@interf/compiler 0.22.2 → 0.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +175 -234
- package/dist/bin-mcp.d.ts +2 -0
- package/dist/bin-mcp.js +63 -0
- package/dist/bin-runtime.d.ts +2 -0
- package/dist/bin-runtime.js +111 -0
- package/dist/cli/commands/agents.js +4 -4
- package/dist/cli/commands/auth.d.ts +20 -0
- package/dist/cli/commands/auth.js +161 -0
- package/dist/cli/commands/benchmark.d.ts +10 -0
- package/dist/cli/commands/benchmark.js +88 -0
- package/dist/cli/commands/build-plan.js +95 -103
- package/dist/cli/commands/build.d.ts +1 -1
- package/dist/cli/commands/build.js +16 -15
- package/dist/cli/commands/doctor.js +3 -3
- package/dist/cli/commands/graphs.d.ts +2 -0
- package/dist/cli/commands/graphs.js +199 -0
- package/dist/cli/commands/login.js +4 -6
- package/dist/cli/commands/logout.js +1 -1
- package/dist/cli/commands/mcp.d.ts +3 -2
- package/dist/cli/commands/mcp.js +721 -204
- package/dist/cli/commands/project.d.ts +2 -0
- package/dist/cli/commands/project.js +202 -0
- package/dist/cli/commands/reset.d.ts +1 -1
- package/dist/cli/commands/reset.js +10 -10
- package/dist/cli/commands/runs.js +52 -26
- package/dist/cli/commands/runtime.d.ts +24 -0
- package/dist/cli/commands/runtime.js +373 -0
- package/dist/cli/commands/status.d.ts +1 -0
- package/dist/cli/commands/status.js +33 -22
- package/dist/cli/commands/traces.d.ts +2 -0
- package/dist/cli/commands/traces.js +125 -0
- package/dist/cli/commands/wizard.js +155 -150
- package/dist/cli/index.d.ts +7 -4
- package/dist/cli/index.js +13 -7
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/packages/build-plans/authoring/brief.d.ts +517 -0
- package/dist/packages/build-plans/authoring/brief.js +89 -0
- package/dist/packages/build-plans/authoring/build-plan-authoring.d.ts +10 -10
- package/dist/packages/build-plans/authoring/build-plan-authoring.js +66 -26
- package/dist/packages/build-plans/authoring/build-plan-edit-session.d.ts +1 -1
- package/dist/packages/build-plans/authoring/build-plan-edit-session.js +8 -2
- package/dist/packages/build-plans/authoring/build-plan-improvement.d.ts +9 -6
- package/dist/packages/build-plans/authoring/build-plan-improvement.js +39 -42
- package/dist/packages/build-plans/authoring/lib/build-plan-edit-utils.js +7 -7
- package/dist/packages/build-plans/build-plan-resolution.d.ts +1 -1
- package/dist/packages/build-plans/build-plan-resolution.js +3 -3
- package/dist/packages/build-plans/index.d.ts +1 -1
- package/dist/packages/build-plans/index.js +1 -1
- package/dist/packages/build-plans/package/build-plan-definitions.d.ts +14 -12
- package/dist/packages/build-plans/package/build-plan-definitions.js +40 -39
- package/dist/packages/build-plans/package/build-plan-helpers.d.ts +3 -2
- package/dist/packages/build-plans/package/build-plan-helpers.js +27 -13
- package/dist/packages/build-plans/package/build-plan-review-paths.d.ts +5 -5
- package/dist/packages/build-plans/package/build-plan-review-paths.js +15 -15
- package/dist/packages/build-plans/package/build-plan-stage-runner.d.ts +4 -4
- package/dist/packages/build-plans/package/build-plan-stage-runner.js +22 -11
- package/dist/packages/build-plans/package/builtin-build-plan.d.ts +5 -6
- package/dist/packages/build-plans/package/builtin-build-plan.js +7 -8
- package/dist/packages/build-plans/package/context-interface.d.ts +11 -9
- package/dist/packages/build-plans/package/context-interface.js +14 -33
- package/dist/packages/build-plans/package/interf-build-plan-package.d.ts +6 -17
- package/dist/packages/build-plans/package/interf-build-plan-package.js +56 -52
- package/dist/packages/build-plans/package/local-build-plans.d.ts +12 -10
- package/dist/packages/build-plans/package/local-build-plans.js +56 -31
- package/dist/packages/build-plans/package/user-build-plans.js +1 -1
- package/dist/packages/contracts/index.d.ts +4 -2
- package/dist/packages/contracts/index.js +2 -1
- package/dist/packages/contracts/lib/project-paths.d.ts +137 -0
- package/dist/packages/contracts/lib/project-paths.js +211 -0
- package/dist/packages/contracts/lib/project-schema.d.ts +160 -0
- package/dist/packages/contracts/lib/project-schema.js +113 -0
- package/dist/packages/contracts/lib/schema.d.ts +739 -80
- package/dist/packages/contracts/lib/schema.js +410 -75
- package/dist/packages/contracts/utils/parse.js +67 -0
- package/dist/packages/projects/index.d.ts +6 -0
- package/dist/packages/{project → projects}/index.js +0 -3
- package/dist/packages/{project → projects}/interf-detect.d.ts +12 -12
- package/dist/packages/{project → projects}/interf-detect.js +56 -50
- package/dist/packages/projects/interf.d.ts +2 -0
- package/dist/packages/projects/interf.js +1 -0
- package/dist/packages/projects/lib/schema.d.ts +79 -0
- package/dist/packages/projects/lib/schema.js +89 -0
- package/dist/packages/projects/source-config.d.ts +58 -0
- package/dist/packages/projects/source-config.js +352 -0
- package/dist/packages/projects/source-folders.d.ts +11 -0
- package/dist/packages/{project → projects}/source-folders.js +26 -26
- package/dist/packages/{engine → runtime}/action-planner.d.ts +1 -1
- package/dist/packages/{engine → runtime}/action-planner.js +20 -22
- package/dist/packages/runtime/action-values.d.ts +1 -0
- package/dist/packages/runtime/action-values.js +1 -0
- package/dist/packages/runtime/actions/errors.d.ts +2 -0
- package/dist/packages/runtime/actions/errors.js +12 -0
- package/dist/packages/runtime/actions/fields.d.ts +82 -0
- package/dist/packages/runtime/actions/form-builders.d.ts +14 -0
- package/dist/packages/runtime/actions/form-builders.js +619 -0
- package/dist/packages/runtime/actions/form-validators.d.ts +8 -0
- package/dist/packages/runtime/actions/form-validators.js +128 -0
- package/dist/packages/runtime/actions/helpers.d.ts +11 -0
- package/dist/packages/runtime/actions/helpers.js +80 -0
- package/dist/packages/runtime/actions/index.d.ts +8 -0
- package/dist/packages/runtime/actions/index.js +11 -0
- package/dist/packages/runtime/actions/registry.d.ts +64 -0
- package/dist/packages/runtime/actions/registry.js +62 -0
- package/dist/packages/runtime/actions/requests.d.ts +45 -0
- package/dist/packages/runtime/actions/requests.js +158 -0
- package/dist/packages/runtime/actions/schemas.d.ts +154 -0
- package/dist/packages/runtime/actions/schemas.js +36 -0
- package/dist/packages/runtime/agent-handoff.d.ts +11 -0
- package/dist/packages/runtime/agent-handoff.js +101 -0
- package/dist/packages/{engine → runtime}/agents/index.d.ts +1 -2
- package/dist/packages/{engine → runtime}/agents/index.js +1 -2
- package/dist/packages/runtime/agents/lib/args.d.ts +14 -0
- package/dist/packages/runtime/agents/lib/args.js +24 -0
- package/dist/packages/{engine → runtime}/agents/lib/constants.d.ts +4 -1
- package/dist/packages/runtime/agents/lib/constants.js +13 -0
- package/dist/packages/runtime/agents/lib/context-graph-bootstrap.d.ts +3 -0
- package/dist/packages/{engine/agents/lib/verifiable-context-bootstrap.js → runtime/agents/lib/context-graph-bootstrap.js} +5 -6
- package/dist/packages/{engine → runtime}/agents/lib/detection.d.ts +5 -0
- package/dist/packages/{engine → runtime}/agents/lib/detection.js +16 -7
- package/dist/packages/{engine → runtime}/agents/lib/execution-profile.js +8 -14
- package/dist/packages/{engine → runtime}/agents/lib/execution.js +14 -4
- package/dist/packages/{engine → runtime}/agents/lib/preflight.js +15 -13
- package/dist/packages/{engine → runtime}/agents/lib/render.js +4 -4
- package/dist/packages/runtime/agents/lib/shell-fs.d.ts +18 -0
- package/dist/packages/runtime/agents/lib/shell-fs.js +190 -0
- package/dist/packages/runtime/agents/lib/shell-paths.d.ts +16 -0
- package/dist/packages/runtime/agents/lib/shell-paths.js +63 -0
- package/dist/packages/runtime/agents/lib/shell-projection.d.ts +25 -0
- package/dist/packages/runtime/agents/lib/shell-projection.js +314 -0
- package/dist/packages/runtime/agents/lib/shell-templates.d.ts +30 -0
- package/dist/packages/runtime/agents/lib/shell-templates.js +452 -0
- package/dist/packages/runtime/agents/lib/shell-workspace.d.ts +17 -0
- package/dist/packages/runtime/agents/lib/shell-workspace.js +70 -0
- package/dist/packages/runtime/agents/lib/shells.d.ts +63 -0
- package/dist/packages/runtime/agents/lib/shells.js +383 -0
- package/dist/packages/{engine → runtime}/agents/lib/user-config.d.ts +8 -2
- package/dist/packages/{engine → runtime}/agents/lib/user-config.js +8 -2
- package/dist/packages/runtime/agents/providers/claude-code.d.ts +13 -0
- package/dist/packages/runtime/agents/providers/claude-code.js +45 -0
- package/dist/packages/runtime/agents/providers/codex.d.ts +17 -0
- package/dist/packages/runtime/agents/providers/codex.js +64 -0
- package/dist/packages/runtime/agents/providers/cursor.d.ts +9 -0
- package/dist/packages/runtime/agents/providers/cursor.js +24 -0
- package/dist/packages/runtime/agents/providers/index.d.ts +9 -0
- package/dist/packages/runtime/agents/providers/index.js +31 -0
- package/dist/packages/runtime/agents/providers/types.d.ts +50 -0
- package/dist/packages/{engine → runtime}/agents/registry.d.ts +13 -2
- package/dist/packages/{engine → runtime}/agents/registry.js +48 -10
- package/dist/packages/{engine → runtime}/agents/role-executors.d.ts +1 -1
- package/dist/packages/{engine → runtime}/agents/role-executors.js +7 -6
- package/dist/packages/{engine → runtime}/agents/role-router.js +7 -5
- package/dist/packages/runtime/auth/account-context.d.ts +52 -0
- package/dist/packages/runtime/auth/account-context.js +68 -0
- package/dist/packages/runtime/auth/auth-flow.d.ts +73 -0
- package/dist/packages/runtime/auth/auth-flow.js +189 -0
- package/dist/packages/runtime/auth/jwt-validator.d.ts +58 -0
- package/dist/packages/runtime/auth/jwt-validator.js +86 -0
- package/dist/packages/runtime/auth/keychain.d.ts +35 -0
- package/dist/packages/runtime/auth/keychain.js +85 -0
- package/dist/packages/runtime/auth/session-store.d.ts +38 -0
- package/dist/packages/runtime/auth/session-store.js +88 -0
- package/dist/packages/runtime/auth/workos-client.d.ts +58 -0
- package/dist/packages/runtime/auth/workos-client.js +87 -0
- package/dist/packages/runtime/benchmark-question-draft.d.ts +20 -0
- package/dist/packages/runtime/benchmark-question-draft.js +124 -0
- package/dist/packages/runtime/build/artifact-counts.d.ts +1 -0
- package/dist/packages/{engine → runtime}/build/artifact-counts.js +5 -9
- package/dist/packages/{engine → runtime}/build/artifact-status.d.ts +5 -5
- package/dist/packages/{engine → runtime}/build/artifact-status.js +25 -23
- package/dist/packages/runtime/build/atomic-fs.d.ts +3 -0
- package/dist/packages/runtime/build/atomic-fs.js +95 -0
- package/dist/packages/runtime/build/billing-events.d.ts +78 -0
- package/dist/packages/{engine → runtime}/build/billing-events.js +17 -19
- package/dist/packages/runtime/build/build-evidence.d.ts +15 -0
- package/dist/packages/runtime/build/build-evidence.js +173 -0
- package/dist/packages/{engine → runtime}/build/build-pipeline.d.ts +12 -8
- package/dist/packages/runtime/build/build-pipeline.js +304 -0
- package/dist/packages/{engine → runtime}/build/build-plan-primitives.d.ts +1 -1
- package/dist/packages/{engine → runtime}/build/build-plan-primitives.js +0 -1
- package/dist/packages/runtime/build/build-plan-runs.d.ts +14 -0
- package/dist/packages/runtime/build/build-plan-runs.js +31 -0
- package/dist/packages/runtime/build/build-stage-plan.d.ts +16 -0
- package/dist/packages/{engine → runtime}/build/build-stage-plan.js +28 -29
- package/dist/packages/{engine → runtime}/build/build-stage-runner.d.ts +2 -1
- package/dist/packages/runtime/build/build-stage-runner.js +165 -0
- package/dist/packages/{engine → runtime}/build/build-target.d.ts +4 -4
- package/dist/packages/runtime/build/build-target.js +16 -0
- package/dist/packages/{engine → runtime}/build/check-evaluator.d.ts +14 -16
- package/dist/packages/runtime/build/check-evaluator.js +575 -0
- package/dist/packages/runtime/build/context-graph-paths.d.ts +51 -0
- package/dist/packages/runtime/build/context-graph-paths.js +133 -0
- package/dist/packages/runtime/build/context-graph-schema.d.ts +19 -0
- package/dist/packages/runtime/build/context-graph-schema.js +39 -0
- package/dist/packages/{engine → runtime}/build/discovery.d.ts +2 -2
- package/dist/packages/{engine → runtime}/build/discovery.js +4 -4
- package/dist/packages/{engine → runtime}/build/index.d.ts +5 -3
- package/dist/packages/{engine → runtime}/build/index.js +5 -3
- package/dist/packages/{engine → runtime}/build/lib/schema.d.ts +221 -88
- package/dist/packages/{engine → runtime}/build/lib/schema.js +61 -41
- package/dist/packages/runtime/build/reset.d.ts +2 -0
- package/dist/packages/runtime/build/reset.js +62 -0
- package/dist/packages/{engine → runtime}/build/runtime-contracts.js +5 -5
- package/dist/packages/runtime/build/runtime-inventory.d.ts +7 -0
- package/dist/packages/{engine → runtime}/build/runtime-inventory.js +3 -3
- package/dist/packages/{engine → runtime}/build/runtime-paths.js +6 -6
- package/dist/packages/{engine → runtime}/build/runtime-prompt.js +7 -6
- package/dist/packages/{engine → runtime}/build/runtime-reconcile.d.ts +1 -1
- package/dist/packages/{engine → runtime}/build/runtime-reconcile.js +25 -21
- package/dist/packages/runtime/build/runtime-runs.d.ts +10 -0
- package/dist/packages/runtime/build/runtime-runs.js +265 -0
- package/dist/packages/{engine → runtime}/build/runtime-types.d.ts +6 -6
- package/dist/packages/runtime/build/runtime-types.js +1 -0
- package/dist/packages/runtime/build/runtime.d.ts +6 -0
- package/dist/packages/runtime/build/runtime.js +5 -0
- package/dist/packages/runtime/build/source-files.d.ts +58 -0
- package/dist/packages/runtime/build/source-files.js +184 -0
- package/dist/packages/runtime/build/source-inventory.d.ts +27 -0
- package/dist/packages/runtime/build/source-inventory.js +273 -0
- package/dist/packages/runtime/build/source-manifest.d.ts +52 -0
- package/dist/packages/runtime/build/source-manifest.js +192 -0
- package/dist/packages/runtime/build/stage-evidence.d.ts +22 -0
- package/dist/packages/runtime/build/stage-evidence.js +317 -0
- package/dist/packages/runtime/build/stage-reuse.d.ts +11 -0
- package/dist/packages/runtime/build/stage-reuse.js +142 -0
- package/dist/packages/runtime/build/state-artifacts.d.ts +9 -0
- package/dist/packages/runtime/build/state-artifacts.js +14 -0
- package/dist/packages/runtime/build/state-health.d.ts +4 -0
- package/dist/packages/{engine → runtime}/build/state-health.js +21 -26
- package/dist/packages/runtime/build/state-io.d.ts +12 -0
- package/dist/packages/runtime/build/state-io.js +119 -0
- package/dist/packages/{engine → runtime}/build/state-paths.d.ts +3 -1
- package/dist/packages/runtime/build/state-paths.js +22 -0
- package/dist/packages/runtime/build/state-view.d.ts +5 -0
- package/dist/packages/{engine → runtime}/build/state-view.js +60 -33
- package/dist/packages/runtime/build/state.d.ts +7 -0
- package/dist/packages/runtime/build/state.js +12 -0
- package/dist/packages/runtime/build/traces.d.ts +30 -0
- package/dist/packages/runtime/build/traces.js +133 -0
- package/dist/packages/{engine/build/validate-verifiable-context.d.ts → runtime/build/validate-context-graph.d.ts} +6 -6
- package/dist/packages/{engine/build/validate-verifiable-context.js → runtime/build/validate-context-graph.js} +48 -35
- package/dist/packages/{engine → runtime}/build/validate.d.ts +5 -5
- package/dist/packages/{engine → runtime}/build/validate.js +26 -26
- package/dist/packages/{engine → runtime}/client.d.ts +15 -15
- package/dist/packages/{engine → runtime}/client.js +41 -24
- package/dist/packages/{engine → runtime}/connection-config.d.ts +3 -2
- package/dist/packages/{engine → runtime}/connection-config.js +9 -8
- package/dist/packages/runtime/context-checks.d.ts +10 -0
- package/dist/packages/runtime/context-checks.js +114 -0
- package/dist/packages/runtime/context-graph-scaffold.d.ts +9 -0
- package/dist/packages/runtime/context-graph-scaffold.js +134 -0
- package/dist/packages/runtime/entitlement-guard.d.ts +43 -0
- package/dist/packages/runtime/entitlement-guard.js +70 -0
- package/dist/packages/{engine → runtime}/execution/index.d.ts +2 -2
- package/dist/packages/{engine → runtime}/execution/index.js +1 -1
- package/dist/packages/{engine → runtime}/execution/lib/schema.d.ts +270 -192
- package/dist/packages/{engine → runtime}/execution/lib/schema.js +35 -32
- package/dist/packages/runtime/index.d.ts +29 -0
- package/dist/packages/runtime/index.js +21 -0
- package/dist/packages/runtime/instance-paths.d.ts +30 -0
- package/dist/packages/runtime/instance-paths.js +29 -0
- package/dist/packages/{engine → runtime}/native-run-handlers.d.ts +4 -4
- package/dist/packages/{engine → runtime}/native-run-handlers.js +184 -152
- package/dist/packages/runtime/plan-artifact-contract.d.ts +17 -0
- package/dist/packages/runtime/plan-artifact-contract.js +42 -0
- package/dist/packages/runtime/project-entries.d.ts +11 -0
- package/dist/packages/runtime/project-entries.js +49 -0
- package/dist/packages/runtime/project-source-state.d.ts +26 -0
- package/dist/packages/runtime/project-source-state.js +53 -0
- package/dist/packages/runtime/project-store.d.ts +85 -0
- package/dist/packages/runtime/project-store.js +168 -0
- package/dist/packages/runtime/requested-artifacts.d.ts +7 -0
- package/dist/packages/{engine → runtime}/requested-artifacts.js +23 -1
- package/dist/packages/{engine → runtime}/run-observability.d.ts +2 -1
- package/dist/packages/{engine → runtime}/run-observability.js +166 -84
- package/dist/packages/runtime/runtime-action-proposals.d.ts +7 -0
- package/dist/packages/runtime/runtime-action-proposals.js +542 -0
- package/dist/packages/runtime/runtime-build-plans.d.ts +5 -0
- package/dist/packages/runtime/runtime-build-plans.js +131 -0
- package/dist/packages/runtime/runtime-build-runs.d.ts +47 -0
- package/dist/packages/runtime/runtime-build-runs.js +562 -0
- package/dist/packages/runtime/runtime-caches.d.ts +91 -0
- package/dist/packages/{engine → runtime}/runtime-caches.js +77 -49
- package/dist/packages/{engine → runtime}/runtime-event-applier.d.ts +3 -1
- package/dist/packages/{engine → runtime}/runtime-event-applier.js +53 -17
- package/dist/packages/runtime/runtime-executor.d.ts +22 -0
- package/dist/packages/runtime/runtime-executor.js +131 -0
- package/dist/packages/runtime/runtime-jobs.d.ts +13 -0
- package/dist/packages/runtime/runtime-jobs.js +463 -0
- package/dist/packages/runtime/runtime-observability.d.ts +11 -0
- package/dist/packages/runtime/runtime-observability.js +39 -0
- package/dist/packages/{engine → runtime}/runtime-persistence.d.ts +9 -18
- package/dist/packages/{engine → runtime}/runtime-persistence.js +25 -25
- package/dist/packages/runtime/runtime-project-mutations.d.ts +7 -0
- package/dist/packages/runtime/runtime-project-mutations.js +64 -0
- package/dist/packages/runtime/runtime-project-reads.d.ts +15 -0
- package/dist/packages/runtime/runtime-project-reads.js +381 -0
- package/dist/packages/runtime/runtime-proposal-helpers.d.ts +22 -0
- package/dist/packages/runtime/runtime-proposal-helpers.js +223 -0
- package/dist/packages/{engine → runtime}/runtime-resource-builders.d.ts +21 -16
- package/dist/packages/{engine → runtime}/runtime-resource-builders.js +48 -38
- package/dist/packages/runtime/runtime-verify-runs.d.ts +84 -0
- package/dist/packages/runtime/runtime-verify-runs.js +295 -0
- package/dist/packages/runtime/runtime.d.ts +1165 -0
- package/dist/packages/runtime/runtime.js +417 -0
- package/dist/packages/runtime/schemas/actions.d.ts +1182 -0
- package/dist/packages/runtime/schemas/actions.js +117 -0
- package/dist/packages/runtime/schemas/agents.d.ts +76 -0
- package/dist/packages/runtime/schemas/agents.js +41 -0
- package/dist/packages/runtime/schemas/build-plans.d.ts +959 -0
- package/dist/packages/runtime/schemas/build-plans.js +107 -0
- package/dist/packages/runtime/schemas/files.d.ts +567 -0
- package/dist/packages/runtime/schemas/files.js +51 -0
- package/dist/packages/runtime/schemas/index.d.ts +8 -0
- package/dist/packages/runtime/schemas/index.js +12 -0
- package/dist/packages/runtime/schemas/instance.d.ts +141 -0
- package/dist/packages/runtime/schemas/instance.js +143 -0
- package/dist/packages/runtime/schemas/jobs.d.ts +339 -0
- package/dist/packages/runtime/schemas/jobs.js +103 -0
- package/dist/packages/runtime/schemas/projects.d.ts +339 -0
- package/dist/packages/runtime/schemas/projects.js +136 -0
- package/dist/packages/runtime/schemas/runs.d.ts +2676 -0
- package/dist/packages/runtime/schemas/runs.js +98 -0
- package/dist/packages/runtime/service/index.d.ts +3 -0
- package/dist/packages/runtime/service/index.js +3 -0
- package/dist/packages/runtime/service/openapi.d.ts +7 -0
- package/dist/packages/runtime/service/openapi.js +117 -0
- package/dist/packages/runtime/service/operations.d.ts +1490 -0
- package/dist/packages/runtime/service/operations.js +245 -0
- package/dist/packages/runtime/service/routes.d.ts +106 -0
- package/dist/packages/runtime/service/routes.js +120 -0
- package/dist/packages/runtime/service/server-api-files.d.ts +10 -0
- package/dist/packages/runtime/service/server-api-files.js +85 -0
- package/dist/packages/runtime/service/server-app-boot.d.ts +4 -0
- package/dist/packages/runtime/service/server-app-boot.js +46 -0
- package/dist/packages/runtime/service/server-guards.d.ts +63 -0
- package/dist/packages/runtime/service/server-guards.js +181 -0
- package/dist/packages/runtime/service/server-helpers.d.ts +27 -0
- package/dist/packages/runtime/service/server-helpers.js +89 -0
- package/dist/packages/runtime/service/server-instance-helpers.d.ts +30 -0
- package/dist/packages/runtime/service/server-instance-helpers.js +114 -0
- package/dist/packages/runtime/service/server-routes-action-proposals.d.ts +3 -0
- package/dist/packages/runtime/service/server-routes-action-proposals.js +43 -0
- package/dist/packages/runtime/service/server-routes-agents.d.ts +4 -0
- package/dist/packages/runtime/service/server-routes-agents.js +198 -0
- package/dist/packages/runtime/service/server-routes-auth.d.ts +33 -0
- package/dist/packages/runtime/service/server-routes-auth.js +138 -0
- package/dist/packages/runtime/service/server-routes-build-plans.d.ts +3 -0
- package/dist/packages/runtime/service/server-routes-build-plans.js +83 -0
- package/dist/packages/runtime/service/server-routes-discovery.d.ts +4 -0
- package/dist/packages/runtime/service/server-routes-discovery.js +196 -0
- package/dist/packages/runtime/service/server-routes-events.d.ts +5 -0
- package/dist/packages/runtime/service/server-routes-events.js +99 -0
- package/dist/packages/runtime/service/server-routes-project-context.d.ts +9 -0
- package/dist/packages/runtime/service/server-routes-project-context.js +192 -0
- package/dist/packages/runtime/service/server-routes-project-jobs.d.ts +9 -0
- package/dist/packages/runtime/service/server-routes-project-jobs.js +130 -0
- package/dist/packages/runtime/service/server-routes-project-runs.d.ts +14 -0
- package/dist/packages/runtime/service/server-routes-project-runs.js +85 -0
- package/dist/packages/runtime/service/server-routes-projects.d.ts +4 -0
- package/dist/packages/runtime/service/server-routes-projects.js +92 -0
- package/dist/packages/runtime/service/server-routes-runs.d.ts +3 -0
- package/dist/packages/runtime/service/server-routes-runs.js +112 -0
- package/dist/packages/runtime/service/server.d.ts +37 -0
- package/dist/packages/runtime/service/server.js +300 -0
- package/dist/packages/{engine → runtime/service}/service-registry.d.ts +5 -5
- package/dist/packages/{engine → runtime/service}/service-registry.js +7 -7
- package/dist/packages/runtime/verify/benchmark-run.d.ts +81 -0
- package/dist/packages/runtime/verify/benchmark-run.js +303 -0
- package/dist/packages/{engine → runtime}/verify/index.d.ts +2 -2
- package/dist/packages/{engine → runtime}/verify/index.js +1 -1
- package/dist/packages/{engine → runtime}/verify/lib/schema.d.ts +83 -16
- package/dist/packages/{engine → runtime}/verify/lib/schema.js +26 -18
- package/dist/packages/{engine → runtime}/verify/verify-execution.js +11 -11
- package/dist/packages/{engine → runtime}/verify/verify-paths.d.ts +4 -4
- package/dist/packages/runtime/verify/verify-paths.js +61 -0
- package/dist/packages/{engine → runtime}/verify/verify-sandbox.d.ts +1 -1
- package/dist/packages/runtime/verify/verify-sandbox.js +88 -0
- package/dist/packages/{engine → runtime}/verify/verify-specs.d.ts +2 -0
- package/dist/packages/{engine → runtime}/verify/verify-specs.js +5 -3
- package/dist/packages/runtime/verify/verify-targets.d.ts +5 -0
- package/dist/packages/{engine → runtime}/verify/verify-targets.js +12 -12
- package/dist/packages/runtime/verify/verify-types.js +1 -0
- package/dist/packages/{engine → runtime}/verify/verify.d.ts +1 -1
- package/dist/packages/{engine → runtime}/verify/verify.js +1 -1
- package/dist/packages/runtime/wire-schemas.d.ts +18 -0
- package/dist/packages/runtime/wire-schemas.js +27 -0
- package/package.json +39 -31
- package/public-repo/CONTRIBUTING.md +7 -16
- package/public-repo/README.md +175 -234
- package/public-repo/SECURITY.md +3 -4
- package/public-repo/build-plans/interf-default/README.md +19 -14
- package/public-repo/build-plans/interf-default/build/stages/shape/SKILL.md +18 -11
- package/public-repo/build-plans/interf-default/build/stages/structure/SKILL.md +12 -5
- package/public-repo/build-plans/interf-default/build/stages/summarize/SKILL.md +16 -4
- package/public-repo/build-plans/interf-default/build-plan.json +34 -28
- package/public-repo/build-plans/interf-default/build-plan.schema.json +54 -32
- package/public-repo/build-plans/interf-default/improve/SKILL.md +3 -3
- package/public-repo/build-plans/interf-default/use/query/SKILL.md +17 -11
- package/public-repo/openapi/local-service.openapi.json +6803 -0
- package/public-repo/skills/interf/SKILL.md +460 -179
- package/dist/cli/commands/prep.d.ts +0 -2
- package/dist/cli/commands/prep.js +0 -240
- package/dist/cli/commands/test.d.ts +0 -10
- package/dist/cli/commands/test.js +0 -85
- package/dist/cli/commands/web.d.ts +0 -2
- package/dist/cli/commands/web.js +0 -286
- package/dist/interf-ui/404.html +0 -1
- package/dist/interf-ui/__next.__PAGE__.txt +0 -10
- package/dist/interf-ui/__next._full.txt +0 -20
- package/dist/interf-ui/__next._head.txt +0 -5
- package/dist/interf-ui/__next._index.txt +0 -5
- package/dist/interf-ui/__next._tree.txt +0 -5
- package/dist/interf-ui/_next/static/--reS3xBzM5zc6QxNjZd6/_buildManifest.js +0 -11
- package/dist/interf-ui/_next/static/--reS3xBzM5zc6QxNjZd6/_clientMiddlewareManifest.js +0 -1
- package/dist/interf-ui/_next/static/--reS3xBzM5zc6QxNjZd6/_ssgManifest.js +0 -1
- package/dist/interf-ui/_next/static/chunks/0.tjb6f4golw..css +0 -3
- package/dist/interf-ui/_next/static/chunks/03~yq9q893hmn.js +0 -1
- package/dist/interf-ui/_next/static/chunks/085-n_jv2ng_q.css +0 -1
- package/dist/interf-ui/_next/static/chunks/0dn41fa_zvgsl.js +0 -1
- package/dist/interf-ui/_next/static/chunks/0g-ea0zj5d-0k.js +0 -1
- package/dist/interf-ui/_next/static/chunks/0gwqglc4iz583.js +0 -1
- package/dist/interf-ui/_next/static/chunks/0haldgm65ve6l.js +0 -1
- package/dist/interf-ui/_next/static/chunks/0nv3am99vjzn4.js +0 -1
- package/dist/interf-ui/_next/static/chunks/0s77gt_o4jwtx.js +0 -1
- package/dist/interf-ui/_next/static/chunks/0y5z3t-z1c8ks.js.map +0 -5
- package/dist/interf-ui/_next/static/chunks/0~a36ujuzpaz..js +0 -116
- package/dist/interf-ui/_next/static/chunks/10jeodxe4nkgj.js +0 -31
- package/dist/interf-ui/_next/static/chunks/119h2rouych2t.js +0 -1
- package/dist/interf-ui/_next/static/chunks/13c8b~m8knjsf.js +0 -1
- package/dist/interf-ui/_next/static/chunks/14dznb2qpt-ho.js +0 -91
- package/dist/interf-ui/_next/static/chunks/15z_en80lrq-3.js +0 -5
- package/dist/interf-ui/_next/static/chunks/turbopack-0p.pvcjrtq-jh.js +0 -1
- package/dist/interf-ui/_next/static/chunks/turbopack-0usj_75.8frlw.js +0 -1
- package/dist/interf-ui/_next/static/chunks/turbopack-worker-0sjn--fhq~1cg.js +0 -1
- package/dist/interf-ui/_next/static/media/GeistMono_Variable.p.17jn9btb_52pq.woff2 +0 -0
- package/dist/interf-ui/_next/static/media/Geist_Variable-s.p.0-te~ja_gpvcf.woff2 +0 -0
- package/dist/interf-ui/_next/static/media/worker.102zas1s52_pf.js +0 -109
- package/dist/interf-ui/_not-found/__next._full.txt +0 -15
- package/dist/interf-ui/_not-found/__next._head.txt +0 -5
- package/dist/interf-ui/_not-found/__next._index.txt +0 -5
- package/dist/interf-ui/_not-found/__next._not-found.__PAGE__.txt +0 -5
- package/dist/interf-ui/_not-found/__next._not-found.txt +0 -5
- package/dist/interf-ui/_not-found/__next._tree.txt +0 -2
- package/dist/interf-ui/_not-found.html +0 -1
- package/dist/interf-ui/_not-found.txt +0 -15
- package/dist/interf-ui/index.html +0 -1
- package/dist/interf-ui/index.txt +0 -20
- package/dist/packages/contracts/lib/preparation-paths.d.ts +0 -117
- package/dist/packages/contracts/lib/preparation-paths.js +0 -177
- package/dist/packages/engine/action-definitions.d.ts +0 -407
- package/dist/packages/engine/action-definitions.js +0 -1158
- package/dist/packages/engine/action-values.d.ts +0 -1
- package/dist/packages/engine/action-values.js +0 -1
- package/dist/packages/engine/agents/lib/args.d.ts +0 -4
- package/dist/packages/engine/agents/lib/args.js +0 -52
- package/dist/packages/engine/agents/lib/chart-guidance.d.ts +0 -1
- package/dist/packages/engine/agents/lib/chart-guidance.js +0 -8
- package/dist/packages/engine/agents/lib/constants.js +0 -28
- package/dist/packages/engine/agents/lib/schema.d.ts +0 -8
- package/dist/packages/engine/agents/lib/schema.js +0 -7
- package/dist/packages/engine/agents/lib/shells.d.ts +0 -74
- package/dist/packages/engine/agents/lib/shells.js +0 -1052
- package/dist/packages/engine/agents/lib/verifiable-context-bootstrap.d.ts +0 -3
- package/dist/packages/engine/build/artifact-counts.d.ts +0 -1
- package/dist/packages/engine/build/billing-events.d.ts +0 -89
- package/dist/packages/engine/build/build-pipeline.js +0 -175
- package/dist/packages/engine/build/build-plan-runs.d.ts +0 -14
- package/dist/packages/engine/build/build-plan-runs.js +0 -31
- package/dist/packages/engine/build/build-stage-plan.d.ts +0 -16
- package/dist/packages/engine/build/build-stage-runner.js +0 -94
- package/dist/packages/engine/build/build-target.js +0 -16
- package/dist/packages/engine/build/check-evaluator.js +0 -298
- package/dist/packages/engine/build/reset.d.ts +0 -2
- package/dist/packages/engine/build/reset.js +0 -74
- package/dist/packages/engine/build/runtime-inventory.d.ts +0 -7
- package/dist/packages/engine/build/runtime-runs.d.ts +0 -10
- package/dist/packages/engine/build/runtime-runs.js +0 -224
- package/dist/packages/engine/build/runtime.d.ts +0 -5
- package/dist/packages/engine/build/runtime.js +0 -4
- package/dist/packages/engine/build/source-files.d.ts +0 -46
- package/dist/packages/engine/build/source-files.js +0 -149
- package/dist/packages/engine/build/state-artifacts.d.ts +0 -9
- package/dist/packages/engine/build/state-artifacts.js +0 -14
- package/dist/packages/engine/build/state-health.d.ts +0 -4
- package/dist/packages/engine/build/state-io.d.ts +0 -11
- package/dist/packages/engine/build/state-io.js +0 -82
- package/dist/packages/engine/build/state-paths.js +0 -16
- package/dist/packages/engine/build/state-view.d.ts +0 -5
- package/dist/packages/engine/build/state.d.ts +0 -7
- package/dist/packages/engine/build/state.js +0 -12
- package/dist/packages/engine/build/validate-helpers.d.ts +0 -12
- package/dist/packages/engine/build/validate-helpers.js +0 -41
- package/dist/packages/engine/build/verifiable-context-paths.d.ts +0 -47
- package/dist/packages/engine/build/verifiable-context-paths.js +0 -121
- package/dist/packages/engine/build/verifiable-context-schema.d.ts +0 -21
- package/dist/packages/engine/build/verifiable-context-schema.js +0 -126
- package/dist/packages/engine/cloud-seams.d.ts +0 -115
- package/dist/packages/engine/cloud-seams.js +0 -84
- package/dist/packages/engine/index.d.ts +0 -22
- package/dist/packages/engine/index.js +0 -15
- package/dist/packages/engine/instance-paths.d.ts +0 -106
- package/dist/packages/engine/instance-paths.js +0 -171
- package/dist/packages/engine/lib/schema.d.ts +0 -6304
- package/dist/packages/engine/lib/schema.js +0 -730
- package/dist/packages/engine/preparation-store.d.ts +0 -105
- package/dist/packages/engine/preparation-store.js +0 -213
- package/dist/packages/engine/readiness-check-draft.d.ts +0 -20
- package/dist/packages/engine/readiness-check-draft.js +0 -111
- package/dist/packages/engine/requested-artifacts.d.ts +0 -5
- package/dist/packages/engine/routes.d.ts +0 -85
- package/dist/packages/engine/routes.js +0 -99
- package/dist/packages/engine/runtime-caches.d.ts +0 -76
- package/dist/packages/engine/runtime-proposal-helpers.d.ts +0 -35
- package/dist/packages/engine/runtime-proposal-helpers.js +0 -247
- package/dist/packages/engine/runtime.d.ts +0 -371
- package/dist/packages/engine/runtime.js +0 -2463
- package/dist/packages/engine/server.d.ts +0 -58
- package/dist/packages/engine/server.js +0 -1399
- package/dist/packages/engine/verify/readiness-check-run.d.ts +0 -82
- package/dist/packages/engine/verify/readiness-check-run.js +0 -265
- package/dist/packages/engine/verify/verify-paths.js +0 -61
- package/dist/packages/engine/verify/verify-sandbox.js +0 -88
- package/dist/packages/engine/verify/verify-targets.d.ts +0 -5
- package/dist/packages/engine/wire-schemas.d.ts +0 -547
- package/dist/packages/engine/wire-schemas.js +0 -59
- package/dist/packages/project/index.d.ts +0 -9
- package/dist/packages/project/interf-bootstrap.d.ts +0 -1
- package/dist/packages/project/interf-bootstrap.js +0 -1
- package/dist/packages/project/interf-scaffold.d.ts +0 -3
- package/dist/packages/project/interf-scaffold.js +0 -136
- package/dist/packages/project/interf.d.ts +0 -4
- package/dist/packages/project/interf.js +0 -3
- package/dist/packages/project/lib/schema.d.ts +0 -328
- package/dist/packages/project/lib/schema.js +0 -136
- package/dist/packages/project/preparation-entries.d.ts +0 -11
- package/dist/packages/project/preparation-entries.js +0 -49
- package/dist/packages/project/source-config.d.ts +0 -46
- package/dist/packages/project/source-config.js +0 -394
- package/dist/packages/project/source-folders.d.ts +0 -11
- package/public-repo/plugins/README.md +0 -9
- package/public-repo/plugins/interf/.claude-plugin/plugin.json +0 -21
- package/public-repo/plugins/interf/.mcp.json +0 -12
- package/public-repo/plugins/interf/README.md +0 -32
- package/public-repo/plugins/interf/skills/interf/SKILL.md +0 -376
- /package/dist/packages/{engine/agents/lib/types.js → runtime/actions/fields.js} +0 -0
- /package/dist/packages/{engine → runtime}/agents/lib/agents.d.ts +0 -0
- /package/dist/packages/{engine → runtime}/agents/lib/agents.js +0 -0
- /package/dist/packages/{engine → runtime}/agents/lib/execution-profile.d.ts +0 -0
- /package/dist/packages/{engine → runtime}/agents/lib/execution.d.ts +0 -0
- /package/dist/packages/{engine → runtime}/agents/lib/executors.d.ts +0 -0
- /package/dist/packages/{engine → runtime}/agents/lib/executors.js +0 -0
- /package/dist/packages/{engine → runtime}/agents/lib/logs.d.ts +0 -0
- /package/dist/packages/{engine → runtime}/agents/lib/logs.js +0 -0
- /package/dist/packages/{engine → runtime}/agents/lib/preflight.d.ts +0 -0
- /package/dist/packages/{engine → runtime}/agents/lib/render.d.ts +0 -0
- /package/dist/packages/{engine → runtime}/agents/lib/status.d.ts +0 -0
- /package/dist/packages/{engine → runtime}/agents/lib/status.js +0 -0
- /package/dist/packages/{engine → runtime}/agents/lib/types.d.ts +0 -0
- /package/dist/packages/{engine/build/runtime-types.js → runtime/agents/lib/types.js} +0 -0
- /package/dist/packages/{engine/verify/verify-types.js → runtime/agents/providers/types.js} +0 -0
- /package/dist/packages/{engine → runtime}/agents/role-router.d.ts +0 -0
- /package/dist/packages/{engine → runtime}/build/build-execution.d.ts +0 -0
- /package/dist/packages/{engine → runtime}/build/build-execution.js +0 -0
- /package/dist/packages/{engine → runtime}/build/runtime-contracts.d.ts +0 -0
- /package/dist/packages/{engine → runtime}/build/runtime-paths.d.ts +0 -0
- /package/dist/packages/{engine → runtime}/build/runtime-prompt.d.ts +0 -0
- /package/dist/packages/{engine → runtime}/execution/adapters.d.ts +0 -0
- /package/dist/packages/{engine → runtime}/execution/adapters.js +0 -0
- /package/dist/packages/{engine → runtime}/execution/events.d.ts +0 -0
- /package/dist/packages/{engine → runtime}/execution/events.js +0 -0
- /package/dist/packages/{engine → runtime}/verify/verify-execution.d.ts +0 -0
- /package/dist/packages/{engine → runtime}/verify/verify-profile-presets.d.ts +0 -0
- /package/dist/packages/{engine → runtime}/verify/verify-profile-presets.js +0 -0
- /package/dist/packages/{engine → runtime}/verify/verify-types.d.ts +0 -0
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `interf
|
|
2
|
+
* `interf plan` — manage Build Plans on the connected instance.
|
|
3
3
|
*
|
|
4
|
-
* interf
|
|
5
|
-
* interf
|
|
6
|
-
* interf
|
|
7
|
-
* interf
|
|
8
|
-
* interf
|
|
9
|
-
* interf
|
|
4
|
+
* interf plan list # list Build Plans
|
|
5
|
+
* interf plan show <plan-id> # show a Build Plan summary
|
|
6
|
+
* interf plan select <project-id> <id> # select a Build Plan for a Project
|
|
7
|
+
* interf plan save <path-or-id> # save/promote a reusable Build Plan
|
|
8
|
+
* interf plan draft <project-id> # start a Build Plan draft run
|
|
9
|
+
* interf plan improve <project-id> # start a Build Plan improvement run
|
|
10
|
+
*
|
|
11
|
+
* The command name stays short for CLI ergonomics; user-facing copy says
|
|
12
|
+
* Build Plan.
|
|
10
13
|
*/
|
|
11
14
|
import chalk from "chalk";
|
|
12
15
|
import { resolve } from "node:path";
|
|
13
|
-
import { CONNECT_OR_ERROR_HINT, readActiveConnection } from "../../packages/
|
|
14
|
-
import { buildPlanResourcePath,
|
|
15
|
-
import { BuildPlanAuthoringArtifactRequirementSchema, } from "../../packages/
|
|
16
|
-
import { artifactRequirementsFromRequestedArtifacts, formatRequestedArtifactsForPrompt, } from "../../packages/
|
|
16
|
+
import { CONNECT_OR_ERROR_HINT, readActiveConnection } from "../../packages/runtime/connection-config.js";
|
|
17
|
+
import { buildPlanResourcePath, projectResourcePath, projectSubresourcePath, } from "../../packages/runtime/service/routes.js";
|
|
18
|
+
import { BuildPlanAuthoringArtifactRequirementSchema, BuildPlanContextCheckDraftSchema, RequestedArtifactSchema, SourceContextSchema, } from "../../packages/runtime/schemas/index.js";
|
|
19
|
+
import { artifactRequirementsFromRequestedArtifacts, formatRequestedArtifactsForPrompt, requestedArtifactsFromPlanArtifacts, } from "../../packages/runtime/requested-artifacts.js";
|
|
17
20
|
import { slugify } from "../../packages/contracts/utils/naming.js";
|
|
18
21
|
function resolveConnection(args) {
|
|
19
22
|
const conn = readActiveConnection({
|
|
@@ -45,10 +48,9 @@ async function callJson(url, token, init = {}) {
|
|
|
45
48
|
}
|
|
46
49
|
return { status: response.status, body, raw };
|
|
47
50
|
}
|
|
48
|
-
function asArray(value) {
|
|
49
|
-
return Array.isArray(value) ? value : [];
|
|
50
|
-
}
|
|
51
51
|
const BuildPlanAuthoringArtifactRequirementsCliSchema = BuildPlanAuthoringArtifactRequirementSchema.array();
|
|
52
|
+
const BuildPlanChecksCliSchema = BuildPlanContextCheckDraftSchema.array();
|
|
53
|
+
const RequestedArtifactsCliSchema = RequestedArtifactSchema.array();
|
|
52
54
|
function parseJsonOption(label, value, parse) {
|
|
53
55
|
if (!value)
|
|
54
56
|
return undefined;
|
|
@@ -70,16 +72,16 @@ function parseJsonOption(label, value, parse) {
|
|
|
70
72
|
process.exit(1);
|
|
71
73
|
}
|
|
72
74
|
}
|
|
73
|
-
function
|
|
74
|
-
return `${url}/?section=
|
|
75
|
+
function buildProjectReviewUrl(url, projectId) {
|
|
76
|
+
return `${url}/?section=projects&project=${encodeURIComponent(projectId)}&projectTab=build-plan`;
|
|
75
77
|
}
|
|
76
|
-
function buildRunUrl(url,
|
|
78
|
+
function buildRunUrl(url, projectId, runId) {
|
|
77
79
|
if (!runId)
|
|
78
80
|
return null;
|
|
79
|
-
return `${url}/?section=
|
|
81
|
+
return `${url}/?section=projects&project=${encodeURIComponent(projectId)}&projectTab=runs&run=${encodeURIComponent(runId)}`;
|
|
80
82
|
}
|
|
81
|
-
function
|
|
82
|
-
return slugify(`${
|
|
83
|
+
function defaultBuildPlanIdForProject(projectId) {
|
|
84
|
+
return slugify(`${projectId}-build-plan`) || "build-plan";
|
|
83
85
|
}
|
|
84
86
|
function labelFromBuildPlanId(buildPlanId) {
|
|
85
87
|
const label = buildPlanId
|
|
@@ -132,121 +134,104 @@ function renderBuildPlanSummary(buildPlan) {
|
|
|
132
134
|
console.log(chalk.dim(` writes: ${writes}`));
|
|
133
135
|
}
|
|
134
136
|
}
|
|
135
|
-
if (buildPlan.
|
|
137
|
+
if (buildPlan.active_for_projects?.length) {
|
|
136
138
|
console.log();
|
|
137
|
-
console.log(chalk.dim(` used by: ${buildPlan.
|
|
139
|
+
console.log(chalk.dim(` used by: ${buildPlan.active_for_projects.join(", ")}`));
|
|
138
140
|
}
|
|
139
141
|
console.log();
|
|
140
142
|
console.log(chalk.dim(" Run with --json for the raw Build Plan record."));
|
|
141
143
|
console.log();
|
|
142
144
|
}
|
|
143
|
-
function
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
return
|
|
150
|
-
? preparation.requested_artifacts
|
|
151
|
-
: preparation.preparation?.requested_artifacts ?? [];
|
|
152
|
-
}
|
|
153
|
-
function preparationSourceProfile(preparation) {
|
|
154
|
-
return preparation.source_profile ?? preparation.preparation?.source_profile ?? null;
|
|
145
|
+
async function selectedBuildPlanRequestedArtifacts(url, token, buildPlanId) {
|
|
146
|
+
if (!buildPlanId)
|
|
147
|
+
return [];
|
|
148
|
+
const fetched = await callJson(`${url}${buildPlanResourcePath(buildPlanId)}`, token);
|
|
149
|
+
if (fetched.status !== 200 || !fetched.body)
|
|
150
|
+
return [];
|
|
151
|
+
return requestedArtifactsFromPlanArtifacts(fetched.body.artifacts ?? []);
|
|
155
152
|
}
|
|
156
|
-
function selectedBuildPlanId(
|
|
157
|
-
return
|
|
153
|
+
function selectedBuildPlanId(project) {
|
|
154
|
+
return project.build_plan_id;
|
|
158
155
|
}
|
|
159
|
-
function
|
|
160
|
-
|
|
161
|
-
return preparation.source.locator;
|
|
162
|
-
if (sourceFiles?.source_files?.[0]?.source_folder_path)
|
|
163
|
-
return sourceFiles.source_files[0].source_folder_path;
|
|
164
|
-
return preparation.source_path ?? null;
|
|
165
|
-
}
|
|
166
|
-
function buildTaskPrompt(args, preparation, prepId, mode) {
|
|
167
|
-
const about = (preparation.about ?? preparation.preparation?.about)?.trim();
|
|
168
|
-
const requestedArtifacts = formatRequestedArtifactsForPrompt(preparationRequestedArtifacts(preparation));
|
|
156
|
+
function buildTaskPrompt(args, requestedArtifacts, projectId, mode) {
|
|
157
|
+
const requestedArtifactsText = formatRequestedArtifactsForPrompt(requestedArtifacts);
|
|
169
158
|
const sections = [
|
|
170
|
-
`${mode === "improve" ? "Improve" : "Draft"} a Build Plan for
|
|
171
|
-
args.
|
|
172
|
-
|
|
173
|
-
requestedArtifacts ? `Requested Artifacts saved on the Preparation:\n${requestedArtifacts}` : null,
|
|
159
|
+
`${mode === "improve" ? "Improve" : "Draft"} a Build Plan for Project "${projectId}".`,
|
|
160
|
+
args.intent?.trim() ? `Intent:\n${args.intent.trim()}` : null,
|
|
161
|
+
requestedArtifactsText ? `Requested Artifacts:\n${requestedArtifactsText}` : null,
|
|
174
162
|
args.artifacts?.trim() ? `Additional Artifact notes:\n${args.artifacts.trim()}` : null,
|
|
175
|
-
args.readyWhen?.trim() ? `
|
|
176
|
-
"Return a Build Plan definition that declares
|
|
163
|
+
args.readyWhen?.trim() ? `Context Check:\n${args.readyWhen.trim()}` : null,
|
|
164
|
+
"Return a Build Plan definition that declares Context Checks, the requested Artifacts backing them, the stages that build those Artifacts, and Artifact diagnostics for internal validation.",
|
|
177
165
|
].filter((section) => Boolean(section));
|
|
178
166
|
return sections.join("\n\n");
|
|
179
167
|
}
|
|
180
|
-
async function
|
|
181
|
-
const fetched = await callJson(`${url}${
|
|
168
|
+
async function readProjectContext(url, token, projectId) {
|
|
169
|
+
const fetched = await callJson(`${url}${projectResourcePath(projectId)}`, token);
|
|
182
170
|
if (fetched.status !== 200 || !fetched.body) {
|
|
183
|
-
console.error(chalk.red(`Failed to read
|
|
171
|
+
console.error(chalk.red(`Failed to read Project ${projectId} (HTTP ${fetched.status}).`));
|
|
184
172
|
if (fetched.raw)
|
|
185
173
|
console.error(fetched.raw);
|
|
186
174
|
process.exit(1);
|
|
187
175
|
}
|
|
188
|
-
let sourceFiles = null;
|
|
189
|
-
const sourcePath = sourceFolderPathFromPreparation(fetched.body, sourceFiles);
|
|
190
|
-
if (!sourcePath) {
|
|
191
|
-
const listed = await callJson(`${url}${preparationSubresourcePath(prepId, "sourceFiles")}`, token);
|
|
192
|
-
if (listed.status === 200)
|
|
193
|
-
sourceFiles = listed.body;
|
|
194
|
-
}
|
|
195
|
-
const sourceFolderPath = sourceFolderPathFromPreparation(fetched.body, sourceFiles);
|
|
196
|
-
if (!sourceFolderPath) {
|
|
197
|
-
console.error(chalk.red(`Preparation ${prepId} has no readable local Source binding.`));
|
|
198
|
-
process.exit(1);
|
|
199
|
-
}
|
|
200
176
|
return {
|
|
201
|
-
|
|
202
|
-
sourceFolderPath,
|
|
203
|
-
checks: preparationChecks(fetched.body),
|
|
177
|
+
project: fetched.body,
|
|
204
178
|
};
|
|
205
179
|
}
|
|
206
180
|
async function startBuildPlanRun(args, mode) {
|
|
207
181
|
const { url, token } = resolveConnection(args);
|
|
208
|
-
const {
|
|
209
|
-
const existingBuildPlan = selectedBuildPlanId(
|
|
210
|
-
const buildPlanId = args.buildPlan ?? (mode === "improve" ? existingBuildPlan :
|
|
211
|
-
const
|
|
182
|
+
const { project } = await readProjectContext(url, token, args.projectId);
|
|
183
|
+
const existingBuildPlan = selectedBuildPlanId(project);
|
|
184
|
+
const buildPlanId = args.buildPlan ?? (mode === "improve" ? existingBuildPlan : defaultBuildPlanIdForProject(args.projectId));
|
|
185
|
+
const explicitRequestedArtifacts = parseJsonOption("--requested-artifacts-json", args.requestedArtifactsJson, (input) => RequestedArtifactsCliSchema.parse(input));
|
|
186
|
+
const requestedArtifacts = explicitRequestedArtifacts
|
|
187
|
+
?? await selectedBuildPlanRequestedArtifacts(url, token, existingBuildPlan);
|
|
212
188
|
const explicitArtifactRequirements = parseJsonOption("--artifact-requirements-json", args.artifactRequirementsJson, (input) => BuildPlanAuthoringArtifactRequirementsCliSchema.parse(input));
|
|
213
189
|
const artifactRequirements = explicitArtifactRequirements
|
|
214
190
|
?? artifactRequirementsFromRequestedArtifacts(requestedArtifacts);
|
|
191
|
+
const explicitChecks = parseJsonOption("--checks-json", args.checksJson, (input) => BuildPlanChecksCliSchema.parse(input));
|
|
192
|
+
const sourceContext = parseJsonOption("--source-context-json", args.sourceContextJson, (input) => SourceContextSchema.parse(input));
|
|
193
|
+
const buildPlanChecks = explicitChecks
|
|
194
|
+
?? (args.readyWhen?.trim()
|
|
195
|
+
? [{
|
|
196
|
+
label: args.readyWhen.trim(),
|
|
197
|
+
backed_by_artifact_ids: artifactRequirements.map((artifact) => artifact.id),
|
|
198
|
+
required: true,
|
|
199
|
+
}]
|
|
200
|
+
: []);
|
|
215
201
|
if (!buildPlanId) {
|
|
216
|
-
console.error(chalk.red(`
|
|
217
|
-
console.error(chalk.dim(`Draft
|
|
202
|
+
console.error(chalk.red(`Project ${args.projectId} has no selected Build Plan to improve.`));
|
|
203
|
+
console.error(chalk.dim(`Draft a Build Plan first: interf plan draft ${args.projectId} --intent "..."`));
|
|
218
204
|
process.exit(1);
|
|
219
205
|
}
|
|
220
206
|
const body = {
|
|
221
|
-
|
|
222
|
-
source_folder_path: sourceFolderPath,
|
|
207
|
+
project: args.projectId,
|
|
223
208
|
...(args.baseBuildPlan ? { base_build_plan_id: args.baseBuildPlan } : {}),
|
|
224
209
|
...(args.referenceBuildPlan ? { reference_build_plan_id: args.referenceBuildPlan } : {}),
|
|
225
210
|
...(mode === "improve" && !args.referenceBuildPlan && existingBuildPlan ? { reference_build_plan_id: existingBuildPlan } : {}),
|
|
226
211
|
build_plan_id: buildPlanId,
|
|
227
212
|
label: args.label ?? labelFromBuildPlanId(buildPlanId),
|
|
228
|
-
hint: args.hint ?? `Build Plan for
|
|
229
|
-
|
|
230
|
-
checks,
|
|
213
|
+
hint: args.hint ?? `Build Plan for Project ${args.projectId}.`,
|
|
214
|
+
intent: buildTaskPrompt(args, requestedArtifacts, args.projectId, mode),
|
|
215
|
+
checks: buildPlanChecks,
|
|
231
216
|
requested_artifacts: requestedArtifacts,
|
|
232
|
-
source_profile: preparationSourceProfile(preparation),
|
|
233
217
|
artifact_requirements: artifactRequirements,
|
|
218
|
+
...(sourceContext !== undefined ? { source_context: sourceContext } : {}),
|
|
234
219
|
};
|
|
235
220
|
const endpoint = mode === "improve" ? "buildPlanImprovementRuns" : "buildPlanDraftRuns";
|
|
236
|
-
const { status, body: run, raw } = await callJson(`${url}${
|
|
221
|
+
const { status, body: run, raw } = await callJson(`${url}${projectSubresourcePath(args.projectId, endpoint)}`, token, { method: "POST", body: JSON.stringify(body) });
|
|
237
222
|
if (status !== 202 && status !== 201 && status !== 200) {
|
|
238
223
|
console.error(chalk.red(`Failed to start Build Plan ${mode} run (HTTP ${status}).`));
|
|
239
224
|
if (raw)
|
|
240
225
|
console.error(raw);
|
|
241
226
|
process.exit(1);
|
|
242
227
|
}
|
|
243
|
-
const runUrl = buildRunUrl(url, args.
|
|
244
|
-
const reviewUrl =
|
|
228
|
+
const runUrl = buildRunUrl(url, args.projectId, run?.run_id);
|
|
229
|
+
const reviewUrl = buildProjectReviewUrl(url, args.projectId);
|
|
245
230
|
if (args.json) {
|
|
246
231
|
console.log(JSON.stringify({
|
|
247
232
|
run_id: run?.run_id ?? null,
|
|
248
233
|
status: run?.status ?? null,
|
|
249
|
-
|
|
234
|
+
project: args.projectId,
|
|
250
235
|
build_plan_id: buildPlanId,
|
|
251
236
|
run_url: runUrl,
|
|
252
237
|
review_url: reviewUrl,
|
|
@@ -260,8 +245,9 @@ async function startBuildPlanRun(args, mode) {
|
|
|
260
245
|
console.log(chalk.dim(` review after it finishes: ${reviewUrl}`));
|
|
261
246
|
}
|
|
262
247
|
export const buildPlanCommand = {
|
|
263
|
-
command: "
|
|
248
|
+
command: "plan <subcommand>",
|
|
264
249
|
describe: "Manage Build Plans on the connected instance",
|
|
250
|
+
aliases: [],
|
|
265
251
|
builder: (yargs) => yargs
|
|
266
252
|
.option("url", { type: "string", describe: "Override the active connection URL" })
|
|
267
253
|
.option("token", { type: "string", describe: "Override the active bearer token" })
|
|
@@ -285,8 +271,8 @@ export const buildPlanCommand = {
|
|
|
285
271
|
const label = buildPlan.label ? ` ${chalk.dim(buildPlan.label)}` : "";
|
|
286
272
|
const kind = buildPlan.source_kind ? chalk.dim(`[${buildPlan.source_kind}]`) : "";
|
|
287
273
|
console.log(` ${chalk.bold(id)} ${kind}${label}`);
|
|
288
|
-
if (buildPlan.
|
|
289
|
-
console.log(chalk.dim(` used by: ${buildPlan.
|
|
274
|
+
if (buildPlan.active_for_projects?.length) {
|
|
275
|
+
console.log(chalk.dim(` used by: ${buildPlan.active_for_projects.join(", ")}`));
|
|
290
276
|
}
|
|
291
277
|
}
|
|
292
278
|
console.log();
|
|
@@ -327,42 +313,48 @@ export const buildPlanCommand = {
|
|
|
327
313
|
}
|
|
328
314
|
renderBuildPlanSummary(body);
|
|
329
315
|
})
|
|
330
|
-
.command("select <
|
|
331
|
-
.positional("
|
|
316
|
+
.command("select <project-id> <build-plan-id>", "Select a Build Plan for a Project", (y) => y
|
|
317
|
+
.positional("project-id", { type: "string", demandOption: true, describe: "Project id" })
|
|
332
318
|
.positional("build-plan-id", { type: "string", demandOption: true, describe: "Build Plan id" }), async (args) => {
|
|
333
319
|
const { url, token } = resolveConnection(args);
|
|
334
|
-
const { status, raw } = await callJson(`${url}${
|
|
320
|
+
const { status, raw } = await callJson(`${url}${projectResourcePath(args.projectId)}`, token, { method: "PATCH", body: JSON.stringify({ build_plan_id: args.buildPlanId }) });
|
|
335
321
|
if (status !== 200) {
|
|
336
322
|
console.error(chalk.red(`Failed to select Build Plan (HTTP ${status}).`));
|
|
337
323
|
if (raw)
|
|
338
324
|
console.error(raw);
|
|
339
325
|
process.exit(1);
|
|
340
326
|
}
|
|
341
|
-
console.log(chalk.green(`Selected Build Plan ${chalk.bold(args.buildPlanId)} for ${chalk.bold(args.
|
|
327
|
+
console.log(chalk.green(`Selected Build Plan ${chalk.bold(args.buildPlanId)} for ${chalk.bold(args.projectId)}.`));
|
|
342
328
|
})
|
|
343
|
-
.command("draft <
|
|
344
|
-
.positional("
|
|
345
|
-
.option("
|
|
329
|
+
.command("draft <project-id>", "Start a Build Plan draft run for a Project", (y) => y
|
|
330
|
+
.positional("project-id", { type: "string", demandOption: true, describe: "Project id" })
|
|
331
|
+
.option("intent", { type: "string", demandOption: true, describe: "Agent task this Build Plan should support" })
|
|
346
332
|
.option("artifacts", { type: "string", describe: "Requested Artifacts and why the agent needs them" })
|
|
333
|
+
.option("requested-artifacts-json", { type: "string", describe: "JSON array of structured requested Artifacts for Build Plan authoring" })
|
|
334
|
+
.option("checks-json", { type: "string", describe: "JSON array of Context Checks for Build Plan authoring" })
|
|
347
335
|
.option("artifact-requirements-json", { type: "string", describe: "JSON array of exact Artifact output requirements for the Build Plan" })
|
|
348
|
-
.option("
|
|
336
|
+
.option("source-context-json", { type: "string", describe: "JSON object with advisory Source context for Build Plan authoring" })
|
|
337
|
+
.option("ready-when", { type: "string", describe: "Plain-English Context Check the requested Artifacts should satisfy" })
|
|
349
338
|
.option("build-plan", { type: "string", describe: "Build Plan id to write" })
|
|
350
339
|
.option("label", { type: "string", describe: "Human-readable Build Plan label" })
|
|
351
|
-
.option("hint", { type: "string", describe: "Short Build Plan
|
|
340
|
+
.option("hint", { type: "string", describe: "Short Build Plan summary for review" })
|
|
352
341
|
.option("base-build-plan", { type: "string", describe: "Existing Build Plan id to use as a starting point" })
|
|
353
342
|
.option("reference-build-plan", { type: "string", describe: "Existing Build Plan id to reference while drafting" })
|
|
354
343
|
.option("json", { type: "boolean", default: false, describe: "Print machine-readable run metadata" }), async (args) => {
|
|
355
344
|
await startBuildPlanRun(args, "draft");
|
|
356
345
|
})
|
|
357
|
-
.command("improve <
|
|
358
|
-
.positional("
|
|
359
|
-
.option("
|
|
346
|
+
.command("improve <project-id>", "Start a Build Plan improvement run for a Project", (y) => y
|
|
347
|
+
.positional("project-id", { type: "string", demandOption: true, describe: "Project id" })
|
|
348
|
+
.option("intent", { type: "string", describe: "Change request for the selected Build Plan" })
|
|
360
349
|
.option("artifacts", { type: "string", describe: "Requested Artifact changes and why they matter" })
|
|
350
|
+
.option("requested-artifacts-json", { type: "string", describe: "JSON array of structured requested Artifacts for Build Plan authoring" })
|
|
351
|
+
.option("checks-json", { type: "string", describe: "JSON array of Context Checks for Build Plan authoring" })
|
|
361
352
|
.option("artifact-requirements-json", { type: "string", describe: "JSON array of exact Artifact output requirements for the Build Plan" })
|
|
362
|
-
.option("
|
|
353
|
+
.option("source-context-json", { type: "string", describe: "JSON object with advisory Source context for Build Plan authoring" })
|
|
354
|
+
.option("ready-when", { type: "string", describe: "Plain-English Context Check to add or change" })
|
|
363
355
|
.option("build-plan", { type: "string", describe: "Build Plan id to update" })
|
|
364
356
|
.option("label", { type: "string", describe: "Human-readable Build Plan label" })
|
|
365
|
-
.option("hint", { type: "string", describe: "Short Build Plan
|
|
357
|
+
.option("hint", { type: "string", describe: "Short Build Plan summary for review" })
|
|
366
358
|
.option("base-build-plan", { type: "string", describe: "Existing Build Plan id to use as a starting point" })
|
|
367
359
|
.option("reference-build-plan", { type: "string", describe: "Existing Build Plan id to reference while improving" })
|
|
368
360
|
.option("json", { type: "boolean", default: false, describe: "Print machine-readable run metadata" }), async (args) => {
|
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
* interf build bristol --quiet # only the locator on stdout (scripting)
|
|
6
6
|
* interf build bristol --watch # stream events
|
|
7
7
|
*
|
|
8
|
-
* Requires an active connection. Hits POST /v1/
|
|
8
|
+
* Requires an active connection. Hits POST /v1/projects/<id>/build-runs.
|
|
9
9
|
*/
|
|
10
10
|
import chalk from "chalk";
|
|
11
|
-
import { CONNECT_OR_ERROR_HINT, readActiveConnection } from "../../packages/
|
|
11
|
+
import { CONNECT_OR_ERROR_HINT, readActiveConnection } from "../../packages/runtime/connection-config.js";
|
|
12
|
+
import { projectSubresourcePath } from "../../packages/runtime/service/routes.js";
|
|
12
13
|
function resolveConnection(args) {
|
|
13
14
|
const conn = readActiveConnection({
|
|
14
15
|
urlOverride: args.url,
|
|
@@ -40,19 +41,19 @@ async function callJson(url, token, init = {}) {
|
|
|
40
41
|
return { status: response.status, body, raw };
|
|
41
42
|
}
|
|
42
43
|
export const buildCommand = {
|
|
43
|
-
command: "build <
|
|
44
|
-
describe: "
|
|
44
|
+
command: "build <project-id>",
|
|
45
|
+
describe: "Build Context Graph for a Project",
|
|
45
46
|
builder: (yargs) => yargs
|
|
46
|
-
.positional("
|
|
47
|
-
.option("watch", { type: "boolean", default: false, describe: "Stream
|
|
48
|
-
.option("quiet", { type: "boolean", default: false, describe: "Print only the
|
|
47
|
+
.positional("project-id", { type: "string", demandOption: true, describe: "Project id" })
|
|
48
|
+
.option("watch", { type: "boolean", default: false, describe: "Stream Run events" })
|
|
49
|
+
.option("quiet", { type: "boolean", default: false, describe: "Print only the Context Graph locator on success" })
|
|
49
50
|
.option("idempotency-key", { type: "string", describe: "Client-supplied dedupe key" })
|
|
50
51
|
.option("url", { type: "string", describe: "Override the active connection URL" })
|
|
51
52
|
.option("token", { type: "string", describe: "Override the active bearer token" }),
|
|
52
53
|
handler: async (args) => {
|
|
53
54
|
const { url, token } = resolveConnection(args);
|
|
54
|
-
//
|
|
55
|
-
//
|
|
55
|
+
// hard-error: refuse to start a Build if the local service has zero
|
|
56
|
+
// execution agents — the build pipeline can't run without one.
|
|
56
57
|
const instance = await callJson(`${url}/v1/instance`, token);
|
|
57
58
|
if (instance.body && instance.body.agent_count === 0) {
|
|
58
59
|
console.error(chalk.red(" Cannot build — no agents available."));
|
|
@@ -63,26 +64,26 @@ export const buildCommand = {
|
|
|
63
64
|
const headers = {};
|
|
64
65
|
if (args.idempotencyKey)
|
|
65
66
|
headers["x-interf-idempotency-key"] = args.idempotencyKey;
|
|
66
|
-
const { status, body, raw } = await callJson(`${url}
|
|
67
|
+
const { status, body, raw } = await callJson(`${url}${projectSubresourcePath(args.projectId, "buildRuns")}`, token, { method: "POST", headers, body: JSON.stringify({}) });
|
|
67
68
|
if (status !== 201 && status !== 200 && status !== 202) {
|
|
68
|
-
console.error(chalk.red(`Failed to
|
|
69
|
+
console.error(chalk.red(`Failed to build Context Graph for ${args.projectId} (HTTP ${status}).`));
|
|
69
70
|
if (raw)
|
|
70
71
|
console.error(raw);
|
|
71
72
|
process.exit(1);
|
|
72
73
|
}
|
|
73
74
|
const run = body?.run;
|
|
74
75
|
const runId = run?.run_id ?? "(unknown run)";
|
|
75
|
-
const locator = run?.
|
|
76
|
+
const locator = run?.context_graph_path ?? "(no locator)";
|
|
76
77
|
if (args.quiet) {
|
|
77
78
|
console.log(locator);
|
|
78
79
|
return;
|
|
79
80
|
}
|
|
80
81
|
console.log();
|
|
81
82
|
console.log(` Build run ${chalk.bold(runId)} ${chalk.dim(`(${run?.status ?? "started"})`)}`);
|
|
82
|
-
console.log(`
|
|
83
|
+
console.log(` Context Graph: ${locator}`);
|
|
83
84
|
if (run?.status === "succeeded" || run?.finished_at) {
|
|
84
|
-
const
|
|
85
|
-
const readiness =
|
|
85
|
+
const projectResp = await callJson(`${url}/v1/projects/${encodeURIComponent(args.projectId)}`, token);
|
|
86
|
+
const readiness = projectResp.body?.readiness?.status;
|
|
86
87
|
if (readiness)
|
|
87
88
|
console.log(` Readiness: ${readiness}`);
|
|
88
89
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
|
-
import { agents, userConfig } from "../../packages/
|
|
2
|
+
import { agents, userConfig } from "../../packages/runtime/agents/index.js";
|
|
3
3
|
function iconFor(status) {
|
|
4
4
|
if (status === "pass")
|
|
5
5
|
return chalk.green("✓");
|
|
@@ -97,7 +97,7 @@ export const doctorCommand = {
|
|
|
97
97
|
id: "live",
|
|
98
98
|
label: "Live executor preflight",
|
|
99
99
|
status: "skipped",
|
|
100
|
-
message: "Skipped. Run `interf doctor --live` to exercise the real local agent before drafting
|
|
100
|
+
message: "Skipped. Run `interf doctor --live` to exercise the real local agent before drafting benchmark questions, Build Plan authoring, a benchmark pass, or a Build.",
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
103
|
const ok = checks.every((check) => check.status !== "fail");
|
|
@@ -121,7 +121,7 @@ export const doctorCommand = {
|
|
|
121
121
|
}
|
|
122
122
|
console.log();
|
|
123
123
|
if (!argv.live) {
|
|
124
|
-
console.log(chalk.dim(" Tip: run `interf doctor --live` before a first
|
|
124
|
+
console.log(chalk.dim(" Tip: run `interf doctor --live` before a first Build on a new machine."));
|
|
125
125
|
console.log();
|
|
126
126
|
}
|
|
127
127
|
}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `interf graphs` — inspect Context Graphs on the connected instance.
|
|
3
|
+
*
|
|
4
|
+
* interf graphs ls --project <id>
|
|
5
|
+
* interf graphs show <graphId> --project <id>
|
|
6
|
+
* interf graphs open <graphId> --project <id>
|
|
7
|
+
*/
|
|
8
|
+
import chalk from "chalk";
|
|
9
|
+
import { CONNECT_OR_ERROR_HINT, readActiveConnection } from "../../packages/runtime/connection-config.js";
|
|
10
|
+
import { ContextGraphListResponseSchema, ContextGraphResourceSchema, } from "../../packages/runtime/schemas/index.js";
|
|
11
|
+
function resolveConnection(args) {
|
|
12
|
+
const conn = readActiveConnection({
|
|
13
|
+
urlOverride: args.url,
|
|
14
|
+
authTokenOverride: args.token,
|
|
15
|
+
});
|
|
16
|
+
if (!conn) {
|
|
17
|
+
console.error(CONNECT_OR_ERROR_HINT);
|
|
18
|
+
process.exit(1);
|
|
19
|
+
}
|
|
20
|
+
return { url: conn.url.replace(/\/+$/, ""), token: conn.auth_token };
|
|
21
|
+
}
|
|
22
|
+
async function callJson(url, token, init = {}) {
|
|
23
|
+
const headers = new Headers(init.headers ?? {});
|
|
24
|
+
if (token)
|
|
25
|
+
headers.set("authorization", `Bearer ${token}`);
|
|
26
|
+
if (init.body && !headers.has("content-type"))
|
|
27
|
+
headers.set("content-type", "application/json");
|
|
28
|
+
const response = await fetch(url, { ...init, headers });
|
|
29
|
+
const raw = await response.text();
|
|
30
|
+
let body = null;
|
|
31
|
+
if (raw) {
|
|
32
|
+
try {
|
|
33
|
+
body = JSON.parse(raw);
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
body = null;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return { status: response.status, body, raw };
|
|
40
|
+
}
|
|
41
|
+
function graphUrl(baseUrl, projectId, graphId) {
|
|
42
|
+
const root = `${baseUrl}/v1/projects/${encodeURIComponent(projectId)}/graphs`;
|
|
43
|
+
return graphId ? `${root}/${encodeURIComponent(graphId)}` : root;
|
|
44
|
+
}
|
|
45
|
+
function statusColor(graph) {
|
|
46
|
+
const status = graph.readiness?.status;
|
|
47
|
+
if (graph.readiness?.ready || status === "ready")
|
|
48
|
+
return chalk.green;
|
|
49
|
+
if (status === "failed" || status === "not-ready")
|
|
50
|
+
return chalk.red;
|
|
51
|
+
return chalk.yellow;
|
|
52
|
+
}
|
|
53
|
+
function renderGraph(graph) {
|
|
54
|
+
const color = statusColor(graph);
|
|
55
|
+
const graphId = graph.graph_id ?? graph.latest_build_run_id ?? `${graph.project}-latest`;
|
|
56
|
+
const status = graph.readiness?.status ?? "unknown";
|
|
57
|
+
console.log();
|
|
58
|
+
console.log(` ${chalk.bold(graphId)} ${color(`(${status})`)}`);
|
|
59
|
+
console.log(chalk.dim(` project: ${graph.project_id ?? graph.project}`));
|
|
60
|
+
if (graph.build_run_id ?? graph.latest_build_run_id) {
|
|
61
|
+
console.log(chalk.dim(` run: ${graph.build_run_id ?? graph.latest_build_run_id}`));
|
|
62
|
+
}
|
|
63
|
+
if (graph.build_plan)
|
|
64
|
+
console.log(chalk.dim(` Build Plan: ${graph.build_plan}`));
|
|
65
|
+
if (graph.created_at)
|
|
66
|
+
console.log(chalk.dim(` created: ${graph.created_at}`));
|
|
67
|
+
console.log(chalk.dim(` path: ${graph.path}`));
|
|
68
|
+
if (graph.build_evidence?.summary)
|
|
69
|
+
console.log(chalk.dim(` evidence: ${graph.build_evidence.summary}`));
|
|
70
|
+
console.log();
|
|
71
|
+
}
|
|
72
|
+
export const graphsCommand = {
|
|
73
|
+
command: "graphs <subcommand>",
|
|
74
|
+
describe: "Inspect Context Graphs produced for a Project",
|
|
75
|
+
builder: (yargs) => yargs
|
|
76
|
+
.option("url", { type: "string", describe: "Override the active connection URL" })
|
|
77
|
+
.option("token", { type: "string", describe: "Override the active bearer token" })
|
|
78
|
+
.command("ls", "List Context Graphs for a Project", (y) => y.option("project", {
|
|
79
|
+
type: "string",
|
|
80
|
+
demandOption: true,
|
|
81
|
+
describe: "Project id",
|
|
82
|
+
}), async (args) => {
|
|
83
|
+
const { url, token } = resolveConnection(args);
|
|
84
|
+
const { status, body, raw } = await callJson(graphUrl(url, args.project), token);
|
|
85
|
+
if (status !== 200) {
|
|
86
|
+
console.error(chalk.red(`Failed to list Context Graphs (HTTP ${status}).`));
|
|
87
|
+
if (raw)
|
|
88
|
+
console.error(raw);
|
|
89
|
+
process.exit(1);
|
|
90
|
+
}
|
|
91
|
+
const parsed = ContextGraphListResponseSchema.safeParse(body);
|
|
92
|
+
if (!parsed.success) {
|
|
93
|
+
console.error(chalk.red("Failed to parse Context Graph list."));
|
|
94
|
+
process.exit(1);
|
|
95
|
+
}
|
|
96
|
+
const graphs = parsed.data.graphs;
|
|
97
|
+
if (graphs.length === 0) {
|
|
98
|
+
console.log(chalk.dim(" No Context Graphs."));
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
console.log();
|
|
102
|
+
for (const graph of graphs) {
|
|
103
|
+
const marker = graph.is_latest ? " latest" : "";
|
|
104
|
+
const statusLabel = graph.readiness?.status ?? "unknown";
|
|
105
|
+
const graphId = graph.graph_id ?? graph.latest_build_run_id ?? `${graph.project}-latest`;
|
|
106
|
+
console.log(` ${chalk.bold(graphId)} ${chalk.dim(`(${statusLabel}${marker})`)}`);
|
|
107
|
+
console.log(chalk.dim(` path: ${graph.path}`));
|
|
108
|
+
}
|
|
109
|
+
console.log();
|
|
110
|
+
})
|
|
111
|
+
.command("show <graphId>", "Show one Context Graph", (y) => y
|
|
112
|
+
.positional("graphId", {
|
|
113
|
+
type: "string",
|
|
114
|
+
demandOption: true,
|
|
115
|
+
describe: "Context Graph id, or latest",
|
|
116
|
+
})
|
|
117
|
+
.option("project", {
|
|
118
|
+
type: "string",
|
|
119
|
+
demandOption: true,
|
|
120
|
+
describe: "Project id",
|
|
121
|
+
})
|
|
122
|
+
.option("json", {
|
|
123
|
+
type: "boolean",
|
|
124
|
+
default: false,
|
|
125
|
+
describe: "Print the raw JSON record",
|
|
126
|
+
}), async (args) => {
|
|
127
|
+
const { url, token } = resolveConnection(args);
|
|
128
|
+
const resource = await readGraph(url, token, args.project, args.graphId);
|
|
129
|
+
if (args.json) {
|
|
130
|
+
console.log(JSON.stringify(resource, null, 2));
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
renderGraph(resource);
|
|
134
|
+
})
|
|
135
|
+
.command("open <graphId>", "Open a Context Graph folder", (y) => y
|
|
136
|
+
.positional("graphId", {
|
|
137
|
+
type: "string",
|
|
138
|
+
demandOption: true,
|
|
139
|
+
describe: "Context Graph id, or latest",
|
|
140
|
+
})
|
|
141
|
+
.option("project", {
|
|
142
|
+
type: "string",
|
|
143
|
+
demandOption: true,
|
|
144
|
+
describe: "Project id",
|
|
145
|
+
}), async (args) => {
|
|
146
|
+
const { url, token } = resolveConnection(args);
|
|
147
|
+
const resource = await readGraph(url, token, args.project, args.graphId);
|
|
148
|
+
const { status, raw } = await callJson(`${url}/v1/open-path`, token, {
|
|
149
|
+
method: "POST",
|
|
150
|
+
body: JSON.stringify({ path: resource.path }),
|
|
151
|
+
});
|
|
152
|
+
if (status !== 200) {
|
|
153
|
+
console.error(chalk.red(`Failed to open Context Graph (HTTP ${status}).`));
|
|
154
|
+
if (raw)
|
|
155
|
+
console.error(raw);
|
|
156
|
+
process.exit(1);
|
|
157
|
+
}
|
|
158
|
+
console.log(chalk.dim(` Opened ${resource.path}`));
|
|
159
|
+
})
|
|
160
|
+
.demandCommand(1, "Choose a graphs subcommand."),
|
|
161
|
+
handler: () => {
|
|
162
|
+
// Subcommands own all behavior.
|
|
163
|
+
},
|
|
164
|
+
};
|
|
165
|
+
async function readGraph(url, token, projectId, graphId) {
|
|
166
|
+
if (graphId === "latest") {
|
|
167
|
+
const { status, body, raw } = await callJson(graphUrl(url, projectId), token);
|
|
168
|
+
if (status !== 200) {
|
|
169
|
+
console.error(chalk.red(`Failed to read latest Context Graph (HTTP ${status}).`));
|
|
170
|
+
if (raw)
|
|
171
|
+
console.error(raw);
|
|
172
|
+
process.exit(1);
|
|
173
|
+
}
|
|
174
|
+
const parsed = ContextGraphListResponseSchema.safeParse(body);
|
|
175
|
+
if (!parsed.success) {
|
|
176
|
+
console.error(chalk.red("Failed to parse Context Graph list."));
|
|
177
|
+
process.exit(1);
|
|
178
|
+
}
|
|
179
|
+
const latest = parsed.data.graphs.find((graph) => graph.is_latest) ?? parsed.data.graphs[0] ?? null;
|
|
180
|
+
if (!latest) {
|
|
181
|
+
console.error(chalk.red(`Project ${projectId} has no Context Graph.`));
|
|
182
|
+
process.exit(1);
|
|
183
|
+
}
|
|
184
|
+
return latest;
|
|
185
|
+
}
|
|
186
|
+
const { status, body, raw } = await callJson(graphUrl(url, projectId, graphId), token);
|
|
187
|
+
if (status !== 200 || !body) {
|
|
188
|
+
console.error(chalk.red(`Failed to read Context Graph ${graphId} (HTTP ${status}).`));
|
|
189
|
+
if (raw)
|
|
190
|
+
console.error(raw);
|
|
191
|
+
process.exit(1);
|
|
192
|
+
}
|
|
193
|
+
const parsed = ContextGraphResourceSchema.safeParse(body);
|
|
194
|
+
if (!parsed.success) {
|
|
195
|
+
console.error(chalk.red(`Failed to parse Context Graph ${graphId}.`));
|
|
196
|
+
process.exit(1);
|
|
197
|
+
}
|
|
198
|
+
return parsed.data;
|
|
199
|
+
}
|