@interf/compiler 0.7.3 → 0.9.1
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 +123 -89
- package/TRADEMARKS.md +1 -1
- package/agent-skills/interf-actions/SKILL.md +71 -0
- package/agent-skills/interf-actions/references/cli.md +190 -0
- package/apps/compiler-ui/.next/server/app/index.html +1 -0
- package/apps/compiler-ui/.next/static/XWKL548yXD_UOG4ID9G3J/_buildManifest.js +11 -0
- package/apps/compiler-ui/.next/static/XWKL548yXD_UOG4ID9G3J/_clientMiddlewareManifest.js +1 -0
- package/apps/compiler-ui/.next/static/XWKL548yXD_UOG4ID9G3J/_ssgManifest.js +1 -0
- package/apps/compiler-ui/.next/static/chunks/03~yq9q893hmn.js +1 -0
- package/apps/compiler-ui/.next/static/chunks/06z~l3kwb891e.js +1 -0
- package/apps/compiler-ui/.next/static/chunks/08g7lvje.te.u.js +1 -0
- package/apps/compiler-ui/.next/static/chunks/08m7vf5asqlsm.js +91 -0
- package/apps/compiler-ui/.next/static/chunks/0_i-3_5l9t2qe.js +1 -0
- package/apps/compiler-ui/.next/static/chunks/0b-ywny_j0g~0.js +1 -0
- package/apps/compiler-ui/.next/static/chunks/0b52v41o1gixx.js +1 -0
- package/apps/compiler-ui/.next/static/chunks/0fgt_8knmicoz.js +124 -0
- package/apps/compiler-ui/.next/static/chunks/0gpzgsv0w.q~m.js +31 -0
- package/apps/compiler-ui/.next/static/chunks/0ilwfezfvu6~-.js +1 -0
- package/apps/compiler-ui/.next/static/chunks/0n51hrfoufc7g.js +1 -0
- package/apps/compiler-ui/.next/static/chunks/0ti_66mx7~w2-.js +5 -0
- package/apps/compiler-ui/.next/static/chunks/0xxmf45eskdt~.css +1 -0
- package/apps/compiler-ui/.next/static/chunks/0y5z3t-z1c8ks.js.map +5 -0
- package/apps/compiler-ui/.next/static/chunks/13g~4mamjft.c.css +3 -0
- package/apps/compiler-ui/.next/static/chunks/14wtz~vq25~qq.js +1 -0
- package/apps/compiler-ui/.next/static/chunks/turbopack-109rtik40vwh5.js +1 -0
- package/apps/compiler-ui/.next/static/chunks/turbopack-10e~t1yzi4svj.js +1 -0
- package/apps/compiler-ui/.next/static/chunks/turbopack-worker-0sjn--fhq~1cg.js +1 -0
- package/apps/compiler-ui/.next/static/media/GeistMono_Variable.p.17jn9btb_52pq.woff2 +0 -0
- package/apps/compiler-ui/.next/static/media/Geist_Variable-s.p.0-te~ja_gpvcf.woff2 +0 -0
- package/apps/compiler-ui/.next/static/media/worker.102zas1s52_pf.js +109 -0
- package/builtin-workflows/interf/README.md +8 -8
- package/builtin-workflows/interf/compile/stages/shape/SKILL.md +4 -4
- package/builtin-workflows/interf/compile/stages/structure/SKILL.md +1 -1
- package/builtin-workflows/interf/improve/SKILL.md +1 -1
- package/builtin-workflows/interf/use/query/SKILL.md +1 -1
- package/builtin-workflows/interf/workflow.json +8 -8
- package/builtin-workflows/interf/workflow.schema.json +1 -1
- package/dist/cli/commands/check-draft.d.ts +5 -4
- package/dist/cli/commands/check-draft.js +18 -17
- package/dist/cli/commands/compile-controller.d.ts +3 -0
- package/dist/cli/commands/compile-controller.js +53 -45
- package/dist/cli/commands/compile.js +83 -27
- package/dist/cli/commands/compiled-flow.d.ts +3 -0
- package/dist/cli/commands/compiled-flow.js +9 -7
- package/dist/cli/commands/control-path.d.ts +11 -0
- package/dist/cli/commands/control-path.js +72 -0
- package/dist/cli/commands/create-workflow-wizard.d.ts +6 -0
- package/dist/cli/commands/create-workflow-wizard.js +191 -77
- package/dist/cli/commands/create.js +54 -40
- package/dist/cli/commands/default.js +4 -3
- package/dist/cli/commands/doctor.js +5 -5
- package/dist/cli/commands/executor-flow.js +1 -1
- package/dist/cli/commands/init.js +326 -76
- package/dist/cli/commands/list.js +8 -7
- package/dist/cli/commands/preparation-selection.d.ts +6 -0
- package/dist/cli/commands/preparation-selection.js +11 -0
- package/dist/cli/commands/reset.js +3 -3
- package/dist/cli/commands/source-config-wizard.d.ts +4 -3
- package/dist/cli/commands/source-config-wizard.js +175 -197
- package/dist/cli/commands/status.js +116 -8
- package/dist/cli/commands/test-flow.d.ts +1 -1
- package/dist/cli/commands/test-flow.js +31 -31
- package/dist/cli/commands/test.d.ts +4 -0
- package/dist/cli/commands/test.js +95 -58
- package/dist/cli/commands/verify.js +7 -7
- package/dist/cli/commands/web.d.ts +11 -0
- package/dist/cli/commands/web.js +373 -0
- package/dist/cli/index.d.ts +2 -1
- package/dist/cli/index.js +3 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +3 -1
- package/dist/packages/agents/lib/execution.js +4 -2
- package/dist/packages/agents/lib/executors.d.ts +1 -0
- package/dist/packages/agents/lib/executors.js +1 -0
- package/dist/packages/agents/lib/render.d.ts +2 -2
- package/dist/packages/agents/lib/render.js +10 -9
- package/dist/packages/agents/lib/shells.d.ts +3 -11
- package/dist/packages/agents/lib/shells.js +45 -96
- package/dist/packages/agents/lib/types.d.ts +1 -0
- package/dist/packages/compiler/compiled-paths.d.ts +4 -1
- package/dist/packages/compiler/compiled-paths.js +7 -1
- package/dist/packages/compiler/compiled-pipeline.d.ts +7 -0
- package/dist/packages/compiler/compiled-pipeline.js +15 -4
- package/dist/packages/compiler/compiled-schema.js +1 -1
- package/dist/packages/compiler/compiled-stage-plan.d.ts +2 -2
- package/dist/packages/compiler/compiled-stage-plan.js +4 -4
- package/dist/packages/compiler/compiled-stage-runner.d.ts +5 -0
- package/dist/packages/compiler/compiled-stage-runner.js +50 -2
- package/dist/packages/compiler/compiled-target.d.ts +1 -1
- package/dist/packages/compiler/compiled-target.js +2 -2
- package/dist/packages/compiler/lib/schema.d.ts +161 -1
- package/dist/packages/compiler/lib/schema.js +87 -1
- package/dist/packages/compiler/raw-snapshot.d.ts +9 -2
- package/dist/packages/compiler/runtime-acceptance.js +1 -1
- package/dist/packages/compiler/runtime-contracts.js +2 -2
- package/dist/packages/compiler/runtime-prompt.js +6 -6
- package/dist/packages/compiler/runtime-reconcile.js +3 -3
- package/dist/packages/compiler/runtime-runs.js +3 -0
- package/dist/packages/compiler/runtime-types.d.ts +1 -0
- package/dist/packages/compiler/state-health.js +1 -1
- package/dist/packages/compiler/state-view.js +2 -2
- package/dist/packages/compiler/validate-compiled.js +11 -9
- package/dist/packages/execution/adapters.d.ts +15 -0
- package/dist/packages/execution/adapters.js +1 -0
- package/dist/packages/execution/events.d.ts +8 -0
- package/dist/packages/execution/events.js +16 -0
- package/dist/packages/execution/index.d.ts +9 -0
- package/dist/packages/execution/index.js +6 -0
- package/dist/packages/execution/lib/schema.d.ts +1554 -0
- package/dist/packages/execution/lib/schema.js +319 -0
- package/dist/packages/local-service/action-values.d.ts +23 -0
- package/dist/packages/local-service/action-values.js +31 -0
- package/dist/packages/local-service/client.d.ts +119 -0
- package/dist/packages/local-service/client.js +356 -0
- package/dist/packages/local-service/index.d.ts +15 -0
- package/dist/packages/local-service/index.js +11 -0
- package/dist/packages/local-service/lib/schema.d.ts +7355 -0
- package/dist/packages/local-service/lib/schema.js +636 -0
- package/dist/packages/local-service/routes.d.ts +27 -0
- package/dist/packages/local-service/routes.js +32 -0
- package/dist/packages/local-service/runtime.d.ts +134 -0
- package/dist/packages/local-service/runtime.js +2841 -0
- package/dist/packages/local-service/server.d.ts +17 -0
- package/dist/packages/local-service/server.js +572 -0
- package/dist/packages/project-model/index.d.ts +2 -1
- package/dist/packages/project-model/index.js +1 -0
- package/dist/packages/project-model/interf-detect.d.ts +6 -2
- package/dist/packages/project-model/interf-detect.js +25 -10
- package/dist/packages/project-model/interf-scaffold.js +9 -6
- package/dist/packages/project-model/interf.d.ts +1 -1
- package/dist/packages/project-model/interf.js +1 -1
- package/dist/packages/project-model/lib/schema.d.ts +80 -6
- package/dist/packages/project-model/lib/schema.js +29 -19
- package/dist/packages/project-model/source-config.d.ts +22 -13
- package/dist/packages/project-model/source-config.js +140 -123
- package/dist/packages/project-model/source-folders.d.ts +11 -0
- package/dist/packages/project-model/source-folders.js +110 -0
- package/dist/packages/testing/test-execution.js +5 -5
- package/dist/packages/testing/test-paths.js +1 -3
- package/dist/packages/workflow-authoring/workflow-authoring.d.ts +4 -6
- package/dist/packages/workflow-authoring/workflow-authoring.js +45 -86
- package/dist/packages/workflow-authoring/workflow-edit-session.d.ts +2 -0
- package/dist/packages/workflow-authoring/workflow-edit-session.js +80 -49
- package/dist/packages/workflow-authoring/workflow-improvement.js +2 -1
- package/dist/packages/workflow-package/context-interface.js +1 -1
- package/dist/packages/workflow-package/interf-workflow-package.d.ts +6 -0
- package/dist/packages/workflow-package/interf-workflow-package.js +115 -8
- package/dist/packages/workflow-package/local-workflows.js +33 -17
- package/dist/packages/workflow-package/workflow-definitions.d.ts +5 -5
- package/dist/packages/workflow-package/workflow-definitions.js +23 -22
- package/dist/packages/workflow-package/workflow-helpers.js +10 -6
- package/dist/packages/workflow-package/workflow-stage-runner.d.ts +1 -0
- package/dist/packages/workflow-package/workflow-stage-runner.js +2 -0
- package/package.json +17 -1
- package/dist/cli/commands/dataset-selection.d.ts +0 -6
- package/dist/cli/commands/dataset-selection.js +0 -11
- package/dist/lib/agent-args.d.ts +0 -1
- package/dist/lib/agent-args.js +0 -1
- package/dist/lib/agent-constants.d.ts +0 -1
- package/dist/lib/agent-constants.js +0 -1
- package/dist/lib/agent-detection.d.ts +0 -1
- package/dist/lib/agent-detection.js +0 -1
- package/dist/lib/agent-execution.d.ts +0 -1
- package/dist/lib/agent-execution.js +0 -1
- package/dist/lib/agent-logs.d.ts +0 -1
- package/dist/lib/agent-logs.js +0 -1
- package/dist/lib/agent-preflight.d.ts +0 -1
- package/dist/lib/agent-preflight.js +0 -1
- package/dist/lib/agent-render.d.ts +0 -1
- package/dist/lib/agent-render.js +0 -1
- package/dist/lib/agent-shells.d.ts +0 -1
- package/dist/lib/agent-shells.js +0 -1
- package/dist/lib/agent-status.d.ts +0 -1
- package/dist/lib/agent-status.js +0 -1
- package/dist/lib/agent-types.d.ts +0 -1
- package/dist/lib/agent-types.js +0 -1
- package/dist/lib/agents.d.ts +0 -1
- package/dist/lib/agents.js +0 -1
- package/dist/lib/builtin-compiled-workflow.d.ts +0 -1
- package/dist/lib/builtin-compiled-workflow.js +0 -1
- package/dist/lib/chart-guidance.d.ts +0 -1
- package/dist/lib/chart-guidance.js +0 -1
- package/dist/lib/compiled-compile.d.ts +0 -1
- package/dist/lib/compiled-compile.js +0 -1
- package/dist/lib/compiled-paths.d.ts +0 -1
- package/dist/lib/compiled-paths.js +0 -3
- package/dist/lib/compiled-raw.d.ts +0 -1
- package/dist/lib/compiled-raw.js +0 -3
- package/dist/lib/compiled-reset.d.ts +0 -1
- package/dist/lib/compiled-reset.js +0 -3
- package/dist/lib/compiled-schema.d.ts +0 -1
- package/dist/lib/compiled-schema.js +0 -1
- package/dist/lib/discovery.d.ts +0 -1
- package/dist/lib/discovery.js +0 -1
- package/dist/lib/execution-profile.d.ts +0 -1
- package/dist/lib/execution-profile.js +0 -1
- package/dist/lib/executors.d.ts +0 -1
- package/dist/lib/executors.js +0 -1
- package/dist/lib/filesystem.d.ts +0 -1
- package/dist/lib/filesystem.js +0 -1
- package/dist/lib/interf-bootstrap.d.ts +0 -1
- package/dist/lib/interf-bootstrap.js +0 -3
- package/dist/lib/interf-detect.d.ts +0 -1
- package/dist/lib/interf-detect.js +0 -3
- package/dist/lib/interf-scaffold.d.ts +0 -1
- package/dist/lib/interf-scaffold.js +0 -3
- package/dist/lib/interf-workflow-package.d.ts +0 -1
- package/dist/lib/interf-workflow-package.js +0 -1
- package/dist/lib/interf.d.ts +0 -1
- package/dist/lib/interf.js +0 -3
- package/dist/lib/local-workflows.d.ts +0 -1
- package/dist/lib/local-workflows.js +0 -1
- package/dist/lib/logger.d.ts +0 -1
- package/dist/lib/logger.js +0 -1
- package/dist/lib/package-root.d.ts +0 -1
- package/dist/lib/package-root.js +0 -1
- package/dist/lib/parse.d.ts +0 -1
- package/dist/lib/parse.js +0 -1
- package/dist/lib/project-paths.d.ts +0 -1
- package/dist/lib/project-paths.js +0 -3
- package/dist/lib/runtime-acceptance.d.ts +0 -1
- package/dist/lib/runtime-acceptance.js +0 -1
- package/dist/lib/runtime-contracts.d.ts +0 -1
- package/dist/lib/runtime-contracts.js +0 -1
- package/dist/lib/runtime-inventory.d.ts +0 -1
- package/dist/lib/runtime-inventory.js +0 -1
- package/dist/lib/runtime-paths.d.ts +0 -1
- package/dist/lib/runtime-paths.js +0 -1
- package/dist/lib/runtime-prompt.d.ts +0 -1
- package/dist/lib/runtime-prompt.js +0 -1
- package/dist/lib/runtime-reconcile.d.ts +0 -1
- package/dist/lib/runtime-reconcile.js +0 -1
- package/dist/lib/runtime-runs.d.ts +0 -1
- package/dist/lib/runtime-runs.js +0 -1
- package/dist/lib/runtime-types.d.ts +0 -1
- package/dist/lib/runtime-types.js +0 -1
- package/dist/lib/runtime.d.ts +0 -1
- package/dist/lib/runtime.js +0 -1
- package/dist/lib/schema.d.ts +0 -4
- package/dist/lib/schema.js +0 -6
- package/dist/lib/source-config.d.ts +0 -1
- package/dist/lib/source-config.js +0 -3
- package/dist/lib/state-artifacts.d.ts +0 -1
- package/dist/lib/state-artifacts.js +0 -1
- package/dist/lib/state-health.d.ts +0 -1
- package/dist/lib/state-health.js +0 -1
- package/dist/lib/state-io.d.ts +0 -1
- package/dist/lib/state-io.js +0 -1
- package/dist/lib/state-paths.d.ts +0 -1
- package/dist/lib/state-paths.js +0 -1
- package/dist/lib/state-view.d.ts +0 -1
- package/dist/lib/state-view.js +0 -1
- package/dist/lib/state.d.ts +0 -1
- package/dist/lib/state.js +0 -1
- package/dist/lib/test-execution.d.ts +0 -1
- package/dist/lib/test-execution.js +0 -3
- package/dist/lib/test-matrices.d.ts +0 -1
- package/dist/lib/test-matrices.js +0 -3
- package/dist/lib/test-paths.d.ts +0 -1
- package/dist/lib/test-paths.js +0 -3
- package/dist/lib/test-profile-presets.d.ts +0 -1
- package/dist/lib/test-profile-presets.js +0 -3
- package/dist/lib/test-sandbox.d.ts +0 -1
- package/dist/lib/test-sandbox.js +0 -3
- package/dist/lib/test-specs.d.ts +0 -1
- package/dist/lib/test-specs.js +0 -3
- package/dist/lib/test-targets.d.ts +0 -1
- package/dist/lib/test-targets.js +0 -3
- package/dist/lib/test-types.d.ts +0 -1
- package/dist/lib/test-types.js +0 -3
- package/dist/lib/test.d.ts +0 -1
- package/dist/lib/test.js +0 -3
- package/dist/lib/util.d.ts +0 -1
- package/dist/lib/util.js +0 -1
- package/dist/lib/validate-compiled.d.ts +0 -1
- package/dist/lib/validate-compiled.js +0 -1
- package/dist/lib/validate-helpers.d.ts +0 -1
- package/dist/lib/validate-helpers.js +0 -1
- package/dist/lib/validate.d.ts +0 -1
- package/dist/lib/validate.js +0 -1
- package/dist/lib/workflow-authoring.d.ts +0 -1
- package/dist/lib/workflow-authoring.js +0 -1
- package/dist/lib/workflow-definitions.d.ts +0 -1
- package/dist/lib/workflow-definitions.js +0 -1
- package/dist/lib/workflow-edit-session.d.ts +0 -1
- package/dist/lib/workflow-edit-session.js +0 -1
- package/dist/lib/workflow-edit-utils.d.ts +0 -1
- package/dist/lib/workflow-edit-utils.js +0 -1
- package/dist/lib/workflow-helpers.d.ts +0 -1
- package/dist/lib/workflow-helpers.js +0 -1
- package/dist/lib/workflow-improvement.d.ts +0 -1
- package/dist/lib/workflow-improvement.js +0 -1
- package/dist/lib/workflow-primitives.d.ts +0 -1
- package/dist/lib/workflow-primitives.js +0 -1
- package/dist/lib/workflow-review-paths.d.ts +0 -1
- package/dist/lib/workflow-review-paths.js +0 -1
- package/dist/lib/workflow-stage-policy.d.ts +0 -1
- package/dist/lib/workflow-stage-policy.js +0 -1
- package/dist/lib/workflow-stage-runner.d.ts +0 -1
- package/dist/lib/workflow-stage-runner.js +0 -1
- package/dist/lib/workflows.d.ts +0 -1
- package/dist/lib/workflows.js +0 -1
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { existsSync, readdirSync, statSync } from "node:fs";
|
|
2
|
-
import { join, relative, sep } from "node:path";
|
|
3
1
|
import * as p from "@clack/prompts";
|
|
4
|
-
import { sourceConfig as projectSourceConfig, } from "../../packages/project-model/index.js";
|
|
2
|
+
import { sourceConfig as projectSourceConfig, sourceFolders as projectSourceFolders, } from "../../packages/project-model/index.js";
|
|
5
3
|
import { slugify } from "../../packages/shared/naming.js";
|
|
4
|
+
import { submitReadinessCheckDraftToLocalService, } from "../../packages/local-service/index.js";
|
|
6
5
|
import { resolveOrConfigureLocalExecutor } from "./executor-flow.js";
|
|
7
|
-
import {
|
|
6
|
+
import { draftReadinessChecks } from "./check-draft.js";
|
|
8
7
|
export const DEFAULT_COMPILED_NAME = "dataset1";
|
|
9
|
-
export const DEFAULT_COMPILED_CHECK_QUESTION_PLACEHOLDER = "
|
|
8
|
+
export const DEFAULT_COMPILED_CHECK_QUESTION_PLACEHOLDER = "An agent-work-critical check you can already verify from this Source Folder";
|
|
10
9
|
export const DEFAULT_COMPILED_CHECK_ANSWER_PLACEHOLDER = "The expected answer in plain English";
|
|
11
10
|
export const DEFAULT_COMPILED_ABOUT_PLACEHOLDER = "Example: board prep from these files, chart reads from this report, or tax review from these exports.";
|
|
12
11
|
export const DEFAULT_DATASET_PATH_PLACEHOLDER = "./dataset1";
|
|
@@ -19,108 +18,29 @@ function normalizeOptionalPromptText(value) {
|
|
|
19
18
|
const normalized = value.trim();
|
|
20
19
|
return normalized.length > 0 ? normalized : undefined;
|
|
21
20
|
}
|
|
22
|
-
function listVisibleDatasetFolders(cwd) {
|
|
23
|
-
const ignoredEntries = new Set([
|
|
24
|
-
".DS_Store",
|
|
25
|
-
".git",
|
|
26
|
-
".interf",
|
|
27
|
-
"interf",
|
|
28
|
-
"interf.json",
|
|
29
|
-
"node_modules",
|
|
30
|
-
]);
|
|
31
|
-
let rootEntries = [];
|
|
32
|
-
try {
|
|
33
|
-
rootEntries = readdirSync(cwd);
|
|
34
|
-
}
|
|
35
|
-
catch {
|
|
36
|
-
return [];
|
|
37
|
-
}
|
|
38
|
-
const visibleEntries = rootEntries.filter((entry) => !ignoredEntries.has(entry) && !entry.startsWith("."));
|
|
39
|
-
const visibleDirectories = [];
|
|
40
|
-
for (const entry of visibleEntries) {
|
|
41
|
-
try {
|
|
42
|
-
const entryPath = join(cwd, entry);
|
|
43
|
-
if (statSync(entryPath).isDirectory()) {
|
|
44
|
-
visibleDirectories.push(entry);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
catch {
|
|
48
|
-
// ignore unreadable entries
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
return visibleDirectories.sort((left, right) => left.localeCompare(right));
|
|
52
|
-
}
|
|
53
|
-
function isReservedDatasetPath(relativePath) {
|
|
54
|
-
const normalized = relativePath.replace(/\\/g, "/").replace(/^\.\/+/, "");
|
|
55
|
-
return normalized === "interf" || normalized.startsWith("interf/") || normalized === ".interf" || normalized.startsWith(".interf/");
|
|
56
|
-
}
|
|
57
21
|
export function normalizeDatasetPathForConfig(projectPath, value) {
|
|
58
|
-
|
|
59
|
-
const relativePath = relative(projectPath, resolvedPath).split(sep).join("/") || ".";
|
|
60
|
-
if (relativePath === ".") {
|
|
61
|
-
throw new Error("Pick a source folder inside this project, not the project root.");
|
|
62
|
-
}
|
|
63
|
-
if (isReservedDatasetPath(relativePath)) {
|
|
64
|
-
throw new Error("Pick an existing source folder under the project root, not `interf/` or `.interf/`.");
|
|
65
|
-
}
|
|
66
|
-
if (!existsSync(resolvedPath)) {
|
|
67
|
-
throw new Error("Pick an existing source folder under the project root.");
|
|
68
|
-
}
|
|
69
|
-
if (!statSync(resolvedPath).isDirectory()) {
|
|
70
|
-
throw new Error("Source folder must be a directory.");
|
|
71
|
-
}
|
|
72
|
-
return relativePath.startsWith("./") ? relativePath : `./${relativePath}`;
|
|
22
|
+
return projectSourceFolders.normalizeSourceDatasetPathForConfig(projectPath, value);
|
|
73
23
|
}
|
|
74
24
|
function defaultDatasetNameForPath(datasetPath) {
|
|
75
|
-
|
|
76
|
-
.replace(/\\/g, "/")
|
|
77
|
-
.replace(/\/+$/g, "")
|
|
78
|
-
.split("/")
|
|
79
|
-
.filter((segment) => segment.length > 0 && segment !== ".");
|
|
80
|
-
return slugify(segments[segments.length - 1] ?? "") || DEFAULT_COMPILED_NAME;
|
|
81
|
-
}
|
|
82
|
-
function findSingleDatasetFolderCandidate(cwd) {
|
|
83
|
-
const visibleDirectories = listVisibleDatasetFolders(cwd);
|
|
84
|
-
if (visibleDirectories.length !== 1) {
|
|
85
|
-
return null;
|
|
86
|
-
}
|
|
87
|
-
return `./${visibleDirectories[0]}`;
|
|
25
|
+
return projectSourceFolders.defaultDatasetNameForPath(datasetPath);
|
|
88
26
|
}
|
|
89
27
|
export function listDatasetFolderChoices(cwd = process.cwd()) {
|
|
90
|
-
return
|
|
91
|
-
value: `./${entry}`,
|
|
92
|
-
label: entry,
|
|
93
|
-
hint: `Use ./${entry} as the source folder`,
|
|
94
|
-
}));
|
|
28
|
+
return projectSourceFolders.listSourceFolderChoices(cwd);
|
|
95
29
|
}
|
|
96
30
|
export function defaultDatasetPathForPrompt(name, introStyle, cwd = process.cwd()) {
|
|
97
|
-
|
|
98
|
-
if (existsSync(namedFolderPath)) {
|
|
99
|
-
try {
|
|
100
|
-
if (statSync(namedFolderPath).isDirectory()) {
|
|
101
|
-
return `./${name}`;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
catch {
|
|
105
|
-
// fall through
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
if (introStyle === "first") {
|
|
109
|
-
return findSingleDatasetFolderCandidate(cwd) ?? `./${name}`;
|
|
110
|
-
}
|
|
111
|
-
return `./${name}`;
|
|
31
|
+
return projectSourceFolders.defaultSourceDatasetPathForPrompt(name, introStyle, cwd);
|
|
112
32
|
}
|
|
113
33
|
async function promptDatasetFolderPath(options) {
|
|
114
34
|
const folderChoices = listDatasetFolderChoices(options.projectPath);
|
|
115
35
|
if (folderChoices.length > 0) {
|
|
116
36
|
const selected = await p.select({
|
|
117
|
-
message: "Which
|
|
37
|
+
message: "Which Source Folder should Interf use?",
|
|
118
38
|
options: [
|
|
119
39
|
...folderChoices,
|
|
120
40
|
{
|
|
121
41
|
value: "__manual__",
|
|
122
42
|
label: "Enter a different path",
|
|
123
|
-
hint: "Use a relative path if the
|
|
43
|
+
hint: "Use a relative path if the Source Folder is not listed here",
|
|
124
44
|
},
|
|
125
45
|
],
|
|
126
46
|
initialValue: folderChoices.some((choice) => choice.value === options.initialPath)
|
|
@@ -140,13 +60,13 @@ async function promptDatasetFolderPath(options) {
|
|
|
140
60
|
}
|
|
141
61
|
}
|
|
142
62
|
const datasetPath = await p.text({
|
|
143
|
-
message: "Which
|
|
63
|
+
message: "Which Source Folder should Interf use?",
|
|
144
64
|
placeholder: DEFAULT_DATASET_PATH_PLACEHOLDER,
|
|
145
65
|
initialValue: options.initialPath,
|
|
146
66
|
validate: (value) => {
|
|
147
67
|
const normalized = value.trim();
|
|
148
68
|
if (normalized.length === 0)
|
|
149
|
-
return "Source
|
|
69
|
+
return "Source Folder is required";
|
|
150
70
|
try {
|
|
151
71
|
normalizeDatasetPathForConfig(options.projectPath, normalized);
|
|
152
72
|
return undefined;
|
|
@@ -162,9 +82,9 @@ async function promptDatasetFolderPath(options) {
|
|
|
162
82
|
}
|
|
163
83
|
export function datasetAboutPromptMessage(introStyle) {
|
|
164
84
|
if (introStyle === "edit") {
|
|
165
|
-
return "What work should this
|
|
85
|
+
return "What agent work should this Preparation stay focused on?";
|
|
166
86
|
}
|
|
167
|
-
return "What work should this
|
|
87
|
+
return "What agent work should this Preparation help with?";
|
|
168
88
|
}
|
|
169
89
|
function formatAttemptLabel(count, noun) {
|
|
170
90
|
return `${count} ${noun}${count === 1 ? "" : "s"}`;
|
|
@@ -179,15 +99,15 @@ export function resolveCompileLoopMode(maxAttempts, maxLoops) {
|
|
|
179
99
|
export function describeCompileLoopSelection(options) {
|
|
180
100
|
const mode = resolveCompileLoopMode(options.maxAttempts, options.maxLoops);
|
|
181
101
|
if (mode === "once") {
|
|
182
|
-
return "
|
|
102
|
+
return "Prepare once.";
|
|
183
103
|
}
|
|
184
104
|
if (mode === "retry") {
|
|
185
105
|
const attempts = options.maxAttempts ?? DEFAULT_COMPILE_RETRY_ATTEMPTS;
|
|
186
|
-
return `
|
|
106
|
+
return `Prepare retries are enabled here (${formatAttemptLabel(attempts, "total attempt")}).`;
|
|
187
107
|
}
|
|
188
108
|
const loops = options.maxLoops ?? DEFAULT_SELF_IMPROVING_LOOPS;
|
|
189
109
|
const attempts = options.maxAttempts ?? DEFAULT_SELF_IMPROVING_ATTEMPTS;
|
|
190
|
-
return `Self-improving loops are enabled here (${formatAttemptLabel(attempts, "attempt")} per variation, ${formatAttemptLabel(loops, "
|
|
110
|
+
return `Self-improving loops are enabled here (${formatAttemptLabel(attempts, "attempt")} per variation, ${formatAttemptLabel(loops, "Method revision")}).`;
|
|
191
111
|
}
|
|
192
112
|
async function promptCompileRetryAttempts(options) {
|
|
193
113
|
const maxAttempts = await p.text({
|
|
@@ -215,9 +135,9 @@ export async function promptCheckCases(options) {
|
|
|
215
135
|
const question = await p.text({
|
|
216
136
|
message: cases.length === 0
|
|
217
137
|
? options.questionMessage
|
|
218
|
-
: `
|
|
138
|
+
: `Check ${startIndex + cases.length}?`,
|
|
219
139
|
placeholder: options.questionPlaceholder,
|
|
220
|
-
validate: (value) => (value.trim().length === 0 ? "
|
|
140
|
+
validate: (value) => (value.trim().length === 0 ? "Check is required" : undefined),
|
|
221
141
|
});
|
|
222
142
|
if (p.isCancel(question))
|
|
223
143
|
return null;
|
|
@@ -244,15 +164,15 @@ export async function promptCheckCases(options) {
|
|
|
244
164
|
return cases;
|
|
245
165
|
}
|
|
246
166
|
}
|
|
247
|
-
function
|
|
167
|
+
function printDraftReadinessChecks(checks) {
|
|
248
168
|
console.log();
|
|
249
|
-
p.log.info(`Draft
|
|
169
|
+
p.log.info(`Draft readiness checks: ${checks.length}`);
|
|
250
170
|
for (const [index, check] of checks.entries()) {
|
|
251
171
|
console.log(` ${index + 1}. ${check.question}`);
|
|
252
172
|
console.log(` Expected: ${check.answer ?? ""}`);
|
|
253
173
|
}
|
|
254
174
|
}
|
|
255
|
-
async function
|
|
175
|
+
async function promptDraftReadinessChecks(options) {
|
|
256
176
|
let resolvedDatasetPath;
|
|
257
177
|
try {
|
|
258
178
|
const datasetConfig = {
|
|
@@ -264,61 +184,101 @@ async function promptDraftTruthChecks(options) {
|
|
|
264
184
|
p.log.error(error instanceof Error ? error.message : String(error));
|
|
265
185
|
return "manual";
|
|
266
186
|
}
|
|
267
|
-
const resolved = await resolveOrConfigureLocalExecutor({
|
|
268
|
-
preflight: true,
|
|
269
|
-
purpose: "draft",
|
|
270
|
-
});
|
|
271
|
-
if (!resolved.executor) {
|
|
272
|
-
if (resolved.cancelled)
|
|
273
|
-
return null;
|
|
274
|
-
p.log.error(resolved.error ?? "No local agent detected for question drafting.");
|
|
275
|
-
const fallback = await p.select({
|
|
276
|
-
message: "How do you want to continue?",
|
|
277
|
-
options: [
|
|
278
|
-
{
|
|
279
|
-
value: "manual",
|
|
280
|
-
label: "Add questions manually",
|
|
281
|
-
hint: "Write the questions and expected answers yourself",
|
|
282
|
-
},
|
|
283
|
-
{
|
|
284
|
-
value: "skip",
|
|
285
|
-
label: "Skip for now",
|
|
286
|
-
hint: "Save this dataset without questions",
|
|
287
|
-
},
|
|
288
|
-
],
|
|
289
|
-
});
|
|
290
|
-
if (p.isCancel(fallback))
|
|
291
|
-
return null;
|
|
292
|
-
return fallback === "manual" ? "manual" : [];
|
|
293
|
-
}
|
|
294
187
|
while (true) {
|
|
295
|
-
p.log.info("Drafting
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
188
|
+
p.log.info("Drafting readiness checks from the source files.");
|
|
189
|
+
let lastServiceStatus = "";
|
|
190
|
+
const serviceRun = await submitReadinessCheckDraftToLocalService({
|
|
191
|
+
projectPath: options.projectPath,
|
|
192
|
+
request: {
|
|
193
|
+
preparation: options.datasetName,
|
|
194
|
+
source_folder_path: resolvedDatasetPath,
|
|
195
|
+
about: options.about,
|
|
196
|
+
target_count: 4,
|
|
197
|
+
},
|
|
198
|
+
onSubmitted: (submission) => {
|
|
199
|
+
p.log.info(`Visible in Interf: ${submission.serviceUrl}/`);
|
|
200
|
+
},
|
|
201
|
+
onUpdate: (job) => {
|
|
202
|
+
const activeStep = job.steps.find((step) => step.status === "running")
|
|
203
|
+
?? [...job.steps].reverse().find((step) => step.status === "succeeded" || step.status === "failed")
|
|
204
|
+
?? null;
|
|
205
|
+
const statusKey = `${job.status}:${activeStep?.id ?? ""}:${activeStep?.status ?? ""}`;
|
|
206
|
+
if (statusKey === lastServiceStatus)
|
|
207
|
+
return;
|
|
208
|
+
lastServiceStatus = statusKey;
|
|
209
|
+
p.log.info(activeStep
|
|
210
|
+
? `${activeStep.label}: ${activeStep.status}`
|
|
211
|
+
: `Readiness-check draft run: ${job.status}`);
|
|
212
|
+
},
|
|
302
213
|
});
|
|
214
|
+
const drafted = serviceRun
|
|
215
|
+
? {
|
|
216
|
+
checks: serviceRun.result?.checks ?? null,
|
|
217
|
+
error: serviceRun.error,
|
|
218
|
+
}
|
|
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
|
+
datasetName: options.datasetName,
|
|
251
|
+
datasetPath: resolvedDatasetPath,
|
|
252
|
+
about: options.about,
|
|
253
|
+
executor: resolved.executor,
|
|
254
|
+
targetCount: 4,
|
|
255
|
+
});
|
|
256
|
+
})();
|
|
257
|
+
if (drafted === null)
|
|
258
|
+
return null;
|
|
259
|
+
if (drafted === "manual")
|
|
260
|
+
return "manual";
|
|
261
|
+
if (drafted === "skip")
|
|
262
|
+
return [];
|
|
303
263
|
if (!drafted.checks) {
|
|
304
|
-
p.log.error(drafted.error ?? "Could not draft
|
|
264
|
+
p.log.error(drafted.error ?? "Could not draft readiness checks from this Source Folder.");
|
|
305
265
|
const retryMode = await p.select({
|
|
306
266
|
message: "How do you want to continue?",
|
|
307
267
|
options: [
|
|
308
268
|
{
|
|
309
269
|
value: "retry",
|
|
310
270
|
label: "Try auto-create again",
|
|
311
|
-
hint: "Run the same local agent again on the
|
|
271
|
+
hint: "Run the same local agent again on the Source Folder",
|
|
312
272
|
},
|
|
313
273
|
{
|
|
314
274
|
value: "manual",
|
|
315
|
-
label: "Add
|
|
316
|
-
hint: "Write the
|
|
275
|
+
label: "Add readiness checks manually",
|
|
276
|
+
hint: "Write the checks yourself instead",
|
|
317
277
|
},
|
|
318
278
|
{
|
|
319
279
|
value: "skip",
|
|
320
280
|
label: "Skip for now",
|
|
321
|
-
hint: "Save this
|
|
281
|
+
hint: "Save this Preparation without readiness checks",
|
|
322
282
|
},
|
|
323
283
|
],
|
|
324
284
|
});
|
|
@@ -328,29 +288,29 @@ async function promptDraftTruthChecks(options) {
|
|
|
328
288
|
continue;
|
|
329
289
|
return retryMode === "manual" ? "manual" : [];
|
|
330
290
|
}
|
|
331
|
-
|
|
291
|
+
printDraftReadinessChecks(drafted.checks);
|
|
332
292
|
const nextStep = await p.select({
|
|
333
|
-
message: "Use these
|
|
293
|
+
message: "Use these readiness checks?",
|
|
334
294
|
options: [
|
|
335
295
|
{
|
|
336
296
|
value: "use",
|
|
337
297
|
label: "Use this draft (Recommended)",
|
|
338
|
-
hint: "Save these
|
|
298
|
+
hint: "Save these checks and edit them later if needed",
|
|
339
299
|
},
|
|
340
300
|
{
|
|
341
301
|
value: "retry",
|
|
342
302
|
label: "Draft again",
|
|
343
|
-
hint: "Run the same local agent again on the
|
|
303
|
+
hint: "Run the same local agent again on the Source Folder",
|
|
344
304
|
},
|
|
345
305
|
{
|
|
346
306
|
value: "manual",
|
|
347
|
-
label: "Add
|
|
348
|
-
hint: "Discard this draft and write the
|
|
307
|
+
label: "Add readiness checks manually instead",
|
|
308
|
+
hint: "Discard this draft and write the checks yourself",
|
|
349
309
|
},
|
|
350
310
|
{
|
|
351
311
|
value: "skip",
|
|
352
312
|
label: "Skip for now",
|
|
353
|
-
hint: "Save this
|
|
313
|
+
hint: "Save this Preparation without readiness checks",
|
|
354
314
|
},
|
|
355
315
|
],
|
|
356
316
|
});
|
|
@@ -370,24 +330,24 @@ async function promptCompiledChecks(options) {
|
|
|
370
330
|
if (options.initialAbout) {
|
|
371
331
|
p.log.info(`About: ${options.initialAbout}`);
|
|
372
332
|
}
|
|
373
|
-
p.log.info("
|
|
333
|
+
p.log.info("Readiness checks are small agent-work-critical checks from your files that define when this data is ready for agent work.");
|
|
374
334
|
const mode = await p.select({
|
|
375
335
|
message: "How should Interf create them?",
|
|
376
336
|
options: [
|
|
377
337
|
{
|
|
378
338
|
value: "draft",
|
|
379
|
-
label: "Auto-create
|
|
380
|
-
hint: "Let your chosen local agent recommend a few clear, verifiable
|
|
339
|
+
label: "Auto-create readiness checks (Recommended)",
|
|
340
|
+
hint: "Let your chosen local agent recommend a few clear, verifiable checks from this Source Folder",
|
|
381
341
|
},
|
|
382
342
|
{
|
|
383
343
|
value: "manual",
|
|
384
|
-
label: "Add
|
|
385
|
-
hint: "Write the
|
|
344
|
+
label: "Add readiness checks manually",
|
|
345
|
+
hint: "Write the checks and expected answers yourself",
|
|
386
346
|
},
|
|
387
347
|
{
|
|
388
348
|
value: "skip",
|
|
389
349
|
label: "Skip for now",
|
|
390
|
-
hint: "You can save the
|
|
350
|
+
hint: "You can save the Preparation first and add readiness checks later",
|
|
391
351
|
},
|
|
392
352
|
],
|
|
393
353
|
});
|
|
@@ -396,7 +356,7 @@ async function promptCompiledChecks(options) {
|
|
|
396
356
|
if (mode === "skip")
|
|
397
357
|
return [];
|
|
398
358
|
if (mode === "draft") {
|
|
399
|
-
const drafted = await
|
|
359
|
+
const drafted = await promptDraftReadinessChecks({
|
|
400
360
|
projectPath: options.projectPath,
|
|
401
361
|
datasetName: options.datasetName,
|
|
402
362
|
datasetPath: options.datasetPath,
|
|
@@ -406,56 +366,56 @@ async function promptCompiledChecks(options) {
|
|
|
406
366
|
return null;
|
|
407
367
|
if (drafted === "manual") {
|
|
408
368
|
return promptCheckCases({
|
|
409
|
-
heading: "
|
|
410
|
-
questionMessage: "
|
|
369
|
+
heading: "Readiness checks",
|
|
370
|
+
questionMessage: "Check 1?",
|
|
411
371
|
questionPlaceholder: DEFAULT_COMPILED_CHECK_QUESTION_PLACEHOLDER,
|
|
412
372
|
answerMessage: "Expected answer 1?",
|
|
413
373
|
answerPlaceholder: DEFAULT_COMPILED_CHECK_ANSWER_PLACEHOLDER,
|
|
414
|
-
addAnotherMessage: "Add another
|
|
374
|
+
addAnotherMessage: "Add another readiness check?",
|
|
415
375
|
});
|
|
416
376
|
}
|
|
417
377
|
return drafted;
|
|
418
378
|
}
|
|
419
379
|
return promptCheckCases({
|
|
420
|
-
heading: "
|
|
421
|
-
questionMessage: "
|
|
380
|
+
heading: "Readiness checks",
|
|
381
|
+
questionMessage: "Check 1?",
|
|
422
382
|
questionPlaceholder: DEFAULT_COMPILED_CHECK_QUESTION_PLACEHOLDER,
|
|
423
383
|
answerMessage: "Expected answer 1?",
|
|
424
384
|
answerPlaceholder: DEFAULT_COMPILED_CHECK_ANSWER_PLACEHOLDER,
|
|
425
|
-
addAnotherMessage: "Add another
|
|
385
|
+
addAnotherMessage: "Add another readiness check?",
|
|
426
386
|
});
|
|
427
387
|
}
|
|
428
388
|
if (options.initialAbout) {
|
|
429
389
|
p.log.info(`About: ${options.initialAbout}`);
|
|
430
390
|
}
|
|
431
|
-
p.log.info(`Current
|
|
391
|
+
p.log.info(`Current readiness checks: ${options.initialChecks.length}`);
|
|
432
392
|
const mode = await p.select({
|
|
433
393
|
message: "What do you want to do with them?",
|
|
434
394
|
options: [
|
|
435
395
|
{
|
|
436
396
|
value: "keep",
|
|
437
397
|
label: "Keep them",
|
|
438
|
-
hint: "Leave the current
|
|
398
|
+
hint: "Leave the current readiness checks as-is",
|
|
439
399
|
},
|
|
440
400
|
{
|
|
441
401
|
value: "add",
|
|
442
402
|
label: "Add more",
|
|
443
|
-
hint: "Append more
|
|
403
|
+
hint: "Append more readiness checks",
|
|
444
404
|
},
|
|
445
405
|
{
|
|
446
406
|
value: "replace",
|
|
447
407
|
label: "Replace all",
|
|
448
|
-
hint: "Rewrite the
|
|
408
|
+
hint: "Rewrite the readiness checks from scratch",
|
|
449
409
|
},
|
|
450
410
|
{
|
|
451
411
|
value: "redraft",
|
|
452
412
|
label: "Replace with auto-created draft",
|
|
453
|
-
hint: "Let a local agent rewrite the
|
|
413
|
+
hint: "Let a local agent rewrite the readiness checks from the Preparation files",
|
|
454
414
|
},
|
|
455
415
|
{
|
|
456
416
|
value: "clear",
|
|
457
417
|
label: "Clear them for now",
|
|
458
|
-
hint: "Keep this
|
|
418
|
+
hint: "Keep this Preparation without readiness checks",
|
|
459
419
|
},
|
|
460
420
|
],
|
|
461
421
|
});
|
|
@@ -468,7 +428,7 @@ async function promptCompiledChecks(options) {
|
|
|
468
428
|
return [];
|
|
469
429
|
}
|
|
470
430
|
if (mode === "redraft") {
|
|
471
|
-
const drafted = await
|
|
431
|
+
const drafted = await promptDraftReadinessChecks({
|
|
472
432
|
projectPath: options.projectPath,
|
|
473
433
|
datasetName: options.datasetName,
|
|
474
434
|
datasetPath: options.datasetPath,
|
|
@@ -478,27 +438,27 @@ async function promptCompiledChecks(options) {
|
|
|
478
438
|
return null;
|
|
479
439
|
if (drafted === "manual") {
|
|
480
440
|
return promptCheckCases({
|
|
481
|
-
heading: "Replace
|
|
482
|
-
questionMessage: "
|
|
441
|
+
heading: "Replace readiness checks",
|
|
442
|
+
questionMessage: "Check 1?",
|
|
483
443
|
questionPlaceholder: DEFAULT_COMPILED_CHECK_QUESTION_PLACEHOLDER,
|
|
484
444
|
answerMessage: "Expected answer 1?",
|
|
485
445
|
answerPlaceholder: DEFAULT_COMPILED_CHECK_ANSWER_PLACEHOLDER,
|
|
486
|
-
addAnotherMessage: "Add another
|
|
446
|
+
addAnotherMessage: "Add another readiness check?",
|
|
487
447
|
});
|
|
488
448
|
}
|
|
489
449
|
return drafted;
|
|
490
450
|
}
|
|
491
451
|
const nextChecks = await promptCheckCases({
|
|
492
|
-
heading: mode === "add" ? "Add more
|
|
452
|
+
heading: mode === "add" ? "Add more readiness checks" : "Replace readiness checks",
|
|
493
453
|
questionMessage: mode === "add"
|
|
494
|
-
? `
|
|
495
|
-
: "
|
|
454
|
+
? `Check ${options.initialChecks.length + 1}?`
|
|
455
|
+
: "Check 1?",
|
|
496
456
|
questionPlaceholder: DEFAULT_COMPILED_CHECK_QUESTION_PLACEHOLDER,
|
|
497
457
|
answerMessage: mode === "add"
|
|
498
458
|
? `Expected answer ${options.initialChecks.length + 1}?`
|
|
499
459
|
: "Expected answer 1?",
|
|
500
460
|
answerPlaceholder: DEFAULT_COMPILED_CHECK_ANSWER_PLACEHOLDER,
|
|
501
|
-
addAnotherMessage: "Add another
|
|
461
|
+
addAnotherMessage: "Add another readiness check?",
|
|
502
462
|
startIndex: mode === "add" ? options.initialChecks.length + 1 : 1,
|
|
503
463
|
});
|
|
504
464
|
if (nextChecks === null)
|
|
@@ -543,20 +503,20 @@ export async function promptCompileLoopSelection(options) {
|
|
|
543
503
|
const optionsByMode = {
|
|
544
504
|
once: {
|
|
545
505
|
value: "once",
|
|
546
|
-
label: "
|
|
547
|
-
hint: "
|
|
506
|
+
label: "Prepare once",
|
|
507
|
+
hint: "Run the selected Method once and write Portable Context",
|
|
548
508
|
},
|
|
549
509
|
"self-improving": {
|
|
550
510
|
value: "self-improving",
|
|
551
511
|
label: recommendedMode === "self-improving"
|
|
552
512
|
? "Self-improving loops (Recommended)"
|
|
553
513
|
: "Self-improving loops",
|
|
554
|
-
hint: `Let Interf revise the
|
|
514
|
+
hint: `Let Interf revise the Method and retry up to ${options.initialMaxLoops ?? DEFAULT_SELF_IMPROVING_LOOPS} time${(options.initialMaxLoops ?? DEFAULT_SELF_IMPROVING_LOOPS) === 1 ? "" : "s"}`,
|
|
555
515
|
},
|
|
556
516
|
retry: {
|
|
557
517
|
value: "retry",
|
|
558
|
-
label: "Retry same
|
|
559
|
-
hint: `Retry
|
|
518
|
+
label: "Retry same Method",
|
|
519
|
+
hint: `Retry the same Method and readiness checks up to ${options.initialMaxAttempts ?? DEFAULT_COMPILE_RETRY_ATTEMPTS} total time${(options.initialMaxAttempts ?? DEFAULT_COMPILE_RETRY_ATTEMPTS) === 1 ? "" : "s"} without editing the Method`,
|
|
560
520
|
},
|
|
561
521
|
};
|
|
562
522
|
const orderedModes = (hasSavedPolicy
|
|
@@ -573,7 +533,7 @@ export async function promptCompileLoopSelection(options) {
|
|
|
573
533
|
]).filter((mode, index, list) => list.indexOf(mode) === index)
|
|
574
534
|
.filter((mode) => includeCompileOnce || mode !== "once");
|
|
575
535
|
const selectedMode = await p.select({
|
|
576
|
-
message: options.message ?? "How should this
|
|
536
|
+
message: options.message ?? "How should this prepare run work?",
|
|
577
537
|
options: orderedModes.map((mode) => optionsByMode[mode]),
|
|
578
538
|
});
|
|
579
539
|
if (p.isCancel(selectedMode))
|
|
@@ -594,7 +554,7 @@ export async function promptCompileLoopSelection(options) {
|
|
|
594
554
|
}
|
|
595
555
|
const maxLoops = await promptSelfImprovingLoops({
|
|
596
556
|
initialMaxLoops: options.initialMaxLoops ?? DEFAULT_SELF_IMPROVING_LOOPS,
|
|
597
|
-
message: "How many
|
|
557
|
+
message: "How many Method revisions should Interf try?",
|
|
598
558
|
});
|
|
599
559
|
if (maxLoops === null)
|
|
600
560
|
return null;
|
|
@@ -607,48 +567,66 @@ export async function promptSingleCompiledConfig(options = {}) {
|
|
|
607
567
|
const initial = options.initial;
|
|
608
568
|
const introStyle = options.introStyle ?? "first";
|
|
609
569
|
if (introStyle === "first") {
|
|
610
|
-
|
|
611
|
-
|
|
570
|
+
if (options.fixedPath) {
|
|
571
|
+
p.log.info("Describe the agent work this Preparation should help with and review the recommended readiness checks.");
|
|
572
|
+
}
|
|
573
|
+
else {
|
|
574
|
+
p.log.info("Pick the Source Folder for this Preparation.");
|
|
575
|
+
p.log.info("Then say what agent work this Preparation should help with and review the recommended readiness checks.");
|
|
576
|
+
}
|
|
612
577
|
}
|
|
613
578
|
else if (introStyle === "additional") {
|
|
614
|
-
p.log.info("Add another
|
|
579
|
+
p.log.info("Add another Preparation only if this Source Folder needs a separate folder, agent-work focus, or readiness-check set.");
|
|
615
580
|
}
|
|
616
581
|
const fixedName = options.fixedName ? slugify(String(options.fixedName)) : undefined;
|
|
617
582
|
if (options.fixedName && !fixedName) {
|
|
618
|
-
p.log.error("Current
|
|
583
|
+
p.log.error("Current Preparation name needs letters, numbers, or dashes.");
|
|
619
584
|
return null;
|
|
620
585
|
}
|
|
621
586
|
let name = fixedName;
|
|
622
587
|
if (name && options.fixedName) {
|
|
623
|
-
p.log.info(`Editing
|
|
588
|
+
p.log.info(`Editing readiness checks for Preparation "${name}".`);
|
|
624
589
|
}
|
|
625
590
|
let about = normalizeOptionalPromptText(initial?.about);
|
|
626
591
|
const projectPath = options.projectPath ?? process.cwd();
|
|
627
592
|
const defaultNameSeed = slugify(String(initial?.name ?? DEFAULT_COMPILED_NAME)) || DEFAULT_COMPILED_NAME;
|
|
628
593
|
const defaultDatasetPath = initial?.path ?? defaultDatasetPathForPrompt(defaultNameSeed, introStyle, projectPath);
|
|
629
|
-
const normalizedDatasetPath =
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
594
|
+
const normalizedDatasetPath = options.fixedPath
|
|
595
|
+
? (() => {
|
|
596
|
+
try {
|
|
597
|
+
return normalizeDatasetPathForConfig(projectPath, options.fixedPath);
|
|
598
|
+
}
|
|
599
|
+
catch (error) {
|
|
600
|
+
p.log.error(error instanceof Error ? error.message : String(error));
|
|
601
|
+
return null;
|
|
602
|
+
}
|
|
603
|
+
})()
|
|
604
|
+
: await promptDatasetFolderPath({
|
|
605
|
+
projectPath,
|
|
606
|
+
initialPath: defaultDatasetPath,
|
|
607
|
+
});
|
|
633
608
|
if (!normalizedDatasetPath)
|
|
634
609
|
return null;
|
|
610
|
+
if (options.fixedPath) {
|
|
611
|
+
p.log.info(`Source Folder: ${normalizedDatasetPath}`);
|
|
612
|
+
}
|
|
635
613
|
if (!name) {
|
|
636
614
|
const suggestedName = defaultDatasetNameForPath(normalizedDatasetPath);
|
|
637
615
|
const rawName = await p.text({
|
|
638
|
-
message: "
|
|
616
|
+
message: "Preparation name?",
|
|
639
617
|
placeholder: suggestedName,
|
|
640
618
|
initialValue: suggestedName,
|
|
641
|
-
validate: (value) => (value.trim().length === 0 ? "
|
|
619
|
+
validate: (value) => (value.trim().length === 0 ? "Preparation name is required" : undefined),
|
|
642
620
|
});
|
|
643
621
|
if (p.isCancel(rawName))
|
|
644
622
|
return null;
|
|
645
623
|
name = slugify(String(rawName));
|
|
646
624
|
if (!name) {
|
|
647
|
-
p.log.error("
|
|
625
|
+
p.log.error("Preparation name needs letters, numbers, or dashes.");
|
|
648
626
|
return null;
|
|
649
627
|
}
|
|
650
628
|
if (name !== rawName) {
|
|
651
|
-
p.log.info(`
|
|
629
|
+
p.log.info(`Preparation name: ${name}`);
|
|
652
630
|
}
|
|
653
631
|
}
|
|
654
632
|
let compileLoopSelection = {
|
|
@@ -680,8 +658,8 @@ export async function promptSingleCompiledConfig(options = {}) {
|
|
|
680
658
|
initialMaxLoops: initial?.max_loops,
|
|
681
659
|
hasChecks: checks.length > 0,
|
|
682
660
|
intro: [
|
|
683
|
-
"
|
|
684
|
-
"Choose whether Interf should
|
|
661
|
+
"Prepare mode",
|
|
662
|
+
"Choose whether Interf should prepare once, retry the same Method, or try self-improving Method variations against the same readiness checks.",
|
|
685
663
|
],
|
|
686
664
|
});
|
|
687
665
|
if (compileLoopSelection === null)
|