forgedock 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/README.md +8 -2
  2. package/bin/engine/phases.mjs +178 -28
  3. package/bin/engine/state.mjs +39 -7
  4. package/bin/engine-cli.mjs +63 -2
  5. package/bin/engine.mjs +25 -4
  6. package/bin/forgedock.mjs +235 -4
  7. package/bin/hooks/pre-tool-use.mjs +26 -12
  8. package/bin/journey.mjs +103 -11
  9. package/commands/forge-stats.md +5 -4
  10. package/commands/issue.md +5 -1
  11. package/commands/orchestrate/phase-4-execution.md +2 -0
  12. package/commands/qa-sweep.md +17 -0
  13. package/commands/replay.md +16 -2
  14. package/commands/review-pr-agents/spec-cli.md +179 -0
  15. package/commands/review-pr.md +49 -0
  16. package/commands/upgrade-deps.md +518 -0
  17. package/commands/work-on/build/validate.md +61 -1
  18. package/commands/work-on/build.md +9 -1
  19. package/commands/work-on/decompose.md +8 -1
  20. package/docs/AIDER.md +264 -0
  21. package/docs/AUTOPILOT-CRON.md +130 -0
  22. package/docs/CONFIG.md +36 -0
  23. package/docs/CURSOR.md +135 -0
  24. package/docs/OPENCODE.md +312 -0
  25. package/docs/demo.gif +0 -0
  26. package/docs/eval/README.md +4 -4
  27. package/docs/launch/show-hn.md +3 -3
  28. package/docs/site/architecture.md +180 -0
  29. package/docs/site/command-reference.md +17 -0
  30. package/docs/site/configuration.md +243 -0
  31. package/docs/site/for-companies.md +4 -4
  32. package/docs/site/forge-annotation-protocol.md +1 -1
  33. package/docs/site/github-is-the-memory.md +2 -2
  34. package/docs/site/how-it-works.md +1 -1
  35. package/docs/site/public/llms-full.txt +380 -0
  36. package/docs/site/public/llms.txt +35 -0
  37. package/docs/spec-graph-schema.md +3 -3
  38. package/package.json +2 -2
  39. package/packages/protocol/README.md +75 -0
  40. package/packages/protocol/src/card.js +114 -0
  41. package/packages/protocol/src/cli.js +4 -77
  42. package/packages/protocol/src/emit.js +14 -3
  43. package/packages/protocol/src/index.js +2 -1
  44. package/packages/protocol/src/parse.js +17 -8
  45. package/packages/protocol/src/types.js +1 -1
  46. package/packages/protocol/src/validate.js +11 -0
  47. package/scripts/check-command-side-effects.sh +261 -0
  48. package/scripts/check-spec-markers.sh +273 -0
  49. package/scripts/classify-lane.sh +29 -7
  50. package/scripts/forge-run.sh +322 -0
  51. package/templates/cross-repo-trigger.yml +282 -0
  52. package/templates/cursor/forge.mdc +148 -0
  53. package/templates/github-actions/forgedock-autopilot.yml +113 -0
package/docs/AIDER.md ADDED
@@ -0,0 +1,264 @@
1
+ # Aider Support
2
+
3
+ ForgeDock has an additive Aider-native install path. The goal is to give Aider
4
+ users access to the ForgeDock pipeline without regressing the existing Claude
5
+ Code or Codex setups.
6
+
7
+ ## Architecture
8
+
9
+ Shared source:
10
+ - `commands/**/*.md` remains the workflow spec for all runtimes
11
+
12
+ Claude Code wrapper:
13
+ - `install.sh` (or `npx forgedock`) symlinks command files into `~/.claude/commands/`
14
+
15
+ Codex wrapper:
16
+ - `install-codex.sh` generates namespaced skills in `~/.codex/skills/`
17
+
18
+ **Aider wrapper** (this document):
19
+ - `install-aider.sh` writes `~/.aider-forge.md` — a conventions file Aider
20
+ loads at session start via `--read`
21
+ - The conventions file provides runtime mapping rules and entry point references
22
+ - Aider reads ForgeDock command specs on demand with `/read $FORGE_HOME/commands/x.md`
23
+
24
+ This is intentionally a conventions-file architecture, not a duplicate command
25
+ tree. The shared `commands/` directory remains the single source of truth.
26
+
27
+ ## Install
28
+
29
+ ### Option A — standalone bash installer
30
+
31
+ ```bash
32
+ cd /path/to/forgedock
33
+ ./install-aider.sh
34
+ ```
35
+
36
+ This writes `~/.aider-forge.md` with ForgeDock conventions and runtime mapping
37
+ rules.
38
+
39
+ ### Option B — via npx forgedock
40
+
41
+ If you already use `npx forgedock` for Claude Code:
42
+
43
+ ```bash
44
+ npx forgedock
45
+ ```
46
+
47
+ When `aider` is detected on your PATH, `npx forgedock` writes `~/.aider-forge.md`
48
+ as an additional install step. No existing Claude Code files are affected.
49
+
50
+ ## Usage
51
+
52
+ ### Per-session (command line)
53
+
54
+ ```bash
55
+ aider --read ~/.aider-forge.md
56
+ ```
57
+
58
+ ### Always-on (`.aider.conf.yml`)
59
+
60
+ Add to your project's `.aider.conf.yml`:
61
+
62
+ ```yaml
63
+ read:
64
+ - ~/.aider-forge.md
65
+ ```
66
+
67
+ Or to `~/.aider.conf.yml` for global application across all projects.
68
+
69
+ ### Loading a pipeline command
70
+
71
+ Once Aider has the conventions file loaded, load a command spec on demand:
72
+
73
+ ```
74
+ /read /path/to/forgedock/commands/work-on.md
75
+ ```
76
+
77
+ Then follow the command spec step by step, using `/run` for all shell
78
+ operations.
79
+
80
+ ## Tool Translation Rules
81
+
82
+ ForgeDock command specs reference Claude Code-specific tools. Translate them
83
+ to Aider equivalents:
84
+
85
+ | Claude Code | Aider equivalent | Notes |
86
+ |-------------|-----------------|-------|
87
+ | `Skill("work-on", args="123")` | `/read $FORGE_HOME/commands/work-on.md` | Load the spec and execute it |
88
+ | `Skill("review-pr", args="456")` | `/read $FORGE_HOME/commands/review-pr.md` | Load the spec and execute it |
89
+ | `Skill("quality-gate")` | `/read $FORGE_HOME/commands/quality-gate.md` | Load the spec and execute it |
90
+ | `Bash("git status")` | `/run git status` | Direct shell execution |
91
+ | `Read("path/to/file")` | Read the file directly | Aider's native file read |
92
+ | `Grep(pattern, path)` | `/run rg 'pattern' path` | Use `rg` (ripgrep) |
93
+ | `Glob("**/*.md")` | `/run find . -name "*.md"` | Shell find |
94
+ | `WebFetch(url)` | `/run curl -s url` | curl or wget |
95
+ | `Agent(...)` / `Task(...)` | Continue the sub-task yourself | No sub-agent support; inline it |
96
+ | `EnterWorktree(path)` | `/run cd path` then use `/run` | Work in worktree directory |
97
+
98
+ ### Nested Skill references
99
+
100
+ When a command spec calls `Skill("x")` or references another command:
101
+
102
+ ```
103
+ # Load the referenced command spec manually:
104
+ /read $FORGE_HOME/commands/x.md
105
+ ```
106
+
107
+ Map command names to file paths:
108
+ - `Skill("work-on")` → `commands/work-on.md`
109
+ - `Skill("review-pr")` → `commands/review-pr.md`
110
+ - `Skill("quality-gate")` → `commands/quality-gate.md`
111
+ - `Skill("orchestrate")` → `commands/orchestrate.md`
112
+
113
+ ## GitHub Operations
114
+
115
+ All FORGE annotations are written to GitHub issue/PR comments via the `gh`
116
+ CLI. Use `/run gh ...` for every GitHub operation.
117
+
118
+ ### Label management
119
+
120
+ ```bash
121
+ /run gh issue edit 123 -R OWNER/REPO --add-label "workflow:investigating"
122
+ /run gh issue edit 123 -R OWNER/REPO --remove-label "workflow:investigating"
123
+ ```
124
+
125
+ ### Reading existing annotations
126
+
127
+ ```bash
128
+ /run gh api repos/OWNER/REPO/issues/123/comments \
129
+ --jq '.[] | select(.body | contains("FORGE:INVESTIGATOR")) | .body'
130
+ ```
131
+
132
+ ### Writing a FORGE annotation comment
133
+
134
+ ```bash
135
+ /run gh issue comment 123 -R OWNER/REPO --body "<!-- FORGE:INVESTIGATOR -->
136
+ ## Investigation Report
137
+
138
+ **Verdict**: CONFIRMED
139
+ ...
140
+ <!-- INVESTIGATION:COMPLETE -->"
141
+ ```
142
+
143
+ For multi-line comment bodies, write the content to a temp file first:
144
+
145
+ ```bash
146
+ cat > /tmp/comment.md << 'EOF'
147
+ <!-- FORGE:INVESTIGATOR -->
148
+ ## Investigation Report
149
+ ...
150
+ <!-- INVESTIGATION:COMPLETE -->
151
+ EOF
152
+ /run gh issue comment 123 -R OWNER/REPO --body "$(cat /tmp/comment.md)"
153
+ ```
154
+
155
+ ### Creating a PR
156
+
157
+ ```bash
158
+ /run gh pr create -R OWNER/REPO \
159
+ --base staging \
160
+ --head feat/my-branch-123 \
161
+ --title "feat: description (#123)" \
162
+ --body "$(cat /tmp/pr_body.md)"
163
+ ```
164
+
165
+ ## Worktrees
166
+
167
+ ForgeDock uses git worktrees to isolate branch work. Create one with:
168
+
169
+ ```bash
170
+ /run git fetch origin
171
+ /run git worktree add .claude/worktrees/feat-my-feature-123 \
172
+ -b feat/my-feature-123 origin/staging
173
+ ```
174
+
175
+ Work inside the worktree for all file edits and commits. Aider's `/run`
176
+ commands execute in the worktree directory if you `cd` to it:
177
+
178
+ ```bash
179
+ /run cd /path/to/repo/.claude/worktrees/feat-my-feature-123
180
+ ```
181
+
182
+ Or pass the path explicitly in each command:
183
+
184
+ ```bash
185
+ /run git -C /path/to/repo/.claude/worktrees/feat-my-feature-123 status
186
+ ```
187
+
188
+ ## FORGE Annotation Protocol
189
+
190
+ Every pipeline stage writes a structured annotation to GitHub. Key rules:
191
+
192
+ 1. **Idempotency**: Check for existing annotations BEFORE starting a phase.
193
+ Do not re-run a completed phase.
194
+ 2. **Compaction resilience**: Write annotations AFTER completing each
195
+ significant step. GitHub is the persistent state layer.
196
+ 3. **Restart partial annotations**: If an annotation exists without its
197
+ `:COMPLETE` sentinel, delete it and restart the phase.
198
+ 4. **Respect label state**: Labels track workflow state. Read and set them
199
+ at each phase boundary.
200
+
201
+ ### Label state machine
202
+
203
+ ```
204
+ workflow:investigating
205
+ → workflow:ready-to-build (investigation complete)
206
+ → workflow:building (build started)
207
+ → workflow:in-review (PR created)
208
+ → workflow:merged (PR merged) [TERMINAL]
209
+
210
+ workflow:invalid [TERMINAL]
211
+ workflow:decomposed [TERMINAL]
212
+ needs-human [TERMINAL]
213
+ ```
214
+
215
+ Stop the pipeline when any terminal label is set.
216
+
217
+ ## Feasibility Analysis
218
+
219
+ Aider is the highest-feasibility non-Claude agent for ForgeDock because:
220
+
221
+ | Capability | Requirement | Aider support |
222
+ |-----------|-------------|---------------|
223
+ | Load instruction files | `--read` flag / `.aider.conf.yml` | Native |
224
+ | Execute shell commands | `gh`, `git`, `rg` via shell | `/run` command |
225
+ | Read/write files | File editing | Native |
226
+ | GitHub API | `gh` CLI | Via `/run gh ...` |
227
+ | Multi-step workflows | Follow sequential instructions | Supported |
228
+ | Compaction resilience | Re-read GitHub state at phase start | Supported (via `/run gh ...`) |
229
+
230
+ **Limitation**: Aider has no native sub-agent/parallel task model (`Agent(...)`,
231
+ `Task(...)`). Phase 3 parallel context gathering (`FORGE:CONTEXT`) and
232
+ multi-agent review (`review-pr-agents.md`) must be executed sequentially.
233
+ For the orchestrate command (`/orchestrate`), run one issue at a time or
234
+ use separate Aider sessions per issue.
235
+
236
+ ## Trust and Configuration
237
+
238
+ Aider does not have a project trust model. Once `~/.aider-forge.md` is loaded,
239
+ all operations in that session have access to shell execution via `/run`.
240
+
241
+ **Security note**: ForgeDock's shell operations are limited to `gh`, `git`,
242
+ `rg`, `find`, and standard POSIX tools. The conventions file does not execute
243
+ arbitrary code at load time — it only provides instruction text.
244
+
245
+ ## Usage Notes
246
+
247
+ - Use `--read ~/.aider-forge.md` on every session, or add it to
248
+ `.aider.conf.yml` for automatic loading.
249
+ - Load command specs on demand with `/read $FORGE_HOME/commands/x.md` —
250
+ do not load all commands at once.
251
+ - Keep `CLAUDE.md` and `AGENTS.md` aligned with ForgeDock conventions;
252
+ Aider and Claude Code can differ at the wrapper layer but not on FORGE
253
+ workflow invariants (annotation format, label state machine, branch
254
+ naming, worktree conventions).
255
+ - For pipeline stages that post FORGE annotations, always write the body
256
+ to a temp file before passing to `gh issue comment` to avoid shell
257
+ quoting issues with multi-line content.
258
+
259
+ ## Reference
260
+
261
+ - [FORGE Protocol spec](FORGE-PROTOCOL.md) — annotation format, label state machine, conformance tests
262
+ - [Codex adapter](CODEX.md) — parallel reference for OpenAI Codex CLI
263
+ - [Pipeline commands](../commands/) — shared workflow specs (authoritative for all runtimes)
264
+ - [`install-aider.sh`](../install-aider.sh) — installer script
@@ -0,0 +1,130 @@
1
+ # Autopilot Cron Mode — GitHub Actions Setup
2
+
3
+ Run [`/autopilot`](../commands/autopilot.md) on a schedule so your repo gets better while you sleep.
4
+
5
+ ---
6
+
7
+ ## Quick Start
8
+
9
+ 1. **Copy the workflow template** into your repo:
10
+
11
+ ```bash
12
+ mkdir -p .github/workflows
13
+ curl -o .github/workflows/forgedock-autopilot.yml \
14
+ https://raw.githubusercontent.com/RapierCraftStudios/ForgeDock/milestone/developer-experience-distribution/templates/github-actions/forgedock-autopilot.yml
15
+ ```
16
+
17
+ 2. **Add your Anthropic API key** as a repository secret:
18
+ - Go to: `Settings → Secrets and variables → Actions → New repository secret`
19
+ - Name: `ANTHROPIC_API_KEY`
20
+ - Value: your key from [console.anthropic.com](https://console.anthropic.com)
21
+
22
+ 3. **Commit the workflow file** — GitHub Actions picks it up automatically.
23
+
24
+ That's it. The workflow runs every Monday at 9 AM UTC in `recon` mode (safe, read-only).
25
+
26
+ ---
27
+
28
+ ## Modes
29
+
30
+ ### `recon` (default — safe)
31
+
32
+ Runs [`/autopilot --recon-only`](../commands/autopilot.md):
33
+
34
+ - Pulls signals: production health, CI/CD, issue backlog, analytics
35
+ - Creates GitHub issues for findings
36
+ - **No branches, no PRs, no code changes**
37
+
38
+ This is the default for scheduled runs. Safe to enable immediately.
39
+
40
+ ### `fix` (explicit opt-in)
41
+
42
+ Runs [`/autopilot --fix --limit N`](../commands/autopilot.md):
43
+
44
+ - Everything in `recon` mode, plus:
45
+ - Picks up the top N open issues and runs `/work-on` on each
46
+ - Creates branches and PRs targeting `staging` (never `main`)
47
+ - **Requires explicit selection** — not available on scheduled runs without editing the workflow
48
+
49
+ To enable `fix` mode on a scheduled run, edit the `Resolve autopilot arguments` step in the workflow and change the default `MODE` to `fix`.
50
+
51
+ To run `fix` mode on demand, use the **Run workflow** button on GitHub Actions and select `fix` from the mode dropdown.
52
+
53
+ ---
54
+
55
+ ## Permissions
56
+
57
+ The workflow requires these GitHub token permissions (already set in the template):
58
+
59
+ | Permission | Required for |
60
+ |------------|-------------|
61
+ | `contents: write` | Creating branches and pushing commits (`fix` mode) |
62
+ | `issues: write` | Creating and labeling issues (both modes) |
63
+ | `pull-requests: write` | Creating PRs (`fix` mode) |
64
+
65
+ `GITHUB_TOKEN` is provided automatically — no extra setup needed.
66
+
67
+ ---
68
+
69
+ ## Adjusting the Schedule
70
+
71
+ The default cron runs every Monday at 9 AM UTC. To change it, edit the `cron` line:
72
+
73
+ ```yaml
74
+ on:
75
+ schedule:
76
+ - cron: '0 9 * * 1' # Monday 9 AM UTC
77
+ # - cron: '0 8 * * *' # Daily at 8 AM UTC
78
+ # - cron: '0 9 1 * *' # Monthly on the 1st
79
+ ```
80
+
81
+ Cron syntax: `minute hour day-of-month month day-of-week`. Use [crontab.guru](https://crontab.guru) to verify expressions.
82
+
83
+ ---
84
+
85
+ ## Changing the Fix Limit
86
+
87
+ The `limit` input controls how many issues are picked up per run in `fix` mode (default: 3). To change the default for manual runs, edit the `default` value under `inputs.limit` in the workflow file.
88
+
89
+ ---
90
+
91
+ ## Non-Interactive Confirmation Bypass
92
+
93
+ `/autopilot` Phase 4B normally requires interactive user confirmation before running `/work-on` on any issues. In GitHub Actions (a non-interactive environment), this gate is bypassed automatically when the `CI` environment variable is `true` — which is always the case in GHA.
94
+
95
+ **The `workflow_dispatch` mode input serves as the human opt-in.** When you select `fix` and click **Run workflow**, you are explicitly approving the fix run. For scheduled runs, the mode embedded in the workflow YAML is your standing approval.
96
+
97
+ This bypass is narrow: it only skips Phase 4B's interactive prompt. All other safety rules in `/autopilot` remain in force — `needs-human` issues are never picked up, milestone issues are excluded, and the `FIX_LIMIT` cap is always enforced.
98
+
99
+ ---
100
+
101
+ ## Cost Estimates
102
+
103
+ | Mode | Typical token usage | Approximate cost |
104
+ |------|--------------------|--------------------|
105
+ | `recon` | ~5,000–15,000 tokens | ~$0.02–$0.05/run |
106
+ | `fix` (1 issue) | ~50,000–150,000 tokens | ~$0.15–$0.45/run |
107
+ | `fix` (3 issues) | ~150,000–450,000 tokens | ~$0.45–$1.35/run |
108
+
109
+ Estimates based on `claude-sonnet-4` pricing ($3.00/M input, $15.00/M output). Actual usage varies by issue complexity and codebase size.
110
+
111
+ To control costs, keep `mode: recon` for scheduled runs and use `fix` mode only on demand.
112
+
113
+ ---
114
+
115
+ ## Frequently Asked Questions
116
+
117
+ **Will this merge code to `main`?**
118
+ No. `/autopilot` (and `/work-on`) never merge to `main`. All PRs target `staging` or a milestone branch. You deploy when ready.
119
+
120
+ **What if an autopilot run fails?**
121
+ The workflow exits with a non-zero status. GitHub sends a notification email (configurable). The run is logged in the Actions tab. No partial state is left — issues are only created after a full recon cycle.
122
+
123
+ **Can I run this in a private repo?**
124
+ Yes. `GITHUB_TOKEN` has full access to your repo. Only the Anthropic API key is external.
125
+
126
+ **Can I use this with Codex / OpenAI models?**
127
+ No. `/autopilot` requires Claude Code CLI, which runs Anthropic models. The `ANTHROPIC_API_KEY` is mandatory.
128
+
129
+ **What does `/autopilot` do if there are open P0 issues?**
130
+ It skips normal recon and immediately routes to `fix` mode targeting the P0 issues, regardless of the selected mode. P0 always takes priority.
package/docs/CONFIG.md CHANGED
@@ -210,6 +210,9 @@ repos:
210
210
  | `satellites[].local_path` | string | No | Absolute local path to the satellite repo's checkout |
211
211
  | `satellites[].subpaths` | map(string→string) | No | Named sub-directory paths within `local_path`, for monorepo satellites that publish multiple packages. Each key is a logical name; the value is the relative path to that package's root. Used by `/sync-ecosystem` to locate per-package version files and publish workflows. |
212
212
  | `satellites[].billing_enabled` | boolean | No | Set to `true` to run Phase 4 (Financial Integrity) of `/security-audit` against this satellite repo. Mirrors the top-level [`billing.enabled`](#billing-optional) flag but scoped per-satellite. Defaults to `false` when absent. |
213
+ | `satellites[].trigger_on_merge` | boolean | No | When `true`, fires a cross-repo trigger when a PR merges in the parent repo and touches paths matching `trigger_paths`. Set to `false` to disable triggering for this satellite. Defaults to `true` when `trigger_paths` is present; otherwise has no effect until runtime trigger support is configured. |
214
+ | `satellites[].trigger_paths` | list of strings | No | Path glob patterns that constrain when the trigger fires. Uses GitHub Actions glob syntax (same as `on: push: paths:`). The trigger fires only when at least one changed file matches a pattern in this list. When omitted, the trigger fires on every merge (if `trigger_on_merge: true`). |
215
+ | `satellites[].auto_run` | boolean | No | When `true`, automatically invokes `/work-on` on the satellite issue when the cross-repo trigger fires. Requires a running Claude Code session with ForgeDock installed in the satellite repo. Advanced opt-in — defaults to `false`. Do not set to `true` unless a persistent Claude Code session is available in the satellite repo. |
213
216
 
214
217
  **Routing syntax in commands**: `<prefix>:<issue_number>` — e.g., `mcp:5`, `sdk:12`
215
218
 
@@ -609,6 +612,39 @@ Colors are grouped by semantic meaning:
609
612
 
610
613
  ---
611
614
 
615
+ ## `branding` (OPTIONAL)
616
+
617
+ Controls attribution in FORGE annotation comments posted to GitHub issues and PRs by pipeline commands.
618
+
619
+ When `show_attribution` is `true` (the default), every annotation comment (`FORGE:INVESTIGATOR`, `FORGE:CONTRACT`, `FORGE:BUILDER`, `FORGE:TRAJECTORY`, `FORGE:DECOMPOSED`, etc.) ends with a one-line footer:
620
+
621
+ ```
622
+ > Pipeline powered by [ForgeDock](https://github.com/RapierCraftStudios/ForgeDock)
623
+ ```
624
+
625
+ This follows the pattern established by Dependabot, Renovate, and similar tools. It helps new users discover the tooling when they encounter FORGE: annotations in a public thread. Set to `false` to suppress the attribution entirely.
626
+
627
+ ```yaml
628
+ branding:
629
+ show_attribution: true
630
+ ```
631
+
632
+ | Field | Type | Required | Default | Description |
633
+ |-------|------|----------|---------|-------------|
634
+ | `show_attribution` | boolean | No | `true` | When `true`, annotation comments posted by the pipeline include a one-line attribution footer. Set to `false` to suppress it entirely. Opt-out model — attribution is on by default. |
635
+
636
+ **Commands that use this section**: `work-on` (all phases that post FORGE: annotation comments)
637
+
638
+ **Config read pattern** (yq, with default-true fallback):
639
+
640
+ ```bash
641
+ SHOW_ATTRIBUTION=$(yq '.branding.show_attribution // "true"' forge.yaml 2>/dev/null || echo "true")
642
+ [ "$SHOW_ATTRIBUTION" = "false" ] && ATTRIBUTION_LINE="" || ATTRIBUTION_LINE="
643
+ > Pipeline powered by [ForgeDock](https://github.com/RapierCraftStudios/ForgeDock)"
644
+ ```
645
+
646
+ ---
647
+
612
648
  ## GitHub App Install
613
649
 
614
650
  During `npx forgedock`, the installer prompts you to install the ForgeDock GitHub App (`rapiercraft-forgedock`) on your account or org.
package/docs/CURSOR.md ADDED
@@ -0,0 +1,135 @@
1
+ # Cursor Support
2
+
3
+ ForgeDock has a Cursor adapter that lets Cursor Agent mode run the ForgeDock pipeline via shell commands and the `gh` CLI.
4
+
5
+ ## Architecture
6
+
7
+ Shared source:
8
+ - `commands/**/*.md` remains the canonical workflow spec for all runtimes
9
+
10
+ Cursor wrapper:
11
+ - `templates/cursor/forge.mdc` — a static Cursor rules file that instructs Cursor Agent to execute pipeline phases using shell commands, `gh` CLI, and `git`
12
+ - Users install this file into their repo's `.cursor/rules/forge.mdc`
13
+
14
+ This is a static injection model, not a dynamic skill-loading mechanism. The adapter cannot replicate Claude Code's `Skill()` invocation or Codex's installed skill wrappers. Instead, it instructs the agent to read command specs directly from `commands/` and execute them using available terminal tools.
15
+
16
+ ## Install
17
+
18
+ ### Automatic (via `npx forgedock`)
19
+
20
+ If your project already has a `.cursor/` directory, `npx forgedock` will detect it and automatically write `templates/cursor/forge.mdc` to `.cursor/rules/forge.mdc`:
21
+
22
+ ```bash
23
+ npx forgedock
24
+ ```
25
+
26
+ The installer skips this step if `.cursor/rules/forge.mdc` already exists (idempotent — never overwrites customizations).
27
+
28
+ ### Manual
29
+
30
+ Copy the template directly:
31
+
32
+ ```bash
33
+ mkdir -p .cursor/rules
34
+ cp node_modules/forgedock/templates/cursor/forge.mdc .cursor/rules/forge.mdc
35
+ # or, if installed globally:
36
+ cp "$(npx forgedock which-dir)/templates/cursor/forge.mdc" .cursor/rules/forge.mdc
37
+ ```
38
+
39
+ Commit the file to version control so all team members get it:
40
+
41
+ ```bash
42
+ git add .cursor/rules/forge.mdc
43
+ git commit -m "chore: add ForgeDock Cursor rules adapter"
44
+ ```
45
+
46
+ ## Usage
47
+
48
+ ### Running the Pipeline
49
+
50
+ Open a Cursor Agent session and describe the pipeline task:
51
+
52
+ ```
53
+ Work on GitHub issue #123 using the ForgeDock pipeline.
54
+ Read commands/work-on.md and follow all phases.
55
+ ```
56
+
57
+ The rules file will instruct Cursor Agent to:
58
+
59
+ 1. Load issue context from GitHub using `gh issue view`
60
+ 2. Follow the Universal Phase Dispatcher in `commands/work-on.md`
61
+ 3. Write FORGE annotations (HTML comments) to issue comments after each phase
62
+ 4. Transition `workflow:*` labels as phases complete
63
+ 5. Continue until a terminal label is set
64
+
65
+ ### Checking Pipeline State
66
+
67
+ ```bash
68
+ # See current workflow state
69
+ gh issue view NUMBER --json labels --jq '[.labels[].name]'
70
+
71
+ # Read existing pipeline annotations
72
+ gh api repos/OWNER/REPO/issues/NUMBER/comments \
73
+ --jq '.[] | select(.body | contains("FORGE:")) | {body: .body[:200]}'
74
+ ```
75
+
76
+ ### Continuing After a Phase
77
+
78
+ Because Cursor Agent mode does not persist between invocations, start a new session and describe the resume:
79
+
80
+ ```
81
+ Resume the ForgeDock pipeline for GitHub issue #123.
82
+ Read commands/work-on.md — it will re-read GitHub state and pick up from the current label.
83
+ ```
84
+
85
+ The pipeline is designed for compaction resilience — every phase re-reads GitHub state at the start, so a new Cursor Agent session picks up exactly where the previous session left off.
86
+
87
+ ## Limitations
88
+
89
+ | Capability | Claude Code | Cursor (this adapter) |
90
+ |------------|-------------|----------------------|
91
+ | Skill loading | Dynamic (`~/.claude/commands/`) | Static (this rules file) |
92
+ | Multi-phase pipeline | Automatic (single continuous session) | Manual (re-invoke agent per phase) |
93
+ | Sub-skill invocation | `Skill("review-pr")` | Read `commands/review-pr.md` directly |
94
+ | Session continuity | Native compaction resilience | Re-read GitHub state each invocation |
95
+ | Tool set | Claude-native (`Bash`, `Read`, `Grep`, `Glob`, `WebFetch`) | Cursor Agent terminal tools |
96
+
97
+ ### Multi-Phase Pipeline
98
+
99
+ The ForgeDock pipeline has 7 phases (investigate → build → review → merge → close → trajectory). Cursor Agent mode does not automatically advance through all phases in a single session. After each phase completes, you will need to start a new agent invocation and ask it to continue.
100
+
101
+ The pipeline's compaction resilience handles this correctly: each invocation re-reads the issue's labels and comments, determines the current phase, and continues from there. No context is lost between sessions.
102
+
103
+ ### Sub-Skill Invocation
104
+
105
+ When the pipeline spec calls `Skill("review-pr")` or `Skill("quality-gate")`, Cursor Agent should read the referenced command spec file directly:
106
+
107
+ ```bash
108
+ cat commands/review-pr.md # Then execute that spec
109
+ cat commands/quality-gate.md
110
+ ```
111
+
112
+ ### Project Board Steps
113
+
114
+ Some pipeline phases (0C: Sync to Project board) call GitHub Projects API operations. These work via `gh` CLI but require the project number and field IDs from `forge.yaml`. Verify your `forge.yaml` has the correct project configuration before running the pipeline.
115
+
116
+ ## Configuration
117
+
118
+ ForgeDock reads `forge.yaml` for project-specific settings:
119
+
120
+ ```bash
121
+ cat forge.yaml # Review before running the pipeline
122
+ ```
123
+
124
+ Key fields used by the pipeline:
125
+ - `project.github.owner` / `project.github.repo` — GitHub repo coordinates
126
+ - `branches.staging` — target branch for fast-lane PRs
127
+ - `branches.main` — default branch
128
+
129
+ ## Reference
130
+
131
+ - `commands/work-on.md` — Full pipeline spec (all phases)
132
+ - `commands/review-pr.md` — PR review spec
133
+ - `commands/quality-gate.md` — Pre-commit quality checks (14+ domains)
134
+ - `docs/FORGE-PROTOCOL.md` — FORGE annotation protocol specification
135
+ - `docs/CODEX.md` — Codex CLI adapter (dynamic skill model)