@ouro.bot/cli 0.1.0-alpha.1469 → 0.1.0-alpha.1470
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 +1 -1
- package/changelog.json +6 -2
- package/deploy/unraid/sanctuary.ouro/bundle-meta.json +1 -1
- package/deploy/unraid/sanctuary.xml +1 -1
- package/desk.lock.json +8 -0
- package/dist/heart/identity.js +27 -1
- package/dist/mind/desk-section.js +33 -43
- package/dist/repertoire/desk-mcp.js +140 -0
- package/dist/repertoire/mcp-manager.js +22 -0
- package/dist/repertoire/mcp-tools.js +11 -7
- package/npm-shrinkwrap.json +2 -2
- package/package.json +4 -1
- package/vendor/desk/.claude-plugin/plugin.json +35 -0
- package/vendor/desk/.mcp.claude-codex.json +28 -0
- package/vendor/desk/.mcp.copilot.json +16 -0
- package/vendor/desk/.ouro-desk.json +6 -0
- package/vendor/desk/CHANGELOG.md +7004 -0
- package/vendor/desk/README.md +195 -0
- package/vendor/desk/activation/README.md +98 -0
- package/vendor/desk/activation/copilot-root.flattened-bundle.json +38 -0
- package/vendor/desk/activation/desk.activation.json +251 -0
- package/vendor/desk/activation/host-capability-evidence.md +46 -0
- package/vendor/desk/activation/support-matrix.json +84 -0
- package/vendor/desk/agency.json +20 -0
- package/vendor/desk/agents/observer.agent.md +26 -0
- package/vendor/desk/agents/observer.md +29 -0
- package/vendor/desk/agents/worker.agent.md +32 -0
- package/vendor/desk/agents/worker.md +40 -0
- package/vendor/desk/artifacts/tombstones/tombstone.schema.json +53 -0
- package/vendor/desk/artifacts/tombstones/tombstones.jsonl +1 -0
- package/vendor/desk/changelog.d/README.md +12 -0
- package/vendor/desk/docs/agent-files.md +104 -0
- package/vendor/desk/docs/agentic-engineering-v2-rfc.md +206 -0
- package/vendor/desk/docs/agentic-engineering-v3-rfc.md +109 -0
- package/vendor/desk/docs/browser-remote-desktops.md +69 -0
- package/vendor/desk/docs/dependency-activation-stories-and-criteria.md +500 -0
- package/vendor/desk/docs/evaluation-packet.md +363 -0
- package/vendor/desk/docs/factory-local-capture.md +651 -0
- package/vendor/desk/docs/factory-store-playbook.md +927 -0
- package/vendor/desk/docs/images/factory-site.png +0 -0
- package/vendor/desk/docs/issue-drains.md +79 -0
- package/vendor/desk/docs/lfs-inspection.md +55 -0
- package/vendor/desk/docs/preview-diagnostics.md +11 -0
- package/vendor/desk/docs/relays.md +88 -0
- package/vendor/desk/docs/schedules.md +69 -0
- package/vendor/desk/docs/search-recovery.md +22 -0
- package/vendor/desk/docs/session-labels.md +157 -0
- package/vendor/desk/docs/session-retention.md +125 -0
- package/vendor/desk/docs/sessions.md +17 -0
- package/vendor/desk/docs/stalled-nudges.md +54 -0
- package/vendor/desk/docs/webhooks.md +80 -0
- package/vendor/desk/docs/workspace-tidy.md +74 -0
- package/vendor/desk/hooks/boot-checks.cjs +7 -0
- package/vendor/desk/hooks/claude-session-start.cjs +123 -0
- package/vendor/desk/hooks/compatible-node.cjs +97 -0
- package/vendor/desk/hooks/copilot-boot-prompt.cjs +69 -0
- package/vendor/desk/hooks/copilot-durable-files.cjs +8 -0
- package/vendor/desk/hooks/copilot-hooks.json +61 -0
- package/vendor/desk/hooks/copilot-intake-context.cjs +5 -0
- package/vendor/desk/hooks/copilot-lane-model.cjs +8 -0
- package/vendor/desk/hooks/copilot-session-start.cjs +264 -0
- package/vendor/desk/hooks/copilot-skill-current.cjs +28 -0
- package/vendor/desk/hooks/factory-end.cjs +5 -0
- package/vendor/desk/hooks/factory-start.cjs +27 -0
- package/vendor/desk/hooks/hooks.json +40 -0
- package/vendor/desk/hooks/lib/boot-checks.cjs +643 -0
- package/vendor/desk/hooks/lib/child-agent.cjs +14 -0
- package/vendor/desk/hooks/lib/copilot-intake-context.cjs +73 -0
- package/vendor/desk/hooks/lib/current-release.cjs +162 -0
- package/vendor/desk/hooks/lib/delivery-stop.cjs +326 -0
- package/vendor/desk/hooks/lib/detach-worker.cjs +43 -0
- package/vendor/desk/hooks/lib/durable-files.cjs +102 -0
- package/vendor/desk/hooks/lib/factory-end.cjs +327 -0
- package/vendor/desk/hooks/lib/lane-model.cjs +82 -0
- package/vendor/desk/hooks/lib/node-required.cjs +56 -0
- package/vendor/desk/hooks/lib/orca-session-title.cjs +60 -0
- package/vendor/desk/hooks/lib/session-end.cjs +30 -0
- package/vendor/desk/hooks/lib/sync-end.cjs +89 -0
- package/vendor/desk/hooks/loop-start.cjs +105 -0
- package/vendor/desk/hooks/node-missing.sh +78 -0
- package/vendor/desk/hooks/orca-session-title.cjs +8 -0
- package/vendor/desk/hooks/session-end.cjs +8 -0
- package/vendor/desk/mcp/README.md +269 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/darwin-arm64-node-127/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.manifest.json +881 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/darwin-arm64-node-127/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.sha256 +1 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/darwin-arm64-node-127/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.tgz +0 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/darwin-arm64-node-137/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.manifest.json +881 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/darwin-arm64-node-137/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.sha256 +1 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/darwin-arm64-node-137/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.tgz +0 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/linux-x64-node-127/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.manifest.json +881 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/linux-x64-node-127/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.sha256 +1 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/linux-x64-node-127/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.tgz +0 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/linux-x64-node-137/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.manifest.json +881 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/linux-x64-node-137/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.sha256 +1 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/linux-x64-node-137/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.tgz +0 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/linux-x64-node-147/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.manifest.json +881 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/linux-x64-node-147/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.sha256 +1 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/linux-x64-node-147/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.tgz +0 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/support-matrix.json +72 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/win32-x64-node-137/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.manifest.json +881 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/win32-x64-node-137/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.sha256 +1 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/win32-x64-node-137/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.tgz +0 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/win32-x64-node-147/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.manifest.json +881 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/win32-x64-node-147/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.sha256 +1 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/1.4.0-alpha.6/win32-x64-node-147/3b0cb8b1e7dd77a982b38375fe88a5278bd77974213e18be025d7dc8deea800f/runtime-deps.tgz +0 -0
- package/vendor/desk/mcp/artifacts/runtime-deps/README.md +25 -0
- package/vendor/desk/mcp/bootstrap.cjs +761 -0
- package/vendor/desk/mcp/docs/private-feedback.md +13 -0
- package/vendor/desk/mcp/idle-proxy.cjs +423 -0
- package/vendor/desk/mcp/index.js +813 -0
- package/vendor/desk/mcp/package-lock.json +3717 -0
- package/vendor/desk/mcp/package.json +44 -0
- package/vendor/desk/mcp/scripts/agency-desk-channel.js +7 -0
- package/vendor/desk/mcp/scripts/build-runtime-deps-pack.js +5 -0
- package/vendor/desk/mcp/scripts/crew.js +89 -0
- package/vendor/desk/mcp/scripts/drains-launcher.mjs +329 -0
- package/vendor/desk/mcp/scripts/drains.js +5 -0
- package/vendor/desk/mcp/scripts/factory.js +657 -0
- package/vendor/desk/mcp/scripts/file-desk-problem.js +9 -0
- package/vendor/desk/mcp/scripts/finish-commit.js +7 -0
- package/vendor/desk/mcp/scripts/lfs.js +37 -0
- package/vendor/desk/mcp/scripts/local-recovery.js +363 -0
- package/vendor/desk/mcp/scripts/migrations.js +11 -0
- package/vendor/desk/mcp/scripts/private-view.js +177 -0
- package/vendor/desk/mcp/scripts/resolve-desk-root.js +106 -0
- package/vendor/desk/mcp/scripts/session-boot.js +22 -0
- package/vendor/desk/mcp/scripts/session-retention.js +5 -0
- package/vendor/desk/mcp/scripts/session-sync.js +10 -0
- package/vendor/desk/mcp/scripts/sessions.js +5 -0
- package/vendor/desk/mcp/scripts/sync-push.js +13 -0
- package/vendor/desk/mcp/scripts/tidy-status.js +8 -0
- package/vendor/desk/mcp/scripts/verify-runtime-deps-pack.js +5 -0
- package/vendor/desk/mcp/src/actions/desk-read.actions.mts +73 -0
- package/vendor/desk/mcp/src/actions/desk-session.actions.mts +42 -0
- package/vendor/desk/mcp/src/actions/desk-web.actions.mts +52 -0
- package/vendor/desk/mcp/src/actions/desk.actions.mts +5 -0
- package/vendor/desk/mcp/src/actions/generated/desk/OuroActions.swift +649 -0
- package/vendor/desk/mcp/src/actions/generated/desk/OuroActionsReins.swift +61 -0
- package/vendor/desk/mcp/src/actions/generated/desk/actions.json +280 -0
- package/vendor/desk/mcp/src/actions/generated/desk/commands.json +145 -0
- package/vendor/desk/mcp/src/actions/generated/desk/mcp.json +256 -0
- package/vendor/desk/mcp/src/actions/generated/desk/web.ts +59 -0
- package/vendor/desk/mcp/src/actions/generated/desk/webmcp.json +250 -0
- package/vendor/desk/mcp/src/actions/generated/desk-web/OuroActions.swift +241 -0
- package/vendor/desk/mcp/src/actions/generated/desk-web/OuroActionsReins.swift +25 -0
- package/vendor/desk/mcp/src/actions/generated/desk-web/actions.json +73 -0
- package/vendor/desk/mcp/src/actions/generated/desk-web/commands.json +53 -0
- package/vendor/desk/mcp/src/actions/generated/desk-web/mcp.json +83 -0
- package/vendor/desk/mcp/src/actions/generated/desk-web/web.ts +47 -0
- package/vendor/desk/mcp/src/actions/generated/desk-web/webmcp.json +81 -0
- package/vendor/desk/mcp/src/actions/served.js +5 -0
- package/vendor/desk/mcp/src/activation/admit.js +77 -0
- package/vendor/desk/mcp/src/activation/failures.js +65 -0
- package/vendor/desk/mcp/src/activation/readiness-policy.js +102 -0
- package/vendor/desk/mcp/src/activation/schema.js +17 -0
- package/vendor/desk/mcp/src/activation/superpowers-context.js +265 -0
- package/vendor/desk/mcp/src/activation/validate.js +540 -0
- package/vendor/desk/mcp/src/artifacts/tombstones.js +61 -0
- package/vendor/desk/mcp/src/crew/initiative.js +287 -0
- package/vendor/desk/mcp/src/crew/workspace.js +1259 -0
- package/vendor/desk/mcp/src/db/init.js +75 -0
- package/vendor/desk/mcp/src/db/schema.sql +83 -0
- package/vendor/desk/mcp/src/desk/active-tasks.js +408 -0
- package/vendor/desk/mcp/src/desk/card-commit-guard.js +281 -0
- package/vendor/desk/mcp/src/desk/cleanup-index.js +53 -0
- package/vendor/desk/mcp/src/desk/content-home.js +246 -0
- package/vendor/desk/mcp/src/desk/crew-config.js +102 -0
- package/vendor/desk/mcp/src/desk/crew-member.js +196 -0
- package/vendor/desk/mcp/src/desk/crew-roster.js +151 -0
- package/vendor/desk/mcp/src/desk/frontmatter-lite.js +228 -0
- package/vendor/desk/mcp/src/desk/gh-logins.js +109 -0
- package/vendor/desk/mcp/src/desk/handles.js +123 -0
- package/vendor/desk/mcp/src/desk/handoff-reference.js +35 -0
- package/vendor/desk/mcp/src/desk/improvement-authority.js +3 -0
- package/vendor/desk/mcp/src/desk/improvement-cards.js +704 -0
- package/vendor/desk/mcp/src/desk/improvement-person.js +51 -0
- package/vendor/desk/mcp/src/desk/lifecycle.js +16 -0
- package/vendor/desk/mcp/src/desk/machine-desks.js +119 -0
- package/vendor/desk/mcp/src/desk/naming.js +333 -0
- package/vendor/desk/mcp/src/desk/organization.js +592 -0
- package/vendor/desk/mcp/src/desk/resources.js +274 -0
- package/vendor/desk/mcp/src/desk/runtime-resolver.js +30 -0
- package/vendor/desk/mcp/src/desk/scratch-paths.js +44 -0
- package/vendor/desk/mcp/src/desk/step-delivery.js +140 -0
- package/vendor/desk/mcp/src/desk/steps.js +263 -0
- package/vendor/desk/mcp/src/desk/tidy.js +930 -0
- package/vendor/desk/mcp/src/desk/unsigned-deliveries.js +359 -0
- package/vendor/desk/mcp/src/factory/agent-types.js +45 -0
- package/vendor/desk/mcp/src/factory/andon-watch.js +109 -0
- package/vendor/desk/mcp/src/factory/binding.js +612 -0
- package/vendor/desk/mcp/src/factory/boot-check.js +645 -0
- package/vendor/desk/mcp/src/factory/capture-classify.js +158 -0
- package/vendor/desk/mcp/src/factory/capture-count.js +183 -0
- package/vendor/desk/mcp/src/factory/capture-flush.js +268 -0
- package/vendor/desk/mcp/src/factory/capture-publish.js +141 -0
- package/vendor/desk/mcp/src/factory/capture-schema.js +193 -0
- package/vendor/desk/mcp/src/factory/capture-sweep.js +239 -0
- package/vendor/desk/mcp/src/factory/catch-point.js +60 -0
- package/vendor/desk/mcp/src/factory/commit-resolve.js +94 -0
- package/vendor/desk/mcp/src/factory/consent-answer.js +37 -0
- package/vendor/desk/mcp/src/factory/context-capability.js +15 -0
- package/vendor/desk/mcp/src/factory/context-outbox.js +885 -0
- package/vendor/desk/mcp/src/factory/context-run.js +386 -0
- package/vendor/desk/mcp/src/factory/context-schema.js +249 -0
- package/vendor/desk/mcp/src/factory/copilot-turn-index.js +93 -0
- package/vendor/desk/mcp/src/factory/copilot-usage.js +148 -0
- package/vendor/desk/mcp/src/factory/credential.js +45 -0
- package/vendor/desk/mcp/src/factory/derive-claude.js +960 -0
- package/vendor/desk/mcp/src/factory/derive-codex.js +734 -0
- package/vendor/desk/mcp/src/factory/derive-common.js +279 -0
- package/vendor/desk/mcp/src/factory/derive-copilot.js +1057 -0
- package/vendor/desk/mcp/src/factory/derive-run.js +807 -0
- package/vendor/desk/mcp/src/factory/desk-problem-file.js +310 -0
- package/vendor/desk/mcp/src/factory/desk-problem-fingerprint.js +70 -0
- package/vendor/desk/mcp/src/factory/desk-problem-known.js +246 -0
- package/vendor/desk/mcp/src/factory/desk-problem-template.js +107 -0
- package/vendor/desk/mcp/src/factory/desk-repo.js +1223 -0
- package/vendor/desk/mcp/src/factory/desk-task-line.js +28 -0
- package/vendor/desk/mcp/src/factory/desk-visibility.js +48 -0
- package/vendor/desk/mcp/src/factory/end-hook.js +14 -0
- package/vendor/desk/mcp/src/factory/evaluate-kick.js +164 -0
- package/vendor/desk/mcp/src/factory/evaluate-run.js +678 -0
- package/vendor/desk/mcp/src/factory/evaluator-step.js +484 -0
- package/vendor/desk/mcp/src/factory/filer-launch.js +79 -0
- package/vendor/desk/mcp/src/factory/flush-health.js +26 -0
- package/vendor/desk/mcp/src/factory/flush.js +1758 -0
- package/vendor/desk/mcp/src/factory/focus.js +326 -0
- package/vendor/desk/mcp/src/factory/headless-flag.cjs +32 -0
- package/vendor/desk/mcp/src/factory/headless-flag.js +25 -0
- package/vendor/desk/mcp/src/factory/headless-ledger.js +743 -0
- package/vendor/desk/mcp/src/factory/headless.js +567 -0
- package/vendor/desk/mcp/src/factory/held-route.js +93 -0
- package/vendor/desk/mcp/src/factory/host-flags.js +36 -0
- package/vendor/desk/mcp/src/factory/improvement-verify.js +429 -0
- package/vendor/desk/mcp/src/factory/kaizen-file.js +231 -0
- package/vendor/desk/mcp/src/factory/label-binding.js +90 -0
- package/vendor/desk/mcp/src/factory/label-schema.js +426 -0
- package/vendor/desk/mcp/src/factory/local-status.js +368 -0
- package/vendor/desk/mcp/src/factory/loop-conditions.js +121 -0
- package/vendor/desk/mcp/src/factory/loop-health.js +500 -0
- package/vendor/desk/mcp/src/factory/loop-slot.js +90 -0
- package/vendor/desk/mcp/src/factory/loop-status.js +100 -0
- package/vendor/desk/mcp/src/factory/loop-switch.cjs +14 -0
- package/vendor/desk/mcp/src/factory/loop-worker-state.js +96 -0
- package/vendor/desk/mcp/src/factory/loop-worker.js +290 -0
- package/vendor/desk/mcp/src/factory/marker.js +61 -0
- package/vendor/desk/mcp/src/factory/mirror-step.js +145 -0
- package/vendor/desk/mcp/src/factory/os-protect.js +243 -0
- package/vendor/desk/mcp/src/factory/outbox.js +2231 -0
- package/vendor/desk/mcp/src/factory/outcome.js +431 -0
- package/vendor/desk/mcp/src/factory/pipeline/andon.js +319 -0
- package/vendor/desk/mcp/src/factory/pipeline/attention-rollup.js +158 -0
- package/vendor/desk/mcp/src/factory/pipeline/attention.js +146 -0
- package/vendor/desk/mcp/src/factory/pipeline/build.js +299 -0
- package/vendor/desk/mcp/src/factory/pipeline/compare.js +148 -0
- package/vendor/desk/mcp/src/factory/pipeline/formulas.js +652 -0
- package/vendor/desk/mcp/src/factory/pipeline/kaizen.js +387 -0
- package/vendor/desk/mcp/src/factory/pipeline/lifecycle-clocks.js +345 -0
- package/vendor/desk/mcp/src/factory/pipeline/normalize.js +73 -0
- package/vendor/desk/mcp/src/factory/pipeline/number-states.js +154 -0
- package/vendor/desk/mcp/src/factory/pipeline/outcomes.js +268 -0
- package/vendor/desk/mcp/src/factory/pipeline/report.js +737 -0
- package/vendor/desk/mcp/src/factory/pipeline/rollups.js +883 -0
- package/vendor/desk/mcp/src/factory/pipeline/stretches.js +523 -0
- package/vendor/desk/mcp/src/factory/pipeline/timeline.js +199 -0
- package/vendor/desk/mcp/src/factory/pipeline/validate-pr.js +238 -0
- package/vendor/desk/mcp/src/factory/pipeline/versions.js +42 -0
- package/vendor/desk/mcp/src/factory/pipeline/walk.js +1177 -0
- package/vendor/desk/mcp/src/factory/plugin-registry.js +72 -0
- package/vendor/desk/mcp/src/factory/plugin-sources.cjs +249 -0
- package/vendor/desk/mcp/src/factory/pr-green.js +77 -0
- package/vendor/desk/mcp/src/factory/process-lock.js +142 -0
- package/vendor/desk/mcp/src/factory/proof-session.js +75 -0
- package/vendor/desk/mcp/src/factory/publish.js +637 -0
- package/vendor/desk/mcp/src/factory/published-schema.js +648 -0
- package/vendor/desk/mcp/src/factory/reconcile-reasons.js +22 -0
- package/vendor/desk/mcp/src/factory/reconcile-step.js +251 -0
- package/vendor/desk/mcp/src/factory/reconcile.js +808 -0
- package/vendor/desk/mcp/src/factory/release-version.js +134 -0
- package/vendor/desk/mcp/src/factory/repo-name.js +13 -0
- package/vendor/desk/mcp/src/factory/retention.js +60 -0
- package/vendor/desk/mcp/src/factory/route-desk.js +40 -0
- package/vendor/desk/mcp/src/factory/route-issues.js +251 -0
- package/vendor/desk/mcp/src/factory/route-local.js +264 -0
- package/vendor/desk/mcp/src/factory/schema.js +957 -0
- package/vendor/desk/mcp/src/factory/session-kind.js +16 -0
- package/vendor/desk/mcp/src/factory/session-lifetime.js +56 -0
- package/vendor/desk/mcp/src/factory/session-route.js +183 -0
- package/vendor/desk/mcp/src/factory/shell-git.js +500 -0
- package/vendor/desk/mcp/src/factory/store-issues.js +143 -0
- package/vendor/desk/mcp/src/factory/store-route.js +208 -0
- package/vendor/desk/mcp/src/factory/test-state-guard.js +103 -0
- package/vendor/desk/mcp/src/factory/time.js +36 -0
- package/vendor/desk/mcp/src/factory/tool-issue-file.js +84 -0
- package/vendor/desk/mcp/src/factory/tool-kinds.js +87 -0
- package/vendor/desk/mcp/src/factory/triage-schema.js +233 -0
- package/vendor/desk/mcp/src/factory/windows-acl.js +679 -0
- package/vendor/desk/mcp/src/indexer/chunk.js +232 -0
- package/vendor/desk/mcp/src/indexer/discover.js +434 -0
- package/vendor/desk/mcp/src/indexer/exclusions.js +247 -0
- package/vendor/desk/mcp/src/indexer/index.js +167 -0
- package/vendor/desk/mcp/src/indexer/refs.js +0 -0
- package/vendor/desk/mcp/src/indexer/text-hash.js +18 -0
- package/vendor/desk/mcp/src/lib/ouro-actions/actions.claims.json +75 -0
- package/vendor/desk/mcp/src/lib/ouro-actions/dist-manifest.json +70 -0
- package/vendor/desk/mcp/src/lib/ouro-actions/ouro-actions.mts +1416 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/LICENSE +21 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/ax-claims.ts +190 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/ax-command.ts +1020 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/checks.ts +343 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/cli.ts +240 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/component.ts +430 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/dev-commands.ts +204 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/doctor.ts +126 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/effects.ts +68 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/exit-codes.ts +75 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/help.ts +220 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/mcp.ts +268 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/outcome.ts +265 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/output.ts +67 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/precise-copy.ts +235 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/problem.ts +124 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/surfaces.kit.mts +8 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/surfaces.ts +568 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/terminal.ts +245 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/voice.ts +136 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/wait.ts +226 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/work-event.ts +181 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/xray.kit.mts +18 -0
- package/vendor/desk/mcp/src/lib/ouro-ui/registry/ouro/ax/xray.ts +2072 -0
- package/vendor/desk/mcp/src/package-metadata.js +20 -0
- package/vendor/desk/mcp/src/protected/legacy-ledger.js +55 -0
- package/vendor/desk/mcp/src/readiness/leftovers.js +75 -0
- package/vendor/desk/mcp/src/readiness/process-start.js +149 -0
- package/vendor/desk/mcp/src/runtime/admission-worker.js +194 -0
- package/vendor/desk/mcp/src/runtime/admission.js +177 -0
- package/vendor/desk/mcp/src/runtime/agency-desk-channel.js +342 -0
- package/vendor/desk/mcp/src/runtime/agents-md.js +62 -0
- package/vendor/desk/mcp/src/runtime/append-lane.js +68 -0
- package/vendor/desk/mcp/src/runtime/argv-safe-reason.js +55 -0
- package/vendor/desk/mcp/src/runtime/boot-dependencies.js +75 -0
- package/vendor/desk/mcp/src/runtime/boot-text.js +504 -0
- package/vendor/desk/mcp/src/runtime/boot.js +1677 -0
- package/vendor/desk/mcp/src/runtime/bootstrap.js +1455 -0
- package/vendor/desk/mcp/src/runtime/chunked-import.js +102 -0
- package/vendor/desk/mcp/src/runtime/copilot-commit-trailer.js +133 -0
- package/vendor/desk/mcp/src/runtime/copilot-session.js +155 -0
- package/vendor/desk/mcp/src/runtime/deliver.js +469 -0
- package/vendor/desk/mcp/src/runtime/desk-channel.js +86 -0
- package/vendor/desk/mcp/src/runtime/desk-failure.js +26 -0
- package/vendor/desk/mcp/src/runtime/desk-health.js +168 -0
- package/vendor/desk/mcp/src/runtime/desk-session.js +1451 -0
- package/vendor/desk/mcp/src/runtime/diagnostic-server.js +72 -0
- package/vendor/desk/mcp/src/runtime/diagnostics.js +241 -0
- package/vendor/desk/mcp/src/runtime/drains-cli.js +187 -0
- package/vendor/desk/mcp/src/runtime/drains.js +781 -0
- package/vendor/desk/mcp/src/runtime/elsewhere-note.js +9 -0
- package/vendor/desk/mcp/src/runtime/failure-evidence.js +21 -0
- package/vendor/desk/mcp/src/runtime/fast-refs.js +209 -0
- package/vendor/desk/mcp/src/runtime/filer-throttle.js +66 -0
- package/vendor/desk/mcp/src/runtime/focused-card.js +147 -0
- package/vendor/desk/mcp/src/runtime/front-door.js +204 -0
- package/vendor/desk/mcp/src/runtime/gate-wait.js +2 -0
- package/vendor/desk/mcp/src/runtime/git-inspection.js +201 -0
- package/vendor/desk/mcp/src/runtime/git-read-worker.js +157 -0
- package/vendor/desk/mcp/src/runtime/health.js +50 -0
- package/vendor/desk/mcp/src/runtime/hooks.js +353 -0
- package/vendor/desk/mcp/src/runtime/hosted.js +163 -0
- package/vendor/desk/mcp/src/runtime/inbox.js +102 -0
- package/vendor/desk/mcp/src/runtime/index-drift.js +118 -0
- package/vendor/desk/mcp/src/runtime/last-start.js +133 -0
- package/vendor/desk/mcp/src/runtime/lesson-section.js +92 -0
- package/vendor/desk/mcp/src/runtime/lessons-shelf.js +100 -0
- package/vendor/desk/mcp/src/runtime/lfs.js +319 -0
- package/vendor/desk/mcp/src/runtime/native-path.js +12 -0
- package/vendor/desk/mcp/src/runtime/newest-release.js +197 -0
- package/vendor/desk/mcp/src/runtime/node-selection.js +233 -0
- package/vendor/desk/mcp/src/runtime/orca-session-title.js +225 -0
- package/vendor/desk/mcp/src/runtime/other-sessions.js +183 -0
- package/vendor/desk/mcp/src/runtime/pending-migrations.js +653 -0
- package/vendor/desk/mcp/src/runtime/plugin-update.js +215 -0
- package/vendor/desk/mcp/src/runtime/pluginless-runtimes.js +34 -0
- package/vendor/desk/mcp/src/runtime/pr-publication.js +226 -0
- package/vendor/desk/mcp/src/runtime/preview-snapshot.js +23 -0
- package/vendor/desk/mcp/src/runtime/publication-mode.js +19 -0
- package/vendor/desk/mcp/src/runtime/relays.js +974 -0
- package/vendor/desk/mcp/src/runtime/release-alert.js +148 -0
- package/vendor/desk/mcp/src/runtime/remote-identity.js +140 -0
- package/vendor/desk/mcp/src/runtime/resolve-here.js +4 -0
- package/vendor/desk/mcp/src/runtime/runtime-deps-cli.js +65 -0
- package/vendor/desk/mcp/src/runtime/runtime-deps.js +1109 -0
- package/vendor/desk/mcp/src/runtime/runtime-identity.js +22 -0
- package/vendor/desk/mcp/src/runtime/runtime-swap.js +101 -0
- package/vendor/desk/mcp/src/runtime/schedules.js +235 -0
- package/vendor/desk/mcp/src/runtime/session-activity.js +190 -0
- package/vendor/desk/mcp/src/runtime/session-label.js +30 -0
- package/vendor/desk/mcp/src/runtime/session-retention.js +662 -0
- package/vendor/desk/mcp/src/runtime/session-sync.js +333 -0
- package/vendor/desk/mcp/src/runtime/session-trailer.js +126 -0
- package/vendor/desk/mcp/src/runtime/sessions-cli.js +301 -0
- package/vendor/desk/mcp/src/runtime/signoff-listed.js +81 -0
- package/vendor/desk/mcp/src/runtime/skills.js +76 -0
- package/vendor/desk/mcp/src/runtime/stale-card-lead.js +52 -0
- package/vendor/desk/mcp/src/runtime/stale-desk-refresh.js +198 -0
- package/vendor/desk/mcp/src/runtime/stale-desk.js +219 -0
- package/vendor/desk/mcp/src/runtime/stalled.js +255 -0
- package/vendor/desk/mcp/src/runtime/standing-authority.js +79 -0
- package/vendor/desk/mcp/src/runtime/startup-boot.js +341 -0
- package/vendor/desk/mcp/src/runtime/startup-resolve.js +140 -0
- package/vendor/desk/mcp/src/runtime/state-branch.js +203 -0
- package/vendor/desk/mcp/src/runtime/status-compact.js +165 -0
- package/vendor/desk/mcp/src/runtime/status-inspection-child.js +26 -0
- package/vendor/desk/mcp/src/runtime/status-inspection.js +147 -0
- package/vendor/desk/mcp/src/runtime/status-root.js +39 -0
- package/vendor/desk/mcp/src/runtime/sync-worker.js +911 -0
- package/vendor/desk/mcp/src/runtime/test-state-guard.js +107 -0
- package/vendor/desk/mcp/src/runtime/unmerged-saves.js +247 -0
- package/vendor/desk/mcp/src/runtime/workspace-claim.js +53 -0
- package/vendor/desk/mcp/src/runtime/workspace-evidence.js +96 -0
- package/vendor/desk/mcp/src/runtime/workspace-tidy.js +509 -0
- package/vendor/desk/mcp/src/search/direct-lexical.js +54 -0
- package/vendor/desk/mcp/src/search/embedder.js +108 -0
- package/vendor/desk/mcp/src/search/engine.js +406 -0
- package/vendor/desk/mcp/src/search/files-router.js +22 -0
- package/vendor/desk/mcp/src/search/old-index.js +46 -0
- package/vendor/desk/mcp/src/search/vectors.js +60 -0
- package/vendor/desk/mcp/src/server.js +389 -0
- package/vendor/desk/mcp/src/tool-names.js +73 -0
- package/vendor/desk/mcp/src/tool-refusal.cjs +35 -0
- package/vendor/desk/mcp/src/tool-schema-parts.js +12 -0
- package/vendor/desk/mcp/src/tool-schemas.js +325 -0
- package/vendor/desk/mcp/src/tools/_card-commit.js +148 -0
- package/vendor/desk/mcp/src/tools/archive-links.js +185 -0
- package/vendor/desk/mcp/src/tools/archive-move.js +18 -0
- package/vendor/desk/mcp/src/tools/archive-native-session.js +728 -0
- package/vendor/desk/mcp/src/tools/archive-state.js +513 -0
- package/vendor/desk/mcp/src/tools/delivery-gate.js +251 -0
- package/vendor/desk/mcp/src/tools/desk-save.js +444 -0
- package/vendor/desk/mcp/src/tools/doctor.js +122 -0
- package/vendor/desk/mcp/src/tools/done-evidence.js +260 -0
- package/vendor/desk/mcp/src/tools/factory-context.js +204 -0
- package/vendor/desk/mcp/src/tools/friction.js +332 -0
- package/vendor/desk/mcp/src/tools/improvement.js +156 -0
- package/vendor/desk/mcp/src/tools/lesson-lines.js +22 -0
- package/vendor/desk/mcp/src/tools/lesson-owners.js +137 -0
- package/vendor/desk/mcp/src/tools/lesson-team.js +169 -0
- package/vendor/desk/mcp/src/tools/lesson.js +254 -0
- package/vendor/desk/mcp/src/tools/local-only.js +151 -0
- package/vendor/desk/mcp/src/tools/move.js +794 -0
- package/vendor/desk/mcp/src/tools/native-stage-context.js +32 -0
- package/vendor/desk/mcp/src/tools/note.js +267 -0
- package/vendor/desk/mcp/src/tools/search.js +634 -0
- package/vendor/desk/mcp/src/tools/shared-write.js +196 -0
- package/vendor/desk/mcp/src/tools/sibling-desk.js +37 -0
- package/vendor/desk/mcp/src/tools/status.js +233 -0
- package/vendor/desk/mcp/src/tools/task-archive-due.js +9 -0
- package/vendor/desk/mcp/src/tools/task-archived-resource.js +53 -0
- package/vendor/desk/mcp/src/tools/task-body.js +141 -0
- package/vendor/desk/mcp/src/tools/task-focus.js +164 -0
- package/vendor/desk/mcp/src/tools/task-log.js +76 -0
- package/vendor/desk/mcp/src/tools/task-signoff.js +155 -0
- package/vendor/desk/mcp/src/tools/task.js +1768 -0
- package/vendor/desk/mcp/src/tools/track-row.js +89 -0
- package/vendor/desk/mcp/src/tools/track.js +240 -0
- package/vendor/desk/mcp/src/util/agency-session.cjs +29 -0
- package/vendor/desk/mcp/src/util/archive-links.js +105 -0
- package/vendor/desk/mcp/src/util/bash.js +36 -0
- package/vendor/desk/mcp/src/util/capture-record.js +73 -0
- package/vendor/desk/mcp/src/util/cas-commit.js +252 -0
- package/vendor/desk/mcp/src/util/created-dirs.js +71 -0
- package/vendor/desk/mcp/src/util/deferred-tools.js +51 -0
- package/vendor/desk/mcp/src/util/desk-owner.js +99 -0
- package/vendor/desk/mcp/src/util/env-value.js +13 -0
- package/vendor/desk/mcp/src/util/file-identity.js +40 -0
- package/vendor/desk/mcp/src/util/finish-commit.js +145 -0
- package/vendor/desk/mcp/src/util/fm.js +410 -0
- package/vendor/desk/mcp/src/util/git-config-file.js +85 -0
- package/vendor/desk/mcp/src/util/git-stage.js +440 -0
- package/vendor/desk/mcp/src/util/main-publish.js +240 -0
- package/vendor/desk/mcp/src/util/markdown-links.cjs +555 -0
- package/vendor/desk/mcp/src/util/object-input.js +59 -0
- package/vendor/desk/mcp/src/util/paths.js +647 -0
- package/vendor/desk/mcp/src/util/rank.js +189 -0
- package/vendor/desk/mcp/src/util/redact.js +92 -0
- package/vendor/desk/mcp/src/util/remove-retry.js +35 -0
- package/vendor/desk/mcp/src/util/rename-retry.js +73 -0
- package/vendor/desk/mcp/src/util/route-around.js +265 -0
- package/vendor/desk/mcp/src/util/shell-quote.js +18 -0
- package/vendor/desk/mcp/src/util/startup-direction.js +124 -0
- package/vendor/desk/mcp/src/util/state-ignore.js +33 -0
- package/vendor/desk/mcp/src/util/tool-commits.js +64 -0
- package/vendor/desk/mcp/src/util/unicode-16/LICENSE-MIT.txt +7 -0
- package/vendor/desk/mcp/src/util/unicode-16/README.md +9 -0
- package/vendor/desk/mcp/src/util/unicode-16/letter.cjs +1 -0
- package/vendor/desk/mcp/src/util/unicode-16/mark.cjs +1 -0
- package/vendor/desk/mcp/src/util/unicode-16/number.cjs +1 -0
- package/vendor/desk/mcp/web-auth.cjs +1897 -0
- package/vendor/desk/mcp/web-browser-discovery.cjs +53 -0
- package/vendor/desk/mcp/web-catalog.json +34 -0
- package/vendor/desk/mcp/web-launch.cjs +101 -0
- package/vendor/desk/mcp/web.cjs +1239 -0
- package/vendor/desk/migrations/01-move-to-ourostack-desk.md +188 -0
- package/vendor/desk/migrations/02-tidy-desk.md +87 -0
- package/vendor/desk/migrations/03-desk-release-channel.md +38 -0
- package/vendor/desk/optional/session-label/consumer.mjs +237 -0
- package/vendor/desk/optional/session-label/extension.mjs +32 -0
- package/vendor/desk/plugin.json +54 -0
- package/vendor/desk/settings.json +3 -0
- package/vendor/desk/skills/add-workspace-mcp/SKILL.md +180 -0
- package/vendor/desk/skills/adopt-inflight-work/SKILL.md +212 -0
- package/vendor/desk/skills/archive-workflow/SKILL.md +132 -0
- package/vendor/desk/skills/content-routing/SKILL.md +95 -0
- package/vendor/desk/skills/core-meeting-capture/SKILL.md +47 -0
- package/vendor/desk/skills/core-meeting-capture/references/capture-contract.md +175 -0
- package/vendor/desk/skills/curator/SKILL.md +103 -0
- package/vendor/desk/skills/delightful-decks/SKILL.md +67 -0
- package/vendor/desk/skills/desk-problem/SKILL.md +87 -0
- package/vendor/desk/skills/directory-structure/SKILL.md +169 -0
- package/vendor/desk/skills/doc-review-rigor/SKILL.md +63 -0
- package/vendor/desk/skills/draining-issues/SKILL.md +62 -0
- package/vendor/desk/skills/evaluate-release/SKILL.md +96 -0
- package/vendor/desk/skills/evidence-discipline/SKILL.md +150 -0
- package/vendor/desk/skills/factory-evaluator/SKILL.md +122 -0
- package/vendor/desk/skills/factory-task-context/SKILL.md +116 -0
- package/vendor/desk/skills/factory-work/SKILL.md +16 -0
- package/vendor/desk/skills/fast-honest-ci/SKILL.md +70 -0
- package/vendor/desk/skills/fast-honest-ci/examples.md +49 -0
- package/vendor/desk/skills/first-run-bootstrap/SKILL.md +95 -0
- package/vendor/desk/skills/friction-management/SKILL.md +98 -0
- package/vendor/desk/skills/git-hygiene/SKILL.md +253 -0
- package/vendor/desk/skills/independent-review/SKILL.md +34 -0
- package/vendor/desk/skills/interaction-style/SKILL.md +239 -0
- package/vendor/desk/skills/lesson-capture/SKILL.md +85 -0
- package/vendor/desk/skills/lesson-capture/agents-md-budget.mjs +61 -0
- package/vendor/desk/skills/online-evaluation/SKILL.md +81 -0
- package/vendor/desk/skills/operator-voice-comments/LICENSE-humanize +21 -0
- package/vendor/desk/skills/operator-voice-comments/SKILL.md +90 -0
- package/vendor/desk/skills/operator-voice-comments/human-voice.md +43 -0
- package/vendor/desk/skills/peer-pr-review/SKILL.md +104 -0
- package/vendor/desk/skills/pr-feedback-on-own-pr/SKILL.md +145 -0
- package/vendor/desk/skills/pr-review-interrogation/SKILL.md +121 -0
- package/vendor/desk/skills/pr-reviewer-audit/SKILL.md +68 -0
- package/vendor/desk/skills/pr-reviewer-audit/helpers/audit.py +335 -0
- package/vendor/desk/skills/pr-reviewer-audit/helpers/test_audit.py +486 -0
- package/vendor/desk/skills/pr-self-review/SKILL.md +86 -0
- package/vendor/desk/skills/pr-surface-hygiene/SKILL.md +105 -0
- package/vendor/desk/skills/pr-surface-hygiene/check-visual-proof.cjs +99 -0
- package/vendor/desk/skills/pr-surface-hygiene/repository-setup.md +19 -0
- package/vendor/desk/skills/pr-surface-hygiene/resources/pr-visual-proof.yml +29 -0
- package/vendor/desk/skills/pr-surface-hygiene/resources/pull-request-template.md +5 -0
- package/vendor/desk/skills/preflight-actions/SKILL.md +60 -0
- package/vendor/desk/skills/preview-feedback/SKILL.md +70 -0
- package/vendor/desk/skills/repo-handling/SKILL.md +67 -0
- package/vendor/desk/skills/rnd-lab/SKILL.md +52 -0
- package/vendor/desk/skills/runtime-symptom-investigation/SKILL.md +106 -0
- package/vendor/desk/skills/session-resumption/SKILL.md +126 -0
- package/vendor/desk/skills/session-start/SKILL.md +54 -0
- package/vendor/desk/skills/session-start/details.md +150 -0
- package/vendor/desk/skills/session-start-migrations/README.md +71 -0
- package/vendor/desk/skills/session-start-migrations/SKILL.md +108 -0
- package/vendor/desk/skills/start-task/SKILL.md +88 -0
- package/vendor/desk/skills/task-card-format/SKILL.md +198 -0
- package/vendor/desk/skills/task-lifecycle/SKILL.md +217 -0
- package/vendor/desk/skills/track-card-format/SKILL.md +90 -0
- package/vendor/desk/skills/using-desk/SKILL.md +58 -0
- package/vendor/desk/skills/using-superpowers-with-desk/SKILL.md +156 -0
- package/vendor/desk/skills/work-orchestration/SKILL.md +162 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
export { agoText, DOCTOR_VERSION, doctorReport, doctorText, isDoctorReport };
|
|
2
|
+
export type { DoctorReport, PartState, StateLine, StateSection };
|
|
3
|
+
|
|
4
|
+
// The export list comes first because the shadcn CLI drops comments before a file's
|
|
5
|
+
// first statement, which would take the JSDoc below with it.
|
|
6
|
+
|
|
7
|
+
import { checksText, isChecksReport, type ChecksReport } from "./checks.ts";
|
|
8
|
+
import { paint, type TerminalStyle } from "./terminal.ts";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A doctor: a tool's checks (ax-checks) with the state they judged, so a person and an agent read the same facts. It
|
|
12
|
+
* says what runs and since when, the versions and the last attempts, then what is wrong and the command that fixes it.
|
|
13
|
+
* `DoctorReport` is a checks report with `doctor`, `at` and `state` added, so whatever reads a checks report reads it.
|
|
14
|
+
*
|
|
15
|
+
* @claim "so whatever reads a checks report reads it" registry/ouro/ax/doctor.test.mts verify:testExists(registry/ouro/ax/doctor.test.mts::a doctor report is the checks report with the state it judged, and still a checks report)
|
|
16
|
+
* @example
|
|
17
|
+
* const report = doctorReport(await checks.run(facts), [{ id: "processes", label: "Processes", lines: [{ label: "Service", value: "up", state: "up", since: startedAt }] }], Date.now());
|
|
18
|
+
* stdout.write(json ? JSON.stringify(report) : doctorText(report, terminalStyle(stdout, env), { command: "notes doctor" }));
|
|
19
|
+
* process.exitCode = report.exitCode;
|
|
20
|
+
*/
|
|
21
|
+
type PartState = "up" | "starting" | "stuck" | "down" | "absent";
|
|
22
|
+
|
|
23
|
+
/** The version of the doctor's shape; `--json` carries it as `doctor`, beside the checks' `ax`. */
|
|
24
|
+
const DOCTOR_VERSION = "doctor/1";
|
|
25
|
+
|
|
26
|
+
/** One fact: what it is, its value in words, and since when it has held (ms since the epoch) when that is known. */
|
|
27
|
+
interface StateLine {
|
|
28
|
+
label: string;
|
|
29
|
+
value: string;
|
|
30
|
+
since?: number | null;
|
|
31
|
+
/** A part's state, when the line is about one: up, starting, stuck (there and not answering), down or absent. */
|
|
32
|
+
state?: PartState;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** A group of facts under one heading: "Versions", "Processes", "Sign-in". */
|
|
36
|
+
interface StateSection {
|
|
37
|
+
id: string;
|
|
38
|
+
label: string;
|
|
39
|
+
lines: StateLine[];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** The checks' report, with the doctor's version, when it looked and what it saw. */
|
|
43
|
+
interface DoctorReport extends ChecksReport {
|
|
44
|
+
doctor: typeof DOCTOR_VERSION;
|
|
45
|
+
at: number;
|
|
46
|
+
state: StateSection[];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The checks' report with what the doctor saw and when it looked. Its exit code is the checks' own.
|
|
51
|
+
*
|
|
52
|
+
* @claim "Its exit code is the checks' own" registry/ouro/ax/doctor.test.mts verify:testExists(registry/ouro/ax/doctor.test.mts::a doctor report is the checks report with the state it judged, and still a checks report)
|
|
53
|
+
* @example
|
|
54
|
+
* const report = doctorReport(await checks.run(facts), state(facts), Date.now());
|
|
55
|
+
*/
|
|
56
|
+
function doctorReport(checks: ChecksReport, state: StateSection[], at: number): DoctorReport {
|
|
57
|
+
return { ...checks, doctor: DOCTOR_VERSION, at, state };
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Whether a value is a doctor report, such as the answer of an app's own doctor endpoint, with sections and lines
|
|
62
|
+
* `doctorText` can print.
|
|
63
|
+
*
|
|
64
|
+
* @claim "with sections and lines `doctorText` can print" registry/ouro/ax/doctor.test.mts verify:testExists(registry/ouro/ax/doctor.test.mts::a doctor report is the checks report with the state it judged, and still a checks report)
|
|
65
|
+
* @example
|
|
66
|
+
* const asked = await probeHttp(`${serviceUrl}/api/doctor`);
|
|
67
|
+
* if (asked.state === "up" && isDoctorReport(asked.body)) return asked.body;
|
|
68
|
+
*/
|
|
69
|
+
function isDoctorReport(value: unknown): value is DoctorReport {
|
|
70
|
+
if (!isChecksReport(value)) return false;
|
|
71
|
+
const v = value as Partial<DoctorReport>;
|
|
72
|
+
return v.doctor === DOCTOR_VERSION && typeof v.at === "number" && Array.isArray(v.state) && v.state.every(isSection);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** A field of a value that may not be an object: undefined when it isn't one. */
|
|
76
|
+
const field = (v: unknown, key: string): unknown => (v as Record<string, unknown> | null | undefined)?.[key];
|
|
77
|
+
|
|
78
|
+
/** A section `doctorText` can print: a label, and lines with a label and a value in words. */
|
|
79
|
+
function isSection(s: unknown): boolean {
|
|
80
|
+
const lines = field(s, "lines");
|
|
81
|
+
return typeof field(s, "label") === "string" && Array.isArray(lines) && lines.every((l) => typeof field(l, "label") === "string" && typeof field(l, "value") === "string");
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* How long ago, in a person's words: "just now", "40 s ago", "12 min ago", "3 h ago", "2 days ago". A time after `now`
|
|
86
|
+
* reads as "just now".
|
|
87
|
+
*
|
|
88
|
+
* @claim "A time after `now` reads as" registry/ouro/ax/doctor.test.mts verify:testExists(registry/ouro/ax/doctor.test.mts::agoText says how long ago in a person's words, at each step's edges)
|
|
89
|
+
* @example
|
|
90
|
+
* agoText(Date.now() - 12 * 60_000, Date.now()); // "12 min ago"
|
|
91
|
+
*/
|
|
92
|
+
function agoText(at: number, now: number): string {
|
|
93
|
+
const s = Math.max(0, Math.round((now - at) / 1000));
|
|
94
|
+
if (s < 5) return "just now";
|
|
95
|
+
if (s < 120) return `${s} s ago`;
|
|
96
|
+
if (s < 120 * 60) return `${Math.round(s / 60)} min ago`;
|
|
97
|
+
if (s < 48 * 3600) return `${Math.round(s / 3600)} h ago`;
|
|
98
|
+
return `${Math.round(s / 86400)} days ago`;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** A state line as a person reads it: "Engine up, since 12 min ago", stuck and down in red, starting in yellow. */
|
|
102
|
+
function lineText(line: StateLine, now: number, width: number, style: TerminalStyle): string {
|
|
103
|
+
const p = paint(style);
|
|
104
|
+
const tint = line.state === "stuck" || line.state === "down" ? p.red : line.state === "starting" ? p.yellow : (s: string) => s;
|
|
105
|
+
const since = line.since != null ? p.dim(`, since ${agoText(line.since, now)}`) : "";
|
|
106
|
+
return ` ${line.label.padEnd(width)} ${tint(line.value)}${since}`;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* The report for a person: the checks' verdict on the first line (with the line under it that says what was not run),
|
|
111
|
+
* then what the doctor saw, section by section, then the problems, their fixes and the next steps, as `checksText`
|
|
112
|
+
* prints them. A section with no lines is left out.
|
|
113
|
+
*
|
|
114
|
+
* @claim "the checks' verdict on the first line" registry/ouro/ax/doctor.test.mts verify:testExists(registry/ouro/ax/doctor.test.mts::the text leads with the verdict, then the state by section, then the problems and their fixes)
|
|
115
|
+
* @claim "A section with no lines is left out" registry/ouro/ax/doctor.test.mts verify:testExists(registry/ouro/ax/doctor.test.mts::the text leads with the verdict, then the state by section, then the problems and their fixes)
|
|
116
|
+
* @example
|
|
117
|
+
* stdout.write(`${doctorText(report, terminalStyle(stdout, env), { command: "notes doctor", verbose })}\n`);
|
|
118
|
+
*/
|
|
119
|
+
function doctorText(report: DoctorReport, style: TerminalStyle, options: { verbose?: boolean; command?: string } = {}): string {
|
|
120
|
+
const p = paint(style);
|
|
121
|
+
const lines = checksText(report, style, options).split("\n");
|
|
122
|
+
const head = lines.indexOf("") === -1 ? lines.length : lines.indexOf("");
|
|
123
|
+
const width = Math.max(0, ...report.state.flatMap((s) => s.lines.map((l) => l.label.length)));
|
|
124
|
+
const state = report.state.filter((s) => s.lines.length).flatMap((s) => ["", p.bold(s.label), ...s.lines.map((l) => lineText(l, report.at, width, style))]);
|
|
125
|
+
return [...lines.slice(0, head), ...state, ...lines.slice(head)].join("\n");
|
|
126
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export { audienceLines, DEFAULT_HEADINGS, DRY_RUN_FLAG, effectAnnotations, namesLine, ONLY_YOU, privateResult, WHY_FLAG, WHY_PLACEHOLDER };
|
|
2
|
+
export type { Audience, Effect, EffectHeadings };
|
|
3
|
+
|
|
4
|
+
// The export list comes first because the shadcn CLI drops comments before a file's
|
|
5
|
+
// first statement, which would take the JSDoc below with it.
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Effect classes: a command either touches only the person's own space ("private") or reaches other people
|
|
9
|
+
* ("others"). Help groups commands under those headings, an "others" command needs `--why` and previews its
|
|
10
|
+
* audience before it acts, and its result says who can see it. `readOnly` marks reads, which change nothing.
|
|
11
|
+
*/
|
|
12
|
+
type Effect = "private" | "others";
|
|
13
|
+
|
|
14
|
+
interface EffectHeadings {
|
|
15
|
+
private: string;
|
|
16
|
+
others: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const DEFAULT_HEADINGS: EffectHeadings = Object.freeze({ private: "Only you see these", others: "Other people see these" });
|
|
20
|
+
|
|
21
|
+
/** Who can see an effect, in words a person reads: `{ only: true, who: "only you" }` or the people of a conversation. */
|
|
22
|
+
interface Audience {
|
|
23
|
+
only: boolean;
|
|
24
|
+
who: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const ONLY_YOU: Audience = Object.freeze({ only: true, who: "only you" });
|
|
28
|
+
|
|
29
|
+
/** The flag an "others" command takes: who asked, and what they said. */
|
|
30
|
+
const WHY_FLAG = "why";
|
|
31
|
+
const WHY_PLACEHOLDER = "<who asked you, and what they said>";
|
|
32
|
+
|
|
33
|
+
/** The flag that previews an "others" command's effect and audience without acting. */
|
|
34
|
+
const DRY_RUN_FLAG = "dry-run";
|
|
35
|
+
|
|
36
|
+
/** MCP tool annotations for an effect, as [the MCP specification](https://modelcontextprotocol.io/specification/2025-06-18/server/tools) defines them. */
|
|
37
|
+
function effectAnnotations(effect: Effect, readOnly: boolean): { readOnlyHint: boolean; destructiveHint: boolean; openWorldHint: boolean } {
|
|
38
|
+
return { readOnlyHint: readOnly, destructiveHint: effect === "others", openWorldHint: effect === "others" };
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* "Jo Park", "Jo Park and Ana Ruiz", "Jo Park, Ana Ruiz and 3 others".
|
|
43
|
+
*
|
|
44
|
+
* @claim "Ana Ruiz and 3 others" registry/ouro/ax/effects.test.mts verify:testExists(registry/ouro/ax/effects.test.mts::names read as a person would say them)
|
|
45
|
+
*/
|
|
46
|
+
function namesLine(names: readonly string[], max: number = 2): string {
|
|
47
|
+
if (names.length === 0) return "nobody";
|
|
48
|
+
if (names.length <= max) return names.length === 1 ? names[0]! : `${names.slice(0, -1).join(", ")} and ${names.at(-1)!}`;
|
|
49
|
+
const more = names.length - max;
|
|
50
|
+
return `${names.slice(0, max).join(", ")} and ${more} other${more === 1 ? "" : "s"}`;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* The audience preview an "others" action prints before it runs, and the line its result states.
|
|
55
|
+
* @example audienceLines({ doing: "Sending", done: "Sent", where: '"Design sync"', as: "the person", who: ["Jo Park", "Ana Ruiz"] })
|
|
56
|
+
*/
|
|
57
|
+
function audienceLines(a: { doing: string; done: string; where: string; as: string; who: readonly string[] | "everyone" }): { preview: string; result: string } {
|
|
58
|
+
const who = a.who === "everyone" ? `Everyone in ${a.where}` : namesLine(a.who);
|
|
59
|
+
return {
|
|
60
|
+
preview: `${a.doing} to ${a.where} as ${a.as}. ${who} will see it.`,
|
|
61
|
+
result: `${a.done} to ${a.where} as ${a.as}. ${who} can see it.`,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** The result line of a private action: what changed, and that nobody else saw it. */
|
|
66
|
+
function privateResult(what: string): string {
|
|
67
|
+
return `${what.replace(/[.\s]+$/, "")}. Only you see it; nothing was sent.`;
|
|
68
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
export { BASE_EXIT_CODES, defineExitCodes, FINDINGS_EXIT_CODE };
|
|
2
|
+
export type { ExitCode, ExitTable };
|
|
3
|
+
|
|
4
|
+
// The export list comes first because the shadcn CLI drops comments before a file's
|
|
5
|
+
// first statement, which would take the JSDoc below with it.
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* A tool's exit codes as one table: the overview, every command's footer, `help --json` and the MCP error shape read
|
|
9
|
+
* it, so the numbers never drift. Codes 0, 1 and 2 mean the same thing in every Ouro AX tool.
|
|
10
|
+
*
|
|
11
|
+
* @claim "so the numbers never drift" registry/ouro/ax/help.ts verify:fileLine(registry/ouro/ax/help.ts, /cli\.exits\.line\(\)/)
|
|
12
|
+
* @claim "mean the same thing in every Ouro AX tool" registry/ouro/ax/exit-codes.test.mts verify:testExists(registry/ouro/ax/exit-codes.test.mts::a gap, a renamed base code, a short table or a repeated name fails with the fix)
|
|
13
|
+
*/
|
|
14
|
+
interface ExitCode {
|
|
15
|
+
code: number;
|
|
16
|
+
/** A slug an error names its exit by, such as "usage" or "unavailable". */
|
|
17
|
+
name: string;
|
|
18
|
+
/** A few words for the one-line summary. */
|
|
19
|
+
short: string;
|
|
20
|
+
/** The full meaning, for `help exit-codes`. */
|
|
21
|
+
meaning: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const BASE_EXIT_CODES: readonly ExitCode[] = Object.freeze([
|
|
25
|
+
{ code: 0, name: "ok", short: "ok", meaning: "ok" },
|
|
26
|
+
{ code: 1, name: "error", short: "error", meaning: "error: the message says what to do" },
|
|
27
|
+
{ code: 2, name: "usage", short: "usage", meaning: "usage: a missing or wrong argument; nothing was done" },
|
|
28
|
+
]);
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The code a check or doctor tool declares beside the base codes: its checks ran and found a problem, with a fix
|
|
32
|
+
* beside it. A check that threw before finishing is a crash and exits with the base `error` code instead, so an agent tells "the
|
|
33
|
+
* tool found something" from "the tool broke" by the code alone.
|
|
34
|
+
*
|
|
35
|
+
* @claim "exits with the base `error` code instead" registry/ouro/ax/checks.test.mts verify:testExists(registry/ouro/ax/checks.test.mts::findings exit with the declared findings code and a check that couldn't run exits 1, never the same code)
|
|
36
|
+
*/
|
|
37
|
+
const FINDINGS_EXIT_CODE: ExitCode = Object.freeze({ code: 3, name: "findings", short: "findings", meaning: "findings: a check found a problem; its fix says what to do" });
|
|
38
|
+
|
|
39
|
+
interface ExitTable {
|
|
40
|
+
readonly codes: readonly ExitCode[];
|
|
41
|
+
/** The number for a name; throws for a name the table does not have, so a typo fails in tests, not in an agent's run. */
|
|
42
|
+
code(name: string): number;
|
|
43
|
+
/** Whether the table has a code by this name. */
|
|
44
|
+
has(name: string): boolean;
|
|
45
|
+
/** `Exit codes: 0 ok, 1 error, 2 usage, ...` */
|
|
46
|
+
line(): string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The tool's table: the base codes (their meanings may be reworded, never their names) then its own, numbered from 3
|
|
51
|
+
* with no gaps.
|
|
52
|
+
*
|
|
53
|
+
* @claim "numbered from 3 with" registry/ouro/ax/exit-codes.test.mts verify:testExists(registry/ouro/ax/exit-codes.test.mts::a gap, a renamed base code, a short table or a repeated name fails with the fix)
|
|
54
|
+
*/
|
|
55
|
+
function defineExitCodes(codes: readonly ExitCode[] = BASE_EXIT_CODES): ExitTable {
|
|
56
|
+
codes.forEach((entry, i) => {
|
|
57
|
+
if (entry.code !== i) throw new Error(`exit codes: code ${entry.code} is at position ${i}. Fix: number the codes 0, 1, 2, ... with no gaps.`);
|
|
58
|
+
const base = BASE_EXIT_CODES[i];
|
|
59
|
+
if (base && entry.name !== base.name) throw new Error(`exit codes: code ${i} is named "${entry.name}". Fix: name it "${base.name}", as every Ouro AX tool does.`);
|
|
60
|
+
});
|
|
61
|
+
if (codes.length < BASE_EXIT_CODES.length) throw new Error("exit codes: the table needs 0 ok, 1 error and 2 usage. Fix: start from BASE_EXIT_CODES.");
|
|
62
|
+
const names = new Map(codes.map((entry) => [entry.name, entry.code]));
|
|
63
|
+
if (names.size !== codes.length) throw new Error("exit codes: two codes share a name. Fix: give each code its own name.");
|
|
64
|
+
const frozen = Object.freeze(codes.map((entry) => Object.freeze({ ...entry })));
|
|
65
|
+
return {
|
|
66
|
+
codes: frozen,
|
|
67
|
+
code(name) {
|
|
68
|
+
const found = names.get(name);
|
|
69
|
+
if (found === undefined) throw new Error(`exit codes: no code named "${name}". Fix: one of ${[...names.keys()].join(", ")}.`);
|
|
70
|
+
return found;
|
|
71
|
+
},
|
|
72
|
+
has: (name) => names.has(name),
|
|
73
|
+
line: () => `Exit codes: ${frozen.map((entry) => `${entry.code} ${entry.short}`).join(", ")}.`,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
export { commandManifest, DEFAULT_WIDTH, definitionLines, flagLines, helpJson, renderCommand, renderOverview, wrap };
|
|
2
|
+
export type { CommandManifest, OverviewOptions };
|
|
3
|
+
|
|
4
|
+
// The export list comes first because the shadcn CLI drops comments before a file's
|
|
5
|
+
// first statement, which would take the JSDoc below with it.
|
|
6
|
+
|
|
7
|
+
import { argUsage, BUILTIN_FLAGS, flagsOf, flagUsage, inputSchema, invocation, usageOf, type Cli, type CommandDef, type JsonSchema } from "./ax-command.ts";
|
|
8
|
+
import { DRY_RUN_FLAG, WHY_FLAG } from "./effects.ts";
|
|
9
|
+
import { shellWord } from "./problem.ts";
|
|
10
|
+
import { voiceLines } from "./voice.ts";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Help from the definitions: a one-screen overview under the two effect headings, each command's details, and the same
|
|
14
|
+
* as JSON (`help --json`), which an agent parses instead of scraping text. Every line is wrapped to `width` columns.
|
|
15
|
+
*
|
|
16
|
+
* @claim "a one-screen overview under the two effect headings" registry/ouro/ax/help.test.mts verify:testExists(registry/ouro/ax/help.test.mts::the overview is the two headings, one line per command, and the exit codes)
|
|
17
|
+
* @claim "Every line is wrapped" registry/ouro/ax/help.test.mts verify:testExists(registry/ouro/ax/help.test.mts::a command's help is generated from its definition, and an others command says so first)
|
|
18
|
+
*/
|
|
19
|
+
const DEFAULT_WIDTH = 100;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Wraps text to `width` columns, every line indented; a word longer than a line stays whole.
|
|
23
|
+
*
|
|
24
|
+
* @claim "every line indented" registry/ouro/ax/help.test.mts verify:testExists(registry/ouro/ax/help.test.mts::wrap keeps long words whole and indents every line)
|
|
25
|
+
*/
|
|
26
|
+
function wrap(text: string, indent: number, first: number = indent, width: number = DEFAULT_WIDTH): [...string[], string] {
|
|
27
|
+
const lines: string[] = [];
|
|
28
|
+
let line = " ".repeat(first);
|
|
29
|
+
let empty = true;
|
|
30
|
+
for (const word of text.split(/\s+/).filter(Boolean)) {
|
|
31
|
+
if (!empty && line.length + 1 + word.length > width) {
|
|
32
|
+
lines.push(line);
|
|
33
|
+
line = " ".repeat(indent);
|
|
34
|
+
empty = true;
|
|
35
|
+
}
|
|
36
|
+
line += (empty ? "" : " ") + word;
|
|
37
|
+
empty = false;
|
|
38
|
+
}
|
|
39
|
+
return [...lines, line];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
interface OverviewOptions {
|
|
43
|
+
width?: number;
|
|
44
|
+
/** Added after the "others" heading, such as " (only when a human asked you to, with --why)". */
|
|
45
|
+
othersNote?: string;
|
|
46
|
+
/** Lines after the command lists; defaults to where details are, --json and the exit codes. */
|
|
47
|
+
footer?: readonly string[];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const listed = (cli: Cli) => cli.commands.filter((c) => !c.hidden && c !== cli.defaultCommand);
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Commands of one effect, one per row. A multi-word command ("draft set") shows under its first word once when the CLI
|
|
54
|
+
* gives that word a group summary, and by its whole name otherwise, so no row names a command that does not exist.
|
|
55
|
+
*
|
|
56
|
+
* @claim "by its whole name otherwise" registry/ouro/ax/help.test.mts verify:testExists(registry/ouro/ax/help.test.mts::a multi-word command with no group summary is listed by its whole name, never as its first word)
|
|
57
|
+
*/
|
|
58
|
+
function rows(cli: Cli, effect: "private" | "others"): { name: string; summary: string }[] {
|
|
59
|
+
const out: { name: string; summary: string }[] = [];
|
|
60
|
+
for (const c of listed(cli).filter((x) => x.effect === effect)) {
|
|
61
|
+
const head = c.name.split(" ")[0]!;
|
|
62
|
+
const group = cli.groups[head];
|
|
63
|
+
const name = group === undefined ? c.name : head;
|
|
64
|
+
if (out.some((r) => r.name === name)) continue;
|
|
65
|
+
out.push({ name, summary: group ?? c.summary });
|
|
66
|
+
}
|
|
67
|
+
return out;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* The overview: what the tool is, the commands under "Only you see these" and "Other people see these", the words only
|
|
72
|
+
* the person acts on, the footer. A tool defined with `command` shows its one command's usage and summary in place of
|
|
73
|
+
* the command list; a tool with a default command lists the default's usage, arguments and flags under its heading.
|
|
74
|
+
*
|
|
75
|
+
* @claim "the words only the person acts on" registry/ouro/ax/help.test.mts verify:testExists(registry/ouro/ax/help.test.mts::person-only words are listed in the overview and in help --json, with the reason and how the person does it)
|
|
76
|
+
* @claim "shows its one command's usage and summary" registry/ouro/ax/help.test.mts verify:testExists(registry/ouro/ax/help.test.mts::a one-command tool's overview and command help name the tool and its usage, never a command word)
|
|
77
|
+
* @claim "lists the default's usage, arguments and flags" registry/ouro/ax/help.test.mts verify:testExists(registry/ouro/ax/help.test.mts::a default command is listed in the overview under its own heading, with its arguments and flags, and never as a command word)
|
|
78
|
+
*/
|
|
79
|
+
function renderOverview(cli: Cli, options: OverviewOptions = {}): string {
|
|
80
|
+
const width = options.width ?? DEFAULT_WIDTH;
|
|
81
|
+
const footer = options.footer ?? [...wrap(`Output: --json on every command. ${cli.exits.line()} Errors: one line that says what to do instead.`, 0, 0, width), `Details: ${cli.single ? `${cli.name} --help` : `${cli.name} help <command>`}`];
|
|
82
|
+
if (cli.single) {
|
|
83
|
+
const cmd = cli.commands[0]!;
|
|
84
|
+
const heading = cmd.effect === "others" ? `${cli.headings.others}${options.othersNote ?? ""}` : cli.headings.private;
|
|
85
|
+
return [...cli.about, "", heading, ...columns(usageOf(cli, cmd), cmd.summary, width), "", ...footer, ""].join("\n");
|
|
86
|
+
}
|
|
87
|
+
const mine = rows(cli, "private");
|
|
88
|
+
const theirs = rows(cli, "others");
|
|
89
|
+
const pad = Math.max(...[...mine, ...theirs].map((r) => r.name.length)) + 2;
|
|
90
|
+
// A summary longer than the line wraps under itself, so no overview line is wider than `width`.
|
|
91
|
+
const line = (r: { name: string; summary: string }) => {
|
|
92
|
+
const [first, ...more] = wrap(r.summary, pad + 3, pad + 3, width);
|
|
93
|
+
return [` ${r.name.padEnd(pad)} ${first.slice(pad + 3)}`, ...more];
|
|
94
|
+
};
|
|
95
|
+
const theirsOnly = Object.keys(cli.personOnly);
|
|
96
|
+
const person = theirsOnly.length ? [...wrap(`Only the person does these, never you: ${theirsOnly.join(", ")}. Why and where: ${cli.name} help --json.`, 0, 0, width), ""] : [];
|
|
97
|
+
const def = cli.defaultCommand;
|
|
98
|
+
const defaultUnder = (effect: "private" | "others") => (def && !def.hidden && def.effect === effect ? defaultLines(cli, def, width) : []);
|
|
99
|
+
return [...cli.about, "", cli.headings.private, ...defaultUnder("private"), ...mine.flatMap(line), "", `${cli.headings.others}${options.othersNote ?? ""}`, ...defaultUnder("others"), ...theirs.flatMap(line), "", ...person, ...footer, ""].join("\n");
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** The default command's part of the overview: its usage and summary, then its arguments and flags with what they do. */
|
|
103
|
+
function defaultLines(cli: Cli, cmd: CommandDef, width: number): string[] {
|
|
104
|
+
return [...columns(usageOf(cli, cmd), cmd.summary, width), ...argLines(cli, cmd, width), ...flagLines(cli, cmd, width)];
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const COL = 34;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* `left` from column 2, `text` from column 34, wrapped.
|
|
111
|
+
*
|
|
112
|
+
* @claim "from column 34" registry/ouro/ax/help.ts verify:fileLine(registry/ouro/ax/help.ts, /const COL = 34;/)
|
|
113
|
+
*/
|
|
114
|
+
function columns(left: string, text: string, width: number): string[] {
|
|
115
|
+
if (left.length + 4 < COL) {
|
|
116
|
+
const [head, ...more] = wrap(text, COL, COL, width);
|
|
117
|
+
return [` ${left}`.padEnd(COL) + head.slice(COL), ...more];
|
|
118
|
+
}
|
|
119
|
+
return [...wrap(left, 4, 2, width), ...wrap(text, COL, COL, width)];
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** One line per flag: usage on the left, what it does on the right; the built-ins and the tool's own are left out. */
|
|
123
|
+
function flagLines(cli: Cli, cmd: CommandDef, width: number = DEFAULT_WIDTH): string[] {
|
|
124
|
+
return Object.entries(flagsOf(cli, cmd))
|
|
125
|
+
.filter(([name]) => !(name in BUILTIN_FLAGS) && !(name in cli.globalFlags))
|
|
126
|
+
.flatMap(([name, spec]) => columns(flagUsage(name, spec), `${spec.description}${spec.default === undefined ? "" : ` (default: ${typeof spec.default === "string" ? shellWord(spec.default) : String(spec.default)})`}${spec.required ? (spec.unless === undefined ? " Required." : ` Required unless ${(typeof spec.unless === "string" ? [spec.unless] : spec.unless).map((u) => `--${u}`).join(" or ")}.`) : ""}${spec.repeat ? " Repeat it for each value." : ""}${spec.stdin ? ' "-" reads it from stdin.' : ""}`, width));
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** One line per argument: its usage on the left, what it is on the right. */
|
|
130
|
+
function argLines(cli: Cli, cmd: CommandDef, width: number = DEFAULT_WIDTH): string[] {
|
|
131
|
+
return (cmd.args ?? []).flatMap((a) => columns(argUsage(a), `${a.description}${a.source ? ` "${cli.name} ${a.source}" lists them.` : ""}${a.stdin ? ' "-" reads it from stdin.' : ""}`, width));
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/** The generated part of a command's help: its usage from the definition, its arguments and its flags. */
|
|
135
|
+
function definitionLines(cli: Cli, cmd: CommandDef, width: number = DEFAULT_WIDTH): string[] {
|
|
136
|
+
return ["Definition", ...wrap(`${cli.name} ${usageOf(cli, cmd)}`, 4, 2, width), ...argLines(cli, cmd, width), ...flagLines(cli, cmd, width)];
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/** One command's whole help, from its definition alone. */
|
|
140
|
+
function renderCommand(cli: Cli, cmd: CommandDef, width: number = DEFAULT_WIDTH): string {
|
|
141
|
+
const lines = [
|
|
142
|
+
...(cmd.effect === "others" ? [...wrap(`${cli.headings.others}: run it only when a human asked you to, with --${WHY_FLAG}.`, 0, 0, width), ""] : []),
|
|
143
|
+
...wrap(`${invocation(cli, cmd)}: ${cmd.summary}`, 2, 0, width),
|
|
144
|
+
"",
|
|
145
|
+
...definitionLines(cli, cmd, width),
|
|
146
|
+
];
|
|
147
|
+
if (cmd.output) lines.push("", "--json", ...wrap(cmd.output, 4, 2, width));
|
|
148
|
+
if (cmd.examples?.length) lines.push("", "Examples", ...cmd.examples.map((x) => ` ${x}`));
|
|
149
|
+
lines.push("", ...wrap(cli.exits.line(), 0, 0, width), "");
|
|
150
|
+
return lines.join("\n");
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
interface CommandManifest {
|
|
154
|
+
name: string;
|
|
155
|
+
aliases: readonly string[];
|
|
156
|
+
effect: "private" | "others";
|
|
157
|
+
whoSees: string;
|
|
158
|
+
protocol?: true;
|
|
159
|
+
readOnly: boolean;
|
|
160
|
+
needsWhy: boolean;
|
|
161
|
+
/** Whether `--dry-run` previews it (an "others" command with a plan()). */
|
|
162
|
+
dryRun: boolean;
|
|
163
|
+
/** Whether a run() executes it; false for a declaration that only documents a command another path runs. */
|
|
164
|
+
runs: boolean;
|
|
165
|
+
summary: string;
|
|
166
|
+
usage: string;
|
|
167
|
+
inputSchema: JsonSchema;
|
|
168
|
+
output: string | null;
|
|
169
|
+
examples: readonly string[];
|
|
170
|
+
hidden: boolean;
|
|
171
|
+
/** `"self"` on a command an agent runs only on its own item (`--agent`); left out otherwise. */
|
|
172
|
+
scope?: "self";
|
|
173
|
+
/**
|
|
174
|
+
* `true` on the word-less command: the one command of a tool defined with `command`, or the default command of one
|
|
175
|
+
* defined with both.
|
|
176
|
+
*/
|
|
177
|
+
single?: true;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/** One command as data. */
|
|
181
|
+
function commandManifest(cli: Cli, cmd: CommandDef): CommandManifest {
|
|
182
|
+
const flags = flagsOf(cli, cmd);
|
|
183
|
+
return {
|
|
184
|
+
name: cmd.name,
|
|
185
|
+
aliases: cmd.aliases ?? [],
|
|
186
|
+
effect: cmd.effect,
|
|
187
|
+
whoSees: cmd.effect === "others" ? cli.headings.others : cli.headings.private,
|
|
188
|
+
readOnly: cmd.readOnly === true,
|
|
189
|
+
needsWhy: flags[WHY_FLAG]?.required === true,
|
|
190
|
+
dryRun: DRY_RUN_FLAG in flags && typeof cmd.plan === "function",
|
|
191
|
+
runs: typeof cmd.run === "function" && cmd.loose !== true,
|
|
192
|
+
summary: cmd.summary,
|
|
193
|
+
usage: `${cli.name} ${usageOf(cli, cmd)}`,
|
|
194
|
+
inputSchema: inputSchema(cli, cmd),
|
|
195
|
+
output: cmd.output ?? null,
|
|
196
|
+
examples: cmd.examples ?? [],
|
|
197
|
+
hidden: cmd.hidden === true,
|
|
198
|
+
...(cmd.protocol ? { protocol: true as const } : {}),
|
|
199
|
+
...(cmd.self ? { scope: "self" as const } : {}),
|
|
200
|
+
...(cmd === cli.defaultCommand ? { single: true as const } : {}),
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* The help as data: the tool, its headings, the commands, the words only the person acts on (`personOnly`: name, reason
|
|
206
|
+
* and how), the exit codes, the tool's fixed voice lines (for a checker
|
|
207
|
+
* that looks for them in an agent's output) and the one error shape.
|
|
208
|
+
*/
|
|
209
|
+
function helpJson(cli: Cli) {
|
|
210
|
+
return {
|
|
211
|
+
tool: cli.name,
|
|
212
|
+
about: cli.about,
|
|
213
|
+
effects: { private: cli.headings.private, others: cli.headings.others },
|
|
214
|
+
commands: cli.commands.map((c) => commandManifest(cli, c)),
|
|
215
|
+
personOnly: Object.entries(cli.personOnly).map(([name, p]) => ({ name, reason: p.reason, how: p.how })),
|
|
216
|
+
exitCodes: cli.exits.codes,
|
|
217
|
+
voice: voiceLines(cli.voice),
|
|
218
|
+
errorShape: { error: { code: "<slug>", exit: "<exit code>", thing: "<command or flag>", problem: "<what's wrong>", fix: "<exact code to run instead, or null>", message: "<thing>: <problem>. Fix: <fix>." } },
|
|
219
|
+
};
|
|
220
|
+
}
|