We are standardizing our release workflow to prevent "bad" commits from reaching production and to automate version tagging. This task involves implementing a client-side verification model where every release is verified before tagging, and production deployments are gated by these tags.
This implementation covers three key areas:
- Release Automation: Standardizing version bumps (patch/minor/major).
- Local Safety: A git hook to prevent modifying source code without updating the verification proof.
- Production Safety: A deployment check to ensure only tagged releases are deployed.
Assignee: @[Developer Name]
Priority: High
Related Issues: #470, #471
📋 Tasks
💻 Implementation Details
1. package.json Updates
Add the following scripts to the scripts section:
"scripts": {
// ... existing scripts
"verify": "ts-node scripts/verify-and-publish.ts",
"commit:verified": "npm run verify && git add test-proof.json && git commit",
"release:patch": "npm run verify && npm version patch && git push --follow-tags",
"release:minor": "npm run verify && npm version minor && git push --follow-tags",
"release:major": "npm run verify && npm version major && git push --follow-tags"
}
2. Git Hook (.git/hooks/pre-commit)
Create this file and ensure it is executable (chmod +x .git/hooks/pre-commit).
#!/bin/bash
# .git/hooks/pre-commit
# 1. Check if we are modifying source code
STAGED_SRC=$(git diff --cached --name-only | grep -E "^(app|components|lib|hooks|services|tests|server.ts)/")
if [ -n "$STAGED_SRC" ]; then
# 2. Check if test-proof.json is ALSO staged
STAGED_PROOF=$(git diff --cached --name-only | grep "test-proof.json")
if [ -z "$STAGED_PROOF" ]; then
echo "⛔️ STOP! You are modifying source code but 'test-proof.json' is not updated."
echo " The CI Integrity Guard will reject this commit."
echo ""
echo "👉 Solution: Run 'npm run commit:verified' instead of 'git commit'."
exit 1
fi
fi
3. Deployment Safety (deploy.sh)
Insert this block at the top of deploy.sh (after set -e):
# --- SAFETY CHECK ---
git fetch --tags
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "none")
CURRENT_VER=$(node -p "require('./package.json').version")
if [[ "v$CURRENT_VER" != "$LATEST_TAG" ]]; then
echo "⚠️ WARNING: Mismatch detected! Version: v$CURRENT_VER, Tag: $LATEST_TAG"
echo " You are deploying untagged code."
read -p " Are you sure you want to continue? (y/n) " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo "❌ Deployment cancelled."
exit 1
fi
fi
4. Documentation
TESTING.md: Add a "Release Verification" section explaining npm run commit:verified.
DEVELOPMENT.md: Update "Current Workflow" to reflect that direct commits should be avoided in favor of verified commits.
✅ Acceptance Criteria
- Running
npm run release:patch successfully runs tests, bumps the version, and pushes tags.
- Trying to
git commit changes to server.ts without running the verifier is blocked by the hook.
- Running
deploy.sh on a version that hasn't been tagged triggers a warning prompt.
We are standardizing our release workflow to prevent "bad" commits from reaching production and to automate version tagging. This task involves implementing a client-side verification model where every release is verified before tagging, and production deployments are gated by these tags.
This implementation covers three key areas:
Assignee: @[Developer Name]
Priority: High
Related Issues: #470, #471
📋 Tasks
package.jsonverify,commit:verified, andrelease:*scripts to standardize the workflow..git/hooks/pre-committo block commits that touch source code but fail to updatetest-proof.json.deploy.shpackage.jsonversion matches the latest Git tag.TESTING.mdwith the new verification workflow.DEVELOPMENT.mdwith new action items and workflow notes.💻 Implementation Details
1.
package.jsonUpdatesAdd the following scripts to the
scriptssection:2. Git Hook (
.git/hooks/pre-commit)Create this file and ensure it is executable (
chmod +x .git/hooks/pre-commit).3. Deployment Safety (
deploy.sh)Insert this block at the top of
deploy.sh(afterset -e):4. Documentation
TESTING.md: Add a "Release Verification" section explainingnpm run commit:verified.DEVELOPMENT.md: Update "Current Workflow" to reflect that direct commits should be avoided in favor of verified commits.✅ Acceptance Criteria
npm run release:patchsuccessfully runs tests, bumps the version, and pushes tags.git commitchanges toserver.tswithout running the verifier is blocked by the hook.deploy.shon a version that hasn't been tagged triggers a warning prompt.