@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.
Files changed (162) hide show
  1. package/README.md +70 -66
  2. package/builtin-workflows/interf/README.md +6 -6
  3. package/builtin-workflows/interf/compile/stages/shape/SKILL.md +7 -7
  4. package/builtin-workflows/interf/compile/stages/structure/SKILL.md +2 -2
  5. package/builtin-workflows/interf/compile/stages/summarize/SKILL.md +1 -1
  6. package/builtin-workflows/interf/{workspace.schema.json → compiled.schema.json} +5 -5
  7. package/builtin-workflows/interf/improve/SKILL.md +3 -3
  8. package/builtin-workflows/interf/use/query/SKILL.md +2 -2
  9. package/builtin-workflows/interf/workflow.json +42 -31
  10. package/dist/commands/check-draft.d.ts +19 -0
  11. package/dist/commands/check-draft.js +110 -0
  12. package/dist/commands/compile-controller.d.ts +4 -4
  13. package/dist/commands/compile-controller.js +117 -81
  14. package/dist/commands/compile.d.ts +5 -5
  15. package/dist/commands/compile.js +61 -62
  16. package/dist/commands/compiled-flow.d.ts +23 -0
  17. package/dist/commands/compiled-flow.js +112 -0
  18. package/dist/commands/create-workflow-wizard.d.ts +3 -3
  19. package/dist/commands/create-workflow-wizard.js +11 -11
  20. package/dist/commands/create.d.ts +2 -2
  21. package/dist/commands/create.js +50 -57
  22. package/dist/commands/default.js +2 -2
  23. package/dist/commands/executor-flow.d.ts +20 -1
  24. package/dist/commands/executor-flow.js +67 -7
  25. package/dist/commands/init.js +242 -289
  26. package/dist/commands/list.js +14 -10
  27. package/dist/commands/reset.js +6 -6
  28. package/dist/commands/source-config-wizard.d.ts +12 -8
  29. package/dist/commands/source-config-wizard.js +356 -119
  30. package/dist/commands/status.js +49 -26
  31. package/dist/commands/test-flow.d.ts +23 -10
  32. package/dist/commands/test-flow.js +274 -65
  33. package/dist/commands/test.d.ts +7 -1
  34. package/dist/commands/test.js +264 -65
  35. package/dist/commands/verify.js +23 -14
  36. package/dist/index.d.ts +7 -7
  37. package/dist/index.js +4 -4
  38. package/dist/lib/agent-args.js +2 -1
  39. package/dist/lib/agent-constants.js +1 -1
  40. package/dist/lib/agent-render.js +4 -4
  41. package/dist/lib/agent-shells.d.ts +8 -8
  42. package/dist/lib/agent-shells.js +231 -142
  43. package/dist/lib/{workflow-abi.d.ts → builtin-compiled-workflow.d.ts} +37 -46
  44. package/dist/lib/builtin-compiled-workflow.js +153 -0
  45. package/dist/lib/compiled-compile.d.ts +52 -0
  46. package/dist/lib/compiled-compile.js +274 -0
  47. package/dist/lib/compiled-home.d.ts +5 -0
  48. package/dist/lib/compiled-home.js +32 -0
  49. package/dist/lib/compiled-paths.d.ts +39 -0
  50. package/dist/lib/compiled-paths.js +103 -0
  51. package/dist/lib/{workspace-raw.d.ts → compiled-raw.d.ts} +9 -8
  52. package/dist/lib/{workspace-raw.js → compiled-raw.js} +16 -14
  53. package/dist/lib/compiled-reset.d.ts +1 -0
  54. package/dist/lib/compiled-reset.js +44 -0
  55. package/dist/lib/compiled-schema.d.ts +27 -0
  56. package/dist/lib/compiled-schema.js +110 -0
  57. package/dist/lib/config.d.ts +0 -1
  58. package/dist/lib/config.js +0 -1
  59. package/dist/lib/discovery.d.ts +1 -1
  60. package/dist/lib/discovery.js +3 -3
  61. package/dist/lib/interf-bootstrap.d.ts +1 -1
  62. package/dist/lib/interf-bootstrap.js +4 -4
  63. package/dist/lib/interf-detect.d.ts +9 -10
  64. package/dist/lib/interf-detect.js +70 -59
  65. package/dist/lib/interf-scaffold.d.ts +2 -2
  66. package/dist/lib/interf-scaffold.js +90 -57
  67. package/dist/lib/interf-workflow-package.d.ts +3 -3
  68. package/dist/lib/interf-workflow-package.js +30 -30
  69. package/dist/lib/interf.d.ts +5 -5
  70. package/dist/lib/interf.js +4 -4
  71. package/dist/lib/local-workflows.d.ts +4 -4
  72. package/dist/lib/local-workflows.js +35 -70
  73. package/dist/lib/obsidian.d.ts +1 -1
  74. package/dist/lib/parse.js +92 -1
  75. package/dist/lib/project-paths.d.ts +11 -0
  76. package/dist/lib/project-paths.js +32 -0
  77. package/dist/lib/runtime-acceptance.d.ts +7 -1
  78. package/dist/lib/runtime-acceptance.js +194 -59
  79. package/dist/lib/runtime-contracts.d.ts +2 -4
  80. package/dist/lib/runtime-contracts.js +17 -161
  81. package/dist/lib/runtime-inventory.d.ts +7 -0
  82. package/dist/lib/runtime-inventory.js +29 -0
  83. package/dist/lib/runtime-paths.js +5 -5
  84. package/dist/lib/runtime-prompt.js +7 -6
  85. package/dist/lib/runtime-reconcile.d.ts +2 -3
  86. package/dist/lib/runtime-reconcile.js +94 -184
  87. package/dist/lib/runtime-runs.js +25 -119
  88. package/dist/lib/runtime-types.d.ts +10 -19
  89. package/dist/lib/runtime.d.ts +2 -2
  90. package/dist/lib/runtime.js +1 -1
  91. package/dist/lib/schema.d.ts +169 -153
  92. package/dist/lib/schema.js +116 -164
  93. package/dist/lib/source-config.d.ts +24 -20
  94. package/dist/lib/source-config.js +159 -122
  95. package/dist/lib/state-artifacts.d.ts +5 -5
  96. package/dist/lib/state-artifacts.js +8 -8
  97. package/dist/lib/state-health.d.ts +4 -4
  98. package/dist/lib/state-health.js +110 -126
  99. package/dist/lib/state-io.d.ts +8 -8
  100. package/dist/lib/state-io.js +21 -102
  101. package/dist/lib/state-paths.js +5 -5
  102. package/dist/lib/state-view.d.ts +4 -4
  103. package/dist/lib/state-view.js +52 -55
  104. package/dist/lib/state.d.ts +5 -5
  105. package/dist/lib/state.js +4 -4
  106. package/dist/lib/summarize-plan.d.ts +3 -2
  107. package/dist/lib/summarize-plan.js +19 -21
  108. package/dist/lib/test-execution.js +9 -9
  109. package/dist/lib/test-matrices.d.ts +3 -3
  110. package/dist/lib/test-matrices.js +6 -6
  111. package/dist/lib/test-paths.d.ts +4 -4
  112. package/dist/lib/test-paths.js +26 -11
  113. package/dist/lib/test-sandbox.d.ts +1 -1
  114. package/dist/lib/test-sandbox.js +32 -38
  115. package/dist/lib/test-specs.js +1 -1
  116. package/dist/lib/test-targets.d.ts +2 -2
  117. package/dist/lib/test-targets.js +11 -11
  118. package/dist/lib/test-types.d.ts +1 -1
  119. package/dist/lib/test.d.ts +1 -1
  120. package/dist/lib/test.js +1 -1
  121. package/dist/lib/util.d.ts +2 -0
  122. package/dist/lib/util.js +14 -1
  123. package/dist/lib/validate-compiled.d.ts +27 -0
  124. package/dist/lib/validate-compiled.js +238 -0
  125. package/dist/lib/validate-helpers.d.ts +0 -8
  126. package/dist/lib/validate-helpers.js +0 -30
  127. package/dist/lib/validate.d.ts +6 -4
  128. package/dist/lib/validate.js +76 -27
  129. package/dist/lib/workflow-definitions.d.ts +12 -11
  130. package/dist/lib/workflow-definitions.js +45 -55
  131. package/dist/lib/workflow-helpers.d.ts +2 -3
  132. package/dist/lib/workflow-helpers.js +9 -13
  133. package/dist/lib/workflow-improvement.d.ts +3 -3
  134. package/dist/lib/workflow-improvement.js +48 -48
  135. package/dist/lib/workflow-primitives.d.ts +2 -0
  136. package/dist/lib/workflow-primitives.js +5 -0
  137. package/dist/lib/workflow-review-paths.d.ts +3 -3
  138. package/dist/lib/workflow-review-paths.js +11 -11
  139. package/dist/lib/workflow-stage-runner.d.ts +1 -1
  140. package/dist/lib/workflow-stage-runner.js +8 -8
  141. package/dist/lib/workflows.d.ts +9 -9
  142. package/dist/lib/workflows.js +15 -17
  143. package/package.json +13 -12
  144. package/dist/commands/workspace-flow.d.ts +0 -23
  145. package/dist/commands/workspace-flow.js +0 -109
  146. package/dist/lib/registry.d.ts +0 -16
  147. package/dist/lib/registry.js +0 -65
  148. package/dist/lib/validate-workspace.d.ts +0 -121
  149. package/dist/lib/validate-workspace.js +0 -407
  150. package/dist/lib/workflow-abi.js +0 -181
  151. package/dist/lib/workspace-compile.d.ts +0 -54
  152. package/dist/lib/workspace-compile.js +0 -476
  153. package/dist/lib/workspace-home.d.ts +0 -5
  154. package/dist/lib/workspace-home.js +0 -32
  155. package/dist/lib/workspace-layout.d.ts +0 -2
  156. package/dist/lib/workspace-layout.js +0 -60
  157. package/dist/lib/workspace-paths.d.ts +0 -41
  158. package/dist/lib/workspace-paths.js +0 -107
  159. package/dist/lib/workspace-reset.d.ts +0 -1
  160. package/dist/lib/workspace-reset.js +0 -43
  161. package/dist/lib/workspace-schema.d.ts +0 -17
  162. 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
- workspacePath: string;
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
- workspacePath: options.workspacePath,
20
+ compiledPath: options.compiledPath,
21
21
  executionPath: options.executionPath,
22
- workspaceName: options.targetName,
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
- workspacePath: options.workspacePath,
45
+ compiledPath: options.compiledPath,
46
46
  executionPath: options.executionPath,
47
- workspaceName: options.targetName,
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.workspacePath, options.validate());
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.workspacePath, validation.summary);
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.workspacePath, validation.summary);
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.workspacePath, validation.summary);
102
+ markRuntimeRunFailedAfterValidation(options.compiledPath, validation.summary);
103
103
  }
104
104
  return {
105
105
  ok: validation.ok,
@@ -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, bundledSkillForContractType, resolveStageAcceptance, validateStageOutcome, } from "./workflow-helpers.js";
4
- export type WorkspaceCheck = "summarize" | "structure" | "compile";
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: "workspace";
8
- engineType: "workspace";
7
+ kind: "compiled";
8
+ engineType: "compiled";
9
9
  config: InterfConfig;
10
10
  }
11
- export declare function detectWorkspace(cwd: string): DetectedInterfTarget | null;
12
- export declare function createWorkspace(name: string, sourcePath: string, workflowId?: string, about?: string): string;
13
- export declare function verifyWorkspaceCheck(check: WorkspaceCheck, workspacePath: string): import("./validate-workspace.js").WorkspaceSummarizeValidation | import("./validate-workspace.js").WorkspaceCompileValidation | import("./validate-workspace.js").WorkspaceStructureValidation;
14
- export { runWorkspaceSummarize, runWorkspaceCompile, compileWorkspace, resolveWorkspaceContext, workspaceExecutionStages, } from "./workspace-compile.js";
15
- export type { WorkspaceSummarizeResult, WorkspaceCompileResult, WorkspaceStageExecutionDefinition, StageShellRetentionMode, } from "./workspace-compile.js";
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";
@@ -1,33 +1,31 @@
1
- import { createWorkspace as createWorkspaceScaffold, } from "./interf.js";
1
+ import { createCompiled as createCompiledScaffold, } from "./interf.js";
2
2
  import { detectInterf } from "./interf.js";
3
- import { validateWorkspaceSummarize, validateWorkspaceStructure, validateWorkspaceCompile, } from "./validate.js";
4
- export { workflowQueryDirectory, workflowImproveDirectory, workflowCompileStageDirectory, emptyLocalSkillContractExtension, buildLocalSkillContractExtension, buildLocalSkillContractExtensionRelativeTo, mergeLocalSkillContractExtensions, buildStageInstructions, reportLine, reportBlankLine, reportValidationFailure, bundledSkillForContractType, resolveStageAcceptance, validateStageOutcome, } from "./workflow-helpers.js";
5
- export function detectWorkspace(cwd) {
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: "workspace",
12
- engineType: "workspace",
11
+ kind: "compiled",
12
+ engineType: "compiled",
13
13
  config: detected.config,
14
14
  };
15
15
  }
16
- export function createWorkspace(name, sourcePath, workflowId = "interf", about) {
17
- return createWorkspaceScaffold(name, sourcePath, workflowId, about);
16
+ export function createCompiled(name, sourcePath, workflowId = "interf", about, datasetPath = sourcePath) {
17
+ return createCompiledScaffold(name, sourcePath, workflowId, about, datasetPath);
18
18
  }
19
- export function verifyWorkspaceCheck(check, workspacePath) {
19
+ export function verifyCompiledCheck(check, compiledPath) {
20
20
  switch (check) {
21
- case "summarize":
22
- return validateWorkspaceSummarize(workspacePath);
23
- case "structure":
24
- return validateWorkspaceStructure(workspacePath);
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 workspace check: ${exhaustiveCheck}`);
27
+ throw new Error(`Unknown compiled check: ${exhaustiveCheck}`);
30
28
  }
31
29
  }
32
30
  }
33
- export { runWorkspaceSummarize, runWorkspaceCompile, compileWorkspace, resolveWorkspaceContext, workspaceExecutionStages, } from "./workspace-compile.js";
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.1",
4
- "description": "Interf Compiler is a local runtime for data-processing workflows that turn datasets into compiled workspaces for local agents.",
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:claude": "npm run test:acceptance-cache:refresh:claude && npm run test:acceptance-quick:create-workspace -- --agent claude-code --cache-root .interf-test-cache/claude-code && npm run test:acceptance-quick:query-workspace -- --agent claude-code --cache-root .interf-test-cache/claude-code && npm run test:acceptance-quick:self-improving -- --agent claude-code",
31
- "test:e2e:quick:codex": "npm run test:acceptance-cache:refresh:codex && npm run test:acceptance-quick:create-workspace -- --agent codex --cache-root .interf-test-cache/codex && npm run test:acceptance-quick:query-workspace -- --agent codex --cache-root .interf-test-cache/codex && npm run test:acceptance-quick:self-improving -- --agent codex",
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-workspaces",
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-workspaces",
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:e2e:claude && npm run test:e2e:codex && npm run test:release:matrix",
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": "npm run build && node scripts/acceptance-live.mjs --agent claude-code --output-root .interf-test-cache/claude-code",
43
- "test:acceptance-cache:refresh:codex": "npm run build && node scripts/acceptance-live.mjs --agent codex --output-root .interf-test-cache/codex",
44
- "test:acceptance-quick:create-workspace": "npm run build && node scripts/acceptance-targeted.mjs create-workspace",
45
- "test:acceptance-quick:query-workspace": "npm run build && node scripts/acceptance-targeted.mjs workspace-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
- }
@@ -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;
@@ -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;