@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,89 @@
|
|
|
1
|
+
// The one edit `task_update` makes to a track card: when a task's status changes, that task's row in the track's Tasks
|
|
2
|
+
// table gets its new `State`. The documented table (`track-card-format`) is
|
|
3
|
+
//
|
|
4
|
+
// | Slug | State | Repos | Tracker link | Doing doc |
|
|
5
|
+
// |------|-------|-------|--------------|-----------|
|
|
6
|
+
// | `api-validation-layer` | drafting | ... | ... | ... |
|
|
7
|
+
//
|
|
8
|
+
// so the row is found by a header that names the `Slug` and `State` columns and a first cell that is the task's slug
|
|
9
|
+
// (backticks optional), and only the `State` cell is rewritten, byte for byte elsewhere, line endings kept. A card with
|
|
10
|
+
// no such table, or no such row, is left alone: the edit never invents a table, a row or a column.
|
|
11
|
+
|
|
12
|
+
function cells(line) {
|
|
13
|
+
const trimmed = line.trim()
|
|
14
|
+
if (!trimmed.startsWith("|")) return null
|
|
15
|
+
return trimmed.replace(/^\|/u, "").replace(/\|$/u, "").split("|")
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const SEPARATOR = /^\s*\|?\s*:?-{2,}:?\s*(\|\s*:?-{2,}:?\s*)*\|?\s*$/u
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* `trackText` with the `State` cell of `slug`'s row set to `status`, or null when nothing changed (no documented table,
|
|
22
|
+
* no row for the slug, or the cell already says it).
|
|
23
|
+
*/
|
|
24
|
+
export function setTaskState(trackText, slug, status) {
|
|
25
|
+
const eol = trackText.includes("\r\n") ? "\r\n" : "\n"
|
|
26
|
+
const lines = trackText.split(/\r?\n/u)
|
|
27
|
+
let slugColumn = -1
|
|
28
|
+
let stateColumn = -1
|
|
29
|
+
let fenced = false
|
|
30
|
+
for (let index = 0; index < lines.length; index += 1) {
|
|
31
|
+
const line = lines[index]
|
|
32
|
+
if (/^\s{0,3}(```|~~~)/u.test(line)) fenced = !fenced
|
|
33
|
+
const row = fenced ? null : cells(line)
|
|
34
|
+
if (row === null) {
|
|
35
|
+
slugColumn = -1
|
|
36
|
+
stateColumn = -1
|
|
37
|
+
continue
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const names = row.map((cell) => cell.trim().toLowerCase())
|
|
41
|
+
if (slugColumn === -1 && names.includes("slug") && names.includes("state") && SEPARATOR.test(lines[index + 1] ?? "")) {
|
|
42
|
+
slugColumn = names.indexOf("slug")
|
|
43
|
+
stateColumn = names.indexOf("state")
|
|
44
|
+
index += 1
|
|
45
|
+
continue
|
|
46
|
+
}
|
|
47
|
+
if (slugColumn === -1 || SEPARATOR.test(line) || row.length <= Math.max(slugColumn, stateColumn)) continue
|
|
48
|
+
if (row[slugColumn].trim().replace(/^`+|`+$/gu, "") !== slug) continue
|
|
49
|
+
if (row[stateColumn].trim() === status) return null
|
|
50
|
+
const lead = line.match(/^\s*/u)[0]
|
|
51
|
+
row[stateColumn] = ` ${status} `
|
|
52
|
+
lines[index] = `${lead}|${row.join("|")}${line.trimEnd().endsWith("|") ? "|" : ""}`
|
|
53
|
+
return lines.join(eol)
|
|
54
|
+
}
|
|
55
|
+
return null
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Move only local links in the task's structured row.
|
|
59
|
+
export function setTaskArchiveLinks(trackText, slug) {
|
|
60
|
+
const lines = trackText.split(/(?<=\n)/u)
|
|
61
|
+
let slugColumn = -1
|
|
62
|
+
let fenced = false
|
|
63
|
+
for (let index = 0; index < lines.length; index += 1) {
|
|
64
|
+
const line = lines[index]
|
|
65
|
+
if (/^\s{0,3}(```|~~~)/u.test(line)) fenced = !fenced
|
|
66
|
+
const row = fenced ? null : cells(line)
|
|
67
|
+
if (row === null) { slugColumn = -1; continue }
|
|
68
|
+
const names = row.map((cell) => cell.trim().toLowerCase())
|
|
69
|
+
if (slugColumn === -1 && names.includes("slug") && names.includes("state") && SEPARATOR.test(lines[index + 1] ?? "")) {
|
|
70
|
+
slugColumn = names.indexOf("slug")
|
|
71
|
+
index += 1
|
|
72
|
+
continue
|
|
73
|
+
}
|
|
74
|
+
if (slugColumn === -1 || row.length <= slugColumn ||
|
|
75
|
+
row[slugColumn].trim().replace(/^`+|`+$/gu, "") !== slug) continue
|
|
76
|
+
const next = line.replace(/(\[[^\]]*\]\()(<[^>\r\n]+>|[^\s)]+)([^)]*\))/gu, (whole, open, href, close) => {
|
|
77
|
+
const angled = href.startsWith("<")
|
|
78
|
+
const raw = angled ? href.slice(1,-1) : href
|
|
79
|
+
const dot = raw.startsWith("./") ? "./" : ""
|
|
80
|
+
const target = raw.slice(dot.length)
|
|
81
|
+
return target.startsWith(`${slug}/`)
|
|
82
|
+
? `${open}${angled ? "<" : ""}${dot}_archive/${target}${angled ? ">" : ""}${close}` : whole
|
|
83
|
+
})
|
|
84
|
+
if (next === line) return null
|
|
85
|
+
lines[index] = next
|
|
86
|
+
return lines.join("")
|
|
87
|
+
}
|
|
88
|
+
return null
|
|
89
|
+
}
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
// Runtime CRUD tools for `track.md` cards — track_create, track_update.
|
|
2
|
+
//
|
|
3
|
+
// On-disk layout: `<root>/<slug>/track.md`. Schema documented in
|
|
4
|
+
// `plugins/desk/skills/track-card-format/SKILL.md` (schema_version 1).
|
|
5
|
+
|
|
6
|
+
import * as path from "node:path"
|
|
7
|
+
import { spawnSync } from "node:child_process"
|
|
8
|
+
import {
|
|
9
|
+
nowIso,
|
|
10
|
+
readMarkdown,
|
|
11
|
+
writeMarkdown,
|
|
12
|
+
pathExists,
|
|
13
|
+
} from "../util/fm.js"
|
|
14
|
+
import { deskRelativePath, resolveWriteTarget } from "../util/paths.js"
|
|
15
|
+
import { objectInput } from "../util/object-input.js"
|
|
16
|
+
import { isGitRepository, hasUnstagedWork, stagePaths, commitPaths } from "../util/git-stage.js"
|
|
17
|
+
import { commitFailure, commitRoute, withNext } from "../util/route-around.js"
|
|
18
|
+
import { schedulePush as schedulePushDefault } from "../runtime/sync-worker.js"
|
|
19
|
+
import {
|
|
20
|
+
validateTrackName,
|
|
21
|
+
validateScope,
|
|
22
|
+
operatorNames,
|
|
23
|
+
describeNameRejection,
|
|
24
|
+
} from "../desk/naming.js"
|
|
25
|
+
|
|
26
|
+
// Optional fields a caller may supply at create time.
|
|
27
|
+
const OPTIONAL_TRACK_FIELDS = [
|
|
28
|
+
"predecessor",
|
|
29
|
+
"adopted_from",
|
|
30
|
+
"planning",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
// Every field track_create/track_update read off `input`, kept next to each
|
|
34
|
+
// handler so a field added to its destructuring or to OPTIONAL_TRACK_FIELDS
|
|
35
|
+
// is a field added here in the same diff. __tests__/tool_schema_parity.test.js
|
|
36
|
+
// checks these against the tool's declared schema in tool-schemas.js.
|
|
37
|
+
export const TRACK_CREATE_FIELDS = ["slug", "title", "scope", "status", "body", ...OPTIONAL_TRACK_FIELDS]
|
|
38
|
+
export const TRACK_UPDATE_FIELDS = ["slug", "frontmatter", "body_append"]
|
|
39
|
+
|
|
40
|
+
function relPath(deskRoot, absPath) {
|
|
41
|
+
return deskRelativePath(deskRoot, absPath)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// On a Git desk, a track tool stages the track.md it writes (M4-5 fix round
|
|
45
|
+
// 4), so the move tools treat that write as the current tidy's work in
|
|
46
|
+
// progress rather than another session's. It stages only a file that held
|
|
47
|
+
// no unstaged changes before the write, so it never adopts another
|
|
48
|
+
// session's edit. Staging is best-effort: if `git add` fails the write still
|
|
49
|
+
// stands, and a later move refuses that track.md, which is the safe side.
|
|
50
|
+
// `spawnGit` is a test-only seam over `spawnSync`.
|
|
51
|
+
function stagingAllowed(filePath, spawnGit) {
|
|
52
|
+
const dir = path.dirname(filePath)
|
|
53
|
+
return isGitRepository(dir, spawnGit) && !hasUnstagedWork(dir, [path.basename(filePath)], spawnGit)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// After staging, commits exactly the one file staged (M4-6 Part 2: every
|
|
57
|
+
// write tool commits its own paths synchronously; push is a later part).
|
|
58
|
+
// A stage failure (e.g. a concurrent call holding .git/index.lock) leaves
|
|
59
|
+
// nothing to commit, and neither it nor a commit failure ever throws away
|
|
60
|
+
// the write or the tool's own result — either comes back as this
|
|
61
|
+
// function's return value, which a caller attaches to its result under
|
|
62
|
+
// `commit` only on failure, so a normal, silent success stays byte-identical
|
|
63
|
+
// to today's response shape.
|
|
64
|
+
function stageAndCommitTrackCard(filePath, message, spawnGit, deskRoot) {
|
|
65
|
+
const dir = path.dirname(filePath)
|
|
66
|
+
const basename = path.basename(filePath)
|
|
67
|
+
const staged = stagePaths(dir, [basename], spawnGit)
|
|
68
|
+
if (!staged.ok) return { status: "failed", reason: staged.stderr, route_around: commitRoute({ root: dir, paths: [basename], message, readback: "absent", deskRoot }) }
|
|
69
|
+
const committed = commitPaths(dir, [basename], message, spawnGit)
|
|
70
|
+
return committed.ok ? undefined : commitFailure({ root: dir, paths: [basename], message, committed, deskRoot })
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* track_create
|
|
75
|
+
*
|
|
76
|
+
* Input:
|
|
77
|
+
* {
|
|
78
|
+
* slug: string, // required — validated, see Errors
|
|
79
|
+
* title: string, // required
|
|
80
|
+
* scope: string, // required — one line, at most 240 characters,
|
|
81
|
+
* // in the form "<what belongs>; not <what doesn't>"
|
|
82
|
+
* status?: string, // default "active"
|
|
83
|
+
* body?: string,
|
|
84
|
+
* ...optional fields per track-card schema
|
|
85
|
+
* }
|
|
86
|
+
*
|
|
87
|
+
* Side effects: creates `<root>/<slug>/track.md` (and parent dir), and
|
|
88
|
+
* stages it on a Git desk.
|
|
89
|
+
*
|
|
90
|
+
* Errors:
|
|
91
|
+
* - refuses if `<root>/<slug>/track.md` already exists.
|
|
92
|
+
* - refuses `slug` that isn't a valid outcome name per `validateTrackName`
|
|
93
|
+
* (see `desk/naming.js`): wrong shape, too long, prompt-like,
|
|
94
|
+
* credential-like, a catch-all name, or named after the operator.
|
|
95
|
+
* - refuses a missing or invalid `scope` per `validateScope`.
|
|
96
|
+
*
|
|
97
|
+
* Returns: { status: "created", path }
|
|
98
|
+
*/
|
|
99
|
+
export async function track_create({ deskRoot, input, person = null, search, spawnGit = spawnSync, schedulePush = schedulePushDefault }) {
|
|
100
|
+
const values = input ?? {}
|
|
101
|
+
const { slug, title } = values
|
|
102
|
+
if (!Object.hasOwn(values, "slug")) {
|
|
103
|
+
throw Object.assign(new Error("track_create: Pass `slug` as a string: `slug` is required (string)"), { code: "track_create_slug_is_required_string" })
|
|
104
|
+
}
|
|
105
|
+
if (!title || typeof title !== "string") {
|
|
106
|
+
throw Object.assign(new Error("track_create: Pass `title` as a string: `title` is required (string)"), { code: "track_create_title_is_required_string" })
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const filePath = await resolveWriteTarget({
|
|
110
|
+
deskRoot,
|
|
111
|
+
person,
|
|
112
|
+
segments: [slug, "track.md"],
|
|
113
|
+
})
|
|
114
|
+
|
|
115
|
+
// Path/segment/alias safety (above) is a tool-misuse concern and takes
|
|
116
|
+
// precedence over naming/scope content rules, which are business rules
|
|
117
|
+
// evaluated once the target path itself is known-safe.
|
|
118
|
+
const nameResult = validateTrackName(slug, {
|
|
119
|
+
operatorNames: operatorNames(deskRoot),
|
|
120
|
+
})
|
|
121
|
+
if (!nameResult.ok) {
|
|
122
|
+
throw Object.assign(new Error(
|
|
123
|
+
`track_create: Pass a valid value: invalid slug: ${describeNameRejection(nameResult)}`), { code: "track_create_invalid_slug" })
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const scopeResult = validateScope(values.scope)
|
|
127
|
+
if (!scopeResult.ok) {
|
|
128
|
+
throw Object.assign(new Error(`track_create: Pass a valid value: invalid \`scope\`: ${scopeResult.hint}`), { code: "track_create_invalid_scope" })
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (await pathExists(filePath)) {
|
|
132
|
+
throw Object.assign(new Error(
|
|
133
|
+
`track_create: Choose another name: track already exists at ${relPath(deskRoot, filePath)}`), { code: "track_create_track_already_exists_at" })
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const ts = nowIso()
|
|
137
|
+
const data = {
|
|
138
|
+
schema_version: 1,
|
|
139
|
+
title,
|
|
140
|
+
status: values.status ?? "active",
|
|
141
|
+
created: ts,
|
|
142
|
+
updated: ts,
|
|
143
|
+
scope: values.scope,
|
|
144
|
+
}
|
|
145
|
+
for (const k of OPTIONAL_TRACK_FIELDS) {
|
|
146
|
+
if (values[k] !== undefined) data[k] = values[k]
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
await writeMarkdown(filePath, data, values.body ?? "")
|
|
150
|
+
let commit
|
|
151
|
+
if (isGitRepository(path.dirname(filePath), spawnGit)) {
|
|
152
|
+
commit = stageAndCommitTrackCard(filePath, `track_create: ${slug}`, spawnGit, deskRoot)
|
|
153
|
+
if (!commit) schedulePush({ root: deskRoot })
|
|
154
|
+
}
|
|
155
|
+
search?.noteChange(relPath(deskRoot, filePath))
|
|
156
|
+
const result = { status: "created", path: relPath(deskRoot, filePath) }
|
|
157
|
+
if (commit) result.commit = commit
|
|
158
|
+
return withNext(result)
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* track_update
|
|
163
|
+
*
|
|
164
|
+
* Input:
|
|
165
|
+
* {
|
|
166
|
+
* slug: string,
|
|
167
|
+
* frontmatter?: object, // may set `scope` — validated, see Errors; a
|
|
168
|
+
* // JSON-string object is parsed, anything else
|
|
169
|
+
* // is refused before the card is touched;
|
|
170
|
+
* // `slug` itself is never re-validated, so an
|
|
171
|
+
* // update to a track named before these rules
|
|
172
|
+
* // existed still works
|
|
173
|
+
* body_append?: string,
|
|
174
|
+
* }
|
|
175
|
+
*
|
|
176
|
+
* Side effects: rewrites `<root>/<slug>/track.md` in place, and on a Git
|
|
177
|
+
* desk stages it when it held no unstaged changes before the write.
|
|
178
|
+
*
|
|
179
|
+
* Preserves: `schema_version`, `created`. Always refreshes `updated`.
|
|
180
|
+
*
|
|
181
|
+
* Errors:
|
|
182
|
+
* - refuses if the track doesn't exist.
|
|
183
|
+
* - refuses an invalid `frontmatter.scope` per `validateScope`, when the
|
|
184
|
+
* caller sets it; an update that doesn't touch `scope` is unaffected.
|
|
185
|
+
*
|
|
186
|
+
* Returns: { status: "updated", path }
|
|
187
|
+
*/
|
|
188
|
+
export async function track_update({ deskRoot, input, person = null, search, spawnGit = spawnSync, schedulePush = schedulePushDefault }) {
|
|
189
|
+
const values = input ?? {}
|
|
190
|
+
const { slug, body_append } = values
|
|
191
|
+
if (!Object.hasOwn(values, "slug")) {
|
|
192
|
+
throw Object.assign(new Error("track_update: Pass `slug`: `slug` is required"), { code: "track_update_slug_is_required" })
|
|
193
|
+
}
|
|
194
|
+
const frontmatter = objectInput(values.frontmatter, { tool: "track_update", field: "frontmatter" })
|
|
195
|
+
|
|
196
|
+
if (frontmatter && Object.hasOwn(frontmatter, "scope")) {
|
|
197
|
+
const scopeResult = validateScope(frontmatter.scope)
|
|
198
|
+
if (!scopeResult.ok) {
|
|
199
|
+
throw Object.assign(new Error(`track_update: Pass a valid value: invalid \`scope\`: ${scopeResult.hint}`), { code: "track_update_invalid_scope" })
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
const filePath = await resolveWriteTarget({
|
|
204
|
+
deskRoot,
|
|
205
|
+
person,
|
|
206
|
+
segments: [slug, "track.md"],
|
|
207
|
+
})
|
|
208
|
+
if (!(await pathExists(filePath))) {
|
|
209
|
+
throw Object.assign(new Error(
|
|
210
|
+
`track_update: Check the track and slug, then try again: track does not exist at ${relPath(deskRoot, filePath)}`), { code: "track_update_track_does_not_exist_at" })
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
const existing = await readMarkdown(filePath)
|
|
214
|
+
const merged = { ...existing.data, ...(frontmatter ?? {}) }
|
|
215
|
+
|
|
216
|
+
if (existing.data.schema_version !== undefined) {
|
|
217
|
+
merged.schema_version = existing.data.schema_version
|
|
218
|
+
} else {
|
|
219
|
+
merged.schema_version = 1
|
|
220
|
+
}
|
|
221
|
+
if (existing.data.created !== undefined) {
|
|
222
|
+
merged.created = existing.data.created
|
|
223
|
+
}
|
|
224
|
+
merged.updated = nowIso()
|
|
225
|
+
|
|
226
|
+
let newBody = existing.content
|
|
227
|
+
if (typeof body_append === "string" && body_append.length > 0) {
|
|
228
|
+
const sep = newBody.endsWith("\n\n") || newBody.length === 0 ? "" : "\n\n"
|
|
229
|
+
newBody = `${newBody}${sep}${body_append}`
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
const stage = stagingAllowed(filePath, spawnGit)
|
|
233
|
+
await writeMarkdown(filePath, merged, newBody)
|
|
234
|
+
const commit = stage ? stageAndCommitTrackCard(filePath, `track_update: ${slug}`, spawnGit, deskRoot) : undefined
|
|
235
|
+
if (stage && !commit) schedulePush({ root: deskRoot })
|
|
236
|
+
search?.noteChange(relPath(deskRoot, filePath))
|
|
237
|
+
const result = { status: "updated", path: relPath(deskRoot, filePath) }
|
|
238
|
+
if (commit) result.commit = commit
|
|
239
|
+
return withNext(result)
|
|
240
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const fs = require("node:fs");
|
|
4
|
+
const path = require("node:path");
|
|
5
|
+
|
|
6
|
+
const SESSION = /^agency-plugin-[A-Za-z0-9_-]+\.p[1-9][0-9]*$/u;
|
|
7
|
+
const SOURCE_ROOT = /^root-[0-9]+$/u;
|
|
8
|
+
|
|
9
|
+
// Only the current Agency composition is authoritative; never walk ancestors
|
|
10
|
+
// or inspect neighboring sessions. Numbered roots preserve acquisition order.
|
|
11
|
+
function agencySessionPluginParents(pluginRoot) {
|
|
12
|
+
const parent = path.dirname(path.resolve(pluginRoot));
|
|
13
|
+
const numbered = SOURCE_ROOT.test(path.basename(parent));
|
|
14
|
+
const container = numbered ? path.dirname(parent) : parent;
|
|
15
|
+
if (!SESSION.test(path.basename(container))) return null;
|
|
16
|
+
if (!numbered) return [container];
|
|
17
|
+
try {
|
|
18
|
+
return fs.readdirSync(container, { withFileTypes: true })
|
|
19
|
+
.filter(entry => entry.isDirectory() && SOURCE_ROOT.test(entry.name))
|
|
20
|
+
.sort((a, b) => Number(a.name.slice(5)) - Number(b.name.slice(5)))
|
|
21
|
+
.map(entry => path.join(container, entry.name));
|
|
22
|
+
} catch {
|
|
23
|
+
const error = Object.assign(new Error(`desk-mcp: Check that the Agency session composition can be read: Agency session composition cannot be read: ${container}. Desk does not fall back to another desk.`), { code: "agency_session.cjs_desk_mcp_check_that_the" });
|
|
24
|
+
Object.assign(error, { code: "DESK_ROOT_UNAVAILABLE", path: container, source: "agency-session", problem: "cannot be read", tried: [] });
|
|
25
|
+
throw error;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
module.exports = { agencySessionPluginParents };
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
// Rewrites the relative Markdown links in one file for a folder move, touching only the destination spans.
|
|
2
|
+
// Paths are desk-relative and posix. Pure: text in, text out.
|
|
3
|
+
import { extractMarkdownLinks } from "./markdown-links.cjs"
|
|
4
|
+
|
|
5
|
+
const SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*:/u
|
|
6
|
+
const PERCENT_ESCAPE = /%[0-9A-Fa-f]{2}/u
|
|
7
|
+
const UNWRITABLE_RAW = /[\u0000-\u001f\u007f<>\\#?]/u
|
|
8
|
+
|
|
9
|
+
const segments = (dir) => (dir === "." ? [] : dir.split("/"))
|
|
10
|
+
const dirOf = (file) => (file.includes("/") ? file.slice(0, file.lastIndexOf("/")) : ".")
|
|
11
|
+
const under = (target, prefix) => target === prefix || target.startsWith(`${prefix}/`)
|
|
12
|
+
const moved = (target, sourcePrefix, destinationPrefix) =>
|
|
13
|
+
under(target, sourcePrefix) ? destinationPrefix + target.slice(sourcePrefix.length) : target
|
|
14
|
+
|
|
15
|
+
function normalize(dir, rel) {
|
|
16
|
+
const out = []
|
|
17
|
+
for (const part of [...segments(dir), ...rel.split("/")]) {
|
|
18
|
+
if (part === "" || part === ".") continue
|
|
19
|
+
if (part === "..") {
|
|
20
|
+
if (out.length && out[out.length - 1] !== "..") out.pop()
|
|
21
|
+
else out.push("..")
|
|
22
|
+
} else out.push(part)
|
|
23
|
+
}
|
|
24
|
+
return out.join("/") || "."
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function relativeFrom(fromDir, to) {
|
|
28
|
+
const from = segments(fromDir), target = segments(to)
|
|
29
|
+
let common = 0
|
|
30
|
+
while (common < from.length && common < target.length && from[common] === target[common]) common++
|
|
31
|
+
return [...from.slice(common).map(() => ".."), ...target.slice(common)].join("/") || "."
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function decodeSegment(segment) {
|
|
35
|
+
try { return decodeURIComponent(segment) } catch { return segment }
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function encodeSegment(segment, percentForm) {
|
|
39
|
+
if (!percentForm) return segment
|
|
40
|
+
return encodeURIComponent(segment).replace(/[!'()*]/gu, (char) => `%${char.charCodeAt(0).toString(16).toUpperCase()}`)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function writableRaw(segment, angle) {
|
|
44
|
+
if (UNWRITABLE_RAW.test(segment) || PERCENT_ESCAPE.test(segment)) return false
|
|
45
|
+
return angle || !/[\s()]/u.test(segment)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Returns the new destination text, `null` when the link needs no change, or `{ reason }` when it cannot be written.
|
|
49
|
+
function relinkDestination(link, { filePath, oldPath, sourcePrefix, destinationPrefix }) {
|
|
50
|
+
const destination = link.destination
|
|
51
|
+
if (destination === "" || SCHEME.test(destination) || destination.startsWith("#") ||
|
|
52
|
+
destination.startsWith("?") || destination.startsWith("/")) return null
|
|
53
|
+
const cut = destination.search(/[?#]/u)
|
|
54
|
+
const pathPart = cut === -1 ? destination : destination.slice(0, cut)
|
|
55
|
+
const suffix = cut === -1 ? "" : destination.slice(cut)
|
|
56
|
+
const rawParts = pathPart.split("/")
|
|
57
|
+
const decodedParts = rawParts.map(decodeSegment)
|
|
58
|
+
const target = normalize(dirOf(oldPath), decodedParts.join("/"))
|
|
59
|
+
const relocated = moved(target, sourcePrefix, destinationPrefix)
|
|
60
|
+
if (relocated === target && filePath === oldPath) return null
|
|
61
|
+
if (relocated === ".." || relocated.startsWith("../")) return { reason: "the target is outside the desk after the move" }
|
|
62
|
+
if (link.destination !== link.raw) return { reason: "the destination uses backslash or entity escapes, so it was not rewritten" }
|
|
63
|
+
|
|
64
|
+
let rel = relativeFrom(dirOf(filePath), relocated)
|
|
65
|
+
if (pathPart.endsWith("/") && !rel.endsWith("/")) rel += "/"
|
|
66
|
+
const percentForm = PERCENT_ESCAPE.test(pathPart)
|
|
67
|
+
const rawByDecoded = new Map(decodedParts.map((decoded, index) => [decoded, rawParts[index]]))
|
|
68
|
+
const out = []
|
|
69
|
+
for (const part of rel.split("/")) {
|
|
70
|
+
if (part === "" || part === "." || part === "..") { out.push(part); continue }
|
|
71
|
+
if (rawByDecoded.has(part)) { out.push(rawByDecoded.get(part)); continue }
|
|
72
|
+
if (!percentForm && !writableRaw(part, link.angle)) {
|
|
73
|
+
return { reason: `the new path needs a character the original form cannot hold (${JSON.stringify(part)})` }
|
|
74
|
+
}
|
|
75
|
+
out.push(encodeSegment(part, percentForm))
|
|
76
|
+
}
|
|
77
|
+
const next = out.join("/") + suffix
|
|
78
|
+
return next === link.raw ? null : next
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Rewrites every relative link in `text` for a move of `sourcePrefix` to `destinationPrefix`. `filePath` is the file's
|
|
83
|
+
* desk-relative path after the move. Returns `{ text, rewritten, unresolved }`; `text` is the input string when nothing changed.
|
|
84
|
+
*/
|
|
85
|
+
export function rewriteForMove({ text, filePath, sourcePrefix, destinationPrefix }) {
|
|
86
|
+
if (typeof text !== "string") throw Object.assign(new TypeError("Pass the file's text to rewriteForMove: rewriteForMove requires the file's text"), { code: "archive_links_pass_the_file_s_text" })
|
|
87
|
+
const oldPath = under(filePath, destinationPrefix)
|
|
88
|
+
? sourcePrefix + filePath.slice(destinationPrefix.length) : filePath
|
|
89
|
+
const parsed = extractMarkdownLinks(text)
|
|
90
|
+
if (parsed.diagnostics.some((diagnostic) => diagnostic.code === "parse_budget_exceeded")) {
|
|
91
|
+
return { text, rewritten: 0, unresolved: [{ destination: null, reason: "the link parser ran out of work budget, so this file's links were not checked" }] }
|
|
92
|
+
}
|
|
93
|
+
const edits = [], unresolved = []
|
|
94
|
+
for (const link of parsed.links) {
|
|
95
|
+
const result = relinkDestination(link, { filePath, oldPath, sourcePrefix, destinationPrefix })
|
|
96
|
+
if (result === null) continue
|
|
97
|
+
if (typeof result === "string") edits.push({ start: link.start, end: link.end, text: result })
|
|
98
|
+
else unresolved.push({ destination: link.raw, reason: result.reason })
|
|
99
|
+
}
|
|
100
|
+
let next = text
|
|
101
|
+
for (const edit of edits.sort((left, right) => right.start - left.start)) {
|
|
102
|
+
next = next.slice(0, edit.start) + edit.text + next.slice(edit.end)
|
|
103
|
+
}
|
|
104
|
+
return { text: next, rewritten: edits.length, unresolved }
|
|
105
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { existsSync } from "node:fs"
|
|
2
|
+
import * as path from "node:path"
|
|
3
|
+
|
|
4
|
+
const WIN = path.win32
|
|
5
|
+
|
|
6
|
+
// `bash.exe` in System32 or WindowsApps is the WSL relay. With no distro installed it starts, prints "execvpe(/bin/bash) failed" and
|
|
7
|
+
// exits 1, so a script run through it fails without ever running.
|
|
8
|
+
export function isWslRelay(file) {
|
|
9
|
+
return /\\(?:windows\\(?:system32|sysnative)|windowsapps)\\/iu.test(file)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* resolveBash({ platform, env, exists }) -> string
|
|
14
|
+
*
|
|
15
|
+
* The bash to run Desk's scripts with. Off Windows, `bash` from PATH. On Windows, Git for Windows' bash first (next to the `git` on
|
|
16
|
+
* PATH, then the usual install folders, which are the standard `Program Files` folders when the environment names none), then any other `bash.exe` on PATH that is not the WSL relay. When none exists it returns
|
|
17
|
+
* `null`, never plain `bash`, because plain `bash` there is the relay. A Git for Windows in a custom folder is found only when its
|
|
18
|
+
* `git.exe` is on PATH (there is no registry lookup).
|
|
19
|
+
*/
|
|
20
|
+
export function resolveBash({ platform = process.platform, env = process.env, exists = existsSync } = {}) {
|
|
21
|
+
if (platform !== "win32") return "bash"
|
|
22
|
+
const dirs = (env.PATH ?? env.Path ?? "").split(";").filter((dir) => dir !== "")
|
|
23
|
+
const git = []
|
|
24
|
+
const other = []
|
|
25
|
+
for (const dir of dirs) {
|
|
26
|
+
if (exists(WIN.join(dir, "git.exe"))) git.push(WIN.join(dir, "..", "bin", "bash.exe"), WIN.join(dir, "..", "usr", "bin", "bash.exe"))
|
|
27
|
+
const candidate = WIN.join(dir, "bash.exe")
|
|
28
|
+
if (!isWslRelay(candidate)) other.push(candidate)
|
|
29
|
+
}
|
|
30
|
+
const roots = [env.ProgramFiles, env.ProgramW6432, env["ProgramFiles(x86)"], env.LOCALAPPDATA && WIN.join(env.LOCALAPPDATA, "Programs")].filter(Boolean)
|
|
31
|
+
// A host that starts Desk with a minimal environment may pass none of these variables; the standard folders then stand in.
|
|
32
|
+
const drive = env.SystemDrive ?? "C:"
|
|
33
|
+
roots.push(WIN.join(`${drive}\\`, "Program Files"), WIN.join(`${drive}\\`, "Program Files (x86)"))
|
|
34
|
+
const installed = roots.map((root) => WIN.join(root, "Git", "bin", "bash.exe"))
|
|
35
|
+
return [...git, ...installed, ...other].find((candidate) => exists(candidate)) ?? null
|
|
36
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// The record of a card commit Desk could not finish: what the call meant to commit (the HEAD and branch it read, the captured
|
|
2
|
+
// entries, the paths and the message), kept in Desk's own state folder under `pending-captures/<id>.json`. Only Desk writes it.
|
|
3
|
+
// A route names the record by its id, so a card's change is finished only from a record Desk wrote, never from bytes or entries
|
|
4
|
+
// a caller supplies on the command line (the card guard lets such a finish through, so this is what keeps it to Desk's own changes).
|
|
5
|
+
// A record is removed once its commit is proven landed, and a record older than a week is pruned when the next one is written.
|
|
6
|
+
|
|
7
|
+
import { randomUUID } from "node:crypto"
|
|
8
|
+
import { mkdirSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } from "node:fs"
|
|
9
|
+
import * as path from "node:path"
|
|
10
|
+
import { renameWithRetry } from "./rename-retry.js"
|
|
11
|
+
import { assertNotRealStateUnderTest } from "../runtime/test-state-guard.js"
|
|
12
|
+
|
|
13
|
+
export const CAPTURE_DIR = "pending-captures"
|
|
14
|
+
const KEEP_MS = 7 * 24 * 60 * 60 * 1000
|
|
15
|
+
const ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/u
|
|
16
|
+
|
|
17
|
+
const dirOf = (stateDir) => path.join(stateDir, CAPTURE_DIR)
|
|
18
|
+
const fileOf = (stateDir, id) => path.join(dirOf(stateDir), `${id}.json`)
|
|
19
|
+
|
|
20
|
+
function pruneOld(dir, now) {
|
|
21
|
+
for (const name of readdirSync(dir)) {
|
|
22
|
+
if (!name.endsWith(".json")) continue
|
|
23
|
+
const file = path.join(dir, name)
|
|
24
|
+
try {
|
|
25
|
+
if (now - statSync(file).mtimeMs > KEEP_MS) rmSync(file, { force: true })
|
|
26
|
+
} catch {
|
|
27
|
+
// Another process removed it first.
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** Writes the record of a captured change and returns its id. Throws when the state folder cannot be written. */
|
|
33
|
+
export function writeCaptureRecord({ stateDir, root, paths, message, capture, now = Date.now() }) {
|
|
34
|
+
assertNotRealStateUnderTest(stateDir)
|
|
35
|
+
mkdirSync(dirOf(stateDir), { recursive: true, mode: 0o700 })
|
|
36
|
+
pruneOld(dirOf(stateDir), now)
|
|
37
|
+
const id = randomUUID()
|
|
38
|
+
const record = { schema_version: 1, id, root, paths, message, before: capture.before, branch: capture.branch, expected: capture.expected, created: new Date(now).toISOString() }
|
|
39
|
+
const file = fileOf(stateDir, id)
|
|
40
|
+
const temporary = `${file}.${process.pid}.tmp`
|
|
41
|
+
writeFileSync(temporary, `${JSON.stringify(record)}\n`, { mode: 0o600, flag: "wx" })
|
|
42
|
+
renameWithRetry(temporary, file)
|
|
43
|
+
return id
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const isText = (value) => typeof value === "string" && value.length > 0
|
|
47
|
+
const isRecord = (record) => record !== null && typeof record === "object" && record.schema_version === 1 && ID.test(record.id ?? "") &&
|
|
48
|
+
isText(record.root) && Array.isArray(record.paths) && record.paths.length > 0 && record.paths.every(isText) &&
|
|
49
|
+
typeof record.message === "string" && isText(record.before) && isText(record.branch) &&
|
|
50
|
+
Array.isArray(record.expected) && record.expected.every(isText)
|
|
51
|
+
|
|
52
|
+
/** The record for `id`: `{ record }`, or `{ error }` saying why Desk cannot use it. */
|
|
53
|
+
export function readCaptureRecord({ stateDir, id }) {
|
|
54
|
+
if (typeof id !== "string" || !ID.test(id)) return { code: "capture_id_not_issued", error: "Pass a capture id Desk issued: the capture id is not one Desk issues" }
|
|
55
|
+
let text
|
|
56
|
+
try {
|
|
57
|
+
text = readFileSync(fileOf(stateDir, id), "utf8")
|
|
58
|
+
} catch {
|
|
59
|
+
return { code: "capture_record_missing", error: "Pass the id of a change Desk still holds: Desk has no record of this change: it was never written here, or it was removed once the commit landed" }
|
|
60
|
+
}
|
|
61
|
+
let record
|
|
62
|
+
try {
|
|
63
|
+
record = JSON.parse(text)
|
|
64
|
+
} catch {
|
|
65
|
+
return { code: "capture_record_unreadable", error: "Check that Desk's record of this change can be read: Desk's record of this change is unreadable" }
|
|
66
|
+
}
|
|
67
|
+
return isRecord(record) && record.id === id ? { record } : { code: "capture_record_malformed", error: "Remove the malformed record of this change, then run it again: Desk's record of this change is malformed" }
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** Removes the record for `id`, a valid id Desk issued; a missing record is already removed. */
|
|
71
|
+
export function removeCaptureRecord({ stateDir, id }) {
|
|
72
|
+
rmSync(fileOf(stateDir, id), { force: true })
|
|
73
|
+
}
|