@interf/compiler 0.4.0 → 0.5.0
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 +71 -69
- package/builtin-workflows/interf/README.md +6 -6
- package/builtin-workflows/interf/compile/stages/shape/SKILL.md +7 -7
- package/builtin-workflows/interf/compile/stages/structure/SKILL.md +2 -2
- package/builtin-workflows/interf/compile/stages/summarize/SKILL.md +1 -1
- package/builtin-workflows/interf/{workspace.schema.json → compiled.schema.json} +5 -5
- package/builtin-workflows/interf/improve/SKILL.md +3 -3
- package/builtin-workflows/interf/use/query/SKILL.md +2 -2
- package/builtin-workflows/interf/workflow.json +42 -31
- package/dist/commands/check-draft.d.ts +19 -0
- package/dist/commands/check-draft.js +110 -0
- package/dist/commands/compile-controller.d.ts +4 -4
- package/dist/commands/compile-controller.js +117 -81
- package/dist/commands/compile.d.ts +5 -5
- package/dist/commands/compile.js +61 -62
- package/dist/commands/compiled-flow.d.ts +23 -0
- package/dist/commands/compiled-flow.js +112 -0
- package/dist/commands/create-workflow-wizard.d.ts +3 -3
- package/dist/commands/create-workflow-wizard.js +11 -11
- package/dist/commands/create.d.ts +2 -2
- package/dist/commands/create.js +50 -57
- package/dist/commands/default.js +2 -2
- package/dist/commands/executor-flow.d.ts +20 -1
- package/dist/commands/executor-flow.js +67 -7
- package/dist/commands/init.js +242 -289
- package/dist/commands/list.js +14 -10
- package/dist/commands/reset.js +6 -6
- package/dist/commands/source-config-wizard.d.ts +12 -8
- package/dist/commands/source-config-wizard.js +356 -119
- package/dist/commands/status.js +49 -26
- package/dist/commands/test-flow.d.ts +23 -10
- package/dist/commands/test-flow.js +278 -58
- package/dist/commands/test.d.ts +7 -1
- package/dist/commands/test.js +264 -65
- package/dist/commands/verify.js +23 -14
- package/dist/index.d.ts +7 -7
- package/dist/index.js +4 -4
- package/dist/lib/agent-args.js +2 -1
- package/dist/lib/agent-constants.js +1 -1
- package/dist/lib/agent-render.js +4 -4
- package/dist/lib/agent-shells.d.ts +8 -8
- package/dist/lib/agent-shells.js +231 -142
- package/dist/lib/compiled-compile.d.ts +52 -0
- package/dist/lib/compiled-compile.js +274 -0
- package/dist/lib/compiled-home.d.ts +5 -0
- package/dist/lib/compiled-home.js +32 -0
- package/dist/lib/compiled-layout.d.ts +2 -0
- package/dist/lib/compiled-layout.js +60 -0
- package/dist/lib/compiled-paths.d.ts +41 -0
- package/dist/lib/compiled-paths.js +111 -0
- package/dist/lib/{workspace-raw.d.ts → compiled-raw.d.ts} +8 -7
- package/dist/lib/{workspace-raw.js → compiled-raw.js} +16 -14
- package/dist/lib/compiled-reset.d.ts +1 -0
- package/dist/lib/compiled-reset.js +44 -0
- package/dist/lib/compiled-schema.d.ts +27 -0
- package/dist/lib/compiled-schema.js +110 -0
- package/dist/lib/config.d.ts +0 -1
- package/dist/lib/config.js +0 -1
- package/dist/lib/discovery.d.ts +1 -1
- package/dist/lib/discovery.js +3 -3
- package/dist/lib/interf-bootstrap.d.ts +1 -1
- package/dist/lib/interf-bootstrap.js +4 -4
- package/dist/lib/interf-detect.d.ts +10 -10
- package/dist/lib/interf-detect.js +78 -56
- package/dist/lib/interf-scaffold.d.ts +2 -2
- package/dist/lib/interf-scaffold.js +90 -57
- package/dist/lib/interf-workflow-package.d.ts +3 -3
- package/dist/lib/interf-workflow-package.js +30 -30
- package/dist/lib/interf.d.ts +5 -5
- package/dist/lib/interf.js +4 -4
- package/dist/lib/local-workflows.d.ts +4 -4
- package/dist/lib/local-workflows.js +35 -70
- package/dist/lib/obsidian.d.ts +1 -1
- package/dist/lib/parse.js +92 -1
- package/dist/lib/project-paths.d.ts +13 -0
- package/dist/lib/project-paths.js +29 -0
- package/dist/lib/runtime-acceptance.d.ts +7 -1
- package/dist/lib/runtime-acceptance.js +194 -59
- package/dist/lib/runtime-contracts.d.ts +2 -4
- package/dist/lib/runtime-contracts.js +17 -161
- package/dist/lib/runtime-inventory.d.ts +7 -0
- package/dist/lib/runtime-inventory.js +29 -0
- package/dist/lib/runtime-paths.js +5 -5
- package/dist/lib/runtime-prompt.js +9 -6
- package/dist/lib/runtime-reconcile.d.ts +2 -3
- package/dist/lib/runtime-reconcile.js +92 -171
- package/dist/lib/runtime-runs.js +30 -39
- package/dist/lib/runtime-types.d.ts +10 -19
- package/dist/lib/runtime.d.ts +2 -2
- package/dist/lib/runtime.js +1 -1
- package/dist/lib/schema.d.ts +163 -140
- package/dist/lib/schema.js +163 -124
- package/dist/lib/source-config.d.ts +24 -20
- package/dist/lib/source-config.js +154 -116
- package/dist/lib/state-artifacts.d.ts +5 -5
- package/dist/lib/state-artifacts.js +8 -8
- package/dist/lib/state-health.d.ts +4 -4
- package/dist/lib/state-health.js +108 -126
- package/dist/lib/state-io.d.ts +8 -8
- package/dist/lib/state-io.js +77 -50
- package/dist/lib/state-paths.js +5 -5
- package/dist/lib/state-view.d.ts +4 -4
- package/dist/lib/state-view.js +52 -55
- package/dist/lib/state.d.ts +5 -5
- package/dist/lib/state.js +4 -4
- package/dist/lib/summarize-plan.d.ts +3 -2
- package/dist/lib/summarize-plan.js +18 -16
- package/dist/lib/test-execution.js +9 -9
- package/dist/lib/test-matrices.d.ts +3 -3
- package/dist/lib/test-matrices.js +6 -6
- package/dist/lib/test-paths.d.ts +4 -4
- package/dist/lib/test-paths.js +16 -10
- package/dist/lib/test-sandbox.d.ts +1 -1
- package/dist/lib/test-sandbox.js +38 -31
- package/dist/lib/test-targets.d.ts +2 -2
- package/dist/lib/test-targets.js +11 -11
- package/dist/lib/test-types.d.ts +1 -1
- package/dist/lib/test.d.ts +1 -1
- package/dist/lib/test.js +1 -1
- package/dist/lib/util.d.ts +2 -0
- package/dist/lib/util.js +14 -1
- package/dist/lib/validate-compiled.d.ts +27 -0
- package/dist/lib/validate-compiled.js +236 -0
- package/dist/lib/validate-helpers.d.ts +0 -8
- package/dist/lib/validate-helpers.js +0 -30
- package/dist/lib/validate.d.ts +4 -4
- package/dist/lib/validate.js +49 -15
- package/dist/lib/workflow-abi.d.ts +37 -46
- package/dist/lib/workflow-abi.js +51 -76
- package/dist/lib/workflow-definitions.d.ts +11 -11
- package/dist/lib/workflow-definitions.js +36 -53
- package/dist/lib/workflow-helpers.d.ts +2 -3
- package/dist/lib/workflow-helpers.js +9 -13
- package/dist/lib/workflow-improvement.d.ts +3 -3
- package/dist/lib/workflow-improvement.js +48 -48
- package/dist/lib/workflow-review-paths.d.ts +3 -3
- package/dist/lib/workflow-review-paths.js +11 -11
- package/dist/lib/workflow-stage-runner.d.ts +1 -1
- package/dist/lib/workflow-stage-runner.js +8 -8
- package/dist/lib/workflows.d.ts +9 -9
- package/dist/lib/workflows.js +15 -17
- package/package.json +10 -9
- package/dist/commands/workspace-flow.d.ts +0 -23
- package/dist/commands/workspace-flow.js +0 -109
- package/dist/lib/registry.d.ts +0 -16
- package/dist/lib/registry.js +0 -65
- package/dist/lib/validate-workspace.d.ts +0 -121
- package/dist/lib/validate-workspace.js +0 -407
- package/dist/lib/workspace-compile.d.ts +0 -54
- package/dist/lib/workspace-compile.js +0 -476
- package/dist/lib/workspace-home.d.ts +0 -5
- package/dist/lib/workspace-home.js +0 -32
- package/dist/lib/workspace-layout.d.ts +0 -2
- package/dist/lib/workspace-layout.js +0 -60
- package/dist/lib/workspace-paths.d.ts +0 -41
- package/dist/lib/workspace-paths.js +0 -107
- package/dist/lib/workspace-reset.d.ts +0 -1
- package/dist/lib/workspace-reset.js +0 -43
- package/dist/lib/workspace-schema.d.ts +0 -17
- package/dist/lib/workspace-schema.js +0 -74
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { mkdirSync, writeFileSync, } from "node:fs";
|
|
2
|
-
import { basename, join } from "node:path";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { mkdirSync, existsSync, writeFileSync, } from "node:fs";
|
|
2
|
+
import { basename, join, relative, sep } from "node:path";
|
|
3
|
+
import { getCompiledWorkflow } from "./workflow-definitions.js";
|
|
4
|
+
import { refreshCompiledArtifacts, saveState, initCompiledState, } from "./state.js";
|
|
5
|
+
import { saveEmptyCompiledInventory } from "./state-io.js";
|
|
6
6
|
import { writeObsidianDefaults } from "./obsidian.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
7
|
+
import { assertCompiledContainer, assertWritableTargetDir, assertCompiledName, } from "./interf-detect.js";
|
|
8
|
+
import { refreshCompiledBootstrapGuidance } from "./interf-bootstrap.js";
|
|
9
|
+
import { seedCompiledWorkflowPackage } from "./interf-workflow-package.js";
|
|
10
|
+
import { compiledCompiledPathForDataset } from "./project-paths.js";
|
|
11
|
+
import { syncCompiledRawSnapshot } from "./compiled-raw.js";
|
|
12
|
+
import { ensureCompiledZoneTargets, readCompiledSchemaFile } from "./compiled-schema.js";
|
|
13
|
+
import { findSourceDatasetConfig, loadSourceFolderConfig, resolveSourceDatasetPath, saveCompiledInterfConfig, } from "./source-config.js";
|
|
14
|
+
import { defaultControlPathForCompiled, workflowPackagePathForCompiled } from "./compiled-paths.js";
|
|
14
15
|
const DEFAULT_INTERFIGNORE = [
|
|
15
16
|
".claude/",
|
|
16
17
|
".codex/",
|
|
@@ -22,67 +23,99 @@ const DEFAULT_INTERFIGNORE = [
|
|
|
22
23
|
".obsidian/",
|
|
23
24
|
"",
|
|
24
25
|
].join("\n");
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
26
|
+
const UNCOMPILED_COMPILED_PLACEHOLDER = "Not yet compiled. Run `interf compile` to build the compiled dataset.";
|
|
27
|
+
function renderUncompiledCompiledFile(compiledName, relativePath, about) {
|
|
28
|
+
return [
|
|
29
|
+
`# ${compiledName} — ${relativePath}`,
|
|
30
|
+
"",
|
|
31
|
+
UNCOMPILED_COMPILED_PLACEHOLDER,
|
|
32
|
+
...(about ? ["", `About: ${about}`] : []),
|
|
33
|
+
"",
|
|
34
|
+
].join("\n");
|
|
35
|
+
}
|
|
36
|
+
function compiledGitignoreEntries(compiledPath) {
|
|
37
|
+
const schema = readCompiledSchemaFile(workflowPackagePathForCompiled(compiledPath));
|
|
38
|
+
const zoneEntries = (schema?.zones ?? [])
|
|
39
|
+
.filter((zone) => zone.kind !== "runtime")
|
|
40
|
+
.map((zone) => zone.kind === "file" ? zone.path : `${zone.path}/`);
|
|
41
|
+
return [
|
|
42
|
+
...zoneEntries,
|
|
43
|
+
".claude/",
|
|
44
|
+
".codex/",
|
|
45
|
+
".agents/",
|
|
46
|
+
".cursor/",
|
|
47
|
+
".interf/tests/",
|
|
48
|
+
".interf/tests/targets/sandboxes/",
|
|
49
|
+
".interf/runtime/",
|
|
50
|
+
".obsidian/",
|
|
51
|
+
];
|
|
52
|
+
}
|
|
53
|
+
function scaffoldCompiledOutputs(compiledPath, compiledName, about) {
|
|
54
|
+
const schema = readCompiledSchemaFile(workflowPackagePathForCompiled(compiledPath));
|
|
55
|
+
if (!schema) {
|
|
56
|
+
throw new Error(`Missing compiled schema at ${workflowPackagePathForCompiled(compiledPath)}.`);
|
|
57
|
+
}
|
|
58
|
+
ensureCompiledZoneTargets(compiledPath, schema);
|
|
59
|
+
for (const zone of schema.zones) {
|
|
60
|
+
if (!zone.required || zone.kind !== "file" || zone.id === "raw")
|
|
61
|
+
continue;
|
|
62
|
+
const targetPath = join(compiledPath, zone.path);
|
|
63
|
+
if (existsSync(targetPath))
|
|
64
|
+
continue;
|
|
65
|
+
writeFileSync(targetPath, renderUncompiledCompiledFile(compiledName, zone.path, about));
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
export function createCompiled(name, sourcePath, workflowId = "interf", about, datasetPath = sourcePath) {
|
|
69
|
+
assertCompiledName(name, "Compiled");
|
|
70
|
+
assertCompiledContainer(sourcePath);
|
|
71
|
+
const compiledPath = compiledCompiledPathForDataset(sourcePath, name);
|
|
72
|
+
assertWritableTargetDir(compiledPath, "Compiled");
|
|
73
|
+
mkdirSync(compiledPath, { recursive: true });
|
|
74
|
+
const savedCompiled = findSourceDatasetConfig(loadSourceFolderConfig(sourcePath), name);
|
|
75
|
+
const selectedWorkflow = getCompiledWorkflow(workflowId, { sourcePath });
|
|
76
|
+
const resolvedAbout = about ?? savedCompiled?.about;
|
|
77
|
+
const resolvedDatasetPath = savedCompiled
|
|
78
|
+
? resolveSourceDatasetPath(sourcePath, savedCompiled)
|
|
79
|
+
: datasetPath;
|
|
80
|
+
saveCompiledInterfConfig(compiledPath, {
|
|
81
|
+
type: "compiled",
|
|
37
82
|
name,
|
|
38
83
|
...(resolvedAbout ? { about: resolvedAbout } : {}),
|
|
39
84
|
workflow: selectedWorkflow.id,
|
|
40
|
-
...(typeof
|
|
41
|
-
? { max_attempts:
|
|
85
|
+
...(typeof savedCompiled?.max_attempts === "number"
|
|
86
|
+
? { max_attempts: savedCompiled.max_attempts }
|
|
42
87
|
: {}),
|
|
43
|
-
...(typeof
|
|
44
|
-
? { max_loops:
|
|
88
|
+
...(typeof savedCompiled?.max_loops === "number"
|
|
89
|
+
? { max_loops: savedCompiled.max_loops }
|
|
45
90
|
: {}),
|
|
46
|
-
checks:
|
|
91
|
+
checks: savedCompiled?.checks ?? [],
|
|
47
92
|
workflow_origin: {
|
|
48
93
|
selected: selectedWorkflow.id,
|
|
49
94
|
local_draft: false,
|
|
50
95
|
},
|
|
51
96
|
source: {
|
|
52
97
|
path: "./raw",
|
|
53
|
-
control_path:
|
|
98
|
+
control_path: defaultControlPathForCompiled(compiledPath),
|
|
99
|
+
dataset_path: relative(compiledPath, resolvedDatasetPath).split(sep).join("/") || ".",
|
|
54
100
|
},
|
|
55
101
|
});
|
|
56
|
-
mkdirSync(join(
|
|
57
|
-
|
|
58
|
-
writeFileSync(join(
|
|
59
|
-
|
|
60
|
-
|
|
102
|
+
mkdirSync(join(compiledPath, "raw"), { recursive: true });
|
|
103
|
+
syncCompiledRawSnapshot(compiledPath, resolvedDatasetPath);
|
|
104
|
+
writeFileSync(join(compiledPath, ".interfignore"), DEFAULT_INTERFIGNORE);
|
|
105
|
+
seedCompiledWorkflowPackage({
|
|
106
|
+
compiledPath,
|
|
61
107
|
sourcePath,
|
|
62
108
|
workflowId: selectedWorkflow.id,
|
|
63
109
|
});
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
writeFileSync(join(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
".agents/",
|
|
73
|
-
".cursor/",
|
|
74
|
-
".interf/tests/",
|
|
75
|
-
".interf/tests/targets/sandboxes/",
|
|
76
|
-
".interf/runtime/",
|
|
77
|
-
".obsidian/",
|
|
78
|
-
"",
|
|
79
|
-
].join("\n"));
|
|
80
|
-
saveState(workspacePath, initWorkspaceState());
|
|
81
|
-
saveEmptyWorkspaceInventory(workspacePath);
|
|
82
|
-
refreshWorkspaceArtifacts(workspacePath, { ensureViewSpec: true });
|
|
83
|
-
writeObsidianDefaults(workspacePath, "workspace");
|
|
84
|
-
return workspacePath;
|
|
110
|
+
scaffoldCompiledOutputs(compiledPath, name, about);
|
|
111
|
+
refreshCompiledBootstrapGuidance(compiledPath);
|
|
112
|
+
writeFileSync(join(compiledPath, ".gitignore"), [...compiledGitignoreEntries(compiledPath), ""].join("\n"));
|
|
113
|
+
saveState(compiledPath, initCompiledState());
|
|
114
|
+
saveEmptyCompiledInventory(compiledPath);
|
|
115
|
+
refreshCompiledArtifacts(compiledPath, { ensureViewSpec: true });
|
|
116
|
+
writeObsidianDefaults(compiledPath, "compiled");
|
|
117
|
+
return compiledPath;
|
|
85
118
|
}
|
|
86
|
-
export function
|
|
119
|
+
export function defaultCompiledNameForSource(sourcePath) {
|
|
87
120
|
return basename(sourcePath);
|
|
88
121
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { type WorkflowDefinition } from "./workflow-definitions.js";
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function writeCompiledWorkflowPackage(compiledPath: string, workflow: WorkflowDefinition<string>): void;
|
|
3
3
|
export declare function writeWorkflowPackageToDir(workflowDir: string, workflow: WorkflowDefinition<string>, options?: {
|
|
4
4
|
overwrite?: boolean;
|
|
5
5
|
}): void;
|
|
6
|
-
export declare function
|
|
7
|
-
|
|
6
|
+
export declare function seedCompiledWorkflowPackage(options: {
|
|
7
|
+
compiledPath: string;
|
|
8
8
|
sourcePath: string;
|
|
9
9
|
workflowId: string;
|
|
10
10
|
}): void;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { dirname, join } from "node:path";
|
|
3
3
|
import { copyWorkflowPackageDirectory, isPortableWorkflowPackage, patchWorkflowPackageMetadata, resolveWorkflowPackageSourcePath, workflowDefinitionPath, } from "./local-workflows.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { getCompiledWorkflow, } from "./workflow-definitions.js";
|
|
5
|
+
import { renderCompiledQuerySkill } from "./agent-shells.js";
|
|
6
6
|
import { CHART_APPROXIMATION_NOTES } from "./chart-guidance.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { writeCompiledSchemaFile } from "./compiled-schema.js";
|
|
8
|
+
import { workflowPackagePathForCompiled } from "./compiled-paths.js";
|
|
9
9
|
function workflowPackagePath(dirPath) {
|
|
10
|
-
return
|
|
10
|
+
return workflowPackagePathForCompiled(dirPath);
|
|
11
11
|
}
|
|
12
12
|
function mergeWorkflowStagePolicyNotes(stages, baseNotes, nextNotes) {
|
|
13
13
|
const merged = {};
|
|
@@ -37,9 +37,9 @@ function writeWorkflowPackageJson(rootPath, workflow, options) {
|
|
|
37
37
|
return;
|
|
38
38
|
writeFileSync(targetPath, `${JSON.stringify({
|
|
39
39
|
id: workflow.id,
|
|
40
|
-
type: "
|
|
40
|
+
type: "compiled",
|
|
41
41
|
compiler_api: workflow.compilerApi ?? {
|
|
42
|
-
kind: "
|
|
42
|
+
kind: "compiled",
|
|
43
43
|
version: 1,
|
|
44
44
|
},
|
|
45
45
|
label: workflow.label,
|
|
@@ -69,7 +69,7 @@ function renderWorkflowReadme(workflow) {
|
|
|
69
69
|
"## Package",
|
|
70
70
|
"",
|
|
71
71
|
"- `workflow.json` = stage graph, compiler API target, and compile contract mapping",
|
|
72
|
-
"- `
|
|
72
|
+
"- `compiled.schema.json` = deterministic compiled-dataset output shape",
|
|
73
73
|
"- `improve/`, `compile/stages/`, and `use/query/` = human-readable authoring docs",
|
|
74
74
|
"- Portable workflow packages are standalone: explicit stages, schema, and docs live together in this folder",
|
|
75
75
|
"- Interf Compiler projects native agent shells from these docs for query use, stage execution, and workflow-improvement loops",
|
|
@@ -78,7 +78,7 @@ function renderWorkflowReadme(workflow) {
|
|
|
78
78
|
"",
|
|
79
79
|
stageLines,
|
|
80
80
|
"",
|
|
81
|
-
"Interf Compiler runs the
|
|
81
|
+
"Interf Compiler runs the local copy of this package directly from `.interf/workflow/` inside each compiled dataset.",
|
|
82
82
|
"",
|
|
83
83
|
].join("\n");
|
|
84
84
|
}
|
|
@@ -90,7 +90,7 @@ function renderDerivedWorkflowReadme(options) {
|
|
|
90
90
|
"",
|
|
91
91
|
`This workflow package was copied from \`${options.baseWorkflowId}\` and materialized as a standalone package for this dataset job.`,
|
|
92
92
|
"",
|
|
93
|
-
"Interf Compiler runs the
|
|
93
|
+
"Interf Compiler runs the local copy of this package directly. Keep changes in this folder self-contained instead of relying on runtime inheritance or fallback.",
|
|
94
94
|
"",
|
|
95
95
|
"## Emphasis",
|
|
96
96
|
"",
|
|
@@ -107,13 +107,13 @@ function renderImproveSkill(workflow) {
|
|
|
107
107
|
`Workflow: ${workflow.id}`,
|
|
108
108
|
"",
|
|
109
109
|
"This file is the editable authoring source for Interf Compiler's generated native workflow-improver shell.",
|
|
110
|
-
"The improver edits this
|
|
110
|
+
"The improver edits this local package directly.",
|
|
111
111
|
"",
|
|
112
112
|
"Default loop:",
|
|
113
113
|
"1. Read the loop context first.",
|
|
114
114
|
"2. Review preserved stage shells, runtime logs, and saved test runs from failed attempts.",
|
|
115
|
-
"3. Edit only the local workflow package for this
|
|
116
|
-
"4. Keep `workflow.json`, `
|
|
115
|
+
"3. Edit only the local workflow package for this compiled dataset to create a better workflow variation for this dataset.",
|
|
116
|
+
"4. Keep `workflow.json`, `compiled.schema.json`, and any changed stage docs aligned.",
|
|
117
117
|
"",
|
|
118
118
|
"Guardrails:",
|
|
119
119
|
"- do not edit truth checks, test specs, or raw dataset files",
|
|
@@ -125,23 +125,23 @@ function renderImproveSkill(workflow) {
|
|
|
125
125
|
}
|
|
126
126
|
function renderStageSkill(workflow, stage) {
|
|
127
127
|
const notes = workflow.stagePolicyNotes?.[stage.id] ?? [];
|
|
128
|
-
const stageSpecificNotes = stage.contractType === "
|
|
128
|
+
const stageSpecificNotes = stage.contractType === "compiled-file-evidence"
|
|
129
129
|
? [
|
|
130
130
|
"Each summary must use JSON frontmatter and include `source`, `source_kind`, `evidence_tier`, `truth_mode`, `state`, and a non-empty `abstract`.",
|
|
131
131
|
"Include a clear abstract block in the body so a human can skim the summary quickly.",
|
|
132
132
|
"Do not skip the abstract just because the overview section is present.",
|
|
133
133
|
]
|
|
134
|
-
: stage.contractType === "
|
|
134
|
+
: stage.contractType === "compiled-knowledge-structure"
|
|
135
135
|
? [
|
|
136
136
|
"Treat the knowledge layer as retrieval structure, not final truth.",
|
|
137
137
|
"Prefer durable entity, claim, and index notes over one giant catch-all file.",
|
|
138
138
|
]
|
|
139
|
-
: stage.contractType === "
|
|
139
|
+
: stage.contractType === "compiled-query-shape"
|
|
140
140
|
? [
|
|
141
|
-
"Use the
|
|
141
|
+
"Use the compiled focus plus saved truth-check question text to shape `home.md` and retrieval routes.",
|
|
142
142
|
"Rewrite `home.md` into a real entrypoint note. Do not leave the scaffold `Not yet compiled.` placeholder in place.",
|
|
143
143
|
...CHART_APPROXIMATION_NOTES,
|
|
144
|
-
"Do not copy expected answers into the
|
|
144
|
+
"Do not copy expected answers into the compiled dataset.",
|
|
145
145
|
]
|
|
146
146
|
: [];
|
|
147
147
|
return [
|
|
@@ -169,8 +169,8 @@ function renderStageSkill(workflow, stage) {
|
|
|
169
169
|
: []),
|
|
170
170
|
].join("\n");
|
|
171
171
|
}
|
|
172
|
-
export function
|
|
173
|
-
writeWorkflowPackageToDir(workflowPackagePath(
|
|
172
|
+
export function writeCompiledWorkflowPackage(compiledPath, workflow) {
|
|
173
|
+
writeWorkflowPackageToDir(workflowPackagePath(compiledPath), workflow);
|
|
174
174
|
}
|
|
175
175
|
export function writeWorkflowPackageToDir(workflowDir, workflow, options = {}) {
|
|
176
176
|
const overwrite = options.overwrite ?? true;
|
|
@@ -181,8 +181,8 @@ export function writeWorkflowPackageToDir(workflowDir, workflow, options = {}) {
|
|
|
181
181
|
mkdirSync(join(workflowDir, "compile", "stages", stage.skillDir), { recursive: true });
|
|
182
182
|
}
|
|
183
183
|
writeWorkflowPackageJson(workflowDir, workflow, { overwrite });
|
|
184
|
-
if (overwrite || !existsSync(join(workflowDir, "
|
|
185
|
-
|
|
184
|
+
if (overwrite || !existsSync(join(workflowDir, "compiled.schema.json"))) {
|
|
185
|
+
writeCompiledSchemaFile(workflowDir, workflow.stages, `${workflow.label} compiled schema`);
|
|
186
186
|
}
|
|
187
187
|
if (overwrite || !existsSync(join(workflowDir, "README.md"))) {
|
|
188
188
|
writeFileSync(join(workflowDir, "README.md"), renderWorkflowReadme(workflow));
|
|
@@ -191,7 +191,7 @@ export function writeWorkflowPackageToDir(workflowDir, workflow, options = {}) {
|
|
|
191
191
|
writeFileSync(join(workflowDir, "improve", "SKILL.md"), renderImproveSkill(workflow));
|
|
192
192
|
}
|
|
193
193
|
if (overwrite || !existsSync(join(workflowDir, "use", "query", "SKILL.md"))) {
|
|
194
|
-
writeFileSync(join(workflowDir, "use", "query", "SKILL.md"),
|
|
194
|
+
writeFileSync(join(workflowDir, "use", "query", "SKILL.md"), renderCompiledQuerySkill());
|
|
195
195
|
}
|
|
196
196
|
for (const stage of workflow.stages) {
|
|
197
197
|
const targetPath = join(workflowDir, "compile", "stages", stage.skillDir, "SKILL.md");
|
|
@@ -201,20 +201,20 @@ export function writeWorkflowPackageToDir(workflowDir, workflow, options = {}) {
|
|
|
201
201
|
}
|
|
202
202
|
writeWorkflowStarterDocs(workflowDir, workflow.starterDocs, { overwrite });
|
|
203
203
|
}
|
|
204
|
-
export function
|
|
205
|
-
const resolvedWorkflow =
|
|
204
|
+
export function seedCompiledWorkflowPackage(options) {
|
|
205
|
+
const resolvedWorkflow = getCompiledWorkflow(options.workflowId, {
|
|
206
206
|
sourcePath: options.sourcePath,
|
|
207
207
|
});
|
|
208
208
|
const sourceWorkflowPath = resolveWorkflowPackageSourcePath(options.sourcePath, resolvedWorkflow.id);
|
|
209
209
|
if (sourceWorkflowPath && isPortableWorkflowPackage(sourceWorkflowPath)) {
|
|
210
210
|
// Portable seed packages can be copied directly because compile runs the
|
|
211
|
-
//
|
|
212
|
-
copyWorkflowPackageDirectory(sourceWorkflowPath, workflowPackagePath(options.
|
|
211
|
+
// local package folder without any source-root fallback.
|
|
212
|
+
copyWorkflowPackageDirectory(sourceWorkflowPath, workflowPackagePath(options.compiledPath));
|
|
213
213
|
return;
|
|
214
214
|
}
|
|
215
215
|
// Legacy or partially-defined seed packages are resolved once and
|
|
216
|
-
// materialized into a standalone
|
|
217
|
-
|
|
216
|
+
// materialized into a standalone local package.
|
|
217
|
+
writeCompiledWorkflowPackage(options.compiledPath, resolvedWorkflow);
|
|
218
218
|
}
|
|
219
219
|
export function createLocalWorkflowPackageFromTemplate(options) {
|
|
220
220
|
const sourceWorkflowPath = resolveWorkflowPackageSourcePath(options.sourcePath, options.baseWorkflowId);
|
|
@@ -245,7 +245,7 @@ export function createLocalWorkflowPackageFromTemplate(options) {
|
|
|
245
245
|
}
|
|
246
246
|
// Legacy or inherited base packages are materialized immediately so the new
|
|
247
247
|
// local workflow package is standalone from its first write.
|
|
248
|
-
const baseWorkflow =
|
|
248
|
+
const baseWorkflow = getCompiledWorkflow(options.baseWorkflowId, {
|
|
249
249
|
sourcePath: options.sourcePath,
|
|
250
250
|
});
|
|
251
251
|
const localWorkflow = {
|
package/dist/lib/interf.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { INTERF_CONTAINER_NAME,
|
|
2
|
-
export type { InterfConfig,
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
1
|
+
export { INTERF_CONTAINER_NAME, WORKFLOW_CONTAINER_NAME, TEST_CONTAINER_NAME, INTERF_CONFIG_FILE, WORKFLOW_PACKAGE_DIR, prepareCompiledLayout, readInterfConfig, detectInterf, resolveCompiled, resolveSourceFolderPath, resolveSourceControlPath, resolveSourceInputPath, listCompiledDatasetsForSourceFolder, hasSourceFolderInput, assertCompiledContainer, assertWritableTargetDir, assertCompiledName, } from "./interf-detect.js";
|
|
2
|
+
export type { InterfConfig, ResolvedCompiled } from "./interf-detect.js";
|
|
3
|
+
export { ensureCompiledRawBinding, resolveCompiledRawPath, syncCompiledRawSnapshot, } from "./compiled-raw.js";
|
|
4
|
+
export { refreshCompiledBootstrapGuidance, renderClaudeBootstrap, } from "./interf-bootstrap.js";
|
|
5
|
+
export { createCompiled, defaultCompiledNameForSource, } from "./interf-scaffold.js";
|
package/dist/lib/interf.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { INTERF_CONTAINER_NAME,
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
1
|
+
export { INTERF_CONTAINER_NAME, WORKFLOW_CONTAINER_NAME, TEST_CONTAINER_NAME, INTERF_CONFIG_FILE, WORKFLOW_PACKAGE_DIR, prepareCompiledLayout, readInterfConfig, detectInterf, resolveCompiled, resolveSourceFolderPath, resolveSourceControlPath, resolveSourceInputPath, listCompiledDatasetsForSourceFolder, hasSourceFolderInput, assertCompiledContainer, assertWritableTargetDir, assertCompiledName, } from "./interf-detect.js";
|
|
2
|
+
export { ensureCompiledRawBinding, resolveCompiledRawPath, syncCompiledRawSnapshot, } from "./compiled-raw.js";
|
|
3
|
+
export { refreshCompiledBootstrapGuidance, renderClaudeBootstrap, } from "./interf-bootstrap.js";
|
|
4
|
+
export { createCompiled, defaultCompiledNameForSource, } from "./interf-scaffold.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { WorkflowCompilerApiSchema, RuntimeContractTypeSchema, RuntimeStageAcceptanceSchema, WorkflowStageZoneAccessSchema, type
|
|
2
|
+
import { WorkflowCompilerApiSchema, RuntimeContractTypeSchema, RuntimeStageAcceptanceSchema, WorkflowStageZoneAccessSchema, type WorkflowCompiledSchema } from "./schema.js";
|
|
3
3
|
export interface LocalWorkflowStarterDoc {
|
|
4
4
|
relativePath: string;
|
|
5
5
|
content: string;
|
|
@@ -16,18 +16,18 @@ export interface LocalWorkflowStageDefinition {
|
|
|
16
16
|
}
|
|
17
17
|
export interface LocalWorkflowDefinition {
|
|
18
18
|
id: string;
|
|
19
|
-
type: "
|
|
19
|
+
type: "compiled";
|
|
20
20
|
compiler_api?: z.infer<typeof WorkflowCompilerApiSchema>;
|
|
21
21
|
label: string;
|
|
22
22
|
hint: string;
|
|
23
23
|
extends?: string;
|
|
24
24
|
stages?: LocalWorkflowStageDefinition[];
|
|
25
25
|
stage_policy_notes?: Record<string, string[]>;
|
|
26
|
-
|
|
26
|
+
compiled_schema: WorkflowCompiledSchema;
|
|
27
27
|
starter_docs: LocalWorkflowStarterDoc[];
|
|
28
28
|
directoryPath: string;
|
|
29
29
|
workflowPath: string;
|
|
30
|
-
|
|
30
|
+
compiledSchemaPath: string;
|
|
31
31
|
}
|
|
32
32
|
export declare function workflowDefinitionPath(sourcePath: string, id: string): string;
|
|
33
33
|
export declare function loadWorkflowDefinitionFromDir(dirPath: string): LocalWorkflowDefinition | null;
|