@interf/compiler 0.9.5 → 0.16.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 (365) hide show
  1. package/README.md +135 -91
  2. package/TRADEMARKS.md +2 -13
  3. package/agent-skills/interf-actions/SKILL.md +143 -38
  4. package/agent-skills/interf-actions/references/cli.md +134 -67
  5. package/builtin-methods/interf-default/README.md +3 -4
  6. package/builtin-methods/interf-default/compile/stages/shape/SKILL.md +2 -2
  7. package/builtin-methods/interf-default/compile/stages/summarize/SKILL.md +2 -1
  8. package/builtin-methods/interf-default/improve/SKILL.md +1 -1
  9. package/builtin-methods/interf-default/method.json +10 -4
  10. package/builtin-methods/interf-default/method.schema.json +0 -9
  11. package/builtin-methods/interf-default/use/query/SKILL.md +5 -5
  12. package/dist/cli/commands/agents.d.ts +2 -0
  13. package/dist/cli/commands/agents.js +213 -0
  14. package/dist/cli/commands/compile.d.ts +8 -25
  15. package/dist/cli/commands/compile.js +83 -359
  16. package/dist/cli/commands/doctor.js +2 -2
  17. package/dist/cli/commands/login.d.ts +7 -0
  18. package/dist/cli/commands/login.js +39 -0
  19. package/dist/cli/commands/logout.d.ts +2 -0
  20. package/dist/cli/commands/logout.js +16 -0
  21. package/dist/cli/commands/mcp.d.ts +42 -0
  22. package/dist/cli/commands/mcp.js +239 -0
  23. package/dist/cli/commands/method.d.ts +2 -0
  24. package/dist/cli/commands/method.js +113 -0
  25. package/dist/cli/commands/prep.d.ts +2 -0
  26. package/dist/cli/commands/prep.js +152 -0
  27. package/dist/cli/commands/reset.d.ts +8 -1
  28. package/dist/cli/commands/reset.js +47 -26
  29. package/dist/cli/commands/runs.d.ts +2 -0
  30. package/dist/cli/commands/runs.js +120 -0
  31. package/dist/cli/commands/status.d.ts +6 -1
  32. package/dist/cli/commands/status.js +68 -111
  33. package/dist/cli/commands/verify.d.ts +7 -1
  34. package/dist/cli/commands/verify.js +69 -85
  35. package/dist/cli/commands/web.d.ts +0 -9
  36. package/dist/cli/commands/web.js +201 -121
  37. package/dist/cli/commands/wizard.d.ts +9 -0
  38. package/dist/cli/commands/wizard.js +689 -0
  39. package/dist/cli/index.d.ts +10 -7
  40. package/dist/cli/index.js +19 -12
  41. package/dist/compiler-ui/404.html +1 -1
  42. package/dist/compiler-ui/__next.__PAGE__.txt +2 -2
  43. package/dist/compiler-ui/__next._full.txt +3 -3
  44. package/dist/compiler-ui/__next._head.txt +1 -1
  45. package/dist/compiler-ui/__next._index.txt +2 -2
  46. package/dist/compiler-ui/__next._tree.txt +2 -2
  47. package/dist/compiler-ui/_next/static/chunks/{177mvn4rse235.js → 0jipmpez3_ehh.js} +16 -16
  48. package/dist/compiler-ui/_next/static/chunks/{18a8f2jkv3z.c.css → 13awzu4tooflw.css} +1 -1
  49. package/dist/compiler-ui/_not-found/__next._full.txt +2 -2
  50. package/dist/compiler-ui/_not-found/__next._head.txt +1 -1
  51. package/dist/compiler-ui/_not-found/__next._index.txt +2 -2
  52. package/dist/compiler-ui/_not-found/__next._not-found.__PAGE__.txt +1 -1
  53. package/dist/compiler-ui/_not-found/__next._not-found.txt +1 -1
  54. package/dist/compiler-ui/_not-found/__next._tree.txt +2 -2
  55. package/dist/compiler-ui/_not-found.html +1 -1
  56. package/dist/compiler-ui/_not-found.txt +2 -2
  57. package/dist/compiler-ui/index.html +1 -1
  58. package/dist/compiler-ui/index.txt +3 -3
  59. package/dist/index.d.ts +2 -2
  60. package/dist/index.js +2 -2
  61. package/dist/packages/contracts/index.d.ts +2 -1
  62. package/dist/packages/contracts/index.js +1 -0
  63. package/dist/packages/contracts/lib/preparation-paths.d.ts +117 -0
  64. package/dist/packages/contracts/lib/preparation-paths.js +177 -0
  65. package/dist/packages/contracts/lib/schema.d.ts +187 -13
  66. package/dist/packages/contracts/lib/schema.js +148 -3
  67. package/dist/packages/contracts/utils/filesystem.d.ts +9 -0
  68. package/dist/packages/contracts/utils/filesystem.js +142 -0
  69. package/dist/packages/{local-service → engine}/action-definitions.d.ts +14 -14
  70. package/dist/packages/{local-service → engine}/action-definitions.js +35 -29
  71. package/dist/packages/{local-service → engine}/action-planner.d.ts +1 -1
  72. package/dist/packages/{local-service → engine}/action-planner.js +3 -2
  73. package/dist/packages/{agents → engine/agents}/index.d.ts +3 -0
  74. package/dist/packages/{agents → engine/agents}/index.js +3 -0
  75. package/dist/packages/{agents → engine/agents}/lib/compiled-bootstrap.js +2 -2
  76. package/dist/packages/engine/agents/lib/detection.d.ts +13 -0
  77. package/dist/packages/{agents → engine/agents}/lib/detection.js +11 -0
  78. package/dist/packages/{agents → engine/agents}/lib/executors.d.ts +2 -2
  79. package/dist/packages/{agents → engine/agents}/lib/shells.d.ts +5 -5
  80. package/dist/packages/{agents → engine/agents}/lib/shells.js +117 -58
  81. package/dist/packages/{agents → engine/agents}/lib/user-config.d.ts +4 -2
  82. package/dist/packages/engine/agents/lib/user-config.js +24 -0
  83. package/dist/packages/engine/agents/registry.d.ts +91 -0
  84. package/dist/packages/engine/agents/registry.js +321 -0
  85. package/dist/packages/engine/agents/role-executors.d.ts +35 -0
  86. package/dist/packages/engine/agents/role-executors.js +88 -0
  87. package/dist/packages/engine/agents/role-router.d.ts +66 -0
  88. package/dist/packages/engine/agents/role-router.js +73 -0
  89. package/dist/packages/{local-service → engine}/client.d.ts +59 -60
  90. package/dist/packages/{local-service → engine}/client.js +137 -145
  91. package/dist/packages/{compiler → engine/compile}/artifact-counts.js +1 -1
  92. package/dist/packages/{compiler → engine/compile}/compiled-paths.d.ts +9 -2
  93. package/dist/packages/{compiler → engine/compile}/compiled-paths.js +30 -15
  94. package/dist/packages/{compiler → engine/compile}/compiled-pipeline.d.ts +12 -1
  95. package/dist/packages/{compiler → engine/compile}/compiled-pipeline.js +39 -9
  96. package/dist/packages/{compiler → engine/compile}/compiled-schema.d.ts +2 -2
  97. package/dist/packages/{compiler → engine/compile}/compiled-schema.js +4 -4
  98. package/dist/packages/{compiler → engine/compile}/compiled-stage-plan.d.ts +1 -1
  99. package/dist/packages/{compiler → engine/compile}/compiled-stage-plan.js +8 -4
  100. package/dist/packages/{compiler → engine/compile}/compiled-stage-runner.d.ts +1 -1
  101. package/dist/packages/{compiler → engine/compile}/compiled-stage-runner.js +3 -3
  102. package/dist/packages/{compiler → engine/compile}/compiled-target.d.ts +3 -3
  103. package/dist/packages/{compiler → engine/compile}/compiled-target.js +3 -3
  104. package/dist/packages/{compiler → engine/compile}/discovery.js +1 -1
  105. package/dist/packages/{compiler → engine/compile}/index.d.ts +1 -0
  106. package/dist/packages/{compiler → engine/compile}/index.js +1 -0
  107. package/dist/packages/{compiler → engine/compile}/lib/schema.d.ts +26 -31
  108. package/dist/packages/{compiler → engine/compile}/lib/schema.js +2 -13
  109. package/dist/packages/engine/compile/method-runs.d.ts +14 -0
  110. package/dist/packages/{compiler → engine/compile}/method-runs.js +5 -6
  111. package/dist/packages/{compiler → engine/compile}/reset.js +3 -1
  112. package/dist/packages/{compiler → engine/compile}/runtime-acceptance.js +17 -14
  113. package/dist/packages/{compiler → engine/compile}/runtime-contracts.js +0 -3
  114. package/dist/packages/{compiler → engine/compile}/runtime-prompt.js +1 -1
  115. package/dist/packages/{compiler → engine/compile}/runtime-reconcile.d.ts +1 -1
  116. package/dist/packages/{compiler → engine/compile}/runtime-reconcile.js +12 -10
  117. package/dist/packages/{compiler → engine/compile}/runtime-runs.d.ts +1 -2
  118. package/dist/packages/{compiler → engine/compile}/runtime-runs.js +3 -43
  119. package/dist/packages/{compiler → engine/compile}/runtime-types.d.ts +1 -5
  120. package/dist/packages/{compiler → engine/compile}/runtime.d.ts +2 -2
  121. package/dist/packages/{compiler → engine/compile}/runtime.js +1 -1
  122. package/dist/packages/engine/compile/source-files.d.ts +46 -0
  123. package/dist/packages/engine/compile/source-files.js +149 -0
  124. package/dist/packages/engine/compile/state-artifacts.d.ts +9 -0
  125. package/dist/packages/{compiler → engine/compile}/state-artifacts.js +4 -3
  126. package/dist/packages/{compiler → engine/compile}/state-health.js +2 -2
  127. package/dist/packages/{compiler → engine/compile}/state-io.d.ts +3 -2
  128. package/dist/packages/{compiler → engine/compile}/state-io.js +13 -7
  129. package/dist/packages/{compiler → engine/compile}/state-paths.d.ts +2 -1
  130. package/dist/packages/engine/compile/state-paths.js +16 -0
  131. package/dist/packages/engine/compile/state-view.d.ts +5 -0
  132. package/dist/packages/{compiler → engine/compile}/state-view.js +20 -30
  133. package/dist/packages/engine/compile/state.d.ts +7 -0
  134. package/dist/packages/{compiler → engine/compile}/state.js +3 -3
  135. package/dist/packages/{compiler → engine/compile}/validate-compiled.js +2 -2
  136. package/dist/packages/{compiler → engine/compile}/validate.d.ts +1 -1
  137. package/dist/packages/{compiler → engine/compile}/validate.js +3 -3
  138. package/dist/packages/engine/connection-config.d.ts +38 -0
  139. package/dist/packages/engine/connection-config.js +75 -0
  140. package/dist/packages/{execution → engine/execution}/lib/schema.d.ts +52 -72
  141. package/dist/packages/{execution → engine/execution}/lib/schema.js +3 -3
  142. package/dist/packages/engine/index.d.ts +22 -0
  143. package/dist/packages/engine/index.js +15 -0
  144. package/dist/packages/engine/instance-paths.d.ts +100 -0
  145. package/dist/packages/engine/instance-paths.js +165 -0
  146. package/dist/packages/{local-service → engine}/lib/schema.d.ts +392 -2408
  147. package/dist/packages/{local-service → engine}/lib/schema.js +164 -76
  148. package/dist/packages/{local-service → engine}/native-run-handlers.d.ts +7 -5
  149. package/dist/packages/{local-service → engine}/native-run-handlers.js +71 -27
  150. package/dist/packages/engine/preparation-store.d.ts +104 -0
  151. package/dist/packages/engine/preparation-store.js +194 -0
  152. package/dist/packages/{local-service → engine}/readiness-check-draft.d.ts +2 -2
  153. package/dist/packages/engine/routes.d.ts +78 -0
  154. package/dist/packages/engine/routes.js +92 -0
  155. package/dist/packages/{local-service → engine}/run-observability.d.ts +3 -3
  156. package/dist/packages/{local-service → engine}/run-observability.js +25 -24
  157. package/dist/packages/engine/runtime-caches.d.ts +76 -0
  158. package/dist/packages/engine/runtime-caches.js +191 -0
  159. package/dist/packages/engine/runtime-event-applier.d.ts +12 -0
  160. package/dist/packages/engine/runtime-event-applier.js +177 -0
  161. package/dist/packages/engine/runtime-persistence.d.ts +47 -0
  162. package/dist/packages/engine/runtime-persistence.js +137 -0
  163. package/dist/packages/engine/runtime-proposal-helpers.d.ts +35 -0
  164. package/dist/packages/engine/runtime-proposal-helpers.js +251 -0
  165. package/dist/packages/engine/runtime-resource-builders.d.ts +52 -0
  166. package/dist/packages/engine/runtime-resource-builders.js +149 -0
  167. package/dist/packages/engine/runtime.d.ts +318 -0
  168. package/dist/packages/{local-service → engine}/runtime.js +835 -1011
  169. package/dist/packages/{local-service → engine}/server.d.ts +15 -0
  170. package/dist/packages/engine/server.js +1257 -0
  171. package/dist/packages/engine/service-registry.d.ts +47 -0
  172. package/dist/packages/engine/service-registry.js +137 -0
  173. package/dist/packages/{testing → engine/verify}/lib/schema.d.ts +11 -11
  174. package/dist/packages/{testing → engine/verify}/lib/schema.js +3 -3
  175. package/dist/packages/{testing → engine/verify}/readiness-check-run.d.ts +9 -16
  176. package/dist/packages/{testing → engine/verify}/readiness-check-run.js +38 -94
  177. package/dist/packages/{testing → engine/verify}/test-execution.js +6 -6
  178. package/dist/packages/{testing → engine/verify}/test-paths.js +5 -4
  179. package/dist/packages/{testing → engine/verify}/test-sandbox.d.ts +0 -1
  180. package/dist/packages/{testing → engine/verify}/test-sandbox.js +17 -33
  181. package/dist/packages/{testing → engine/verify}/test-specs.js +1 -1
  182. package/dist/packages/{testing → engine/verify}/test-targets.d.ts +1 -1
  183. package/dist/packages/{testing → engine/verify}/test-targets.js +9 -9
  184. package/dist/packages/{testing → engine/verify}/test.d.ts +1 -1
  185. package/dist/packages/{testing → engine/verify}/test.js +1 -1
  186. package/dist/packages/{method-authoring → methods/authoring}/method-authoring.d.ts +12 -4
  187. package/dist/packages/{method-authoring → methods/authoring}/method-authoring.js +70 -7
  188. package/dist/packages/{method-authoring → methods/authoring}/method-edit-session.d.ts +2 -2
  189. package/dist/packages/{method-authoring → methods/authoring}/method-improvement.d.ts +4 -4
  190. package/dist/packages/{method-authoring → methods/authoring}/method-improvement.js +16 -10
  191. package/dist/packages/{method-package → methods/package}/builtin-compiled-method.d.ts +4 -5
  192. package/dist/packages/{method-package → methods/package}/builtin-compiled-method.js +10 -16
  193. package/dist/packages/{method-package → methods/package}/context-interface.d.ts +5 -41
  194. package/dist/packages/{method-package → methods/package}/context-interface.js +3 -25
  195. package/dist/packages/{method-package → methods/package}/interf-method-package.d.ts +4 -4
  196. package/dist/packages/{method-package → methods/package}/interf-method-package.js +24 -35
  197. package/dist/packages/{method-package → methods/package}/lib/package-root.js +2 -2
  198. package/dist/packages/{method-package → methods/package}/local-methods.d.ts +18 -8
  199. package/dist/packages/{method-package → methods/package}/local-methods.js +64 -45
  200. package/dist/packages/{method-package → methods/package}/method-definitions.d.ts +16 -36
  201. package/dist/packages/{method-package → methods/package}/method-definitions.js +53 -40
  202. package/dist/packages/{method-package → methods/package}/method-helpers.d.ts +2 -14
  203. package/dist/packages/{method-package → methods/package}/method-helpers.js +12 -46
  204. package/dist/packages/{method-package → methods/package}/method-review-paths.d.ts +1 -1
  205. package/dist/packages/{method-package → methods/package}/method-review-paths.js +1 -1
  206. package/dist/packages/{method-package → methods/package}/method-stage-runner.d.ts +4 -9
  207. package/dist/packages/{method-package → methods/package}/method-stage-runner.js +3 -31
  208. package/dist/packages/methods/package/user-methods.d.ts +17 -0
  209. package/dist/packages/methods/package/user-methods.js +77 -0
  210. package/dist/packages/{project-model → project}/index.d.ts +0 -1
  211. package/dist/packages/{project-model → project}/index.js +0 -1
  212. package/dist/packages/{project-model → project}/interf-bootstrap.d.ts +1 -1
  213. package/dist/packages/{project-model → project}/interf-bootstrap.js +1 -1
  214. package/dist/packages/{project-model → project}/interf-detect.d.ts +8 -3
  215. package/dist/packages/{project-model → project}/interf-detect.js +38 -38
  216. package/dist/packages/project/interf-scaffold.d.ts +3 -0
  217. package/dist/packages/{project-model → project}/interf-scaffold.js +30 -39
  218. package/dist/packages/{project-model → project}/lib/schema.d.ts +2 -2
  219. package/dist/packages/{project-model → project}/lib/schema.js +39 -2
  220. package/dist/packages/project/preparation-entries.d.ts +11 -0
  221. package/dist/packages/{project-model → project}/preparation-entries.js +14 -14
  222. package/dist/packages/{project-model → project}/source-config.d.ts +12 -12
  223. package/dist/packages/{project-model → project}/source-config.js +81 -53
  224. package/dist/packages/{project-model → project}/source-folders.d.ts +5 -5
  225. package/dist/packages/{project-model → project}/source-folders.js +16 -16
  226. package/package.json +8 -8
  227. package/CHANGELOG.md +0 -93
  228. package/LICENSE +0 -183
  229. package/dist/cli/commands/action-input-cli.d.ts +0 -25
  230. package/dist/cli/commands/action-input-cli.js +0 -73
  231. package/dist/cli/commands/control-path.d.ts +0 -11
  232. package/dist/cli/commands/control-path.js +0 -72
  233. package/dist/cli/commands/create-method-wizard.d.ts +0 -64
  234. package/dist/cli/commands/create-method-wizard.js +0 -434
  235. package/dist/cli/commands/create.d.ts +0 -6
  236. package/dist/cli/commands/create.js +0 -183
  237. package/dist/cli/commands/default.d.ts +0 -2
  238. package/dist/cli/commands/default.js +0 -39
  239. package/dist/cli/commands/executor-flow.d.ts +0 -29
  240. package/dist/cli/commands/executor-flow.js +0 -163
  241. package/dist/cli/commands/init.d.ts +0 -26
  242. package/dist/cli/commands/init.js +0 -771
  243. package/dist/cli/commands/list.d.ts +0 -2
  244. package/dist/cli/commands/list.js +0 -30
  245. package/dist/cli/commands/preparation-action.d.ts +0 -8
  246. package/dist/cli/commands/preparation-action.js +0 -29
  247. package/dist/cli/commands/preparation-picker.d.ts +0 -5
  248. package/dist/cli/commands/preparation-picker.js +0 -36
  249. package/dist/cli/commands/preparation-selection.d.ts +0 -6
  250. package/dist/cli/commands/preparation-selection.js +0 -11
  251. package/dist/cli/commands/service-action-flow.d.ts +0 -9
  252. package/dist/cli/commands/service-action-flow.js +0 -19
  253. package/dist/cli/commands/source-config-wizard.d.ts +0 -51
  254. package/dist/cli/commands/source-config-wizard.js +0 -670
  255. package/dist/cli/commands/test.d.ts +0 -17
  256. package/dist/cli/commands/test.js +0 -188
  257. package/dist/packages/agents/lib/detection.d.ts +0 -7
  258. package/dist/packages/agents/lib/user-config.js +0 -16
  259. package/dist/packages/compiler/method-runs.d.ts +0 -15
  260. package/dist/packages/compiler/raw-snapshot.d.ts +0 -49
  261. package/dist/packages/compiler/raw-snapshot.js +0 -101
  262. package/dist/packages/compiler/state-artifacts.d.ts +0 -8
  263. package/dist/packages/compiler/state-paths.js +0 -13
  264. package/dist/packages/compiler/state-view.d.ts +0 -4
  265. package/dist/packages/compiler/state.d.ts +0 -7
  266. package/dist/packages/local-service/index.d.ts +0 -18
  267. package/dist/packages/local-service/index.js +0 -13
  268. package/dist/packages/local-service/routes.d.ts +0 -32
  269. package/dist/packages/local-service/routes.js +0 -37
  270. package/dist/packages/local-service/runtime.d.ts +0 -133
  271. package/dist/packages/local-service/server.js +0 -627
  272. package/dist/packages/method-package/index.d.ts +0 -11
  273. package/dist/packages/method-package/index.js +0 -11
  274. package/dist/packages/method-package/method-stage-policy.d.ts +0 -5
  275. package/dist/packages/method-package/method-stage-policy.js +0 -31
  276. package/dist/packages/project-model/interf-scaffold.d.ts +0 -3
  277. package/dist/packages/project-model/preparation-entries.d.ts +0 -11
  278. package/dist/packages/project-model/project-paths.d.ts +0 -12
  279. package/dist/packages/project-model/project-paths.js +0 -33
  280. package/dist/packages/shared/filesystem.d.ts +0 -2
  281. package/dist/packages/shared/filesystem.js +0 -55
  282. /package/dist/compiler-ui/_next/static/{84FaeF3EzBF9kKTMjSEVN → a3UiUF0DiMEbfWy_0gihg}/_buildManifest.js +0 -0
  283. /package/dist/compiler-ui/_next/static/{84FaeF3EzBF9kKTMjSEVN → a3UiUF0DiMEbfWy_0gihg}/_clientMiddlewareManifest.js +0 -0
  284. /package/dist/compiler-ui/_next/static/{84FaeF3EzBF9kKTMjSEVN → a3UiUF0DiMEbfWy_0gihg}/_ssgManifest.js +0 -0
  285. /package/dist/packages/{shared → contracts/utils}/file-types.d.ts +0 -0
  286. /package/dist/packages/{shared → contracts/utils}/file-types.js +0 -0
  287. /package/dist/packages/{shared → contracts/utils}/logger.d.ts +0 -0
  288. /package/dist/packages/{shared → contracts/utils}/logger.js +0 -0
  289. /package/dist/packages/{shared → contracts/utils}/naming.d.ts +0 -0
  290. /package/dist/packages/{shared → contracts/utils}/naming.js +0 -0
  291. /package/dist/packages/{shared → contracts/utils}/parse.d.ts +0 -0
  292. /package/dist/packages/{shared → contracts/utils}/parse.js +0 -0
  293. /package/dist/packages/{shared → contracts/utils}/path-guards.d.ts +0 -0
  294. /package/dist/packages/{shared → contracts/utils}/path-guards.js +0 -0
  295. /package/dist/packages/{local-service → engine}/action-values.d.ts +0 -0
  296. /package/dist/packages/{local-service → engine}/action-values.js +0 -0
  297. /package/dist/packages/{agents → engine/agents}/lib/agents.d.ts +0 -0
  298. /package/dist/packages/{agents → engine/agents}/lib/agents.js +0 -0
  299. /package/dist/packages/{agents → engine/agents}/lib/args.d.ts +0 -0
  300. /package/dist/packages/{agents → engine/agents}/lib/args.js +0 -0
  301. /package/dist/packages/{agents → engine/agents}/lib/chart-guidance.d.ts +0 -0
  302. /package/dist/packages/{agents → engine/agents}/lib/chart-guidance.js +0 -0
  303. /package/dist/packages/{agents → engine/agents}/lib/compiled-bootstrap.d.ts +0 -0
  304. /package/dist/packages/{agents → engine/agents}/lib/constants.d.ts +0 -0
  305. /package/dist/packages/{agents → engine/agents}/lib/constants.js +0 -0
  306. /package/dist/packages/{agents → engine/agents}/lib/execution-profile.d.ts +0 -0
  307. /package/dist/packages/{agents → engine/agents}/lib/execution-profile.js +0 -0
  308. /package/dist/packages/{agents → engine/agents}/lib/execution.d.ts +0 -0
  309. /package/dist/packages/{agents → engine/agents}/lib/execution.js +0 -0
  310. /package/dist/packages/{agents → engine/agents}/lib/executors.js +0 -0
  311. /package/dist/packages/{agents → engine/agents}/lib/logs.d.ts +0 -0
  312. /package/dist/packages/{agents → engine/agents}/lib/logs.js +0 -0
  313. /package/dist/packages/{agents → engine/agents}/lib/preflight.d.ts +0 -0
  314. /package/dist/packages/{agents → engine/agents}/lib/preflight.js +0 -0
  315. /package/dist/packages/{agents → engine/agents}/lib/render.d.ts +0 -0
  316. /package/dist/packages/{agents → engine/agents}/lib/render.js +0 -0
  317. /package/dist/packages/{agents → engine/agents}/lib/schema.d.ts +0 -0
  318. /package/dist/packages/{agents → engine/agents}/lib/schema.js +0 -0
  319. /package/dist/packages/{agents → engine/agents}/lib/status.d.ts +0 -0
  320. /package/dist/packages/{agents → engine/agents}/lib/status.js +0 -0
  321. /package/dist/packages/{agents → engine/agents}/lib/types.d.ts +0 -0
  322. /package/dist/packages/{agents → engine/agents}/lib/types.js +0 -0
  323. /package/dist/packages/{compiler → engine/compile}/artifact-counts.d.ts +0 -0
  324. /package/dist/packages/{compiler → engine/compile}/compiled-compile.d.ts +0 -0
  325. /package/dist/packages/{compiler → engine/compile}/compiled-compile.js +0 -0
  326. /package/dist/packages/{compiler → engine/compile}/discovery.d.ts +0 -0
  327. /package/dist/packages/{compiler → engine/compile}/method-primitives.d.ts +0 -0
  328. /package/dist/packages/{compiler → engine/compile}/method-primitives.js +0 -0
  329. /package/dist/packages/{compiler → engine/compile}/reset.d.ts +0 -0
  330. /package/dist/packages/{compiler → engine/compile}/runtime-acceptance.d.ts +0 -0
  331. /package/dist/packages/{compiler → engine/compile}/runtime-contracts.d.ts +0 -0
  332. /package/dist/packages/{compiler → engine/compile}/runtime-inventory.d.ts +0 -0
  333. /package/dist/packages/{compiler → engine/compile}/runtime-inventory.js +0 -0
  334. /package/dist/packages/{compiler → engine/compile}/runtime-paths.d.ts +0 -0
  335. /package/dist/packages/{compiler → engine/compile}/runtime-paths.js +0 -0
  336. /package/dist/packages/{compiler → engine/compile}/runtime-prompt.d.ts +0 -0
  337. /package/dist/packages/{compiler → engine/compile}/runtime-types.js +0 -0
  338. /package/dist/packages/{compiler → engine/compile}/state-health.d.ts +0 -0
  339. /package/dist/packages/{compiler → engine/compile}/validate-compiled.d.ts +0 -0
  340. /package/dist/packages/{compiler → engine/compile}/validate-helpers.d.ts +0 -0
  341. /package/dist/packages/{compiler → engine/compile}/validate-helpers.js +0 -0
  342. /package/dist/packages/{execution → engine/execution}/adapters.d.ts +0 -0
  343. /package/dist/packages/{execution → engine/execution}/adapters.js +0 -0
  344. /package/dist/packages/{execution → engine/execution}/events.d.ts +0 -0
  345. /package/dist/packages/{execution → engine/execution}/events.js +0 -0
  346. /package/dist/packages/{execution → engine/execution}/index.d.ts +0 -0
  347. /package/dist/packages/{execution → engine/execution}/index.js +0 -0
  348. /package/dist/packages/{local-service → engine}/readiness-check-draft.js +0 -0
  349. /package/dist/packages/{testing → engine/verify}/index.d.ts +0 -0
  350. /package/dist/packages/{testing → engine/verify}/index.js +0 -0
  351. /package/dist/packages/{testing → engine/verify}/test-execution.d.ts +0 -0
  352. /package/dist/packages/{testing → engine/verify}/test-paths.d.ts +0 -0
  353. /package/dist/packages/{testing → engine/verify}/test-profile-presets.d.ts +0 -0
  354. /package/dist/packages/{testing → engine/verify}/test-profile-presets.js +0 -0
  355. /package/dist/packages/{testing → engine/verify}/test-specs.d.ts +0 -0
  356. /package/dist/packages/{testing → engine/verify}/test-types.d.ts +0 -0
  357. /package/dist/packages/{testing → engine/verify}/test-types.js +0 -0
  358. /package/dist/packages/{method-authoring → methods/authoring}/index.d.ts +0 -0
  359. /package/dist/packages/{method-authoring → methods/authoring}/index.js +0 -0
  360. /package/dist/packages/{method-authoring → methods/authoring}/lib/method-edit-utils.d.ts +0 -0
  361. /package/dist/packages/{method-authoring → methods/authoring}/lib/method-edit-utils.js +0 -0
  362. /package/dist/packages/{method-authoring → methods/authoring}/method-edit-session.js +0 -0
  363. /package/dist/packages/{method-package → methods/package}/lib/package-root.d.ts +0 -0
  364. /package/dist/packages/{project-model → project}/interf.d.ts +0 -0
  365. /package/dist/packages/{project-model → project}/interf.js +0 -0
@@ -1,434 +0,0 @@
1
- import chalk from "chalk";
2
- import * as p from "@clack/prompts";
3
- import { resolve } from "node:path";
4
- import { listCompiledMethodChoices, getCompiledMethod, } from "../../packages/method-package/method-definitions.js";
5
- import { loadMethodDefinitionFromDir, } from "../../packages/method-package/local-methods.js";
6
- import { listSourcePreparationConfigs, loadSourceFolderConfig, resolveSourcePreparationPath, } from "../../packages/project-model/source-config.js";
7
- import { MethodChangeCreateRequestSchema, submitMethodAuthoringRunToLocalService, submitMethodChangeToLocalService, } from "../../packages/local-service/index.js";
8
- import { MethodAuthoringActionValuesSchema, buildCreateMethodActionDefinition, buildMethodChangeActionDefinition, methodAuthoringTaskPrompt, } from "../../packages/local-service/action-definitions.js";
9
- import { DEFAULT_SOURCE_FOLDER_PATH_PLACEHOLDER, listSourceFolderChoices, normalizeSourceFolderPathForConfig, } from "./source-config-wizard.js";
10
- import { promptActionInputValues } from "./action-input-cli.js";
11
- export const clackMethodPrompts = {
12
- intro: p.intro,
13
- select: (options) => p.select(options),
14
- text: (options) => p.text(options),
15
- isCancel: p.isCancel,
16
- log: {
17
- info: p.log.info,
18
- error: p.log.error,
19
- },
20
- };
21
- function normalizeMethodCreationMode(mode) {
22
- if (mode === "draft")
23
- return "draft-from-scratch";
24
- if (mode === "manual")
25
- return "fork-existing";
26
- return mode;
27
- }
28
- function findMatchingPreparationConfig(sourcePath, sourceFolderPath) {
29
- const config = loadSourceFolderConfig(sourcePath);
30
- for (const preparation of listSourcePreparationConfigs(config)) {
31
- if (resolveSourcePreparationPath(sourcePath, preparation) === sourceFolderPath) {
32
- return preparation;
33
- }
34
- }
35
- return null;
36
- }
37
- function describeSavedPreparation(preparation) {
38
- return preparation.about
39
- ? `${preparation.path} · ${preparation.about}`
40
- : `${preparation.path} · ${preparation.checks.length} readiness check${preparation.checks.length === 1 ? "" : "s"}`;
41
- }
42
- async function promptMethodSourceFolder(sourcePath, prompts) {
43
- const savedPreparations = listSourcePreparationConfigs(loadSourceFolderConfig(sourcePath));
44
- const folderChoices = listSourceFolderChoices(sourcePath);
45
- if (folderChoices.length > 0) {
46
- const selected = await prompts.select({
47
- message: "Which Source Folder should shape this Method?",
48
- options: [
49
- ...savedPreparations.map((preparation) => ({
50
- value: preparation.name,
51
- label: preparation.name,
52
- hint: describeSavedPreparation(preparation),
53
- })),
54
- ...folderChoices,
55
- {
56
- value: "__manual__",
57
- label: "Enter a different path",
58
- hint: "Use a relative path if the Source Folder is not listed here",
59
- },
60
- ],
61
- });
62
- if (prompts.isCancel(selected))
63
- return selected;
64
- if (selected !== "__manual__") {
65
- const savedPreparation = savedPreparations.find((preparation) => preparation.name === selected);
66
- if (savedPreparation) {
67
- return resolveSourcePreparationPath(sourcePath, savedPreparation);
68
- }
69
- return resolve(sourcePath, normalizeSourceFolderPathForConfig(sourcePath, String(selected)));
70
- }
71
- }
72
- const sourceFolderPrompt = await prompts.text({
73
- message: "Which Source Folder should shape this Method?",
74
- placeholder: DEFAULT_SOURCE_FOLDER_PATH_PLACEHOLDER,
75
- initialValue: folderChoices.length === 1 ? folderChoices[0]?.value : undefined,
76
- validate: (value) => {
77
- const trimmed = value.trim();
78
- if (trimmed.length === 0)
79
- return "Source Folder is required";
80
- try {
81
- normalizeSourceFolderPathForConfig(sourcePath, trimmed);
82
- return undefined;
83
- }
84
- catch (error) {
85
- return error instanceof Error ? error.message : String(error);
86
- }
87
- },
88
- });
89
- if (prompts.isCancel(sourceFolderPrompt))
90
- return sourceFolderPrompt;
91
- return resolve(sourcePath, normalizeSourceFolderPathForConfig(sourcePath, String(sourceFolderPrompt)));
92
- }
93
- export function formatMethodLabel(method) {
94
- return {
95
- value: method.id,
96
- label: method.scope === "local" ? `${method.label} (Local)` : method.label,
97
- hint: method.hint,
98
- };
99
- }
100
- export function buildCompiledMethodOptions(sourcePath) {
101
- return listCompiledMethodChoices(sourcePath).map(formatMethodLabel);
102
- }
103
- function methodUseLabel(method) {
104
- if (method.value === "interf-default") {
105
- return "built-in Method";
106
- }
107
- return method.label.replace(/ \(Local\)$/, "");
108
- }
109
- function methodForkLabel(method) {
110
- return `Fork ${methodUseLabel(method)}`;
111
- }
112
- async function promptMethodAuthoringValues(options) {
113
- const existingMethodIds = listCompiledMethodChoices(options.sourcePath).map((method) => method.id);
114
- const definition = buildCreateMethodActionDefinition({
115
- defaultPreparation: options.defaultPreparation ?? "",
116
- existingMethodIds,
117
- suggestedMethodId: options.defaultPreparation ? `${options.defaultPreparation}-method` : "custom-method",
118
- });
119
- const values = await promptActionInputValues(definition, {
120
- prompts: options.prompts,
121
- omitFields: options.includeOutputFields
122
- ? undefined
123
- : new Set(["portable_output", "readiness_notes"]),
124
- });
125
- if (!values)
126
- return null;
127
- const parsed = MethodAuthoringActionValuesSchema.parse(values);
128
- const methodId = parsed.method_id;
129
- const label = parsed.label;
130
- const hint = parsed.hint;
131
- if (!methodId || !label || !hint) {
132
- throw new Error("Create Method action did not produce complete Method metadata.");
133
- }
134
- return {
135
- methodId,
136
- label,
137
- hint,
138
- taskPrompt: methodAuthoringTaskPrompt(parsed),
139
- };
140
- }
141
- export async function chooseCompiledMethod(sourcePath, options = {}) {
142
- const currentMethodId = options.currentMethodId;
143
- const methodOptions = buildCompiledMethodOptions(sourcePath);
144
- const orderedOptions = methodOptions
145
- .map((option) => option.value === currentMethodId
146
- ? {
147
- ...option,
148
- label: `${option.label} (Current)`,
149
- hint: option.hint,
150
- }
151
- : option)
152
- .sort((left, right) => {
153
- if (left.value === currentMethodId)
154
- return -1;
155
- if (right.value === currentMethodId)
156
- return 1;
157
- return 0;
158
- });
159
- if (orderedOptions.length === 1) {
160
- return orderedOptions[0]?.value ?? "interf-default";
161
- }
162
- return p.select({
163
- message: options.message ?? "Preparation Method?",
164
- options: orderedOptions,
165
- });
166
- }
167
- export async function chooseOrCreateCompiledMethodForPreparation(sourcePath, preparationConfig, options = {}, prompts = clackMethodPrompts) {
168
- const currentMethodId = options.currentMethodId ?? preparationConfig.method ?? "interf-default";
169
- const methodOptions = buildCompiledMethodOptions(sourcePath);
170
- const currentMethod = methodOptions.find((method) => method.value === currentMethodId) ??
171
- methodOptions.find((method) => method.value === "interf-default") ??
172
- methodOptions[0];
173
- const selected = await prompts.select({
174
- message: "Which Method should Interf use for this Preparation?",
175
- options: [
176
- {
177
- value: "__draft_from_scratch__",
178
- label: "Draft a new Method from scratch (Recommended)",
179
- hint: "Start from a neutral scaffold; an agent designs stages, outputs, and proof for this Preparation",
180
- },
181
- ...(currentMethod
182
- ? [{
183
- value: "__current__",
184
- label: `Use ${methodUseLabel(currentMethod)}`,
185
- hint: currentMethod.value === "interf-default"
186
- ? "Use the built-in Method without drafting a custom package"
187
- : currentMethod.hint,
188
- }]
189
- : []),
190
- ...(currentMethod
191
- ? [{
192
- value: "__fork_existing__",
193
- label: methodForkLabel(currentMethod),
194
- hint: "Copy its existing stage topology, then write the per-stage guidance yourself",
195
- }]
196
- : []),
197
- ...methodOptions
198
- .filter((method) => method.value !== currentMethod?.value)
199
- .map((method) => ({
200
- ...method,
201
- label: `Use ${methodUseLabel(method)}`,
202
- })),
203
- ],
204
- });
205
- if (prompts.isCancel(selected))
206
- return selected;
207
- if (selected === "__current__") {
208
- return currentMethod?.value ?? currentMethodId;
209
- }
210
- if (selected === "__draft_from_scratch__" || selected === "__fork_existing__") {
211
- const methodId = await createMethodWizard({
212
- intro: false,
213
- sourcePath,
214
- baseMethodId: selected === "__fork_existing__"
215
- ? currentMethod?.value ?? currentMethodId
216
- : undefined,
217
- creationMode: selected === "__draft_from_scratch__" ? "draft-from-scratch" : "fork-existing",
218
- preparationContext: {
219
- config: preparationConfig,
220
- sourceFolderPath: resolveSourcePreparationPath(sourcePath, preparationConfig),
221
- },
222
- }, prompts);
223
- return methodId;
224
- }
225
- return String(selected);
226
- }
227
- export async function createMethodWizard(options = {}, prompts = clackMethodPrompts) {
228
- if (options.intro !== false) {
229
- prompts.intro(chalk.bold("Create a Method"));
230
- }
231
- const sourcePath = options.sourcePath ?? process.cwd();
232
- return createCompiledMethodWizard(sourcePath, prompts, {
233
- baseMethodId: options.baseMethodId,
234
- creationMode: options.creationMode,
235
- preparationContext: options.preparationContext,
236
- });
237
- }
238
- export async function createCompiledMethodWizard(sourcePath, prompts = clackMethodPrompts, options = {}) {
239
- const creationMode = options.creationMode ?? await prompts.select({
240
- message: "How do you want to create it?",
241
- options: [
242
- {
243
- value: "draft-from-scratch",
244
- label: "Draft a new Method from scratch (Recommended)",
245
- hint: "Start from a neutral scaffold and let a local agent design a reusable Method for this kind of agent work",
246
- },
247
- {
248
- value: "fork-existing",
249
- label: "Fork an existing Method and edit stage guidance",
250
- hint: "Copy an existing topology; choose this when the stages are right but their emphasis should change",
251
- },
252
- ],
253
- });
254
- if (prompts.isCancel(creationMode))
255
- return creationMode;
256
- const creationModeValue = normalizeMethodCreationMode(creationMode);
257
- const baseMethod = creationModeValue === "fork-existing"
258
- ? options.baseMethodId ?? await prompts.select({
259
- message: "Which existing Method should Interf fork?",
260
- options: listCompiledMethodChoices(sourcePath).map(formatMethodLabel),
261
- })
262
- : null;
263
- if (prompts.isCancel(baseMethod))
264
- return baseMethod;
265
- const baseMethodId = typeof baseMethod === "string" ? baseMethod : null;
266
- const resolvedBaseMethod = baseMethodId
267
- ? getCompiledMethod(baseMethodId, { sourcePath })
268
- : null;
269
- if (creationModeValue === "draft-from-scratch") {
270
- let sourceFolderPath = options.preparationContext?.sourceFolderPath ?? null;
271
- let matchedPreparation = options.preparationContext?.config ?? null;
272
- if (!sourceFolderPath) {
273
- const savedPreparations = listSourcePreparationConfigs(loadSourceFolderConfig(sourcePath));
274
- if (savedPreparations.length > 0) {
275
- const preparationChoice = await prompts.select({
276
- message: "Which saved Preparation should shape this Method?",
277
- options: [
278
- ...savedPreparations.map((preparation) => ({
279
- value: preparation.name,
280
- label: preparation.name,
281
- hint: describeSavedPreparation(preparation),
282
- })),
283
- {
284
- value: "__manual__",
285
- label: "Enter folder path manually",
286
- hint: "Use a folder that is not saved as a Preparation yet",
287
- },
288
- ],
289
- });
290
- if (prompts.isCancel(preparationChoice))
291
- return preparationChoice;
292
- if (preparationChoice !== "__manual__") {
293
- matchedPreparation = savedPreparations.find((preparation) => preparation.name === preparationChoice) ?? null;
294
- sourceFolderPath = matchedPreparation
295
- ? resolveSourcePreparationPath(sourcePath, matchedPreparation)
296
- : null;
297
- }
298
- }
299
- }
300
- if (!sourceFolderPath) {
301
- const sourceFolderPrompt = await promptMethodSourceFolder(sourcePath, prompts);
302
- if (prompts.isCancel(sourceFolderPrompt))
303
- return sourceFolderPrompt;
304
- if (!sourceFolderPrompt)
305
- return null;
306
- sourceFolderPath = String(sourceFolderPrompt);
307
- matchedPreparation = matchedPreparation ?? findMatchingPreparationConfig(sourcePath, sourceFolderPath);
308
- }
309
- const methodValues = await promptMethodAuthoringValues({
310
- defaultPreparation: matchedPreparation?.name ?? options.preparationContext?.config.name,
311
- includeOutputFields: true,
312
- prompts,
313
- sourcePath,
314
- });
315
- if (prompts.isCancel(methodValues))
316
- return methodValues;
317
- if (!methodValues)
318
- return null;
319
- if (matchedPreparation) {
320
- prompts.log.info(`Shaping this Method from Preparation "${matchedPreparation.name}".`);
321
- }
322
- if (matchedPreparation?.checks.length) {
323
- prompts.log.info(`Using ${matchedPreparation.checks.length} saved readiness check${matchedPreparation.checks.length === 1 ? "" : "s"} from Preparation "${matchedPreparation.name}" as authoring context.`);
324
- }
325
- prompts.log.info("Preparing a Method-authoring shell from the Source Folder, then drafting the package.");
326
- let lastServiceStatus = "";
327
- const serviceRun = await submitMethodAuthoringRunToLocalService({
328
- projectPath: sourcePath,
329
- request: {
330
- preparation: matchedPreparation?.name ?? null,
331
- source_folder_path: sourceFolderPath,
332
- method_id: methodValues.methodId,
333
- label: methodValues.label,
334
- hint: methodValues.hint,
335
- task_prompt: methodValues.taskPrompt,
336
- checks: matchedPreparation?.checks ?? [],
337
- },
338
- onSubmitted: (submission) => {
339
- prompts.log.info(`Visible in Interf: ${submission.serviceUrl}/`);
340
- },
341
- onUpdate: (job) => {
342
- const activeStep = job.steps.find((step) => step.status === "running")
343
- ?? [...job.steps].reverse().find((step) => step.status === "succeeded" || step.status === "failed")
344
- ?? null;
345
- const statusKey = `${job.status}:${activeStep?.id ?? ""}:${activeStep?.status ?? ""}`;
346
- if (statusKey === lastServiceStatus)
347
- return;
348
- lastServiceStatus = statusKey;
349
- prompts.log.info(activeStep
350
- ? `${activeStep.label}: ${activeStep.status}`
351
- : `Method draft run: ${job.status}`);
352
- },
353
- });
354
- if (!serviceRun) {
355
- process.exitCode = 1;
356
- (prompts.log.error ?? prompts.log.info)("Interf local service is not running. Start `interf web`, then rerun Method creation so the draft run is visible in Interf.");
357
- return null;
358
- }
359
- const result = serviceRun.result
360
- ? {
361
- status: serviceRun.result.status,
362
- changed: serviceRun.result.changed,
363
- summary: serviceRun.result.summary,
364
- validation: serviceRun.result.validation ?? null,
365
- methodPath: serviceRun.result.method_path,
366
- shellPath: serviceRun.result.shell_path,
367
- }
368
- : {
369
- status: "executor-failed",
370
- changed: false,
371
- summary: serviceRun.error ?? "Method authoring failed in the local Interf service.",
372
- validation: null,
373
- methodPath: resolve(sourcePath, "interf", "methods", methodValues.methodId),
374
- shellPath: resolve(sourcePath, "interf", "methods", methodValues.methodId),
375
- };
376
- if (!result)
377
- return null;
378
- if (result.status === "updated") {
379
- const draft = loadMethodDefinitionFromDir(result.methodPath);
380
- const stageList = draft?.stages?.map((stage) => stage.id).join(" -> ") ?? "-";
381
- prompts.log.info(`Draft ready at ${result.methodPath}`);
382
- prompts.log.info(` Name: ${draft?.label ?? methodValues.label}`);
383
- prompts.log.info(` Description: ${draft?.hint ?? methodValues.hint}`);
384
- if (draft?.purpose)
385
- prompts.log.info(` Purpose: ${draft.purpose}`);
386
- prompts.log.info(` Stages: ${stageList}`);
387
- const confirmChoice = await prompts.select({
388
- message: "Save this Method?",
389
- options: [
390
- { value: "save", label: "Save", hint: "Keep the draft as your new Method package" },
391
- { value: "cancel", label: "Close", hint: "Leave the service-created draft in place for review" },
392
- ],
393
- });
394
- if (prompts.isCancel(confirmChoice) || confirmChoice === "cancel") {
395
- prompts.log.info(`Draft kept at ${result.methodPath}`);
396
- return null;
397
- }
398
- prompts.log.info(`Saved local Method: ${result.methodPath}`);
399
- return methodValues.methodId;
400
- }
401
- process.exitCode = 1;
402
- (prompts.log.error ?? prompts.log.info)(result.status === "no-change"
403
- ? `${result.summary} Draft mode only succeeds when it produces an agent-work-specific package change.`
404
- : result.summary);
405
- prompts.log.info(`Method shell kept at: ${result.shellPath}`);
406
- return null;
407
- }
408
- if (!baseMethodId || !resolvedBaseMethod) {
409
- throw new Error("Fork-existing Method creation needs a base Method.");
410
- }
411
- const duplicateDefinition = buildMethodChangeActionDefinition({
412
- action: "duplicate",
413
- existingMethodIds: listCompiledMethodChoices(sourcePath).map((method) => method.id),
414
- hint: resolvedBaseMethod.hint ?? null,
415
- label: resolvedBaseMethod.label ?? baseMethodId,
416
- methodId: baseMethodId,
417
- preparation: options.preparationContext?.config.name ?? "",
418
- });
419
- const duplicateValues = await promptActionInputValues(duplicateDefinition, { prompts });
420
- if (!duplicateValues)
421
- return null;
422
- const duplicateDraft = duplicateDefinition.buildDraft(duplicateValues);
423
- const result = await submitMethodChangeToLocalService({
424
- projectPath: sourcePath,
425
- request: MethodChangeCreateRequestSchema.parse(duplicateDraft.values),
426
- });
427
- if (!result) {
428
- process.exitCode = 1;
429
- (prompts.log.error ?? prompts.log.info)("Interf local service is not running. Start `interf web`, then rerun Method creation so the Method change is visible in Interf.");
430
- return null;
431
- }
432
- prompts.log.info(`Saved local Method: ${result.method_path}`);
433
- return result.new_method_id ?? null;
434
- }
@@ -1,6 +0,0 @@
1
- import type { CommandModule } from "yargs";
2
- export declare const createCommand: CommandModule;
3
- export declare function createCompiledWizard(options?: {
4
- intro?: boolean;
5
- }): Promise<void>;
6
- export { type MethodWizardPrompts, formatMethodLabel, createMethodWizard, createCompiledMethodWizard, } from "./create-method-wizard.js";
@@ -1,183 +0,0 @@
1
- import chalk from "chalk";
2
- import * as p from "@clack/prompts";
3
- import { detectInterf, resolveSourceControlPath, } from "../../packages/project-model/interf.js";
4
- import { SOURCE_FOLDER_CONFIG_PATH, listSourcePreparationConfigs, loadSourceFolderConfig, } from "../../packages/project-model/source-config.js";
5
- import { chooseOrCreateCompiledMethodForPreparation, createMethodWizard, } from "./create-method-wizard.js";
6
- import { findBuiltPortableContextPath, } from "../../packages/project-model/preparation-entries.js";
7
- import { DEFAULT_PREPARATION_NAME, promptSingleCompiledConfig, } from "./source-config-wizard.js";
8
- import { defaultPreparationNameForPath, } from "../../packages/project-model/source-folders.js";
9
- import { resolveCommandControlPath, resolveInterfInstanceContext, } from "./control-path.js";
10
- import { savePreparationThroughServiceAction } from "./preparation-action.js";
11
- function normalizeCreateTarget(value) {
12
- if (!value)
13
- return null;
14
- switch (value) {
15
- case "preparation":
16
- return "preparation";
17
- case "method":
18
- return "method";
19
- default:
20
- return null;
21
- }
22
- }
23
- async function selectCreateTarget() {
24
- return p.select({
25
- message: "Create what?",
26
- options: [
27
- {
28
- value: "preparation",
29
- label: "Preparation (Recommended)",
30
- hint: "Add one Preparation for this Source Folder",
31
- },
32
- {
33
- value: "method",
34
- label: "Method",
35
- hint: "Create a reusable local Method",
36
- },
37
- ],
38
- });
39
- }
40
- async function maybeAssignMethodToPreparation(sourcePath, methodId) {
41
- const config = loadSourceFolderConfig(sourcePath);
42
- const preparations = listSourcePreparationConfigs(config);
43
- if (preparations.length === 0) {
44
- p.log.info(`Created Method "${methodId}".`);
45
- p.log.info(`Next: run \`interf\`, add a Preparation, then assign Method "${methodId}" from that menu.`);
46
- return;
47
- }
48
- const assignNow = await p.confirm({
49
- message: "Assign this Method to a Preparation now? (Recommended)",
50
- initialValue: true,
51
- });
52
- if (p.isCancel(assignNow) || !assignNow) {
53
- p.log.info(`Created Method "${methodId}".`);
54
- p.log.info(`Next: run \`interf\`, open a saved Preparation, and assign Method "${methodId}" from that menu.`);
55
- return;
56
- }
57
- let targetPreparation = preparations[0] ?? null;
58
- if (preparations.length > 1) {
59
- const selected = await p.select({
60
- message: "Which saved Preparation should use this Method?",
61
- options: preparations.map((preparation) => ({
62
- value: preparation.name,
63
- label: preparation.name,
64
- hint: `${preparation.path} · ${preparation.about ?? `${preparation.checks.length} readiness check${preparation.checks.length === 1 ? "" : "s"}`}`,
65
- })),
66
- });
67
- if (p.isCancel(selected))
68
- return;
69
- targetPreparation = preparations.find((preparation) => preparation.name === selected) ?? null;
70
- }
71
- if (!targetPreparation)
72
- return;
73
- const nextConfig = {
74
- ...targetPreparation,
75
- method: methodId,
76
- };
77
- await savePreparationThroughServiceAction({
78
- sourcePath,
79
- preparation: nextConfig,
80
- setupMode: "select-method",
81
- });
82
- const builtCompiledPath = findBuiltPortableContextPath(sourcePath, targetPreparation.name);
83
- p.log.info(`Assigned Method "${methodId}" to Preparation "${targetPreparation.name}".`);
84
- if (builtCompiledPath) {
85
- p.log.info("The active local Method copy for that Portable Context lives under `.interf/method/`.");
86
- }
87
- p.log.info("Next: run `interf compile`, then `interf test`.");
88
- }
89
- export const createCommand = {
90
- command: "create [type]",
91
- describe: "Create a Preparation or reusable Method",
92
- builder: (yargs) => yargs.positional("type", {
93
- type: "string",
94
- describe: "Type to create (`preparation` or `method`)",
95
- default: undefined,
96
- }),
97
- handler: async (argv) => {
98
- const rawType = argv.type;
99
- let type = normalizeCreateTarget(rawType);
100
- if (rawType && !type) {
101
- process.exitCode = 1;
102
- p.log.error(`Unknown create target: ${rawType}`);
103
- return;
104
- }
105
- if (!type) {
106
- const selected = await selectCreateTarget();
107
- if (p.isCancel(selected))
108
- return;
109
- type = selected;
110
- }
111
- if (type === "method") {
112
- const detected = detectInterf(process.cwd());
113
- const sourcePath = detected ? resolveSourceControlPath(detected.path) : resolveCommandControlPath();
114
- const methodId = await createMethodWizard({
115
- sourcePath,
116
- });
117
- if (typeof methodId === "string") {
118
- await maybeAssignMethodToPreparation(sourcePath, methodId);
119
- }
120
- return;
121
- }
122
- await createCompiledWizard();
123
- },
124
- };
125
- export async function createCompiledWizard(options = {}) {
126
- if (options.intro !== false) {
127
- p.intro(chalk.bold("Add a Preparation"));
128
- }
129
- const cwd = process.cwd();
130
- const detected = detectInterf(cwd);
131
- if (detected) {
132
- process.exitCode = 1;
133
- p.log.error("You are already inside Portable Context.");
134
- return;
135
- }
136
- const initContext = resolveInterfInstanceContext(cwd);
137
- const sourcePath = initContext.controlPath;
138
- const savedPreparations = listSourcePreparationConfigs(loadSourceFolderConfig(sourcePath));
139
- if (savedPreparations.length > 0) {
140
- p.log.info(`This Source Folder already has ${savedPreparations.length} saved Preparation${savedPreparations.length === 1 ? "" : "s"} in ${SOURCE_FOLDER_CONFIG_PATH}. Add another only when you need a separate Source Folder, agent-work focus, or readiness-check set.`);
141
- }
142
- if (sourcePath !== cwd) {
143
- p.log.info(`Interf Workspace: ${sourcePath}`);
144
- }
145
- p.log.info("Interf works one Preparation at a time. Start with the agent work, the relevant files, and a few readiness checks, then build Portable Context when you need evidence that the data is ready for agents.");
146
- const existingConfig = loadSourceFolderConfig(sourcePath);
147
- const initialConfig = initContext.defaultSourceFolderPath && initContext.defaultPreparationPath
148
- ? {
149
- name: defaultPreparationNameForPath(initContext.defaultSourceFolderPath),
150
- path: initContext.defaultPreparationPath,
151
- }
152
- : { name: DEFAULT_PREPARATION_NAME };
153
- const draft = await promptSingleCompiledConfig({
154
- projectPath: sourcePath,
155
- initial: initialConfig,
156
- introStyle: existingConfig ? "additional" : "first",
157
- });
158
- if (!draft)
159
- return;
160
- const existingNames = new Set(listSourcePreparationConfigs(existingConfig).map((preparation) => preparation.name));
161
- if (existingNames.has(draft.name)) {
162
- process.exitCode = 1;
163
- p.log.error(`Preparation "${draft.name}" already exists. Use \`interf\` or \`interf init\` to edit it.`);
164
- return;
165
- }
166
- const methodChoice = await chooseOrCreateCompiledMethodForPreparation(sourcePath, draft, {
167
- currentMethodId: "interf-default",
168
- });
169
- if (!methodChoice || p.isCancel(methodChoice))
170
- return;
171
- const configToSave = {
172
- ...draft,
173
- method: String(methodChoice),
174
- };
175
- await savePreparationThroughServiceAction({
176
- sourcePath,
177
- preparation: configToSave,
178
- });
179
- p.outro(configToSave.checks.length > 0
180
- ? "Saved Preparation.\nNext:\n interf compile\n interf test"
181
- : "Saved Preparation.\nNext:\n interf or interf init");
182
- }
183
- export { formatMethodLabel, createMethodWizard, createCompiledMethodWizard, } from "./create-method-wizard.js";
@@ -1,2 +0,0 @@
1
- import type { CommandModule } from "yargs";
2
- export declare const defaultCommand: CommandModule;
@@ -1,39 +0,0 @@
1
- import chalk from "chalk";
2
- import { userConfig } from "../../packages/agents/index.js";
3
- import { runInitCommand } from "./init.js";
4
- function printStaticLanding() {
5
- const config = userConfig.loadUserConfig();
6
- console.log();
7
- console.log(chalk.bold(" Interf"));
8
- console.log(chalk.dim(" Prepare data for agent work."));
9
- console.log(chalk.dim(" Run locally, process files, show evidence that your data is ready, and write verifiable outputs as Portable Context for agents."));
10
- console.log();
11
- if (config) {
12
- console.log(chalk.dim(` Agent: ${config.agent}`));
13
- console.log();
14
- }
15
- console.log(chalk.dim(" Suggested flow:"));
16
- console.log(chalk.dim(" interf"));
17
- console.log(chalk.dim(" interf web # optional local UI/API"));
18
- console.log(chalk.dim(" interf compile"));
19
- console.log(chalk.dim(" interf test"));
20
- console.log(chalk.dim(" interf test --target source-files # optional baseline before compile"));
21
- console.log();
22
- console.log(chalk.dim(" More:"));
23
- console.log(chalk.dim(" interf init"));
24
- console.log(chalk.dim(" interf create method"));
25
- console.log(chalk.dim(" interf doctor --live"));
26
- console.log(chalk.dim(" interf --help"));
27
- console.log();
28
- }
29
- export const defaultCommand = {
30
- command: "$0",
31
- describe: false,
32
- handler: async () => {
33
- if (!process.stdin.isTTY || !process.stdout.isTTY) {
34
- printStaticLanding();
35
- return;
36
- }
37
- await runInitCommand();
38
- },
39
- };