@interf/compiler 0.9.3 → 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 -22
  64. package/dist/packages/local-service/action-values.js +1 -30
  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 +302 -292
  70. package/dist/packages/local-service/lib/schema.js +115 -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 +430 -286
  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/0c9mu7yldxyyg.css +0 -3
  99. package/dist/compiler-ui/_next/static/chunks/15mks7ry_cupt.js +0 -118
  100. /package/dist/compiler-ui/_next/static/{pIZnDsV3Je6hdC3cOsGdK → 84FaeF3EzBF9kKTMjSEVN}/_buildManifest.js +0 -0
  101. /package/dist/compiler-ui/_next/static/{pIZnDsV3Je6hdC3cOsGdK → 84FaeF3EzBF9kKTMjSEVN}/_clientMiddlewareManifest.js +0 -0
  102. /package/dist/compiler-ui/_next/static/{pIZnDsV3Je6hdC3cOsGdK → 84FaeF3EzBF9kKTMjSEVN}/_ssgManifest.js +0 -0
  103. /package/dist/{cli/commands/check-draft.js → packages/local-service/readiness-check-draft.js} +0 -0
@@ -3,18 +3,19 @@ import * as p from "@clack/prompts";
3
3
  import { existsSync, statSync } from "node:fs";
4
4
  import { homedir } from "node:os";
5
5
  import { basename, isAbsolute, relative, resolve } from "node:path";
6
- import { assertCompiledContainer, detectInterf, ensurePortableContextScaffold, readInterfConfig, resolveSourceControlPath, } from "../../packages/project-model/interf.js";
7
- import { SOURCE_FOLDER_CONFIG_PATH, configuredSourceFolderPath, loadSourceFolderConfig, resolveConfiguredSourceFolderPath, saveSourceFolderConfig, syncCompiledInterfConfigFromSourcePreparationConfig, upsertSourcePreparationConfig, } from "../../packages/project-model/source-config.js";
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
8
  import { defaultPreparationNameForPath, } from "../../packages/project-model/source-folders.js";
9
9
  import { DEFAULT_PREPARATION_NAME, describeCompileLoopSelection, listSourceFolderChoices, promptSingleCompiledConfig, } from "./source-config-wizard.js";
10
10
  import { chooseOrCreateCompiledMethodForPreparation, createMethodWizard, } from "./create-method-wizard.js";
11
11
  import { seedLocalDefaultMethod } from "../../packages/method-package/local-methods.js";
12
- import { findBuiltCompiledPath, findSavedCompiledConfig, listSavedPreparationEntries, } from "./compiled-flow.js";
13
- import { readCurrentSavedTestComparison, } from "./test-flow.js";
12
+ import { listSavedPreparationEntries, findBuiltPortableContextPath, findSavedPreparationConfig, } from "../../packages/project-model/preparation-entries.js";
13
+ import { readCurrentSavedReadinessCheckRun, } from "../../packages/testing/readiness-check-run.js";
14
14
  import { runCompileCommand } from "./compile.js";
15
15
  import { runTestCommand } from "./test.js";
16
16
  import { defaultInterfInstanceRoot, relativeSourceFolderPath, resolveInterfInstanceContext, } from "./control-path.js";
17
17
  import { runWebCommand } from "./web.js";
18
+ import { savePreparationThroughServiceAction } from "./preparation-action.js";
18
19
  function displayPath(path) {
19
20
  const resolvedPath = resolve(path);
20
21
  const cwd = process.cwd();
@@ -212,27 +213,27 @@ function printPreparationSummary(options) {
212
213
  });
213
214
  if (prepareMode !== "Prepare once.")
214
215
  p.log.info(`Prepare mode: ${prepareMode}`);
215
- if (options.latestComparison?.raw && options.latestComparison?.compiled) {
216
- p.log.info(`Latest saved comparison: source files ${options.latestComparison.raw.passed_cases}/${options.latestComparison.raw.total_cases}, Portable Context ${options.latestComparison.compiled.passed_cases}/${options.latestComparison.compiled.total_cases}.`);
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}.`);
217
218
  }
218
- else if (options.latestComparison?.raw) {
219
- p.log.info(`Latest saved source-files run: ${options.latestComparison.raw.passed_cases}/${options.latestComparison.raw.total_cases}.`);
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}.`);
220
221
  }
221
- else if (options.latestComparison?.compiled) {
222
- p.log.info(`Latest Portable Context run: ${options.latestComparison.compiled.passed_cases}/${options.latestComparison.compiled.total_cases}.`);
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}.`);
223
224
  }
224
- else if (options.latestComparisonStale) {
225
+ else if (options.latestReadinessStale) {
225
226
  p.log.info("Saved readiness results are stale for the current checks.");
226
227
  }
227
228
  if (options.sourcePath !== process.cwd()) {
228
229
  p.log.info(`Interf Workspace: ${displayPath(options.sourcePath)}`);
229
230
  }
230
231
  }
231
- async function promptPreparationAction(preparation, built, latestComparison) {
232
+ async function promptPreparationAction(preparation, built, latestReadiness) {
232
233
  const options = [];
233
- const hasSavedRawBaseline = Boolean(latestComparison?.raw);
234
- const latestRawPasses = latestComparison?.raw &&
235
- latestComparison.raw.passed_cases === latestComparison.raw.total_cases;
234
+ const hasSavedRawBaseline = Boolean(latestReadiness?.raw);
235
+ const latestRawPasses = latestReadiness?.raw &&
236
+ latestReadiness.raw.passed_cases === latestReadiness.raw.total_cases;
236
237
  const compileOption = {
237
238
  value: "compile",
238
239
  label: built ? "Prepare again" : "Prepare files",
@@ -251,9 +252,7 @@ async function promptPreparationAction(preparation, built, latestComparison) {
251
252
  label: "Open Interf UI",
252
253
  hint: "Start the local UI and API for this Interf Workspace",
253
254
  };
254
- if (built) {
255
- options.push(webOption);
256
- }
255
+ options.push(webOption);
257
256
  if (preparation.checks.length > 0) {
258
257
  const testOption = {
259
258
  value: "test",
@@ -303,21 +302,21 @@ async function promptPreparationAction(preparation, built, latestComparison) {
303
302
  return null;
304
303
  return selected;
305
304
  }
306
- function printPreparationRecommendation(preparation, built, latestComparison) {
305
+ function printPreparationRecommendation(preparation, built, latestReadiness) {
307
306
  if (preparation.checks.length === 0) {
308
307
  return;
309
308
  }
310
309
  if (!built) {
311
- if (latestComparison?.raw) {
312
- p.log.info(latestComparison.raw.passed_cases === latestComparison.raw.total_cases
313
- ? `Latest source-files run: ${latestComparison.raw.passed_cases}/${latestComparison.raw.total_cases}. Prepare files if you want a side-by-side comparison.`
314
- : `Latest source-files run: ${latestComparison.raw.passed_cases}/${latestComparison.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.`);
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.`);
315
314
  return;
316
315
  }
317
316
  p.log.info("Recommended first step: choose a Method and prepare files.");
318
317
  return;
319
318
  }
320
- p.log.info("Recommended first step: compare the source-files baseline and Portable Context.");
319
+ p.log.info("Recommended first step: run readiness checks against source files and Portable Context.");
321
320
  }
322
321
  async function promptPostBaselineAction(rows) {
323
322
  const status = currentRunTargetStatus(rows, "raw");
@@ -369,7 +368,7 @@ async function promptPostBaselineAction(rows) {
369
368
  }
370
369
  async function chooseCompiledForWizard(options) {
371
370
  if (options.fixedCompiledName) {
372
- return findSavedCompiledConfig(options.sourcePath, options.fixedCompiledName);
371
+ return findSavedPreparationConfig(options.sourcePath, options.fixedCompiledName);
373
372
  }
374
373
  const savedEntries = listSavedPreparationEntries(options.sourcePath);
375
374
  if (savedEntries.length === 0)
@@ -400,7 +399,7 @@ async function chooseCompiledForWizard(options) {
400
399
  return null;
401
400
  if (selected === "__new__")
402
401
  return "__new__";
403
- return findSavedCompiledConfig(options.sourcePath, String(selected));
402
+ return findSavedPreparationConfig(options.sourcePath, String(selected));
404
403
  }
405
404
  async function promptCompiledSetup(options) {
406
405
  const savedConfig = loadSourceFolderConfig(options.sourcePath);
@@ -417,7 +416,6 @@ async function promptCompiledSetup(options) {
417
416
  return null;
418
417
  const methodChoice = await chooseOrCreateCompiledMethodForPreparation(options.sourcePath, compiledConfig, {
419
418
  currentMethodId: options.initial?.method ?? "interf-default",
420
- executionProfile: options.executionProfile,
421
419
  });
422
420
  if (!methodChoice || p.isCancel(methodChoice))
423
421
  return null;
@@ -426,16 +424,10 @@ async function promptCompiledSetup(options) {
426
424
  ...compiledConfig,
427
425
  method: methodId,
428
426
  };
429
- upsertSourcePreparationConfig(options.sourcePath, compiledConfigWithMethod, {
430
- ...(options.fixedName ? { matchName: options.fixedName } : {}),
427
+ await savePreparationThroughServiceAction({
428
+ sourcePath: options.sourcePath,
429
+ preparation: compiledConfigWithMethod,
431
430
  });
432
- const builtCompiledPath = findBuiltCompiledPath(options.sourcePath, compiledConfigWithMethod.name);
433
- if (builtCompiledPath) {
434
- syncCompiledInterfConfigFromSourcePreparationConfig(builtCompiledPath, compiledConfigWithMethod);
435
- }
436
- else {
437
- ensurePortableContextScaffold(options.sourcePath, compiledConfigWithMethod.name, compiledConfigWithMethod.method ?? "interf-default");
438
- }
439
431
  console.log();
440
432
  console.log(chalk.green(` ✓ Saved Preparation in ${SOURCE_FOLDER_CONFIG_PATH}`));
441
433
  console.log(chalk.dim(` Interf Workspace: ${options.sourcePath}`));
@@ -458,8 +450,8 @@ export async function compileSelectedCompiled(sourcePath, compiledConfig, deps =
458
450
  });
459
451
  }
460
452
  async function runCompiledActionMenu(sourcePath, compiledConfig, options = {}) {
461
- const builtCompiledPath = findBuiltCompiledPath(sourcePath, compiledConfig.name);
462
- const { comparison: latestComparison, stale: latestComparisonStale, } = readCurrentSavedTestComparison({
453
+ const builtCompiledPath = findBuiltPortableContextPath(sourcePath, compiledConfig.name);
454
+ const { readinessRun: latestReadiness, stale: latestReadinessStale, } = readCurrentSavedReadinessCheckRun({
463
455
  projectPath: sourcePath,
464
456
  preparationName: compiledConfig.name,
465
457
  checks: compiledConfig.checks,
@@ -469,11 +461,11 @@ async function runCompiledActionMenu(sourcePath, compiledConfig, options = {}) {
469
461
  preparation: compiledConfig,
470
462
  built: Boolean(builtCompiledPath),
471
463
  builtCompiledPath,
472
- latestComparison,
473
- latestComparisonStale,
464
+ latestReadiness,
465
+ latestReadinessStale,
474
466
  });
475
- printPreparationRecommendation(compiledConfig, Boolean(builtCompiledPath), latestComparison);
476
- const action = await promptPreparationAction(compiledConfig, Boolean(builtCompiledPath), latestComparison);
467
+ printPreparationRecommendation(compiledConfig, Boolean(builtCompiledPath), latestReadiness);
468
+ const action = await promptPreparationAction(compiledConfig, Boolean(builtCompiledPath), latestReadiness);
477
469
  if (!action)
478
470
  return;
479
471
  if (action === "done") {
@@ -493,16 +485,11 @@ async function runCompiledActionMenu(sourcePath, compiledConfig, options = {}) {
493
485
  ...compiledConfig,
494
486
  method: methodId,
495
487
  };
496
- upsertSourcePreparationConfig(sourcePath, nextConfig, {
497
- matchName: compiledConfig.name,
488
+ await savePreparationThroughServiceAction({
489
+ sourcePath,
490
+ preparation: nextConfig,
491
+ setupMode: "select-method",
498
492
  });
499
- const builtCompiledPath = findBuiltCompiledPath(sourcePath, compiledConfig.name);
500
- if (builtCompiledPath) {
501
- syncCompiledInterfConfigFromSourcePreparationConfig(builtCompiledPath, nextConfig);
502
- }
503
- else {
504
- ensurePortableContextScaffold(sourcePath, nextConfig.name, nextConfig.method ?? "interf-default");
505
- }
506
493
  p.log.info(`Assigned Method "${methodId}" to Preparation "${compiledConfig.name}".`);
507
494
  p.log.info("Next: run `interf compile`, then `interf test`.");
508
495
  }
@@ -598,7 +585,7 @@ async function runCompiledActionMenu(sourcePath, compiledConfig, options = {}) {
598
585
  }
599
586
  if (compileResult.testedDuringCompile) {
600
587
  p.log.info("This prepare run already checked the Portable Context on the saved readiness checks.");
601
- p.log.info("Run `interf test` later if you want a fresh side-by-side comparison summary.");
588
+ p.log.info("Run `interf test` later if you want fresh readiness evidence for source files and Portable Context.");
602
589
  return;
603
590
  }
604
591
  await runTestCommand({
@@ -620,7 +607,7 @@ async function runCompiledActionMenu(sourcePath, compiledConfig, options = {}) {
620
607
  }
621
608
  const runCompiledTest = await p.confirm({
622
609
  message: compileResult.testedDuringCompile
623
- ? "Run a fresh source-files versus Portable Context comparison now?"
610
+ ? "Run fresh readiness checks against source files and Portable Context now?"
624
611
  : builtCompiledPath
625
612
  ? "Run readiness checks on source files and Portable Context now?"
626
613
  : "Run readiness checks on source files and Portable Context now?",
@@ -1,6 +1,6 @@
1
1
  import chalk from "chalk";
2
2
  import { detectInterf, resolveSourceControlPath, } from "../../packages/project-model/interf.js";
3
- import { listSavedPreparationEntries } from "./compiled-flow.js";
3
+ import { listSavedPreparationEntries, } from "../../packages/project-model/preparation-entries.js";
4
4
  import { resolveCommandControlPath } from "./control-path.js";
5
5
  import { resolveMethodId } from "../../packages/methods/method-resolution.js";
6
6
  export const listCommand = {
@@ -0,0 +1,8 @@
1
+ import type { SourcePreparationConfig } from "../../packages/project-model/lib/schema.js";
2
+ import type { PreparationSetupResult } from "../../packages/local-service/index.js";
3
+ export declare function savePreparationThroughServiceAction(options: {
4
+ preparation: SourcePreparationConfig;
5
+ prepareAfterSetup?: boolean;
6
+ setupMode?: "create" | "select-method";
7
+ sourcePath: string;
8
+ }): Promise<PreparationSetupResult>;
@@ -0,0 +1,29 @@
1
+ import { submitPreparationSetupToLocalService, } from "../../packages/local-service/index.js";
2
+ import { PreparationSetupActionValuesSchema, preparationSetupRequestFromActionValues, } from "../../packages/local-service/action-definitions.js";
3
+ function preparationSetupRequest(preparation, options = {}) {
4
+ const values = PreparationSetupActionValuesSchema.parse({
5
+ name: preparation.name,
6
+ path: preparation.path,
7
+ about: preparation.about ?? `Preparation ${preparation.name}`,
8
+ method: preparation.method ?? "interf-default",
9
+ checks: preparation.checks,
10
+ ...(typeof preparation.max_attempts === "number" ? { max_attempts: preparation.max_attempts } : {}),
11
+ ...(typeof preparation.max_loops === "number" ? { max_loops: preparation.max_loops } : {}),
12
+ prepare_after_setup: options.prepareAfterSetup ?? false,
13
+ ...(options.setupMode ? { setup_mode: options.setupMode } : {}),
14
+ });
15
+ return preparationSetupRequestFromActionValues(values);
16
+ }
17
+ export async function savePreparationThroughServiceAction(options) {
18
+ const submitted = await submitPreparationSetupToLocalService({
19
+ projectPath: options.sourcePath,
20
+ request: preparationSetupRequest(options.preparation, {
21
+ prepareAfterSetup: options.prepareAfterSetup,
22
+ setupMode: options.setupMode,
23
+ }),
24
+ });
25
+ if (!submitted) {
26
+ throw new Error("Interf local service is not running. Start `interf web`, then retry so the Preparation change is visible in Interf.");
27
+ }
28
+ return submitted.result;
29
+ }
@@ -0,0 +1,5 @@
1
+ import type { SourcePreparationConfig } from "../../packages/project-model/lib/schema.js";
2
+ export declare function choosePreparationConfig(options: {
3
+ sourcePath: string;
4
+ selectMessage: string;
5
+ }): Promise<SourcePreparationConfig | null | undefined>;
@@ -0,0 +1,36 @@
1
+ import * as p from "@clack/prompts";
2
+ import { listSavedPreparationEntries, } from "../../packages/project-model/preparation-entries.js";
3
+ import { resolveMethodId } from "../../packages/methods/method-resolution.js";
4
+ function formatSavedPreparationHint(entry) {
5
+ const config = entry.config;
6
+ const checkCount = config.checks.length;
7
+ const methodHint = `Method ${resolveMethodId(config)}${entry.localDraft ? " (local draft)" : ""}`;
8
+ if (config.about)
9
+ return `${config.path} · ${config.about} · ${methodHint}`;
10
+ if (checkCount === 0)
11
+ return `${config.path} · No readiness checks yet · ${methodHint}`;
12
+ return `${config.path} · ${checkCount} readiness check${checkCount === 1 ? "" : "s"} · ${methodHint}`;
13
+ }
14
+ export async function choosePreparationConfig(options) {
15
+ const savedEntries = listSavedPreparationEntries(options.sourcePath);
16
+ if (savedEntries.length === 0) {
17
+ return null;
18
+ }
19
+ if (savedEntries.length === 1) {
20
+ return savedEntries[0]?.config ?? null;
21
+ }
22
+ const selected = await p.select({
23
+ message: options.selectMessage,
24
+ options: savedEntries.map((entry) => ({
25
+ value: entry.config.name,
26
+ label: entry.config.name,
27
+ hint: [
28
+ formatSavedPreparationHint(entry),
29
+ entry.path ? "Portable Context available" : "Portable Context not built yet",
30
+ ].join(" · "),
31
+ })),
32
+ });
33
+ if (p.isCancel(selected))
34
+ return undefined;
35
+ return savedEntries.find((entry) => entry.config.name === selected)?.config ?? null;
36
+ }
@@ -1,4 +1,4 @@
1
- import { findSavedCompiledConfig } from "./compiled-flow.js";
1
+ import { findSavedPreparationConfig, } from "../../packages/project-model/preparation-entries.js";
2
2
  export function resolveConfiguredPreparationSelection(options) {
3
3
  if (options.hintedPreparationConfig &&
4
4
  (!options.requestedPreparationName || options.hintedPreparationConfig.name === options.requestedPreparationName)) {
@@ -7,5 +7,5 @@ export function resolveConfiguredPreparationSelection(options) {
7
7
  if (!options.requestedPreparationName) {
8
8
  return null;
9
9
  }
10
- return findSavedCompiledConfig(options.sourcePath, options.requestedPreparationName);
10
+ return findSavedPreparationConfig(options.sourcePath, options.requestedPreparationName);
11
11
  }
@@ -1,6 +1,7 @@
1
1
  import chalk from "chalk";
2
2
  import { detectInterf } from "../../packages/project-model/interf.js";
3
- import { resetCompiledGeneratedState } from "../../packages/compiler/reset.js";
3
+ import { submitResetToLocalService, } from "../../packages/local-service/index.js";
4
+ import { resolveSourceControlPath, } from "../../packages/project-model/interf.js";
4
5
  export const resetCommand = {
5
6
  command: "reset <scope>",
6
7
  describe: "Reset generated Portable Context state while keeping source files and the local Method package",
@@ -15,8 +16,18 @@ export const resetCommand = {
15
16
  console.log(chalk.red("Run this from inside a Portable Context."));
16
17
  return;
17
18
  }
18
- const compiledPath = detected.path;
19
- resetCompiledGeneratedState(compiledPath, argv.scope);
20
- console.log(chalk.green(" Portable Context reset complete."));
19
+ const submitted = await submitResetToLocalService({
20
+ projectPath: resolveSourceControlPath(detected.path),
21
+ request: {
22
+ preparation: detected.config.name,
23
+ scope: argv.scope,
24
+ },
25
+ });
26
+ if (!submitted) {
27
+ process.exitCode = 1;
28
+ console.log(chalk.red("Interf local service is not running. Start `interf web`, then retry reset so the mutation is visible through the service API."));
29
+ return;
30
+ }
31
+ console.log(chalk.green(` ${submitted.result.message}`));
21
32
  },
22
33
  };
@@ -0,0 +1,9 @@
1
+ import { type ActionProposalCreateRequest, type ActionProposalResource } from "../../packages/local-service/index.js";
2
+ export type ApprovedActionResult = {
3
+ proposal: ActionProposalResource;
4
+ serviceUrl: string | null;
5
+ };
6
+ export declare function approveActionThroughService(options: {
7
+ request: ActionProposalCreateRequest;
8
+ sourcePath: string;
9
+ }): Promise<ApprovedActionResult>;
@@ -0,0 +1,19 @@
1
+ import { approveActionProposalInLocalService, } from "../../packages/local-service/index.js";
2
+ export async function approveActionThroughService(options) {
3
+ const serviceProposal = await approveActionProposalInLocalService({
4
+ projectPath: options.sourcePath,
5
+ request: {
6
+ ...options.request,
7
+ client_origin: options.request.client_origin && options.request.client_origin !== "unknown"
8
+ ? options.request.client_origin
9
+ : "cli",
10
+ },
11
+ });
12
+ if (serviceProposal) {
13
+ return {
14
+ proposal: serviceProposal.resource,
15
+ serviceUrl: serviceProposal.serviceUrl,
16
+ };
17
+ }
18
+ throw new Error("Interf local service is not running for this Workspace. Start it with `interf web`, then rerun this action so the proposal and run are visible in Interf.");
19
+ }
@@ -2,7 +2,6 @@ import { type SourcePreparationConfig, type SourceReadinessCheck } from "../../p
2
2
  export declare const DEFAULT_PREPARATION_NAME = "default";
3
3
  export declare const DEFAULT_COMPILED_CHECK_QUESTION_PLACEHOLDER = "An agent-work-critical check you can already verify from this Source Folder";
4
4
  export declare const DEFAULT_COMPILED_CHECK_ANSWER_PLACEHOLDER = "The expected answer in plain English";
5
- export declare const DEFAULT_COMPILED_ABOUT_PLACEHOLDER = "Example: board prep from these files, chart reads from this report, or tax review from these exports.";
6
5
  export declare const DEFAULT_SOURCE_FOLDER_PATH_PLACEHOLDER = "./source-files";
7
6
  export declare const DEFAULT_COMPILE_RETRY_ATTEMPTS = 3;
8
7
  export declare const DEFAULT_SELF_IMPROVING_LOOPS = 3;
@@ -2,12 +2,10 @@ import * as p from "@clack/prompts";
2
2
  import { sourceConfig as projectSourceConfig, sourceFolders as projectSourceFolders, } from "../../packages/project-model/index.js";
3
3
  import { slugify } from "../../packages/shared/naming.js";
4
4
  import { submitReadinessCheckDraftToLocalService, } from "../../packages/local-service/index.js";
5
- import { resolveOrConfigureLocalExecutor } from "./executor-flow.js";
6
- import { draftReadinessChecks } from "./check-draft.js";
5
+ import { buildCreatePreparationActionDefinition, } from "../../packages/local-service/action-definitions.js";
7
6
  export const DEFAULT_PREPARATION_NAME = "default";
8
7
  export const DEFAULT_COMPILED_CHECK_QUESTION_PLACEHOLDER = "An agent-work-critical check you can already verify from this Source Folder";
9
8
  export const DEFAULT_COMPILED_CHECK_ANSWER_PLACEHOLDER = "The expected answer in plain English";
10
- export const DEFAULT_COMPILED_ABOUT_PLACEHOLDER = "Example: board prep from these files, chart reads from this report, or tax review from these exports.";
11
9
  export const DEFAULT_SOURCE_FOLDER_PATH_PLACEHOLDER = "./source-files";
12
10
  export const DEFAULT_COMPILE_RETRY_ATTEMPTS = 3;
13
11
  export const DEFAULT_SELF_IMPROVING_LOOPS = 3;
@@ -81,10 +79,20 @@ async function promptSourceFolderPath(options) {
81
79
  return normalizeSourceFolderPathForConfig(options.projectPath, String(sourceFolderPath));
82
80
  }
83
81
  export function preparationAboutPromptMessage(introStyle) {
84
- if (introStyle === "edit") {
85
- return "What agent work should this Preparation stay focused on?";
86
- }
87
- return "What agent work should this Preparation help with?";
82
+ void introStyle;
83
+ return createPreparationActionField("about").label;
84
+ }
85
+ function createPreparationActionField(name) {
86
+ const definition = buildCreatePreparationActionDefinition({
87
+ existingNames: [],
88
+ methods: [],
89
+ sourcePath: DEFAULT_SOURCE_FOLDER_PATH_PLACEHOLDER,
90
+ suggestedName: DEFAULT_PREPARATION_NAME,
91
+ });
92
+ const field = definition.fields.find((candidate) => candidate.name === name);
93
+ if (!field)
94
+ throw new Error(`Create Preparation action field missing: ${name}`);
95
+ return field;
88
96
  }
89
97
  function formatAttemptLabel(count, noun) {
90
98
  return `${count} ${noun}${count === 1 ? "" : "s"}`;
@@ -208,7 +216,7 @@ async function promptDraftReadinessChecks(options) {
208
216
  lastServiceStatus = statusKey;
209
217
  p.log.info(activeStep
210
218
  ? `${activeStep.label}: ${activeStep.status}`
211
- : `Readiness-check draft run: ${job.status}`);
219
+ : `Draft readiness checks run: ${job.status}`);
212
220
  },
213
221
  });
214
222
  const drafted = serviceRun
@@ -216,50 +224,30 @@ async function promptDraftReadinessChecks(options) {
216
224
  checks: serviceRun.result?.checks ?? null,
217
225
  error: serviceRun.error,
218
226
  }
219
- : await (async () => {
220
- const resolved = await resolveOrConfigureLocalExecutor({
221
- preflight: true,
222
- purpose: "draft",
223
- });
224
- if (!resolved.executor) {
225
- if (resolved.cancelled)
226
- return null;
227
- p.log.error(resolved.error ?? "No local agent detected for readiness-check drafting.");
228
- const manualChoice = await p.select({
229
- message: "How do you want to continue?",
230
- options: [
231
- {
232
- value: "manual",
233
- label: "Add readiness checks manually",
234
- hint: "Write the checks and expected answers yourself",
235
- },
236
- {
237
- value: "skip",
238
- label: "Skip for now",
239
- hint: "Save this Preparation without readiness checks",
240
- },
241
- ],
242
- });
243
- if (p.isCancel(manualChoice))
244
- return null;
245
- return manualChoice === "manual"
246
- ? "manual"
247
- : "skip";
248
- }
249
- return draftReadinessChecks({
250
- preparationName: options.preparationName,
251
- sourceFolderPath: resolvedSourceFolderPath,
252
- about: options.about,
253
- executor: resolved.executor,
254
- targetCount: 4,
255
- });
256
- })();
227
+ : "service-missing";
257
228
  if (drafted === null)
258
229
  return null;
259
- if (drafted === "manual")
260
- return "manual";
261
- if (drafted === "skip")
262
- return [];
230
+ if (drafted === "service-missing") {
231
+ p.log.error("Interf local service is not running. Start `interf web` to create visible runs for drafting readiness checks.");
232
+ const manualChoice = await p.select({
233
+ message: "How do you want to continue?",
234
+ options: [
235
+ {
236
+ value: "manual",
237
+ label: "Add readiness checks manually",
238
+ hint: "Write the checks and expected answers yourself",
239
+ },
240
+ {
241
+ value: "skip",
242
+ label: "Skip for now",
243
+ hint: "Save this Preparation without readiness checks",
244
+ },
245
+ ],
246
+ });
247
+ if (p.isCancel(manualChoice))
248
+ return null;
249
+ return manualChoice === "manual" ? "manual" : [];
250
+ }
263
251
  if (!drafted.checks) {
264
252
  p.log.error(drafted.error ?? "Could not draft readiness checks from this Source Folder.");
265
253
  const retryMode = await p.select({
@@ -612,9 +600,10 @@ export async function promptSingleCompiledConfig(options = {}) {
612
600
  }
613
601
  if (!name) {
614
602
  const suggestedName = defaultPreparationNameForPath(normalizedSourceFolderPath);
603
+ const nameField = createPreparationActionField("name");
615
604
  const rawName = await p.text({
616
- message: "Preparation name?",
617
- placeholder: suggestedName,
605
+ message: nameField.label,
606
+ placeholder: nameField.placeholder ?? suggestedName,
618
607
  initialValue: suggestedName,
619
608
  validate: (value) => (value.trim().length === 0 ? "Preparation name is required" : undefined),
620
609
  });
@@ -634,9 +623,10 @@ export async function promptSingleCompiledConfig(options = {}) {
634
623
  ...(typeof initial?.max_loops === "number" ? { max_loops: initial.max_loops } : {}),
635
624
  };
636
625
  if (!(options.skipAboutPrompt && initial?.about)) {
626
+ const aboutField = createPreparationActionField("about");
637
627
  const aboutInput = await p.text({
638
628
  message: preparationAboutPromptMessage(introStyle),
639
- placeholder: DEFAULT_COMPILED_ABOUT_PLACEHOLDER,
629
+ placeholder: aboutField.placeholder,
640
630
  initialValue: about ?? "",
641
631
  });
642
632
  if (p.isCancel(aboutInput))