@planu/cli 1.10.0 → 1.12.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 (323) hide show
  1. package/dist/config/license-plans.json +32 -2
  2. package/dist/engine/api-compat/compatibility-checker.d.ts +4 -0
  3. package/dist/engine/api-compat/compatibility-checker.d.ts.map +1 -0
  4. package/dist/engine/api-compat/compatibility-checker.js +118 -0
  5. package/dist/engine/api-compat/compatibility-checker.js.map +1 -0
  6. package/dist/engine/checkpoint/checkpoint-manager.d.ts +22 -0
  7. package/dist/engine/checkpoint/checkpoint-manager.d.ts.map +1 -0
  8. package/dist/engine/checkpoint/checkpoint-manager.js +76 -0
  9. package/dist/engine/checkpoint/checkpoint-manager.js.map +1 -0
  10. package/dist/engine/checkpoint/policy-engine.d.ts +10 -0
  11. package/dist/engine/checkpoint/policy-engine.d.ts.map +1 -0
  12. package/dist/engine/checkpoint/policy-engine.js +87 -0
  13. package/dist/engine/checkpoint/policy-engine.js.map +1 -0
  14. package/dist/engine/compliance/auto-remediator.d.ts +9 -0
  15. package/dist/engine/compliance/auto-remediator.d.ts.map +1 -0
  16. package/dist/engine/compliance/auto-remediator.js +118 -0
  17. package/dist/engine/compliance/auto-remediator.js.map +1 -0
  18. package/dist/engine/compliance/evidence-builder.d.ts +19 -0
  19. package/dist/engine/compliance/evidence-builder.d.ts.map +1 -0
  20. package/dist/engine/compliance/evidence-builder.js +36 -0
  21. package/dist/engine/compliance/evidence-builder.js.map +1 -0
  22. package/dist/engine/compliance/framework-catalog.d.ts +15 -0
  23. package/dist/engine/compliance/framework-catalog.d.ts.map +1 -0
  24. package/dist/engine/compliance/framework-catalog.js +134 -0
  25. package/dist/engine/compliance/framework-catalog.js.map +1 -0
  26. package/dist/engine/compliance/gap-analyzer.d.ts +11 -0
  27. package/dist/engine/compliance/gap-analyzer.d.ts.map +1 -0
  28. package/dist/engine/compliance/gap-analyzer.js +39 -0
  29. package/dist/engine/compliance/gap-analyzer.js.map +1 -0
  30. package/dist/engine/context-profile/profile-catalog.d.ts +5 -0
  31. package/dist/engine/context-profile/profile-catalog.d.ts.map +1 -0
  32. package/dist/engine/context-profile/profile-catalog.js +145 -0
  33. package/dist/engine/context-profile/profile-catalog.js.map +1 -0
  34. package/dist/engine/critical-path/path-analyzer.d.ts +3 -0
  35. package/dist/engine/critical-path/path-analyzer.d.ts.map +1 -0
  36. package/dist/engine/critical-path/path-analyzer.js +145 -0
  37. package/dist/engine/critical-path/path-analyzer.js.map +1 -0
  38. package/dist/engine/distribution/cost-estimator.d.ts +8 -0
  39. package/dist/engine/distribution/cost-estimator.d.ts.map +1 -0
  40. package/dist/engine/distribution/cost-estimator.js +113 -0
  41. package/dist/engine/distribution/cost-estimator.js.map +1 -0
  42. package/dist/engine/distribution/diagram-generator.d.ts +12 -0
  43. package/dist/engine/distribution/diagram-generator.d.ts.map +1 -0
  44. package/dist/engine/distribution/diagram-generator.js +59 -0
  45. package/dist/engine/distribution/diagram-generator.js.map +1 -0
  46. package/dist/engine/distribution/readiness-analyzer.d.ts +4 -0
  47. package/dist/engine/distribution/readiness-analyzer.d.ts.map +1 -0
  48. package/dist/engine/distribution/readiness-analyzer.js +61 -0
  49. package/dist/engine/distribution/readiness-analyzer.js.map +1 -0
  50. package/dist/engine/distribution/runbook-generator.d.ts +7 -0
  51. package/dist/engine/distribution/runbook-generator.d.ts.map +1 -0
  52. package/dist/engine/distribution/runbook-generator.js +42 -0
  53. package/dist/engine/distribution/runbook-generator.js.map +1 -0
  54. package/dist/engine/drift/violation-resolver.d.ts +9 -0
  55. package/dist/engine/drift/violation-resolver.d.ts.map +1 -0
  56. package/dist/engine/drift/violation-resolver.js +128 -0
  57. package/dist/engine/drift/violation-resolver.js.map +1 -0
  58. package/dist/engine/ears/criterion-scorer.d.ts +7 -0
  59. package/dist/engine/ears/criterion-scorer.d.ts.map +1 -0
  60. package/dist/engine/ears/criterion-scorer.js +87 -0
  61. package/dist/engine/ears/criterion-scorer.js.map +1 -0
  62. package/dist/engine/ears/pattern-matcher.d.ts +5 -0
  63. package/dist/engine/ears/pattern-matcher.d.ts.map +1 -0
  64. package/dist/engine/ears/pattern-matcher.js +48 -0
  65. package/dist/engine/ears/pattern-matcher.js.map +1 -0
  66. package/dist/engine/ears/rewriter.d.ts +7 -0
  67. package/dist/engine/ears/rewriter.d.ts.map +1 -0
  68. package/dist/engine/ears/rewriter.js +45 -0
  69. package/dist/engine/ears/rewriter.js.map +1 -0
  70. package/dist/engine/ears/spec-linter.d.ts +7 -0
  71. package/dist/engine/ears/spec-linter.d.ts.map +1 -0
  72. package/dist/engine/ears/spec-linter.js +127 -0
  73. package/dist/engine/ears/spec-linter.js.map +1 -0
  74. package/dist/engine/health/auto-fixer.d.ts +7 -0
  75. package/dist/engine/health/auto-fixer.d.ts.map +1 -0
  76. package/dist/engine/health/auto-fixer.js +130 -0
  77. package/dist/engine/health/auto-fixer.js.map +1 -0
  78. package/dist/engine/mcp-catalog/catalog-advisor.d.ts +3 -0
  79. package/dist/engine/mcp-catalog/catalog-advisor.d.ts.map +1 -0
  80. package/dist/engine/mcp-catalog/catalog-advisor.js +180 -0
  81. package/dist/engine/mcp-catalog/catalog-advisor.js.map +1 -0
  82. package/dist/engine/mcp-hub/adapter-registry.d.ts +23 -0
  83. package/dist/engine/mcp-hub/adapter-registry.d.ts.map +1 -0
  84. package/dist/engine/mcp-hub/adapter-registry.js +19 -0
  85. package/dist/engine/mcp-hub/adapter-registry.js.map +1 -0
  86. package/dist/engine/mcp-hub/adapters/github-adapter.d.ts +4 -0
  87. package/dist/engine/mcp-hub/adapters/github-adapter.d.ts.map +1 -0
  88. package/dist/engine/mcp-hub/adapters/github-adapter.js +44 -0
  89. package/dist/engine/mcp-hub/adapters/github-adapter.js.map +1 -0
  90. package/dist/engine/mcp-hub/adapters/supabase-adapter.d.ts +4 -0
  91. package/dist/engine/mcp-hub/adapters/supabase-adapter.d.ts.map +1 -0
  92. package/dist/engine/mcp-hub/adapters/supabase-adapter.js +41 -0
  93. package/dist/engine/mcp-hub/adapters/supabase-adapter.js.map +1 -0
  94. package/dist/engine/mcp-hub/event-router.d.ts +19 -0
  95. package/dist/engine/mcp-hub/event-router.d.ts.map +1 -0
  96. package/dist/engine/mcp-hub/event-router.js +47 -0
  97. package/dist/engine/mcp-hub/event-router.js.map +1 -0
  98. package/dist/engine/productivity/calibration-engine.d.ts +17 -0
  99. package/dist/engine/productivity/calibration-engine.d.ts.map +1 -0
  100. package/dist/engine/productivity/calibration-engine.js +49 -0
  101. package/dist/engine/productivity/calibration-engine.js.map +1 -0
  102. package/dist/engine/productivity/time-tracker.d.ts +6 -0
  103. package/dist/engine/productivity/time-tracker.d.ts.map +1 -0
  104. package/dist/engine/productivity/time-tracker.js +28 -0
  105. package/dist/engine/productivity/time-tracker.js.map +1 -0
  106. package/dist/engine/productivity/vibe-tax-calculator.d.ts +14 -0
  107. package/dist/engine/productivity/vibe-tax-calculator.d.ts.map +1 -0
  108. package/dist/engine/productivity/vibe-tax-calculator.js +63 -0
  109. package/dist/engine/productivity/vibe-tax-calculator.js.map +1 -0
  110. package/dist/engine/quality-gates/gate-catalog.d.ts +6 -0
  111. package/dist/engine/quality-gates/gate-catalog.d.ts.map +1 -0
  112. package/dist/engine/quality-gates/gate-catalog.js +351 -0
  113. package/dist/engine/quality-gates/gate-catalog.js.map +1 -0
  114. package/dist/engine/quality-gates/gate-evaluator.d.ts +3 -0
  115. package/dist/engine/quality-gates/gate-evaluator.d.ts.map +1 -0
  116. package/dist/engine/quality-gates/gate-evaluator.js +25 -0
  117. package/dist/engine/quality-gates/gate-evaluator.js.map +1 -0
  118. package/dist/engine/quality-gates/gate-injector.d.ts +20 -0
  119. package/dist/engine/quality-gates/gate-injector.d.ts.map +1 -0
  120. package/dist/engine/quality-gates/gate-injector.js +75 -0
  121. package/dist/engine/quality-gates/gate-injector.js.map +1 -0
  122. package/dist/engine/similar-problems/similarity-finder.d.ts +3 -0
  123. package/dist/engine/similar-problems/similarity-finder.d.ts.map +1 -0
  124. package/dist/engine/similar-problems/similarity-finder.js +144 -0
  125. package/dist/engine/similar-problems/similarity-finder.js.map +1 -0
  126. package/dist/engine/sync/asana-puller.d.ts +9 -0
  127. package/dist/engine/sync/asana-puller.d.ts.map +1 -0
  128. package/dist/engine/sync/asana-puller.js +91 -0
  129. package/dist/engine/sync/asana-puller.js.map +1 -0
  130. package/dist/engine/sync/conflict-resolver.d.ts +17 -0
  131. package/dist/engine/sync/conflict-resolver.d.ts.map +1 -0
  132. package/dist/engine/sync/conflict-resolver.js +58 -0
  133. package/dist/engine/sync/conflict-resolver.js.map +1 -0
  134. package/dist/engine/sync/monday-puller.d.ts +9 -0
  135. package/dist/engine/sync/monday-puller.d.ts.map +1 -0
  136. package/dist/engine/sync/monday-puller.js +110 -0
  137. package/dist/engine/sync/monday-puller.js.map +1 -0
  138. package/dist/engine/sync/notion-puller.d.ts +15 -0
  139. package/dist/engine/sync/notion-puller.d.ts.map +1 -0
  140. package/dist/engine/sync/notion-puller.js +101 -0
  141. package/dist/engine/sync/notion-puller.js.map +1 -0
  142. package/dist/engine/verifier/code-scanner.d.ts +8 -0
  143. package/dist/engine/verifier/code-scanner.d.ts.map +1 -0
  144. package/dist/engine/verifier/code-scanner.js +73 -0
  145. package/dist/engine/verifier/code-scanner.js.map +1 -0
  146. package/dist/engine/verifier/compliance-scorer.d.ts +17 -0
  147. package/dist/engine/verifier/compliance-scorer.d.ts.map +1 -0
  148. package/dist/engine/verifier/compliance-scorer.js +131 -0
  149. package/dist/engine/verifier/compliance-scorer.js.map +1 -0
  150. package/dist/engine/verifier/criterion-matcher.d.ts +15 -0
  151. package/dist/engine/verifier/criterion-matcher.d.ts.map +1 -0
  152. package/dist/engine/verifier/criterion-matcher.js +210 -0
  153. package/dist/engine/verifier/criterion-matcher.js.map +1 -0
  154. package/dist/index.js +24 -0
  155. package/dist/index.js.map +1 -1
  156. package/dist/storage/compliance-audit-store.d.ts +12 -0
  157. package/dist/storage/compliance-audit-store.d.ts.map +1 -0
  158. package/dist/storage/compliance-audit-store.js +40 -0
  159. package/dist/storage/compliance-audit-store.js.map +1 -0
  160. package/dist/storage/compliance-score-store.d.ts +16 -0
  161. package/dist/storage/compliance-score-store.d.ts.map +1 -0
  162. package/dist/storage/compliance-score-store.js +30 -0
  163. package/dist/storage/compliance-score-store.js.map +1 -0
  164. package/dist/storage/context-profile-store.d.ts +14 -0
  165. package/dist/storage/context-profile-store.d.ts.map +1 -0
  166. package/dist/storage/context-profile-store.js +34 -0
  167. package/dist/storage/context-profile-store.js.map +1 -0
  168. package/dist/storage/mcp-hub-store.d.ts +9 -0
  169. package/dist/storage/mcp-hub-store.d.ts.map +1 -0
  170. package/dist/storage/mcp-hub-store.js +28 -0
  171. package/dist/storage/mcp-hub-store.js.map +1 -0
  172. package/dist/storage/time-tracking-store.d.ts +6 -0
  173. package/dist/storage/time-tracking-store.d.ts.map +1 -0
  174. package/dist/storage/time-tracking-store.js +34 -0
  175. package/dist/storage/time-tracking-store.js.map +1 -0
  176. package/dist/storage/workflow-checkpoint-store.d.ts +16 -0
  177. package/dist/storage/workflow-checkpoint-store.d.ts.map +1 -0
  178. package/dist/storage/workflow-checkpoint-store.js +71 -0
  179. package/dist/storage/workflow-checkpoint-store.js.map +1 -0
  180. package/dist/tools/checkpoint/approve-checkpoint-handler.d.ts +3 -0
  181. package/dist/tools/checkpoint/approve-checkpoint-handler.d.ts.map +1 -0
  182. package/dist/tools/checkpoint/approve-checkpoint-handler.js +32 -0
  183. package/dist/tools/checkpoint/approve-checkpoint-handler.js.map +1 -0
  184. package/dist/tools/checkpoint/configure-policy-handler.d.ts +3 -0
  185. package/dist/tools/checkpoint/configure-policy-handler.d.ts.map +1 -0
  186. package/dist/tools/checkpoint/configure-policy-handler.js +60 -0
  187. package/dist/tools/checkpoint/configure-policy-handler.js.map +1 -0
  188. package/dist/tools/checkpoint/list-checkpoints-handler.d.ts +3 -0
  189. package/dist/tools/checkpoint/list-checkpoints-handler.d.ts.map +1 -0
  190. package/dist/tools/checkpoint/list-checkpoints-handler.js +25 -0
  191. package/dist/tools/checkpoint/list-checkpoints-handler.js.map +1 -0
  192. package/dist/tools/checkpoint/reject-checkpoint-handler.d.ts +3 -0
  193. package/dist/tools/checkpoint/reject-checkpoint-handler.d.ts.map +1 -0
  194. package/dist/tools/checkpoint/reject-checkpoint-handler.js +32 -0
  195. package/dist/tools/checkpoint/reject-checkpoint-handler.js.map +1 -0
  196. package/dist/tools/checkpoint/require-checkpoint-handler.d.ts +3 -0
  197. package/dist/tools/checkpoint/require-checkpoint-handler.d.ts.map +1 -0
  198. package/dist/tools/checkpoint/require-checkpoint-handler.js +44 -0
  199. package/dist/tools/checkpoint/require-checkpoint-handler.js.map +1 -0
  200. package/dist/tools/compliance-gap-handler.d.ts +5 -0
  201. package/dist/tools/compliance-gap-handler.d.ts.map +1 -0
  202. package/dist/tools/compliance-gap-handler.js +64 -0
  203. package/dist/tools/compliance-gap-handler.js.map +1 -0
  204. package/dist/tools/distribution-readiness-handler.d.ts +3 -0
  205. package/dist/tools/distribution-readiness-handler.d.ts.map +1 -0
  206. package/dist/tools/distribution-readiness-handler.js +24 -0
  207. package/dist/tools/distribution-readiness-handler.js.map +1 -0
  208. package/dist/tools/generate-cost-estimate-handler.d.ts +3 -0
  209. package/dist/tools/generate-cost-estimate-handler.d.ts.map +1 -0
  210. package/dist/tools/generate-cost-estimate-handler.js +29 -0
  211. package/dist/tools/generate-cost-estimate-handler.js.map +1 -0
  212. package/dist/tools/generate-deployment-diagram-handler.d.ts +3 -0
  213. package/dist/tools/generate-deployment-diagram-handler.d.ts.map +1 -0
  214. package/dist/tools/generate-deployment-diagram-handler.js +26 -0
  215. package/dist/tools/generate-deployment-diagram-handler.js.map +1 -0
  216. package/dist/tools/generate-runbook-handler.d.ts +3 -0
  217. package/dist/tools/generate-runbook-handler.d.ts.map +1 -0
  218. package/dist/tools/generate-runbook-handler.js +18 -0
  219. package/dist/tools/generate-runbook-handler.js.map +1 -0
  220. package/dist/tools/inject-quality-gates-handler.d.ts +7 -0
  221. package/dist/tools/inject-quality-gates-handler.d.ts.map +1 -0
  222. package/dist/tools/inject-quality-gates-handler.js +59 -0
  223. package/dist/tools/inject-quality-gates-handler.js.map +1 -0
  224. package/dist/tools/mcp-hub-handler.d.ts +7 -0
  225. package/dist/tools/mcp-hub-handler.d.ts.map +1 -0
  226. package/dist/tools/mcp-hub-handler.js +73 -0
  227. package/dist/tools/mcp-hub-handler.js.map +1 -0
  228. package/dist/tools/productivity-report-handler.d.ts +4 -0
  229. package/dist/tools/productivity-report-handler.d.ts.map +1 -0
  230. package/dist/tools/productivity-report-handler.js +98 -0
  231. package/dist/tools/productivity-report-handler.js.map +1 -0
  232. package/dist/tools/pull-sync-handler.d.ts +25 -0
  233. package/dist/tools/pull-sync-handler.d.ts.map +1 -0
  234. package/dist/tools/pull-sync-handler.js +161 -0
  235. package/dist/tools/pull-sync-handler.js.map +1 -0
  236. package/dist/tools/register-auto-remediation.d.ts +3 -0
  237. package/dist/tools/register-auto-remediation.d.ts.map +1 -0
  238. package/dist/tools/register-auto-remediation.js +174 -0
  239. package/dist/tools/register-auto-remediation.js.map +1 -0
  240. package/dist/tools/register-checkpoints.d.ts +3 -0
  241. package/dist/tools/register-checkpoints.d.ts.map +1 -0
  242. package/dist/tools/register-checkpoints.js +134 -0
  243. package/dist/tools/register-checkpoints.js.map +1 -0
  244. package/dist/tools/register-context-profile.d.ts +3 -0
  245. package/dist/tools/register-context-profile.d.ts.map +1 -0
  246. package/dist/tools/register-context-profile.js +106 -0
  247. package/dist/tools/register-context-profile.js.map +1 -0
  248. package/dist/tools/register-distribution.d.ts +3 -0
  249. package/dist/tools/register-distribution.d.ts.map +1 -0
  250. package/dist/tools/register-distribution.js +103 -0
  251. package/dist/tools/register-distribution.js.map +1 -0
  252. package/dist/tools/register-ears.d.ts +3 -0
  253. package/dist/tools/register-ears.d.ts.map +1 -0
  254. package/dist/tools/register-ears.js +148 -0
  255. package/dist/tools/register-ears.js.map +1 -0
  256. package/dist/tools/register-enterprise-compliance.d.ts +3 -0
  257. package/dist/tools/register-enterprise-compliance.d.ts.map +1 -0
  258. package/dist/tools/register-enterprise-compliance.js +30 -0
  259. package/dist/tools/register-enterprise-compliance.js.map +1 -0
  260. package/dist/tools/register-mcp-hub.d.ts +3 -0
  261. package/dist/tools/register-mcp-hub.d.ts.map +1 -0
  262. package/dist/tools/register-mcp-hub.js +47 -0
  263. package/dist/tools/register-mcp-hub.js.map +1 -0
  264. package/dist/tools/register-productivity.d.ts +3 -0
  265. package/dist/tools/register-productivity.d.ts.map +1 -0
  266. package/dist/tools/register-productivity.js +25 -0
  267. package/dist/tools/register-productivity.js.map +1 -0
  268. package/dist/tools/register-pull-sync.d.ts +3 -0
  269. package/dist/tools/register-pull-sync.d.ts.map +1 -0
  270. package/dist/tools/register-pull-sync.js +71 -0
  271. package/dist/tools/register-pull-sync.js.map +1 -0
  272. package/dist/tools/register-quality-gates.d.ts +3 -0
  273. package/dist/tools/register-quality-gates.d.ts.map +1 -0
  274. package/dist/tools/register-quality-gates.js +47 -0
  275. package/dist/tools/register-quality-gates.js.map +1 -0
  276. package/dist/tools/register-spec405-tools.d.ts +7 -0
  277. package/dist/tools/register-spec405-tools.d.ts.map +1 -0
  278. package/dist/tools/register-spec405-tools.js +194 -0
  279. package/dist/tools/register-spec405-tools.js.map +1 -0
  280. package/dist/tools/register-verifier.d.ts +3 -0
  281. package/dist/tools/register-verifier.d.ts.map +1 -0
  282. package/dist/tools/register-verifier.js +141 -0
  283. package/dist/tools/register-verifier.js.map +1 -0
  284. package/dist/types/analysis.d.ts +128 -0
  285. package/dist/types/analysis.d.ts.map +1 -1
  286. package/dist/types/context-profile.d.ts +22 -0
  287. package/dist/types/context-profile.d.ts.map +1 -0
  288. package/dist/types/context-profile.js +2 -0
  289. package/dist/types/context-profile.js.map +1 -0
  290. package/dist/types/docs.d.ts +43 -0
  291. package/dist/types/docs.d.ts.map +1 -1
  292. package/dist/types/ears.d.ts +34 -0
  293. package/dist/types/ears.d.ts.map +1 -0
  294. package/dist/types/ears.js +3 -0
  295. package/dist/types/ears.js.map +1 -0
  296. package/dist/types/env.d.ts +23 -0
  297. package/dist/types/env.d.ts.map +1 -1
  298. package/dist/types/estimation.d.ts +30 -0
  299. package/dist/types/estimation.d.ts.map +1 -1
  300. package/dist/types/health.d.ts +40 -0
  301. package/dist/types/health.d.ts.map +1 -0
  302. package/dist/types/health.js +3 -0
  303. package/dist/types/health.js.map +1 -0
  304. package/dist/types/index.d.ts +4 -0
  305. package/dist/types/index.d.ts.map +1 -1
  306. package/dist/types/index.js +4 -0
  307. package/dist/types/index.js.map +1 -1
  308. package/dist/types/notion-asana-monday.d.ts +38 -0
  309. package/dist/types/notion-asana-monday.d.ts.map +1 -1
  310. package/dist/types/orchestration/index.d.ts +1 -0
  311. package/dist/types/orchestration/index.d.ts.map +1 -1
  312. package/dist/types/orchestration/mcp-hub.d.ts +29 -0
  313. package/dist/types/orchestration/mcp-hub.d.ts.map +1 -0
  314. package/dist/types/orchestration/mcp-hub.js +3 -0
  315. package/dist/types/orchestration/mcp-hub.js.map +1 -0
  316. package/dist/types/orchestration.d.ts +1 -1
  317. package/dist/types/orchestration.d.ts.map +1 -1
  318. package/dist/types/workflow-checkpoint.d.ts +66 -0
  319. package/dist/types/workflow-checkpoint.d.ts.map +1 -0
  320. package/dist/types/workflow-checkpoint.js +4 -0
  321. package/dist/types/workflow-checkpoint.js.map +1 -0
  322. package/package.json +1 -1
  323. package/src/config/license-plans.json +32 -2
@@ -0,0 +1,161 @@
1
+ import { pullFromNotion } from '../engine/sync/notion-puller.js';
2
+ import { pullFromAsana } from '../engine/sync/asana-puller.js';
3
+ import { pullFromMonday } from '../engine/sync/monday-puller.js';
4
+ import { getNotionConfig } from '../storage/notion-config-store.js';
5
+ import { getAsanaConfig } from '../storage/asana-config-store.js';
6
+ import { getMondayConfig } from '../storage/monday-config-store.js';
7
+ // ---------------------------------------------------------------------------
8
+ // pull_from_notion
9
+ // ---------------------------------------------------------------------------
10
+ export async function handlePullFromNotion(input) {
11
+ const strategy = input.conflictStrategy ?? 'spec-wins';
12
+ try {
13
+ const result = await pullFromNotion(input.projectPath, strategy);
14
+ return { content: [{ type: 'text', text: formatPullResult(result) }] };
15
+ }
16
+ catch (err) {
17
+ const message = err instanceof Error ? err.message : String(err);
18
+ return {
19
+ content: [{ type: 'text', text: `pull_from_notion failed: ${message}` }],
20
+ isError: true,
21
+ };
22
+ }
23
+ }
24
+ // ---------------------------------------------------------------------------
25
+ // pull_from_asana
26
+ // ---------------------------------------------------------------------------
27
+ export async function handlePullFromAsana(input) {
28
+ const strategy = input.conflictStrategy ?? 'spec-wins';
29
+ try {
30
+ const result = await pullFromAsana(input.projectPath, strategy);
31
+ return { content: [{ type: 'text', text: formatPullResult(result) }] };
32
+ }
33
+ catch (err) {
34
+ const message = err instanceof Error ? err.message : String(err);
35
+ return {
36
+ content: [{ type: 'text', text: `pull_from_asana failed: ${message}` }],
37
+ isError: true,
38
+ };
39
+ }
40
+ }
41
+ // ---------------------------------------------------------------------------
42
+ // pull_from_monday
43
+ // ---------------------------------------------------------------------------
44
+ export async function handlePullFromMonday(input) {
45
+ const strategy = input.conflictStrategy ?? 'spec-wins';
46
+ try {
47
+ const result = await pullFromMonday(input.projectPath, strategy);
48
+ return { content: [{ type: 'text', text: formatPullResult(result) }] };
49
+ }
50
+ catch (err) {
51
+ const message = err instanceof Error ? err.message : String(err);
52
+ return {
53
+ content: [{ type: 'text', text: `pull_from_monday failed: ${message}` }],
54
+ isError: true,
55
+ };
56
+ }
57
+ }
58
+ // ---------------------------------------------------------------------------
59
+ // sync_all_integrations
60
+ // ---------------------------------------------------------------------------
61
+ export async function handleSyncAllIntegrations(input) {
62
+ const strategy = input.conflictStrategy ?? 'spec-wins';
63
+ const summary = {
64
+ totalPulled: 0,
65
+ totalConflicts: 0,
66
+ conflictsResolved: 0,
67
+ };
68
+ const [notionConfig, asanaConfig, mondayConfig] = await Promise.all([
69
+ getNotionConfig(input.projectPath),
70
+ getAsanaConfig(input.projectPath),
71
+ getMondayConfig(input.projectPath),
72
+ ]);
73
+ if (notionConfig !== null) {
74
+ try {
75
+ const result = await pullFromNotion(input.projectPath, strategy);
76
+ summary.notion = result;
77
+ summary.totalPulled += result.pulled.length;
78
+ summary.totalConflicts += result.conflicts.length;
79
+ summary.conflictsResolved += result.conflicts.filter((c) => c.resolution !== 'pending-manual').length;
80
+ }
81
+ catch {
82
+ // Non-fatal: continue with other integrations
83
+ }
84
+ }
85
+ if (asanaConfig !== null) {
86
+ try {
87
+ const result = await pullFromAsana(input.projectPath, strategy);
88
+ summary.asana = result;
89
+ summary.totalPulled += result.pulled.length;
90
+ summary.totalConflicts += result.conflicts.length;
91
+ summary.conflictsResolved += result.conflicts.filter((c) => c.resolution !== 'pending-manual').length;
92
+ }
93
+ catch {
94
+ // Non-fatal: continue with other integrations
95
+ }
96
+ }
97
+ if (mondayConfig !== null) {
98
+ try {
99
+ const result = await pullFromMonday(input.projectPath, strategy);
100
+ summary.monday = result;
101
+ summary.totalPulled += result.pulled.length;
102
+ summary.totalConflicts += result.conflicts.length;
103
+ summary.conflictsResolved += result.conflicts.filter((c) => c.resolution !== 'pending-manual').length;
104
+ }
105
+ catch {
106
+ // Non-fatal: continue with other integrations
107
+ }
108
+ }
109
+ return { content: [{ type: 'text', text: formatSyncAllResult(summary) }] };
110
+ }
111
+ // ---------------------------------------------------------------------------
112
+ // Formatting helpers
113
+ // ---------------------------------------------------------------------------
114
+ function formatPullResult(result) {
115
+ const lines = [
116
+ `**${capitalize(result.integration)} Pull Sync** — ${result.executedAt.slice(0, 19)}`,
117
+ '',
118
+ `- Updates pulled: ${result.pulled.length}`,
119
+ `- Conflicts detected: ${result.conflicts.length}`,
120
+ `- New specs created: ${result.newSpecsCreated.length}`,
121
+ ];
122
+ if (result.pulled.length > 0) {
123
+ lines.push('', '**Applied Updates:**');
124
+ for (const u of result.pulled) {
125
+ lines.push(`- [${u.specId}] ${u.field}: \`${u.oldValue}\` → \`${u.newValue}\``);
126
+ }
127
+ }
128
+ if (result.conflicts.length > 0) {
129
+ lines.push('', '**Conflicts:**');
130
+ for (const c of result.conflicts) {
131
+ lines.push(`- [${c.specId}] ${c.field}: planu=\`${c.planuValue}\` vs external=\`${c.externalValue}\` → ${c.resolution}`);
132
+ }
133
+ }
134
+ return lines.join('\n');
135
+ }
136
+ function formatSyncAllResult(result) {
137
+ const active = [
138
+ result.notion !== undefined ? 'Notion' : null,
139
+ result.asana !== undefined ? 'Asana' : null,
140
+ result.monday !== undefined ? 'Monday.com' : null,
141
+ ]
142
+ .filter(Boolean)
143
+ .join(', ');
144
+ const lines = [
145
+ '**Sync All Integrations**',
146
+ '',
147
+ `Integrations synced: ${active !== '' ? active : 'none configured'}`,
148
+ '',
149
+ `| Metric | Value |`,
150
+ `|--------|-------|`,
151
+ `| Total pulled | ${result.totalPulled} |`,
152
+ `| Total conflicts | ${result.totalConflicts} |`,
153
+ `| Conflicts resolved | ${result.conflictsResolved} |`,
154
+ `| Pending manual | ${result.totalConflicts - result.conflictsResolved} |`,
155
+ ];
156
+ return lines.join('\n');
157
+ }
158
+ function capitalize(s) {
159
+ return s.charAt(0).toUpperCase() + s.slice(1);
160
+ }
161
+ //# sourceMappingURL=pull-sync-handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pull-sync-handler.js","sourceRoot":"","sources":["../../src/tools/pull-sync-handler.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAyBpE,8EA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C,CAAC,iBAAiB,EAAE;QACpE,EAAE;QACF,oBAAoB;QACpB,oBAAoB;QACpB,oBAAoB,MAAM,CAAC,WAAW,IAAI;QAC1C,uBAAuB,MAAM,CAAC,cAAc,IAAI;QAChD,0BAA0B,MAAM,CAAC,iBAAiB,IAAI;QACtD,sBAAsB,MAAM,CAAC,cAAc,GAAG,MAAM,CAAC,iBAAiB,IAAI;KAC3E,CAAC;IAEF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,SAAS,UAAU,CAAC,CAAS;IAC3B,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAChD,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ export declare function registerAutoRemediationTools(server: McpServer): void;
3
+ //# sourceMappingURL=register-auto-remediation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register-auto-remediation.d.ts","sourceRoot":"","sources":["../../src/tools/register-auto-remediation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAazE,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAmNpE"}
@@ -0,0 +1,174 @@
1
+ // tools/register-auto-remediation.ts — Auto-fix + remediation tools (SPEC-408)
2
+ import { z } from 'zod';
3
+ import { safeLicensed } from './safe-handler.js';
4
+ import { hashProjectPath } from '../storage/base-store.js';
5
+ import { autoFixHealth } from '../engine/health/auto-fixer.js';
6
+ import { autoRemediateCompliance } from '../engine/compliance/auto-remediator.js';
7
+ import { resolveDriftViolations } from '../engine/drift/violation-resolver.js';
8
+ // ---------------------------------------------------------------------------
9
+ // Tool 1: auto_fix_health
10
+ // ---------------------------------------------------------------------------
11
+ export function registerAutoRemediationTools(server) {
12
+ server.registerTool('auto_fix_health', {
13
+ description: 'Automatically fix deterministic health issues found by health_check_all. ' +
14
+ 'Fixable: missing progress.md files. ' +
15
+ 'Not fixable (reported as skipped): incomplete spec fields, missing tests, drift violations. ' +
16
+ 'Use dryRun=true to preview what would be fixed without making changes.',
17
+ inputSchema: {
18
+ projectPath: z
19
+ .string()
20
+ .min(1)
21
+ .max(4096)
22
+ .describe('Absolute path to the project root directory'),
23
+ dryRun: z
24
+ .boolean()
25
+ .optional()
26
+ .describe('When true, report what would be fixed without actually writing any files (default: false)'),
27
+ },
28
+ annotations: {
29
+ title: 'Auto Fix Health Issues',
30
+ },
31
+ }, safeLicensed('auto_fix_health', async (args) => {
32
+ const { projectPath, dryRun = false } = args;
33
+ const projectId = hashProjectPath(projectPath);
34
+ const result = await autoFixHealth(projectPath, projectId, dryRun);
35
+ const lines = [
36
+ dryRun ? '[DRY RUN] Auto-fix health report:' : 'Auto-fix health report:',
37
+ '',
38
+ `Fixed: ${result.fixedCount}`,
39
+ `Skipped (manual action required): ${result.skippedCount}`,
40
+ `Executed at: ${result.executedAt}`,
41
+ ];
42
+ if (result.fixes.length > 0) {
43
+ lines.push('', 'Fixes applied:');
44
+ for (const fix of result.fixes) {
45
+ lines.push(` [${fix.success ? 'OK' : 'FAIL'}] ${fix.affectedItem}: ${fix.action}`);
46
+ }
47
+ }
48
+ if (result.skipped.length > 0) {
49
+ lines.push('', 'Skipped (requires manual action):');
50
+ for (const skip of result.skipped) {
51
+ lines.push(` - ${skip.issue}: ${skip.reason}`);
52
+ for (const step of skip.manualSteps) {
53
+ lines.push(` → ${step}`);
54
+ }
55
+ }
56
+ }
57
+ return { content: [{ type: 'text', text: lines.join('\n') }] };
58
+ }));
59
+ // ---------------------------------------------------------------------------
60
+ // Tool 2: auto_remediate_compliance
61
+ // ---------------------------------------------------------------------------
62
+ server.registerTool('auto_remediate_compliance', {
63
+ description: 'For each compliance control gap, creates a stub spec so the team has a tracked work item. ' +
64
+ 'Already-covered controls are reported. Partially-covered controls list manual actions needed. ' +
65
+ 'Use dryRun=true to preview without creating any files.',
66
+ inputSchema: {
67
+ projectPath: z
68
+ .string()
69
+ .min(1)
70
+ .max(4096)
71
+ .describe('Absolute path to the project root directory'),
72
+ framework: z
73
+ .enum(['SOC2', 'GDPR', 'HIPAA', 'ISO27001'])
74
+ .describe('Compliance framework to remediate: SOC2=service org controls, GDPR=EU data privacy, HIPAA=US health data, ISO27001=security management'),
75
+ dryRun: z
76
+ .boolean()
77
+ .optional()
78
+ .describe('When true, report what would be created without writing any files (default: false)'),
79
+ },
80
+ annotations: {
81
+ title: 'Auto Remediate Compliance Gaps',
82
+ },
83
+ }, safeLicensed('auto_remediate_compliance', async (args) => {
84
+ const { projectPath, framework, dryRun = false, } = args;
85
+ const projectId = hashProjectPath(projectPath);
86
+ const result = await autoRemediateCompliance(projectPath, projectId, framework, dryRun);
87
+ const lines = [
88
+ dryRun
89
+ ? `[DRY RUN] Compliance remediation for ${result.framework}:`
90
+ : `Compliance remediation for ${result.framework}:`,
91
+ '',
92
+ `Specs created: ${result.createdSpecs.length}`,
93
+ `Controls already covered: ${result.alreadyCovered.length}`,
94
+ `Manual actions required: ${result.manualActionRequired.length}`,
95
+ ];
96
+ if (result.createdSpecs.length > 0) {
97
+ lines.push('', 'Specs created:');
98
+ for (const id of result.createdSpecs) {
99
+ lines.push(` + ${id}`);
100
+ }
101
+ }
102
+ if (result.alreadyCovered.length > 0) {
103
+ lines.push('', 'Already covered controls:');
104
+ for (const ctrl of result.alreadyCovered) {
105
+ lines.push(` ✓ ${ctrl}`);
106
+ }
107
+ }
108
+ if (result.manualActionRequired.length > 0) {
109
+ lines.push('', 'Manual actions required:');
110
+ for (const action of result.manualActionRequired) {
111
+ lines.push(` - ${action.control}: ${action.description}`);
112
+ for (const step of action.steps) {
113
+ lines.push(` → ${step}`);
114
+ }
115
+ }
116
+ }
117
+ return { content: [{ type: 'text', text: lines.join('\n') }] };
118
+ }));
119
+ // ---------------------------------------------------------------------------
120
+ // Tool 3: resolve_drift_violations
121
+ // ---------------------------------------------------------------------------
122
+ server.registerTool('resolve_drift_violations', {
123
+ description: 'Resolves drift violations semi-automatically. ' +
124
+ 'For done specs with diverged code: creates a follow-up spec to track the delta. ' +
125
+ 'For in-progress specs ahead of the spec: records the resolution note. ' +
126
+ 'For draft specs with code present: flags for manual review. ' +
127
+ 'Use dryRun=true to preview without creating files.',
128
+ inputSchema: {
129
+ projectPath: z
130
+ .string()
131
+ .min(1)
132
+ .max(4096)
133
+ .describe('Absolute path to the project root directory'),
134
+ dryRun: z
135
+ .boolean()
136
+ .optional()
137
+ .describe('When true, report what would be resolved without writing any files (default: false)'),
138
+ },
139
+ annotations: {
140
+ title: 'Resolve Drift Violations',
141
+ },
142
+ }, safeLicensed('resolve_drift_violations', async (args) => {
143
+ const { projectPath, dryRun = false } = args;
144
+ const projectId = hashProjectPath(projectPath);
145
+ const result = await resolveDriftViolations(projectPath, projectId, dryRun);
146
+ const lines = [
147
+ dryRun ? '[DRY RUN] Drift violation resolution:' : 'Drift violation resolution:',
148
+ '',
149
+ `Violations resolved: ${result.resolved.length}`,
150
+ `Follow-up specs created: ${result.followUpSpecsCreated.length}`,
151
+ `Requiring manual review: ${result.manualReview.length}`,
152
+ ];
153
+ if (result.resolved.length > 0) {
154
+ lines.push('', 'Resolved:');
155
+ for (const r of result.resolved) {
156
+ lines.push(` [${r.specId}] ${r.action}: ${r.description}`);
157
+ }
158
+ }
159
+ if (result.followUpSpecsCreated.length > 0) {
160
+ lines.push('', 'Follow-up specs created:');
161
+ for (const id of result.followUpSpecsCreated) {
162
+ lines.push(` + ${id}`);
163
+ }
164
+ }
165
+ if (result.manualReview.length > 0) {
166
+ lines.push('', 'Requires manual review:');
167
+ for (const item of result.manualReview) {
168
+ lines.push(` - ${item}`);
169
+ }
170
+ }
171
+ return { content: [{ type: 'text', text: lines.join('\n') }] };
172
+ }));
173
+ }
174
+ //# sourceMappingURL=register-auto-remediation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register-auto-remediation.js","sourceRoot":"","sources":["../../src/tools/register-auto-remediation.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAG/E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAClF,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAG/E,8EAA8E;AAC9E,0BAA0B;AAC1B,8EAA8E;AAE9E,MAAM,UAAU,4BAA4B,CAAC,MAAiB;IAC5D,MAAM,CAAC,YAAY,CACjB,iBAAiB,EACjB;QACE,WAAW,EACT,2EAA2E;YAC3E,sCAAsC;YACtC,8FAA8F;YAC9F,wEAAwE;QAC1E,WAAW,EAAE;YACX,WAAW,EAAE,CAAC;iBACX,MAAM,EAAE;iBACR,GAAG,CAAC,CAAC,CAAC;iBACN,GAAG,CAAC,IAAI,CAAC;iBACT,QAAQ,CAAC,6CAA6C,CAAC;YAC1D,MAAM,EAAE,CAAC;iBACN,OAAO,EAAE;iBACT,QAAQ,EAAE;iBACV,QAAQ,CACP,2FAA2F,CAC5F;SACJ;QACD,WAAW,EAAE;YACX,KAAK,EAAE,wBAAwB;SAChC;KACF,EACD,YAAY,CAAC,iBAAiB,EAAE,KAAK,EAAE,IAAI,EAAuB,EAAE;QAClE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,KAAK,EAAE,GAAG,IAAiD,CAAC;QAC1F,MAAM,SAAS,GAAG,eAAe,CAAC,WAAW,CAAC,CAAC;QAC/C,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,WAAW,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;QAEnE,MAAM,KAAK,GAAa;YACtB,MAAM,C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IAAI,MAAM,CAAC,oBAAoB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC3C,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,0BAA0B,CAAC,CAAC;YAC3C,KAAK,MAAM,EAAE,IAAI,MAAM,CAAC,oBAAoB,EAAE,CAAC;gBAC7C,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;YAC1B,CAAC;QACH,CAAC;QAED,IAAI,MAAM,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACnC,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,yBAAyB,CAAC,CAAC;YAC1C,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC;gBACvC,KAAK,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;YAC5B,CAAC;QACH,CAAC;QAED,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;IACjE,CAAC,CAAC,CACH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ export declare function registerCheckpointTools(server: McpServer): void;
3
+ //# sourceMappingURL=register-checkpoints.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register-checkpoints.d.ts","sourceRoot":"","sources":["../../src/tools/register-checkpoints.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAgBzE,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAsL/D"}
@@ -0,0 +1,134 @@
1
+ // tools/register-checkpoints.ts — Registers approval checkpoint tools (SPEC-411)
2
+ import { z } from 'zod';
3
+ import { safeTracked } from './safe-handler.js';
4
+ import { handleConfigureCheckpointPolicy } from './checkpoint/configure-policy-handler.js';
5
+ import { handleRequireCheckpoint } from './checkpoint/require-checkpoint-handler.js';
6
+ import { handleApproveCheckpoint } from './checkpoint/approve-checkpoint-handler.js';
7
+ import { handleRejectCheckpoint } from './checkpoint/reject-checkpoint-handler.js';
8
+ import { handleListPendingCheckpoints } from './checkpoint/list-checkpoints-handler.js';
9
+ export function registerCheckpointTools(server) {
10
+ // -------------------------------------------------------------------------
11
+ // configure_checkpoint_policy — set up approval gates for transitions
12
+ // -------------------------------------------------------------------------
13
+ server.registerTool('configure_checkpoint_policy', {
14
+ description: 'Configure approval checkpoints that block spec status transitions until a designated role approves. ' +
15
+ 'Apply a built-in preset (strict/balanced/relaxed) or define custom per-transition policies. ' +
16
+ 'This implements the Judge gate in Planner→Worker→Judge governance.',
17
+ inputSchema: {
18
+ projectPath: z.string().min(1).max(4096).describe('Absolute path to the project root.'),
19
+ preset: z
20
+ .enum(['strict', 'balanced', 'relaxed'])
21
+ .optional()
22
+ .describe('Policy preset: strict=all transitions need approval (draft->review, review->approved, approved->implementing, implementing->done), ' +
23
+ 'balanced=key transitions only (review->approved, implementing->done), ' +
24
+ 'relaxed=only completion needs approval (implementing->done).'),
25
+ policies: z
26
+ .array(z.object({
27
+ transition: z
28
+ .string()
29
+ .min(1)
30
+ .describe('Transition to gate, e.g. "review->approved". ' +
31
+ 'Valid statuses: draft, review, approved, implementing, done, discarded.'),
32
+ requiredRole: z
33
+ .string()
34
+ .min(1)
35
+ .describe('Role that must approve: developer, tech_lead, qa, product_owner, admin.'),
36
+ description: z
37
+ .string()
38
+ .min(1)
39
+ .describe('Human-readable explanation of why this checkpoint exists.'),
40
+ autoApproveAfterHours: z
41
+ .number()
42
+ .positive()
43
+ .optional()
44
+ .describe('Hours before the checkpoint auto-approves if no action is taken.'),
45
+ }))
46
+ .optional()
47
+ .describe('Custom policies (used when preset is not set). ' +
48
+ 'Replaces all existing policies for the project.'),
49
+ },
50
+ annotations: { title: 'Configure Checkpoint Policy', destructiveHint: false },
51
+ }, safeTracked('configure_checkpoint_policy', (args) => handleConfigureCheckpointPolicy(args)));
52
+ // -------------------------------------------------------------------------
53
+ // require_checkpoint — manually create a pending checkpoint
54
+ // -------------------------------------------------------------------------
55
+ server.registerTool('require_checkpoint', {
56
+ description: 'Create a pending checkpoint that blocks a specific spec status transition. ' +
57
+ 'Returns the checkpoint ID and instructions on who needs to approve it. ' +
58
+ 'The checkpoint must be approved via approve_checkpoint before the transition can proceed.',
59
+ inputSchema: {
60
+ projectPath: z.string().min(1).max(4096).describe('Absolute path to the project root.'),
61
+ specId: z.string().min(1).max(500).describe('Spec ID to block, e.g. SPEC-042.'),
62
+ transition: z
63
+ .string()
64
+ .min(1)
65
+ .describe('Status transition to block, e.g. "review->approved". ' +
66
+ 'Must match a configured policy.'),
67
+ requestedBy: z
68
+ .string()
69
+ .optional()
70
+ .describe('Identifier of who is requesting the checkpoint (defaults to "system").'),
71
+ },
72
+ annotations: { title: 'Require Checkpoint', destructiveHint: false },
73
+ }, safeTracked('require_checkpoint', (args) => handleRequireCheckpoint(args)));
74
+ // -------------------------------------------------------------------------
75
+ // approve_checkpoint — approve a pending checkpoint
76
+ // -------------------------------------------------------------------------
77
+ server.registerTool('approve_checkpoint', {
78
+ description: 'Approve a pending checkpoint, unblocking the associated spec status transition. ' +
79
+ 'Returns confirmation and next steps for the spec.',
80
+ inputSchema: {
81
+ projectPath: z.string().min(1).max(4096).describe('Absolute path to the project root.'),
82
+ checkpointId: z
83
+ .string()
84
+ .min(1)
85
+ .describe('ID of the checkpoint to approve (returned by require_checkpoint).'),
86
+ approvedBy: z
87
+ .string()
88
+ .optional()
89
+ .describe('Identifier of the approver (defaults to "anonymous").'),
90
+ },
91
+ annotations: { title: 'Approve Checkpoint', destructiveHint: false },
92
+ }, safeTracked('approve_checkpoint', (args) => handleApproveCheckpoint(args)));
93
+ // -------------------------------------------------------------------------
94
+ // reject_checkpoint — reject a pending checkpoint
95
+ // -------------------------------------------------------------------------
96
+ server.registerTool('reject_checkpoint', {
97
+ description: 'Reject a pending checkpoint, blocking the associated spec status transition. ' +
98
+ 'A rejection reason is required. The spec stays in its current status.',
99
+ inputSchema: {
100
+ projectPath: z.string().min(1).max(4096).describe('Absolute path to the project root.'),
101
+ checkpointId: z
102
+ .string()
103
+ .min(1)
104
+ .describe('ID of the checkpoint to reject (returned by require_checkpoint).'),
105
+ rejectedBy: z
106
+ .string()
107
+ .optional()
108
+ .describe('Identifier of the reviewer rejecting (defaults to "anonymous").'),
109
+ reason: z
110
+ .string()
111
+ .min(1)
112
+ .describe('Mandatory explanation of why the checkpoint was rejected.'),
113
+ },
114
+ annotations: { title: 'Reject Checkpoint', destructiveHint: false },
115
+ }, safeTracked('reject_checkpoint', (args) => handleRejectCheckpoint(args)));
116
+ // -------------------------------------------------------------------------
117
+ // list_pending_checkpoints — list checkpoints awaiting approval
118
+ // -------------------------------------------------------------------------
119
+ server.registerTool('list_pending_checkpoints', {
120
+ description: 'List all pending approval checkpoints for a project. ' +
121
+ 'Optionally filter by required role to see only checkpoints relevant to you. ' +
122
+ 'Returns spec ID, transition being blocked, required role, and requester.',
123
+ inputSchema: {
124
+ projectPath: z.string().min(1).max(4096).describe('Absolute path to the project root.'),
125
+ role: z
126
+ .string()
127
+ .optional()
128
+ .describe('Filter by required role: developer, tech_lead, qa, product_owner, admin. ' +
129
+ 'Omit to list all pending checkpoints.'),
130
+ },
131
+ annotations: { title: 'List Pending Checkpoints', readOnlyHint: true },
132
+ }, safeTracked('list_pending_checkpoints', (args) => handleListPendingCheckpoints(args)));
133
+ }
134
+ //# sourceMappingURL=register-checkpoints.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register-checkpoints.js","sourceRoot":"","sources":["../../src/tools/register-checkpoints.ts"],"names":[],"mappings":"AAAA,iFAAiF;AAQjF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EA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,EAAE,KAAK,EAAE,mBAAmB,EAAE,eAAe,EAAE,KAAK,EAAE;KACpE,EACD,WAAW,CAAC,mBAAmB,EAAE,CAAC,IAAI,EAAE,EAAE,CACxC,sBAAsB,CAAC,IAA6B,CAAC,CACtD,CACF,CAAC;IAEF,4EAA4E;IAC5E,gEAAgE;IAChE,4EAA4E;IAE5E,MAAM,CAAC,YAAY,CACjB,0BAA0B,EAC1B;QACE,WAAW,EACT,uDAAuD;YACvD,8EAA8E;YAC9E,0EAA0E;QAC5E,WAAW,EAAE;YACX,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,oCAAoC,CAAC;YACvF,IAAI,EAAE,CAAC;iBACJ,MAAM,EAAE;iBACR,QAAQ,EAAE;iBACV,QAAQ,CACP,2EAA2E;gBACzE,uCAAuC,CAC1C;SACJ;QACD,WAAW,EAAE,EAAE,KAAK,EAAE,0BAA0B,EAAE,YAAY,EAAE,IAAI,EAAE;KACvE,EACD,WAAW,CAAC,0BAA0B,EAAE,CAAC,IAAI,EAAE,EAAE,CAC/C,4BAA4B,CAAC,IAAmC,CAAC,CAClE,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ export declare function registerContextProfileTools(server: McpServer): void;
3
+ //# sourceMappingURL=register-context-profile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register-context-profile.d.ts","sourceRoot":"","sources":["../../src/tools/register-context-profile.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AA2BzE,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAiHnE"}
@@ -0,0 +1,106 @@
1
+ import { z } from 'zod';
2
+ import { safeTracked } from './safe-handler.js';
3
+ import { setActiveProfile, getActiveProfile } from '../storage/context-profile-store.js';
4
+ import { getProfile, getAllProfiles } from '../engine/context-profile/profile-catalog.js';
5
+ const AVAILABLE_PHASES = ['brainstorm', 'plan', 'implement', 'review', 'release'];
6
+ const projectPathField = z
7
+ .string()
8
+ .min(1)
9
+ .max(4096)
10
+ .describe('Absolute path to the project root directory.');
11
+ const phaseField = z
12
+ .enum(['brainstorm', 'plan', 'implement', 'review', 'release'])
13
+ .describe('Work phase to activate: ' +
14
+ 'brainstorm=explore ideas, ' +
15
+ 'plan=design specs, ' +
16
+ 'implement=build features, ' +
17
+ 'review=validate quality, ' +
18
+ 'release=publish');
19
+ export function registerContextProfileTools(server) {
20
+ // -------------------------------------------------------------------------
21
+ // set_context_profile
22
+ // -------------------------------------------------------------------------
23
+ server.registerTool('set_context_profile', {
24
+ description: 'Activate a work-phase context profile that guides the LLM to use only the ' +
25
+ 'relevant tools for the current phase (brainstorm/plan/implement/review/release). ' +
26
+ 'Reduces token waste by surfacing only the ~10 most relevant tools per phase.',
27
+ inputSchema: {
28
+ projectPath: projectPathField,
29
+ phase: phaseField,
30
+ },
31
+ annotations: { readOnlyHint: false },
32
+ }, safeTracked('set_context_profile', async (args) => {
33
+ const { projectPath, phase } = args;
34
+ await setActiveProfile(projectPath, phase);
35
+ const profile = getProfile(phase);
36
+ const focusList = profile.focusTools.map((t) => ` • ${t}`).join('\n');
37
+ const tipsList = profile.tips.map((t) => ` - ${t}`).join('\n');
38
+ const text = `You are now in **${profile.name}**.\n\n` +
39
+ `${profile.description}\n\n` +
40
+ `**Focus tools (~${profile.estimatedTokensSaved}% token savings):**\n${focusList}\n\n` +
41
+ `**Tips:**\n${tipsList}`;
42
+ return { content: [{ type: 'text', text }] };
43
+ }));
44
+ // -------------------------------------------------------------------------
45
+ // get_context_profile
46
+ // -------------------------------------------------------------------------
47
+ server.registerTool('get_context_profile', {
48
+ description: 'Get the currently active context profile for a project, ' +
49
+ 'including focus tools and phase-specific tips. ' +
50
+ 'Returns a prompt when no profile is active.',
51
+ inputSchema: {
52
+ projectPath: projectPathField,
53
+ },
54
+ annotations: { readOnlyHint: true },
55
+ }, safeTracked('get_context_profile', async (args) => {
56
+ const { projectPath } = args;
57
+ const active = await getActiveProfile(projectPath);
58
+ if (!active) {
59
+ return {
60
+ content: [
61
+ {
62
+ type: 'text',
63
+ text: 'No active context profile. Use set_context_profile to activate one.\n\n' +
64
+ `Available phases: ${AVAILABLE_PHASES.join(', ')}`,
65
+ },
66
+ ],
67
+ };
68
+ }
69
+ const profile = getProfile(active.phase);
70
+ const focusList = profile.focusTools.map((t) => ` • ${t}`).join('\n');
71
+ const avoidList = profile.avoidTools.map((t) => ` • ${t}`).join('\n');
72
+ const tipsList = profile.tips.map((t) => ` - ${t}`).join('\n');
73
+ const text = `**Active profile: ${profile.name}**\n` +
74
+ `Activated: ${active.activatedAt}\n\n` +
75
+ `${profile.description}\n\n` +
76
+ `**Focus tools:**\n${focusList}\n\n` +
77
+ `**Avoid tools:**\n${avoidList}\n\n` +
78
+ `**Tips:**\n${tipsList}\n\n` +
79
+ `Estimated token savings: ~${profile.estimatedTokensSaved}%`;
80
+ return { content: [{ type: 'text', text }] };
81
+ }));
82
+ // -------------------------------------------------------------------------
83
+ // list_context_profiles
84
+ // -------------------------------------------------------------------------
85
+ server.registerTool('list_context_profiles', {
86
+ description: 'List all 5 available context profiles (brainstorm/plan/implement/review/release) ' +
87
+ 'with their focus tools and estimated token savings. ' +
88
+ 'Use this to discover which profile is best for the current work.',
89
+ inputSchema: {
90
+ projectPath: projectPathField,
91
+ },
92
+ annotations: { readOnlyHint: true },
93
+ }, safeTracked('list_context_profiles', async (args) => {
94
+ const { projectPath } = args;
95
+ const active = await getActiveProfile(projectPath);
96
+ const profiles = getAllProfiles();
97
+ const lines = ['**Available context profiles:**\n'];
98
+ for (const p of profiles) {
99
+ const isActive = active?.phase === p.phase ? ' (ACTIVE)' : '';
100
+ lines.push(`### ${p.name}${isActive}`, `Phase: \`${p.phase}\``, p.description, `Focus: ${p.focusTools.slice(0, 5).join(', ')}${p.focusTools.length > 5 ? ` +${String(p.focusTools.length - 5)} more` : ''}`, `Token savings: ~${String(p.estimatedTokensSaved)}%`, '');
101
+ }
102
+ lines.push(`Use set_context_profile with phase=<phase> to activate one.`);
103
+ return { content: [{ type: 'text', text: lines.join('\n') }] };
104
+ }));
105
+ }
106
+ //# sourceMappingURL=register-context-profile.js.map