Mandatory verification gate that must be executed before any push to shared repositories
Performs an 8-point validation covering repository state, branch verification, remote synchronization, scope validation, force-push detection, structure integrity, changelog awareness, and pre-push backup. Returns an explicit GO, CONDITIONAL GO, or NO-GO verdict. Push proceeds only on GO.
Monorepo Pre-Push Gate
TL;DR
How To Start
STEP 1Provide Push Context
-
monorepo_path
· string · required
Path to the cloned monorepo root. -
project_id
· string · required
Must match MONOREPO_ROLE=MASTER. Non-MASTER projects should not execute this recipe. -
session_id
· string · required
Current session ID for snapshot tagging. -
project_folder_prefix
· string · optional · default: projects/CFT-PROJ-{project_id}
Expected folder prefix for scope validation. -
push_command
· string · optional · default: git push origin main
The intended push command (inspected for force flags). -
skip_snapshot
· boolean · optional · default: false
Skip CWK-037 snapshot (only valid if snapshot was just taken).
Usage Examples
EXAMPLE 1Clean pre-push gate pass
EXAMPLE 2Gate with scope violation
EXAMPLE 3Conditional pass with warnings
How AI Reads This Recipe
- Check 1: Repository Verification. Verify monorepo_path exists and is a valid git repository (.git directory present). Fail immediately if not.
- Check 2: Branch State. Verify current branch is main. Fail on detached HEAD or any non-main branch.
- Check 3: Pull-Before-Push. Run git fetch origin. If behind origin/main, merge. Fail on merge conflicts. Warn (do not fail) if fetch fails due to sandbox network issues.
- Check 4: Scope Validation. Compare changed files (git diff –name-only origin/main…HEAD) against allowed prefixes. All changes must be within the MASTER project’s folder or authorized shared root files (changelog, recipe index). Fail on any out-of-scope files.
- Check 5: Force-Push Detection. Inspect push_command for –force, -f, or –force-with-lease flags. Fail if any force flag is detected.
- Check 6: Structure Integrity. Verify projects/ and specs/ directories exist. Count project folders and spec files. Fail if either directory is missing.
- Check 7: Changelog Read. Display recent changelog entries for awareness. Warn if changelog file is missing.
- Check 8: Pre-Push Snapshot. Call CWK-037 to create a git bundle backup. Warn (do not fail) if snapshot creation fails. Skip if skip_snapshot flag is set.
- Verdict. Count PASS, WARN, FAIL results. Any FAIL → NO-GO. All PASS → GO. Warnings only → CONDITIONAL GO (requires human confirmation). Post-gate: remind to update changelog after pushing.
When To Use This Recipe
Recipe FAQ
Why is this recipe marked LEGACY?
What is the difference between GO, CONDITIONAL GO, and NO-GO?
Can I skip individual checks?
What happens if Check 4 (scope) fails?
Does this recipe actually execute the push?
Version History
Get this recipe with CRAFT for Claude Cowork
Cowork recipes ship bundled with CRAFT for Claude Cowork — there’s no separate download. Clone the framework once, and your AI runs every recipe automatically when invoked.
Pull anytime to stay on the latest version — free to clone, no login or email required.
Then start your session
Once CRAFT is in your project folder, open a new Cowork session and ask Claude to initialize. For example:
You
Claude
Not familiar with Git? Download as a ZIP
No command line needed. Just download, move, and unzip:
- Open the CRAFT framework repo on GitHub.
- Click the green Code button, then choose Download ZIP.
- Move the downloaded ZIP into your Claude Cowork project folder.
- Unzip it: double-click on Mac, or right-click → Extract All on Windows.
