@interf/compiler 0.9.1 → 0.9.3
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/README.md +9 -9
- package/agent-skills/interf-actions/SKILL.md +3 -0
- package/agent-skills/interf-actions/references/cli.md +13 -13
- package/{builtin-workflows/interf → builtin-methods/interf-default}/README.md +2 -2
- package/builtin-methods/interf-default/improve/SKILL.md +18 -0
- package/{builtin-workflows/interf/workflow.json → builtin-methods/interf-default/method.json} +4 -4
- package/{builtin-workflows/interf/workflow.schema.json → builtin-methods/interf-default/method.schema.json} +2 -2
- package/dist/cli/commands/check-draft.d.ts +6 -6
- package/dist/cli/commands/check-draft.js +5 -5
- package/dist/cli/commands/compile-controller.d.ts +7 -7
- package/dist/cli/commands/compile-controller.js +35 -38
- package/dist/cli/commands/compile.d.ts +3 -3
- package/dist/cli/commands/compile.js +23 -21
- package/dist/cli/commands/compiled-flow.d.ts +11 -11
- package/dist/cli/commands/compiled-flow.js +33 -30
- package/dist/cli/commands/create-method-wizard.d.ts +76 -0
- package/dist/cli/commands/{create-workflow-wizard.js → create-method-wizard.js} +153 -163
- package/dist/cli/commands/create.d.ts +3 -3
- package/dist/cli/commands/create.js +44 -45
- package/dist/cli/commands/default.js +1 -1
- package/dist/cli/commands/executor-flow.d.ts +6 -6
- package/dist/cli/commands/executor-flow.js +1 -1
- package/dist/cli/commands/init.d.ts +2 -2
- package/dist/cli/commands/init.js +139 -118
- package/dist/cli/commands/list.js +11 -10
- package/dist/cli/commands/preparation-selection.d.ts +3 -3
- package/dist/cli/commands/source-config-wizard.d.ts +9 -9
- package/dist/cli/commands/source-config-wizard.js +43 -43
- package/dist/cli/commands/status.js +36 -9
- package/dist/cli/commands/test-flow.d.ts +15 -15
- package/dist/cli/commands/test-flow.js +29 -219
- package/dist/cli/commands/test.d.ts +2 -2
- package/dist/cli/commands/test.js +50 -51
- package/dist/cli/commands/verify.js +7 -7
- package/dist/cli/commands/web.js +41 -28
- package/dist/compiler-ui/404.html +1 -0
- package/dist/compiler-ui/__next.__PAGE__.txt +10 -0
- package/dist/compiler-ui/__next._full.txt +20 -0
- package/dist/compiler-ui/__next._head.txt +5 -0
- package/dist/compiler-ui/__next._index.txt +5 -0
- package/dist/compiler-ui/__next._tree.txt +5 -0
- package/dist/compiler-ui/_next/static/chunks/06yhdspx~ca5-.js +5 -0
- package/{apps/compiler-ui/.next/static/chunks/13g~4mamjft.c.css → dist/compiler-ui/_next/static/chunks/0c9mu7yldxyyg.css} +1 -1
- package/{apps/compiler-ui/.next/static/chunks/0fgt_8knmicoz.js → dist/compiler-ui/_next/static/chunks/15mks7ry_cupt.js} +15 -21
- package/{apps/compiler-ui/.next/static/chunks/turbopack-109rtik40vwh5.js → dist/compiler-ui/_next/static/chunks/turbopack-0.uq1k8c0j4s..js} +1 -1
- package/dist/compiler-ui/_not-found/__next._full.txt +15 -0
- package/dist/compiler-ui/_not-found/__next._head.txt +5 -0
- package/dist/compiler-ui/_not-found/__next._index.txt +5 -0
- package/dist/compiler-ui/_not-found/__next._not-found.__PAGE__.txt +5 -0
- package/dist/compiler-ui/_not-found/__next._not-found.txt +5 -0
- package/dist/compiler-ui/_not-found/__next._tree.txt +2 -0
- package/dist/compiler-ui/_not-found.html +1 -0
- package/dist/compiler-ui/_not-found.txt +15 -0
- package/{apps/compiler-ui/.next/server/app → dist/compiler-ui}/index.html +1 -1
- package/dist/compiler-ui/index.txt +20 -0
- package/dist/index.d.ts +8 -6
- package/dist/index.js +5 -3
- package/dist/packages/agents/index.d.ts +1 -1
- package/dist/packages/agents/lib/args.d.ts +2 -2
- package/dist/packages/agents/lib/compiled-bootstrap.js +7 -6
- package/dist/packages/agents/lib/execution-profile.d.ts +5 -5
- package/dist/packages/agents/lib/execution-profile.js +7 -6
- package/dist/packages/agents/lib/executors.d.ts +13 -13
- package/dist/packages/agents/lib/preflight.d.ts +1 -0
- package/dist/packages/agents/lib/preflight.js +32 -9
- package/dist/packages/agents/lib/shells.d.ts +25 -24
- package/dist/packages/agents/lib/shells.js +161 -154
- package/dist/packages/agents/lib/types.d.ts +2 -2
- package/dist/packages/compiler/artifact-counts.d.ts +1 -0
- package/dist/packages/compiler/artifact-counts.js +30 -0
- package/dist/packages/compiler/compiled-paths.d.ts +4 -7
- package/dist/packages/compiler/compiled-paths.js +9 -15
- package/dist/packages/compiler/compiled-pipeline.d.ts +11 -12
- package/dist/packages/compiler/compiled-pipeline.js +22 -22
- package/dist/packages/compiler/compiled-schema.d.ts +20 -20
- package/dist/packages/compiler/compiled-schema.js +29 -29
- package/dist/packages/compiler/compiled-stage-plan.d.ts +4 -4
- package/dist/packages/compiler/compiled-stage-plan.js +8 -8
- package/dist/packages/compiler/compiled-stage-runner.d.ts +5 -5
- package/dist/packages/compiler/compiled-stage-runner.js +7 -7
- package/dist/packages/compiler/compiled-target.d.ts +5 -5
- package/dist/packages/compiler/compiled-target.js +5 -5
- package/dist/packages/compiler/index.d.ts +3 -3
- package/dist/packages/compiler/index.js +2 -2
- package/dist/packages/compiler/lib/schema.d.ts +62 -247
- package/dist/packages/compiler/lib/schema.js +56 -174
- package/dist/packages/compiler/{workflows.d.ts → method-runs.d.ts} +4 -4
- package/dist/packages/compiler/{workflows.js → method-runs.js} +4 -3
- package/dist/packages/compiler/raw-snapshot.d.ts +0 -7
- package/dist/packages/compiler/raw-snapshot.js +0 -1
- package/dist/packages/compiler/reset.js +3 -3
- package/dist/packages/compiler/runtime-acceptance.js +9 -16
- package/dist/packages/compiler/runtime-contracts.js +9 -9
- package/dist/packages/compiler/runtime-prompt.js +4 -4
- package/dist/packages/compiler/runtime-reconcile.d.ts +2 -2
- package/dist/packages/compiler/runtime-reconcile.js +3 -3
- package/dist/packages/compiler/runtime-runs.js +9 -9
- package/dist/packages/compiler/runtime-types.d.ts +8 -7
- package/dist/packages/compiler/state-health.js +26 -35
- package/dist/packages/compiler/state-view.js +6 -6
- package/dist/packages/compiler/validate-compiled.d.ts +5 -5
- package/dist/packages/compiler/validate-compiled.js +56 -64
- package/dist/packages/compiler/validate.d.ts +2 -2
- package/dist/packages/compiler/validate.js +22 -14
- package/dist/packages/contracts/index.d.ts +2 -0
- package/dist/packages/contracts/index.js +1 -0
- package/dist/packages/contracts/lib/schema.d.ts +205 -0
- package/dist/packages/contracts/lib/schema.js +101 -0
- package/dist/packages/execution/index.d.ts +2 -2
- package/dist/packages/execution/index.js +1 -1
- package/dist/packages/execution/lib/schema.d.ts +80 -83
- package/dist/packages/execution/lib/schema.js +25 -48
- package/dist/packages/local-service/action-values.d.ts +0 -1
- package/dist/packages/local-service/action-values.js +0 -1
- package/dist/packages/local-service/client.d.ts +4 -4
- package/dist/packages/local-service/client.js +4 -4
- package/dist/packages/local-service/index.d.ts +3 -3
- package/dist/packages/local-service/index.js +2 -2
- package/dist/packages/local-service/lib/schema.d.ts +536 -974
- package/dist/packages/local-service/lib/schema.js +43 -160
- package/dist/packages/local-service/run-observability.d.ts +6 -0
- package/dist/packages/local-service/run-observability.js +592 -0
- package/dist/packages/local-service/runtime.d.ts +19 -23
- package/dist/packages/local-service/runtime.js +302 -880
- package/dist/packages/local-service/server.d.ts +1 -0
- package/dist/packages/local-service/server.js +25 -20
- package/dist/packages/method-authoring/index.d.ts +4 -0
- package/dist/packages/method-authoring/index.js +4 -0
- package/dist/packages/{workflow-authoring/lib/workflow-edit-utils.d.ts → method-authoring/lib/method-edit-utils.d.ts} +3 -3
- package/dist/packages/method-authoring/method-authoring.d.ts +24 -0
- package/dist/packages/method-authoring/method-authoring.js +116 -0
- package/dist/packages/method-authoring/method-edit-session.d.ts +18 -0
- package/dist/packages/method-authoring/method-edit-session.js +125 -0
- package/dist/packages/method-authoring/method-improvement.d.ts +23 -0
- package/dist/packages/{workflow-authoring/workflow-improvement.js → method-authoring/method-improvement.js} +63 -63
- package/dist/packages/{workflow-package/builtin-compiled-workflow.d.ts → method-package/builtin-compiled-method.d.ts} +1 -1
- package/dist/packages/{workflow-package/builtin-compiled-workflow.js → method-package/builtin-compiled-method.js} +17 -17
- package/dist/packages/{workflow-package → method-package}/context-interface.d.ts +12 -12
- package/dist/packages/{workflow-package → method-package}/context-interface.js +19 -19
- package/dist/packages/method-package/index.d.ts +11 -0
- package/dist/packages/method-package/index.js +11 -0
- package/dist/packages/method-package/interf-method-package.d.ts +31 -0
- package/dist/packages/{workflow-package/interf-workflow-package.js → method-package/interf-method-package.js} +145 -145
- package/dist/packages/{workflow-package → method-package}/lib/package-root.js +1 -1
- package/dist/packages/method-package/local-methods.d.ts +64 -0
- package/dist/packages/method-package/local-methods.js +466 -0
- package/dist/packages/method-package/method-definitions.d.ts +83 -0
- package/dist/packages/method-package/method-definitions.js +205 -0
- package/dist/packages/{workflow-package/workflow-helpers.d.ts → method-package/method-helpers.d.ts} +10 -10
- package/dist/packages/{workflow-package/workflow-helpers.js → method-package/method-helpers.js} +22 -26
- package/dist/packages/method-package/method-review-paths.d.ts +10 -0
- package/dist/packages/{workflow-package/workflow-review-paths.js → method-package/method-review-paths.js} +4 -4
- package/dist/packages/{workflow-package/workflow-stage-runner.d.ts → method-package/method-stage-runner.d.ts} +12 -11
- package/dist/packages/{workflow-package/workflow-stage-runner.js → method-package/method-stage-runner.js} +6 -6
- package/dist/packages/methods/index.d.ts +2 -0
- package/dist/packages/methods/index.js +2 -0
- package/dist/packages/methods/method-resolution.d.ts +6 -0
- package/dist/packages/methods/method-resolution.js +7 -0
- package/dist/packages/project-model/index.d.ts +1 -4
- package/dist/packages/project-model/index.js +0 -3
- package/dist/packages/project-model/interf-detect.d.ts +1 -5
- package/dist/packages/project-model/interf-detect.js +7 -18
- package/dist/packages/project-model/interf-scaffold.d.ts +2 -2
- package/dist/packages/project-model/interf-scaffold.js +38 -39
- package/dist/packages/project-model/interf.d.ts +1 -2
- package/dist/packages/project-model/interf.js +1 -2
- package/dist/packages/project-model/lib/schema.d.ts +2 -66
- package/dist/packages/project-model/lib/schema.js +5 -23
- package/dist/packages/project-model/project-paths.d.ts +9 -10
- package/dist/packages/project-model/project-paths.js +14 -17
- package/dist/packages/project-model/source-config.d.ts +11 -18
- package/dist/packages/project-model/source-config.js +42 -60
- package/dist/packages/project-model/source-folders.d.ts +4 -4
- package/dist/packages/project-model/source-folders.js +10 -10
- package/dist/packages/testing/index.d.ts +2 -2
- package/dist/packages/testing/index.js +1 -1
- package/dist/packages/testing/lib/schema.d.ts +11 -11
- package/dist/packages/testing/lib/schema.js +8 -9
- package/dist/packages/testing/readiness-check-run.d.ts +67 -0
- package/dist/packages/testing/readiness-check-run.js +258 -0
- package/dist/packages/testing/test-execution.d.ts +3 -3
- package/dist/packages/testing/test-execution.js +5 -5
- package/dist/packages/testing/test-paths.js +6 -6
- package/dist/packages/testing/test-profile-presets.js +2 -2
- package/dist/packages/testing/test-sandbox.js +10 -11
- package/dist/packages/testing/test-targets.d.ts +1 -1
- package/dist/packages/testing/test-targets.js +8 -7
- package/dist/packages/testing/test-types.d.ts +1 -1
- package/package.json +16 -33
- package/apps/compiler-ui/.next/static/chunks/0ti_66mx7~w2-.js +0 -5
- package/builtin-workflows/interf/improve/SKILL.md +0 -18
- package/dist/cli/commands/create-workflow-wizard.d.ts +0 -76
- package/dist/packages/project-model/compiled-paths.d.ts +0 -1
- package/dist/packages/project-model/compiled-paths.js +0 -1
- package/dist/packages/project-model/compiled-raw.d.ts +0 -1
- package/dist/packages/project-model/compiled-raw.js +0 -1
- package/dist/packages/project-model/compiled-reset.d.ts +0 -1
- package/dist/packages/project-model/compiled-reset.js +0 -1
- package/dist/packages/shared/index.d.ts +0 -7
- package/dist/packages/shared/index.js +0 -7
- package/dist/packages/shared/util.d.ts +0 -3
- package/dist/packages/shared/util.js +0 -3
- package/dist/packages/testing/test-matrices.d.ts +0 -90
- package/dist/packages/testing/test-matrices.js +0 -96
- package/dist/packages/workflow-authoring/index.d.ts +0 -4
- package/dist/packages/workflow-authoring/index.js +0 -4
- package/dist/packages/workflow-authoring/workflow-authoring.d.ts +0 -24
- package/dist/packages/workflow-authoring/workflow-authoring.js +0 -82
- package/dist/packages/workflow-authoring/workflow-edit-session.d.ts +0 -18
- package/dist/packages/workflow-authoring/workflow-edit-session.js +0 -91
- package/dist/packages/workflow-authoring/workflow-improvement.d.ts +0 -23
- package/dist/packages/workflow-package/index.d.ts +0 -11
- package/dist/packages/workflow-package/index.js +0 -11
- package/dist/packages/workflow-package/interf-workflow-package.d.ts +0 -31
- package/dist/packages/workflow-package/local-workflows.d.ts +0 -64
- package/dist/packages/workflow-package/local-workflows.js +0 -457
- package/dist/packages/workflow-package/workflow-definitions.d.ts +0 -82
- package/dist/packages/workflow-package/workflow-definitions.js +0 -211
- package/dist/packages/workflow-package/workflow-review-paths.d.ts +0 -10
- /package/{builtin-workflows/interf → builtin-methods/interf-default}/compile/stages/shape/SKILL.md +0 -0
- /package/{builtin-workflows/interf → builtin-methods/interf-default}/compile/stages/structure/SKILL.md +0 -0
- /package/{builtin-workflows/interf → builtin-methods/interf-default}/compile/stages/summarize/SKILL.md +0 -0
- /package/{builtin-workflows/interf → builtin-methods/interf-default}/use/query/SKILL.md +0 -0
- /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/chunks/03~yq9q893hmn.js +0 -0
- /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/chunks/06z~l3kwb891e.js +0 -0
- /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/chunks/08g7lvje.te.u.js +0 -0
- /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/chunks/08m7vf5asqlsm.js +0 -0
- /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/chunks/0_i-3_5l9t2qe.js +0 -0
- /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/chunks/0b-ywny_j0g~0.js +0 -0
- /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/chunks/0b52v41o1gixx.js +0 -0
- /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/chunks/0gpzgsv0w.q~m.js +0 -0
- /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/chunks/0ilwfezfvu6~-.js +0 -0
- /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/chunks/0n51hrfoufc7g.js +0 -0
- /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/chunks/0xxmf45eskdt~.css +0 -0
- /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/chunks/0y5z3t-z1c8ks.js.map +0 -0
- /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/chunks/14wtz~vq25~qq.js +0 -0
- /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/chunks/turbopack-10e~t1yzi4svj.js +0 -0
- /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/chunks/turbopack-worker-0sjn--fhq~1cg.js +0 -0
- /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/media/GeistMono_Variable.p.17jn9btb_52pq.woff2 +0 -0
- /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/media/Geist_Variable-s.p.0-te~ja_gpvcf.woff2 +0 -0
- /package/{apps/compiler-ui/.next → dist/compiler-ui/_next}/static/media/worker.102zas1s52_pf.js +0 -0
- /package/{apps/compiler-ui/.next/static/XWKL548yXD_UOG4ID9G3J → dist/compiler-ui/_next/static/pIZnDsV3Je6hdC3cOsGdK}/_buildManifest.js +0 -0
- /package/{apps/compiler-ui/.next/static/XWKL548yXD_UOG4ID9G3J → dist/compiler-ui/_next/static/pIZnDsV3Je6hdC3cOsGdK}/_clientMiddlewareManifest.js +0 -0
- /package/{apps/compiler-ui/.next/static/XWKL548yXD_UOG4ID9G3J → dist/compiler-ui/_next/static/pIZnDsV3Je6hdC3cOsGdK}/_ssgManifest.js +0 -0
- /package/dist/packages/compiler/{workflow-primitives.d.ts → method-primitives.d.ts} +0 -0
- /package/dist/packages/compiler/{workflow-primitives.js → method-primitives.js} +0 -0
- /package/dist/packages/{workflow-authoring/lib/workflow-edit-utils.js → method-authoring/lib/method-edit-utils.js} +0 -0
- /package/dist/packages/{workflow-package → method-package}/lib/package-root.d.ts +0 -0
- /package/dist/packages/{workflow-package/workflow-stage-policy.d.ts → method-package/method-stage-policy.d.ts} +0 -0
- /package/dist/packages/{workflow-package/workflow-stage-policy.js → method-package/method-stage-policy.js} +0 -0
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
2
|
import * as p from "@clack/prompts";
|
|
3
3
|
import { resolve } from "node:path";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { listCompiledMethodChoices, getCompiledMethod, } from "../../packages/method-package/method-definitions.js";
|
|
5
|
+
import { createLocalMethodPackageFromTemplate } from "../../packages/method-package/interf-method-package.js";
|
|
6
6
|
import { rmSync } from "node:fs";
|
|
7
|
-
import {
|
|
7
|
+
import { isMethodId, loadMethodDefinitionFromDir, seedLocalDefaultMethod, } from "../../packages/method-package/local-methods.js";
|
|
8
8
|
import { resolveOrConfigureLocalExecutor } from "./executor-flow.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { runMethodAuthoringDraft } from "../../packages/method-authoring/method-authoring.js";
|
|
10
|
+
import { listSourcePreparationConfigs, loadSourceFolderConfig, resolveSourcePreparationPath, } from "../../packages/project-model/source-config.js";
|
|
11
11
|
import { slugify } from "../../packages/shared/naming.js";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
export const
|
|
12
|
+
import { submitMethodAuthoringRunToLocalService } from "../../packages/local-service/index.js";
|
|
13
|
+
import { DEFAULT_SOURCE_FOLDER_PATH_PLACEHOLDER, listSourceFolderChoices, normalizeSourceFolderPathForConfig, } from "./source-config-wizard.js";
|
|
14
|
+
export const clackMethodPrompts = {
|
|
15
15
|
intro: p.intro,
|
|
16
16
|
select: (options) => p.select(options),
|
|
17
17
|
text: (options) => p.text(options),
|
|
@@ -21,38 +21,38 @@ export const clackWorkflowPrompts = {
|
|
|
21
21
|
error: p.log.error,
|
|
22
22
|
},
|
|
23
23
|
};
|
|
24
|
-
function
|
|
24
|
+
function normalizeMethodCreationMode(mode) {
|
|
25
25
|
if (mode === "draft")
|
|
26
26
|
return "draft-from-scratch";
|
|
27
27
|
if (mode === "manual")
|
|
28
28
|
return "fork-existing";
|
|
29
29
|
return mode;
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function findMatchingPreparationConfig(sourcePath, sourceFolderPath) {
|
|
32
32
|
const config = loadSourceFolderConfig(sourcePath);
|
|
33
|
-
for (const
|
|
34
|
-
if (
|
|
35
|
-
return
|
|
33
|
+
for (const preparation of listSourcePreparationConfigs(config)) {
|
|
34
|
+
if (resolveSourcePreparationPath(sourcePath, preparation) === sourceFolderPath) {
|
|
35
|
+
return preparation;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
return null;
|
|
39
39
|
}
|
|
40
|
-
function
|
|
41
|
-
return
|
|
42
|
-
? `${
|
|
43
|
-
: `${
|
|
40
|
+
function describeSavedPreparation(preparation) {
|
|
41
|
+
return preparation.about
|
|
42
|
+
? `${preparation.path} · ${preparation.about}`
|
|
43
|
+
: `${preparation.path} · ${preparation.checks.length} readiness check${preparation.checks.length === 1 ? "" : "s"}`;
|
|
44
44
|
}
|
|
45
|
-
async function
|
|
46
|
-
const
|
|
47
|
-
const folderChoices =
|
|
45
|
+
async function promptMethodSourceFolder(sourcePath, prompts) {
|
|
46
|
+
const savedPreparations = listSourcePreparationConfigs(loadSourceFolderConfig(sourcePath));
|
|
47
|
+
const folderChoices = listSourceFolderChoices(sourcePath);
|
|
48
48
|
if (folderChoices.length > 0) {
|
|
49
49
|
const selected = await prompts.select({
|
|
50
50
|
message: "Which Source Folder should shape this Method?",
|
|
51
51
|
options: [
|
|
52
|
-
...
|
|
53
|
-
value:
|
|
54
|
-
label:
|
|
55
|
-
hint:
|
|
52
|
+
...savedPreparations.map((preparation) => ({
|
|
53
|
+
value: preparation.name,
|
|
54
|
+
label: preparation.name,
|
|
55
|
+
hint: describeSavedPreparation(preparation),
|
|
56
56
|
})),
|
|
57
57
|
...folderChoices,
|
|
58
58
|
{
|
|
@@ -65,23 +65,23 @@ async function promptWorkflowDatasetFolder(sourcePath, prompts) {
|
|
|
65
65
|
if (prompts.isCancel(selected))
|
|
66
66
|
return selected;
|
|
67
67
|
if (selected !== "__manual__") {
|
|
68
|
-
const
|
|
69
|
-
if (
|
|
70
|
-
return
|
|
68
|
+
const savedPreparation = savedPreparations.find((preparation) => preparation.name === selected);
|
|
69
|
+
if (savedPreparation) {
|
|
70
|
+
return resolveSourcePreparationPath(sourcePath, savedPreparation);
|
|
71
71
|
}
|
|
72
|
-
return resolve(sourcePath,
|
|
72
|
+
return resolve(sourcePath, normalizeSourceFolderPathForConfig(sourcePath, String(selected)));
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
const
|
|
75
|
+
const sourceFolderPrompt = await prompts.text({
|
|
76
76
|
message: "Which Source Folder should shape this Method?",
|
|
77
|
-
placeholder:
|
|
77
|
+
placeholder: DEFAULT_SOURCE_FOLDER_PATH_PLACEHOLDER,
|
|
78
78
|
initialValue: folderChoices.length === 1 ? folderChoices[0]?.value : undefined,
|
|
79
79
|
validate: (value) => {
|
|
80
80
|
const trimmed = value.trim();
|
|
81
81
|
if (trimmed.length === 0)
|
|
82
82
|
return "Source Folder is required";
|
|
83
83
|
try {
|
|
84
|
-
|
|
84
|
+
normalizeSourceFolderPathForConfig(sourcePath, trimmed);
|
|
85
85
|
return undefined;
|
|
86
86
|
}
|
|
87
87
|
catch (error) {
|
|
@@ -89,34 +89,34 @@ async function promptWorkflowDatasetFolder(sourcePath, prompts) {
|
|
|
89
89
|
}
|
|
90
90
|
},
|
|
91
91
|
});
|
|
92
|
-
if (prompts.isCancel(
|
|
93
|
-
return
|
|
94
|
-
return resolve(sourcePath,
|
|
92
|
+
if (prompts.isCancel(sourceFolderPrompt))
|
|
93
|
+
return sourceFolderPrompt;
|
|
94
|
+
return resolve(sourcePath, normalizeSourceFolderPathForConfig(sourcePath, String(sourceFolderPrompt)));
|
|
95
95
|
}
|
|
96
|
-
export function
|
|
96
|
+
export function formatMethodLabel(method) {
|
|
97
97
|
return {
|
|
98
|
-
value:
|
|
99
|
-
label:
|
|
100
|
-
hint:
|
|
98
|
+
value: method.id,
|
|
99
|
+
label: method.scope === "local" ? `${method.label} (Local)` : method.label,
|
|
100
|
+
hint: method.hint,
|
|
101
101
|
};
|
|
102
102
|
}
|
|
103
|
-
export function
|
|
104
|
-
return
|
|
103
|
+
export function buildCompiledMethodOptions(sourcePath) {
|
|
104
|
+
return listCompiledMethodChoices(sourcePath).map(formatMethodLabel);
|
|
105
105
|
}
|
|
106
|
-
function
|
|
107
|
-
if (
|
|
106
|
+
function methodUseLabel(method) {
|
|
107
|
+
if (method.value === "interf-default") {
|
|
108
108
|
return "built-in Method";
|
|
109
109
|
}
|
|
110
|
-
return
|
|
110
|
+
return method.label.replace(/ \(Local\)$/, "");
|
|
111
111
|
}
|
|
112
|
-
function
|
|
113
|
-
return `Fork ${
|
|
112
|
+
function methodForkLabel(method) {
|
|
113
|
+
return `Fork ${methodUseLabel(method)}`;
|
|
114
114
|
}
|
|
115
|
-
export async function
|
|
116
|
-
const
|
|
117
|
-
const
|
|
118
|
-
const orderedOptions =
|
|
119
|
-
.map((option) => option.value ===
|
|
115
|
+
export async function chooseCompiledMethod(sourcePath, options = {}) {
|
|
116
|
+
const currentMethodId = options.currentMethodId;
|
|
117
|
+
const methodOptions = buildCompiledMethodOptions(sourcePath);
|
|
118
|
+
const orderedOptions = methodOptions
|
|
119
|
+
.map((option) => option.value === currentMethodId
|
|
120
120
|
? {
|
|
121
121
|
...option,
|
|
122
122
|
label: `${option.label} (Current)`,
|
|
@@ -124,36 +124,26 @@ export async function chooseCompiledWorkflow(sourcePath, options = {}) {
|
|
|
124
124
|
}
|
|
125
125
|
: option)
|
|
126
126
|
.sort((left, right) => {
|
|
127
|
-
if (left.value ===
|
|
127
|
+
if (left.value === currentMethodId)
|
|
128
128
|
return -1;
|
|
129
|
-
if (right.value ===
|
|
129
|
+
if (right.value === currentMethodId)
|
|
130
130
|
return 1;
|
|
131
131
|
return 0;
|
|
132
132
|
});
|
|
133
133
|
if (orderedOptions.length === 1) {
|
|
134
|
-
return orderedOptions[0]?.value ?? "interf";
|
|
134
|
+
return orderedOptions[0]?.value ?? "interf-default";
|
|
135
135
|
}
|
|
136
136
|
return p.select({
|
|
137
137
|
message: options.message ?? "Preparation Method?",
|
|
138
138
|
options: orderedOptions,
|
|
139
139
|
});
|
|
140
140
|
}
|
|
141
|
-
export async function
|
|
142
|
-
const
|
|
143
|
-
const
|
|
144
|
-
const
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
? {
|
|
148
|
-
value: "interf-default",
|
|
149
|
-
label: "built-in Method",
|
|
150
|
-
hint: "Use the built-in Method without drafting a custom package",
|
|
151
|
-
}
|
|
152
|
-
: undefined;
|
|
153
|
-
const currentWorkflow = workflowOptions.find((workflow) => workflow.value === currentWorkflowId) ??
|
|
154
|
-
workflowOptions.find((workflow) => workflow.value === "interf-default") ??
|
|
155
|
-
(currentWorkflowId === "interf-default" ? virtualDefaultWorkflow : undefined) ??
|
|
156
|
-
workflowOptions[0];
|
|
141
|
+
export async function chooseOrCreateCompiledMethodForPreparation(sourcePath, preparationConfig, options = {}, prompts = clackMethodPrompts) {
|
|
142
|
+
const currentMethodId = options.currentMethodId ?? preparationConfig.method ?? "interf-default";
|
|
143
|
+
const methodOptions = buildCompiledMethodOptions(sourcePath);
|
|
144
|
+
const currentMethod = methodOptions.find((method) => method.value === currentMethodId) ??
|
|
145
|
+
methodOptions.find((method) => method.value === "interf-default") ??
|
|
146
|
+
methodOptions[0];
|
|
157
147
|
const selected = await prompts.select({
|
|
158
148
|
message: "Which Method should Interf use for this Preparation?",
|
|
159
149
|
options: [
|
|
@@ -162,76 +152,76 @@ export async function chooseOrCreateCompiledWorkflowForDataset(sourcePath, datas
|
|
|
162
152
|
label: "Draft a new Method from scratch (Recommended)",
|
|
163
153
|
hint: "Start from a neutral scaffold; an agent designs stages, outputs, and proof for this Preparation",
|
|
164
154
|
},
|
|
165
|
-
...(
|
|
155
|
+
...(currentMethod
|
|
166
156
|
? [{
|
|
167
157
|
value: "__current__",
|
|
168
|
-
label: `Use ${
|
|
169
|
-
hint:
|
|
158
|
+
label: `Use ${methodUseLabel(currentMethod)}`,
|
|
159
|
+
hint: currentMethod.value === "interf-default"
|
|
170
160
|
? "Use the built-in Method without drafting a custom package"
|
|
171
|
-
:
|
|
161
|
+
: currentMethod.hint,
|
|
172
162
|
}]
|
|
173
163
|
: []),
|
|
174
|
-
...(
|
|
164
|
+
...(currentMethod
|
|
175
165
|
? [{
|
|
176
166
|
value: "__fork_existing__",
|
|
177
|
-
label:
|
|
167
|
+
label: methodForkLabel(currentMethod),
|
|
178
168
|
hint: "Copy its existing stage topology, then write the per-stage guidance yourself",
|
|
179
169
|
}]
|
|
180
170
|
: []),
|
|
181
|
-
...
|
|
182
|
-
.filter((
|
|
183
|
-
.map((
|
|
184
|
-
...
|
|
185
|
-
label: `Use ${
|
|
171
|
+
...methodOptions
|
|
172
|
+
.filter((method) => method.value !== currentMethod?.value)
|
|
173
|
+
.map((method) => ({
|
|
174
|
+
...method,
|
|
175
|
+
label: `Use ${methodUseLabel(method)}`,
|
|
186
176
|
})),
|
|
187
177
|
],
|
|
188
178
|
});
|
|
189
179
|
if (prompts.isCancel(selected))
|
|
190
180
|
return selected;
|
|
191
181
|
if (selected === "__current__") {
|
|
192
|
-
if (
|
|
193
|
-
|
|
182
|
+
if (currentMethod?.value === "interf-default") {
|
|
183
|
+
seedLocalDefaultMethod({ sourcePath });
|
|
194
184
|
}
|
|
195
|
-
return
|
|
185
|
+
return currentMethod?.value ?? currentMethodId;
|
|
196
186
|
}
|
|
197
187
|
if (selected === "__draft_from_scratch__" || selected === "__fork_existing__") {
|
|
198
|
-
if (selected === "__fork_existing__" &&
|
|
199
|
-
|
|
188
|
+
if (selected === "__fork_existing__" && currentMethod?.value === "interf-default") {
|
|
189
|
+
seedLocalDefaultMethod({ sourcePath });
|
|
200
190
|
}
|
|
201
|
-
const
|
|
191
|
+
const methodId = await createMethodWizard({
|
|
202
192
|
intro: false,
|
|
203
193
|
sourcePath,
|
|
204
|
-
|
|
205
|
-
?
|
|
194
|
+
baseMethodId: selected === "__fork_existing__"
|
|
195
|
+
? currentMethod?.value ?? currentMethodId
|
|
206
196
|
: undefined,
|
|
207
197
|
creationMode: selected === "__draft_from_scratch__" ? "draft-from-scratch" : "fork-existing",
|
|
208
198
|
executionProfile: options.executionProfile,
|
|
209
199
|
resolveExecutor: options.resolveExecutor,
|
|
210
200
|
runDraft: options.runDraft,
|
|
211
|
-
|
|
212
|
-
config:
|
|
213
|
-
|
|
201
|
+
preparationContext: {
|
|
202
|
+
config: preparationConfig,
|
|
203
|
+
sourceFolderPath: resolveSourcePreparationPath(sourcePath, preparationConfig),
|
|
214
204
|
},
|
|
215
205
|
}, prompts);
|
|
216
|
-
return
|
|
206
|
+
return methodId;
|
|
217
207
|
}
|
|
218
208
|
return String(selected);
|
|
219
209
|
}
|
|
220
|
-
export async function
|
|
210
|
+
export async function createMethodWizard(options = {}, prompts = clackMethodPrompts) {
|
|
221
211
|
if (options.intro !== false) {
|
|
222
212
|
prompts.intro(chalk.bold("Create a Method"));
|
|
223
213
|
}
|
|
224
214
|
const sourcePath = options.sourcePath ?? process.cwd();
|
|
225
|
-
return
|
|
215
|
+
return createCompiledMethodWizard(sourcePath, prompts, {
|
|
226
216
|
executionProfile: options.executionProfile,
|
|
227
|
-
|
|
217
|
+
baseMethodId: options.baseMethodId,
|
|
228
218
|
creationMode: options.creationMode,
|
|
229
|
-
|
|
219
|
+
preparationContext: options.preparationContext,
|
|
230
220
|
resolveExecutor: options.resolveExecutor,
|
|
231
221
|
runDraft: options.runDraft,
|
|
232
222
|
});
|
|
233
223
|
}
|
|
234
|
-
export async function
|
|
224
|
+
export async function createCompiledMethodWizard(sourcePath, prompts = clackMethodPrompts, options = {}) {
|
|
235
225
|
const creationMode = options.creationMode ?? await prompts.select({
|
|
236
226
|
message: "How do you want to create it?",
|
|
237
227
|
options: [
|
|
@@ -249,18 +239,18 @@ export async function createCompiledWorkflowWizard(sourcePath, prompts = clackWo
|
|
|
249
239
|
});
|
|
250
240
|
if (prompts.isCancel(creationMode))
|
|
251
241
|
return creationMode;
|
|
252
|
-
const creationModeValue =
|
|
253
|
-
const
|
|
254
|
-
? options.
|
|
242
|
+
const creationModeValue = normalizeMethodCreationMode(creationMode);
|
|
243
|
+
const baseMethod = creationModeValue === "fork-existing"
|
|
244
|
+
? options.baseMethodId ?? await prompts.select({
|
|
255
245
|
message: "Which existing Method should Interf fork?",
|
|
256
|
-
options:
|
|
246
|
+
options: listCompiledMethodChoices(sourcePath).map(formatMethodLabel),
|
|
257
247
|
})
|
|
258
248
|
: null;
|
|
259
|
-
if (prompts.isCancel(
|
|
260
|
-
return
|
|
261
|
-
const
|
|
262
|
-
const
|
|
263
|
-
?
|
|
249
|
+
if (prompts.isCancel(baseMethod))
|
|
250
|
+
return baseMethod;
|
|
251
|
+
const baseMethodId = typeof baseMethod === "string" ? baseMethod : null;
|
|
252
|
+
const resolvedBaseMethod = baseMethodId
|
|
253
|
+
? getCompiledMethod(baseMethodId, { sourcePath })
|
|
264
254
|
: null;
|
|
265
255
|
const rawName = await prompts.text({
|
|
266
256
|
message: "New Method name?",
|
|
@@ -268,10 +258,10 @@ export async function createCompiledWorkflowWizard(sourcePath, prompts = clackWo
|
|
|
268
258
|
validate: (value) => {
|
|
269
259
|
if (value.trim().length === 0)
|
|
270
260
|
return "Name is required";
|
|
271
|
-
const
|
|
272
|
-
if (!
|
|
261
|
+
const methodId = slugify(value);
|
|
262
|
+
if (!isMethodId(methodId))
|
|
273
263
|
return "Use letters, numbers, and dashes only";
|
|
274
|
-
if (
|
|
264
|
+
if (listCompiledMethodChoices(sourcePath).some((method) => method.id === methodId)) {
|
|
275
265
|
return "That Method name already exists";
|
|
276
266
|
}
|
|
277
267
|
return undefined;
|
|
@@ -279,7 +269,7 @@ export async function createCompiledWorkflowWizard(sourcePath, prompts = clackWo
|
|
|
279
269
|
});
|
|
280
270
|
if (prompts.isCancel(rawName))
|
|
281
271
|
return rawName;
|
|
282
|
-
const
|
|
272
|
+
const methodId = slugify(rawName);
|
|
283
273
|
const label = rawName.trim();
|
|
284
274
|
const hint = await prompts.text({
|
|
285
275
|
message: "One-line Method description?",
|
|
@@ -289,18 +279,18 @@ export async function createCompiledWorkflowWizard(sourcePath, prompts = clackWo
|
|
|
289
279
|
if (prompts.isCancel(hint))
|
|
290
280
|
return hint;
|
|
291
281
|
if (creationModeValue === "draft-from-scratch") {
|
|
292
|
-
let
|
|
293
|
-
let
|
|
294
|
-
if (!
|
|
295
|
-
const
|
|
296
|
-
if (
|
|
297
|
-
const
|
|
282
|
+
let sourceFolderPath = options.preparationContext?.sourceFolderPath ?? null;
|
|
283
|
+
let matchedPreparation = options.preparationContext?.config ?? null;
|
|
284
|
+
if (!sourceFolderPath) {
|
|
285
|
+
const savedPreparations = listSourcePreparationConfigs(loadSourceFolderConfig(sourcePath));
|
|
286
|
+
if (savedPreparations.length > 0) {
|
|
287
|
+
const preparationChoice = await prompts.select({
|
|
298
288
|
message: "Which saved Preparation should shape this Method?",
|
|
299
289
|
options: [
|
|
300
|
-
...
|
|
301
|
-
value:
|
|
302
|
-
label:
|
|
303
|
-
hint:
|
|
290
|
+
...savedPreparations.map((preparation) => ({
|
|
291
|
+
value: preparation.name,
|
|
292
|
+
label: preparation.name,
|
|
293
|
+
hint: describeSavedPreparation(preparation),
|
|
304
294
|
})),
|
|
305
295
|
{
|
|
306
296
|
value: "__manual__",
|
|
@@ -309,24 +299,24 @@ export async function createCompiledWorkflowWizard(sourcePath, prompts = clackWo
|
|
|
309
299
|
},
|
|
310
300
|
],
|
|
311
301
|
});
|
|
312
|
-
if (prompts.isCancel(
|
|
313
|
-
return
|
|
314
|
-
if (
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
?
|
|
302
|
+
if (prompts.isCancel(preparationChoice))
|
|
303
|
+
return preparationChoice;
|
|
304
|
+
if (preparationChoice !== "__manual__") {
|
|
305
|
+
matchedPreparation = savedPreparations.find((preparation) => preparation.name === preparationChoice) ?? null;
|
|
306
|
+
sourceFolderPath = matchedPreparation
|
|
307
|
+
? resolveSourcePreparationPath(sourcePath, matchedPreparation)
|
|
318
308
|
: null;
|
|
319
309
|
}
|
|
320
310
|
}
|
|
321
311
|
}
|
|
322
|
-
if (!
|
|
323
|
-
const
|
|
324
|
-
if (prompts.isCancel(
|
|
325
|
-
return
|
|
326
|
-
if (!
|
|
312
|
+
if (!sourceFolderPath) {
|
|
313
|
+
const sourceFolderPrompt = await promptMethodSourceFolder(sourcePath, prompts);
|
|
314
|
+
if (prompts.isCancel(sourceFolderPrompt))
|
|
315
|
+
return sourceFolderPrompt;
|
|
316
|
+
if (!sourceFolderPrompt)
|
|
327
317
|
return null;
|
|
328
|
-
|
|
329
|
-
|
|
318
|
+
sourceFolderPath = String(sourceFolderPrompt);
|
|
319
|
+
matchedPreparation = matchedPreparation ?? findMatchingPreparationConfig(sourcePath, sourceFolderPath);
|
|
330
320
|
}
|
|
331
321
|
const taskPrompt = await prompts.text({
|
|
332
322
|
message: "What should this Method prepare for agents, and what evidence should show the data is ready?",
|
|
@@ -335,24 +325,24 @@ export async function createCompiledWorkflowWizard(sourcePath, prompts = clackWo
|
|
|
335
325
|
});
|
|
336
326
|
if (prompts.isCancel(taskPrompt))
|
|
337
327
|
return taskPrompt;
|
|
338
|
-
if (
|
|
339
|
-
prompts.log.info(`Shaping this Method from Preparation "${
|
|
328
|
+
if (matchedPreparation) {
|
|
329
|
+
prompts.log.info(`Shaping this Method from Preparation "${matchedPreparation.name}".`);
|
|
340
330
|
}
|
|
341
|
-
if (
|
|
342
|
-
prompts.log.info(`Using ${
|
|
331
|
+
if (matchedPreparation?.checks.length) {
|
|
332
|
+
prompts.log.info(`Using ${matchedPreparation.checks.length} saved readiness check${matchedPreparation.checks.length === 1 ? "" : "s"} from Preparation "${matchedPreparation.name}" as authoring context.`);
|
|
343
333
|
}
|
|
344
334
|
prompts.log.info("Preparing a Method-authoring shell from the Source Folder, then drafting the package.");
|
|
345
335
|
let lastServiceStatus = "";
|
|
346
|
-
const serviceRun = await
|
|
336
|
+
const serviceRun = await submitMethodAuthoringRunToLocalService({
|
|
347
337
|
projectPath: sourcePath,
|
|
348
338
|
request: {
|
|
349
|
-
preparation:
|
|
350
|
-
source_folder_path:
|
|
351
|
-
method_id:
|
|
339
|
+
preparation: matchedPreparation?.name ?? null,
|
|
340
|
+
source_folder_path: sourceFolderPath,
|
|
341
|
+
method_id: methodId,
|
|
352
342
|
label,
|
|
353
343
|
hint: hint.trim(),
|
|
354
344
|
task_prompt: taskPrompt.trim(),
|
|
355
|
-
checks:
|
|
345
|
+
checks: matchedPreparation?.checks ?? [],
|
|
356
346
|
},
|
|
357
347
|
onSubmitted: (submission) => {
|
|
358
348
|
prompts.log.info(`Visible in Interf: ${submission.serviceUrl}/`);
|
|
@@ -377,7 +367,7 @@ export async function createCompiledWorkflowWizard(sourcePath, prompts = clackWo
|
|
|
377
367
|
changed: serviceRun.result.changed,
|
|
378
368
|
summary: serviceRun.result.summary,
|
|
379
369
|
validation: serviceRun.result.validation ?? null,
|
|
380
|
-
|
|
370
|
+
methodPath: serviceRun.result.method_path,
|
|
381
371
|
shellPath: serviceRun.result.shell_path,
|
|
382
372
|
}
|
|
383
373
|
: {
|
|
@@ -385,15 +375,15 @@ export async function createCompiledWorkflowWizard(sourcePath, prompts = clackWo
|
|
|
385
375
|
changed: false,
|
|
386
376
|
summary: serviceRun.error ?? "Method authoring failed in the local Interf service.",
|
|
387
377
|
validation: null,
|
|
388
|
-
|
|
389
|
-
shellPath: resolve(sourcePath, "interf", "methods",
|
|
378
|
+
methodPath: resolve(sourcePath, "interf", "methods", methodId),
|
|
379
|
+
shellPath: resolve(sourcePath, "interf", "methods", methodId),
|
|
390
380
|
}
|
|
391
381
|
: await (async () => {
|
|
392
382
|
const resolveExecutor = options.resolveExecutor ?? resolveOrConfigureLocalExecutor;
|
|
393
|
-
const runDraft = options.runDraft ??
|
|
383
|
+
const runDraft = options.runDraft ?? runMethodAuthoringDraft;
|
|
394
384
|
const { executor, error } = await resolveExecutor({
|
|
395
385
|
executionProfile: options.executionProfile,
|
|
396
|
-
purpose: "
|
|
386
|
+
purpose: "method",
|
|
397
387
|
});
|
|
398
388
|
if (!executor && !error) {
|
|
399
389
|
return null;
|
|
@@ -405,12 +395,12 @@ export async function createCompiledWorkflowWizard(sourcePath, prompts = clackWo
|
|
|
405
395
|
}
|
|
406
396
|
return runDraft({
|
|
407
397
|
sourcePath,
|
|
408
|
-
|
|
409
|
-
|
|
398
|
+
sourceFolderPath,
|
|
399
|
+
methodId,
|
|
410
400
|
label,
|
|
411
401
|
hint: hint.trim(),
|
|
412
402
|
taskPrompt: taskPrompt.trim(),
|
|
413
|
-
checks:
|
|
403
|
+
checks: matchedPreparation?.checks ?? [],
|
|
414
404
|
executor,
|
|
415
405
|
onStatus: (line) => prompts.log.info(line),
|
|
416
406
|
});
|
|
@@ -418,9 +408,9 @@ export async function createCompiledWorkflowWizard(sourcePath, prompts = clackWo
|
|
|
418
408
|
if (!result)
|
|
419
409
|
return null;
|
|
420
410
|
if (result.status === "updated") {
|
|
421
|
-
const draft =
|
|
411
|
+
const draft = loadMethodDefinitionFromDir(result.methodPath);
|
|
422
412
|
const stageList = draft?.stages?.map((stage) => stage.id).join(" -> ") ?? "-";
|
|
423
|
-
prompts.log.info(`Draft ready at ${result.
|
|
413
|
+
prompts.log.info(`Draft ready at ${result.methodPath}`);
|
|
424
414
|
prompts.log.info(` Name: ${draft?.label ?? label}`);
|
|
425
415
|
prompts.log.info(` Description: ${draft?.hint ?? hint.trim()}`);
|
|
426
416
|
if (draft?.purpose)
|
|
@@ -434,12 +424,12 @@ export async function createCompiledWorkflowWizard(sourcePath, prompts = clackWo
|
|
|
434
424
|
],
|
|
435
425
|
});
|
|
436
426
|
if (prompts.isCancel(confirmChoice) || confirmChoice === "cancel") {
|
|
437
|
-
rmSync(result.
|
|
438
|
-
prompts.log.info(`Discarded draft at ${result.
|
|
427
|
+
rmSync(result.methodPath, { recursive: true, force: true });
|
|
428
|
+
prompts.log.info(`Discarded draft at ${result.methodPath}`);
|
|
439
429
|
return null;
|
|
440
430
|
}
|
|
441
|
-
prompts.log.info(`Saved local Method: ${result.
|
|
442
|
-
return
|
|
431
|
+
prompts.log.info(`Saved local Method: ${result.methodPath}`);
|
|
432
|
+
return methodId;
|
|
443
433
|
}
|
|
444
434
|
process.exitCode = 1;
|
|
445
435
|
(prompts.log.error ?? prompts.log.info)(result.status === "no-change"
|
|
@@ -449,10 +439,10 @@ export async function createCompiledWorkflowWizard(sourcePath, prompts = clackWo
|
|
|
449
439
|
return null;
|
|
450
440
|
}
|
|
451
441
|
const stagePolicyNotes = {};
|
|
452
|
-
if (!
|
|
442
|
+
if (!baseMethodId || !resolvedBaseMethod) {
|
|
453
443
|
throw new Error("Fork-existing Method creation needs a base Method.");
|
|
454
444
|
}
|
|
455
|
-
for (const stage of
|
|
445
|
+
for (const stage of resolvedBaseMethod.stages) {
|
|
456
446
|
const stagePrompt = await prompts.text({
|
|
457
447
|
message: `What should ${stage.id} (${stage.label}) emphasize?`,
|
|
458
448
|
placeholder: stage.description,
|
|
@@ -462,14 +452,14 @@ export async function createCompiledWorkflowWizard(sourcePath, prompts = clackWo
|
|
|
462
452
|
return stagePrompt;
|
|
463
453
|
stagePolicyNotes[stage.id] = [String(stagePrompt).trim()];
|
|
464
454
|
}
|
|
465
|
-
const
|
|
455
|
+
const methodPath = createLocalMethodPackageFromTemplate({
|
|
466
456
|
sourcePath,
|
|
467
|
-
|
|
468
|
-
|
|
457
|
+
baseMethodId,
|
|
458
|
+
methodId,
|
|
469
459
|
label,
|
|
470
460
|
hint: hint.trim(),
|
|
471
461
|
stagePolicyNotes,
|
|
472
462
|
});
|
|
473
|
-
prompts.log.info(`Saved local Method: ${
|
|
474
|
-
return
|
|
463
|
+
prompts.log.info(`Saved local Method: ${methodPath}`);
|
|
464
|
+
return methodId;
|
|
475
465
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { CommandModule } from "yargs";
|
|
2
|
-
import type {
|
|
2
|
+
import type { MethodExecutionProfile } from "../../packages/agents/lib/executors.js";
|
|
3
3
|
export declare const createCommand: CommandModule;
|
|
4
4
|
export declare function createCompiledWizard(options?: {
|
|
5
5
|
intro?: boolean;
|
|
6
|
-
executionProfile?:
|
|
6
|
+
executionProfile?: MethodExecutionProfile;
|
|
7
7
|
}): Promise<void>;
|
|
8
|
-
export { type
|
|
8
|
+
export { type MethodWizardPrompts, formatMethodLabel, createMethodWizard, createCompiledMethodWizard, } from "./create-method-wizard.js";
|