bmad-module-skill-forge 0.9.0 → 0.10.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +39 -0
- package/.gitattributes +16 -0
- package/README.md +105 -38
- package/docs/404.md +13 -10
- package/docs/RELEASING.md +185 -0
- package/docs/STABILITY.md +123 -0
- package/docs/_data/pinned.yaml +98 -0
- package/docs/agents.md +16 -11
- package/docs/architecture.md +221 -0
- package/docs/bmad-synergy.md +11 -13
- package/docs/concepts.md +18 -108
- package/docs/examples.md +121 -80
- package/docs/getting-started.md +85 -147
- package/docs/how-it-works.md +25 -536
- package/docs/index.md +44 -27
- package/docs/skill-model.md +328 -0
- package/docs/troubleshooting.md +39 -0
- package/docs/verifying-a-skill.md +232 -0
- package/docs/why-skf.md +93 -0
- package/docs/workflows.md +119 -13
- package/package.json +25 -4
- package/src/README.md +23 -25
- package/src/forger/forge-tier.yaml +4 -2
- package/src/forger/preferences.yaml +7 -1
- package/src/knowledge/agentskills-spec.md +1 -1
- package/src/knowledge/architecture-verification.md +1 -1
- package/src/knowledge/ccc-bridge.md +16 -15
- package/src/knowledge/overview.md +11 -11
- package/src/knowledge/progressive-capability.md +3 -3
- package/src/knowledge/provenance-tracking.md +9 -3
- package/src/knowledge/qmd-registry.md +8 -8
- package/src/knowledge/skf-knowledge-index.csv +2 -2
- package/src/knowledge/skill-lifecycle.md +16 -1
- package/src/knowledge/split-body-strategy.md +1 -1
- package/src/knowledge/version-paths.md +17 -12
- package/src/module-help.csv +18 -17
- package/src/module.yaml +4 -0
- package/src/shared/health-check.md +372 -0
- package/src/shared/references/feasibility-report-schema.md +86 -0
- package/src/shared/references/headless-gate-convention.md +62 -0
- package/src/shared/references/output-contract-schema.md +35 -0
- package/src/shared/references/pipeline-contracts.md +102 -0
- package/src/shared/scripts/skf-atomic-write.py +370 -0
- package/src/shared/scripts/skf-manifest-ops.py +236 -0
- package/src/shared/scripts/skf-preflight.py +164 -0
- package/src/shared/scripts/skf-rebuild-managed-sections.py +201 -0
- package/src/shared/scripts/skf-severity-classify.py +163 -0
- package/src/shared/scripts/skf-skill-inventory.py +210 -0
- package/src/shared/scripts/skf-structural-diff.py +257 -0
- package/src/shared/scripts/skf-validate-frontmatter.py +318 -0
- package/src/shared/scripts/skf-validate-output.py +247 -0
- package/src/skf-analyze-source/SKILL.md +57 -0
- package/src/skf-analyze-source/assets/skill-brief-schema.md +125 -0
- package/src/skf-analyze-source/references/unit-detection-heuristics.md +124 -0
- package/src/{workflows/analyze-source → skf-analyze-source}/steps-c/step-01-init.md +6 -66
- package/src/{workflows/analyze-source → skf-analyze-source}/steps-c/step-01b-continue.md +4 -59
- package/src/{workflows/analyze-source → skf-analyze-source}/steps-c/step-02-scan-project.md +7 -68
- package/src/{workflows/analyze-source → skf-analyze-source}/steps-c/step-03-identify-units.md +6 -66
- package/src/{workflows/analyze-source → skf-analyze-source}/steps-c/step-04-map-and-detect.md +7 -68
- package/src/{workflows/analyze-source → skf-analyze-source}/steps-c/step-05-recommend.md +6 -66
- package/src/{workflows/analyze-source → skf-analyze-source}/steps-c/step-06-generate-briefs.md +14 -66
- package/src/skf-analyze-source/steps-c/step-07-health-check.md +22 -0
- package/src/skf-audit-skill/SKILL.md +59 -0
- package/src/{workflows/audit-skill/data → skf-audit-skill/assets}/drift-report-template.md +7 -7
- package/src/{workflows/audit-skill/data → skf-audit-skill/references}/severity-rules.md +11 -11
- package/src/{workflows/audit-skill → skf-audit-skill}/steps-c/step-01-init.md +24 -68
- package/src/{workflows/audit-skill → skf-audit-skill}/steps-c/step-02-re-index.md +36 -71
- package/src/{workflows/audit-skill → skf-audit-skill}/steps-c/step-03-structural-diff.md +21 -63
- package/src/{workflows/audit-skill → skf-audit-skill}/steps-c/step-04-semantic-diff.md +6 -65
- package/src/{workflows/audit-skill → skf-audit-skill}/steps-c/step-05-severity-classify.md +5 -63
- package/src/{workflows/audit-skill → skf-audit-skill}/steps-c/step-06-report.md +10 -59
- package/src/skf-audit-skill/steps-c/step-07-health-check.md +22 -0
- package/src/skf-brief-skill/SKILL.md +53 -0
- package/src/{workflows/brief-skill/data → skf-brief-skill/assets}/scope-templates.md +23 -0
- package/src/skf-brief-skill/assets/skill-brief-schema.md +206 -0
- package/src/{workflows/brief-skill → skf-brief-skill}/steps-c/step-01-gather-intent.md +6 -67
- package/src/{workflows/brief-skill → skf-brief-skill}/steps-c/step-02-analyze-target.md +6 -66
- package/src/{workflows/brief-skill → skf-brief-skill}/steps-c/step-03-scope-definition.md +12 -68
- package/src/{workflows/brief-skill → skf-brief-skill}/steps-c/step-04-confirm-brief.md +5 -63
- package/src/{workflows/brief-skill → skf-brief-skill}/steps-c/step-05-write-brief.md +10 -69
- package/src/skf-brief-skill/steps-c/step-06-health-check.md +22 -0
- package/src/skf-create-skill/SKILL.md +63 -0
- package/src/{workflows/create-skill/data → skf-create-skill/assets}/compile-assembly-rules.md +60 -0
- package/src/{workflows/create-skill/data → skf-create-skill/assets}/skill-sections.md +92 -23
- package/src/skf-create-skill/assets/tessl-dismissal-rules.md +102 -0
- package/src/{workflows/create-skill/data → skf-create-skill/references}/extraction-patterns-tracing.md +13 -13
- package/src/{workflows/create-skill/data → skf-create-skill/references}/extraction-patterns.md +8 -3
- package/src/skf-create-skill/references/source-resolution-protocols.md +239 -0
- package/src/{workflows/create-skill/data → skf-create-skill/references}/tier-degradation-rules.md +8 -7
- package/src/{workflows/create-skill → skf-create-skill}/steps-c/step-01-load-brief.md +25 -63
- package/src/{workflows/create-skill → skf-create-skill}/steps-c/step-02-ecosystem-check.md +8 -64
- package/src/skf-create-skill/steps-c/step-03-extract.md +379 -0
- package/src/{workflows/create-skill → skf-create-skill}/steps-c/step-03d-component-extraction.md +18 -35
- package/src/{workflows/create-skill → skf-create-skill}/steps-c/step-04-enrich.md +12 -69
- package/src/{workflows/create-skill → skf-create-skill}/steps-c/step-05-compile.md +71 -75
- package/src/skf-create-skill/steps-c/step-06-validate.md +267 -0
- package/src/{workflows/create-skill → skf-create-skill}/steps-c/step-07-generate-artifacts.md +30 -74
- package/src/skf-create-skill/steps-c/step-08-report.md +145 -0
- package/src/skf-create-skill/steps-c/step-09-health-check.md +23 -0
- package/src/{workflows/create-skill/steps-c → skf-create-skill/steps-c/sub}/step-02b-ccc-discover.md +8 -66
- package/src/skf-create-skill/steps-c/sub/step-03b-fetch-temporal.md +229 -0
- package/src/{workflows/create-skill/steps-c → skf-create-skill/steps-c/sub}/step-03c-fetch-docs.md +18 -42
- package/src/skf-create-stack-skill/SKILL.md +64 -0
- package/src/{workflows/create-stack-skill/data → skf-create-stack-skill/assets}/stack-skill-template.md +2 -1
- package/src/{workflows/create-stack-skill/data → skf-create-stack-skill/references}/compose-mode-rules.md +19 -5
- package/src/{workflows/create-stack-skill/data → skf-create-stack-skill/references}/integration-patterns.md +1 -1
- package/src/{workflows/create-stack-skill/data → skf-create-stack-skill/references}/manifest-patterns.md +10 -10
- package/src/{workflows/create-stack-skill → skf-create-stack-skill}/steps-c/step-01-init.md +14 -55
- package/src/{workflows/create-stack-skill → skf-create-stack-skill}/steps-c/step-02-detect-manifests.md +29 -63
- package/src/{workflows/create-stack-skill → skf-create-stack-skill}/steps-c/step-03-rank-and-confirm.md +9 -59
- package/src/{workflows/create-stack-skill → skf-create-stack-skill}/steps-c/step-04-parallel-extract.md +29 -64
- package/src/skf-create-stack-skill/steps-c/step-05-detect-integrations.md +164 -0
- package/src/{workflows/create-stack-skill → skf-create-stack-skill}/steps-c/step-06-compile-stack.md +7 -60
- package/src/skf-create-stack-skill/steps-c/step-07-generate-output.md +328 -0
- package/src/{workflows/create-stack-skill → skf-create-stack-skill}/steps-c/step-08-validate.md +17 -63
- package/src/skf-create-stack-skill/steps-c/step-09-report.md +128 -0
- package/src/skf-create-stack-skill/steps-c/step-10-health-check.md +22 -0
- package/src/skf-drop-skill/SKILL.md +57 -0
- package/src/{workflows/drop-skill → skf-drop-skill}/steps-c/step-01-select.md +9 -69
- package/src/{workflows/drop-skill → skf-drop-skill}/steps-c/step-02-execute.md +30 -106
- package/src/skf-drop-skill/steps-c/step-03-report.md +83 -0
- package/src/skf-drop-skill/steps-c/step-04-health-check.md +22 -0
- package/src/skf-export-skill/SKILL.md +57 -0
- package/src/skf-export-skill/assets/managed-section-format.md +138 -0
- package/src/{workflows/export-skill/data → skf-export-skill/assets}/snippet-format.md +8 -12
- package/src/skf-export-skill/steps-c/step-01-load-skill.md +247 -0
- package/src/{workflows/export-skill → skf-export-skill}/steps-c/step-02-package.md +5 -58
- package/src/{workflows/export-skill → skf-export-skill}/steps-c/step-03-generate-snippet.md +15 -77
- package/src/{workflows/export-skill → skf-export-skill}/steps-c/step-04-update-context.md +59 -133
- package/src/{workflows/export-skill → skf-export-skill}/steps-c/step-05-token-report.md +4 -58
- package/src/{workflows/export-skill → skf-export-skill}/steps-c/step-06-summary.md +20 -64
- package/src/skf-export-skill/steps-c/step-07-health-check.md +22 -0
- package/src/skf-forger/SKILL.md +110 -0
- package/src/skf-forger/bmad-skill-manifest.yaml +11 -0
- package/src/skf-quick-skill/SKILL.md +56 -0
- package/src/{workflows/quick-skill/data → skf-quick-skill/references}/registry-resolution.md +6 -6
- package/src/{workflows/quick-skill → skf-quick-skill}/steps-c/step-01-resolve-target.md +9 -62
- package/src/{workflows/quick-skill → skf-quick-skill}/steps-c/step-02-ecosystem-check.md +5 -59
- package/src/{workflows/quick-skill → skf-quick-skill}/steps-c/step-03-quick-extract.md +18 -61
- package/src/{workflows/quick-skill → skf-quick-skill}/steps-c/step-04-compile.md +6 -60
- package/src/{workflows/quick-skill → skf-quick-skill}/steps-c/step-05-validate.md +58 -78
- package/src/skf-quick-skill/steps-c/step-06-write.md +73 -0
- package/src/skf-quick-skill/steps-c/step-07-health-check.md +22 -0
- package/src/skf-refine-architecture/SKILL.md +57 -0
- package/src/{workflows/refine-architecture/data → skf-refine-architecture/references}/refinement-rules.md +16 -16
- package/src/{workflows/refine-architecture → skf-refine-architecture}/steps-c/step-01-init.md +6 -63
- package/src/{workflows/refine-architecture → skf-refine-architecture}/steps-c/step-02-gap-analysis.md +29 -71
- package/src/{workflows/refine-architecture → skf-refine-architecture}/steps-c/step-03-issue-detection.md +5 -65
- package/src/{workflows/refine-architecture → skf-refine-architecture}/steps-c/step-04-improvements.md +5 -64
- package/src/{workflows/refine-architecture → skf-refine-architecture}/steps-c/step-05-compile.md +5 -56
- package/src/{workflows/refine-architecture → skf-refine-architecture}/steps-c/step-06-report.md +14 -64
- package/src/skf-refine-architecture/steps-c/step-07-health-check.md +22 -0
- package/src/skf-rename-skill/SKILL.md +58 -0
- package/src/{workflows/rename-skill → skf-rename-skill}/steps-c/step-01-select.md +12 -73
- package/src/{workflows/rename-skill → skf-rename-skill}/steps-c/step-02-execute.md +32 -113
- package/src/skf-rename-skill/steps-c/step-03-report.md +83 -0
- package/src/skf-rename-skill/steps-c/step-04-health-check.md +22 -0
- package/src/skf-setup/SKILL.md +55 -0
- package/src/{workflows/setup-forge → skf-setup}/steps-c/step-01-detect-and-tier.md +6 -62
- package/src/{workflows/setup-forge → skf-setup}/steps-c/step-01b-ccc-index.md +9 -65
- package/src/{workflows/setup-forge → skf-setup}/steps-c/step-02-write-config.md +15 -60
- package/src/{workflows/setup-forge → skf-setup}/steps-c/step-03-auto-index.md +7 -66
- package/src/skf-setup/steps-c/step-04-report.md +92 -0
- package/src/skf-setup/steps-c/step-05-health-check.md +22 -0
- package/src/skf-test-skill/SKILL.md +59 -0
- package/src/skf-test-skill/references/migration-section-rules.md +114 -0
- package/src/skf-test-skill/references/scoring-rules.md +207 -0
- package/src/skf-test-skill/references/source-access-protocol.md +109 -0
- package/src/skf-test-skill/scripts/compute-score.py +310 -0
- package/src/skf-test-skill/steps-c/step-01-init.md +238 -0
- package/src/{workflows/test-skill → skf-test-skill}/steps-c/step-02-detect-mode.md +4 -62
- package/src/skf-test-skill/steps-c/step-03-coverage-check.md +347 -0
- package/src/skf-test-skill/steps-c/step-04-coherence-check.md +239 -0
- package/src/{workflows/test-skill → skf-test-skill}/steps-c/step-04b-external-validators.md +42 -77
- package/src/skf-test-skill/steps-c/step-05-score.md +266 -0
- package/src/skf-test-skill/steps-c/step-06-report.md +290 -0
- package/src/skf-test-skill/steps-c/step-07-health-check.md +25 -0
- package/src/skf-test-skill/templates/test-report-template.md +58 -0
- package/src/skf-update-skill/SKILL.md +58 -0
- package/src/{workflows/update-skill/data → skf-update-skill/references}/manual-section-rules.md +6 -6
- package/src/{workflows/update-skill/data → skf-update-skill/references}/merge-conflict-rules.md +5 -5
- package/src/skf-update-skill/references/remote-source-resolution.md +94 -0
- package/src/{workflows/update-skill → skf-update-skill}/steps-c/step-01-init.md +22 -69
- package/src/skf-update-skill/steps-c/step-02-detect-changes.md +255 -0
- package/src/skf-update-skill/steps-c/step-03-re-extract.md +336 -0
- package/src/{workflows/update-skill → skf-update-skill}/steps-c/step-04-merge.md +60 -72
- package/src/{workflows/update-skill → skf-update-skill}/steps-c/step-05-validate.md +5 -62
- package/src/skf-update-skill/steps-c/step-06-write.md +278 -0
- package/src/{workflows/update-skill → skf-update-skill}/steps-c/step-07-report.md +11 -66
- package/src/skf-update-skill/steps-c/step-08-health-check.md +22 -0
- package/src/skf-verify-stack/SKILL.md +60 -0
- package/src/skf-verify-stack/assets/feasibility-report-template.md +76 -0
- package/src/{workflows/verify-stack/data → skf-verify-stack/references}/coverage-patterns.md +12 -4
- package/src/skf-verify-stack/references/integration-verification-rules.md +78 -0
- package/src/skf-verify-stack/steps-c/step-01-init.md +178 -0
- package/src/{workflows/verify-stack → skf-verify-stack}/steps-c/step-02-coverage.md +27 -72
- package/src/skf-verify-stack/steps-c/step-03-integrations.md +179 -0
- package/src/{workflows/verify-stack → skf-verify-stack}/steps-c/step-04-requirements.md +14 -67
- package/src/skf-verify-stack/steps-c/step-05-synthesize.md +147 -0
- package/src/skf-verify-stack/steps-c/step-06-report.md +156 -0
- package/src/skf-verify-stack/steps-c/step-07-health-check.md +25 -0
- package/tools/cli/commands/install.js +1 -1
- package/tools/cli/commands/status.js +21 -23
- package/tools/cli/commands/uninstall.js +11 -19
- package/tools/cli/commands/update.js +2 -2
- package/tools/cli/lib/ide-skills.js +216 -0
- package/tools/cli/lib/installer.js +29 -52
- package/tools/cli/lib/manifest.js +11 -5
- package/tools/cli/lib/platform-codes.yaml +223 -0
- package/tools/cli/lib/ui.js +76 -47
- package/tools/validate-docs-drift.js +193 -0
- package/src/agents/forger.agent.yaml +0 -114
- package/src/workflows/README.md +0 -174
- package/src/workflows/analyze-source/data/skill-brief-schema.md +0 -125
- package/src/workflows/analyze-source/data/unit-detection-heuristics.md +0 -124
- package/src/workflows/analyze-source/workflow.md +0 -61
- package/src/workflows/audit-skill/workflow.md +0 -64
- package/src/workflows/brief-skill/data/skill-brief-schema.md +0 -159
- package/src/workflows/brief-skill/workflow.md +0 -58
- package/src/workflows/create-skill/data/source-resolution-protocols.md +0 -200
- package/src/workflows/create-skill/steps-c/step-03-extract.md +0 -301
- package/src/workflows/create-skill/steps-c/step-03b-fetch-temporal.md +0 -253
- package/src/workflows/create-skill/steps-c/step-06-validate.md +0 -254
- package/src/workflows/create-skill/steps-c/step-08-report.md +0 -176
- package/src/workflows/create-skill/workflow.md +0 -53
- package/src/workflows/create-stack-skill/steps-c/step-05-detect-integrations.md +0 -196
- package/src/workflows/create-stack-skill/steps-c/step-07-generate-output.md +0 -270
- package/src/workflows/create-stack-skill/steps-c/step-09-report.md +0 -145
- package/src/workflows/create-stack-skill/workflow.md +0 -59
- package/src/workflows/drop-skill/steps-c/step-03-report.md +0 -135
- package/src/workflows/drop-skill/workflow.md +0 -63
- package/src/workflows/export-skill/data/managed-section-format.md +0 -103
- package/src/workflows/export-skill/steps-c/step-01-load-skill.md +0 -237
- package/src/workflows/export-skill/workflow.md +0 -58
- package/src/workflows/quick-skill/steps-c/step-06-write.md +0 -179
- package/src/workflows/quick-skill/workflow.md +0 -58
- package/src/workflows/refine-architecture/workflow.md +0 -61
- package/src/workflows/rename-skill/steps-c/step-03-report.md +0 -132
- package/src/workflows/rename-skill/workflow.md +0 -64
- package/src/workflows/setup-forge/steps-c/step-04-report.md +0 -156
- package/src/workflows/setup-forge/workflow.md +0 -51
- package/src/workflows/test-skill/data/scoring-rules.md +0 -123
- package/src/workflows/test-skill/data/source-access-protocol.md +0 -51
- package/src/workflows/test-skill/steps-c/step-01-init.md +0 -217
- package/src/workflows/test-skill/steps-c/step-03-coverage-check.md +0 -280
- package/src/workflows/test-skill/steps-c/step-04-coherence-check.md +0 -271
- package/src/workflows/test-skill/steps-c/step-05-score.md +0 -222
- package/src/workflows/test-skill/steps-c/step-06-report.md +0 -207
- package/src/workflows/test-skill/templates/test-report-template.md +0 -28
- package/src/workflows/test-skill/workflow.md +0 -57
- package/src/workflows/update-skill/data/remote-source-resolution.md +0 -57
- package/src/workflows/update-skill/steps-c/step-02-detect-changes.md +0 -221
- package/src/workflows/update-skill/steps-c/step-03-re-extract.md +0 -256
- package/src/workflows/update-skill/steps-c/step-06-write.md +0 -265
- package/src/workflows/update-skill/workflow.md +0 -56
- package/src/workflows/verify-stack/data/feasibility-report-template.md +0 -63
- package/src/workflows/verify-stack/data/integration-verification-rules.md +0 -73
- package/src/workflows/verify-stack/steps-c/step-01-init.md +0 -179
- package/src/workflows/verify-stack/steps-c/step-03-integrations.md +0 -195
- package/src/workflows/verify-stack/steps-c/step-05-synthesize.md +0 -191
- package/src/workflows/verify-stack/steps-c/step-06-report.md +0 -197
- package/src/workflows/verify-stack/workflow.md +0 -61
- package/tools/cli/lib/compiler.js +0 -306
- package/tools/cli/lib/ide-commands.js +0 -244
- /package/src/{workflows/analyze-source → skf-analyze-source}/templates/analysis-report-template.md +0 -0
- /package/src/{workflows/quick-skill/data → skf-quick-skill/assets}/skill-template.md +0 -0
- /package/src/{workflows/setup-forge/data → skf-setup/references}/tier-rules.md +0 -0
- /package/src/{workflows/test-skill/data → skf-test-skill/assets}/output-section-formats.md +0 -0
|
@@ -1,301 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: 'step-03-extract'
|
|
3
|
-
description: 'Tier-dependent source code extraction — AST or source reading for exports, signatures, and types'
|
|
4
|
-
nextStepFile: './step-03b-fetch-temporal.md'
|
|
5
|
-
componentExtractionStepFile: './step-03d-component-extraction.md'
|
|
6
|
-
extractionPatternsData: '../data/extraction-patterns.md'
|
|
7
|
-
extractionPatternsTracingData: '../data/extraction-patterns-tracing.md'
|
|
8
|
-
tierDegradationRulesData: '../data/tier-degradation-rules.md'
|
|
9
|
-
sourceResolutionData: '../data/source-resolution-protocols.md'
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
# Step 3: Extract
|
|
13
|
-
|
|
14
|
-
## STEP GOAL:
|
|
15
|
-
|
|
16
|
-
To extract all public exports, function signatures, type definitions, and co-import patterns from the source code using tier-appropriate tools, building a complete extraction inventory with confidence-tiered provenance citations.
|
|
17
|
-
|
|
18
|
-
## MANDATORY EXECUTION RULES (READ FIRST):
|
|
19
|
-
|
|
20
|
-
### Universal Rules:
|
|
21
|
-
|
|
22
|
-
- 📖 CRITICAL: Read the complete step file before taking any action
|
|
23
|
-
- 🎯 ALWAYS follow the exact instructions in the step file
|
|
24
|
-
- ⚙️ TOOL/SUBPROCESS FALLBACK: If any instruction references a tool you do not have access to, you MUST still achieve the outcome in your main context thread
|
|
25
|
-
- ✅ YOU MUST ALWAYS SPEAK OUTPUT in your Agent communication style with the config `{communication_language}`
|
|
26
|
-
|
|
27
|
-
### Role Reinforcement:
|
|
28
|
-
|
|
29
|
-
- ✅ You are a skill compilation engine performing structural extraction
|
|
30
|
-
- ✅ Zero hallucination tolerance — every extracted item must trace to source code
|
|
31
|
-
- ✅ Confidence tier labeling is mandatory for every extraction result
|
|
32
|
-
|
|
33
|
-
### Step-Specific Rules:
|
|
34
|
-
|
|
35
|
-
- 🎯 Focus ONLY on extracting exports, signatures, types from source code
|
|
36
|
-
- 🚫 FORBIDDEN to compile SKILL.md content — that's step-05
|
|
37
|
-
- 🚫 FORBIDDEN to write any output files — extraction stays in context
|
|
38
|
-
- 🚫 FORBIDDEN to include content that cannot be cited to a source location
|
|
39
|
-
- ⚒️ Every extracted item MUST have a provenance citation: `[AST:{file}:L{line}]` or `[SRC:{file}:L{line}]`
|
|
40
|
-
|
|
41
|
-
## EXECUTION PROTOCOLS:
|
|
42
|
-
|
|
43
|
-
- 🎯 Follow MANDATORY SEQUENCE exactly
|
|
44
|
-
- 💾 Build extraction inventory in context — do not write files
|
|
45
|
-
- 📖 Load extraction patterns data file for tier-specific strategy
|
|
46
|
-
- 🚫 If an export cannot be verified, exclude it — do not guess
|
|
47
|
-
|
|
48
|
-
## CONTEXT BOUNDARIES:
|
|
49
|
-
|
|
50
|
-
- Available: brief_data, tier, source_root, file_tree from step-01; ecosystem check outcome from step-02; source_ref and source_commit from source resolution (see source-resolution-protocols.md)
|
|
51
|
-
- Focus: Source code extraction and inventory building
|
|
52
|
-
- Limits: Do NOT compile, assemble, or write any output
|
|
53
|
-
- Dependencies: Source code must be accessible (local repos resolved in step-01; remote repos cloned in section 2a)
|
|
54
|
-
|
|
55
|
-
## MANDATORY SEQUENCE
|
|
56
|
-
|
|
57
|
-
**CRITICAL:** Follow this sequence exactly. Do not skip, reorder, or improvise.
|
|
58
|
-
|
|
59
|
-
### 1. Load Extraction Patterns
|
|
60
|
-
|
|
61
|
-
Load `{extractionPatternsData}` completely. Identify the strategy for the current forge tier.
|
|
62
|
-
|
|
63
|
-
### 2. Apply Scope Filters
|
|
64
|
-
|
|
65
|
-
From the brief, apply scope and pattern filters:
|
|
66
|
-
|
|
67
|
-
- `scope` — determines what to extract (e.g., "all public exports", specific modules)
|
|
68
|
-
- `include_patterns` — file globs to include (if specified)
|
|
69
|
-
- `exclude_patterns` — file globs to exclude (if specified)
|
|
70
|
-
|
|
71
|
-
Build the filtered file list from the source tree resolved in step-01. Record the result: "**Filtered file count: {N} files in scope**" — this count is the input to the AST Extraction Protocol decision tree in the extraction patterns data file.
|
|
72
|
-
|
|
73
|
-
### 2a. Resolve Source Access
|
|
74
|
-
|
|
75
|
-
Load `{sourceResolutionData}` completely. Follow the **Remote Source Resolution** protocol for Forge/Deep tiers (ephemeral clone, sparse-checkout, cleanup), the **Source Commit Capture** protocol for all tiers, and the **Version Reconciliation** protocol for all tiers. This ensures source code is accessible regardless of which extraction path is taken below (standard, component-library, or docs-only).
|
|
76
|
-
|
|
77
|
-
**Deferred CCC Discovery (Forge+ and Deep — remote sources only):**
|
|
78
|
-
|
|
79
|
-
If ALL of these conditions are true:
|
|
80
|
-
- `tools.ccc` is true in forge-tier.yaml
|
|
81
|
-
- `{ccc_discovery}` is empty (step-02b deferred because source was remote)
|
|
82
|
-
- `ephemeral_clone_active` is true (clone succeeded in source resolution above)
|
|
83
|
-
- Tier is Forge+ or Deep
|
|
84
|
-
|
|
85
|
-
Then run CCC indexing and discovery on the ephemeral clone:
|
|
86
|
-
|
|
87
|
-
1. **Initialize index:** Run `cd {temp_path} && ccc init` — `ccc init` takes no positional arguments and initializes the index for the current working directory. If init fails, set `{ccc_discovery: []}` and continue — this is not an error.
|
|
88
|
-
|
|
89
|
-
2. **Apply brief exclusions:** If `brief.exclude_patterns` is present and non-empty, apply them to `{temp_path}/.cocoindex_code/settings.yml` before indexing:
|
|
90
|
-
1. Read `{temp_path}/.cocoindex_code/settings.yml` (created by `ccc init`)
|
|
91
|
-
2. For each pattern in `brief.exclude_patterns`: if the pattern is NOT already present in the `exclude_patterns` array, append it
|
|
92
|
-
3. Write the updated `settings.yml` back
|
|
93
|
-
This prevents CCC from indexing excluded files, keeping search results focused on in-scope source code. If `brief.exclude_patterns` is absent or empty, skip this step.
|
|
94
|
-
|
|
95
|
-
3. **Index the clone:** Run `cd {temp_path} && ccc index` with an extended timeout or in background mode. Indexing can take several minutes on large codebases (1000+ files). Use `ccc status` to verify completion — check that `Chunks` and `Files` counts are non-zero. If indexing fails, set `{ccc_discovery: []}` and continue — this is not an error.
|
|
96
|
-
|
|
97
|
-
4. **Construct semantic query:** Build from brief data: `"{brief.name} {brief.scope}"`. Truncate to 80 characters — keep the full skill name and trim `brief.scope` from the end. If `brief.scope` is very short (< 10 chars), append terms from `brief.description` to fill the remaining space.
|
|
98
|
-
|
|
99
|
-
5. **Execute search:** Run `ccc_bridge.search(query, temp_path, top_k=20)`:
|
|
100
|
-
- **Tool resolution:** Use `/ccc` skill search (Claude Code), ccc MCP server (Cursor), or `cd {temp_path} && ccc search --limit 20 "{query}"` (CLI). Note: `ccc search` operates on the index in the current working directory. See [knowledge/tool-resolution.md](../../../knowledge/tool-resolution.md).
|
|
101
|
-
|
|
102
|
-
6. **Store results:** If search succeeds, store as `{ccc_discovery: [{file, score, snippet}]}`. Display: "**CCC semantic discovery (post-clone): {N} relevant regions identified across {M} unique files.**"
|
|
103
|
-
|
|
104
|
-
7. **On failure:** Set `{ccc_discovery: []}`. Display: "CCC post-clone discovery unavailable — proceeding with standard extraction." Do NOT halt.
|
|
105
|
-
|
|
106
|
-
**CCC Discovery Integration (Forge+ and Deep with ccc only):**
|
|
107
|
-
|
|
108
|
-
If `{ccc_discovery}` is in context and non-empty (populated by step-02b or deferred discovery above):
|
|
109
|
-
- Sort the filtered file list by CCC relevance score: files appearing in `{ccc_discovery}` results move to the front of the extraction queue, sorted by their relevance score descending
|
|
110
|
-
- Files NOT in CCC results remain in the queue after ranked files — they are not excluded, only deprioritized
|
|
111
|
-
- Display: "**CCC discovery: {N} files pre-ranked by semantic relevance** — extraction will prioritize these first."
|
|
112
|
-
|
|
113
|
-
If `{ccc_discovery}` is empty or not in context: proceed with existing file ordering (no change to current behavior).
|
|
114
|
-
|
|
115
|
-
### 2b. Component Library Delegation
|
|
116
|
-
|
|
117
|
-
**If `scope.type: "component-library"` in the brief:**
|
|
118
|
-
|
|
119
|
-
"**Component library detected.** Delegating to specialized extraction strategy for registry-first, props-focused extraction."
|
|
120
|
-
|
|
121
|
-
Load and execute `{componentExtractionStepFile}` completely. When that step completes, it returns control here. Resume at section 5 (Build Extraction Inventory) with the enriched extraction data and `component_catalog[]` from the component extraction step.
|
|
122
|
-
|
|
123
|
-
**Otherwise:** Continue with standard extraction below.
|
|
124
|
-
|
|
125
|
-
### 3. Check for Docs-Only Mode
|
|
126
|
-
|
|
127
|
-
**If `source_type: "docs-only"` in the brief data:**
|
|
128
|
-
|
|
129
|
-
"**Docs-only mode:** No source code to extract. Documentation content will be fetched from `doc_urls` in step-03c."
|
|
130
|
-
|
|
131
|
-
Build an empty extraction inventory with zero exports. Set `extraction_mode: "docs-only"` in context. Auto-proceed through Gate 2 (section 6) — display the empty inventory and note that T3 content will be produced by the doc-fetcher step.
|
|
132
|
-
|
|
133
|
-
**If `source_type: "source"` (default):** Continue with extraction below.
|
|
134
|
-
|
|
135
|
-
### 4. Execute Tier-Dependent Extraction
|
|
136
|
-
|
|
137
|
-
Source resolution, version reconciliation, and CCC discovery were completed in section 2a. Proceed with the tier-specific extraction strategy below.
|
|
138
|
-
|
|
139
|
-
**Quick Tier (No AST tools):**
|
|
140
|
-
|
|
141
|
-
1. Use `gh_bridge.list_tree(owner, repo, branch)` to map source structure (if remote)
|
|
142
|
-
2. Identify entry points: index files, main exports, public modules
|
|
143
|
-
3. Use `gh_bridge.read_file(owner, repo, path)` to read each entry point
|
|
144
|
-
4. Extract from source text: exported function names, parameter lists, return types
|
|
145
|
-
5. Infer types from JSDoc, docstrings, type annotations
|
|
146
|
-
6. Confidence: All results T1-low — `[SRC:{file}:L{line}]`
|
|
147
|
-
|
|
148
|
-
**Tool resolution for gh_bridge:** Use `gh api repos/{owner}/{repo}/git/trees/{branch}?recursive=1` for list_tree, `gh api repos/{owner}/{repo}/contents/{path}` for read_file. If source is local, use direct file listing/reading instead. See [knowledge/tool-resolution.md](../../../knowledge/tool-resolution.md).
|
|
149
|
-
|
|
150
|
-
**Forge/Forge+/Deep Tier (AST available):**
|
|
151
|
-
|
|
152
|
-
⚠️ **CRITICAL:** Before executing AST extraction, load the **AST Extraction Protocol** section from `{extractionPatternsData}`. Follow the decision tree based on the file count from step-01's file tree. This determines whether to use the MCP tool, scoped YAML rules, or CLI streaming. Never use `ast-grep --json` (without `=stream`) — it loads the entire result set into memory and will fail on large codebases. Always use the explicit `run` subcommand with streaming: `ast-grep run -p '{pattern}' --json=stream`.
|
|
153
|
-
|
|
154
|
-
1. Detect language from brief or file extensions
|
|
155
|
-
2. Follow the AST Extraction Protocol decision tree from `{extractionPatternsData}`:
|
|
156
|
-
- ≤100 files: use `find_code()` MCP tool with `max_results` and `output_format="text"`
|
|
157
|
-
- ≤500 files: use `find_code_by_rule()` MCP tool with scoped YAML rules
|
|
158
|
-
- >500 files: use CLI `--json=stream` with line-by-line streaming Python — **CRITICAL:** inject the brief's `scope.exclude` patterns into the Python filter's `EXCLUDES` list (use `[]` if absent) so excluded files are discarded before consuming `head -N` slots (see template in extraction patterns data)
|
|
159
|
-
3. For each export: extract function name, full signature, parameter types, return type, line number
|
|
160
|
-
4. Use `ast_bridge.detect_co_imports(path, libraries[])` to find integration points
|
|
161
|
-
5. Build extraction rules YAML data for reproducibility
|
|
162
|
-
6. Confidence: All results T1 — `[AST:{file}:L{line}]`
|
|
163
|
-
|
|
164
|
-
**Tool resolution for ast_bridge:** Use ast-grep MCP tools (`mcp__ast-grep__find_code`, `mcp__ast-grep__find_code_by_rule`) as specified in the AST Extraction Protocol above, or `ast-grep` CLI. For `detect_co_imports`, use `find_code_by_rule` with a co-import YAML rule scoped to the libraries list. See [knowledge/tool-resolution.md](../../../knowledge/tool-resolution.md).
|
|
165
|
-
|
|
166
|
-
**If AST tool is unavailable at Forge/Deep tier** (see `{tierDegradationRulesData}` for full rules):
|
|
167
|
-
|
|
168
|
-
⚠️ **Warn the user explicitly:** "AST tools are unavailable — extraction will use source reading (T1-low). Run [SF] Setup Forge to detect and configure AST tools for T1 confidence."
|
|
169
|
-
|
|
170
|
-
Degrade to Quick tier extraction. Note the degradation reason in context for the evidence report.
|
|
171
|
-
|
|
172
|
-
**For each file — handle failures gracefully:**
|
|
173
|
-
|
|
174
|
-
- If a file cannot be read: log warning, skip file, continue with remaining files
|
|
175
|
-
- If AST parsing fails on a file: fall back to source reading for that file, continue
|
|
176
|
-
|
|
177
|
-
**Re-export tracing (Forge/Deep only):** After the initial AST scan, check for unresolved public exports from entry points (`__init__.py`, `index.ts`, `lib.rs`). Follow the **Re-Export Tracing** protocol in `{extractionPatternsTracingData}` to resolve them to their definition files.
|
|
178
|
-
|
|
179
|
-
### 4b. Validate Exports Against Package Entry Point
|
|
180
|
-
|
|
181
|
-
After extraction, validate the collected exports against the package's actual public API surface:
|
|
182
|
-
|
|
183
|
-
- **Python:** Read `{source_root}/__init__.py` — extract imports to build the public export list. Compare against AST results:
|
|
184
|
-
- In AST but not entry point → mark as internal (exclude from `metadata.json` exports)
|
|
185
|
-
- In entry point but not AST → flag as extraction gap (trace via re-export protocol)
|
|
186
|
-
- **TypeScript/JS:** Read `index.ts`/`index.js` — same comparison logic.
|
|
187
|
-
- **Rust:** Read `lib.rs` — extract `pub use` items. Same logic. **Go:** Scan for exported (capitalized) identifiers.
|
|
188
|
-
|
|
189
|
-
Use the entry point as the authoritative source for `metadata.json`'s `exports[]` array.
|
|
190
|
-
|
|
191
|
-
**If entry point is missing or unreadable:** Skip validation with a warning.
|
|
192
|
-
|
|
193
|
-
### 4c. Detect and Inventory Scripts/Assets
|
|
194
|
-
|
|
195
|
-
**Default resolution:** If `scripts_intent` is absent from the brief, treat as `"detect"` (auto-detection). If `assets_intent` is absent, treat as `"detect"`. Only an explicit `"none"` value disables detection.
|
|
196
|
-
|
|
197
|
-
**If `scripts_intent` is `"none"` AND `assets_intent` is `"none"`:** Skip this section entirely. **If only one is `"none"`:** Skip that category only, proceed with the other.
|
|
198
|
-
|
|
199
|
-
After export extraction, scan the source for scripts and assets using the detection patterns in `{extractionPatternsTracingData}`:
|
|
200
|
-
|
|
201
|
-
1. Scan source tree for directories/files matching detection heuristics (scripts/, bin/, tools/, cli/ for scripts; assets/, templates/, schemas/, configs/, examples/ for assets)
|
|
202
|
-
2. For each candidate: verify existence, check size (flag >500 lines), exclude binaries, compute SHA-256 hash
|
|
203
|
-
3. Extract purpose from header comments, shebang, README references, or schema fields. Record: file_path, purpose, source_path, language/type, content_hash, confidence (T1-low)
|
|
204
|
-
|
|
205
|
-
Add results to `scripts_inventory[]` and `assets_inventory[]` alongside the existing export inventory.
|
|
206
|
-
|
|
207
|
-
### 5. Build Extraction Inventory
|
|
208
|
-
|
|
209
|
-
Compile all extracted data into a structured inventory:
|
|
210
|
-
|
|
211
|
-
**Per-export entry:**
|
|
212
|
-
- Function/type name
|
|
213
|
-
- Full signature with types
|
|
214
|
-
- Parameters (name, type, required/optional)
|
|
215
|
-
- Return type
|
|
216
|
-
- Source file and line number
|
|
217
|
-
- Provenance citation (`[AST:...]` or `[SRC:...]`)
|
|
218
|
-
- Confidence tier (T1 or T1-low)
|
|
219
|
-
|
|
220
|
-
**Aggregate counts:**
|
|
221
|
-
- Total files scanned
|
|
222
|
-
- Total exports found
|
|
223
|
-
- Exports by type (functions, types/interfaces, constants)
|
|
224
|
-
- Confidence breakdown (T1 count, T1-low count)
|
|
225
|
-
- `top_exports[]` — sorted list of the top 10-20 public API function names by prominence (import frequency or documentation position). This named field is consumed by step-03b for targeted temporal fetching and cache fingerprinting.
|
|
226
|
-
|
|
227
|
-
**Script/asset counts (when detected):**
|
|
228
|
-
- `scripts_found`: count of scripts detected
|
|
229
|
-
- `assets_found`: count of assets detected
|
|
230
|
-
|
|
231
|
-
**Co-import patterns (Forge/Deep only):**
|
|
232
|
-
- Libraries commonly imported alongside extracted exports
|
|
233
|
-
- Integration point suggestions
|
|
234
|
-
|
|
235
|
-
### 6. Present Extraction Summary (Gate 2)
|
|
236
|
-
|
|
237
|
-
Display the extraction findings for user confirmation:
|
|
238
|
-
|
|
239
|
-
"**Extraction complete.**
|
|
240
|
-
|
|
241
|
-
**Files scanned:** {file_count}
|
|
242
|
-
**Exports found:** {export_count} ({function_count} functions, {type_count} types, {constant_count} constants)
|
|
243
|
-
**Confidence:** {t1_count} T1 (AST-verified), {t1_low_count} T1-low (source reading)
|
|
244
|
-
**Tier used:** {tier}
|
|
245
|
-
**Co-import patterns:** {pattern_count} detected
|
|
246
|
-
{if scripts_found > 0: **Scripts detected:** {scripts_found}}
|
|
247
|
-
{if assets_found > 0: **Assets detected:** {assets_found}}
|
|
248
|
-
|
|
249
|
-
**Top exports:**
|
|
250
|
-
{list top 10 exports with signatures}
|
|
251
|
-
|
|
252
|
-
{warnings if any files skipped or degraded}
|
|
253
|
-
|
|
254
|
-
Review the extraction summary above. Select an option to continue."
|
|
255
|
-
|
|
256
|
-
### 7. Present MENU OPTIONS
|
|
257
|
-
|
|
258
|
-
Display: "**Extraction Summary — Select an Option:** [C] Continue to compilation"
|
|
259
|
-
|
|
260
|
-
#### EXECUTION RULES:
|
|
261
|
-
|
|
262
|
-
- IF docs-only mode (`extraction_mode: "docs-only"`): Auto-proceed immediately to `{nextStepFile}` — no user interaction required
|
|
263
|
-
- OTHERWISE: ALWAYS halt and wait for user input after presenting the extraction summary
|
|
264
|
-
- This is Gate 2 — user must confirm before compilation proceeds (except docs-only mode)
|
|
265
|
-
- User may ask questions about the extraction results before continuing
|
|
266
|
-
|
|
267
|
-
#### Menu Handling Logic:
|
|
268
|
-
|
|
269
|
-
- IF C: Confirm extraction inventory is complete. Immediately load, read entire file, then execute `{nextStepFile}`
|
|
270
|
-
- IF Any other comments or queries: answer questions about the extraction results, then redisplay the menu
|
|
271
|
-
|
|
272
|
-
## CRITICAL STEP COMPLETION NOTE
|
|
273
|
-
|
|
274
|
-
ONLY WHEN the extraction inventory is built with provenance citations and the user has confirmed the extraction summary will you proceed to load `{nextStepFile}` for temporal context fetching.
|
|
275
|
-
|
|
276
|
-
---
|
|
277
|
-
|
|
278
|
-
## 🚨 SYSTEM SUCCESS/FAILURE METRICS
|
|
279
|
-
|
|
280
|
-
### ✅ SUCCESS:
|
|
281
|
-
|
|
282
|
-
- Extraction patterns loaded and tier-appropriate strategy applied
|
|
283
|
-
- Scope filters applied from brief
|
|
284
|
-
- All accessible source files in scope scanned
|
|
285
|
-
- Every extracted item has a provenance citation with confidence tier
|
|
286
|
-
- Extraction inventory built with aggregate counts
|
|
287
|
-
- Graceful degradation if AST tools unavailable
|
|
288
|
-
- Gate 2 summary presented with export counts and confidence breakdown
|
|
289
|
-
- User confirmed before proceeding
|
|
290
|
-
|
|
291
|
-
### ❌ SYSTEM FAILURE:
|
|
292
|
-
|
|
293
|
-
- Including exports without provenance citations
|
|
294
|
-
- Guessing or hallucinating function signatures not in source
|
|
295
|
-
- Not applying scope/include/exclude filters from the brief
|
|
296
|
-
- Halting on individual file read failures instead of skipping
|
|
297
|
-
- Not presenting Gate 2 summary for user confirmation
|
|
298
|
-
- Beginning compilation or SKILL.md assembly in this step
|
|
299
|
-
- Not reporting confidence tier breakdown
|
|
300
|
-
|
|
301
|
-
**Master Rule:** Zero hallucination — every extraction must trace to source code. Uncitable content is excluded, not guessed.
|
|
@@ -1,253 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: 'step-03b-fetch-temporal'
|
|
3
|
-
description: 'Fetch temporal context (issues, PRs, changelogs) and index into QMD — Deep tier only'
|
|
4
|
-
nextStepFile: './step-03c-fetch-docs.md'
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Step 3b: Fetch Temporal Context
|
|
8
|
-
|
|
9
|
-
## STEP GOAL:
|
|
10
|
-
|
|
11
|
-
To fetch temporal context (issues, PRs, changelogs, release notes) from the source repository and index it into a QMD collection for Deep tier enrichment. This ensures step-04 has historical data to search when annotating extracted functions with T2 provenance.
|
|
12
|
-
|
|
13
|
-
## MANDATORY EXECUTION RULES (READ FIRST):
|
|
14
|
-
|
|
15
|
-
### Universal Rules:
|
|
16
|
-
|
|
17
|
-
- 📖 CRITICAL: Read the complete step file before taking any action
|
|
18
|
-
- 🎯 ALWAYS follow the exact instructions in the step file
|
|
19
|
-
- ⚙️ TOOL/SUBPROCESS FALLBACK: If any instruction references a tool you do not have access to, you MUST still achieve the outcome in your main context thread
|
|
20
|
-
- ✅ YOU MUST ALWAYS SPEAK OUTPUT in your Agent communication style with the config `{communication_language}`
|
|
21
|
-
|
|
22
|
-
### Role Reinforcement:
|
|
23
|
-
|
|
24
|
-
- ✅ You are a skill compilation engine fetching temporal data for QMD enrichment
|
|
25
|
-
- ✅ Temporal context is best-effort — failures never block the workflow
|
|
26
|
-
- ✅ Graceful degradation is paramount — non-GitHub repos or missing tools are silent skips, not errors
|
|
27
|
-
|
|
28
|
-
### Step-Specific Rules:
|
|
29
|
-
|
|
30
|
-
- 🎯 Deep tier only — Quick, Forge, and Forge+ tiers skip this step entirely and silently
|
|
31
|
-
- 🎯 GitHub repositories only — other source types degrade gracefully
|
|
32
|
-
- 🚫 FORBIDDEN to halt the workflow if fetching or indexing fails
|
|
33
|
-
- 🚫 FORBIDDEN to modify extraction data from step-03 — this step only creates QMD collections
|
|
34
|
-
- 💾 Write fetched content to a staging directory, index into QMD, then clean up
|
|
35
|
-
|
|
36
|
-
## EXECUTION PROTOCOLS:
|
|
37
|
-
|
|
38
|
-
- 🎯 Follow MANDATORY SEQUENCE exactly
|
|
39
|
-
- 💾 Write fetched markdown files to a staging directory: `_bmad-output/{skill-name}-temporal/`
|
|
40
|
-
- 📖 Index the staging directory into QMD and register in `forge-tier.yaml`
|
|
41
|
-
- 🚫 Never leave staging files on disk after indexing — always clean up
|
|
42
|
-
|
|
43
|
-
## CONTEXT BOUNDARIES:
|
|
44
|
-
|
|
45
|
-
- Available: brief_data, tier, source_location from step-01; extraction_inventory from step-03
|
|
46
|
-
- **Used from extraction_inventory:** `top_exports[]` — the list of top-level public API function names (typically 10-20). Used for targeted GitHub searches (section 3b). If `extraction_mode: "docs-only"` or `top_exports` is absent/empty, skip targeted searches silently.
|
|
47
|
-
- Focus: Creating a QMD temporal collection for the source repository
|
|
48
|
-
- Limits: Do NOT modify extraction data, begin enrichment, or compile content
|
|
49
|
-
- Dependencies: Extraction must be complete from step-03
|
|
50
|
-
|
|
51
|
-
## MANDATORY SEQUENCE
|
|
52
|
-
|
|
53
|
-
**CRITICAL:** Follow this sequence exactly. Do not skip, reorder, or improvise.
|
|
54
|
-
|
|
55
|
-
### 1. Check Eligibility
|
|
56
|
-
|
|
57
|
-
Evaluate the following conditions sequentially. **If ANY condition fails, skip silently to section 5 (auto-proceed) with no output:**
|
|
58
|
-
|
|
59
|
-
1. **Tier is Deep:** If tier is Quick, Forge, or Forge+, skip silently.
|
|
60
|
-
2. **Source is GitHub:** Verify `source_repo` is a GitHub URL (`https://github.com/...`) or `owner/repo` format. If the source is a local path, a non-GitHub URL, or any other format, attempt GitHub remote detection (section 1b) before skipping.
|
|
61
|
-
3. **`gh` CLI is available:** Run `gh auth status` to verify the CLI is installed and authenticated. If it fails, skip silently.
|
|
62
|
-
|
|
63
|
-
All three conditions must pass to proceed to section 2.
|
|
64
|
-
|
|
65
|
-
### 1b. GitHub Remote Detection for Local Sources
|
|
66
|
-
|
|
67
|
-
**Only runs when condition 2 above fails because `source_repo` is a local path.**
|
|
68
|
-
|
|
69
|
-
Local repositories that are clones of GitHub repos contain temporal context (issues, PRs, releases) accessible via `gh`. Detect this automatically:
|
|
70
|
-
|
|
71
|
-
1. Check if the local path is a git repository: `git -C {source_repo} rev-parse --is-inside-work-tree`
|
|
72
|
-
2. If not a git repo: skip silently to section 5 (current behavior).
|
|
73
|
-
3. Extract the origin remote: `git -C {source_repo} remote get-url origin`
|
|
74
|
-
4. If the remote URL contains `github.com`:
|
|
75
|
-
- Extract `owner/repo` from the remote URL (strip `.git` suffix, handle both HTTPS and SSH formats)
|
|
76
|
-
- Log: "**Local source with GitHub remote detected:** {owner}/{repo} — fetching temporal context."
|
|
77
|
-
- Use the extracted `owner/repo` for all `gh` API calls in sections 3-4. Continue to condition 3 (gh CLI check).
|
|
78
|
-
5. If no remote, or remote is not GitHub: skip silently to section 5 (current behavior).
|
|
79
|
-
|
|
80
|
-
### 2. Check Cache (Skip If Fresh)
|
|
81
|
-
|
|
82
|
-
Read `forge-tier.yaml` from the sidecar path.
|
|
83
|
-
|
|
84
|
-
- Look for a `qmd_collections` entry where `skill_name` matches the current brief AND `type` is `"temporal"`.
|
|
85
|
-
- If found AND `created_at` is within the last **7 days**: the temporal collection is fresh. Display:
|
|
86
|
-
|
|
87
|
-
"**Temporal context: cached.** Collection `{skill-name}-temporal` is fresh ({days} days old). Skipping re-fetch."
|
|
88
|
-
|
|
89
|
-
Skip to section 5 (auto-proceed).
|
|
90
|
-
|
|
91
|
-
- If not found OR `created_at` is older than 7 days: continue to section 3.
|
|
92
|
-
|
|
93
|
-
### 3. Fetch Temporal Context
|
|
94
|
-
|
|
95
|
-
Create a staging directory: `_bmad-output/{skill-name}-temporal/`
|
|
96
|
-
|
|
97
|
-
Resolve the `owner` and `repo` from `source_repo` (e.g., `acme/toolkit` from `https://github.com/acme/toolkit`).
|
|
98
|
-
|
|
99
|
-
Execute the following fetches, writing output as markdown files to the staging directory. **If any individual fetch fails, log a warning and continue with the others:**
|
|
100
|
-
|
|
101
|
-
1. **Issues (last 100):**
|
|
102
|
-
|
|
103
|
-
```bash
|
|
104
|
-
gh issue list -R {owner}/{repo} --state all --limit 100 --json number,title,state,labels,createdAt,closedAt,body | ...
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
Write to `{staging}/issues.md` — format as a markdown document with one section per issue (number, title, state, labels, body summary).
|
|
108
|
-
|
|
109
|
-
2. **Merged PRs (last 100):**
|
|
110
|
-
|
|
111
|
-
```bash
|
|
112
|
-
gh pr list -R {owner}/{repo} --state merged --limit 100 --json number,title,mergedAt,labels,body | ...
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
Write to `{staging}/prs.md` — format as a markdown document with one section per PR.
|
|
116
|
-
|
|
117
|
-
3. **Releases (last 10):**
|
|
118
|
-
|
|
119
|
-
**Note:** `gh release list --json` does **not** support the `body` field. Use a two-step approach: list tags first, then fetch each release individually with `--json` (which IS supported on `gh release view`).
|
|
120
|
-
|
|
121
|
-
```bash
|
|
122
|
-
# Step 1: Get release tags (body NOT available here)
|
|
123
|
-
gh release list -R {owner}/{repo} --limit 10 --json tagName,name,publishedAt
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
If Step 1 returns an empty array (no releases), skip Step 2 and omit the releases section entirely.
|
|
127
|
-
|
|
128
|
-
```bash
|
|
129
|
-
# Step 2: For EACH tagName from Step 1, fetch the full release
|
|
130
|
-
gh release view {tagName} -R {owner}/{repo} --json tagName,name,publishedAt,body
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
Iterate over every `tagName` from Step 1's JSON array. If `gh release view` fails for a specific tag, log a warning and skip that release — continue with remaining tags. If a rate limit (HTTP 429) is hit, stop the release loop, keep results collected so far, and log: "Release fetch stopped at tag {N}/{total} due to rate limiting."
|
|
134
|
-
|
|
135
|
-
Write to `{staging}/releases.md` — format as a markdown document with one section per release (tag, name, date, body).
|
|
136
|
-
|
|
137
|
-
4. **Changelog (if exists):**
|
|
138
|
-
|
|
139
|
-
Check if `CHANGELOG.md` or `RELEASES.md` exists in the repository root:
|
|
140
|
-
|
|
141
|
-
```bash
|
|
142
|
-
gh api repos/{owner}/{repo}/contents/CHANGELOG.md --jq '.content' | base64 -d
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
If found, write to `{staging}/changelog.md`. If not found (404), skip silently.
|
|
146
|
-
|
|
147
|
-
#### 3b. Targeted Function Searches (Uses Extraction Inventory)
|
|
148
|
-
|
|
149
|
-
After the generic fetches above, perform **targeted searches** using the top-level public API function names from `extraction_inventory.top_exports[]`. This produces high-signal results that generic list fetches miss.
|
|
150
|
-
|
|
151
|
-
**Limit:** Search the top **10 function names** maximum to control API call volume and avoid `gh` rate limiting.
|
|
152
|
-
|
|
153
|
-
For each function name in `top_exports[]` (up to 10):
|
|
154
|
-
|
|
155
|
-
```bash
|
|
156
|
-
gh search issues --repo {owner}/{repo} "{function_name}" --limit 5 --json number,title,state,body
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
Aggregate all targeted search results into a single file: `{staging}/targeted-issues.md`. Format as a markdown document with one section per function name, listing the matching issues/PRs found.
|
|
160
|
-
|
|
161
|
-
**If `gh search` is unavailable** (older `gh` CLI versions): skip targeted searches silently. The generic fetches from section 3 still provide baseline temporal context.
|
|
162
|
-
|
|
163
|
-
**If rate limiting occurs** (HTTP 429 or similar): stop targeted searches immediately, keep results collected so far. Log: "Targeted search stopped at function {N}/{total} due to rate limiting."
|
|
164
|
-
|
|
165
|
-
**After all fetching,** verify at least one file was written to the staging directory. If the staging directory is empty (all fetches failed), log a warning and skip to section 5.
|
|
166
|
-
|
|
167
|
-
### 4. Index Into QMD & Register
|
|
168
|
-
|
|
169
|
-
**Index the staging directory:**
|
|
170
|
-
|
|
171
|
-
If a `{skill-name}-temporal` collection already exists, remove and recreate for atomic replace:
|
|
172
|
-
|
|
173
|
-
```bash
|
|
174
|
-
qmd collection remove {skill-name}-temporal
|
|
175
|
-
qmd collection add {project-root}/_bmad-output/{skill-name}-temporal/ --name {skill-name}-temporal --mask "*.md"
|
|
176
|
-
qmd embed
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
**Note:** `qmd embed` generates vector embeddings required for `vector_search` and `deep_search`. Without it, only BM25 keyword `search` works. Run it after every `qmd collection add`.
|
|
180
|
-
|
|
181
|
-
**Update the registry** in `forge-tier.yaml`:
|
|
182
|
-
|
|
183
|
-
If an entry with `name: "{skill-name}-temporal"` already exists in `qmd_collections`, replace it. Otherwise, append:
|
|
184
|
-
|
|
185
|
-
```yaml
|
|
186
|
-
- name: "{skill-name}-temporal"
|
|
187
|
-
type: "temporal"
|
|
188
|
-
source_workflow: "create-skill"
|
|
189
|
-
skill_name: "{skill-name}"
|
|
190
|
-
created_at: "{current ISO date}"
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
**Clean up** the staging directory after successful indexing:
|
|
194
|
-
|
|
195
|
-
```bash
|
|
196
|
-
rm -rf {project-root}/_bmad-output/{skill-name}-temporal/
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
**Error handling:**
|
|
200
|
-
|
|
201
|
-
- If QMD indexing fails: log the error, note that temporal enrichment will be unavailable. Do NOT fail the workflow.
|
|
202
|
-
- If registry update fails: log the error, continue. The collection may exist in QMD even if the registry entry failed.
|
|
203
|
-
- If cleanup fails: log a warning and continue.
|
|
204
|
-
|
|
205
|
-
Display brief confirmation:
|
|
206
|
-
|
|
207
|
-
"**Temporal context indexed.** Collection `{skill-name}-temporal` created ({file_count} files: {list files}). Proceeding to enrichment..."
|
|
208
|
-
|
|
209
|
-
### 5. Menu Handling Logic
|
|
210
|
-
|
|
211
|
-
**Auto-proceed step — no user interaction.**
|
|
212
|
-
|
|
213
|
-
After temporal context is fetched and indexed (or skipped for any reason), immediately load, read entire file, then execute `{nextStepFile}`.
|
|
214
|
-
|
|
215
|
-
#### EXECUTION RULES:
|
|
216
|
-
|
|
217
|
-
- This is an auto-proceed step with no user choices
|
|
218
|
-
- Quick/Forge/Forge+ tiers skip directly to next step with no output
|
|
219
|
-
- Non-GitHub sources skip directly to next step with no output
|
|
220
|
-
- Cached collections (< 7 days old) skip with brief cache-hit message
|
|
221
|
-
- Deep tier with fresh fetch displays brief confirmation then auto-proceeds
|
|
222
|
-
- All failures degrade gracefully — skip and auto-proceed
|
|
223
|
-
|
|
224
|
-
## CRITICAL STEP COMPLETION NOTE
|
|
225
|
-
|
|
226
|
-
ONLY WHEN temporal context is indexed into QMD (or the step is skipped due to eligibility, cache, or failure) will you proceed to load `{nextStepFile}` for documentation fetch.
|
|
227
|
-
|
|
228
|
-
---
|
|
229
|
-
|
|
230
|
-
## 🚨 SYSTEM SUCCESS/FAILURE METRICS
|
|
231
|
-
|
|
232
|
-
### ✅ SUCCESS:
|
|
233
|
-
|
|
234
|
-
- Non-eligible scenarios (Quick/Forge/Forge+ tier, non-GitHub source, no `gh` CLI) skipped silently
|
|
235
|
-
- Cached collections (< 7 days old) detected and re-fetch skipped
|
|
236
|
-
- Temporal data fetched via `gh` CLI into staging directory (generic + targeted)
|
|
237
|
-
- Targeted searches performed for up to 10 top_exports function names
|
|
238
|
-
- At least one temporal file written (issues, PRs, releases, changelog, or targeted-issues)
|
|
239
|
-
- Collection `{skill-name}-temporal` indexed into QMD
|
|
240
|
-
- Registry entry added/updated in forge-tier.yaml with type `"temporal"`
|
|
241
|
-
- Staging directory cleaned up after indexing
|
|
242
|
-
- Auto-proceeded to step-03c
|
|
243
|
-
|
|
244
|
-
### ❌ SYSTEM FAILURE:
|
|
245
|
-
|
|
246
|
-
- Halting the workflow due to a `gh` CLI, QMD, or network failure
|
|
247
|
-
- Leaving staging files on disk after indexing (must clean up)
|
|
248
|
-
- Overwriting or modifying extraction data from step-03
|
|
249
|
-
- Displaying skip messages for Quick/Forge/Forge+ tiers (should be silent)
|
|
250
|
-
- Attempting to fetch temporal data from non-GitHub sources
|
|
251
|
-
- Not registering the collection in forge-tier.yaml after successful indexing
|
|
252
|
-
|
|
253
|
-
**Master Rule:** Temporal context is best-effort enrichment data. Fetch what you can, index it, clean up, and move on. Failures degrade gracefully — they never block the skill compilation pipeline.
|