@jeger-ai/opengantry 1.0.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 (515) hide show
  1. package/LICENSE +235 -0
  2. package/NOTICE +16 -0
  3. package/README.md +337 -0
  4. package/dist/cli/commands/arch.d.ts +19 -0
  5. package/dist/cli/commands/arch.d.ts.map +1 -0
  6. package/dist/cli/commands/arch.js +86 -0
  7. package/dist/cli/commands/arch.js.map +1 -0
  8. package/dist/cli/commands/check.d.ts +2 -0
  9. package/dist/cli/commands/check.d.ts.map +1 -0
  10. package/dist/cli/commands/check.js +16 -0
  11. package/dist/cli/commands/check.js.map +1 -0
  12. package/dist/cli/commands/doctor.d.ts +12 -0
  13. package/dist/cli/commands/doctor.d.ts.map +1 -0
  14. package/dist/cli/commands/doctor.js +40 -0
  15. package/dist/cli/commands/doctor.js.map +1 -0
  16. package/dist/cli/commands/init.d.ts +18 -0
  17. package/dist/cli/commands/init.d.ts.map +1 -0
  18. package/dist/cli/commands/init.js +185 -0
  19. package/dist/cli/commands/init.js.map +1 -0
  20. package/dist/cli/commands/legislate.d.ts +21 -0
  21. package/dist/cli/commands/legislate.d.ts.map +1 -0
  22. package/dist/cli/commands/legislate.js +143 -0
  23. package/dist/cli/commands/legislate.js.map +1 -0
  24. package/dist/cli/commands/mcp-serve.d.ts +2 -0
  25. package/dist/cli/commands/mcp-serve.d.ts.map +1 -0
  26. package/dist/cli/commands/mcp-serve.js +14 -0
  27. package/dist/cli/commands/mcp-serve.js.map +1 -0
  28. package/dist/cli/commands/metrics.d.ts +6 -0
  29. package/dist/cli/commands/metrics.d.ts.map +1 -0
  30. package/dist/cli/commands/metrics.js +20 -0
  31. package/dist/cli/commands/metrics.js.map +1 -0
  32. package/dist/cli/commands/mission.d.ts +3 -0
  33. package/dist/cli/commands/mission.d.ts.map +1 -0
  34. package/dist/cli/commands/mission.js +29 -0
  35. package/dist/cli/commands/mission.js.map +1 -0
  36. package/dist/cli/commands/onboarding.d.ts +2 -0
  37. package/dist/cli/commands/onboarding.d.ts.map +1 -0
  38. package/dist/cli/commands/onboarding.js +85 -0
  39. package/dist/cli/commands/onboarding.js.map +1 -0
  40. package/dist/cli/commands/runtime.d.ts +19 -0
  41. package/dist/cli/commands/runtime.d.ts.map +1 -0
  42. package/dist/cli/commands/runtime.js +101 -0
  43. package/dist/cli/commands/runtime.js.map +1 -0
  44. package/dist/cli/commands/start.d.ts +4 -0
  45. package/dist/cli/commands/start.d.ts.map +1 -0
  46. package/dist/cli/commands/start.js +3 -0
  47. package/dist/cli/commands/start.js.map +1 -0
  48. package/dist/cli/commands/status.d.ts +8 -0
  49. package/dist/cli/commands/status.d.ts.map +1 -0
  50. package/dist/cli/commands/status.js +65 -0
  51. package/dist/cli/commands/status.js.map +1 -0
  52. package/dist/cli/commands/teacher.d.ts +11 -0
  53. package/dist/cli/commands/teacher.d.ts.map +1 -0
  54. package/dist/cli/commands/teacher.js +48 -0
  55. package/dist/cli/commands/teacher.js.map +1 -0
  56. package/dist/cli/commands/triage.d.ts +10 -0
  57. package/dist/cli/commands/triage.d.ts.map +1 -0
  58. package/dist/cli/commands/triage.js +48 -0
  59. package/dist/cli/commands/triage.js.map +1 -0
  60. package/dist/cli/commands/upgrade.d.ts +10 -0
  61. package/dist/cli/commands/upgrade.d.ts.map +1 -0
  62. package/dist/cli/commands/upgrade.js +89 -0
  63. package/dist/cli/commands/upgrade.js.map +1 -0
  64. package/dist/cli/commands/verify.d.ts +6 -0
  65. package/dist/cli/commands/verify.d.ts.map +1 -0
  66. package/dist/cli/commands/verify.js +33 -0
  67. package/dist/cli/commands/verify.js.map +1 -0
  68. package/dist/cli/index.d.ts +3 -0
  69. package/dist/cli/index.d.ts.map +1 -0
  70. package/dist/cli/index.js +13 -0
  71. package/dist/cli/index.js.map +1 -0
  72. package/dist/cli/lib/agent-error.d.ts +20 -0
  73. package/dist/cli/lib/agent-error.d.ts.map +1 -0
  74. package/dist/cli/lib/agent-error.js +58 -0
  75. package/dist/cli/lib/agent-error.js.map +1 -0
  76. package/dist/cli/lib/architecture-credential.d.ts +22 -0
  77. package/dist/cli/lib/architecture-credential.d.ts.map +1 -0
  78. package/dist/cli/lib/architecture-credential.js +198 -0
  79. package/dist/cli/lib/architecture-credential.js.map +1 -0
  80. package/dist/cli/lib/architecture-pointer-discovery.d.ts +7 -0
  81. package/dist/cli/lib/architecture-pointer-discovery.d.ts.map +1 -0
  82. package/dist/cli/lib/architecture-pointer-discovery.js +60 -0
  83. package/dist/cli/lib/architecture-pointer-discovery.js.map +1 -0
  84. package/dist/cli/lib/architecture-pointer-doctor.d.ts +3 -0
  85. package/dist/cli/lib/architecture-pointer-doctor.d.ts.map +1 -0
  86. package/dist/cli/lib/architecture-pointer-doctor.js +114 -0
  87. package/dist/cli/lib/architecture-pointer-doctor.js.map +1 -0
  88. package/dist/cli/lib/architecture-pointer-schema.d.ts +5 -0
  89. package/dist/cli/lib/architecture-pointer-schema.d.ts.map +1 -0
  90. package/dist/cli/lib/architecture-pointer-schema.js +137 -0
  91. package/dist/cli/lib/architecture-pointer-schema.js.map +1 -0
  92. package/dist/cli/lib/architecture-pointer-types.d.ts +24 -0
  93. package/dist/cli/lib/architecture-pointer-types.d.ts.map +1 -0
  94. package/dist/cli/lib/architecture-pointer-types.js +7 -0
  95. package/dist/cli/lib/architecture-pointer-types.js.map +1 -0
  96. package/dist/cli/lib/architecture-pointer.d.ts +7 -0
  97. package/dist/cli/lib/architecture-pointer.d.ts.map +1 -0
  98. package/dist/cli/lib/architecture-pointer.js +10 -0
  99. package/dist/cli/lib/architecture-pointer.js.map +1 -0
  100. package/dist/cli/lib/atomic-fs.d.ts +9 -0
  101. package/dist/cli/lib/atomic-fs.d.ts.map +1 -0
  102. package/dist/cli/lib/atomic-fs.js +63 -0
  103. package/dist/cli/lib/atomic-fs.js.map +1 -0
  104. package/dist/cli/lib/audience-output.d.ts +18 -0
  105. package/dist/cli/lib/audience-output.d.ts.map +1 -0
  106. package/dist/cli/lib/audience-output.js +80 -0
  107. package/dist/cli/lib/audience-output.js.map +1 -0
  108. package/dist/cli/lib/break-glass.d.ts +25 -0
  109. package/dist/cli/lib/break-glass.d.ts.map +1 -0
  110. package/dist/cli/lib/break-glass.js +134 -0
  111. package/dist/cli/lib/break-glass.js.map +1 -0
  112. package/dist/cli/lib/cli-io.d.ts +9 -0
  113. package/dist/cli/lib/cli-io.d.ts.map +1 -0
  114. package/dist/cli/lib/cli-io.js +38 -0
  115. package/dist/cli/lib/cli-io.js.map +1 -0
  116. package/dist/cli/lib/cli-timeout.d.ts +9 -0
  117. package/dist/cli/lib/cli-timeout.d.ts.map +1 -0
  118. package/dist/cli/lib/cli-timeout.js +17 -0
  119. package/dist/cli/lib/cli-timeout.js.map +1 -0
  120. package/dist/cli/lib/constants.d.ts +26 -0
  121. package/dist/cli/lib/constants.d.ts.map +1 -0
  122. package/dist/cli/lib/constants.js +26 -0
  123. package/dist/cli/lib/constants.js.map +1 -0
  124. package/dist/cli/lib/dirty-missions.d.ts +8 -0
  125. package/dist/cli/lib/dirty-missions.d.ts.map +1 -0
  126. package/dist/cli/lib/dirty-missions.js +65 -0
  127. package/dist/cli/lib/dirty-missions.js.map +1 -0
  128. package/dist/cli/lib/doctor-checks.d.ts +16 -0
  129. package/dist/cli/lib/doctor-checks.d.ts.map +1 -0
  130. package/dist/cli/lib/doctor-checks.js +138 -0
  131. package/dist/cli/lib/doctor-checks.js.map +1 -0
  132. package/dist/cli/lib/doctor-integration-checks.d.ts +5 -0
  133. package/dist/cli/lib/doctor-integration-checks.d.ts.map +1 -0
  134. package/dist/cli/lib/doctor-integration-checks.js +88 -0
  135. package/dist/cli/lib/doctor-integration-checks.js.map +1 -0
  136. package/dist/cli/lib/doctor-orchestration.d.ts +10 -0
  137. package/dist/cli/lib/doctor-orchestration.d.ts.map +1 -0
  138. package/dist/cli/lib/doctor-orchestration.js +25 -0
  139. package/dist/cli/lib/doctor-orchestration.js.map +1 -0
  140. package/dist/cli/lib/draft-token.d.ts +37 -0
  141. package/dist/cli/lib/draft-token.d.ts.map +1 -0
  142. package/dist/cli/lib/draft-token.js +171 -0
  143. package/dist/cli/lib/draft-token.js.map +1 -0
  144. package/dist/cli/lib/fix-hints.d.ts +51 -0
  145. package/dist/cli/lib/fix-hints.d.ts.map +1 -0
  146. package/dist/cli/lib/fix-hints.js +197 -0
  147. package/dist/cli/lib/fix-hints.js.map +1 -0
  148. package/dist/cli/lib/forbidden-scan.d.ts +18 -0
  149. package/dist/cli/lib/forbidden-scan.d.ts.map +1 -0
  150. package/dist/cli/lib/forbidden-scan.js +96 -0
  151. package/dist/cli/lib/forbidden-scan.js.map +1 -0
  152. package/dist/cli/lib/gate.d.ts +10 -0
  153. package/dist/cli/lib/gate.d.ts.map +1 -0
  154. package/dist/cli/lib/gate.js +30 -0
  155. package/dist/cli/lib/gate.js.map +1 -0
  156. package/dist/cli/lib/git-metrics-missions.d.ts +3 -0
  157. package/dist/cli/lib/git-metrics-missions.d.ts.map +1 -0
  158. package/dist/cli/lib/git-metrics-missions.js +51 -0
  159. package/dist/cli/lib/git-metrics-missions.js.map +1 -0
  160. package/dist/cli/lib/git-metrics-stream.d.ts +24 -0
  161. package/dist/cli/lib/git-metrics-stream.d.ts.map +1 -0
  162. package/dist/cli/lib/git-metrics-stream.js +137 -0
  163. package/dist/cli/lib/git-metrics-stream.js.map +1 -0
  164. package/dist/cli/lib/git-metrics.d.ts +18 -0
  165. package/dist/cli/lib/git-metrics.d.ts.map +1 -0
  166. package/dist/cli/lib/git-metrics.js +39 -0
  167. package/dist/cli/lib/git-metrics.js.map +1 -0
  168. package/dist/cli/lib/git-proof-errors.d.ts +3 -0
  169. package/dist/cli/lib/git-proof-errors.d.ts.map +1 -0
  170. package/dist/cli/lib/git-proof-errors.js +7 -0
  171. package/dist/cli/lib/git-proof-errors.js.map +1 -0
  172. package/dist/cli/lib/git-proof.d.ts +37 -0
  173. package/dist/cli/lib/git-proof.d.ts.map +1 -0
  174. package/dist/cli/lib/git-proof.js +147 -0
  175. package/dist/cli/lib/git-proof.js.map +1 -0
  176. package/dist/cli/lib/git-repo.d.ts +17 -0
  177. package/dist/cli/lib/git-repo.d.ts.map +1 -0
  178. package/dist/cli/lib/git-repo.js +39 -0
  179. package/dist/cli/lib/git-repo.js.map +1 -0
  180. package/dist/cli/lib/git.d.ts +2 -0
  181. package/dist/cli/lib/git.d.ts.map +1 -0
  182. package/dist/cli/lib/git.js +19 -0
  183. package/dist/cli/lib/git.js.map +1 -0
  184. package/dist/cli/lib/gitignore-gxt.d.ts +2 -0
  185. package/dist/cli/lib/gitignore-gxt.d.ts.map +1 -0
  186. package/dist/cli/lib/gitignore-gxt.js +24 -0
  187. package/dist/cli/lib/gitignore-gxt.js.map +1 -0
  188. package/dist/cli/lib/gxt-error-codes.d.ts +19 -0
  189. package/dist/cli/lib/gxt-error-codes.d.ts.map +1 -0
  190. package/dist/cli/lib/gxt-error-codes.js +60 -0
  191. package/dist/cli/lib/gxt-error-codes.js.map +1 -0
  192. package/dist/cli/lib/init-asset-catalog.d.ts +15 -0
  193. package/dist/cli/lib/init-asset-catalog.d.ts.map +1 -0
  194. package/dist/cli/lib/init-asset-catalog.js +163 -0
  195. package/dist/cli/lib/init-asset-catalog.js.map +1 -0
  196. package/dist/cli/lib/init-assets.d.ts +8 -0
  197. package/dist/cli/lib/init-assets.d.ts.map +1 -0
  198. package/dist/cli/lib/init-assets.js +3 -0
  199. package/dist/cli/lib/init-assets.js.map +1 -0
  200. package/dist/cli/lib/init-compose-arch-pointer.d.ts +6 -0
  201. package/dist/cli/lib/init-compose-arch-pointer.d.ts.map +1 -0
  202. package/dist/cli/lib/init-compose-arch-pointer.js +64 -0
  203. package/dist/cli/lib/init-compose-arch-pointer.js.map +1 -0
  204. package/dist/cli/lib/init-compose-doc.d.ts +5 -0
  205. package/dist/cli/lib/init-compose-doc.d.ts.map +1 -0
  206. package/dist/cli/lib/init-compose-doc.js +37 -0
  207. package/dist/cli/lib/init-compose-doc.js.map +1 -0
  208. package/dist/cli/lib/init-interactive.d.ts +8 -0
  209. package/dist/cli/lib/init-interactive.d.ts.map +1 -0
  210. package/dist/cli/lib/init-interactive.js +195 -0
  211. package/dist/cli/lib/init-interactive.js.map +1 -0
  212. package/dist/cli/lib/init-plan.d.ts +20 -0
  213. package/dist/cli/lib/init-plan.d.ts.map +1 -0
  214. package/dist/cli/lib/init-plan.js +92 -0
  215. package/dist/cli/lib/init-plan.js.map +1 -0
  216. package/dist/cli/lib/init-profile.d.ts +39 -0
  217. package/dist/cli/lib/init-profile.d.ts.map +1 -0
  218. package/dist/cli/lib/init-profile.js +93 -0
  219. package/dist/cli/lib/init-profile.js.map +1 -0
  220. package/dist/cli/lib/init-tutorial.d.ts +2 -0
  221. package/dist/cli/lib/init-tutorial.d.ts.map +1 -0
  222. package/dist/cli/lib/init-tutorial.js +156 -0
  223. package/dist/cli/lib/init-tutorial.js.map +1 -0
  224. package/dist/cli/lib/integration-compat.d.ts +24 -0
  225. package/dist/cli/lib/integration-compat.d.ts.map +1 -0
  226. package/dist/cli/lib/integration-compat.js +50 -0
  227. package/dist/cli/lib/integration-compat.js.map +1 -0
  228. package/dist/cli/lib/legislate-skill.d.ts +20 -0
  229. package/dist/cli/lib/legislate-skill.d.ts.map +1 -0
  230. package/dist/cli/lib/legislate-skill.js +30 -0
  231. package/dist/cli/lib/legislate-skill.js.map +1 -0
  232. package/dist/cli/lib/manifest.d.ts +6 -0
  233. package/dist/cli/lib/manifest.d.ts.map +1 -0
  234. package/dist/cli/lib/manifest.js +53 -0
  235. package/dist/cli/lib/manifest.js.map +1 -0
  236. package/dist/cli/lib/mcp-legislation.d.ts +82 -0
  237. package/dist/cli/lib/mcp-legislation.d.ts.map +1 -0
  238. package/dist/cli/lib/mcp-legislation.js +181 -0
  239. package/dist/cli/lib/mcp-legislation.js.map +1 -0
  240. package/dist/cli/lib/mcp-orchestration.d.ts +12 -0
  241. package/dist/cli/lib/mcp-orchestration.d.ts.map +1 -0
  242. package/dist/cli/lib/mcp-orchestration.js +54 -0
  243. package/dist/cli/lib/mcp-orchestration.js.map +1 -0
  244. package/dist/cli/lib/mcp-runtime.d.ts +60 -0
  245. package/dist/cli/lib/mcp-runtime.d.ts.map +1 -0
  246. package/dist/cli/lib/mcp-runtime.js +133 -0
  247. package/dist/cli/lib/mcp-runtime.js.map +1 -0
  248. package/dist/cli/lib/mcp-tools-register.d.ts +4 -0
  249. package/dist/cli/lib/mcp-tools-register.d.ts.map +1 -0
  250. package/dist/cli/lib/mcp-tools-register.js +78 -0
  251. package/dist/cli/lib/mcp-tools-register.js.map +1 -0
  252. package/dist/cli/lib/mcp-upgrade.d.ts +7 -0
  253. package/dist/cli/lib/mcp-upgrade.d.ts.map +1 -0
  254. package/dist/cli/lib/mcp-upgrade.js +38 -0
  255. package/dist/cli/lib/mcp-upgrade.js.map +1 -0
  256. package/dist/cli/lib/mission-emit.d.ts +7 -0
  257. package/dist/cli/lib/mission-emit.d.ts.map +1 -0
  258. package/dist/cli/lib/mission-emit.js +23 -0
  259. package/dist/cli/lib/mission-emit.js.map +1 -0
  260. package/dist/cli/lib/mission-legislative-stub.d.ts +9 -0
  261. package/dist/cli/lib/mission-legislative-stub.d.ts.map +1 -0
  262. package/dist/cli/lib/mission-legislative-stub.js +36 -0
  263. package/dist/cli/lib/mission-legislative-stub.js.map +1 -0
  264. package/dist/cli/lib/mission-markdown.d.ts +6 -0
  265. package/dist/cli/lib/mission-markdown.d.ts.map +1 -0
  266. package/dist/cli/lib/mission-markdown.js +84 -0
  267. package/dist/cli/lib/mission-markdown.js.map +1 -0
  268. package/dist/cli/lib/mission-msn.d.ts +10 -0
  269. package/dist/cli/lib/mission-msn.d.ts.map +1 -0
  270. package/dist/cli/lib/mission-msn.js +85 -0
  271. package/dist/cli/lib/mission-msn.js.map +1 -0
  272. package/dist/cli/lib/mission-parser.d.ts +6 -0
  273. package/dist/cli/lib/mission-parser.d.ts.map +1 -0
  274. package/dist/cli/lib/mission-parser.js +29 -0
  275. package/dist/cli/lib/mission-parser.js.map +1 -0
  276. package/dist/cli/lib/mission-path.d.ts +4 -0
  277. package/dist/cli/lib/mission-path.d.ts.map +1 -0
  278. package/dist/cli/lib/mission-path.js +28 -0
  279. package/dist/cli/lib/mission-path.js.map +1 -0
  280. package/dist/cli/lib/mission-resolution.d.ts +14 -0
  281. package/dist/cli/lib/mission-resolution.d.ts.map +1 -0
  282. package/dist/cli/lib/mission-resolution.js +60 -0
  283. package/dist/cli/lib/mission-resolution.js.map +1 -0
  284. package/dist/cli/lib/mission-yaml.d.ts +12 -0
  285. package/dist/cli/lib/mission-yaml.d.ts.map +1 -0
  286. package/dist/cli/lib/mission-yaml.js +96 -0
  287. package/dist/cli/lib/mission-yaml.js.map +1 -0
  288. package/dist/cli/lib/msn-allocate.d.ts +13 -0
  289. package/dist/cli/lib/msn-allocate.d.ts.map +1 -0
  290. package/dist/cli/lib/msn-allocate.js +98 -0
  291. package/dist/cli/lib/msn-allocate.js.map +1 -0
  292. package/dist/cli/lib/msn.d.ts +2 -0
  293. package/dist/cli/lib/msn.d.ts.map +1 -0
  294. package/dist/cli/lib/msn.js +5 -0
  295. package/dist/cli/lib/msn.js.map +1 -0
  296. package/dist/cli/lib/onboarding-flow.d.ts +11 -0
  297. package/dist/cli/lib/onboarding-flow.d.ts.map +1 -0
  298. package/dist/cli/lib/onboarding-flow.js +25 -0
  299. package/dist/cli/lib/onboarding-flow.js.map +1 -0
  300. package/dist/cli/lib/out-of-scope-hint.d.ts +7 -0
  301. package/dist/cli/lib/out-of-scope-hint.d.ts.map +1 -0
  302. package/dist/cli/lib/out-of-scope-hint.js +79 -0
  303. package/dist/cli/lib/out-of-scope-hint.js.map +1 -0
  304. package/dist/cli/lib/output-context.d.ts +22 -0
  305. package/dist/cli/lib/output-context.d.ts.map +1 -0
  306. package/dist/cli/lib/output-context.js +55 -0
  307. package/dist/cli/lib/output-context.js.map +1 -0
  308. package/dist/cli/lib/program-audience-hook.d.ts +4 -0
  309. package/dist/cli/lib/program-audience-hook.d.ts.map +1 -0
  310. package/dist/cli/lib/program-audience-hook.js +35 -0
  311. package/dist/cli/lib/program-audience-hook.js.map +1 -0
  312. package/dist/cli/lib/runtime-env.d.ts +23 -0
  313. package/dist/cli/lib/runtime-env.d.ts.map +1 -0
  314. package/dist/cli/lib/runtime-env.js +64 -0
  315. package/dist/cli/lib/runtime-env.js.map +1 -0
  316. package/dist/cli/lib/runtime-exec-orchestrator.d.ts +14 -0
  317. package/dist/cli/lib/runtime-exec-orchestrator.d.ts.map +1 -0
  318. package/dist/cli/lib/runtime-exec-orchestrator.js +131 -0
  319. package/dist/cli/lib/runtime-exec-orchestrator.js.map +1 -0
  320. package/dist/cli/lib/runtime-exec-process.d.ts +23 -0
  321. package/dist/cli/lib/runtime-exec-process.d.ts.map +1 -0
  322. package/dist/cli/lib/runtime-exec-process.js +55 -0
  323. package/dist/cli/lib/runtime-exec-process.js.map +1 -0
  324. package/dist/cli/lib/runtime-exec-result.d.ts +21 -0
  325. package/dist/cli/lib/runtime-exec-result.d.ts.map +1 -0
  326. package/dist/cli/lib/runtime-exec-result.js +42 -0
  327. package/dist/cli/lib/runtime-exec-result.js.map +1 -0
  328. package/dist/cli/lib/runtime-exec-worker.d.ts +18 -0
  329. package/dist/cli/lib/runtime-exec-worker.d.ts.map +1 -0
  330. package/dist/cli/lib/runtime-exec-worker.js +49 -0
  331. package/dist/cli/lib/runtime-exec-worker.js.map +1 -0
  332. package/dist/cli/lib/runtime-exec.d.ts +5 -0
  333. package/dist/cli/lib/runtime-exec.d.ts.map +1 -0
  334. package/dist/cli/lib/runtime-exec.js +5 -0
  335. package/dist/cli/lib/runtime-exec.js.map +1 -0
  336. package/dist/cli/lib/skill-sync.d.ts +11 -0
  337. package/dist/cli/lib/skill-sync.d.ts.map +1 -0
  338. package/dist/cli/lib/skill-sync.js +39 -0
  339. package/dist/cli/lib/skill-sync.js.map +1 -0
  340. package/dist/cli/lib/start-orchestration.d.ts +29 -0
  341. package/dist/cli/lib/start-orchestration.d.ts.map +1 -0
  342. package/dist/cli/lib/start-orchestration.js +176 -0
  343. package/dist/cli/lib/start-orchestration.js.map +1 -0
  344. package/dist/cli/lib/start-state.d.ts +12 -0
  345. package/dist/cli/lib/start-state.d.ts.map +1 -0
  346. package/dist/cli/lib/start-state.js +86 -0
  347. package/dist/cli/lib/start-state.js.map +1 -0
  348. package/dist/cli/lib/status-report.d.ts +21 -0
  349. package/dist/cli/lib/status-report.d.ts.map +1 -0
  350. package/dist/cli/lib/status-report.js +77 -0
  351. package/dist/cli/lib/status-report.js.map +1 -0
  352. package/dist/cli/lib/substrate-version.d.ts +22 -0
  353. package/dist/cli/lib/substrate-version.d.ts.map +1 -0
  354. package/dist/cli/lib/substrate-version.js +97 -0
  355. package/dist/cli/lib/substrate-version.js.map +1 -0
  356. package/dist/cli/lib/teacher-identity.d.ts +24 -0
  357. package/dist/cli/lib/teacher-identity.d.ts.map +1 -0
  358. package/dist/cli/lib/teacher-identity.js +123 -0
  359. package/dist/cli/lib/teacher-identity.js.map +1 -0
  360. package/dist/cli/lib/telemetry-log.d.ts +22 -0
  361. package/dist/cli/lib/telemetry-log.d.ts.map +1 -0
  362. package/dist/cli/lib/telemetry-log.js +50 -0
  363. package/dist/cli/lib/telemetry-log.js.map +1 -0
  364. package/dist/cli/lib/trace-failure-kind.d.ts +4 -0
  365. package/dist/cli/lib/trace-failure-kind.d.ts.map +1 -0
  366. package/dist/cli/lib/trace-failure-kind.js +23 -0
  367. package/dist/cli/lib/trace-failure-kind.js.map +1 -0
  368. package/dist/cli/lib/trace.d.ts +25 -0
  369. package/dist/cli/lib/trace.d.ts.map +1 -0
  370. package/dist/cli/lib/trace.js +121 -0
  371. package/dist/cli/lib/trace.js.map +1 -0
  372. package/dist/cli/lib/triage-logic.d.ts +10 -0
  373. package/dist/cli/lib/triage-logic.d.ts.map +1 -0
  374. package/dist/cli/lib/triage-logic.js +105 -0
  375. package/dist/cli/lib/triage-logic.js.map +1 -0
  376. package/dist/cli/lib/types.d.ts +62 -0
  377. package/dist/cli/lib/types.d.ts.map +1 -0
  378. package/dist/cli/lib/types.js +2 -0
  379. package/dist/cli/lib/types.js.map +1 -0
  380. package/dist/cli/lib/upgrade-apply.d.ts +15 -0
  381. package/dist/cli/lib/upgrade-apply.d.ts.map +1 -0
  382. package/dist/cli/lib/upgrade-apply.js +122 -0
  383. package/dist/cli/lib/upgrade-apply.js.map +1 -0
  384. package/dist/cli/lib/upgrade-eligible-assets.d.ts +5 -0
  385. package/dist/cli/lib/upgrade-eligible-assets.d.ts.map +1 -0
  386. package/dist/cli/lib/upgrade-eligible-assets.js +9 -0
  387. package/dist/cli/lib/upgrade-eligible-assets.js.map +1 -0
  388. package/dist/cli/lib/upgrade-plan.d.ts +43 -0
  389. package/dist/cli/lib/upgrade-plan.d.ts.map +1 -0
  390. package/dist/cli/lib/upgrade-plan.js +220 -0
  391. package/dist/cli/lib/upgrade-plan.js.map +1 -0
  392. package/dist/cli/lib/upgrade-profile.d.ts +4 -0
  393. package/dist/cli/lib/upgrade-profile.d.ts.map +1 -0
  394. package/dist/cli/lib/upgrade-profile.js +27 -0
  395. package/dist/cli/lib/upgrade-profile.js.map +1 -0
  396. package/dist/cli/lib/user-error.d.ts +20 -0
  397. package/dist/cli/lib/user-error.d.ts.map +1 -0
  398. package/dist/cli/lib/user-error.js +64 -0
  399. package/dist/cli/lib/user-error.js.map +1 -0
  400. package/dist/cli/lib/verify-engine.d.ts +33 -0
  401. package/dist/cli/lib/verify-engine.d.ts.map +1 -0
  402. package/dist/cli/lib/verify-engine.js +104 -0
  403. package/dist/cli/lib/verify-engine.js.map +1 -0
  404. package/dist/cli/lib/verify-failure-presentation.d.ts +31 -0
  405. package/dist/cli/lib/verify-failure-presentation.d.ts.map +1 -0
  406. package/dist/cli/lib/verify-failure-presentation.js +93 -0
  407. package/dist/cli/lib/verify-failure-presentation.js.map +1 -0
  408. package/dist/cli/lib/verify-flow.d.ts +21 -0
  409. package/dist/cli/lib/verify-flow.d.ts.map +1 -0
  410. package/dist/cli/lib/verify-flow.js +103 -0
  411. package/dist/cli/lib/verify-flow.js.map +1 -0
  412. package/dist/cli/lib/verify-repair.d.ts +4 -0
  413. package/dist/cli/lib/verify-repair.d.ts.map +1 -0
  414. package/dist/cli/lib/verify-repair.js +61 -0
  415. package/dist/cli/lib/verify-repair.js.map +1 -0
  416. package/dist/cli/lib/verify-types.d.ts +21 -0
  417. package/dist/cli/lib/verify-types.d.ts.map +1 -0
  418. package/dist/cli/lib/verify-types.js +2 -0
  419. package/dist/cli/lib/verify-types.js.map +1 -0
  420. package/dist/cli/lib/version.gen.d.ts +4 -0
  421. package/dist/cli/lib/version.gen.d.ts.map +1 -0
  422. package/dist/cli/lib/version.gen.js +4 -0
  423. package/dist/cli/lib/version.gen.js.map +1 -0
  424. package/dist/cli/lib/worker-log-line-map.d.ts +12 -0
  425. package/dist/cli/lib/worker-log-line-map.d.ts.map +1 -0
  426. package/dist/cli/lib/worker-log-line-map.js +29 -0
  427. package/dist/cli/lib/worker-log-line-map.js.map +1 -0
  428. package/dist/cli/lib/workspace.d.ts +11 -0
  429. package/dist/cli/lib/workspace.d.ts.map +1 -0
  430. package/dist/cli/lib/workspace.js +14 -0
  431. package/dist/cli/lib/workspace.js.map +1 -0
  432. package/dist/cli/program-arch.d.ts +3 -0
  433. package/dist/cli/program-arch.d.ts.map +1 -0
  434. package/dist/cli/program-arch.js +45 -0
  435. package/dist/cli/program-arch.js.map +1 -0
  436. package/dist/cli/program-core.d.ts +3 -0
  437. package/dist/cli/program-core.d.ts.map +1 -0
  438. package/dist/cli/program-core.js +154 -0
  439. package/dist/cli/program-core.js.map +1 -0
  440. package/dist/cli/program-mcp.d.ts +3 -0
  441. package/dist/cli/program-mcp.d.ts.map +1 -0
  442. package/dist/cli/program-mcp.js +12 -0
  443. package/dist/cli/program-mcp.js.map +1 -0
  444. package/dist/cli/program-mission.d.ts +3 -0
  445. package/dist/cli/program-mission.d.ts.map +1 -0
  446. package/dist/cli/program-mission.js +77 -0
  447. package/dist/cli/program-mission.js.map +1 -0
  448. package/dist/cli/program-teacher.d.ts +3 -0
  449. package/dist/cli/program-teacher.d.ts.map +1 -0
  450. package/dist/cli/program-teacher.js +19 -0
  451. package/dist/cli/program-teacher.js.map +1 -0
  452. package/dist/cli/program-workflow.d.ts +3 -0
  453. package/dist/cli/program-workflow.d.ts.map +1 -0
  454. package/dist/cli/program-workflow.js +81 -0
  455. package/dist/cli/program-workflow.js.map +1 -0
  456. package/dist/cli/program.d.ts +4 -0
  457. package/dist/cli/program.d.ts.map +1 -0
  458. package/dist/cli/program.js +25 -0
  459. package/dist/cli/program.js.map +1 -0
  460. package/package.json +66 -0
  461. package/templates/.cursor/hooks/gxt-before-shell.sh +63 -0
  462. package/templates/.cursor/hooks/gxt-session-start.sh +68 -0
  463. package/templates/.cursor/hooks.json +15 -0
  464. package/templates/.cursor/mcp.json +8 -0
  465. package/templates/.cursor/rules/opengantry-gxt-substrate.mdc +43 -0
  466. package/templates/.gitagent/ARCHITECTURE.pointer.external.example.json +13 -0
  467. package/templates/.gitagent/ARCHITECTURE.pointer.json +9 -0
  468. package/templates/.gitagent/foreman/BYPASS.sha256 +2 -0
  469. package/templates/.gitagent/foreman/MANIFEST.json +37 -0
  470. package/templates/.gitagent/foreman/SUBSTRATE.version.json +6 -0
  471. package/templates/.gitagent/foreman/TEACHER.allowlist.example +4 -0
  472. package/templates/.gitagent/missions/README.md +18 -0
  473. package/templates/.gitagent/teacher/ARCHITECTURE-ACCESS.md +85 -0
  474. package/templates/.gitagent/teacher/ARCHITECTURE-DISCOVERY.md +40 -0
  475. package/templates/.gitagent/teacher/MISSION-ARCHITECT.md +93 -0
  476. package/templates/.gitagent/teacher/MISSION.schema.yaml +80 -0
  477. package/templates/.gitagent/teacher/RULES.md +36 -0
  478. package/templates/.gitagent/teacher/WORKER_LOG.template.md +2 -0
  479. package/templates/.githooks/post-checkout +26 -0
  480. package/templates/.githooks/pre-push +53 -0
  481. package/templates/.github/workflows/gxt-validate.yml +129 -0
  482. package/templates/.gitignore.gxt +8 -0
  483. package/templates/AGENTS.md +24 -0
  484. package/templates/docs/ARCHITECTURE.md +23 -0
  485. package/templates/integrations/aider/.aider.conf.yml +4 -0
  486. package/templates/integrations/antigravity/.agent/rules/gxt.md +11 -0
  487. package/templates/integrations/claude-code/CLAUDE.md +9 -0
  488. package/templates/integrations/cline/.clinerules/gxt.md +7 -0
  489. package/templates/integrations/codex-cli/.codex/config.toml +3 -0
  490. package/templates/integrations/compatibility.json +92 -0
  491. package/templates/integrations/junie/.junie/guidelines.md +11 -0
  492. package/templates/integrations/opencode/opencode.json +3 -0
  493. package/templates/integrations/openhands/.openhands/microagents/gxt.md +11 -0
  494. package/templates/integrations/recipes/_footer.md +20 -0
  495. package/templates/integrations/recipes/_preamble.md +46 -0
  496. package/templates/integrations/recipes/aider.md +13 -0
  497. package/templates/integrations/recipes/antigravity.md +8 -0
  498. package/templates/integrations/recipes/claude-code.md +14 -0
  499. package/templates/integrations/recipes/cline.md +8 -0
  500. package/templates/integrations/recipes/codex-cli.md +16 -0
  501. package/templates/integrations/recipes/cursor.md +19 -0
  502. package/templates/integrations/recipes/junie.md +8 -0
  503. package/templates/integrations/recipes/opencode.md +8 -0
  504. package/templates/integrations/recipes/openhands.md +8 -0
  505. package/templates/scripts/dev-validate.sh +24 -0
  506. package/templates/scripts/gxt-cursor-env.sh +5 -0
  507. package/templates/scripts/gxt-manifest-lib.mjs +139 -0
  508. package/templates/scripts/gxt-pin-mission.sh +31 -0
  509. package/templates/scripts/gxt-resolve-mission.sh +47 -0
  510. package/templates/scripts/gxt-runtime-env.sh +32 -0
  511. package/templates/scripts/validate-gxt.sh +184 -0
  512. package/templates/skills/gapman.md +5 -0
  513. package/templates/skills/logic.md +3 -0
  514. package/templates/skills/substrate.md +3 -0
  515. package/templates/skills/ui.md +3 -0
@@ -0,0 +1,156 @@
1
+ import path from "node:path";
2
+ import fs from "node:fs";
3
+ import { CLI_NAME } from "./constants.js";
4
+ import { logError, logInfo, setExitCode } from "./cli-io.js";
5
+ import { teacherMissionStamped } from "./git-proof.js";
6
+ import { ONBOARDING_ADOPTION_DOC, onboardingRuntimeEnvHint, onboardingStatusHint, onboardingVerifyHint, tutorialTeacherStampBlock, TUTORIAL_INTENT, TUTORIAL_MSN_ID, } from "./onboarding-flow.js";
7
+ import { runStartOrchestration } from "./start-orchestration.js";
8
+ import { loadWorkspace } from "./workspace.js";
9
+ import { runVerify } from "../commands/verify.js";
10
+ function findExistingTutorialMission(repoRoot) {
11
+ const missionsDir = path.join(repoRoot, ".gitagent", "missions");
12
+ if (!fs.existsSync(missionsDir))
13
+ return null;
14
+ for (const name of fs.readdirSync(missionsDir)) {
15
+ if (name.startsWith(`${TUTORIAL_MSN_ID}.`) && name.endsWith(".yaml")) {
16
+ return `.gitagent/missions/${name}`;
17
+ }
18
+ }
19
+ return null;
20
+ }
21
+ function pickTutorialSkillKey(skillKeys) {
22
+ const preferred = ["logic", "ui", "gapman"];
23
+ for (const key of preferred) {
24
+ if (skillKeys.includes(key))
25
+ return key;
26
+ }
27
+ const nonSubstrate = skillKeys.filter((k) => k !== "substrate");
28
+ return nonSubstrate[0] ?? skillKeys[0] ?? "logic";
29
+ }
30
+ function missionAbsolute(repoRoot, missionRel) {
31
+ return path.join(repoRoot, missionRel.split("/").join(path.sep));
32
+ }
33
+ async function confirmTeacherStamp(p, repoRoot, missionPath) {
34
+ while (true) {
35
+ logInfo(tutorialTeacherStampBlock(missionPath, TUTORIAL_MSN_ID));
36
+ const ready = await p.confirm({
37
+ message: "I've run the git commands above (gapman will check git history before continuing)",
38
+ initialValue: false,
39
+ });
40
+ if (p.isCancel(ready) || !ready)
41
+ return false;
42
+ if (teacherMissionStamped(repoRoot, missionAbsolute(repoRoot, missionPath), { msnId: TUTORIAL_MSN_ID })) {
43
+ p.log.success("Teacher stamp OK — [MSN-9001] commit touches this mission file");
44
+ return true;
45
+ }
46
+ p.log.warn("Git-proof not satisfied yet: no allowlisted Teacher commit [MSN-9001] modifying this mission file.");
47
+ const retry = await p.confirm({
48
+ message: "Run the commands above in another terminal, then check again?",
49
+ initialValue: true,
50
+ });
51
+ if (p.isCancel(retry) || !retry)
52
+ return false;
53
+ }
54
+ }
55
+ function verifyExitOk() {
56
+ const code = process.exitCode;
57
+ return code === undefined || code === 0;
58
+ }
59
+ async function scaffoldTutorialMission(p, repoRoot, skillKey) {
60
+ p.log.step("Step 2 — Scaffold tutorial mission (gapman start)");
61
+ const existing = findExistingTutorialMission(repoRoot);
62
+ if (existing) {
63
+ p.log.message(`Using existing tutorial mission: ${existing}`);
64
+ return existing;
65
+ }
66
+ const start = runStartOrchestration({
67
+ intent: TUTORIAL_INTENT,
68
+ msn: TUTORIAL_MSN_ID,
69
+ skillKey,
70
+ gateCommand: "gapman check",
71
+ writeMission: true,
72
+ silent: true,
73
+ audience: "teacher",
74
+ });
75
+ if (!start.ok || !start.mission_file_path) {
76
+ logError("Tutorial start failed — run gapman onboarding or pass --skill-key");
77
+ setExitCode(start.exit_code);
78
+ p.outro("Tutorial incomplete");
79
+ return null;
80
+ }
81
+ p.log.success(`Mission scaffold: ${start.mission_file_path}`);
82
+ return start.mission_file_path;
83
+ }
84
+ async function runTutorialVerifyStep(p, missionPath) {
85
+ p.log.step("Step 5 — Verify");
86
+ logInfo(` ${onboardingVerifyHint(missionPath)}`);
87
+ const runVerifyNow = await p.confirm({
88
+ message: "Run gapman verify now (git-proof, gate, trace — expect errors until trace is complete)?",
89
+ initialValue: true,
90
+ });
91
+ if (p.isCancel(runVerifyNow) || !runVerifyNow) {
92
+ return { verifyOk: true, ranVerify: false };
93
+ }
94
+ process.exitCode = undefined;
95
+ await runVerify({
96
+ mission: missionPath,
97
+ fix: true,
98
+ fixNonInteractive: true,
99
+ audience: "teacher",
100
+ });
101
+ const verifyOk = verifyExitOk();
102
+ if (!verifyOk) {
103
+ p.log.warn("Verify did not pass yet — expected until gate runs and trace rows cite WORKER_LOG.md");
104
+ }
105
+ return { verifyOk, ranVerify: true };
106
+ }
107
+ function emitTutorialOutro(p, missionPath, verifyOk, ranVerify) {
108
+ if (!verifyOk) {
109
+ setExitCode(typeof process.exitCode === "number" ? process.exitCode : 1);
110
+ p.outro(`Tutorial incomplete — finish stamp/trace, then: gapman verify --mission ${missionPath} — see ${ONBOARDING_ADOPTION_DOC}`);
111
+ return;
112
+ }
113
+ if (!ranVerify) {
114
+ p.outro(`Tutorial paused before verify — run: gapman verify --mission ${missionPath} — see ${ONBOARDING_ADOPTION_DOC}`);
115
+ return;
116
+ }
117
+ p.outro(`Tutorial complete — full loop: ${ONBOARDING_ADOPTION_DOC}`);
118
+ }
119
+ export async function runInitTutorial() {
120
+ const p = await import("@clack/prompts");
121
+ const { root: repoRoot, manifest } = loadWorkspace();
122
+ const manifestPath = path.join(repoRoot, ".gitagent", "foreman", "MANIFEST.json");
123
+ if (!fs.existsSync(manifestPath)) {
124
+ logError("init --tutorial: substrate missing — init must complete before tutorial");
125
+ setExitCode(2);
126
+ return;
127
+ }
128
+ p.intro(`${CLI_NAME} init --tutorial — first mission loop (~3 min)`);
129
+ const confirm = await p.confirm({
130
+ message: "Walk through scaffold → Teacher stamp → trace → verify (strict checks)?",
131
+ initialValue: true,
132
+ });
133
+ if (p.isCancel(confirm) || !confirm) {
134
+ p.cancel("Tutorial skipped");
135
+ return;
136
+ }
137
+ p.log.step("Step 1 — Teacher allowlist");
138
+ logInfo(' gapman teacher set "$(git config user.email)"');
139
+ const missionPath = await scaffoldTutorialMission(p, repoRoot, pickTutorialSkillKey(Object.keys(manifest.skills)));
140
+ if (!missionPath)
141
+ return;
142
+ p.log.step("Step 3 — Teacher stamp (manual, required)");
143
+ if (!(await confirmTeacherStamp(p, repoRoot, missionPath))) {
144
+ p.note("Verify will fail until git-proof passes. Re-run: gapman verify --mission " + missionPath, "Paused");
145
+ p.outro(`Tutorial paused — see ${ONBOARDING_ADOPTION_DOC}`);
146
+ return;
147
+ }
148
+ p.log.step("Step 4 — Worker trace");
149
+ logInfo(` ${onboardingRuntimeEnvHint(missionPath)}`);
150
+ logInfo(" Append a unique gate evidence line to WORKER_LOG.md, then set mission trace_row PASS + trace_quote");
151
+ const { verifyOk, ranVerify } = await runTutorialVerifyStep(p, missionPath);
152
+ p.log.step("Step 6 — Status dashboard");
153
+ logInfo(` ${onboardingStatusHint()}`);
154
+ emitTutorialOutro(p, missionPath, verifyOk, ranVerify);
155
+ }
156
+ //# sourceMappingURL=init-tutorial.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init-tutorial.js","sourceRoot":"","sources":["../../../src/cli/lib/init-tutorial.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACxB,oBAAoB,EACpB,oBAAoB,EACpB,yBAAyB,EACzB,eAAe,EACf,eAAe,GAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAIlD,SAAS,2BAA2B,CAAC,QAAgB;IACnD,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;IACjE,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC;QAAE,OAAO,IAAI,CAAC;IAC7C,KAAK,MAAM,IAAI,IAAI,EAAE,CAAC,WAAW,CAAC,WAAW,CAAC,EAAE,CAAC;Q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declare const INTEGRATION_IDE_KEYS: readonly ["cursor", "claude-code", "codex-cli", "opencode", "junie", "antigravity", "cline", "aider", "openhands"];
2
+ export type IntegrationIdeKey = (typeof INTEGRATION_IDE_KEYS)[number];
3
+ export interface IntegrationCompatEntry {
4
+ display_name: string;
5
+ verified_date: string;
6
+ docs_url: string;
7
+ recipe_file: string;
8
+ canonical_paths: string[];
9
+ deprecated_paths: string[];
10
+ hooks_schema_version?: number;
11
+ cli_probe?: string[] | null;
12
+ disambiguation?: string;
13
+ }
14
+ export interface IntegrationCompatManifest {
15
+ schema_version: string;
16
+ opengantry_version: string;
17
+ integrations: Record<IntegrationIdeKey, IntegrationCompatEntry>;
18
+ }
19
+ export declare function isIntegrationIdeKey(key: string): key is IntegrationIdeKey;
20
+ export declare function resolveTemplateRootFromModule(): string;
21
+ export declare function loadIntegrationCompat(templatesRoot?: string): IntegrationCompatManifest;
22
+ export declare function validateIntegrationCompat(manifest: IntegrationCompatManifest): void;
23
+ export declare function integrationWizardLabel(entry: IntegrationCompatEntry): string;
24
+ //# sourceMappingURL=integration-compat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"integration-compat.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/integration-compat.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,oBAAoB,oHAUvB,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtE,MAAM,WAAW,sBAAsB;IACrC,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,yBAAyB;IACxC,cAAc,EAAE,MAAM,CAAC;IACvB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,YAAY,EAAE,MAAM,CAAC,iBAAiB,EAAE,sBAAsB,CAAC,CAAC;CACjE;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,IAAI,iBAAiB,CAEzE;AAED,wBAAgB,6BAA6B,IAAI,MAAM,CAOtD;AAED,wBAAgB,qBAAqB,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,yBAAyB,CAMvF;AAED,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,yBAAyB,GAAG,IAAI,CAUnF;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,sBAAsB,GAAG,MAAM,CAE5E"}
@@ -0,0 +1,50 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ export const INTEGRATION_IDE_KEYS = [
5
+ "cursor",
6
+ "claude-code",
7
+ "codex-cli",
8
+ "opencode",
9
+ "junie",
10
+ "antigravity",
11
+ "cline",
12
+ "aider",
13
+ "openhands",
14
+ ];
15
+ export function isIntegrationIdeKey(key) {
16
+ return INTEGRATION_IDE_KEYS.includes(key);
17
+ }
18
+ export function resolveTemplateRootFromModule() {
19
+ const moduleDir = path.dirname(fileURLToPath(import.meta.url));
20
+ const root = path.resolve(moduleDir, "../../../templates");
21
+ if (!fs.existsSync(root)) {
22
+ throw new Error(`missing templates directory at ${root}`);
23
+ }
24
+ return root;
25
+ }
26
+ export function loadIntegrationCompat(templatesRoot) {
27
+ const root = templatesRoot ?? resolveTemplateRootFromModule();
28
+ const compatPath = path.join(root, "integrations/compatibility.json");
29
+ const raw = JSON.parse(fs.readFileSync(compatPath, "utf8"));
30
+ validateIntegrationCompat(raw);
31
+ return raw;
32
+ }
33
+ export function validateIntegrationCompat(manifest) {
34
+ if (manifest.schema_version !== "1") {
35
+ throw new Error(`integration compat: unsupported schema_version ${manifest.schema_version}`);
36
+ }
37
+ for (const key of INTEGRATION_IDE_KEYS) {
38
+ const entry = manifest.integrations[key];
39
+ if (!entry)
40
+ throw new Error(`integration compat: missing entry for ${key}`);
41
+ if (!entry.recipe_file)
42
+ throw new Error(`integration compat: ${key} missing recipe_file`);
43
+ if (!entry.display_name)
44
+ throw new Error(`integration compat: ${key} missing display_name`);
45
+ }
46
+ }
47
+ export function integrationWizardLabel(entry) {
48
+ return `${entry.display_name} (verified ${entry.verified_date})`;
49
+ }
50
+ //# sourceMappingURL=integration-compat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"integration-compat.js","sourceRoot":"","sources":["../../../src/cli/lib/integration-compat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,QAAQ;IACR,aAAa;IACb,WAAW;IACX,UAAU;IACV,OAAO;IACP,aAAa;IACb,OAAO;IACP,OAAO;IACP,WAAW;CACH,CAAC;AAsBX,MAAM,UAAU,mBAAmB,CAAC,GAAW;IAC7C,OAAQ,oBAA0C,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AACnE,CAAC;AAED,MAAM,UAAU,6BAA6B;IAC3C,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/D,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;IAC3D,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,kCAAkC,IAAI,EAAE,CAAC,CAAC;IAC5D,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,aAAsB;IAC1D,MAAM,IAAI,GAAG,aAAa,IAAI,6BAA6B,EAAE,CAAC;IAC9D,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,iCAAiC,CAAC,CAAC;IACtE,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAA8B,CAAC;IACzF,yBAAyB,CAAC,GAAG,CAAC,CAAC;IAC/B,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,QAAmC;IAC3E,IAAI,QAAQ,CAAC,cAAc,KAAK,GAAG,EAAE,CAAC;QACpC,MAAM,IAAI,KAAK,CAAC,kDAAkD,QAAQ,CAAC,cAAc,EAAE,CAAC,CAAC;IAC/F,CAAC;IACD,KAAK,MAAM,GAAG,IAAI,oBAAoB,EAAE,CAAC;QACvC,MAAM,KAAK,GAAG,QAAQ,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;QACzC,IAAI,CAAC,KAAK;YAAE,MAAM,IAAI,KAAK,CAAC,yCAAyC,GAAG,EAAE,CAAC,CAAC;QAC5E,IAAI,CAAC,KAAK,CAAC,WAAW;YAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,GAAG,sBAAsB,CAAC,CAAC;QAC1F,IAAI,CAAC,KAAK,CAAC,YAAY;YAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,GAAG,uBAAuB,CAAC,CAAC;IAC9F,CAAC;AACH,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,KAA6B;IAClE,OAAO,GAAG,KAAK,CAAC,YAAY,cAAc,KAAK,CAAC,aAAa,GAAG,CAAC;AACnE,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { Manifest } from "./types.js";
2
+ import type { TriageResult } from "./types.js";
3
+ export declare function isTriageEscalated(triage: TriageResult): boolean;
4
+ export type ResolveSkillKeyResult = {
5
+ ok: true;
6
+ skillKey: string;
7
+ triage: TriageResult;
8
+ } | {
9
+ ok: false;
10
+ triage: TriageResult;
11
+ reason: string;
12
+ kind: "unknown_skill" | "escalated";
13
+ };
14
+ export declare function resolveSkillKeyForLegislation(opts: {
15
+ root: string;
16
+ manifest: Manifest;
17
+ intent: string;
18
+ skillKey?: string;
19
+ }): ResolveSkillKeyResult;
20
+ //# sourceMappingURL=legislate-skill.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"legislate-skill.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/legislate-skill.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG/C,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAE/D;AAED,MAAM,MAAM,qBAAqB,GAC7B;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,YAAY,CAAA;CAAE,GACpD;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,YAAY,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,eAAe,GAAG,WAAW,CAAA;CAAE,CAAC;AAE7F,wBAAgB,6BAA6B,CAAC,IAAI,EAAE;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,QAAQ,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,qBAAqB,CAyBxB"}
@@ -0,0 +1,30 @@
1
+ import { triageIntent } from "./triage-logic.js";
2
+ export function isTriageEscalated(triage) {
3
+ return triage.action !== "DIRECT_EXECUTION" || triage.skill_key === "NONE";
4
+ }
5
+ export function resolveSkillKeyForLegislation(opts) {
6
+ const explicit = opts.skillKey?.trim();
7
+ if (explicit) {
8
+ if (!opts.manifest.skills[explicit]) {
9
+ return {
10
+ ok: false,
11
+ triage: triageIntent(opts.root, opts.intent, opts.manifest),
12
+ reason: `unknown skill_key "${explicit}" (manifest skills: ${Object.keys(opts.manifest.skills).join(", ")})`,
13
+ kind: "unknown_skill",
14
+ };
15
+ }
16
+ const triage = triageIntent(opts.root, opts.intent, opts.manifest);
17
+ return { ok: true, skillKey: explicit, triage };
18
+ }
19
+ const triage = triageIntent(opts.root, opts.intent, opts.manifest);
20
+ if (isTriageEscalated(triage)) {
21
+ return {
22
+ ok: false,
23
+ triage,
24
+ reason: `triage escalation — ${triage.reason}. Pass --skill-key <manifest skill> after Teacher assigns scope.`,
25
+ kind: "escalated",
26
+ };
27
+ }
28
+ return { ok: true, skillKey: triage.skill_key, triage };
29
+ }
30
+ //# sourceMappingURL=legislate-skill.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"legislate-skill.js","sourceRoot":"","sources":["../../../src/cli/lib/legislate-skill.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,UAAU,iBAAiB,CAAC,MAAoB;IACpD,OAAO,MAAM,CAAC,MAAM,KAAK,kBAAkB,IAAI,MAAM,CAAC,SAAS,KAAK,MAAM,CAAC;AAC7E,CAAC;AAMD,MAAM,UAAU,6BAA6B,CAAC,IAK7C;IACC,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC;IACvC,IAAI,QAAQ,EAAE,CAAC;QACb,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;YACpC,OAAO;gBACL,EAAE,EAAE,KAAK;gBACT,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC;gBAC3D,MAAM,EAAE,sBAAsB,QAAQ,uBAAuB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;gBAC5G,IAAI,EAAE,eAAe;aACtB,CAAC;QACJ,CAAC;QACD,MAAM,MAAM,GAAG,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QACnE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;IAClD,CAAC;IAED,MAAM,MAAM,GAAG,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IACnE,IAAI,iBAAiB,CAAC,MAAM,CAAC,EAAE,CAAC;QAC9B,OAAO;YACL,EAAE,EAAE,KAAK;YACT,MAAM;YACN,MAAM,EAAE,uBAAuB,MAAM,CAAC,MAAM,kEAAkE;YAC9G,IAAI,EAAE,WAAW;SAClB,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC;AAC1D,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { Manifest } from "./types.js";
2
+ export declare function manifestPath(root: string): string;
3
+ export declare function loadManifest(root: string): Manifest;
4
+ /** Mirrors scripts/validate-gxt.sh manifest checks */
5
+ export declare function validateManifestShape(m: unknown): asserts m is Manifest;
6
+ //# sourceMappingURL=manifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/manifest.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAQnD;AAED,sDAAsD;AACtD,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,IAAI,QAAQ,CA2BvE"}
@@ -0,0 +1,53 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ import { REL_MANIFEST } from "./constants.js";
4
+ export function manifestPath(root) {
5
+ return path.join(root, REL_MANIFEST);
6
+ }
7
+ export function loadManifest(root) {
8
+ const p = manifestPath(root);
9
+ if (!fs.existsSync(p)) {
10
+ throw new Error(`gapman: missing ${REL_MANIFEST}`);
11
+ }
12
+ const raw = JSON.parse(fs.readFileSync(p, "utf8"));
13
+ validateManifestShape(raw);
14
+ return raw;
15
+ }
16
+ /** Mirrors scripts/validate-gxt.sh manifest checks */
17
+ export function validateManifestShape(m) {
18
+ if (typeof m !== "object" || m === null)
19
+ throw new Error("MANIFEST: not an object");
20
+ const o = m;
21
+ if (typeof o.schema_version !== "string" || o.schema_version.length === 0) {
22
+ throw new Error("MANIFEST: schema_version must be a non-empty string");
23
+ }
24
+ if (typeof o.skills !== "object" || o.skills === null || Array.isArray(o.skills)) {
25
+ throw new Error("MANIFEST: skills must be an object");
26
+ }
27
+ const skills = o.skills;
28
+ if (Object.keys(skills).length === 0)
29
+ throw new Error("MANIFEST: skills must be non-empty");
30
+ if (typeof o.path_risks !== "object" || o.path_risks === null || Array.isArray(o.path_risks)) {
31
+ throw new Error("MANIFEST: path_risks must be an object");
32
+ }
33
+ if (!Array.isArray(o.risk_keywords))
34
+ throw new Error("MANIFEST: risk_keywords must be an array");
35
+ for (const k of Object.keys(skills)) {
36
+ const s = skills[k];
37
+ if (typeof s !== "object" || s === null)
38
+ throw new Error(`MANIFEST: skills.${k} must be an object`);
39
+ const sk = s;
40
+ if (!("trust_threshold" in sk))
41
+ throw new Error(`MANIFEST: skills.${k} missing trust_threshold`);
42
+ if (!("tmvc_roots" in sk))
43
+ throw new Error(`MANIFEST: skills.${k} missing tmvc_roots`);
44
+ if (!("forbidden_zones" in sk))
45
+ throw new Error(`MANIFEST: skills.${k} missing forbidden_zones`);
46
+ if (!Array.isArray(sk.tmvc_roots))
47
+ throw new Error(`MANIFEST: skills.${k}.tmvc_roots must be array`);
48
+ if (!Array.isArray(sk.forbidden_zones)) {
49
+ throw new Error(`MANIFEST: skills.${k}.forbidden_zones must be array`);
50
+ }
51
+ }
52
+ }
53
+ //# sourceMappingURL=manifest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../../src/cli/lib/manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,MAAM,CAAC,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IAC7B,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,mBAAmB,YAAY,EAAE,CAAC,CAAC;IACrD,CAAC;IACD,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,EAAE,MAAM,CAAC,CAAY,CAAC;IAC9D,qBAAqB,CAAC,GAAG,CAAC,CAAC;IAC3B,OAAO,GAAG,CAAC;AACb,CAAC;AAED,sDAAsD;AACtD,MAAM,UAAU,qBAAqB,CAAC,CAAU;IAC9C,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IACpF,M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C,CAAC,iBAAiB,IAAI,EAAE,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,0BAA0B,CAAC,CAAC;QACjG,IAAI,CAAC,CAAC,YAAY,IAAI,EAAE,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,qBAAqB,CAAC,CAAC;QACvF,IAAI,CAAC,CAAC,iBAAiB,IAAI,EAAE,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,0BAA0B,CAAC,CAAC;QACjG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,2BAA2B,CAAC,CAAC;QACrG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,eAAe,CAAC,EAAE,CAAC;YACvC,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,gCAAgC,CAAC,CAAC;QACzE,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,82 @@
1
+ export type McpToolStatus = "awaiting_human_approval" | "pending_signature" | "signature_valid" | "signature_missing" | "error";
2
+ export interface McpErrorBody {
3
+ code: string;
4
+ message: string;
5
+ retryable: boolean;
6
+ }
7
+ export interface DraftLegislationInput {
8
+ title: string;
9
+ msn_id: string;
10
+ skill_key: string;
11
+ gate_command: string;
12
+ gate_success_substring?: string;
13
+ }
14
+ export interface DraftLegislationResult {
15
+ status: "awaiting_human_approval";
16
+ draft_token: string;
17
+ chat_message_to_user: string;
18
+ expires_at: string;
19
+ requires_teacher_commit: true;
20
+ }
21
+ export interface ExecuteLegislationResult {
22
+ status: "pending_signature";
23
+ msn_id: string;
24
+ mission_file_path: string;
25
+ suggested_human_action: string;
26
+ commit_message: string;
27
+ commit_target: string;
28
+ requires_teacher_commit: true;
29
+ next_tool: "gxt_check_signature";
30
+ }
31
+ export interface CheckSignatureResult {
32
+ status: "signature_valid" | "signature_missing";
33
+ msn_id: string;
34
+ mission_file_path: string;
35
+ message: string;
36
+ next_tools?: string[];
37
+ }
38
+ export type PinMissionResult = {
39
+ status: "pinned";
40
+ mission_file_path: string;
41
+ message: string;
42
+ } | {
43
+ status: "error";
44
+ error: McpErrorBody;
45
+ };
46
+ export type ResolveMissionResult = {
47
+ status: "resolved";
48
+ mission_file_path: string;
49
+ } | {
50
+ status: "unpinned";
51
+ mission_file_path: null;
52
+ message: string;
53
+ };
54
+ export type LastErrorResult = {
55
+ status: "empty";
56
+ message: string;
57
+ } | {
58
+ status: "found";
59
+ payload: Record<string, unknown>;
60
+ } | {
61
+ status: "error";
62
+ message: string;
63
+ };
64
+ export declare function handleDraftLegislation(input: DraftLegislationInput): DraftLegislationResult | {
65
+ status: "error";
66
+ error: McpErrorBody;
67
+ };
68
+ export declare function handleExecuteLegislation(draftToken: string): ExecuteLegislationResult | {
69
+ status: "error";
70
+ error: McpErrorBody;
71
+ };
72
+ export declare function handleCheckSignature(missionFilePath: string): CheckSignatureResult | {
73
+ status: "error";
74
+ error: McpErrorBody;
75
+ };
76
+ export declare function handlePinMission(missionFilePath: string): PinMissionResult | {
77
+ status: "error";
78
+ error: McpErrorBody;
79
+ };
80
+ export declare function handleResolveMission(explicit?: string): ResolveMissionResult;
81
+ export declare function handleLastError(): LastErrorResult;
82
+ //# sourceMappingURL=mcp-legislation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-legislation.d.ts","sourceRoot":"","sources":["../../../src/cli/lib/mcp-legislation.ts"],"names":[],"mappings":"AAeA,MAAM,MAAM,aAAa,GACrB,yBAAyB,GACzB,mBAAmB,GACnB,iBAAiB,GACjB,mBAAmB,GACnB,OAAO,CAAC;AAEZ,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAC;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C;CACjB,CAAC;AAEN,MAAM,MAAM,eAAe,GACvB;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACpC;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,GACrD;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AA8CzC,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,qBAAqB,GAC3B,sBAAsB,GAAG;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,YAAY,CAAA;CAAE,CA6BnE;AAED,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,MAAM,GACjB,wBAAwB,GAAG;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,YAAY,CAAA;CAAE,CAwCrE;AAED,wBAAgB,oBAAoB,CAClC,eAAe,EAAE,MAAM,GACtB,oBAAoB,GAAG;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,YAAY,CAAA;CAAE,CA8BjE;AAED,wBAAgB,gBAAgB,CAAC,eAAe,EAAE,MAAM,GAAG,gBAAgB,GAAG;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,YAAY,CAAA;CAAE,CAcrH;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,oBAAoB,CAgB5E;AAED,wBAAgB,eAAe,IAAI,eAAe,CAYjD"}
@@ -0,0 +1,181 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ import { runLegislate } from "../commands/legislate.js";
4
+ import { formatRepoRelative } from "./cli-io.js";
5
+ import { MSN_ID_PATTERN } from "./constants.js";
6
+ import { DraftTokenError, createDraftToken, verifyDraftToken } from "./draft-token.js";
7
+ import { assertTeacherMissionProof } from "./git-proof.js";
8
+ import { pinMissionFile, resolveMissionFilePath, } from "./mission-path.js";
9
+ import { resolvePinnedMission } from "./mission-resolution.js";
10
+ import { GapmanUserError } from "./user-error.js";
11
+ import { loadWorkspace } from "./workspace.js";
12
+ function mcpError(code, message, retryable) {
13
+ return { status: "error", error: { code, message, retryable } };
14
+ }
15
+ function buildDraftChatMessage(input, manifestSkillDesc) {
16
+ const lines = [
17
+ "## Proposed GXT mission (draft — not yet written)",
18
+ "",
19
+ `- **Title:** ${input.title}`,
20
+ `- **MSN:** ${input.msn_id}`,
21
+ `- **Skill:** ${input.skill_key}`,
22
+ `- **Gate:** \`${input.gate_command}\``,
23
+ ];
24
+ if (input.gate_success_substring?.trim()) {
25
+ lines.push(`- **Gate success substring:** \`${input.gate_success_substring.trim()}\``);
26
+ }
27
+ if (manifestSkillDesc) {
28
+ lines.push(`- **Skill scope:** ${manifestSkillDesc}`);
29
+ }
30
+ lines.push("", "Reply with clear approval (e.g. **yes**, **approve**, **looks good**) to execute legislation, or **deny** / **no** to cancel.", "", "_No mission file will be written until you approve._");
31
+ return lines.join("\n");
32
+ }
33
+ function validateDraftInput(input) {
34
+ if (!input.title?.trim()) {
35
+ return { code: "VALIDATION_ERROR", message: "title is required", retryable: true };
36
+ }
37
+ if (!MSN_ID_PATTERN.test(input.msn_id?.trim() ?? "")) {
38
+ return { code: "VALIDATION_ERROR", message: 'msn_id must match "MSN-0007"', retryable: true };
39
+ }
40
+ if (!input.skill_key?.trim()) {
41
+ return { code: "VALIDATION_ERROR", message: "skill_key is required", retryable: true };
42
+ }
43
+ if (!input.gate_command?.trim()) {
44
+ return { code: "VALIDATION_ERROR", message: "gate_command is required", retryable: true };
45
+ }
46
+ return null;
47
+ }
48
+ export function handleDraftLegislation(input) {
49
+ const validation = validateDraftInput(input);
50
+ if (validation)
51
+ return mcpError(validation.code, validation.message, validation.retryable);
52
+ const { root, manifest } = loadWorkspace();
53
+ const skillKey = input.skill_key.trim();
54
+ if (!manifest.skills[skillKey]) {
55
+ return mcpError("UNKNOWN_SKILL", `unknown skill_key "${skillKey}" (manifest skills: ${Object.keys(manifest.skills).join(", ")})`, true);
56
+ }
57
+ const token = createDraftToken(root, {
58
+ title: input.title,
59
+ msn_id: input.msn_id.trim(),
60
+ skill_key: skillKey,
61
+ gate_command: input.gate_command,
62
+ gate_success_substring: input.gate_success_substring,
63
+ });
64
+ return {
65
+ status: "awaiting_human_approval",
66
+ draft_token: token.draft_token,
67
+ chat_message_to_user: buildDraftChatMessage(input, manifest.skills[skillKey]?.desc),
68
+ expires_at: token.expires_at,
69
+ requires_teacher_commit: true,
70
+ };
71
+ }
72
+ export function handleExecuteLegislation(draftToken) {
73
+ const { root } = loadWorkspace();
74
+ let payload;
75
+ try {
76
+ payload = verifyDraftToken(root, draftToken, { consume: true });
77
+ }
78
+ catch (err) {
79
+ if (err instanceof DraftTokenError) {
80
+ return mcpError(err.code, err.message, err.retryable);
81
+ }
82
+ throw err;
83
+ }
84
+ const legislateOpts = {
85
+ intent: payload.title,
86
+ msn: payload.msn_id,
87
+ skillKey: payload.skill_key,
88
+ gateCommand: payload.gate_command,
89
+ gateSuccessSubstring: payload.gate_success_substring,
90
+ };
91
+ const result = runLegislate(legislateOpts);
92
+ if (!result.ok) {
93
+ return mcpError("LEGISLATE_FAILED", "gapman legislate failed; check skill_key, msn, or output path", true);
94
+ }
95
+ const missionRel = formatRepoRelative(root, result.missionAbs);
96
+ const commitMessage = `[${payload.msn_id}] Legislate ${payload.title.replace(/"/g, '\\"')}`;
97
+ const suggestedHumanAction = `git add ${missionRel} && git commit -m "${commitMessage}"`;
98
+ return {
99
+ status: "pending_signature",
100
+ msn_id: payload.msn_id,
101
+ mission_file_path: missionRel,
102
+ suggested_human_action: suggestedHumanAction,
103
+ commit_message: commitMessage,
104
+ commit_target: missionRel,
105
+ requires_teacher_commit: true,
106
+ next_tool: "gxt_check_signature",
107
+ };
108
+ }
109
+ export function handleCheckSignature(missionFilePath) {
110
+ const { root } = loadWorkspace();
111
+ const missionAbs = resolveMissionFilePath(root, missionFilePath);
112
+ if (!fs.existsSync(missionAbs)) {
113
+ return mcpError("MISSION_NOT_FOUND", `mission file not found: ${missionFilePath}`, true);
114
+ }
115
+ try {
116
+ const msnId = assertTeacherMissionProof(root, missionAbs);
117
+ const rel = formatRepoRelative(root, missionAbs);
118
+ return {
119
+ status: "signature_valid",
120
+ msn_id: msnId,
121
+ mission_file_path: rel,
122
+ message: `Teacher signature valid for ${msnId}. You may pin the mission and begin worker execution.`,
123
+ next_tools: ["gxt_pin_mission", "gxt_runtime_env"],
124
+ };
125
+ }
126
+ catch (err) {
127
+ if (err instanceof GapmanUserError) {
128
+ return {
129
+ status: "signature_missing",
130
+ msn_id: "unknown",
131
+ mission_file_path: formatRepoRelative(root, missionAbs),
132
+ message: err.message,
133
+ next_tools: [],
134
+ };
135
+ }
136
+ throw err;
137
+ }
138
+ }
139
+ export function handlePinMission(missionFilePath) {
140
+ const { root } = loadWorkspace();
141
+ const missionAbs = resolveMissionFilePath(root, missionFilePath);
142
+ if (!fs.existsSync(missionAbs)) {
143
+ return mcpError("MISSION_NOT_FOUND", `mission file not found: ${missionFilePath}`, true);
144
+ }
145
+ const rel = pinMissionFile(root, missionAbs);
146
+ return {
147
+ status: "pinned",
148
+ mission_file_path: rel,
149
+ message: `Pinned active mission: ${rel}`,
150
+ };
151
+ }
152
+ export function handleResolveMission(explicit) {
153
+ const { root } = loadWorkspace();
154
+ const resolved = resolvePinnedMission(root, {
155
+ explicit,
156
+ profile: "full",
157
+ });
158
+ if (resolved) {
159
+ return { status: "resolved", mission_file_path: resolved };
160
+ }
161
+ return {
162
+ status: "unpinned",
163
+ mission_file_path: null,
164
+ message: "No active mission pinned. Run Mission Architect / gxt_draft_legislation first.",
165
+ };
166
+ }
167
+ export function handleLastError() {
168
+ const { root } = loadWorkspace();
169
+ const errPath = path.join(root, ".gitagent", "history", ".ignored-last-error.json");
170
+ if (!fs.existsSync(errPath)) {
171
+ return { status: "empty", message: "No last error recorded." };
172
+ }
173
+ try {
174
+ const payload = JSON.parse(fs.readFileSync(errPath, "utf8"));
175
+ return { status: "found", payload };
176
+ }
177
+ catch {
178
+ return { status: "error", message: "Failed to parse last error file." };
179
+ }
180
+ }
181
+ //# sourceMappingURL=mcp-legislation.js.map