@tryglen/cli 0.37.1 → 0.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -4
- package/dist/_generated/contract/index.js +3 -0
- package/dist/_generated/contract/index.js.map +1 -0
- package/dist/_generated/contract/procedures.gen.js +34 -0
- package/dist/_generated/contract/procedures.gen.js.map +1 -0
- package/dist/_generated/contract/types.gen.js +3 -0
- package/dist/_generated/contract/types.gen.js.map +1 -0
- package/dist/_generated/contract/zod.gen.js +799 -0
- package/dist/_generated/contract/zod.gen.js.map +1 -0
- package/dist/bin.js +137 -560
- package/dist/bin.js.map +1 -1
- package/dist/clients/agents/agent-bin.js +67 -0
- package/dist/clients/agents/agent-bin.js.map +1 -0
- package/dist/clients/agents/agent-path-overrides.js +23 -0
- package/dist/clients/agents/agent-path-overrides.js.map +1 -0
- package/dist/clients/agents/agents-table.js +91 -0
- package/dist/clients/agents/agents-table.js.map +1 -0
- package/dist/{_utils → clients/agents}/managed-block.js +8 -4
- package/dist/clients/agents/managed-block.js.map +1 -0
- package/dist/clients/agents/normalize-transcript-timestamp.js.map +1 -0
- package/dist/clients/agents/plugin-status.js +74 -0
- package/dist/clients/agents/plugin-status.js.map +1 -0
- package/dist/clients/agents/run-agent-steps.js +21 -0
- package/dist/clients/agents/run-agent-steps.js.map +1 -0
- package/dist/{_utils → clients/claude}/extract-claude-segments.js +9 -5
- package/dist/clients/claude/extract-claude-segments.js.map +1 -0
- package/dist/clients/claude/parse-claude-transcript.js +114 -0
- package/dist/clients/claude/parse-claude-transcript.js.map +1 -0
- package/dist/clients/codex/codex-app-server.js +102 -0
- package/dist/clients/codex/codex-app-server.js.map +1 -0
- package/dist/clients/codex/codex-hooks-file.js +65 -0
- package/dist/clients/codex/codex-hooks-file.js.map +1 -0
- package/dist/clients/codex/codex-hooks-merge.js +9 -0
- package/dist/clients/codex/codex-hooks-merge.js.map +1 -0
- package/dist/clients/codex/codex-hooks-setup.js +167 -0
- package/dist/clients/codex/codex-hooks-setup.js.map +1 -0
- package/dist/clients/codex/codex-paths.js +13 -0
- package/dist/clients/codex/codex-paths.js.map +1 -0
- package/dist/clients/codex/codex-repair-trace.js +36 -0
- package/dist/clients/codex/codex-repair-trace.js.map +1 -0
- package/dist/clients/codex/codex-rules-setup.js +27 -0
- package/dist/clients/codex/codex-rules-setup.js.map +1 -0
- package/dist/{_utils → clients/codex}/codex-trust-toml.js +6 -5
- package/dist/clients/codex/codex-trust-toml.js.map +1 -0
- package/dist/clients/codex/extract-codex-segments.js +64 -0
- package/dist/clients/codex/extract-codex-segments.js.map +1 -0
- package/dist/clients/codex/parse-codex-transcript.js +123 -0
- package/dist/clients/codex/parse-codex-transcript.js.map +1 -0
- package/dist/clients/cursor/parse-cursor-db.js +185 -0
- package/dist/clients/cursor/parse-cursor-db.js.map +1 -0
- package/dist/clients/git/canonical-remote-url.js +13 -0
- package/dist/clients/git/canonical-remote-url.js.map +1 -0
- package/dist/clients/git/git-context.js +60 -0
- package/dist/clients/git/git-context.js.map +1 -0
- package/dist/clients/git/git-hook-setup.js +128 -0
- package/dist/clients/git/git-hook-setup.js.map +1 -0
- package/dist/{_utils → clients/git}/pr-review-link.js +5 -4
- package/dist/clients/git/pr-review-link.js.map +1 -0
- package/dist/clients/glen-api/config.js +11 -0
- package/dist/clients/glen-api/config.js.map +1 -0
- package/dist/clients/glen-api/glen-api.js +199 -0
- package/dist/clients/glen-api/glen-api.js.map +1 -0
- package/dist/{_utils → clients/glen-api}/glen-headers.js +1 -1
- package/dist/clients/glen-api/glen-headers.js.map +1 -0
- package/dist/clients/glen-api/refresh-control-state.js +18 -0
- package/dist/clients/glen-api/refresh-control-state.js.map +1 -0
- package/dist/clients/glen-api/report-cli-install.js +20 -0
- package/dist/clients/glen-api/report-cli-install.js.map +1 -0
- package/dist/clients/glen-api/sync-mode-from-server.js +45 -0
- package/dist/clients/glen-api/sync-mode-from-server.js.map +1 -0
- package/dist/clients/indicator/indicator-app.js +127 -0
- package/dist/clients/indicator/indicator-app.js.map +1 -0
- package/dist/clients/indicator/indicator-health.js +40 -0
- package/dist/clients/indicator/indicator-health.js.map +1 -0
- package/dist/clients/jcode/jcode-bundle.js +19 -0
- package/dist/clients/jcode/jcode-bundle.js.map +1 -0
- package/dist/clients/jcode/jcode-event.js +74 -0
- package/dist/clients/jcode/jcode-event.js.map +1 -0
- package/dist/{_utils → clients/jcode}/jcode-hook-lines.js +1 -1
- package/dist/clients/jcode/jcode-hook-lines.js.map +1 -0
- package/dist/{_utils → clients/jcode}/jcode-hooks-toml.js +21 -29
- package/dist/clients/jcode/jcode-hooks-toml.js.map +1 -0
- package/dist/clients/jcode/jcode-paths.js +14 -0
- package/dist/clients/jcode/jcode-paths.js.map +1 -0
- package/dist/clients/jcode/jcode-setup.js +148 -0
- package/dist/clients/jcode/jcode-setup.js.map +1 -0
- package/dist/clients/jcode/jcode-skills-sync.js +84 -0
- package/dist/clients/jcode/jcode-skills-sync.js.map +1 -0
- package/dist/{_utils → clients/jcode}/parse-jcode-session.js +38 -35
- package/dist/clients/jcode/parse-jcode-session.js.map +1 -0
- package/dist/clients/npm/semver-newer.js +8 -0
- package/dist/clients/npm/semver-newer.js.map +1 -0
- package/dist/clients/npm/update.js +147 -0
- package/dist/clients/npm/update.js.map +1 -0
- package/dist/{_utils → clients/pi}/extract-pi-segments.js +7 -3
- package/dist/clients/pi/extract-pi-segments.js.map +1 -0
- package/dist/clients/pi/parse-pi-transcript.js +149 -0
- package/dist/clients/pi/parse-pi-transcript.js.map +1 -0
- package/dist/clients/telemetry/send-events.js +32 -0
- package/dist/clients/telemetry/send-events.js.map +1 -0
- package/dist/commands/_utils/forget-or-restore-observation-or-message.js +41 -0
- package/dist/commands/_utils/forget-or-restore-observation-or-message.js.map +1 -0
- package/dist/commands/artifact/_utils/explain-artifact-error.js +31 -0
- package/dist/commands/artifact/_utils/explain-artifact-error.js.map +1 -0
- package/dist/commands/artifact/_utils/require-slug.js +14 -0
- package/dist/commands/artifact/_utils/require-slug.js.map +1 -0
- package/dist/commands/artifact/artifact.options.js +43 -0
- package/dist/commands/artifact/artifact.options.js.map +1 -0
- package/dist/commands/artifact/create.js +87 -0
- package/dist/commands/artifact/create.js.map +1 -0
- package/dist/commands/artifact/delete.js +18 -0
- package/dist/commands/artifact/delete.js.map +1 -0
- package/dist/commands/artifact/get.js +21 -0
- package/dist/commands/artifact/get.js.map +1 -0
- package/dist/commands/artifact/list.js +4 -0
- package/dist/commands/artifact/list.js.map +1 -0
- package/dist/commands/artifact/search.js +25 -0
- package/dist/commands/artifact/search.js.map +1 -0
- package/dist/commands/artifact/share.js +42 -0
- package/dist/commands/artifact/share.js.map +1 -0
- package/dist/commands/code-search/code-search.options.js +10 -0
- package/dist/commands/code-search/code-search.options.js.map +1 -0
- package/dist/commands/code-search/index.js +106 -0
- package/dist/commands/code-search/index.js.map +1 -0
- package/dist/commands/dependency/dependency.options.js +10 -0
- package/dist/commands/dependency/dependency.options.js.map +1 -0
- package/dist/commands/dependency/index.js +25 -0
- package/dist/commands/dependency/index.js.map +1 -0
- package/dist/{_utils → commands/doctor/_utils}/ingest-diagnosis.js +16 -17
- package/dist/commands/doctor/_utils/ingest-diagnosis.js.map +1 -0
- package/dist/commands/doctor/_utils/login-check.js +48 -0
- package/dist/commands/doctor/_utils/login-check.js.map +1 -0
- package/dist/commands/doctor/doctor.options.js +17 -0
- package/dist/commands/doctor/doctor.options.js.map +1 -0
- package/dist/commands/doctor/index.js +366 -0
- package/dist/commands/doctor/index.js.map +1 -0
- package/dist/commands/feedback/feedback.options.js +82 -0
- package/dist/commands/feedback/feedback.options.js.map +1 -0
- package/dist/commands/feedback/index.js +64 -0
- package/dist/commands/feedback/index.js.map +1 -0
- package/dist/commands/forget/forget.options.js +12 -0
- package/dist/commands/forget/forget.options.js.map +1 -0
- package/dist/commands/forget/index.js +30 -0
- package/dist/commands/forget/index.js.map +1 -0
- package/dist/commands/git-hooks/git-hooks.options.js +17 -0
- package/dist/commands/git-hooks/git-hooks.options.js.map +1 -0
- package/dist/commands/git-hooks/index.js +21 -0
- package/dist/commands/git-hooks/index.js.map +1 -0
- package/dist/commands/git-hooks/write-commit-trailer.js +38 -0
- package/dist/commands/git-hooks/write-commit-trailer.js.map +1 -0
- package/dist/commands/import/_utils/collect-import-files.js +54 -0
- package/dist/commands/import/_utils/collect-import-files.js.map +1 -0
- package/dist/commands/import/_utils/detect-transcript-format.js +46 -0
- package/dist/commands/import/_utils/detect-transcript-format.js.map +1 -0
- package/dist/{_utils → commands/import/_utils}/parse-harbor-atif.js +28 -51
- package/dist/commands/import/_utils/parse-harbor-atif.js.map +1 -0
- package/dist/{_utils → commands/import/_utils}/resolve-import-workspace.js +12 -17
- package/dist/commands/import/_utils/resolve-import-workspace.js.map +1 -0
- package/dist/{_utils → commands/import/_utils}/transcript-turns.js +47 -52
- package/dist/commands/import/_utils/transcript-turns.js.map +1 -0
- package/dist/commands/import/import.options.js +18 -0
- package/dist/commands/import/import.options.js.map +1 -0
- package/dist/commands/import/import.schema.js +28 -0
- package/dist/commands/import/import.schema.js.map +1 -0
- package/dist/commands/import/index.js +284 -0
- package/dist/commands/import/index.js.map +1 -0
- package/dist/commands/incognito/incognito.options.js +7 -0
- package/dist/commands/incognito/incognito.options.js.map +1 -0
- package/dist/commands/incognito/index.js +5 -0
- package/dist/commands/incognito/index.js.map +1 -0
- package/dist/commands/indicator/index.js +59 -0
- package/dist/commands/indicator/index.js.map +1 -0
- package/dist/commands/indicator/indicator.options.js +7 -0
- package/dist/commands/indicator/indicator.options.js.map +1 -0
- package/dist/commands/ingest/_utils/agent-adapter.js +37 -0
- package/dist/commands/ingest/_utils/agent-adapter.js.map +1 -0
- package/dist/{_utils → commands/ingest/_utils}/build-turn-body.js +8 -6
- package/dist/commands/ingest/_utils/build-turn-body.js.map +1 -0
- package/dist/{_utils → commands/ingest/_utils}/format-turn-nudges.js +14 -31
- package/dist/commands/ingest/_utils/format-turn-nudges.js.map +1 -0
- package/dist/commands/ingest/_utils/idempotency-key.js +4 -0
- package/dist/commands/ingest/_utils/idempotency-key.js.map +1 -0
- package/dist/commands/ingest/_utils/ingest-failure-memo.js +58 -0
- package/dist/commands/ingest/_utils/ingest-failure-memo.js.map +1 -0
- package/dist/commands/ingest/_utils/parse-transcript.js +76 -0
- package/dist/commands/ingest/_utils/parse-transcript.js.map +1 -0
- package/dist/commands/ingest/_utils/turn-cache.js +73 -0
- package/dist/commands/ingest/_utils/turn-cache.js.map +1 -0
- package/dist/commands/ingest/index.js +379 -0
- package/dist/commands/ingest/index.js.map +1 -0
- package/dist/commands/ingest/ingest.options.js +13 -0
- package/dist/commands/ingest/ingest.options.js.map +1 -0
- package/dist/commands/install/_utils/claude-statusline.js +58 -0
- package/dist/commands/install/_utils/claude-statusline.js.map +1 -0
- package/dist/commands/install/_utils/codex-post-install.js +56 -0
- package/dist/commands/install/_utils/codex-post-install.js.map +1 -0
- package/dist/{_utils → commands/install/_utils}/ensure-global-cli.js +49 -52
- package/dist/commands/install/_utils/ensure-global-cli.js.map +1 -0
- package/dist/commands/install/_utils/finish-install.js +67 -0
- package/dist/commands/install/_utils/finish-install.js.map +1 -0
- package/dist/commands/install/_utils/jcode-install.js +29 -0
- package/dist/commands/install/_utils/jcode-install.js.map +1 -0
- package/dist/{_utils → commands/install/_utils}/npm-error-cause.js +1 -2
- package/dist/commands/install/_utils/npm-error-cause.js.map +1 -0
- package/dist/commands/install/_utils/prepare-machine.js +85 -0
- package/dist/commands/install/_utils/prepare-machine.js.map +1 -0
- package/dist/commands/install/codex-hooks-repair.js +17 -0
- package/dist/commands/install/codex-hooks-repair.js.map +1 -0
- package/dist/commands/install/index.js +186 -0
- package/dist/commands/install/index.js.map +1 -0
- package/dist/commands/install/install.options.js +41 -0
- package/dist/commands/install/install.options.js.map +1 -0
- package/dist/commands/invite/index.js +47 -0
- package/dist/commands/invite/index.js.map +1 -0
- package/dist/commands/invite/invite.options.js +24 -0
- package/dist/commands/invite/invite.options.js.map +1 -0
- package/dist/commands/login/_utils/open-browser.js +9 -0
- package/dist/commands/login/_utils/open-browser.js.map +1 -0
- package/dist/commands/login/_utils/parse-start.js +25 -0
- package/dist/commands/login/_utils/parse-start.js.map +1 -0
- package/dist/commands/login/_utils/poll-for-approval.js +55 -0
- package/dist/commands/login/_utils/poll-for-approval.js.map +1 -0
- package/dist/commands/login/index.js +101 -0
- package/dist/commands/login/index.js.map +1 -0
- package/dist/commands/login/login.options.js +12 -0
- package/dist/commands/login/login.options.js.map +1 -0
- package/dist/commands/logout/index.js +16 -0
- package/dist/commands/logout/index.js.map +1 -0
- package/dist/commands/logout/logout.options.js +4 -0
- package/dist/commands/logout/logout.options.js.map +1 -0
- package/dist/commands/onboard/index.js +20 -0
- package/dist/commands/onboard/index.js.map +1 -0
- package/dist/commands/org/_utils/apply-switch.js +37 -0
- package/dist/commands/org/_utils/apply-switch.js.map +1 -0
- package/dist/commands/org/_utils/fetch-orgs.js +19 -0
- package/dist/commands/org/_utils/fetch-orgs.js.map +1 -0
- package/dist/commands/org/list.js +14 -0
- package/dist/commands/org/list.js.map +1 -0
- package/dist/commands/org/org.options.js +10 -0
- package/dist/commands/org/org.options.js.map +1 -0
- package/dist/commands/org/switch.js +37 -0
- package/dist/commands/org/switch.js.map +1 -0
- package/dist/commands/pr-link/_utils/is-commit-command.js +14 -0
- package/dist/commands/pr-link/_utils/is-commit-command.js.map +1 -0
- package/dist/commands/pr-link/_utils/record-commit-anchor.js +46 -0
- package/dist/commands/pr-link/_utils/record-commit-anchor.js.map +1 -0
- package/dist/commands/pr-link/index.js +74 -0
- package/dist/commands/pr-link/index.js.map +1 -0
- package/dist/commands/pr-link/pr-link.options.js +13 -0
- package/dist/commands/pr-link/pr-link.options.js.map +1 -0
- package/dist/commands/restore/index.js +27 -0
- package/dist/commands/restore/index.js.map +1 -0
- package/dist/commands/restore/restore.options.js +12 -0
- package/dist/commands/restore/restore.options.js.map +1 -0
- package/dist/{_utils → commands/search/_utils}/format-search-result.js +5 -4
- package/dist/commands/search/_utils/format-search-result.js.map +1 -0
- package/dist/commands/search/_utils/runtime-timezone.js +12 -0
- package/dist/commands/search/_utils/runtime-timezone.js.map +1 -0
- package/dist/commands/search/index.js +36 -0
- package/dist/commands/search/index.js.map +1 -0
- package/dist/commands/search/search.options.js +7 -0
- package/dist/commands/search/search.options.js.map +1 -0
- package/dist/commands/session-start/index.js +119 -0
- package/dist/commands/session-start/index.js.map +1 -0
- package/dist/commands/session-start/session-start.options.js +13 -0
- package/dist/commands/session-start/session-start.options.js.map +1 -0
- package/dist/commands/set-mode/index.js +38 -0
- package/dist/commands/set-mode/index.js.map +1 -0
- package/dist/commands/set-mode/set-mode.options.js +8 -0
- package/dist/commands/set-mode/set-mode.options.js.map +1 -0
- package/dist/commands/skill/_utils/download-file.js +28 -0
- package/dist/commands/skill/_utils/download-file.js.map +1 -0
- package/dist/commands/skill/_utils/explain-skill-error.js +31 -0
- package/dist/commands/skill/_utils/explain-skill-error.js.map +1 -0
- package/dist/commands/skill/_utils/skill-cache.js +136 -0
- package/dist/commands/skill/_utils/skill-cache.js.map +1 -0
- package/dist/commands/skill/create/_utils/pack-skill-dir.js +160 -0
- package/dist/commands/skill/create/_utils/pack-skill-dir.js.map +1 -0
- package/dist/commands/skill/create/index.js +108 -0
- package/dist/commands/skill/create/index.js.map +1 -0
- package/dist/commands/skill/search.js +38 -0
- package/dist/commands/skill/search.js.map +1 -0
- package/dist/commands/skill/share.js +52 -0
- package/dist/commands/skill/share.js.map +1 -0
- package/dist/commands/skill/skill.options.js +58 -0
- package/dist/commands/skill/skill.options.js.map +1 -0
- package/dist/commands/skill/use.js +72 -0
- package/dist/commands/skill/use.js.map +1 -0
- package/dist/commands/status/index.js +33 -0
- package/dist/commands/status/index.js.map +1 -0
- package/dist/commands/status/status.options.js +4 -0
- package/dist/commands/status/status.options.js.map +1 -0
- package/dist/commands/statusline/index.js +33 -0
- package/dist/commands/statusline/index.js.map +1 -0
- package/dist/commands/statusline/statusline.options.js +4 -0
- package/dist/commands/statusline/statusline.options.js.map +1 -0
- package/dist/commands/suggestions/index.js +36 -0
- package/dist/commands/suggestions/index.js.map +1 -0
- package/dist/commands/suggestions/suggestions.options.js +12 -0
- package/dist/commands/suggestions/suggestions.options.js.map +1 -0
- package/dist/commands/takeover/_utils/agent-paths.js +13 -7
- package/dist/commands/takeover/_utils/agent-paths.js.map +1 -1
- package/dist/commands/takeover/_utils/agent-process.js +111 -0
- package/dist/commands/takeover/_utils/agent-process.js.map +1 -0
- package/dist/commands/takeover/_utils/archive-codex-desktop-thread.js +17 -58
- package/dist/commands/takeover/_utils/archive-codex-desktop-thread.js.map +1 -1
- package/dist/commands/takeover/_utils/canonical-digest.js +2 -2
- package/dist/commands/takeover/_utils/canonical-digest.js.map +1 -1
- package/dist/commands/takeover/_utils/codex-desktop-recovery.js +77 -95
- package/dist/commands/takeover/_utils/codex-desktop-recovery.js.map +1 -1
- package/dist/commands/takeover/_utils/context-fit.js +7 -4
- package/dist/commands/takeover/_utils/context-fit.js.map +1 -1
- package/dist/commands/takeover/_utils/cursor-store.js +333 -281
- package/dist/commands/takeover/_utils/cursor-store.js.map +1 -1
- package/dist/commands/takeover/_utils/import-codex-desktop-thread.js +138 -282
- package/dist/commands/takeover/_utils/import-codex-desktop-thread.js.map +1 -1
- package/dist/commands/takeover/_utils/launch-desktop-url.js +19 -24
- package/dist/commands/takeover/_utils/launch-desktop-url.js.map +1 -1
- package/dist/commands/takeover/_utils/native-file.js +86 -73
- package/dist/commands/takeover/_utils/native-file.js.map +1 -1
- package/dist/commands/takeover/_utils/probe-agent.js +12 -9
- package/dist/commands/takeover/_utils/probe-agent.js.map +1 -1
- package/dist/commands/takeover/_utils/staged-session.js +18 -17
- package/dist/commands/takeover/_utils/staged-session.js.map +1 -1
- package/dist/commands/takeover/_utils/write-claude-session.js +10 -13
- package/dist/commands/takeover/_utils/write-claude-session.js.map +1 -1
- package/dist/commands/takeover/_utils/write-codex-desktop-session.js +39 -37
- package/dist/commands/takeover/_utils/write-codex-desktop-session.js.map +1 -1
- package/dist/commands/takeover/_utils/write-codex-session.js +34 -25
- package/dist/commands/takeover/_utils/write-codex-session.js.map +1 -1
- package/dist/commands/takeover/_utils/write-cursor-session.js +8 -19
- package/dist/commands/takeover/_utils/write-cursor-session.js.map +1 -1
- package/dist/commands/takeover/_utils/write-pi-session.js +34 -22
- package/dist/commands/takeover/_utils/write-pi-session.js.map +1 -1
- package/dist/commands/takeover/index.js +129 -164
- package/dist/commands/takeover/index.js.map +1 -1
- package/dist/commands/takeover/takeover.options.js +6 -0
- package/dist/commands/takeover/takeover.options.js.map +1 -0
- package/dist/commands/takeover/takeover.schema.js +17 -55
- package/dist/commands/takeover/takeover.schema.js.map +1 -1
- package/dist/commands/telemetry/index.js +33 -0
- package/dist/commands/telemetry/index.js.map +1 -0
- package/dist/commands/telemetry/send.js +7 -0
- package/dist/commands/telemetry/send.js.map +1 -0
- package/dist/commands/telemetry/telemetry.options.js +12 -0
- package/dist/commands/telemetry/telemetry.options.js.map +1 -0
- package/dist/commands/uninstall/_utils/purge-agent-plugins.js +58 -0
- package/dist/commands/uninstall/_utils/purge-agent-plugins.js.map +1 -0
- package/dist/commands/uninstall/_utils/purge-claude-statusline.js +51 -0
- package/dist/commands/uninstall/_utils/purge-claude-statusline.js.map +1 -0
- package/dist/commands/uninstall/_utils/purge-local-state.js +52 -0
- package/dist/commands/uninstall/_utils/purge-local-state.js.map +1 -0
- package/dist/commands/uninstall/index.js +138 -0
- package/dist/commands/uninstall/index.js.map +1 -0
- package/dist/commands/uninstall/uninstall.options.js +4 -0
- package/dist/commands/uninstall/uninstall.options.js.map +1 -0
- package/dist/commands/update/index.js +117 -0
- package/dist/commands/update/index.js.map +1 -0
- package/dist/commands/update/self-update.js +7 -0
- package/dist/commands/update/self-update.js.map +1 -0
- package/dist/commands/update/update.options.js +7 -0
- package/dist/commands/update/update.options.js.map +1 -0
- package/dist/core/errors/cli-error.js +22 -0
- package/dist/core/errors/cli-error.js.map +1 -0
- package/dist/core/errors/result.js +21 -0
- package/dist/core/errors/result.js.map +1 -0
- package/dist/core/errors/settle.js +18 -0
- package/dist/core/errors/settle.js.map +1 -0
- package/dist/core/json/is-record.js +3 -0
- package/dist/core/json/is-record.js.map +1 -0
- package/dist/core/json/json-field.js +5 -0
- package/dist/core/json/json-field.js.map +1 -0
- package/dist/core/json/jsonl-records.js +15 -0
- package/dist/core/json/jsonl-records.js.map +1 -0
- package/dist/core/json/parse-json.js +4 -0
- package/dist/core/json/parse-json.js.map +1 -0
- package/dist/core/run/cli-input.js +116 -0
- package/dist/core/run/cli-input.js.map +1 -0
- package/dist/core/run/hook-agents.js +4 -0
- package/dist/core/run/hook-agents.js.map +1 -0
- package/dist/{_utils → core/run}/normalize-boolean-flags.js +0 -1
- package/dist/core/run/normalize-boolean-flags.js.map +1 -0
- package/dist/core/run/run-hook.js +18 -0
- package/dist/core/run/run-hook.js.map +1 -0
- package/dist/core/run/run.js +16 -0
- package/dist/core/run/run.js.map +1 -0
- package/dist/core/state/credentials.js +34 -0
- package/dist/core/state/credentials.js.map +1 -0
- package/dist/core/state/ephemeral-session.js +11 -0
- package/dist/core/state/ephemeral-session.js.map +1 -0
- package/dist/core/state/glen-home.js +9 -0
- package/dist/core/state/glen-home.js.map +1 -0
- package/dist/core/state/ingest-heartbeat.js +56 -0
- package/dist/core/state/ingest-heartbeat.js.map +1 -0
- package/dist/core/state/install-receipt.js +174 -0
- package/dist/core/state/install-receipt.js.map +1 -0
- package/dist/core/state/session-map.js +22 -0
- package/dist/core/state/session-map.js.map +1 -0
- package/dist/core/state/state-line-memo.js +52 -0
- package/dist/core/state/state-line-memo.js.map +1 -0
- package/dist/{_utils → core/state}/state-line.js +1 -1
- package/dist/core/state/state-line.js.map +1 -0
- package/dist/core/state/state.js +51 -0
- package/dist/core/state/state.js.map +1 -0
- package/dist/core/system/env.js +74 -0
- package/dist/core/system/env.js.map +1 -0
- package/dist/core/system/files.js +102 -0
- package/dist/core/system/files.js.map +1 -0
- package/dist/core/system/glen-base-url.js +4 -0
- package/dist/core/system/glen-base-url.js.map +1 -0
- package/dist/core/system/http.js +146 -0
- package/dist/core/system/http.js.map +1 -0
- package/dist/core/system/run-program.js +55 -0
- package/dist/core/system/run-program.js.map +1 -0
- package/dist/core/system/sha256-hex.js +4 -0
- package/dist/core/system/sha256-hex.js.map +1 -0
- package/dist/{_utils → core/system}/shell-profile.js +43 -56
- package/dist/core/system/shell-profile.js.map +1 -0
- package/dist/core/system/spawn-detached.js +10 -0
- package/dist/core/system/spawn-detached.js.map +1 -0
- package/dist/core/system/spawn-self.js +5 -0
- package/dist/core/system/spawn-self.js.map +1 -0
- package/dist/core/system/sqlite.js +55 -0
- package/dist/core/system/sqlite.js.map +1 -0
- package/dist/core/system/version.js +16 -0
- package/dist/core/system/version.js.map +1 -0
- package/dist/core/telemetry/build-event.js +27 -0
- package/dist/core/telemetry/build-event.js.map +1 -0
- package/dist/core/telemetry/events-store.js +62 -0
- package/dist/core/telemetry/events-store.js.map +1 -0
- package/dist/core/telemetry/finish-telemetry.js +32 -0
- package/dist/core/telemetry/finish-telemetry.js.map +1 -0
- package/dist/core/telemetry/install-id.js +18 -0
- package/dist/core/telemetry/install-id.js.map +1 -0
- package/dist/core/telemetry/note-if-err.js +8 -0
- package/dist/core/telemetry/note-if-err.js.map +1 -0
- package/dist/core/telemetry/record-event.js +7 -0
- package/dist/core/telemetry/record-event.js.map +1 -0
- package/dist/core/telemetry/telemetry-context.js +10 -0
- package/dist/core/telemetry/telemetry-context.js.map +1 -0
- package/dist/core/telemetry/telemetry-settings.js +32 -0
- package/dist/core/telemetry/telemetry-settings.js.map +1 -0
- package/dist/core/terminal/attention-summary.js +14 -0
- package/dist/core/terminal/attention-summary.js.map +1 -0
- package/dist/core/terminal/out.js +86 -0
- package/dist/core/terminal/out.js.map +1 -0
- package/dist/core/terminal/prompt.js +34 -0
- package/dist/core/terminal/prompt.js.map +1 -0
- package/dist/core/terminal/read-hook-event.js +17 -0
- package/dist/core/terminal/read-hook-event.js.map +1 -0
- package/dist/core/terminal/read-stdin.js +23 -0
- package/dist/core/terminal/read-stdin.js.map +1 -0
- package/dist/jcode/plugin.json +1 -1
- package/dist/jcode/skills/feedback/SKILL.md +8 -8
- package/dist/jcode/skills/invite/SKILL.md +4 -4
- package/dist/jcode/skills/setup/SKILL.md +6 -4
- package/dist/macos/glen.app/Contents/MacOS/glen +0 -0
- package/package.json +16 -7
- package/dist/_utils/agent-adapter.d.ts +0 -9
- package/dist/_utils/agent-adapter.js +0 -49
- package/dist/_utils/agent-adapter.js.map +0 -1
- package/dist/_utils/agents-table.d.ts +0 -11
- package/dist/_utils/agents-table.js +0 -35
- package/dist/_utils/agents-table.js.map +0 -1
- package/dist/_utils/build-turn-body.d.ts +0 -17
- package/dist/_utils/build-turn-body.js.map +0 -1
- package/dist/_utils/cli-error.d.ts +0 -12
- package/dist/_utils/cli-error.js +0 -21
- package/dist/_utils/cli-error.js.map +0 -1
- package/dist/_utils/codex-app-server.d.ts +0 -11
- package/dist/_utils/codex-app-server.js +0 -94
- package/dist/_utils/codex-app-server.js.map +0 -1
- package/dist/_utils/codex-hooks-merge.d.ts +0 -22
- package/dist/_utils/codex-hooks-merge.js +0 -60
- package/dist/_utils/codex-hooks-merge.js.map +0 -1
- package/dist/_utils/codex-hooks-setup.d.ts +0 -14
- package/dist/_utils/codex-hooks-setup.js +0 -162
- package/dist/_utils/codex-hooks-setup.js.map +0 -1
- package/dist/_utils/codex-paths.d.ts +0 -5
- package/dist/_utils/codex-paths.js +0 -10
- package/dist/_utils/codex-paths.js.map +0 -1
- package/dist/_utils/codex-repair-trace.d.ts +0 -11
- package/dist/_utils/codex-repair-trace.js +0 -39
- package/dist/_utils/codex-repair-trace.js.map +0 -1
- package/dist/_utils/codex-rules-setup.d.ts +0 -4
- package/dist/_utils/codex-rules-setup.js +0 -34
- package/dist/_utils/codex-rules-setup.js.map +0 -1
- package/dist/_utils/codex-trust-toml.d.ts +0 -7
- package/dist/_utils/codex-trust-toml.js.map +0 -1
- package/dist/_utils/collect-import-files.d.ts +0 -4
- package/dist/_utils/collect-import-files.js +0 -50
- package/dist/_utils/collect-import-files.js.map +0 -1
- package/dist/_utils/config.d.ts +0 -45
- package/dist/_utils/config.js +0 -47
- package/dist/_utils/config.js.map +0 -1
- package/dist/_utils/confirm.d.ts +0 -7
- package/dist/_utils/confirm.js +0 -35
- package/dist/_utils/confirm.js.map +0 -1
- package/dist/_utils/credentials.d.ts +0 -15
- package/dist/_utils/credentials.js +0 -62
- package/dist/_utils/credentials.js.map +0 -1
- package/dist/_utils/detect-transcript-format.d.ts +0 -2
- package/dist/_utils/detect-transcript-format.js +0 -57
- package/dist/_utils/detect-transcript-format.js.map +0 -1
- package/dist/_utils/ensure-global-cli.d.ts +0 -4
- package/dist/_utils/ensure-global-cli.js.map +0 -1
- package/dist/_utils/ephemeral-session.d.ts +0 -2
- package/dist/_utils/ephemeral-session.js +0 -12
- package/dist/_utils/ephemeral-session.js.map +0 -1
- package/dist/_utils/extract-claude-segments.d.ts +0 -2
- package/dist/_utils/extract-claude-segments.js.map +0 -1
- package/dist/_utils/extract-codex-segments.d.ts +0 -2
- package/dist/_utils/extract-codex-segments.js +0 -65
- package/dist/_utils/extract-codex-segments.js.map +0 -1
- package/dist/_utils/extract-pi-segments.d.ts +0 -2
- package/dist/_utils/extract-pi-segments.js.map +0 -1
- package/dist/_utils/find-bin.d.ts +0 -7
- package/dist/_utils/find-bin.js +0 -89
- package/dist/_utils/find-bin.js.map +0 -1
- package/dist/_utils/format-search-result.d.ts +0 -2
- package/dist/_utils/format-search-result.js.map +0 -1
- package/dist/_utils/format-turn-nudges.d.ts +0 -2
- package/dist/_utils/format-turn-nudges.js.map +0 -1
- package/dist/_utils/git-context.d.ts +0 -13
- package/dist/_utils/git-context.js +0 -82
- package/dist/_utils/git-context.js.map +0 -1
- package/dist/_utils/git-hook-setup.d.ts +0 -18
- package/dist/_utils/git-hook-setup.js +0 -115
- package/dist/_utils/git-hook-setup.js.map +0 -1
- package/dist/_utils/glen-headers.d.ts +0 -8
- package/dist/_utils/glen-headers.js.map +0 -1
- package/dist/_utils/http.d.ts +0 -23
- package/dist/_utils/http.js +0 -97
- package/dist/_utils/http.js.map +0 -1
- package/dist/_utils/idempotency-key.d.ts +0 -2
- package/dist/_utils/idempotency-key.js +0 -7
- package/dist/_utils/idempotency-key.js.map +0 -1
- package/dist/_utils/indicator-app.d.ts +0 -9
- package/dist/_utils/indicator-app.js +0 -91
- package/dist/_utils/indicator-app.js.map +0 -1
- package/dist/_utils/indicator-health.d.ts +0 -8
- package/dist/_utils/indicator-health.js +0 -37
- package/dist/_utils/indicator-health.js.map +0 -1
- package/dist/_utils/ingest-diagnosis.d.ts +0 -24
- package/dist/_utils/ingest-diagnosis.js.map +0 -1
- package/dist/_utils/ingest-failure-memo.d.ts +0 -2
- package/dist/_utils/ingest-failure-memo.js +0 -58
- package/dist/_utils/ingest-failure-memo.js.map +0 -1
- package/dist/_utils/ingest-heartbeat.d.ts +0 -9
- package/dist/_utils/ingest-heartbeat.js +0 -48
- package/dist/_utils/ingest-heartbeat.js.map +0 -1
- package/dist/_utils/install-receipt.d.ts +0 -51
- package/dist/_utils/install-receipt.js +0 -202
- package/dist/_utils/install-receipt.js.map +0 -1
- package/dist/_utils/jcode-bundle.d.ts +0 -3
- package/dist/_utils/jcode-bundle.js +0 -16
- package/dist/_utils/jcode-bundle.js.map +0 -1
- package/dist/_utils/jcode-event.d.ts +0 -3
- package/dist/_utils/jcode-event.js +0 -66
- package/dist/_utils/jcode-event.js.map +0 -1
- package/dist/_utils/jcode-hook-lines.d.ts +0 -5
- package/dist/_utils/jcode-hook-lines.js.map +0 -1
- package/dist/_utils/jcode-hooks-toml.d.ts +0 -8
- package/dist/_utils/jcode-hooks-toml.js.map +0 -1
- package/dist/_utils/jcode-paths.d.ts +0 -7
- package/dist/_utils/jcode-paths.js +0 -10
- package/dist/_utils/jcode-paths.js.map +0 -1
- package/dist/_utils/jcode-setup.d.ts +0 -27
- package/dist/_utils/jcode-setup.js +0 -151
- package/dist/_utils/jcode-setup.js.map +0 -1
- package/dist/_utils/jcode-skills-sync.d.ts +0 -8
- package/dist/_utils/jcode-skills-sync.js +0 -74
- package/dist/_utils/jcode-skills-sync.js.map +0 -1
- package/dist/_utils/login-check.d.ts +0 -2
- package/dist/_utils/login-check.js +0 -57
- package/dist/_utils/login-check.js.map +0 -1
- package/dist/_utils/managed-block.d.ts +0 -4
- package/dist/_utils/managed-block.js.map +0 -1
- package/dist/_utils/normalize-boolean-flags.d.ts +0 -2
- package/dist/_utils/normalize-boolean-flags.js.map +0 -1
- package/dist/_utils/normalize-transcript-timestamp.d.ts +0 -2
- package/dist/_utils/normalize-transcript-timestamp.js.map +0 -1
- package/dist/_utils/npm-error-cause.d.ts +0 -5
- package/dist/_utils/npm-error-cause.js.map +0 -1
- package/dist/_utils/open-browser.d.ts +0 -2
- package/dist/_utils/open-browser.js +0 -18
- package/dist/_utils/open-browser.js.map +0 -1
- package/dist/_utils/parse-claude-transcript.d.ts +0 -3
- package/dist/_utils/parse-claude-transcript.js +0 -145
- package/dist/_utils/parse-claude-transcript.js.map +0 -1
- package/dist/_utils/parse-codex-transcript.d.ts +0 -3
- package/dist/_utils/parse-codex-transcript.js +0 -132
- package/dist/_utils/parse-codex-transcript.js.map +0 -1
- package/dist/_utils/parse-cursor-db.d.ts +0 -5
- package/dist/_utils/parse-cursor-db.js +0 -212
- package/dist/_utils/parse-cursor-db.js.map +0 -1
- package/dist/_utils/parse-harbor-atif.d.ts +0 -3
- package/dist/_utils/parse-harbor-atif.js.map +0 -1
- package/dist/_utils/parse-jcode-session.d.ts +0 -14
- package/dist/_utils/parse-jcode-session.js.map +0 -1
- package/dist/_utils/parse-pi-transcript.d.ts +0 -3
- package/dist/_utils/parse-pi-transcript.js +0 -164
- package/dist/_utils/parse-pi-transcript.js.map +0 -1
- package/dist/_utils/parse-transcript.d.ts +0 -14
- package/dist/_utils/parse-transcript.js +0 -94
- package/dist/_utils/parse-transcript.js.map +0 -1
- package/dist/_utils/plugin-status.d.ts +0 -4
- package/dist/_utils/plugin-status.js +0 -76
- package/dist/_utils/plugin-status.js.map +0 -1
- package/dist/_utils/post-route.d.ts +0 -6
- package/dist/_utils/post-route.js +0 -66
- package/dist/_utils/post-route.js.map +0 -1
- package/dist/_utils/pr-review-link.d.ts +0 -11
- package/dist/_utils/pr-review-link.js.map +0 -1
- package/dist/_utils/proactive-ticket-log.d.ts +0 -3
- package/dist/_utils/proactive-ticket-log.js +0 -21
- package/dist/_utils/proactive-ticket-log.js.map +0 -1
- package/dist/_utils/purge-agent-plugins.d.ts +0 -8
- package/dist/_utils/purge-agent-plugins.js +0 -62
- package/dist/_utils/purge-agent-plugins.js.map +0 -1
- package/dist/_utils/purge-claude-statusline.d.ts +0 -12
- package/dist/_utils/purge-claude-statusline.js +0 -57
- package/dist/_utils/purge-claude-statusline.js.map +0 -1
- package/dist/_utils/purge-local-state.d.ts +0 -7
- package/dist/_utils/purge-local-state.js +0 -40
- package/dist/_utils/purge-local-state.js.map +0 -1
- package/dist/_utils/record-commit-anchor.d.ts +0 -8
- package/dist/_utils/record-commit-anchor.js +0 -73
- package/dist/_utils/record-commit-anchor.js.map +0 -1
- package/dist/_utils/refresh-control-state.d.ts +0 -6
- package/dist/_utils/refresh-control-state.js +0 -30
- package/dist/_utils/refresh-control-state.js.map +0 -1
- package/dist/_utils/render-callback-page.d.ts +0 -2
- package/dist/_utils/render-callback-page.js +0 -90
- package/dist/_utils/render-callback-page.js.map +0 -1
- package/dist/_utils/report-cli-install.d.ts +0 -2
- package/dist/_utils/report-cli-install.js +0 -17
- package/dist/_utils/report-cli-install.js.map +0 -1
- package/dist/_utils/resolve-import-workspace.d.ts +0 -4
- package/dist/_utils/resolve-import-workspace.js.map +0 -1
- package/dist/_utils/result.d.ts +0 -14
- package/dist/_utils/result.js +0 -12
- package/dist/_utils/result.js.map +0 -1
- package/dist/_utils/run-bin.d.ts +0 -14
- package/dist/_utils/run-bin.js +0 -60
- package/dist/_utils/run-bin.js.map +0 -1
- package/dist/_utils/runtime-timezone.d.ts +0 -1
- package/dist/_utils/runtime-timezone.js +0 -13
- package/dist/_utils/runtime-timezone.js.map +0 -1
- package/dist/_utils/session-map.d.ts +0 -4
- package/dist/_utils/session-map.js +0 -38
- package/dist/_utils/session-map.js.map +0 -1
- package/dist/_utils/shell-profile.d.ts +0 -13
- package/dist/_utils/shell-profile.js.map +0 -1
- package/dist/_utils/state-line-memo.d.ts +0 -2
- package/dist/_utils/state-line-memo.js +0 -47
- package/dist/_utils/state-line-memo.js.map +0 -1
- package/dist/_utils/state-line.d.ts +0 -3
- package/dist/_utils/state-line.js.map +0 -1
- package/dist/_utils/state.d.ts +0 -15
- package/dist/_utils/state.js +0 -53
- package/dist/_utils/state.js.map +0 -1
- package/dist/_utils/sync-mode-from-server.d.ts +0 -3
- package/dist/_utils/sync-mode-from-server.js +0 -44
- package/dist/_utils/sync-mode-from-server.js.map +0 -1
- package/dist/_utils/transcript-turns.d.ts +0 -51
- package/dist/_utils/transcript-turns.js.map +0 -1
- package/dist/_utils/turn-cache.d.ts +0 -7
- package/dist/_utils/turn-cache.js +0 -56
- package/dist/_utils/turn-cache.js.map +0 -1
- package/dist/_utils/update.d.ts +0 -19
- package/dist/_utils/update.js +0 -196
- package/dist/_utils/update.js.map +0 -1
- package/dist/_utils/version.d.ts +0 -2
- package/dist/_utils/version.js +0 -18
- package/dist/_utils/version.js.map +0 -1
- package/dist/_utils/which.d.ts +0 -2
- package/dist/_utils/which.js +0 -4
- package/dist/_utils/which.js.map +0 -1
- package/dist/_utils/write-commit-trailer.d.ts +0 -2
- package/dist/_utils/write-commit-trailer.js +0 -25
- package/dist/_utils/write-commit-trailer.js.map +0 -1
- package/dist/bin.d.ts +0 -2
- package/dist/commands/_utils/materialize-skill.d.ts +0 -30
- package/dist/commands/_utils/materialize-skill.js +0 -207
- package/dist/commands/_utils/materialize-skill.js.map +0 -1
- package/dist/commands/_utils/mutate-evidence.d.ts +0 -17
- package/dist/commands/_utils/mutate-evidence.js +0 -80
- package/dist/commands/_utils/mutate-evidence.js.map +0 -1
- package/dist/commands/_utils/pack-skill-dir.d.ts +0 -15
- package/dist/commands/_utils/pack-skill-dir.js +0 -169
- package/dist/commands/_utils/pack-skill-dir.js.map +0 -1
- package/dist/commands/artifact.d.ts +0 -18
- package/dist/commands/artifact.js +0 -139
- package/dist/commands/artifact.js.map +0 -1
- package/dist/commands/code-search.d.ts +0 -4
- package/dist/commands/code-search.js +0 -164
- package/dist/commands/code-search.js.map +0 -1
- package/dist/commands/dependency.d.ts +0 -4
- package/dist/commands/dependency.js +0 -23
- package/dist/commands/dependency.js.map +0 -1
- package/dist/commands/doctor.d.ts +0 -7
- package/dist/commands/doctor.js +0 -243
- package/dist/commands/doctor.js.map +0 -1
- package/dist/commands/feedback.d.ts +0 -15
- package/dist/commands/feedback.js +0 -112
- package/dist/commands/feedback.js.map +0 -1
- package/dist/commands/forget.d.ts +0 -4
- package/dist/commands/forget.js +0 -29
- package/dist/commands/forget.js.map +0 -1
- package/dist/commands/git-hooks.d.ts +0 -9
- package/dist/commands/git-hooks.js +0 -18
- package/dist/commands/git-hooks.js.map +0 -1
- package/dist/commands/import.d.ts +0 -8
- package/dist/commands/import.js +0 -414
- package/dist/commands/import.js.map +0 -1
- package/dist/commands/incognito.d.ts +0 -4
- package/dist/commands/incognito.js +0 -13
- package/dist/commands/incognito.js.map +0 -1
- package/dist/commands/indicator.d.ts +0 -4
- package/dist/commands/indicator.js +0 -65
- package/dist/commands/indicator.js.map +0 -1
- package/dist/commands/ingest.d.ts +0 -3
- package/dist/commands/ingest.js +0 -367
- package/dist/commands/ingest.js.map +0 -1
- package/dist/commands/install.d.ts +0 -9
- package/dist/commands/install.js +0 -431
- package/dist/commands/install.js.map +0 -1
- package/dist/commands/invite.d.ts +0 -4
- package/dist/commands/invite.js +0 -61
- package/dist/commands/invite.js.map +0 -1
- package/dist/commands/login.d.ts +0 -4
- package/dist/commands/login.js +0 -145
- package/dist/commands/login.js.map +0 -1
- package/dist/commands/logout.d.ts +0 -4
- package/dist/commands/logout.js +0 -26
- package/dist/commands/logout.js.map +0 -1
- package/dist/commands/onboard.d.ts +0 -4
- package/dist/commands/onboard.js +0 -18
- package/dist/commands/onboard.js.map +0 -1
- package/dist/commands/org.d.ts +0 -5
- package/dist/commands/org.js +0 -157
- package/dist/commands/org.js.map +0 -1
- package/dist/commands/pr-link.d.ts +0 -2
- package/dist/commands/pr-link.js +0 -69
- package/dist/commands/pr-link.js.map +0 -1
- package/dist/commands/restore.d.ts +0 -4
- package/dist/commands/restore.js +0 -23
- package/dist/commands/restore.js.map +0 -1
- package/dist/commands/search.d.ts +0 -4
- package/dist/commands/search.js +0 -85
- package/dist/commands/search.js.map +0 -1
- package/dist/commands/session-start.d.ts +0 -2
- package/dist/commands/session-start.js +0 -114
- package/dist/commands/session-start.js.map +0 -1
- package/dist/commands/set-mode.d.ts +0 -5
- package/dist/commands/set-mode.js +0 -96
- package/dist/commands/set-mode.js.map +0 -1
- package/dist/commands/skill.d.ts +0 -18
- package/dist/commands/skill.js +0 -309
- package/dist/commands/skill.js.map +0 -1
- package/dist/commands/status.d.ts +0 -4
- package/dist/commands/status.js +0 -33
- package/dist/commands/status.js.map +0 -1
- package/dist/commands/statusline.d.ts +0 -2
- package/dist/commands/statusline.js +0 -37
- package/dist/commands/statusline.js.map +0 -1
- package/dist/commands/suggestions.d.ts +0 -4
- package/dist/commands/suggestions.js +0 -84
- package/dist/commands/suggestions.js.map +0 -1
- package/dist/commands/takeover/_utils/agent-paths.d.ts +0 -6
- package/dist/commands/takeover/_utils/archive-codex-desktop-thread.d.ts +0 -5
- package/dist/commands/takeover/_utils/canonical-digest.d.ts +0 -5
- package/dist/commands/takeover/_utils/codex-desktop-recovery.d.ts +0 -16
- package/dist/commands/takeover/_utils/context-fit.d.ts +0 -18
- package/dist/commands/takeover/_utils/cursor-store.d.ts +0 -49
- package/dist/commands/takeover/_utils/import-codex-desktop-thread.d.ts +0 -14
- package/dist/commands/takeover/_utils/launch-desktop-url.d.ts +0 -4
- package/dist/commands/takeover/_utils/native-file.d.ts +0 -14
- package/dist/commands/takeover/_utils/probe-agent.d.ts +0 -20
- package/dist/commands/takeover/_utils/provenance-context.d.ts +0 -7
- package/dist/commands/takeover/_utils/staged-session.d.ts +0 -64
- package/dist/commands/takeover/_utils/write-claude-desktop-session.d.ts +0 -47
- package/dist/commands/takeover/_utils/write-claude-session.d.ts +0 -53
- package/dist/commands/takeover/_utils/write-codex-desktop-session.d.ts +0 -96
- package/dist/commands/takeover/_utils/write-codex-session.d.ts +0 -52
- package/dist/commands/takeover/_utils/write-cursor-session.d.ts +0 -57
- package/dist/commands/takeover/_utils/write-pi-session.d.ts +0 -52
- package/dist/commands/takeover/index.d.ts +0 -21
- package/dist/commands/takeover/takeover.schema.d.ts +0 -24
- package/dist/commands/uninstall.d.ts +0 -8
- package/dist/commands/uninstall.js +0 -130
- package/dist/commands/uninstall.js.map +0 -1
- package/dist/commands/update.d.ts +0 -4
- package/dist/commands/update.js +0 -127
- package/dist/commands/update.js.map +0 -1
- package/dist/jcode/skills/session-takeover/SKILL.md +0 -67
- /package/dist/{_utils → clients/agents}/normalize-transcript-timestamp.js +0 -0
|
@@ -1,113 +1,292 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { copyFile, mkdtemp, readFile, readdir, rm, } from "node:fs/promises";
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
3
2
|
import { homedir, tmpdir } from "node:os";
|
|
4
3
|
import { join } from "node:path";
|
|
5
4
|
import { pathToFileURL } from "node:url";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
5
|
+
import { cliErr } from "../../../core/errors/cli-error.js";
|
|
6
|
+
import { env } from "../../../core/system/env.js";
|
|
7
|
+
import { files } from "../../../core/system/files.js";
|
|
8
|
+
import { field } from "../../../core/json/json-field.js";
|
|
9
|
+
import { parseJson } from "../../../core/json/parse-json.js";
|
|
10
|
+
import { err, ok } from "../../../core/errors/result.js";
|
|
11
|
+
import { runProgram } from "../../../core/system/run-program.js";
|
|
12
|
+
import { sqlite } from "../../../core/system/sqlite.js";
|
|
13
|
+
const SQLITE_MISSING = cliErr("Exec", {
|
|
14
|
+
code: "cursor.sqlite_unavailable",
|
|
15
|
+
what: "Cursor takeover needs Node.js 22.5 or newer (node:sqlite)",
|
|
16
|
+
remedy: "run the takeover with Node.js 22.5+; no database was changed",
|
|
17
|
+
});
|
|
18
|
+
const cursorRoot = () => {
|
|
19
|
+
const e = env();
|
|
20
|
+
if (e.GLEN_CURSOR_USER_DATA)
|
|
21
|
+
return e.GLEN_CURSOR_USER_DATA;
|
|
22
|
+
if (process.platform === "darwin")
|
|
23
|
+
return join(homedir(), "Library", "Application Support", "Cursor");
|
|
24
|
+
if (process.platform === "win32")
|
|
25
|
+
return join(e.APPDATA ?? "", "Cursor");
|
|
26
|
+
return join(homedir(), ".config", "Cursor");
|
|
27
|
+
};
|
|
28
|
+
// SQLite in WAL mode keeps recent writes in -wal/-shm beside the db; a copy needs all three.
|
|
29
|
+
const databaseFiles = async (path) => {
|
|
30
|
+
const candidates = ["", "-wal", "-shm"].map((suffix) => ({
|
|
31
|
+
path: `${path}${suffix}`,
|
|
32
|
+
suffix,
|
|
33
|
+
}));
|
|
34
|
+
const present = await Promise.all(candidates.map((c) => files.exists(c.path)));
|
|
35
|
+
return candidates.filter((_, i) => present[i]);
|
|
36
|
+
};
|
|
37
|
+
const copyDatabaseFiles = async (source, destination) => {
|
|
38
|
+
const copied = await Promise.all((await databaseFiles(source)).map((file) => files.copyFile(file.path, `${destination}${file.suffix}`)));
|
|
39
|
+
const failed = copied.find((c) => !c.ok);
|
|
40
|
+
return failed && !failed.ok ? failed : ok(undefined);
|
|
41
|
+
};
|
|
42
|
+
const folderOf = async (directory) => {
|
|
43
|
+
const raw = await files.readTextIfExists(join(directory, "workspace.json"));
|
|
44
|
+
if (!raw.ok || raw.value === null)
|
|
16
45
|
return null;
|
|
17
|
-
|
|
46
|
+
const parsed = parseJson(raw.value);
|
|
47
|
+
const folder = parsed.ok ? field(parsed.value, "folder") : undefined;
|
|
48
|
+
return typeof folder === "string" ? folder.replace(/\/$/, "") : null;
|
|
18
49
|
};
|
|
19
|
-
|
|
20
|
-
(process.platform === "darwin"
|
|
21
|
-
? join(homedir(), "Library", "Application Support", "Cursor")
|
|
22
|
-
: process.platform === "win32"
|
|
23
|
-
? join(process.env.APPDATA ?? "", "Cursor")
|
|
24
|
-
: join(homedir(), ".config", "Cursor"));
|
|
25
|
-
const databaseFiles = (path) => ["", "-wal", "-shm"]
|
|
26
|
-
.map((suffix) => ({ path: `${path}${suffix}`, suffix }))
|
|
27
|
-
.filter((file) => existsSync(file.path));
|
|
28
|
-
const copyDatabaseFiles = (source, destination) => Promise.all(databaseFiles(source).map((file) => copyFile(file.path, `${destination}${file.suffix}`)));
|
|
50
|
+
// Cursor keeps one state db per opened folder under a hashed name; workspace.json says which.
|
|
29
51
|
const workspaceDb = async (workspace) => {
|
|
30
|
-
|
|
31
|
-
|
|
52
|
+
const override = env().GLEN_CURSOR_WORKSPACE_DB;
|
|
53
|
+
if (override)
|
|
54
|
+
return override;
|
|
32
55
|
const root = join(cursorRoot(), "User", "workspaceStorage");
|
|
33
|
-
const
|
|
34
|
-
if (!
|
|
56
|
+
const entries = await files.readDirEntries(root);
|
|
57
|
+
if (!entries.ok)
|
|
35
58
|
return null;
|
|
36
59
|
const expected = pathToFileURL(workspace).href.replace(/\/$/, "");
|
|
37
|
-
const matches = await Promise.all(
|
|
60
|
+
const matches = await Promise.all(entries.value
|
|
38
61
|
.filter((entry) => entry.isDirectory())
|
|
39
|
-
.map(async (entry) =>
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
if (!raw.ok)
|
|
43
|
-
return null;
|
|
44
|
-
try {
|
|
45
|
-
const parsed = JSON.parse(raw.value);
|
|
46
|
-
return typeof parsed.folder === "string" &&
|
|
47
|
-
parsed.folder.replace(/\/$/, "") === expected
|
|
48
|
-
? join(directory, "state.vscdb")
|
|
49
|
-
: null;
|
|
50
|
-
}
|
|
51
|
-
catch {
|
|
52
|
-
return null;
|
|
53
|
-
}
|
|
54
|
-
}));
|
|
62
|
+
.map(async (entry) => (await folderOf(join(root, entry.name))) === expected
|
|
63
|
+
? join(root, entry.name, "state.vscdb")
|
|
64
|
+
: null));
|
|
55
65
|
return matches.find((match) => match !== null) ?? null;
|
|
56
66
|
};
|
|
57
67
|
const cursorIsRunning = () => {
|
|
58
|
-
if (
|
|
68
|
+
if (env().GLEN_CURSOR_TEST_CLOSED)
|
|
59
69
|
return false;
|
|
60
70
|
if (process.platform === "win32") {
|
|
61
|
-
const listed =
|
|
71
|
+
const listed = runProgram("tasklist", ["/FI", "IMAGENAME eq Cursor.exe"], {
|
|
62
72
|
timeoutMs: 3000,
|
|
63
73
|
});
|
|
64
74
|
return listed.ok && /Cursor\.exe/i.test(listed.value.stdout);
|
|
65
75
|
}
|
|
66
|
-
return
|
|
76
|
+
return runProgram("pgrep", ["-f", "Cursor(.app/Contents/MacOS/Cursor)?"], {
|
|
67
77
|
timeoutMs: 3000,
|
|
68
78
|
}).ok;
|
|
69
79
|
};
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
80
|
+
const namesOf = (rows) => new Set(rows.ok
|
|
81
|
+
? rows.value.map((row) => row.name).filter((n) => typeof n === "string")
|
|
82
|
+
: []);
|
|
83
|
+
const HEADER_COLUMNS = [
|
|
84
|
+
"composerId",
|
|
85
|
+
"workspaceId",
|
|
86
|
+
"createdAt",
|
|
87
|
+
"lastUpdatedAt",
|
|
88
|
+
"isArchived",
|
|
89
|
+
"isSubagent",
|
|
90
|
+
"recency",
|
|
91
|
+
"checkpointAt",
|
|
92
|
+
"value",
|
|
93
|
+
];
|
|
94
|
+
const schemaSupported = (global, workspace) => {
|
|
95
|
+
const tables = namesOf(global.all("SELECT name FROM sqlite_master WHERE type = 'table'"));
|
|
76
96
|
if (!tables.has("cursorDiskKV") || !tables.has("composerHeaders"))
|
|
77
97
|
return false;
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
.
|
|
82
|
-
.
|
|
83
|
-
return [
|
|
84
|
-
"composerId",
|
|
85
|
-
"workspaceId",
|
|
86
|
-
"createdAt",
|
|
87
|
-
"lastUpdatedAt",
|
|
88
|
-
"isArchived",
|
|
89
|
-
"isSubagent",
|
|
90
|
-
"recency",
|
|
91
|
-
"checkpointAt",
|
|
92
|
-
"value",
|
|
93
|
-
].every((column) => headerColumns.has(column));
|
|
98
|
+
const columns = namesOf(global.all("PRAGMA table_info(composerHeaders)"));
|
|
99
|
+
const itemTable = workspace.get("SELECT name FROM sqlite_master WHERE type='table' AND name='ItemTable'");
|
|
100
|
+
return (HEADER_COLUMNS.every((column) => columns.has(column)) &&
|
|
101
|
+
itemTable.ok &&
|
|
102
|
+
itemTable.value !== null);
|
|
94
103
|
};
|
|
95
|
-
const
|
|
96
|
-
db
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
104
|
+
const openDb = async (path, readOnly) => {
|
|
105
|
+
const db = await sqlite.open(path, { readOnly });
|
|
106
|
+
if (db.ok)
|
|
107
|
+
return db;
|
|
108
|
+
return err(db.error.kind === "unavailable"
|
|
109
|
+
? SQLITE_MISSING
|
|
110
|
+
: cliErr("Fs", {
|
|
111
|
+
code: "cursor.db_open_failed",
|
|
112
|
+
what: "could not open a Cursor database",
|
|
113
|
+
path,
|
|
114
|
+
cause: db.error.cause,
|
|
115
|
+
remedy: "confirm Cursor is closed and the databases are readable",
|
|
116
|
+
}));
|
|
102
117
|
};
|
|
118
|
+
const runAll = (db, statements) => statements.reduce((done, [sql, ...params]) => (done.ok ? db.run(sql, ...params) : done), ok(undefined));
|
|
103
119
|
const attach = (db, path) => db.exec(`ATTACH DATABASE '${path.replaceAll("'", "''")}' AS workspace_db`);
|
|
120
|
+
const insertComposer = (db, input) => runAll(db, [
|
|
121
|
+
[
|
|
122
|
+
"INSERT INTO cursorDiskKV(key, value) VALUES (?, ?)",
|
|
123
|
+
`composerData:${input.sessionId}`,
|
|
124
|
+
input.composer,
|
|
125
|
+
],
|
|
126
|
+
...input.bubbles.map((bubble) => [
|
|
127
|
+
"INSERT INTO cursorDiskKV(key, value) VALUES (?, ?)",
|
|
128
|
+
bubble.key,
|
|
129
|
+
bubble.value,
|
|
130
|
+
]),
|
|
131
|
+
[
|
|
132
|
+
"INSERT INTO composerHeaders(composerId, workspaceId, createdAt, lastUpdatedAt, isArchived, isSubagent, recency, checkpointAt, value) VALUES (?, ?, ?, ?, 0, 0, ?, NULL, ?)",
|
|
133
|
+
input.sessionId,
|
|
134
|
+
input.workspaceId,
|
|
135
|
+
input.now,
|
|
136
|
+
input.now,
|
|
137
|
+
input.now,
|
|
138
|
+
input.header,
|
|
139
|
+
],
|
|
140
|
+
[
|
|
141
|
+
"INSERT OR REPLACE INTO workspace_db.ItemTable(key, value) VALUES (?, ?)",
|
|
142
|
+
"composer.composerData",
|
|
143
|
+
input.workspaceIndex,
|
|
144
|
+
],
|
|
145
|
+
]);
|
|
146
|
+
const nextWorkspaceIndex = (db, sessionId) => {
|
|
147
|
+
const stored = db.get("SELECT value FROM workspace_db.ItemTable WHERE key = 'composer.composerData'");
|
|
148
|
+
if (!stored.ok)
|
|
149
|
+
return stored;
|
|
150
|
+
const raw = stored.value?.value;
|
|
151
|
+
const parsed = typeof raw === "string" ? parseJson(raw) : null;
|
|
152
|
+
const index = parsed?.ok && typeof parsed.value === "object" && parsed.value !== null
|
|
153
|
+
? parsed.value
|
|
154
|
+
: {};
|
|
155
|
+
return ok(JSON.stringify({
|
|
156
|
+
...index,
|
|
157
|
+
selectedComposerIds: [sessionId],
|
|
158
|
+
lastFocusedComposerIds: [sessionId],
|
|
159
|
+
hasMigratedComposerData: true,
|
|
160
|
+
hasMigratedMultipleComposers: true,
|
|
161
|
+
}));
|
|
162
|
+
};
|
|
163
|
+
const writeStaged = (db, workspaceCopy, input) => {
|
|
164
|
+
const attached = attach(db, workspaceCopy);
|
|
165
|
+
if (!attached.ok)
|
|
166
|
+
return attached;
|
|
167
|
+
return db.transaction(() => {
|
|
168
|
+
const index = nextWorkspaceIndex(db, input.sessionId);
|
|
169
|
+
if (!index.ok)
|
|
170
|
+
return index;
|
|
171
|
+
return insertComposer(db, { ...input, workspaceIndex: index.value });
|
|
172
|
+
});
|
|
173
|
+
};
|
|
174
|
+
const readStagedRows = (stagedGlobal, stagedWorkspace, sessionId) => {
|
|
175
|
+
const composer = stagedGlobal.get("SELECT value FROM cursorDiskKV WHERE key = ?", `composerData:${sessionId}`);
|
|
176
|
+
const bubbles = stagedGlobal.all("SELECT key, value FROM cursorDiskKV WHERE key LIKE ?", `bubbleId:${sessionId}:%`);
|
|
177
|
+
const header = stagedGlobal.get("SELECT * FROM composerHeaders WHERE composerId = ?", sessionId);
|
|
178
|
+
const index = stagedWorkspace.get("SELECT value FROM ItemTable WHERE key = 'composer.composerData'");
|
|
179
|
+
if (!composer.ok)
|
|
180
|
+
return composer;
|
|
181
|
+
if (!bubbles.ok)
|
|
182
|
+
return bubbles;
|
|
183
|
+
if (!header.ok)
|
|
184
|
+
return header;
|
|
185
|
+
if (!index.ok)
|
|
186
|
+
return index;
|
|
187
|
+
const composerValue = composer.value?.value;
|
|
188
|
+
const indexValue = index.value?.value;
|
|
189
|
+
if (typeof composerValue !== "string" ||
|
|
190
|
+
!header.value ||
|
|
191
|
+
typeof indexValue !== "string")
|
|
192
|
+
return err(new Error("staged Cursor rows are incomplete"));
|
|
193
|
+
return ok({
|
|
194
|
+
composer: composerValue,
|
|
195
|
+
bubbles: bubbles.value,
|
|
196
|
+
header: header.value,
|
|
197
|
+
workspaceIndex: indexValue,
|
|
198
|
+
});
|
|
199
|
+
};
|
|
200
|
+
const sortedByKey = (rows) => [...rows].sort((a, b) => String(a.key).localeCompare(String(b.key)));
|
|
201
|
+
// Must run inside the transaction, so the retry-vs-conflict check can't race another takeover.
|
|
202
|
+
const applyRows = (global, sessionId, rows) => {
|
|
203
|
+
const existing = global.get("SELECT value FROM cursorDiskKV WHERE key = ?", `composerData:${sessionId}`);
|
|
204
|
+
const existingHeader = global.get("SELECT value FROM composerHeaders WHERE composerId = ?", sessionId);
|
|
205
|
+
const existingBubbles = global.all("SELECT key, value FROM cursorDiskKV WHERE key LIKE ? ORDER BY key", `bubbleId:${sessionId}:%`);
|
|
206
|
+
if (!existing.ok)
|
|
207
|
+
return existing;
|
|
208
|
+
if (!existingHeader.ok)
|
|
209
|
+
return existingHeader;
|
|
210
|
+
if (!existingBubbles.ok)
|
|
211
|
+
return existingBubbles;
|
|
212
|
+
const indexed = [
|
|
213
|
+
"INSERT OR REPLACE INTO workspace_db.ItemTable(key, value) VALUES ('composer.composerData', ?)",
|
|
214
|
+
rows.workspaceIndex,
|
|
215
|
+
];
|
|
216
|
+
if (existing.value !== null) {
|
|
217
|
+
const matches = existing.value.value === rows.composer &&
|
|
218
|
+
existingHeader.value?.value === rows.header.value &&
|
|
219
|
+
JSON.stringify(existingBubbles.value) ===
|
|
220
|
+
JSON.stringify(sortedByKey(rows.bubbles));
|
|
221
|
+
return matches
|
|
222
|
+
? runAll(global, [indexed])
|
|
223
|
+
: err(new Error("destination composer already exists with different content"));
|
|
224
|
+
}
|
|
225
|
+
const h = rows.header;
|
|
226
|
+
return runAll(global, [
|
|
227
|
+
[
|
|
228
|
+
"INSERT INTO cursorDiskKV(key, value) VALUES (?, ?)",
|
|
229
|
+
`composerData:${sessionId}`,
|
|
230
|
+
rows.composer,
|
|
231
|
+
],
|
|
232
|
+
...rows.bubbles.map((bubble) => [
|
|
233
|
+
"INSERT INTO cursorDiskKV(key, value) VALUES (?, ?)",
|
|
234
|
+
bubble.key,
|
|
235
|
+
bubble.value,
|
|
236
|
+
]),
|
|
237
|
+
[
|
|
238
|
+
"INSERT INTO composerHeaders(composerId, workspaceId, createdAt, lastUpdatedAt, isArchived, isSubagent, recency, checkpointAt, value) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)",
|
|
239
|
+
h.composerId,
|
|
240
|
+
h.workspaceId,
|
|
241
|
+
h.createdAt,
|
|
242
|
+
h.lastUpdatedAt,
|
|
243
|
+
h.isArchived,
|
|
244
|
+
h.isSubagent,
|
|
245
|
+
h.recency,
|
|
246
|
+
h.checkpointAt ?? null,
|
|
247
|
+
h.value,
|
|
248
|
+
],
|
|
249
|
+
indexed,
|
|
250
|
+
]);
|
|
251
|
+
};
|
|
252
|
+
const readStaged = async (stagedDirectory, sessionId) => {
|
|
253
|
+
const stagedGlobal = await openDb(join(stagedDirectory, "global.vscdb"), true);
|
|
254
|
+
if (!stagedGlobal.ok)
|
|
255
|
+
return stagedGlobal;
|
|
256
|
+
const stagedWorkspace = await openDb(join(stagedDirectory, "workspace.vscdb"), true);
|
|
257
|
+
if (!stagedWorkspace.ok) {
|
|
258
|
+
stagedGlobal.value.close();
|
|
259
|
+
return stagedWorkspace;
|
|
260
|
+
}
|
|
261
|
+
const rows = readStagedRows(stagedGlobal.value, stagedWorkspace.value, sessionId);
|
|
262
|
+
stagedGlobal.value.close();
|
|
263
|
+
stagedWorkspace.value.close();
|
|
264
|
+
return rows.ok ? rows : err({ cause: rows.error });
|
|
265
|
+
};
|
|
266
|
+
const applyStaged = async (paths, stagedDirectory, sessionId) => {
|
|
267
|
+
const rows = await readStaged(stagedDirectory, sessionId);
|
|
268
|
+
if (!rows.ok)
|
|
269
|
+
return rows;
|
|
270
|
+
const global = await openDb(paths.globalDb, false);
|
|
271
|
+
if (!global.ok)
|
|
272
|
+
return global;
|
|
273
|
+
const attached = attach(global.value, paths.workspaceDb);
|
|
274
|
+
const applied = attached.ok
|
|
275
|
+
? global.value.transaction(() => applyRows(global.value, sessionId, rows.value))
|
|
276
|
+
: attached;
|
|
277
|
+
global.value.close();
|
|
278
|
+
return applied.ok ? ok(undefined) : err({ cause: applied.error });
|
|
279
|
+
};
|
|
104
280
|
const cursorStore = {
|
|
105
281
|
async locate(workspace) {
|
|
106
|
-
const globalDb =
|
|
282
|
+
const globalDb = env().GLEN_CURSOR_GLOBAL_DB ??
|
|
107
283
|
join(cursorRoot(), "User", "globalStorage", "state.vscdb");
|
|
108
284
|
const matched = await workspaceDb(workspace);
|
|
109
|
-
if (!
|
|
110
|
-
|
|
285
|
+
if (!(await files.exists(globalDb)) ||
|
|
286
|
+
!matched ||
|
|
287
|
+
!(await files.exists(matched)))
|
|
288
|
+
return err(cliErr("Usage", {
|
|
289
|
+
code: "cursor.workspace_not_initialized",
|
|
111
290
|
what: "Cursor has not initialized this workspace for local chat history",
|
|
112
291
|
path: matched ?? globalDb,
|
|
113
292
|
remedy: "open this folder in Cursor once, close Cursor completely, then retry the takeover",
|
|
@@ -120,130 +299,51 @@ const cursorStore = {
|
|
|
120
299
|
},
|
|
121
300
|
async probe(paths) {
|
|
122
301
|
if ((Number(process.versions.node.split(".")[0]) || 0) < 22)
|
|
123
|
-
return err(
|
|
124
|
-
what: "Cursor takeover needs Node.js 22.5 or newer",
|
|
125
|
-
remedy: "run the takeover with Node.js 22.5+; no database was changed",
|
|
126
|
-
}));
|
|
302
|
+
return err(SQLITE_MISSING);
|
|
127
303
|
if (cursorIsRunning())
|
|
128
|
-
return err(cliErr({
|
|
304
|
+
return err(cliErr("Usage", {
|
|
305
|
+
code: "cursor.running",
|
|
129
306
|
what: "Cursor is still running",
|
|
130
307
|
remedy: "quit every Cursor window and wait a moment, then retry; no database was changed",
|
|
131
308
|
}));
|
|
132
|
-
const
|
|
133
|
-
if (!
|
|
134
|
-
return
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
const supported = schemaSupported(global) &&
|
|
145
|
-
workspace
|
|
146
|
-
.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='ItemTable'")
|
|
147
|
-
.get() !== undefined;
|
|
148
|
-
global.close();
|
|
149
|
-
workspace.close();
|
|
150
|
-
return supported;
|
|
151
|
-
}
|
|
152
|
-
catch {
|
|
153
|
-
return false;
|
|
154
|
-
}
|
|
155
|
-
})();
|
|
156
|
-
return checked
|
|
309
|
+
const global = await openDb(paths.globalDb, true);
|
|
310
|
+
if (!global.ok)
|
|
311
|
+
return global;
|
|
312
|
+
const workspace = await openDb(paths.workspaceDb, true);
|
|
313
|
+
if (!workspace.ok) {
|
|
314
|
+
global.value.close();
|
|
315
|
+
return workspace;
|
|
316
|
+
}
|
|
317
|
+
const supported = schemaSupported(global.value, workspace.value);
|
|
318
|
+
global.value.close();
|
|
319
|
+
workspace.value.close();
|
|
320
|
+
return supported
|
|
157
321
|
? ok(undefined)
|
|
158
|
-
: err(cliErr({
|
|
322
|
+
: err(cliErr("Usage", {
|
|
323
|
+
code: "cursor.schema_unsupported",
|
|
159
324
|
what: "this Cursor local-history schema is not supported",
|
|
160
325
|
remedy: "update Glen and Cursor, then retry; no database was changed",
|
|
161
326
|
}));
|
|
162
327
|
},
|
|
163
328
|
async stage(paths, input) {
|
|
164
|
-
const safe = await
|
|
329
|
+
const safe = await cursorStore.probe(paths);
|
|
165
330
|
if (!safe.ok)
|
|
166
331
|
return safe;
|
|
167
|
-
const directory =
|
|
168
|
-
|
|
169
|
-
|
|
332
|
+
const directory = join(tmpdir(), `glen-cursor-takeover-${randomUUID()}`);
|
|
333
|
+
const made = await files.ensureDir(directory);
|
|
334
|
+
if (!made.ok)
|
|
335
|
+
return err(files.toError(made.error, {
|
|
336
|
+
code: "cursor.staging_dir_failed",
|
|
170
337
|
what: "could not create Cursor takeover staging",
|
|
171
|
-
why: causeOf(directory.error),
|
|
172
338
|
remedy: "check temporary-directory permissions, then retry",
|
|
173
339
|
}));
|
|
174
|
-
const
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
copyDatabaseFiles(paths.workspaceDb, workspaceCopy),
|
|
179
|
-
]));
|
|
180
|
-
if (!copied.ok) {
|
|
181
|
-
await rm(directory.value, { recursive: true, force: true });
|
|
182
|
-
return err(cliErr({
|
|
183
|
-
what: "could not copy the Cursor databases for staging",
|
|
184
|
-
why: causeOf(copied.error),
|
|
185
|
-
remedy: "confirm Cursor is closed and the databases are readable",
|
|
186
|
-
}));
|
|
187
|
-
}
|
|
188
|
-
const DatabaseSync = await loadSqlite();
|
|
189
|
-
if (!DatabaseSync) {
|
|
190
|
-
await rm(directory.value, { recursive: true, force: true });
|
|
191
|
-
return err(cliErr({
|
|
192
|
-
what: "node:sqlite became unavailable",
|
|
193
|
-
remedy: "retry with Node.js 22.5+",
|
|
194
|
-
}));
|
|
195
|
-
}
|
|
196
|
-
const written = (() => {
|
|
197
|
-
try {
|
|
198
|
-
const global = new DatabaseSync(globalCopy);
|
|
199
|
-
attach(global, workspaceCopy);
|
|
200
|
-
global.exec("BEGIN IMMEDIATE");
|
|
201
|
-
const storedIndex = global
|
|
202
|
-
.prepare("SELECT value FROM workspace_db.ItemTable WHERE key = 'composer.composerData'")
|
|
203
|
-
.get()?.value;
|
|
204
|
-
const parsedIndex = (() => {
|
|
205
|
-
try {
|
|
206
|
-
const value = typeof storedIndex === "string"
|
|
207
|
-
? JSON.parse(storedIndex)
|
|
208
|
-
: null;
|
|
209
|
-
return value !== null && typeof value === "object"
|
|
210
|
-
? value
|
|
211
|
-
: {};
|
|
212
|
-
}
|
|
213
|
-
catch {
|
|
214
|
-
return {};
|
|
215
|
-
}
|
|
216
|
-
})();
|
|
217
|
-
mutate(global, {
|
|
218
|
-
...input,
|
|
219
|
-
workspaceIndex: JSON.stringify({
|
|
220
|
-
...parsedIndex,
|
|
221
|
-
selectedComposerIds: [input.sessionId],
|
|
222
|
-
lastFocusedComposerIds: [input.sessionId],
|
|
223
|
-
hasMigratedComposerData: true,
|
|
224
|
-
hasMigratedMultipleComposers: true,
|
|
225
|
-
}),
|
|
226
|
-
});
|
|
227
|
-
global.exec("COMMIT");
|
|
228
|
-
global.close();
|
|
229
|
-
return ok(undefined);
|
|
230
|
-
}
|
|
231
|
-
catch (error) {
|
|
232
|
-
return err(error);
|
|
233
|
-
}
|
|
234
|
-
})();
|
|
235
|
-
if (!written.ok) {
|
|
236
|
-
await rm(directory.value, { recursive: true, force: true });
|
|
237
|
-
return err(cliErr({
|
|
238
|
-
what: "could not stage the Cursor conversation",
|
|
239
|
-
why: causeOf(written.error),
|
|
240
|
-
remedy: "update Glen and Cursor, then retry",
|
|
241
|
-
}));
|
|
242
|
-
}
|
|
243
|
-
return ok({ path: directory.value });
|
|
340
|
+
const staged = await stageInto(directory, paths, input);
|
|
341
|
+
if (!staged.ok)
|
|
342
|
+
void (await files.remove(directory, { recursive: true }));
|
|
343
|
+
return staged.ok ? ok({ path: directory }) : staged;
|
|
244
344
|
},
|
|
245
345
|
async install(paths, stagedDirectory, sessionId) {
|
|
246
|
-
const safe = await
|
|
346
|
+
const safe = await cursorStore.probe(paths);
|
|
247
347
|
if (!safe.ok)
|
|
248
348
|
return safe;
|
|
249
349
|
const suffix = new Date().toISOString().replace(/[:.]/g, "-");
|
|
@@ -251,107 +351,59 @@ const cursorStore = {
|
|
|
251
351
|
source,
|
|
252
352
|
destination: `${source}.glen-takeover-${suffix}.bak`,
|
|
253
353
|
}));
|
|
254
|
-
const backups = backupSets.
|
|
255
|
-
const backedUp = await
|
|
256
|
-
|
|
257
|
-
|
|
354
|
+
const backups = (await Promise.all(backupSets.map(async ({ source, destination }) => (await databaseFiles(source)).map((file) => `${destination}${file.suffix}`)))).flat();
|
|
355
|
+
const backedUp = await Promise.all(backupSets.map(({ source, destination }) => copyDatabaseFiles(source, destination)));
|
|
356
|
+
const backupFailed = backedUp.find((b) => !b.ok);
|
|
357
|
+
if (backupFailed && !backupFailed.ok)
|
|
358
|
+
return err(files.toError(backupFailed.error, {
|
|
359
|
+
code: "cursor.backup_failed",
|
|
258
360
|
what: "could not back up Cursor before takeover",
|
|
259
|
-
why: causeOf(backedUp.error),
|
|
260
361
|
remedy: "check disk space and database permissions, then retry",
|
|
261
362
|
}));
|
|
262
|
-
const
|
|
263
|
-
if (
|
|
264
|
-
return
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
.get(`composerData:${sessionId}`)?.value;
|
|
275
|
-
const bubbles = stagedGlobal
|
|
276
|
-
.prepare("SELECT key, value FROM cursorDiskKV WHERE key LIKE ?")
|
|
277
|
-
.all(`bubbleId:${sessionId}:%`);
|
|
278
|
-
const header = stagedGlobal
|
|
279
|
-
.prepare("SELECT * FROM composerHeaders WHERE composerId = ?")
|
|
280
|
-
.get(sessionId);
|
|
281
|
-
const workspaceIndex = stagedWorkspace
|
|
282
|
-
.prepare("SELECT value FROM ItemTable WHERE key = 'composer.composerData'")
|
|
283
|
-
.get()?.value;
|
|
284
|
-
stagedGlobal.close();
|
|
285
|
-
stagedWorkspace.close();
|
|
286
|
-
if (typeof composer !== "string" ||
|
|
287
|
-
!header ||
|
|
288
|
-
typeof workspaceIndex !== "string")
|
|
289
|
-
return err(new Error("staged Cursor rows are incomplete"));
|
|
290
|
-
const global = new DatabaseSync(paths.globalDb);
|
|
291
|
-
try {
|
|
292
|
-
attach(global, paths.workspaceDb);
|
|
293
|
-
global.exec("BEGIN IMMEDIATE");
|
|
294
|
-
const existing = global
|
|
295
|
-
.prepare("SELECT value FROM cursorDiskKV WHERE key = ?")
|
|
296
|
-
.get(`composerData:${sessionId}`)?.value;
|
|
297
|
-
const existingHeader = global
|
|
298
|
-
.prepare("SELECT value FROM composerHeaders WHERE composerId = ?")
|
|
299
|
-
.get(sessionId)?.value;
|
|
300
|
-
const existingBubbles = global
|
|
301
|
-
.prepare("SELECT key, value FROM cursorDiskKV WHERE key LIKE ? ORDER BY key")
|
|
302
|
-
.all(`bubbleId:${sessionId}:%`);
|
|
303
|
-
const expectedBubbles = [...bubbles].sort((first, second) => String(first.key).localeCompare(String(second.key)));
|
|
304
|
-
const existingMatches = existing === composer &&
|
|
305
|
-
existingHeader === header.value &&
|
|
306
|
-
JSON.stringify(existingBubbles) === JSON.stringify(expectedBubbles);
|
|
307
|
-
if (existing !== undefined && !existingMatches) {
|
|
308
|
-
global.exec("ROLLBACK");
|
|
309
|
-
global.close();
|
|
310
|
-
return err(new Error("destination composer already exists with different content"));
|
|
311
|
-
}
|
|
312
|
-
if (existing === undefined) {
|
|
313
|
-
global
|
|
314
|
-
.prepare("INSERT INTO cursorDiskKV(key, value) VALUES (?, ?)")
|
|
315
|
-
.run(`composerData:${sessionId}`, composer);
|
|
316
|
-
const insertBubble = global.prepare("INSERT INTO cursorDiskKV(key, value) VALUES (?, ?)");
|
|
317
|
-
for (const bubble of bubbles)
|
|
318
|
-
insertBubble.run(bubble.key, bubble.value);
|
|
319
|
-
global
|
|
320
|
-
.prepare("INSERT INTO composerHeaders(composerId, workspaceId, createdAt, lastUpdatedAt, isArchived, isSubagent, recency, checkpointAt, value) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)")
|
|
321
|
-
.run(header.composerId, header.workspaceId, header.createdAt, header.lastUpdatedAt, header.isArchived, header.isSubagent, header.recency, header.checkpointAt ?? null, header.value);
|
|
322
|
-
}
|
|
323
|
-
global
|
|
324
|
-
.prepare("INSERT OR REPLACE INTO workspace_db.ItemTable(key, value) VALUES ('composer.composerData', ?)")
|
|
325
|
-
.run(workspaceIndex);
|
|
326
|
-
global.exec("COMMIT");
|
|
327
|
-
global.close();
|
|
328
|
-
return ok(undefined);
|
|
329
|
-
}
|
|
330
|
-
catch (error) {
|
|
331
|
-
try {
|
|
332
|
-
global.exec("ROLLBACK");
|
|
333
|
-
}
|
|
334
|
-
catch { }
|
|
335
|
-
global.close();
|
|
336
|
-
return err(error);
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
catch (error) {
|
|
340
|
-
return err(error);
|
|
341
|
-
}
|
|
342
|
-
})();
|
|
343
|
-
return applied.ok
|
|
344
|
-
? ok({ backups })
|
|
345
|
-
: err(cliErr({
|
|
346
|
-
what: "Cursor takeover rolled back before completion",
|
|
347
|
-
why: causeOf(applied.error),
|
|
348
|
-
path: backups.join(" and "),
|
|
349
|
-
remedy: "keep the backups, confirm Cursor is closed, and retry; no existing conversation was overwritten",
|
|
350
|
-
}));
|
|
363
|
+
const applied = await applyStaged(paths, stagedDirectory, sessionId);
|
|
364
|
+
if (applied.ok)
|
|
365
|
+
return ok({ backups });
|
|
366
|
+
if ("code" in applied.error)
|
|
367
|
+
return err(applied.error);
|
|
368
|
+
return err(cliErr("Exec", {
|
|
369
|
+
code: "cursor.install_rolled_back",
|
|
370
|
+
what: "Cursor takeover rolled back before completion",
|
|
371
|
+
cause: applied.error.cause,
|
|
372
|
+
path: backups.join(" and "),
|
|
373
|
+
remedy: "keep the backups, confirm Cursor is closed, and retry; no existing conversation was overwritten",
|
|
374
|
+
}));
|
|
351
375
|
},
|
|
352
376
|
async cleanup(path) {
|
|
353
|
-
await
|
|
377
|
+
void (await files.remove(path, { recursive: true }));
|
|
354
378
|
},
|
|
355
379
|
};
|
|
380
|
+
const stageInto = async (directory, paths, input) => {
|
|
381
|
+
const globalCopy = join(directory, "global.vscdb");
|
|
382
|
+
const workspaceCopy = join(directory, "workspace.vscdb");
|
|
383
|
+
const copied = await Promise.all([
|
|
384
|
+
copyDatabaseFiles(paths.globalDb, globalCopy),
|
|
385
|
+
copyDatabaseFiles(paths.workspaceDb, workspaceCopy),
|
|
386
|
+
]);
|
|
387
|
+
const copyFailed = copied.find((c) => !c.ok);
|
|
388
|
+
if (copyFailed && !copyFailed.ok)
|
|
389
|
+
return err(files.toError(copyFailed.error, {
|
|
390
|
+
code: "cursor.copy_failed",
|
|
391
|
+
what: "could not copy the Cursor databases for staging",
|
|
392
|
+
remedy: "confirm Cursor is closed and the databases are readable",
|
|
393
|
+
}));
|
|
394
|
+
const db = await openDb(globalCopy, false);
|
|
395
|
+
if (!db.ok)
|
|
396
|
+
return db;
|
|
397
|
+
const written = writeStaged(db.value, workspaceCopy, input);
|
|
398
|
+
db.value.close();
|
|
399
|
+
return written.ok
|
|
400
|
+
? ok(undefined)
|
|
401
|
+
: err(cliErr("Exec", {
|
|
402
|
+
code: "cursor.stage_failed",
|
|
403
|
+
what: "could not stage the Cursor conversation",
|
|
404
|
+
cause: written.error,
|
|
405
|
+
remedy: "update Glen and Cursor, then retry",
|
|
406
|
+
}));
|
|
407
|
+
};
|
|
356
408
|
export { cursorStore };
|
|
357
409
|
//# sourceMappingURL=cursor-store.js.map
|