@interf/compiler 0.9.4 → 0.9.5

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 (103) hide show
  1. package/CHANGELOG.md +93 -0
  2. package/README.md +2 -1
  3. package/agent-skills/interf-actions/SKILL.md +17 -11
  4. package/agent-skills/interf-actions/references/cli.md +8 -22
  5. package/dist/cli/commands/action-input-cli.d.ts +25 -0
  6. package/dist/cli/commands/action-input-cli.js +73 -0
  7. package/dist/cli/commands/compile.d.ts +3 -8
  8. package/dist/cli/commands/compile.js +13 -41
  9. package/dist/cli/commands/create-method-wizard.d.ts +0 -12
  10. package/dist/cli/commands/create-method-wizard.js +95 -126
  11. package/dist/cli/commands/create.d.ts +0 -2
  12. package/dist/cli/commands/create.js +16 -22
  13. package/dist/cli/commands/doctor.js +1 -1
  14. package/dist/cli/commands/executor-flow.js +1 -1
  15. package/dist/cli/commands/init.d.ts +16 -1
  16. package/dist/cli/commands/init.js +40 -53
  17. package/dist/cli/commands/list.js +1 -1
  18. package/dist/cli/commands/preparation-action.d.ts +8 -0
  19. package/dist/cli/commands/preparation-action.js +29 -0
  20. package/dist/cli/commands/preparation-picker.d.ts +5 -0
  21. package/dist/cli/commands/preparation-picker.js +36 -0
  22. package/dist/cli/commands/preparation-selection.js +2 -2
  23. package/dist/cli/commands/reset.js +15 -4
  24. package/dist/cli/commands/service-action-flow.d.ts +9 -0
  25. package/dist/cli/commands/service-action-flow.js +19 -0
  26. package/dist/cli/commands/source-config-wizard.d.ts +0 -1
  27. package/dist/cli/commands/source-config-wizard.js +43 -53
  28. package/dist/cli/commands/status.js +7 -123
  29. package/dist/cli/commands/test.d.ts +1 -2
  30. package/dist/cli/commands/test.js +40 -203
  31. package/dist/cli/commands/web.js +8 -262
  32. package/dist/compiler-ui/404.html +1 -1
  33. package/dist/compiler-ui/__next.__PAGE__.txt +2 -2
  34. package/dist/compiler-ui/__next._full.txt +3 -3
  35. package/dist/compiler-ui/__next._head.txt +1 -1
  36. package/dist/compiler-ui/__next._index.txt +2 -2
  37. package/dist/compiler-ui/__next._tree.txt +2 -2
  38. package/dist/compiler-ui/_next/static/chunks/177mvn4rse235.js +89 -0
  39. package/dist/compiler-ui/_next/static/chunks/18a8f2jkv3z.c.css +3 -0
  40. package/dist/compiler-ui/_not-found/__next._full.txt +2 -2
  41. package/dist/compiler-ui/_not-found/__next._head.txt +1 -1
  42. package/dist/compiler-ui/_not-found/__next._index.txt +2 -2
  43. package/dist/compiler-ui/_not-found/__next._not-found.__PAGE__.txt +1 -1
  44. package/dist/compiler-ui/_not-found/__next._not-found.txt +1 -1
  45. package/dist/compiler-ui/_not-found/__next._tree.txt +2 -2
  46. package/dist/compiler-ui/_not-found.html +1 -1
  47. package/dist/compiler-ui/_not-found.txt +2 -2
  48. package/dist/compiler-ui/index.html +1 -1
  49. package/dist/compiler-ui/index.txt +3 -3
  50. package/dist/index.d.ts +0 -23
  51. package/dist/index.js +0 -16
  52. package/dist/packages/agents/lib/shells.js +2 -2
  53. package/dist/packages/compiler/lib/schema.d.ts +1 -1
  54. package/dist/packages/compiler/lib/schema.js +1 -1
  55. package/dist/packages/contracts/lib/schema.d.ts +0 -1
  56. package/dist/packages/contracts/lib/schema.js +0 -1
  57. package/dist/packages/execution/lib/schema.d.ts +0 -7
  58. package/dist/packages/execution/lib/schema.js +0 -1
  59. package/dist/packages/local-service/action-definitions.d.ts +246 -0
  60. package/dist/packages/local-service/action-definitions.js +1148 -0
  61. package/dist/packages/local-service/action-planner.d.ts +9 -0
  62. package/dist/packages/local-service/action-planner.js +134 -0
  63. package/dist/packages/local-service/action-values.d.ts +1 -23
  64. package/dist/packages/local-service/action-values.js +1 -31
  65. package/dist/packages/local-service/client.d.ts +48 -17
  66. package/dist/packages/local-service/client.js +95 -52
  67. package/dist/packages/local-service/index.d.ts +8 -5
  68. package/dist/packages/local-service/index.js +5 -3
  69. package/dist/packages/local-service/lib/schema.d.ts +301 -295
  70. package/dist/packages/local-service/lib/schema.js +114 -39
  71. package/dist/packages/local-service/native-run-handlers.d.ts +23 -0
  72. package/dist/{cli/commands/compile-controller.js → packages/local-service/native-run-handlers.js} +203 -19
  73. package/dist/{cli/commands/check-draft.d.ts → packages/local-service/readiness-check-draft.d.ts} +2 -2
  74. package/dist/packages/local-service/routes.d.ts +6 -1
  75. package/dist/packages/local-service/routes.js +7 -2
  76. package/dist/packages/local-service/run-observability.js +15 -17
  77. package/dist/packages/local-service/runtime.d.ts +10 -7
  78. package/dist/packages/local-service/runtime.js +427 -297
  79. package/dist/packages/local-service/server.js +94 -44
  80. package/dist/packages/method-package/method-review-paths.d.ts +1 -1
  81. package/dist/packages/method-package/method-review-paths.js +5 -5
  82. package/dist/packages/project-model/index.d.ts +1 -0
  83. package/dist/packages/project-model/index.js +1 -0
  84. package/dist/packages/project-model/preparation-entries.d.ts +11 -0
  85. package/dist/packages/project-model/preparation-entries.js +49 -0
  86. package/dist/packages/project-model/source-config.d.ts +1 -0
  87. package/dist/packages/project-model/source-config.js +12 -1
  88. package/dist/packages/testing/lib/schema.d.ts +2 -3
  89. package/dist/packages/testing/lib/schema.js +2 -3
  90. package/dist/packages/testing/readiness-check-run.d.ts +3 -3
  91. package/dist/packages/testing/readiness-check-run.js +12 -17
  92. package/package.json +5 -24
  93. package/dist/cli/commands/compile-controller.d.ts +0 -17
  94. package/dist/cli/commands/compiled-flow.d.ts +0 -25
  95. package/dist/cli/commands/compiled-flow.js +0 -112
  96. package/dist/cli/commands/test-flow.d.ts +0 -58
  97. package/dist/cli/commands/test-flow.js +0 -231
  98. package/dist/compiler-ui/_next/static/chunks/0d~8t0zm6545p.js +0 -118
  99. package/dist/compiler-ui/_next/static/chunks/0xnel.ax9a.2c.css +0 -3
  100. /package/dist/compiler-ui/_next/static/{j7pdoqWrl4YJrJUVnksbl → 84FaeF3EzBF9kKTMjSEVN}/_buildManifest.js +0 -0
  101. /package/dist/compiler-ui/_next/static/{j7pdoqWrl4YJrJUVnksbl → 84FaeF3EzBF9kKTMjSEVN}/_clientMiddlewareManifest.js +0 -0
  102. /package/dist/compiler-ui/_next/static/{j7pdoqWrl4YJrJUVnksbl → 84FaeF3EzBF9kKTMjSEVN}/_ssgManifest.js +0 -0
  103. /package/dist/{cli/commands/check-draft.js → packages/local-service/readiness-check-draft.js} +0 -0
@@ -2,15 +2,12 @@ import chalk from "chalk";
2
2
  import * as p from "@clack/prompts";
3
3
  import { resolve } from "node:path";
4
4
  import { listCompiledMethodChoices, getCompiledMethod, } from "../../packages/method-package/method-definitions.js";
5
- import { createLocalMethodPackageFromTemplate } from "../../packages/method-package/interf-method-package.js";
6
- import { rmSync } from "node:fs";
7
- import { isMethodId, loadMethodDefinitionFromDir, seedLocalDefaultMethod, } from "../../packages/method-package/local-methods.js";
8
- import { resolveOrConfigureLocalExecutor } from "./executor-flow.js";
9
- import { runMethodAuthoringDraft } from "../../packages/method-authoring/method-authoring.js";
5
+ import { loadMethodDefinitionFromDir, } from "../../packages/method-package/local-methods.js";
10
6
  import { listSourcePreparationConfigs, loadSourceFolderConfig, resolveSourcePreparationPath, } from "../../packages/project-model/source-config.js";
11
- import { slugify } from "../../packages/shared/naming.js";
12
- import { submitMethodAuthoringRunToLocalService } from "../../packages/local-service/index.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";
13
9
  import { DEFAULT_SOURCE_FOLDER_PATH_PLACEHOLDER, listSourceFolderChoices, normalizeSourceFolderPathForConfig, } from "./source-config-wizard.js";
10
+ import { promptActionInputValues } from "./action-input-cli.js";
14
11
  export const clackMethodPrompts = {
15
12
  intro: p.intro,
16
13
  select: (options) => p.select(options),
@@ -112,6 +109,35 @@ function methodUseLabel(method) {
112
109
  function methodForkLabel(method) {
113
110
  return `Fork ${methodUseLabel(method)}`;
114
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
+ }
115
141
  export async function chooseCompiledMethod(sourcePath, options = {}) {
116
142
  const currentMethodId = options.currentMethodId;
117
143
  const methodOptions = buildCompiledMethodOptions(sourcePath);
@@ -179,15 +205,9 @@ export async function chooseOrCreateCompiledMethodForPreparation(sourcePath, pre
179
205
  if (prompts.isCancel(selected))
180
206
  return selected;
181
207
  if (selected === "__current__") {
182
- if (currentMethod?.value === "interf-default") {
183
- seedLocalDefaultMethod({ sourcePath });
184
- }
185
208
  return currentMethod?.value ?? currentMethodId;
186
209
  }
187
210
  if (selected === "__draft_from_scratch__" || selected === "__fork_existing__") {
188
- if (selected === "__fork_existing__" && currentMethod?.value === "interf-default") {
189
- seedLocalDefaultMethod({ sourcePath });
190
- }
191
211
  const methodId = await createMethodWizard({
192
212
  intro: false,
193
213
  sourcePath,
@@ -195,9 +215,6 @@ export async function chooseOrCreateCompiledMethodForPreparation(sourcePath, pre
195
215
  ? currentMethod?.value ?? currentMethodId
196
216
  : undefined,
197
217
  creationMode: selected === "__draft_from_scratch__" ? "draft-from-scratch" : "fork-existing",
198
- executionProfile: options.executionProfile,
199
- resolveExecutor: options.resolveExecutor,
200
- runDraft: options.runDraft,
201
218
  preparationContext: {
202
219
  config: preparationConfig,
203
220
  sourceFolderPath: resolveSourcePreparationPath(sourcePath, preparationConfig),
@@ -213,12 +230,9 @@ export async function createMethodWizard(options = {}, prompts = clackMethodProm
213
230
  }
214
231
  const sourcePath = options.sourcePath ?? process.cwd();
215
232
  return createCompiledMethodWizard(sourcePath, prompts, {
216
- executionProfile: options.executionProfile,
217
233
  baseMethodId: options.baseMethodId,
218
234
  creationMode: options.creationMode,
219
235
  preparationContext: options.preparationContext,
220
- resolveExecutor: options.resolveExecutor,
221
- runDraft: options.runDraft,
222
236
  });
223
237
  }
224
238
  export async function createCompiledMethodWizard(sourcePath, prompts = clackMethodPrompts, options = {}) {
@@ -252,32 +266,6 @@ export async function createCompiledMethodWizard(sourcePath, prompts = clackMeth
252
266
  const resolvedBaseMethod = baseMethodId
253
267
  ? getCompiledMethod(baseMethodId, { sourcePath })
254
268
  : null;
255
- const rawName = await prompts.text({
256
- message: "New Method name?",
257
- placeholder: "customer-research",
258
- validate: (value) => {
259
- if (value.trim().length === 0)
260
- return "Name is required";
261
- const methodId = slugify(value);
262
- if (!isMethodId(methodId))
263
- return "Use letters, numbers, and dashes only";
264
- if (listCompiledMethodChoices(sourcePath).some((method) => method.id === methodId)) {
265
- return "That Method name already exists";
266
- }
267
- return undefined;
268
- },
269
- });
270
- if (prompts.isCancel(rawName))
271
- return rawName;
272
- const methodId = slugify(rawName);
273
- const label = rawName.trim();
274
- const hint = await prompts.text({
275
- message: "One-line Method description?",
276
- placeholder: "Bias toward evidence-backed summaries and strong retrieval structure",
277
- validate: (value) => (value.trim().length === 0 ? "Description is required" : undefined),
278
- });
279
- if (prompts.isCancel(hint))
280
- return hint;
281
269
  if (creationModeValue === "draft-from-scratch") {
282
270
  let sourceFolderPath = options.preparationContext?.sourceFolderPath ?? null;
283
271
  let matchedPreparation = options.preparationContext?.config ?? null;
@@ -318,13 +306,16 @@ export async function createCompiledMethodWizard(sourcePath, prompts = clackMeth
318
306
  sourceFolderPath = String(sourceFolderPrompt);
319
307
  matchedPreparation = matchedPreparation ?? findMatchingPreparationConfig(sourcePath, sourceFolderPath);
320
308
  }
321
- const taskPrompt = await prompts.text({
322
- message: "What should this Method prepare for agents, and what evidence should show the data is ready?",
323
- placeholder: "Data: research interviews. Output: per-file summaries, themes, entities, claims, and source links. Evidence: every file processed, evidence linked to sources, required outputs created.",
324
- validate: (value) => (value.trim().length === 0 ? "A description is required" : undefined),
309
+ const methodValues = await promptMethodAuthoringValues({
310
+ defaultPreparation: matchedPreparation?.name ?? options.preparationContext?.config.name,
311
+ includeOutputFields: true,
312
+ prompts,
313
+ sourcePath,
325
314
  });
326
- if (prompts.isCancel(taskPrompt))
327
- return taskPrompt;
315
+ if (prompts.isCancel(methodValues))
316
+ return methodValues;
317
+ if (!methodValues)
318
+ return null;
328
319
  if (matchedPreparation) {
329
320
  prompts.log.info(`Shaping this Method from Preparation "${matchedPreparation.name}".`);
330
321
  }
@@ -338,10 +329,10 @@ export async function createCompiledMethodWizard(sourcePath, prompts = clackMeth
338
329
  request: {
339
330
  preparation: matchedPreparation?.name ?? null,
340
331
  source_folder_path: sourceFolderPath,
341
- method_id: methodId,
342
- label,
343
- hint: hint.trim(),
344
- task_prompt: taskPrompt.trim(),
332
+ method_id: methodValues.methodId,
333
+ label: methodValues.label,
334
+ hint: methodValues.hint,
335
+ task_prompt: methodValues.taskPrompt,
345
336
  checks: matchedPreparation?.checks ?? [],
346
337
  },
347
338
  onSubmitted: (submission) => {
@@ -360,59 +351,36 @@ export async function createCompiledMethodWizard(sourcePath, prompts = clackMeth
360
351
  : `Method draft run: ${job.status}`);
361
352
  },
362
353
  });
363
- const result = serviceRun
364
- ? serviceRun.result
365
- ? {
366
- status: serviceRun.result.status,
367
- changed: serviceRun.result.changed,
368
- summary: serviceRun.result.summary,
369
- validation: serviceRun.result.validation ?? null,
370
- methodPath: serviceRun.result.method_path,
371
- shellPath: serviceRun.result.shell_path,
372
- }
373
- : {
374
- status: "executor-failed",
375
- changed: false,
376
- summary: serviceRun.error ?? "Method authoring failed in the local Interf service.",
377
- validation: null,
378
- methodPath: resolve(sourcePath, "interf", "methods", methodId),
379
- shellPath: resolve(sourcePath, "interf", "methods", methodId),
380
- }
381
- : await (async () => {
382
- const resolveExecutor = options.resolveExecutor ?? resolveOrConfigureLocalExecutor;
383
- const runDraft = options.runDraft ?? runMethodAuthoringDraft;
384
- const { executor, error } = await resolveExecutor({
385
- executionProfile: options.executionProfile,
386
- purpose: "method",
387
- });
388
- if (!executor && !error) {
389
- return null;
390
- }
391
- if (!executor) {
392
- process.exitCode = 1;
393
- (prompts.log.error ?? prompts.log.info)(error ?? "No coding agent detected.");
394
- return null;
395
- }
396
- return runDraft({
397
- sourcePath,
398
- sourceFolderPath,
399
- methodId,
400
- label,
401
- hint: hint.trim(),
402
- taskPrompt: taskPrompt.trim(),
403
- checks: matchedPreparation?.checks ?? [],
404
- executor,
405
- onStatus: (line) => prompts.log.info(line),
406
- });
407
- })();
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
+ };
408
376
  if (!result)
409
377
  return null;
410
378
  if (result.status === "updated") {
411
379
  const draft = loadMethodDefinitionFromDir(result.methodPath);
412
380
  const stageList = draft?.stages?.map((stage) => stage.id).join(" -> ") ?? "-";
413
381
  prompts.log.info(`Draft ready at ${result.methodPath}`);
414
- prompts.log.info(` Name: ${draft?.label ?? label}`);
415
- prompts.log.info(` Description: ${draft?.hint ?? hint.trim()}`);
382
+ prompts.log.info(` Name: ${draft?.label ?? methodValues.label}`);
383
+ prompts.log.info(` Description: ${draft?.hint ?? methodValues.hint}`);
416
384
  if (draft?.purpose)
417
385
  prompts.log.info(` Purpose: ${draft.purpose}`);
418
386
  prompts.log.info(` Stages: ${stageList}`);
@@ -420,16 +388,15 @@ export async function createCompiledMethodWizard(sourcePath, prompts = clackMeth
420
388
  message: "Save this Method?",
421
389
  options: [
422
390
  { value: "save", label: "Save", hint: "Keep the draft as your new Method package" },
423
- { value: "cancel", label: "Discard", hint: "Remove the draft folder and exit without saving" },
391
+ { value: "cancel", label: "Close", hint: "Leave the service-created draft in place for review" },
424
392
  ],
425
393
  });
426
394
  if (prompts.isCancel(confirmChoice) || confirmChoice === "cancel") {
427
- rmSync(result.methodPath, { recursive: true, force: true });
428
- prompts.log.info(`Discarded draft at ${result.methodPath}`);
395
+ prompts.log.info(`Draft kept at ${result.methodPath}`);
429
396
  return null;
430
397
  }
431
398
  prompts.log.info(`Saved local Method: ${result.methodPath}`);
432
- return methodId;
399
+ return methodValues.methodId;
433
400
  }
434
401
  process.exitCode = 1;
435
402
  (prompts.log.error ?? prompts.log.info)(result.status === "no-change"
@@ -438,28 +405,30 @@ export async function createCompiledMethodWizard(sourcePath, prompts = clackMeth
438
405
  prompts.log.info(`Method shell kept at: ${result.shellPath}`);
439
406
  return null;
440
407
  }
441
- const stagePolicyNotes = {};
442
408
  if (!baseMethodId || !resolvedBaseMethod) {
443
409
  throw new Error("Fork-existing Method creation needs a base Method.");
444
410
  }
445
- for (const stage of resolvedBaseMethod.stages) {
446
- const stagePrompt = await prompts.text({
447
- message: `What should ${stage.id} (${stage.label}) emphasize?`,
448
- placeholder: stage.description,
449
- validate: (value) => (value.trim().length === 0 ? `${stage.label} guidance is required` : undefined),
450
- });
451
- if (prompts.isCancel(stagePrompt))
452
- return stagePrompt;
453
- stagePolicyNotes[stage.id] = [String(stagePrompt).trim()];
454
- }
455
- const methodPath = createLocalMethodPackageFromTemplate({
456
- sourcePath,
457
- baseMethodId,
458
- methodId,
459
- label,
460
- hint: hint.trim(),
461
- stagePolicyNotes,
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 ?? "",
462
418
  });
463
- prompts.log.info(`Saved local Method: ${methodPath}`);
464
- return methodId;
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;
465
434
  }
@@ -1,8 +1,6 @@
1
1
  import type { CommandModule } from "yargs";
2
- import type { MethodExecutionProfile } from "../../packages/agents/lib/executors.js";
3
2
  export declare const createCommand: CommandModule;
4
3
  export declare function createCompiledWizard(options?: {
5
4
  intro?: boolean;
6
- executionProfile?: MethodExecutionProfile;
7
5
  }): Promise<void>;
8
6
  export { type MethodWizardPrompts, formatMethodLabel, createMethodWizard, createCompiledMethodWizard, } from "./create-method-wizard.js";
@@ -1,14 +1,13 @@
1
1
  import chalk from "chalk";
2
2
  import * as p from "@clack/prompts";
3
- import { detectInterf, ensurePortableContextScaffold, resolveSourceControlPath, } from "../../packages/project-model/interf.js";
4
- import { addExecutionProfileOptions, executionProfileFromArgv, } from "../../packages/agents/lib/execution-profile.js";
5
- import { SOURCE_FOLDER_CONFIG_PATH, listSourcePreparationConfigs, loadSourceFolderConfig, syncCompiledInterfConfigFromSourcePreparationConfig, upsertSourcePreparationConfig, } from "../../packages/project-model/source-config.js";
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";
6
5
  import { chooseOrCreateCompiledMethodForPreparation, createMethodWizard, } from "./create-method-wizard.js";
7
- import { findBuiltCompiledPath, } from "./compiled-flow.js";
6
+ import { findBuiltPortableContextPath, } from "../../packages/project-model/preparation-entries.js";
8
7
  import { DEFAULT_PREPARATION_NAME, promptSingleCompiledConfig, } from "./source-config-wizard.js";
9
8
  import { defaultPreparationNameForPath, } from "../../packages/project-model/source-folders.js";
10
9
  import { resolveCommandControlPath, resolveInterfInstanceContext, } from "./control-path.js";
11
- import { resolveMethodId } from "../../packages/methods/method-resolution.js";
10
+ import { savePreparationThroughServiceAction } from "./preparation-action.js";
12
11
  function normalizeCreateTarget(value) {
13
12
  if (!value)
14
13
  return null;
@@ -75,16 +74,12 @@ async function maybeAssignMethodToPreparation(sourcePath, methodId) {
75
74
  ...targetPreparation,
76
75
  method: methodId,
77
76
  };
78
- upsertSourcePreparationConfig(sourcePath, nextConfig, {
79
- matchName: targetPreparation.name,
77
+ await savePreparationThroughServiceAction({
78
+ sourcePath,
79
+ preparation: nextConfig,
80
+ setupMode: "select-method",
80
81
  });
81
- const builtCompiledPath = findBuiltCompiledPath(sourcePath, targetPreparation.name);
82
- if (builtCompiledPath) {
83
- syncCompiledInterfConfigFromSourcePreparationConfig(builtCompiledPath, nextConfig);
84
- }
85
- else {
86
- ensurePortableContextScaffold(sourcePath, nextConfig.name, resolveMethodId(nextConfig));
87
- }
82
+ const builtCompiledPath = findBuiltPortableContextPath(sourcePath, targetPreparation.name);
88
83
  p.log.info(`Assigned Method "${methodId}" to Preparation "${targetPreparation.name}".`);
89
84
  if (builtCompiledPath) {
90
85
  p.log.info("The active local Method copy for that Portable Context lives under `.interf/method/`.");
@@ -94,15 +89,14 @@ async function maybeAssignMethodToPreparation(sourcePath, methodId) {
94
89
  export const createCommand = {
95
90
  command: "create [type]",
96
91
  describe: "Create a Preparation or reusable Method",
97
- builder: (yargs) => addExecutionProfileOptions(yargs.positional("type", {
92
+ builder: (yargs) => yargs.positional("type", {
98
93
  type: "string",
99
94
  describe: "Type to create (`preparation` or `method`)",
100
95
  default: undefined,
101
- })),
96
+ }),
102
97
  handler: async (argv) => {
103
98
  const rawType = argv.type;
104
99
  let type = normalizeCreateTarget(rawType);
105
- const executionProfile = executionProfileFromArgv(argv);
106
100
  if (rawType && !type) {
107
101
  process.exitCode = 1;
108
102
  p.log.error(`Unknown create target: ${rawType}`);
@@ -119,14 +113,13 @@ export const createCommand = {
119
113
  const sourcePath = detected ? resolveSourceControlPath(detected.path) : resolveCommandControlPath();
120
114
  const methodId = await createMethodWizard({
121
115
  sourcePath,
122
- executionProfile,
123
116
  });
124
117
  if (typeof methodId === "string") {
125
118
  await maybeAssignMethodToPreparation(sourcePath, methodId);
126
119
  }
127
120
  return;
128
121
  }
129
- await createCompiledWizard({ executionProfile });
122
+ await createCompiledWizard();
130
123
  },
131
124
  };
132
125
  export async function createCompiledWizard(options = {}) {
@@ -172,7 +165,6 @@ export async function createCompiledWizard(options = {}) {
172
165
  }
173
166
  const methodChoice = await chooseOrCreateCompiledMethodForPreparation(sourcePath, draft, {
174
167
  currentMethodId: "interf-default",
175
- executionProfile: options.executionProfile,
176
168
  });
177
169
  if (!methodChoice || p.isCancel(methodChoice))
178
170
  return;
@@ -180,8 +172,10 @@ export async function createCompiledWizard(options = {}) {
180
172
  ...draft,
181
173
  method: String(methodChoice),
182
174
  };
183
- upsertSourcePreparationConfig(sourcePath, configToSave);
184
- ensurePortableContextScaffold(sourcePath, configToSave.name, configToSave.method);
175
+ await savePreparationThroughServiceAction({
176
+ sourcePath,
177
+ preparation: configToSave,
178
+ });
185
179
  p.outro(configToSave.checks.length > 0
186
180
  ? "Saved Preparation.\nNext:\n interf compile\n interf test"
187
181
  : "Saved Preparation.\nNext:\n interf or interf init");
@@ -97,7 +97,7 @@ export const doctorCommand = {
97
97
  id: "live",
98
98
  label: "Live executor preflight",
99
99
  status: "skipped",
100
- message: "Skipped. Run `interf doctor --live` to exercise the real local agent before a check draft, Method authoring run, readiness check, or Compilation.",
100
+ message: "Skipped. Run `interf doctor --live` to exercise the real local agent before drafting readiness checks, Method authoring, a readiness check, or a prepare run.",
101
101
  });
102
102
  }
103
103
  const ok = checks.every((check) => check.status !== "fail");
@@ -86,7 +86,7 @@ export async function promptForTestAgents() {
86
86
  }
87
87
  async function promptForRunAgent(purpose) {
88
88
  const purposeLabel = purpose === "draft"
89
- ? "check draft"
89
+ ? "draft readiness checks"
90
90
  : purpose === "method"
91
91
  ? "Method authoring"
92
92
  : purpose;
@@ -1,11 +1,26 @@
1
1
  import type { CommandModule } from "yargs";
2
2
  import type { SourcePreparationConfig } from "../../packages/project-model/lib/schema.js";
3
- import { type AgentTestMatrixRow } from "./test-flow.js";
4
3
  import { runCompileCommand } from "./compile.js";
5
4
  export type CurrentRunTargetStatus = "pass" | "mixed" | "fail" | "missing";
5
+ interface AgentTestMatrixRow {
6
+ agentLabel: string;
7
+ rawOutcome?: {
8
+ result: {
9
+ totalCases: number;
10
+ passedCases: number;
11
+ };
12
+ } | null;
13
+ compiledOutcome?: {
14
+ result: {
15
+ totalCases: number;
16
+ passedCases: number;
17
+ };
18
+ } | null;
19
+ }
6
20
  export declare function currentRunTargetStatus(rows: AgentTestMatrixRow[], target: "raw" | "compiled"): CurrentRunTargetStatus;
7
21
  export declare function compileSelectedCompiled(sourcePath: string, compiledConfig: SourcePreparationConfig, deps?: {
8
22
  runCompileCommand?: typeof runCompileCommand;
9
23
  }): Promise<import("./compile.js").CompileCommandResult | null>;
10
24
  export declare const initCommand: CommandModule;
11
25
  export declare function runInitCommand(): Promise<void>;
26
+ export {};