@interf/compiler 0.6.1 → 0.6.4
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 +106 -80
- package/builtin-workflows/interf/README.md +5 -5
- package/builtin-workflows/interf/compile/stages/shape/SKILL.md +4 -4
- package/builtin-workflows/interf/improve/SKILL.md +2 -2
- package/builtin-workflows/interf/use/query/SKILL.md +1 -1
- package/builtin-workflows/interf/workflow.json +6 -6
- package/builtin-workflows/interf/workflow.schema.json +1 -1
- package/dist/bin.js +2 -28
- package/dist/{commands → cli/commands}/check-draft.d.ts +2 -2
- package/dist/{commands → cli/commands}/check-draft.js +16 -16
- package/dist/{commands → cli/commands}/compile-controller.d.ts +3 -3
- package/dist/{commands → cli/commands}/compile-controller.js +37 -35
- package/dist/{commands → cli/commands}/compile.d.ts +2 -2
- package/dist/{commands → cli/commands}/compile.js +15 -11
- package/dist/{commands → cli/commands}/compiled-flow.d.ts +3 -4
- package/dist/{commands → cli/commands}/compiled-flow.js +9 -14
- package/dist/{commands → cli/commands}/create-workflow-wizard.d.ts +3 -3
- package/dist/{commands → cli/commands}/create-workflow-wizard.js +64 -37
- package/dist/{commands → cli/commands}/create.d.ts +1 -1
- package/dist/{commands → cli/commands}/create.js +15 -18
- package/dist/{commands → cli/commands}/dataset-selection.d.ts +1 -1
- package/dist/{commands → cli/commands}/default.js +3 -3
- package/dist/{commands → cli/commands}/doctor.js +5 -6
- package/dist/{commands → cli/commands}/executor-flow.d.ts +1 -1
- package/dist/{commands → cli/commands}/executor-flow.js +13 -16
- package/dist/{commands → cli/commands}/init.d.ts +4 -1
- package/dist/{commands → cli/commands}/init.js +162 -77
- package/dist/{commands → cli/commands}/list.js +6 -6
- package/dist/{commands → cli/commands}/reset.js +4 -4
- package/dist/{commands → cli/commands}/source-config-wizard.d.ts +9 -4
- package/dist/{commands → cli/commands}/source-config-wizard.js +168 -94
- package/dist/{commands → cli/commands}/status.js +20 -11
- package/dist/{commands → cli/commands}/test-flow.d.ts +13 -4
- package/dist/{commands → cli/commands}/test-flow.js +52 -48
- package/dist/cli/commands/test.d.ts +14 -0
- package/dist/{commands → cli/commands}/test.js +40 -24
- package/dist/{commands → cli/commands}/verify.js +4 -4
- package/dist/cli/index.d.ts +21 -0
- package/dist/cli/index.js +33 -0
- package/dist/index.d.ts +22 -11
- package/dist/index.js +15 -6
- package/dist/lib/agent-args.d.ts +1 -4
- package/dist/lib/agent-args.js +1 -52
- package/dist/lib/agent-constants.d.ts +1 -5
- package/dist/lib/agent-constants.js +1 -28
- package/dist/lib/agent-detection.d.ts +1 -7
- package/dist/lib/agent-detection.js +1 -65
- package/dist/lib/agent-execution.d.ts +1 -2
- package/dist/lib/agent-execution.js +1 -243
- package/dist/lib/agent-logs.d.ts +1 -2
- package/dist/lib/agent-logs.js +1 -17
- package/dist/lib/agent-preflight.d.ts +1 -7
- package/dist/lib/agent-preflight.js +1 -77
- package/dist/lib/agent-render.d.ts +1 -8
- package/dist/lib/agent-render.js +1 -218
- package/dist/lib/agent-shells.d.ts +1 -69
- package/dist/lib/agent-shells.js +1 -1021
- package/dist/lib/agent-status.d.ts +1 -3
- package/dist/lib/agent-status.js +1 -58
- package/dist/lib/agent-types.d.ts +1 -30
- package/dist/lib/agent-types.js +1 -1
- package/dist/lib/agents.d.ts +1 -6
- package/dist/lib/agents.js +1 -5
- package/dist/lib/builtin-compiled-workflow.d.ts +1 -38
- package/dist/lib/builtin-compiled-workflow.js +1 -94
- package/dist/lib/chart-guidance.d.ts +1 -1
- package/dist/lib/chart-guidance.js +1 -8
- package/dist/lib/compiled-compile.d.ts +1 -48
- package/dist/lib/compiled-compile.js +1 -255
- package/dist/lib/compiled-paths.d.ts +1 -40
- package/dist/lib/compiled-paths.js +3 -106
- package/dist/lib/compiled-raw.d.ts +1 -49
- package/dist/lib/compiled-raw.js +3 -102
- package/dist/lib/compiled-reset.d.ts +1 -2
- package/dist/lib/compiled-reset.js +3 -72
- package/dist/lib/compiled-schema.d.ts +1 -31
- package/dist/lib/compiled-schema.js +1 -141
- package/dist/lib/discovery.d.ts +1 -7
- package/dist/lib/discovery.js +1 -84
- package/dist/lib/execution-profile.d.ts +1 -17
- package/dist/lib/execution-profile.js +1 -84
- package/dist/lib/executors.d.ts +1 -32
- package/dist/lib/executors.js +1 -43
- package/dist/lib/filesystem.d.ts +1 -2
- package/dist/lib/filesystem.js +1 -55
- package/dist/lib/interf-bootstrap.d.ts +1 -3
- package/dist/lib/interf-bootstrap.js +3 -18
- package/dist/lib/interf-detect.d.ts +1 -33
- package/dist/lib/interf-detect.js +3 -176
- package/dist/lib/interf-scaffold.d.ts +1 -2
- package/dist/lib/interf-scaffold.js +3 -114
- package/dist/lib/interf-workflow-package.d.ts +1 -25
- package/dist/lib/interf-workflow-package.js +1 -342
- package/dist/lib/interf.d.ts +1 -5
- package/dist/lib/interf.js +3 -4
- package/dist/lib/local-workflows.d.ts +1 -54
- package/dist/lib/local-workflows.js +1 -422
- package/dist/lib/logger.d.ts +1 -3
- package/dist/lib/logger.js +1 -10
- package/dist/lib/package-root.d.ts +1 -0
- package/dist/lib/package-root.js +1 -0
- package/dist/lib/parse.d.ts +1 -8
- package/dist/lib/parse.js +1 -145
- package/dist/lib/project-paths.d.ts +1 -11
- package/dist/lib/project-paths.js +3 -32
- package/dist/lib/runtime-acceptance.d.ts +1 -9
- package/dist/lib/runtime-acceptance.js +1 -269
- package/dist/lib/runtime-contracts.d.ts +1 -2
- package/dist/lib/runtime-contracts.js +1 -48
- package/dist/lib/runtime-inventory.d.ts +1 -7
- package/dist/lib/runtime-inventory.js +1 -29
- package/dist/lib/runtime-paths.d.ts +1 -8
- package/dist/lib/runtime-paths.js +1 -26
- package/dist/lib/runtime-prompt.d.ts +1 -2
- package/dist/lib/runtime-prompt.js +1 -48
- package/dist/lib/runtime-reconcile.d.ts +1 -2
- package/dist/lib/runtime-reconcile.js +1 -193
- package/dist/lib/runtime-runs.d.ts +1 -11
- package/dist/lib/runtime-runs.js +1 -262
- package/dist/lib/runtime-types.d.ts +1 -43
- package/dist/lib/runtime-types.js +1 -1
- package/dist/lib/runtime.d.ts +1 -6
- package/dist/lib/runtime.js +1 -5
- package/dist/lib/schema.d.ts +4 -1073
- package/dist/lib/schema.js +6 -542
- package/dist/lib/source-config.d.ts +1 -39
- package/dist/lib/source-config.js +3 -293
- package/dist/lib/state-artifacts.d.ts +1 -8
- package/dist/lib/state-artifacts.js +1 -13
- package/dist/lib/state-health.d.ts +1 -4
- package/dist/lib/state-health.js +1 -132
- package/dist/lib/state-io.d.ts +1 -10
- package/dist/lib/state-io.js +1 -76
- package/dist/lib/state-paths.d.ts +1 -4
- package/dist/lib/state-paths.js +1 -13
- package/dist/lib/state-view.d.ts +1 -4
- package/dist/lib/state-view.js +1 -103
- package/dist/lib/state.d.ts +1 -7
- package/dist/lib/state.js +1 -12
- package/dist/lib/test-execution.d.ts +1 -14
- package/dist/lib/test-execution.js +3 -525
- package/dist/lib/test-matrices.d.ts +1 -90
- package/dist/lib/test-matrices.js +3 -96
- package/dist/lib/test-paths.d.ts +1 -12
- package/dist/lib/test-paths.js +3 -59
- package/dist/lib/test-profile-presets.d.ts +1 -57
- package/dist/lib/test-profile-presets.js +3 -50
- package/dist/lib/test-sandbox.d.ts +1 -11
- package/dist/lib/test-sandbox.js +3 -105
- package/dist/lib/test-specs.d.ts +1 -7
- package/dist/lib/test-specs.js +3 -114
- package/dist/lib/test-targets.d.ts +1 -5
- package/dist/lib/test-targets.js +3 -38
- package/dist/lib/test-types.d.ts +1 -17
- package/dist/lib/test-types.js +3 -1
- package/dist/lib/test.d.ts +1 -4
- package/dist/lib/test.js +3 -3
- package/dist/lib/util.d.ts +1 -4
- package/dist/lib/util.js +1 -25
- package/dist/lib/validate-compiled.d.ts +1 -27
- package/dist/lib/validate-compiled.js +1 -241
- package/dist/lib/validate-helpers.d.ts +1 -12
- package/dist/lib/validate-helpers.js +1 -41
- package/dist/lib/validate.d.ts +1 -21
- package/dist/lib/validate.js +1 -249
- package/dist/lib/workflow-authoring.d.ts +1 -26
- package/dist/lib/workflow-authoring.js +1 -119
- package/dist/lib/workflow-definitions.d.ts +1 -78
- package/dist/lib/workflow-definitions.js +1 -203
- package/dist/lib/workflow-edit-session.d.ts +1 -16
- package/dist/lib/workflow-edit-session.js +1 -57
- package/dist/lib/workflow-edit-utils.d.ts +1 -10
- package/dist/lib/workflow-edit-utils.js +1 -39
- package/dist/lib/workflow-helpers.d.ts +1 -38
- package/dist/lib/workflow-helpers.js +1 -167
- package/dist/lib/workflow-improvement.d.ts +1 -22
- package/dist/lib/workflow-improvement.js +1 -209
- package/dist/lib/workflow-primitives.d.ts +1 -2
- package/dist/lib/workflow-primitives.js +1 -5
- package/dist/lib/workflow-review-paths.d.ts +1 -10
- package/dist/lib/workflow-review-paths.js +1 -27
- package/dist/lib/workflow-stage-policy.d.ts +1 -5
- package/dist/lib/workflow-stage-policy.js +1 -31
- package/dist/lib/workflow-stage-runner.d.ts +1 -41
- package/dist/lib/workflow-stage-runner.js +1 -109
- package/dist/lib/workflows.d.ts +1 -15
- package/dist/lib/workflows.js +1 -31
- package/dist/packages/agents/index.d.ts +18 -0
- package/dist/packages/agents/index.js +16 -0
- package/dist/packages/agents/lib/agents.d.ts +6 -0
- package/dist/packages/agents/lib/agents.js +5 -0
- package/dist/packages/agents/lib/args.d.ts +4 -0
- package/dist/packages/agents/lib/args.js +52 -0
- package/dist/packages/agents/lib/chart-guidance.d.ts +1 -0
- package/dist/packages/agents/lib/chart-guidance.js +8 -0
- package/dist/packages/agents/lib/compiled-bootstrap.d.ts +3 -0
- package/dist/packages/agents/lib/compiled-bootstrap.js +18 -0
- package/dist/packages/agents/lib/constants.d.ts +5 -0
- package/dist/packages/agents/lib/constants.js +28 -0
- package/dist/packages/agents/lib/detection.d.ts +7 -0
- package/dist/packages/agents/lib/detection.js +65 -0
- package/dist/packages/agents/lib/execution-profile.d.ts +17 -0
- package/dist/packages/agents/lib/execution-profile.js +84 -0
- package/dist/packages/agents/lib/execution.d.ts +2 -0
- package/dist/packages/agents/lib/execution.js +243 -0
- package/dist/packages/agents/lib/executors.d.ts +32 -0
- package/dist/packages/agents/lib/executors.js +45 -0
- package/dist/packages/agents/lib/logs.d.ts +2 -0
- package/dist/packages/agents/lib/logs.js +17 -0
- package/dist/packages/agents/lib/preflight.d.ts +7 -0
- package/dist/packages/agents/lib/preflight.js +77 -0
- package/dist/packages/agents/lib/render.d.ts +8 -0
- package/dist/packages/agents/lib/render.js +218 -0
- package/dist/packages/agents/lib/schema.d.ts +8 -0
- package/dist/packages/agents/lib/schema.js +7 -0
- package/dist/packages/agents/lib/shells.d.ts +71 -0
- package/dist/packages/agents/lib/shells.js +1023 -0
- package/dist/packages/agents/lib/status.d.ts +3 -0
- package/dist/packages/agents/lib/status.js +58 -0
- package/dist/packages/agents/lib/types.d.ts +30 -0
- package/dist/packages/agents/lib/types.js +1 -0
- package/dist/{lib → packages/agents/lib}/user-config.d.ts +1 -0
- package/dist/{lib → packages/agents/lib}/user-config.js +3 -2
- package/dist/packages/compiler/compiled-compile.d.ts +4 -0
- package/dist/packages/compiler/compiled-compile.js +4 -0
- package/dist/packages/compiler/compiled-paths.d.ts +40 -0
- package/dist/packages/compiler/compiled-paths.js +106 -0
- package/dist/packages/compiler/compiled-pipeline.d.ts +39 -0
- package/dist/packages/compiler/compiled-pipeline.js +134 -0
- package/dist/packages/compiler/compiled-schema.d.ts +31 -0
- package/dist/packages/compiler/compiled-schema.js +141 -0
- package/dist/packages/compiler/compiled-stage-plan.d.ts +15 -0
- package/dist/packages/compiler/compiled-stage-plan.js +79 -0
- package/dist/packages/compiler/compiled-stage-runner.d.ts +10 -0
- package/dist/packages/compiler/compiled-stage-runner.js +46 -0
- package/dist/packages/compiler/compiled-target.d.ts +11 -0
- package/dist/packages/compiler/compiled-target.js +16 -0
- package/dist/packages/compiler/discovery.d.ts +7 -0
- package/dist/packages/compiler/discovery.js +80 -0
- package/dist/packages/compiler/index.d.ts +24 -0
- package/dist/packages/compiler/index.js +23 -0
- package/dist/packages/compiler/lib/schema.d.ts +684 -0
- package/dist/packages/compiler/lib/schema.js +363 -0
- package/dist/packages/compiler/raw-snapshot.d.ts +49 -0
- package/dist/packages/compiler/raw-snapshot.js +102 -0
- package/dist/packages/compiler/reset.d.ts +2 -0
- package/dist/packages/compiler/reset.js +72 -0
- package/dist/packages/compiler/runtime-acceptance.d.ts +9 -0
- package/dist/packages/compiler/runtime-acceptance.js +269 -0
- package/dist/packages/compiler/runtime-contracts.d.ts +2 -0
- package/dist/packages/compiler/runtime-contracts.js +48 -0
- package/dist/packages/compiler/runtime-inventory.d.ts +7 -0
- package/dist/packages/compiler/runtime-inventory.js +29 -0
- package/dist/packages/compiler/runtime-paths.d.ts +8 -0
- package/dist/packages/compiler/runtime-paths.js +26 -0
- package/dist/packages/compiler/runtime-prompt.d.ts +2 -0
- package/dist/packages/compiler/runtime-prompt.js +48 -0
- package/dist/packages/compiler/runtime-reconcile.d.ts +2 -0
- package/dist/packages/compiler/runtime-reconcile.js +193 -0
- package/dist/packages/compiler/runtime-runs.d.ts +11 -0
- package/dist/packages/compiler/runtime-runs.js +262 -0
- package/dist/packages/compiler/runtime-types.d.ts +43 -0
- package/dist/packages/compiler/runtime-types.js +1 -0
- package/dist/packages/compiler/runtime.d.ts +6 -0
- package/dist/packages/compiler/runtime.js +5 -0
- package/dist/packages/compiler/state-artifacts.d.ts +8 -0
- package/dist/packages/compiler/state-artifacts.js +13 -0
- package/dist/packages/compiler/state-health.d.ts +4 -0
- package/dist/packages/compiler/state-health.js +132 -0
- package/dist/packages/compiler/state-io.d.ts +10 -0
- package/dist/packages/compiler/state-io.js +76 -0
- package/dist/packages/compiler/state-paths.d.ts +4 -0
- package/dist/packages/compiler/state-paths.js +13 -0
- package/dist/packages/compiler/state-view.d.ts +4 -0
- package/dist/packages/compiler/state-view.js +103 -0
- package/dist/packages/compiler/state.d.ts +7 -0
- package/dist/packages/compiler/state.js +12 -0
- package/dist/packages/compiler/validate-compiled.d.ts +27 -0
- package/dist/packages/compiler/validate-compiled.js +241 -0
- package/dist/packages/compiler/validate-helpers.d.ts +12 -0
- package/dist/packages/compiler/validate-helpers.js +41 -0
- package/dist/packages/compiler/validate.d.ts +21 -0
- package/dist/packages/compiler/validate.js +249 -0
- package/dist/packages/compiler/workflow-primitives.d.ts +2 -0
- package/dist/packages/compiler/workflow-primitives.js +5 -0
- package/dist/packages/compiler/workflows.d.ts +15 -0
- package/dist/packages/compiler/workflows.js +31 -0
- package/dist/packages/project-model/compiled-paths.d.ts +1 -0
- package/dist/packages/project-model/compiled-paths.js +1 -0
- package/dist/packages/project-model/compiled-raw.d.ts +1 -0
- package/dist/packages/project-model/compiled-raw.js +1 -0
- package/dist/packages/project-model/compiled-reset.d.ts +1 -0
- package/dist/packages/project-model/compiled-reset.js +1 -0
- package/dist/packages/project-model/index.d.ts +11 -0
- package/dist/packages/project-model/index.js +10 -0
- package/dist/packages/project-model/interf-bootstrap.d.ts +1 -0
- package/dist/packages/project-model/interf-bootstrap.js +1 -0
- package/dist/packages/project-model/interf-detect.d.ts +33 -0
- package/dist/packages/project-model/interf-detect.js +176 -0
- package/dist/packages/project-model/interf-scaffold.d.ts +2 -0
- package/dist/packages/project-model/interf-scaffold.js +124 -0
- package/dist/packages/project-model/interf.d.ts +5 -0
- package/dist/packages/project-model/interf.js +4 -0
- package/dist/packages/project-model/lib/schema.d.ts +125 -0
- package/dist/packages/project-model/lib/schema.js +62 -0
- package/dist/packages/project-model/project-paths.d.ts +11 -0
- package/dist/packages/project-model/project-paths.js +32 -0
- package/dist/packages/project-model/source-config.d.ts +38 -0
- package/dist/packages/project-model/source-config.js +298 -0
- package/dist/packages/shared/file-types.d.ts +1 -0
- package/dist/packages/shared/file-types.js +4 -0
- package/dist/packages/shared/filesystem.d.ts +2 -0
- package/dist/packages/shared/filesystem.js +55 -0
- package/dist/packages/shared/index.d.ts +7 -0
- package/dist/packages/shared/index.js +7 -0
- package/dist/packages/shared/logger.d.ts +3 -0
- package/dist/packages/shared/logger.js +10 -0
- package/dist/packages/shared/naming.d.ts +1 -0
- package/dist/packages/shared/naming.js +8 -0
- package/dist/packages/shared/parse.d.ts +8 -0
- package/dist/packages/shared/parse.js +145 -0
- package/dist/packages/shared/path-guards.d.ts +2 -0
- package/dist/packages/shared/path-guards.js +14 -0
- package/dist/packages/shared/util.d.ts +3 -0
- package/dist/packages/shared/util.js +3 -0
- package/dist/packages/testing/index.d.ts +13 -0
- package/dist/packages/testing/index.js +10 -0
- package/dist/packages/testing/lib/schema.d.ts +261 -0
- package/dist/packages/testing/lib/schema.js +119 -0
- package/dist/packages/testing/test-execution.d.ts +14 -0
- package/dist/packages/testing/test-execution.js +525 -0
- package/dist/packages/testing/test-matrices.d.ts +90 -0
- package/dist/packages/testing/test-matrices.js +96 -0
- package/dist/packages/testing/test-paths.d.ts +12 -0
- package/dist/packages/testing/test-paths.js +59 -0
- package/dist/packages/testing/test-profile-presets.d.ts +57 -0
- package/dist/packages/testing/test-profile-presets.js +50 -0
- package/dist/packages/testing/test-sandbox.d.ts +11 -0
- package/dist/packages/testing/test-sandbox.js +105 -0
- package/dist/packages/testing/test-specs.d.ts +7 -0
- package/dist/packages/testing/test-specs.js +114 -0
- package/dist/packages/testing/test-targets.d.ts +5 -0
- package/dist/packages/testing/test-targets.js +38 -0
- package/dist/packages/testing/test-types.d.ts +16 -0
- package/dist/packages/testing/test-types.js +1 -0
- package/dist/packages/testing/test.d.ts +4 -0
- package/dist/packages/testing/test.js +3 -0
- package/dist/packages/workflow-authoring/index.d.ts +4 -0
- package/dist/packages/workflow-authoring/index.js +4 -0
- package/dist/packages/workflow-authoring/lib/workflow-edit-utils.d.ts +10 -0
- package/dist/packages/workflow-authoring/lib/workflow-edit-utils.js +39 -0
- package/dist/packages/workflow-authoring/workflow-authoring.d.ts +26 -0
- package/dist/packages/workflow-authoring/workflow-authoring.js +121 -0
- package/dist/packages/workflow-authoring/workflow-edit-session.d.ts +16 -0
- package/dist/packages/workflow-authoring/workflow-edit-session.js +57 -0
- package/dist/packages/workflow-authoring/workflow-improvement.d.ts +23 -0
- package/dist/packages/workflow-authoring/workflow-improvement.js +210 -0
- package/dist/packages/workflow-package/builtin-compiled-workflow.d.ts +38 -0
- package/dist/packages/workflow-package/builtin-compiled-workflow.js +94 -0
- package/dist/packages/workflow-package/context-interface.d.ts +96 -0
- package/dist/packages/workflow-package/context-interface.js +146 -0
- package/dist/packages/workflow-package/index.d.ts +11 -0
- package/dist/packages/workflow-package/index.js +11 -0
- package/dist/packages/workflow-package/interf-workflow-package.d.ts +25 -0
- package/dist/packages/workflow-package/interf-workflow-package.js +389 -0
- package/dist/{lib/config.d.ts → packages/workflow-package/lib/package-root.d.ts} +0 -1
- package/dist/packages/workflow-package/lib/package-root.js +6 -0
- package/dist/packages/workflow-package/local-workflows.d.ts +57 -0
- package/dist/packages/workflow-package/local-workflows.js +424 -0
- package/dist/packages/workflow-package/workflow-definitions.d.ts +82 -0
- package/dist/packages/workflow-package/workflow-definitions.js +210 -0
- package/dist/packages/workflow-package/workflow-helpers.d.ts +38 -0
- package/dist/packages/workflow-package/workflow-helpers.js +167 -0
- package/dist/packages/workflow-package/workflow-review-paths.d.ts +10 -0
- package/dist/packages/workflow-package/workflow-review-paths.js +27 -0
- package/dist/packages/workflow-package/workflow-stage-policy.d.ts +5 -0
- package/dist/packages/workflow-package/workflow-stage-policy.js +31 -0
- package/dist/packages/workflow-package/workflow-stage-runner.d.ts +41 -0
- package/dist/packages/workflow-package/workflow-stage-runner.js +109 -0
- package/package.json +43 -19
- package/dist/commands/test.d.ts +0 -3
- package/dist/lib/compiled-home.d.ts +0 -5
- package/dist/lib/compiled-home.js +0 -32
- package/dist/lib/config.js +0 -9
- /package/dist/{commands → cli/commands}/dataset-selection.js +0 -0
- /package/dist/{commands → cli/commands}/default.d.ts +0 -0
- /package/dist/{commands → cli/commands}/doctor.d.ts +0 -0
- /package/dist/{commands → cli/commands}/list.d.ts +0 -0
- /package/dist/{commands → cli/commands}/reset.d.ts +0 -0
- /package/dist/{commands → cli/commands}/status.d.ts +0 -0
- /package/dist/{commands → cli/commands}/verify.d.ts +0 -0
|
@@ -1,422 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { dirname, join, relative } from "node:path";
|
|
3
|
-
import { z } from "zod";
|
|
4
|
-
import { PACKAGE_ROOT } from "./config.js";
|
|
5
|
-
import { isMarkdownFile } from "./util.js";
|
|
6
|
-
import { listFilesRecursive } from "./filesystem.js";
|
|
7
|
-
import { warnInterf } from "./logger.js";
|
|
8
|
-
import { readJsonFileUnchecked, readJsonFileWithSchema } from "./parse.js";
|
|
9
|
-
import { listBuiltinCompiledZoneSpecs, } from "./builtin-compiled-workflow.js";
|
|
10
|
-
import { WorkflowCompilerApiSchema, RuntimeContractTypeSchema, RuntimeStageAcceptanceSchema, WorkflowPurposeSchema, WorkflowStageZoneAccessSchema, WorkflowIdPattern, } from "./schema.js";
|
|
11
|
-
import { WORKFLOW_SCHEMA_FILE, workflowSchemaExists, writeWorkflowSchemaDocument, workflowSchemaFilePath, readWorkflowSchemaFile, } from "./compiled-schema.js";
|
|
12
|
-
import { mergeStagePolicyNotesForStages } from "./workflow-stage-policy.js";
|
|
13
|
-
const LocalWorkflowStageDefinitionSchema = z.object({
|
|
14
|
-
id: z.string().regex(WorkflowIdPattern),
|
|
15
|
-
label: z.string().min(1),
|
|
16
|
-
contract_type: RuntimeContractTypeSchema,
|
|
17
|
-
skill_dir: z.string().regex(WorkflowIdPattern).optional(),
|
|
18
|
-
description: z.string().min(1).optional(),
|
|
19
|
-
reads: WorkflowStageZoneAccessSchema,
|
|
20
|
-
writes: WorkflowStageZoneAccessSchema,
|
|
21
|
-
acceptance: RuntimeStageAcceptanceSchema.optional(),
|
|
22
|
-
});
|
|
23
|
-
const LocalWorkflowDefinitionSchema = z.object({
|
|
24
|
-
id: z.string().regex(WorkflowIdPattern),
|
|
25
|
-
type: z.literal("compiled"),
|
|
26
|
-
compiler_api: WorkflowCompilerApiSchema.optional(),
|
|
27
|
-
purpose: WorkflowPurposeSchema.optional(),
|
|
28
|
-
label: z.string().min(1),
|
|
29
|
-
hint: z.string().min(1),
|
|
30
|
-
extends: z.string().regex(WorkflowIdPattern).optional(),
|
|
31
|
-
stages: z.array(LocalWorkflowStageDefinitionSchema).min(1).optional(),
|
|
32
|
-
stage_policy_notes: z.record(z.string(), z.array(z.string())).optional(),
|
|
33
|
-
});
|
|
34
|
-
function workflowRootPath(sourcePath) {
|
|
35
|
-
return join(sourcePath, "interf", "workflows");
|
|
36
|
-
}
|
|
37
|
-
function builtinWorkflowRootPath(workflowId) {
|
|
38
|
-
return join(PACKAGE_ROOT, "builtin-workflows", workflowId);
|
|
39
|
-
}
|
|
40
|
-
export function workflowDefinitionPath(sourcePath, id) {
|
|
41
|
-
return join(workflowRootPath(sourcePath), id);
|
|
42
|
-
}
|
|
43
|
-
function isSupportedWorkflowStarterDocPath(relativePath) {
|
|
44
|
-
if (relativePath === "README.md")
|
|
45
|
-
return true;
|
|
46
|
-
if (relativePath.startsWith("improve/"))
|
|
47
|
-
return true;
|
|
48
|
-
if (relativePath.startsWith("use/query/"))
|
|
49
|
-
return true;
|
|
50
|
-
if (relativePath.startsWith("compile/stages/"))
|
|
51
|
-
return true;
|
|
52
|
-
return false;
|
|
53
|
-
}
|
|
54
|
-
function collectStarterDocs(dirPath) {
|
|
55
|
-
return listFilesRecursive(dirPath, isMarkdownFile)
|
|
56
|
-
.map((filePath) => relative(dirPath, filePath).replaceAll("\\", "/"))
|
|
57
|
-
.filter((relativePath) => isSupportedWorkflowStarterDocPath(relativePath))
|
|
58
|
-
.map((relativePath) => ({
|
|
59
|
-
relativePath,
|
|
60
|
-
content: readFileSync(join(dirPath, relativePath), "utf8"),
|
|
61
|
-
}))
|
|
62
|
-
.sort((a, b) => a.relativePath.localeCompare(b.relativePath));
|
|
63
|
-
}
|
|
64
|
-
function workflowPackageCopyPaths(dirPath) {
|
|
65
|
-
return [
|
|
66
|
-
"workflow.json",
|
|
67
|
-
WORKFLOW_SCHEMA_FILE,
|
|
68
|
-
...collectStarterDocs(dirPath).map((doc) => doc.relativePath),
|
|
69
|
-
];
|
|
70
|
-
}
|
|
71
|
-
function copyRelativeFile(sourceRoot, targetRoot, relativePath) {
|
|
72
|
-
const sourcePath = join(sourceRoot, relativePath);
|
|
73
|
-
if (!existsSync(sourcePath))
|
|
74
|
-
return;
|
|
75
|
-
const targetPath = join(targetRoot, relativePath);
|
|
76
|
-
mkdirSync(dirname(targetPath), { recursive: true });
|
|
77
|
-
cpSync(sourcePath, targetPath, { force: true });
|
|
78
|
-
}
|
|
79
|
-
function copyWorkflowPackageFiles(sourceWorkflowPath, targetWorkflowPath) {
|
|
80
|
-
rmSync(targetWorkflowPath, { recursive: true, force: true });
|
|
81
|
-
mkdirSync(targetWorkflowPath, { recursive: true });
|
|
82
|
-
for (const relativePath of workflowPackageCopyPaths(sourceWorkflowPath)) {
|
|
83
|
-
copyRelativeFile(sourceWorkflowPath, targetWorkflowPath, relativePath);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
export function loadWorkflowDefinitionFromDir(dirPath) {
|
|
87
|
-
const workflowPath = existsSync(join(dirPath, "workflow.json"))
|
|
88
|
-
? join(dirPath, "workflow.json")
|
|
89
|
-
: null;
|
|
90
|
-
if (!workflowPath)
|
|
91
|
-
return null;
|
|
92
|
-
const definition = readJsonFileWithSchema(workflowPath, "local workflow definition", LocalWorkflowDefinitionSchema);
|
|
93
|
-
if (!definition)
|
|
94
|
-
return null;
|
|
95
|
-
const workflowSchema = readWorkflowSchemaFile(dirPath);
|
|
96
|
-
if (!workflowSchema)
|
|
97
|
-
return null;
|
|
98
|
-
if (definition.type !== "compiled") {
|
|
99
|
-
warnInterf(`Warning: local workflow definition at ${workflowPath} has unexpected type "${definition.type}".`);
|
|
100
|
-
return null;
|
|
101
|
-
}
|
|
102
|
-
return {
|
|
103
|
-
...definition,
|
|
104
|
-
workflow_schema: workflowSchema,
|
|
105
|
-
starter_docs: collectStarterDocs(dirPath),
|
|
106
|
-
directoryPath: dirPath,
|
|
107
|
-
workflowPath,
|
|
108
|
-
workflowSchemaPath: workflowSchemaFilePath(dirPath),
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
export function listLocalWorkflowDefinitions(sourcePath) {
|
|
112
|
-
const root = workflowRootPath(sourcePath);
|
|
113
|
-
if (!existsSync(root))
|
|
114
|
-
return [];
|
|
115
|
-
return readdirSync(root)
|
|
116
|
-
.map((entry) => join(root, entry))
|
|
117
|
-
.filter((entryPath) => {
|
|
118
|
-
try {
|
|
119
|
-
return statSync(entryPath).isDirectory();
|
|
120
|
-
}
|
|
121
|
-
catch {
|
|
122
|
-
return false;
|
|
123
|
-
}
|
|
124
|
-
})
|
|
125
|
-
.map((entryPath) => loadWorkflowDefinitionFromDir(entryPath))
|
|
126
|
-
.filter((definition) => definition !== null)
|
|
127
|
-
.sort((a, b) => a.label.localeCompare(b.label));
|
|
128
|
-
}
|
|
129
|
-
export function loadLocalWorkflowDefinition(sourcePath, id) {
|
|
130
|
-
return loadWorkflowDefinitionFromDir(workflowDefinitionPath(sourcePath, id));
|
|
131
|
-
}
|
|
132
|
-
export function resolveWorkflowPackageSourcePath(sourcePath, workflowId) {
|
|
133
|
-
const builtinPath = builtinWorkflowRootPath(workflowId);
|
|
134
|
-
if (workflowId === "interf" && existsSync(join(builtinPath, "workflow.json")))
|
|
135
|
-
return builtinPath;
|
|
136
|
-
const localPath = workflowDefinitionPath(sourcePath, workflowId);
|
|
137
|
-
if (existsSync(join(localPath, "workflow.json")))
|
|
138
|
-
return localPath;
|
|
139
|
-
if (existsSync(join(builtinPath, "workflow.json")))
|
|
140
|
-
return builtinPath;
|
|
141
|
-
return null;
|
|
142
|
-
}
|
|
143
|
-
export function isWorkflowId(value) {
|
|
144
|
-
return WorkflowIdPattern.test(value);
|
|
145
|
-
}
|
|
146
|
-
function readWorkflowJsonObject(dirPath) {
|
|
147
|
-
const workflowPath = join(dirPath, "workflow.json");
|
|
148
|
-
const raw = readJsonFileUnchecked(workflowPath, "workflow package");
|
|
149
|
-
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
|
150
|
-
throw new Error(`Workflow package at ${dirPath} is missing a valid workflow.json.`);
|
|
151
|
-
}
|
|
152
|
-
return { ...raw };
|
|
153
|
-
}
|
|
154
|
-
export function patchWorkflowPackageMetadata(dirPath, options = {}) {
|
|
155
|
-
const workflowPath = join(dirPath, "workflow.json");
|
|
156
|
-
const workflowJson = readWorkflowJsonObject(dirPath);
|
|
157
|
-
const normalizedStages = Array.isArray(workflowJson.stages) && workflowJson.stages.length > 0
|
|
158
|
-
? workflowJson.stages
|
|
159
|
-
: null;
|
|
160
|
-
if (!normalizedStages) {
|
|
161
|
-
throw new Error(`Cannot patch workflow package at ${dirPath}: workflow.json must declare explicit stages before it can be copied or rewritten.`);
|
|
162
|
-
}
|
|
163
|
-
const nextWorkflowJson = {
|
|
164
|
-
...workflowJson,
|
|
165
|
-
type: "compiled",
|
|
166
|
-
compiler_api: workflowJson.compiler_api ?? {
|
|
167
|
-
kind: "compiled",
|
|
168
|
-
version: 1,
|
|
169
|
-
},
|
|
170
|
-
stages: normalizedStages,
|
|
171
|
-
...(options.id ? { id: options.id } : {}),
|
|
172
|
-
...(options.label ? { label: options.label } : {}),
|
|
173
|
-
...(options.hint ? { hint: options.hint } : {}),
|
|
174
|
-
};
|
|
175
|
-
delete nextWorkflowJson.extends;
|
|
176
|
-
const mergedStagePolicyNotes = mergeStagePolicyNotesForStages(normalizedStages, workflowJson.stage_policy_notes, options.stagePolicyNotes);
|
|
177
|
-
if (mergedStagePolicyNotes) {
|
|
178
|
-
nextWorkflowJson.stage_policy_notes = mergedStagePolicyNotes;
|
|
179
|
-
}
|
|
180
|
-
else {
|
|
181
|
-
delete nextWorkflowJson.stage_policy_notes;
|
|
182
|
-
}
|
|
183
|
-
writeFileSync(workflowPath, JSON.stringify(nextWorkflowJson, null, 2) + "\n");
|
|
184
|
-
const schemaLabel = `${String(nextWorkflowJson.label ?? workflowJson.label ?? options.id ?? "Workflow")} workflow schema`;
|
|
185
|
-
const existingSchema = readWorkflowSchemaFile(dirPath);
|
|
186
|
-
if (!existingSchema) {
|
|
187
|
-
throw new Error(`Cannot patch workflow package at ${dirPath}: missing ${WORKFLOW_SCHEMA_FILE}. Restore or reseed the package instead of regenerating a schema from workflow.json.`);
|
|
188
|
-
}
|
|
189
|
-
writeWorkflowSchemaDocument(dirPath, {
|
|
190
|
-
...existingSchema,
|
|
191
|
-
label: schemaLabel,
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
function collectWorkflowPackageStructureIssues(dirPath, stages) {
|
|
195
|
-
const issues = [];
|
|
196
|
-
const workflowPath = join(dirPath, "workflow.json");
|
|
197
|
-
if (!existsSync(workflowPath))
|
|
198
|
-
issues.push("missing workflow.json");
|
|
199
|
-
if (!workflowSchemaExists(dirPath))
|
|
200
|
-
issues.push("missing workflow.schema.json");
|
|
201
|
-
if (!existsSync(join(dirPath, "README.md")))
|
|
202
|
-
issues.push("missing README.md");
|
|
203
|
-
if (!existsSync(join(dirPath, "improve", "SKILL.md")))
|
|
204
|
-
issues.push("missing improve/SKILL.md");
|
|
205
|
-
if (!existsSync(join(dirPath, "use", "query", "SKILL.md")))
|
|
206
|
-
issues.push("missing use/query/SKILL.md");
|
|
207
|
-
if (!stages)
|
|
208
|
-
return issues;
|
|
209
|
-
for (const stage of stages) {
|
|
210
|
-
const skillDir = typeof stage.skill_dir === "string" && stage.skill_dir.trim().length > 0
|
|
211
|
-
? stage.skill_dir
|
|
212
|
-
: stage.id;
|
|
213
|
-
if (!existsSync(join(dirPath, "compile", "stages", skillDir, "SKILL.md"))) {
|
|
214
|
-
issues.push(`missing compile/stages/${skillDir}/SKILL.md`);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
return issues;
|
|
218
|
-
}
|
|
219
|
-
function collectWorkflowStageSkillIssues(dirPath, stages) {
|
|
220
|
-
if (!stages)
|
|
221
|
-
return [];
|
|
222
|
-
const issues = [];
|
|
223
|
-
for (const stage of stages) {
|
|
224
|
-
const skillDir = typeof stage.skill_dir === "string" && stage.skill_dir.trim().length > 0
|
|
225
|
-
? stage.skill_dir
|
|
226
|
-
: stage.id;
|
|
227
|
-
if (!existsSync(join(dirPath, "compile", "stages", skillDir, "SKILL.md"))) {
|
|
228
|
-
issues.push(`missing compile/stages/${skillDir}/SKILL.md`);
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
return issues;
|
|
232
|
-
}
|
|
233
|
-
export function describeWorkflowPackagePortability(dirPath) {
|
|
234
|
-
const issues = collectWorkflowPackageStructureIssues(dirPath, null);
|
|
235
|
-
if (issues.length > 0)
|
|
236
|
-
return issues;
|
|
237
|
-
let workflowJson;
|
|
238
|
-
try {
|
|
239
|
-
workflowJson = readWorkflowJsonObject(dirPath);
|
|
240
|
-
}
|
|
241
|
-
catch (error) {
|
|
242
|
-
issues.push(error instanceof Error ? error.message : String(error));
|
|
243
|
-
return issues;
|
|
244
|
-
}
|
|
245
|
-
const parsed = LocalWorkflowDefinitionSchema.safeParse(workflowJson);
|
|
246
|
-
if (!parsed.success) {
|
|
247
|
-
issues.push(...parsed.error.issues.map((issue) => issue.path.length > 0
|
|
248
|
-
? `workflow.json ${issue.path.join(".")}: ${issue.message}`
|
|
249
|
-
: `workflow.json: ${issue.message}`));
|
|
250
|
-
return issues;
|
|
251
|
-
}
|
|
252
|
-
if (typeof parsed.data.extends === "string" && parsed.data.extends.trim().length > 0) {
|
|
253
|
-
issues.push("workflow.json uses legacy extends; portable workflow packages must be materialized standalone");
|
|
254
|
-
}
|
|
255
|
-
if (!parsed.data.stages || parsed.data.stages.length === 0) {
|
|
256
|
-
issues.push("workflow.json must declare explicit stages for a portable workflow package");
|
|
257
|
-
return issues;
|
|
258
|
-
}
|
|
259
|
-
return [
|
|
260
|
-
...issues,
|
|
261
|
-
...collectWorkflowStageSkillIssues(dirPath, parsed.data.stages ?? null),
|
|
262
|
-
];
|
|
263
|
-
}
|
|
264
|
-
export function isPortableWorkflowPackage(dirPath) {
|
|
265
|
-
return describeWorkflowPackagePortability(dirPath).length === 0;
|
|
266
|
-
}
|
|
267
|
-
export function copyWorkflowPackageDirectory(sourceWorkflowPath, targetWorkflowPath) {
|
|
268
|
-
const portabilityIssues = describeWorkflowPackagePortability(sourceWorkflowPath);
|
|
269
|
-
if (portabilityIssues.length > 0) {
|
|
270
|
-
throw new Error(`Workflow package at ${sourceWorkflowPath} is not directly copyable: ${portabilityIssues.join("; ")}.`);
|
|
271
|
-
}
|
|
272
|
-
mkdirSync(dirname(targetWorkflowPath), { recursive: true });
|
|
273
|
-
copyWorkflowPackageFiles(sourceWorkflowPath, targetWorkflowPath);
|
|
274
|
-
}
|
|
275
|
-
export function validateWorkflowPackage(dirPath) {
|
|
276
|
-
const workflowPath = join(dirPath, "workflow.json");
|
|
277
|
-
if (!existsSync(workflowPath)) {
|
|
278
|
-
return {
|
|
279
|
-
ok: false,
|
|
280
|
-
summary: `No workflow.json found at ${dirPath}`,
|
|
281
|
-
errors: ["Missing workflow.json"],
|
|
282
|
-
counts: {},
|
|
283
|
-
};
|
|
284
|
-
}
|
|
285
|
-
const raw = readJsonFileUnchecked(workflowPath, "workflow package");
|
|
286
|
-
if (!raw) {
|
|
287
|
-
return {
|
|
288
|
-
ok: false,
|
|
289
|
-
summary: `Failed to parse workflow.json at ${workflowPath}`,
|
|
290
|
-
errors: ["Invalid JSON in workflow.json"],
|
|
291
|
-
counts: {},
|
|
292
|
-
};
|
|
293
|
-
}
|
|
294
|
-
const parsed = LocalWorkflowDefinitionSchema.safeParse(raw);
|
|
295
|
-
if (!parsed.success) {
|
|
296
|
-
const issues = parsed.error.issues.map((issue) => `${issue.path.join(".")}: ${issue.message}`);
|
|
297
|
-
return {
|
|
298
|
-
ok: false,
|
|
299
|
-
summary: `workflow.json failed validation: ${issues.length} issue(s)`,
|
|
300
|
-
errors: issues,
|
|
301
|
-
counts: {},
|
|
302
|
-
};
|
|
303
|
-
}
|
|
304
|
-
const def = parsed.data;
|
|
305
|
-
const errors = [];
|
|
306
|
-
if (typeof def.extends === "string" && def.extends.trim().length > 0) {
|
|
307
|
-
errors.push("workflow.json uses legacy extends. Portable workflow packages must be materialized as standalone packages.");
|
|
308
|
-
}
|
|
309
|
-
if (!def.stages || def.stages.length === 0) {
|
|
310
|
-
errors.push("workflow.json must declare explicit stages. Legacy inherited packages are not portable.");
|
|
311
|
-
}
|
|
312
|
-
if (def.stage_policy_notes && def.stages) {
|
|
313
|
-
const stageIds = new Set(def.stages.map((stage) => stage.id));
|
|
314
|
-
for (const stageId of Object.keys(def.stage_policy_notes)) {
|
|
315
|
-
if (!stageIds.has(stageId)) {
|
|
316
|
-
errors.push(`workflow.json stage_policy_notes references unknown stage "${stageId}".`);
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
for (const issue of collectWorkflowPackageStructureIssues(dirPath, def.stages ?? null)) {
|
|
321
|
-
const formatted = issue.startsWith("missing ")
|
|
322
|
-
? `Missing ${issue.slice("missing ".length)}.`
|
|
323
|
-
: issue;
|
|
324
|
-
errors.push(formatted);
|
|
325
|
-
}
|
|
326
|
-
const workflowSchema = readWorkflowSchemaFile(dirPath);
|
|
327
|
-
if (!workflowSchema) {
|
|
328
|
-
errors.push("workflow.schema.json is missing or invalid.");
|
|
329
|
-
}
|
|
330
|
-
if (workflowSchema) {
|
|
331
|
-
const stages = def.stages ?? [];
|
|
332
|
-
const stageIds = new Set(stages.map((stage) => stage.id));
|
|
333
|
-
const seenPaths = new Map();
|
|
334
|
-
const seenZoneIds = new Set();
|
|
335
|
-
const zoneById = new Map(workflowSchema.zones.map((zone) => [zone.id, zone]));
|
|
336
|
-
const normalizedParts = (value) => value.replaceAll("\\", "/").split("/").filter(Boolean);
|
|
337
|
-
const hasOverlappingPath = (value, other) => {
|
|
338
|
-
const a = normalizedParts(value);
|
|
339
|
-
const b = normalizedParts(other);
|
|
340
|
-
const shorter = a.length <= b.length ? a : b;
|
|
341
|
-
const longer = a.length <= b.length ? b : a;
|
|
342
|
-
return shorter.every((part, index) => longer[index] === part);
|
|
343
|
-
};
|
|
344
|
-
for (const zone of workflowSchema.zones) {
|
|
345
|
-
if (seenZoneIds.has(zone.id)) {
|
|
346
|
-
errors.push(`workflow.schema.json repeats zone id "${zone.id}".`);
|
|
347
|
-
}
|
|
348
|
-
seenZoneIds.add(zone.id);
|
|
349
|
-
const existingPathOwner = seenPaths.get(zone.path);
|
|
350
|
-
if (existingPathOwner) {
|
|
351
|
-
errors.push(`workflow.schema.json repeats zone path "${zone.path}".`);
|
|
352
|
-
}
|
|
353
|
-
for (const [existingPath, existingZoneId] of seenPaths.entries()) {
|
|
354
|
-
if (existingPath === zone.path)
|
|
355
|
-
continue;
|
|
356
|
-
if (hasOverlappingPath(zone.path, existingPath)) {
|
|
357
|
-
errors.push(`workflow.schema.json zones "${zone.id}" and "${existingZoneId}" overlap on path "${zone.path}" / "${existingPath}".`);
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
seenPaths.set(zone.path, zone.id);
|
|
361
|
-
if ((zone.role === "input" || zone.role === "runtime") && zone.owned_by.length > 0) {
|
|
362
|
-
errors.push(`workflow.schema.json zone "${zone.id}" cannot declare owners because its role is "${zone.role}".`);
|
|
363
|
-
}
|
|
364
|
-
for (const owner of zone.owned_by) {
|
|
365
|
-
if (!stageIds.has(owner)) {
|
|
366
|
-
errors.push(`workflow.schema.json references unknown stage "${owner}" for zone "${zone.path}".`);
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
for (const stage of stages) {
|
|
371
|
-
for (const zoneId of stage.reads) {
|
|
372
|
-
if (!zoneById.has(zoneId)) {
|
|
373
|
-
errors.push(`Stage "${stage.id}" reads unknown zone "${zoneId}".`);
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
for (const zoneId of stage.writes) {
|
|
377
|
-
const zone = zoneById.get(zoneId);
|
|
378
|
-
if (!zone) {
|
|
379
|
-
errors.push(`Stage "${stage.id}" writes unknown zone "${zoneId}".`);
|
|
380
|
-
continue;
|
|
381
|
-
}
|
|
382
|
-
if (zone.role === "input" || zone.role === "runtime") {
|
|
383
|
-
errors.push(`Stage "${stage.id}" writes zone "${zoneId}" but zones with role "${zone.role}" are engine-owned inputs, not writable stage outputs.`);
|
|
384
|
-
}
|
|
385
|
-
if (!zone.owned_by.includes(stage.id)) {
|
|
386
|
-
errors.push(`Stage "${stage.id}" writes zone "${zoneId}" but that zone is not owned by the stage in workflow.schema.json.`);
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
for (const requiredZone of listBuiltinCompiledZoneSpecs().filter((zone) => zone.id === "raw" || zone.id === "runtime")) {
|
|
391
|
-
const match = zoneById.get(requiredZone.id);
|
|
392
|
-
if (!match) {
|
|
393
|
-
errors.push(`workflow.schema.json is missing required zone "${requiredZone.id}".`);
|
|
394
|
-
continue;
|
|
395
|
-
}
|
|
396
|
-
if (match.kind !== requiredZone.kind) {
|
|
397
|
-
errors.push(`workflow.schema.json zone "${requiredZone.id}" should be kind "${requiredZone.kind}".`);
|
|
398
|
-
}
|
|
399
|
-
if (match.role !== requiredZone.role) {
|
|
400
|
-
errors.push(`workflow.schema.json zone "${requiredZone.id}" should have role "${requiredZone.role}".`);
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
const stageDirs = existsSync(join(dirPath, "compile", "stages"))
|
|
405
|
-
? listFilesRecursive(join(dirPath, "compile", "stages"), (filePath) => basename(filePath) === "SKILL.md")
|
|
406
|
-
: [];
|
|
407
|
-
const counts = {
|
|
408
|
-
starter_docs: collectStarterDocs(dirPath).length,
|
|
409
|
-
compile_stage_docs: stageDirs.length,
|
|
410
|
-
compiled_zones: workflowSchema?.zones.length ?? 0,
|
|
411
|
-
workflow_zones: workflowSchema?.zones.length ?? 0,
|
|
412
|
-
};
|
|
413
|
-
return {
|
|
414
|
-
ok: errors.length === 0,
|
|
415
|
-
summary: errors.length === 0 ? "Workflow package is valid." : `Workflow package has ${errors.length} issue(s).`,
|
|
416
|
-
errors,
|
|
417
|
-
counts,
|
|
418
|
-
};
|
|
419
|
-
}
|
|
420
|
-
function basename(filePath) {
|
|
421
|
-
return filePath.split(/[\\/]/).pop() ?? filePath;
|
|
422
|
-
}
|
|
1
|
+
export * from "../packages/workflow-package/local-workflows.js";
|
package/dist/lib/logger.d.ts
CHANGED
package/dist/lib/logger.js
CHANGED
|
@@ -1,10 +1 @@
|
|
|
1
|
-
|
|
2
|
-
console.warn(message);
|
|
3
|
-
};
|
|
4
|
-
let currentWarningHandler = defaultWarningHandler;
|
|
5
|
-
export function setInterfWarningHandler(handler) {
|
|
6
|
-
currentWarningHandler = handler ?? defaultWarningHandler;
|
|
7
|
-
}
|
|
8
|
-
export function warnInterf(message) {
|
|
9
|
-
currentWarningHandler(message);
|
|
10
|
-
}
|
|
1
|
+
export * from "../packages/shared/logger.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../packages/workflow-package/lib/package-root.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../packages/workflow-package/lib/package-root.js";
|
package/dist/lib/parse.d.ts
CHANGED
|
@@ -1,8 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function readJsonFileUnchecked<T>(filePath: string, label: string): T | null;
|
|
3
|
-
export declare function readJsonFileWithSchema<T>(filePath: string, label: string, schema: ZodType<T>): T | null;
|
|
4
|
-
export declare function renderJsonFrontmatter(frontmatter: Record<string, unknown>): string;
|
|
5
|
-
export declare function parseJsonFrontmatter(content: string): {
|
|
6
|
-
frontmatter: Record<string, unknown>;
|
|
7
|
-
body: string;
|
|
8
|
-
} | null;
|
|
1
|
+
export * from "../packages/shared/parse.js";
|
package/dist/lib/parse.js
CHANGED
|
@@ -1,145 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { warnInterf } from "./logger.js";
|
|
3
|
-
function formatError(error) {
|
|
4
|
-
return error instanceof Error ? error.message : String(error);
|
|
5
|
-
}
|
|
6
|
-
export function readJsonFileUnchecked(filePath, label) {
|
|
7
|
-
try {
|
|
8
|
-
return JSON.parse(readFileSync(filePath, "utf-8"));
|
|
9
|
-
}
|
|
10
|
-
catch (error) {
|
|
11
|
-
warnInterf(`Warning: failed to parse ${label} at ${filePath}: ${formatError(error)}`);
|
|
12
|
-
return null;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
export function readJsonFileWithSchema(filePath, label, schema) {
|
|
16
|
-
const raw = readJsonFileUnchecked(filePath, label);
|
|
17
|
-
if (raw === null)
|
|
18
|
-
return null;
|
|
19
|
-
const parsed = schema.safeParse(raw);
|
|
20
|
-
if (!parsed.success) {
|
|
21
|
-
warnInterf(`Warning: failed to validate ${label} at ${filePath}: ${parsed.error.issues.map((issue) => issue.message).join("; ")}`);
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
return parsed.data;
|
|
25
|
-
}
|
|
26
|
-
export function renderJsonFrontmatter(frontmatter) {
|
|
27
|
-
return [
|
|
28
|
-
"---",
|
|
29
|
-
JSON.stringify(frontmatter, null, 2),
|
|
30
|
-
"---",
|
|
31
|
-
].join("\n");
|
|
32
|
-
}
|
|
33
|
-
function parseQuotedString(value) {
|
|
34
|
-
if (value.length < 2)
|
|
35
|
-
return null;
|
|
36
|
-
const quote = value[0];
|
|
37
|
-
if ((quote !== "\"" && quote !== "'") || value[value.length - 1] !== quote)
|
|
38
|
-
return null;
|
|
39
|
-
const inner = value.slice(1, -1);
|
|
40
|
-
if (quote === "\"") {
|
|
41
|
-
try {
|
|
42
|
-
return JSON.parse(value);
|
|
43
|
-
}
|
|
44
|
-
catch {
|
|
45
|
-
return null;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return inner.replace(/\\'/g, "'");
|
|
49
|
-
}
|
|
50
|
-
function parseYamlScalar(value) {
|
|
51
|
-
const trimmed = value.trim();
|
|
52
|
-
if (trimmed.length === 0)
|
|
53
|
-
return "";
|
|
54
|
-
const quoted = parseQuotedString(trimmed);
|
|
55
|
-
if (quoted !== null)
|
|
56
|
-
return quoted;
|
|
57
|
-
if (trimmed === "true")
|
|
58
|
-
return true;
|
|
59
|
-
if (trimmed === "false")
|
|
60
|
-
return false;
|
|
61
|
-
if (trimmed === "null")
|
|
62
|
-
return null;
|
|
63
|
-
if (/^-?\d+(?:\.\d+)?$/.test(trimmed))
|
|
64
|
-
return Number(trimmed);
|
|
65
|
-
if ((trimmed.startsWith("[") && trimmed.endsWith("]"))
|
|
66
|
-
|| (trimmed.startsWith("{") && trimmed.endsWith("}"))) {
|
|
67
|
-
try {
|
|
68
|
-
return JSON.parse(trimmed);
|
|
69
|
-
}
|
|
70
|
-
catch {
|
|
71
|
-
return trimmed;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
return trimmed;
|
|
75
|
-
}
|
|
76
|
-
function parseYamlFrontmatter(frontmatterText) {
|
|
77
|
-
const lines = frontmatterText.split("\n");
|
|
78
|
-
const frontmatter = {};
|
|
79
|
-
for (let index = 0; index < lines.length; index += 1) {
|
|
80
|
-
const line = lines[index] ?? "";
|
|
81
|
-
const trimmed = line.trim();
|
|
82
|
-
if (trimmed.length === 0 || trimmed.startsWith("#"))
|
|
83
|
-
continue;
|
|
84
|
-
const match = line.match(/^([A-Za-z0-9_-]+):(?:\s+(.*))?$/);
|
|
85
|
-
if (!match)
|
|
86
|
-
return null;
|
|
87
|
-
const [, key, inlineValue] = match;
|
|
88
|
-
if (!key)
|
|
89
|
-
return null;
|
|
90
|
-
if (inlineValue && inlineValue.trim().length > 0) {
|
|
91
|
-
frontmatter[key] = parseYamlScalar(inlineValue);
|
|
92
|
-
continue;
|
|
93
|
-
}
|
|
94
|
-
const items = [];
|
|
95
|
-
let cursor = index + 1;
|
|
96
|
-
while (cursor < lines.length) {
|
|
97
|
-
const nextLine = lines[cursor] ?? "";
|
|
98
|
-
const nextTrimmed = nextLine.trim();
|
|
99
|
-
if (nextTrimmed.length === 0) {
|
|
100
|
-
cursor += 1;
|
|
101
|
-
continue;
|
|
102
|
-
}
|
|
103
|
-
const itemMatch = nextLine.match(/^\s*-\s+(.*)$/);
|
|
104
|
-
if (!itemMatch || !/^\s+/.test(nextLine))
|
|
105
|
-
break;
|
|
106
|
-
items.push(parseYamlScalar(itemMatch[1] ?? ""));
|
|
107
|
-
cursor += 1;
|
|
108
|
-
}
|
|
109
|
-
if (items.length > 0) {
|
|
110
|
-
frontmatter[key] = items;
|
|
111
|
-
index = cursor - 1;
|
|
112
|
-
continue;
|
|
113
|
-
}
|
|
114
|
-
frontmatter[key] = "";
|
|
115
|
-
}
|
|
116
|
-
return Object.keys(frontmatter).length > 0 ? frontmatter : null;
|
|
117
|
-
}
|
|
118
|
-
export function parseJsonFrontmatter(content) {
|
|
119
|
-
const normalized = content.replace(/\r\n/g, "\n");
|
|
120
|
-
const match = normalized.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);
|
|
121
|
-
if (!match)
|
|
122
|
-
return null;
|
|
123
|
-
const [, frontmatterText, body = ""] = match;
|
|
124
|
-
if (frontmatterText === undefined)
|
|
125
|
-
return null;
|
|
126
|
-
try {
|
|
127
|
-
const frontmatter = JSON.parse(frontmatterText);
|
|
128
|
-
if (!frontmatter || typeof frontmatter !== "object" || Array.isArray(frontmatter)) {
|
|
129
|
-
return null;
|
|
130
|
-
}
|
|
131
|
-
return {
|
|
132
|
-
frontmatter: frontmatter,
|
|
133
|
-
body,
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
catch {
|
|
137
|
-
const frontmatter = parseYamlFrontmatter(frontmatterText);
|
|
138
|
-
if (!frontmatter)
|
|
139
|
-
return null;
|
|
140
|
-
return {
|
|
141
|
-
frontmatter,
|
|
142
|
-
body,
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
}
|
|
1
|
+
export * from "../packages/shared/parse.js";
|
|
@@ -1,11 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export declare const PROJECT_TESTS_DIR = "tests";
|
|
3
|
-
export declare function projectInterfRoot(projectPath: string): string;
|
|
4
|
-
export declare function compiledCompiledPathForDataset(projectPath: string, datasetName: string): string;
|
|
5
|
-
export declare function datasetTestsRoot(projectPath: string, datasetName: string): string;
|
|
6
|
-
export type DatasetTestTargetLabel = "file-as-is" | "compiled";
|
|
7
|
-
export declare function datasetTestRunsRoot(projectPath: string, datasetName: string, target: DatasetTestTargetLabel): string;
|
|
8
|
-
export declare function datasetLatestTestStatePath(projectPath: string, datasetName: string): string;
|
|
9
|
-
export declare function datasetLatestTestSummaryPath(projectPath: string, datasetName: string): string;
|
|
10
|
-
export declare function normalizeDatasetTestRunId(input: string): string;
|
|
11
|
-
export declare function datasetTestRunPath(projectPath: string, datasetName: string, target: DatasetTestTargetLabel, generatedAt: string, runId: string, runSuffix?: string | null): string;
|
|
1
|
+
export * from "../packages/project-model/project-paths.js";
|
|
@@ -1,32 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
export function projectInterfRoot(projectPath) {
|
|
5
|
-
return join(projectPath, PROJECT_INTERF_DIR);
|
|
6
|
-
}
|
|
7
|
-
export function compiledCompiledPathForDataset(projectPath, datasetName) {
|
|
8
|
-
return join(projectInterfRoot(projectPath), datasetName);
|
|
9
|
-
}
|
|
10
|
-
export function datasetTestsRoot(projectPath, datasetName) {
|
|
11
|
-
return join(projectInterfRoot(projectPath), PROJECT_TESTS_DIR, datasetName);
|
|
12
|
-
}
|
|
13
|
-
export function datasetTestRunsRoot(projectPath, datasetName, target) {
|
|
14
|
-
return join(datasetTestsRoot(projectPath, datasetName), target, "runs");
|
|
15
|
-
}
|
|
16
|
-
export function datasetLatestTestStatePath(projectPath, datasetName) {
|
|
17
|
-
return join(datasetTestsRoot(projectPath, datasetName), "latest.json");
|
|
18
|
-
}
|
|
19
|
-
export function datasetLatestTestSummaryPath(projectPath, datasetName) {
|
|
20
|
-
return join(datasetTestsRoot(projectPath, datasetName), "latest.md");
|
|
21
|
-
}
|
|
22
|
-
export function normalizeDatasetTestRunId(input) {
|
|
23
|
-
return input
|
|
24
|
-
.toLowerCase()
|
|
25
|
-
.trim()
|
|
26
|
-
.replace(/[^a-z0-9]+/g, "-")
|
|
27
|
-
.replace(/^-+|-+$/g, "")
|
|
28
|
-
.slice(0, 80);
|
|
29
|
-
}
|
|
30
|
-
export function datasetTestRunPath(projectPath, datasetName, target, generatedAt, runId, runSuffix) {
|
|
31
|
-
return join(datasetTestRunsRoot(projectPath, datasetName, target), `${generatedAt.replace(/[:.]/g, "-")}-${runId}${runSuffix ? `-${normalizeDatasetTestRunId(runSuffix)}` : ""}.json`);
|
|
32
|
-
}
|
|
1
|
+
// Compatibility shim for historical `src/lib/project-paths.ts` imports.
|
|
2
|
+
// Source of truth: `src/packages/project-model/project-paths.ts`.
|
|
3
|
+
export * from "../packages/project-model/project-paths.js";
|
|
@@ -1,9 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { type RuntimeStageAcceptanceValidation } from "./runtime-types.js";
|
|
3
|
-
export declare function stageRecordFromState(state: CompiledState | null, stageId: string): Record<string, unknown> | null;
|
|
4
|
-
export declare function validateResolvedStageAcceptance(dirPath: string, options: {
|
|
5
|
-
stageId: string;
|
|
6
|
-
acceptance?: RuntimeStageAcceptance;
|
|
7
|
-
counts?: Record<string, number>;
|
|
8
|
-
}): RuntimeStageAcceptanceValidation;
|
|
9
|
-
export declare function validateStageContractAcceptance(dirPath: string, contract?: RuntimeStageContract | null): RuntimeStageAcceptanceValidation;
|
|
1
|
+
export * from "../packages/compiler/runtime-acceptance.js";
|