@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,771 +0,0 @@
1
- import chalk from "chalk";
2
- import * as p from "@clack/prompts";
3
- import { existsSync, statSync } from "node:fs";
4
- import { homedir } from "node:os";
5
- import { basename, isAbsolute, relative, resolve } from "node:path";
6
- import { assertCompiledContainer, detectInterf, readInterfConfig, resolveSourceControlPath, } from "../../packages/project-model/interf.js";
7
- import { SOURCE_FOLDER_CONFIG_PATH, configuredSourceFolderPath, loadSourceFolderConfig, resolveConfiguredSourceFolderPath, saveSourceFolderConfig, } from "../../packages/project-model/source-config.js";
8
- import { defaultPreparationNameForPath, } from "../../packages/project-model/source-folders.js";
9
- import { DEFAULT_PREPARATION_NAME, describeCompileLoopSelection, listSourceFolderChoices, promptSingleCompiledConfig, } from "./source-config-wizard.js";
10
- import { chooseOrCreateCompiledMethodForPreparation, createMethodWizard, } from "./create-method-wizard.js";
11
- import { seedLocalDefaultMethod } from "../../packages/method-package/local-methods.js";
12
- import { listSavedPreparationEntries, findBuiltPortableContextPath, findSavedPreparationConfig, } from "../../packages/project-model/preparation-entries.js";
13
- import { readCurrentSavedReadinessCheckRun, } from "../../packages/testing/readiness-check-run.js";
14
- import { runCompileCommand } from "./compile.js";
15
- import { runTestCommand } from "./test.js";
16
- import { defaultInterfInstanceRoot, relativeSourceFolderPath, resolveInterfInstanceContext, } from "./control-path.js";
17
- import { runWebCommand } from "./web.js";
18
- import { savePreparationThroughServiceAction } from "./preparation-action.js";
19
- function displayPath(path) {
20
- const resolvedPath = resolve(path);
21
- const cwd = process.cwd();
22
- if (resolvedPath === cwd)
23
- return ".";
24
- if (isPathInside(cwd, resolvedPath))
25
- return `./${relative(cwd, resolvedPath)}`;
26
- const home = homedir();
27
- if (resolvedPath === home)
28
- return "~";
29
- if (isPathInside(home, resolvedPath))
30
- return `~/${relative(home, resolvedPath)}`;
31
- return resolvedPath;
32
- }
33
- function isPathInside(parentPath, childPath) {
34
- const relativePath = relative(parentPath, childPath);
35
- return relativePath === "" || (!relativePath.startsWith("..") && !isAbsolute(relativePath));
36
- }
37
- function normalizeSourceFolderInput(cwd, input) {
38
- const trimmed = input.trim();
39
- if (trimmed.length === 0) {
40
- throw new Error("Source Folder is required.");
41
- }
42
- const sourceFolderPath = resolve(cwd, trimmed);
43
- if (!existsSync(sourceFolderPath)) {
44
- throw new Error("Pick an existing Source Folder.");
45
- }
46
- if (!statSync(sourceFolderPath).isDirectory()) {
47
- throw new Error("Source Folder must be a directory.");
48
- }
49
- return sourceFolderPath;
50
- }
51
- function normalizeInterfInstanceFolderInput(cwd, sourceFolderPath, input) {
52
- const trimmed = input.trim();
53
- if (trimmed.length === 0) {
54
- throw new Error("Interf Workspace folder is required.");
55
- }
56
- const controlPath = resolve(cwd, trimmed);
57
- if (isPathInside(sourceFolderPath, controlPath)) {
58
- throw new Error("Choose an Interf Workspace folder outside the Source Folder so Interf does not write generated state into your source files.");
59
- }
60
- assertCompiledContainer(controlPath);
61
- return controlPath;
62
- }
63
- async function promptSourceFolderForInstance(cwd) {
64
- const folderChoices = listSourceFolderChoices(cwd);
65
- const selected = await p.select({
66
- message: "Which Source Folder should Interf prepare?",
67
- options: [
68
- ...folderChoices,
69
- {
70
- value: "__current__",
71
- label: `Use current folder (${basename(cwd)})`,
72
- hint: cwd,
73
- },
74
- {
75
- value: "__manual__",
76
- label: "Enter a different path",
77
- hint: "Use an absolute path or a path relative to this folder",
78
- },
79
- ],
80
- initialValue: folderChoices.length === 1 ? folderChoices[0]?.value : "__current__",
81
- });
82
- if (p.isCancel(selected))
83
- return null;
84
- if (selected === "__manual__") {
85
- const sourceInput = await p.text({
86
- message: "Source Folder path?",
87
- placeholder: cwd,
88
- initialValue: cwd,
89
- validate: (value) => {
90
- try {
91
- normalizeSourceFolderInput(cwd, value);
92
- return undefined;
93
- }
94
- catch (error) {
95
- return error instanceof Error ? error.message : String(error);
96
- }
97
- },
98
- });
99
- if (p.isCancel(sourceInput))
100
- return null;
101
- return normalizeSourceFolderInput(cwd, String(sourceInput));
102
- }
103
- return normalizeSourceFolderInput(cwd, selected === "__current__" ? "." : String(selected));
104
- }
105
- async function promptInterfInstanceFolder(cwd, sourceFolderPath) {
106
- const defaultControlPath = defaultInterfInstanceRoot(sourceFolderPath);
107
- p.log.info("Interf stores config, Methods, runs, and portable context outside the Source Folder.");
108
- const controlInput = await p.text({
109
- message: "Where should Interf store this Interf Workspace?",
110
- placeholder: defaultControlPath,
111
- initialValue: defaultControlPath,
112
- validate: (value) => {
113
- try {
114
- normalizeInterfInstanceFolderInput(cwd, sourceFolderPath, value);
115
- return undefined;
116
- }
117
- catch (error) {
118
- return error instanceof Error ? error.message : String(error);
119
- }
120
- },
121
- });
122
- if (p.isCancel(controlInput))
123
- return null;
124
- return normalizeInterfInstanceFolderInput(cwd, sourceFolderPath, String(controlInput));
125
- }
126
- async function setupInterfInstance(cwd) {
127
- const sourceFolderPath = await promptSourceFolderForInstance(cwd);
128
- if (!sourceFolderPath)
129
- return null;
130
- const controlPath = await promptInterfInstanceFolder(cwd, sourceFolderPath);
131
- if (!controlPath)
132
- return null;
133
- const sourceFolderConfigPath = relativeSourceFolderPath(controlPath, sourceFolderPath);
134
- saveSourceFolderConfig(controlPath, {
135
- source_folder: { path: sourceFolderConfigPath },
136
- preparations: [],
137
- });
138
- const seeded = seedLocalDefaultMethod({ sourcePath: controlPath });
139
- p.log.info(`Source Folder: ${displayPath(sourceFolderPath)}`);
140
- p.log.info(`Interf Workspace: ${displayPath(controlPath)}`);
141
- if (!seeded.alreadyExisted)
142
- p.log.info(`Method: ${seeded.methodId}`);
143
- return {
144
- sourceFolderPath,
145
- controlPath,
146
- sourceFolderConfigPath,
147
- };
148
- }
149
- async function promptEmptyInstanceAction() {
150
- const selected = await p.select({
151
- message: "What next?",
152
- options: [
153
- {
154
- value: "web",
155
- label: "Open Interf UI (Recommended)",
156
- hint: "Start the local UI and API for this Source Folder",
157
- },
158
- {
159
- value: "preparation",
160
- label: "Create Preparation",
161
- hint: "Describe the agent work, choose a Method, and save readiness checks",
162
- },
163
- {
164
- value: "method",
165
- label: "Create Method",
166
- hint: "Create or draft a reusable way to process files",
167
- },
168
- {
169
- value: "done",
170
- label: "Done",
171
- hint: `Leave the empty Interf Workspace at ${SOURCE_FOLDER_CONFIG_PATH}`,
172
- },
173
- ],
174
- });
175
- if (p.isCancel(selected))
176
- return null;
177
- return selected;
178
- }
179
- export function currentRunTargetStatus(rows, target) {
180
- const outcomes = rows
181
- .map((row) => (target === "raw" ? row.rawOutcome : row.compiledOutcome))
182
- .filter((outcome) => Boolean(outcome));
183
- if (outcomes.length === 0)
184
- return "missing";
185
- const passFlags = outcomes.map((outcome) => outcome.result.totalCases > 0 && outcome.result.passedCases === outcome.result.totalCases);
186
- if (passFlags.every(Boolean))
187
- return "pass";
188
- if (passFlags.some(Boolean))
189
- return "mixed";
190
- return "fail";
191
- }
192
- function describeSavedReadinessChecks(preparation) {
193
- const count = preparation.checks.length;
194
- if (count === 0)
195
- return "no checks";
196
- return `${count} readiness check${count === 1 ? "" : "s"}`;
197
- }
198
- function printPreparationSummary(options) {
199
- const compiledConfig = options.builtCompiledPath
200
- ? readInterfConfig(options.builtCompiledPath)
201
- : null;
202
- const methodLabel = `${options.preparation.method ?? "interf-default"}${compiledConfig?.method_origin?.local_draft === true ? " (local draft)" : ""}`;
203
- const sourceFolderPath = resolve(options.sourcePath, options.preparation.path);
204
- p.log.info(`Preparation: ${options.preparation.name} · Method: ${methodLabel}`);
205
- if (options.preparation.about) {
206
- p.log.info(`Agent work: ${options.preparation.about}`);
207
- }
208
- p.log.info(`Source Folder: ${displayPath(sourceFolderPath)}`);
209
- p.log.info(`Portable Context: ${options.built ? "built" : "not built"} · Readiness: ${describeSavedReadinessChecks(options.preparation)}`);
210
- const prepareMode = describeCompileLoopSelection({
211
- maxAttempts: options.preparation.max_attempts,
212
- maxLoops: options.preparation.max_loops,
213
- });
214
- if (prepareMode !== "Prepare once.")
215
- p.log.info(`Prepare mode: ${prepareMode}`);
216
- if (options.latestReadiness?.raw && options.latestReadiness?.compiled) {
217
- p.log.info(`Latest readiness evidence: source files ${options.latestReadiness.raw.passed_cases}/${options.latestReadiness.raw.total_cases}, Portable Context ${options.latestReadiness.compiled.passed_cases}/${options.latestReadiness.compiled.total_cases}.`);
218
- }
219
- else if (options.latestReadiness?.raw) {
220
- p.log.info(`Latest source-files readiness run: ${options.latestReadiness.raw.passed_cases}/${options.latestReadiness.raw.total_cases}.`);
221
- }
222
- else if (options.latestReadiness?.compiled) {
223
- p.log.info(`Latest Portable Context readiness run: ${options.latestReadiness.compiled.passed_cases}/${options.latestReadiness.compiled.total_cases}.`);
224
- }
225
- else if (options.latestReadinessStale) {
226
- p.log.info("Saved readiness results are stale for the current checks.");
227
- }
228
- if (options.sourcePath !== process.cwd()) {
229
- p.log.info(`Interf Workspace: ${displayPath(options.sourcePath)}`);
230
- }
231
- }
232
- async function promptPreparationAction(preparation, built, latestReadiness) {
233
- const options = [];
234
- const hasSavedRawBaseline = Boolean(latestReadiness?.raw);
235
- const latestRawPasses = latestReadiness?.raw &&
236
- latestReadiness.raw.passed_cases === latestReadiness.raw.total_cases;
237
- const compileOption = {
238
- value: "compile",
239
- label: built ? "Prepare again" : "Prepare files",
240
- hint: built
241
- ? "Refresh Portable Context"
242
- : preparation.checks.length > 0
243
- ? latestRawPasses
244
- ? "Use the latest source-files baseline"
245
- : hasSavedRawBaseline
246
- ? "Run the same readiness checks after prepare"
247
- : "Write Portable Context"
248
- : "Write Portable Context",
249
- };
250
- const webOption = {
251
- value: "web",
252
- label: "Open Interf UI",
253
- hint: "Start the local UI and API for this Interf Workspace",
254
- };
255
- options.push(webOption);
256
- if (preparation.checks.length > 0) {
257
- const testOption = {
258
- value: "test",
259
- label: built
260
- ? "Run readiness checks"
261
- : hasSavedRawBaseline
262
- ? "Rerun the source-files baseline"
263
- : "Measure the source-files baseline",
264
- hint: built
265
- ? "Check source files and Portable Context"
266
- : hasSavedRawBaseline
267
- ? "Refresh the saved source-files baseline on the current readiness checks"
268
- : "Optional source-files readiness baseline before Interf builds Portable Context",
269
- };
270
- if (built) {
271
- options.push(testOption, compileOption);
272
- }
273
- else {
274
- options.push(compileOption, testOption);
275
- }
276
- }
277
- else {
278
- options.push(compileOption);
279
- }
280
- options.push({
281
- value: "preparation",
282
- label: "Add another Preparation",
283
- hint: "Separate source, focus, or checks",
284
- }, {
285
- value: "edit",
286
- label: preparation.checks.length === 0 ? "Add readiness checks" : "Edit checks and settings",
287
- hint: "Checks, focus, Method, or mode",
288
- }, {
289
- value: "method",
290
- label: "Create Method",
291
- hint: "Custom file processing",
292
- }, {
293
- value: "done",
294
- label: "Done",
295
- hint: "Exit the wizard",
296
- });
297
- const selected = await p.select({
298
- message: "What next?",
299
- options,
300
- });
301
- if (p.isCancel(selected))
302
- return null;
303
- return selected;
304
- }
305
- function printPreparationRecommendation(preparation, built, latestReadiness) {
306
- if (preparation.checks.length === 0) {
307
- return;
308
- }
309
- if (!built) {
310
- if (latestReadiness?.raw) {
311
- p.log.info(latestReadiness.raw.passed_cases === latestReadiness.raw.total_cases
312
- ? `Latest source-files readiness run: ${latestReadiness.raw.passed_cases}/${latestReadiness.raw.total_cases}. Prepare files when you want Portable Context for the same agent work.`
313
- : `Latest source-files readiness run: ${latestReadiness.raw.passed_cases}/${latestReadiness.raw.total_cases}. Some readiness checks still fail on the source files. Prepare files if you want Interf to process this data and run the same checks.`);
314
- return;
315
- }
316
- p.log.info("Recommended first step: choose a Method and prepare files.");
317
- return;
318
- }
319
- p.log.info("Recommended first step: run readiness checks against source files and Portable Context.");
320
- }
321
- async function promptPostBaselineAction(rows) {
322
- const status = currentRunTargetStatus(rows, "raw");
323
- const subject = rows.length === 1 ? "selected agent" : "selected agents";
324
- if (status === "pass") {
325
- p.log.info(`Source files passed on all ${subject} in this run.`);
326
- }
327
- else if (status === "mixed") {
328
- p.log.info(`Source files were mixed across the ${subject} in this run.`);
329
- }
330
- else if (status === "fail") {
331
- p.log.info(`Source files did not pass on the ${subject} in this run.`);
332
- }
333
- const compileRecommended = status !== "pass";
334
- const selected = await p.select({
335
- message: "What next?",
336
- options: [
337
- {
338
- value: "compile",
339
- label: compileRecommended
340
- ? "Prepare files and write Portable Context (Recommended)"
341
- : "Prepare files and write Portable Context",
342
- hint: compileRecommended
343
- ? status === "mixed"
344
- ? "Some selected agents still failed on the source files. Prepare files and run the same readiness checks"
345
- : "Prepare files and run the same readiness checks"
346
- : "Prepare files and run the same readiness checks",
347
- },
348
- {
349
- value: "edit",
350
- label: "Change readiness checks and settings",
351
- hint: "Revise the readiness checks or Preparation settings before the next run",
352
- },
353
- {
354
- value: "rerun",
355
- label: "Rerun the source-files baseline",
356
- hint: "Run the same readiness checks again, including different local agents if you want",
357
- },
358
- {
359
- value: "done",
360
- label: "Stop here",
361
- hint: "Leave the Preparation as-is for now",
362
- },
363
- ],
364
- });
365
- if (p.isCancel(selected))
366
- return null;
367
- return selected;
368
- }
369
- async function chooseCompiledForWizard(options) {
370
- if (options.fixedCompiledName) {
371
- return findSavedPreparationConfig(options.sourcePath, options.fixedCompiledName);
372
- }
373
- const savedEntries = listSavedPreparationEntries(options.sourcePath);
374
- if (savedEntries.length === 0)
375
- return null;
376
- if (savedEntries.length === 1)
377
- return savedEntries[0]?.config ?? null;
378
- const selected = await p.select({
379
- message: "Which saved Preparation do you want to work with?",
380
- options: [
381
- ...savedEntries.map((entry) => ({
382
- value: entry.config.name,
383
- label: entry.config.name,
384
- hint: [
385
- `path ${entry.config.path}`,
386
- entry.config.about ?? describeSavedReadinessChecks(entry.config),
387
- `Method ${entry.config.method ?? "interf-default"}${entry.localDraft ? " (local draft)" : ""}`,
388
- entry.path ? "Portable Context available" : "Portable Context not built yet",
389
- ].join(" · "),
390
- })),
391
- {
392
- value: "__new__",
393
- label: "Add another Preparation",
394
- hint: "Add a separate folder, focus, or readiness-check set",
395
- },
396
- ],
397
- });
398
- if (p.isCancel(selected))
399
- return null;
400
- if (selected === "__new__")
401
- return "__new__";
402
- return findSavedPreparationConfig(options.sourcePath, String(selected));
403
- }
404
- async function promptCompiledSetup(options) {
405
- const savedConfig = loadSourceFolderConfig(options.sourcePath);
406
- const fixedPath = options.fixedPath
407
- ?? (options.fixedName ? options.initial?.path : configuredSourceFolderPath(savedConfig) ?? undefined);
408
- const compiledConfig = await promptSingleCompiledConfig({
409
- projectPath: options.sourcePath,
410
- initial: options.initial,
411
- ...(options.fixedName ? { fixedName: options.fixedName } : {}),
412
- ...(fixedPath ? { fixedPath } : {}),
413
- introStyle: options.introStyle,
414
- });
415
- if (!compiledConfig)
416
- return null;
417
- const methodChoice = await chooseOrCreateCompiledMethodForPreparation(options.sourcePath, compiledConfig, {
418
- currentMethodId: options.initial?.method ?? "interf-default",
419
- });
420
- if (!methodChoice || p.isCancel(methodChoice))
421
- return null;
422
- const methodId = String(methodChoice);
423
- const compiledConfigWithMethod = {
424
- ...compiledConfig,
425
- method: methodId,
426
- };
427
- await savePreparationThroughServiceAction({
428
- sourcePath: options.sourcePath,
429
- preparation: compiledConfigWithMethod,
430
- });
431
- console.log();
432
- console.log(chalk.green(` ✓ Saved Preparation in ${SOURCE_FOLDER_CONFIG_PATH}`));
433
- console.log(chalk.dim(` Interf Workspace: ${options.sourcePath}`));
434
- console.log(chalk.dim(` Preparation: ${compiledConfigWithMethod.name}`));
435
- console.log(chalk.dim(` Source folder: ${compiledConfigWithMethod.path}`));
436
- console.log(chalk.dim(` Method: ${methodId} · interf/methods/${methodId}/`));
437
- console.log(chalk.dim(` Prepare mode: ${describeCompileLoopSelection({
438
- maxAttempts: compiledConfigWithMethod.max_attempts,
439
- maxLoops: compiledConfigWithMethod.max_loops,
440
- })}`));
441
- return compiledConfigWithMethod;
442
- }
443
- export async function compileSelectedCompiled(sourcePath, compiledConfig, deps = {}) {
444
- return (deps.runCompileCommand ?? runCompileCommand)({
445
- sourcePath,
446
- preparation: compiledConfig.name,
447
- preparationConfig: compiledConfig,
448
- skipConfirm: true,
449
- skipPreparationBanner: true,
450
- });
451
- }
452
- async function runCompiledActionMenu(sourcePath, compiledConfig, options = {}) {
453
- const builtCompiledPath = findBuiltPortableContextPath(sourcePath, compiledConfig.name);
454
- const { readinessRun: latestReadiness, stale: latestReadinessStale, } = readCurrentSavedReadinessCheckRun({
455
- projectPath: sourcePath,
456
- preparationName: compiledConfig.name,
457
- checks: compiledConfig.checks,
458
- });
459
- printPreparationSummary({
460
- sourcePath,
461
- preparation: compiledConfig,
462
- built: Boolean(builtCompiledPath),
463
- builtCompiledPath,
464
- latestReadiness,
465
- latestReadinessStale,
466
- });
467
- printPreparationRecommendation(compiledConfig, Boolean(builtCompiledPath), latestReadiness);
468
- const action = await promptPreparationAction(compiledConfig, Boolean(builtCompiledPath), latestReadiness);
469
- if (!action)
470
- return;
471
- if (action === "done") {
472
- p.outro(options.justConfigured ? "Saved Preparation." : "Nothing changed.");
473
- return;
474
- }
475
- if (action === "method") {
476
- const methodId = await createMethodWizard({
477
- sourcePath,
478
- preparationContext: {
479
- config: compiledConfig,
480
- sourceFolderPath: resolve(sourcePath, compiledConfig.path),
481
- },
482
- });
483
- if (typeof methodId === "string") {
484
- const nextConfig = {
485
- ...compiledConfig,
486
- method: methodId,
487
- };
488
- await savePreparationThroughServiceAction({
489
- sourcePath,
490
- preparation: nextConfig,
491
- setupMode: "select-method",
492
- });
493
- p.log.info(`Assigned Method "${methodId}" to Preparation "${compiledConfig.name}".`);
494
- p.log.info("Next: run `interf compile`, then `interf test`.");
495
- }
496
- return;
497
- }
498
- if (action === "web") {
499
- await runWebCommand({ "control-path": sourcePath });
500
- return;
501
- }
502
- if (action === "preparation") {
503
- const nextCompiled = await promptCompiledSetup({
504
- sourcePath,
505
- initial: { name: DEFAULT_PREPARATION_NAME },
506
- introStyle: "additional",
507
- });
508
- if (!nextCompiled)
509
- return;
510
- await runCompiledActionMenu(sourcePath, nextCompiled, { justConfigured: true });
511
- return;
512
- }
513
- if (action === "edit") {
514
- const nextCompiled = await promptCompiledSetup({
515
- sourcePath,
516
- initial: compiledConfig,
517
- fixedName: compiledConfig.name,
518
- introStyle: "edit",
519
- });
520
- if (!nextCompiled)
521
- return;
522
- await runCompiledActionMenu(sourcePath, nextCompiled, { justConfigured: true });
523
- return;
524
- }
525
- if (action === "test") {
526
- if (compiledConfig.checks.length === 0) {
527
- process.exitCode = 1;
528
- console.log(chalk.red(` Preparation "${compiledConfig.name}" does not have any readiness checks yet.`));
529
- console.log(chalk.dim(" Run `interf`, edit this Preparation, and add a few readiness checks first."));
530
- console.log(chalk.dim(" Then rerun `interf test`."));
531
- return;
532
- }
533
- if (builtCompiledPath) {
534
- const baselineRan = await runTestCommand({
535
- sourcePath,
536
- preparation: compiledConfig.name,
537
- preparationConfig: compiledConfig,
538
- target: "both",
539
- });
540
- if (!baselineRan) {
541
- return;
542
- }
543
- return;
544
- }
545
- while (true) {
546
- const baselineCapture = { result: null };
547
- const baselineRan = await runTestCommand({
548
- sourcePath,
549
- preparation: compiledConfig.name,
550
- preparationConfig: compiledConfig,
551
- target: "source-files",
552
- onComplete(result) {
553
- baselineCapture.result = result;
554
- },
555
- });
556
- const baselineResult = baselineCapture.result;
557
- if (!baselineRan || !baselineResult) {
558
- return;
559
- }
560
- const nextAction = await promptPostBaselineAction(baselineResult.rows);
561
- if (!nextAction || nextAction === "done") {
562
- return;
563
- }
564
- if (nextAction === "rerun") {
565
- continue;
566
- }
567
- if (nextAction === "edit") {
568
- const nextCompiled = await promptCompiledSetup({
569
- sourcePath,
570
- initial: compiledConfig,
571
- fixedName: compiledConfig.name,
572
- introStyle: "edit",
573
- });
574
- if (!nextCompiled) {
575
- return;
576
- }
577
- await runCompiledActionMenu(sourcePath, nextCompiled, { justConfigured: true });
578
- return;
579
- }
580
- break;
581
- }
582
- const compileResult = await compileSelectedCompiled(sourcePath, compiledConfig);
583
- if (!compileResult) {
584
- return;
585
- }
586
- if (compileResult.testedDuringCompile) {
587
- p.log.info("This prepare run already checked the Portable Context on the saved readiness checks.");
588
- p.log.info("Run `interf test` later if you want fresh readiness evidence for source files and Portable Context.");
589
- return;
590
- }
591
- await runTestCommand({
592
- sourcePath,
593
- preparation: compiledConfig.name,
594
- preparationConfig: compiledConfig,
595
- target: "both",
596
- });
597
- return;
598
- }
599
- if (action === "compile") {
600
- const compileResult = await compileSelectedCompiled(sourcePath, compiledConfig);
601
- if (!compileResult)
602
- return;
603
- if (compiledConfig.checks.length === 0)
604
- return;
605
- if (compileResult.testedDuringCompile) {
606
- p.log.info("This prepare run already checked the Portable Context on the compile agent.");
607
- }
608
- const runCompiledTest = await p.confirm({
609
- message: compileResult.testedDuringCompile
610
- ? "Run fresh readiness checks against source files and Portable Context now?"
611
- : builtCompiledPath
612
- ? "Run readiness checks on source files and Portable Context now?"
613
- : "Run readiness checks on source files and Portable Context now?",
614
- initialValue: true,
615
- });
616
- if (p.isCancel(runCompiledTest) || !runCompiledTest)
617
- return;
618
- await runTestCommand({
619
- sourcePath,
620
- preparation: compiledConfig.name,
621
- preparationConfig: compiledConfig,
622
- target: "both",
623
- });
624
- return;
625
- }
626
- }
627
- export const initCommand = {
628
- command: "init",
629
- describe: "Set up Interf or open the Preparation wizard",
630
- handler: async () => {
631
- await runInitCommand();
632
- },
633
- };
634
- export async function runInitCommand() {
635
- p.intro(chalk.bold("Interf"));
636
- const cwd = process.cwd();
637
- const detected = detectInterf(cwd);
638
- let initContext = detected
639
- ? {
640
- controlPath: resolveSourceControlPath(detected.path),
641
- defaultSourceFolderPath: null,
642
- defaultPreparationPath: null,
643
- }
644
- : resolveInterfInstanceContext(cwd);
645
- let sourcePath = initContext.controlPath;
646
- if (detected) {
647
- p.log.info(`Interf Workspace: ${displayPath(sourcePath)}`);
648
- }
649
- const hasConfig = Boolean(loadSourceFolderConfig(sourcePath));
650
- let initialSourceFolderPath = initContext.defaultSourceFolderPath;
651
- let initialSourceFolderConfigPath = initContext.defaultPreparationPath;
652
- if (!detected && !hasConfig) {
653
- const setup = await setupInterfInstance(cwd);
654
- if (!setup)
655
- return;
656
- sourcePath = setup.controlPath;
657
- initialSourceFolderPath = setup.sourceFolderPath;
658
- initialSourceFolderConfigPath = setup.sourceFolderConfigPath;
659
- initContext = {
660
- controlPath: sourcePath,
661
- defaultSourceFolderPath: initialSourceFolderPath,
662
- defaultPreparationPath: initialSourceFolderConfigPath,
663
- };
664
- }
665
- else {
666
- const seeded = seedLocalDefaultMethod({ sourcePath });
667
- if (!seeded.alreadyExisted) {
668
- p.log.info(`Method: ${seeded.methodId}`);
669
- }
670
- }
671
- let currentConfig = loadSourceFolderConfig(sourcePath);
672
- if (!currentConfig?.source_folder && !detected) {
673
- const currentEntries = currentConfig?.preparations ?? [];
674
- if (initialSourceFolderPath && initialSourceFolderConfigPath) {
675
- saveSourceFolderConfig(sourcePath, {
676
- source_folder: { path: initialSourceFolderConfigPath },
677
- preparations: currentEntries,
678
- });
679
- currentConfig = loadSourceFolderConfig(sourcePath);
680
- }
681
- else if (currentConfig && currentEntries.length === 0) {
682
- const sourceFolderPath = await promptSourceFolderForInstance(cwd);
683
- if (!sourceFolderPath)
684
- return;
685
- const sourceFolderConfigPath = relativeSourceFolderPath(sourcePath, sourceFolderPath);
686
- saveSourceFolderConfig(sourcePath, {
687
- source_folder: { path: sourceFolderConfigPath },
688
- preparations: [],
689
- });
690
- initialSourceFolderPath = sourceFolderPath;
691
- initialSourceFolderConfigPath = sourceFolderConfigPath;
692
- currentConfig = loadSourceFolderConfig(sourcePath);
693
- p.log.info(`Source Folder: ${sourceFolderPath}`);
694
- p.log.info(`Source Folder path in Interf config: ${sourceFolderConfigPath}`);
695
- }
696
- else if (!currentConfig) {
697
- const setup = await setupInterfInstance(cwd);
698
- if (!setup)
699
- return;
700
- sourcePath = setup.controlPath;
701
- initialSourceFolderPath = setup.sourceFolderPath;
702
- initialSourceFolderConfigPath = setup.sourceFolderConfigPath;
703
- currentConfig = loadSourceFolderConfig(sourcePath);
704
- }
705
- }
706
- const configuredSourcePath = resolveConfiguredSourceFolderPath(sourcePath, currentConfig);
707
- const configuredSourceConfigPath = configuredSourceFolderPath(currentConfig);
708
- if (configuredSourcePath && configuredSourceConfigPath) {
709
- initialSourceFolderPath = configuredSourcePath;
710
- initialSourceFolderConfigPath = configuredSourceConfigPath;
711
- }
712
- const savedEntries = listSavedPreparationEntries(sourcePath);
713
- if (savedEntries.length === 0) {
714
- p.log.info("No Preparations yet. Create one when you are ready to describe the agent work.");
715
- const action = await promptEmptyInstanceAction();
716
- if (!action || action === "done") {
717
- p.outro("Interf Workspace is ready. Next: run `interf web` or `interf create preparation`.");
718
- return;
719
- }
720
- if (action === "web") {
721
- await runWebCommand({ "control-path": sourcePath });
722
- return;
723
- }
724
- if (action === "method") {
725
- const methodId = await createMethodWizard({ sourcePath });
726
- if (typeof methodId === "string") {
727
- p.outro(`Saved Method "${methodId}". Next: create a Preparation and assign this Method.`);
728
- }
729
- return;
730
- }
731
- const compiledConfig = await promptCompiledSetup({
732
- sourcePath,
733
- initial: initialSourceFolderPath && initialSourceFolderConfigPath
734
- ? {
735
- name: defaultPreparationNameForPath(initialSourceFolderPath),
736
- path: initialSourceFolderConfigPath,
737
- }
738
- : { name: DEFAULT_PREPARATION_NAME },
739
- ...(initialSourceFolderConfigPath ? { fixedPath: initialSourceFolderConfigPath } : {}),
740
- introStyle: "first",
741
- });
742
- if (!compiledConfig)
743
- return;
744
- await runCompiledActionMenu(sourcePath, compiledConfig, { justConfigured: true });
745
- return;
746
- }
747
- const selectedCompiled = await chooseCompiledForWizard({
748
- sourcePath,
749
- fixedCompiledName: detected?.config.name ?? null,
750
- });
751
- if (!selectedCompiled)
752
- return;
753
- if (selectedCompiled === "__new__") {
754
- const compiledConfig = await promptCompiledSetup({
755
- sourcePath,
756
- initial: initialSourceFolderPath && initialSourceFolderConfigPath
757
- ? {
758
- name: defaultPreparationNameForPath(initialSourceFolderPath),
759
- path: initialSourceFolderConfigPath,
760
- }
761
- : { name: DEFAULT_PREPARATION_NAME },
762
- ...(initialSourceFolderConfigPath ? { fixedPath: initialSourceFolderConfigPath } : {}),
763
- introStyle: "additional",
764
- });
765
- if (!compiledConfig)
766
- return;
767
- await runCompiledActionMenu(sourcePath, compiledConfig, { justConfigured: true });
768
- return;
769
- }
770
- await runCompiledActionMenu(sourcePath, selectedCompiled);
771
- }