@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.
- package/CHANGELOG.md +93 -0
- package/README.md +2 -1
- package/agent-skills/interf-actions/SKILL.md +17 -11
- package/agent-skills/interf-actions/references/cli.md +8 -22
- package/dist/cli/commands/action-input-cli.d.ts +25 -0
- package/dist/cli/commands/action-input-cli.js +73 -0
- package/dist/cli/commands/compile.d.ts +3 -8
- package/dist/cli/commands/compile.js +13 -41
- package/dist/cli/commands/create-method-wizard.d.ts +0 -12
- package/dist/cli/commands/create-method-wizard.js +95 -126
- package/dist/cli/commands/create.d.ts +0 -2
- package/dist/cli/commands/create.js +16 -22
- package/dist/cli/commands/doctor.js +1 -1
- package/dist/cli/commands/executor-flow.js +1 -1
- package/dist/cli/commands/init.d.ts +16 -1
- package/dist/cli/commands/init.js +40 -53
- package/dist/cli/commands/list.js +1 -1
- package/dist/cli/commands/preparation-action.d.ts +8 -0
- package/dist/cli/commands/preparation-action.js +29 -0
- package/dist/cli/commands/preparation-picker.d.ts +5 -0
- package/dist/cli/commands/preparation-picker.js +36 -0
- package/dist/cli/commands/preparation-selection.js +2 -2
- package/dist/cli/commands/reset.js +15 -4
- package/dist/cli/commands/service-action-flow.d.ts +9 -0
- package/dist/cli/commands/service-action-flow.js +19 -0
- package/dist/cli/commands/source-config-wizard.d.ts +0 -1
- package/dist/cli/commands/source-config-wizard.js +43 -53
- package/dist/cli/commands/status.js +7 -123
- package/dist/cli/commands/test.d.ts +1 -2
- package/dist/cli/commands/test.js +40 -203
- package/dist/cli/commands/web.js +8 -262
- package/dist/compiler-ui/404.html +1 -1
- package/dist/compiler-ui/__next.__PAGE__.txt +2 -2
- package/dist/compiler-ui/__next._full.txt +3 -3
- package/dist/compiler-ui/__next._head.txt +1 -1
- package/dist/compiler-ui/__next._index.txt +2 -2
- package/dist/compiler-ui/__next._tree.txt +2 -2
- package/dist/compiler-ui/_next/static/chunks/177mvn4rse235.js +89 -0
- package/dist/compiler-ui/_next/static/chunks/18a8f2jkv3z.c.css +3 -0
- package/dist/compiler-ui/_not-found/__next._full.txt +2 -2
- package/dist/compiler-ui/_not-found/__next._head.txt +1 -1
- package/dist/compiler-ui/_not-found/__next._index.txt +2 -2
- package/dist/compiler-ui/_not-found/__next._not-found.__PAGE__.txt +1 -1
- package/dist/compiler-ui/_not-found/__next._not-found.txt +1 -1
- package/dist/compiler-ui/_not-found/__next._tree.txt +2 -2
- package/dist/compiler-ui/_not-found.html +1 -1
- package/dist/compiler-ui/_not-found.txt +2 -2
- package/dist/compiler-ui/index.html +1 -1
- package/dist/compiler-ui/index.txt +3 -3
- package/dist/index.d.ts +0 -23
- package/dist/index.js +0 -16
- package/dist/packages/agents/lib/shells.js +2 -2
- package/dist/packages/compiler/lib/schema.d.ts +1 -1
- package/dist/packages/compiler/lib/schema.js +1 -1
- package/dist/packages/contracts/lib/schema.d.ts +0 -1
- package/dist/packages/contracts/lib/schema.js +0 -1
- package/dist/packages/execution/lib/schema.d.ts +0 -7
- package/dist/packages/execution/lib/schema.js +0 -1
- package/dist/packages/local-service/action-definitions.d.ts +246 -0
- package/dist/packages/local-service/action-definitions.js +1148 -0
- package/dist/packages/local-service/action-planner.d.ts +9 -0
- package/dist/packages/local-service/action-planner.js +134 -0
- package/dist/packages/local-service/action-values.d.ts +1 -22
- package/dist/packages/local-service/action-values.js +1 -30
- package/dist/packages/local-service/client.d.ts +48 -17
- package/dist/packages/local-service/client.js +95 -52
- package/dist/packages/local-service/index.d.ts +8 -5
- package/dist/packages/local-service/index.js +5 -3
- package/dist/packages/local-service/lib/schema.d.ts +302 -292
- package/dist/packages/local-service/lib/schema.js +115 -39
- package/dist/packages/local-service/native-run-handlers.d.ts +23 -0
- package/dist/{cli/commands/compile-controller.js → packages/local-service/native-run-handlers.js} +203 -19
- package/dist/{cli/commands/check-draft.d.ts → packages/local-service/readiness-check-draft.d.ts} +2 -2
- package/dist/packages/local-service/routes.d.ts +6 -1
- package/dist/packages/local-service/routes.js +7 -2
- package/dist/packages/local-service/run-observability.js +15 -17
- package/dist/packages/local-service/runtime.d.ts +10 -7
- package/dist/packages/local-service/runtime.js +430 -286
- package/dist/packages/local-service/server.js +94 -44
- package/dist/packages/method-package/method-review-paths.d.ts +1 -1
- package/dist/packages/method-package/method-review-paths.js +5 -5
- package/dist/packages/project-model/index.d.ts +1 -0
- package/dist/packages/project-model/index.js +1 -0
- package/dist/packages/project-model/preparation-entries.d.ts +11 -0
- package/dist/packages/project-model/preparation-entries.js +49 -0
- package/dist/packages/project-model/source-config.d.ts +1 -0
- package/dist/packages/project-model/source-config.js +12 -1
- package/dist/packages/testing/lib/schema.d.ts +2 -3
- package/dist/packages/testing/lib/schema.js +2 -3
- package/dist/packages/testing/readiness-check-run.d.ts +3 -3
- package/dist/packages/testing/readiness-check-run.js +12 -17
- package/package.json +5 -24
- package/dist/cli/commands/compile-controller.d.ts +0 -17
- package/dist/cli/commands/compiled-flow.d.ts +0 -25
- package/dist/cli/commands/compiled-flow.js +0 -112
- package/dist/cli/commands/test-flow.d.ts +0 -58
- package/dist/cli/commands/test-flow.js +0 -231
- package/dist/compiler-ui/_next/static/chunks/0c9mu7yldxyyg.css +0 -3
- package/dist/compiler-ui/_next/static/chunks/15mks7ry_cupt.js +0 -118
- /package/dist/compiler-ui/_next/static/{pIZnDsV3Je6hdC3cOsGdK → 84FaeF3EzBF9kKTMjSEVN}/_buildManifest.js +0 -0
- /package/dist/compiler-ui/_next/static/{pIZnDsV3Je6hdC3cOsGdK → 84FaeF3EzBF9kKTMjSEVN}/_clientMiddlewareManifest.js +0 -0
- /package/dist/compiler-ui/_next/static/{pIZnDsV3Je6hdC3cOsGdK → 84FaeF3EzBF9kKTMjSEVN}/_ssgManifest.js +0 -0
- /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 {
|
|
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 {
|
|
12
|
-
import {
|
|
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
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
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(
|
|
327
|
-
return
|
|
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
|
|
344
|
-
task_prompt: taskPrompt
|
|
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
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
:
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
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
|
|
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: "
|
|
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
|
-
|
|
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
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
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
|
-
|
|
464
|
-
|
|
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,
|
|
4
|
-
import {
|
|
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 {
|
|
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 {
|
|
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
|
-
|
|
79
|
-
|
|
77
|
+
await savePreparationThroughServiceAction({
|
|
78
|
+
sourcePath,
|
|
79
|
+
preparation: nextConfig,
|
|
80
|
+
setupMode: "select-method",
|
|
80
81
|
});
|
|
81
|
-
const builtCompiledPath =
|
|
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) =>
|
|
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(
|
|
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
|
-
|
|
184
|
-
|
|
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
|
|
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");
|
|
@@ -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 {};
|