@planu/cli 5.3.68 → 5.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (381) hide show
  1. package/CHANGELOG.md +78 -0
  2. package/dist/.planu-build.json +1 -1
  3. package/dist/cli/commands/install.d.ts +2 -15
  4. package/dist/config/skill-templates/planu-dogfood-bug.md +43 -0
  5. package/dist/config/skill-templates/planu-implement.md +42 -0
  6. package/dist/config/skill-templates/planu-review.md +47 -0
  7. package/dist/core/shared/fs.d.ts +11 -0
  8. package/dist/core/shared/fs.js +90 -0
  9. package/dist/core/shared/strings.d.ts +3 -0
  10. package/dist/core/shared/strings.js +13 -0
  11. package/dist/engine/actuals/git-analyzer.js +1 -1
  12. package/dist/engine/actuals/progress-parser.js +1 -3
  13. package/dist/engine/agent-handoff-store.js +1 -0
  14. package/dist/engine/agent-squad/dispatcher.js +1 -0
  15. package/dist/engine/agent-telemetry.js +1 -0
  16. package/dist/engine/auth/config.js +1 -0
  17. package/dist/engine/auto-updater/atomic-upgrade.js +1 -0
  18. package/dist/engine/auto-updater/index.js +1 -0
  19. package/dist/engine/autopilot/action-registry.js +20 -0
  20. package/dist/engine/autopilot/audit-logger.js +1 -0
  21. package/dist/engine/autopilot/bootstrap.js +9 -2
  22. package/dist/engine/autopilot/complete-loop.js +4 -0
  23. package/dist/engine/autopilot/crash-shield-rate-limiter.js +1 -0
  24. package/dist/engine/autopilot/event-bus.js +1 -0
  25. package/dist/engine/autopilot/state-updater.js +6 -0
  26. package/dist/engine/browser-validator.js +1 -3
  27. package/dist/engine/build-tool-detector.js +1 -8
  28. package/dist/engine/bundle-installer.js +2 -10
  29. package/dist/engine/cascade-hooks/core/append-releases.js +1 -0
  30. package/dist/engine/cascade-hooks/core/write-session-json.js +2 -2
  31. package/dist/engine/cascade-hooks/hooks/dispatch-hook-event.hook.d.ts +3 -1
  32. package/dist/engine/cascade-hooks/hooks/dispatch-hook-event.hook.js +12 -3
  33. package/dist/engine/cascade-hooks/hooks/estimate-calibration.hook.js +1 -0
  34. package/dist/engine/cascade-hooks/hooks/housekeeping-on-done.hook.js +2 -0
  35. package/dist/engine/cascade-hooks/hooks/implementing-kickoff.hook.js +5 -1
  36. package/dist/engine/cascade-hooks/hooks/lesson-drift.hook.js +1 -0
  37. package/dist/engine/cascade-hooks/hooks/orchestration-plan.hook.js +1 -0
  38. package/dist/engine/cascade-hooks/hooks/session-context.hook.js +4 -2
  39. package/dist/engine/cascade-hooks/hooks/slack-notify.hook.js +1 -0
  40. package/dist/engine/cascade-hooks/hooks/status-json.hook.js +2 -0
  41. package/dist/engine/cascade-hooks/hooks/velocity-profile.hook.js +2 -0
  42. package/dist/engine/cascade-hooks/runner.js +2 -0
  43. package/dist/engine/cascade-hooks/state-drift-detector.js +2 -0
  44. package/dist/engine/checkpoint/checkpoint-manager.js +2 -0
  45. package/dist/engine/checkpoint/policy-engine.js +1 -0
  46. package/dist/engine/ci-generator/stack-detector.js +2 -10
  47. package/dist/engine/clarification-gate/token-store.js +1 -0
  48. package/dist/engine/claude-config-auditor/claudemd-auditor.js +2 -10
  49. package/dist/engine/claude-config-auditor/settings-auditor.js +2 -10
  50. package/dist/engine/client-detection.js +2 -10
  51. package/dist/engine/compliance/auto-remediator.js +1 -0
  52. package/dist/engine/compliance/evidence-builder.d.ts +2 -2
  53. package/dist/engine/compliance/framework-catalog.d.ts +6 -6
  54. package/dist/engine/compliance/gap-analyzer.d.ts +2 -2
  55. package/dist/engine/config-health/build-tool-checker.js +1 -9
  56. package/dist/engine/config-health/ci-commands-collector.d.ts +2 -1
  57. package/dist/engine/config-health/ci-commands-collector.js +2 -9
  58. package/dist/engine/config-health/go-checker.js +1 -9
  59. package/dist/engine/config-health/mcp-config-checker.js +2 -10
  60. package/dist/engine/config-health/python-checker.js +1 -9
  61. package/dist/engine/config-health/rust-checker.js +1 -9
  62. package/dist/engine/config-health/ts-checker-scripts.js +1 -9
  63. package/dist/engine/config-health/ts-checker.js +1 -9
  64. package/dist/engine/context-artifacts/store.js +1 -0
  65. package/dist/engine/context-md-generator.js +1 -0
  66. package/dist/engine/context-orchestrator/index.js +2 -0
  67. package/dist/engine/convention-scanner/convention-parser.js +2 -9
  68. package/dist/engine/cost-guardrails.js +1 -0
  69. package/dist/engine/cost-tracking/ledger.js +1 -0
  70. package/dist/engine/criterion-identity.js +1 -1
  71. package/dist/engine/dashboard/data-loader.js +1 -0
  72. package/dist/engine/dashboard/drift-score.js +2 -0
  73. package/dist/engine/dashboard/spec-updater.d.ts +3 -1
  74. package/dist/engine/dashboard/spec-updater.js +9 -2
  75. package/dist/engine/dashboard/templates-layout.d.ts +2 -2
  76. package/dist/engine/dashboard/templates-layout.js +2 -9
  77. package/dist/engine/data-projects-gc/gc-runner.js +2 -4
  78. package/dist/engine/deleter/audit-logger.js +1 -0
  79. package/dist/engine/deleter/core.js +6 -0
  80. package/dist/engine/deleter/trash-manager.js +1 -0
  81. package/dist/engine/desktop-detector.js +1 -9
  82. package/dist/engine/detection-utils.d.ts +2 -1
  83. package/dist/engine/detection-utils.js +3 -10
  84. package/dist/engine/detectors/advanced-framework-detector/helpers.d.ts +3 -2
  85. package/dist/engine/detectors/advanced-framework-detector/helpers.js +3 -17
  86. package/dist/engine/detectors/cicd-detector.js +2 -10
  87. package/dist/engine/detectors/css-framework-detector.js +2 -10
  88. package/dist/engine/detectors/deployment-detector.js +3 -12
  89. package/dist/engine/detectors/frontend-perf-detector.js +2 -10
  90. package/dist/engine/detectors/gitops-detector.js +3 -11
  91. package/dist/engine/detectors/idp-detector.js +1 -3
  92. package/dist/engine/detectors/k3s-detector.js +3 -11
  93. package/dist/engine/detectors/llm-detector/file-readers.d.ts +2 -1
  94. package/dist/engine/detectors/llm-detector/file-readers.js +2 -9
  95. package/dist/engine/detectors/mfe-detector.js +5 -13
  96. package/dist/engine/detectors/monitoring-detector.js +2 -11
  97. package/dist/engine/detectors/monorepo-detector.d.ts +1 -0
  98. package/dist/engine/detectors/monorepo-detector.js +1 -10
  99. package/dist/engine/detectors/nomad-detector.js +3 -11
  100. package/dist/engine/detectors/otel-ecosystem-detectors.d.ts +2 -1
  101. package/dist/engine/detectors/otel-ecosystem-detectors.js +2 -10
  102. package/dist/engine/doc-generator/executive-summary/html-template.js +1 -7
  103. package/dist/engine/doc-generator/executive-summary/section-builders.js +1 -7
  104. package/dist/engine/doc-generator/per-spec-report/mermaid-renderer.js +1 -7
  105. package/dist/engine/doc-generator/per-spec-report/spec-section-builders.js +1 -7
  106. package/dist/engine/doc-generator/per-spec-report/technical-report.js +1 -7
  107. package/dist/engine/doc-generator/portal/analytics-page.js +1 -7
  108. package/dist/engine/doc-generator/portal/architecture-page.js +1 -7
  109. package/dist/engine/doc-generator/portal/changelog-page.js +1 -7
  110. package/dist/engine/doc-generator/portal/decision-page.js +1 -7
  111. package/dist/engine/doc-generator/portal/decision-timeline-builder.js +1 -7
  112. package/dist/engine/doc-generator/portal/kanban-view-builder.js +1 -7
  113. package/dist/engine/doc-generator/portal/portal-breadcrumbs.js +1 -7
  114. package/dist/engine/doc-generator/portal/portal-landing-cards.js +1 -7
  115. package/dist/engine/doc-generator/portal/portal-navbar.js +1 -7
  116. package/dist/engine/doc-generator/portal/portal-page-detector.d.ts +3 -0
  117. package/dist/engine/doc-generator/portal/portal-page-detector.js +1 -10
  118. package/dist/engine/doc-generator/portal/portal-regenerator.js +2 -0
  119. package/dist/engine/doc-generator/portal/risk-matrix-svg.js +1 -7
  120. package/dist/engine/doc-generator/portal/risk-page.js +1 -7
  121. package/dist/engine/doc-generator/portal/roadmap-page.js +1 -7
  122. package/dist/engine/doc-generator/proposal/proposal-gantt-builder.js +1 -7
  123. package/dist/engine/doc-generator/proposal/proposal-kpi-builder.js +1 -7
  124. package/dist/engine/doc-generator/proposal/proposal-section-builders-advanced.js +2 -8
  125. package/dist/engine/doc-generator/proposal/proposal-section-builders.js +1 -7
  126. package/dist/engine/docs-site-generator/html-templates.js +1 -7
  127. package/dist/engine/docs-site-generator/markdown-renderer.js +1 -7
  128. package/dist/engine/drift/violation-resolver.js +2 -0
  129. package/dist/engine/dynamic-knowledge/knowledge-cache.js +1 -0
  130. package/dist/engine/ecosystem-absorber/knowledge-cache.js +1 -0
  131. package/dist/engine/edge-db-detector.js +1 -10
  132. package/dist/engine/escalator/retry-counter.js +1 -0
  133. package/dist/engine/evidence-gates/artifact-reader.js +1 -0
  134. package/dist/engine/evidence-gates/evidence-autofill.js +1 -0
  135. package/dist/engine/evidence-gates/evidence-skeletons.js +1 -0
  136. package/dist/engine/evidence-gates/reconciliation-freshness.js +1 -0
  137. package/dist/engine/execution/durable-job-heartbeat-runtime.js +1 -0
  138. package/dist/engine/execution/job-runtime.js +2 -0
  139. package/dist/engine/execution/validate-job-executor.d.ts +1 -1
  140. package/dist/engine/execution/validate-job-executor.js +3 -0
  141. package/dist/engine/execution/validate-job-payload.js +1 -0
  142. package/dist/engine/execution/validate-worker-thread.js +1 -0
  143. package/dist/engine/facilitate/context-loader.js +1 -0
  144. package/dist/engine/figma/change-detector.d.ts +1 -8
  145. package/dist/engine/figma/code-connect-fetcher.d.ts +1 -7
  146. package/dist/engine/figma/design-enricher.d.ts +1 -17
  147. package/dist/engine/figma/design-enricher.js +0 -1
  148. package/dist/engine/figma/e2e-generator.d.ts +1 -23
  149. package/dist/engine/figma/flow-analyzer.d.ts +1 -11
  150. package/dist/engine/figma/frame-extractor.d.ts +1 -11
  151. package/dist/engine/figma/frame-extractor.js +3 -0
  152. package/dist/engine/figma/multi-file-manager.d.ts +1 -6
  153. package/dist/engine/figma/spec-generator.js +2 -0
  154. package/dist/engine/figma/thumbnail-fetcher.d.ts +1 -1
  155. package/dist/engine/figma/token-extractor.d.ts +1 -6
  156. package/dist/engine/figma/token-extractor.js +0 -1
  157. package/dist/engine/figma/version-tracker.d.ts +1 -7
  158. package/dist/engine/figma/version-tracker.js +0 -1
  159. package/dist/engine/figma/visual-qa.d.ts +5 -19
  160. package/dist/engine/figma/visual-qa.js +1 -2
  161. package/dist/engine/figma/webhook-manager.d.ts +1 -7
  162. package/dist/engine/frontmatter-sha/reseal.js +1 -0
  163. package/dist/engine/frontmatter-sha/verify-terminal.js +1 -0
  164. package/dist/engine/git-hook-injector.js +2 -10
  165. package/dist/engine/github/quality-dimensions.js +1 -3
  166. package/dist/engine/global-rules-manager.js +2 -3
  167. package/dist/engine/handoff-artifacts/implementation-review-reader.js +1 -0
  168. package/dist/engine/handoff-artifacts/io.js +2 -0
  169. package/dist/engine/handoff-packager.js +2 -1
  170. package/dist/engine/health/auto-fixer.js +1 -0
  171. package/dist/engine/hooks/context-injector.js +1 -0
  172. package/dist/engine/hooks-reconciler.js +1 -8
  173. package/dist/engine/impact-detector/index.js +2 -9
  174. package/dist/engine/implementation-contract/common.js +1 -3
  175. package/dist/engine/implementation-contract/evaluator.js +1 -3
  176. package/dist/engine/keyword-matcher/boundary.d.ts +2 -7
  177. package/dist/engine/keyword-matcher/boundary.js +2 -14
  178. package/dist/engine/lifecycle-reconciliation-io.js +1 -0
  179. package/dist/engine/lifecycle-reconciliation.js +3 -0
  180. package/dist/engine/local-first/detector.js +1 -9
  181. package/dist/engine/marketplace-fetcher/cache.js +2 -0
  182. package/dist/engine/marketplace-fetcher/index.js +1 -0
  183. package/dist/engine/mcp-config/mcp-config-writer.js +2 -10
  184. package/dist/engine/migrations/remove-commercial-state.js +2 -0
  185. package/dist/engine/mobile-detector-shared.d.ts +1 -1
  186. package/dist/engine/mobile-detector-shared.js +2 -9
  187. package/dist/engine/multi-channel-notifier.js +1 -0
  188. package/dist/engine/multi-teammate-review/disagreement-counter.js +1 -0
  189. package/dist/engine/multi-teammate-review/panel-orchestrator.js +1 -0
  190. package/dist/engine/onboarding-engine.js +1 -9
  191. package/dist/engine/permissions-merger/stack-detectors.js +2 -10
  192. package/dist/engine/pii-detector/core.js +1 -3
  193. package/dist/engine/platform-engineering/dx-analyzer.js +1 -10
  194. package/dist/engine/platform-engineering/idp-detector.js +2 -10
  195. package/dist/engine/project-dna/ai-tool-detector.js +2 -10
  196. package/dist/engine/project-dna/stack-detector.js +2 -10
  197. package/dist/engine/project-graph/builder.js +11 -2
  198. package/dist/engine/project-graph/cache.d.ts +5 -2
  199. package/dist/engine/project-graph/cache.js +174 -34
  200. package/dist/engine/project-graph/extractors/decision-store-extractor.js +1 -0
  201. package/dist/engine/project-graph/freshness-projection.js +3 -0
  202. package/dist/engine/project-graph/query.js +14 -11
  203. package/dist/engine/project-health-checker.js +2 -6
  204. package/dist/engine/provider-adapters/shared/spec-loader.js +1 -0
  205. package/dist/engine/quality-gates/gate-evaluator.js +1 -3
  206. package/dist/engine/react-detector.js +6 -14
  207. package/dist/engine/reconcile/apply-changes.js +1 -3
  208. package/dist/engine/registry/core.js +1 -0
  209. package/dist/engine/registry/loader.js +2 -0
  210. package/dist/engine/release/postmortem-generator.js +1 -0
  211. package/dist/engine/release/rollback-runner.d.ts +2 -2
  212. package/dist/engine/release/stuck-spec-detector.js +7 -0
  213. package/dist/engine/release-pipeline/release-spec-closer.js +3 -0
  214. package/dist/engine/rules-reconciler.d.ts +1 -1
  215. package/dist/engine/rules-reconciler.js +2 -9
  216. package/dist/engine/safety/atomic-writer.js +1 -0
  217. package/dist/engine/safety/cross-process-lock.js +2 -0
  218. package/dist/engine/safety/file-mutex.js +1 -0
  219. package/dist/engine/safety/lock-lease-store.js +1 -0
  220. package/dist/engine/safety/lock-scavenger.js +2 -0
  221. package/dist/engine/saga/transition-cascade.js +3 -0
  222. package/dist/engine/scan-project/index.js +1 -0
  223. package/dist/engine/scan-project/module-discoverer.js +1 -9
  224. package/dist/engine/schema-parity-auditor/handler-checker.js +1 -3
  225. package/dist/engine/schema-parity-auditor/index.js +1 -3
  226. package/dist/engine/schema-parity-auditor/type-checker.js +1 -3
  227. package/dist/engine/self-healing/strategies/coverage-fix.js +2 -10
  228. package/dist/engine/session-context-generator.d.ts +8 -0
  229. package/dist/engine/session-context-generator.js +33 -23
  230. package/dist/engine/session-state/session-artifact-refresher.d.ts +7 -0
  231. package/dist/engine/session-state/session-artifact-refresher.js +140 -0
  232. package/dist/engine/session-state/writer.d.ts +3 -0
  233. package/dist/engine/session-state/writer.js +35 -17
  234. package/dist/engine/shared-agent-memory.js +1 -0
  235. package/dist/engine/skill-adapter/index.js +3 -0
  236. package/dist/engine/skill-bootstrap/registry-fetcher.js +1 -0
  237. package/dist/engine/skill-bootstrap/skill-writer.js +2 -9
  238. package/dist/engine/skill-bootstrap/stack-matcher.js +1 -9
  239. package/dist/engine/skill-discovery/multi-agent-writer.d.ts +1 -0
  240. package/dist/engine/skill-discovery/multi-agent-writer.js +1 -9
  241. package/dist/engine/skill-generator/workflow-skill-generator.js +1 -0
  242. package/dist/engine/skill-registry/ttl-refresh.js +2 -0
  243. package/dist/engine/spec-audit/index.js +2 -0
  244. package/dist/engine/spec-audit/report-writer.js +1 -0
  245. package/dist/engine/spec-coverage/core.js +1 -0
  246. package/dist/engine/spec-decomposer/analyzer.js +1 -11
  247. package/dist/engine/spec-dependency-graph/dot-exporter.d.ts +1 -1
  248. package/dist/engine/spec-dependency-graph/graph-builder.d.ts +1 -20
  249. package/dist/engine/spec-dependency-graph/superseded-set.d.ts +1 -1
  250. package/dist/engine/spec-diff-engine.js +1 -7
  251. package/dist/engine/spec-format/read-technical-section.js +1 -3
  252. package/dist/engine/spec-format/replace-section.js +1 -3
  253. package/dist/engine/spec-format/spec-id.d.ts +9 -1
  254. package/dist/engine/spec-format/spec-id.js +24 -3
  255. package/dist/engine/spec-format/unified-spec-builder.js +1 -3
  256. package/dist/engine/spec-migrator/canonical-deduplicator.js +2 -0
  257. package/dist/engine/spec-observability/tracker.js +1 -0
  258. package/dist/engine/spec-registry/adapter.js +2 -10
  259. package/dist/engine/spec-registry/validator.d.ts +1 -0
  260. package/dist/engine/spec-registry/validator.js +1 -9
  261. package/dist/engine/spec-state-machine/transition-spec.js +1 -0
  262. package/dist/engine/spec-templates/custom-loader.js +1 -0
  263. package/dist/engine/stack-auditor/build-tool-auditor.js +1 -9
  264. package/dist/engine/staleness/stale-implementing.js +5 -14
  265. package/dist/engine/status-reconciler/index.js +4 -1
  266. package/dist/engine/structural-memory/helpers.js +1 -0
  267. package/dist/engine/supply-chain/slsa-checker.js +1 -9
  268. package/dist/engine/tdd-enforcer/stub-artifact-path.js +1 -0
  269. package/dist/engine/telemetry/health-checker.js +1 -0
  270. package/dist/engine/telemetry/telemetry-store.js +1 -0
  271. package/dist/engine/token-optimizer/response-cache.js +1 -3
  272. package/dist/engine/tool-groups/group-manager.js +2 -0
  273. package/dist/engine/update-notifier.js +1 -0
  274. package/dist/engine/validation/approved-spec-portability.js +1 -0
  275. package/dist/engine/validation/durable-validation.js +1 -0
  276. package/dist/engine/validation/validation-freshness.js +2 -0
  277. package/dist/engine/validation/validation-receipt.js +1 -0
  278. package/dist/engine/validation/validation-submission.d.ts +1 -1
  279. package/dist/engine/validation-evidence-ledger.js +1 -0
  280. package/dist/engine/validator/deep-code-checker.js +1 -3
  281. package/dist/engine/validator/executable-evidence.d.ts +1 -14
  282. package/dist/engine/validator/scope-resolver.d.ts +2 -2
  283. package/dist/engine/validator/spec-compliance-runner.d.ts +1 -31
  284. package/dist/engine/validator/validation-report-writer.js +1 -1
  285. package/dist/engine/validator.d.ts +1 -1
  286. package/dist/engine/validator.js +1 -0
  287. package/dist/engine/velocity/measure-velocity.js +2 -0
  288. package/dist/engine/version-resolver.js +1 -0
  289. package/dist/engine/workers/handlers/auto-drift.js +3 -0
  290. package/dist/engine/workspace-manager.js +4 -0
  291. package/dist/hosts/gemini/config-scaffold.js +2 -10
  292. package/dist/storage/approval-operation-lock.js +1 -0
  293. package/dist/storage/auto-promoter-config-store.js +1 -0
  294. package/dist/storage/autopilot-log-store.js +1 -0
  295. package/dist/storage/base-store.js +1 -0
  296. package/dist/storage/checkpoint-store.js +1 -0
  297. package/dist/storage/feedback-remote.js +1 -0
  298. package/dist/storage/gaps-log.js +1 -0
  299. package/dist/storage/global-projects-store.js +1 -0
  300. package/dist/storage/global-store.js +1 -0
  301. package/dist/storage/knowledge-store/sessions.js +2 -0
  302. package/dist/storage/migrations/canonical-storage.js +42 -18
  303. package/dist/storage/project-drift-store.js +1 -0
  304. package/dist/storage/project-identity.js +1 -0
  305. package/dist/storage/project-resolver.js +1 -17
  306. package/dist/storage/runtime-db.d.ts +2 -20
  307. package/dist/storage/runtime-db.js +2 -9
  308. package/dist/storage/semantic-index-store.js +1 -0
  309. package/dist/storage/sentry-store.js +1 -0
  310. package/dist/storage/session-state-store.js +1 -0
  311. package/dist/storage/spec-store.d.ts +7 -0
  312. package/dist/storage/spec-store.js +21 -1
  313. package/dist/storage/status-store/atomic-status-write.js +1 -0
  314. package/dist/storage/status-store/file-lock.js +1 -0
  315. package/dist/storage/status-store/self-healing.js +1 -0
  316. package/dist/storage/storage-bundle.d.ts +12 -2
  317. package/dist/storage/supabase-store.js +1 -0
  318. package/dist/storage/technology-selection-store.js +1 -0
  319. package/dist/storage/trash-store.d.ts +2 -4
  320. package/dist/storage/trash-store.js +2 -15
  321. package/dist/storage/vector-store/json-fallback.js +1 -0
  322. package/dist/storage/vector-store/migrator.js +1 -0
  323. package/dist/storage/vector-store/sqlite-adapter.js +1 -0
  324. package/dist/tools/audit-claude-config.js +1 -10
  325. package/dist/tools/check-readiness.js +104 -30
  326. package/dist/tools/clarify-requirements/multiple-choice.d.ts +3 -3
  327. package/dist/tools/configure-oauth-handler.js +1 -0
  328. package/dist/tools/create-skill.js +11 -9
  329. package/dist/tools/create-spec-helpers.d.ts +1 -3
  330. package/dist/tools/create-spec-helpers.js +1 -8
  331. package/dist/tools/create-spec.js +1 -13
  332. package/dist/tools/dashboard.js +5 -0
  333. package/dist/tools/github-pr-handler.js +1 -0
  334. package/dist/tools/github-release-handler.d.ts +1 -0
  335. package/dist/tools/github-release-handler.js +4 -3
  336. package/dist/tools/graph-specs.d.ts +1 -1
  337. package/dist/tools/heal-spec-docs.js +1 -3
  338. package/dist/tools/init-project/git-setup.d.ts +2 -2
  339. package/dist/tools/init-project/host-assets-writer.js +9 -10
  340. package/dist/tools/init-project/lifecycle-helpers.d.ts +2 -2
  341. package/dist/tools/init-project/lint-scaffolder.js +2 -10
  342. package/dist/tools/init-project/stack-detector.d.ts +2 -2
  343. package/dist/tools/reconcile-interactive-question-hooks.d.ts +2 -2
  344. package/dist/tools/register-sdd-tools.js +1 -0
  345. package/dist/tools/safe-handler.js +1 -0
  346. package/dist/tools/schemas/spec-id.d.ts +1 -6
  347. package/dist/tools/schemas/spec-id.js +1 -16
  348. package/dist/tools/tool-entry.d.ts +2 -2
  349. package/dist/tools/tool-entry.js +1 -1
  350. package/dist/tools/tool-registry/core-tools.d.ts +2 -2
  351. package/dist/tools/tool-registry/deprecated-stubs.d.ts +3 -3
  352. package/dist/tools/tool-registry/deprecated-stubs.js +1 -1
  353. package/dist/tools/triage-request.d.ts +2 -2
  354. package/dist/tools/update-status/approval-gates.d.ts +2 -2
  355. package/dist/tools/update-status/approval-gates.js +1 -0
  356. package/dist/tools/update-status/dod-gates.d.ts +1 -1
  357. package/dist/tools/update-status/done-receipt-verifier.d.ts +1 -1
  358. package/dist/tools/update-status/side-effects.js +5 -0
  359. package/dist/tools/update-status-actions.js +28 -40
  360. package/dist/tools/validate-graph-coverage.js +14 -2
  361. package/dist/tools/validate.js +2 -0
  362. package/dist/transports/middleware/types.d.ts +3 -3
  363. package/dist/types/atomic-upgrade.d.ts +1 -1
  364. package/dist/types/cascade-hooks.d.ts +3 -0
  365. package/dist/types/dashboard.d.ts +4 -1
  366. package/dist/types/durable-job.d.ts +20 -0
  367. package/dist/types/durable-job.js +9 -1
  368. package/dist/types/index.d.ts +2 -0
  369. package/dist/types/index.js +2 -0
  370. package/dist/types/installation.d.ts +16 -0
  371. package/dist/types/installation.js +2 -0
  372. package/dist/types/project-knowledge-graph.d.ts +11 -0
  373. package/dist/types/session-checkpoint.d.ts +16 -0
  374. package/dist/types/spec-dependency-graph.d.ts +21 -0
  375. package/dist/types/spec-dependency-graph.js +2 -0
  376. package/dist/types/universal-rules/index.d.ts +1 -0
  377. package/dist/types/validation-evidence.d.ts +45 -0
  378. package/package.json +16 -16
  379. package/planu-plugin.json +1 -1
  380. package/dist/types/storage-bundle.d.ts +0 -13
  381. package/dist/types/storage-bundle.js +0 -2
@@ -46,6 +46,7 @@ async function runWithProgress(projectPath, projectId, specId, action, fn) {
46
46
  * existing create-branch handler so naming conventions stay consistent.
47
47
  */
48
48
  async function doAutoCreateBranch(projectId, specId) {
49
+ // eslint-disable-next-line no-restricted-syntax -- grandfathered layer violation, remediation SPEC-1661 SPEC-1662 SPEC-1663
49
50
  const { handleCreateBranch } = await import('../../tools/git/branch-ops.js');
50
51
  // SPEC-1396: cascade side effect — create the ref, never move the shared checkout.
51
52
  const result = await handleCreateBranch(projectId, specId, undefined, undefined, {
@@ -69,11 +70,13 @@ export function fireAutoCreateBranch(projectPath, projectId, specId) {
69
70
  * tdd_scaffold handler once the spec path is resolved.
70
71
  */
71
72
  async function doAutoScaffoldTdd(projectPath, projectId, specId) {
73
+ // eslint-disable-next-line no-restricted-syntax -- grandfathered layer violation, remediation SPEC-1661 SPEC-1662 SPEC-1663
72
74
  const { specStore } = await import('../../storage/index.js');
73
75
  const spec = await specStore.getSpec(projectId, specId);
74
76
  if (!spec?.specPath) {
75
77
  throw new Error(`spec ${specId} has no specPath`);
76
78
  }
79
+ // eslint-disable-next-line no-restricted-syntax -- grandfathered layer violation, remediation SPEC-1661 SPEC-1662 SPEC-1663
77
80
  const { handleTddScaffold } = await import('../../tools/tdd-scaffold-handler.js');
78
81
  const result = await handleTddScaffold({ projectPath, specPath: spec.specPath });
79
82
  if (result.isError === true) {
@@ -100,6 +103,7 @@ export function resolveAutoMergeThreshold(config) {
100
103
  * Fire-and-forget — delegates to handleCreatePRFromSpec and captures errors.
101
104
  */
102
105
  async function doAutoCreatePr(specId) {
106
+ // eslint-disable-next-line no-restricted-syntax -- grandfathered layer violation, remediation SPEC-1661 SPEC-1662 SPEC-1663
103
107
  const { handleCreatePRFromSpec } = await import('../../tools/github-pr-handler.js');
104
108
  const result = await handleCreatePRFromSpec({
105
109
  specId,
@@ -1,6 +1,7 @@
1
1
  // engine/autopilot/crash-shield-rate-limiter.ts — SPEC-628: Rate-limit crash scans to max once per 6h per project
2
2
  import { readFile, writeFile, mkdir } from 'node:fs/promises';
3
3
  import { join, dirname } from 'node:path';
4
+ // eslint-disable-next-line no-restricted-imports -- grandfathered layer violation, remediation SPEC-1661 SPEC-1662 SPEC-1663
4
5
  import { hashProjectPath, projectDataDir } from '../../storage/base-store.js';
5
6
  const SIX_HOURS_MS = 6 * 60 * 60 * 1000;
6
7
  function stateFilePath(projectPath) {
@@ -1,5 +1,6 @@
1
1
  // engine/autopilot/event-bus.ts — SPEC-413: Simple in-memory event bus for autopilot triggers
2
2
  // SPEC-772: log each emitted event to autopilot-log.jsonl (best-effort, fire-and-forget)
3
+ // eslint-disable-next-line no-restricted-imports -- grandfathered layer violation, remediation SPEC-1661 SPEC-1662 SPEC-1663
3
4
  import { appendAutopilotLogEntry } from '../../storage/autopilot-log-store.js';
4
5
  const handlers = new Map();
5
6
  export function onAutopilotEvent(name, handler) {
@@ -4,10 +4,15 @@
4
4
  // SPEC-753: File-lock applied to all writes; self-healing on corrupt reads.
5
5
  import { readFile } from 'node:fs/promises';
6
6
  import { join } from 'node:path';
7
+ // eslint-disable-next-line no-restricted-imports -- grandfathered layer violation, remediation SPEC-1661 SPEC-1662 SPEC-1663
7
8
  import { withStatusLock } from '../../storage/status-store/file-lock.js';
9
+ // eslint-disable-next-line no-restricted-imports -- grandfathered layer violation, remediation SPEC-1661 SPEC-1662 SPEC-1663
8
10
  import { validateStatusJson, rebuildStatusFromFrontmatters, writeRebuiltStatus, } from '../../storage/status-store/self-healing.js';
11
+ // eslint-disable-next-line no-restricted-imports -- grandfathered layer violation, remediation SPEC-1661 SPEC-1662 SPEC-1663
9
12
  import { syncVersionField } from '../../storage/status-store/version-sync.js';
13
+ // eslint-disable-next-line no-restricted-imports -- grandfathered layer violation, remediation SPEC-1661 SPEC-1662 SPEC-1663
10
14
  import { hashProjectPath, projectDataDir } from '../../storage/base-store.js';
15
+ // eslint-disable-next-line no-restricted-imports -- grandfathered layer violation, remediation SPEC-1661 SPEC-1662 SPEC-1663
11
16
  import { atomicStatusWrite } from '../../storage/status-store/atomic-status-write.js';
12
17
  const STATUS_FILENAME = 'status.json';
13
18
  const MAX_RECENT_CHANGES = 20;
@@ -97,6 +102,7 @@ export async function refreshProjectStatus(projectPath, projectId) {
97
102
  const filePath = getStatusPath(projectPath);
98
103
  try {
99
104
  await withStatusLock(filePath, async () => {
105
+ // eslint-disable-next-line no-restricted-syntax -- grandfathered layer violation, remediation SPEC-1661 SPEC-1662 SPEC-1663
100
106
  const { specStore } = await import('../../storage/index.js');
101
107
  const specs = await specStore.listSpecs(projectId);
102
108
  const { PLANU_VERSION } = await import('../../config/version.js');
@@ -2,6 +2,7 @@ import { technologyValue } from './technology-registry.js';
2
2
  // engine/browser-validator.ts — SPEC-308: Parse spec criteria for UI checkable assertions
3
3
  import { execFile } from 'node:child_process';
4
4
  import { promisify } from 'node:util';
5
+ import { escapeRegex as escapeRegExpLiteral } from '../core/shared/strings.js';
5
6
  const execFileAsync = promisify(execFile);
6
7
  /** Patterns that indicate a visibility assertion. */
7
8
  const VISIBILITY_KEYWORDS = ['visible', 'shown', 'displayed', 'appear', 'shows', 'see'];
@@ -88,9 +89,6 @@ export function extractUIAssertions(criteriaMarkdown) {
88
89
  }
89
90
  return assertions;
90
91
  }
91
- function escapeRegExpLiteral(value) {
92
- return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
93
- }
94
92
  function safeComment(value) {
95
93
  return value.replace(/[\r\n\u2028\u2029]+/g, ' ');
96
94
  }
@@ -5,6 +5,7 @@ import { technologyValue } from './technology-registry.js';
5
5
  // package.json devDependencies and config files.
6
6
  import { readFile, access } from 'node:fs/promises';
7
7
  import { join } from 'node:path';
8
+ import { readFileSafe } from '../core/shared/fs.js';
8
9
  // -- Constants ----------------------------------------------------------------
9
10
  /** devDependency key → BuildTool */
10
11
  const DEV_DEP_TO_BUILD_TOOL = new Map([
@@ -71,14 +72,6 @@ async function configFileExists(filePath) {
71
72
  return false;
72
73
  }
73
74
  }
74
- async function readFileSafe(filePath) {
75
- try {
76
- return await readFile(filePath, 'utf-8');
77
- }
78
- catch {
79
- return '';
80
- }
81
- }
82
75
  function allDeps(pkg) {
83
76
  return { ...pkg.dependencies, ...pkg.devDependencies };
84
77
  }
@@ -1,9 +1,10 @@
1
1
  // @crash-shield-ignore-file — config/cache reader for Planu-controlled JSON; writer is this codebase, shape guaranteed by build/seed.
2
2
  // Planu — bundle-installer.ts
3
3
  // Installs domain bundle components (skills, rules, spec templates) into a project.
4
- import { readFile, writeFile, mkdir, access } from 'node:fs/promises';
4
+ import { readFile, writeFile, mkdir } from 'node:fs/promises';
5
5
  import { join, dirname } from 'node:path';
6
6
  import { fileURLToPath } from 'node:url';
7
+ import { fileExists } from '../core/shared/fs.js';
7
8
  // ---------------------------------------------------------------------------
8
9
  // Config loading
9
10
  // ---------------------------------------------------------------------------
@@ -31,15 +32,6 @@ export async function listBundlesAsync() {
31
32
  /**
32
33
  * Checks if a file exists at the given path.
33
34
  */
34
- async function fileExists(filePath) {
35
- try {
36
- await access(filePath);
37
- return true;
38
- }
39
- catch {
40
- return false;
41
- }
42
- }
43
35
  /**
44
36
  * Writes a file, creating parent directories as needed.
45
37
  */
@@ -6,6 +6,7 @@ import { readFile, mkdir } from 'node:fs/promises';
6
6
  import { execFile as execFileCallback } from 'node:child_process';
7
7
  import { createRequire } from 'node:module';
8
8
  import { promisify } from 'node:util';
9
+ // eslint-disable-next-line no-restricted-imports -- grandfathered layer violation, remediation SPEC-1661 SPEC-1662 SPEC-1663
9
10
  import { specStore } from '../../../storage/index.js';
10
11
  import { reportClassifiedDegradation } from '../../../errors/classified-degradation.js';
11
12
  const CORE_ACTION_BUDGET_MS = 2000;
@@ -8,12 +8,12 @@ async function actuallyWriteSessionJson(ctx, opts) {
8
8
  if (opts.signal.aborted) {
9
9
  throw new Error('write-session-json aborted before start');
10
10
  }
11
- const { generateSessionContext } = await import('../../session-context-generator.js');
11
+ const { refreshSessionArtifacts } = await import('../../session-state/session-artifact-refresher.js');
12
12
  await new Promise((resolve, reject) => {
13
13
  opts.signal.addEventListener('abort', () => {
14
14
  reject(new Error('CoreActionTimeoutError: write-session-json timed out'));
15
15
  });
16
- generateSessionContext(projectPath, projectId)
16
+ refreshSessionArtifacts(projectPath, projectId)
17
17
  .then(() => {
18
18
  resolve();
19
19
  })
@@ -1,3 +1,5 @@
1
- import type { CascadeHook } from '../../../types/cascade-hooks.js';
1
+ import type { CascadeHook, DispatchHookEventFn } from '../../../types/cascade-hooks.js';
2
+ /** Wired by the tools layer at startup so this engine module never imports tools/. */
3
+ export declare function setDispatchHookEventHandler(fn: DispatchHookEventFn): void;
2
4
  export declare const dispatchHookEventHook: CascadeHook;
3
5
  //# sourceMappingURL=dispatch-hook-event.hook.d.ts.map
@@ -1,16 +1,25 @@
1
- import { dispatchHookEvent } from '../../../tools/manage-hooks.js';
2
1
  import { buildStatusChangePayload } from '../../hooks/triggers.js';
3
2
  import { withAudit } from '../../autopilot/audit-logger.js';
3
+ let dispatchHookEvent;
4
+ /** Wired by the tools layer at startup so this engine module never imports tools/. */
5
+ export function setDispatchHookEventHandler(fn) {
6
+ dispatchHookEvent = fn;
7
+ }
4
8
  async function handler(ctx) {
5
9
  const { projectPath, projectId, specId, spec, newStatus, currentStatus } = ctx;
10
+ if (!dispatchHookEvent) {
11
+ console.error('[planu] dispatchHookEvent failed: no handler registered');
12
+ return;
13
+ }
14
+ const dispatch = dispatchHookEvent;
6
15
  const payload = buildStatusChangePayload(projectId, specId, spec.title, currentStatus, newStatus);
7
16
  if (projectPath) {
8
- await withAudit(projectPath, `update_status(${newStatus})`, 'dispatchHookEvent', () => dispatchHookEvent(projectId, payload)).catch((err) => {
17
+ await withAudit(projectPath, `update_status(${newStatus})`, 'dispatchHookEvent', () => dispatch(projectId, payload)).catch((err) => {
9
18
  console.error('[planu] dispatchHookEvent failed:', err);
10
19
  });
11
20
  }
12
21
  else {
13
- await dispatchHookEvent(projectId, payload).catch((err) => {
22
+ await dispatch(projectId, payload).catch((err) => {
14
23
  console.error('[planu] dispatchHookEvent failed:', err);
15
24
  });
16
25
  }
@@ -4,6 +4,7 @@ async function handler(ctx) {
4
4
  return;
5
5
  }
6
6
  try {
7
+ // eslint-disable-next-line no-restricted-syntax -- grandfathered layer violation, remediation SPEC-1661 SPEC-1662 SPEC-1663
7
8
  const { listActuals, saveCalibration } = await import('../../../storage/actuals-store.js');
8
9
  const { computeCalibrationFactors } = await import('../../estimation-calibrator.js');
9
10
  const records = await listActuals(projectId);
@@ -1,4 +1,6 @@
1
+ // eslint-disable-next-line no-restricted-imports -- grandfathered layer violation, remediation SPEC-1661 SPEC-1662 SPEC-1663
1
2
  import { appendAutopilotLogEntry } from '../../../storage/autopilot-log-store.js';
3
+ // eslint-disable-next-line no-restricted-imports -- grandfathered layer violation, remediation SPEC-1661 SPEC-1662 SPEC-1663
2
4
  import { hashProjectPath } from '../../../storage/base-store.js';
3
5
  async function handler(ctx) {
4
6
  const { projectPath, specId } = ctx;
@@ -1,4 +1,6 @@
1
+ // eslint-disable-next-line no-restricted-imports -- grandfathered layer violation, remediation SPEC-1661 SPEC-1662 SPEC-1663
1
2
  import { appendAutopilotLogEntry } from '../../../storage/autopilot-log-store.js';
3
+ // eslint-disable-next-line no-restricted-imports -- grandfathered layer violation, remediation SPEC-1661 SPEC-1662 SPEC-1663
2
4
  import { hashProjectPath } from '../../../storage/base-store.js';
3
5
  function logExecutionPlanOutcome(projectPath, entry) {
4
6
  try {
@@ -11,7 +13,9 @@ function logExecutionPlanOutcome(projectPath, entry) {
11
13
  async function fireExecutionPlan(projectPath, projectId, specId) {
12
14
  const start = Date.now();
13
15
  try {
14
- const { handleGenerateExecutionPlan } = await import('../../../tools/generate-execution-plan.js');
16
+ const { handleGenerateExecutionPlan } =
17
+ // eslint-disable-next-line no-restricted-syntax -- grandfathered layer violation, remediation SPEC-1661 SPEC-1662 SPEC-1663
18
+ await import('../../../tools/generate-execution-plan.js');
15
19
  const result = await handleGenerateExecutionPlan({ specId, projectId });
16
20
  logExecutionPlanOutcome(projectPath, {
17
21
  specId,
@@ -1,3 +1,4 @@
1
+ // eslint-disable-next-line no-restricted-imports -- grandfathered layer violation, remediation SPEC-1661 SPEC-1662 SPEC-1663
1
2
  import { addLesson, getLessons } from '../../../storage/lessons-store.js';
2
3
  async function handler(ctx) {
3
4
  const { spec, projectId, projectPath, validateScore } = ctx;
@@ -4,6 +4,7 @@ async function handler(ctx) {
4
4
  return;
5
5
  }
6
6
  try {
7
+ // eslint-disable-next-line no-restricted-syntax -- grandfathered layer violation, remediation SPEC-1661 SPEC-1662 SPEC-1663
7
8
  const { specStore } = await import('../../../storage/index.js');
8
9
  await specStore.withFreshSpecsLock(projectId, async (freshSpecs) => {
9
10
  const approvedCount = freshSpecs.filter((spec) => spec.status === 'approved').length;
@@ -1,4 +1,6 @@
1
+ // eslint-disable-next-line no-restricted-imports -- grandfathered layer violation, remediation SPEC-1661 SPEC-1662 SPEC-1663
1
2
  import { appendAutopilotLogEntry } from '../../../storage/autopilot-log-store.js';
3
+ // eslint-disable-next-line no-restricted-imports -- grandfathered layer violation, remediation SPEC-1661 SPEC-1662 SPEC-1663
2
4
  import { hashProjectPath } from '../../../storage/base-store.js';
3
5
  async function handler(ctx) {
4
6
  const { projectPath, projectId, specId } = ctx;
@@ -7,8 +9,8 @@ async function handler(ctx) {
7
9
  }
8
10
  const start = Date.now();
9
11
  try {
10
- const { generateSessionContext } = await import('../../session-context-generator.js');
11
- await generateSessionContext(projectPath, projectId);
12
+ const { refreshSessionArtifacts } = await import('../../session-state/session-artifact-refresher.js');
13
+ await refreshSessionArtifacts(projectPath, projectId);
12
14
  }
13
15
  catch (err) {
14
16
  const error = err instanceof Error ? err.message : String(err);
@@ -1,3 +1,4 @@
1
+ // eslint-disable-next-line no-restricted-imports -- grandfathered layer violation, remediation SPEC-1661 SPEC-1662 SPEC-1663
1
2
  import { getSlackConfig, appendDelivery } from '../../../storage/slack-store.js';
2
3
  import { buildSpecPayload, dispatchToSlack } from '../../../engine/slack-dispatcher.js';
3
4
  async function handler(ctx) {
@@ -1,6 +1,8 @@
1
1
  import { recordStatusChange } from '../../autopilot/state-updater.js';
2
2
  import { withAudit } from '../../autopilot/audit-logger.js';
3
+ // eslint-disable-next-line no-restricted-imports -- grandfathered layer violation, remediation SPEC-1661 SPEC-1662 SPEC-1663
3
4
  import { appendAutopilotLogEntry } from '../../../storage/autopilot-log-store.js';
5
+ // eslint-disable-next-line no-restricted-imports -- grandfathered layer violation, remediation SPEC-1661 SPEC-1662 SPEC-1663
4
6
  import { hashProjectPath } from '../../../storage/base-store.js';
5
7
  async function handler(ctx) {
6
8
  const { projectPath, projectId, specId, newStatus, currentStatus } = ctx;
@@ -1,5 +1,7 @@
1
+ // eslint-disable-next-line no-restricted-imports -- grandfathered layer violation, remediation SPEC-1661 SPEC-1662 SPEC-1663
1
2
  import { hashProjectPath } from '../../../storage/base-store.js';
2
3
  import { measureVelocity } from '../../velocity/measure-velocity.js';
4
+ // eslint-disable-next-line no-restricted-imports -- grandfathered layer violation, remediation SPEC-1661 SPEC-1662 SPEC-1663
3
5
  import { saveVelocityProfile } from '../../../storage/velocity-store.js';
4
6
  async function handler(ctx) {
5
7
  const { projectPath } = ctx;
@@ -1,7 +1,9 @@
1
1
  // engine/cascade-hooks/runner.ts — SPEC-714: Cascade runner
2
2
  // SPEC-772: fast hooks (hook.fast === true) are awaited synchronously (2s budget)
3
3
  import { HOOKS } from './registry.js';
4
+ // eslint-disable-next-line no-restricted-imports -- grandfathered layer violation, remediation SPEC-1661 SPEC-1662 SPEC-1663
4
5
  import { writeSessionJson } from './core/write-session-json.js';
6
+ // eslint-disable-next-line no-restricted-imports -- grandfathered layer violation, remediation SPEC-1661 SPEC-1662 SPEC-1663
5
7
  import { appendReleasesPending } from './core/append-releases.js';
6
8
  const FAST_HOOK_BUDGET_MS = 2000;
7
9
  export async function runCascade(ctx, opts) {
@@ -2,7 +2,9 @@
2
2
  // Detects drift between in-memory spec store and canonical Planu state files.
3
3
  import { readFile } from 'node:fs/promises';
4
4
  import { join } from 'node:path';
5
+ // eslint-disable-next-line no-restricted-imports -- grandfathered layer violation, remediation SPEC-1661 SPEC-1662 SPEC-1663
5
6
  import { specStore } from '../../storage/index.js';
7
+ // eslint-disable-next-line no-restricted-imports -- grandfathered layer violation, remediation SPEC-1661 SPEC-1662 SPEC-1663
6
8
  import { hashProjectPath, projectDataDir } from '../../storage/base-store.js';
7
9
  function externalStatusPath(projectPath) {
8
10
  return join(projectDataDir(hashProjectPath(projectPath)), 'status.json');
@@ -1,5 +1,7 @@
1
1
  // engine/checkpoint/checkpoint-manager.ts — Checkpoint lifecycle management (SPEC-411)
2
+ // eslint-disable-next-line no-restricted-imports -- grandfathered layer violation, remediation SPEC-1661 SPEC-1662 SPEC-1663
2
3
  import { hashProjectPath } from '../../storage/base-store.js';
4
+ // eslint-disable-next-line no-restricted-imports -- grandfathered layer violation, remediation SPEC-1661 SPEC-1662 SPEC-1663
3
5
  import { createWorkflowCheckpoint, resolveWorkflowCheckpoint, getPendingWorkflowCheckpoints, } from '../../storage/workflow-checkpoint-store.js';
4
6
  // ---------------------------------------------------------------------------
5
7
  // Request
@@ -1,4 +1,5 @@
1
1
  // engine/checkpoint/policy-engine.ts — Checkpoint policy evaluation (SPEC-411)
2
+ // eslint-disable-next-line no-restricted-imports -- grandfathered layer violation, remediation SPEC-1661 SPEC-1662 SPEC-1663
2
3
  import { readJson, writeJson, projectDataDir, hashProjectPath } from '../../storage/base-store.js';
3
4
  // ---------------------------------------------------------------------------
4
5
  // Built-in presets
@@ -1,16 +1,8 @@
1
1
  // ci-generator/stack-detector.ts — Detect project stack for CI generation (SPEC-066)
2
- import { readFile, access } from 'node:fs/promises';
2
+ import { readFile } from 'node:fs/promises';
3
3
  import { join } from 'node:path';
4
+ import { fileExists } from '../../core/shared/fs.js';
4
5
  // -- File existence helper ---------------------------------------------------
5
- async function fileExists(filePath) {
6
- try {
7
- await access(filePath);
8
- return true;
9
- }
10
- catch {
11
- return false;
12
- }
13
- }
14
6
  async function readTextSafe(filePath) {
15
7
  try {
16
8
  return await readFile(filePath, 'utf-8');
@@ -2,6 +2,7 @@
2
2
  // Persists tokens in data/projects/{hash}/pending-clarifications.json with 5-min TTL.
3
3
  // Lazy expiry: expired tokens are pruned on every read, no background process.
4
4
  import { createHash } from 'node:crypto';
5
+ // eslint-disable-next-line no-restricted-imports -- grandfathered layer violation, remediation SPEC-1661 SPEC-1662 SPEC-1663
5
6
  import { readJson, writeJson, projectDataDir } from '../../storage/index.js';
6
7
  import { join } from 'node:path';
7
8
  export const CLARIFICATION_TOKEN_TTL_MS = 5 * 60 * 1000;
@@ -1,7 +1,8 @@
1
1
  // Planu — CLAUDE.md auditor for SPEC-092 / SPEC-255
2
- import { readFile, access } from 'node:fs/promises';
2
+ import { readFile } from 'node:fs/promises';
3
3
  import { homedir } from 'node:os';
4
4
  import { join } from 'node:path';
5
+ import { pathExists } from '../../core/shared/fs.js';
5
6
  const DOCS_REF = 'https://code.claude.com/docs/en/memory';
6
7
  const MAX_LINES = 200;
7
8
  const CRITICAL_LINES = 400;
@@ -20,15 +21,6 @@ async function readFileLines(filePath) {
20
21
  return null;
21
22
  }
22
23
  }
23
- async function pathExists(p) {
24
- try {
25
- await access(p);
26
- return true;
27
- }
28
- catch {
29
- return false;
30
- }
31
- }
32
24
  function auditLineCount(lineCount, label) {
33
25
  if (lineCount > V2_CRITICAL_LINES) {
34
26
  return {
@@ -1,6 +1,7 @@
1
1
  // Planu — Settings and extensions auditor for SPEC-092, SPEC-374
2
- import { readFile, access } from 'node:fs/promises';
2
+ import { readFile } from 'node:fs/promises';
3
3
  import { join } from 'node:path';
4
+ import { pathExists } from '../../core/shared/fs.js';
4
5
  const DOCS_REF = 'https://code.claude.com/docs/en/settings';
5
6
  const RTK_DOCS_REF = 'https://github.com/planu-dev/rtk';
6
7
  async function readSettings(filePath) {
@@ -12,15 +13,6 @@ async function readSettings(filePath) {
12
13
  return null;
13
14
  }
14
15
  }
15
- async function pathExists(p) {
16
- try {
17
- await access(p);
18
- return true;
19
- }
20
- catch {
21
- return false;
22
- }
23
- }
24
16
  function settingsHasRtkHook(data) {
25
17
  const preToolUse = data.hooks?.PreToolUse;
26
18
  if (!Array.isArray(preToolUse)) {
@@ -1,8 +1,9 @@
1
1
  // @crash-shield-ignore-file — config/cache reader for Planu-controlled JSON; writer is this codebase, shape guaranteed by build/seed.
2
2
  // engine/client-detection.ts — SPEC-645: 4-signal cascade LLM client detection
3
- import { readFile, writeFile, access, mkdir } from 'node:fs/promises';
3
+ import { readFile, writeFile, mkdir } from 'node:fs/promises';
4
4
  import { join } from 'node:path';
5
5
  import { getConnectedClient } from './llm-runtime/index.js';
6
+ import { pathExists } from '../core/shared/fs.js';
6
7
  // Signal 2: file paths that indicate a specific client
7
8
  const FILE_SIGNALS = [
8
9
  { path: '.cursor', client: 'cursor' },
@@ -43,15 +44,6 @@ function normalizeClientName(name) {
43
44
  }
44
45
  return 'unknown';
45
46
  }
46
- async function pathExists(p) {
47
- try {
48
- await access(p);
49
- return true;
50
- }
51
- catch {
52
- return false;
53
- }
54
- }
55
47
  /** Signal 1: MCP handshake clientInfo.name */
56
48
  function detectFromHandshake() {
57
49
  const client = getConnectedClient();
@@ -1,6 +1,7 @@
1
1
  // engine/compliance/auto-remediator.ts — Auto-remediation for compliance gaps (SPEC-408)
2
2
  import { mkdir, writeFile, access } from 'node:fs/promises';
3
3
  import { join } from 'node:path';
4
+ // eslint-disable-next-line no-restricted-imports -- grandfathered layer violation, remediation SPEC-1661 SPEC-1662 SPEC-1663
4
5
  import { specStore } from '../../storage/index.js';
5
6
  import { analyzeComplianceGaps } from './gap-analyzer.js';
6
7
  const FRAMEWORK_MAP = {
@@ -1,5 +1,5 @@
1
1
  import type { ComplianceEvidencePackage } from '../../types/index.js';
2
- import type { ComplianceFramework } from './framework-catalog.js';
2
+ import type { ComplianceCatalogFramework } from './framework-catalog.js';
3
3
  interface SpecInput {
4
4
  id: string;
5
5
  title: string;
@@ -14,6 +14,6 @@ interface AuditEventInput {
14
14
  specId: string;
15
15
  actor?: string;
16
16
  }
17
- export declare function buildEvidencePackage(framework: ComplianceFramework, projectId: string, specs: SpecInput[], auditEvents: AuditEventInput[]): ComplianceEvidencePackage;
17
+ export declare function buildEvidencePackage(framework: ComplianceCatalogFramework, projectId: string, specs: SpecInput[], auditEvents: AuditEventInput[]): ComplianceEvidencePackage;
18
18
  export {};
19
19
  //# sourceMappingURL=evidence-builder.d.ts.map
@@ -1,15 +1,15 @@
1
1
  import type { EnterpriseComplianceFramework } from '../../types/index.js';
2
2
  /** Local alias for the enterprise compliance framework union type. */
3
- export type ComplianceFramework = EnterpriseComplianceFramework;
4
- export interface ComplianceControl {
3
+ export type ComplianceCatalogFramework = EnterpriseComplianceFramework;
4
+ export interface ComplianceCatalogControl {
5
5
  id: string;
6
- framework: ComplianceFramework;
6
+ framework: ComplianceCatalogFramework;
7
7
  name: string;
8
8
  description: string;
9
9
  specPatterns: string[];
10
10
  requiredCriteria: string[];
11
11
  }
12
- export declare const COMPLIANCE_CATALOG: ComplianceControl[];
13
- export declare function getControlsForFramework(framework: ComplianceFramework): ComplianceControl[];
14
- export declare function findMatchingControls(framework: ComplianceFramework, specTitle: string, specDescription: string): ComplianceControl[];
12
+ export declare const COMPLIANCE_CATALOG: ComplianceCatalogControl[];
13
+ export declare function getControlsForFramework(framework: ComplianceCatalogFramework): ComplianceCatalogControl[];
14
+ export declare function findMatchingControls(framework: ComplianceCatalogFramework, specTitle: string, specDescription: string): ComplianceCatalogControl[];
15
15
  //# sourceMappingURL=framework-catalog.d.ts.map
@@ -1,11 +1,11 @@
1
1
  import type { ComplianceGapResult } from '../../types/index.js';
2
- import { type ComplianceFramework } from './framework-catalog.js';
2
+ import { type ComplianceCatalogFramework } from './framework-catalog.js';
3
3
  interface SpecInput {
4
4
  id: string;
5
5
  title: string;
6
6
  description?: string;
7
7
  status: string;
8
8
  }
9
- export declare function analyzeComplianceGaps(framework: ComplianceFramework, specs: SpecInput[]): ComplianceGapResult;
9
+ export declare function analyzeComplianceGaps(framework: ComplianceCatalogFramework, specs: SpecInput[]): ComplianceGapResult;
10
10
  export {};
11
11
  //# sourceMappingURL=gap-analyzer.d.ts.map
@@ -3,20 +3,12 @@
3
3
  // C7: vite.config.ts not in tsconfig include → error
4
4
  // C8: rolldown bundler + this.emitFile in config → warning
5
5
  // C9: Vite 7+ with explicit es5/es6 target → info
6
- import { readFile } from 'node:fs/promises';
7
6
  import { join } from 'node:path';
8
7
  import { detectBuildTool } from '../build-tool-detector.js';
8
+ import { readFileSafe } from '../../core/shared/fs.js';
9
9
  // ---------------------------------------------------------------------------
10
10
  // Helpers
11
11
  // ---------------------------------------------------------------------------
12
- async function readFileSafe(filePath) {
13
- try {
14
- return await readFile(filePath, 'utf-8');
15
- }
16
- catch {
17
- return '';
18
- }
19
- }
20
12
  function parseVersionMajor(version) {
21
13
  if (!version) {
22
14
  return null;
@@ -1,4 +1,5 @@
1
- export declare function readFileSafe(filePath: string): Promise<string>;
1
+ import { readFileSafe } from '../../core/shared/fs.js';
2
+ export { readFileSafe };
2
3
  export declare function fileExists(filePath: string): Promise<boolean>;
3
4
  export declare function collectProjectCommands(projectPath: string): Promise<{
4
5
  packageScripts: Set<string>;
@@ -1,16 +1,9 @@
1
1
  // engine/config-health/ci-commands-collector.ts — SPEC-042
2
2
  // Helpers to collect available commands/scripts in a project.
3
- import { readFile } from 'node:fs/promises';
4
3
  import { join } from 'node:path';
5
4
  import { glob } from 'glob';
6
- export async function readFileSafe(filePath) {
7
- try {
8
- return await readFile(filePath, 'utf-8');
9
- }
10
- catch {
11
- return '';
12
- }
13
- }
5
+ import { readFileSafe } from '../../core/shared/fs.js';
6
+ export { readFileSafe };
14
7
  export async function fileExists(filePath) {
15
8
  const c = await readFileSafe(filePath);
16
9
  return c !== '';
@@ -1,20 +1,12 @@
1
1
  // engine/config-health/go-checker.ts — SPEC-042
2
2
  // Go project configuration health checks.
3
- import { readFile } from 'node:fs/promises';
4
3
  import { join } from 'node:path';
5
4
  import { glob } from 'glob';
6
5
  import healthSchemas from '../../config/config-health-schemas.json' with { type: 'json' };
6
+ import { readFileSafe } from '../../core/shared/fs.js';
7
7
  // ---------------------------------------------------------------------------
8
8
  // Helpers
9
9
  // ---------------------------------------------------------------------------
10
- async function readFileSafe(filePath) {
11
- try {
12
- return await readFile(filePath, 'utf-8');
13
- }
14
- catch {
15
- return '';
16
- }
17
- }
18
10
  // ---------------------------------------------------------------------------
19
11
  // go.mod parser helpers
20
12
  // ---------------------------------------------------------------------------
@@ -1,18 +1,10 @@
1
1
  // engine/config-health/mcp-config-checker.ts — SPEC-1062
2
2
  // Detects unsafe Planu MCP host configuration.
3
- import { access, readFile } from 'node:fs/promises';
3
+ import { readFile } from 'node:fs/promises';
4
4
  import { homedir } from 'node:os';
5
5
  import { isAbsolute, join } from 'node:path';
6
+ import { fileExists } from '../../core/shared/fs.js';
6
7
  import { PLANU_VERSION } from '../../config/version.js';
7
- async function fileExists(path) {
8
- try {
9
- await access(path);
10
- return true;
11
- }
12
- catch {
13
- return false;
14
- }
15
- }
16
8
  async function readIfExists(path) {
17
9
  try {
18
10
  return await readFile(path, 'utf-8');
@@ -1,19 +1,11 @@
1
1
  // engine/config-health/python-checker.ts — SPEC-042
2
2
  // Python project configuration health checks.
3
- import { readFile } from 'node:fs/promises';
4
3
  import { join } from 'node:path';
5
4
  import healthSchemas from '../../config/config-health-schemas.json' with { type: 'json' };
5
+ import { readFileSafe } from '../../core/shared/fs.js';
6
6
  // ---------------------------------------------------------------------------
7
7
  // Helpers
8
8
  // ---------------------------------------------------------------------------
9
- async function readFileSafe(filePath) {
10
- try {
11
- return await readFile(filePath, 'utf-8');
12
- }
13
- catch {
14
- return '';
15
- }
16
- }
17
9
  // ---------------------------------------------------------------------------
18
10
  // TOML parser (minimal — no external deps)
19
11
  // ---------------------------------------------------------------------------