@planu/cli 5.7.4 → 5.7.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (208) hide show
  1. package/CHANGELOG.md +85 -0
  2. package/README.md +3 -3
  3. package/dist/.planu-build.json +1 -1
  4. package/dist/cli/commands/package-handoff.js +30 -5
  5. package/dist/config/compliance-profiles.json +36 -3
  6. package/dist/config/environment-schema.json +21 -0
  7. package/dist/config/hook-templates/planu-session-safeguard.sh +22 -15
  8. package/dist/config/official-sdd-tools.d.ts +1 -1
  9. package/dist/config/official-sdd-tools.js +11 -24
  10. package/dist/config/registries/hosts/codex.json +14 -30
  11. package/dist/config/registries/hosts/opencode.json +1 -6
  12. package/dist/config/registries/legacy-guidance.json +26 -0
  13. package/dist/config/server-instructions.js +0 -21
  14. package/dist/config/skill-templates/planu-context-assets.md +3 -6
  15. package/dist/config/skill-templates/planu-implement.md +2 -2
  16. package/dist/config/skill-templates/planu-multi-teammate-review.md +1 -1
  17. package/dist/config/skill-templates/planu-release.md +2 -7
  18. package/dist/config/skill-templates/planu-validate.md +3 -3
  19. package/dist/config/spec-templates/crud-rest-api/template.json +5 -1
  20. package/dist/config/spec-templates/file-upload-s3/template.json +5 -1
  21. package/dist/config/spec-templates/stripe-payments/template.json +5 -1
  22. package/dist/config/spec-templates/webhook-system/template.json +5 -1
  23. package/dist/config/subagent-templates/planu-challenger.md +4 -9
  24. package/dist/config/subagent-templates/planu-spec-implementer.md +2 -4
  25. package/dist/config/subagent-templates/planu-validator.md +5 -8
  26. package/dist/config/tool-groups.json +6 -144
  27. package/dist/engine/ambiguity-scorer.js +40 -1
  28. package/dist/engine/autopilot/bootstrap.js +1 -1
  29. package/dist/engine/code-impact-analyzer.js +2 -6
  30. package/dist/engine/context-orchestrator/index.js +2 -2
  31. package/dist/engine/convention-scanner/codebase-scanner.js +2 -2
  32. package/dist/engine/dogfooding/runtime-gap-detector.js +2 -2
  33. package/dist/engine/evidence-gates/artifact-reader.d.ts +1 -0
  34. package/dist/engine/evidence-gates/artifact-reader.js +1 -1
  35. package/dist/engine/evidence-gates/evidence-autofill.d.ts +13 -5
  36. package/dist/engine/evidence-gates/evidence-autofill.js +106 -43
  37. package/dist/engine/evidence-gates/lifecycle-gate.js +7 -4
  38. package/dist/engine/evidence-index/index-builder.js +21 -4
  39. package/dist/engine/execution/job-runtime.js +1 -1
  40. package/dist/engine/execution/package-handoff-job-executor.d.ts +22 -0
  41. package/dist/engine/execution/package-handoff-job-executor.js +490 -0
  42. package/dist/engine/execution/validate-job-executor.js +20 -8
  43. package/dist/engine/git/exec-git.d.ts +4 -0
  44. package/dist/engine/git/exec-git.js +14 -0
  45. package/dist/engine/handoff-artifacts/implementation-review-reader.js +15 -2
  46. package/dist/engine/handoff-artifacts/schemas.d.ts +2 -0
  47. package/dist/engine/handoff-artifacts/schemas.js +1 -0
  48. package/dist/engine/handoff-format.d.ts +36 -0
  49. package/dist/engine/handoff-format.js +314 -0
  50. package/dist/engine/handoff-packager.d.ts +5 -3
  51. package/dist/engine/handoff-packager.js +89 -32
  52. package/dist/engine/host-tool-filter.js +20 -49
  53. package/dist/engine/human-summary.js +14 -3
  54. package/dist/engine/implementation-contract/common.d.ts +8 -3
  55. package/dist/engine/implementation-contract/common.js +9 -6
  56. package/dist/engine/implementation-contract/evaluator.js +4 -6
  57. package/dist/engine/implementation-contract/renderer.js +18 -23
  58. package/dist/engine/project-health-checker.js +2 -2
  59. package/dist/engine/readiness-checker.js +27 -0
  60. package/dist/engine/reconcile/apply-changes.js +4 -0
  61. package/dist/engine/reconcile/propagate-mirrors.d.ts +3 -0
  62. package/dist/engine/reconcile/propagate-mirrors.js +311 -0
  63. package/dist/engine/self-healing/healer.js +12 -5
  64. package/dist/engine/self-healing/strategies/lint-fix.d.ts +1 -1
  65. package/dist/engine/self-healing/strategies/lint-fix.js +4 -1
  66. package/dist/engine/self-healing/strategies/test-fix.d.ts +4 -3
  67. package/dist/engine/self-healing/strategies/test-fix.js +32 -14
  68. package/dist/engine/self-healing/strategies/typescript-fix.d.ts +1 -1
  69. package/dist/engine/self-healing/strategies/typescript-fix.js +28 -10
  70. package/dist/engine/session/checkpoint-writer.js +8 -4
  71. package/dist/engine/session/session-tracker.d.ts +5 -16
  72. package/dist/engine/session/session-tracker.js +29 -26
  73. package/dist/engine/session-state/writer.js +3 -11
  74. package/dist/engine/skill-generator/workflow-skill-generator.d.ts +4 -2
  75. package/dist/engine/skill-generator/workflow-skill-generator.js +113 -38
  76. package/dist/engine/spec-format/bdd-parser.d.ts +1 -11
  77. package/dist/engine/spec-format/bdd-parser.js +40 -11
  78. package/dist/engine/spec-format/lean-spec-generator.js +30 -10
  79. package/dist/engine/spec-format/retired-scaffold.d.ts +3 -0
  80. package/dist/engine/spec-format/retired-scaffold.js +5 -0
  81. package/dist/engine/spec-format/technical-md-populator.d.ts +1 -0
  82. package/dist/engine/spec-format/technical-md-populator.js +27 -0
  83. package/dist/engine/spec-format/unified-spec-builder.d.ts +1 -0
  84. package/dist/engine/spec-format/unified-spec-builder.js +30 -20
  85. package/dist/engine/spec-grounding/contract.js +115 -1
  86. package/dist/engine/spec-migrator/fold-technical.js +60 -19
  87. package/dist/engine/spec-migrator/placeholder-technical.d.ts +2 -0
  88. package/dist/engine/spec-migrator/placeholder-technical.js +18 -0
  89. package/dist/engine/spec-quality/generic-output-gate.js +37 -3
  90. package/dist/engine/technical-enricher/index.js +4 -1
  91. package/dist/engine/type-safety-gate.js +3 -11
  92. package/dist/engine/universal-rules/catalog.js +0 -2
  93. package/dist/engine/universal-rules/rules/planu-workflow.js +1 -1
  94. package/dist/engine/validation/durable-validation.d.ts +3 -2
  95. package/dist/engine/validation/durable-validation.js +106 -40
  96. package/dist/engine/validation/validation-freshness.d.ts +3 -2
  97. package/dist/engine/validation/validation-freshness.js +22 -16
  98. package/dist/engine/validation/validation-worktree.js +34 -0
  99. package/dist/hosts/claude-code/ux/mcp-prompts.js +8 -8
  100. package/dist/index.js +3 -17
  101. package/dist/resources/process.js +38 -65
  102. package/dist/storage/session-state-store.js +2 -0
  103. package/dist/tools/challenge-spec/scenarios-utils.js +2 -2
  104. package/dist/tools/configure-checkpoint-policy.js +3 -3
  105. package/dist/tools/create-spec-helpers.js +2 -5
  106. package/dist/tools/create-spec.js +21 -4
  107. package/dist/tools/facilitate.js +3 -6
  108. package/dist/tools/git/branch-ops.js +16 -4
  109. package/dist/tools/github-release-handler.js +1 -20
  110. package/dist/tools/heal-spec-docs.js +1 -13
  111. package/dist/tools/init-project/agents-md-writer.js +6 -6
  112. package/dist/tools/init-project/claude-md-generator.d.ts +0 -1
  113. package/dist/tools/init-project/claude-md-generator.js +0 -35
  114. package/dist/tools/init-project/handler.js +24 -49
  115. package/dist/tools/init-project/legacy-guidance-scanner.d.ts +12 -0
  116. package/dist/tools/init-project/legacy-guidance-scanner.js +176 -0
  117. package/dist/tools/init-project/per-client-files-writer.js +5 -5
  118. package/dist/tools/init-project/planu-workflow-generator.js +2 -13
  119. package/dist/tools/init-project/portable-index-reconciler.d.ts +21 -1
  120. package/dist/tools/init-project/portable-index-reconciler.js +66 -0
  121. package/dist/tools/init-project/rules-generator.d.ts +0 -11
  122. package/dist/tools/init-project/rules-generator.js +4 -85
  123. package/dist/tools/init-project/scaffold-writer.d.ts +0 -1
  124. package/dist/tools/init-project/scaffold-writer.js +1 -12
  125. package/dist/tools/jobs/handlers.d.ts +0 -6
  126. package/dist/tools/jobs/handlers.js +13 -40
  127. package/dist/tools/list-specs.js +6 -21
  128. package/dist/tools/package-handoff.d.ts +3 -2
  129. package/dist/tools/package-handoff.js +153 -427
  130. package/dist/tools/reconcile-session-safeguard-hook.js +22 -15
  131. package/dist/tools/register-sdd-tools.js +0 -23
  132. package/dist/tools/register-spec-tools/core-spec-tools.js +18 -27
  133. package/dist/tools/schemas/index.d.ts +1 -1
  134. package/dist/tools/schemas/index.js +1 -1
  135. package/dist/tools/schemas/output-schemas.d.ts +1 -18
  136. package/dist/tools/schemas/output-schemas.js +1 -11
  137. package/dist/tools/schemas/package-handoff-output-schema.d.ts +40 -0
  138. package/dist/tools/schemas/package-handoff-output-schema.js +68 -0
  139. package/dist/tools/schemas/validate-output-schema.d.ts +1 -2
  140. package/dist/tools/schemas/validate-output-schema.js +3 -2
  141. package/dist/tools/session-checkpoint.js +2 -2
  142. package/dist/tools/skill-registry/index.d.ts +0 -1
  143. package/dist/tools/skill-registry/index.js +0 -1
  144. package/dist/tools/sync-spec-state-handler.d.ts +2 -2
  145. package/dist/tools/sync-spec-state-handler.js +23 -3
  146. package/dist/tools/tool-registry/core-tools.js +1 -140
  147. package/dist/tools/tool-registry/group-infra.js +2 -39
  148. package/dist/tools/tool-registry/group-quality-compliance.js +9 -1
  149. package/dist/tools/update-status/batch.js +17 -0
  150. package/dist/tools/update-status/dod-gates.js +14 -1
  151. package/dist/tools/update-status/done-receipt-verifier.d.ts +22 -0
  152. package/dist/tools/update-status/done-receipt-verifier.js +56 -26
  153. package/dist/tools/update-status/evidence-gate.js +10 -21
  154. package/dist/tools/update-status/file-sync.d.ts +1 -0
  155. package/dist/tools/update-status/file-sync.js +6 -0
  156. package/dist/tools/update-status/index.d.ts +6 -0
  157. package/dist/tools/update-status/index.js +39 -44
  158. package/dist/tools/update-status-actions.js +2 -7
  159. package/dist/tools/validate.js +34 -28
  160. package/dist/transports/oauth-validator.js +12 -1
  161. package/dist/transports/transport-factory.d.ts +2 -1
  162. package/dist/transports/transport-factory.js +19 -0
  163. package/dist/types/common/primitives.d.ts +2 -0
  164. package/dist/types/durable-job.d.ts +45 -0
  165. package/dist/types/durable-validation.d.ts +1 -1
  166. package/dist/types/evidence-autofill.d.ts +13 -1
  167. package/dist/types/handoff-artifacts.d.ts +2 -1
  168. package/dist/types/index.d.ts +1 -0
  169. package/dist/types/index.js +1 -0
  170. package/dist/types/legacy-guidance.d.ts +20 -0
  171. package/dist/types/legacy-guidance.js +3 -0
  172. package/dist/types/readiness.d.ts +8 -1
  173. package/dist/types/reconcile.d.ts +6 -0
  174. package/dist/types/skill-registry.d.ts +26 -1
  175. package/dist/types/spec/core.d.ts +5 -0
  176. package/dist/types/spec/inputs.d.ts +2 -2
  177. package/dist/types/spec-format.d.ts +11 -1
  178. package/dist/types/spec-grounding.d.ts +12 -0
  179. package/dist/types/ssr-migration.d.ts +1 -1
  180. package/dist/types/transport.d.ts +1 -0
  181. package/dist/types/validation-receipt.d.ts +27 -0
  182. package/package.json +3 -2
  183. package/planu-plugin.json +13 -26
  184. package/src/i18n/messages/en.json +1 -1
  185. package/src/i18n/messages/es.json +1 -1
  186. package/src/i18n/messages/pt.json +1 -1
  187. package/dist/engine/skill-generator/conventions-hasher.d.ts +0 -7
  188. package/dist/engine/skill-generator/conventions-hasher.js +0 -24
  189. package/dist/engine/universal-rules/rules/agent-teams.d.ts +0 -3
  190. package/dist/engine/universal-rules/rules/agent-teams.js +0 -63
  191. package/dist/tools/clarify-requirements/multiple-choice.d.ts +0 -30
  192. package/dist/tools/clarify-requirements/multiple-choice.js +0 -306
  193. package/dist/tools/clarify-requirements/questions-context.d.ts +0 -9
  194. package/dist/tools/clarify-requirements/questions-context.js +0 -74
  195. package/dist/tools/clarify-requirements/questions.d.ts +0 -16
  196. package/dist/tools/clarify-requirements/questions.js +0 -96
  197. package/dist/tools/clarify-requirements.d.ts +0 -4
  198. package/dist/tools/clarify-requirements.js +0 -314
  199. package/dist/tools/code-graph-handler.d.ts +0 -6
  200. package/dist/tools/code-graph-handler.js +0 -72
  201. package/dist/tools/create-rule.d.ts +0 -4
  202. package/dist/tools/create-rule.js +0 -107
  203. package/dist/tools/feedback-handler.d.ts +0 -7
  204. package/dist/tools/feedback-handler.js +0 -150
  205. package/dist/tools/semantic-search-handler.d.ts +0 -7
  206. package/dist/tools/semantic-search-handler.js +0 -71
  207. package/dist/tools/skill-registry/search.d.ts +0 -11
  208. package/dist/tools/skill-registry/search.js +0 -159
@@ -4,7 +4,11 @@
4
4
  "variables": [
5
5
  { "name": "max_retries", "description": "Maximum delivery retry attempts", "default": "3" },
6
6
  { "name": "timeout_seconds", "description": "HTTP request timeout per delivery attempt", "default": "10" },
7
- { "name": "signature_header", "description": "HTTP header name for HMAC signature", "default": "X-Webhook-Signature" }
7
+ {
8
+ "name": "signature_header",
9
+ "description": "HTTP header name for HMAC signature",
10
+ "default": "X-Webhook-Signature"
11
+ }
8
12
  ],
9
13
  "tags": ["webhooks", "events", "backend", "integrations"]
10
14
  }
@@ -5,10 +5,7 @@ tools:
5
5
  - Read
6
6
  - mcp__planu__challenge_spec
7
7
  - mcp__planu__list_specs
8
- - mcp__planu__suggest_criteria
9
- - mcp__planu__red_team
10
- - mcp__planu__ears_lint
11
- - mcp__planu__validate_criteria_quality
8
+ - mcp__planu__check_readiness
12
9
  ---
13
10
 
14
11
  # Planu Challenger
@@ -25,11 +22,9 @@ You are a adversarial spec reviewer. Your job is to find every weakness in a spe
25
22
 
26
23
  1. **Load spec** — call `list_specs` to find the spec. Read `spec.md` fully.
27
24
  2. **Run challenge** — call `challenge_spec({ specId })`. Read all findings.
28
- 3. **EARS lint** — call `ears_lint({ specId })` to check criteria format quality.
29
- 4. **Criteria quality** — call `validate_criteria_quality({ specId })` for testability gaps.
30
- 5. **Red team** — call `red_team({ specId })` for adversarial scenarios.
31
- 6. **Synthesize** — group findings by severity: blocking gaps, missing edge cases, ambiguous wording, implementation risks.
32
- 7. **Suggest fixes** — for each finding, propose a concrete criterion rewrite or addition.
25
+ 3. **Check readiness** — call `check_readiness({ specId })` to verify the spec has enough detail to implement.
26
+ 4. **Synthesize** — group findings by severity: blocking gaps, missing edge cases, ambiguous wording, implementation risks.
27
+ 5. **Suggest fixes** — for each finding, propose a concrete criterion rewrite or addition.
33
28
 
34
29
  ## Output format
35
30
 
@@ -12,9 +12,7 @@ tools:
12
12
  - mcp__planu__update_status
13
13
  - mcp__planu__validate
14
14
  - mcp__planu__get_job
15
- - mcp__planu__watch_job
16
15
  - mcp__planu__check_readiness
17
- - mcp__planu__tdd_scaffold
18
16
  ---
19
17
 
20
18
  # Planu Spec Implementer
@@ -32,11 +30,11 @@ You are an autonomous implementation agent for Spec Driven Development. Your job
32
30
  2. **Verify approval** — confirm spec status is `approved`. If not, call `check_readiness` and stop with a note.
33
31
  3. **Update status to `implementing`** — call `update_status({ specId, status: "implementing" })`.
34
32
  4. **Create a feature branch** — `git checkout -b feat/SPEC-NNN-slug`.
35
- 5. **Scaffold TDD tests** — call `tdd_scaffold` to generate test stubs from acceptance criteria.
33
+ 5. **Write TDD tests** — write failing test stubs mirroring `src/` in `tests/`, one per acceptance criterion.
36
34
  6. **Implement** — write all source files in dependency order: types → engine → storage → tools/resources. Follow Clean Architecture (types layer imports nothing; tools import engine+storage+types).
37
35
  7. **Run tests** — `pnpm typecheck && pnpm lint && pnpm test:coverage`. Fix all failures.
38
36
  8. **Submit validation** — call `validate({ specId })` and capture `operationId`, `projectId`, `workspaceId`, and `cursor` from the durable acknowledgement.
39
- 9. **Await and inspect** — call `watch_job` with those identifiers and the latest cursor until terminal. Require `completed`, then inspect `job.result.structuredContent`. Stop on `failed`, `dead-letter`, or `cancelled`; fix failures and submit a new validation job.
37
+ 9. **Await and inspect** — poll `get_job` with those identifiers and the latest cursor until terminal. Require `completed`, then inspect `job.result.structuredContent`. Stop on `failed`, `dead-letter`, or `cancelled`; fix failures and submit a new validation job.
40
38
  10. **Commit** — only after the completed validation result reports `ready: true`, `status: "passing"`, and passing quality gates, run `git add <files> && git commit -m "feat(SPEC-NNN): <title>"`.
41
39
  11. **Update status to `done`** — call `update_status({ specId, status: "done" })` only after that completed passing result.
42
40
 
@@ -8,11 +8,9 @@ tools:
8
8
  - Grep
9
9
  - mcp__planu__validate
10
10
  - mcp__planu__get_job
11
- - mcp__planu__watch_job
12
11
  - mcp__planu__list_specs
13
- - mcp__planu__spec_health_check
14
12
  - mcp__planu__check_readiness
15
- - mcp__planu__auto_fix_validation
13
+ - mcp__planu__restart_job
16
14
  ---
17
15
 
18
16
  # Planu Validator
@@ -29,15 +27,14 @@ You are a validation specialist. Your job is to verify that implemented code sat
29
27
 
30
28
  1. **Load spec** — call `list_specs` and read `spec.md` for all acceptance criteria.
31
29
  2. **Submit validation** — call `validate({ specId })` and capture `operationId`, `projectId`, `workspaceId`, and `cursor` from the durable acknowledgement.
32
- 3. **Wait for the terminal result** — call `watch_job` with those identifiers and the latest cursor. Repeat while state is `accepted`, `running`, or `checkpointed`. Require `completed`; stop and report `failed`, `dead-letter`, or `cancelled`.
30
+ 3. **Wait for the terminal result** — poll `get_job` with those identifiers and the latest cursor. Repeat while state is `accepted`, `running`, or `checkpointed`. Require `completed`; stop and report `failed`, `dead-letter`, or `cancelled`.
33
31
  4. **Read the validation result** — inspect `job.result.structuredContent`. The acknowledgement is not a pass/fail result.
34
- 5. **Run health check** — call `spec_health_check({ specId })` for structural issues.
35
- 6. **Assess gaps** — for each failing criterion:
32
+ 5. **Assess gaps** — for each failing criterion:
36
33
  - Identify which source files are responsible
37
34
  - Diagnose the root cause (missing logic, wrong condition, untested branch)
38
35
  - Propose a minimal fix
39
- 7. **Auto-fix when safe** — call `auto_fix_validation` for fixable issues, then submit and await a new validation job.
40
- 8. **Report** — provide a summary with: passing count, failing count, and concrete next steps for each failure.
36
+ 6. **Fix and re-validate** — fix the underlying code or test, then call `validate({ specId })` again and poll `get_job` until terminal; use `restart_job` if the job itself failed or was cancelled rather than the criteria.
37
+ 7. **Report** — provide a summary with: passing count, failing count, and concrete next steps for each failure.
41
38
 
42
39
  ## Output format
43
40
 
@@ -3,22 +3,8 @@
3
3
  {
4
4
  "id": "core",
5
5
  "name": "Core",
6
- "description": "The 9 Tier 1 tools every new user needs: project setup, spec creation, lifecycle management, and status.",
7
- "tools": [
8
- "facilitate",
9
- "init_project",
10
- "create_spec",
11
- "list_specs",
12
- "update_status",
13
- "validate",
14
- "planu_status",
15
- "capture_idea",
16
- "quick_start",
17
- "set_locale",
18
- "init_constitution",
19
- "activate_group",
20
- "list_groups"
21
- ],
6
+ "description": "The Tier 1 tools every new user needs: project setup, spec creation, lifecycle management, and status.",
7
+ "tools": ["facilitate", "init_project", "create_spec", "list_specs", "update_status", "validate", "planu_status"],
22
8
  "defaultEnabled": true,
23
9
  "locked": true
24
10
  },
@@ -26,143 +12,19 @@
26
12
  "id": "spec-lifecycle",
27
13
  "name": "Spec Lifecycle",
28
14
  "description": "Create, validate, estimate, and manage specs through their full lifecycle.",
29
- "tools": [
30
- "estimate",
31
- "request_changes",
32
- "challenge_spec",
33
- "check_readiness",
34
- "clarify_requirements",
35
- "summarize_spec",
36
- "reconcile_spec",
37
- "reconcile_hooks",
38
- "reconcile_rules",
39
- "reconcile_skills",
40
- "config_health",
41
- "list_templates",
42
- "apply_template",
43
- "spec_history",
44
- "log_decision"
45
- ],
15
+ "tools": ["estimate", "request_changes", "challenge_spec", "check_readiness", "reconcile_spec"],
46
16
  "defaultEnabled": true,
47
17
  "locked": false,
48
18
  "triggerTools": ["estimate", "challenge_spec", "check_readiness"]
49
19
  },
50
- {
51
- "id": "analysis",
52
- "name": "Analysis",
53
- "description": "Audit, drift detection, contradiction checks, and deep code analysis.",
54
- "tools": [
55
- "audit",
56
- "audit_stack",
57
- "detect_drift",
58
- "detect_contradictions",
59
- "detect_deprecations",
60
- "detect_agent",
61
- "reality_check",
62
- "check_spec_accuracy",
63
- "paradigm_report",
64
- "spec_coverage",
65
- "validate_annotations",
66
- "generate_annotations",
67
- "snapshot_spec_hashes",
68
- "auto_reconcile",
69
- "living_spec_watch",
70
- "living_spec_status",
71
- "spec_diff",
72
- "living_spec_coverage",
73
- "sync_spec_to_code",
74
- "sync_code_to_spec",
75
- "resolve_sync_conflict"
76
- ],
77
- "defaultEnabled": false,
78
- "locked": false,
79
- "triggerTools": ["audit", "detect_drift", "reality_check"]
80
- },
81
- {
82
- "id": "generation",
83
- "name": "Generation",
84
- "description": "Generate docs, tests, schemas, UI contracts, skills, rules, and ADRs.",
85
- "tools": [
86
- "generate_docs",
87
- "generate_tests",
88
- "design_schema",
89
- "define_ui_contract",
90
- "generate_adr",
91
- "generate_checklist",
92
- "generate_rules",
93
- "generate_skill",
94
- "generate_sub_agent",
95
- "consult_docs",
96
- "event_contracts"
97
- ],
98
- "defaultEnabled": false,
99
- "locked": false,
100
- "triggerTools": ["generate_docs", "generate_tests", "design_schema"]
101
- },
102
20
  {
103
21
  "id": "orchestration",
104
22
  "name": "Orchestration",
105
- "description": "Multi-agent orchestration, execution plans, handoff packages, and AI cost estimation.",
106
- "tools": [
107
- "orchestrate",
108
- "orchestrate_agents",
109
- "package_handoff",
110
- "generate_execution_plan",
111
- "generate_orchestration_script",
112
- "estimate_ai_cost",
113
- "integrate_pm"
114
- ],
115
- "defaultEnabled": false,
116
- "locked": false,
117
- "triggerTools": ["orchestrate", "orchestrate_agents", "generate_execution_plan"]
118
- },
119
- {
120
- "id": "devops",
121
- "name": "DevOps",
122
- "description": "Git management, tooling suggestions, CI generation, upgrades, and stack recommendations.",
123
- "tools": [
124
- "manage_git",
125
- "suggest_tooling",
126
- "suggest_stack",
127
- "suggest_mcps",
128
- "suggest_mcp_server",
129
- "plan_upgrade",
130
- "check_versions",
131
- "check_config_health",
132
- "generate_ci",
133
- "discover_mcps",
134
- "validate_workflow"
135
- ],
136
- "defaultEnabled": false,
137
- "locked": false,
138
- "triggerTools": ["manage_git", "suggest_tooling", "generate_ci"]
139
- },
140
- {
141
- "id": "governance",
142
- "name": "Governance",
143
- "description": "Security checks, data governance, scope management, and context control.",
144
- "tools": [
145
- "security_check",
146
- "data_governance",
147
- "legal_compliance_report",
148
- "manage_scope",
149
- "manage_context",
150
- "context_budget",
151
- "request_context",
152
- "contribute_context"
153
- ],
154
- "defaultEnabled": false,
155
- "locked": false,
156
- "triggerTools": ["security_check", "data_governance", "manage_scope"]
157
- },
158
- {
159
- "id": "learning",
160
- "name": "Learning",
161
- "description": "Pattern learning, knowledge capture, reverse engineering, and migration.",
162
- "tools": ["learn_pattern", "capture_learning", "reverse_engineer", "migrate_tech", "manage_hooks"],
23
+ "description": "Handoff packages for implementation agents.",
24
+ "tools": ["package_handoff"],
163
25
  "defaultEnabled": false,
164
26
  "locked": false,
165
- "triggerTools": ["learn_pattern", "capture_learning", "reverse_engineer"]
27
+ "triggerTools": ["package_handoff"]
166
28
  }
167
29
  ]
168
30
  }
@@ -40,6 +40,44 @@ function buildSuggestion(term, criterion) {
40
40
  const clean = criterion.slice(0, 80);
41
41
  return `Replace "${term}" with a concrete measurable value, e.g.: "${clean.replace(new RegExp(`\\b${term}\\b`, 'gi'), `<${term}_value>`)}"`;
42
42
  }
43
+ const ENUM_LITERAL_TOKEN = /^[A-Za-z0-9_.-]+$/;
44
+ const NON_WORD_MASK_CHAR = '#';
45
+ function maskSpan(span) {
46
+ return span.replace(/\S/g, NON_WORD_MASK_CHAR);
47
+ }
48
+ function maskLiteralSpans(line) {
49
+ let masked = '';
50
+ let cursor = 0;
51
+ while (cursor < line.length) {
52
+ const char = line.charAt(cursor);
53
+ if (char === '`') {
54
+ const closeIndex = line.indexOf('`', cursor + 1);
55
+ if (closeIndex === -1) {
56
+ masked += line.slice(cursor);
57
+ break;
58
+ }
59
+ masked += maskSpan(line.slice(cursor, closeIndex + 1));
60
+ cursor = closeIndex + 1;
61
+ continue;
62
+ }
63
+ if (char === '"') {
64
+ const closeIndex = line.indexOf('"', cursor + 1);
65
+ if (closeIndex === -1) {
66
+ masked += line.slice(cursor);
67
+ break;
68
+ }
69
+ const content = line.slice(cursor + 1, closeIndex);
70
+ masked += ENUM_LITERAL_TOKEN.test(content)
71
+ ? maskSpan(line.slice(cursor, closeIndex + 1))
72
+ : line.slice(cursor, closeIndex + 1);
73
+ cursor = closeIndex + 1;
74
+ continue;
75
+ }
76
+ masked += char;
77
+ cursor += 1;
78
+ }
79
+ return masked;
80
+ }
43
81
  function hasAdjacentNumber(line, term) {
44
82
  // Check if a number appears within 4 words of the vague term
45
83
  const words = line.toLowerCase().split(/\s+/);
@@ -63,10 +101,11 @@ export function scoreAmbiguity(criteriaLines) {
63
101
  continue;
64
102
  }
65
103
  const lower = line.toLowerCase();
104
+ const maskedLower = maskLiteralSpans(line).toLowerCase();
66
105
  // Check vague units (skip if adjacent number is present)
67
106
  for (const [term, reason] of Object.entries(VAGUE_UNITS)) {
68
107
  const pattern = new RegExp(`\\b${term}\\b`);
69
- if (pattern.test(lower) && !hasAdjacentNumber(lower, term)) {
108
+ if (pattern.test(maskedLower) && !hasAdjacentNumber(maskedLower, term)) {
70
109
  violations.push({
71
110
  term,
72
111
  criterion: line.slice(0, 120),
@@ -106,7 +106,7 @@ function registerPluginInstalledListener() {
106
106
  /**
107
107
  * SPEC-1345 AC4: Fire-and-forget semantic index refresh on spec:created.
108
108
  * Reconciles the persisted TF-IDF index against the current corpus so the next
109
- * semantic_search call hits a warm, up-to-date index.
109
+ * internal pattern-learning lookup hits a warm, up-to-date index.
110
110
  */
111
111
  function registerSemanticIndexRefreshListener() {
112
112
  onAutopilotEvent('spec:created', (event) => {
@@ -1,5 +1,5 @@
1
1
  // engine/code-impact-analyzer.ts — Code Change → Spec Impact Analyzer (SPEC-366)
2
- import { execSync } from 'node:child_process';
2
+ import { execGitCapture } from './git/exec-git.js';
3
3
  // ---------------------------------------------------------------------------
4
4
  // Helpers
5
5
  // ---------------------------------------------------------------------------
@@ -138,11 +138,7 @@ export function suggestSpecUpdates(specs, filePath) {
138
138
  export function runGitDiffImpact(specs, projectPath) {
139
139
  let diffText = '';
140
140
  try {
141
- diffText = execSync('git diff HEAD', {
142
- cwd: projectPath,
143
- encoding: 'utf-8',
144
- stdio: ['pipe', 'pipe', 'pipe'],
145
- });
141
+ diffText = execGitCapture('git diff HEAD', projectPath);
146
142
  }
147
143
  catch {
148
144
  // ignore git errors — proceed with empty diff
@@ -1,6 +1,6 @@
1
1
  import { suggestArchivableSpecs, archiveSpecToPath } from '../context-manager.js';
2
2
  import { writeCheckpoint } from '../session/checkpoint-writer.js';
3
- import { sessionTracker } from '../session/session-tracker.js';
3
+ import { getSessionTracker } from '../session/session-tracker.js';
4
4
  // eslint-disable-next-line no-restricted-imports -- grandfathered layer violation, remediation SPEC-1661 SPEC-1662 SPEC-1663
5
5
  import { specStore } from '../../storage/index.js';
6
6
  // eslint-disable-next-line no-restricted-imports -- grandfathered layer violation, remediation SPEC-1661 SPEC-1662 SPEC-1663
@@ -114,7 +114,7 @@ async function archiveDoneSpecs(projectId, projectPath, actionsExecuted) {
114
114
  }
115
115
  async function createSessionCheckpoint(projectPath, actionsExecuted) {
116
116
  try {
117
- const snapshot = sessionTracker.getSnapshot();
117
+ const snapshot = getSessionTracker(projectPath).getSnapshot();
118
118
  await writeCheckpoint(projectPath, snapshot);
119
119
  actionsExecuted.push('session_checkpoint: written to planu/session-context.md');
120
120
  }
@@ -1,13 +1,13 @@
1
1
  // engine/convention-scanner/codebase-scanner.ts — SPEC-192
2
2
  // Scans actual codebase files against parsed conventions
3
- import { execSync } from 'node:child_process';
4
3
  import { readdirSync, readFileSync, statSync } from 'node:fs';
5
4
  import { join, relative } from 'node:path';
5
+ import { execGitCapture } from '../git/exec-git.js';
6
6
  const MAX_VIOLATIONS_PER_CATEGORY = 50;
7
7
  // ── helpers ───────────────────────────────────────────────────────────────────
8
8
  function execSafe(cmd, cwd) {
9
9
  try {
10
- return execSync(cmd, { cwd, timeout: 5_000, stdio: ['pipe', 'pipe', 'pipe'] }).toString();
10
+ return execGitCapture(cmd, cwd);
11
11
  }
12
12
  catch {
13
13
  return '';
@@ -78,7 +78,7 @@ const SIGNAL_RULES = [
78
78
  signature: 'manual-recovery-loop',
79
79
  title: 'Repeated manual recovery steps',
80
80
  severity: 'medium',
81
- nextAction: 'submit_feedback',
81
+ nextAction: 'create_spec',
82
82
  patterns: [
83
83
  /\bmanual recovery\b/gi,
84
84
  /\brepair_frontmatter_drift\b/gi,
@@ -342,7 +342,7 @@ export async function analyzeRuntimeDogfooding(projectPath) {
342
342
  signature: 'session-version-drift',
343
343
  title: 'Persisted session version drifted from the current package version',
344
344
  severity: 'medium',
345
- nextAction: 'submit_feedback',
345
+ nextAction: 'create_spec',
346
346
  occurrences: 1,
347
347
  evidence: ['Persisted session version does not match package.json'],
348
348
  });
@@ -45,6 +45,7 @@ export declare function traceabilityRowHasCurrentCommandEvidence(row: Traceabili
45
45
  projectId: string;
46
46
  projectPath: string;
47
47
  }): boolean;
48
+ export declare function artifactHint(label: string): string;
48
49
  /** SPEC-1356: exported so evidence-autofill (and other producers) target the same path convention. */
49
50
  export declare function handoffEvidencePath(projectId: string, specId: string, filename: string): string;
50
51
  export declare function readEvidenceArtifacts(args: {
@@ -247,7 +247,7 @@ const ARTIFACT_HINTS = {
247
247
  'contract-validation-ui.json': 'Expected filename contract-validation-ui.json with { version: 1, kind: "ui", passed: boolean, reportPath?, summary? }.',
248
248
  'contract-validation-mcp.json': 'Expected filename contract-validation-mcp.json with { version: 1, kind: "mcp", passed: boolean, reportPath?, summary? }.',
249
249
  };
250
- function artifactHint(label) {
250
+ export function artifactHint(label) {
251
251
  return ARTIFACT_HINTS[label] ?? '';
252
252
  }
253
253
  /** SPEC-1356: exported so evidence-autofill (and other producers) target the same path convention. */
@@ -4,12 +4,20 @@ export declare const PLANU_BOOKKEEPING_FILES: readonly ['planu/context.md', 'pla
4
4
  /** Normalizes a spec.md path (absolute or already repo-relative) to a repo-relative,
5
5
  * forward-slash path so it can be compared against `git diff` output. */
6
6
  export declare function toRepoRelativePath(specPath: string, projectPath?: string): string;
7
+ /** Prose template + matching regex for the generator's validation evidence, shared by the
8
+ * generator (renders it) and the staleness classifier (recognizes it). */
9
+ export declare function buildValidationEvidenceText(specId: string, score: number | undefined): string;
10
+ export declare const VALIDATION_EVIDENCE_PATTERN: RegExp;
11
+ /** Prose template + matching regex for the generator's reviewer evidence, shared by the
12
+ * generator (renders it) and the staleness classifier (recognizes it). */
13
+ export declare function buildReviewerEvidenceText(agent: string, kind: string, verdict: string): string;
14
+ export declare const REVIEWER_EVIDENCE_PATTERN: RegExp;
7
15
  /**
8
- * Generate `traceability-matrix.json` in the handoff evidence store when it does
9
- * not already exist. Never overwrites an existing file if one is present this
10
- * is a no-op that reports `already-exists`. Tolerates every failure by returning
11
- * a typed non-throwing result; callers must never let this crash a lifecycle
12
- * transition.
16
+ * Generate `traceability-matrix.json` in the handoff evidence store, or regenerate
17
+ * it in place when it is autofill-shaped but stale relative to the current
18
+ * validation report. Never touches a hand-written or mixed matrix those are a
19
+ * permanent no-op. Tolerates every failure by returning a typed non-throwing
20
+ * result; callers must never let this crash a lifecycle transition.
13
21
  */
14
22
  export declare function autofillTraceabilityMatrix(args: AutofillTraceabilityMatrixArgs): Promise<AutofillTraceabilityMatrixResult>;
15
23
  //# sourceMappingURL=evidence-autofill.d.ts.map