bmad-module-skill-forge 0.10.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/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 -71
- 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 -64
- 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 -70
- 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 +16 -68
- 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 +11 -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 -69
- 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 -179
- 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 -150
- package/src/workflows/create-stack-skill/workflow.md +0 -59
- package/src/workflows/drop-skill/steps-c/step-03-report.md +0 -136
- 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 -178
- 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 -133
- package/src/workflows/rename-skill/workflow.md +0 -64
- package/src/workflows/setup-forge/steps-c/step-04-report.md +0 -159
- package/src/workflows/setup-forge/workflow.md +0 -51
- package/src/workflows/shared/health-check.md +0 -231
- 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 -208
- 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 -200
- 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
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
---
|
|
2
|
+
nextStepFile: './step-04-merge.md'
|
|
3
|
+
extractionPatternsData: 'skf-create-skill/references/extraction-patterns.md'
|
|
4
|
+
extractionPatternsTracingData: 'skf-create-skill/references/extraction-patterns-tracing.md'
|
|
5
|
+
remoteSourceResolutionData: 'references/remote-source-resolution.md'
|
|
6
|
+
tierDegradationRulesData: 'skf-create-skill/references/tier-degradation-rules.md'
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Step 3: Re-Extract Changed Exports
|
|
10
|
+
|
|
11
|
+
## STEP GOAL:
|
|
12
|
+
|
|
13
|
+
Perform tier-aware extraction on only the changed files identified in step 02, producing fresh export data with confidence tier labels (T1/T1-low/T2) that will be merged into the existing skill in step 04.
|
|
14
|
+
|
|
15
|
+
## Rules
|
|
16
|
+
|
|
17
|
+
- Focus only on extracting changed exports — do not merge or modify existing skill
|
|
18
|
+
- Only extract files in the change manifest — do not touch unchanged files. **Exception (gap-driven mode):** §0a's Targeted Re-Extraction Branch also scans files listed in each manifest entry's `remediation_paths[]` to resolve citation-less Critical/High gaps.
|
|
19
|
+
- For each changed file, launch a subprocess for deep AST analysis (Pattern 2); if unavailable, extract sequentially
|
|
20
|
+
|
|
21
|
+
## MANDATORY SEQUENCE
|
|
22
|
+
|
|
23
|
+
**CRITICAL:** Follow this sequence exactly. Do not skip, reorder, or improvise unless user explicitly requests a change.
|
|
24
|
+
|
|
25
|
+
### 0. Check for Gap-Driven Mode
|
|
26
|
+
|
|
27
|
+
**If `update_mode == "gap-driven"` (set in step-01 via `--from-test-report`, confirmed in step-02 section 0):**
|
|
28
|
+
|
|
29
|
+
Source code has not drifted — the gap-derived manifest from step-02 contains export-level findings translated from the test report, not file-level changes. Perform citation spot-checks instead of full re-extraction to verify each gap-affected export is still at its recorded location.
|
|
30
|
+
|
|
31
|
+
**0.a Pre-flight: verify workspace HEAD matches pinned commit.** Gap-driven spot-checks read source at recorded `source_line` positions and must see the exact bytes the skill was pinned against. A drifted workspace silently verifies against the wrong tree — moved/renamed symbols appear "verified" because the recorded line now points at different code. Before reading any source, run this guard:
|
|
32
|
+
|
|
33
|
+
- Resolve `pinned_commit` from `metadata.source_commit` (loaded in step-01).
|
|
34
|
+
- **If `pinned_commit` is null, empty, `"local"`, or a per-repo map (stack skills) with no single commit:** skip the guard and log `workspace_drift_check: skipped (no pinned commit)`. Continue to bullet 1.
|
|
35
|
+
- **If `source_root` is not a git working tree** (e.g., bare checkout, tarball extract) — detect by running `git -C "{source_root}" rev-parse --is-inside-work-tree`; non-zero exit means skip: log `workspace_drift_check: skipped (not a git working tree)`. Continue to bullet 1.
|
|
36
|
+
- **Otherwise** run `git -C "{source_root}" rev-parse HEAD` and compare to `pinned_commit`. Accept either a full SHA match or a short-SHA prefix match (the pinned commit is often stored as an 8-char short hash — see `src/knowledge/provenance-tracking.md`).
|
|
37
|
+
- **On match:** log `workspace_drift_check: ok ({short_sha})` and continue.
|
|
38
|
+
- **On mismatch, AND the user did not pass `--allow-workspace-drift`:** HALT immediately with exit status `halted-for-workspace-drift`. Display:
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
Workspace HEAD does not match the commit this skill was pinned against.
|
|
42
|
+
|
|
43
|
+
pinned (metadata.source_commit): {pinned_commit}
|
|
44
|
+
pinned ref (metadata.source_ref): {source_ref or "unset"}
|
|
45
|
+
workspace HEAD ({source_root}): {head_sha}
|
|
46
|
+
|
|
47
|
+
Gap-driven spot-checks read source at pinned line numbers — verifying
|
|
48
|
+
against a drifted tree silently produces wrong results (symbols appear at
|
|
49
|
+
unintended locations). Re-sync the workspace before re-running:
|
|
50
|
+
|
|
51
|
+
git -C "{source_root}" checkout {source_ref or pinned_commit}
|
|
52
|
+
|
|
53
|
+
Or, to intentionally proceed against the current workspace HEAD (accepting
|
|
54
|
+
that spot-checks will read bytes that differ from the pinned commit),
|
|
55
|
+
re-run update-skill with `--allow-workspace-drift`.
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Do not proceed to bullet 1. Step-04 merge has not run; no partial writes.
|
|
59
|
+
- **On mismatch WITH `--allow-workspace-drift`:** log `workspace_drift_check: overridden (pinned={pinned_commit}, head={head_sha})` and surface a visible warning in the final report ("**Workspace drift accepted via --allow-workspace-drift** — spot-checks read HEAD {head_sha}, not pinned {pinned_commit}"). Continue to bullet 1. The override does not automatically re-pin `metadata.source_commit`; re-pinning is explicit user work (run the normal-mode update-skill flow against the same HEAD, or re-create the skill).
|
|
60
|
+
|
|
61
|
+
1. Use the provenance map already loaded in step-01 (at `{forge_version}/provenance-map.json`) — do not re-read
|
|
62
|
+
2. For each entry in the gap-derived change manifest from step-02:
|
|
63
|
+
- Look up the export by `name` in `provenance_map.exports` — read `source_file` and `source_line`
|
|
64
|
+
- **If export not found in provenance map:**
|
|
65
|
+
- **If the manifest entry has a `source_citation` (propagated from the test report by step-02 §0 bullet 4):** read the file at that citation's `file:line ± 5` lines and verify the symbol name still appears within that window. Record a full `verified` / `moved` / `missing` entry using the citation as the starting location — same spot-check logic as the "export found" branch below, keyed on the manifest-supplied citation instead of the provenance map. The export is still flagged `NEW_EXPORT` for the merge step; this branch only upgrades the provenance entry from `unknown` to a live spot-check result so step-06 writes `source_file` / `source_line` instead of `null`.
|
|
66
|
+
- **If the manifest entry has no `source_citation` but has a non-empty `remediation_paths[]` AND `severity` is `Critical` or `High`:** route this entry to §0a (Targeted Re-Extraction Branch). §0a scans the remediation paths with the tier-appropriate extractor and, on success, records a full verification record with `verification: re-extracted`, a live `provenance_citation`, and full signature/params/return-type fields for the merge step to consume as a NEW_EXPORT. On failure, §0a halts the workflow — Critical/High gaps are not allowed to degrade to `unknown`. See §0a for the procedure, the consolidated halt protocol, and the output record shape.
|
|
67
|
+
- **If the manifest entry has no `source_citation` AND (`remediation_paths[]` is empty OR `severity` is `Medium`, `Low`, or `Info`):** record as new (`provenance_citation: unknown`) — no spot-check possible; flag for merge step to handle as `NEW_EXPORT`. Step-06 §3 only accepts null `source_file` / `source_line` for these lower-severity unknowns; a Critical/High unknown reaching step-06 indicates §0a was skipped or bypassed and is a workflow bug.
|
|
68
|
+
- **If export found:** read the source file at `source_line ± 5` lines and verify the symbol name still appears within that window
|
|
69
|
+
- Record verification outcome: `verified` (symbol at recorded line), `moved` (symbol found elsewhere in same file — record new line), `missing` (symbol not found in file), `re-extracted` (resolved via §0a from `remediation_paths[]`), or `unknown` (no usable provenance data)
|
|
70
|
+
3. Build a minimal extraction results block matching section 4's shape, with `mode: gap-driven` and per-export verification records:
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
Extraction Results:
|
|
74
|
+
mode: gap-driven
|
|
75
|
+
files_extracted: {count} # non-zero only when §0a scanned remediation_paths[]
|
|
76
|
+
exports_extracted: {gap_count}
|
|
77
|
+
confidence_breakdown:
|
|
78
|
+
T1: {verified_count + moved_count + re_extracted_t1_count}
|
|
79
|
+
T1-low: {re_extracted_t1_low_count}
|
|
80
|
+
T2: 0
|
|
81
|
+
|
|
82
|
+
Per-export verification:
|
|
83
|
+
{export_name}:
|
|
84
|
+
provenance_citation: {source_file}:{source_line}
|
|
85
|
+
verification: verified|moved|missing|unknown|re-extracted
|
|
86
|
+
new_location: {source_file}:{new_line} # set when moved OR re-extracted
|
|
87
|
+
resolution_source: remediation-paths # set only when verification == re-extracted
|
|
88
|
+
gap_category: NEW_EXPORT|MODIFIED_EXPORT|metadata_update
|
|
89
|
+
|
|
90
|
+
Per-file extractions: # populated only when §0a produced re-extracted records
|
|
91
|
+
{file_path}:
|
|
92
|
+
exports:
|
|
93
|
+
- name: {export_name}
|
|
94
|
+
type: function|class|type|constant
|
|
95
|
+
signature: {full signature}
|
|
96
|
+
location: {file}:{start_line}-{end_line}
|
|
97
|
+
confidence: T1|T1-low
|
|
98
|
+
params: [{name, type}]
|
|
99
|
+
return_type: {type}
|
|
100
|
+
docstring: {summary}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
4. Set `no_reextraction: true` in workflow context — step-06 will use this flag to skip stale `source_file`/`source_line`/`confidence` field updates for `verified` exports. `moved` exports get updated citations; `re-extracted` exports get full fresh provenance from §0a's extraction records (see step-06 §3). The flag is a global gap-driven marker, not a per-entry one — step-06 dispatches on each verification outcome independently.
|
|
104
|
+
5. **Skip all remaining sections of step-03** — sections 1–5 are source-drift extraction paths that do not apply. Display the summary below and load `{nextStepFile}` to proceed directly to the merge step.
|
|
105
|
+
|
|
106
|
+
"**Gap-driven re-extraction.** Verified {verified_count}/{gap_count} citations against live source. Moved: {moved_count}. Missing: {missing_count}. Re-extracted (via remediation paths, §0a): {re_extracted_count}. Unknown (not in provenance map): {unknown_count}. Proceeding to merge."
|
|
107
|
+
|
|
108
|
+
**If normal mode (`update_mode` unset or not `gap-driven`):** Continue with docs-only check and source extraction below.
|
|
109
|
+
|
|
110
|
+
### 0a. Targeted Re-Extraction Branch (Helper — Called from §0 bullet 2)
|
|
111
|
+
|
|
112
|
+
**Do not execute this section sequentially.** It is a helper procedure invoked by §0 bullet 2 when specific conditions are met (see below). Normal-mode runs, and gap-driven runs where every entry has a `source_citation` or qualifies as `Medium`/`Low`/`Info` unknown, skip this section entirely. §0's "skip sections 1–5" instruction does not apply here — §0a is addressed by name from §0, not by sequential fall-through.
|
|
113
|
+
|
|
114
|
+
**Used by:** §0 bullet 2, when a manifest entry has no `source_citation`, has non-empty `remediation_paths[]`, and `severity` is `Critical` or `High`.
|
|
115
|
+
|
|
116
|
+
**Purpose:** produce AST-backed provenance for citation-less Critical/High gaps so step-06 §3 never writes `source_file: null` for blocking findings. Honors the workflow-level rule **Never hallucinate — every statement must have AST provenance** against the most common gap-driven trigger — a failing test report whose Gap Report `Source:` field is a region reference (e.g., `@storybook/addon-docs control primitives`) rather than a `file:line` pair. Gap-driven mode skips §1 through §5, so §0a is also the only place §1b's source-access and extraction machinery is invoked during gap-driven runs.
|
|
117
|
+
|
|
118
|
+
**Procedure:**
|
|
119
|
+
|
|
120
|
+
1. **Resolve source access** — invoke §1b's MCP-fallback chain (gh API → zread → deepwiki → workspace / ephemeral clone) once per workflow run to ensure files under `{source_root}` are readable. Cache the chosen access path; do not re-resolve per entry.
|
|
121
|
+
2. **Expand `remediation_paths[]`** — for each path across all qualifying entries:
|
|
122
|
+
- Literal source file (ends in a recognized source extension): use as-is.
|
|
123
|
+
- Directory or glob: expand under `{source_root}` using the provenance map's file patterns.
|
|
124
|
+
- **Security boundary:** reject and skip any path that resolves outside `{source_root}`. Remediation text is user-editable and must never be allowed to escape the source tree.
|
|
125
|
+
- Deduplicate the resolved file set across all entries routed to §0a — each physical file is scanned at most once.
|
|
126
|
+
3. **Extract** — run the tier-appropriate extractor from §1b (Quick pattern-match → T1-low; Forge/Forge+/Deep AST via ast-grep → T1) over the resolved file set. Launch subprocesses in parallel (Pattern 4) when available; sequential fallback otherwise. Follow the AST Extraction Protocol in `{extractionPatternsData}` for Forge/Deep tiers, and the tier-degradation rules in `{tierDegradationRulesData}` when AST tools fail on individual files.
|
|
127
|
+
4. **Match by name** — for each manifest entry routed here, search the aggregated extraction results for an export whose `name` matches the manifest entry's `name`. Record the first hit as:
|
|
128
|
+
- `verification: re-extracted`
|
|
129
|
+
- `provenance_citation: {file}:{start_line}` from the AST result
|
|
130
|
+
- `new_location: {file}:{start_line}` (same value — satisfies the existing consumer contract)
|
|
131
|
+
- `resolution_source: remediation-paths`
|
|
132
|
+
- `confidence: T1` (AST-extracted) or `T1-low` (pattern-matched fallback)
|
|
133
|
+
- the full extraction signature (type, params, return_type, docstring) — mirror the shape of §4's per-file extraction record so step-04 Priority 5 can merge it with the same code path used in normal mode.
|
|
134
|
+
5. **Track failures across all qualifying entries.** Collect every entry whose symbol was not found in any scanned remediation path into an `unresolved[]` list. After processing every qualifying entry, if `unresolved[]` is non-empty: HALT with a consolidated report listing every unresolved entry (`name`, `severity`, `remediation_paths`, `files_scanned`, `exports_found_in_scan`). Template:
|
|
135
|
+
|
|
136
|
+
```
|
|
137
|
+
Targeted re-extraction failed for {N} Critical/High gap(s).
|
|
138
|
+
|
|
139
|
+
Critical and High gaps must resolve to AST provenance. The Remediation text for
|
|
140
|
+
the entries below does not name a file that contains the expected export, so the
|
|
141
|
+
workflow cannot produce a non-null `source_file` / `source_line` without
|
|
142
|
+
hallucinating.
|
|
143
|
+
|
|
144
|
+
Unresolved entries:
|
|
145
|
+
{for each entry in unresolved[]:}
|
|
146
|
+
- {name} ({severity})
|
|
147
|
+
remediation_paths: {paths}
|
|
148
|
+
files_scanned: {count}
|
|
149
|
+
exports_matched: 0
|
|
150
|
+
|
|
151
|
+
Fix one of the following, then re-run update-skill:
|
|
152
|
+
a) Add a `file:line` citation to the Gap Report `Source:` field.
|
|
153
|
+
b) Edit the Remediation text to name the file(s) that actually contain the export(s).
|
|
154
|
+
c) Downgrade the gap(s) to Medium/Low/Info (accepts the degraded documentation outcome).
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Exit with status `halted-for-remediation-path`. Step-04 merge has not run; no partial writes.
|
|
158
|
+
|
|
159
|
+
6. **Success summary** — record `targeted_reextraction: {resolved_count, files_scanned, exports_matched, tier}` in workflow context. The evidence report (step-06 §4) surfaces this alongside the verified / moved / missing tally.
|
|
160
|
+
|
|
161
|
+
**Why halt instead of degrading to `unknown`:** a Critical or High gap by definition blocks skill usefulness — it is either missing documentation for a public API or a wrong signature. Silently writing `source_file: null` for a blocking gap produces a skill that passes re-test but still hides the broken behavior behind a placeholder. The halt forces the test report to carry usable remediation information — a one-time fix-up that is far cheaper than a downstream audit trying to track why the "repaired" skill still fails.
|
|
162
|
+
|
|
163
|
+
### 1. Check for Docs-Only Mode
|
|
164
|
+
|
|
165
|
+
**If `source_type: "docs-only"` in the original brief or metadata:**
|
|
166
|
+
|
|
167
|
+
"**Docs-only skill detected.** This skill was generated from external documentation, not source code. Re-extraction will re-fetch the original `doc_urls` to check for updated content."
|
|
168
|
+
|
|
169
|
+
- Re-fetch each URL from `doc_urls` (from the brief or metadata) using whatever web fetching capability is available
|
|
170
|
+
- Extract updated API information with T3 `[EXT:{url}]` citations
|
|
171
|
+
- Build the updated extraction inventory from fetched content
|
|
172
|
+
- Skip all source code extraction below — proceed directly to the merge step (section 5 or equivalent)
|
|
173
|
+
|
|
174
|
+
**If `source_type: "source"` (default):** Continue with source extraction below.
|
|
175
|
+
|
|
176
|
+
### 1b. Determine Extraction Strategy by Tier
|
|
177
|
+
|
|
178
|
+
**Remote Source Resolution (Forge/Deep only):**
|
|
179
|
+
|
|
180
|
+
**MCP source access (ordered fallback):** When `source_repo` is set in metadata.json, try each MCP tool in order to fetch only the changed files from the change manifest. This avoids clone overhead entirely. Tools are ordered by data freshness — gh API returns live GitHub content and is preferred for update-skill where current file versions are required. zread and deepwiki depend on manual indexing and may return stale data if indexes haven't been refreshed since the changes being extracted.
|
|
181
|
+
|
|
182
|
+
1. **gh API** — `gh api repos/{owner}/{repo}/contents/{path}` for raw file content
|
|
183
|
+
- If accessible: fetch file content (base64-decoded), always current
|
|
184
|
+
- If rate-limited, 404, or inaccessible: log tool and reason, continue to next tool
|
|
185
|
+
2. **zread** — `get_repo_structure` + `read_file` for targeted file access
|
|
186
|
+
- If repo found: fetch changed files, proceed with extraction
|
|
187
|
+
- If "repo not found" or error: log tool and reason, continue to next tool
|
|
188
|
+
- Caveat: indexed data — may be stale if index wasn't refreshed after the target changes
|
|
189
|
+
3. **deepwiki** — `ask_question` for targeted export/signature queries
|
|
190
|
+
- If repo indexed and returns usable source data: extract from response
|
|
191
|
+
- If no results or repo not indexed: log tool and reason, continue to next tool
|
|
192
|
+
- Caveat: returns synthesized content, not raw source — extraction quality varies; index may be stale
|
|
193
|
+
|
|
194
|
+
**Confidence labeling:** MCP-fetched content written to a temp file and analyzed with ast-grep → T1. MCP-fetched content analyzed with pattern matching (AST unavailable) → T1-low.
|
|
195
|
+
|
|
196
|
+
**If all MCP tools fail for this repo:** Fall back to workspace or ephemeral clone — load and follow `{remoteSourceResolutionData}` for clone setup, version reconciliation, and AST tool unavailability handling.
|
|
197
|
+
|
|
198
|
+
**If all approaches fail (MCP + workspace/ephemeral clone):** Degrade to provenance-map-only analysis (State 2, T1 confidence from compilation-time data). Warn user: "Source access failed for {source_repo}. Analysis limited to provenance-map baseline."
|
|
199
|
+
|
|
200
|
+
**Quick tier (text pattern matching):**
|
|
201
|
+
- Extract function/class/type names via regex patterns
|
|
202
|
+
- Extract export statements via text matching
|
|
203
|
+
- Confidence: T1-low (pattern-matched, not AST-verified)
|
|
204
|
+
|
|
205
|
+
**Forge tier (AST structural extraction):**
|
|
206
|
+
|
|
207
|
+
⚠️ **CRITICAL:** Load and follow the **AST Extraction Protocol** from `{extractionPatternsData}`. Use the decision tree based on the number of changed files: prefer MCP `find_code()` for small sets, `find_code_by_rule()` with scoped YAML rules for medium sets, and CLI `--json=stream` with line-by-line streaming for large sets. Never use `ast-grep --json` (without `=stream`) — it loads the entire result set into memory and will fail on large codebases.
|
|
208
|
+
|
|
209
|
+
- Extract: function signatures, type definitions, class members, exported constants
|
|
210
|
+
- Extract: parameter types, return types, JSDoc/docstring comments
|
|
211
|
+
- Confidence: T1 (AST-verified structural truth)
|
|
212
|
+
|
|
213
|
+
**Tier degradation handling (Forge/Forge+/Deep):** If ast-grep is unavailable or fails on individual files, follow `{tierDegradationRulesData}` for fallback strategy and user notification requirements. Silent degradation is forbidden — the user must always know when AST extraction was skipped.
|
|
214
|
+
|
|
215
|
+
**Deep tier (AST + QMD semantic enrichment):**
|
|
216
|
+
- Perform all Forge tier extractions (T1)
|
|
217
|
+
- Additionally: launch a subprocess that queries qmd_bridge for temporal context on changed exports, returning T2 evidence per export
|
|
218
|
+
- QMD provides: usage patterns, historical context, related documentation
|
|
219
|
+
- Confidence: T1 for structural, T2 for semantic enrichment
|
|
220
|
+
|
|
221
|
+
**Tool resolution:** `ast_bridge` → ast-grep MCP tools (`find_code`, `find_code_by_rule`) or `ast-grep` CLI. `qmd_bridge` → QMD MCP tools (`mcp__plugin_qmd-plugin_qmd__search`, `vector_search`) or `qmd` CLI. See `knowledge/tool-resolution.md`.
|
|
222
|
+
|
|
223
|
+
### 2. Extract Changed Files
|
|
224
|
+
|
|
225
|
+
**Skip authoritative doc paths.** Before iterating the change manifest, build a skip set from `promoted_docs_new[]` (populated by step-02 §1b) and any existing `file_entries[]` entries with `file_type: "doc"` from the provenance map. These are documentation files tracked for drift detection only — they must not reach AST extraction, which would produce ghost entries on non-code content. If a change manifest entry matches the skip set, skip it silently and continue; doc-type drift is handled by step-02 Category D and step-04 Priority 6/7.
|
|
226
|
+
|
|
227
|
+
DO NOT BE LAZY — For EACH remaining file in the change manifest with status MODIFIED, ADDED, or RENAMED, launch a subprocess that:
|
|
228
|
+
|
|
229
|
+
1. Loads the source file
|
|
230
|
+
2. Performs tier-appropriate extraction (Quick/Forge/Forge+/Deep)
|
|
231
|
+
3. For each export found:
|
|
232
|
+
- Record: export name, type (function/class/type/constant), signature
|
|
233
|
+
- Record: file path, start line, end line
|
|
234
|
+
- Record: parameters with types (if function/method)
|
|
235
|
+
- Record: return type (if function/method)
|
|
236
|
+
- Record: JSDoc/docstring summary (if present)
|
|
237
|
+
- Label: confidence tier (T1/T1-low/T2)
|
|
238
|
+
4. Returns structured extraction findings to parent
|
|
239
|
+
|
|
240
|
+
**For DELETED files:** No extraction needed — deletions handled in merge step.
|
|
241
|
+
|
|
242
|
+
**For MOVED files:** Re-extract at new location to update file:line references.
|
|
243
|
+
|
|
244
|
+
**Re-export tracing (Forge/Deep only):** After extracting changed files, check if any public exports from the package entry point (`__init__.py`, `index.ts`, `lib.rs`) are unresolved — particularly when a changed file is part of a module re-export chain. Follow the **Re-Export Tracing** protocol in `{extractionPatternsTracingData}` to trace unresolved symbols to their actual definition files.
|
|
245
|
+
|
|
246
|
+
### 2b. CCC Semantic Ranking (Forge+ and Deep with ccc)
|
|
247
|
+
|
|
248
|
+
**IF `tools.ccc` is true in forge-tier.yaml:**
|
|
249
|
+
|
|
250
|
+
Before aggregating extraction results, use CCC to assess semantic significance of changes:
|
|
251
|
+
|
|
252
|
+
1. Run `ccc_bridge.search("{skill_name}", source_root, top_k=15)` — **Tool resolution:** `/ccc` skill search (Claude Code), ccc MCP (Cursor), `ccc search` (CLI) — to get the skill's most semantically central files
|
|
253
|
+
2. Cross-reference the change manifest files with CCC results
|
|
254
|
+
3. Files appearing in BOTH the change manifest AND CCC's top results are **semantically significant changes** — flag them for priority in the merge step
|
|
255
|
+
4. Store `{ccc_significant_changes: [{file, score}]}` in context
|
|
256
|
+
|
|
257
|
+
This helps the merge step (section 4) prioritize which changes are most likely to affect the skill's core content vs. peripheral modifications.
|
|
258
|
+
|
|
259
|
+
CCC failures: skip ranking silently, all changes treated equally.
|
|
260
|
+
|
|
261
|
+
**Note on remote sources:** If `source_root` is a workspace clone, the CCC index may already exist from a prior forge and can be reused via `ccc search --refresh`. If the source is an ephemeral fallback clone, the clone path is not indexed by CCC — the search will return empty results and semantic ranking will be skipped. Deferred CCC indexing is implemented in create-skill step-03 but not in update-skill. All changes are treated equally for ephemeral remote sources.
|
|
262
|
+
|
|
263
|
+
**IF `tools.ccc` is false:** Skip this section silently.
|
|
264
|
+
|
|
265
|
+
### 3. Deep Tier QMD Enrichment (Conditional)
|
|
266
|
+
|
|
267
|
+
**ONLY if forge_tier == Deep:**
|
|
268
|
+
|
|
269
|
+
Read the `qmd_collections` registry from `{sidecar_path}/forge-tier.yaml`.
|
|
270
|
+
|
|
271
|
+
Find the collection entry matching the current skill: look for an entry where `skill_name` matches the skill being updated AND `type` is `"extraction"`.
|
|
272
|
+
|
|
273
|
+
**If a matching extraction collection is found:**
|
|
274
|
+
Launch a subprocess that loads qmd_bridge and for each changed export:
|
|
275
|
+
1. Queries the `{skill_name}-extraction` collection for semantic context related to the export
|
|
276
|
+
2. Searches for usage patterns, documentation references, temporal history
|
|
277
|
+
3. Returns T2 evidence per export (usage frequency, context snippets, related concepts)
|
|
278
|
+
|
|
279
|
+
**If no matching collection found in registry:**
|
|
280
|
+
Log: "No QMD extraction collection found for {skill_name}. T2 enrichment skipped. Re-run [CS] Create Skill to generate the collection."
|
|
281
|
+
Continue without T2 enrichment — extraction still produces T1 results.
|
|
282
|
+
|
|
283
|
+
**If forge_tier != Deep:** Skip this section with notice: "QMD enrichment skipped (tier: {forge_tier})"
|
|
284
|
+
|
|
285
|
+
### 4. Compile Extraction Results
|
|
286
|
+
|
|
287
|
+
Aggregate all subprocess results into structured extraction data:
|
|
288
|
+
|
|
289
|
+
```
|
|
290
|
+
Extraction Results:
|
|
291
|
+
files_extracted: [count]
|
|
292
|
+
exports_extracted: [count]
|
|
293
|
+
confidence_breakdown:
|
|
294
|
+
T1: [count]
|
|
295
|
+
T1-low: [count]
|
|
296
|
+
T2: [count]
|
|
297
|
+
|
|
298
|
+
Per-file extractions:
|
|
299
|
+
{file_path}:
|
|
300
|
+
exports:
|
|
301
|
+
- name: {export_name}
|
|
302
|
+
type: function|class|type|constant
|
|
303
|
+
signature: {full signature}
|
|
304
|
+
location: {file}:{start_line}-{end_line}
|
|
305
|
+
confidence: T1|T1-low|T2
|
|
306
|
+
parameters: [{name, type}]
|
|
307
|
+
return_type: {type}
|
|
308
|
+
docstring: {summary}
|
|
309
|
+
qmd_evidence: {if Deep tier}
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
### 5. Display Extraction Summary and Auto-Proceed
|
|
313
|
+
|
|
314
|
+
"**Re-Extraction Complete:**
|
|
315
|
+
|
|
316
|
+
| Metric | Count |
|
|
317
|
+
|--------|-------|
|
|
318
|
+
| Files extracted | {count} |
|
|
319
|
+
| Exports extracted | {count} |
|
|
320
|
+
| T1 (AST-verified) | {count} |
|
|
321
|
+
| T1-low (pattern-matched) | {count} |
|
|
322
|
+
| T2 (QMD-enriched) | {count} |
|
|
323
|
+
|
|
324
|
+
**Proceeding to merge with existing skill...**"
|
|
325
|
+
|
|
326
|
+
### 6. Present MENU OPTIONS
|
|
327
|
+
|
|
328
|
+
Display: "**Proceeding to merge...**"
|
|
329
|
+
|
|
330
|
+
- After extraction results are compiled, immediately load, read entire file, then execute {nextStepFile}
|
|
331
|
+
- This is an auto-proceed step with no user choices
|
|
332
|
+
|
|
333
|
+
## CRITICAL STEP COMPLETION NOTE
|
|
334
|
+
|
|
335
|
+
ONLY WHEN all changed files have been extracted and results compiled will you load {nextStepFile} to begin the merge operation.
|
|
336
|
+
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
name: 'step-04-merge'
|
|
3
|
-
description: 'Merge new extractions into existing skill content, preserving all [MANUAL] sections with conflict resolution'
|
|
4
|
-
|
|
5
2
|
nextStepFile: './step-05-validate.md'
|
|
6
|
-
manualSectionRulesFile: '
|
|
7
|
-
mergeConflictRulesFile: '
|
|
3
|
+
manualSectionRulesFile: 'references/manual-section-rules.md'
|
|
4
|
+
mergeConflictRulesFile: 'references/merge-conflict-rules.md'
|
|
8
5
|
---
|
|
9
6
|
|
|
10
7
|
# Step 4: Merge
|
|
@@ -13,45 +10,12 @@ mergeConflictRulesFile: '../data/merge-conflict-rules.md'
|
|
|
13
10
|
|
|
14
11
|
Merge freshly extracted export data into the existing SKILL.md content while preserving all [MANUAL] sections. Detect and resolve conflicts where regenerated content overlaps developer-authored content. For stack skills, merge across all output files.
|
|
15
12
|
|
|
16
|
-
##
|
|
17
|
-
|
|
18
|
-
### Universal Rules:
|
|
19
|
-
|
|
20
|
-
- 🛑 NEVER generate content without user input
|
|
21
|
-
- 📖 CRITICAL: Read the complete step file before taking any action
|
|
22
|
-
- 🔄 CRITICAL: When loading next step with 'C', ensure entire file is read
|
|
23
|
-
- 📋 YOU ARE A FACILITATOR, not a content generator
|
|
24
|
-
- ⚙️ TOOL/SUBPROCESS FALLBACK: If any instruction references a subprocess, subagent, or 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 precision code analyst operating in Surgeon mode
|
|
30
|
-
- ✅ [MANUAL] section preservation is the HIGHEST PRIORITY — zero content loss
|
|
31
|
-
- ✅ Every merge decision must be traceable and reversible
|
|
32
|
-
- ✅ When in doubt about [MANUAL] conflicts, HALT and ask the user
|
|
33
|
-
|
|
34
|
-
### Step-Specific Rules:
|
|
35
|
-
|
|
36
|
-
- 🎯 Focus ONLY on merging extractions into existing skill content
|
|
37
|
-
- 🚫 FORBIDDEN to delete or modify [MANUAL] section content
|
|
38
|
-
- 🚫 FORBIDDEN to write files — merge produces an edit plan for step 06 to execute
|
|
39
|
-
- 💬 If [MANUAL] conflicts detected: HALT and present to user for resolution
|
|
40
|
-
- 💬 If clean merge: auto-proceed without user interaction
|
|
41
|
-
|
|
42
|
-
## EXECUTION PROTOCOLS:
|
|
13
|
+
## Rules
|
|
43
14
|
|
|
44
|
-
-
|
|
45
|
-
-
|
|
46
|
-
-
|
|
47
|
-
-
|
|
48
|
-
|
|
49
|
-
## CONTEXT BOUNDARIES:
|
|
50
|
-
|
|
51
|
-
- Available: extraction results from step 03, existing SKILL.md content, [MANUAL] inventory from step 01, change manifest from step 02
|
|
52
|
-
- Focus: content merge and [MANUAL] preservation
|
|
53
|
-
- Limits: merge planning only — no file writes (step 06 executes the edit plan)
|
|
54
|
-
- Dependencies: step 03 must have produced extraction results
|
|
15
|
+
- Focus only on merging extractions into existing skill content
|
|
16
|
+
- Never delete or modify [MANUAL] section content
|
|
17
|
+
- Write merged SKILL.md (and stack reference files) directly to disk at section 6b — Claude Code's Edit/Write tools commit on call, so there is no held-in-memory "edit plan" primitive; subsequent steps validate and verify against the on-disk files
|
|
18
|
+
- If [MANUAL] conflicts detected: halt and present to user. If clean merge: auto-proceed
|
|
55
19
|
|
|
56
20
|
## MANDATORY SEQUENCE
|
|
57
21
|
|
|
@@ -101,12 +65,37 @@ Follow the merge priority order from {mergeConflictRulesFile}:
|
|
|
101
65
|
- No conflicts expected (new content, no existing [MANUAL])
|
|
102
66
|
|
|
103
67
|
**Priority 6 — Process script/asset file changes (from Category D in change manifest):**
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
-
|
|
108
|
-
-
|
|
109
|
-
-
|
|
68
|
+
|
|
69
|
+
Category D operates on every `file_entries[]` row regardless of `file_type`. Handle each entry by its type:
|
|
70
|
+
|
|
71
|
+
- **`file_type: "script"` or `file_type: "asset"`:**
|
|
72
|
+
- MODIFIED_FILE: queue file for re-copy from source, update `file_entries` content_hash
|
|
73
|
+
- DELETED_FILE: queue file for removal from `scripts/` or `assets/`, remove from `file_entries`
|
|
74
|
+
- NEW_FILE: queue file for copy from source, add to `file_entries`
|
|
75
|
+
- Files in `scripts/[MANUAL]/` or `assets/[MANUAL]/` are never modified (user-authored)
|
|
76
|
+
- Update Section 7b manifest table to reflect changes
|
|
77
|
+
- Update `metadata.json` `scripts[]`/`assets[]` arrays and `stats.scripts_count`/`stats.assets_count`
|
|
78
|
+
|
|
79
|
+
- **`file_type: "doc"`** (authoritative docs promoted by §2a/§1b):
|
|
80
|
+
- MODIFIED_FILE: update `file_entries` content_hash only. **Do NOT copy the file** — doc-type entries are source-tracked but not bundled. Record the drift in the update report.
|
|
81
|
+
- DELETED_FILE: remove from `file_entries`. **Do NOT remove any file from the skill package** (there was nothing copied). Record the removal in the update report — a deleted authoritative doc is a meaningful upstream signal.
|
|
82
|
+
- NEW_FILE: this path is not used for doc type — new doc entries come from Priority 7 below, not from Category D. If Category D reports NEW_FILE with `file_type: "doc"`, log a warning and route to Priority 7.
|
|
83
|
+
|
|
84
|
+
**Priority 7 — Process new authoritative docs (from `promoted_docs_new[]` populated by §1b):**
|
|
85
|
+
|
|
86
|
+
For each entry in the in-context `promoted_docs_new[]` list:
|
|
87
|
+
|
|
88
|
+
- Add a new row to `file_entries[]` in the merged provenance map with:
|
|
89
|
+
- `file_name`: `"docs/authoritative/{source_path}"` (synthetic namespace — see skill-sections.md for convention)
|
|
90
|
+
- `file_type`: `"doc"`
|
|
91
|
+
- `source_file`: the path from `promoted_docs_new[].path`
|
|
92
|
+
- `content_hash`: the hash pre-computed by §1b
|
|
93
|
+
- `confidence`: `"T1-low"`
|
|
94
|
+
- `extraction_method`: `"promoted-authoritative"`
|
|
95
|
+
- Do NOT copy the file into the skill package (doc type is source-tracked, not bundled).
|
|
96
|
+
- Record in the update report: `"Added authoritative doc: {path} (heuristic: {basename})"`.
|
|
97
|
+
|
|
98
|
+
**If `promoted_docs_new[]` is empty:** skip Priority 7 silently. No report entry.
|
|
110
99
|
|
|
111
100
|
### 4. Check for Conflicts
|
|
112
101
|
|
|
@@ -169,6 +158,27 @@ Merge Results:
|
|
|
169
158
|
stack_files_merged: [count] (if stack skill)
|
|
170
159
|
```
|
|
171
160
|
|
|
161
|
+
### 6b. Write Merged Files to Disk
|
|
162
|
+
|
|
163
|
+
Write the merged content produced by sections 3–5 directly to disk now. Later steps read from these files for validation and verification. The write must happen exactly once, here.
|
|
164
|
+
|
|
165
|
+
**Write SKILL.md:**
|
|
166
|
+
- Use the `Edit` or `Write` tool to write merged SKILL.md content to `{skill_package}/SKILL.md`
|
|
167
|
+
- Preserve UTF-8 encoding
|
|
168
|
+
- If the source version detected during step-03 differs from the previous metadata version, create the new `{skill_package}` directory (`{skill_group}/{new_version}/`) first and write there — the previous version's directory is preserved on disk. Update `{skill_package}` in context to point at the new path.
|
|
169
|
+
|
|
170
|
+
**Write stack reference files (if `skill_type == "stack"`):**
|
|
171
|
+
- For each affected file from section 5, use `Edit` or `Write` to write:
|
|
172
|
+
- `references/{library}.md` with merged per-library content
|
|
173
|
+
- `references/integrations/{pair}.md` with merged per-integration content
|
|
174
|
+
- Preserve [MANUAL] blocks exactly as captured in section 2.
|
|
175
|
+
|
|
176
|
+
**Do NOT write here:**
|
|
177
|
+
- `metadata.json`, `provenance-map.json`, `evidence-report.md` — derived from merge + validation output, written by step-06 sections 2–4
|
|
178
|
+
- `context-snippet.md` — regenerated from the on-disk SKILL.md + metadata.json by step-06 section 5
|
|
179
|
+
|
|
180
|
+
**Halt-on-tool-failure:** If any `Edit`/`Write` call errors (permission denied, disk full, path invalid, etc.), halt and report the failure — do not proceed to step-05 validation. The skill package may be in a partial state and will need manual recovery before re-running update-skill.
|
|
181
|
+
|
|
172
182
|
### 7. Display Merge Summary
|
|
173
183
|
|
|
174
184
|
"**Merge Complete:**
|
|
@@ -195,6 +205,7 @@ Display: "**Merge complete with conflict resolution. Select:** [C] Continue to V
|
|
|
195
205
|
#### EXECUTION RULES:
|
|
196
206
|
|
|
197
207
|
- ALWAYS halt and wait for user input after conflict resolution
|
|
208
|
+
- **GATE [default: C if clean merge]** — If `{headless_mode}` and merge is clean (no [MANUAL] conflicts): auto-proceed with [C] Continue, log: "headless: clean merge, auto-continue". If conflicts exist, HALT even in headless mode — conflicts require human judgment.
|
|
198
209
|
- ONLY proceed when user selects 'C'
|
|
199
210
|
|
|
200
211
|
**If clean merge (no conflicts):**
|
|
@@ -213,26 +224,3 @@ Display: "**Clean merge — proceeding to validation...**"
|
|
|
213
224
|
|
|
214
225
|
ONLY WHEN all merge operations are complete and any [MANUAL] conflicts have been resolved by the user will you load {nextStepFile} to begin validation.
|
|
215
226
|
|
|
216
|
-
---
|
|
217
|
-
|
|
218
|
-
## 🚨 SYSTEM SUCCESS/FAILURE METRICS
|
|
219
|
-
|
|
220
|
-
### ✅ SUCCESS:
|
|
221
|
-
|
|
222
|
-
- All [MANUAL] sections preserved with zero content loss
|
|
223
|
-
- Merge applied in correct priority order (delete → move → rename → modify → add)
|
|
224
|
-
- Every conflict presented to user for resolution (no auto-resolution of [MANUAL] conflicts)
|
|
225
|
-
- Stack skill files merged if applicable
|
|
226
|
-
- Merge results compiled with full accounting
|
|
227
|
-
- Clean merges auto-proceed; conflict merges require user [C]
|
|
228
|
-
|
|
229
|
-
### ❌ SYSTEM FAILURE:
|
|
230
|
-
|
|
231
|
-
- ANY [MANUAL] content lost or modified without user consent
|
|
232
|
-
- Auto-resolving [MANUAL] conflicts without user input
|
|
233
|
-
- Writing files during merge planning (edits are executed in step 06)
|
|
234
|
-
- Applying merge out of priority order
|
|
235
|
-
- Not detecting orphaned [MANUAL] blocks on deleted exports
|
|
236
|
-
- Not handling stack skill multi-file merge
|
|
237
|
-
|
|
238
|
-
**Master Rule:** Skipping steps, optimizing sequences, or not following exact instructions is FORBIDDEN and constitutes SYSTEM FAILURE.
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
---
|
|
2
|
-
name: 'step-05-validate'
|
|
3
|
-
description: 'Validate updated skill against spec, verify MANUAL integrity, and check confidence tier consistency'
|
|
4
|
-
|
|
5
2
|
nextStepFile: './step-06-write.md'
|
|
6
3
|
---
|
|
7
4
|
|
|
@@ -11,44 +8,11 @@ nextStepFile: './step-06-write.md'
|
|
|
11
8
|
|
|
12
9
|
Validate the merged skill content against the agentskills.io specification, verify all [MANUAL] sections survived the merge intact, and check confidence tier consistency across all re-extracted content. This is an advisory validation — findings are warnings, not blockers.
|
|
13
10
|
|
|
14
|
-
##
|
|
15
|
-
|
|
16
|
-
### Universal Rules:
|
|
17
|
-
|
|
18
|
-
- 🛑 NEVER generate content without user input
|
|
19
|
-
- 📖 CRITICAL: Read the complete step file before taking any action
|
|
20
|
-
- 🔄 CRITICAL: When loading next step with 'C', ensure entire file is read
|
|
21
|
-
- 📋 YOU ARE A FACILITATOR, not a content generator
|
|
22
|
-
- ⚙️ TOOL/SUBPROCESS FALLBACK: If any instruction references a subprocess, subagent, or tool you do not have access to, you MUST still achieve the outcome in your main context thread
|
|
23
|
-
- ✅ YOU MUST ALWAYS SPEAK OUTPUT in your Agent communication style with the config `{communication_language}`
|
|
24
|
-
|
|
25
|
-
### Role Reinforcement:
|
|
26
|
-
|
|
27
|
-
- ✅ You are a precision code analyst operating in Surgeon mode
|
|
28
|
-
- ✅ Validation is advisory — flag issues but do not block the workflow
|
|
29
|
-
- ✅ Every finding must include specific file:line reference
|
|
30
|
-
- ✅ Zero-hallucination principle applies to validation findings too
|
|
31
|
-
|
|
32
|
-
### Step-Specific Rules:
|
|
33
|
-
|
|
34
|
-
- 🎯 Focus ONLY on validation — do not fix issues (that's the user's choice)
|
|
35
|
-
- 🚫 FORBIDDEN to modify merged content — validation is read-only
|
|
36
|
-
- 💬 Launch parallel validation checks when subprocess available (Pattern 4): In Claude Code, use multiple parallel Agent tool calls. In Cursor, use parallel requests (IDE-dependent). In CLI, use `xargs -P`. See [knowledge/tool-resolution.md](../../../knowledge/tool-resolution.md)
|
|
37
|
-
- ⚙️ If subprocess unavailable, perform checks sequentially in main thread
|
|
38
|
-
|
|
39
|
-
## EXECUTION PROTOCOLS:
|
|
40
|
-
|
|
41
|
-
- 🎯 Follow MANDATORY SEQUENCE exactly
|
|
42
|
-
- 💾 Compile validation findings with severity levels
|
|
43
|
-
- 📖 Track pass/fail for each validation category
|
|
44
|
-
- 🚫 Validation is ADVISORY — do not block on warnings
|
|
11
|
+
## Rules
|
|
45
12
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
-
|
|
49
|
-
- Focus: quality assurance — spec compliance, [MANUAL] integrity, confidence consistency
|
|
50
|
-
- Limits: read-only — do not modify merged content
|
|
51
|
-
- Dependencies: step 04 must have completed merge (with or without conflict resolution)
|
|
13
|
+
- Focus only on validation — do not fix issues (that's the user's choice)
|
|
14
|
+
- Validation is read-only — do not modify merged content
|
|
15
|
+
- Use parallel validation checks (Pattern 4) when available; if unavailable, check sequentially
|
|
52
16
|
|
|
53
17
|
## MANDATORY SEQUENCE
|
|
54
18
|
|
|
@@ -63,7 +27,7 @@ Run: `npx skill-check -h`
|
|
|
63
27
|
|
|
64
28
|
**Important:** Do not assume availability — empirical check required.
|
|
65
29
|
|
|
66
|
-
**Validation timing note:** Step-04
|
|
30
|
+
**Validation timing note:** Step-04 section 6b has already written SKILL.md (and stack reference files) to disk. External-tool checks against written files (skill-check Checks A, E, F) still run in **step-06 section 7** to co-locate external-tool validation with post-write verification. Structural checks (B, C, D) run here against the merged content — content on disk is byte-identical to the in-context copy.
|
|
67
31
|
|
|
68
32
|
### 2. Launch Parallel Validation Checks
|
|
69
33
|
|
|
@@ -156,24 +120,3 @@ After validation summary is displayed, immediately load, read entire file, then
|
|
|
156
120
|
|
|
157
121
|
ONLY WHEN all validation checks have completed and findings are displayed will you load {nextStepFile} to write the updated files. Validation does NOT block — it informs.
|
|
158
122
|
|
|
159
|
-
---
|
|
160
|
-
|
|
161
|
-
## 🚨 SYSTEM SUCCESS/FAILURE METRICS
|
|
162
|
-
|
|
163
|
-
### ✅ SUCCESS:
|
|
164
|
-
|
|
165
|
-
- All six checks executed (spec-manual, [MANUAL], confidence, provenance, diff, security)
|
|
166
|
-
- Checks A (spec compliance via skill-check), E (diff), and F (security scan) deferred to post-write in step-06
|
|
167
|
-
- Manual structural check performed for spec compliance in this step
|
|
168
|
-
- Stack skill reference files validated if applicable
|
|
169
|
-
- Findings reported with severity and specific locations; [MANUAL] integrity verified
|
|
170
|
-
- Auto-proceeds regardless of findings (advisory mode)
|
|
171
|
-
|
|
172
|
-
### ❌ SYSTEM FAILURE:
|
|
173
|
-
|
|
174
|
-
- Skipping any of the six checks; blocking on validation warnings
|
|
175
|
-
- Not verifying [MANUAL] integrity; hallucinating findings not backed by comparison
|
|
176
|
-
- Modifying merged content during validation (validation is read-only in this step)
|
|
177
|
-
- Not recording quality score when skill-check is available
|
|
178
|
-
|
|
179
|
-
**Master Rule:** Skipping steps, optimizing sequences, or not following exact instructions is FORBIDDEN and constitutes SYSTEM FAILURE.
|