@interf/compiler 0.4.1 → 0.5.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 +70 -66
- 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 +274 -65
- 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/{workflow-abi.d.ts → builtin-compiled-workflow.d.ts} +37 -46
- package/dist/lib/builtin-compiled-workflow.js +153 -0
- 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-paths.d.ts +39 -0
- package/dist/lib/compiled-paths.js +103 -0
- package/dist/lib/{workspace-raw.d.ts → compiled-raw.d.ts} +9 -8
- 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 +9 -10
- package/dist/lib/interf-detect.js +70 -59
- 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 +11 -0
- package/dist/lib/project-paths.js +32 -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 +7 -6
- package/dist/lib/runtime-reconcile.d.ts +2 -3
- package/dist/lib/runtime-reconcile.js +94 -184
- package/dist/lib/runtime-runs.js +25 -119
- 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 +169 -153
- package/dist/lib/schema.js +116 -164
- package/dist/lib/source-config.d.ts +24 -20
- package/dist/lib/source-config.js +159 -122
- 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 +110 -126
- package/dist/lib/state-io.d.ts +8 -8
- package/dist/lib/state-io.js +21 -102
- 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 +19 -21
- 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 +26 -11
- package/dist/lib/test-sandbox.d.ts +1 -1
- package/dist/lib/test-sandbox.js +32 -38
- package/dist/lib/test-specs.js +1 -1
- 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 +238 -0
- package/dist/lib/validate-helpers.d.ts +0 -8
- package/dist/lib/validate-helpers.js +0 -30
- package/dist/lib/validate.d.ts +6 -4
- package/dist/lib/validate.js +76 -27
- package/dist/lib/workflow-definitions.d.ts +12 -11
- package/dist/lib/workflow-definitions.js +45 -55
- 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-primitives.d.ts +2 -0
- package/dist/lib/workflow-primitives.js +5 -0
- 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 +13 -12
- 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/workflow-abi.js +0 -181
- 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
|
@@ -9,7 +9,7 @@ interface WorkflowStageShape<TContractType extends RuntimeContractType> {
|
|
|
9
9
|
}
|
|
10
10
|
interface ExecuteValidatedStageOptions<TContractType extends RuntimeContractType> {
|
|
11
11
|
executor: WorkflowExecutor;
|
|
12
|
-
|
|
12
|
+
compiledPath: string;
|
|
13
13
|
executionPath?: string;
|
|
14
14
|
targetName: string;
|
|
15
15
|
workflow: string;
|
|
@@ -17,9 +17,9 @@ export async function executeValidatedStage(options) {
|
|
|
17
17
|
: undefined;
|
|
18
18
|
const code = await runExecutorStage({
|
|
19
19
|
executor: options.executor,
|
|
20
|
-
|
|
20
|
+
compiledPath: options.compiledPath,
|
|
21
21
|
executionPath: options.executionPath,
|
|
22
|
-
|
|
22
|
+
compiledName: options.targetName,
|
|
23
23
|
workflow: options.workflow,
|
|
24
24
|
workflowSourcePath: options.workflowSourcePath,
|
|
25
25
|
stage: options.stageDefinition.id,
|
|
@@ -42,9 +42,9 @@ export async function executeValidatedSummarizeStage(options) {
|
|
|
42
42
|
: undefined;
|
|
43
43
|
const code = await runExecutorSummarizeStage({
|
|
44
44
|
executor: options.executor,
|
|
45
|
-
|
|
45
|
+
compiledPath: options.compiledPath,
|
|
46
46
|
executionPath: options.executionPath,
|
|
47
|
-
|
|
47
|
+
compiledName: options.targetName,
|
|
48
48
|
workflow: options.workflow,
|
|
49
49
|
workflowSourcePath: options.workflowSourcePath,
|
|
50
50
|
stage: options.stageDefinition.id,
|
|
@@ -64,7 +64,7 @@ function finalizeValidatedStage(options, code) {
|
|
|
64
64
|
options.syncWrites?.();
|
|
65
65
|
options.reconcile?.();
|
|
66
66
|
options.refreshArtifacts?.();
|
|
67
|
-
return validateStageOutcome(options.
|
|
67
|
+
return validateStageOutcome(options.compiledPath, options.validate());
|
|
68
68
|
};
|
|
69
69
|
if (code !== 0) {
|
|
70
70
|
let completionSatisfied = false;
|
|
@@ -79,7 +79,7 @@ function finalizeValidatedStage(options, code) {
|
|
|
79
79
|
if (completionSatisfied) {
|
|
80
80
|
const validation = refreshAndValidate();
|
|
81
81
|
if (validation.ok) {
|
|
82
|
-
markRuntimeRunSucceededAfterValidation(options.
|
|
82
|
+
markRuntimeRunSucceededAfterValidation(options.compiledPath, validation.summary);
|
|
83
83
|
return {
|
|
84
84
|
ok: true,
|
|
85
85
|
code: 0,
|
|
@@ -87,7 +87,7 @@ function finalizeValidatedStage(options, code) {
|
|
|
87
87
|
};
|
|
88
88
|
}
|
|
89
89
|
reportValidationFailure(options.reporter, validation.summary);
|
|
90
|
-
markRuntimeRunFailedAfterValidation(options.
|
|
90
|
+
markRuntimeRunFailedAfterValidation(options.compiledPath, validation.summary);
|
|
91
91
|
return {
|
|
92
92
|
ok: false,
|
|
93
93
|
code,
|
|
@@ -99,7 +99,7 @@ function finalizeValidatedStage(options, code) {
|
|
|
99
99
|
const validation = refreshAndValidate();
|
|
100
100
|
if (!validation.ok) {
|
|
101
101
|
reportValidationFailure(options.reporter, validation.summary);
|
|
102
|
-
markRuntimeRunFailedAfterValidation(options.
|
|
102
|
+
markRuntimeRunFailedAfterValidation(options.compiledPath, validation.summary);
|
|
103
103
|
}
|
|
104
104
|
return {
|
|
105
105
|
ok: validation.ok,
|
package/dist/lib/workflows.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { type InterfConfig } from "./interf.js";
|
|
2
2
|
export type { WorkflowReporter, WorkflowStageResult, LocalSkillContractExtension } from "./workflow-helpers.js";
|
|
3
|
-
export { workflowQueryDirectory, workflowImproveDirectory, workflowCompileStageDirectory, emptyLocalSkillContractExtension, buildLocalSkillContractExtension, buildLocalSkillContractExtensionRelativeTo, mergeLocalSkillContractExtensions, buildStageInstructions, reportLine, reportBlankLine, reportValidationFailure,
|
|
4
|
-
export type
|
|
3
|
+
export { workflowQueryDirectory, workflowImproveDirectory, workflowCompileStageDirectory, emptyLocalSkillContractExtension, buildLocalSkillContractExtension, buildLocalSkillContractExtensionRelativeTo, mergeLocalSkillContractExtensions, buildStageInstructions, reportLine, reportBlankLine, reportValidationFailure, resolveStageAcceptance, validateStageOutcome, } from "./workflow-helpers.js";
|
|
4
|
+
export type CompiledCheck = "compiled" | "stage";
|
|
5
5
|
export interface DetectedInterfTarget {
|
|
6
6
|
path: string;
|
|
7
|
-
kind: "
|
|
8
|
-
engineType: "
|
|
7
|
+
kind: "compiled";
|
|
8
|
+
engineType: "compiled";
|
|
9
9
|
config: InterfConfig;
|
|
10
10
|
}
|
|
11
|
-
export declare function
|
|
12
|
-
export declare function
|
|
13
|
-
export declare function
|
|
14
|
-
export {
|
|
15
|
-
export type {
|
|
11
|
+
export declare function detectCompiled(cwd: string): DetectedInterfTarget | null;
|
|
12
|
+
export declare function createCompiled(name: string, sourcePath: string, workflowId?: string, about?: string, datasetPath?: string): string;
|
|
13
|
+
export declare function verifyCompiledCheck(check: CompiledCheck, compiledPath: string): import("./validate-compiled.js").CompiledWorkflowValidation;
|
|
14
|
+
export { runCompiledSummarize, runCompiledCompile, compileCompiled, resolveCompiledContext, compiledExecutionStages, } from "./compiled-compile.js";
|
|
15
|
+
export type { CompiledSummarizeResult, CompiledCompileResult, CompiledStageExecutionDefinition, StageShellRetentionMode, } from "./compiled-compile.js";
|
package/dist/lib/workflows.js
CHANGED
|
@@ -1,33 +1,31 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createCompiled as createCompiledScaffold, } from "./interf.js";
|
|
2
2
|
import { detectInterf } from "./interf.js";
|
|
3
|
-
import {
|
|
4
|
-
export { workflowQueryDirectory, workflowImproveDirectory, workflowCompileStageDirectory, emptyLocalSkillContractExtension, buildLocalSkillContractExtension, buildLocalSkillContractExtensionRelativeTo, mergeLocalSkillContractExtensions, buildStageInstructions, reportLine, reportBlankLine, reportValidationFailure,
|
|
5
|
-
export function
|
|
3
|
+
import { validateCompiledCompile, } from "./validate.js";
|
|
4
|
+
export { workflowQueryDirectory, workflowImproveDirectory, workflowCompileStageDirectory, emptyLocalSkillContractExtension, buildLocalSkillContractExtension, buildLocalSkillContractExtensionRelativeTo, mergeLocalSkillContractExtensions, buildStageInstructions, reportLine, reportBlankLine, reportValidationFailure, resolveStageAcceptance, validateStageOutcome, } from "./workflow-helpers.js";
|
|
5
|
+
export function detectCompiled(cwd) {
|
|
6
6
|
const detected = detectInterf(cwd);
|
|
7
7
|
if (!detected)
|
|
8
8
|
return null;
|
|
9
9
|
return {
|
|
10
10
|
path: detected.path,
|
|
11
|
-
kind: "
|
|
12
|
-
engineType: "
|
|
11
|
+
kind: "compiled",
|
|
12
|
+
engineType: "compiled",
|
|
13
13
|
config: detected.config,
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
|
-
export function
|
|
17
|
-
return
|
|
16
|
+
export function createCompiled(name, sourcePath, workflowId = "interf", about, datasetPath = sourcePath) {
|
|
17
|
+
return createCompiledScaffold(name, sourcePath, workflowId, about, datasetPath);
|
|
18
18
|
}
|
|
19
|
-
export function
|
|
19
|
+
export function verifyCompiledCheck(check, compiledPath) {
|
|
20
20
|
switch (check) {
|
|
21
|
-
case "
|
|
22
|
-
return
|
|
23
|
-
case "
|
|
24
|
-
return
|
|
25
|
-
case "compile":
|
|
26
|
-
return validateWorkspaceCompile(workspacePath);
|
|
21
|
+
case "compiled":
|
|
22
|
+
return validateCompiledCompile(compiledPath);
|
|
23
|
+
case "stage":
|
|
24
|
+
return validateCompiledCompile(compiledPath);
|
|
27
25
|
default: {
|
|
28
26
|
const exhaustiveCheck = check;
|
|
29
|
-
throw new Error(`Unknown
|
|
27
|
+
throw new Error(`Unknown compiled check: ${exhaustiveCheck}`);
|
|
30
28
|
}
|
|
31
29
|
}
|
|
32
30
|
}
|
|
33
|
-
export {
|
|
31
|
+
export { runCompiledSummarize, runCompiledCompile, compileCompiled, resolveCompiledContext, compiledExecutionStages, } from "./compiled-compile.js";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@interf/compiler",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Interf Compiler is a local runtime for data-processing workflows that
|
|
3
|
+
"version": "0.5.1",
|
|
4
|
+
"description": "Interf Compiler is a local runtime for data-processing workflows that prepare datasets for accurate local agent use.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"interf": "dist/bin.js"
|
|
@@ -27,22 +27,23 @@
|
|
|
27
27
|
"test:e2e:claude": "npm run test:acceptance-live -- --agent claude-code",
|
|
28
28
|
"test:e2e:codex": "npm run test:acceptance-live -- --agent codex",
|
|
29
29
|
"test:e2e:quick": "npm run test:e2e:quick:matrix",
|
|
30
|
-
"test:e2e:quick:
|
|
31
|
-
"test:e2e:quick:
|
|
30
|
+
"test:e2e:quick:agent": "node scripts/run-quick-e2e.mjs",
|
|
31
|
+
"test:e2e:quick:claude": "npm run test:e2e:quick:agent -- --agent claude-code",
|
|
32
|
+
"test:e2e:quick:codex": "npm run test:e2e:quick:agent -- --agent codex",
|
|
32
33
|
"test:e2e:quick:matrix": "npm run test:e2e:quick:claude && npm run test:e2e:quick:codex",
|
|
33
34
|
"test:internal:cbre:fast": "npm run test:matrix -- --matrix internal/test-matrices/cbre-chart-sanity.json",
|
|
34
|
-
"test:internal:cbre:fast:keep": "npm run test:matrix -- --matrix internal/test-matrices/cbre-chart-sanity.json --keep-
|
|
35
|
+
"test:internal:cbre:fast:keep": "npm run test:matrix -- --matrix internal/test-matrices/cbre-chart-sanity.json --keep-project-clones",
|
|
35
36
|
"test:internal:cbre:max": "npm run test:matrix -- --matrix internal/test-matrices/cbre-chart-tier1-max.json",
|
|
36
|
-
"test:internal:cbre:max:keep": "npm run test:matrix -- --matrix internal/test-matrices/cbre-chart-tier1-max.json --keep-
|
|
37
|
+
"test:internal:cbre:max:keep": "npm run test:matrix -- --matrix internal/test-matrices/cbre-chart-tier1-max.json --keep-project-clones",
|
|
37
38
|
"test:full": "npm test && npm run test:e2e:quick:matrix",
|
|
38
39
|
"test:release:matrix": "npm run test:internal:cbre:max",
|
|
39
|
-
"test:release": "npm test && npm run test:
|
|
40
|
+
"test:release": "npm test && npm run test:acceptance-live -- --agent claude-code --with-test && npm run test:acceptance-live -- --agent codex --with-test",
|
|
40
41
|
"test:acceptance-live": "npm run build && node scripts/acceptance-live.mjs",
|
|
41
|
-
"test:acceptance-cache:refresh": "npm run test:acceptance-cache:refresh:claude",
|
|
42
|
-
"test:acceptance-cache:refresh:claude": "
|
|
43
|
-
"test:acceptance-cache:refresh:codex": "
|
|
44
|
-
"test:acceptance-quick:create-
|
|
45
|
-
"test:acceptance-quick:query
|
|
42
|
+
"test:acceptance-cache:refresh": "npm run test:acceptance-cache:refresh:claude && npm run test:acceptance-cache:refresh:codex",
|
|
43
|
+
"test:acceptance-cache:refresh:claude": "node scripts/acceptance-cache-refresh.mjs --agent claude-code",
|
|
44
|
+
"test:acceptance-cache:refresh:codex": "node scripts/acceptance-cache-refresh.mjs --agent codex",
|
|
45
|
+
"test:acceptance-quick:create-compiled": "npm run build && node scripts/acceptance-targeted.mjs create-compiled",
|
|
46
|
+
"test:acceptance-quick:compiled-query": "npm run build && node scripts/acceptance-targeted.mjs compiled-query",
|
|
46
47
|
"test:acceptance-quick:self-improving": "npm run build && node scripts/acceptance-targeted.mjs self-improving-compile",
|
|
47
48
|
"prepublishOnly": "node scripts/prepublish-gate.mjs"
|
|
48
49
|
},
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { SourceWorkspaceConfig } from "../lib/schema.js";
|
|
2
|
-
import { type StageShellRetentionMode } from "../lib/workflows.js";
|
|
3
|
-
import type { WorkflowExecutor } from "../lib/executors.js";
|
|
4
|
-
import type { WorkspaceCompileResult } from "../lib/workflows.js";
|
|
5
|
-
export interface SavedWorkspaceEntry {
|
|
6
|
-
config: SourceWorkspaceConfig;
|
|
7
|
-
path: string | null;
|
|
8
|
-
localDraft: boolean;
|
|
9
|
-
}
|
|
10
|
-
export declare function listSavedWorkspaceEntries(sourcePath: string): SavedWorkspaceEntry[];
|
|
11
|
-
export declare function findBuiltWorkspacePath(sourcePath: string, workspaceName: string): string | null;
|
|
12
|
-
export declare function findSavedWorkspaceConfig(sourcePath: string, workspaceName: string): SourceWorkspaceConfig | null;
|
|
13
|
-
export declare function chooseWorkspaceConfigToBuild(options: {
|
|
14
|
-
sourcePath: string;
|
|
15
|
-
selectMessage: string;
|
|
16
|
-
}): Promise<SourceWorkspaceConfig | null | undefined>;
|
|
17
|
-
export declare function createWorkspaceFromConfig(sourcePath: string, workspaceConfig: SourceWorkspaceConfig): string;
|
|
18
|
-
export declare function ensureWorkspaceFromConfig(sourcePath: string, workspaceConfig: SourceWorkspaceConfig): string;
|
|
19
|
-
export declare function compileWorkspaceWithReporter(executor: WorkflowExecutor, workspacePath: string, options?: {
|
|
20
|
-
heading?: string;
|
|
21
|
-
successMessage?: string;
|
|
22
|
-
preserveStageShells?: StageShellRetentionMode;
|
|
23
|
-
}): Promise<WorkspaceCompileResult>;
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import chalk from "chalk";
|
|
2
|
-
import * as p from "@clack/prompts";
|
|
3
|
-
import { listWorkspacesForSourceFolder } from "../lib/interf.js";
|
|
4
|
-
import { addWorkspace } from "../lib/registry.js";
|
|
5
|
-
import { listSourceWorkspaceConfigs, loadWorkspaceControlConfig, loadSourceFolderConfig, sourceWorkspaceConfigFromInterfConfig, syncWorkspaceInterfConfigFromSourceWorkspaceConfig, } from "../lib/source-config.js";
|
|
6
|
-
import { compileWorkspace, createWorkspace, } from "../lib/workflows.js";
|
|
7
|
-
import { formatWorkflowExecutionProfile } from "../lib/execution-profile.js";
|
|
8
|
-
function formatSavedWorkspaceHint(entry) {
|
|
9
|
-
const config = entry.config;
|
|
10
|
-
const checkCount = config.checks.length;
|
|
11
|
-
const workflowHint = `workflow ${config.workflow ?? "interf"}${entry.localDraft ? " (local draft)" : ""}`;
|
|
12
|
-
if (config.about)
|
|
13
|
-
return `${config.about} · ${workflowHint}`;
|
|
14
|
-
if (checkCount === 0)
|
|
15
|
-
return "No saved truth checks yet";
|
|
16
|
-
return `${checkCount} saved truth check${checkCount === 1 ? "" : "s"} · ${workflowHint}`;
|
|
17
|
-
}
|
|
18
|
-
export function listSavedWorkspaceEntries(sourcePath) {
|
|
19
|
-
const entries = new Map();
|
|
20
|
-
for (const builtWorkspace of listWorkspacesForSourceFolder(sourcePath)) {
|
|
21
|
-
const workspaceConfig = loadWorkspaceControlConfig(builtWorkspace.path)
|
|
22
|
-
?? sourceWorkspaceConfigFromInterfConfig(builtWorkspace.config);
|
|
23
|
-
entries.set(builtWorkspace.config.name, {
|
|
24
|
-
config: workspaceConfig,
|
|
25
|
-
path: builtWorkspace.path,
|
|
26
|
-
localDraft: builtWorkspace.config.workflow_origin?.local_draft === true,
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
for (const config of listSourceWorkspaceConfigs(loadSourceFolderConfig(sourcePath))) {
|
|
30
|
-
if (entries.has(config.name))
|
|
31
|
-
continue;
|
|
32
|
-
entries.set(config.name, {
|
|
33
|
-
config,
|
|
34
|
-
path: null,
|
|
35
|
-
localDraft: false,
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
return Array.from(entries.values()).sort((left, right) => left.config.name.localeCompare(right.config.name));
|
|
39
|
-
}
|
|
40
|
-
export function findBuiltWorkspacePath(sourcePath, workspaceName) {
|
|
41
|
-
return listSavedWorkspaceEntries(sourcePath).find((entry) => entry.config.name === workspaceName)?.path ?? null;
|
|
42
|
-
}
|
|
43
|
-
export function findSavedWorkspaceConfig(sourcePath, workspaceName) {
|
|
44
|
-
return listSavedWorkspaceEntries(sourcePath).find((entry) => entry.config.name === workspaceName)?.config ?? null;
|
|
45
|
-
}
|
|
46
|
-
export async function chooseWorkspaceConfigToBuild(options) {
|
|
47
|
-
const savedEntries = listSavedWorkspaceEntries(options.sourcePath);
|
|
48
|
-
if (savedEntries.length === 0) {
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
if (savedEntries.length === 1) {
|
|
52
|
-
return savedEntries[0]?.config ?? null;
|
|
53
|
-
}
|
|
54
|
-
const selected = await p.select({
|
|
55
|
-
message: options.selectMessage,
|
|
56
|
-
options: savedEntries.map((entry) => ({
|
|
57
|
-
value: entry.config.name,
|
|
58
|
-
label: entry.config.name,
|
|
59
|
-
hint: [
|
|
60
|
-
formatSavedWorkspaceHint(entry),
|
|
61
|
-
entry.path ? "built" : "not built yet",
|
|
62
|
-
].join(" · "),
|
|
63
|
-
})),
|
|
64
|
-
});
|
|
65
|
-
if (p.isCancel(selected))
|
|
66
|
-
return undefined;
|
|
67
|
-
return savedEntries.find((entry) => entry.config.name === selected)?.config ?? null;
|
|
68
|
-
}
|
|
69
|
-
export function createWorkspaceFromConfig(sourcePath, workspaceConfig) {
|
|
70
|
-
const workflowId = workspaceConfig.workflow ?? "interf";
|
|
71
|
-
const workspacePath = createWorkspace(workspaceConfig.name, sourcePath, workflowId, workspaceConfig.about);
|
|
72
|
-
syncWorkspaceInterfConfigFromSourceWorkspaceConfig(workspacePath, workspaceConfig);
|
|
73
|
-
addWorkspace(workspaceConfig.name, workspacePath, workflowId);
|
|
74
|
-
return workspacePath;
|
|
75
|
-
}
|
|
76
|
-
export function ensureWorkspaceFromConfig(sourcePath, workspaceConfig) {
|
|
77
|
-
const existingPath = findBuiltWorkspacePath(sourcePath, workspaceConfig.name);
|
|
78
|
-
if (existingPath) {
|
|
79
|
-
syncWorkspaceInterfConfigFromSourceWorkspaceConfig(existingPath, workspaceConfig);
|
|
80
|
-
addWorkspace(workspaceConfig.name, existingPath, workspaceConfig.workflow ?? "interf");
|
|
81
|
-
return existingPath;
|
|
82
|
-
}
|
|
83
|
-
return createWorkspaceFromConfig(sourcePath, workspaceConfig);
|
|
84
|
-
}
|
|
85
|
-
export async function compileWorkspaceWithReporter(executor, workspacePath, options = {}) {
|
|
86
|
-
console.log();
|
|
87
|
-
console.log(chalk.bold(` ${options.heading ?? "Building compiled workspace..."}`));
|
|
88
|
-
const profileLabel = formatWorkflowExecutionProfile(executor.executionProfile);
|
|
89
|
-
if (profileLabel) {
|
|
90
|
-
console.log(chalk.dim(` Execution profile: ${profileLabel}`));
|
|
91
|
-
}
|
|
92
|
-
console.log();
|
|
93
|
-
const reporter = {
|
|
94
|
-
line: (message) => console.log(chalk.dim(` ${message}`)),
|
|
95
|
-
blankLine: () => console.log(),
|
|
96
|
-
};
|
|
97
|
-
const result = await compileWorkspace({
|
|
98
|
-
executor,
|
|
99
|
-
workspacePath,
|
|
100
|
-
reporter,
|
|
101
|
-
preserveStageShells: options.preserveStageShells,
|
|
102
|
-
});
|
|
103
|
-
if (!result.ok) {
|
|
104
|
-
return result;
|
|
105
|
-
}
|
|
106
|
-
console.log();
|
|
107
|
-
console.log(chalk.green(` ✓ ${options.successMessage ?? "Compiled workspace ready."}`));
|
|
108
|
-
return result;
|
|
109
|
-
}
|
package/dist/lib/registry.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export interface WorkspaceEntry {
|
|
2
|
-
name: string;
|
|
3
|
-
path: string;
|
|
4
|
-
workflow: string;
|
|
5
|
-
created: string;
|
|
6
|
-
}
|
|
7
|
-
export interface Registry {
|
|
8
|
-
version: number;
|
|
9
|
-
workspaces: WorkspaceEntry[];
|
|
10
|
-
}
|
|
11
|
-
export declare function loadRegistry(): Registry;
|
|
12
|
-
export declare function saveRegistry(registry: Registry): void;
|
|
13
|
-
export declare function listWorkspaceEntries(registry?: Registry): WorkspaceEntry[];
|
|
14
|
-
export declare function addWorkspace(name: string, path: string, workflow: string): void;
|
|
15
|
-
export declare function findWorkspaceByName(name: string): WorkspaceEntry[];
|
|
16
|
-
export declare function findInterf(name: string): WorkspaceEntry | undefined;
|
package/dist/lib/registry.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
2
|
-
import { INTERF_HOME, REGISTRY_PATH } from "./config.js";
|
|
3
|
-
import { readJsonFileUnchecked } from "./parse.js";
|
|
4
|
-
function normalizeWorkspaceEntry(value) {
|
|
5
|
-
const name = String(value.name ?? "");
|
|
6
|
-
const path = String(value.path ?? "");
|
|
7
|
-
if (name.length === 0 || path.length === 0)
|
|
8
|
-
return null;
|
|
9
|
-
return {
|
|
10
|
-
name,
|
|
11
|
-
path,
|
|
12
|
-
workflow: String(value.workflow ?? "interf"),
|
|
13
|
-
created: String(value.created ?? new Date().toISOString()),
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
export function loadRegistry() {
|
|
17
|
-
const empty = { version: 7, workspaces: [] };
|
|
18
|
-
if (!existsSync(REGISTRY_PATH)) {
|
|
19
|
-
return empty;
|
|
20
|
-
}
|
|
21
|
-
const raw = readJsonFileUnchecked(REGISTRY_PATH, "Interf registry");
|
|
22
|
-
if (!raw)
|
|
23
|
-
return empty;
|
|
24
|
-
const seen = new Set();
|
|
25
|
-
const workspaces = [];
|
|
26
|
-
const rawWorkspaces = Array.isArray(raw.workspaces) ? raw.workspaces : [];
|
|
27
|
-
for (const value of rawWorkspaces) {
|
|
28
|
-
if (!value || typeof value !== "object")
|
|
29
|
-
continue;
|
|
30
|
-
const entry = normalizeWorkspaceEntry(value);
|
|
31
|
-
if (!entry || seen.has(entry.path))
|
|
32
|
-
continue;
|
|
33
|
-
seen.add(entry.path);
|
|
34
|
-
workspaces.push(entry);
|
|
35
|
-
}
|
|
36
|
-
return {
|
|
37
|
-
version: 7,
|
|
38
|
-
workspaces,
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
export function saveRegistry(registry) {
|
|
42
|
-
mkdirSync(INTERF_HOME, { recursive: true });
|
|
43
|
-
writeFileSync(REGISTRY_PATH, JSON.stringify({ version: 7, workspaces: registry.workspaces }, null, 2) + "\n");
|
|
44
|
-
}
|
|
45
|
-
export function listWorkspaceEntries(registry = loadRegistry()) {
|
|
46
|
-
return [...registry.workspaces].sort((left, right) => left.name.localeCompare(right.name) || left.path.localeCompare(right.path));
|
|
47
|
-
}
|
|
48
|
-
export function addWorkspace(name, path, workflow) {
|
|
49
|
-
const reg = loadRegistry();
|
|
50
|
-
reg.workspaces = reg.workspaces.filter((entry) => entry.path !== path);
|
|
51
|
-
reg.workspaces.push({
|
|
52
|
-
name,
|
|
53
|
-
path,
|
|
54
|
-
workflow,
|
|
55
|
-
created: new Date().toISOString(),
|
|
56
|
-
});
|
|
57
|
-
saveRegistry(reg);
|
|
58
|
-
}
|
|
59
|
-
export function findWorkspaceByName(name) {
|
|
60
|
-
return listWorkspaceEntries().filter((workspace) => workspace.name === name);
|
|
61
|
-
}
|
|
62
|
-
export function findInterf(name) {
|
|
63
|
-
const matches = listWorkspaceEntries().filter((workspace) => workspace.name === name);
|
|
64
|
-
return matches.length === 1 ? matches[0] : undefined;
|
|
65
|
-
}
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
export interface WorkspaceValidationSummary {
|
|
2
|
-
config_present: boolean;
|
|
3
|
-
config_valid: boolean;
|
|
4
|
-
config_type_match: boolean;
|
|
5
|
-
summary_frontmatter_valid: boolean;
|
|
6
|
-
abstracts_valid: boolean;
|
|
7
|
-
invalid_frontmatter: number;
|
|
8
|
-
short_abstracts: number;
|
|
9
|
-
broken_links: number;
|
|
10
|
-
}
|
|
11
|
-
export interface WorkspaceSummarizeValidation {
|
|
12
|
-
ok: boolean;
|
|
13
|
-
required: boolean;
|
|
14
|
-
summary: string;
|
|
15
|
-
counts: {
|
|
16
|
-
source_total: number;
|
|
17
|
-
source_covered: number;
|
|
18
|
-
summarized: number;
|
|
19
|
-
to_summarize: number;
|
|
20
|
-
invalid_frontmatter: number;
|
|
21
|
-
short_abstracts: number;
|
|
22
|
-
inventory_total: number;
|
|
23
|
-
};
|
|
24
|
-
checks: {
|
|
25
|
-
config_present: boolean;
|
|
26
|
-
config_valid: boolean;
|
|
27
|
-
config_type_match: boolean;
|
|
28
|
-
summaries_present: boolean;
|
|
29
|
-
state_present: boolean;
|
|
30
|
-
state_valid: boolean;
|
|
31
|
-
inventory_present: boolean;
|
|
32
|
-
inventory_valid: boolean;
|
|
33
|
-
inventory_complete: boolean;
|
|
34
|
-
inventory_matches_summaries: boolean;
|
|
35
|
-
state_covers_summaries: boolean;
|
|
36
|
-
full_source_coverage: boolean;
|
|
37
|
-
summary_frontmatter_valid: boolean;
|
|
38
|
-
abstracts_valid: boolean;
|
|
39
|
-
};
|
|
40
|
-
errors: string[];
|
|
41
|
-
}
|
|
42
|
-
export interface WorkspaceCompileValidation {
|
|
43
|
-
ok: boolean;
|
|
44
|
-
required: boolean;
|
|
45
|
-
summary: string;
|
|
46
|
-
counts: {
|
|
47
|
-
source_total: number;
|
|
48
|
-
summarized: number;
|
|
49
|
-
structured: number;
|
|
50
|
-
shaped: number;
|
|
51
|
-
compiled: number;
|
|
52
|
-
inventory_total: number;
|
|
53
|
-
frontmatter_scanned: number;
|
|
54
|
-
abstracts_read: number;
|
|
55
|
-
full_reads: number;
|
|
56
|
-
entity_files: number;
|
|
57
|
-
claim_files: number;
|
|
58
|
-
index_files: number;
|
|
59
|
-
outputs: number;
|
|
60
|
-
};
|
|
61
|
-
checks: {
|
|
62
|
-
config_present: boolean;
|
|
63
|
-
config_valid: boolean;
|
|
64
|
-
config_type_match: boolean;
|
|
65
|
-
summarize_complete: boolean;
|
|
66
|
-
structure_complete: boolean;
|
|
67
|
-
state_present: boolean;
|
|
68
|
-
state_valid: boolean;
|
|
69
|
-
inventory_present: boolean;
|
|
70
|
-
inventory_valid: boolean;
|
|
71
|
-
inventory_complete: boolean;
|
|
72
|
-
inventory_matches_summaries: boolean;
|
|
73
|
-
frontmatter_inventory_complete: boolean;
|
|
74
|
-
abstracts_cover_summaries: boolean;
|
|
75
|
-
shaped_complete: boolean;
|
|
76
|
-
compiled_complete: boolean;
|
|
77
|
-
outputs_present: boolean;
|
|
78
|
-
home_present: boolean;
|
|
79
|
-
links_valid: boolean;
|
|
80
|
-
};
|
|
81
|
-
errors: string[];
|
|
82
|
-
}
|
|
83
|
-
export interface WorkspaceStructureValidation {
|
|
84
|
-
ok: boolean;
|
|
85
|
-
required: boolean;
|
|
86
|
-
summary: string;
|
|
87
|
-
counts: {
|
|
88
|
-
source_total: number;
|
|
89
|
-
summarized: number;
|
|
90
|
-
structured: number;
|
|
91
|
-
inventory_total: number;
|
|
92
|
-
frontmatter_scanned: number;
|
|
93
|
-
abstracts_read: number;
|
|
94
|
-
entity_files: number;
|
|
95
|
-
claim_files: number;
|
|
96
|
-
index_files: number;
|
|
97
|
-
outputs: number;
|
|
98
|
-
};
|
|
99
|
-
checks: {
|
|
100
|
-
config_present: boolean;
|
|
101
|
-
config_valid: boolean;
|
|
102
|
-
config_type_match: boolean;
|
|
103
|
-
summarize_complete: boolean;
|
|
104
|
-
state_present: boolean;
|
|
105
|
-
state_valid: boolean;
|
|
106
|
-
inventory_present: boolean;
|
|
107
|
-
inventory_valid: boolean;
|
|
108
|
-
inventory_complete: boolean;
|
|
109
|
-
inventory_matches_summaries: boolean;
|
|
110
|
-
frontmatter_inventory_complete: boolean;
|
|
111
|
-
abstracts_cover_summaries: boolean;
|
|
112
|
-
structured_complete: boolean;
|
|
113
|
-
outputs_present: boolean;
|
|
114
|
-
links_valid: boolean;
|
|
115
|
-
};
|
|
116
|
-
errors: string[];
|
|
117
|
-
}
|
|
118
|
-
export declare function validateWorkspace(dirPath: string): WorkspaceValidationSummary;
|
|
119
|
-
export declare function validateWorkspaceSummarize(dirPath: string): WorkspaceSummarizeValidation;
|
|
120
|
-
export declare function validateWorkspaceCompile(dirPath: string): WorkspaceCompileValidation;
|
|
121
|
-
export declare function validateWorkspaceStructure(dirPath: string): WorkspaceStructureValidation;
|