@garygentry/feature-forge 0.2.14 → 0.3.1
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.
- package/README.md +6 -3
- package/adapters/GENERATION-REPORT.md +20 -0
- package/adapters/claude/.feature-forge-bundle.json +1 -1
- package/adapters/claude/agents/forge-verifier.md +1 -1
- package/adapters/claude/references/forge-config-schema.json +2 -2
- package/adapters/claude/references/pipeline-state-schema.json +1 -1
- package/adapters/claude/references/shared-conventions.md +62 -12
- package/adapters/claude/references/stage-exit-protocol.md +14 -4
- package/adapters/claude/references/vendor-construct-inventory.md +1 -1
- package/adapters/claude/scripts/epic-manifest.py +49 -6
- package/adapters/claude/scripts/forge-root.sh +47 -3
- package/adapters/claude/scripts/forge-session.py +1179 -9
- package/adapters/claude/scripts/validate-traceability.py +6 -1
- package/adapters/claude/skills/forge/SKILL.md +11 -5
- package/adapters/claude/skills/forge/references/pipeline-state-schema.json +1 -1
- package/adapters/claude/skills/forge/references/shared-conventions.md +62 -12
- package/adapters/claude/skills/forge/references/stage-exit-protocol.md +14 -4
- package/adapters/claude/skills/forge-0-epic/SKILL.md +1 -1
- package/adapters/claude/skills/forge-0-epic/references/pipeline-state-schema.json +1 -1
- package/adapters/claude/skills/forge-0-epic/references/shared-conventions.md +62 -12
- package/adapters/claude/skills/forge-0-epic/references/stage-exit-protocol.md +14 -4
- package/adapters/claude/skills/forge-1-prd/SKILL.md +25 -8
- package/adapters/claude/skills/forge-1-prd/references/shared-conventions.md +62 -12
- package/adapters/claude/skills/forge-1-prd/references/stage-exit-protocol.md +14 -4
- package/adapters/claude/skills/forge-2-tech/SKILL.md +25 -7
- package/adapters/claude/skills/forge-2-tech/references/shared-conventions.md +62 -12
- package/adapters/claude/skills/forge-2-tech/references/stage-exit-protocol.md +14 -4
- package/adapters/claude/skills/forge-3-specs/SKILL.md +24 -7
- package/adapters/claude/skills/forge-3-specs/references/shared-conventions.md +62 -12
- package/adapters/claude/skills/forge-3-specs/references/stage-exit-protocol.md +14 -4
- package/adapters/claude/skills/forge-4-backlog/SKILL.md +23 -7
- package/adapters/claude/skills/forge-4-backlog/references/shared-conventions.md +62 -12
- package/adapters/claude/skills/forge-4-backlog/references/stage-exit-protocol.md +14 -4
- package/adapters/claude/skills/forge-5-loop/SKILL.md +25 -25
- package/adapters/claude/skills/forge-5-loop/references/agent-selection.md +116 -0
- package/adapters/claude/skills/forge-5-loop/references/runner-contract.md +14 -107
- package/adapters/claude/skills/forge-5-loop/references/shared-conventions.md +62 -12
- package/adapters/claude/skills/forge-5-loop/references/stage-exit-protocol.md +14 -4
- package/adapters/claude/skills/forge-6-docs/SKILL.md +11 -5
- package/adapters/claude/skills/forge-6-docs/references/shared-conventions.md +62 -12
- package/adapters/claude/skills/forge-fix/references/shared-conventions.md +62 -12
- package/adapters/claude/skills/forge-fix/references/stage-exit-protocol.md +14 -4
- package/adapters/claude/skills/forge-guide/references/forge-config-schema.json +2 -2
- package/adapters/claude/skills/forge-guide/references/shared-conventions.md +62 -12
- package/adapters/claude/skills/forge-verify/SKILL.md +22 -12
- package/adapters/claude/skills/forge-verify/references/findings-template.md +157 -0
- package/adapters/claude/skills/forge-verify/references/pipeline-state-schema.json +1 -1
- package/adapters/claude/skills/forge-verify/references/shared-conventions.md +62 -12
- package/adapters/claude/skills/forge-verify/references/verification-checklists/backlog.md +97 -0
- package/adapters/claude/skills/forge-verify/references/verification-checklists/epic.md +79 -0
- package/adapters/claude/skills/forge-verify/references/verification-checklists/impl.md +48 -0
- package/adapters/claude/skills/forge-verify/references/verification-checklists/prd.md +31 -0
- package/adapters/claude/skills/forge-verify/references/verification-checklists/specs.md +64 -0
- package/adapters/claude/skills/forge-verify/references/verification-checklists/tech.md +35 -0
- package/adapters/codex/.feature-forge-bundle.json +1 -1
- package/adapters/codex/agents/forge-verifier.toml +1 -1
- package/adapters/codex/references/forge-config-schema.json +2 -2
- package/adapters/codex/references/pipeline-state-schema.json +1 -1
- package/adapters/codex/references/shared-conventions.md +62 -12
- package/adapters/codex/references/stage-exit-protocol.md +14 -4
- package/adapters/codex/references/vendor-construct-inventory.md +1 -1
- package/adapters/codex/scripts/epic-manifest.py +49 -6
- package/adapters/codex/scripts/forge-root.sh +47 -3
- package/adapters/codex/scripts/forge-session.py +1179 -9
- package/adapters/codex/scripts/validate-traceability.py +6 -1
- package/adapters/codex/skills/forge/SKILL.md +11 -5
- package/adapters/codex/skills/forge/references/pipeline-state-schema.json +1 -1
- package/adapters/codex/skills/forge/references/shared-conventions.md +62 -12
- package/adapters/codex/skills/forge/references/stage-exit-protocol.md +14 -4
- package/adapters/codex/skills/forge-0-epic/SKILL.md +1 -1
- package/adapters/codex/skills/forge-0-epic/references/pipeline-state-schema.json +1 -1
- package/adapters/codex/skills/forge-0-epic/references/shared-conventions.md +62 -12
- package/adapters/codex/skills/forge-0-epic/references/stage-exit-protocol.md +14 -4
- package/adapters/codex/skills/forge-1-prd/SKILL.md +25 -8
- package/adapters/codex/skills/forge-1-prd/references/shared-conventions.md +62 -12
- package/adapters/codex/skills/forge-1-prd/references/stage-exit-protocol.md +14 -4
- package/adapters/codex/skills/forge-2-tech/SKILL.md +25 -7
- package/adapters/codex/skills/forge-2-tech/references/shared-conventions.md +62 -12
- package/adapters/codex/skills/forge-2-tech/references/stage-exit-protocol.md +14 -4
- package/adapters/codex/skills/forge-3-specs/SKILL.md +24 -7
- package/adapters/codex/skills/forge-3-specs/references/shared-conventions.md +62 -12
- package/adapters/codex/skills/forge-3-specs/references/stage-exit-protocol.md +14 -4
- package/adapters/codex/skills/forge-4-backlog/SKILL.md +23 -7
- package/adapters/codex/skills/forge-4-backlog/references/shared-conventions.md +62 -12
- package/adapters/codex/skills/forge-4-backlog/references/stage-exit-protocol.md +14 -4
- package/adapters/codex/skills/forge-5-loop/SKILL.md +25 -25
- package/adapters/codex/skills/forge-5-loop/references/agent-selection.md +116 -0
- package/adapters/codex/skills/forge-5-loop/references/runner-contract.md +14 -107
- package/adapters/codex/skills/forge-5-loop/references/shared-conventions.md +62 -12
- package/adapters/codex/skills/forge-5-loop/references/stage-exit-protocol.md +14 -4
- package/adapters/codex/skills/forge-6-docs/SKILL.md +11 -5
- package/adapters/codex/skills/forge-6-docs/references/shared-conventions.md +62 -12
- package/adapters/codex/skills/forge-fix/references/shared-conventions.md +62 -12
- package/adapters/codex/skills/forge-fix/references/stage-exit-protocol.md +14 -4
- package/adapters/codex/skills/forge-guide/references/forge-config-schema.json +2 -2
- package/adapters/codex/skills/forge-guide/references/shared-conventions.md +62 -12
- package/adapters/codex/skills/forge-verify/SKILL.md +22 -12
- package/adapters/codex/skills/forge-verify/references/findings-template.md +157 -0
- package/adapters/codex/skills/forge-verify/references/pipeline-state-schema.json +1 -1
- package/adapters/codex/skills/forge-verify/references/shared-conventions.md +62 -12
- package/adapters/codex/skills/forge-verify/references/verification-checklists/backlog.md +97 -0
- package/adapters/codex/skills/forge-verify/references/verification-checklists/epic.md +79 -0
- package/adapters/codex/skills/forge-verify/references/verification-checklists/impl.md +48 -0
- package/adapters/codex/skills/forge-verify/references/verification-checklists/prd.md +31 -0
- package/adapters/codex/skills/forge-verify/references/verification-checklists/specs.md +64 -0
- package/adapters/codex/skills/forge-verify/references/verification-checklists/tech.md +35 -0
- package/adapters/copilot/.feature-forge-bundle.json +1 -1
- package/adapters/copilot/agents/forge-verifier.md +1 -1
- package/adapters/copilot/references/forge-config-schema.json +2 -2
- package/adapters/copilot/references/pipeline-state-schema.json +1 -1
- package/adapters/copilot/references/shared-conventions.md +62 -12
- package/adapters/copilot/references/stage-exit-protocol.md +14 -4
- package/adapters/copilot/references/vendor-construct-inventory.md +1 -1
- package/adapters/copilot/scripts/epic-manifest.py +49 -6
- package/adapters/copilot/scripts/forge-root.sh +47 -3
- package/adapters/copilot/scripts/forge-session.py +1179 -9
- package/adapters/copilot/scripts/validate-traceability.py +6 -1
- package/adapters/copilot/skills/forge/forge.md +11 -5
- package/adapters/copilot/skills/forge/references/pipeline-state-schema.json +1 -1
- package/adapters/copilot/skills/forge/references/shared-conventions.md +62 -12
- package/adapters/copilot/skills/forge/references/stage-exit-protocol.md +14 -4
- package/adapters/copilot/skills/forge-0-epic/forge-0-epic.md +1 -1
- package/adapters/copilot/skills/forge-0-epic/references/pipeline-state-schema.json +1 -1
- package/adapters/copilot/skills/forge-0-epic/references/shared-conventions.md +62 -12
- package/adapters/copilot/skills/forge-0-epic/references/stage-exit-protocol.md +14 -4
- package/adapters/copilot/skills/forge-1-prd/forge-1-prd.md +25 -8
- package/adapters/copilot/skills/forge-1-prd/references/shared-conventions.md +62 -12
- package/adapters/copilot/skills/forge-1-prd/references/stage-exit-protocol.md +14 -4
- package/adapters/copilot/skills/forge-2-tech/forge-2-tech.md +25 -7
- package/adapters/copilot/skills/forge-2-tech/references/shared-conventions.md +62 -12
- package/adapters/copilot/skills/forge-2-tech/references/stage-exit-protocol.md +14 -4
- package/adapters/copilot/skills/forge-3-specs/forge-3-specs.md +24 -7
- package/adapters/copilot/skills/forge-3-specs/references/shared-conventions.md +62 -12
- package/adapters/copilot/skills/forge-3-specs/references/stage-exit-protocol.md +14 -4
- package/adapters/copilot/skills/forge-4-backlog/forge-4-backlog.md +23 -7
- package/adapters/copilot/skills/forge-4-backlog/references/shared-conventions.md +62 -12
- package/adapters/copilot/skills/forge-4-backlog/references/stage-exit-protocol.md +14 -4
- package/adapters/copilot/skills/forge-5-loop/forge-5-loop.md +25 -25
- package/adapters/copilot/skills/forge-5-loop/references/agent-selection.md +116 -0
- package/adapters/copilot/skills/forge-5-loop/references/runner-contract.md +14 -107
- package/adapters/copilot/skills/forge-5-loop/references/shared-conventions.md +62 -12
- package/adapters/copilot/skills/forge-5-loop/references/stage-exit-protocol.md +14 -4
- package/adapters/copilot/skills/forge-6-docs/forge-6-docs.md +11 -5
- package/adapters/copilot/skills/forge-6-docs/references/shared-conventions.md +62 -12
- package/adapters/copilot/skills/forge-fix/references/shared-conventions.md +62 -12
- package/adapters/copilot/skills/forge-fix/references/stage-exit-protocol.md +14 -4
- package/adapters/copilot/skills/forge-guide/references/forge-config-schema.json +2 -2
- package/adapters/copilot/skills/forge-guide/references/shared-conventions.md +62 -12
- package/adapters/copilot/skills/forge-verify/forge-verify.md +22 -12
- package/adapters/copilot/skills/forge-verify/references/findings-template.md +157 -0
- package/adapters/copilot/skills/forge-verify/references/pipeline-state-schema.json +1 -1
- package/adapters/copilot/skills/forge-verify/references/shared-conventions.md +62 -12
- package/adapters/copilot/skills/forge-verify/references/verification-checklists/backlog.md +97 -0
- package/adapters/copilot/skills/forge-verify/references/verification-checklists/epic.md +79 -0
- package/adapters/copilot/skills/forge-verify/references/verification-checklists/impl.md +48 -0
- package/adapters/copilot/skills/forge-verify/references/verification-checklists/prd.md +31 -0
- package/adapters/copilot/skills/forge-verify/references/verification-checklists/specs.md +64 -0
- package/adapters/copilot/skills/forge-verify/references/verification-checklists/tech.md +35 -0
- package/adapters/cursor/.feature-forge-bundle.json +1 -1
- package/adapters/cursor/agents/forge-verifier.mdc +1 -1
- package/adapters/cursor/references/forge-config-schema.json +2 -2
- package/adapters/cursor/references/pipeline-state-schema.json +1 -1
- package/adapters/cursor/references/shared-conventions.md +62 -12
- package/adapters/cursor/references/stage-exit-protocol.md +14 -4
- package/adapters/cursor/references/vendor-construct-inventory.md +1 -1
- package/adapters/cursor/scripts/epic-manifest.py +49 -6
- package/adapters/cursor/scripts/forge-root.sh +47 -3
- package/adapters/cursor/scripts/forge-session.py +1179 -9
- package/adapters/cursor/scripts/validate-traceability.py +6 -1
- package/adapters/cursor/skills/forge/forge.mdc +11 -5
- package/adapters/cursor/skills/forge/references/pipeline-state-schema.json +1 -1
- package/adapters/cursor/skills/forge/references/shared-conventions.md +62 -12
- package/adapters/cursor/skills/forge/references/stage-exit-protocol.md +14 -4
- package/adapters/cursor/skills/forge-0-epic/forge-0-epic.mdc +1 -1
- package/adapters/cursor/skills/forge-0-epic/references/pipeline-state-schema.json +1 -1
- package/adapters/cursor/skills/forge-0-epic/references/shared-conventions.md +62 -12
- package/adapters/cursor/skills/forge-0-epic/references/stage-exit-protocol.md +14 -4
- package/adapters/cursor/skills/forge-1-prd/forge-1-prd.mdc +25 -8
- package/adapters/cursor/skills/forge-1-prd/references/shared-conventions.md +62 -12
- package/adapters/cursor/skills/forge-1-prd/references/stage-exit-protocol.md +14 -4
- package/adapters/cursor/skills/forge-2-tech/forge-2-tech.mdc +25 -7
- package/adapters/cursor/skills/forge-2-tech/references/shared-conventions.md +62 -12
- package/adapters/cursor/skills/forge-2-tech/references/stage-exit-protocol.md +14 -4
- package/adapters/cursor/skills/forge-3-specs/forge-3-specs.mdc +24 -7
- package/adapters/cursor/skills/forge-3-specs/references/shared-conventions.md +62 -12
- package/adapters/cursor/skills/forge-3-specs/references/stage-exit-protocol.md +14 -4
- package/adapters/cursor/skills/forge-4-backlog/forge-4-backlog.mdc +23 -7
- package/adapters/cursor/skills/forge-4-backlog/references/shared-conventions.md +62 -12
- package/adapters/cursor/skills/forge-4-backlog/references/stage-exit-protocol.md +14 -4
- package/adapters/cursor/skills/forge-5-loop/forge-5-loop.mdc +25 -25
- package/adapters/cursor/skills/forge-5-loop/references/agent-selection.md +116 -0
- package/adapters/cursor/skills/forge-5-loop/references/runner-contract.md +14 -107
- package/adapters/cursor/skills/forge-5-loop/references/shared-conventions.md +62 -12
- package/adapters/cursor/skills/forge-5-loop/references/stage-exit-protocol.md +14 -4
- package/adapters/cursor/skills/forge-6-docs/forge-6-docs.mdc +11 -5
- package/adapters/cursor/skills/forge-6-docs/references/shared-conventions.md +62 -12
- package/adapters/cursor/skills/forge-fix/references/shared-conventions.md +62 -12
- package/adapters/cursor/skills/forge-fix/references/stage-exit-protocol.md +14 -4
- package/adapters/cursor/skills/forge-guide/references/forge-config-schema.json +2 -2
- package/adapters/cursor/skills/forge-guide/references/shared-conventions.md +62 -12
- package/adapters/cursor/skills/forge-verify/forge-verify.mdc +22 -12
- package/adapters/cursor/skills/forge-verify/references/findings-template.md +157 -0
- package/adapters/cursor/skills/forge-verify/references/pipeline-state-schema.json +1 -1
- package/adapters/cursor/skills/forge-verify/references/shared-conventions.md +62 -12
- package/adapters/cursor/skills/forge-verify/references/verification-checklists/backlog.md +97 -0
- package/adapters/cursor/skills/forge-verify/references/verification-checklists/epic.md +79 -0
- package/adapters/cursor/skills/forge-verify/references/verification-checklists/impl.md +48 -0
- package/adapters/cursor/skills/forge-verify/references/verification-checklists/prd.md +31 -0
- package/adapters/cursor/skills/forge-verify/references/verification-checklists/specs.md +64 -0
- package/adapters/cursor/skills/forge-verify/references/verification-checklists/tech.md +35 -0
- package/adapters/gemini/.feature-forge-bundle.json +1 -1
- package/adapters/gemini/agents/forge-verifier.md +1 -1
- package/adapters/gemini/gemini-extension.json +1 -1
- package/adapters/gemini/references/forge-config-schema.json +2 -2
- package/adapters/gemini/references/pipeline-state-schema.json +1 -1
- package/adapters/gemini/references/shared-conventions.md +62 -12
- package/adapters/gemini/references/stage-exit-protocol.md +14 -4
- package/adapters/gemini/references/vendor-construct-inventory.md +1 -1
- package/adapters/gemini/scripts/epic-manifest.py +49 -6
- package/adapters/gemini/scripts/forge-root.sh +47 -3
- package/adapters/gemini/scripts/forge-session.py +1179 -9
- package/adapters/gemini/scripts/validate-traceability.py +6 -1
- package/adapters/gemini/skills/forge/forge.md +11 -5
- package/adapters/gemini/skills/forge/references/pipeline-state-schema.json +1 -1
- package/adapters/gemini/skills/forge/references/shared-conventions.md +62 -12
- package/adapters/gemini/skills/forge/references/stage-exit-protocol.md +14 -4
- package/adapters/gemini/skills/forge-0-epic/forge-0-epic.md +1 -1
- package/adapters/gemini/skills/forge-0-epic/references/pipeline-state-schema.json +1 -1
- package/adapters/gemini/skills/forge-0-epic/references/shared-conventions.md +62 -12
- package/adapters/gemini/skills/forge-0-epic/references/stage-exit-protocol.md +14 -4
- package/adapters/gemini/skills/forge-1-prd/forge-1-prd.md +25 -8
- package/adapters/gemini/skills/forge-1-prd/references/shared-conventions.md +62 -12
- package/adapters/gemini/skills/forge-1-prd/references/stage-exit-protocol.md +14 -4
- package/adapters/gemini/skills/forge-2-tech/forge-2-tech.md +25 -7
- package/adapters/gemini/skills/forge-2-tech/references/shared-conventions.md +62 -12
- package/adapters/gemini/skills/forge-2-tech/references/stage-exit-protocol.md +14 -4
- package/adapters/gemini/skills/forge-3-specs/forge-3-specs.md +24 -7
- package/adapters/gemini/skills/forge-3-specs/references/shared-conventions.md +62 -12
- package/adapters/gemini/skills/forge-3-specs/references/stage-exit-protocol.md +14 -4
- package/adapters/gemini/skills/forge-4-backlog/forge-4-backlog.md +23 -7
- package/adapters/gemini/skills/forge-4-backlog/references/shared-conventions.md +62 -12
- package/adapters/gemini/skills/forge-4-backlog/references/stage-exit-protocol.md +14 -4
- package/adapters/gemini/skills/forge-5-loop/forge-5-loop.md +25 -25
- package/adapters/gemini/skills/forge-5-loop/references/agent-selection.md +116 -0
- package/adapters/gemini/skills/forge-5-loop/references/runner-contract.md +14 -107
- package/adapters/gemini/skills/forge-5-loop/references/shared-conventions.md +62 -12
- package/adapters/gemini/skills/forge-5-loop/references/stage-exit-protocol.md +14 -4
- package/adapters/gemini/skills/forge-6-docs/forge-6-docs.md +11 -5
- package/adapters/gemini/skills/forge-6-docs/references/shared-conventions.md +62 -12
- package/adapters/gemini/skills/forge-fix/references/shared-conventions.md +62 -12
- package/adapters/gemini/skills/forge-fix/references/stage-exit-protocol.md +14 -4
- package/adapters/gemini/skills/forge-guide/references/forge-config-schema.json +2 -2
- package/adapters/gemini/skills/forge-guide/references/shared-conventions.md +62 -12
- package/adapters/gemini/skills/forge-verify/forge-verify.md +22 -12
- package/adapters/gemini/skills/forge-verify/references/findings-template.md +157 -0
- package/adapters/gemini/skills/forge-verify/references/pipeline-state-schema.json +1 -1
- package/adapters/gemini/skills/forge-verify/references/shared-conventions.md +62 -12
- package/adapters/gemini/skills/forge-verify/references/verification-checklists/backlog.md +97 -0
- package/adapters/gemini/skills/forge-verify/references/verification-checklists/epic.md +79 -0
- package/adapters/gemini/skills/forge-verify/references/verification-checklists/impl.md +48 -0
- package/adapters/gemini/skills/forge-verify/references/verification-checklists/prd.md +31 -0
- package/adapters/gemini/skills/forge-verify/references/verification-checklists/specs.md +64 -0
- package/adapters/gemini/skills/forge-verify/references/verification-checklists/tech.md +35 -0
- package/adapters/pi/.feature-forge-bundle.json +6 -0
- package/adapters/pi/agents/forge-researcher.md +139 -0
- package/adapters/pi/agents/forge-spec-writer.md +116 -0
- package/adapters/pi/agents/forge-verifier.md +126 -0
- package/adapters/pi/extensions/ask-user-question/LICENSE +21 -0
- package/adapters/pi/extensions/ask-user-question/README.md +91 -0
- package/adapters/pi/extensions/ask-user-question/ask-user-question.ts +298 -0
- package/adapters/pi/extensions/ask-user-question/config.ts +78 -0
- package/adapters/pi/extensions/ask-user-question/events.ts +57 -0
- package/adapters/pi/extensions/ask-user-question/index.ts +61 -0
- package/adapters/pi/extensions/ask-user-question/locales/de.json +27 -0
- package/adapters/pi/extensions/ask-user-question/locales/en.json +27 -0
- package/adapters/pi/extensions/ask-user-question/locales/es.json +27 -0
- package/adapters/pi/extensions/ask-user-question/locales/fr.json +27 -0
- package/adapters/pi/extensions/ask-user-question/locales/pt-BR.json +27 -0
- package/adapters/pi/extensions/ask-user-question/locales/pt.json +27 -0
- package/adapters/pi/extensions/ask-user-question/locales/ru.json +27 -0
- package/adapters/pi/extensions/ask-user-question/locales/uk.json +27 -0
- package/adapters/pi/extensions/ask-user-question/locales/zh.json +29 -0
- package/adapters/pi/extensions/ask-user-question/reconcile.ts +49 -0
- package/adapters/pi/extensions/ask-user-question/rpc-fallback.ts +168 -0
- package/adapters/pi/extensions/ask-user-question/state/build-questionnaire.ts +302 -0
- package/adapters/pi/extensions/ask-user-question/state/i18n-bridge.ts +53 -0
- package/adapters/pi/extensions/ask-user-question/state/key-router.ts +277 -0
- package/adapters/pi/extensions/ask-user-question/state/questionnaire-session.ts +234 -0
- package/adapters/pi/extensions/ask-user-question/state/row-intent.ts +145 -0
- package/adapters/pi/extensions/ask-user-question/state/selectors/contract.ts +26 -0
- package/adapters/pi/extensions/ask-user-question/state/selectors/derivations.ts +42 -0
- package/adapters/pi/extensions/ask-user-question/state/selectors/focus.ts +19 -0
- package/adapters/pi/extensions/ask-user-question/state/selectors/projections.ts +101 -0
- package/adapters/pi/extensions/ask-user-question/state/state-reducer.ts +292 -0
- package/adapters/pi/extensions/ask-user-question/state/state.ts +55 -0
- package/adapters/pi/extensions/ask-user-question/tool/format-answer.ts +31 -0
- package/adapters/pi/extensions/ask-user-question/tool/response-envelope.ts +49 -0
- package/adapters/pi/extensions/ask-user-question/tool/types.ts +147 -0
- package/adapters/pi/extensions/ask-user-question/tool/validate-questionnaire.ts +58 -0
- package/adapters/pi/extensions/ask-user-question/vendor-config-shim.ts +65 -0
- package/adapters/pi/extensions/ask-user-question/view/component-binding.ts +47 -0
- package/adapters/pi/extensions/ask-user-question/view/components/inline-input.ts +98 -0
- package/adapters/pi/extensions/ask-user-question/view/components/multi-select-view.ts +193 -0
- package/adapters/pi/extensions/ask-user-question/view/components/option-list-view.ts +70 -0
- package/adapters/pi/extensions/ask-user-question/view/components/preview/markdown-content-cache.ts +79 -0
- package/adapters/pi/extensions/ask-user-question/view/components/preview/preview-block-renderer.ts +111 -0
- package/adapters/pi/extensions/ask-user-question/view/components/preview/preview-box-renderer.ts +88 -0
- package/adapters/pi/extensions/ask-user-question/view/components/preview/preview-layout-decider.ts +202 -0
- package/adapters/pi/extensions/ask-user-question/view/components/preview/preview-pane.ts +228 -0
- package/adapters/pi/extensions/ask-user-question/view/components/submit-picker.ts +67 -0
- package/adapters/pi/extensions/ask-user-question/view/components/tab-bar.ts +59 -0
- package/adapters/pi/extensions/ask-user-question/view/components/wrapping-select.ts +293 -0
- package/adapters/pi/extensions/ask-user-question/view/dialog-builder.ts +224 -0
- package/adapters/pi/extensions/ask-user-question/view/props-adapter.ts +125 -0
- package/adapters/pi/extensions/ask-user-question/view/stateful-view.ts +26 -0
- package/adapters/pi/extensions/ask-user-question/view/tab-components.ts +18 -0
- package/adapters/pi/extensions/ask-user-question/view/tab-content-strategy.ts +252 -0
- package/adapters/pi/package.json +26 -0
- package/adapters/pi/references/epic-manifest-schema.json +125 -0
- package/adapters/{claude/skills/forge-5-loop → pi}/references/forge-config-schema.json +4 -4
- package/adapters/{claude/skills/forge-1-prd → pi}/references/pipeline-state-schema.json +1 -1
- package/adapters/pi/references/portable-root.md +71 -0
- package/adapters/pi/references/process-overview.md +143 -0
- package/adapters/pi/references/ralph-loop-contract.md +221 -0
- package/adapters/pi/references/shared-conventions.md +345 -0
- package/adapters/pi/references/skill-frontmatter.schema.json +17 -0
- package/adapters/pi/references/stack-resolution.md +54 -0
- package/adapters/pi/references/stacks/_generic.md +111 -0
- package/adapters/pi/references/stacks/go.md +157 -0
- package/adapters/pi/references/stacks/python.md +184 -0
- package/adapters/pi/references/stacks/rust.md +170 -0
- package/adapters/pi/references/stacks/typescript.md +134 -0
- package/adapters/pi/references/stage-exit-protocol.md +268 -0
- package/adapters/pi/references/templates/specs-hygiene/AGENTS.md +32 -0
- package/adapters/pi/references/templates/specs-hygiene/CLAUDE.md +31 -0
- package/adapters/pi/references/vendor-construct-inventory.md +50 -0
- package/adapters/pi/scripts/epic-manifest.py +1737 -0
- package/adapters/pi/scripts/forge-bootstrap.py +1070 -0
- package/adapters/pi/scripts/forge-init.sh +58 -0
- package/adapters/pi/scripts/forge-root.sh +179 -0
- package/adapters/pi/scripts/forge-session.py +3036 -0
- package/adapters/pi/scripts/validate-traceability.py +155 -0
- package/adapters/pi/skills/forge/SKILL.md +249 -0
- package/adapters/{claude/skills/forge-4-backlog → pi/skills/forge}/references/pipeline-state-schema.json +1 -1
- package/adapters/pi/skills/forge/references/process-overview.md +143 -0
- package/adapters/pi/skills/forge/references/shared-conventions.md +345 -0
- package/adapters/pi/skills/forge/references/stage-exit-protocol.md +268 -0
- package/adapters/pi/skills/forge-0-epic/SKILL.md +308 -0
- package/adapters/pi/skills/forge-0-epic/references/edit-mode.md +266 -0
- package/adapters/pi/skills/forge-0-epic/references/epic-manifest-subcommands.md +75 -0
- package/adapters/{claude/skills/forge-2-tech → pi/skills/forge-0-epic}/references/pipeline-state-schema.json +1 -1
- package/adapters/pi/skills/forge-0-epic/references/portable-root.md +71 -0
- package/adapters/pi/skills/forge-0-epic/references/shared-conventions.md +345 -0
- package/adapters/pi/skills/forge-0-epic/references/stage-exit-protocol.md +268 -0
- package/adapters/pi/skills/forge-1-prd/SKILL.md +181 -0
- package/adapters/pi/skills/forge-1-prd/references/prd-template.md +106 -0
- package/adapters/pi/skills/forge-1-prd/references/shared-conventions.md +345 -0
- package/adapters/pi/skills/forge-1-prd/references/stage-exit-protocol.md +268 -0
- package/adapters/pi/skills/forge-2-tech/SKILL.md +243 -0
- package/adapters/pi/skills/forge-2-tech/references/shared-conventions.md +345 -0
- package/adapters/pi/skills/forge-2-tech/references/stack-discovery-checklist.md +95 -0
- package/adapters/pi/skills/forge-2-tech/references/stack-resolution.md +54 -0
- package/adapters/pi/skills/forge-2-tech/references/stacks/_generic.md +111 -0
- package/adapters/pi/skills/forge-2-tech/references/stacks/go.md +157 -0
- package/adapters/pi/skills/forge-2-tech/references/stacks/python.md +184 -0
- package/adapters/pi/skills/forge-2-tech/references/stacks/rust.md +170 -0
- package/adapters/pi/skills/forge-2-tech/references/stacks/typescript.md +134 -0
- package/adapters/pi/skills/forge-2-tech/references/stage-exit-protocol.md +268 -0
- package/adapters/pi/skills/forge-3-specs/SKILL.md +195 -0
- package/adapters/pi/skills/forge-3-specs/references/shared-conventions.md +345 -0
- package/adapters/pi/skills/forge-3-specs/references/spec-archetypes.md +106 -0
- package/adapters/pi/skills/forge-3-specs/references/spec-examples.md +71 -0
- package/adapters/pi/skills/forge-3-specs/references/stacks/_generic.md +111 -0
- package/adapters/pi/skills/forge-3-specs/references/stacks/go.md +157 -0
- package/adapters/pi/skills/forge-3-specs/references/stacks/python.md +184 -0
- package/adapters/pi/skills/forge-3-specs/references/stacks/rust.md +170 -0
- package/adapters/pi/skills/forge-3-specs/references/stacks/typescript.md +134 -0
- package/adapters/pi/skills/forge-3-specs/references/stage-exit-protocol.md +268 -0
- package/adapters/pi/skills/forge-4-backlog/SKILL.md +191 -0
- package/adapters/pi/skills/forge-4-backlog/references/shared-conventions.md +345 -0
- package/adapters/pi/skills/forge-4-backlog/references/stage-exit-protocol.md +268 -0
- package/adapters/pi/skills/forge-5-loop/SKILL.md +314 -0
- package/adapters/pi/skills/forge-5-loop/references/agent-selection.md +116 -0
- package/adapters/pi/skills/forge-5-loop/references/ralph-loop-contract.md +221 -0
- package/adapters/pi/skills/forge-5-loop/references/result-reporting.md +85 -0
- package/adapters/pi/skills/forge-5-loop/references/runner-contract.md +248 -0
- package/adapters/pi/skills/forge-5-loop/references/shared-conventions.md +345 -0
- package/adapters/pi/skills/forge-5-loop/references/stage-exit-protocol.md +268 -0
- package/adapters/pi/skills/forge-6-docs/SKILL.md +208 -0
- package/adapters/pi/skills/forge-6-docs/references/doc-conventions.md +126 -0
- package/adapters/pi/skills/forge-6-docs/references/shared-conventions.md +345 -0
- package/adapters/pi/skills/forge-bootstrap/SKILL.md +250 -0
- package/adapters/pi/skills/forge-bootstrap/references/templates/ci/github-actions.yml +12 -0
- package/adapters/pi/skills/forge-bootstrap/references/templates/generic/run.sh +3 -0
- package/adapters/pi/skills/forge-bootstrap/references/templates/generic/test.sh +13 -0
- package/adapters/pi/skills/forge-bootstrap/references/templates/go/go.mod +3 -0
- package/adapters/pi/skills/forge-bootstrap/references/templates/go/main.go +12 -0
- package/adapters/pi/skills/forge-bootstrap/references/templates/go/main_test.go +11 -0
- package/adapters/pi/skills/forge-bootstrap/references/templates/hygiene/AGENTS.md +35 -0
- package/adapters/pi/skills/forge-bootstrap/references/templates/hygiene/CLAUDE.md +36 -0
- package/adapters/pi/skills/forge-bootstrap/references/templates/hygiene/README.md +11 -0
- package/adapters/pi/skills/forge-bootstrap/references/templates/licenses/Apache-2.0/LICENSE +198 -0
- package/adapters/pi/skills/forge-bootstrap/references/templates/licenses/MIT/LICENSE +21 -0
- package/adapters/pi/skills/forge-bootstrap/references/templates/python/pyproject.toml +24 -0
- package/adapters/pi/skills/forge-bootstrap/references/templates/python/src/{{PKG}}/__init__.py +5 -0
- package/adapters/pi/skills/forge-bootstrap/references/templates/python/src/{{PKG}}/main.py +13 -0
- package/adapters/pi/skills/forge-bootstrap/references/templates/python/tests/test_smoke.py +8 -0
- package/adapters/pi/skills/forge-bootstrap/references/templates/rust/Cargo.toml +15 -0
- package/adapters/pi/skills/forge-bootstrap/references/templates/rust/src/lib.rs +7 -0
- package/adapters/pi/skills/forge-bootstrap/references/templates/rust/src/main.rs +5 -0
- package/adapters/pi/skills/forge-bootstrap/references/templates/rust/tests/smoke.rs +6 -0
- package/adapters/pi/skills/forge-bootstrap/references/templates/typescript/package.json +15 -0
- package/adapters/pi/skills/forge-bootstrap/references/templates/typescript/src/index.ts +4 -0
- package/adapters/pi/skills/forge-bootstrap/references/templates/typescript/test/smoke.test.ts +6 -0
- package/adapters/pi/skills/forge-bootstrap/references/templates/typescript/tsconfig.json +14 -0
- package/adapters/pi/skills/forge-fix/SKILL.md +98 -0
- package/adapters/pi/skills/forge-fix/references/shared-conventions.md +345 -0
- package/adapters/pi/skills/forge-fix/references/stage-exit-protocol.md +268 -0
- package/adapters/pi/skills/forge-guide/SKILL.md +192 -0
- package/adapters/{codex/skills/forge-4-backlog → pi/skills/forge-guide}/references/forge-config-schema.json +4 -4
- package/adapters/pi/skills/forge-guide/references/process-overview.md +143 -0
- package/adapters/pi/skills/forge-guide/references/ralph-loop-contract.md +221 -0
- package/adapters/pi/skills/forge-guide/references/shared-conventions.md +345 -0
- package/adapters/pi/skills/forge-guide/references/stack-resolution.md +54 -0
- package/adapters/pi/skills/forge-guide/references/stacks/_generic.md +111 -0
- package/adapters/pi/skills/forge-guide/references/stacks/go.md +157 -0
- package/adapters/pi/skills/forge-guide/references/stacks/python.md +184 -0
- package/adapters/pi/skills/forge-guide/references/stacks/rust.md +170 -0
- package/adapters/pi/skills/forge-guide/references/stacks/typescript.md +134 -0
- package/adapters/pi/skills/forge-init/SKILL.md +72 -0
- package/adapters/pi/skills/forge-verify/SKILL.md +283 -0
- package/adapters/pi/skills/forge-verify/references/findings-template.md +157 -0
- package/adapters/{claude/skills/forge-3-specs → pi/skills/forge-verify}/references/pipeline-state-schema.json +1 -1
- package/adapters/pi/skills/forge-verify/references/shared-conventions.md +345 -0
- package/adapters/pi/skills/forge-verify/references/verification-checklists/backlog.md +97 -0
- package/adapters/pi/skills/forge-verify/references/verification-checklists/epic.md +79 -0
- package/adapters/pi/skills/forge-verify/references/verification-checklists/impl.md +48 -0
- package/adapters/pi/skills/forge-verify/references/verification-checklists/prd.md +31 -0
- package/adapters/pi/skills/forge-verify/references/verification-checklists/specs.md +64 -0
- package/adapters/pi/skills/forge-verify/references/verification-checklists/tech.md +35 -0
- package/dist/agent-targets.d.ts +1 -1
- package/dist/agent-targets.js +23 -3
- package/dist/detect.d.ts +1 -1
- package/dist/detect.js +2 -1
- package/dist/manifest.d.ts +1 -1
- package/dist/manifest.js +2 -2
- package/dist/placements.js +5 -1
- package/dist/rauf.d.ts +4 -4
- package/dist/rauf.js +3 -3
- package/dist/types.d.ts +31 -6
- package/dist/types.js +6 -3
- package/package.json +14 -3
- package/adapters/claude/skills/forge-4-backlog/references/forge-config-schema.json +0 -236
- package/adapters/claude/skills/forge-6-docs/references/pipeline-state-schema.json +0 -191
- package/adapters/claude/skills/forge-verify/references/verification-checklists.md +0 -477
- package/adapters/codex/skills/forge-1-prd/references/pipeline-state-schema.json +0 -191
- package/adapters/codex/skills/forge-2-tech/references/pipeline-state-schema.json +0 -191
- package/adapters/codex/skills/forge-3-specs/references/pipeline-state-schema.json +0 -191
- package/adapters/codex/skills/forge-4-backlog/references/pipeline-state-schema.json +0 -191
- package/adapters/codex/skills/forge-5-loop/references/forge-config-schema.json +0 -236
- package/adapters/codex/skills/forge-6-docs/references/pipeline-state-schema.json +0 -191
- package/adapters/codex/skills/forge-verify/references/verification-checklists.md +0 -477
- package/adapters/copilot/skills/forge-1-prd/references/pipeline-state-schema.json +0 -191
- package/adapters/copilot/skills/forge-2-tech/references/pipeline-state-schema.json +0 -191
- package/adapters/copilot/skills/forge-3-specs/references/pipeline-state-schema.json +0 -191
- package/adapters/copilot/skills/forge-4-backlog/references/forge-config-schema.json +0 -236
- package/adapters/copilot/skills/forge-4-backlog/references/pipeline-state-schema.json +0 -191
- package/adapters/copilot/skills/forge-5-loop/references/forge-config-schema.json +0 -236
- package/adapters/copilot/skills/forge-6-docs/references/pipeline-state-schema.json +0 -191
- package/adapters/copilot/skills/forge-verify/references/verification-checklists.md +0 -477
- package/adapters/cursor/skills/forge-1-prd/references/pipeline-state-schema.json +0 -191
- package/adapters/cursor/skills/forge-2-tech/references/pipeline-state-schema.json +0 -191
- package/adapters/cursor/skills/forge-3-specs/references/pipeline-state-schema.json +0 -191
- package/adapters/cursor/skills/forge-4-backlog/references/forge-config-schema.json +0 -236
- package/adapters/cursor/skills/forge-4-backlog/references/pipeline-state-schema.json +0 -191
- package/adapters/cursor/skills/forge-5-loop/references/forge-config-schema.json +0 -236
- package/adapters/cursor/skills/forge-6-docs/references/pipeline-state-schema.json +0 -191
- package/adapters/cursor/skills/forge-verify/references/verification-checklists.md +0 -477
- package/adapters/gemini/skills/forge-1-prd/references/pipeline-state-schema.json +0 -191
- package/adapters/gemini/skills/forge-2-tech/references/pipeline-state-schema.json +0 -191
- package/adapters/gemini/skills/forge-3-specs/references/pipeline-state-schema.json +0 -191
- package/adapters/gemini/skills/forge-4-backlog/references/forge-config-schema.json +0 -236
- package/adapters/gemini/skills/forge-4-backlog/references/pipeline-state-schema.json +0 -191
- package/adapters/gemini/skills/forge-5-loop/references/forge-config-schema.json +0 -236
- package/adapters/gemini/skills/forge-6-docs/references/pipeline-state-schema.json +0 -191
- package/adapters/gemini/skills/forge-verify/references/verification-checklists.md +0 -477
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
# Shared Pipeline Conventions
|
|
2
|
+
|
|
3
|
+
These conventions apply to every forge pipeline skill. Skills reference this file to avoid duplicating shared logic.
|
|
4
|
+
|
|
5
|
+
## Feature Name Requirement
|
|
6
|
+
|
|
7
|
+
Every pipeline skill requires a feature name as the first argument (e.g., `/skill:forge-1-prd auth`).
|
|
8
|
+
|
|
9
|
+
If no feature name is provided:
|
|
10
|
+
1. STOP IMMEDIATELY
|
|
11
|
+
2. Do NOT attempt to guess or infer a feature name
|
|
12
|
+
3. Ask the user to provide one
|
|
13
|
+
4. Do NOT proceed until a feature name is explicitly given
|
|
14
|
+
5. The feature name must be a single kebab-case token. If the user provides multiple words (e.g., "user auth flow"), convert to kebab-case: `user-auth-flow`.
|
|
15
|
+
|
|
16
|
+
## User Input Protocol
|
|
17
|
+
|
|
18
|
+
### CRITICAL GUARDRAIL: Use AskUserQuestion for All Questions
|
|
19
|
+
|
|
20
|
+
You MUST use the `AskUserQuestion` tool whenever you need the user's input before proceeding. This includes yes/no confirmations, choices between options, interview questions, and feedback on artifacts. NEVER output questions as inline prose text — the user may not be prompted and the session will stall.
|
|
21
|
+
|
|
22
|
+
**Required turn structure:** Output your analysis, findings, or context as regular text. Then call `AskUserQuestion` with your questions. Do NOT mix questions into your text output.
|
|
23
|
+
|
|
24
|
+
**WRONG — questions as inline prose (causes stalling):**
|
|
25
|
+
```
|
|
26
|
+
I found that the codebase uses React and TanStack Router. Here are my questions:
|
|
27
|
+
1. Where should this component live?
|
|
28
|
+
2. Should we use server-side rendering?
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**RIGHT — context as text, questions via tool:**
|
|
32
|
+
```
|
|
33
|
+
I found that the codebase uses React and TanStack Router.
|
|
34
|
+
[then call AskUserQuestion with: "1. Where should this component live? 2. Should we use server-side rendering?"]
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Decision Support: Help the User Choose
|
|
38
|
+
|
|
39
|
+
When an `AskUserQuestion` carries substantive options (a real choice — not a trivial yes/no confirmation), do not just list them. The interview stages have already done codebase research and integration analysis; surfacing that synthesis at the decision moment is the whole point. For every such question:
|
|
40
|
+
|
|
41
|
+
- **Lead with a recommended option.** Place it first and label it `(recommended)` (matching the `AskUserQuestion` "(Recommended)" convention).
|
|
42
|
+
- **Put the trade-off in each option's `description`.** Say why you'd pick it and what you give up versus the alternatives — the cost, not just the benefit.
|
|
43
|
+
- **State a one-line rationale** in the text before the question for *why* the recommendation wins.
|
|
44
|
+
|
|
45
|
+
Two modes, and make clear which one you're in:
|
|
46
|
+
|
|
47
|
+
- **Evidence-backed** — codebase evidence, an established convention, or a clear technical rationale favors one option. Recommend it with confidence and cite the evidence ("the codebase already uses X, so…").
|
|
48
|
+
- **Preference** — no option clearly wins (taste, team workflow, risk appetite). Still offer a sensible **default** and the trade-offs, but say plainly this is a judgment call / the user's preference, so you don't manufacture false confidence.
|
|
49
|
+
|
|
50
|
+
**The only thing to avoid is false confidence** — recommending as if evidence-backed when it's really preference. Never respond to the absence of a clear winner by going silent: a defaulted recommendation with honest trade-offs always beats a neutral option dump.
|
|
51
|
+
|
|
52
|
+
For genuinely comparable artifacts (competing module structures, two code snippets, layout variants), use the `AskUserQuestion` `preview` field to show them side-by-side.
|
|
53
|
+
|
|
54
|
+
The **Branch Setup** block below is the reference pattern: a strong recommendation as the first option, rationale inline, the alternative still available, never a hard-stop.
|
|
55
|
+
|
|
56
|
+
## Configuration Reading
|
|
57
|
+
|
|
58
|
+
Read `forge.config.json` from the project root. If it doesn't exist, use defaults.
|
|
59
|
+
|
|
60
|
+
If `forge.config.json` does not exist and no `.pipeline-state.json` files exist anywhere in `{specsDir}/`, suggest: "No forge.config.json found. Run `/skill:forge-init` to create one with defaults, or I'll use built-in defaults. Want me to continue with defaults?"
|
|
61
|
+
|
|
62
|
+
Extract these config values (use defaults if not present):
|
|
63
|
+
- `specsDir` (default: `./specs`)
|
|
64
|
+
- `docsDir` (default: `./docs/architecture`)
|
|
65
|
+
- `backlogDir` (default: null — backlog lives at `{specsDir}/{feature}/backlog.json`; when `backlogDir` is configured, forge-4 composes `{backlogDir}/{feature}/`)
|
|
66
|
+
- `gitCommitAfterStage` (default: true)
|
|
67
|
+
- `commitPrefix` (default: `forge`)
|
|
68
|
+
- `branchPerFeature` (default: true)
|
|
69
|
+
- `branchPrefix` (default: `forge/`)
|
|
70
|
+
- `loopIterationMultiplier` (default: `1.5`)
|
|
71
|
+
- `autoInvokeNextStage` (default: `true` — the `/skill:forge` navigator auto-invokes the next stage via the `Skill` tool after the user confirms; `false` keeps copy-paste behavior. Navigator-only.)
|
|
72
|
+
- `contextWindowTokens` (default: `null` — context window used by the navigator's context-usage check; `null` infers from the session model and falls back to 200000. Set to the model's window, e.g. `1000000` on a 1M model. Navigator-only.)
|
|
73
|
+
- `contextWarnThreshold` (default: `0.7` — fraction of the window past which the navigator recommends a clean session. Navigator-only.)
|
|
74
|
+
- `autoVerify` (default: `false` — when `true`, `forge-verify` runs automatically after a stage completes, no prompt. **In-stage-primary:** the just-completed authoring stage runs it itself, in-session, before the exit block (honoring the verify-before-clear principle). The navigator runs it only as a **catch-up** when verify is still pending (a host that could not dispatch a clean-room subagent, or a stage run before this behavior landed). Either way it runs in a fresh clean-room subagent, so it never needs a `/clear` and costs only a compact digest.)
|
|
75
|
+
- `autoVerifyStages` (default: `{}` — per-stage overrides for `autoVerify`, e.g. `{"forge-1-prd": false}`. Effective value = `autoVerifyStages[stage]` if present, else `autoVerify`. Keys are constrained to the five verify-capable stages; a typo is a config error surfaced as `invalidAutoVerifyKeys`. Both the in-stage run and the navigator catch-up read this same effective value.)
|
|
76
|
+
- `autoFix` (default: `false` — when `true`, `forge-fix` is chained after an auto-verify that finds issues — by the in-stage run (primary) or the navigator catch-up — but only when auto-verify is on for that stage AND preconditions hold (zero unresolved decisions, clean tree, passing re-verify); otherwise a digest is surfaced and the gate is presented.)
|
|
77
|
+
- `loopRunner` (optional object — the loop runner to drive; **defaults to rauf** when absent, with every command templated. See `references/forge-config-schema.json` and `references/ralph-loop-contract.md`.)
|
|
78
|
+
|
|
79
|
+
## Feature Directory Resolution
|
|
80
|
+
|
|
81
|
+
Before any file I/O against a feature's artifacts, resolve its directory through the deterministic helper rather than hardcoding `{specsDir}/{feature}/`. This makes flat (`{specsDir}/{feature}/`) and nested (`{specsDir}/{epic}/{feature}/`) layouts both resolve from a bare feature name (REQ-DIR-03), with standalone features behaving exactly as today.
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
R="$(bash -c 'for d in "${CLAUDE_PLUGIN_ROOT:-}" "$HOME"/.claude/skills/feature-forge "$HOME"/.claude/plugins/cache/*/feature-forge/* "$HOME"/.claude/plugins/*/feature-forge "$HOME"/.agents/skills/feature-forge ./.agents/skills/feature-forge; do [ -x "$d/scripts/forge-root.sh" ] && exec "$d/scripts/forge-root.sh"; done')"
|
|
85
|
+
[ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
|
|
86
|
+
resolvedFeatureDir=$(python3 "$R/scripts/epic-manifest.py" \
|
|
87
|
+
resolve "<feature>" --specs-dir "<specsDir>")
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
- **Exit 0:** stdout is the absolute feature directory. Use it everywhere this skill previously wrote `{specsDir}/{feature}/`.
|
|
91
|
+
- **Exit 1:** the helper reports a structured finding (`not-found`, `ambiguous` — see `00-core-definitions.md §4`). Because this `resolve` call passes **no `--json`** (the subcommand has no such flag), the finding is a plain `not-found:`/`ambiguous:` line on **stderr** with empty stdout — there is no findings JSON to parse. **STOP** and surface that stderr line verbatim. (The `{valid, findings[]}`-on-stdout envelope is the `--json` shape used by `render-status`/`validate`, not by `resolve`.)
|
|
92
|
+
- **Exit 2:** a usage / safety error (`unsafe-name`, a path-containment escape, missing file). The message is a plain `Error: …` line on **stderr** with empty stdout — there is no findings JSON to parse. **STOP** and surface that stderr line verbatim.
|
|
93
|
+
|
|
94
|
+
In both failure cases, do not fall back to a guessed path.
|
|
95
|
+
|
|
96
|
+
**On `not-found`, check other branches before stopping.** With `branchPerFeature`, the feature's directory (and its `.pipeline-state.json`) may exist only on its topic branch — invisible from the default branch of a fresh clone. Before concluding the pipeline does not exist, run the read-only cross-branch discovery:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
R="$(bash -c 'for d in "${CLAUDE_PLUGIN_ROOT:-}" "$HOME"/.claude/skills/feature-forge "$HOME"/.claude/plugins/cache/*/feature-forge/* "$HOME"/.claude/plugins/*/feature-forge "$HOME"/.agents/skills/feature-forge ./.agents/skills/feature-forge; do [ -x "$d/scripts/forge-root.sh" ] && exec "$d/scripts/forge-root.sh"; done')"
|
|
100
|
+
[ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
|
|
101
|
+
python3 "$R/scripts/forge-session.py" discover-feature "<feature>" --specs-dir "<specsDir>" --json
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
- **Candidates found** (`candidates` and/or `remoteCandidates` non-empty): summarize them as text (branch, recorded stage, whether the state's own `branch` field matches), then use `AskUserQuestion`: **Switch to `{branch}` (recommended)** — run the candidate's `switchCommand` · **Fetch + switch** — for a `needsFetch` remote candidate, run its `fetchCommand` then `switchCommand` (note its contents were matched by name only, not inspected) · **Treat `{feature}` as new on this branch** · **Stop**. A checkout is a mutation inside an otherwise read-only flow: perform it ONLY on the user's explicit accept AND with a clean working tree (`git status --porcelain` prints nothing) — never auto-switch, never with uncommitted changes. After a successful switch, re-run this Feature Directory Resolution block from the top.
|
|
105
|
+
- **Nothing found** (both lists empty): the pipeline genuinely does not exist anywhere discoverable — STOP and surface the original `not-found` stderr line verbatim (or, where the caller offers to start a new pipeline, offer that).
|
|
106
|
+
|
|
107
|
+
**Anti-fabrication guard.** Never describe pipeline state that resolution or discovery did not return: if both come back empty, the pipeline does not exist — say exactly that, and never reconstruct stages, backlogs, or history from conversational memory.
|
|
108
|
+
|
|
109
|
+
**Resolution algorithm (summary; full spec in `02-manifest-helper-cli.md §4`):**
|
|
110
|
+
1. Reject the name if unsafe (path separator, `..`, absolute, or failing `SAFE_NAME_RE`) — before any filesystem access.
|
|
111
|
+
2. If `{specsDir}/{name}/.pipeline-state.json` exists → return that flat path.
|
|
112
|
+
3. Else if exactly one `{specsDir}/*/{name}/.pipeline-state.json` exists → return that nested path.
|
|
113
|
+
4. More than one match anywhere → `ambiguous` error listing all matching paths (uniqueness violation, REQ-DIR-04).
|
|
114
|
+
5. Zero matches → `not-found` error.
|
|
115
|
+
|
|
116
|
+
A directory counts as a **feature** only if it directly contains a `.pipeline-state.json` (the *feature-shaped-dir bound*, `00-core-definitions.md §6`). Non-feature subtrees (`.verification/`, `tests/`, fixture dirs, and the epic root itself — which holds `epic-manifest.json` but no `.pipeline-state.json`) are therefore never matched as features.
|
|
117
|
+
|
|
118
|
+
**Compatibility:** for a standalone feature the resolver returns its flat path with no epic logic engaged (REQ-COMPAT-01/02) — standalone-feature behavior is unchanged. A pre-existing latent name collision is reported for manual cleanup by the navigator / forge-verify epic mode (CHECK-E08), not by aborting an unrelated command whose name resolves to exactly one dir (tech-spec §3.4).
|
|
119
|
+
|
|
120
|
+
## Specs Directory Hygiene
|
|
121
|
+
|
|
122
|
+
Whenever a stage creates the specs tree for the first time (the first PRD or epic written under `{specsDir}/`), ensure a spec-directory agent-instruction file exists at the **specsDir root**. This tells coding agents in the project that the specs here are pre-implementation artifacts — not live contracts to enforce against the code. It is **idempotent: never overwrite an existing file** (the project may have edited it).
|
|
123
|
+
|
|
124
|
+
Run this after creating the feature/epic directory, before the stage's git commit:
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
R="$(bash -c 'for d in "${CLAUDE_PLUGIN_ROOT:-}" "$HOME"/.claude/skills/feature-forge "$HOME"/.claude/plugins/cache/*/feature-forge/* "$HOME"/.claude/plugins/*/feature-forge "$HOME"/.agents/skills/feature-forge ./.agents/skills/feature-forge; do [ -x "$d/scripts/forge-root.sh" ] && exec "$d/scripts/forge-root.sh"; done')"
|
|
128
|
+
[ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
|
|
129
|
+
mkdir -p "<specsDir>"
|
|
130
|
+
[ -f "<specsDir>/AGENTS.md" ] || cp "$R/references/templates/specs-hygiene/AGENTS.md" "<specsDir>/AGENTS.md"
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
If the host is Claude (the `AskUserQuestion` tool is available), also ensure the Claude-framed variant:
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
R="$(bash -c 'for d in "${CLAUDE_PLUGIN_ROOT:-}" "$HOME"/.claude/skills/feature-forge "$HOME"/.claude/plugins/cache/*/feature-forge/* "$HOME"/.claude/plugins/*/feature-forge "$HOME"/.agents/skills/feature-forge ./.agents/skills/feature-forge; do [ -x "$d/scripts/forge-root.sh" ] && exec "$d/scripts/forge-root.sh"; done')"
|
|
137
|
+
[ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
|
|
138
|
+
[ -f "<specsDir>/CLAUDE.md" ] || cp "$R/references/templates/specs-hygiene/CLAUDE.md" "<specsDir>/CLAUDE.md"
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Stage any file this writes (`{specsDir}/AGENTS.md`, and `{specsDir}/CLAUDE.md` when written) as part of the stage's existing git commit.
|
|
142
|
+
|
|
143
|
+
## Epic Context Injection
|
|
144
|
+
|
|
145
|
+
After resolving the feature directory, check the feature's `.pipeline-state.json` for an `epic` back-pointer. **If absent, skip this block entirely** (standalone feature — REQ-COMPAT-01; standalone-feature behavior is unchanged). **If present**, load exactly the following context, and nothing transitive (REQ-CTX-01):
|
|
146
|
+
|
|
147
|
+
1. **`{specsDir}/{epic}/EPIC.md`** — the epic narrative, including the per-feature Contracts sections.
|
|
148
|
+
2. **This feature's `charter`** — read from `{specsDir}/{epic}/epic-manifest.json` (the `features[]` entry whose `name` matches), together with its `exposes` and `consumes` arrays. These are the feature's **contract obligations** (REQ-CTX-02): what it must expose to dependents and what it consumes from dependencies.
|
|
149
|
+
3. **Direct completed dependencies only** — for each `name` in this feature's `dependsOn`, resolve that sibling's directory and, **only if it is complete-for-orchestration** (`00-core-definitions.md §7`), load its `PRD.md` and `tech-spec.md`.
|
|
150
|
+
|
|
151
|
+
**Do NOT load** transitive (indirect) dependencies' specs. Indirect contracts reach this feature only through the *direct* deps' Contracts sections in `EPIC.md`. This bounds context size and keeps the injected set deterministic (REQ-CTX-01).
|
|
152
|
+
|
|
153
|
+
To obtain the manifest contracts and the live completion status of each dependency in one deterministic call, run `render-status` and read the per-feature `status` and the `consumes`/`exposes` arrays rather than re-deriving them:
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
R="$(bash -c 'for d in "${CLAUDE_PLUGIN_ROOT:-}" "$HOME"/.claude/skills/feature-forge "$HOME"/.claude/plugins/cache/*/feature-forge/* "$HOME"/.claude/plugins/*/feature-forge "$HOME"/.agents/skills/feature-forge ./.agents/skills/feature-forge; do [ -x "$d/scripts/forge-root.sh" ] && exec "$d/scripts/forge-root.sh"; done')"
|
|
157
|
+
[ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
|
|
158
|
+
python3 "$R/scripts/epic-manifest.py" \
|
|
159
|
+
render-status "<epic>" --specs-dir "<specsDir>" --json
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
If `render-status` fails, proceed with **only** EPIC.md + charter (a corrupt manifest must not silently inject stale dep specs — REQ-ROBUST-02): on **exit 1**, parse the `{findings[]}` JSON from stdout and surface each; on **exit 2**, surface the plain `Error:` line from stderr verbatim. Do not attempt to parse findings JSON on an exit-2 failure (stdout is empty).
|
|
163
|
+
|
|
164
|
+
**After injecting context, invoke the Epic-Member Base Guard block below** (it self-gates to a no-op for standalone features and features that do not resolve as a nested member).
|
|
165
|
+
|
|
166
|
+
## Epic-Member Base Guard
|
|
167
|
+
|
|
168
|
+
Defense-in-depth for the split-brain-epic failure (Issue #125). Invoke this block in the authoring stages (`forge-1-prd`..`forge-4-backlog`) once the feature has resolved — right after **Epic Context Injection** for the stages that run it (`forge-1-prd`..`forge-3-specs`), and right after **Feature Directory Resolution** for `forge-4-backlog`. It confirms that a **resolved nested epic member** actually sits on a branch that contains the epic's manifest. Without this, a member reached from a branch cut *before* the epic-manifest commit (or that otherwise lacks it) would author specs against an epic decomposition that is not present — the exact drift that produces a disjoint, split-brain member. **Skip if not a git repo or `branchPerFeature` is false.**
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
R="$(bash -c 'for d in "${CLAUDE_PLUGIN_ROOT:-}" "$HOME"/.claude/skills/feature-forge "$HOME"/.claude/plugins/cache/*/feature-forge/* "$HOME"/.claude/plugins/*/feature-forge "$HOME"/.agents/skills/feature-forge ./.agents/skills/feature-forge; do [ -x "$d/scripts/forge-root.sh" ] && exec "$d/scripts/forge-root.sh"; done')"
|
|
172
|
+
[ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
|
|
173
|
+
python3 "$R/scripts/forge-session.py" check-epic-base --feature "{feature}" --specs-dir "{specsDir}" --json
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Act on the emitted `action`:
|
|
177
|
+
- **`none`** — a standalone feature (no epic to check) or the manifest is present on the current branch. Proceed silently. This is the no-op path for standalone features (REQ-COMPAT-01), so standalone behavior is unchanged.
|
|
178
|
+
- **`not-resolved`** — the feature does not resolve on the current branch. Proceed silently (the caller's own resolution already handled that case).
|
|
179
|
+
- **`warn-detached-base`** — a nested member resolves here but the epic's `epic-manifest.json` is **absent on this branch**. **STOP** unless `--force` was passed, and surface verbatim (filling `{epic}` and `{homeBranch}` from the payload's `epic` and `homeBranch`):
|
|
180
|
+
> `{feature}` is a member of epic `{epic}`, but this branch does not contain the epic manifest (`{specsDir}/{epic}/epic-manifest.json`). This base predates or lacks the epic. Switch to the epic's home branch `{homeBranch}` and re-run, or pass `--force` to author against a detached base anyway.
|
|
181
|
+
|
|
182
|
+
With `--force`, log a one-line warning ("Authoring `{feature}` against a detached epic base — manifest not on this branch") and proceed, consistent with the other guards.
|
|
183
|
+
|
|
184
|
+
If the helper is unavailable (a non-Claude host without the resolver), skip this block — it is best-effort defense in depth, not a hard prerequisite.
|
|
185
|
+
|
|
186
|
+
## Pipeline State Protocol
|
|
187
|
+
|
|
188
|
+
Pipeline state is written by the `state-*` verbs of `scripts/forge-session.py` — never by hand. Each verb writes `{resolvedFeatureDir}/.pipeline-state.json` atomically, conforms to `references/pipeline-state-schema.json` by construction, and refreshes `updatedAt` for you, so no stage needs to read the schema in order to author state.
|
|
189
|
+
|
|
190
|
+
**Epic members MUST pass `--epic`.** Every `state-*` verb takes an optional `--epic "{epic}"`, and it is **required** whenever the feature is an epic member (its resolved directory is `{specsDir}/{epic}/{feature}/`, i.e. its state carries an `epic` back-pointer) — append it to **every** `state-*` call in this file and in every skill body, exactly as the `state-ecr` calls already do. Omit it only for a standalone feature. Without it the verb resolves the bare name itself and, mirroring `epic-manifest.py resolve`, refuses with exit 2 whenever more than one directory carries a state file rather than guessing which feature to write — so a same-named standalone feature can never be mutated in a member's place.
|
|
191
|
+
|
|
192
|
+
If a `state-*` verb exits 2, surface the plain `Error:` line from stderr verbatim, do **not** proceed to the next step of the surrounding protocol, and do **not** hand-author the JSON as a workaround. The stage remains resumable because the entry stamp is already on disk — re-run the verb once the cause is fixed.
|
|
193
|
+
|
|
194
|
+
### Staleness Detection (Read-Time)
|
|
195
|
+
|
|
196
|
+
When loading upstream artifacts as prerequisites, check `basedOnVersions` in the pipeline state for this stage. If any upstream stage's current version is newer than the version recorded in `basedOnVersions`, warn the user before proceeding:
|
|
197
|
+
|
|
198
|
+
> "This stage was built against {upstream} v{old}, but {upstream} is now at v{new}. The current artifacts may be outdated. Consider re-running this stage, or use --force to proceed with potentially stale inputs."
|
|
199
|
+
|
|
200
|
+
Frame the choice with its cost: re-running re-derives this stage from the current upstream (safest, but discards any hand-edits to this stage's artifacts); proceeding stale is faster but risks baking outdated assumptions into everything downstream. Recommend re-running unless the user knows the upstream change doesn't affect this stage.
|
|
201
|
+
|
|
202
|
+
## Branch Setup
|
|
203
|
+
|
|
204
|
+
Invoke this block at the **very start** of a pipeline entry point — `forge-1-prd` (standalone feature) and `forge-0-epic` (epic) — **before** any directory resolution or interview, so the rest of the run lands on the intended branch. `{label}` is the feature name (forge-1-prd) or epic name (forge-0-epic); `{scope}` is `feature` or `epic` correspondingly.
|
|
205
|
+
|
|
206
|
+
**Gate.** Run this block only when the project uses git (a `.git` directory resolves) **and** `branchPerFeature` is true. It is **independent of `gitCommitAfterStage`** — branch isolation matters whether or not forge auto-commits. If `branchPerFeature` is false, skip silently.
|
|
207
|
+
|
|
208
|
+
**Epic-member inheritance.** In `forge-1-prd`, if the feature has an `epic` back-pointer (an `epic` field resolves via Epic Context Injection, or the directory is nested under an epic), the epic already established the branch in `forge-0-epic`. Skip the prompt — inherit the current branch.
|
|
209
|
+
|
|
210
|
+
**Detection, then a branch-aware prompt:**
|
|
211
|
+
|
|
212
|
+
1. Read the current branch: `git rev-parse --abbrev-ref HEAD`.
|
|
213
|
+
2. Determine the default branch: `git symbolic-ref --quiet refs/remotes/origin/HEAD` (strip to the last path segment); if that fails, fall back to `main`, else `master` — whichever the repo has.
|
|
214
|
+
3. **If the current branch is NOT the default branch** (the user is already on a topic/`{branchPrefix}*` branch) → record it (see below) and proceed silently. Do not prompt.
|
|
215
|
+
4. **If the current branch IS the default branch** → use `AskUserQuestion` with a **strong recommendation** (still optional):
|
|
216
|
+
|
|
217
|
+
> "You're on `{defaultBranch}`. Strongly recommended: create `{branchPrefix}{label}` so this {scope}'s work stays isolated and reviewable as one branch. Create it?"
|
|
218
|
+
> Options: **Create `{branchPrefix}{label}` (recommended)** · **Stay on `{defaultBranch}`**
|
|
219
|
+
|
|
220
|
+
- **Create** → `git switch -c {branchPrefix}{label}` (or `git checkout -b` if `switch` is unavailable). If the branch already exists, `git switch {branchPrefix}{label}`.
|
|
221
|
+
- **Stay** → proceed on the default branch; note that subsequent commits (and any `forge-5-loop` run) will land directly on `{defaultBranch}`.
|
|
222
|
+
|
|
223
|
+
**Record the branch.** After this block resolves, record the resulting branch name in the feature's top-level `branch` field by running `state-branch` (create/update it when the state file is first written for this stage). Emit the call **once the feature directory exists** — i.e. after Feature Directory Resolution and the Entry Stamp, **not** at this block: Branch Setup runs at the very start of the entry point, before any directory resolution, and a brand-new standalone feature may have no directory yet. Add `--epic "{epic}"` to the call when this feature is an epic member — required, per the Pipeline State Protocol.
|
|
224
|
+
|
|
225
|
+
```bash
|
|
226
|
+
R="$(bash -c 'for d in "${CLAUDE_PLUGIN_ROOT:-}" "$HOME"/.claude/skills/feature-forge "$HOME"/.claude/plugins/cache/*/feature-forge/* "$HOME"/.claude/plugins/*/feature-forge "$HOME"/.agents/skills/feature-forge ./.agents/skills/feature-forge; do [ -x "$d/scripts/forge-root.sh" ] && exec "$d/scripts/forge-root.sh"; done')"
|
|
227
|
+
[ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
|
|
228
|
+
python3 "$R/scripts/forge-session.py" state-branch \
|
|
229
|
+
--feature "{feature}" --branch "<name>" --specs-dir "{specsDir}"
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
Downstream stages and `forge-5-loop` read it to detect drift back onto the default branch.
|
|
233
|
+
|
|
234
|
+
## Branch Reconciliation
|
|
235
|
+
|
|
236
|
+
The recorded `branch` is a **self-healing hint, not gospel.** A hosted environment (Claude.ai remote, cloud agents) can impose an arbitrary session branch (e.g. `claude/<slug>`) that Branch Setup silently records; the user may then move the work to the intended topic branch, leaving the recorded field stale. Every branch-aware mechanism (the `forge-5-loop` guard, `discover-feature`) keys off that field, so a stale value actively misleads — the loop would offer to switch you *back* to the imposed branch. Invoke this block from `forge-5-loop`'s pre-flight (and any stage that acts on the recorded branch) to reconcile deterministically. Skip if not a git repo or `branchPerFeature` is false.
|
|
237
|
+
|
|
238
|
+
```bash
|
|
239
|
+
R="$(bash -c 'for d in "${CLAUDE_PLUGIN_ROOT:-}" "$HOME"/.claude/skills/feature-forge "$HOME"/.claude/plugins/cache/*/feature-forge/* "$HOME"/.claude/plugins/*/feature-forge "$HOME"/.agents/skills/feature-forge ./.agents/skills/feature-forge; do [ -x "$d/scripts/forge-root.sh" ] && exec "$d/scripts/forge-root.sh"; done')"
|
|
240
|
+
[ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
|
|
241
|
+
python3 "$R/scripts/forge-session.py" reconcile-branch --feature "{feature}" --specs-dir "{specsDir}" --json
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
Act on the emitted `action` (source of truth is where the state actually resolves, not the recorded field):
|
|
245
|
+
- **`adopt-current`** — you are on a non-default topic branch where the state resolves, and the recorded `branch` differs (a stale/imposed value). Run `state-branch` (below) to write `newBranch` into the state `branch` field, with a **visible one-line note** ("recorded branch was `{stateBranch}`; work is on `{currentBranch}` — updating to match") — never silently, and **never push the user back** to the recorded branch (offer that only as a plain alternative).
|
|
246
|
+
- **`warn-drift`** — you are on the **default** branch and the state records a topic branch. Via `AskUserQuestion`, strongly recommend creating/switching to `{branchPrefix}{feature}` (then record it), still allowing **proceed on the default branch**. Never hard-stop.
|
|
247
|
+
- **`none`** / **`not-resolved`** — nothing to do; proceed.
|
|
248
|
+
|
|
249
|
+
The `adopt-current` write, with the portable plugin-root prelude. Add `--epic "{epic}"` when this feature is an epic member — required, per the Pipeline State Protocol:
|
|
250
|
+
|
|
251
|
+
```bash
|
|
252
|
+
R="$(bash -c 'for d in "${CLAUDE_PLUGIN_ROOT:-}" "$HOME"/.claude/skills/feature-forge "$HOME"/.claude/plugins/cache/*/feature-forge/* "$HOME"/.claude/plugins/*/feature-forge "$HOME"/.agents/skills/feature-forge ./.agents/skills/feature-forge; do [ -x "$d/scripts/forge-root.sh" ] && exec "$d/scripts/forge-root.sh"; done')"
|
|
253
|
+
[ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
|
|
254
|
+
python3 "$R/scripts/forge-session.py" state-branch \
|
|
255
|
+
--feature "{feature}" --branch "{newBranch}" --specs-dir "{specsDir}"
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
If the helper is unavailable (non-Claude host without the resolver), fall back to the manual check: current branch differs from recorded → adopt the current branch unless it is the default, in which case recommend creating `{branchPrefix}{feature}`.
|
|
259
|
+
|
|
260
|
+
## Git Commit Protocol
|
|
261
|
+
|
|
262
|
+
When `gitCommitAfterStage` is true, follow this exact order to avoid state inconsistency.
|
|
263
|
+
|
|
264
|
+
**Why two commits.** The stage's `.pipeline-state.json` is itself part of the staged commit, but the stage's `commitHash` cannot be known until *after* that commit is made. Recording it *inside* the same commit is a chicken-and-egg with no single-commit solution. Resolve it with a **deterministic two-commit sequence**, and **never** with `git commit --amend`: amending rewrites HEAD, so a hash captured before the amend points at an orphaned commit that is not in the final history (the exact defect this protocol exists to prevent).
|
|
265
|
+
|
|
266
|
+
1. **Stage specific files only:** `git add {specsDir}/{feature}/` — never use `git add -A` or `git add .`
|
|
267
|
+
2. **Commit 1 — artifacts + state, hash not yet known:** Run `state-complete --feature {feature} --stage {stage} --version N …` (which sets this stage's `status: "complete"`, `completedAt`, `version`, `basedOnVersions`, `artifacts` and `commitHash: null`, and applies the downstream staleness cascade), then `git commit -m "{commitPrefix}({feature}): <action>"`. This is the stage's **artifact commit**; its hash is the provenance hash callers rely on.
|
|
268
|
+
3. **If Commit 1 succeeds — Commit 2 records the hash:** Capture the hash of Commit 1 (`git rev-parse HEAD`) by running `state-complete --feature {feature} --stage {stage} --version N --commit-hash $(git rev-parse HEAD)`, which writes it into this stage's `commitHash` and touches nothing else, then commit only that one-line change: `git add {specsDir}/{feature}/.pipeline-state.json && git commit -m "{commitPrefix}({feature}): record stage commit hash"`. The stored `commitHash` now points at the artifact commit (Commit 1) — never at Commit 2, and never at an orphaned amend. The working tree is clean afterward, so the next stage's dirty-tree check passes.
|
|
269
|
+
4. **If Commit 1 fails:** do NOT update pipeline state to complete. Report the error to the user and leave state as `in-progress` so the stage can be resumed. Do that with `state-complete --feature {feature} --stage {stage} --version N --resumable`, which records **only** `status` — no `completedAt`, no version bump, no `basedOnVersions`/`artifacts`, no `commitHash` reset, and no staleness cascade, so the stage stays resumable. (`--version` is still REQUIRED by argparse and must be passed even though `--resumable` does not write it; omitting it makes the recovery command exit 2 every time.) Common failure causes:
|
|
270
|
+
- **Pre-commit hook failure:** Report the hook output. Never use `--no-verify` to bypass. Help the user fix the underlying issue.
|
|
271
|
+
- **Merge conflicts:** Report conflicting files. Suggest resolution steps appropriate to the conflict.
|
|
272
|
+
- **Nothing to commit:** If all artifacts were already committed, this is fine — mark the stage `complete`, leave `commitHash` at its existing value (or `null` if there was never an artifact commit), and skip Commit 2. Pass `--preserve-commit-hash` on the Commit-1 `state-complete` call so the recorded hash is left alone instead of being reset to `null`. There is no new artifact commit to record.
|
|
273
|
+
5. **Never** use `git add -A`, `--amend`, `--no-verify`, or `--force` flags
|
|
274
|
+
|
|
275
|
+
The two `state-complete` calls, with the portable plugin-root prelude. Add `--epic "{epic}"` to each when this feature is an epic member — required, per the Pipeline State Protocol:
|
|
276
|
+
|
|
277
|
+
```bash
|
|
278
|
+
R="$(bash -c 'for d in "${CLAUDE_PLUGIN_ROOT:-}" "$HOME"/.claude/skills/feature-forge "$HOME"/.claude/plugins/cache/*/feature-forge/* "$HOME"/.claude/plugins/*/feature-forge "$HOME"/.agents/skills/feature-forge ./.agents/skills/feature-forge; do [ -x "$d/scripts/forge-root.sh" ] && exec "$d/scripts/forge-root.sh"; done')"
|
|
279
|
+
[ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
|
|
280
|
+
# Commit 1 — before `git commit`
|
|
281
|
+
python3 "$R/scripts/forge-session.py" state-complete \
|
|
282
|
+
--feature "{feature}" --stage "{stage}" --version {n} \
|
|
283
|
+
--based-on "<upstream>=<n>" --artifact "<file>" --specs-dir "{specsDir}"
|
|
284
|
+
# Commit 2 — after Commit 1 lands, so its hash exists
|
|
285
|
+
python3 "$R/scripts/forge-session.py" state-complete \
|
|
286
|
+
--feature "{feature}" --stage "{stage}" --version {n} \
|
|
287
|
+
--commit-hash "$(git rev-parse HEAD)" --specs-dir "{specsDir}"
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
## Stage-Entry Guard
|
|
291
|
+
|
|
292
|
+
Invoke this block at the **start of an authoring stage** (`forge-1-prd`..`forge-4-backlog`), **after** Feature Directory Resolution and **before** any interview or (re-)authoring. It prevents a re-entered stage — an injected skill body or a re-invoked `Skill` — from blindly re-running the interview over an in-progress or already-complete draft. `{stage}` is the invoking skill's id (e.g. `forge-2-tech`).
|
|
293
|
+
|
|
294
|
+
**Read, then classify** this stage's entry in `{resolvedFeatureDir}/.pipeline-state.json` (`stages.{stage}.status`):
|
|
295
|
+
|
|
296
|
+
1. **Fresh** — no state file yet, or `stages.{stage}` is absent/`pending`. First run of this stage. Proceed to the **Entry Stamp** below, then author normally. No prompt.
|
|
297
|
+
|
|
298
|
+
2. **Interrupted** (`status: "in-progress"`) — a previous run of THIS stage was interrupted before it committed (the exit commit is what flips it to `complete`, so `in-progress` on entry always means a crash/abandon). Do **not** silently re-author. Instead:
|
|
299
|
+
- **Inventory on-disk artifacts:** list the files this stage produces that already exist in `{resolvedFeatureDir}/` (e.g. `PRD.md`; `tech-spec.md`; the `##-*.md` suite + `TRACEABILITY.md`; `backlog.json`), and cross-check against the `stages.{stage}.artifacts` array (written incrementally during the previous run).
|
|
300
|
+
- **Gate via `AskUserQuestion`** (Decision Support protocol): present the inventory as text, then ask "This {stage} run was interrupted — {N} artifact(s) from the previous run are on disk: {list}. Resume the in-progress draft, or start a new version from scratch?" Options: **Resume (recommended)** — continue from the first artifact not yet written/complete, reusing the existing files; do **not** re-stamp or bump the version. · **Start a new version** — treat it as a fresh authoring pass (proceed to the Entry Stamp; the version increments at exit).
|
|
301
|
+
- Skip artifact regeneration for files that already exist and are complete (non-empty, properly structured); continue from the next unwritten artifact.
|
|
302
|
+
|
|
303
|
+
3. **Re-authoring** (`status: "complete"` or `"stale"`) — a finished draft exists. Warn via `AskUserQuestion` before overwriting: "A completed {stage} artifact already exists for '{feature}' (v{n}{, marked stale}). Continuing will create a new version. Proceed?" On confirm, proceed to the Entry Stamp and author a new version (the version increments at exit, per that stage's Update-Pipeline-State step).
|
|
304
|
+
|
|
305
|
+
**Entry Stamp** (fresh, restart, and re-author paths — NOT the resume path). Before authoring, record the entry stamp by running `state-enter` — one atomic write that sets `stages.{stage}.status` → `"in-progress"`, `stages.{stage}.startedAt` → current ISO-8601 UTC timestamp, top-level `currentStage` → `"{stage}"` (where the pipeline IS, per O1), and refreshes `updatedAt`. Add `--epic "{epic}"` when this feature is an epic member — required, per the Pipeline State Protocol:
|
|
306
|
+
|
|
307
|
+
```bash
|
|
308
|
+
R="$(bash -c 'for d in "${CLAUDE_PLUGIN_ROOT:-}" "$HOME"/.claude/skills/feature-forge "$HOME"/.claude/plugins/cache/*/feature-forge/* "$HOME"/.claude/plugins/*/feature-forge "$HOME"/.agents/skills/feature-forge ./.agents/skills/feature-forge; do [ -x "$d/scripts/forge-root.sh" ] && exec "$d/scripts/forge-root.sh"; done')"
|
|
309
|
+
[ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
|
|
310
|
+
python3 "$R/scripts/forge-session.py" state-enter \
|
|
311
|
+
--feature "{feature}" --stage "{stage}" --specs-dir "{specsDir}"
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
This write is **left uncommitted**: it is staged and committed as part of this stage's existing exit commit (Git Commit Protocol), so no extra commit is needed at entry. If the run is interrupted after the stamp but before the exit commit, the marker survives on disk (uncommitted) and the next entry classifies as **Interrupted** — which is exactly the intent.
|
|
315
|
+
|
|
316
|
+
**Force Mode.** When `--force` is passed, skip the interactive gate: do not prompt for resume-vs-restart or the re-author warning. Treat entry as a fresh restart — apply the Entry Stamp and author. (`--force` already skips prerequisite checks; here it likewise bypasses the self-stage gate. Existing on-disk artifacts are still loaded per Force Mode.)
|
|
317
|
+
|
|
318
|
+
**Incremental artifact tracking:** When a stage writes multiple files (e.g. forge-3-specs writing a suite of spec documents), run `state-artifact --feature {feature} --stage {stage} --path <file>` after writing each file — not just at stage completion. This is what makes the Interrupted inventory above precise about which files were successfully written. Add `--epic "{epic}"` when this feature is an epic member — required, per the Pipeline State Protocol.
|
|
319
|
+
|
|
320
|
+
```bash
|
|
321
|
+
R="$(bash -c 'for d in "${CLAUDE_PLUGIN_ROOT:-}" "$HOME"/.claude/skills/feature-forge "$HOME"/.claude/plugins/cache/*/feature-forge/* "$HOME"/.claude/plugins/*/feature-forge "$HOME"/.agents/skills/feature-forge ./.agents/skills/feature-forge; do [ -x "$d/scripts/forge-root.sh" ] && exec "$d/scripts/forge-root.sh"; done')"
|
|
322
|
+
[ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
|
|
323
|
+
python3 "$R/scripts/forge-session.py" state-artifact \
|
|
324
|
+
--feature "{feature}" --stage "{stage}" --path "<file>" --specs-dir "{specsDir}"
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
## Stage-Completion Re-check
|
|
328
|
+
|
|
329
|
+
Invoke this block **at the head of any post-entry step that writes a stage artifact or runs the Scripted Stage Exit** — the Stage-Entry Guard runs only once, at the top of the skill. A **resumed or pasted mid-stage instruction** (e.g. "continue {stage}: write TRACEABILITY.md, run the stage exit") enters *below* the entry guard, so nothing re-checks completion before it overwrites a committed artifact and re-fires a finished exit — data-destructive if followed literally. This re-check is the idempotency backstop for that path. `{stage}` is the invoking skill's id.
|
|
330
|
+
|
|
331
|
+
**Re-read** `stages.{stage}` in `{resolvedFeatureDir}/.pipeline-state.json`, then classify by **provenance** — a legitimate completion runs in the same session that applied this stage's Entry Stamp; a replayed continuation finds a finished stage it did not produce:
|
|
332
|
+
|
|
333
|
+
1. **Proceed** when `stages.{stage}.status` is `"in-progress"` (this session's Entry Stamp — you are finishing the run you started) or absent/`pending`. Run the write / exit normally.
|
|
334
|
+
|
|
335
|
+
2. **Detect-and-refuse** when ALL of these hold: `stages.{stage}.status ∈ {"complete", "stale"}` **AND** the stage's artifacts (incl. `TRACEABILITY.md` for forge-3-specs) exist on disk **AND** a `commitHash` is recorded for the stage **AND** you did **not** author this stage earlier in the current session. This is a stale/replayed continuation of an already-finished, committed stage. Do **not** overwrite the artifact or re-run the exit. Route instead to the **Stage-Entry Guard**'s *Re-authoring* path: surface the same `AskUserQuestion` warning ("A completed {stage} artifact already exists for '{feature}' (v{n}{, marked stale}). Continuing will create a new version. Proceed?"). Only on explicit confirmation re-enter from the Entry Stamp (the version bumps at exit); otherwise **stop** and report that the stage is already complete — cite the recorded `commitHash` and offer `/skill:forge {feature}` to see true state.
|
|
336
|
+
|
|
337
|
+
When you cannot confirm you authored the current run, treat it as a replay and refuse: a false refuse costs one confirmation click; a false proceed overwrites a committed artifact and re-churns a stage version. `--force` follows Force Mode (skip the gate, treat as a deliberate re-author).
|
|
338
|
+
|
|
339
|
+
## Force Mode
|
|
340
|
+
|
|
341
|
+
If the user passes `--force` as an argument, skip prerequisite validation with a warning:
|
|
342
|
+
|
|
343
|
+
> Force mode: skipping prerequisite checks. Pipeline state tracking may be incomplete — this stage may build on prior stages that were never completed or verified, so its output can be silently wrong. Recommend running `/skill:forge {feature}` after to verify status.
|
|
344
|
+
|
|
345
|
+
Continue with the stage even if prior stages are not marked complete. Still read any existing artifacts (PRD.md, tech-spec.md, etc.) if they exist on disk — force mode skips the pipeline state check, not the artifact loading.
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
---
|
|
2
|
+
# GENERATED — DO NOT EDIT. Source: skills/forge-bootstrap/SKILL.md. Regenerate: python3 scripts/build-adapters.py
|
|
3
|
+
name: forge-bootstrap
|
|
4
|
+
description: Scaffold a brand-new empty repository to a pipeline-ready, green baseline (structure, toolchain, passing lint+test, forge.config.json), then optionally chain into the pipeline. Use when the user runs /skill:forge-bootstrap or asks to bootstrap/scaffold a new empty project for forge. Do NOT trigger on a non-empty repo (that is forge-init), or for general project setup outside the forge pipeline.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Bootstrap a Greenfield Repo
|
|
8
|
+
|
|
9
|
+
Take a **brand-new, empty** repository to a pipeline-ready, **green** baseline — a
|
|
10
|
+
scaffolded stack, a valid `forge.config.json`, and a passing lint+test — then optionally
|
|
11
|
+
chain into the pipeline (Mode B). You own the **conversation and decisions only**; every
|
|
12
|
+
mechanic (the greenfield gate, `git init`, scaffolding, the config write, the toolchain
|
|
13
|
+
probe, the commit) is delegated to the helper `scripts/forge-bootstrap.py`. Never inline
|
|
14
|
+
file generation, template contents, the config field list, or the greenfield allow-list —
|
|
15
|
+
they live in the helper and templates, referenced here, never duplicated.
|
|
16
|
+
|
|
17
|
+
`<target-dir>` below is the project being bootstrapped (default `.`, or the argument) — it is
|
|
18
|
+
**distinct from `$R`**, the plugin root. Drive control flow off the helper's exit codes and
|
|
19
|
+
JSON: **0** = ok, **1** = actionable findings, **2** = usage/IO **or** verify
|
|
20
|
+
toolchain-missing.
|
|
21
|
+
|
|
22
|
+
## Host adaptation (conversational fallback)
|
|
23
|
+
|
|
24
|
+
If the `AskUserQuestion` tool is available, ask the interview questions through it. If it is
|
|
25
|
+
**not** available (a non-Claude host such as Codex), emit the same questions as a single
|
|
26
|
+
**numbered text list** — each line one question with its options in brackets and the default
|
|
27
|
+
marked — then **stop and wait for a single text reply**. Parse the reply positionally
|
|
28
|
+
(answer N → question N); re-prompt only the unparseable items. The question content (text,
|
|
29
|
+
options, defaults) and the conditional gating (Q4 skipped for go/rust/generic; Q6a only for
|
|
30
|
+
monorepo; Q8 only after a verified-green baseline) are **identical** across both paths — only
|
|
31
|
+
the rendering changes. Never assume answers; always wait for the reply.
|
|
32
|
+
|
|
33
|
+
Emit any context as plain text, then route **all** questions through `AskUserQuestion` (or the
|
|
34
|
+
fallback) — never as inline prose questions, which stall the session.
|
|
35
|
+
|
|
36
|
+
## Flow (Mode A — default)
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
1. Portable-root prelude → locate $R
|
|
40
|
+
2. check → gate + recovery detection
|
|
41
|
+
├─ eligible:false (exit 1) → Greenfield refusal — STOP
|
|
42
|
+
└─ resumeMarker != null → Resume / restart / cancel
|
|
43
|
+
3. Interview → assemble the Answers payload
|
|
44
|
+
4. scaffold --answers <json> → git init if absent; compose templates; write config;
|
|
45
|
+
track artifacts into the sentinel
|
|
46
|
+
5. verify → toolchain probe + lint/test per member
|
|
47
|
+
├─ toolchainPresent:false (2) → Missing toolchain: scaffold-anyway-unverified vs abort
|
|
48
|
+
├─ green:false (exit 1) → Not-green: surface failures, offer fix/abort
|
|
49
|
+
└─ green:true (exit 0) → proceed
|
|
50
|
+
6. commit [--stage-only per Q9] → stage exact tracked list; single baseline commit;
|
|
51
|
+
remove the sentinel before staging
|
|
52
|
+
7. Completion summary / Mode B hand-off
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Step 1 — locate the helper
|
|
56
|
+
|
|
57
|
+
Every bash invocation begins with the byte-identical portable-root prelude, then calls the
|
|
58
|
+
helper. Pass `--specs-dir ./specs` (the default) so the gate allow-lists the specs directory.
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
R="$(bash -c 'for d in "${FEATURE_FORGE_ROOT:-}" "$HOME"/.claude/skills/feature-forge "$HOME"/.claude/plugins/cache/*/feature-forge/* "$HOME"/.claude/plugins/*/feature-forge "$HOME"/.agents/skills/feature-forge ./.agents/skills/feature-forge; do [ -x "$d/scripts/forge-root.sh" ] && exec "$d/scripts/forge-root.sh"; done')"
|
|
62
|
+
[ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
|
|
63
|
+
python3 "$R/scripts/forge-bootstrap.py" check "<target-dir>" --json --specs-dir ./specs
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Never hardcode a plugin path or a `~/.claude/...` path — always go through `$R`.
|
|
67
|
+
|
|
68
|
+
### Step 2 — gate (`check`)
|
|
69
|
+
|
|
70
|
+
Read `CheckResult{eligible, disqualifying[], resumeMarker}`.
|
|
71
|
+
|
|
72
|
+
- **`eligible:false` (exit 1) → Greenfield refusal.** Name **every** path in `disqualifying[]`
|
|
73
|
+
verbatim, then direct the user to the right tool — run `forge-init`, then `forge-1-prd`.
|
|
74
|
+
**Touch no files** and STOP (the gate is read-only).
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
This repo is not empty — forge-bootstrap only scaffolds a brand-new project.
|
|
78
|
+
Disqualifying files found:
|
|
79
|
+
- package.json
|
|
80
|
+
- src/index.ts
|
|
81
|
+
To set forge up on an existing project, run: /skill:forge-init
|
|
82
|
+
Then start the pipeline with: /skill:forge-1-prd <feature>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
- **`resumeMarker != null` → Partial-state detected.** A `.forge-bootstrap.json` sentinel
|
|
86
|
+
from this tool's own prior run exists — do **not** treat it as a refusal. Surface the prior
|
|
87
|
+
run's `startedAt` and `artifactsWritten[]`, then ask **resume / restart / cancel**:
|
|
88
|
+
- **Resume** — reuse the sentinel's mirrored `answers` (no re-interview), re-run `scaffold`
|
|
89
|
+
(idempotent — the helper skips already-recorded files), continue from step 5.
|
|
90
|
+
- **Restart** — discard the partial: delete the recorded `artifactsWritten[]` tree + the `.forge-bootstrap.json` sentinel (a skill-orchestration step — the helper has no clean subcommand), then run the interview and `scaffold` fresh.
|
|
91
|
+
- **Cancel** — stop without changes.
|
|
92
|
+
|
|
93
|
+
You perform no cleanup yourself; you only render the choice and dispatch the subcommand.
|
|
94
|
+
|
|
95
|
+
### Step 3 — interview
|
|
96
|
+
|
|
97
|
+
Ask exactly these, in order. Resolved answers become the `Answers` payload handed to
|
|
98
|
+
`scaffold --answers`.
|
|
99
|
+
|
|
100
|
+
| # | Question | Default / seed rule | Options |
|
|
101
|
+
|---|----------|---------------------|---------|
|
|
102
|
+
| Q1 | Project name? | default = target directory basename (confirm) | free-text, pre-filled |
|
|
103
|
+
| Q2 | One-line purpose? | no default; seeds README + config | free-text |
|
|
104
|
+
| Q3 | Language / stack? | required | `typescript` / `python` / `go` / `rust` / `generic` |
|
|
105
|
+
| Q4 | Package manager? | **only when the stack has a choice** — TS: `npm`/`pnpm`/`yarn`, Python: `uv`/`poetry`/`pip`; **skipped** for go/rust/generic | the stack's options |
|
|
106
|
+
| Q5 | License? | **detect & pre-select** from a pre-existing `LICENSE` (see gating); else default `MIT`. The helper keeps an existing `LICENSE` (REQ-SCAF-09) | `MIT` / `Apache-2.0` / `none` |
|
|
107
|
+
| Q6 | Single package or monorepo? | default `single` | `single` / `monorepo` |
|
|
108
|
+
| Q6a | (monorepo only) member count, then per-member name + stack | no default; one member each (mixed-language allowed) | loop |
|
|
109
|
+
| Q7 | Chain into the pipeline now (Mode B)? | default `no` | `no, scaffold only` / `yes, chain in` |
|
|
110
|
+
| Q8 | (Mode B only) First build: feature or epic? | asked **only after a verified-green baseline** | `feature` / `epic` |
|
|
111
|
+
| Q9 | Commit the baseline, or leave it staged? | default `commit` | `commit` / `stage only` |
|
|
112
|
+
|
|
113
|
+
Gating: Q4 is asked only when the chosen stack has a package-manager choice; Q6a only when
|
|
114
|
+
Q6 = `monorepo` (each member gets a `path` like `packages/<name>`; a single package is one
|
|
115
|
+
member with `path = "."`); Q7 may be asked up-front, but Q8 / Mode B launch are gated on a
|
|
116
|
+
verified-green, committed baseline (see below). You may also offer an optional
|
|
117
|
+
"generate a CI workflow (lint+test)?" question, setting `Answers.ci`.
|
|
118
|
+
|
|
119
|
+
License detect-and-seed (Q5, REQ-SCAF-09): when a `LICENSE` already exists in the target
|
|
120
|
+
(an allowed-meta file the gate let through), **read its first lines** and pre-select the
|
|
121
|
+
matching Q5 default — "MIT License" → `MIT`, "Apache License" → `Apache-2.0`, otherwise
|
|
122
|
+
keep the default and note the unrecognized license. The helper never overwrites the existing
|
|
123
|
+
`LICENSE`; this only seeds the interview default. Also set `Answers.author` from
|
|
124
|
+
`git config user.name` (fallback: the project name) and `Answers.host` to `claude` when
|
|
125
|
+
running on a Claude host (so the helper emits `CLAUDE.md` alongside `AGENTS.md`), else leave
|
|
126
|
+
it null.
|
|
127
|
+
|
|
128
|
+
**Assemble the payload.** Build one `Answers` JSON object — `projectName`, `purpose`,
|
|
129
|
+
`layout`, `license`, `members[]`, `modeB`, `modeBTarget`, `ci`, `commitStyle`, `author`,
|
|
130
|
+
`host` — and pass it verbatim to `scaffold --answers '<json>'`. Invent no fields beyond that
|
|
131
|
+
schema. Two fields come from your runtime, not the interview: `author` from `git config
|
|
132
|
+
user.name` (else the project name; it is the LICENSE copyright holder), and `host` — `"claude"`
|
|
133
|
+
when running under a Claude host (e.g. `AskUserQuestion` is available), else `"codex"`/`"other"`.
|
|
134
|
+
`host` drives the host-conditional agent file: the helper always emits `AGENTS.md` and adds
|
|
135
|
+
`CLAUDE.md` only when `host == "claude"`.
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
R="$(bash -c 'for d in "${FEATURE_FORGE_ROOT:-}" "$HOME"/.claude/skills/feature-forge "$HOME"/.claude/plugins/cache/*/feature-forge/* "$HOME"/.claude/plugins/*/feature-forge "$HOME"/.agents/skills/feature-forge ./.agents/skills/feature-forge; do [ -x "$d/scripts/forge-root.sh" ] && exec "$d/scripts/forge-root.sh"; done')"
|
|
139
|
+
[ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
|
|
140
|
+
python3 "$R/scripts/forge-bootstrap.py" scaffold "<target-dir>" --json --answers '<Answers JSON>'
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Step 5 — verify
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
R="$(bash -c 'for d in "${FEATURE_FORGE_ROOT:-}" "$HOME"/.claude/skills/feature-forge "$HOME"/.claude/plugins/cache/*/feature-forge/* "$HOME"/.claude/plugins/*/feature-forge "$HOME"/.agents/skills/feature-forge ./.agents/skills/feature-forge; do [ -x "$d/scripts/forge-root.sh" ] && exec "$d/scripts/forge-root.sh"; done')"
|
|
147
|
+
[ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
|
|
148
|
+
python3 "$R/scripts/forge-bootstrap.py" verify "<target-dir>" --json --answers '<Answers JSON>'
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Read `VerifyResult{green, toolchainPresent, lint[], test[]}`.
|
|
152
|
+
|
|
153
|
+
- **`toolchainPresent:false` (exit 2) → Missing toolchain.** Warn, naming which stack's
|
|
154
|
+
toolchain is missing. Ask **scaffold-anyway (unverified) vs abort**. If scaffold-anyway,
|
|
155
|
+
proceed to commit and mark the baseline **unverified** in the summary — never claim green
|
|
156
|
+
you could not verify. If abort, stop; the sentinel stays in-progress for a later resume. An
|
|
157
|
+
unverified baseline **disqualifies Mode B** (no override).
|
|
158
|
+
- **`green:false` with `toolchainPresent:true` (exit 1) → Not-green.** Surface the failing
|
|
159
|
+
`CommandOutcome` entries (command + member) verbatim; offer abort or retry-after-investigation.
|
|
160
|
+
Do not silently proceed to a "green" summary.
|
|
161
|
+
- **`green:true` (exit 0)** → proceed to commit.
|
|
162
|
+
|
|
163
|
+
### Step 6 — commit
|
|
164
|
+
|
|
165
|
+
Invoke `commit` (or `commit --stage-only`, per Q9). Helper-owned: it stages the **exact
|
|
166
|
+
tracked list** (never `git add -A`/`--force`/`--no-verify`), makes a single baseline commit,
|
|
167
|
+
and removes the sentinel before staging so it never enters history. Read
|
|
168
|
+
`CommitResult{committed, commitHash, staged[]}`. On commit failure, surface the error and
|
|
169
|
+
leave the sentinel in-progress (resumable) — do **not** declare success.
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
R="$(bash -c 'for d in "${FEATURE_FORGE_ROOT:-}" "$HOME"/.claude/skills/feature-forge "$HOME"/.claude/plugins/cache/*/feature-forge/* "$HOME"/.claude/plugins/*/feature-forge "$HOME"/.agents/skills/feature-forge ./.agents/skills/feature-forge; do [ -x "$d/scripts/forge-root.sh" ] && exec "$d/scripts/forge-root.sh"; done')"
|
|
173
|
+
[ -n "$R" ] || { echo "feature-forge: cannot locate plugin root" >&2; exit 1; }
|
|
174
|
+
python3 "$R/scripts/forge-bootstrap.py" commit "<target-dir>" --json --answers '<Answers JSON>' [--stage-only]
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## Completion summary
|
|
178
|
+
|
|
179
|
+
Render the human-facing summary from the helper's JSON (`VerifyResult` + `CommitResult`). State:
|
|
180
|
+
created artifacts (from `CommitResult.staged[]`, including any kept pre-existing meta file);
|
|
181
|
+
resolved stack(s) (single, or each monorepo member's name + stack); the **verification
|
|
182
|
+
verdict** — `green` or `unverified` (never "green" for an unverified baseline); the commit
|
|
183
|
+
state (with `commitHash`, or staged-only); and the exact next command. In Mode B, **launch**
|
|
184
|
+
the next stage instead of printing the command.
|
|
185
|
+
|
|
186
|
+
```
|
|
187
|
+
Bootstrap complete — pipeline-ready baseline.
|
|
188
|
+
Stack: python (uv)
|
|
189
|
+
Created: pyproject.toml, src/acme_svc/..., tests/test_smoke.py, .gitignore,
|
|
190
|
+
README.md, LICENSE, AGENTS.md, CLAUDE.md, forge.config.json
|
|
191
|
+
Kept: (none — README/LICENSE generated fresh)
|
|
192
|
+
Verification: green (mypy ✓ pytest ✓)
|
|
193
|
+
Commit: baseline committed (a1b2c3d)
|
|
194
|
+
Next step: /skill:forge-1-prd <feature>
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Unverified variant:
|
|
198
|
+
|
|
199
|
+
```
|
|
200
|
+
Verification: UNVERIFIED — toolchain not found on this machine; lint+test were not run.
|
|
201
|
+
Install the toolchain and re-run verify before relying on the baseline.
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
## Mode B hand-off (opt-in)
|
|
205
|
+
|
|
206
|
+
Mode B is **opt-in** (Q7; default Mode A) and **agent-driven** — it hands skill-to-skill to
|
|
207
|
+
the next pipeline stage, not through the helper.
|
|
208
|
+
|
|
209
|
+
**Gate:** launch the next stage **only after both** a verified-green baseline
|
|
210
|
+
(`VerifyResult.green == true`) **and** a successful commit (`CommitResult.committed == true`).
|
|
211
|
+
If the baseline is unverified or not-green, you MUST NOT launch the next stage and MUST NOT
|
|
212
|
+
even ask Q8 — fall back to the Mode A summary with the next command printed. There is no
|
|
213
|
+
"launch anyway on red" path.
|
|
214
|
+
|
|
215
|
+
When the gate passes:
|
|
216
|
+
|
|
217
|
+
1. Ask Q8 — feature vs epic — if not already resolved.
|
|
218
|
+
2. **Feature:** invoke `forge-1-prd <feature>` skill-to-skill, seeding `<feature>` from a
|
|
219
|
+
confirmed, kebab-cased name.
|
|
220
|
+
3. **Epic:** invoke `forge-0-epic <epic>` skill-to-skill. Seed the epic name and initial
|
|
221
|
+
decomposition from the project name + purpose (Q1/Q2), **propose it, let the user
|
|
222
|
+
edit/approve**, then launch.
|
|
223
|
+
4. **Launch** that stage instead of printing its command.
|
|
224
|
+
|
|
225
|
+
Mode B auto-launches **only the immediate next stage**; every subsequent pipeline stage stays
|
|
226
|
+
a normal, user-driven step. The hand-off is always skill-to-skill, never via the helper.
|
|
227
|
+
|
|
228
|
+
## The four terminal outcomes
|
|
229
|
+
|
|
230
|
+
Every run ends in exactly one explicit, actionable outcome — make it explicit in your output;
|
|
231
|
+
no run ends silently:
|
|
232
|
+
|
|
233
|
+
- **Success** — `commit` exit 0 + green (or unverified-but-proceeded) → completion summary, or
|
|
234
|
+
Mode B launch.
|
|
235
|
+
- **Greenfield refusal** — `check` `eligible:false` → name `disqualifying[]`, point to
|
|
236
|
+
`forge-init` + `forge-1-prd`, touch nothing.
|
|
237
|
+
- **Missing toolchain** — `verify` `toolchainPresent:false` (exit 2) → scaffold-anyway-unverified
|
|
238
|
+
vs abort; mark **unverified**.
|
|
239
|
+
- **Partial-state detected** — `check` `resumeMarker != null` → resume / restart / cancel.
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
## Host execution notes (Pi)
|
|
244
|
+
|
|
245
|
+
This Pi bundle preserves Claude's `AskUserQuestion` references because it ships a Pi compatibility extension registering an `AskUserQuestion` tool. On Pi:
|
|
246
|
+
|
|
247
|
+
- **User input:** use `AskUserQuestion` for genuine user decisions. It supports multiple questions, option descriptions, recommended ordering, multi-select, previews, and free-form Other/custom answers.
|
|
248
|
+
- **Skill dispatch:** Pi uses `/skill:<name>` commands. If you cannot invoke a skill directly, print the exact `/skill:<name> ...` command for the user to run.
|
|
249
|
+
- **Subagents:** this bundle declares its custom agents (`forge-researcher`, `forge-spec-writer`, `forge-verifier`) as package agents. If a `subagent` tool is registered, dispatch one with `{ agent: "forge-verifier", task: "..." }`, or fan several out concurrently with `{ tasks: [{ agent: "forge-spec-writer", task: "..." }, ...] }`. If no `subagent` tool is available, run that step inline yourself.
|
|
250
|
+
- **Background / monitoring:** run long-lived commands in the foreground and report progress as it arrives.
|