@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,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 {
|
|
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";
|
|
7
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) {
|
|
@@ -69,30 +221,30 @@ async function promptDatasetAction(dataset, built, latestComparison) {
|
|
|
69
221
|
latestComparison.raw.passed_cases === latestComparison.raw.total_cases;
|
|
70
222
|
const compileOption = {
|
|
71
223
|
value: "compile",
|
|
72
|
-
label: built ? "
|
|
224
|
+
label: built ? "Prepare again and refresh Portable Context" : "Prepare files and write Portable Context (Recommended)",
|
|
73
225
|
hint: built
|
|
74
226
|
? "Refresh it from the current source files"
|
|
75
227
|
: dataset.checks.length > 0
|
|
76
228
|
? latestRawPasses
|
|
77
|
-
? "
|
|
229
|
+
? "Prepare files for a side-by-side comparison with the latest saved source-files run"
|
|
78
230
|
: hasSavedRawBaseline
|
|
79
|
-
? "Some
|
|
80
|
-
: "Run the selected
|
|
81
|
-
: "
|
|
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",
|
|
82
234
|
};
|
|
83
235
|
if (dataset.checks.length > 0) {
|
|
84
236
|
const testOption = {
|
|
85
237
|
value: "test",
|
|
86
238
|
label: built
|
|
87
|
-
? "
|
|
239
|
+
? "Run readiness checks on source files and Portable Context (Recommended)"
|
|
88
240
|
: hasSavedRawBaseline
|
|
89
241
|
? "Rerun the source-files baseline"
|
|
90
242
|
: "Measure the source-files baseline",
|
|
91
243
|
hint: built
|
|
92
|
-
? "See whether the
|
|
244
|
+
? "See whether the Portable Context is ready for your agents on the saved checks"
|
|
93
245
|
: hasSavedRawBaseline
|
|
94
|
-
? "Refresh the saved source-files baseline on the current
|
|
95
|
-
: "Optional
|
|
246
|
+
? "Refresh the saved source-files baseline on the current readiness checks"
|
|
247
|
+
: "Optional source-files readiness baseline before Interf builds Portable Context",
|
|
96
248
|
};
|
|
97
249
|
if (built) {
|
|
98
250
|
options.push(testOption, compileOption);
|
|
@@ -106,16 +258,16 @@ async function promptDatasetAction(dataset, built, latestComparison) {
|
|
|
106
258
|
}
|
|
107
259
|
options.push({
|
|
108
260
|
value: "dataset",
|
|
109
|
-
label: "Add another
|
|
110
|
-
hint: "Add a separate folder, focus, or
|
|
261
|
+
label: "Add another Preparation",
|
|
262
|
+
hint: "Add a separate folder, focus, or readiness-check set",
|
|
111
263
|
}, {
|
|
112
264
|
value: "edit",
|
|
113
|
-
label: "Edit
|
|
114
|
-
hint: "Update
|
|
265
|
+
label: "Edit readiness checks and settings",
|
|
266
|
+
hint: "Update readiness checks, focus, Method, or prepare mode",
|
|
115
267
|
}, {
|
|
116
268
|
value: "workflow",
|
|
117
|
-
label: "Create
|
|
118
|
-
hint: "Advanced: customize
|
|
269
|
+
label: "Create Method",
|
|
270
|
+
hint: "Advanced: customize how Interf prepares files",
|
|
119
271
|
}, {
|
|
120
272
|
value: "done",
|
|
121
273
|
label: "Done",
|
|
@@ -131,20 +283,20 @@ async function promptDatasetAction(dataset, built, latestComparison) {
|
|
|
131
283
|
}
|
|
132
284
|
function printDatasetRecommendation(dataset, built, latestComparison) {
|
|
133
285
|
if (dataset.checks.length === 0) {
|
|
134
|
-
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.");
|
|
135
287
|
return;
|
|
136
288
|
}
|
|
137
289
|
if (!built) {
|
|
138
290
|
if (latestComparison?.raw) {
|
|
139
291
|
p.log.info(latestComparison.raw.passed_cases === latestComparison.raw.total_cases
|
|
140
|
-
? `Latest source-files run: ${latestComparison.raw.passed_cases}/${latestComparison.raw.total_cases}.
|
|
141
|
-
: `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.`);
|
|
142
294
|
return;
|
|
143
295
|
}
|
|
144
|
-
p.log.info("Recommended first step: choose a
|
|
296
|
+
p.log.info("Recommended first step: choose a Method and prepare files.");
|
|
145
297
|
return;
|
|
146
298
|
}
|
|
147
|
-
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.");
|
|
148
300
|
}
|
|
149
301
|
async function promptPostBaselineAction(rows) {
|
|
150
302
|
const status = currentRunTargetStatus(rows, "raw");
|
|
@@ -165,28 +317,28 @@ async function promptPostBaselineAction(rows) {
|
|
|
165
317
|
{
|
|
166
318
|
value: "compile",
|
|
167
319
|
label: compileRecommended
|
|
168
|
-
? "
|
|
169
|
-
: "
|
|
320
|
+
? "Prepare files and write Portable Context (Recommended)"
|
|
321
|
+
: "Prepare files and write Portable Context",
|
|
170
322
|
hint: compileRecommended
|
|
171
323
|
? status === "mixed"
|
|
172
|
-
? "Some selected agents still failed on the source files.
|
|
173
|
-
: "
|
|
174
|
-
: "
|
|
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",
|
|
175
327
|
},
|
|
176
328
|
{
|
|
177
329
|
value: "edit",
|
|
178
|
-
label: "Change
|
|
179
|
-
hint: "Revise the
|
|
330
|
+
label: "Change readiness checks and settings",
|
|
331
|
+
hint: "Revise the readiness checks or Preparation settings before the next run",
|
|
180
332
|
},
|
|
181
333
|
{
|
|
182
334
|
value: "rerun",
|
|
183
335
|
label: "Rerun the source-files baseline",
|
|
184
|
-
hint: "Run the same
|
|
336
|
+
hint: "Run the same readiness checks again, including different local agents if you want",
|
|
185
337
|
},
|
|
186
338
|
{
|
|
187
339
|
value: "done",
|
|
188
340
|
label: "Stop here",
|
|
189
|
-
hint: "Leave the
|
|
341
|
+
hint: "Leave the Preparation as-is for now",
|
|
190
342
|
},
|
|
191
343
|
],
|
|
192
344
|
});
|
|
@@ -204,22 +356,22 @@ async function chooseCompiledForWizard(options) {
|
|
|
204
356
|
if (savedEntries.length === 1)
|
|
205
357
|
return savedEntries[0]?.config ?? null;
|
|
206
358
|
const selected = await p.select({
|
|
207
|
-
message: "Which
|
|
359
|
+
message: "Which saved Preparation do you want to work with?",
|
|
208
360
|
options: [
|
|
209
361
|
...savedEntries.map((entry) => ({
|
|
210
362
|
value: entry.config.name,
|
|
211
363
|
label: entry.config.name,
|
|
212
364
|
hint: [
|
|
213
365
|
`path ${entry.config.path}`,
|
|
214
|
-
entry.config.about ??
|
|
215
|
-
`
|
|
216
|
-
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",
|
|
217
369
|
].join(" · "),
|
|
218
370
|
})),
|
|
219
371
|
{
|
|
220
372
|
value: "__new__",
|
|
221
|
-
label: "Add another
|
|
222
|
-
hint: "Add a separate folder, focus, or
|
|
373
|
+
label: "Add another Preparation",
|
|
374
|
+
hint: "Add a separate folder, focus, or readiness-check set",
|
|
223
375
|
},
|
|
224
376
|
],
|
|
225
377
|
});
|
|
@@ -230,10 +382,14 @@ async function chooseCompiledForWizard(options) {
|
|
|
230
382
|
return findSavedCompiledConfig(options.sourcePath, String(selected));
|
|
231
383
|
}
|
|
232
384
|
async function promptCompiledSetup(options) {
|
|
385
|
+
const savedConfig = loadSourceFolderConfig(options.sourcePath);
|
|
386
|
+
const fixedPath = options.fixedPath
|
|
387
|
+
?? (options.fixedName ? options.initial?.path : configuredSourceFolderPath(savedConfig) ?? undefined);
|
|
233
388
|
const compiledConfig = await promptSingleCompiledConfig({
|
|
234
389
|
projectPath: options.sourcePath,
|
|
235
390
|
initial: options.initial,
|
|
236
391
|
...(options.fixedName ? { fixedName: options.fixedName } : {}),
|
|
392
|
+
...(fixedPath ? { fixedPath } : {}),
|
|
237
393
|
introStyle: options.introStyle,
|
|
238
394
|
});
|
|
239
395
|
if (!compiledConfig)
|
|
@@ -247,6 +403,7 @@ async function promptCompiledSetup(options) {
|
|
|
247
403
|
const workflowId = String(workflowChoice);
|
|
248
404
|
const compiledConfigWithWorkflow = {
|
|
249
405
|
...compiledConfig,
|
|
406
|
+
method: workflowId,
|
|
250
407
|
workflow: workflowId,
|
|
251
408
|
};
|
|
252
409
|
upsertSourceDatasetConfig(options.sourcePath, compiledConfigWithWorkflow, {
|
|
@@ -260,12 +417,12 @@ async function promptCompiledSetup(options) {
|
|
|
260
417
|
ensurePortableContextScaffold(options.sourcePath, compiledConfigWithWorkflow.name, compiledConfigWithWorkflow.workflow ?? "interf-default");
|
|
261
418
|
}
|
|
262
419
|
console.log();
|
|
263
|
-
console.log(chalk.green(` ✓ Saved
|
|
264
|
-
console.log(chalk.dim(`
|
|
265
|
-
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}`));
|
|
266
423
|
console.log(chalk.dim(` Source folder: ${compiledConfigWithWorkflow.path}`));
|
|
267
|
-
console.log(chalk.dim(`
|
|
268
|
-
console.log(chalk.dim(`
|
|
424
|
+
console.log(chalk.dim(` Method: ${workflowId} · interf/methods/${workflowId}/`));
|
|
425
|
+
console.log(chalk.dim(` Prepare mode: ${describeCompileLoopSelection({
|
|
269
426
|
maxAttempts: compiledConfigWithWorkflow.max_attempts,
|
|
270
427
|
maxLoops: compiledConfigWithWorkflow.max_loops,
|
|
271
428
|
})}`));
|
|
@@ -300,7 +457,7 @@ async function runCompiledActionMenu(sourcePath, compiledConfig, options = {}) {
|
|
|
300
457
|
if (!action)
|
|
301
458
|
return;
|
|
302
459
|
if (action === "done") {
|
|
303
|
-
p.outro(options.justConfigured ? "Saved
|
|
460
|
+
p.outro(options.justConfigured ? "Saved Preparation." : "Nothing changed.");
|
|
304
461
|
return;
|
|
305
462
|
}
|
|
306
463
|
if (action === "workflow") {
|
|
@@ -314,6 +471,7 @@ async function runCompiledActionMenu(sourcePath, compiledConfig, options = {}) {
|
|
|
314
471
|
if (typeof workflowId === "string") {
|
|
315
472
|
const nextConfig = {
|
|
316
473
|
...compiledConfig,
|
|
474
|
+
method: workflowId,
|
|
317
475
|
workflow: workflowId,
|
|
318
476
|
};
|
|
319
477
|
upsertSourceDatasetConfig(sourcePath, nextConfig, {
|
|
@@ -326,7 +484,7 @@ async function runCompiledActionMenu(sourcePath, compiledConfig, options = {}) {
|
|
|
326
484
|
else {
|
|
327
485
|
ensurePortableContextScaffold(sourcePath, nextConfig.name, nextConfig.workflow ?? "interf-default");
|
|
328
486
|
}
|
|
329
|
-
p.log.info(`Assigned
|
|
487
|
+
p.log.info(`Assigned Method "${workflowId}" to Preparation "${compiledConfig.name}".`);
|
|
330
488
|
p.log.info("Next: run `interf compile`, then `interf test`.");
|
|
331
489
|
}
|
|
332
490
|
return;
|
|
@@ -357,8 +515,8 @@ async function runCompiledActionMenu(sourcePath, compiledConfig, options = {}) {
|
|
|
357
515
|
if (action === "test") {
|
|
358
516
|
if (compiledConfig.checks.length === 0) {
|
|
359
517
|
process.exitCode = 1;
|
|
360
|
-
console.log(chalk.red(`
|
|
361
|
-
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."));
|
|
362
520
|
console.log(chalk.dim(" Then rerun `interf test`."));
|
|
363
521
|
return;
|
|
364
522
|
}
|
|
@@ -416,7 +574,7 @@ async function runCompiledActionMenu(sourcePath, compiledConfig, options = {}) {
|
|
|
416
574
|
return;
|
|
417
575
|
}
|
|
418
576
|
if (compileResult.testedDuringCompile) {
|
|
419
|
-
p.log.info("This
|
|
577
|
+
p.log.info("This prepare run already checked the Portable Context on the saved readiness checks.");
|
|
420
578
|
p.log.info("Run `interf test` later if you want a fresh side-by-side comparison summary.");
|
|
421
579
|
return;
|
|
422
580
|
}
|
|
@@ -435,14 +593,14 @@ async function runCompiledActionMenu(sourcePath, compiledConfig, options = {}) {
|
|
|
435
593
|
if (compiledConfig.checks.length === 0)
|
|
436
594
|
return;
|
|
437
595
|
if (compileResult.testedDuringCompile) {
|
|
438
|
-
p.log.info("This
|
|
596
|
+
p.log.info("This prepare run already checked the Portable Context on the compile agent.");
|
|
439
597
|
}
|
|
440
598
|
const runCompiledTest = await p.confirm({
|
|
441
599
|
message: compileResult.testedDuringCompile
|
|
442
|
-
? "Run a fresh source-files versus
|
|
600
|
+
? "Run a fresh source-files versus Portable Context comparison now?"
|
|
443
601
|
: builtCompiledPath
|
|
444
|
-
? "Run source files and
|
|
445
|
-
: "
|
|
602
|
+
? "Run readiness checks on source files and Portable Context now?"
|
|
603
|
+
: "Run readiness checks on source files and Portable Context now?",
|
|
446
604
|
initialValue: true,
|
|
447
605
|
});
|
|
448
606
|
if (p.isCancel(runCompiledTest) || !runCompiledTest)
|
|
@@ -458,7 +616,7 @@ async function runCompiledActionMenu(sourcePath, compiledConfig, options = {}) {
|
|
|
458
616
|
}
|
|
459
617
|
export const initCommand = {
|
|
460
618
|
command: "init",
|
|
461
|
-
describe: "
|
|
619
|
+
describe: "Set up Interf or open the Preparation wizard",
|
|
462
620
|
handler: async () => {
|
|
463
621
|
await runInitCommand();
|
|
464
622
|
},
|
|
@@ -466,25 +624,111 @@ export const initCommand = {
|
|
|
466
624
|
export async function runInitCommand() {
|
|
467
625
|
p.intro(chalk.bold("Interf"));
|
|
468
626
|
p.log.info("Interf prepares data for agent work.");
|
|
469
|
-
p.log.info("
|
|
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.");
|
|
470
628
|
const cwd = process.cwd();
|
|
471
629
|
const detected = detectInterf(cwd);
|
|
472
|
-
|
|
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;
|
|
473
638
|
if (detected) {
|
|
474
|
-
p.log.info(`Working from
|
|
639
|
+
p.log.info(`Working from Interf Workspace: ${sourcePath}`);
|
|
475
640
|
}
|
|
476
|
-
|
|
477
|
-
|
|
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
|
+
};
|
|
478
656
|
}
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
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;
|
|
482
703
|
}
|
|
483
704
|
const savedEntries = listSavedCompiledEntries(sourcePath);
|
|
484
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
|
+
}
|
|
485
723
|
const compiledConfig = await promptCompiledSetup({
|
|
486
724
|
sourcePath,
|
|
487
|
-
initial:
|
|
725
|
+
initial: initialSourceFolderPath && initialSourceFolderConfigPath
|
|
726
|
+
? {
|
|
727
|
+
name: defaultDatasetNameForPath(initialSourceFolderPath),
|
|
728
|
+
path: initialSourceFolderConfigPath,
|
|
729
|
+
}
|
|
730
|
+
: { name: DEFAULT_COMPILED_NAME },
|
|
731
|
+
...(initialSourceFolderConfigPath ? { fixedPath: initialSourceFolderConfigPath } : {}),
|
|
488
732
|
introStyle: "first",
|
|
489
733
|
});
|
|
490
734
|
if (!compiledConfig)
|
|
@@ -501,7 +745,13 @@ export async function runInitCommand() {
|
|
|
501
745
|
if (selectedCompiled === "__new__") {
|
|
502
746
|
const compiledConfig = await promptCompiledSetup({
|
|
503
747
|
sourcePath,
|
|
504
|
-
initial:
|
|
748
|
+
initial: initialSourceFolderPath && initialSourceFolderConfigPath
|
|
749
|
+
? {
|
|
750
|
+
name: defaultDatasetNameForPath(initialSourceFolderPath),
|
|
751
|
+
path: initialSourceFolderConfigPath,
|
|
752
|
+
}
|
|
753
|
+
: { name: DEFAULT_COMPILED_NAME },
|
|
754
|
+
...(initialSourceFolderConfigPath ? { fixedPath: initialSourceFolderConfigPath } : {}),
|
|
505
755
|
introStyle: "additional",
|
|
506
756
|
});
|
|
507
757
|
if (!compiledConfig)
|