|
1 | 1 | --- |
2 | 2 | name: forge-core-workflow |
3 | | -description: Quick reference for correct forge-core development workflow using make dev-core |
| 3 | +description: Quick reference for fully automatic forge-core development workflow |
4 | 4 | maturity: stable |
5 | 5 | load_priority: high |
6 | 6 | --- |
7 | 7 |
|
8 | 8 | # forge-core Development Workflow |
9 | 9 |
|
10 | | -**CRITICAL:** NEVER work directly in forge-core repository. ALWAYS use `make dev-core` from automagik-forge. |
| 10 | +**CRITICAL:** ONLY command you need to know: `make dev-core`. Everything else is automatic. |
11 | 11 |
|
12 | | -## Pre-Flight Checklist |
| 12 | +## The 3-Step Workflow |
13 | 13 |
|
14 | | -Before ANY forge-core work, ask yourself: |
| 14 | +```bash |
| 15 | +# 1. Start dev-core mode |
| 16 | +make dev-core BRANCH=feat/my-feature |
| 17 | + |
| 18 | +# 2. Edit files + commit (from forge root!) |
| 19 | +# Edit files in both repos as needed |
| 20 | +git add . && git commit -m "feat: your changes" |
| 21 | +# → Hooks auto-commit forge-core with same message |
| 22 | + |
| 23 | +# 3. Push (FULLY AUTOMATIC!) |
| 24 | +git push |
| 25 | +# → Hooks auto-push forge-core |
| 26 | +# → Hooks auto-disable patches |
| 27 | +# → Hooks auto-regenerate Cargo.lock |
| 28 | +# → Hooks auto-amend commit |
| 29 | +# → Push proceeds! |
| 30 | +``` |
15 | 31 |
|
16 | | -1. ❓ Am I in automagik-forge directory? → `pwd` should show `.../automagik-forge` |
17 | | -2. ❓ Do I have a feature branch in automagik-forge? → `git branch --show-current` |
18 | | -3. ❓ Is dev-core mode enabled? → `make status` should show "Dev-core: ACTIVE" |
| 32 | +**That's it.** No `make dev-core-off`. No `make push-both`. Just push. |
19 | 33 |
|
20 | | -If ANY answer is NO → STOP and follow correct workflow below. |
| 34 | +## What Happens Automatically |
21 | 35 |
|
22 | | -## Correct Workflow (Step-by-Step) |
| 36 | +### On `git commit` (from forge root): |
| 37 | +1. `pre-commit` hook stages all forge-core changes |
| 38 | +2. `prepare-commit-msg` hook commits forge-core with same message |
| 39 | +3. Both repos have identical commits |
23 | 40 |
|
24 | | -```bash |
25 | | -# 1. Start from automagik-forge |
26 | | -cd /home/namastex/workspace/automagik-forge |
| 41 | +### On `git push` (from forge root): |
| 42 | +1. `pre-push` hook pushes forge-core first (if has unpushed commits) |
| 43 | +2. `pre-push` hook disables Cargo [patch] overrides |
| 44 | +3. `pre-push` hook regenerates Cargo.lock with git deps |
| 45 | +4. `pre-push` hook amends commit with config changes |
| 46 | +5. Push proceeds to origin |
27 | 47 |
|
28 | | -# 2. Create feature branch in automagik-forge |
29 | | -git checkout -b feat/my-feature-name |
| 48 | +## Forbidden Actions |
30 | 49 |
|
31 | | -# 3. Enable dev-core mode (auto-syncs forge-core to same branch) |
32 | | -make dev-core |
| 50 | +- ❌ `cd forge-core && git commit` - BLOCKED by hook |
| 51 | +- ❌ `cd forge-core && git push` - BLOCKED by hook |
| 52 | +- ❌ Any git commands inside forge-core directory |
33 | 53 |
|
34 | | -# 4. Verify dev-core is active |
35 | | -make status |
36 | | -# Expected output: |
37 | | -# Dev-core: ACTIVE (Cargo [patch]) |
38 | | -# forge-core: On branch: feat/my-feature-name |
39 | | -# Ready to push: NO (dev-core active, use dev-core-off first) |
40 | | - |
41 | | -# 5. Edit forge-core files (changes hot-reload via Cargo [patch]) |
42 | | -# Use your editor to modify files in forge-core/ subdirectory |
| 54 | +## Pre-Flight Checklist |
43 | 55 |
|
44 | | -# 6. Test changes |
45 | | -cargo build # Builds with local forge-core via [patch] |
46 | | -cargo test # Tests with local forge-core |
| 56 | +Before ANY forge-core work: |
47 | 57 |
|
48 | | -# 7. Push forge-core changes and create PR |
49 | | -cd forge-core |
50 | | -git add . |
51 | | -git commit -m "feat: your feature description" |
52 | | -git push origin feat/my-feature-name |
53 | | -gh pr create --title "feat: your feature" --body "Description" |
54 | | -cd .. |
55 | | - |
56 | | -# 8. Wait for forge-core PR to merge |
57 | | -# Automation will create tag and dispatch to automagik-forge |
58 | | - |
59 | | -# 9. Disable dev-core mode |
60 | | -make dev-core-off |
61 | | - |
62 | | -# 10. Verify clean state |
63 | | -make status |
64 | | -# Expected output: |
65 | | -# Dev-core: INACTIVE |
66 | | -# forge-core: Directory removed |
67 | | -# Ready to push: YES |
68 | | -``` |
| 58 | +1. ❓ Am I in automagik-forge directory? → `pwd` should show `.../forge` |
| 59 | +2. ❓ Is dev-core mode enabled? → `make status` shows "Dev-core: ACTIVE" |
| 60 | +3. ❓ Do I have a feature branch? → `git branch --show-current` |
69 | 61 |
|
70 | 62 | ## What `make dev-core` Does |
71 | 63 |
|
72 | | -1. **Clones forge-core** to `./forge-core/` subdirectory (if not exists) |
73 | | -2. **Syncs to your branch** - checks out same branch as automagik-forge (creates if doesn't exist) |
74 | | -3. **Enables Cargo [patch]** - modifies `.cargo/config.toml` to redirect git dependencies to local paths |
75 | | -4. **Regenerates Cargo.lock** - updates lockfile to use local paths |
76 | | -5. **Installs pre-push hook** - blocks accidental pushes from automagik-forge while dev-core active |
| 64 | +1. **Clones forge-core** to `./forge-core/` (if not exists) |
| 65 | +2. **Syncs to your branch** - same branch as automagik-forge |
| 66 | +3. **Enables Cargo [patch]** - redirects git deps to local paths |
| 67 | +4. **Regenerates Cargo.lock** - uses local paths |
| 68 | +5. **Installs hooks** - pre-commit, prepare-commit-msg, pre-push |
77 | 69 |
|
78 | 70 | ## Common Pitfalls |
79 | 71 |
|
80 | | -### ❌ WRONG: Creating branch directly in forge-core |
| 72 | +### ❌ WRONG: Working directly in forge-core |
81 | 73 | ```bash |
82 | 74 | cd forge-core |
83 | | -git checkout -b feat/my-feature # ❌ BYPASSES AUTOMATION |
84 | | -gh pr create # ❌ BREAKS VERSION SYNC |
| 75 | +git commit # ❌ BLOCKED |
| 76 | +git push # ❌ BLOCKED |
85 | 77 | ``` |
86 | 78 |
|
87 | | -**Why wrong:** forge-core PRs bypass the automation chain that syncs versions between repos. |
88 | | - |
89 | | -### ❌ WRONG: Working in standalone forge-core clone |
| 79 | +### ✅ CORRECT: All operations from forge root |
90 | 80 | ```bash |
91 | | -cd ~/workspace/forge-core # ❌ STANDALONE CLONE |
92 | | -git checkout -b feat/my-feature # ❌ NOT INTEGRATED |
| 81 | +cd /path/to/forge # ✅ ALWAYS from root |
| 82 | +git add . && git commit # ✅ Hooks sync forge-core |
| 83 | +git push # ✅ Hooks handle everything |
93 | 84 | ``` |
94 | 85 |
|
95 | | -**Why wrong:** Changes won't hot-reload in automagik-forge, can't test integration. |
96 | | - |
97 | | -### ✅ CORRECT: Using make dev-core workflow |
98 | | -```bash |
99 | | -cd ~/workspace/automagik-forge # ✅ START FROM automagik-forge |
100 | | -git checkout -b feat/my-feature # ✅ BRANCH IN automagik-forge FIRST |
101 | | -make dev-core # ✅ AUTO-SYNCS forge-core |
102 | | -``` |
103 | | - |
104 | | -**Why correct:** Automation handles branch sync, Cargo [patch] enables hot reload, version sync preserved. |
105 | | - |
106 | | -## Why This Workflow Matters |
107 | | - |
108 | | -### CI/CD Pipeline |
109 | | -- automagik-forge PR (labeled 'rc') → triggers `auto-version-bump.yml` |
110 | | -- auto-version-bump → bumps version → creates commit + tag |
111 | | -- GitHub Actions → `repository_dispatch` to forge-core |
112 | | -- forge-core `pre-release.yml` → creates release |
113 | | - |
114 | | -**If you bypass this:** Versions desync, releases break, automation fails. |
115 | | - |
116 | | -### Integration Testing |
117 | | -- automagik-forge tests run against forge-core via git dependency |
118 | | -- `make dev-core` redirects to local path via Cargo [patch] |
119 | | -- Changes hot-reload without waiting for PR merge |
120 | | -- Test integration before creating PR |
121 | | - |
122 | | -**If you bypass this:** Can't test integration, PRs may break production. |
123 | | - |
124 | | -### Version Synchronization |
125 | | -- Both repos must maintain identical version numbers |
126 | | -- Automation ensures atomic version bumps across repos |
127 | | -- Direct forge-core PRs can bump version independently |
128 | | -- Version mismatch breaks dependency resolution |
129 | | - |
130 | | -**If you bypass this:** Cargo can't resolve dependencies, builds fail. |
131 | | - |
132 | | -## Emergency Recovery |
133 | | - |
134 | | -If you accidentally worked directly in forge-core: |
135 | | - |
136 | | -1. **Stop immediately** - don't create more commits |
137 | | -2. **Close any forge-core PRs** - `gh pr close PR_NUMBER` in forge-core |
138 | | -3. **Return to automagik-forge** - `cd ~/workspace/automagik-forge` |
139 | | -4. **Clean up** - `make dev-core-off && rm -rf forge-core` |
140 | | -5. **Start over** - follow correct workflow above |
141 | | - |
142 | | -## Key Files Reference |
143 | | - |
144 | | -- `Makefile` (lines 706-815) - dev-core lifecycle implementation |
145 | | -- `.cargo/config.toml` (lines 21-33) - [patch] section |
146 | | -- `docs/DUAL_REPO_WORKFLOW.md` - Complete workflow documentation |
147 | | -- `AGENTS.md` (Amendment #11) - Framework rule documentation |
148 | | - |
149 | | -## Documented Violations |
150 | | - |
151 | | -**2025-12-05: Direct forge-core PR violation** |
152 | | -- Created branch `feat/rmcp-0.10.0-upgrade` directly in forge-core |
153 | | -- Pushed PR #23 directly to forge-core (bypassed automation) |
154 | | -- Merged PR #26 directly, caused version desync (0.8.8-rc.2 vs 0.8.6-rc.2) |
155 | | -- Had to manually revert 5 commits and fix version sync |
156 | | -- **Total violations in one session:** 5 times |
| 86 | +## Key Files |
157 | 87 |
|
158 | | -**Lesson learned:** The automation exists for a reason. Use it. |
| 88 | +- `scripts/hooks/pre-commit` - Auto-stages forge-core changes |
| 89 | +- `scripts/hooks/prepare-commit-msg` - Auto-commits forge-core |
| 90 | +- `scripts/hooks/pre-push` - Auto-push + auto-disable patches |
| 91 | +- `docs/DUAL_REPO_WORKFLOW.md` - Complete documentation |
| 92 | +- `AGENTS.md` (Amendment #11) - Framework rule |
0 commit comments