@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,6 +1,6 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
|
-
import { existsSync, mkdirSync,
|
|
3
|
-
import { join, relative, resolve, sep } from "node:path";
|
|
2
|
+
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
4
4
|
import { refreshCompiledBootstrapGuidance } from "../agents/lib/compiled-bootstrap.js";
|
|
5
5
|
import { readInterfConfig, } from "./interf.js";
|
|
6
6
|
import { seedCompiledWorkflowPackage } from "../workflow-package/interf-workflow-package.js";
|
|
@@ -8,7 +8,7 @@ import { readJsonFileWithSchema } from "../shared/parse.js";
|
|
|
8
8
|
import { getCompiledWorkflow } from "../workflow-package/workflow-definitions.js";
|
|
9
9
|
import { SourceFolderConfigSchema, } from "./lib/schema.js";
|
|
10
10
|
import { slugify } from "../shared/naming.js";
|
|
11
|
-
import { assertPathWithinRoot } from "../shared/path-guards.js";
|
|
11
|
+
import { assertPathWithinRoot, isPathWithinRoot } from "../shared/path-guards.js";
|
|
12
12
|
import { defaultControlPathForCompiled, resolveSourceControlPathForCompiled, compiledInterfConfigPath, compiledInterfRoot, } from "../compiler/compiled-paths.js";
|
|
13
13
|
import { projectInterfRoot, PROJECT_INTERF_DIR } from "./project-paths.js";
|
|
14
14
|
export const SOURCE_FOLDER_CONFIG_FILE = "interf.json";
|
|
@@ -16,56 +16,13 @@ export const SOURCE_FOLDER_CONFIG_PATH = `${PROJECT_INTERF_DIR}/${SOURCE_FOLDER_
|
|
|
16
16
|
export function sourceFolderConfigPath(sourcePath) {
|
|
17
17
|
return join(projectInterfRoot(sourcePath), SOURCE_FOLDER_CONFIG_FILE);
|
|
18
18
|
}
|
|
19
|
-
export function legacySourceFolderConfigPath(sourcePath) {
|
|
20
|
-
return join(sourcePath, SOURCE_FOLDER_CONFIG_FILE);
|
|
21
|
-
}
|
|
22
19
|
export function resolveSourceFolderConfigPath(sourcePath) {
|
|
23
|
-
|
|
24
|
-
if (existsSync(primaryPath))
|
|
25
|
-
return primaryPath;
|
|
26
|
-
const legacyPath = legacySourceFolderConfigPath(sourcePath);
|
|
27
|
-
if (existsSync(legacyPath))
|
|
28
|
-
return legacyPath;
|
|
29
|
-
return primaryPath;
|
|
20
|
+
return sourceFolderConfigPath(sourcePath);
|
|
30
21
|
}
|
|
31
22
|
function readSourceFolderConfigFile(filePath) {
|
|
32
23
|
return readJsonFileWithSchema(filePath, "Interf project config", SourceFolderConfigSchema);
|
|
33
24
|
}
|
|
34
|
-
function
|
|
35
|
-
try {
|
|
36
|
-
return JSON.parse(readFileSync(filePath, "utf-8"));
|
|
37
|
-
}
|
|
38
|
-
catch {
|
|
39
|
-
return null;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
function isValidLegacySourceFolderConfig(sourcePath) {
|
|
43
|
-
const legacyPath = legacySourceFolderConfigPath(sourcePath);
|
|
44
|
-
if (!existsSync(legacyPath))
|
|
45
|
-
return false;
|
|
46
|
-
const raw = readJsonFileUncheckedQuiet(legacyPath);
|
|
47
|
-
return SourceFolderConfigSchema.safeParse(raw).success;
|
|
48
|
-
}
|
|
49
|
-
export function migrateLegacySourceFolderConfig(sourcePath) {
|
|
50
|
-
const primaryPath = sourceFolderConfigPath(sourcePath);
|
|
51
|
-
const legacyPath = legacySourceFolderConfigPath(sourcePath);
|
|
52
|
-
if (existsSync(primaryPath) || !existsSync(legacyPath))
|
|
53
|
-
return false;
|
|
54
|
-
if (!isValidLegacySourceFolderConfig(sourcePath))
|
|
55
|
-
return false;
|
|
56
|
-
mkdirSync(projectInterfRoot(sourcePath), { recursive: true });
|
|
57
|
-
renameSync(legacyPath, primaryPath);
|
|
58
|
-
return true;
|
|
59
|
-
}
|
|
60
|
-
function removeLegacySourceFolderConfig(sourcePath) {
|
|
61
|
-
const legacyPath = legacySourceFolderConfigPath(sourcePath);
|
|
62
|
-
if (!existsSync(legacyPath))
|
|
63
|
-
return;
|
|
64
|
-
if (!isValidLegacySourceFolderConfig(sourcePath))
|
|
65
|
-
return;
|
|
66
|
-
rmSync(legacyPath, { force: true });
|
|
67
|
-
}
|
|
68
|
-
function normalizeTruthChecks(cases) {
|
|
25
|
+
function normalizeReadinessChecks(cases) {
|
|
69
26
|
const seen = new Set();
|
|
70
27
|
return cases.map((caseSpec, index) => {
|
|
71
28
|
const baseId = slugify(caseSpec.id ?? caseSpec.question) || `check-${index + 1}`;
|
|
@@ -85,7 +42,7 @@ function normalizeTruthChecks(cases) {
|
|
|
85
42
|
};
|
|
86
43
|
});
|
|
87
44
|
}
|
|
88
|
-
export function
|
|
45
|
+
export function fingerprintReadinessChecks(checks) {
|
|
89
46
|
const normalized = checks.map((check) => ({
|
|
90
47
|
question: check.question.trim(),
|
|
91
48
|
...(check.answer ? { answer: check.answer.trim() } : {}),
|
|
@@ -103,9 +60,24 @@ export function loadSourceFolderConfig(sourcePath) {
|
|
|
103
60
|
return null;
|
|
104
61
|
return readSourceFolderConfigFile(filePath);
|
|
105
62
|
}
|
|
106
|
-
export function
|
|
107
|
-
return
|
|
63
|
+
export function methodIdForSourcePreparationConfig(preparationConfig) {
|
|
64
|
+
return preparationConfig?.method ?? preparationConfig?.workflow ?? null;
|
|
65
|
+
}
|
|
66
|
+
function normalizeSourcePreparationConfig(preparationConfig) {
|
|
67
|
+
const method = methodIdForSourcePreparationConfig(preparationConfig);
|
|
68
|
+
return {
|
|
69
|
+
...preparationConfig,
|
|
70
|
+
...(method ? { method } : {}),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
export function listSourcePreparationConfigs(config) {
|
|
74
|
+
const explicitPreparations = config?.preparations ?? [];
|
|
75
|
+
const preparations = explicitPreparations.length > 0
|
|
76
|
+
? explicitPreparations
|
|
77
|
+
: config?.datasets ?? [];
|
|
78
|
+
return preparations.map((preparation) => normalizeSourcePreparationConfig(preparation));
|
|
108
79
|
}
|
|
80
|
+
export const listSourceDatasetConfigs = listSourcePreparationConfigs;
|
|
109
81
|
export function resolveDatasetCompileMaxAttempts(datasetConfig, override = null) {
|
|
110
82
|
const configured = override ?? datasetConfig.max_attempts ?? null;
|
|
111
83
|
if (configured == null)
|
|
@@ -124,73 +96,98 @@ export function resolveDatasetCompileMaxLoops(datasetConfig, override = null) {
|
|
|
124
96
|
return 1;
|
|
125
97
|
return Math.min(3, normalized);
|
|
126
98
|
}
|
|
127
|
-
export function
|
|
128
|
-
const
|
|
129
|
-
return
|
|
99
|
+
export function getDefaultSourcePreparationConfig(config) {
|
|
100
|
+
const preparations = listSourcePreparationConfigs(config);
|
|
101
|
+
return preparations[0] ?? null;
|
|
102
|
+
}
|
|
103
|
+
export const getDefaultSourceDatasetConfig = getDefaultSourcePreparationConfig;
|
|
104
|
+
export function findSourcePreparationConfig(config, preparationName) {
|
|
105
|
+
return listSourcePreparationConfigs(config).find((preparation) => preparation.name === preparationName) ?? null;
|
|
106
|
+
}
|
|
107
|
+
export const findSourceDatasetConfig = findSourcePreparationConfig;
|
|
108
|
+
export function configuredSourceFolderPath(config) {
|
|
109
|
+
return config?.source_folder?.path ?? null;
|
|
130
110
|
}
|
|
131
|
-
export function
|
|
132
|
-
|
|
111
|
+
export function resolveConfiguredSourceFolderPath(sourcePath, config = loadSourceFolderConfig(sourcePath)) {
|
|
112
|
+
const configuredPath = configuredSourceFolderPath(config);
|
|
113
|
+
return configuredPath ? resolve(sourcePath, configuredPath) : null;
|
|
133
114
|
}
|
|
134
115
|
function toWritableSourceProjectConfig(config) {
|
|
135
|
-
const
|
|
136
|
-
|
|
116
|
+
const explicitPreparations = config?.preparations ?? [];
|
|
117
|
+
const preparations = explicitPreparations.length > 0
|
|
118
|
+
? explicitPreparations
|
|
119
|
+
: config?.datasets ?? [];
|
|
120
|
+
const sourceFolder = config?.source_folder;
|
|
121
|
+
if (preparations.length > 0) {
|
|
137
122
|
return {
|
|
138
|
-
|
|
123
|
+
...(sourceFolder ? { source_folder: sourceFolder } : {}),
|
|
124
|
+
preparations: preparations.map((preparation) => toWritableSourcePreparationConfig(preparation)),
|
|
139
125
|
};
|
|
140
126
|
}
|
|
141
|
-
return {
|
|
127
|
+
return {
|
|
128
|
+
...(sourceFolder ? { source_folder: sourceFolder } : {}),
|
|
129
|
+
preparations: [],
|
|
130
|
+
};
|
|
142
131
|
}
|
|
143
|
-
function
|
|
132
|
+
function toWritableSourcePreparationConfig(preparation) {
|
|
133
|
+
const method = methodIdForSourcePreparationConfig(preparation);
|
|
144
134
|
return {
|
|
145
|
-
name:
|
|
146
|
-
path:
|
|
147
|
-
...(
|
|
148
|
-
...(
|
|
149
|
-
...(typeof
|
|
150
|
-
...(typeof
|
|
151
|
-
checks:
|
|
135
|
+
name: preparation.name,
|
|
136
|
+
path: preparation.path,
|
|
137
|
+
...(preparation.about ? { about: preparation.about } : {}),
|
|
138
|
+
...(method && method !== "interf" ? { method } : {}),
|
|
139
|
+
...(typeof preparation.max_attempts === "number" ? { max_attempts: preparation.max_attempts } : {}),
|
|
140
|
+
...(typeof preparation.max_loops === "number" ? { max_loops: preparation.max_loops } : {}),
|
|
141
|
+
checks: preparation.checks,
|
|
152
142
|
};
|
|
153
143
|
}
|
|
144
|
+
const toWritableSourceDatasetConfig = toWritableSourcePreparationConfig;
|
|
154
145
|
export function saveSourceFolderConfig(sourcePath, config) {
|
|
146
|
+
const existing = loadSourceFolderConfig(sourcePath);
|
|
147
|
+
const mergedConfig = {
|
|
148
|
+
...(existing?.source_folder && !config.source_folder ? { source_folder: existing.source_folder } : {}),
|
|
149
|
+
...config,
|
|
150
|
+
};
|
|
155
151
|
mkdirSync(projectInterfRoot(sourcePath), { recursive: true });
|
|
156
|
-
writeFileSync(sourceFolderConfigPath(sourcePath), JSON.stringify(toWritableSourceProjectConfig(
|
|
157
|
-
removeLegacySourceFolderConfig(sourcePath);
|
|
152
|
+
writeFileSync(sourceFolderConfigPath(sourcePath), JSON.stringify(toWritableSourceProjectConfig(mergedConfig), null, 2) + "\n");
|
|
158
153
|
}
|
|
159
|
-
export function appendSourceDatasetChecks(sourcePath,
|
|
154
|
+
export function appendSourceDatasetChecks(sourcePath, preparationName, checks) {
|
|
160
155
|
const existing = loadSourceFolderConfig(sourcePath);
|
|
161
|
-
const
|
|
162
|
-
const
|
|
163
|
-
const currentChecks =
|
|
164
|
-
const
|
|
165
|
-
...
|
|
166
|
-
name:
|
|
167
|
-
path: `./${
|
|
156
|
+
const currentPreparation = findSourcePreparationConfig(existing, preparationName);
|
|
157
|
+
const otherPreparations = listSourcePreparationConfigs(existing).filter((preparation) => preparation.name !== preparationName);
|
|
158
|
+
const currentChecks = currentPreparation?.checks ?? [];
|
|
159
|
+
const nextPreparation = {
|
|
160
|
+
...toWritableSourcePreparationConfig(currentPreparation ?? {
|
|
161
|
+
name: preparationName,
|
|
162
|
+
path: `./${preparationName}`,
|
|
168
163
|
checks: [],
|
|
169
164
|
}),
|
|
170
165
|
checks: [...currentChecks, ...checks],
|
|
171
166
|
};
|
|
172
167
|
saveSourceFolderConfig(sourcePath, {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
...
|
|
168
|
+
preparations: [
|
|
169
|
+
nextPreparation,
|
|
170
|
+
...otherPreparations,
|
|
176
171
|
],
|
|
177
172
|
});
|
|
178
173
|
}
|
|
179
|
-
export
|
|
174
|
+
export const appendSourcePreparationChecks = appendSourceDatasetChecks;
|
|
175
|
+
export function upsertSourceDatasetConfig(sourcePath, preparationConfig, options = {}) {
|
|
180
176
|
const existing = loadSourceFolderConfig(sourcePath);
|
|
181
|
-
const
|
|
182
|
-
const candidateNames = Array.from(new Set([
|
|
183
|
-
const existingIndex =
|
|
177
|
+
const preparations = listSourcePreparationConfigs(existing);
|
|
178
|
+
const candidateNames = Array.from(new Set([preparationConfig.name, options.matchName].filter((value) => Boolean(value))));
|
|
179
|
+
const existingIndex = preparations.findIndex((entry) => candidateNames.includes(entry.name));
|
|
184
180
|
if (existingIndex >= 0) {
|
|
185
|
-
|
|
181
|
+
preparations[existingIndex] = normalizeSourcePreparationConfig(preparationConfig);
|
|
186
182
|
}
|
|
187
183
|
else {
|
|
188
|
-
|
|
184
|
+
preparations.push(normalizeSourcePreparationConfig(preparationConfig));
|
|
189
185
|
}
|
|
190
186
|
saveSourceFolderConfig(sourcePath, {
|
|
191
|
-
|
|
187
|
+
preparations,
|
|
192
188
|
});
|
|
193
189
|
}
|
|
190
|
+
export const upsertSourcePreparationConfig = upsertSourceDatasetConfig;
|
|
194
191
|
export function compiledMaxAttempts(maxAttempts) {
|
|
195
192
|
if (maxAttempts == null)
|
|
196
193
|
return undefined;
|
|
@@ -201,12 +198,13 @@ export function compiledMaxLoops(maxLoops) {
|
|
|
201
198
|
return undefined;
|
|
202
199
|
return resolveDatasetCompileMaxLoops({ max_loops: maxLoops }, null) ?? 1;
|
|
203
200
|
}
|
|
204
|
-
export function sourceDatasetConfigFromInterfConfig(config,
|
|
201
|
+
export function sourceDatasetConfigFromInterfConfig(config, preparationPath = `./${config.name}`) {
|
|
202
|
+
const method = config.method ?? config.workflow;
|
|
205
203
|
return {
|
|
206
204
|
name: config.name,
|
|
207
|
-
path:
|
|
205
|
+
path: preparationPath,
|
|
208
206
|
...(config.about ? { about: config.about } : {}),
|
|
209
|
-
...(
|
|
207
|
+
...(method ? { method } : {}),
|
|
210
208
|
...(typeof config.max_attempts === "number"
|
|
211
209
|
? { max_attempts: config.max_attempts }
|
|
212
210
|
: {}),
|
|
@@ -221,14 +219,27 @@ export function loadCompiledDatasetConfig(compiledPath) {
|
|
|
221
219
|
if (!config)
|
|
222
220
|
return null;
|
|
223
221
|
const projectPath = resolveSourceControlPathForCompiled(compiledPath);
|
|
224
|
-
const
|
|
225
|
-
const
|
|
226
|
-
?
|
|
222
|
+
const configuredPreparations = listSourcePreparationConfigs(loadSourceFolderConfig(projectPath));
|
|
223
|
+
const defaultPreparationPath = configuredPreparations.length === 1
|
|
224
|
+
? configuredPreparations[0].path
|
|
227
225
|
: `./${config.name}`;
|
|
228
|
-
const
|
|
229
|
-
?
|
|
230
|
-
:
|
|
231
|
-
|
|
226
|
+
const sourceBinding = typeof config.source?.preparation_path === "string" && config.source.preparation_path.length > 0
|
|
227
|
+
? config.source.preparation_path
|
|
228
|
+
: typeof config.source?.source_folder_path === "string" && config.source.source_folder_path.length > 0
|
|
229
|
+
? config.source.source_folder_path
|
|
230
|
+
: typeof config.source?.dataset_path === "string" && config.source.dataset_path.length > 0
|
|
231
|
+
? config.source.dataset_path
|
|
232
|
+
: null;
|
|
233
|
+
const preparationPath = sourceBinding
|
|
234
|
+
? (() => {
|
|
235
|
+
const sourceAbsolutePath = resolve(compiledPath, sourceBinding);
|
|
236
|
+
if (!isPathWithinRoot(projectPath, sourceAbsolutePath)) {
|
|
237
|
+
return sourceAbsolutePath;
|
|
238
|
+
}
|
|
239
|
+
return relative(projectPath, sourceAbsolutePath).split(sep).join("/") || defaultPreparationPath;
|
|
240
|
+
})()
|
|
241
|
+
: defaultPreparationPath;
|
|
242
|
+
return sourceDatasetConfigFromInterfConfig(config, preparationPath);
|
|
232
243
|
}
|
|
233
244
|
export function saveCompiledInterfConfig(compiledPath, config) {
|
|
234
245
|
mkdirSync(compiledInterfRoot(compiledPath), { recursive: true });
|
|
@@ -238,17 +249,17 @@ export function saveCompiledInterfConfig(compiledPath, config) {
|
|
|
238
249
|
export function syncCompiledInterfConfigFromSourceDatasetConfig(compiledPath, datasetConfig) {
|
|
239
250
|
const current = readInterfConfig(compiledPath);
|
|
240
251
|
const projectPath = resolveSourceControlPathForCompiled(compiledPath);
|
|
241
|
-
const datasetAbsolutePath =
|
|
252
|
+
const datasetAbsolutePath = resolveSourceDatasetPath(projectPath, datasetConfig);
|
|
242
253
|
const datasetRelativePath = relative(compiledPath, datasetAbsolutePath).split(sep).join("/") || ".";
|
|
243
|
-
const
|
|
244
|
-
const
|
|
245
|
-
const
|
|
254
|
+
const methodId = methodIdForSourcePreparationConfig(datasetConfig) ?? current?.method ?? current?.workflow ?? "interf";
|
|
255
|
+
const methodChanged = current?.method !== undefined && current.method !== methodId;
|
|
256
|
+
const methodOrigin = methodChanged || !current?.method_origin
|
|
246
257
|
? {
|
|
247
|
-
selected:
|
|
258
|
+
selected: methodId,
|
|
248
259
|
local_draft: false,
|
|
249
260
|
}
|
|
250
|
-
: current.
|
|
251
|
-
const { type: _ignoredType, name: _ignoredName, about: _ignoredAbout, workflow: _ignoredWorkflow, max_attempts: _ignoredMaxAttempts, max_loops: _ignoredMaxLoops, checks: _ignoredChecks, workflow_origin: _ignoredWorkflowOrigin, source: _ignoredSource, ...passthrough } = current ?? {};
|
|
261
|
+
: current.method_origin;
|
|
262
|
+
const { type: _ignoredType, name: _ignoredName, about: _ignoredAbout, method: _ignoredMethod, workflow: _ignoredWorkflow, max_attempts: _ignoredMaxAttempts, max_loops: _ignoredMaxLoops, checks: _ignoredChecks, method_origin: _ignoredMethodOrigin, workflow_origin: _ignoredWorkflowOrigin, source: _ignoredSource, ...passthrough } = current ?? {};
|
|
252
263
|
const nextConfig = {
|
|
253
264
|
...passthrough,
|
|
254
265
|
...(!current ? {
|
|
@@ -260,7 +271,7 @@ export function syncCompiledInterfConfigFromSourceDatasetConfig(compiledPath, da
|
|
|
260
271
|
type: "compiled",
|
|
261
272
|
name: datasetConfig.name,
|
|
262
273
|
...(datasetConfig.about ? { about: datasetConfig.about } : {}),
|
|
263
|
-
|
|
274
|
+
method: methodId,
|
|
264
275
|
...(typeof datasetConfig.max_attempts === "number"
|
|
265
276
|
? { max_attempts: datasetConfig.max_attempts }
|
|
266
277
|
: {}),
|
|
@@ -268,17 +279,17 @@ export function syncCompiledInterfConfigFromSourceDatasetConfig(compiledPath, da
|
|
|
268
279
|
? { max_loops: datasetConfig.max_loops }
|
|
269
280
|
: {}),
|
|
270
281
|
checks: datasetConfig.checks,
|
|
271
|
-
|
|
282
|
+
method_origin: methodOrigin,
|
|
272
283
|
source: {
|
|
273
284
|
path: current?.source?.path ?? "./raw",
|
|
274
285
|
control_path: defaultControlPathForCompiled(compiledPath),
|
|
275
|
-
|
|
286
|
+
preparation_path: datasetRelativePath,
|
|
276
287
|
},
|
|
277
288
|
};
|
|
278
289
|
const saved = saveCompiledInterfConfig(compiledPath, nextConfig);
|
|
279
|
-
if (
|
|
290
|
+
if (methodChanged) {
|
|
280
291
|
const sourcePath = projectPath;
|
|
281
|
-
const selectedWorkflow = getCompiledWorkflow(
|
|
292
|
+
const selectedWorkflow = getCompiledWorkflow(methodId, { sourcePath });
|
|
282
293
|
seedCompiledWorkflowPackage({
|
|
283
294
|
compiledPath,
|
|
284
295
|
sourcePath,
|
|
@@ -297,8 +308,8 @@ function buildLoadedTestSpec(options) {
|
|
|
297
308
|
filePath: options.filePath,
|
|
298
309
|
type: options.targetType,
|
|
299
310
|
name: options.name,
|
|
300
|
-
description: options.about ?? options.
|
|
301
|
-
cases:
|
|
311
|
+
description: options.about ?? options.defaultDescription,
|
|
312
|
+
cases: normalizeReadinessChecks(options.checks),
|
|
302
313
|
};
|
|
303
314
|
}
|
|
304
315
|
export function buildTestSpecFromSourceFolderConfig(options) {
|
|
@@ -306,14 +317,14 @@ export function buildTestSpecFromSourceFolderConfig(options) {
|
|
|
306
317
|
const config = loadSourceFolderConfig(sourcePath);
|
|
307
318
|
if (!config)
|
|
308
319
|
return null;
|
|
309
|
-
const
|
|
310
|
-
if (
|
|
320
|
+
const preparations = listSourcePreparationConfigs(config);
|
|
321
|
+
if (preparations.length === 0)
|
|
311
322
|
return null;
|
|
312
323
|
const match = targetName
|
|
313
|
-
?
|
|
314
|
-
:
|
|
315
|
-
?
|
|
316
|
-
:
|
|
324
|
+
? preparations.find((entry) => entry.name === targetName)
|
|
325
|
+
: preparations.length === 1
|
|
326
|
+
? preparations[0]
|
|
327
|
+
: getDefaultSourcePreparationConfig(config);
|
|
317
328
|
if (!match)
|
|
318
329
|
return null;
|
|
319
330
|
const configPath = resolveSourceFolderConfigPath(sourcePath);
|
|
@@ -324,9 +335,9 @@ export function buildTestSpecFromSourceFolderConfig(options) {
|
|
|
324
335
|
checks: match.checks,
|
|
325
336
|
targetType,
|
|
326
337
|
filePath: targetType === "raw"
|
|
327
|
-
? `${configPath}#
|
|
328
|
-
: `${configPath}#
|
|
329
|
-
|
|
338
|
+
? `${configPath}#preparations/${match.name}:source-files`
|
|
339
|
+
: `${configPath}#preparations/${match.name}:portable-context`,
|
|
340
|
+
defaultDescription: `Derived from saved Preparation checks in ${SOURCE_FOLDER_CONFIG_PATH}`,
|
|
330
341
|
});
|
|
331
342
|
}
|
|
332
343
|
export function buildTestSpecFromCompiledDatasetConfig(options) {
|
|
@@ -343,9 +354,15 @@ export function buildTestSpecFromCompiledDatasetConfig(options) {
|
|
|
343
354
|
filePath: targetType === "raw"
|
|
344
355
|
? `${configPath}#checks:file-as-is`
|
|
345
356
|
: `${configPath}#checks:compiled`,
|
|
346
|
-
|
|
357
|
+
defaultDescription: "Derived from checks in the compiled context config.",
|
|
347
358
|
});
|
|
348
359
|
}
|
|
349
360
|
export function resolveSourceDatasetPath(projectPath, datasetConfig) {
|
|
350
|
-
|
|
361
|
+
const configuredPath = datasetConfig.path.trim();
|
|
362
|
+
const resolvedPath = resolve(projectPath, configuredPath);
|
|
363
|
+
if (isAbsolute(configuredPath)) {
|
|
364
|
+
return resolvedPath;
|
|
365
|
+
}
|
|
366
|
+
return assertPathWithinRoot(projectPath, resolvedPath, "Source folder path");
|
|
351
367
|
}
|
|
368
|
+
export const resolveSourcePreparationPath = resolveSourceDatasetPath;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare function listVisibleSourceFolders(projectPath: string): string[];
|
|
2
|
+
export declare function isReservedSourceDatasetPath(relativePath: string): boolean;
|
|
3
|
+
export declare function normalizeSourceDatasetPathForConfig(projectPath: string, value: string): string;
|
|
4
|
+
export declare function defaultDatasetNameForPath(datasetPath: string): string;
|
|
5
|
+
export declare function findSingleSourceFolderCandidate(projectPath: string): string | null;
|
|
6
|
+
export declare function listSourceFolderChoices(projectPath?: string): Array<{
|
|
7
|
+
value: string;
|
|
8
|
+
label: string;
|
|
9
|
+
hint: string;
|
|
10
|
+
}>;
|
|
11
|
+
export declare function defaultSourceDatasetPathForPrompt(name: string, introStyle: "first" | "additional" | "edit", projectPath?: string): string;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { existsSync, readdirSync, statSync } from "node:fs";
|
|
2
|
+
import { isAbsolute, join, relative, sep } from "node:path";
|
|
3
|
+
import { slugify } from "../shared/naming.js";
|
|
4
|
+
import { resolveSourceDatasetPath } from "./source-config.js";
|
|
5
|
+
import { isPathWithinRoot } from "../shared/path-guards.js";
|
|
6
|
+
const DEFAULT_DATASET_NAME = "dataset1";
|
|
7
|
+
const IGNORED_SOURCE_FOLDER_ENTRIES = new Set([
|
|
8
|
+
".DS_Store",
|
|
9
|
+
".git",
|
|
10
|
+
".interf",
|
|
11
|
+
"interf",
|
|
12
|
+
"interf.json",
|
|
13
|
+
"node_modules",
|
|
14
|
+
]);
|
|
15
|
+
export function listVisibleSourceFolders(projectPath) {
|
|
16
|
+
let rootEntries = [];
|
|
17
|
+
try {
|
|
18
|
+
rootEntries = readdirSync(projectPath);
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
return [];
|
|
22
|
+
}
|
|
23
|
+
const visibleEntries = rootEntries.filter((entry) => (!IGNORED_SOURCE_FOLDER_ENTRIES.has(entry) && !entry.startsWith(".")));
|
|
24
|
+
const visibleDirectories = [];
|
|
25
|
+
for (const entry of visibleEntries) {
|
|
26
|
+
try {
|
|
27
|
+
const entryPath = join(projectPath, entry);
|
|
28
|
+
if (statSync(entryPath).isDirectory()) {
|
|
29
|
+
visibleDirectories.push(entry);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
// Ignore unreadable entries.
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return visibleDirectories.sort((left, right) => left.localeCompare(right));
|
|
37
|
+
}
|
|
38
|
+
export function isReservedSourceDatasetPath(relativePath) {
|
|
39
|
+
const normalized = relativePath.replace(/\\/g, "/").replace(/^\.\/+/, "");
|
|
40
|
+
return normalized === "interf" ||
|
|
41
|
+
normalized.startsWith("interf/") ||
|
|
42
|
+
normalized === ".interf" ||
|
|
43
|
+
normalized.startsWith(".interf/");
|
|
44
|
+
}
|
|
45
|
+
export function normalizeSourceDatasetPathForConfig(projectPath, value) {
|
|
46
|
+
const trimmedValue = value.trim();
|
|
47
|
+
const resolvedPath = resolveSourceDatasetPath(projectPath, { path: trimmedValue });
|
|
48
|
+
const relativePath = relative(projectPath, resolvedPath).split(sep).join("/") || ".";
|
|
49
|
+
if (relativePath === ".") {
|
|
50
|
+
throw new Error("Pick a Source Folder, not the Interf Workspace itself.");
|
|
51
|
+
}
|
|
52
|
+
if (isAbsolute(trimmedValue) && !isPathWithinRoot(projectPath, resolvedPath)) {
|
|
53
|
+
if (!existsSync(resolvedPath)) {
|
|
54
|
+
throw new Error("Pick an existing source folder.");
|
|
55
|
+
}
|
|
56
|
+
if (!statSync(resolvedPath).isDirectory()) {
|
|
57
|
+
throw new Error("Source folder must be a directory.");
|
|
58
|
+
}
|
|
59
|
+
return resolvedPath;
|
|
60
|
+
}
|
|
61
|
+
if (isReservedSourceDatasetPath(relativePath)) {
|
|
62
|
+
throw new Error("Pick an existing source folder, not `interf/` or `.interf/`.");
|
|
63
|
+
}
|
|
64
|
+
if (!existsSync(resolvedPath)) {
|
|
65
|
+
throw new Error("Pick an existing source folder.");
|
|
66
|
+
}
|
|
67
|
+
if (!statSync(resolvedPath).isDirectory()) {
|
|
68
|
+
throw new Error("Source folder must be a directory.");
|
|
69
|
+
}
|
|
70
|
+
return relativePath.startsWith("./") ? relativePath : `./${relativePath}`;
|
|
71
|
+
}
|
|
72
|
+
export function defaultDatasetNameForPath(datasetPath) {
|
|
73
|
+
const segments = datasetPath
|
|
74
|
+
.replace(/\\/g, "/")
|
|
75
|
+
.replace(/\/+$/g, "")
|
|
76
|
+
.split("/")
|
|
77
|
+
.filter((segment) => segment.length > 0 && segment !== ".");
|
|
78
|
+
return slugify(segments[segments.length - 1] ?? "") || DEFAULT_DATASET_NAME;
|
|
79
|
+
}
|
|
80
|
+
export function findSingleSourceFolderCandidate(projectPath) {
|
|
81
|
+
const visibleDirectories = listVisibleSourceFolders(projectPath);
|
|
82
|
+
if (visibleDirectories.length !== 1) {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
return `./${visibleDirectories[0]}`;
|
|
86
|
+
}
|
|
87
|
+
export function listSourceFolderChoices(projectPath = process.cwd()) {
|
|
88
|
+
return listVisibleSourceFolders(projectPath).map((entry) => ({
|
|
89
|
+
value: `./${entry}`,
|
|
90
|
+
label: entry,
|
|
91
|
+
hint: `Use ./${entry} as the source folder`,
|
|
92
|
+
}));
|
|
93
|
+
}
|
|
94
|
+
export function defaultSourceDatasetPathForPrompt(name, introStyle, projectPath = process.cwd()) {
|
|
95
|
+
const namedFolderPath = join(projectPath, name);
|
|
96
|
+
if (existsSync(namedFolderPath)) {
|
|
97
|
+
try {
|
|
98
|
+
if (statSync(namedFolderPath).isDirectory()) {
|
|
99
|
+
return `./${name}`;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
catch {
|
|
103
|
+
// Fall through to the normal default.
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
if (introStyle === "first") {
|
|
107
|
+
return findSingleSourceFolderCandidate(projectPath) ?? `./${name}`;
|
|
108
|
+
}
|
|
109
|
+
return `./${name}`;
|
|
110
|
+
}
|
|
@@ -201,9 +201,9 @@ function buildTestQueryPrompt(target, testCase, answerPath, tracePath) {
|
|
|
201
201
|
"Read `AGENTS.md` first.",
|
|
202
202
|
"Use the local native `interf-query` skill available in this portable context.",
|
|
203
203
|
"Answer the check question the same way you would answer a real user inside this portable context.",
|
|
204
|
-
"Prefer the workflow-declared context outputs before raw
|
|
205
|
-
"This sandbox is self-contained: the copied portable context has
|
|
206
|
-
"The original
|
|
204
|
+
"Prefer the workflow-declared context outputs before consulting `raw/`.",
|
|
205
|
+
"This sandbox is self-contained: the copied portable context has sanitized source files under `raw/` via `.interf/interf.json` `source.path`.",
|
|
206
|
+
"The original control plane folder is intentionally absent from this sandbox. Work only from this sandboxed compiled context and its embedded raw files.",
|
|
207
207
|
]
|
|
208
208
|
: [
|
|
209
209
|
"You are running an Interf baseline test inside an isolated raw test shell.",
|
|
@@ -211,14 +211,14 @@ function buildTestQueryPrompt(target, testCase, answerPath, tracePath) {
|
|
|
211
211
|
"Use the local native `interf-query` skill available in this shell.",
|
|
212
212
|
"There is no compiled context in this sandbox.",
|
|
213
213
|
"Answer only from `raw/` inside this shell.",
|
|
214
|
-
"The original
|
|
214
|
+
"The original control plane folder is intentionally absent from this sandbox.",
|
|
215
215
|
];
|
|
216
216
|
return [
|
|
217
217
|
...header,
|
|
218
218
|
"Emit only STATUS:, DONE:, BLOCKED:, or ERROR: lines.",
|
|
219
219
|
"Do not ask follow-up questions.",
|
|
220
220
|
`Write the answer to ${JSON.stringify(answerPath)}.`,
|
|
221
|
-
`Write the trace to ${JSON.stringify(tracePath)} with keys: case_id, target, artifacts_consulted, raw_paths_read,
|
|
221
|
+
`Write the trace to ${JSON.stringify(tracePath)} with keys: case_id, target, artifacts_consulted, raw_paths_read, used_source_files, answer_summary.`,
|
|
222
222
|
`Set \`case_id\` to ${JSON.stringify(testCase.id)}.`,
|
|
223
223
|
`Set \`target\` to ${JSON.stringify(target.type)}.`,
|
|
224
224
|
`Question: ${testCase.question}`,
|
|
@@ -10,10 +10,8 @@ export function testSpecTypePath(sourcePath, type) {
|
|
|
10
10
|
return join(testSpecRootPath(sourcePath), type);
|
|
11
11
|
}
|
|
12
12
|
function isDatasetTestsRootPath(artifactRootPath) {
|
|
13
|
-
|
|
13
|
+
return basename(artifactRootPath) === "tests" &&
|
|
14
14
|
basename(dirname(artifactRootPath)) === ".interf";
|
|
15
|
-
const legacyProjectTestsRoot = basename(dirname(artifactRootPath)) === "tests";
|
|
16
|
-
return portableContextTestsRoot || legacyProjectTestsRoot;
|
|
17
15
|
}
|
|
18
16
|
export function targetTestRunsPath(compiledPath, type) {
|
|
19
17
|
if (existsSync(compiledInterfConfigPath(compiledPath))) {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { WorkflowExecutor } from "../agents/lib/executors.js";
|
|
2
2
|
import { validateWorkflowPackage } from "../workflow-package/local-workflows.js";
|
|
3
|
-
import {
|
|
4
|
-
import type { SourceTruthCheck } from "../project-model/lib/schema.js";
|
|
3
|
+
import type { SourceReadinessCheck } from "../project-model/lib/schema.js";
|
|
5
4
|
export interface WorkflowAuthoringRunResult {
|
|
6
5
|
status: "updated" | "no-change" | "invalid" | "executor-failed";
|
|
7
6
|
changed: boolean;
|
|
@@ -13,14 +12,13 @@ export interface WorkflowAuthoringRunResult {
|
|
|
13
12
|
export declare function runWorkflowAuthoringDraft(options: {
|
|
14
13
|
sourcePath: string;
|
|
15
14
|
datasetPath: string;
|
|
16
|
-
baseWorkflowId
|
|
15
|
+
baseWorkflowId?: string;
|
|
17
16
|
workflowId: string;
|
|
18
17
|
label: string;
|
|
19
18
|
hint: string;
|
|
20
19
|
taskPrompt: string;
|
|
21
|
-
checks?:
|
|
20
|
+
checks?: SourceReadinessCheck[];
|
|
22
21
|
executor: WorkflowExecutor;
|
|
23
|
-
|
|
24
|
-
previewReporter?: WorkflowReporter | null;
|
|
22
|
+
onStatus?: (line: string) => void;
|
|
25
23
|
}): Promise<WorkflowAuthoringRunResult>;
|
|
26
24
|
export declare function resolveWorkflowDraftPath(sourcePath: string, workflowId: string): string;
|