Skip to content

Commit 506fa8e

Browse files
authored
Merge pull request #323 from automagik-dev/main
dev
2 parents f05ac8f + 5a62207 commit 506fa8e

57 files changed

Lines changed: 1134 additions & 5490 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.cargo/config.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ rustflags = ["-C", "link-arg=/DEBUG:FASTLINK"]
1818
rustflags = ["-C", "link-arg=-Wl,-z,max-page-size=16384"]
1919

2020
# ============================================================================
21-
# DEV-CORE PATCHES - TEMPORARILY DISABLED
22-
# This section is managed by `make dev-core` and `make dev-core-off`
21+
# DEV-CORE PATCHES - ENABLED
22+
# This section is managed by `make dev-core` (auto-disabled by pre-push hook)
2323
# When uncommented, Cargo uses local forge-core paths instead of crates.io
2424
# ============================================================================
2525
# [patch.crates-io]

.claude/settings.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"enabledPlugins": {
3+
"pr-review-toolkit@claude-code-plugins": true
4+
}
5+
}
Lines changed: 59 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -1,158 +1,92 @@
11
---
22
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
44
maturity: stable
55
load_priority: high
66
---
77

88
# forge-core Development Workflow
99

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.
1111

12-
## Pre-Flight Checklist
12+
## The 3-Step Workflow
1313

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+
```
1531

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.
1933

20-
If ANY answer is NO → STOP and follow correct workflow below.
34+
## What Happens Automatically
2135

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
2340

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
2747

28-
# 2. Create feature branch in automagik-forge
29-
git checkout -b feat/my-feature-name
48+
## Forbidden Actions
3049

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
3353

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
4355

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:
4757

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`
6961

7062
## What `make dev-core` Does
7163

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
7769

7870
## Common Pitfalls
7971

80-
### ❌ WRONG: Creating branch directly in forge-core
72+
### ❌ WRONG: Working directly in forge-core
8173
```bash
8274
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
8577
```
8678

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
9080
```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
9384
```
9485

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
15787

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

.github/actions/setup-node/action.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,16 @@ runs:
1010
node-version: ${{ env.NODE_VERSION }}
1111
registry-url: 'https://registry.npmjs.org'
1212

13+
- name: Clean pnpm cache (self-hosted runner fix)
14+
shell: bash
15+
run: |
16+
rm -rf ~/setup-pnpm $HOME/setup-pnpm 2>/dev/null || true
17+
1318
- name: Setup pnpm
1419
uses: pnpm/action-setup@v4
1520
with:
16-
version: ${{ env.PNPM_VERSION }}
21+
standalone: true
22+
dest: ~/setup-pnpm
1723

1824
- name: Get pnpm store directory
1925
shell: bash

.github/workflows/build-all-platforms.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ jobs:
8383
uses: actions/cache/restore@v4
8484
with:
8585
path: npx-cli/dist/${{ matrix.platform }}
86-
key: binaries-${{ matrix.platform }}-${{ matrix.target }}-${{ runner.os }}${{ env.ZIG_SUFFIX }}-${{ hashFiles('pnpm-lock.yaml', 'Cargo.lock', '**/Cargo.toml', 'forge-app/**/*.rs', 'forge-app/build.rs', 'forge-extensions/**/*.rs', 'upstream/crates/**/*.rs', 'upstream/crates/**/Cargo.toml', 'shared/**/*.ts', 'frontend/src/**', 'frontend/public/**', 'frontend/index.html', 'frontend/vite.config.ts', 'frontend/tailwind.config.js', 'frontend/postcss.config.js', 'frontend/tsconfig*.json', 'frontend/package.json') }}
86+
key: binaries-${{ matrix.platform }}-${{ matrix.target }}-${{ runner.os }}${{ env.ZIG_SUFFIX }}-${{ hashFiles('pnpm-lock.yaml', 'Cargo.lock', '**/Cargo.toml', 'forge-app/**/*.rs', 'forge-app/build.rs', 'upstream/crates/**/*.rs', 'upstream/crates/**/Cargo.toml', 'shared/**/*.ts', 'frontend/src/**', 'frontend/public/**', 'frontend/index.html', 'frontend/vite.config.ts', 'frontend/tailwind.config.js', 'frontend/postcss.config.js', 'frontend/tsconfig*.json', 'frontend/package.json') }}
8787

8888
- name: Check if build can be skipped
8989
id: check-skip
@@ -374,7 +374,7 @@ jobs:
374374
uses: actions/cache/save@v4
375375
with:
376376
path: npx-cli/dist/${{ matrix.platform }}
377-
key: binaries-${{ matrix.platform }}-${{ matrix.target }}-${{ runner.os }}${{ env.ZIG_SUFFIX }}-${{ hashFiles('pnpm-lock.yaml', 'Cargo.lock', '**/Cargo.toml', 'forge-app/**/*.rs', 'forge-app/build.rs', 'forge-extensions/**/*.rs', 'upstream/crates/**/*.rs', 'upstream/crates/**/Cargo.toml', 'shared/**/*.ts', 'frontend/src/**', 'frontend/public/**', 'frontend/index.html', 'frontend/vite.config.ts', 'frontend/tailwind.config.js', 'frontend/postcss.config.js', 'frontend/tsconfig*.json', 'frontend/package.json') }}
377+
key: binaries-${{ matrix.platform }}-${{ matrix.target }}-${{ runner.os }}${{ env.ZIG_SUFFIX }}-${{ hashFiles('pnpm-lock.yaml', 'Cargo.lock', '**/Cargo.toml', 'forge-app/**/*.rs', 'forge-app/build.rs', 'upstream/crates/**/*.rs', 'upstream/crates/**/Cargo.toml', 'shared/**/*.ts', 'frontend/src/**', 'frontend/public/**', 'frontend/index.html', 'frontend/vite.config.ts', 'frontend/tailwind.config.js', 'frontend/postcss.config.js', 'frontend/tsconfig*.json', 'frontend/package.json') }}
378378

379379
- name: Upload artifacts
380380
uses: actions/upload-artifact@v4
@@ -423,25 +423,25 @@ jobs:
423423
uses: actions/cache/restore@v4
424424
with:
425425
path: npx-cli/dist/linux-x64
426-
key: binaries-linux-x64-x86_64-unknown-linux-gnu-Linux-${{ hashFiles('pnpm-lock.yaml', 'Cargo.lock', '**/Cargo.toml', 'forge-app/**/*.rs', 'forge-app/build.rs', 'forge-extensions/**/*.rs', 'upstream/crates/**/*.rs', 'upstream/crates/**/Cargo.toml', 'shared/**/*.ts', 'frontend/src/**', 'frontend/public/**', 'frontend/index.html', 'frontend/vite.config.ts', 'frontend/tailwind.config.js', 'frontend/postcss.config.js', 'frontend/tsconfig*.json', 'frontend/package.json') }}
426+
key: binaries-linux-x64-x86_64-unknown-linux-gnu-Linux-${{ hashFiles('pnpm-lock.yaml', 'Cargo.lock', '**/Cargo.toml', 'forge-app/**/*.rs', 'forge-app/build.rs', 'upstream/crates/**/*.rs', 'upstream/crates/**/Cargo.toml', 'shared/**/*.ts', 'frontend/src/**', 'frontend/public/**', 'frontend/index.html', 'frontend/vite.config.ts', 'frontend/tailwind.config.js', 'frontend/postcss.config.js', 'frontend/tsconfig*.json', 'frontend/package.json') }}
427427

428428
- name: Restore linux-arm64 cache
429429
uses: actions/cache/restore@v4
430430
with:
431431
path: npx-cli/dist/linux-arm64
432-
key: binaries-linux-arm64-aarch64-unknown-linux-gnu-Linux-zig-0.13.0-${{ hashFiles('pnpm-lock.yaml', 'Cargo.lock', '**/Cargo.toml', 'forge-app/**/*.rs', 'forge-app/build.rs', 'forge-extensions/**/*.rs', 'upstream/crates/**/*.rs', 'upstream/crates/**/Cargo.toml', 'shared/**/*.ts', 'frontend/src/**', 'frontend/public/**', 'frontend/index.html', 'frontend/vite.config.ts', 'frontend/tailwind.config.js', 'frontend/postcss.config.js', 'frontend/tsconfig*.json', 'frontend/package.json') }}
432+
key: binaries-linux-arm64-aarch64-unknown-linux-gnu-Linux-zig-0.13.0-${{ hashFiles('pnpm-lock.yaml', 'Cargo.lock', '**/Cargo.toml', 'forge-app/**/*.rs', 'forge-app/build.rs', 'upstream/crates/**/*.rs', 'upstream/crates/**/Cargo.toml', 'shared/**/*.ts', 'frontend/src/**', 'frontend/public/**', 'frontend/index.html', 'frontend/vite.config.ts', 'frontend/tailwind.config.js', 'frontend/postcss.config.js', 'frontend/tsconfig*.json', 'frontend/package.json') }}
433433

434434
- name: Restore windows-x64 cache
435435
uses: actions/cache/restore@v4
436436
with:
437437
path: npx-cli/dist/windows-x64
438-
key: binaries-windows-x64-x86_64-pc-windows-msvc-Windows-${{ hashFiles('pnpm-lock.yaml', 'Cargo.lock', '**/Cargo.toml', 'forge-app/**/*.rs', 'forge-app/build.rs', 'forge-extensions/**/*.rs', 'upstream/crates/**/*.rs', 'upstream/crates/**/Cargo.toml', 'shared/**/*.ts', 'frontend/src/**', 'frontend/public/**', 'frontend/index.html', 'frontend/vite.config.ts', 'frontend/tailwind.config.js', 'frontend/postcss.config.js', 'frontend/tsconfig*.json', 'frontend/package.json') }}
438+
key: binaries-windows-x64-x86_64-pc-windows-msvc-Windows-${{ hashFiles('pnpm-lock.yaml', 'Cargo.lock', '**/Cargo.toml', 'forge-app/**/*.rs', 'forge-app/build.rs', 'upstream/crates/**/*.rs', 'upstream/crates/**/Cargo.toml', 'shared/**/*.ts', 'frontend/src/**', 'frontend/public/**', 'frontend/index.html', 'frontend/vite.config.ts', 'frontend/tailwind.config.js', 'frontend/postcss.config.js', 'frontend/tsconfig*.json', 'frontend/package.json') }}
439439

440440
- name: Restore macos-arm64 cache
441441
uses: actions/cache/restore@v4
442442
with:
443443
path: npx-cli/dist/macos-arm64
444-
key: binaries-macos-arm64-aarch64-apple-darwin-macOS-${{ hashFiles('pnpm-lock.yaml', 'Cargo.lock', '**/Cargo.toml', 'forge-app/**/*.rs', 'forge-app/build.rs', 'forge-extensions/**/*.rs', 'upstream/crates/**/*.rs', 'upstream/crates/**/Cargo.toml', 'shared/**/*.ts', 'frontend/src/**', 'frontend/public/**', 'frontend/index.html', 'frontend/vite.config.ts', 'frontend/tailwind.config.js', 'frontend/postcss.config.js', 'frontend/tsconfig*.json', 'frontend/package.json') }}
444+
key: binaries-macos-arm64-aarch64-apple-darwin-macOS-${{ hashFiles('pnpm-lock.yaml', 'Cargo.lock', '**/Cargo.toml', 'forge-app/**/*.rs', 'forge-app/build.rs', 'upstream/crates/**/*.rs', 'upstream/crates/**/Cargo.toml', 'shared/**/*.ts', 'frontend/src/**', 'frontend/public/**', 'frontend/index.html', 'frontend/vite.config.ts', 'frontend/tailwind.config.js', 'frontend/postcss.config.js', 'frontend/tsconfig*.json', 'frontend/package.json') }}
445445

446446
- name: Download all artifacts
447447
uses: actions/download-artifact@v4

.github/workflows/playwright-e2e.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,14 @@ jobs:
2525
run: |
2626
rm -rf "$GITHUB_WORKSPACE"/* "$GITHUB_WORKSPACE"/.[!.]* 2>/dev/null || true
2727
rm -f .git/index.lock 2>/dev/null || true
28+
# Clean pnpm setup directory (self-hosted runner cruft)
29+
rm -rf ~/setup-pnpm 2>/dev/null || true
30+
# Kill any leftover processes on test port (8887 backend serves frontend in CI)
31+
fuser -k 8887/tcp 2>/dev/null || true
2832
2933
- uses: actions/checkout@v4
3034

31-
- name: Cache cargo
32-
uses: actions/cache@v4
33-
with:
34-
path: |
35-
~/.cargo/registry
36-
~/.cargo/git
37-
target
38-
key: cargo-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}
39-
restore-keys: cargo-${{ runner.os }}-
35+
# Note: No cargo cache needed - self-hosted runner persists ~/.cargo and target/
4036

4137
- name: Setup Node
4238
uses: ./.github/actions/setup-node

0 commit comments

Comments
 (0)