@interf/compiler 0.7.2 → 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 +141 -99
- 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 +6 -6
- package/builtin-workflows/interf/compile/stages/structure/SKILL.md +1 -1
- package/builtin-workflows/interf/improve/SKILL.md +2 -2
- package/builtin-workflows/interf/use/query/SKILL.md +2 -2
- package/builtin-workflows/interf/workflow.json +9 -9
- package/builtin-workflows/interf/workflow.schema.json +2 -2
- 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 +12 -0
- package/dist/cli/commands/create-workflow-wizard.js +232 -66
- package/dist/cli/commands/create.js +70 -46
- package/dist/cli/commands/default.js +5 -3
- package/dist/cli/commands/doctor.js +5 -5
- package/dist/cli/commands/executor-flow.js +1 -1
- package/dist/cli/commands/init.js +362 -101
- 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 -4
- package/dist/cli/commands/source-config-wizard.js +175 -200
- 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 +35 -33
- 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 +58 -106
- 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 +8 -2
- 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 +7 -7
- 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 +48 -19
- package/dist/packages/project-model/interf-scaffold.d.ts +1 -0
- package/dist/packages/project-model/interf-scaffold.js +39 -17
- package/dist/packages/project-model/interf.d.ts +2 -2
- package/dist/packages/project-model/interf.js +2 -2
- 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/project-paths.d.ts +3 -1
- package/dist/packages/project-model/project-paths.js +6 -2
- package/dist/packages/project-model/source-config.d.ts +25 -11
- package/dist/packages/project-model/source-config.js +152 -82
- 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 +4 -3
- package/dist/packages/workflow-authoring/workflow-authoring.d.ts +4 -6
- package/dist/packages/workflow-authoring/workflow-authoring.js +46 -85
- package/dist/packages/workflow-authoring/workflow-edit-session.d.ts +2 -0
- package/dist/packages/workflow-authoring/workflow-edit-session.js +83 -49
- package/dist/packages/workflow-authoring/workflow-improvement.js +2 -1
- package/dist/packages/workflow-package/context-interface.js +2 -2
- 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-review-paths.js +5 -1
- 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 +18 -4
- 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,15 +1,167 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
2
|
import * as p from "@clack/prompts";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import { existsSync, statSync } from "node:fs";
|
|
4
|
+
import { basename, isAbsolute, relative, resolve } from "node:path";
|
|
5
|
+
import { assertCompiledContainer, detectInterf, ensurePortableContextScaffold, readInterfConfig, resolveSourceControlPath, } from "../../packages/project-model/interf.js";
|
|
6
|
+
import { SOURCE_FOLDER_CONFIG_PATH, configuredSourceFolderPath, loadSourceFolderConfig, resolveConfiguredSourceFolderPath, saveSourceFolderConfig, syncCompiledInterfConfigFromSourceDatasetConfig, upsertSourceDatasetConfig, } from "../../packages/project-model/source-config.js";
|
|
7
|
+
import { defaultDatasetNameForPath, } from "../../packages/project-model/source-folders.js";
|
|
8
|
+
import { DEFAULT_COMPILED_NAME, describeCompileLoopSelection, listDatasetFolderChoices, promptSingleCompiledConfig, } from "./source-config-wizard.js";
|
|
9
|
+
import { chooseOrCreateCompiledWorkflowForDataset, createWorkflowWizard, } from "./create-workflow-wizard.js";
|
|
8
10
|
import { seedLocalDefaultWorkflow } from "../../packages/workflow-package/local-workflows.js";
|
|
9
11
|
import { findBuiltCompiledPath, findSavedCompiledConfig, listSavedCompiledEntries, } from "./compiled-flow.js";
|
|
10
12
|
import { readCurrentSavedTestComparison, } from "./test-flow.js";
|
|
11
13
|
import { runCompileCommand } from "./compile.js";
|
|
12
14
|
import { runTestCommand } from "./test.js";
|
|
15
|
+
import { defaultInterfInstanceRoot, relativeSourceFolderPath, resolveInterfInstanceContext, } from "./control-path.js";
|
|
16
|
+
import { runWebCommand } from "./web.js";
|
|
17
|
+
function isPathInside(parentPath, childPath) {
|
|
18
|
+
const relativePath = relative(parentPath, childPath);
|
|
19
|
+
return relativePath === "" || (!relativePath.startsWith("..") && !isAbsolute(relativePath));
|
|
20
|
+
}
|
|
21
|
+
function normalizeSourceFolderInput(cwd, input) {
|
|
22
|
+
const trimmed = input.trim();
|
|
23
|
+
if (trimmed.length === 0) {
|
|
24
|
+
throw new Error("Source Folder is required.");
|
|
25
|
+
}
|
|
26
|
+
const sourceFolderPath = resolve(cwd, trimmed);
|
|
27
|
+
if (!existsSync(sourceFolderPath)) {
|
|
28
|
+
throw new Error("Pick an existing Source Folder.");
|
|
29
|
+
}
|
|
30
|
+
if (!statSync(sourceFolderPath).isDirectory()) {
|
|
31
|
+
throw new Error("Source Folder must be a directory.");
|
|
32
|
+
}
|
|
33
|
+
return sourceFolderPath;
|
|
34
|
+
}
|
|
35
|
+
function normalizeInterfInstanceFolderInput(cwd, sourceFolderPath, input) {
|
|
36
|
+
const trimmed = input.trim();
|
|
37
|
+
if (trimmed.length === 0) {
|
|
38
|
+
throw new Error("Interf Workspace folder is required.");
|
|
39
|
+
}
|
|
40
|
+
const controlPath = resolve(cwd, trimmed);
|
|
41
|
+
if (isPathInside(sourceFolderPath, controlPath)) {
|
|
42
|
+
throw new Error("Choose an Interf Workspace folder outside the Source Folder so Interf does not write generated state into your source files.");
|
|
43
|
+
}
|
|
44
|
+
assertCompiledContainer(controlPath);
|
|
45
|
+
return controlPath;
|
|
46
|
+
}
|
|
47
|
+
async function promptSourceFolderForInstance(cwd) {
|
|
48
|
+
const folderChoices = listDatasetFolderChoices(cwd);
|
|
49
|
+
const selected = await p.select({
|
|
50
|
+
message: "Which Source Folder should Interf prepare?",
|
|
51
|
+
options: [
|
|
52
|
+
...folderChoices,
|
|
53
|
+
{
|
|
54
|
+
value: "__current__",
|
|
55
|
+
label: `Use current folder (${basename(cwd)})`,
|
|
56
|
+
hint: cwd,
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
value: "__manual__",
|
|
60
|
+
label: "Enter a different path",
|
|
61
|
+
hint: "Use an absolute path or a path relative to this folder",
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
initialValue: folderChoices.length === 1 ? folderChoices[0]?.value : "__current__",
|
|
65
|
+
});
|
|
66
|
+
if (p.isCancel(selected))
|
|
67
|
+
return null;
|
|
68
|
+
if (selected === "__manual__") {
|
|
69
|
+
const sourceInput = await p.text({
|
|
70
|
+
message: "Source Folder path?",
|
|
71
|
+
placeholder: cwd,
|
|
72
|
+
initialValue: cwd,
|
|
73
|
+
validate: (value) => {
|
|
74
|
+
try {
|
|
75
|
+
normalizeSourceFolderInput(cwd, value);
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
return error instanceof Error ? error.message : String(error);
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
if (p.isCancel(sourceInput))
|
|
84
|
+
return null;
|
|
85
|
+
return normalizeSourceFolderInput(cwd, String(sourceInput));
|
|
86
|
+
}
|
|
87
|
+
return normalizeSourceFolderInput(cwd, selected === "__current__" ? "." : String(selected));
|
|
88
|
+
}
|
|
89
|
+
async function promptInterfInstanceFolder(cwd, sourceFolderPath) {
|
|
90
|
+
const defaultControlPath = defaultInterfInstanceRoot(sourceFolderPath);
|
|
91
|
+
p.log.info("Interf stores config, Methods, runs, and portable context outside the Source Folder.");
|
|
92
|
+
const controlInput = await p.text({
|
|
93
|
+
message: "Where should Interf store this Interf Workspace?",
|
|
94
|
+
placeholder: defaultControlPath,
|
|
95
|
+
initialValue: defaultControlPath,
|
|
96
|
+
validate: (value) => {
|
|
97
|
+
try {
|
|
98
|
+
normalizeInterfInstanceFolderInput(cwd, sourceFolderPath, value);
|
|
99
|
+
return undefined;
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
return error instanceof Error ? error.message : String(error);
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
});
|
|
106
|
+
if (p.isCancel(controlInput))
|
|
107
|
+
return null;
|
|
108
|
+
return normalizeInterfInstanceFolderInput(cwd, sourceFolderPath, String(controlInput));
|
|
109
|
+
}
|
|
110
|
+
async function setupInterfInstance(cwd) {
|
|
111
|
+
const sourceFolderPath = await promptSourceFolderForInstance(cwd);
|
|
112
|
+
if (!sourceFolderPath)
|
|
113
|
+
return null;
|
|
114
|
+
const controlPath = await promptInterfInstanceFolder(cwd, sourceFolderPath);
|
|
115
|
+
if (!controlPath)
|
|
116
|
+
return null;
|
|
117
|
+
const sourceFolderConfigPath = relativeSourceFolderPath(controlPath, sourceFolderPath);
|
|
118
|
+
saveSourceFolderConfig(controlPath, {
|
|
119
|
+
source_folder: { path: sourceFolderConfigPath },
|
|
120
|
+
preparations: [],
|
|
121
|
+
});
|
|
122
|
+
const seeded = seedLocalDefaultWorkflow({ sourcePath: controlPath });
|
|
123
|
+
p.log.info(`Source Folder: ${sourceFolderPath}`);
|
|
124
|
+
p.log.info(`Interf Workspace: ${controlPath}`);
|
|
125
|
+
p.log.info(`Source Folder path in Interf config: ${sourceFolderConfigPath}`);
|
|
126
|
+
if (!seeded.alreadyExisted) {
|
|
127
|
+
p.log.info(`Copied built-in Method package to interf/methods/${seeded.workflowId}/. Inspect or fork it anytime.`);
|
|
128
|
+
}
|
|
129
|
+
return {
|
|
130
|
+
sourceFolderPath,
|
|
131
|
+
controlPath,
|
|
132
|
+
sourceFolderConfigPath,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
async function promptEmptyInstanceAction() {
|
|
136
|
+
const selected = await p.select({
|
|
137
|
+
message: "What do you want to do next?",
|
|
138
|
+
options: [
|
|
139
|
+
{
|
|
140
|
+
value: "web",
|
|
141
|
+
label: "Open Interf UI (Recommended)",
|
|
142
|
+
hint: "Start the local UI and API for this Source Folder",
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
value: "preparation",
|
|
146
|
+
label: "Create Preparation",
|
|
147
|
+
hint: "Describe the agent work, choose a Method, and save readiness checks",
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
value: "method",
|
|
151
|
+
label: "Create Method",
|
|
152
|
+
hint: "Create or draft a reusable way to process files",
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
value: "done",
|
|
156
|
+
label: "Done",
|
|
157
|
+
hint: `Leave the empty Interf Workspace at ${SOURCE_FOLDER_CONFIG_PATH}`,
|
|
158
|
+
},
|
|
159
|
+
],
|
|
160
|
+
});
|
|
161
|
+
if (p.isCancel(selected))
|
|
162
|
+
return null;
|
|
163
|
+
return selected;
|
|
164
|
+
}
|
|
13
165
|
export function currentRunTargetStatus(rows, target) {
|
|
14
166
|
const outcomes = rows
|
|
15
167
|
.map((row) => (target === "raw" ? row.rawOutcome : row.compiledOutcome))
|
|
@@ -23,43 +175,43 @@ export function currentRunTargetStatus(rows, target) {
|
|
|
23
175
|
return "mixed";
|
|
24
176
|
return "fail";
|
|
25
177
|
}
|
|
26
|
-
function
|
|
178
|
+
function describeSavedReadinessChecks(dataset) {
|
|
27
179
|
const count = dataset.checks.length;
|
|
28
180
|
if (count === 0)
|
|
29
|
-
return "No
|
|
30
|
-
return `${count}
|
|
181
|
+
return "No readiness checks yet";
|
|
182
|
+
return `${count} readiness check${count === 1 ? "" : "s"}`;
|
|
31
183
|
}
|
|
32
184
|
function printDatasetSummary(options) {
|
|
33
185
|
const compiledConfig = options.builtCompiledPath
|
|
34
186
|
? readInterfConfig(options.builtCompiledPath)
|
|
35
187
|
: null;
|
|
36
|
-
const workflowLabel = `${options.dataset.workflow ?? "interf"}${compiledConfig?.workflow_origin?.local_draft === true ? " (local draft)" : ""}`;
|
|
37
|
-
p.log.info(`
|
|
188
|
+
const workflowLabel = `${options.dataset.method ?? options.dataset.workflow ?? "interf-default"}${compiledConfig?.workflow_origin?.local_draft === true ? " (local draft)" : ""}`;
|
|
189
|
+
p.log.info(`Preparation: ${options.dataset.name}`);
|
|
38
190
|
p.log.info(`Source folder: ${options.dataset.path}`);
|
|
39
191
|
if (options.dataset.about) {
|
|
40
192
|
p.log.info(`About: ${options.dataset.about}`);
|
|
41
193
|
}
|
|
42
|
-
p.log.info(`
|
|
194
|
+
p.log.info(`Method: ${workflowLabel}`);
|
|
43
195
|
p.log.info(describeCompileLoopSelection({
|
|
44
196
|
maxAttempts: options.dataset.max_attempts,
|
|
45
197
|
maxLoops: options.dataset.max_loops,
|
|
46
198
|
}));
|
|
47
|
-
p.log.info(
|
|
48
|
-
p.log.info(options.built ? "Portable
|
|
199
|
+
p.log.info(describeSavedReadinessChecks(options.dataset));
|
|
200
|
+
p.log.info(options.built ? "Portable Context is available." : "Portable Context has not been built yet.");
|
|
49
201
|
if (options.latestComparison?.raw && options.latestComparison?.compiled) {
|
|
50
|
-
p.log.info(`Latest saved comparison: source files ${options.latestComparison.raw.passed_cases}/${options.latestComparison.raw.total_cases},
|
|
202
|
+
p.log.info(`Latest saved comparison: source files ${options.latestComparison.raw.passed_cases}/${options.latestComparison.raw.total_cases}, Portable Context ${options.latestComparison.compiled.passed_cases}/${options.latestComparison.compiled.total_cases}.`);
|
|
51
203
|
}
|
|
52
204
|
else if (options.latestComparison?.raw) {
|
|
53
205
|
p.log.info(`Latest saved source-files run: ${options.latestComparison.raw.passed_cases}/${options.latestComparison.raw.total_cases}.`);
|
|
54
206
|
}
|
|
55
207
|
else if (options.latestComparison?.compiled) {
|
|
56
|
-
p.log.info(`Latest
|
|
208
|
+
p.log.info(`Latest Portable Context run: ${options.latestComparison.compiled.passed_cases}/${options.latestComparison.compiled.total_cases}.`);
|
|
57
209
|
}
|
|
58
210
|
else if (options.latestComparisonStale) {
|
|
59
|
-
p.log.info("Saved
|
|
211
|
+
p.log.info("Saved readiness results are stale for the current checks.");
|
|
60
212
|
}
|
|
61
213
|
if (options.sourcePath !== process.cwd()) {
|
|
62
|
-
p.log.info(`
|
|
214
|
+
p.log.info(`Interf Workspace: ${options.sourcePath}`);
|
|
63
215
|
}
|
|
64
216
|
}
|
|
65
217
|
async function promptDatasetAction(dataset, built, latestComparison) {
|
|
@@ -67,45 +219,55 @@ async function promptDatasetAction(dataset, built, latestComparison) {
|
|
|
67
219
|
const hasSavedRawBaseline = Boolean(latestComparison?.raw);
|
|
68
220
|
const latestRawPasses = latestComparison?.raw &&
|
|
69
221
|
latestComparison.raw.passed_cases === latestComparison.raw.total_cases;
|
|
222
|
+
const compileOption = {
|
|
223
|
+
value: "compile",
|
|
224
|
+
label: built ? "Prepare again and refresh Portable Context" : "Prepare files and write Portable Context (Recommended)",
|
|
225
|
+
hint: built
|
|
226
|
+
? "Refresh it from the current source files"
|
|
227
|
+
: dataset.checks.length > 0
|
|
228
|
+
? latestRawPasses
|
|
229
|
+
? "Prepare files for a side-by-side comparison with the latest saved source-files run"
|
|
230
|
+
: hasSavedRawBaseline
|
|
231
|
+
? "Some readiness checks still fail on the source files. Prepare files and run the same checks"
|
|
232
|
+
: "Run the selected Method and write the output folder agents can use"
|
|
233
|
+
: "Run the selected Method and create the output folder agents can use",
|
|
234
|
+
};
|
|
70
235
|
if (dataset.checks.length > 0) {
|
|
71
|
-
|
|
236
|
+
const testOption = {
|
|
72
237
|
value: "test",
|
|
73
238
|
label: built
|
|
74
|
-
? "
|
|
239
|
+
? "Run readiness checks on source files and Portable Context (Recommended)"
|
|
75
240
|
: hasSavedRawBaseline
|
|
76
241
|
? "Rerun the source-files baseline"
|
|
77
|
-
: "Measure the source-files baseline
|
|
242
|
+
: "Measure the source-files baseline",
|
|
78
243
|
hint: built
|
|
79
|
-
? "See whether the
|
|
244
|
+
? "See whether the Portable Context is ready for your agents on the saved checks"
|
|
80
245
|
: hasSavedRawBaseline
|
|
81
|
-
? "Refresh the saved source-files baseline on the current
|
|
82
|
-
: "
|
|
83
|
-
}
|
|
246
|
+
? "Refresh the saved source-files baseline on the current readiness checks"
|
|
247
|
+
: "Optional source-files readiness baseline before Interf builds Portable Context",
|
|
248
|
+
};
|
|
249
|
+
if (built) {
|
|
250
|
+
options.push(testOption, compileOption);
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
options.push(compileOption, testOption);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
options.push(compileOption);
|
|
84
258
|
}
|
|
85
259
|
options.push({
|
|
86
|
-
value: "compile",
|
|
87
|
-
label: built ? "Rebuild portable context for your agents" : "Build portable context for your agents",
|
|
88
|
-
hint: built
|
|
89
|
-
? "Refresh it from the current source files"
|
|
90
|
-
: dataset.checks.length > 0
|
|
91
|
-
? latestRawPasses
|
|
92
|
-
? "Optional: build portable context for your agents for a side-by-side comparison with the latest saved source-files run"
|
|
93
|
-
: hasSavedRawBaseline
|
|
94
|
-
? "Some questions still fail on the source files. Build portable context for your agents and compare it on the same questions"
|
|
95
|
-
: "Build portable context for your agents and compare it on the same questions"
|
|
96
|
-
: "Build it for your agents first, then measure it",
|
|
97
|
-
}, {
|
|
98
260
|
value: "dataset",
|
|
99
|
-
label: "Add another
|
|
100
|
-
hint: "Add a separate folder, focus, or
|
|
261
|
+
label: "Add another Preparation",
|
|
262
|
+
hint: "Add a separate folder, focus, or readiness-check set",
|
|
101
263
|
}, {
|
|
102
264
|
value: "edit",
|
|
103
|
-
label: "Edit
|
|
104
|
-
hint: "Update
|
|
265
|
+
label: "Edit readiness checks and settings",
|
|
266
|
+
hint: "Update readiness checks, focus, Method, or prepare mode",
|
|
105
267
|
}, {
|
|
106
268
|
value: "workflow",
|
|
107
|
-
label: "Create
|
|
108
|
-
hint: "Advanced: customize
|
|
269
|
+
label: "Create Method",
|
|
270
|
+
hint: "Advanced: customize how Interf prepares files",
|
|
109
271
|
}, {
|
|
110
272
|
value: "done",
|
|
111
273
|
label: "Done",
|
|
@@ -121,20 +283,20 @@ async function promptDatasetAction(dataset, built, latestComparison) {
|
|
|
121
283
|
}
|
|
122
284
|
function printDatasetRecommendation(dataset, built, latestComparison) {
|
|
123
285
|
if (dataset.checks.length === 0) {
|
|
124
|
-
p.log.info("
|
|
286
|
+
p.log.info("No readiness checks yet. You can prepare files first, then add checks when you know what evidence matters.");
|
|
125
287
|
return;
|
|
126
288
|
}
|
|
127
289
|
if (!built) {
|
|
128
290
|
if (latestComparison?.raw) {
|
|
129
291
|
p.log.info(latestComparison.raw.passed_cases === latestComparison.raw.total_cases
|
|
130
|
-
? `Latest source-files run: ${latestComparison.raw.passed_cases}/${latestComparison.raw.total_cases}.
|
|
131
|
-
: `Latest source-files run: ${latestComparison.raw.passed_cases}/${latestComparison.raw.total_cases}. Some
|
|
292
|
+
? `Latest source-files run: ${latestComparison.raw.passed_cases}/${latestComparison.raw.total_cases}. Prepare files if you want a side-by-side comparison.`
|
|
293
|
+
: `Latest source-files run: ${latestComparison.raw.passed_cases}/${latestComparison.raw.total_cases}. Some readiness checks still fail on the source files. Prepare files if you want Interf to process this data and run the same checks.`);
|
|
132
294
|
return;
|
|
133
295
|
}
|
|
134
|
-
p.log.info("Recommended first step:
|
|
296
|
+
p.log.info("Recommended first step: choose a Method and prepare files.");
|
|
135
297
|
return;
|
|
136
298
|
}
|
|
137
|
-
p.log.info("Recommended first step: compare the source-files baseline and
|
|
299
|
+
p.log.info("Recommended first step: compare the source-files baseline and Portable Context.");
|
|
138
300
|
}
|
|
139
301
|
async function promptPostBaselineAction(rows) {
|
|
140
302
|
const status = currentRunTargetStatus(rows, "raw");
|
|
@@ -155,28 +317,28 @@ async function promptPostBaselineAction(rows) {
|
|
|
155
317
|
{
|
|
156
318
|
value: "compile",
|
|
157
319
|
label: compileRecommended
|
|
158
|
-
? "
|
|
159
|
-
: "
|
|
320
|
+
? "Prepare files and write Portable Context (Recommended)"
|
|
321
|
+
: "Prepare files and write Portable Context",
|
|
160
322
|
hint: compileRecommended
|
|
161
323
|
? status === "mixed"
|
|
162
|
-
? "Some selected agents still failed on the source files.
|
|
163
|
-
: "
|
|
164
|
-
: "
|
|
324
|
+
? "Some selected agents still failed on the source files. Prepare files and run the same readiness checks"
|
|
325
|
+
: "Prepare files and run the same readiness checks"
|
|
326
|
+
: "Prepare files and run the same readiness checks",
|
|
165
327
|
},
|
|
166
328
|
{
|
|
167
329
|
value: "edit",
|
|
168
|
-
label: "Change
|
|
169
|
-
hint: "Revise the
|
|
330
|
+
label: "Change readiness checks and settings",
|
|
331
|
+
hint: "Revise the readiness checks or Preparation settings before the next run",
|
|
170
332
|
},
|
|
171
333
|
{
|
|
172
334
|
value: "rerun",
|
|
173
335
|
label: "Rerun the source-files baseline",
|
|
174
|
-
hint: "Run the same
|
|
336
|
+
hint: "Run the same readiness checks again, including different local agents if you want",
|
|
175
337
|
},
|
|
176
338
|
{
|
|
177
339
|
value: "done",
|
|
178
340
|
label: "Stop here",
|
|
179
|
-
hint: "Leave the
|
|
341
|
+
hint: "Leave the Preparation as-is for now",
|
|
180
342
|
},
|
|
181
343
|
],
|
|
182
344
|
});
|
|
@@ -194,22 +356,22 @@ async function chooseCompiledForWizard(options) {
|
|
|
194
356
|
if (savedEntries.length === 1)
|
|
195
357
|
return savedEntries[0]?.config ?? null;
|
|
196
358
|
const selected = await p.select({
|
|
197
|
-
message: "Which
|
|
359
|
+
message: "Which saved Preparation do you want to work with?",
|
|
198
360
|
options: [
|
|
199
361
|
...savedEntries.map((entry) => ({
|
|
200
362
|
value: entry.config.name,
|
|
201
363
|
label: entry.config.name,
|
|
202
364
|
hint: [
|
|
203
365
|
`path ${entry.config.path}`,
|
|
204
|
-
entry.config.about ??
|
|
205
|
-
`
|
|
206
|
-
entry.path ? "
|
|
366
|
+
entry.config.about ?? describeSavedReadinessChecks(entry.config),
|
|
367
|
+
`Method ${entry.config.method ?? entry.config.workflow ?? "interf-default"}${entry.localDraft ? " (local draft)" : ""}`,
|
|
368
|
+
entry.path ? "Portable Context available" : "Portable Context not built yet",
|
|
207
369
|
].join(" · "),
|
|
208
370
|
})),
|
|
209
371
|
{
|
|
210
372
|
value: "__new__",
|
|
211
|
-
label: "Add another
|
|
212
|
-
hint: "Add a separate folder, focus, or
|
|
373
|
+
label: "Add another Preparation",
|
|
374
|
+
hint: "Add a separate folder, focus, or readiness-check set",
|
|
213
375
|
},
|
|
214
376
|
],
|
|
215
377
|
});
|
|
@@ -220,31 +382,28 @@ async function chooseCompiledForWizard(options) {
|
|
|
220
382
|
return findSavedCompiledConfig(options.sourcePath, String(selected));
|
|
221
383
|
}
|
|
222
384
|
async function promptCompiledSetup(options) {
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
.
|
|
226
|
-
if (options.introStyle === "edit") {
|
|
227
|
-
const workflowChoice = await chooseCompiledWorkflow(options.sourcePath, {
|
|
228
|
-
currentWorkflowId: workflowId,
|
|
229
|
-
message: "Which workflow should this dataset use?",
|
|
230
|
-
});
|
|
231
|
-
if (p.isCancel(workflowChoice))
|
|
232
|
-
return null;
|
|
233
|
-
workflowId = workflowChoice;
|
|
234
|
-
workflowLabel = buildCompiledWorkflowOptions(options.sourcePath)
|
|
235
|
-
.find((option) => option.value === workflowId)?.label ?? workflowId;
|
|
236
|
-
}
|
|
385
|
+
const savedConfig = loadSourceFolderConfig(options.sourcePath);
|
|
386
|
+
const fixedPath = options.fixedPath
|
|
387
|
+
?? (options.fixedName ? options.initial?.path : configuredSourceFolderPath(savedConfig) ?? undefined);
|
|
237
388
|
const compiledConfig = await promptSingleCompiledConfig({
|
|
238
389
|
projectPath: options.sourcePath,
|
|
239
390
|
initial: options.initial,
|
|
240
391
|
...(options.fixedName ? { fixedName: options.fixedName } : {}),
|
|
392
|
+
...(fixedPath ? { fixedPath } : {}),
|
|
241
393
|
introStyle: options.introStyle,
|
|
242
|
-
selectedWorkflowLabel: workflowLabel,
|
|
243
394
|
});
|
|
244
395
|
if (!compiledConfig)
|
|
245
396
|
return null;
|
|
397
|
+
const workflowChoice = await chooseOrCreateCompiledWorkflowForDataset(options.sourcePath, compiledConfig, {
|
|
398
|
+
currentWorkflowId: options.initial?.workflow ?? "interf-default",
|
|
399
|
+
executionProfile: options.executionProfile,
|
|
400
|
+
});
|
|
401
|
+
if (!workflowChoice || p.isCancel(workflowChoice))
|
|
402
|
+
return null;
|
|
403
|
+
const workflowId = String(workflowChoice);
|
|
246
404
|
const compiledConfigWithWorkflow = {
|
|
247
405
|
...compiledConfig,
|
|
406
|
+
method: workflowId,
|
|
248
407
|
workflow: workflowId,
|
|
249
408
|
};
|
|
250
409
|
upsertSourceDatasetConfig(options.sourcePath, compiledConfigWithWorkflow, {
|
|
@@ -254,13 +413,16 @@ async function promptCompiledSetup(options) {
|
|
|
254
413
|
if (builtCompiledPath) {
|
|
255
414
|
syncCompiledInterfConfigFromSourceDatasetConfig(builtCompiledPath, compiledConfigWithWorkflow);
|
|
256
415
|
}
|
|
416
|
+
else {
|
|
417
|
+
ensurePortableContextScaffold(options.sourcePath, compiledConfigWithWorkflow.name, compiledConfigWithWorkflow.workflow ?? "interf-default");
|
|
418
|
+
}
|
|
257
419
|
console.log();
|
|
258
|
-
console.log(chalk.green(` ✓ Saved
|
|
259
|
-
console.log(chalk.dim(`
|
|
260
|
-
console.log(chalk.dim(`
|
|
420
|
+
console.log(chalk.green(` ✓ Saved Preparation in ${SOURCE_FOLDER_CONFIG_PATH}`));
|
|
421
|
+
console.log(chalk.dim(` Interf Workspace: ${options.sourcePath}`));
|
|
422
|
+
console.log(chalk.dim(` Preparation: ${compiledConfigWithWorkflow.name}`));
|
|
261
423
|
console.log(chalk.dim(` Source folder: ${compiledConfigWithWorkflow.path}`));
|
|
262
|
-
console.log(chalk.dim(`
|
|
263
|
-
console.log(chalk.dim(`
|
|
424
|
+
console.log(chalk.dim(` Method: ${workflowId} · interf/methods/${workflowId}/`));
|
|
425
|
+
console.log(chalk.dim(` Prepare mode: ${describeCompileLoopSelection({
|
|
264
426
|
maxAttempts: compiledConfigWithWorkflow.max_attempts,
|
|
265
427
|
maxLoops: compiledConfigWithWorkflow.max_loops,
|
|
266
428
|
})}`));
|
|
@@ -295,7 +457,7 @@ async function runCompiledActionMenu(sourcePath, compiledConfig, options = {}) {
|
|
|
295
457
|
if (!action)
|
|
296
458
|
return;
|
|
297
459
|
if (action === "done") {
|
|
298
|
-
p.outro(options.justConfigured ? "Saved
|
|
460
|
+
p.outro(options.justConfigured ? "Saved Preparation." : "Nothing changed.");
|
|
299
461
|
return;
|
|
300
462
|
}
|
|
301
463
|
if (action === "workflow") {
|
|
@@ -309,6 +471,7 @@ async function runCompiledActionMenu(sourcePath, compiledConfig, options = {}) {
|
|
|
309
471
|
if (typeof workflowId === "string") {
|
|
310
472
|
const nextConfig = {
|
|
311
473
|
...compiledConfig,
|
|
474
|
+
method: workflowId,
|
|
312
475
|
workflow: workflowId,
|
|
313
476
|
};
|
|
314
477
|
upsertSourceDatasetConfig(sourcePath, nextConfig, {
|
|
@@ -318,7 +481,10 @@ async function runCompiledActionMenu(sourcePath, compiledConfig, options = {}) {
|
|
|
318
481
|
if (builtCompiledPath) {
|
|
319
482
|
syncCompiledInterfConfigFromSourceDatasetConfig(builtCompiledPath, nextConfig);
|
|
320
483
|
}
|
|
321
|
-
|
|
484
|
+
else {
|
|
485
|
+
ensurePortableContextScaffold(sourcePath, nextConfig.name, nextConfig.workflow ?? "interf-default");
|
|
486
|
+
}
|
|
487
|
+
p.log.info(`Assigned Method "${workflowId}" to Preparation "${compiledConfig.name}".`);
|
|
322
488
|
p.log.info("Next: run `interf compile`, then `interf test`.");
|
|
323
489
|
}
|
|
324
490
|
return;
|
|
@@ -349,8 +515,8 @@ async function runCompiledActionMenu(sourcePath, compiledConfig, options = {}) {
|
|
|
349
515
|
if (action === "test") {
|
|
350
516
|
if (compiledConfig.checks.length === 0) {
|
|
351
517
|
process.exitCode = 1;
|
|
352
|
-
console.log(chalk.red(`
|
|
353
|
-
console.log(chalk.dim(" Run `interf`, edit this
|
|
518
|
+
console.log(chalk.red(` Preparation "${compiledConfig.name}" does not have any readiness checks yet.`));
|
|
519
|
+
console.log(chalk.dim(" Run `interf`, edit this Preparation, and add a few readiness checks first."));
|
|
354
520
|
console.log(chalk.dim(" Then rerun `interf test`."));
|
|
355
521
|
return;
|
|
356
522
|
}
|
|
@@ -408,7 +574,7 @@ async function runCompiledActionMenu(sourcePath, compiledConfig, options = {}) {
|
|
|
408
574
|
return;
|
|
409
575
|
}
|
|
410
576
|
if (compileResult.testedDuringCompile) {
|
|
411
|
-
p.log.info("This
|
|
577
|
+
p.log.info("This prepare run already checked the Portable Context on the saved readiness checks.");
|
|
412
578
|
p.log.info("Run `interf test` later if you want a fresh side-by-side comparison summary.");
|
|
413
579
|
return;
|
|
414
580
|
}
|
|
@@ -427,14 +593,14 @@ async function runCompiledActionMenu(sourcePath, compiledConfig, options = {}) {
|
|
|
427
593
|
if (compiledConfig.checks.length === 0)
|
|
428
594
|
return;
|
|
429
595
|
if (compileResult.testedDuringCompile) {
|
|
430
|
-
p.log.info("This
|
|
596
|
+
p.log.info("This prepare run already checked the Portable Context on the compile agent.");
|
|
431
597
|
}
|
|
432
598
|
const runCompiledTest = await p.confirm({
|
|
433
599
|
message: compileResult.testedDuringCompile
|
|
434
|
-
? "Run a fresh source-files versus
|
|
600
|
+
? "Run a fresh source-files versus Portable Context comparison now?"
|
|
435
601
|
: builtCompiledPath
|
|
436
|
-
? "Run source files and
|
|
437
|
-
: "
|
|
602
|
+
? "Run readiness checks on source files and Portable Context now?"
|
|
603
|
+
: "Run readiness checks on source files and Portable Context now?",
|
|
438
604
|
initialValue: true,
|
|
439
605
|
});
|
|
440
606
|
if (p.isCancel(runCompiledTest) || !runCompiledTest)
|
|
@@ -450,30 +616,119 @@ async function runCompiledActionMenu(sourcePath, compiledConfig, options = {}) {
|
|
|
450
616
|
}
|
|
451
617
|
export const initCommand = {
|
|
452
618
|
command: "init",
|
|
453
|
-
describe: "
|
|
619
|
+
describe: "Set up Interf or open the Preparation wizard",
|
|
454
620
|
handler: async () => {
|
|
455
621
|
await runInitCommand();
|
|
456
622
|
},
|
|
457
623
|
};
|
|
458
624
|
export async function runInitCommand() {
|
|
459
625
|
p.intro(chalk.bold("Interf"));
|
|
460
|
-
p.log.info("Interf prepares
|
|
461
|
-
p.log.info("
|
|
626
|
+
p.log.info("Interf prepares data for agent work.");
|
|
627
|
+
p.log.info("It runs locally to process files, show evidence that your data is ready, and write verifiable outputs as Portable Context for agents.");
|
|
462
628
|
const cwd = process.cwd();
|
|
463
629
|
const detected = detectInterf(cwd);
|
|
464
|
-
|
|
630
|
+
let initContext = detected
|
|
631
|
+
? {
|
|
632
|
+
controlPath: resolveSourceControlPath(detected.path),
|
|
633
|
+
defaultSourceFolderPath: null,
|
|
634
|
+
defaultPreparationPath: null,
|
|
635
|
+
}
|
|
636
|
+
: resolveInterfInstanceContext(cwd);
|
|
637
|
+
let sourcePath = initContext.controlPath;
|
|
465
638
|
if (detected) {
|
|
466
|
-
p.log.info(`Working from
|
|
639
|
+
p.log.info(`Working from Interf Workspace: ${sourcePath}`);
|
|
467
640
|
}
|
|
468
|
-
const
|
|
469
|
-
|
|
470
|
-
|
|
641
|
+
const hasConfig = Boolean(loadSourceFolderConfig(sourcePath));
|
|
642
|
+
let initialSourceFolderPath = initContext.defaultSourceFolderPath;
|
|
643
|
+
let initialSourceFolderConfigPath = initContext.defaultPreparationPath;
|
|
644
|
+
if (!detected && !hasConfig) {
|
|
645
|
+
const setup = await setupInterfInstance(cwd);
|
|
646
|
+
if (!setup)
|
|
647
|
+
return;
|
|
648
|
+
sourcePath = setup.controlPath;
|
|
649
|
+
initialSourceFolderPath = setup.sourceFolderPath;
|
|
650
|
+
initialSourceFolderConfigPath = setup.sourceFolderConfigPath;
|
|
651
|
+
initContext = {
|
|
652
|
+
controlPath: sourcePath,
|
|
653
|
+
defaultSourceFolderPath: initialSourceFolderPath,
|
|
654
|
+
defaultPreparationPath: initialSourceFolderConfigPath,
|
|
655
|
+
};
|
|
656
|
+
}
|
|
657
|
+
else {
|
|
658
|
+
const seeded = seedLocalDefaultWorkflow({ sourcePath });
|
|
659
|
+
if (!seeded.alreadyExisted) {
|
|
660
|
+
p.log.info(`Copied built-in Method package to interf/methods/${seeded.workflowId}/. Inspect or fork it anytime.`);
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
let currentConfig = loadSourceFolderConfig(sourcePath);
|
|
664
|
+
if (!currentConfig?.source_folder && !detected) {
|
|
665
|
+
const currentEntries = currentConfig?.preparations ?? currentConfig?.datasets ?? [];
|
|
666
|
+
if (initialSourceFolderPath && initialSourceFolderConfigPath) {
|
|
667
|
+
saveSourceFolderConfig(sourcePath, {
|
|
668
|
+
source_folder: { path: initialSourceFolderConfigPath },
|
|
669
|
+
preparations: currentEntries,
|
|
670
|
+
});
|
|
671
|
+
currentConfig = loadSourceFolderConfig(sourcePath);
|
|
672
|
+
}
|
|
673
|
+
else if (currentConfig && currentEntries.length === 0) {
|
|
674
|
+
const sourceFolderPath = await promptSourceFolderForInstance(cwd);
|
|
675
|
+
if (!sourceFolderPath)
|
|
676
|
+
return;
|
|
677
|
+
const sourceFolderConfigPath = relativeSourceFolderPath(sourcePath, sourceFolderPath);
|
|
678
|
+
saveSourceFolderConfig(sourcePath, {
|
|
679
|
+
source_folder: { path: sourceFolderConfigPath },
|
|
680
|
+
preparations: [],
|
|
681
|
+
});
|
|
682
|
+
initialSourceFolderPath = sourceFolderPath;
|
|
683
|
+
initialSourceFolderConfigPath = sourceFolderConfigPath;
|
|
684
|
+
currentConfig = loadSourceFolderConfig(sourcePath);
|
|
685
|
+
p.log.info(`Source Folder: ${sourceFolderPath}`);
|
|
686
|
+
p.log.info(`Source Folder path in Interf config: ${sourceFolderConfigPath}`);
|
|
687
|
+
}
|
|
688
|
+
else if (!currentConfig) {
|
|
689
|
+
const setup = await setupInterfInstance(cwd);
|
|
690
|
+
if (!setup)
|
|
691
|
+
return;
|
|
692
|
+
sourcePath = setup.controlPath;
|
|
693
|
+
initialSourceFolderPath = setup.sourceFolderPath;
|
|
694
|
+
initialSourceFolderConfigPath = setup.sourceFolderConfigPath;
|
|
695
|
+
currentConfig = loadSourceFolderConfig(sourcePath);
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
const configuredSourcePath = resolveConfiguredSourceFolderPath(sourcePath, currentConfig);
|
|
699
|
+
const configuredSourceConfigPath = configuredSourceFolderPath(currentConfig);
|
|
700
|
+
if (configuredSourcePath && configuredSourceConfigPath) {
|
|
701
|
+
initialSourceFolderPath = configuredSourcePath;
|
|
702
|
+
initialSourceFolderConfigPath = configuredSourceConfigPath;
|
|
471
703
|
}
|
|
472
704
|
const savedEntries = listSavedCompiledEntries(sourcePath);
|
|
473
705
|
if (savedEntries.length === 0) {
|
|
706
|
+
p.log.info("No Preparations yet. Create one when you are ready to describe the agent work.");
|
|
707
|
+
const action = await promptEmptyInstanceAction();
|
|
708
|
+
if (!action || action === "done") {
|
|
709
|
+
p.outro("Interf Workspace is ready. Next: run `interf web` or `interf create preparation`.");
|
|
710
|
+
return;
|
|
711
|
+
}
|
|
712
|
+
if (action === "web") {
|
|
713
|
+
await runWebCommand({ "control-path": sourcePath });
|
|
714
|
+
return;
|
|
715
|
+
}
|
|
716
|
+
if (action === "method") {
|
|
717
|
+
const workflowId = await createWorkflowWizard({ sourcePath });
|
|
718
|
+
if (typeof workflowId === "string") {
|
|
719
|
+
p.outro(`Saved Method "${workflowId}". Next: create a Preparation and assign this Method.`);
|
|
720
|
+
}
|
|
721
|
+
return;
|
|
722
|
+
}
|
|
474
723
|
const compiledConfig = await promptCompiledSetup({
|
|
475
724
|
sourcePath,
|
|
476
|
-
initial:
|
|
725
|
+
initial: initialSourceFolderPath && initialSourceFolderConfigPath
|
|
726
|
+
? {
|
|
727
|
+
name: defaultDatasetNameForPath(initialSourceFolderPath),
|
|
728
|
+
path: initialSourceFolderConfigPath,
|
|
729
|
+
}
|
|
730
|
+
: { name: DEFAULT_COMPILED_NAME },
|
|
731
|
+
...(initialSourceFolderConfigPath ? { fixedPath: initialSourceFolderConfigPath } : {}),
|
|
477
732
|
introStyle: "first",
|
|
478
733
|
});
|
|
479
734
|
if (!compiledConfig)
|
|
@@ -490,7 +745,13 @@ export async function runInitCommand() {
|
|
|
490
745
|
if (selectedCompiled === "__new__") {
|
|
491
746
|
const compiledConfig = await promptCompiledSetup({
|
|
492
747
|
sourcePath,
|
|
493
|
-
initial:
|
|
748
|
+
initial: initialSourceFolderPath && initialSourceFolderConfigPath
|
|
749
|
+
? {
|
|
750
|
+
name: defaultDatasetNameForPath(initialSourceFolderPath),
|
|
751
|
+
path: initialSourceFolderConfigPath,
|
|
752
|
+
}
|
|
753
|
+
: { name: DEFAULT_COMPILED_NAME },
|
|
754
|
+
...(initialSourceFolderConfigPath ? { fixedPath: initialSourceFolderConfigPath } : {}),
|
|
494
755
|
introStyle: "additional",
|
|
495
756
|
});
|
|
496
757
|
if (!compiledConfig)
|