@interf/compiler 0.3.4 → 0.4.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 +128 -149
- package/builtin-workflows/interf/README.md +19 -0
- package/builtin-workflows/interf/compile/stages/shape/SKILL.md +28 -0
- package/builtin-workflows/interf/compile/stages/structure/SKILL.md +18 -0
- package/builtin-workflows/interf/compile/stages/summarize/SKILL.md +18 -0
- package/builtin-workflows/interf/improve/SKILL.md +18 -0
- package/builtin-workflows/interf/use/query/SKILL.md +28 -0
- package/builtin-workflows/interf/workflow.json +120 -0
- package/builtin-workflows/interf/workspace.schema.json +75 -0
- package/dist/bin.d.ts +0 -1
- package/dist/bin.js +0 -1
- package/dist/commands/compile-controller.d.ts +14 -0
- package/dist/commands/compile-controller.js +409 -0
- package/dist/commands/compile.d.ts +8 -9
- package/dist/commands/compile.js +151 -153
- package/dist/commands/create-workflow-wizard.d.ts +4 -2
- package/dist/commands/create-workflow-wizard.js +33 -31
- package/dist/commands/create.d.ts +0 -1
- package/dist/commands/create.js +15 -11
- package/dist/commands/default.d.ts +0 -1
- package/dist/commands/default.js +0 -1
- package/dist/commands/doctor.d.ts +0 -1
- package/dist/commands/doctor.js +1 -16
- package/dist/commands/executor-flow.d.ts +0 -1
- package/dist/commands/executor-flow.js +0 -1
- package/dist/commands/init.d.ts +0 -1
- package/dist/commands/init.js +71 -14
- package/dist/commands/list.d.ts +0 -1
- package/dist/commands/list.js +0 -1
- package/dist/commands/reset.d.ts +0 -1
- package/dist/commands/reset.js +0 -1
- package/dist/commands/source-config-wizard.d.ts +28 -7
- package/dist/commands/source-config-wizard.js +159 -63
- package/dist/commands/status.d.ts +0 -1
- package/dist/commands/status.js +0 -1
- package/dist/commands/test-flow.d.ts +20 -10
- package/dist/commands/test-flow.js +89 -23
- package/dist/commands/test.d.ts +0 -1
- package/dist/commands/test.js +36 -72
- package/dist/commands/verify.d.ts +0 -1
- package/dist/commands/verify.js +0 -1
- package/dist/commands/workspace-flow.d.ts +3 -3
- package/dist/commands/workspace-flow.js +30 -12
- package/dist/index.d.ts +5 -6
- package/dist/index.js +3 -4
- package/dist/lib/agent-args.d.ts +0 -1
- package/dist/lib/agent-args.js +0 -1
- package/dist/lib/agent-constants.d.ts +0 -1
- package/dist/lib/agent-constants.js +0 -1
- package/dist/lib/agent-detection.d.ts +0 -1
- package/dist/lib/agent-detection.js +0 -1
- package/dist/lib/agent-execution.d.ts +0 -1
- package/dist/lib/agent-execution.js +47 -12
- package/dist/lib/agent-logs.d.ts +0 -1
- package/dist/lib/agent-logs.js +0 -1
- package/dist/lib/agent-preflight.d.ts +0 -1
- package/dist/lib/agent-preflight.js +1 -2
- package/dist/lib/agent-render.d.ts +0 -1
- package/dist/lib/agent-render.js +0 -1
- package/dist/lib/agent-shells.d.ts +30 -3
- package/dist/lib/agent-shells.js +517 -54
- package/dist/lib/agent-status.d.ts +0 -1
- package/dist/lib/agent-status.js +0 -1
- package/dist/lib/agent-types.d.ts +0 -1
- package/dist/lib/agent-types.js +0 -1
- package/dist/lib/agents.d.ts +0 -9
- package/dist/lib/agents.js +0 -9
- package/dist/lib/chart-guidance.d.ts +1 -0
- package/dist/lib/chart-guidance.js +8 -0
- package/dist/lib/config.d.ts +0 -3
- package/dist/lib/config.js +0 -5
- package/dist/lib/discovery.d.ts +0 -1
- package/dist/lib/discovery.js +0 -1
- package/dist/lib/execution-profile.d.ts +0 -1
- package/dist/lib/execution-profile.js +0 -1
- package/dist/lib/executors.d.ts +0 -1
- package/dist/lib/executors.js +0 -1
- package/dist/lib/filesystem.d.ts +0 -1
- package/dist/lib/filesystem.js +0 -1
- package/dist/lib/interf-bootstrap.d.ts +0 -1
- package/dist/lib/interf-bootstrap.js +6 -2
- package/dist/lib/interf-detect.d.ts +2 -2
- package/dist/lib/interf-detect.js +25 -8
- package/dist/lib/interf-scaffold.d.ts +0 -1
- package/dist/lib/interf-scaffold.js +54 -21
- package/dist/lib/interf-workflow-package.d.ts +18 -1
- package/dist/lib/interf-workflow-package.js +164 -23
- package/dist/lib/interf.d.ts +1 -2
- package/dist/lib/interf.js +1 -2
- package/dist/lib/local-workflows.d.ts +10 -5
- package/dist/lib/local-workflows.js +208 -97
- package/dist/lib/logger.d.ts +0 -1
- package/dist/lib/logger.js +0 -1
- package/dist/lib/obsidian.d.ts +0 -1
- package/dist/lib/obsidian.js +0 -1
- package/dist/lib/parse.d.ts +0 -1
- package/dist/lib/parse.js +0 -1
- package/dist/lib/registry.d.ts +0 -1
- package/dist/lib/registry.js +0 -1
- package/dist/lib/runtime-acceptance.d.ts +0 -1
- package/dist/lib/runtime-acceptance.js +1 -2
- package/dist/lib/runtime-contracts.d.ts +0 -1
- package/dist/lib/runtime-contracts.js +14 -8
- package/dist/lib/runtime-paths.d.ts +0 -1
- package/dist/lib/runtime-paths.js +5 -10
- package/dist/lib/runtime-prompt.d.ts +0 -1
- package/dist/lib/runtime-prompt.js +8 -23
- package/dist/lib/runtime-reconcile.d.ts +0 -1
- package/dist/lib/runtime-reconcile.js +7 -3
- package/dist/lib/runtime-runs.d.ts +0 -1
- package/dist/lib/runtime-runs.js +4 -5
- package/dist/lib/runtime-types.d.ts +0 -1
- package/dist/lib/runtime-types.js +0 -1
- package/dist/lib/runtime.d.ts +0 -1
- package/dist/lib/runtime.js +0 -1
- package/dist/lib/schema.d.ts +356 -51
- package/dist/lib/schema.js +189 -54
- package/dist/lib/source-config.d.ts +17 -8
- package/dist/lib/source-config.js +125 -11
- package/dist/lib/state-artifacts.d.ts +0 -1
- package/dist/lib/state-artifacts.js +0 -1
- package/dist/lib/state-health.d.ts +0 -1
- package/dist/lib/state-health.js +2 -3
- package/dist/lib/state-io.d.ts +1 -1
- package/dist/lib/state-io.js +9 -10
- package/dist/lib/state-paths.d.ts +0 -1
- package/dist/lib/state-paths.js +5 -11
- package/dist/lib/state-view.d.ts +0 -1
- package/dist/lib/state-view.js +7 -8
- package/dist/lib/state.d.ts +0 -1
- package/dist/lib/state.js +0 -1
- package/dist/lib/summarize-plan.d.ts +0 -1
- package/dist/lib/summarize-plan.js +3 -3
- package/dist/lib/test-execution.d.ts +14 -0
- package/dist/lib/{benchmark-execution.js → test-execution.js} +122 -120
- package/dist/lib/test-matrices.d.ts +90 -0
- package/dist/lib/test-matrices.js +96 -0
- package/dist/lib/test-paths.d.ts +12 -0
- package/dist/lib/test-paths.js +44 -0
- package/dist/lib/test-profile-presets.d.ts +57 -0
- package/dist/lib/test-profile-presets.js +50 -0
- package/dist/lib/test-sandbox.d.ts +11 -0
- package/dist/lib/{benchmark-sandbox.js → test-sandbox.js} +18 -13
- package/dist/lib/test-specs.d.ts +7 -0
- package/dist/lib/test-specs.js +114 -0
- package/dist/lib/test-targets.d.ts +5 -0
- package/dist/lib/test-targets.js +38 -0
- package/dist/lib/test-types.d.ts +17 -0
- package/dist/lib/test-types.js +1 -0
- package/dist/lib/test.d.ts +4 -0
- package/dist/lib/test.js +3 -0
- package/dist/lib/user-config.d.ts +0 -1
- package/dist/lib/user-config.js +0 -1
- package/dist/lib/util.d.ts +0 -2
- package/dist/lib/util.js +0 -2
- package/dist/lib/validate-helpers.d.ts +0 -1
- package/dist/lib/validate-helpers.js +0 -1
- package/dist/lib/validate-workspace.d.ts +0 -1
- package/dist/lib/validate-workspace.js +34 -25
- package/dist/lib/validate.d.ts +0 -1
- package/dist/lib/validate.js +55 -9
- package/dist/lib/workflow-abi.d.ts +138 -0
- package/dist/lib/workflow-abi.js +181 -0
- package/dist/lib/workflow-definitions.d.ts +26 -5
- package/dist/lib/workflow-definitions.js +105 -168
- package/dist/lib/workflow-helpers.d.ts +1 -2
- package/dist/lib/workflow-helpers.js +32 -21
- package/dist/lib/workflow-improvement.d.ts +22 -0
- package/dist/lib/workflow-improvement.js +396 -0
- package/dist/lib/workflow-review-paths.d.ts +10 -0
- package/dist/lib/workflow-review-paths.js +27 -0
- package/dist/lib/workflow-stage-runner.d.ts +1 -1
- package/dist/lib/workflow-stage-runner.js +4 -1
- package/dist/lib/workflows.d.ts +1 -2
- package/dist/lib/workflows.js +1 -2
- package/dist/lib/workspace-compile.d.ts +0 -1
- package/dist/lib/workspace-compile.js +146 -109
- package/dist/lib/workspace-home.d.ts +5 -0
- package/dist/lib/workspace-home.js +32 -0
- package/dist/lib/workspace-layout.d.ts +2 -0
- package/dist/lib/workspace-layout.js +60 -0
- package/dist/lib/workspace-paths.d.ts +41 -0
- package/dist/lib/workspace-paths.js +107 -0
- package/dist/lib/workspace-raw.d.ts +20 -2
- package/dist/lib/workspace-raw.js +6 -8
- package/dist/lib/workspace-reset.d.ts +0 -1
- package/dist/lib/workspace-reset.js +27 -5
- package/dist/lib/workspace-schema.d.ts +1 -10
- package/dist/lib/workspace-schema.js +16 -74
- package/package.json +16 -15
- package/dist/bin.d.ts.map +0 -1
- package/dist/bin.js.map +0 -1
- package/dist/commands/compile.d.ts.map +0 -1
- package/dist/commands/compile.js.map +0 -1
- package/dist/commands/create-workflow-wizard.d.ts.map +0 -1
- package/dist/commands/create-workflow-wizard.js.map +0 -1
- package/dist/commands/create.d.ts.map +0 -1
- package/dist/commands/create.js.map +0 -1
- package/dist/commands/default.d.ts.map +0 -1
- package/dist/commands/default.js.map +0 -1
- package/dist/commands/doctor.d.ts.map +0 -1
- package/dist/commands/doctor.js.map +0 -1
- package/dist/commands/executor-flow.d.ts.map +0 -1
- package/dist/commands/executor-flow.js.map +0 -1
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/list.d.ts.map +0 -1
- package/dist/commands/list.js.map +0 -1
- package/dist/commands/reset.d.ts.map +0 -1
- package/dist/commands/reset.js.map +0 -1
- package/dist/commands/source-config-wizard.d.ts.map +0 -1
- package/dist/commands/source-config-wizard.js.map +0 -1
- package/dist/commands/status.d.ts.map +0 -1
- package/dist/commands/status.js.map +0 -1
- package/dist/commands/test-flow.d.ts.map +0 -1
- package/dist/commands/test-flow.js.map +0 -1
- package/dist/commands/test.d.ts.map +0 -1
- package/dist/commands/test.js.map +0 -1
- package/dist/commands/verify.d.ts.map +0 -1
- package/dist/commands/verify.js.map +0 -1
- package/dist/commands/workspace-flow.d.ts.map +0 -1
- package/dist/commands/workspace-flow.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/agent-args.d.ts.map +0 -1
- package/dist/lib/agent-args.js.map +0 -1
- package/dist/lib/agent-constants.d.ts.map +0 -1
- package/dist/lib/agent-constants.js.map +0 -1
- package/dist/lib/agent-detection.d.ts.map +0 -1
- package/dist/lib/agent-detection.js.map +0 -1
- package/dist/lib/agent-execution.d.ts.map +0 -1
- package/dist/lib/agent-execution.js.map +0 -1
- package/dist/lib/agent-logs.d.ts.map +0 -1
- package/dist/lib/agent-logs.js.map +0 -1
- package/dist/lib/agent-preflight.d.ts.map +0 -1
- package/dist/lib/agent-preflight.js.map +0 -1
- package/dist/lib/agent-render.d.ts.map +0 -1
- package/dist/lib/agent-render.js.map +0 -1
- package/dist/lib/agent-shells.d.ts.map +0 -1
- package/dist/lib/agent-shells.js.map +0 -1
- package/dist/lib/agent-skills.d.ts +0 -21
- package/dist/lib/agent-skills.d.ts.map +0 -1
- package/dist/lib/agent-skills.js +0 -215
- package/dist/lib/agent-skills.js.map +0 -1
- package/dist/lib/agent-status.d.ts.map +0 -1
- package/dist/lib/agent-status.js.map +0 -1
- package/dist/lib/agent-types.d.ts.map +0 -1
- package/dist/lib/agent-types.js.map +0 -1
- package/dist/lib/agents.d.ts.map +0 -1
- package/dist/lib/agents.js.map +0 -1
- package/dist/lib/benchmark-execution.d.ts +0 -13
- package/dist/lib/benchmark-execution.d.ts.map +0 -1
- package/dist/lib/benchmark-execution.js.map +0 -1
- package/dist/lib/benchmark-paths.d.ts +0 -13
- package/dist/lib/benchmark-paths.d.ts.map +0 -1
- package/dist/lib/benchmark-paths.js +0 -44
- package/dist/lib/benchmark-paths.js.map +0 -1
- package/dist/lib/benchmark-sandbox.d.ts +0 -12
- package/dist/lib/benchmark-sandbox.d.ts.map +0 -1
- package/dist/lib/benchmark-sandbox.js.map +0 -1
- package/dist/lib/benchmark-specs.d.ts +0 -8
- package/dist/lib/benchmark-specs.d.ts.map +0 -1
- package/dist/lib/benchmark-specs.js +0 -115
- package/dist/lib/benchmark-specs.js.map +0 -1
- package/dist/lib/benchmark-targets.d.ts +0 -5
- package/dist/lib/benchmark-targets.d.ts.map +0 -1
- package/dist/lib/benchmark-targets.js +0 -38
- package/dist/lib/benchmark-targets.js.map +0 -1
- package/dist/lib/benchmark-types.d.ts +0 -18
- package/dist/lib/benchmark-types.d.ts.map +0 -1
- package/dist/lib/benchmark-types.js +0 -2
- package/dist/lib/benchmark-types.js.map +0 -1
- package/dist/lib/benchmark.d.ts +0 -5
- package/dist/lib/benchmark.d.ts.map +0 -1
- package/dist/lib/benchmark.js +0 -4
- package/dist/lib/benchmark.js.map +0 -1
- package/dist/lib/config.d.ts.map +0 -1
- package/dist/lib/config.js.map +0 -1
- package/dist/lib/discovery.d.ts.map +0 -1
- package/dist/lib/discovery.js.map +0 -1
- package/dist/lib/eval-packs.d.ts +0 -158
- package/dist/lib/eval-packs.d.ts.map +0 -1
- package/dist/lib/eval-packs.js +0 -149
- package/dist/lib/eval-packs.js.map +0 -1
- package/dist/lib/execution-profile.d.ts.map +0 -1
- package/dist/lib/execution-profile.js.map +0 -1
- package/dist/lib/executors.d.ts.map +0 -1
- package/dist/lib/executors.js.map +0 -1
- package/dist/lib/filesystem.d.ts.map +0 -1
- package/dist/lib/filesystem.js.map +0 -1
- package/dist/lib/interf-bootstrap.d.ts.map +0 -1
- package/dist/lib/interf-bootstrap.js.map +0 -1
- package/dist/lib/interf-detect.d.ts.map +0 -1
- package/dist/lib/interf-detect.js.map +0 -1
- package/dist/lib/interf-scaffold.d.ts.map +0 -1
- package/dist/lib/interf-scaffold.js.map +0 -1
- package/dist/lib/interf-workflow-package.d.ts.map +0 -1
- package/dist/lib/interf-workflow-package.js.map +0 -1
- package/dist/lib/interf.d.ts.map +0 -1
- package/dist/lib/interf.js.map +0 -1
- package/dist/lib/local-workflows.d.ts.map +0 -1
- package/dist/lib/local-workflows.js.map +0 -1
- package/dist/lib/logger.d.ts.map +0 -1
- package/dist/lib/logger.js.map +0 -1
- package/dist/lib/obsidian.d.ts.map +0 -1
- package/dist/lib/obsidian.js.map +0 -1
- package/dist/lib/parse.d.ts.map +0 -1
- package/dist/lib/parse.js.map +0 -1
- package/dist/lib/registry.d.ts.map +0 -1
- package/dist/lib/registry.js.map +0 -1
- package/dist/lib/runtime-acceptance.d.ts.map +0 -1
- package/dist/lib/runtime-acceptance.js.map +0 -1
- package/dist/lib/runtime-contracts.d.ts.map +0 -1
- package/dist/lib/runtime-contracts.js.map +0 -1
- package/dist/lib/runtime-paths.d.ts.map +0 -1
- package/dist/lib/runtime-paths.js.map +0 -1
- package/dist/lib/runtime-prompt.d.ts.map +0 -1
- package/dist/lib/runtime-prompt.js.map +0 -1
- package/dist/lib/runtime-reconcile.d.ts.map +0 -1
- package/dist/lib/runtime-reconcile.js.map +0 -1
- package/dist/lib/runtime-runs.d.ts.map +0 -1
- package/dist/lib/runtime-runs.js.map +0 -1
- package/dist/lib/runtime-types.d.ts.map +0 -1
- package/dist/lib/runtime-types.js.map +0 -1
- package/dist/lib/runtime.d.ts.map +0 -1
- package/dist/lib/runtime.js.map +0 -1
- package/dist/lib/schema.d.ts.map +0 -1
- package/dist/lib/schema.js.map +0 -1
- package/dist/lib/source-config.d.ts.map +0 -1
- package/dist/lib/source-config.js.map +0 -1
- package/dist/lib/state-artifacts.d.ts.map +0 -1
- package/dist/lib/state-artifacts.js.map +0 -1
- package/dist/lib/state-health.d.ts.map +0 -1
- package/dist/lib/state-health.js.map +0 -1
- package/dist/lib/state-io.d.ts.map +0 -1
- package/dist/lib/state-io.js.map +0 -1
- package/dist/lib/state-paths.d.ts.map +0 -1
- package/dist/lib/state-paths.js.map +0 -1
- package/dist/lib/state-view.d.ts.map +0 -1
- package/dist/lib/state-view.js.map +0 -1
- package/dist/lib/state.d.ts.map +0 -1
- package/dist/lib/state.js.map +0 -1
- package/dist/lib/summarize-plan.d.ts.map +0 -1
- package/dist/lib/summarize-plan.js.map +0 -1
- package/dist/lib/user-config.d.ts.map +0 -1
- package/dist/lib/user-config.js.map +0 -1
- package/dist/lib/util.d.ts.map +0 -1
- package/dist/lib/util.js.map +0 -1
- package/dist/lib/validate-helpers.d.ts.map +0 -1
- package/dist/lib/validate-helpers.js.map +0 -1
- package/dist/lib/validate-workspace.d.ts.map +0 -1
- package/dist/lib/validate-workspace.js.map +0 -1
- package/dist/lib/validate.d.ts.map +0 -1
- package/dist/lib/validate.js.map +0 -1
- package/dist/lib/workflow-definitions.d.ts.map +0 -1
- package/dist/lib/workflow-definitions.js.map +0 -1
- package/dist/lib/workflow-helpers.d.ts.map +0 -1
- package/dist/lib/workflow-helpers.js.map +0 -1
- package/dist/lib/workflow-stage-runner.d.ts.map +0 -1
- package/dist/lib/workflow-stage-runner.js.map +0 -1
- package/dist/lib/workflow-starter-docs.d.ts +0 -7
- package/dist/lib/workflow-starter-docs.d.ts.map +0 -1
- package/dist/lib/workflow-starter-docs.js +0 -3
- package/dist/lib/workflow-starter-docs.js.map +0 -1
- package/dist/lib/workflows.d.ts.map +0 -1
- package/dist/lib/workflows.js.map +0 -1
- package/dist/lib/workspace-compile.d.ts.map +0 -1
- package/dist/lib/workspace-compile.js.map +0 -1
- package/dist/lib/workspace-docs.d.ts +0 -3
- package/dist/lib/workspace-docs.d.ts.map +0 -1
- package/dist/lib/workspace-docs.js +0 -82
- package/dist/lib/workspace-docs.js.map +0 -1
- package/dist/lib/workspace-raw.d.ts.map +0 -1
- package/dist/lib/workspace-raw.js.map +0 -1
- package/dist/lib/workspace-reset.d.ts.map +0 -1
- package/dist/lib/workspace-reset.js.map +0 -1
- package/dist/lib/workspace-schema.d.ts.map +0 -1
- package/dist/lib/workspace-schema.js.map +0 -1
- package/skills/benchmark/SKILL.md +0 -122
- package/skills/workflow/create/SKILL.md +0 -141
- package/skills/workspace/shape/SKILL.md +0 -15
- package/skills/workspace/structure/SKILL.md +0 -15
- package/skills/workspace/summarize/SKILL.md +0 -15
- package/templates/workspace/README.md +0 -24
- package/templates/workspace/interfignore +0 -2
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import { mkdirSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { countFilesRecursive } from "./filesystem.js";
|
|
4
|
-
import { createStageExecutionShell, pruneStageExecutionShells } from "./agent-shells.js";
|
|
4
|
+
import { createStageExecutionShell, freezeStageExecutionShell, pruneStageExecutionShells, syncStageExecutionShellWrites, } from "./agent-shells.js";
|
|
5
5
|
import { readInterfConfig, refreshWorkspaceBootstrapGuidance, resolveSourceFolderPath, resolveSourceControlPath, } from "./interf.js";
|
|
6
|
-
import { findSourceWorkspaceConfig, loadSourceFolderConfig } from "./source-config.js";
|
|
7
6
|
import { buildSummarizePlan, writeSummarizePlan } from "./summarize-plan.js";
|
|
8
7
|
import { reconcileWorkspaceShapeRun, reconcileWorkspaceStructureRun, reconcileWorkspaceSummarizeRun, } from "./runtime-reconcile.js";
|
|
9
8
|
import { loadState, refreshWorkspaceArtifacts, } from "./state.js";
|
|
10
9
|
import { buildWorkspaceShapeContract, buildWorkspaceStructureContract, buildWorkspaceSummarizeContract, validateStageContractAcceptance, } from "./runtime.js";
|
|
11
10
|
import { readJsonFileUnchecked } from "./parse.js";
|
|
12
|
-
import {
|
|
11
|
+
import { validateWorkflowPackage } from "./local-workflows.js";
|
|
12
|
+
import { formatActiveWorkspaceWorkflowStageStep, getActiveWorkspaceStagePolicyNotes, getActiveWorkspaceWorkflow, resolveWorkspaceWorkflowFromConfig, resolveActiveWorkspaceStageAcceptance, } from "./workflow-definitions.js";
|
|
13
13
|
import { validateWorkspaceCompile, validateWorkspaceStructure, validateWorkspaceSummarize, } from "./validate.js";
|
|
14
|
-
import { buildLocalSkillContractExtension, buildStageInstructions, bundledSkillForContractType, reportBlankLine, reportLine, reportValidationFailure,
|
|
14
|
+
import { buildLocalSkillContractExtension, buildStageInstructions, bundledSkillForContractType, reportBlankLine, reportLine, reportValidationFailure, workflowCompileStageDirectory, } from "./workflow-helpers.js";
|
|
15
15
|
import { executeValidatedStage, executeValidatedSummarizeStage, findStageByContractType, } from "./workflow-stage-runner.js";
|
|
16
16
|
import { syncWorkspaceRawSnapshot } from "./workspace-raw.js";
|
|
17
|
-
|
|
17
|
+
import { workspaceRuntimeRoot } from "./workspace-paths.js";
|
|
18
|
+
const SHAPE_INPUT_RELATIVE_PATH = ".interf/runtime/shape-input.json";
|
|
18
19
|
export function resolveWorkspaceContext(workspacePath) {
|
|
19
20
|
const config = readInterfConfig(workspacePath);
|
|
20
21
|
const workflowId = resolveWorkspaceWorkflowFromConfig(config);
|
|
@@ -26,11 +27,11 @@ export function resolveWorkspaceContext(workspacePath) {
|
|
|
26
27
|
};
|
|
27
28
|
}
|
|
28
29
|
export function workspaceExecutionStages(workflowId, workspacePath) {
|
|
29
|
-
return
|
|
30
|
+
return getActiveWorkspaceWorkflow(workspacePath, workflowId)
|
|
30
31
|
.stages;
|
|
31
32
|
}
|
|
32
33
|
function readWorkspaceInventoryTotal(workspacePath) {
|
|
33
|
-
const inventory = readJsonFileUnchecked(join(workspacePath, "
|
|
34
|
+
const inventory = readJsonFileUnchecked(join(workspaceRuntimeRoot(workspacePath), "inventory.json"), "workspace inventory");
|
|
34
35
|
if (!inventory)
|
|
35
36
|
return 0;
|
|
36
37
|
if (typeof inventory.total === "number")
|
|
@@ -83,21 +84,19 @@ function isWorkspaceShapeStageComplete(workspacePath, summaryCount) {
|
|
|
83
84
|
(state.shaped ?? state.compiled ?? 0) >= summaryCount &&
|
|
84
85
|
(state.compiled ?? 0) >= summaryCount);
|
|
85
86
|
}
|
|
86
|
-
function writeWorkspaceShapeInput(workspacePath, workspaceName
|
|
87
|
+
function writeWorkspaceShapeInput(workspacePath, workspaceName) {
|
|
87
88
|
const workspaceConfig = readInterfConfig(workspacePath);
|
|
88
|
-
const
|
|
89
|
-
const sourceWorkspace = findSourceWorkspaceConfig(sourceConfig, workspaceName);
|
|
90
|
-
const questions = (sourceWorkspace?.checks ?? []).map((check, index) => ({
|
|
89
|
+
const questions = (workspaceConfig?.checks ?? []).map((check, index) => ({
|
|
91
90
|
id: check.id ?? `check-${index + 1}`,
|
|
92
91
|
question: check.question,
|
|
93
92
|
}));
|
|
94
|
-
mkdirSync(
|
|
93
|
+
mkdirSync(workspaceRuntimeRoot(workspacePath), { recursive: true });
|
|
95
94
|
writeFileSync(join(workspacePath, SHAPE_INPUT_RELATIVE_PATH), JSON.stringify({
|
|
96
95
|
kind: "workspace-shape-input",
|
|
97
96
|
version: 1,
|
|
98
97
|
generated_at: new Date().toISOString(),
|
|
99
98
|
target_name: workspaceName,
|
|
100
|
-
about:
|
|
99
|
+
about: workspaceConfig?.about ?? null,
|
|
101
100
|
question_count: questions.length,
|
|
102
101
|
questions,
|
|
103
102
|
}, null, 2) + "\n");
|
|
@@ -105,14 +104,13 @@ function writeWorkspaceShapeInput(workspacePath, workspaceName, controlPath) {
|
|
|
105
104
|
}
|
|
106
105
|
export function buildWorkspaceCompileContract(workspacePath, workflowId, summaryCount, instructions, stageId = "shape", stageSkillDir = "shape", shapeInputPath = SHAPE_INPUT_RELATIVE_PATH) {
|
|
107
106
|
const config = readInterfConfig(workspacePath);
|
|
108
|
-
const
|
|
109
|
-
const acceptance = resolveStageAcceptance(workflowId, stageId, controlPath);
|
|
107
|
+
const acceptance = resolveActiveWorkspaceStageAcceptance(workspacePath, workflowId, stageId);
|
|
110
108
|
const localSkills = buildLocalSkillContractExtension(workspacePath, [workflowCompileStageDirectory(stageSkillDir)], "Use them to refine workspace shaping, navigation, and retrieval routes.");
|
|
111
109
|
return buildWorkspaceShapeContract({
|
|
112
110
|
workspaceName: config?.name ?? "workspace",
|
|
113
111
|
summaryCount,
|
|
114
112
|
shapeInputPath,
|
|
115
|
-
workflowNotes:
|
|
113
|
+
workflowNotes: getActiveWorkspaceStagePolicyNotes(workspacePath, workflowId, stageId),
|
|
116
114
|
localSkillDocs: localSkills.reads,
|
|
117
115
|
instructions,
|
|
118
116
|
acceptance,
|
|
@@ -120,13 +118,12 @@ export function buildWorkspaceCompileContract(workspacePath, workflowId, summary
|
|
|
120
118
|
}
|
|
121
119
|
function buildWorkspaceStructureStageContract(workspacePath, workflowId, summaryCount, instructions, stageId = "structure", stageSkillDir = "structure") {
|
|
122
120
|
const config = readInterfConfig(workspacePath);
|
|
123
|
-
const
|
|
124
|
-
const acceptance = resolveStageAcceptance(workflowId, stageId, controlPath);
|
|
121
|
+
const acceptance = resolveActiveWorkspaceStageAcceptance(workspacePath, workflowId, stageId);
|
|
125
122
|
const localSkills = buildLocalSkillContractExtension(workspacePath, [workflowCompileStageDirectory(stageSkillDir)], "Use them to refine workspace structure, taxonomy, ontology, entity extraction, and claim extraction.");
|
|
126
123
|
return buildWorkspaceStructureContract({
|
|
127
124
|
workspaceName: config?.name ?? "workspace",
|
|
128
125
|
summaryCount,
|
|
129
|
-
workflowNotes:
|
|
126
|
+
workflowNotes: getActiveWorkspaceStagePolicyNotes(workspacePath, workflowId, stageId),
|
|
130
127
|
localSkillDocs: localSkills.reads,
|
|
131
128
|
instructions,
|
|
132
129
|
acceptance,
|
|
@@ -135,7 +132,6 @@ function buildWorkspaceStructureStageContract(workspacePath, workflowId, summary
|
|
|
135
132
|
export async function runWorkspaceSummarize(options) {
|
|
136
133
|
const context = resolveWorkspaceContext(options.workspacePath);
|
|
137
134
|
const sourcePath = options.sourcePath ?? context.sourcePath;
|
|
138
|
-
const controlPath = context.controlPath;
|
|
139
135
|
const workflowId = context.workflowId;
|
|
140
136
|
const stageDefinition = options.stageDefinition ?? findStageByContractType(workspaceExecutionStages(workflowId, options.workspacePath), "workspace-file-evidence");
|
|
141
137
|
const stageStatusLabel = stageDefinition.label.toLowerCase();
|
|
@@ -151,7 +147,7 @@ export async function runWorkspaceSummarize(options) {
|
|
|
151
147
|
refreshWorkspaceArtifacts(options.workspacePath, { ensureViewSpec: true });
|
|
152
148
|
const validation = validateWorkspaceSummarize(options.workspacePath);
|
|
153
149
|
if (options.reportStep !== false) {
|
|
154
|
-
reportLine(options.reporter, `${
|
|
150
|
+
reportLine(options.reporter, `${formatActiveWorkspaceWorkflowStageStep(options.workspacePath, workflowId, stageDefinition.id)} skipped (no work required)`);
|
|
155
151
|
}
|
|
156
152
|
if (!validation.ok) {
|
|
157
153
|
reportValidationFailure(options.reporter, validation.summary);
|
|
@@ -164,45 +160,52 @@ export async function runWorkspaceSummarize(options) {
|
|
|
164
160
|
};
|
|
165
161
|
}
|
|
166
162
|
if (options.reportStep !== false) {
|
|
167
|
-
reportLine(options.reporter, `${
|
|
163
|
+
reportLine(options.reporter, `${formatActiveWorkspaceWorkflowStageStep(options.workspacePath, workflowId, stageDefinition.id)} (${plan.targetCount} files)`);
|
|
168
164
|
}
|
|
169
165
|
const shell = createStageExecutionShell(options.workspacePath, context.workspaceName, workflowId, stageDefinition);
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
contract: buildWorkspaceSummarizeContract({
|
|
181
|
-
workspaceName: context.workspaceName,
|
|
182
|
-
targetCount: plan.targetCount,
|
|
183
|
-
expectedSummaryTotal,
|
|
184
|
-
sourcePath,
|
|
185
|
-
planPath,
|
|
186
|
-
workflowNotes: getWorkflowStagePolicyNotes(workflowId, stageDefinition.id, controlPath),
|
|
187
|
-
localSkillDocs: localSkills.reads,
|
|
166
|
+
let stageResult;
|
|
167
|
+
try {
|
|
168
|
+
stageResult = await executeValidatedSummarizeStage({
|
|
169
|
+
executor: options.executor,
|
|
170
|
+
workspacePath: options.workspacePath,
|
|
171
|
+
executionPath: shell.rootPath,
|
|
172
|
+
targetName: context.workspaceName,
|
|
173
|
+
workflow: workflowId,
|
|
174
|
+
workflowSourcePath: options.workspacePath,
|
|
175
|
+
stageDefinition,
|
|
188
176
|
instructions,
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
177
|
+
summary: `Preparing ${stageDefinition.label.toLowerCase()} for ${plan.targetCount} source files.`,
|
|
178
|
+
contract: buildWorkspaceSummarizeContract({
|
|
179
|
+
workspaceName: context.workspaceName,
|
|
180
|
+
targetCount: plan.targetCount,
|
|
181
|
+
expectedSummaryTotal,
|
|
182
|
+
sourcePath,
|
|
183
|
+
planPath,
|
|
184
|
+
workflowNotes: getActiveWorkspaceStagePolicyNotes(options.workspacePath, workflowId, stageDefinition.id),
|
|
185
|
+
localSkillDocs: localSkills.reads,
|
|
186
|
+
instructions,
|
|
187
|
+
acceptance: resolveActiveWorkspaceStageAcceptance(options.workspacePath, workflowId, stageDefinition.id),
|
|
188
|
+
}),
|
|
189
|
+
statusLines: [
|
|
190
|
+
`Emit exactly one startup line: STATUS: loaded ${stageStatusLabel} plan ${plan.targetCount} files.`,
|
|
191
|
+
"The CLI owns live file-count progress. Do not emit per-file progress.",
|
|
192
|
+
"If `.interf/runtime/inventory.json` already exists, overwrite it completely instead of patching prior contents.",
|
|
193
|
+
"Emit STATUS: batch committed after a completed batch has been merged into summaries/ and inventory.",
|
|
194
|
+
`Emit DONE: ${stageStatusLabel} complete ${plan.targetCount}/${plan.targetCount} when finished.`,
|
|
195
|
+
],
|
|
196
|
+
reporter: options.reporter,
|
|
197
|
+
completionCheck: () => isWorkspaceSummarizeStageComplete(options.workspacePath, expectedSummaryTotal),
|
|
198
|
+
syncWrites: () => syncStageExecutionShellWrites(options.workspacePath, shell.rootPath, stageDefinition),
|
|
199
|
+
reconcile: () => reconcileWorkspaceSummarizeRun(options.workspacePath, expectedSummaryTotal),
|
|
200
|
+
refreshArtifacts: () => refreshWorkspaceArtifacts(options.workspacePath, { ensureViewSpec: true }),
|
|
201
|
+
validate: () => validateWorkspaceSummarize(options.workspacePath),
|
|
202
|
+
startingSummaryCount: plan.summaryCount,
|
|
203
|
+
targetCount: plan.targetCount,
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
finally {
|
|
207
|
+
freezeStageExecutionShell(shell.rootPath);
|
|
208
|
+
}
|
|
206
209
|
if (!stageResult.ok) {
|
|
207
210
|
return {
|
|
208
211
|
ok: false,
|
|
@@ -223,7 +226,6 @@ async function runWorkspaceStructure(options) {
|
|
|
223
226
|
const workspaceName = workspaceConfig?.name ?? "workspace";
|
|
224
227
|
const workflowId = resolveWorkspaceWorkflowFromConfig(workspaceConfig);
|
|
225
228
|
const sourcePath = options.sourcePath ?? resolveSourceFolderPath(options.workspacePath, workspaceConfig);
|
|
226
|
-
const controlPath = resolveSourceControlPath(options.workspacePath);
|
|
227
229
|
const stageDefinition = options.stageDefinition ?? findStageByContractType(workspaceExecutionStages(workflowId, options.workspacePath), "workspace-knowledge-structure");
|
|
228
230
|
const stageStatusLabel = stageDefinition.label.toLowerCase();
|
|
229
231
|
const summaryCount = countFilesRecursive(join(options.workspacePath, "summaries"));
|
|
@@ -231,73 +233,84 @@ async function runWorkspaceStructure(options) {
|
|
|
231
233
|
const instructions = buildStageInstructions(bundledSkillForContractType(stageDefinition.contractType), localSkills);
|
|
232
234
|
if (options.reportStep !== false) {
|
|
233
235
|
reportBlankLine(options.reporter);
|
|
234
|
-
reportLine(options.reporter, `${
|
|
236
|
+
reportLine(options.reporter, `${formatActiveWorkspaceWorkflowStageStep(options.workspacePath, workflowId, stageDefinition.id)} (building knowledge structure)`);
|
|
235
237
|
}
|
|
236
238
|
const shell = createStageExecutionShell(options.workspacePath, workspaceName, workflowId, stageDefinition);
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
239
|
+
try {
|
|
240
|
+
return await executeValidatedStage({
|
|
241
|
+
executor: options.executor,
|
|
242
|
+
workspacePath: options.workspacePath,
|
|
243
|
+
executionPath: shell.rootPath,
|
|
244
|
+
targetName: workspaceName,
|
|
245
|
+
workflow: workflowId,
|
|
246
|
+
workflowSourcePath: options.workspacePath,
|
|
247
|
+
stageDefinition,
|
|
248
|
+
instructions,
|
|
249
|
+
summary: `Preparing ${stageDefinition.label.toLowerCase()} for ${summaryCount} summary files.`,
|
|
250
|
+
contract: buildWorkspaceStructureStageContract(options.workspacePath, workflowId, summaryCount, instructions, stageDefinition.id, stageDefinition.skillDir),
|
|
251
|
+
statusLines: [
|
|
252
|
+
`Emit exactly one startup line: STATUS: loaded ${stageStatusLabel} plan ${summaryCount} summary files.`,
|
|
253
|
+
`Emit STATUS: inventoried summaries ${summaryCount}/${summaryCount} after the inventory pass completes.`,
|
|
254
|
+
`Emit STATUS: structured knowledge layer after entities, claims, and indexes are updated.`,
|
|
255
|
+
`Emit DONE: ${stageStatusLabel} complete ${summaryCount}/${summaryCount} when the required outputs are on disk.`,
|
|
256
|
+
],
|
|
257
|
+
reporter: options.reporter,
|
|
258
|
+
completionCheck: () => isWorkspaceStructureStageComplete(options.workspacePath, summaryCount),
|
|
259
|
+
syncWrites: () => syncStageExecutionShellWrites(options.workspacePath, shell.rootPath, stageDefinition),
|
|
260
|
+
reconcile: () => reconcileWorkspaceStructureRun(options.workspacePath),
|
|
261
|
+
refreshArtifacts: () => refreshWorkspaceArtifacts(options.workspacePath, { ensureViewSpec: true }),
|
|
262
|
+
validate: () => validateWorkspaceStructure(options.workspacePath),
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
finally {
|
|
266
|
+
freezeStageExecutionShell(shell.rootPath);
|
|
267
|
+
}
|
|
260
268
|
}
|
|
261
269
|
async function runWorkspaceShape(options) {
|
|
262
270
|
const workspaceConfig = readInterfConfig(options.workspacePath);
|
|
263
271
|
const workspaceName = workspaceConfig?.name ?? "workspace";
|
|
264
272
|
const workflowId = resolveWorkspaceWorkflowFromConfig(workspaceConfig);
|
|
265
273
|
const sourcePath = options.sourcePath ?? resolveSourceFolderPath(options.workspacePath, workspaceConfig);
|
|
266
|
-
const controlPath = resolveSourceControlPath(options.workspacePath);
|
|
267
274
|
const stageDefinition = options.stageDefinition ?? findStageByContractType(workspaceExecutionStages(workflowId, options.workspacePath), "workspace-query-shape");
|
|
268
275
|
const stageStatusLabel = stageDefinition.label.toLowerCase();
|
|
269
276
|
const summaryCount = countFilesRecursive(join(options.workspacePath, "summaries"));
|
|
270
277
|
const localSkills = buildLocalSkillContractExtension(options.workspacePath, [workflowCompileStageDirectory(stageDefinition.skillDir)], "Use them to refine final workspace shaping, navigation, and retrieval routes.");
|
|
271
278
|
const instructions = buildStageInstructions(bundledSkillForContractType(stageDefinition.contractType), localSkills);
|
|
272
|
-
const shapeInputPath = writeWorkspaceShapeInput(options.workspacePath, workspaceName
|
|
279
|
+
const shapeInputPath = writeWorkspaceShapeInput(options.workspacePath, workspaceName);
|
|
273
280
|
if (options.reportStep !== false) {
|
|
274
281
|
reportBlankLine(options.reporter);
|
|
275
|
-
reportLine(options.reporter, `${
|
|
282
|
+
reportLine(options.reporter, `${formatActiveWorkspaceWorkflowStageStep(options.workspacePath, workflowId, stageDefinition.id)} (shaping workspace surface)`);
|
|
276
283
|
}
|
|
277
284
|
const shell = createStageExecutionShell(options.workspacePath, workspaceName, workflowId, stageDefinition);
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
285
|
+
try {
|
|
286
|
+
return await executeValidatedStage({
|
|
287
|
+
executor: options.executor,
|
|
288
|
+
workspacePath: options.workspacePath,
|
|
289
|
+
executionPath: shell.rootPath,
|
|
290
|
+
targetName: workspaceName,
|
|
291
|
+
workflow: workflowId,
|
|
292
|
+
workflowSourcePath: options.workspacePath,
|
|
293
|
+
stageDefinition,
|
|
294
|
+
instructions,
|
|
295
|
+
summary: `Preparing ${stageDefinition.label.toLowerCase()} for ${summaryCount} summary files.`,
|
|
296
|
+
contract: buildWorkspaceCompileContract(options.workspacePath, workflowId, summaryCount, instructions, stageDefinition.id, stageDefinition.skillDir, shapeInputPath),
|
|
297
|
+
statusLines: [
|
|
298
|
+
`Emit exactly one startup line: STATUS: loaded ${stageStatusLabel} plan ${summaryCount} summary files.`,
|
|
299
|
+
`Emit STATUS: read shaping input after ${shapeInputPath} has been loaded.`,
|
|
300
|
+
"Emit STATUS: shaped workspace surface after home.md and any focused indexes are updated.",
|
|
301
|
+
`Emit DONE: ${stageStatusLabel} complete ${summaryCount}/${summaryCount} when the required outputs are on disk.`,
|
|
302
|
+
],
|
|
303
|
+
reporter: options.reporter,
|
|
304
|
+
completionCheck: () => isWorkspaceShapeStageComplete(options.workspacePath, summaryCount),
|
|
305
|
+
syncWrites: () => syncStageExecutionShellWrites(options.workspacePath, shell.rootPath, stageDefinition),
|
|
306
|
+
reconcile: () => reconcileWorkspaceShapeRun(options.workspacePath),
|
|
307
|
+
refreshArtifacts: () => refreshWorkspaceArtifacts(options.workspacePath, { ensureViewSpec: true }),
|
|
308
|
+
validate: () => validateWorkspaceCompile(options.workspacePath),
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
finally {
|
|
312
|
+
freezeStageExecutionShell(shell.rootPath);
|
|
313
|
+
}
|
|
301
314
|
}
|
|
302
315
|
async function runWorkspaceCompileStages(options) {
|
|
303
316
|
const workspaceConfig = readInterfConfig(options.workspacePath);
|
|
@@ -377,6 +390,31 @@ export async function compileWorkspace(options) {
|
|
|
377
390
|
const controlPath = resolveSourceControlPath(options.workspacePath);
|
|
378
391
|
syncWorkspaceRawSnapshot(options.workspacePath, controlPath);
|
|
379
392
|
refreshWorkspaceBootstrapGuidance(options.workspacePath);
|
|
393
|
+
const workflowValidation = validateWorkflowPackage(join(options.workspacePath, ".interf", "workflow"));
|
|
394
|
+
if (!workflowValidation.ok) {
|
|
395
|
+
const summary = workflowValidation.summary;
|
|
396
|
+
reportValidationFailure(options.reporter, summary, workflowValidation.errors);
|
|
397
|
+
const failedResult = {
|
|
398
|
+
ok: false,
|
|
399
|
+
summarize: {
|
|
400
|
+
ok: false,
|
|
401
|
+
code: 1,
|
|
402
|
+
skipped: true,
|
|
403
|
+
plan: buildSummarizePlan(controlPath, options.workspacePath),
|
|
404
|
+
summary,
|
|
405
|
+
},
|
|
406
|
+
structure: null,
|
|
407
|
+
shape: null,
|
|
408
|
+
compile: {
|
|
409
|
+
ok: false,
|
|
410
|
+
code: 1,
|
|
411
|
+
summary,
|
|
412
|
+
},
|
|
413
|
+
failedStage: "workflow",
|
|
414
|
+
};
|
|
415
|
+
result = failedResult;
|
|
416
|
+
return failedResult;
|
|
417
|
+
}
|
|
380
418
|
const { sourcePath, workflowId } = resolveWorkspaceContext(options.workspacePath);
|
|
381
419
|
const stages = workspaceExecutionStages(workflowId, options.workspacePath);
|
|
382
420
|
let summarize = {
|
|
@@ -436,4 +474,3 @@ export async function compileWorkspace(options) {
|
|
|
436
474
|
}
|
|
437
475
|
}
|
|
438
476
|
}
|
|
439
|
-
//# sourceMappingURL=workspace-compile.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const UNCOMPILED_WORKSPACE_HOME_NOTICE = "Not yet compiled. Run `interf compile` to build this compiled workspace.";
|
|
2
|
+
export declare function renderUncompiledWorkspaceHome(workspaceName: string, about?: string): string;
|
|
3
|
+
export declare function workspaceHomeHasCompilePlaceholder(content: string): boolean;
|
|
4
|
+
export declare function readWorkspaceHomeContent(dirPath: string): string | null;
|
|
5
|
+
export declare function workspaceHomeIsShaped(dirPath: string): boolean;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
export const UNCOMPILED_WORKSPACE_HOME_NOTICE = "Not yet compiled. Run `interf compile` to build this compiled workspace.";
|
|
4
|
+
export function renderUncompiledWorkspaceHome(workspaceName, about) {
|
|
5
|
+
return [
|
|
6
|
+
`# ${workspaceName} — Home`,
|
|
7
|
+
"",
|
|
8
|
+
UNCOMPILED_WORKSPACE_HOME_NOTICE,
|
|
9
|
+
...(about ? ["", `About: ${about}`] : []),
|
|
10
|
+
"",
|
|
11
|
+
].join("\n");
|
|
12
|
+
}
|
|
13
|
+
export function workspaceHomeHasCompilePlaceholder(content) {
|
|
14
|
+
return content.includes(UNCOMPILED_WORKSPACE_HOME_NOTICE);
|
|
15
|
+
}
|
|
16
|
+
export function readWorkspaceHomeContent(dirPath) {
|
|
17
|
+
const homePath = join(dirPath, "home.md");
|
|
18
|
+
if (!existsSync(homePath))
|
|
19
|
+
return null;
|
|
20
|
+
try {
|
|
21
|
+
return readFileSync(homePath, "utf8");
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export function workspaceHomeIsShaped(dirPath) {
|
|
28
|
+
const content = readWorkspaceHomeContent(dirPath);
|
|
29
|
+
if (content === null)
|
|
30
|
+
return false;
|
|
31
|
+
return !workspaceHomeHasCompilePlaceholder(content);
|
|
32
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readdirSync, renameSync, } from "node:fs";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import { WORKSPACE_CONFIG_FILE, WORKSPACE_INTERF_DIR, WORKSPACE_RUNTIME_DIR, WORKSPACE_TEST_DIR, WORKSPACE_WORKFLOW_DIR, workflowPackagePathForWorkspace, workspaceInterfConfigPath, workspaceInterfRoot, workspaceRuntimeRoot, } from "./workspace-paths.js";
|
|
4
|
+
const LEGACY_WORKSPACE_CONFIG_FILE = "interf.json";
|
|
5
|
+
const LEGACY_WORKFLOW_DIR = "workflow";
|
|
6
|
+
function movePathIfMissing(sourcePath, targetPath) {
|
|
7
|
+
if (!existsSync(sourcePath)) {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
if (existsSync(targetPath)) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
mkdirSync(dirname(targetPath), { recursive: true });
|
|
14
|
+
renameSync(sourcePath, targetPath);
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
export function normalizeLegacyWorkspaceLayout(workspacePath) {
|
|
18
|
+
const interfRoot = workspaceInterfRoot(workspacePath);
|
|
19
|
+
const runtimeRoot = workspaceRuntimeRoot(workspacePath);
|
|
20
|
+
let changed = false;
|
|
21
|
+
changed = movePathIfMissing(join(workspacePath, LEGACY_WORKSPACE_CONFIG_FILE), workspaceInterfConfigPath(workspacePath)) || changed;
|
|
22
|
+
changed = movePathIfMissing(join(workspacePath, LEGACY_WORKFLOW_DIR), workflowPackagePathForWorkspace(workspacePath)) || changed;
|
|
23
|
+
if (!existsSync(interfRoot)) {
|
|
24
|
+
return changed;
|
|
25
|
+
}
|
|
26
|
+
for (const entry of readdirSync(interfRoot)) {
|
|
27
|
+
if (entry === WORKSPACE_RUNTIME_DIR ||
|
|
28
|
+
entry === WORKSPACE_TEST_DIR ||
|
|
29
|
+
entry === WORKSPACE_WORKFLOW_DIR ||
|
|
30
|
+
entry === WORKSPACE_CONFIG_FILE) {
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
changed = movePathIfMissing(join(interfRoot, entry), join(runtimeRoot, entry)) || changed;
|
|
34
|
+
}
|
|
35
|
+
return changed;
|
|
36
|
+
}
|
|
37
|
+
export function workspaceNeedsLegacyLayoutNormalization(workspacePath) {
|
|
38
|
+
if (existsSync(join(workspacePath, LEGACY_WORKSPACE_CONFIG_FILE)) &&
|
|
39
|
+
!existsSync(workspaceInterfConfigPath(workspacePath))) {
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
if (!existsSync(join(workspacePath, WORKSPACE_INTERF_DIR)))
|
|
43
|
+
return false;
|
|
44
|
+
if (existsSync(join(workspacePath, LEGACY_WORKFLOW_DIR)) &&
|
|
45
|
+
!existsSync(workflowPackagePathForWorkspace(workspacePath))) {
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
for (const entry of readdirSync(join(workspacePath, WORKSPACE_INTERF_DIR))) {
|
|
49
|
+
if (entry === WORKSPACE_RUNTIME_DIR ||
|
|
50
|
+
entry === WORKSPACE_TEST_DIR ||
|
|
51
|
+
entry === WORKSPACE_WORKFLOW_DIR ||
|
|
52
|
+
entry === WORKSPACE_CONFIG_FILE) {
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
if (!existsSync(join(workspaceRuntimeRoot(workspacePath), entry))) {
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export declare const WORKSPACE_INTERF_DIR = ".interf";
|
|
2
|
+
export declare const WORKSPACE_CONFIG_FILE = "interf.json";
|
|
3
|
+
export declare const WORKSPACE_WORKFLOW_DIR = "workflow";
|
|
4
|
+
export declare const WORKSPACE_TEST_DIR = "tests";
|
|
5
|
+
export declare const WORKSPACE_TEST_TARGETS_DIR = "targets";
|
|
6
|
+
export declare const WORKSPACE_RUNTIME_DIR = "runtime";
|
|
7
|
+
export declare const WORKSPACE_RUNTIME_STATE_FILE = "state.json";
|
|
8
|
+
export declare const WORKSPACE_RUNTIME_HEALTH_FILE = "health.json";
|
|
9
|
+
export declare const WORKSPACE_RUNTIME_VIEW_SPEC_FILE = "view-spec.json";
|
|
10
|
+
export declare const WORKSPACE_RUNTIME_RAW_SNAPSHOT_FILE = "raw-snapshot.json";
|
|
11
|
+
export declare const WORKSPACE_RUNTIME_INVENTORY_FILE = "inventory.json";
|
|
12
|
+
export declare const WORKSPACE_RUNTIME_RUN_FILE = "run.json";
|
|
13
|
+
export declare const WORKSPACE_RUNTIME_RUN_HISTORY_FILE = "run-history.jsonl";
|
|
14
|
+
export declare const WORKSPACE_RUNTIME_STAGE_CONTRACT_FILE = "stage-contract.json";
|
|
15
|
+
export declare function workspaceRuntimeRoot(workspacePath: string): string;
|
|
16
|
+
export declare function workspaceRuntimeFilePath(workspacePath: string, fileName: string): string;
|
|
17
|
+
export declare function workspaceInterfRoot(workspacePath: string): string;
|
|
18
|
+
export declare function workspaceInterfConfigPath(workspacePath: string): string;
|
|
19
|
+
export declare function workflowPackagePathForWorkspace(workspacePath: string): string;
|
|
20
|
+
export declare function testRootForWorkspace(workspacePath: string): string;
|
|
21
|
+
export declare function testRunsRootForWorkspace(workspacePath: string): string;
|
|
22
|
+
export declare function testTargetsRootForWorkspace(workspacePath: string): string;
|
|
23
|
+
export declare function latestTestComparisonPathForWorkspace(workspacePath: string): string;
|
|
24
|
+
export declare function stageExecutionShellsRoot(workspacePath: string): string;
|
|
25
|
+
export declare function workflowImprovementLoopsRoot(workspacePath: string): string;
|
|
26
|
+
export declare function workflowImprovementRunRoot(workspacePath: string, runId: string): string;
|
|
27
|
+
export declare function workflowImprovementLoopRoot(workspacePath: string, runId: string, loopIndex: number): string;
|
|
28
|
+
export declare function targetTestRunsRootForWorkspace(workspacePath: string): string;
|
|
29
|
+
export declare function targetTestSandboxesRootForWorkspace(workspacePath: string): string;
|
|
30
|
+
export declare function workspaceRuntimeLogsRoot(workspacePath: string): string;
|
|
31
|
+
export declare function workspaceQueryAcceptanceRoot(workspacePath: string): string;
|
|
32
|
+
export declare function workspaceRuntimeStatePath(workspacePath: string): string;
|
|
33
|
+
export declare function workspaceRuntimeHealthPath(workspacePath: string): string;
|
|
34
|
+
export declare function workspaceRuntimeViewSpecPath(workspacePath: string): string;
|
|
35
|
+
export declare function workspaceRawSnapshotMetadataPath(workspacePath: string): string;
|
|
36
|
+
export declare function workspaceRuntimeInventoryPath(workspacePath: string): string;
|
|
37
|
+
export declare function workspaceRuntimeRunPath(workspacePath: string): string;
|
|
38
|
+
export declare function workspaceRuntimeRunHistoryPath(workspacePath: string): string;
|
|
39
|
+
export declare function workspaceRuntimeStageContractPath(workspacePath: string): string;
|
|
40
|
+
export declare function resolveSourceControlPathForWorkspace(workspacePath: string): string;
|
|
41
|
+
export declare function defaultControlPathForWorkspace(workspacePath: string): string;
|