@wjarka/cezarion 0.10.0-pr30.54
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/LICENSE +21 -0
- package/README.md +838 -0
- package/dist/agent-config/account-identity.d.ts +44 -0
- package/dist/agent-config/account-identity.js +128 -0
- package/dist/agent-config/account-identity.js.map +1 -0
- package/dist/agent-config/catalog.d.ts +72 -0
- package/dist/agent-config/catalog.js +223 -0
- package/dist/agent-config/catalog.js.map +1 -0
- package/dist/agent-config/files.d.ts +46 -0
- package/dist/agent-config/files.js +119 -0
- package/dist/agent-config/files.js.map +1 -0
- package/dist/agent-config/model-settings/claude.d.ts +2 -0
- package/dist/agent-config/model-settings/claude.js +11 -0
- package/dist/agent-config/model-settings/claude.js.map +1 -0
- package/dist/agent-config/model-settings/codex.d.ts +2 -0
- package/dist/agent-config/model-settings/codex.js +16 -0
- package/dist/agent-config/model-settings/codex.js.map +1 -0
- package/dist/agent-config/model-settings/opencode.d.ts +2 -0
- package/dist/agent-config/model-settings/opencode.js +8 -0
- package/dist/agent-config/model-settings/opencode.js.map +1 -0
- package/dist/agent-config/model-settings/pi.d.ts +12 -0
- package/dist/agent-config/model-settings/pi.js +18 -0
- package/dist/agent-config/model-settings/pi.js.map +1 -0
- package/dist/agent-config/model-settings/shared.d.ts +9 -0
- package/dist/agent-config/model-settings/shared.js +93 -0
- package/dist/agent-config/model-settings/shared.js.map +1 -0
- package/dist/agent-config/model-settings/types.d.ts +9 -0
- package/dist/agent-config/model-settings/types.js +2 -0
- package/dist/agent-config/model-settings/types.js.map +1 -0
- package/dist/agent-config/models.d.ts +9 -0
- package/dist/agent-config/models.js +32 -0
- package/dist/agent-config/models.js.map +1 -0
- package/dist/agent-config/seed.d.ts +7 -0
- package/dist/agent-config/seed.js +90 -0
- package/dist/agent-config/seed.js.map +1 -0
- package/dist/agent-config/service.d.ts +44 -0
- package/dist/agent-config/service.js +71 -0
- package/dist/agent-config/service.js.map +1 -0
- package/dist/agent-config/validate.d.ts +21 -0
- package/dist/agent-config/validate.js +76 -0
- package/dist/agent-config/validate.js.map +1 -0
- package/dist/automations/coordinator.d.ts +26 -0
- package/dist/automations/coordinator.js +66 -0
- package/dist/automations/coordinator.js.map +1 -0
- package/dist/automations/github-poller.d.ts +74 -0
- package/dist/automations/github-poller.js +234 -0
- package/dist/automations/github-poller.js.map +1 -0
- package/dist/automations/scheduler.d.ts +42 -0
- package/dist/automations/scheduler.js +192 -0
- package/dist/automations/scheduler.js.map +1 -0
- package/dist/automations/store.d.ts +65 -0
- package/dist/automations/store.js +298 -0
- package/dist/automations/store.js.map +1 -0
- package/dist/automations/task-template.d.ts +18 -0
- package/dist/automations/task-template.js +95 -0
- package/dist/automations/task-template.js.map +1 -0
- package/dist/automations/types.d.ts +255 -0
- package/dist/automations/types.js +159 -0
- package/dist/automations/types.js.map +1 -0
- package/dist/config.d.ts +77 -0
- package/dist/config.js +242 -0
- package/dist/config.js.map +1 -0
- package/dist/contract/agent-config.d.ts +153 -0
- package/dist/contract/agent-profiles.d.ts +347 -0
- package/dist/contract/automations.d.ts +935 -0
- package/dist/contract/events.d.ts +104 -0
- package/dist/contract/github.d.ts +556 -0
- package/dist/contract/health.d.ts +102 -0
- package/dist/contract/index.d.ts +16 -0
- package/dist/contract/index.js +1895 -0
- package/dist/contract/projects.d.ts +210 -0
- package/dist/contract/repo.d.ts +234 -0
- package/dist/contract/runs.d.ts +1473 -0
- package/dist/contract/skills.d.ts +232 -0
- package/dist/contract/workflows.d.ts +218 -0
- package/dist/contract/workspace.d.ts +579 -0
- package/dist/core/agent-env.d.ts +31 -0
- package/dist/core/agent-env.js +371 -0
- package/dist/core/agent-env.js.map +1 -0
- package/dist/core/agent-model-policy.d.ts +10 -0
- package/dist/core/agent-model-policy.js +36 -0
- package/dist/core/agent-model-policy.js.map +1 -0
- package/dist/core/agent-profiles.d.ts +62 -0
- package/dist/core/agent-profiles.js +90 -0
- package/dist/core/agent-profiles.js.map +1 -0
- package/dist/core/agent-runner.d.ts +211 -0
- package/dist/core/agent-runner.js +68 -0
- package/dist/core/agent-runner.js.map +1 -0
- package/dist/core/ask.d.ts +105 -0
- package/dist/core/ask.js +187 -0
- package/dist/core/ask.js.map +1 -0
- package/dist/core/backend-detect.d.ts +16 -0
- package/dist/core/backend-detect.js +155 -0
- package/dist/core/backend-detect.js.map +1 -0
- package/dist/core/claude-cli-runner.d.ts +59 -0
- package/dist/core/claude-cli-runner.js +483 -0
- package/dist/core/claude-cli-runner.js.map +1 -0
- package/dist/core/claude-ui-mapper.d.ts +80 -0
- package/dist/core/claude-ui-mapper.js +598 -0
- package/dist/core/claude-ui-mapper.js.map +1 -0
- package/dist/core/codex-app-server-runner.d.ts +41 -0
- package/dist/core/codex-app-server-runner.js +584 -0
- package/dist/core/codex-app-server-runner.js.map +1 -0
- package/dist/core/codex-app-server-transport.d.ts +35 -0
- package/dist/core/codex-app-server-transport.js +150 -0
- package/dist/core/codex-app-server-transport.js.map +1 -0
- package/dist/core/codex-model-catalog.d.ts +10 -0
- package/dist/core/codex-model-catalog.js +110 -0
- package/dist/core/codex-model-catalog.js.map +1 -0
- package/dist/core/codex-ui-mapper.d.ts +112 -0
- package/dist/core/codex-ui-mapper.js +766 -0
- package/dist/core/codex-ui-mapper.js.map +1 -0
- package/dist/core/model-identity.d.ts +125 -0
- package/dist/core/model-identity.js +132 -0
- package/dist/core/model-identity.js.map +1 -0
- package/dist/core/model-presets.d.ts +21 -0
- package/dist/core/model-presets.js +81 -0
- package/dist/core/model-presets.js.map +1 -0
- package/dist/core/ndjson.d.ts +6 -0
- package/dist/core/ndjson.js +23 -0
- package/dist/core/ndjson.js.map +1 -0
- package/dist/core/opencode-model-catalog.d.ts +32 -0
- package/dist/core/opencode-model-catalog.js +153 -0
- package/dist/core/opencode-model-catalog.js.map +1 -0
- package/dist/core/opencode-server-runner.d.ts +32 -0
- package/dist/core/opencode-server-runner.js +882 -0
- package/dist/core/opencode-server-runner.js.map +1 -0
- package/dist/core/opencode-ui-mapper.d.ts +137 -0
- package/dist/core/opencode-ui-mapper.js +800 -0
- package/dist/core/opencode-ui-mapper.js.map +1 -0
- package/dist/core/pi-model-catalog.d.ts +31 -0
- package/dist/core/pi-model-catalog.js +152 -0
- package/dist/core/pi-model-catalog.js.map +1 -0
- package/dist/core/pi-runner.d.ts +24 -0
- package/dist/core/pi-runner.js +403 -0
- package/dist/core/pi-runner.js.map +1 -0
- package/dist/core/pi-ui-mapper.d.ts +36 -0
- package/dist/core/pi-ui-mapper.js +304 -0
- package/dist/core/pi-ui-mapper.js.map +1 -0
- package/dist/core/process-usage.d.ts +66 -0
- package/dist/core/process-usage.js +193 -0
- package/dist/core/process-usage.js.map +1 -0
- package/dist/core/provider-auth.d.ts +154 -0
- package/dist/core/provider-auth.js +509 -0
- package/dist/core/provider-auth.js.map +1 -0
- package/dist/core/provider-availability.d.ts +3 -0
- package/dist/core/provider-availability.js +14 -0
- package/dist/core/provider-availability.js.map +1 -0
- package/dist/core/runner-factory.d.ts +8 -0
- package/dist/core/runner-factory.js +25 -0
- package/dist/core/runner-factory.js.map +1 -0
- package/dist/core/runner-model-catalog.d.ts +29 -0
- package/dist/core/runner-model-catalog.js +78 -0
- package/dist/core/runner-model-catalog.js.map +1 -0
- package/dist/core/secret-redaction.d.ts +37 -0
- package/dist/core/secret-redaction.js +115 -0
- package/dist/core/secret-redaction.js.map +1 -0
- package/dist/core/shell-env.d.ts +28 -0
- package/dist/core/shell-env.js +56 -0
- package/dist/core/shell-env.js.map +1 -0
- package/dist/core/tool-display.d.ts +31 -0
- package/dist/core/tool-display.js +179 -0
- package/dist/core/tool-display.js.map +1 -0
- package/dist/core/ui-events.d.ts +335 -0
- package/dist/core/ui-events.js +25 -0
- package/dist/core/ui-events.js.map +1 -0
- package/dist/core/usage-limit.d.ts +42 -0
- package/dist/core/usage-limit.js +209 -0
- package/dist/core/usage-limit.js.map +1 -0
- package/dist/core/usage.d.ts +11 -0
- package/dist/core/usage.js +15 -0
- package/dist/core/usage.js.map +1 -0
- package/dist/core/v1-text-coalescer.d.ts +36 -0
- package/dist/core/v1-text-coalescer.js +72 -0
- package/dist/core/v1-text-coalescer.js.map +1 -0
- package/dist/git-diff-base.d.ts +85 -0
- package/dist/git-diff-base.js +180 -0
- package/dist/git-diff-base.js.map +1 -0
- package/dist/git-refs.d.ts +11 -0
- package/dist/git-refs.js +14 -0
- package/dist/git-refs.js.map +1 -0
- package/dist/git-worktree.d.ts +161 -0
- package/dist/git-worktree.js +508 -0
- package/dist/git-worktree.js.map +1 -0
- package/dist/handoff.d.ts +62 -0
- package/dist/handoff.js +154 -0
- package/dist/handoff.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +680 -0
- package/dist/index.js.map +1 -0
- package/dist/install-as-command.d.ts +40 -0
- package/dist/install-as-command.js +52 -0
- package/dist/install-as-command.js.map +1 -0
- package/dist/pack-check.d.ts +17 -0
- package/dist/pack-check.js +27 -0
- package/dist/pack-check.js.map +1 -0
- package/dist/paths.d.ts +140 -0
- package/dist/paths.js +192 -0
- package/dist/paths.js.map +1 -0
- package/dist/planner.d.ts +27 -0
- package/dist/planner.js +268 -0
- package/dist/planner.js.map +1 -0
- package/dist/release/manifests.d.ts +81 -0
- package/dist/release/manifests.js +74 -0
- package/dist/release/manifests.js.map +1 -0
- package/dist/release/snapshot.d.ts +67 -0
- package/dist/release/snapshot.js +97 -0
- package/dist/release/snapshot.js.map +1 -0
- package/dist/release/stable.d.ts +38 -0
- package/dist/release/stable.js +55 -0
- package/dist/release/stable.js.map +1 -0
- package/dist/runs/agent-tmpdir.d.ts +41 -0
- package/dist/runs/agent-tmpdir.js +183 -0
- package/dist/runs/agent-tmpdir.js.map +1 -0
- package/dist/runs/auto-name.d.ts +75 -0
- package/dist/runs/auto-name.js +179 -0
- package/dist/runs/auto-name.js.map +1 -0
- package/dist/runs/event-history.d.ts +50 -0
- package/dist/runs/event-history.js +613 -0
- package/dist/runs/event-history.js.map +1 -0
- package/dist/runs/retention.d.ts +60 -0
- package/dist/runs/retention.js +86 -0
- package/dist/runs/retention.js.map +1 -0
- package/dist/runs/review-gate.d.ts +18 -0
- package/dist/runs/review-gate.js +21 -0
- package/dist/runs/review-gate.js.map +1 -0
- package/dist/runs/run-index.d.ts +19 -0
- package/dist/runs/run-index.js +43 -0
- package/dist/runs/run-index.js.map +1 -0
- package/dist/runs/store.d.ts +446 -0
- package/dist/runs/store.js +1118 -0
- package/dist/runs/store.js.map +1 -0
- package/dist/runs/task-markers.d.ts +28 -0
- package/dist/runs/task-markers.js +74 -0
- package/dist/runs/task-markers.js.map +1 -0
- package/dist/runs/task-refs.d.ts +25 -0
- package/dist/runs/task-refs.js +74 -0
- package/dist/runs/task-refs.js.map +1 -0
- package/dist/runs/ui-event-sink.d.ts +81 -0
- package/dist/runs/ui-event-sink.js +210 -0
- package/dist/runs/ui-event-sink.js.map +1 -0
- package/dist/server/app-type.d.ts +21 -0
- package/dist/server/app-type.js +2 -0
- package/dist/server/app-type.js.map +1 -0
- package/dist/server/capabilities.d.ts +70 -0
- package/dist/server/capabilities.js +152 -0
- package/dist/server/capabilities.js.map +1 -0
- package/dist/server/checkout.d.ts +128 -0
- package/dist/server/checkout.js +296 -0
- package/dist/server/checkout.js.map +1 -0
- package/dist/server/forge/github.d.ts +513 -0
- package/dist/server/forge/github.js +2364 -0
- package/dist/server/forge/github.js.map +1 -0
- package/dist/server/forge/index.d.ts +40 -0
- package/dist/server/forge/index.js +72 -0
- package/dist/server/forge/index.js.map +1 -0
- package/dist/server/forge/types.d.ts +242 -0
- package/dist/server/forge/types.js +2 -0
- package/dist/server/forge/types.js.map +1 -0
- package/dist/server/fs-browse.d.ts +105 -0
- package/dist/server/fs-browse.js +182 -0
- package/dist/server/fs-browse.js.map +1 -0
- package/dist/server/git-changes.d.ts +213 -0
- package/dist/server/git-changes.js +555 -0
- package/dist/server/git-changes.js.map +1 -0
- package/dist/server/git.d.ts +28 -0
- package/dist/server/git.js +112 -0
- package/dist/server/git.js.map +1 -0
- package/dist/server/github.d.ts +9 -0
- package/dist/server/github.js +8 -0
- package/dist/server/github.js.map +1 -0
- package/dist/server/launch-key.d.ts +7 -0
- package/dist/server/launch-key.js +33 -0
- package/dist/server/launch-key.js.map +1 -0
- package/dist/server/open-in-app.d.ts +66 -0
- package/dist/server/open-in-app.js +211 -0
- package/dist/server/open-in-app.js.map +1 -0
- package/dist/server/open-in-terminal.d.ts +70 -0
- package/dist/server/open-in-terminal.js +179 -0
- package/dist/server/open-in-terminal.js.map +1 -0
- package/dist/server/pr.d.ts +7 -0
- package/dist/server/pr.js +7 -0
- package/dist/server/pr.js.map +1 -0
- package/dist/server/project-context.d.ts +120 -0
- package/dist/server/project-context.js +182 -0
- package/dist/server/project-context.js.map +1 -0
- package/dist/server/provider-action-gate.d.ts +8 -0
- package/dist/server/provider-action-gate.js +56 -0
- package/dist/server/provider-action-gate.js.map +1 -0
- package/dist/server/provider-auth-runtime.d.ts +21 -0
- package/dist/server/provider-auth-runtime.js +66 -0
- package/dist/server/provider-auth-runtime.js.map +1 -0
- package/dist/server/server.d.ts +13138 -0
- package/dist/server/server.js +5263 -0
- package/dist/server/server.js.map +1 -0
- package/dist/server/static-ui.d.ts +49 -0
- package/dist/server/static-ui.js +92 -0
- package/dist/server/static-ui.js.map +1 -0
- package/dist/server/validators.d.ts +97 -0
- package/dist/server/validators.js +86 -0
- package/dist/server/validators.js.map +1 -0
- package/dist/server/ws.d.ts +85 -0
- package/dist/server/ws.js +218 -0
- package/dist/server/ws.js.map +1 -0
- package/dist/server/wsl.d.ts +25 -0
- package/dist/server/wsl.js +92 -0
- package/dist/server/wsl.js.map +1 -0
- package/dist/server-install/engine.d.ts +50 -0
- package/dist/server-install/engine.js +324 -0
- package/dist/server-install/engine.js.map +1 -0
- package/dist/server-install/platforms/macosx-ngrok.d.ts +6 -0
- package/dist/server-install/platforms/macosx-ngrok.js +345 -0
- package/dist/server-install/platforms/macosx-ngrok.js.map +1 -0
- package/dist/server-install/platforms/ubuntu-vps.d.ts +78 -0
- package/dist/server-install/platforms/ubuntu-vps.js +1016 -0
- package/dist/server-install/platforms/ubuntu-vps.js.map +1 -0
- package/dist/server-install/state.d.ts +52 -0
- package/dist/server-install/state.js +182 -0
- package/dist/server-install/state.js.map +1 -0
- package/dist/server-install/steps.d.ts +109 -0
- package/dist/server-install/steps.js +334 -0
- package/dist/server-install/steps.js.map +1 -0
- package/dist/server-install/strategies.d.ts +4 -0
- package/dist/server-install/strategies.js +20 -0
- package/dist/server-install/strategies.js.map +1 -0
- package/dist/server-install/types.d.ts +287 -0
- package/dist/server-install/types.js +121 -0
- package/dist/server-install/types.js.map +1 -0
- package/dist/server-install/ui.d.ts +42 -0
- package/dist/server-install/ui.js +130 -0
- package/dist/server-install/ui.js.map +1 -0
- package/dist/skills-banner.d.ts +22 -0
- package/dist/skills-banner.js +41 -0
- package/dist/skills-banner.js.map +1 -0
- package/dist/skills-remote.d.ts +84 -0
- package/dist/skills-remote.js +468 -0
- package/dist/skills-remote.js.map +1 -0
- package/dist/skills-update.d.ts +88 -0
- package/dist/skills-update.js +392 -0
- package/dist/skills-update.js.map +1 -0
- package/dist/skills.d.ts +82 -0
- package/dist/skills.js +251 -0
- package/dist/skills.js.map +1 -0
- package/dist/todos.d.ts +48 -0
- package/dist/todos.js +201 -0
- package/dist/todos.js.map +1 -0
- package/dist/ui-state.d.ts +26 -0
- package/dist/ui-state.js +38 -0
- package/dist/ui-state.js.map +1 -0
- package/dist/update-check.d.ts +12 -0
- package/dist/update-check.js +41 -0
- package/dist/update-check.js.map +1 -0
- package/dist/workflows/load.d.ts +15 -0
- package/dist/workflows/load.js +56 -0
- package/dist/workflows/load.js.map +1 -0
- package/dist/workflows/run.d.ts +758 -0
- package/dist/workflows/run.js +3389 -0
- package/dist/workflows/run.js.map +1 -0
- package/dist/workflows/types.d.ts +153 -0
- package/dist/workflows/types.js +212 -0
- package/dist/workflows/types.js.map +1 -0
- package/dist/workspace/agent-accounts.d.ts +153 -0
- package/dist/workspace/agent-accounts.js +304 -0
- package/dist/workspace/agent-accounts.js.map +1 -0
- package/dist/workspace/agent-profiles.d.ts +78 -0
- package/dist/workspace/agent-profiles.js +115 -0
- package/dist/workspace/agent-profiles.js.map +1 -0
- package/dist/workspace/config.d.ts +169 -0
- package/dist/workspace/config.js +379 -0
- package/dist/workspace/config.js.map +1 -0
- package/dist/workspace/migrations.d.ts +45 -0
- package/dist/workspace/migrations.js +147 -0
- package/dist/workspace/migrations.js.map +1 -0
- package/dist/workspace/projects-cli.d.ts +25 -0
- package/dist/workspace/projects-cli.js +172 -0
- package/dist/workspace/projects-cli.js.map +1 -0
- package/dist/workspace/projects.d.ts +109 -0
- package/dist/workspace/projects.js +250 -0
- package/dist/workspace/projects.js.map +1 -0
- package/dist/workspace/semaphore.d.ts +179 -0
- package/dist/workspace/semaphore.js +195 -0
- package/dist/workspace/semaphore.js.map +1 -0
- package/dist/workspace/ui-state.d.ts +34 -0
- package/dist/workspace/ui-state.js +53 -0
- package/dist/workspace/ui-state.js.map +1 -0
- package/package.json +70 -0
- package/scripts/check-pack.mjs +46 -0
- package/scripts/inline-contract.mjs +112 -0
- package/scripts/install-as-command.mjs +120 -0
- package/scripts/mock-claude.mjs +520 -0
- package/scripts/mock-pi-rpc.mjs +83 -0
- package/scripts/sync-readme.mjs +20 -0
- package/scripts/test-process-usage.mjs +47 -0
- package/web/dist/assets/alert-dialog-B4Ofsgv7.js +1 -0
- package/web/dist/assets/arrow-down-Dy8dup7j.js +1 -0
- package/web/dist/assets/arrow-left-BJaucbhn.js +1 -0
- package/web/dist/assets/bundle-mjs-BT31bpU6.js +1 -0
- package/web/dist/assets/centered-state-duPW0phQ.js +43 -0
- package/web/dist/assets/chevron-right-Be4A5TCS.js +1 -0
- package/web/dist/assets/chunk-BO2N2NFS-DE6qKn3r.js +131 -0
- package/web/dist/assets/collapsible-DdcNBdSk.js +1 -0
- package/web/dist/assets/commit-list-CgvN9vec.js +1 -0
- package/web/dist/assets/compare-variants-CQA2nd65.js +1 -0
- package/web/dist/assets/core-BCsw8oQw.js +12 -0
- package/web/dist/assets/css-BsVw1vtW.js +1 -0
- package/web/dist/assets/diff-B6Agp5Hl.js +3 -0
- package/web/dist/assets/diff-stat-BoXuGkgq.js +1 -0
- package/web/dist/assets/diff-view-CD8XI-fj.js +6 -0
- package/web/dist/assets/diff-woXpYk--.js +1 -0
- package/web/dist/assets/dropdown-menu-B3SYw-k5.js +1 -0
- package/web/dist/assets/editable-title-B-hjp5wl.js +1 -0
- package/web/dist/assets/ellipsis-vertical-BYwzw0xl.js +1 -0
- package/web/dist/assets/engine-javascript-FQvzRocB.js +141 -0
- package/web/dist/assets/file-BRj5eISx.js +1 -0
- package/web/dist/assets/folder-z4oT5981.js +1 -0
- package/web/dist/assets/git-toolbar-owSEkYld.js +1 -0
- package/web/dist/assets/github-Bz2VgRX3.js +1 -0
- package/web/dist/assets/go-rLFTqkRN.js +1 -0
- package/web/dist/assets/highlighted-body-OFNGDK62-BL-MfFgl.js +1 -0
- package/web/dist/assets/highlighter-CdHqIwFr.js +3 -0
- package/web/dist/assets/html-BY76lXLH.js +1 -0
- package/web/dist/assets/image-preview-h3WFluuy.js +1 -0
- package/web/dist/assets/index-BbcQNT92.css +2 -0
- package/web/dist/assets/index-EtQQQ6Kj.js +7 -0
- package/web/dist/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
- package/web/dist/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
- package/web/dist/assets/javascript-BgS3c2Ky.js +1 -0
- package/web/dist/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
- package/web/dist/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
- package/web/dist/assets/json-qhed-kSA.js +1 -0
- package/web/dist/assets/jsonc-CYpm1nAK.js +1 -0
- package/web/dist/assets/jsx-Bz0zcwM4.js +1 -0
- package/web/dist/assets/lib-BQXq3kEf.js +1 -0
- package/web/dist/assets/lib-BxQXEXDF.js +1 -0
- package/web/dist/assets/markdown-BYOwaDjH.js +1 -0
- package/web/dist/assets/markdown-DqBKYPiB.js +2 -0
- package/web/dist/assets/mermaid-GHXKKRXX-C4jxqUUb.js +1 -0
- package/web/dist/assets/new-task-form-BdJKRBJX.js +1 -0
- package/web/dist/assets/pill-BQfmfpYp.js +1 -0
- package/web/dist/assets/project-router-DxgFZY1l.js +1 -0
- package/web/dist/assets/prompt-templates-B6m16gq-.js +15 -0
- package/web/dist/assets/python-gzcpVVnB.js +1 -0
- package/web/dist/assets/react-runtime-CCIEwYL0.js +9 -0
- package/web/dist/assets/refresh-cw-mhSpxf2a.js +1 -0
- package/web/dist/assets/repo-git-CUNRxR3_.js +1 -0
- package/web/dist/assets/rolldown-runtime-QTnfLwEv.js +1 -0
- package/web/dist/assets/run-diff-DsmmDVfx.js +3 -0
- package/web/dist/assets/run-header-BkhrseLJ.js +1 -0
- package/web/dist/assets/rust-Cfkwpbl8.js +1 -0
- package/web/dist/assets/search-x-BqDMB2g8.js +1 -0
- package/web/dist/assets/shellscript-CLZ0U2zV.js +1 -0
- package/web/dist/assets/skill-empty-hint-BWEvTggc.js +1 -0
- package/web/dist/assets/skills-9oR_oHse.js +1 -0
- package/web/dist/assets/skills-DwIxnnWO.js +1 -0
- package/web/dist/assets/sparkles-DIoTQpyx.js +1 -0
- package/web/dist/assets/sql-BsFa4tDR.js +1 -0
- package/web/dist/assets/square-terminal-Cc7CuQxc.js +1 -0
- package/web/dist/assets/tab-link-D1fQgpmO.js +1 -0
- package/web/dist/assets/task-changes-BKeLlDpK.js +1 -0
- package/web/dist/assets/task-commits-gcEFZIa5.js +1 -0
- package/web/dist/assets/task-files-BGAqoXTW.js +2 -0
- package/web/dist/assets/task-thread-DT8aUYTS.js +9 -0
- package/web/dist/assets/textarea-BOVbfy5C.js +1 -0
- package/web/dist/assets/thread-loading-CypW73KD.js +1 -0
- package/web/dist/assets/toml-CcmNWLt0.js +1 -0
- package/web/dist/assets/trash-2-CJq6LHWn.js +1 -0
- package/web/dist/assets/triangle-alert-CjDFvU27.js +1 -0
- package/web/dist/assets/tsx-udAQXfEw.js +1 -0
- package/web/dist/assets/typescript-bsJCZSQ-.js +1 -0
- package/web/dist/assets/upload-CPDZlJeK.js +1 -0
- package/web/dist/assets/use-desktop-5JsLmi0a.js +1 -0
- package/web/dist/assets/use-submit-shortcut-CHVFevty.js +1 -0
- package/web/dist/assets/utils-DiO6zyJd.js +64 -0
- package/web/dist/assets/workflows-rQDFzWRt.js +11 -0
- package/web/dist/assets/yaml-rwi0_p6S.js +1 -0
- package/web/dist/assets/zoomable-image-COWqb11v.js +1 -0
- package/web/dist/index.html +80 -0
- package/web/dist/open-mercato.svg +11 -0
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { workspaceUiStateSchema } from '../contract/index.js';
|
|
4
|
+
import { cezarHomeDir, workspaceConfigPath } from '../paths.js';
|
|
5
|
+
import { readUiState } from '../ui-state.js';
|
|
6
|
+
import { loadWorkspaceConfig, mergeWriteWorkspaceConfig } from './config.js';
|
|
7
|
+
import { mergeWriteWorkspaceUiState } from './ui-state.js';
|
|
8
|
+
// Step 1.4 exported the global ui-state merge-write from here; step 2.7 moved
|
|
9
|
+
// it to its cleaner home (src/workspace/ui-state.ts, next to the read path the
|
|
10
|
+
// workspace routes share). Re-exported so existing importers keep working.
|
|
11
|
+
export { mergeWriteWorkspaceUiState } from './ui-state.js';
|
|
12
|
+
/** Tolerant raw-JSON read: missing/unreadable/malformed/non-object → null. */
|
|
13
|
+
async function readRawObject(path) {
|
|
14
|
+
try {
|
|
15
|
+
return asObject(JSON.parse(await readFile(path, 'utf8')));
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function asObject(value) {
|
|
22
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value)
|
|
23
|
+
? value
|
|
24
|
+
: null;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The boot repo's `.ai/cezar/config.json` resource keys, read RAW (not through
|
|
28
|
+
* `loadConfig`) so only values the user explicitly set are imported — a
|
|
29
|
+
* defaulted value must not masquerade as a preference. Bounds mirror the
|
|
30
|
+
* workspace `resources` schema; out-of-range values are simply not imported.
|
|
31
|
+
*/
|
|
32
|
+
async function readRepoResourceKeys(repoRoot) {
|
|
33
|
+
const raw = await readRawObject(join(repoRoot, '.ai/cezar', 'config.json'));
|
|
34
|
+
const out = {};
|
|
35
|
+
const maxParallel = raw?.maxParallel;
|
|
36
|
+
if (typeof maxParallel === 'number' && Number.isInteger(maxParallel) && maxParallel >= 1 && maxParallel <= 16) {
|
|
37
|
+
out.maxParallel = maxParallel;
|
|
38
|
+
}
|
|
39
|
+
const memoryLimitMb = raw?.memoryLimitMb;
|
|
40
|
+
if (typeof memoryLimitMb === 'number' &&
|
|
41
|
+
Number.isInteger(memoryLimitMb) &&
|
|
42
|
+
memoryLimitMb >= 0 &&
|
|
43
|
+
memoryLimitMb <= 1_048_576) {
|
|
44
|
+
out.memoryLimitMb = memoryLimitMb;
|
|
45
|
+
}
|
|
46
|
+
return out;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Migration 001 — `schemaVersion 0 → 1`, the "current version up" migration:
|
|
50
|
+
*
|
|
51
|
+
* 1. Create `~/.cezar/config.json` with defaults if absent (the merge-write
|
|
52
|
+
* does this even when there is nothing to import).
|
|
53
|
+
* 2. Booting inside a repo: import its `maxParallel`/`memoryLimitMb` into
|
|
54
|
+
* workspace `resources`, and its `appearance`/`notifications` ui-state
|
|
55
|
+
* keys into `~/.cezar/ui-state.json`. Keys already set globally are NEVER
|
|
56
|
+
* overwritten — presence is checked against the RAW global file (before
|
|
57
|
+
* defaults are applied), which is exactly what makes a crash-interrupted
|
|
58
|
+
* re-run safe: the first pass writes the keys, the re-run sees them set.
|
|
59
|
+
* 3. Every per-repo file is left untouched in place, so an older cezar run in
|
|
60
|
+
* the same repo keeps working off its local copies.
|
|
61
|
+
*
|
|
62
|
+
* Registering the boot repo is NOT part of the migration — the normal boot
|
|
63
|
+
* flow owns registration (single owner, no divergent `addedAt`/`source`).
|
|
64
|
+
*/
|
|
65
|
+
const migration001 = {
|
|
66
|
+
to: 1,
|
|
67
|
+
id: '001-workspace-config',
|
|
68
|
+
async run({ bootRepoRoot }) {
|
|
69
|
+
// Raw presence check BEFORE the first write: after any merge-write the
|
|
70
|
+
// global file contains every defaulted key, so "already set globally"
|
|
71
|
+
// must be decided against what the user's file held coming in.
|
|
72
|
+
const rawGlobal = await readRawObject(workspaceConfigPath());
|
|
73
|
+
const rawResources = asObject(rawGlobal?.resources);
|
|
74
|
+
const imported = bootRepoRoot ? await readRepoResourceKeys(bootRepoRoot) : {};
|
|
75
|
+
await mergeWriteWorkspaceConfig((config) => {
|
|
76
|
+
if (imported.maxParallel !== undefined && rawResources?.maxParallel === undefined) {
|
|
77
|
+
config.resources.maxParallel = imported.maxParallel;
|
|
78
|
+
}
|
|
79
|
+
if (imported.memoryLimitMb !== undefined && rawResources?.memoryLimitMb === undefined) {
|
|
80
|
+
config.resources.memoryLimitMb = imported.memoryLimitMb;
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
if (!bootRepoRoot)
|
|
84
|
+
return;
|
|
85
|
+
const repoUiState = await readUiState(bootRepoRoot);
|
|
86
|
+
// The two prefs that went GLOBAL at step 3.5, read out of the per-repo bag and validated with
|
|
87
|
+
// the DESTINATION's own field schemas. `notifications` is not named by the per-repo contract
|
|
88
|
+
// at all (it left at 3.5), so it arrives through the open catchall as `unknown` — parsing it
|
|
89
|
+
// here is what makes it assignable, and it is also the honest thing: `GET /workspace/ui-state`
|
|
90
|
+
// promises these two keys' shapes, so a hand-edited value must not be promoted into the global
|
|
91
|
+
// file unchecked. A value that does not parse is simply not imported — never a failed boot.
|
|
92
|
+
const shape = workspaceUiStateSchema.shape;
|
|
93
|
+
const importable = {};
|
|
94
|
+
const appearance = shape.appearance.safeParse(repoUiState.appearance);
|
|
95
|
+
if (appearance.success && appearance.data !== undefined)
|
|
96
|
+
importable.appearance = appearance.data;
|
|
97
|
+
const notifications = shape.notifications.safeParse(repoUiState.notifications);
|
|
98
|
+
if (notifications.success && notifications.data !== undefined) {
|
|
99
|
+
importable.notifications = notifications.data;
|
|
100
|
+
}
|
|
101
|
+
if (Object.keys(importable).length === 0)
|
|
102
|
+
return; // nothing to import — don't create the file
|
|
103
|
+
await mergeWriteWorkspaceUiState((state) => {
|
|
104
|
+
for (const [key, value] of Object.entries(importable)) {
|
|
105
|
+
if (state[key] === undefined)
|
|
106
|
+
state[key] = value;
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
/** All known migrations. Kept in ascending `to` order; `runMigrations` sorts
|
|
112
|
+
* defensively anyway. */
|
|
113
|
+
export const WORKSPACE_MIGRATIONS = [migration001];
|
|
114
|
+
/**
|
|
115
|
+
* Run every pending workspace migration — called at boot before anything else
|
|
116
|
+
* touches `~/.cezar`. Reads `schemaVersion` (absent file or key → 0, which
|
|
117
|
+
* means "run everything" — safe because every migration is idempotent), runs
|
|
118
|
+
* each migration with `to > current` in ascending order, and persists the new
|
|
119
|
+
* `schemaVersion` after EACH one, so a crash resumes exactly where it left
|
|
120
|
+
* off. A failing migration logs ONE warning and stops the chain (later
|
|
121
|
+
* migrations may depend on earlier ones); boot proceeds degraded on in-memory
|
|
122
|
+
* defaults. Never throws.
|
|
123
|
+
*
|
|
124
|
+
* `migrations` is injectable for tests only; production callers pass nothing.
|
|
125
|
+
*/
|
|
126
|
+
export async function runMigrations(opts, migrations = WORKSPACE_MIGRATIONS) {
|
|
127
|
+
const home = cezarHomeDir();
|
|
128
|
+
const ordered = [...migrations].sort((a, b) => a.to - b.to);
|
|
129
|
+
let current = (await loadWorkspaceConfig()).schemaVersion;
|
|
130
|
+
for (const migration of ordered) {
|
|
131
|
+
if (migration.to <= current)
|
|
132
|
+
continue;
|
|
133
|
+
try {
|
|
134
|
+
await migration.run({ home, bootRepoRoot: opts.bootRepoRoot });
|
|
135
|
+
const written = await mergeWriteWorkspaceConfig((config) => {
|
|
136
|
+
config.schemaVersion = Math.max(config.schemaVersion, migration.to);
|
|
137
|
+
});
|
|
138
|
+
current = written.schemaVersion;
|
|
139
|
+
}
|
|
140
|
+
catch (err) {
|
|
141
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
142
|
+
console.warn(`[cez] workspace migration ${migration.id} failed (${message}) — booting with in-memory defaults`);
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=migrations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrations.js","sourceRoot":"","sources":["../../src/workspace/migrations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAC7E,OAAO,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAE3D,8EAA8E;AAC9E,+EAA+E;AAC/E,2EAA2E;AAC3E,OAAO,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AA2B3D,8EAA8E;AAC9E,KAAK,UAAU,aAAa,CAAC,IAAY;IACvC,IAAI,CAAC;QACH,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC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AAC;YAC/D,MAAM,OAAO,GAAG,MAAM,yBAAyB,CAAC,CAAC,MAAM,EAAE,EAAE;gBACzD,MAAM,CAAC,aAAa,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,aAAa,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC;YACtE,CAAC,CAAC,CAAC;YACH,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC;QAClC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACjE,OAAO,CAAC,IAAI,CACV,6BAA6B,SAAS,CAAC,EAAE,YAAY,OAAO,qCAAqC,CAClG,CAAC;YACF,OAAO;QACT,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `cezar projects` (spec 2026-07-20-multi-project-workspace, step 5.2) — the
|
|
3
|
+
* terminal twin of Settings → Projects, for the operator who is on a server (or
|
|
4
|
+
* an ssh session) and has no cockpit in front of them.
|
|
5
|
+
*
|
|
6
|
+
* It talks to `~/.cezar/config.json` through `./projects.js` directly, NOT over
|
|
7
|
+
* HTTP: the whole point is that it works with no server running, on a box where
|
|
8
|
+
* the cockpit is behind an nginx login. `CEZ_HOME` therefore selects which
|
|
9
|
+
* workspace it operates on, exactly as it does for `serve`.
|
|
10
|
+
*/
|
|
11
|
+
export interface ProjectsCommandIo {
|
|
12
|
+
log: (line: string) => void;
|
|
13
|
+
error: (line: string) => void;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Run one `projects` subcommand. Returns the process exit code (0 ok, 1 for a
|
|
17
|
+
* usage error, an unknown id, or a folder the registration guards refuse) so
|
|
18
|
+
* `src/index.ts` can assign it to `process.exitCode` like every other command.
|
|
19
|
+
*/
|
|
20
|
+
export declare function runProjectsCommand(args: string[], opts: {
|
|
21
|
+
defaultRoot: string;
|
|
22
|
+
bootProjectId?: string;
|
|
23
|
+
env?: NodeJS.ProcessEnv;
|
|
24
|
+
io?: ProjectsCommandIo;
|
|
25
|
+
}): Promise<number>;
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { stat } from 'node:fs/promises';
|
|
2
|
+
import { resolve } from 'node:path';
|
|
3
|
+
import { workspaceConfigPath } from '../paths.js';
|
|
4
|
+
import { loadWorkspaceConfig, mergeWriteWorkspaceConfig } from './config.js';
|
|
5
|
+
import { listProjects, normalizeProjectTags, registerProject, removeProject, shouldRegisterProject, } from './projects.js';
|
|
6
|
+
const defaultIo = {
|
|
7
|
+
log: (line) => console.log(line),
|
|
8
|
+
error: (line) => console.error(line),
|
|
9
|
+
};
|
|
10
|
+
const USAGE = `usage:
|
|
11
|
+
cez projects [list] list the registered projects
|
|
12
|
+
cez projects add [<dir>] register a folder (default: --repo, else cwd)
|
|
13
|
+
cez projects remove <id> drop a registry entry (the repo is untouched)
|
|
14
|
+
cez projects tag <id> [<tag>…]
|
|
15
|
+
set the grouping tags of a project (none clears them)
|
|
16
|
+
|
|
17
|
+
add/remove/tag are unavailable when CEZ_SINGLE_PROJECT=1`;
|
|
18
|
+
const SINGLE_PROJECT_ADD_ERROR = 'single-project mode is enabled; adding projects is disabled';
|
|
19
|
+
const SINGLE_PROJECT_REMOVE_ERROR = 'single-project mode is enabled; removing projects is disabled';
|
|
20
|
+
const SINGLE_PROJECT_EDIT_ERROR = 'single-project mode is enabled; editing projects is disabled';
|
|
21
|
+
/**
|
|
22
|
+
* Run one `projects` subcommand. Returns the process exit code (0 ok, 1 for a
|
|
23
|
+
* usage error, an unknown id, or a folder the registration guards refuse) so
|
|
24
|
+
* `src/index.ts` can assign it to `process.exitCode` like every other command.
|
|
25
|
+
*/
|
|
26
|
+
export async function runProjectsCommand(args, opts) {
|
|
27
|
+
const io = opts.io ?? defaultIo;
|
|
28
|
+
const singleProject = (opts.env ?? process.env).CEZ_SINGLE_PROJECT === '1';
|
|
29
|
+
const [sub = 'list', ...rest] = args;
|
|
30
|
+
switch (sub) {
|
|
31
|
+
case 'list':
|
|
32
|
+
return listCommand(io, singleProject, opts.bootProjectId);
|
|
33
|
+
case 'add':
|
|
34
|
+
if (singleProject) {
|
|
35
|
+
io.error(SINGLE_PROJECT_ADD_ERROR);
|
|
36
|
+
return 1;
|
|
37
|
+
}
|
|
38
|
+
return addCommand(rest[0] ? resolve(rest[0]) : opts.defaultRoot, io);
|
|
39
|
+
case 'remove':
|
|
40
|
+
case 'rm':
|
|
41
|
+
if (singleProject) {
|
|
42
|
+
io.error(SINGLE_PROJECT_REMOVE_ERROR);
|
|
43
|
+
return 1;
|
|
44
|
+
}
|
|
45
|
+
return removeCommand(rest[0], io);
|
|
46
|
+
case 'tag':
|
|
47
|
+
if (singleProject) {
|
|
48
|
+
io.error(SINGLE_PROJECT_EDIT_ERROR);
|
|
49
|
+
return 1;
|
|
50
|
+
}
|
|
51
|
+
return tagCommand(rest[0], rest.slice(1), io);
|
|
52
|
+
default:
|
|
53
|
+
io.error(`unknown projects subcommand: ${sub}\n`);
|
|
54
|
+
io.error(USAGE);
|
|
55
|
+
return 1;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/** `ok` shows the branch when git could name one; the other states say why. */
|
|
59
|
+
function statusLabel(entry) {
|
|
60
|
+
if (entry.status === 'missing')
|
|
61
|
+
return 'missing';
|
|
62
|
+
if (entry.status === 'not-git')
|
|
63
|
+
return 'not a git repo';
|
|
64
|
+
return entry.branch ?? 'ok';
|
|
65
|
+
}
|
|
66
|
+
/** Same ✓/✗ vocabulary the `serve` banner uses for its environment checks. */
|
|
67
|
+
function statusMark(status) {
|
|
68
|
+
return status === 'missing' ? '✗' : status === 'not-git' ? '·' : '✓';
|
|
69
|
+
}
|
|
70
|
+
async function listCommand(io, singleProject, bootProjectId) {
|
|
71
|
+
const projects = bootProjectId
|
|
72
|
+
? await listProjects({ projectId: bootProjectId })
|
|
73
|
+
: singleProject
|
|
74
|
+
? []
|
|
75
|
+
: await listProjects();
|
|
76
|
+
if (projects.length === 0) {
|
|
77
|
+
io.log('\n no projects registered yet');
|
|
78
|
+
io.log(' start the cockpit in a repo (npx cezarion) or add one: cez projects add <dir>\n');
|
|
79
|
+
return 0;
|
|
80
|
+
}
|
|
81
|
+
const idWidth = Math.max(...projects.map((p) => p.id.length));
|
|
82
|
+
const labelWidth = Math.max(...projects.map((p) => statusLabel(p).length));
|
|
83
|
+
io.log('');
|
|
84
|
+
for (const project of projects) {
|
|
85
|
+
const label = statusLabel(project).padEnd(labelWidth);
|
|
86
|
+
// Tags trail the path rather than taking a column of their own: most projects have none,
|
|
87
|
+
// and a mostly-empty column would cost every row width to say nothing.
|
|
88
|
+
const tags = project.tags?.length ? ` [${project.tags.join(' ')}]` : '';
|
|
89
|
+
io.log(` ${statusMark(project.status)} ${project.id.padEnd(idWidth)} ${label} ${project.root}${tags}`);
|
|
90
|
+
}
|
|
91
|
+
io.log(`\n ${projects.length} project(s) — registry: ${workspaceConfigPath()}\n`);
|
|
92
|
+
return 0;
|
|
93
|
+
}
|
|
94
|
+
async function addCommand(root, io) {
|
|
95
|
+
try {
|
|
96
|
+
if (!(await stat(root)).isDirectory())
|
|
97
|
+
throw new Error('not a directory');
|
|
98
|
+
}
|
|
99
|
+
catch {
|
|
100
|
+
io.error(`not a directory: ${root}`);
|
|
101
|
+
return 1;
|
|
102
|
+
}
|
|
103
|
+
// Same guards `serve`/`run` apply at boot: a task worktree or `$HOME` itself
|
|
104
|
+
// is served happily but never registered, and asking for it explicitly does
|
|
105
|
+
// not buy an exemption.
|
|
106
|
+
if (!(await shouldRegisterProject(root))) {
|
|
107
|
+
io.error(`refusing to register ${root} — cezar task worktrees and your home directory are not projects`);
|
|
108
|
+
return 1;
|
|
109
|
+
}
|
|
110
|
+
const known = new Set((await loadWorkspaceConfig()).projects.map((p) => p.id));
|
|
111
|
+
const entry = await registerProject(root);
|
|
112
|
+
// Registration dedupes by realpath, so a second `add` of the same folder
|
|
113
|
+
// (or a symlink to it) reports the entry that already exists.
|
|
114
|
+
io.log(known.has(entry.id) ? ` = ${entry.id} (already registered) ${entry.root}` : ` + ${entry.id} ${entry.root}`);
|
|
115
|
+
return 0;
|
|
116
|
+
}
|
|
117
|
+
async function removeCommand(id, io) {
|
|
118
|
+
if (!id) {
|
|
119
|
+
io.error(USAGE);
|
|
120
|
+
return 1;
|
|
121
|
+
}
|
|
122
|
+
// Unlike `DELETE /api/projects/:projectId`, there is no boot-project refusal
|
|
123
|
+
// here: that rule exists because a running server would break its own
|
|
124
|
+
// sidebar, and the CLI runs with no server and no boot project. Removing the
|
|
125
|
+
// repo you normally serve is therefore allowed — and self-healing, since the
|
|
126
|
+
// next `cezar serve` in it registers it again (said in the note below).
|
|
127
|
+
if (!(await removeProject(id))) {
|
|
128
|
+
io.error(`unknown project: ${id}`);
|
|
129
|
+
return 1;
|
|
130
|
+
}
|
|
131
|
+
io.log(` - ${id} (registry entry only — the repo and its .ai/cezar/ are untouched)`);
|
|
132
|
+
return 0;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* `cezar projects tag <id> [<tag>…]` — the terminal twin of the Tags cell in
|
|
136
|
+
* Settings → Projects.
|
|
137
|
+
*
|
|
138
|
+
* Replaces the WHOLE list, like the PATCH route does, and for the same reason:
|
|
139
|
+
* the caller always knows the full set, and an add-one/remove-one grammar would
|
|
140
|
+
* be a merge protocol with no one to merge against. No tags at all clears them.
|
|
141
|
+
* Normalization is the shared `normalizeProjectTags`, so a tag typed here and a
|
|
142
|
+
* tag typed in the cockpit are stored identically.
|
|
143
|
+
*/
|
|
144
|
+
async function tagCommand(id, tags, io) {
|
|
145
|
+
if (!id) {
|
|
146
|
+
io.error(USAGE);
|
|
147
|
+
return 1;
|
|
148
|
+
}
|
|
149
|
+
const normalized = normalizeProjectTags(tags);
|
|
150
|
+
let known = false;
|
|
151
|
+
await mergeWriteWorkspaceConfig((config) => {
|
|
152
|
+
const entry = config.projects.find((project) => project.id === id);
|
|
153
|
+
if (!entry)
|
|
154
|
+
return;
|
|
155
|
+
known = true;
|
|
156
|
+
// Mutated in place so `.passthrough()` keys on the entry survive, and the key
|
|
157
|
+
// is DELETED rather than set to `[]`: an untagged project stores nothing.
|
|
158
|
+
if (normalized === undefined)
|
|
159
|
+
delete entry.tags;
|
|
160
|
+
else
|
|
161
|
+
entry.tags = normalized;
|
|
162
|
+
});
|
|
163
|
+
if (!known) {
|
|
164
|
+
io.error(`unknown project: ${id}`);
|
|
165
|
+
return 1;
|
|
166
|
+
}
|
|
167
|
+
io.log(normalized === undefined
|
|
168
|
+
? ` = ${id} (no tags)`
|
|
169
|
+
: ` = ${id} [${normalized.join(' ')}]`);
|
|
170
|
+
return 0;
|
|
171
|
+
}
|
|
172
|
+
//# sourceMappingURL=projects-cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projects-cli.js","sourceRoot":"","sources":["../../src/workspace/projects-cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAC7E,OAAO,EACL,YAAY,EACZ,oBAAoB,EACpB,eAAe,EACf,aAAa,EACb,qBAAqB,GACtB,MAAM,eAAe,CAAC;AAkBvB,MAAM,SAAS,GAAsB;IACnC,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;IAChC,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC;CACrC,CAAC;AAEF,MAAM,KAAK,GAAG;;;;;;;2DAO6C,CAAC;AAE5D,MAA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spaceProject } from './config.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Project registry operations over `~/.cezar/config.json` (spec
|
|
5
|
+
* 2026-07-20-multi-project-workspace, "Project identity" + "Boot flow"):
|
|
6
|
+
*
|
|
7
|
+
* - `registerProject(root)` — realpath-normalize, dedupe by realpath, allocate
|
|
8
|
+
* a human-readable slug from `basename(root)`. Registration is additive and
|
|
9
|
+
* goes through the read-modify-write merge, so the worst race outcome
|
|
10
|
+
* between concurrent `cezar serve` processes is a lost `lastOpenedAt` bump —
|
|
11
|
+
* never a lost project.
|
|
12
|
+
* - `listProjects()` — registry entries + a cheap per-root status/branch probe
|
|
13
|
+
* behind a short TTL cache, so a sidebar render never shells `git` N times.
|
|
14
|
+
* - `removeProject(id)` — unregister only. It never touches any file inside
|
|
15
|
+
* the repo (a project's own state stays in `<repo>/.ai/cezar/`).
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Slugs the allocator must never hand out: `default` is the reserved alias
|
|
19
|
+
* for the boot project, the rest are the cockpit shell's own top-level path
|
|
20
|
+
* segments. A repo named `default/` becomes `default-2` and can never shadow
|
|
21
|
+
* the alias or a route.
|
|
22
|
+
*/
|
|
23
|
+
export declare const RESERVED_PROJECT_IDS: ReadonlySet<string>;
|
|
24
|
+
/**
|
|
25
|
+
* Allocate a unique slug for `root`: the slug base, deduplicated against
|
|
26
|
+
* `taken` ids AND the reserved ids with a numeric suffix (`api`, `api-2`,
|
|
27
|
+
* `api-3`, …). Suffixed candidates stay within the 64-char cap by truncating
|
|
28
|
+
* the base, never the suffix.
|
|
29
|
+
*/
|
|
30
|
+
export declare function allocateProjectSlug(root: string, taken: Iterable<string>): string;
|
|
31
|
+
/**
|
|
32
|
+
* Registration guard (spec 2026-07-20-multi-project-workspace, "Boot flow"):
|
|
33
|
+
* auto-registration is suppressed — the process still serves the folder
|
|
34
|
+
* normally, it just doesn't pollute the registry — when the resolved
|
|
35
|
+
* `repoRoot` is:
|
|
36
|
+
*
|
|
37
|
+
* - inside any `…/.ai/cezar/worktrees/…` path (task worktrees and nested
|
|
38
|
+
* `cez` invocations — the same nesting reality the `CEZ_TODOS_FILE=''`
|
|
39
|
+
* guard in `workflows/run.ts` acknowledges), checked on both the raw and
|
|
40
|
+
* realpath'd spelling so neither a symlinked prefix nor a literal one
|
|
41
|
+
* slips through; or
|
|
42
|
+
* - the user's home directory itself (realpath-compared, so a symlinked
|
|
43
|
+
* `$HOME` still matches).
|
|
44
|
+
*/
|
|
45
|
+
export declare function shouldRegisterProject(repoRoot: string): Promise<boolean>;
|
|
46
|
+
/**
|
|
47
|
+
* Register `root` in the workspace registry (idempotent). Known root (by
|
|
48
|
+
* realpath) → bump its `lastOpenedAt` and return the existing entry, id and
|
|
49
|
+
* all. Unknown → allocate a slug and append a new entry via merge-write.
|
|
50
|
+
*/
|
|
51
|
+
export declare function registerProject(root: string, source?: 'local' | 'checkout'): Promise<WorkspaceProject>;
|
|
52
|
+
/**
|
|
53
|
+
* The ONE spelling rule for project tags — applied on every write, never on read.
|
|
54
|
+
*
|
|
55
|
+
* Trimmed, empties dropped, over-long ones truncated, deduped CASE-INSENSITIVELY (the first
|
|
56
|
+
* spelling wins, so `Storefront` typed before `storefront` keeps its capital), capped at
|
|
57
|
+
* `PROJECT_TAGS_MAX`, and sorted so two projects tagged with the same set store and render the
|
|
58
|
+
* same list. Case-insensitive dedupe is what makes tags usable as a grouping key: `API` and `api`
|
|
59
|
+
* grouping into two columns of the same thing is the whole failure this prevents.
|
|
60
|
+
*
|
|
61
|
+
* Returns `undefined` — never `[]` — for an empty result, because the registry stores nothing for
|
|
62
|
+
* an untagged project and `delete entry.tags` is what the writers then do.
|
|
63
|
+
*/
|
|
64
|
+
export declare function normalizeProjectTags(tags: readonly string[] | null | undefined): string[] | undefined;
|
|
65
|
+
export type ProjectStatus = 'ok' | 'missing' | 'not-git';
|
|
66
|
+
export interface ProjectListEntry extends WorkspaceProject {
|
|
67
|
+
/** `missing` = root gone/unreadable; `not-git` = exists but no `.git`. */
|
|
68
|
+
status: ProjectStatus;
|
|
69
|
+
/** Current branch when cheaply available (omitted e.g. on an unborn HEAD). */
|
|
70
|
+
branch?: string;
|
|
71
|
+
/** Which forge the root's remote belongs to (#698) — classified from the
|
|
72
|
+
* remote URL alone, no `gh` probe. Omitted when there is no forge remote.
|
|
73
|
+
* The sidebar gates each project group's GitHub tab on this, instead of on
|
|
74
|
+
* the boot folder's health-level forge answer. */
|
|
75
|
+
forge?: ForgeKind;
|
|
76
|
+
/** The remote's web root (`https://github.com/owner/repo`), rebuilt from the
|
|
77
|
+
* parsed remote so it can never carry credentials. What lets a cross-project
|
|
78
|
+
* surface link a reference the run knows only by NUMBER — the global Tasks
|
|
79
|
+
* page has one row per project and so cannot use any single repo's base. */
|
|
80
|
+
repoUrl?: string;
|
|
81
|
+
}
|
|
82
|
+
/** Test hook: drop cached probes so status changes are visible immediately. */
|
|
83
|
+
export declare function clearProjectProbeCache(): void;
|
|
84
|
+
/**
|
|
85
|
+
* One root's `status` (+`branch`) through the same TTL cache `listProjects`
|
|
86
|
+
* uses. Exported for `POST /api/projects` (step 4.2): the register route
|
|
87
|
+
* answers with the freshly registered entry and must hand the cockpit the
|
|
88
|
+
* SAME shape the list route does — one project, one shape, whichever route
|
|
89
|
+
* produced it.
|
|
90
|
+
*/
|
|
91
|
+
export declare function probeProjectStatus(root: string): Promise<Pick<ProjectListEntry, 'status' | 'branch' | 'forge' | 'repoUrl'>>;
|
|
92
|
+
/**
|
|
93
|
+
* Registry entries in stored order, each with its `status` (+`branch` when
|
|
94
|
+
* available). Probes run concurrently and are TTL-cached per root. A
|
|
95
|
+
* `missing` project is only ever *listed* — callers must never instantiate a
|
|
96
|
+
* context for it.
|
|
97
|
+
*/
|
|
98
|
+
export interface ProjectListSelector {
|
|
99
|
+
/** Return only this registry id without mutating or pruning other rows. */
|
|
100
|
+
projectId: string;
|
|
101
|
+
}
|
|
102
|
+
export declare function listProjects(selector?: ProjectListSelector): Promise<ProjectListEntry[]>;
|
|
103
|
+
/**
|
|
104
|
+
* Remove `id` from the registry. Returns false when no such entry exists.
|
|
105
|
+
* Pure unregistration: nothing inside the repo (worktrees, `.ai/cezar/`,
|
|
106
|
+
* run history) is touched — re-registering the same root later gets a fresh
|
|
107
|
+
* slug but finds all its state intact.
|
|
108
|
+
*/
|
|
109
|
+
export declare function removeProject(id: string): Promise<boolean>;
|