Skip to content

[ENHANCEMENT] Improve build script and pre-commit hook #2

@pablopda

Description

@pablopda

name: Build Process Improvements
about: Document and improve the build/compilation workflow
title: '[BUILD] Improve build process and automation'
labels: enhancement, build, documentation
assignees: ''

Current State

clsecure uses a hybrid development/distribution model:

  • Development: Modular source (clsecure-src + lib/*.sh)
  • Distribution: Single-file clsecure (generated by build.sh)

Current Workflow

  1. Edit modules (clsecure-src, lib/*.sh)
  2. Run ./build.sh to generate clsecure
  3. Pre-commit hook verifies build consistency
  4. Commit both source and built files

Current Automation

  • ✅ Pre-commit hook: Auto-rebuilds and verifies consistency
  • ✅ Build script: Concatenates modules into single file
  • ⚠️ Manual step: Must rebuild before committing

Proposed Improvements

Option 1: Enhanced Pre-commit Hook

  • Make pre-commit hook automatically stage clsecure after rebuild
  • Add better error messages with diff preview
  • Support --no-verify bypass with warning

Option 2: CI/CD Integration

  • Set up GitHub Actions to build on push
  • Create release workflow that builds and tags
  • Add build verification in PR checks
  • Generate release artifacts automatically

Option 3: Build Script Enhancements

  • Add --dry-run flag to preview changes
  • Add --verify flag to check consistency without rebuilding
  • Add version/commit hash to built file header
  • Add build timestamp to built file

Option 4: Documentation

  • Add .gitattributes to mark clsecure as generated
  • Create CONTRIBUTING.md with build instructions
  • Document build process in README
  • Add troubleshooting guide for build issues

Option 5: Alternative Workflows

  • Consider building only on release (cleaner git history)
  • Consider CI/CD-only builds (no built file in repo)
  • Add make targets for common build tasks

Implementation Priority

  1. High: CI/CD integration (automated builds)
  2. Medium: Build script enhancements (better UX)
  3. Low: Alternative workflows (exploration)

Acceptance Criteria

  • Build process is fully documented
  • Build automation reduces manual steps
  • CI/CD verifies builds automatically
  • Contributors understand the workflow
  • Release process is streamlined

Related Files

  • build.sh - Build script
  • .git/hooks/pre-commit - Pre-commit hook
  • BUILD-WORKFLOW.md - Build workflow documentation
  • .github/workflows/test.yml - CI/CD workflow (if exists)

Notes

  • Current approach works but requires manual rebuild step
  • Pre-commit hook helps but doesn't auto-stage changes
  • CI/CD would eliminate need for built file in repository
  • Consider semantic versioning for releases

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions