even-keel 0.2.4 → 0.3.0-rc.2
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/.claude-plugin/marketplace.json +16 -4
- package/.env.example +2 -2
- package/CHANGELOG.md +23 -0
- package/README.md +10 -8
- package/dist/src/account/aws.js +76 -0
- package/dist/src/account/azure.js +36 -0
- package/dist/src/account/cloud-errors.js +72 -0
- package/dist/src/account/cloud.js +335 -0
- package/dist/src/account/credit.js +49 -7
- package/dist/src/account/gcloud.js +71 -0
- package/dist/src/account/header-levels.js +3 -2
- package/dist/src/account/homes.js +49 -5
- package/dist/src/account/keycheck.js +57 -4
- package/dist/src/account/management.js +41 -0
- package/dist/src/account/model.js +41 -18
- package/dist/src/account/network.js +8 -3
- package/dist/src/account/service-defaults.js +12 -3
- package/dist/src/account/settingsGuard.js +92 -0
- package/dist/src/account/settingsGuardStrip.js +36 -0
- package/dist/src/account/settingsHook.js +15 -0
- package/dist/src/account/settingsLayer.js +190 -0
- package/dist/src/account/settingsUninstall.js +7 -0
- package/dist/src/account/share.js +23 -6
- package/dist/src/account/spend.js +155 -0
- package/dist/src/account/watcher.js +189 -24
- package/dist/src/agent/adapters.js +13 -2
- package/dist/src/agent/env.js +22 -7
- package/dist/src/agent/model-slots.js +32 -0
- package/dist/src/agent/process.js +32 -6
- package/dist/src/agent/projectRules.js +3 -2
- package/dist/src/agent/providers.js +18 -1
- package/dist/src/agent/scripted.js +319 -0
- package/dist/src/agent/windows.js +35 -3
- package/dist/src/badge/action.js +41 -0
- package/dist/src/badge/check.js +60 -0
- package/dist/src/badge/collect.js +174 -0
- package/dist/src/badge/dates.js +29 -0
- package/dist/src/badge/drawing.js +3 -0
- package/dist/src/badge/fonts.generated.js +11 -0
- package/dist/src/badge/model.js +9 -0
- package/dist/src/badge/privacy.js +151 -0
- package/dist/src/badge/push.js +117 -0
- package/dist/src/badge/render.js +490 -0
- package/dist/src/badge/settings.js +43 -0
- package/dist/src/badge/stats.js +31 -0
- package/dist/src/badge/status.js +57 -0
- package/dist/src/badge/text.js +52 -0
- package/dist/src/badge/theme.js +54 -0
- package/dist/src/badge/translate.js +162 -0
- package/dist/src/builtin/adapter.js +40 -0
- package/dist/src/builtin/control.js +179 -0
- package/dist/src/builtin/editor.js +117 -0
- package/dist/src/builtin/export-store.js +67 -0
- package/dist/src/builtin/export.js +202 -0
- package/dist/src/builtin/exporting.js +25 -0
- package/dist/src/builtin/files.js +155 -0
- package/dist/src/builtin/links.js +25 -0
- package/dist/src/builtin/model.js +59 -0
- package/dist/src/builtin/routes.js +108 -0
- package/dist/src/builtin/source.js +240 -0
- package/dist/src/builtin/store.js +520 -0
- package/dist/src/builtin/switch.js +77 -0
- package/dist/src/chain/answers.js +27 -0
- package/dist/src/chain/archive.js +0 -1
- package/dist/src/chain/dispatcher.js +105 -12
- package/dist/src/chain/fence.js +30 -0
- package/dist/src/chain/handover.js +27 -9
- package/dist/src/chain/launches.js +4 -4
- package/dist/src/chain/limitNotice.js +1 -1
- package/dist/src/chain/lists.js +42 -6
- package/dist/src/chain/log.js +3 -1
- package/dist/src/chain/maincheck.js +116 -10
- package/dist/src/chain/mainci.js +26 -7
- package/dist/src/chain/mainfix.js +12 -1
- package/dist/src/chain/milestone-sequence.js +40 -0
- package/dist/src/chain/milestones.js +3 -2
- package/dist/src/chain/order.js +20 -5
- package/dist/src/chain/overage.js +7 -2
- package/dist/src/chain/places.js +1 -1
- package/dist/src/chain/prompts.js +64 -6
- package/dist/src/chain/relay.js +35 -14
- package/dist/src/chain/reviews.js +8 -4
- package/dist/src/chain/rules.js +40 -11
- package/dist/src/chain/snapshots.js +2 -0
- package/dist/src/chain/start.js +21 -1
- package/dist/src/chain/store.js +16 -6
- package/dist/src/chain/unchanged.js +68 -5
- package/dist/src/ci/adapters.js +3 -1
- package/dist/src/ci/forgejo-profile.js +3 -24
- package/dist/src/ci/forgejo.js +2 -1
- package/dist/src/ci/github.js +10 -2
- package/dist/src/ci/gitlab.js +10 -3
- package/dist/src/ci/http.js +4 -0
- package/dist/src/ci/model.js +79 -6
- package/dist/src/ci/report.js +6 -3
- package/dist/src/ci/shared.js +9 -0
- package/dist/src/ci/verdict.js +18 -7
- package/dist/src/ci/watcher.js +95 -23
- package/dist/src/ci/wiring.js +15 -0
- package/dist/src/claude/adapter.js +34 -8
- package/dist/src/claude/cli.js +32 -8
- package/dist/src/claude/instructions.js +42 -7
- package/dist/src/claude/oauth.js +67 -0
- package/dist/src/claude/sdk/host.js +9 -4
- package/dist/src/claude/tree.js +45 -14
- package/dist/src/cli-check/run.js +3 -3
- package/dist/src/cli-check/support.js +4 -4
- package/dist/src/cli.js +54 -17
- package/dist/src/codex/adapter.js +2 -0
- package/dist/src/codex/cli.js +34 -18
- package/dist/src/codex/protection.js +17 -11
- package/dist/src/codex/rollout.js +9 -2
- package/dist/src/codex/turns.js +6 -3
- package/dist/src/codex/window.js +14 -0
- package/dist/src/config-form.js +63 -7
- package/dist/src/config-store.js +29 -7
- package/dist/src/config.js +45 -15
- package/dist/src/copilot/adapter.js +2 -0
- package/dist/src/copilot/cli.js +8 -11
- package/dist/src/copilot/home.js +1 -1
- package/dist/src/copilot/transcript.js +1 -2
- package/dist/src/demo/agent.js +97 -0
- package/dist/src/demo/model.js +6 -0
- package/dist/src/demo/scenario.js +139 -0
- package/dist/src/demo/service.js +161 -0
- package/dist/src/diagnostics/stop.js +16 -0
- package/dist/src/env-file.js +4 -0
- package/dist/src/error-reason.js +10 -0
- package/dist/src/event-log/log.js +97 -0
- package/dist/src/event-log/model.js +1 -0
- package/dist/src/event-log/page-events.js +71 -0
- package/dist/src/event-log/watch.js +236 -0
- package/dist/src/events.js +57 -1
- package/dist/src/forgejo/adapter.js +49 -0
- package/dist/src/forgejo/api.js +95 -0
- package/dist/src/forgejo/editor.js +196 -0
- package/dist/src/forgejo/model.js +90 -0
- package/dist/src/forgejo/profile.js +24 -0
- package/dist/src/forgejo/source.js +292 -0
- package/dist/src/forgejo/trust.js +45 -0
- package/dist/src/git/branches.js +88 -0
- package/dist/src/git/clone-progress.js +168 -0
- package/dist/src/git/remote-run.js +162 -0
- package/dist/src/git/run.js +6 -2
- package/dist/src/git/setup.js +4 -5
- package/dist/src/git/slot.js +9 -7
- package/dist/src/git/worktree.js +13 -10
- package/dist/src/github/adapter.js +1 -0
- package/dist/src/github/editor.js +214 -0
- package/dist/src/github/edits.js +31 -0
- package/dist/src/github/model.js +10 -4
- package/dist/src/github/source.js +66 -15
- package/dist/src/gitlab/adapter.js +1 -0
- package/dist/src/gitlab/api.js +4 -2
- package/dist/src/gitlab/editor.js +248 -0
- package/dist/src/gitlab/model.js +43 -4
- package/dist/src/gitlab/source.js +113 -22
- package/dist/src/guard.js +26 -10
- package/dist/src/hotkeys.js +51 -0
- package/dist/src/huly/adapter.js +1 -0
- package/dist/src/huly/collab.js +15 -0
- package/dist/src/huly/editor.js +241 -0
- package/dist/src/huly/marks.js +48 -0
- package/dist/src/huly/model.js +22 -5
- package/dist/src/huly/source.js +111 -48
- package/dist/src/intake/github.js +10 -0
- package/dist/src/intake/intake.js +41 -1
- package/dist/src/intake/model.js +8 -3
- package/dist/src/jira/adapter.js +1 -0
- package/dist/src/jira/api.js +28 -7
- package/dist/src/jira/editor.js +243 -0
- package/dist/src/jira/model.js +19 -5
- package/dist/src/jira/source.js +41 -9
- package/dist/src/jobs/model.js +1 -0
- package/dist/src/jobs/runner.js +236 -0
- package/dist/src/limits/chatgpt.js +11 -0
- package/dist/src/limits/copilot.js +51 -18
- package/dist/src/limits/model.js +62 -8
- package/dist/src/limits/overage-session.js +2 -2
- package/dist/src/limits/overage.js +8 -5
- package/dist/src/limits/reset.js +7 -0
- package/dist/src/limits/usage.js +60 -5
- package/dist/src/linear/adapter.js +1 -0
- package/dist/src/linear/editor.js +220 -0
- package/dist/src/linear/estimate.js +32 -0
- package/dist/src/linear/model.js +24 -3
- package/dist/src/linear/source.js +74 -21
- package/dist/src/main.js +53 -23
- package/dist/src/notice/en-advice.js +28 -0
- package/dist/src/notice/en-review.js +29 -0
- package/dist/src/notice/en-startup.js +21 -0
- package/dist/src/notice/en-values.js +47 -0
- package/dist/src/notice/en.js +265 -96
- package/dist/src/notice/kinds.js +26 -0
- package/dist/src/notice/notice.js +49 -6
- package/dist/src/npm-access.js +58 -0
- package/dist/src/opencode/adapter.js +4 -2
- package/dist/src/opencode/cli.js +34 -25
- package/dist/src/opencode/go.js +51 -0
- package/dist/src/opencode/home.js +41 -8
- package/dist/src/opencode/transcript.js +5 -5
- package/dist/src/opencode/usage.js +10 -4
- package/dist/src/opencode/window.js +54 -0
- package/dist/src/packages/check.js +11 -5
- package/dist/src/packages/gateway.js +76 -6
- package/dist/src/packages/launch.js +6 -3
- package/dist/src/packages/model.js +61 -2
- package/dist/src/packages/npm.js +55 -6
- package/dist/src/packages/plugins.js +23 -2
- package/dist/src/packages/service.js +104 -17
- package/dist/src/packages/settings.js +13 -0
- package/dist/src/packages/store.js +1 -1
- package/dist/src/paths.js +32 -0
- package/dist/src/profiles/control.js +1 -0
- package/dist/src/profiles/model.js +2 -2
- package/dist/src/profiles/oauth-error.js +1 -9
- package/dist/src/profiles/oauth-response.js +2 -0
- package/dist/src/profiles/service.js +46 -4
- package/dist/src/profiles/store.js +10 -5
- package/dist/src/projects/add.js +25 -2
- package/dist/src/projects/branch-control.js +86 -0
- package/dist/src/projects/branch-move.js +39 -0
- package/dist/src/projects/branch.js +13 -0
- package/dist/src/projects/check.js +80 -36
- package/dist/src/projects/creation.js +166 -0
- package/dist/src/projects/git-found.js +62 -0
- package/dist/src/projects/git-mode.js +116 -0
- package/dist/src/projects/own-folder.js +8 -0
- package/dist/src/projects/place.js +235 -0
- package/dist/src/projects/remote-branches.js +24 -0
- package/dist/src/projects/target-read.js +95 -0
- package/dist/src/projects/target.js +56 -0
- package/dist/src/review/events.js +1 -1
- package/dist/src/review/note.js +58 -0
- package/dist/src/review/open.js +3 -3
- package/dist/src/review/wiring.js +25 -3
- package/dist/src/secrets/catalog.js +4 -1
- package/dist/src/server-control.js +1 -0
- package/dist/src/server-guard.js +4 -0
- package/dist/src/server-request.js +88 -10
- package/dist/src/server-response.js +143 -0
- package/dist/src/server-security.js +16 -0
- package/dist/src/server.js +105 -117
- package/dist/src/service/account-packages.js +116 -0
- package/dist/src/service/accounts.js +109 -81
- package/dist/src/service/badge-private.js +62 -0
- package/dist/src/service/badge.js +203 -0
- package/dist/src/service/chain-prompts.js +87 -0
- package/dist/src/service/chain.js +120 -190
- package/dist/src/service/cleanup.js +114 -0
- package/dist/src/service/cli-check.js +1 -1
- package/dist/src/service/closing.js +57 -0
- package/dist/src/service/demo.js +46 -0
- package/dist/src/service/hosting.js +239 -18
- package/dist/src/service/install-check.js +78 -0
- package/dist/src/service/lifecycle.js +4 -7
- package/dist/src/service/stats.js +3 -3
- package/dist/src/service/trackers.js +27 -1
- package/dist/src/service/vocabulary.js +17 -0
- package/dist/src/service.js +215 -19
- package/dist/src/sessions/agents.js +10 -2
- package/dist/src/sessions/approvals.js +1 -1
- package/dist/src/sessions/ask.js +32 -6
- package/dist/src/sessions/boot.js +7 -0
- package/dist/src/sessions/chat.js +16 -4
- package/dist/src/sessions/commandPrompt.js +13 -6
- package/dist/src/sessions/history.js +2 -0
- package/dist/src/sessions/keepwarm.js +1 -1
- package/dist/src/sessions/launch.js +21 -25
- package/dist/src/sessions/lingering.js +30 -7
- package/dist/src/sessions/mail.js +7 -6
- package/dist/src/sessions/mailRelay.js +2 -2
- package/dist/src/sessions/mailbox.js +1 -1
- package/dist/src/sessions/monitor.js +47 -3
- package/dist/src/sessions/note.js +44 -19
- package/dist/src/sessions/permission.js +32 -10
- package/dist/src/sessions/protection.js +38 -14
- package/dist/src/sessions/rare.js +130 -0
- package/dist/src/sessions/runs-store.js +20 -0
- package/dist/src/sessions/runs.js +140 -0
- package/dist/src/sessions/tail.js +4 -0
- package/dist/src/sessions/transcript.js +64 -8
- package/dist/src/settings/defaults.js +1 -0
- package/dist/src/settings/registry.js +86 -24
- package/dist/src/settings/store.js +14 -5
- package/dist/src/setup.js +5 -0
- package/dist/src/shown-work.js +22 -0
- package/dist/src/state/settings.js +1 -0
- package/dist/src/stats/base-sql.js +7 -1
- package/dist/src/stats/checkpoint.js +8 -5
- package/dist/src/stats/model.js +1 -1
- package/dist/src/stats/reader.js +50 -25
- package/dist/src/stats/rules-reader.js +6 -2
- package/dist/src/stats/steps-reader.js +5 -0
- package/dist/src/stats/tally-schema.js +1 -1
- package/dist/src/storage/backup-model.js +3 -0
- package/dist/src/storage/backup-schedule.js +197 -0
- package/dist/src/storage/backup-worker.js +9 -0
- package/dist/src/storage/backup.js +141 -0
- package/dist/src/storage/browser-hotkeys.js +25 -0
- package/dist/src/storage/context-windows.js +39 -0
- package/dist/src/storage/copy.js +44 -13
- package/dist/src/storage/database.js +343 -4
- package/dist/src/storage/left-folders.js +16 -0
- package/dist/src/storage/migrations.js +98 -1
- package/dist/src/storage/owner.js +12 -7
- package/dist/src/storage/schema.js +1 -1
- package/dist/src/storage/startup.js +25 -0
- package/dist/src/storage/state-files.js +1 -1
- package/dist/src/storage/vacuum.js +29 -0
- package/dist/src/taskmcp/args.js +146 -0
- package/dist/src/taskmcp/calls.js +741 -0
- package/dist/src/taskmcp/downloads.js +87 -0
- package/dist/src/taskmcp/files.js +58 -0
- package/dist/src/taskmcp/retries.js +57 -0
- package/dist/src/taskmcp/server.js +81 -0
- package/dist/src/taskmcp/tools.js +128 -0
- package/dist/src/taskmcp/vocabulary.js +75 -0
- package/dist/src/tools/panel.js +41 -8
- package/dist/src/tools/sessionSettings.js +2 -1
- package/dist/src/tools/settings.js +16 -3
- package/dist/src/tracker/adapters.js +3 -1
- package/dist/src/tracker/card.js +16 -12
- package/dist/src/tracker/close.js +57 -0
- package/dist/src/tracker/closer.js +18 -15
- package/dist/src/tracker/closes.js +6 -0
- package/dist/src/tracker/control.js +32 -13
- package/dist/src/tracker/diagnostics.js +5 -2
- package/dist/src/tracker/editor.js +108 -0
- package/dist/src/tracker/export-target.js +30 -0
- package/dist/src/tracker/export.js +168 -0
- package/dist/src/tracker/health.js +5 -0
- package/dist/src/tracker/link.js +127 -24
- package/dist/src/tracker/markers.js +7 -0
- package/dist/src/tracker/model.js +0 -12
- package/dist/src/tracker/parents.js +8 -0
- package/dist/src/tracker/questions.js +24 -3
- package/dist/src/tracker/readers.js +19 -3
- package/dist/src/tracker/source.js +5 -0
- package/dist/src/tracker/start.js +61 -6
- package/dist/src/tracker/templates.js +102 -0
- package/dist/src/tracker/trackers.js +20 -10
- package/dist/src/updates/runner.js +1 -1
- package/dist/src/updates/settle.js +11 -3
- package/dist/src/updates/updater.js +4 -4
- package/dist/tally/src/builtin-tasks.js +45 -0
- package/dist/tally/src/catalogue.js +70 -0
- package/dist/tally/src/classify.js +1 -0
- package/dist/tally/src/collect.js +33 -10
- package/dist/tally/src/copilot.js +1 -0
- package/dist/tally/src/db-classify.js +46 -0
- package/dist/tally/src/db.js +66 -60
- package/dist/tally/src/migrations/10-rework-label.sql +73 -0
- package/dist/tally/src/migrations/11-catalogue-prices.sql +53 -0
- package/dist/tally/src/migrations/12-key-spends.sql +30 -0
- package/dist/tally/src/migrations/13-normal-spans.sql +110 -0
- package/dist/tally/src/migrations/14-model-families.sql +25 -0
- package/dist/tally/src/migrations/15-task-moves.sql +32 -0
- package/dist/tally/src/migrations.js +1 -1
- package/dist/tally/src/opencode.js +1 -0
- package/dist/tally/src/parse.js +3 -0
- package/dist/tally/src/rollout.js +2 -1
- package/dist/tally/src/rule-hook-size.js +2 -1
- package/dist/tally/src/rule-hook.js +3 -0
- package/dist/tally/src/task-moves.js +32 -0
- package/dist/web/assets/BadgeDialog-Dx2EERWr.js +1 -0
- package/dist/web/assets/BadgeDialog-W0giN4k2.css +1 -0
- package/dist/web/assets/DescriptionEditor-BL_6314d.js +216 -0
- package/dist/web/assets/ProjectPackages-D-Hqs0sG.js +1 -0
- package/dist/web/assets/Select-B5xZpiCG.js +1 -0
- package/dist/web/assets/Select-CYemy5Na.css +1 -0
- package/dist/web/assets/TaskCard-B9EJ_Qa2.js +2 -0
- package/dist/web/assets/TaskCard-BV2lQojC.css +1 -0
- package/dist/web/assets/TranscriptWindow-BN6jSpev.css +1 -0
- package/dist/web/assets/TranscriptWindow-E8DxggYC.js +4 -0
- package/dist/web/assets/accountParts-c2gPSGKK.js +3 -0
- package/dist/web/assets/accountParts-tFRVownp.css +1 -0
- package/dist/web/assets/blocks-B03KxlgQ.js +12 -0
- package/dist/web/assets/blocks-Dx3DACiG.css +1 -0
- package/dist/web/assets/cardDrafts-Cb5dNpJ3.js +12 -0
- package/dist/web/assets/cardDrafts-izWnctoh.css +1 -0
- package/dist/web/assets/cardSide-63fNWHHv.css +1 -0
- package/dist/web/assets/cardSide-CIGvmTwG.js +2 -0
- package/dist/web/assets/description-C-o9LBbp.css +1 -0
- package/dist/web/assets/feedLine-Buzox_AA.js +1 -0
- package/dist/web/assets/feedLine-CBjZXWwX.css +1 -0
- package/dist/web/assets/hooks-DdmIE6gF.js +1 -0
- package/dist/web/assets/index-CkYiatZt.css +1 -0
- package/dist/web/assets/index-DELgEMlH.js +25 -0
- package/dist/web/assets/lib-B8qNeB0X.css +1 -0
- package/dist/web/assets/lib-C1i2rKJZ.js +18 -0
- package/dist/web/assets/overview-B7iEgjQD.css +1 -0
- package/dist/web/assets/overview-D9PUjFeR.js +7 -0
- package/dist/web/assets/packageGroups-B34vA6-0.js +1 -0
- package/dist/web/assets/packages-Dld4uH9X.css +1 -0
- package/dist/web/assets/react-dom-vGPErQYp.js +1 -0
- package/dist/web/assets/rules-BVB-I2tg.js +1 -0
- package/dist/web/assets/rules-Bgil4ZBp.css +1 -0
- package/dist/web/assets/secret-CmK85pY6.js +1 -0
- package/dist/web/assets/secret-DldsC74x.css +1 -0
- package/dist/web/assets/useFileDrop-eZtIxL1H.js +1 -0
- package/dist/web/assets/useHeightGlide-BmtdsmN0.css +1 -0
- package/dist/web/assets/useHeightGlide-DQvvOoIL.js +3 -0
- package/dist/web/assets/useRowFocus-CwOoEmzD.js +1 -0
- package/dist/web/index.html +30 -9
- package/dist/web/theme.js +6 -0
- package/even-keel.config.example.json +5 -4
- package/package.json +21 -5
- package/plugins/agent-bridge/.claude-plugin/plugin.json +16 -0
- package/plugins/{checkpoint → agent-bridge}/README.md +20 -6
- package/plugins/agent-bridge/hooks/addressban.mjs +64 -0
- package/plugins/{checkpoint → agent-bridge}/hooks/checkpoint-mark.mjs +4 -3
- package/plugins/{checkpoint → agent-bridge}/hooks/evenkeel.mjs +28 -11
- package/plugins/agent-bridge/hooks/git-ban.mjs +31 -0
- package/plugins/agent-bridge/hooks/gitban.mjs +83 -0
- package/plugins/agent-bridge/hooks/handoff.mjs +20 -0
- package/plugins/{checkpoint → agent-bridge}/hooks/hooks.json +10 -0
- package/plugins/{checkpoint → agent-bridge}/hooks/mailbox.mjs +6 -3
- package/plugins/{checkpoint → agent-bridge}/hooks/nudges.mjs +11 -7
- package/plugins/{checkpoint/opencode/checkpoint.mjs → agent-bridge/opencode/agent-bridge.mjs} +15 -9
- package/plugins/forgejo/.claude-plugin/plugin.json +7 -0
- package/plugins/forgejo/.mcp.json +13 -0
- package/plugins/forgejo/README.md +23 -0
- package/plugins/forgejo/skills/task/SKILL.md +55 -0
- package/plugins/github/.claude-plugin/plugin.json +1 -1
- package/plugins/github/README.md +1 -1
- package/plugins/github/skills/task/SKILL.md +2 -2
- package/plugins/gitlab/.claude-plugin/plugin.json +1 -1
- package/plugins/gitlab/skills/task/SKILL.md +2 -2
- package/plugins/huly/.claude-plugin/plugin.json +1 -1
- package/plugins/huly/skills/task/SKILL.md +4 -4
- package/plugins/jira/.claude-plugin/plugin.json +1 -1
- package/plugins/jira/skills/task/SKILL.md +3 -3
- package/plugins/linear/.claude-plugin/plugin.json +1 -1
- package/plugins/linear/README.md +1 -1
- package/plugins/linear/skills/task/SKILL.md +3 -3
- package/plugins/tally/.claude-plugin/plugin.json +1 -1
- package/plugins/tally/skills/session-audit/SKILL.md +5 -5
- package/plugins/tasks/.claude-plugin/plugin.json +9 -0
- package/plugins/tasks/.mcp.json +8 -0
- package/plugins/tasks/README.md +42 -0
- package/plugins/tasks/hooks/calibration-context.mjs +45 -0
- package/plugins/tasks/hooks/calibration.mjs +92 -0
- package/plugins/tasks/hooks/check-service.mjs +15 -0
- package/plugins/tasks/hooks/hooks.json +28 -0
- package/plugins/tasks/hooks/service-check.mjs +34 -0
- package/plugins/tasks/hooks/show-calibration.mjs +19 -0
- package/plugins/tasks/opencode/tasks.mjs +28 -0
- package/plugins/tasks/skills/split/SKILL.md +29 -0
- package/plugins/tasks/skills/task/SKILL.md +61 -0
- package/service/EvenKeelTray.cs +4 -20
- package/service/install.sh +25 -2
- package/service/uninstall.ps1 +16 -0
- package/service/uninstall.sh +10 -0
- package/tally/tally.config.json +2 -0
- package/dist/web/assets/Loader-CRe-GCoI.js +0 -31
- package/dist/web/assets/Loader-DJJTBsaF.css +0 -1
- package/dist/web/assets/TaskCard-Br2QIllc.css +0 -1
- package/dist/web/assets/TaskCard-C2xeaHWD.js +0 -2
- package/dist/web/assets/TranscriptWindow-B9zsSmIg.css +0 -1
- package/dist/web/assets/TranscriptWindow-COL_WTrF.js +0 -4
- package/dist/web/assets/feedLine-D0lnFyBZ.js +0 -1
- package/dist/web/assets/index-DQje9Nfo.js +0 -25
- package/dist/web/assets/index-mDBlgk2Y.css +0 -1
- package/dist/web/assets/media-BlW-XXN0.js +0 -1
- package/dist/web/assets/media-DR8nAbPy.css +0 -1
- package/dist/web/assets/useModels-1oIk0mDX.css +0 -1
- package/dist/web/assets/useModels-DRW63oka.js +0 -15
- package/plugins/checkpoint/.claude-plugin/plugin.json +0 -9
- package/plugins/checkpoint/hooks/handoff.mjs +0 -9
- /package/plugins/{checkpoint → agent-bridge}/hooks/context-checkpoint.mjs +0 -0
- /package/plugins/{checkpoint → agent-bridge}/hooks/merge-check.mjs +0 -0
- /package/plugins/{checkpoint → agent-bridge}/hooks/merges.mjs +0 -0
- /package/plugins/{checkpoint → agent-bridge}/hooks/permission.mjs +0 -0
- /package/plugins/{checkpoint → agent-bridge}/hooks/schema-hint.mjs +0 -0
- /package/plugins/{checkpoint → agent-bridge}/hooks/standard-gate.mjs +0 -0
- /package/plugins/{checkpoint → agent-bridge}/hooks/standards.mjs +0 -0
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import { DEFAULT_PROVIDER } from '../agent/providers.js';
|
|
2
|
-
import { CLAUDE } from '../claude/name.js';
|
|
3
2
|
import { parseRemote, remotesOf } from '../ci/remote.js';
|
|
4
3
|
import { withNewProject, yieldedMilestones } from '../config-form.js';
|
|
5
|
-
import { DEFAULT_BRANCH, isPlainObject, parseConfig, projectLabels
|
|
6
|
-
import {
|
|
4
|
+
import { DEFAULT_BRANCH, isPlainObject, parseConfig, projectLabels } from '../config.js';
|
|
5
|
+
import { currentBranch, isBranchName, readBranches } from '../git/branches.js';
|
|
6
|
+
import { sharedRemoteReader } from '../git/remote-run.js';
|
|
7
|
+
import { fail, notice, NoticeError, noticeOf } from '../notice/notice.js';
|
|
7
8
|
import { pathsOf, samePath, sameSpelling, workingFolder } from '../paths.js';
|
|
8
9
|
import { expandFolder, isFullPath, REAL_FOLDERS } from './folder.js';
|
|
10
|
+
import { projectsDir } from './own-folder.js';
|
|
11
|
+
import { checkPlace } from './place.js';
|
|
12
|
+
import { lacksIdentity, readTarget } from './target-read.js';
|
|
9
13
|
import { errorText, TrackerLink } from '../tracker/link.js';
|
|
10
14
|
import { isOpen } from '../tracker/model.js';
|
|
11
15
|
import { trackerOf } from '../tracker/source.js';
|
|
16
|
+
import { isOwnRepo, readIssueTemplates, templateHits } from '../tracker/templates.js';
|
|
12
17
|
const ENTRY_ID = 'wizard-check';
|
|
13
18
|
/**
|
|
14
19
|
* What the wizard's draft would come to: the repository and its branch, the config with the draft added, the tracker's
|
|
@@ -20,72 +25,102 @@ export async function checkDraft(deps, draft, options = { tracker: true }) {
|
|
|
20
25
|
const platform = deps.platform ?? process.platform;
|
|
21
26
|
const raw = deps.raw();
|
|
22
27
|
const adapter = deps.adapters[draft.tracker];
|
|
23
|
-
const repo = await checkRepo(deps.git, draft, raw, platform, adapter, deps.env, deps.folders);
|
|
28
|
+
const repo = await checkRepo(deps.git, draft, raw, platform, adapter, deps.env, deps.folders, deps.projectsDir, deps.readRemote);
|
|
29
|
+
// A folder Even Keel makes or fills when the project is created gets its trust then: nothing to trust yet.
|
|
30
|
+
const unmade = repo.place !== undefined || (draft.git === false && draft.repo.trim() === '');
|
|
24
31
|
const branch = draft.branch.trim() || repo.current || DEFAULT_BRANCH;
|
|
25
32
|
let entry = null;
|
|
26
33
|
let rules;
|
|
27
34
|
let yields = [];
|
|
28
|
-
let labels = isPlainObject(raw) && raw.modelLabels === true;
|
|
29
35
|
try {
|
|
30
36
|
const placed = { ...draft, repo: repo.root ?? draft.repo, branch };
|
|
31
37
|
const config = parseConfig(withNewProject(raw, placed, ENTRY_ID, deps.adapters), deps.adapters);
|
|
32
38
|
rules = config.rules[ENTRY_ID];
|
|
33
|
-
labels = runSettings(config, ENTRY_ID).labels;
|
|
34
39
|
const names = projectLabels(config);
|
|
35
40
|
yields = Object.keys(yieldedMilestones(raw, placed, ENTRY_ID, deps.adapters)).map((project) => names[project]);
|
|
36
41
|
}
|
|
37
42
|
catch (error) {
|
|
38
|
-
|
|
43
|
+
const refused = noticeOf(error);
|
|
44
|
+
// No folder yet is the repository step's to say (BTN-1107): its own refusal, or the footer for a blank field.
|
|
45
|
+
entry = refused.code === 'config.repoEmpty' && repo.root === null ? null : keyNotice(refused);
|
|
39
46
|
}
|
|
40
47
|
const tracker = options.tracker && entry === null && rules !== undefined && adapter !== undefined && repo.root !== null && repo.notice === null
|
|
41
|
-
? await checkTracker(adapter, deps, draft.key.trim(), draft.trackerProject.trim(), rules)
|
|
48
|
+
? await checkTracker(adapter, deps, draft.key.trim(), draft.trackerProject.trim(), rules, { root: repo.root, branch })
|
|
42
49
|
: null;
|
|
43
50
|
const provider = draft.provider ?? (isPlainObject(raw) && typeof raw.provider === 'string' ? raw.provider : DEFAULT_PROVIDER);
|
|
44
51
|
const root = repo.root;
|
|
45
|
-
//
|
|
46
|
-
const trusted = root === null ||
|
|
52
|
+
// A task's run can give it to Claude, whatever the project's own agent (BTN-429, BTN-983).
|
|
53
|
+
const trusted = root === null || unmade ? null : deps.claudeConfigs().some((config) => isTrusted(config, root, platform));
|
|
47
54
|
return { repo, entry, yields, tracker, trusted, platform, user: deps.user, service: deps.service };
|
|
48
55
|
}
|
|
49
|
-
export async function checkRepo(git, draft, raw, platform = process.platform, adapter, env = {}, folders = REAL_FOLDERS) {
|
|
56
|
+
export async function checkRepo(git, draft, raw, platform = process.platform, adapter, env = {}, folders = REAL_FOLDERS, ownDir = projectsDir(), readRemote = sharedRemoteReader) {
|
|
50
57
|
const typed = draft.repo.trim();
|
|
58
|
+
const none = { root: null, current: null, suggested: null, branches: null };
|
|
59
|
+
const plain = draft.git === false;
|
|
60
|
+
if (!plain && draft.target !== undefined) {
|
|
61
|
+
const resolved = await readTarget({ git, platform, folders, ownDir, projectOf: (folder) => projectOfRepo(raw, folder, platform) }, draft);
|
|
62
|
+
const read = resolved.read === null ? {} : { read: resolved.read };
|
|
63
|
+
if (resolved.draft === null)
|
|
64
|
+
return { ...none, ...read, notice: resolved.notice };
|
|
65
|
+
return { ...(await checkRepo(git, resolved.draft, raw, platform, adapter, env, folders, ownDir, readRemote)), ...read };
|
|
66
|
+
}
|
|
67
|
+
// A page that sends no `folder` for a project without git means Even Keel's own folder of the project, as before BTN-1048.
|
|
68
|
+
if (plain ? typed === '' && draft.folder !== undefined : draft.source === 'clone' || draft.source === 'new') {
|
|
69
|
+
const projectOf = (folder) => projectOfRepo(raw, folder, platform);
|
|
70
|
+
return checkPlace({ git, platform, folders, ownDir, readRemote, projectOf, ...(adapter === undefined ? {} : { adapter }), env }, draft);
|
|
71
|
+
}
|
|
51
72
|
if (typed === '')
|
|
52
|
-
return { root:
|
|
73
|
+
return { ...none, root: plain ? ownDir : null, notice: null };
|
|
53
74
|
const path = expandFolder(typed, folders.home, platform);
|
|
54
|
-
const refuse = (code) => ({
|
|
75
|
+
const refuse = (code) => ({ ...none, notice: notice(code, { path: typed }) });
|
|
55
76
|
if (!isFullPath(path, platform))
|
|
56
77
|
return refuse(platform === 'win32' && /%[^%]+%/.test(path) ? 'wizard.noFolder' : 'wizard.relativePath');
|
|
78
|
+
if (plain) {
|
|
79
|
+
// The folder may lie inside a repository that is not the project's: git is not asked about it.
|
|
80
|
+
const folder = pathsOf(platform).normalize(path);
|
|
81
|
+
const taken = projectOfRepo(raw, folder, platform);
|
|
82
|
+
return { ...none, root: folder, notice: taken === undefined ? null : notice('wizard.folderTaken', { project: taken }) };
|
|
83
|
+
}
|
|
57
84
|
if (!folders.isFolder(path))
|
|
58
85
|
return refuse('wizard.noFolder');
|
|
59
86
|
const top = await git(path, ['rev-parse', '--show-toplevel']);
|
|
60
87
|
if (top.missing === true)
|
|
61
|
-
return {
|
|
88
|
+
return { ...none, notice: notice('git.missing', {}) };
|
|
62
89
|
if (top.code !== 0)
|
|
63
|
-
return {
|
|
90
|
+
return { ...none, notice: notice('wizard.notRepo', { path }, { detail: top.out }) };
|
|
64
91
|
const root = pathsOf(platform).normalize(top.out.trim());
|
|
65
|
-
const
|
|
66
|
-
const current = head.code === 0 && head.out.trim() !== '' ? head.out.trim() : null;
|
|
92
|
+
const current = await currentBranch(git, root);
|
|
67
93
|
const suggested = await suggestedOf(git, root, adapter, env);
|
|
94
|
+
const found = { root, current, suggested, branches: null };
|
|
68
95
|
const taken = projectOfRepo(raw, root, platform);
|
|
69
96
|
if (taken !== undefined)
|
|
70
|
-
return {
|
|
71
|
-
const branches = await
|
|
97
|
+
return { ...found, notice: notice('wizard.repoTaken', { project: taken }) };
|
|
98
|
+
const branches = await readBranches(git, root);
|
|
72
99
|
// A fresh `git init` has a current branch that is not born yet: no commit, so no branch at all.
|
|
73
|
-
if (branches
|
|
74
|
-
return {
|
|
100
|
+
if (branches !== null && !branches.branches.some((each) => each.remote === null))
|
|
101
|
+
return { ...found, notice: notice('wizard.noCommits', {}) };
|
|
102
|
+
// A branch the repository lacks is no refusal: adding the project creates it (BTN-754).
|
|
75
103
|
const branch = draft.branch.trim();
|
|
76
|
-
if (branch !== '' &&
|
|
77
|
-
return {
|
|
78
|
-
|
|
104
|
+
if (branch !== '' && !(await isBranchName(git, root, branch)))
|
|
105
|
+
return { ...found, branches, notice: notice('wizard.branchName', { value: branch }) };
|
|
106
|
+
// Sessions commit and merge there: the folder's own config may name them where the global one does not.
|
|
107
|
+
if (await lacksIdentity(git, root))
|
|
108
|
+
return { ...found, branches, notice: notice('git.noIdentity', {}) };
|
|
109
|
+
return { ...found, branches, notice: null };
|
|
79
110
|
}
|
|
80
|
-
/**
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
111
|
+
/**
|
|
112
|
+
* The draft as "Create" builds it (BTN-1093): the wizard's one field read into the source, the remote and the folder
|
|
113
|
+
* the creation's steps take; a draft without the field as it came. Refused as the check refuses it.
|
|
114
|
+
*/
|
|
115
|
+
export async function sourcedDraft(git, draft, raw, platform = process.platform, folders = REAL_FOLDERS, ownDir = projectsDir()) {
|
|
116
|
+
if (draft.git === false || draft.target === undefined)
|
|
117
|
+
return draft;
|
|
118
|
+
const resolved = await readTarget({ git, platform, folders, ownDir, projectOf: (folder) => projectOfRepo(raw, folder, platform) }, draft);
|
|
119
|
+
if (resolved.notice !== null)
|
|
120
|
+
throw new NoticeError(resolved.notice);
|
|
121
|
+
if (resolved.draft === null)
|
|
122
|
+
throw fail('request.required', { field: 'target' });
|
|
123
|
+
return resolved.draft;
|
|
89
124
|
}
|
|
90
125
|
async function suggestedOf(git, root, adapter, env) {
|
|
91
126
|
if (adapter?.projectOfRemote === undefined)
|
|
@@ -137,7 +172,7 @@ function projectOfRepo(raw, root, platform) {
|
|
|
137
172
|
return isPlainObject(found) ? String(found.id) : undefined;
|
|
138
173
|
}
|
|
139
174
|
/** Reads the project's tasks once, through its own connection, which is closed after. */
|
|
140
|
-
async function checkTracker(adapter, deps, key, place, rules) {
|
|
175
|
+
async function checkTracker(adapter, deps, key, place, rules, folder) {
|
|
141
176
|
const failed = (notice) => ({ ok: false, missing: [], open: null, openToAll: false, notice });
|
|
142
177
|
let setup;
|
|
143
178
|
try {
|
|
@@ -153,12 +188,14 @@ async function checkTracker(adapter, deps, key, place, rules) {
|
|
|
153
188
|
const connect = setup.connect;
|
|
154
189
|
const link = new TrackerLink({ name: adapter.title, connect: async () => trackerOf(await connect(deps.timeoutMs)), timeoutMs: deps.timeoutMs });
|
|
155
190
|
try {
|
|
156
|
-
const { tasks, isPublic } = await link.run(async (tracker) => ({
|
|
191
|
+
const { tasks, isPublic, forge } = await link.run(async (tracker) => ({
|
|
157
192
|
...(await tracker.chainTasks(ENTRY_ID, rules)),
|
|
158
193
|
isPublic: (await tracker.isPublic?.(ENTRY_ID)) ?? false,
|
|
194
|
+
forge: tracker.isPublic !== undefined,
|
|
159
195
|
}));
|
|
160
196
|
const openToAll = isPublic && rules.requiredLabels.length === 0;
|
|
161
|
-
|
|
197
|
+
const hits = forge && rules.requiredLabels.length > 0 ? templateHits((await folderTemplates(deps.git, folder, place)) ?? [], rules.requiredLabels) : [];
|
|
198
|
+
return { ok: true, missing: [], open: tasks.filter((task) => isOpen(task.status)).length, openToAll, ...(hits.length > 0 && { templateHits: hits }), notice: null };
|
|
162
199
|
}
|
|
163
200
|
catch (error) {
|
|
164
201
|
return failed(notice('wizard.trackerFailed', { tracker: adapter.title }, { detail: errorText(error) }));
|
|
@@ -167,6 +204,13 @@ async function checkTracker(adapter, deps, key, place, rules) {
|
|
|
167
204
|
await link.close();
|
|
168
205
|
}
|
|
169
206
|
}
|
|
207
|
+
/** The issue templates of the folder's branch, where the folder is a clone of the tracker's repository `place` (BTN-1130). */
|
|
208
|
+
async function folderTemplates(git, { root, branch }, place) {
|
|
209
|
+
if (place === '')
|
|
210
|
+
return null;
|
|
211
|
+
const urls = await git(root, ['config', '--get-regexp', '^remote\\..*\\.url$']);
|
|
212
|
+
return urls.code === 0 && isOwnRepo(remotesOf(urls.out), place) ? readIssueTemplates(git, root, branch) : null;
|
|
213
|
+
}
|
|
170
214
|
/** Whether `.claude.json` trusts the folder under a key the CLI reads. */
|
|
171
215
|
export function isTrusted(config, folder, platform = process.platform) {
|
|
172
216
|
const projects = isPlainObject(config) && isPlainObject(config.projects) ? config.projects : {};
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readdirSync, rmSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { DEFAULT_BRANCH } from '../config.js';
|
|
4
|
+
import { isHeads } from '../git/remote-run.js';
|
|
5
|
+
import { requireStarted } from '../git/setup.js';
|
|
6
|
+
import { fail, NoticeError } from '../notice/notice.js';
|
|
7
|
+
const FIRST_COMMIT = 'Initial commit';
|
|
8
|
+
const PACKAGES_POLL_MS = 500;
|
|
9
|
+
const PACKAGES_WAIT_MS = 5 * 60_000;
|
|
10
|
+
const LFS_CODES = new Set(['git.lfsMissing', 'git.lfsFailed']);
|
|
11
|
+
/**
|
|
12
|
+
* The steps that create a project from the wizard's draft (BTN-1048): the folder, the clone with its LFS files or the
|
|
13
|
+
* new repository's first commit, the project's entry on its main branch, Claude Code's trust for its accounts and the
|
|
14
|
+
* project's packages. The draft is checked first, as the wizard checked it: a refusal starts no job. Cancel removes
|
|
15
|
+
* what the job made until the entry is written; from then on the project stays.
|
|
16
|
+
*/
|
|
17
|
+
export async function creationPlan(deps, draft) {
|
|
18
|
+
const repo = await deps.check(draft);
|
|
19
|
+
if (repo.notice !== null)
|
|
20
|
+
throw new NoticeError(repo.notice);
|
|
21
|
+
const plain = draft.git === false;
|
|
22
|
+
const source = plain ? 'plain' : (draft.source ?? 'existing');
|
|
23
|
+
const path = repo.place === undefined ? null : repo.root;
|
|
24
|
+
if (!plain && repo.root === null)
|
|
25
|
+
throw fail('request.required', { field: source === 'clone' ? 'remote' : 'repo' });
|
|
26
|
+
const made = { folder: false, contents: false, git: false };
|
|
27
|
+
const wait = deps.wait ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
28
|
+
let project;
|
|
29
|
+
// A folder that was there already is trusted by the user, as the wizard asks; one Even Keel makes is trusted here.
|
|
30
|
+
const ours = path !== null || (plain && draft.repo.trim() === '');
|
|
31
|
+
const trustFiles = ours ? deps.trustFiles(draft) : [];
|
|
32
|
+
const folder = {
|
|
33
|
+
id: 'folder',
|
|
34
|
+
run: async () => {
|
|
35
|
+
if (existsSync(path))
|
|
36
|
+
made.contents = made.contents || readdirSync(path).length === 0;
|
|
37
|
+
else {
|
|
38
|
+
mkdirSync(path, { recursive: true });
|
|
39
|
+
made.folder = true;
|
|
40
|
+
made.contents = true;
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
const clone = {
|
|
45
|
+
id: 'clone',
|
|
46
|
+
run: async (tools) => {
|
|
47
|
+
// A clone broken off halfway left its files: git takes only an empty folder.
|
|
48
|
+
if (made.contents)
|
|
49
|
+
emptyFolder(path);
|
|
50
|
+
const remote = draft.remote.trim();
|
|
51
|
+
const heads = await deps.readRemote(remote);
|
|
52
|
+
if (!isHeads(heads))
|
|
53
|
+
throw new NoticeError(heads);
|
|
54
|
+
const branch = draft.branch.trim();
|
|
55
|
+
try {
|
|
56
|
+
await deps.clone({
|
|
57
|
+
remote,
|
|
58
|
+
path: path,
|
|
59
|
+
// A branch the remote lacks is created when the entry is written, as for a repository already there.
|
|
60
|
+
branch: heads.branches.includes(branch) ? branch : null,
|
|
61
|
+
signal: tools.signal,
|
|
62
|
+
onProgress: (progress) => {
|
|
63
|
+
if (progress.stage === 'lfs')
|
|
64
|
+
tools.begin('lfs');
|
|
65
|
+
tools.progress(progress);
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
// The clone came, its LFS files did not: the LFS step fails, and its Retry downloads them into the clone.
|
|
71
|
+
if (error instanceof NoticeError && LFS_CODES.has(error.notice.code))
|
|
72
|
+
tools.begin('lfs');
|
|
73
|
+
throw error;
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
const lfs = {
|
|
78
|
+
id: 'lfs',
|
|
79
|
+
hidden: true,
|
|
80
|
+
run: (tools) => deps.restore({
|
|
81
|
+
remote: draft.remote.trim(),
|
|
82
|
+
path: path,
|
|
83
|
+
signal: tools.signal,
|
|
84
|
+
onProgress: (progress) => tools.progress(progress),
|
|
85
|
+
}),
|
|
86
|
+
};
|
|
87
|
+
const init = {
|
|
88
|
+
id: 'init',
|
|
89
|
+
run: async () => {
|
|
90
|
+
const branch = draft.branch.trim() || DEFAULT_BRANCH;
|
|
91
|
+
const run = async (args) => {
|
|
92
|
+
const result = requireStarted(await deps.git(path, args));
|
|
93
|
+
if (result.code !== 0)
|
|
94
|
+
throw fail('git.initFailed', { path: path }, { detail: result.out });
|
|
95
|
+
};
|
|
96
|
+
// The commit needs them: refused here, the folder is left as it was.
|
|
97
|
+
for (const key of ['user.name', 'user.email']) {
|
|
98
|
+
const value = requireStarted(await deps.git(path, ['config', '--get', key]));
|
|
99
|
+
if (value.code !== 0 || value.out.trim() === '')
|
|
100
|
+
throw fail('git.noIdentity', {});
|
|
101
|
+
}
|
|
102
|
+
if (!existsSync(join(path, '.git'))) {
|
|
103
|
+
await run(['init', '-b', branch]);
|
|
104
|
+
made.git = true;
|
|
105
|
+
}
|
|
106
|
+
await run(['add', '-A']);
|
|
107
|
+
await run(['commit', '--allow-empty', '-m', FIRST_COMMIT]);
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
const entry = {
|
|
111
|
+
id: 'project',
|
|
112
|
+
run: async () => {
|
|
113
|
+
const { source: _source, remote: _remote, folder: _folder, ...rest } = draft;
|
|
114
|
+
project = await deps.add(path === null ? rest : { ...rest, repo: path });
|
|
115
|
+
deps.packages.turnOnTasks(project);
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
const trust = {
|
|
119
|
+
id: 'trust',
|
|
120
|
+
run: async () => {
|
|
121
|
+
const at = deps.folderOf(project);
|
|
122
|
+
for (const file of trustFiles)
|
|
123
|
+
deps.trust(file, at);
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
const packages = {
|
|
127
|
+
id: 'packages',
|
|
128
|
+
run: async ({ signal }) => {
|
|
129
|
+
const until = Date.now() + PACKAGES_WAIT_MS;
|
|
130
|
+
while (deps.packages.installingOf(project).length > 0 && Date.now() < until && !signal.aborted)
|
|
131
|
+
await wait(PACKAGES_POLL_MS);
|
|
132
|
+
const unready = deps.packages.unready(project);
|
|
133
|
+
if (unready.length > 0 && !signal.aborted)
|
|
134
|
+
throw fail('job.packagesUnready', { packages: unready });
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
const steps = [
|
|
138
|
+
...(path === null ? [] : [folder]),
|
|
139
|
+
...(source === 'clone' ? [clone, lfs] : []),
|
|
140
|
+
...(source === 'new' ? [init] : []),
|
|
141
|
+
entry,
|
|
142
|
+
...(trustFiles.length === 0 ? [] : [trust]),
|
|
143
|
+
packages,
|
|
144
|
+
];
|
|
145
|
+
return {
|
|
146
|
+
kind: 'project',
|
|
147
|
+
subject: path ?? repo.root ?? '',
|
|
148
|
+
steps,
|
|
149
|
+
keptAfter: 'project',
|
|
150
|
+
result: () => project,
|
|
151
|
+
undo: async () => {
|
|
152
|
+
if (path === null)
|
|
153
|
+
return;
|
|
154
|
+
if (made.folder)
|
|
155
|
+
rmSync(path, { recursive: true, force: true, maxRetries: 5, retryDelay: 200 });
|
|
156
|
+
else if (made.contents)
|
|
157
|
+
emptyFolder(path);
|
|
158
|
+
else if (made.git)
|
|
159
|
+
rmSync(join(path, '.git'), { recursive: true, force: true, maxRetries: 5, retryDelay: 200 });
|
|
160
|
+
},
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
function emptyFolder(folder) {
|
|
164
|
+
for (const name of readdirSync(folder))
|
|
165
|
+
rmSync(join(folder, name), { recursive: true, force: true, maxRetries: 5, retryDelay: 200 });
|
|
166
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { readFile, stat } from 'node:fs/promises';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { ownRepository } from './git-mode.js';
|
|
4
|
+
/**
|
|
5
|
+
* Whether the folder of a project without git has become a repository of its own (BTN-1025), each step only once the
|
|
6
|
+
* one before holds: git starts on the machine (`gitStarts`, the setup's own read), the folder has a `.git` (no git
|
|
7
|
+
* call), and `git rev-parse --show-toplevel` names the folder itself — the one git call, read-only, which turns down an
|
|
8
|
+
* empty or broken `.git` and a folder inside another repository. `null` — not one.
|
|
9
|
+
*/
|
|
10
|
+
export async function foundRepository(git, folder, gitStarts) {
|
|
11
|
+
if (!gitStarts)
|
|
12
|
+
return null;
|
|
13
|
+
const dotGit = join(folder, '.git');
|
|
14
|
+
const entry = await stat(dotGit).catch(() => null);
|
|
15
|
+
if (entry === null || !(await ownRepository(git, folder)))
|
|
16
|
+
return null;
|
|
17
|
+
// A file system without a birth time gives 0: the change time stands in, steady while git is off in the folder.
|
|
18
|
+
return { branch: entry.isDirectory() ? await headBranch(dotGit) : null, since: Math.round(entry.birthtimeMs || entry.ctimeMs) };
|
|
19
|
+
}
|
|
20
|
+
/** The branch `HEAD` points at, read from the file; `null` — detached or unreadable. */
|
|
21
|
+
async function headBranch(dotGit) {
|
|
22
|
+
const head = await readFile(join(dotGit, 'HEAD'), 'utf8').catch(() => '');
|
|
23
|
+
return /^ref: refs\/heads\/(.+)$/m.exec(head)?.[1]?.trim() ?? null;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The projects without git whose folder was a repository at the last check (BTN-1025). Checked at the start and after
|
|
27
|
+
* a Done of such a project's task, when its agent may have made one; never on a timer.
|
|
28
|
+
*/
|
|
29
|
+
export class GitFound {
|
|
30
|
+
deps;
|
|
31
|
+
found = new Map();
|
|
32
|
+
/** What the page shows changed. */
|
|
33
|
+
changed;
|
|
34
|
+
constructor(deps) {
|
|
35
|
+
this.deps = deps;
|
|
36
|
+
}
|
|
37
|
+
/** By project id, only the projects still without git. */
|
|
38
|
+
view() {
|
|
39
|
+
const folders = this.deps.folders();
|
|
40
|
+
return Object.fromEntries([...this.found].filter(([project]) => folders[project] !== undefined));
|
|
41
|
+
}
|
|
42
|
+
async check(project) {
|
|
43
|
+
const folder = this.deps.folders()[project];
|
|
44
|
+
const read = folder === undefined ? null : await foundRepository(this.deps.git, folder, this.deps.gitStarts()).catch(() => null);
|
|
45
|
+
const before = this.found.get(project);
|
|
46
|
+
if (read === null) {
|
|
47
|
+
if (before === undefined)
|
|
48
|
+
return;
|
|
49
|
+
this.found.delete(project);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
if (before !== undefined && before.branch === read.branch && before.since === read.since)
|
|
53
|
+
return;
|
|
54
|
+
this.found.set(project, read);
|
|
55
|
+
console.log(`git: the folder of ${this.deps.label?.(project) ?? project}, a project without git, is a repository now; the page offers to turn git on`);
|
|
56
|
+
}
|
|
57
|
+
this.changed?.();
|
|
58
|
+
}
|
|
59
|
+
async checkAll() {
|
|
60
|
+
await Promise.all(Object.keys(this.deps.folders()).map((project) => this.check(project)));
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { statSync } from 'node:fs';
|
|
2
|
+
import { requireStarted } from '../git/setup.js';
|
|
3
|
+
import { ensureIgnored, must, requireBranch, requireCheckedOut } from '../git/worktree.js';
|
|
4
|
+
import { fail, notice } from '../notice/notice.js';
|
|
5
|
+
import { samePath } from '../paths.js';
|
|
6
|
+
const FIRST_COMMIT = 'Initial commit';
|
|
7
|
+
const LOOSE_COMMIT = 'Work done without git';
|
|
8
|
+
/**
|
|
9
|
+
* Makes the folder of a project without git a repository on `branch` (BTN-884): `git init`, Even Keel's folders in
|
|
10
|
+
* `info/exclude`, then a first commit of everything already there; `made` — whether the first commit was made here.
|
|
11
|
+
* A folder that is a repository of its own with commits is checked for the branch, and the work done in it while git
|
|
12
|
+
* was off (BTN-1054) goes into one commit on that branch with `commit`, or refuses the switch without it; `committed` —
|
|
13
|
+
* whether that commit was made. The status is read here, at the press, not when the page asked for it.
|
|
14
|
+
*/
|
|
15
|
+
export async function turnGitOn(git, folder, project, branch, { commit = false } = {}) {
|
|
16
|
+
if (!isFolder(folder))
|
|
17
|
+
throw fail('wizard.noFolder', { path: folder });
|
|
18
|
+
if (requireStarted(await git(folder, ['check-ref-format', '--branch', branch])).code !== 0)
|
|
19
|
+
throw fail('wizard.branchName', { value: branch });
|
|
20
|
+
const own = await ownRepository(git, folder);
|
|
21
|
+
if (own && (await hasCommits(git, folder))) {
|
|
22
|
+
await requireBranch(git, folder, project, branch);
|
|
23
|
+
await ensureIgnored(git, folder);
|
|
24
|
+
const files = await statusLines(git, folder);
|
|
25
|
+
if (files.length === 0)
|
|
26
|
+
return { made: false, committed: false };
|
|
27
|
+
await requireCheckedOut(git, folder, project, branch);
|
|
28
|
+
if (!commit)
|
|
29
|
+
throw fail('project.gitDirty', { project, files });
|
|
30
|
+
await requireIdentity(git, folder);
|
|
31
|
+
await must(git, folder, ['add', '-A'], 'commit');
|
|
32
|
+
await must(git, folder, ['commit', '-m', LOOSE_COMMIT], 'commit');
|
|
33
|
+
return { made: false, committed: true };
|
|
34
|
+
}
|
|
35
|
+
await requireIdentity(git, folder);
|
|
36
|
+
const run = async (args) => {
|
|
37
|
+
const result = requireStarted(await git(folder, args));
|
|
38
|
+
if (result.code !== 0)
|
|
39
|
+
throw fail('git.initFailed', { path: folder }, { detail: result.out });
|
|
40
|
+
};
|
|
41
|
+
await run(own ? ['symbolic-ref', 'HEAD', `refs/heads/${branch}`] : ['init', '-b', branch]);
|
|
42
|
+
await ensureIgnored(git, folder);
|
|
43
|
+
await run(['add', '-A']);
|
|
44
|
+
await run(['commit', '--allow-empty', '-m', FIRST_COMMIT]);
|
|
45
|
+
return { made: true, committed: false };
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* What turning git on would commit as work done without git, as `git status --porcelain` lines with Even Keel's folders
|
|
49
|
+
* left out (it writes them into `info/exclude`, as the switch would). Only a repository of its own with commits has
|
|
50
|
+
* any: elsewhere the first commit takes everything anyway.
|
|
51
|
+
*/
|
|
52
|
+
export async function uncommittedChanges(git, folder) {
|
|
53
|
+
if (!isFolder(folder) || !(await ownRepository(git, folder)) || !(await hasCommits(git, folder)))
|
|
54
|
+
return [];
|
|
55
|
+
await ensureIgnored(git, folder);
|
|
56
|
+
return statusLines(git, folder);
|
|
57
|
+
}
|
|
58
|
+
/** The folder may sit inside another repository: only a repository whose top is the folder itself is the project's. */
|
|
59
|
+
export async function ownRepository(git, folder) {
|
|
60
|
+
const top = await git(folder, ['rev-parse', '--show-toplevel']);
|
|
61
|
+
return top.code === 0 && samePath(top.out.trim(), folder);
|
|
62
|
+
}
|
|
63
|
+
async function hasCommits(git, folder) {
|
|
64
|
+
return (await git(folder, ['rev-parse', '--verify', '--quiet', 'HEAD'])).code === 0;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* The changes as short lines, `M file.txt`, `?? new/`, `R old → new`. Read as porcelain v2: git's output comes
|
|
68
|
+
* trimmed, and v1 would lose the leading space of the first line's status.
|
|
69
|
+
*/
|
|
70
|
+
async function statusLines(git, folder) {
|
|
71
|
+
const read = await must(git, folder, ['-c', 'core.quotePath=false', 'status', '--porcelain=v2'], 'readStatus');
|
|
72
|
+
return read.out.split(/\r?\n/).flatMap((line) => {
|
|
73
|
+
if (line.startsWith('? '))
|
|
74
|
+
return [`?? ${line.slice(2)}`];
|
|
75
|
+
const fields = STATUS_FIELDS[line[0] ?? ''];
|
|
76
|
+
if (fields === undefined)
|
|
77
|
+
return [];
|
|
78
|
+
const parts = line.split(' ');
|
|
79
|
+
const path = parts.slice(fields).join(' ').split('\t').reverse().join(' → ');
|
|
80
|
+
return [`${parts[1].replaceAll('.', '')} ${path}`];
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
/** Fields before the path in a porcelain v2 line: changed, renamed or copied, unmerged. */
|
|
84
|
+
const STATUS_FIELDS = { '1': 8, '2': 9, u: 10 };
|
|
85
|
+
async function requireIdentity(git, folder) {
|
|
86
|
+
const [name, email] = await Promise.all(['user.name', 'user.email'].map((key) => configValue(git, folder, key)));
|
|
87
|
+
if (name === null || email === null)
|
|
88
|
+
throw fail('git.noIdentity', {});
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Why git cannot be turned on for the project now, each reason an item; `null` — it can. A chain may run, but only
|
|
92
|
+
* between tasks: no task in hand, no live session, no worktree or slot it holds.
|
|
93
|
+
*/
|
|
94
|
+
export function gitSwitchBlock(facts, inHand) {
|
|
95
|
+
const items = [];
|
|
96
|
+
if (inHand !== null)
|
|
97
|
+
items.push(notice('project.gitTaskInHand', { task: inHand }));
|
|
98
|
+
if (facts.sessions.length > 0)
|
|
99
|
+
items.push(notice('project.removeSessions', { sessions: facts.sessions }));
|
|
100
|
+
if (facts.held.length > 0)
|
|
101
|
+
items.push(notice('project.removePlaces', { tasks: facts.held }));
|
|
102
|
+
return items.length === 0 ? null : notice('project.gitBusy', { project: facts.project }, { items });
|
|
103
|
+
}
|
|
104
|
+
async function configValue(git, cwd, key) {
|
|
105
|
+
const read = requireStarted(await git(cwd, ['config', '--get', key]));
|
|
106
|
+
const value = read.code === 0 ? read.out.trim() : '';
|
|
107
|
+
return value === '' ? null : value;
|
|
108
|
+
}
|
|
109
|
+
function isFolder(path) {
|
|
110
|
+
try {
|
|
111
|
+
return statSync(path).isDirectory();
|
|
112
|
+
}
|
|
113
|
+
catch {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { join } from 'node:path';
|
|
2
|
+
import { home } from '../locations.js';
|
|
3
|
+
/** Where Even Keel makes the folder of a project without git that names none: `projects/` of its data folder. */
|
|
4
|
+
export const projectsDir = () => join(home, 'projects');
|
|
5
|
+
/** The folder of such a project: a key is not unique and a bare id says nothing to a person, so both. */
|
|
6
|
+
export function ownFolder(dir, key, id) {
|
|
7
|
+
return join(dir, `${key.trim().toLowerCase()}-${id.slice(0, 8)}`);
|
|
8
|
+
}
|