kimaki 0.31.0 → 1.1.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/dist/agent-ui.d.ts +33 -0
- package/dist/agent-ui.e2e.test.d.ts +1 -0
- package/dist/agent-ui.e2e.test.js +140 -0
- package/dist/agent-ui.e2e.test.js.map +1 -0
- package/dist/agent-ui.js +199 -0
- package/dist/agent-ui.js.map +1 -0
- package/dist/analytics.d.ts +42 -0
- package/dist/analytics.e2e.test.d.ts +1 -0
- package/dist/analytics.e2e.test.js +112 -0
- package/dist/analytics.e2e.test.js.map +1 -0
- package/dist/analytics.js +162 -223
- package/dist/analytics.js.map +1 -0
- package/dist/analytics.test.d.ts +1 -0
- package/dist/analytics.test.js +121 -157
- package/dist/analytics.test.js.map +1 -0
- package/dist/autostart.d.ts +7 -0
- package/dist/autostart.js +87 -0
- package/dist/autostart.js.map +1 -0
- package/dist/bot.d.ts +91 -0
- package/dist/bot.js +120 -0
- package/dist/bot.js.map +1 -0
- package/dist/btw.e2e.test.d.ts +1 -0
- package/dist/btw.e2e.test.js +102 -0
- package/dist/btw.e2e.test.js.map +1 -0
- package/dist/builtin-skills.d.ts +18 -0
- package/dist/builtin-skills.js +51 -0
- package/dist/builtin-skills.js.map +1 -0
- package/dist/builtin-skills.test.d.ts +1 -0
- package/dist/builtin-skills.test.js +28 -0
- package/dist/builtin-skills.test.js.map +1 -0
- package/dist/catalog-refresh.e2e.test.d.ts +1 -0
- package/dist/catalog-refresh.e2e.test.js +90 -0
- package/dist/catalog-refresh.e2e.test.js.map +1 -0
- package/dist/cli/bot.d.ts +5 -0
- package/dist/cli/bot.js +434 -0
- package/dist/cli/bot.js.map +1 -0
- package/dist/cli/discord.d.ts +3 -0
- package/dist/cli/discord.js +118 -0
- package/dist/cli/discord.js.map +1 -0
- package/dist/cli/project.d.ts +5 -0
- package/dist/cli/project.js +143 -0
- package/dist/cli/project.js.map +1 -0
- package/dist/cli/schedule.d.ts +3 -0
- package/dist/cli/schedule.js +156 -0
- package/dist/cli/schedule.js.map +1 -0
- package/dist/cli/session.d.ts +4 -0
- package/dist/cli/session.js +245 -0
- package/dist/cli/session.js.map +1 -0
- package/dist/cli/shared.d.ts +55 -0
- package/dist/cli/shared.js +138 -0
- package/dist/cli/shared.js.map +1 -0
- package/dist/cli-discord.e2e.test.d.ts +1 -0
- package/dist/cli-discord.e2e.test.js +82 -0
- package/dist/cli-discord.e2e.test.js.map +1 -0
- package/dist/cli-lock.e2e.test.d.ts +1 -0
- package/dist/cli-lock.e2e.test.js +520 -0
- package/dist/cli-lock.e2e.test.js.map +1 -0
- package/dist/cli-read.e2e.test.d.ts +1 -0
- package/dist/cli-read.e2e.test.js +86 -0
- package/dist/cli-read.e2e.test.js.map +1 -0
- package/dist/cli-sessions.e2e.test.d.ts +1 -0
- package/dist/cli-sessions.e2e.test.js +116 -0
- package/dist/cli-sessions.e2e.test.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +34 -263
- package/dist/cli.js.map +1 -0
- package/dist/commands/login-commands.d.ts +59 -0
- package/dist/commands/login-commands.js +341 -0
- package/dist/commands/login-commands.js.map +1 -0
- package/dist/commands/preference-commands.d.ts +44 -0
- package/dist/commands/preference-commands.js +565 -0
- package/dist/commands/preference-commands.js.map +1 -0
- package/dist/commands/session-commands.d.ts +8 -0
- package/dist/commands/session-commands.js +267 -0
- package/dist/commands/session-commands.js.map +1 -0
- package/dist/commands/thread-commands.d.ts +16 -0
- package/dist/commands/thread-commands.js +285 -0
- package/dist/commands/thread-commands.js.map +1 -0
- package/dist/commands/worktree-commands.d.ts +41 -0
- package/dist/commands/worktree-commands.js +279 -0
- package/dist/commands/worktree-commands.js.map +1 -0
- package/dist/commands.e2e.test.d.ts +1 -0
- package/dist/commands.e2e.test.js +255 -0
- package/dist/commands.e2e.test.js.map +1 -0
- package/dist/credentials.d.ts +84 -0
- package/dist/credentials.js +320 -0
- package/dist/credentials.js.map +1 -0
- package/dist/db.d.ts +1532 -0
- package/dist/db.js +57 -245
- package/dist/db.js.map +1 -0
- package/dist/db.test.d.ts +1 -0
- package/dist/db.test.js +351 -682
- package/dist/db.test.js.map +1 -0
- package/dist/duration.d.ts +2 -0
- package/dist/duration.js +18 -0
- package/dist/duration.js.map +1 -0
- package/dist/effects.d.ts +15 -0
- package/dist/effects.js +315 -0
- package/dist/effects.js.map +1 -0
- package/dist/errors.d.ts +38 -0
- package/dist/errors.js +40 -175
- package/dist/errors.js.map +1 -0
- package/dist/event-loop.d.ts +41 -0
- package/dist/event-loop.js +418 -0
- package/dist/event-loop.js.map +1 -0
- package/dist/file-edit-log.d.ts +41 -0
- package/dist/file-edit-log.js +122 -164
- package/dist/file-edit-log.js.map +1 -0
- package/dist/file-edit-log.test.d.ts +1 -0
- package/dist/file-edit-log.test.js +68 -244
- package/dist/file-edit-log.test.js.map +1 -0
- package/dist/format-parts.d.ts +137 -0
- package/dist/format-parts.js +300 -0
- package/dist/format-parts.js.map +1 -0
- package/dist/format-parts.test.d.ts +1 -0
- package/dist/format-parts.test.js +144 -0
- package/dist/format-parts.test.js.map +1 -0
- package/dist/gateway-replay.e2e.test.d.ts +1 -0
- package/dist/gateway-replay.e2e.test.js +95 -0
- package/dist/gateway-replay.e2e.test.js.map +1 -0
- package/dist/harness.e2e.test.d.ts +1 -0
- package/dist/harness.e2e.test.js +107 -0
- package/dist/harness.e2e.test.js.map +1 -0
- package/dist/hello-thread.e2e.test.d.ts +1 -0
- package/dist/hello-thread.e2e.test.js +194 -0
- package/dist/hello-thread.e2e.test.js.map +1 -0
- package/dist/ingress.d.ts +7 -0
- package/dist/ingress.js +337 -0
- package/dist/ingress.js.map +1 -0
- package/dist/interaction-context.d.ts +45 -0
- package/dist/interaction-context.js +77 -0
- package/dist/interaction-context.js.map +1 -0
- package/dist/interrupt.e2e.test.d.ts +1 -0
- package/dist/interrupt.e2e.test.js +124 -0
- package/dist/interrupt.e2e.test.js.map +1 -0
- package/dist/legacy.e2e.test.d.ts +1 -0
- package/dist/legacy.e2e.test.js +85 -0
- package/dist/legacy.e2e.test.js.map +1 -0
- package/dist/live-call.d.ts +51 -0
- package/dist/live-call.js +207 -0
- package/dist/live-call.js.map +1 -0
- package/dist/lock-routes.d.ts +812 -0
- package/dist/lock-routes.js +635 -0
- package/dist/lock-routes.js.map +1 -0
- package/dist/lock-server.d.ts +36 -0
- package/dist/lock-server.js +223 -0
- package/dist/lock-server.js.map +1 -0
- package/dist/logger.d.ts +13 -0
- package/dist/logger.js +112 -162
- package/dist/logger.js.map +1 -0
- package/dist/login.e2e.test.d.ts +1 -0
- package/dist/login.e2e.test.js +83 -0
- package/dist/login.e2e.test.js.map +1 -0
- package/dist/main.d.ts +33 -0
- package/dist/main.js +261 -0
- package/dist/main.js.map +1 -0
- package/dist/markdown/components.d.ts +10 -0
- package/dist/markdown/components.js +77 -0
- package/dist/markdown/components.js.map +1 -0
- package/dist/markdown/markdown.test.d.ts +1 -0
- package/dist/markdown/markdown.test.js +393 -0
- package/dist/markdown/markdown.test.js.map +1 -0
- package/dist/markdown/render-markdown.d.ts +30 -0
- package/dist/markdown/render-markdown.js +265 -0
- package/dist/markdown/render-markdown.js.map +1 -0
- package/dist/message-tool.e2e.test.d.ts +1 -0
- package/dist/message-tool.e2e.test.js +39 -0
- package/dist/message-tool.e2e.test.js.map +1 -0
- package/dist/migrations.d.ts +8 -0
- package/dist/migrations.js +187 -0
- package/dist/migrations.js.map +1 -0
- package/dist/onboarding-cli.e2e.test.d.ts +1 -0
- package/dist/onboarding-cli.e2e.test.js +178 -0
- package/dist/onboarding-cli.e2e.test.js.map +1 -0
- package/dist/onboarding.d.ts +36 -0
- package/dist/onboarding.e2e.test.d.ts +1 -0
- package/dist/onboarding.e2e.test.js +148 -0
- package/dist/onboarding.e2e.test.js.map +1 -0
- package/dist/onboarding.js +261 -0
- package/dist/onboarding.js.map +1 -0
- package/dist/opencode-server.d.ts +54 -0
- package/dist/opencode-server.js +417 -0
- package/dist/opencode-server.js.map +1 -0
- package/dist/opencode-server.test.d.ts +1 -0
- package/dist/opencode-server.test.js +21 -0
- package/dist/opencode-server.test.js.map +1 -0
- package/dist/permissions.d.ts +31 -0
- package/dist/permissions.e2e.test.d.ts +1 -0
- package/dist/permissions.e2e.test.js +166 -0
- package/dist/permissions.e2e.test.js.map +1 -0
- package/dist/permissions.js +95 -0
- package/dist/permissions.js.map +1 -0
- package/dist/plugin/anthropic/index.d.ts +13 -0
- package/dist/plugin/anthropic/index.js +201 -0
- package/dist/plugin/anthropic/index.js.map +1 -0
- package/dist/plugin/anthropic/index.test.d.ts +1 -0
- package/dist/plugin/anthropic/index.test.js +39 -0
- package/dist/plugin/anthropic/index.test.js.map +1 -0
- package/dist/plugin/index.d.ts +3 -0
- package/dist/plugin/index.js +124 -0
- package/dist/plugin/index.js.map +1 -0
- package/dist/plugin/read-media.d.ts +23 -0
- package/dist/plugin/read-media.js +72 -0
- package/dist/plugin/read-media.js.map +1 -0
- package/dist/plugin/session-id/index.d.ts +3 -0
- package/dist/plugin/session-id/index.js +18 -0
- package/dist/plugin/session-id/index.js.map +1 -0
- package/dist/plugin.e2e.test.d.ts +1 -0
- package/dist/plugin.e2e.test.js +92 -0
- package/dist/plugin.e2e.test.js.map +1 -0
- package/dist/preference-commands.e2e.test.d.ts +1 -0
- package/dist/preference-commands.e2e.test.js +555 -0
- package/dist/preference-commands.e2e.test.js.map +1 -0
- package/dist/probe-live.tmp.d.ts +1 -0
- package/dist/probe-live.tmp.js +82 -0
- package/dist/probe-live.tmp.js.map +1 -0
- package/dist/project.d.ts +58 -0
- package/dist/project.js +169 -0
- package/dist/project.js.map +1 -0
- package/dist/prompt.d.ts +112 -0
- package/dist/prompt.js +577 -0
- package/dist/prompt.js.map +1 -0
- package/dist/questions.d.ts +59 -0
- package/dist/questions.e2e.test.d.ts +1 -0
- package/dist/questions.e2e.test.js +290 -0
- package/dist/questions.e2e.test.js.map +1 -0
- package/dist/questions.js +231 -0
- package/dist/questions.js.map +1 -0
- package/dist/queue.d.ts +45 -0
- package/dist/queue.e2e.test.d.ts +1 -0
- package/dist/queue.e2e.test.js +220 -0
- package/dist/queue.e2e.test.js.map +1 -0
- package/dist/queue.js +132 -0
- package/dist/queue.js.map +1 -0
- package/dist/remote-send.d.ts +32 -0
- package/dist/remote-send.e2e.test.d.ts +1 -0
- package/dist/remote-send.e2e.test.js +89 -0
- package/dist/remote-send.e2e.test.js.map +1 -0
- package/dist/remote-send.js +105 -0
- package/dist/remote-send.js.map +1 -0
- package/dist/renderer.e2e.test.d.ts +1 -0
- package/dist/renderer.e2e.test.js +357 -0
- package/dist/renderer.e2e.test.js.map +1 -0
- package/dist/restart.e2e.test.d.ts +1 -0
- package/dist/restart.e2e.test.js +68 -0
- package/dist/restart.e2e.test.js.map +1 -0
- package/dist/routes.d.ts +24 -0
- package/dist/routes.js +42 -0
- package/dist/routes.js.map +1 -0
- package/dist/routes.test.d.ts +1 -0
- package/dist/routes.test.js +79 -0
- package/dist/routes.test.js.map +1 -0
- package/dist/routines.e2e.test.d.ts +1 -0
- package/dist/routines.e2e.test.js +188 -0
- package/dist/routines.e2e.test.js.map +1 -0
- package/dist/scheduler.d.ts +116 -0
- package/dist/scheduler.e2e.test.d.ts +1 -0
- package/dist/scheduler.e2e.test.js +163 -0
- package/dist/scheduler.e2e.test.js.map +1 -0
- package/dist/scheduler.js +602 -0
- package/dist/scheduler.js.map +1 -0
- package/dist/scheduler.test.d.ts +1 -0
- package/dist/scheduler.test.js +180 -0
- package/dist/scheduler.test.js.map +1 -0
- package/dist/schema-sql.d.ts +1 -0
- package/dist/schema-sql.js +3 -0
- package/dist/schema-sql.js.map +1 -0
- package/dist/schema.d.ts +2968 -0
- package/dist/schema.js +95 -252
- package/dist/schema.js.map +1 -0
- package/dist/session-commands.e2e.test.d.ts +1 -0
- package/dist/session-commands.e2e.test.js +285 -0
- package/dist/session-commands.e2e.test.js.map +1 -0
- package/dist/session-events.d.ts +83 -0
- package/dist/session-events.js +260 -0
- package/dist/session-events.js.map +1 -0
- package/dist/session-ops.e2e.test.d.ts +1 -0
- package/dist/session-ops.e2e.test.js +114 -0
- package/dist/session-ops.e2e.test.js.map +1 -0
- package/dist/sessions.d.ts +121 -0
- package/dist/sessions.js +663 -0
- package/dist/sessions.js.map +1 -0
- package/dist/shell.e2e.test.d.ts +1 -0
- package/dist/shell.e2e.test.js +147 -0
- package/dist/shell.e2e.test.js.map +1 -0
- package/dist/slash-commands.d.ts +62 -0
- package/dist/slash-commands.js +476 -0
- package/dist/slash-commands.js.map +1 -0
- package/dist/slash-commands.test.d.ts +1 -0
- package/dist/slash-commands.test.js +87 -0
- package/dist/slash-commands.test.js.map +1 -0
- package/dist/sleep.e2e.test.d.ts +1 -0
- package/dist/sleep.e2e.test.js +115 -487
- package/dist/sleep.e2e.test.js.map +1 -0
- package/dist/sleeps.d.ts +37 -0
- package/dist/sleeps.js +220 -0
- package/dist/sleeps.js.map +1 -0
- package/dist/store.d.ts +10 -0
- package/dist/store.js +8 -28
- package/dist/store.js.map +1 -0
- package/dist/system-prompt.d.ts +76 -0
- package/dist/system-prompt.js +852 -0
- package/dist/system-prompt.js.map +1 -0
- package/dist/tasks.e2e.test.d.ts +1 -0
- package/dist/tasks.e2e.test.js +173 -0
- package/dist/tasks.e2e.test.js.map +1 -0
- package/dist/test/auth-plugin/index.d.ts +3 -0
- package/dist/test/auth-plugin/index.js +18 -0
- package/dist/test/auth-plugin/index.js.map +1 -0
- package/dist/test/fake-mcp-server.d.ts +1 -0
- package/dist/test/fake-mcp-server.js +45 -0
- package/dist/test/fake-mcp-server.js.map +1 -0
- package/dist/test/harness.d.ts +246 -0
- package/dist/test/harness.js +704 -0
- package/dist/test/harness.js.map +1 -0
- package/dist/test/replay.d.ts +14 -0
- package/dist/test/replay.js +75 -0
- package/dist/test/replay.js.map +1 -0
- package/dist/thread-reducer.d.ts +172 -0
- package/dist/thread-reducer.fixtures.test.d.ts +1 -0
- package/dist/thread-reducer.fixtures.test.js +360 -0
- package/dist/thread-reducer.fixtures.test.js.map +1 -0
- package/dist/thread-reducer.js +497 -0
- package/dist/thread-reducer.js.map +1 -0
- package/dist/thread-reducer.test.d.ts +1 -0
- package/dist/thread-reducer.test.js +369 -0
- package/dist/thread-reducer.test.js.map +1 -0
- package/dist/tts.test.d.ts +1 -0
- package/dist/tts.test.js +147 -0
- package/dist/tts.test.js.map +1 -0
- package/dist/voice-agent.d.ts +33 -0
- package/dist/voice-agent.js +159 -0
- package/dist/voice-agent.js.map +1 -0
- package/dist/voice-attachments.e2e.test.d.ts +1 -0
- package/dist/voice-attachments.e2e.test.js +256 -0
- package/dist/voice-attachments.e2e.test.js.map +1 -0
- package/dist/voice-call.d.ts +59 -0
- package/dist/voice-call.e2e.test.d.ts +1 -0
- package/dist/voice-call.e2e.test.js +259 -0
- package/dist/voice-call.e2e.test.js.map +1 -0
- package/dist/voice-call.js +760 -0
- package/dist/voice-call.js.map +1 -0
- package/dist/voice-openai.e2e.test.d.ts +1 -0
- package/dist/voice-openai.e2e.test.js +161 -0
- package/dist/voice-openai.e2e.test.js.map +1 -0
- package/dist/voice.d.ts +116 -0
- package/dist/voice.js +619 -717
- package/dist/voice.js.map +1 -0
- package/dist/working-directory.e2e.test.d.ts +1 -0
- package/dist/working-directory.e2e.test.js +231 -0
- package/dist/working-directory.e2e.test.js.map +1 -0
- package/dist/worktrees.d.ts +54 -0
- package/dist/worktrees.js +247 -709
- package/dist/worktrees.js.map +1 -0
- package/dist/worktrees.test.d.ts +1 -0
- package/dist/worktrees.test.js +97 -952
- package/dist/worktrees.test.js.map +1 -0
- package/package.json +38 -73
- package/skills/kimaki-debug/SKILL.md +44 -0
- package/skills/kimaki-tunnel/SKILL.md +34 -0
- package/src/agent-ui.e2e.test.ts +134 -0
- package/src/agent-ui.ts +216 -0
- package/src/analytics.e2e.test.ts +138 -0
- package/src/analytics.test.ts +122 -182
- package/src/analytics.ts +206 -258
- package/src/autostart.ts +90 -0
- package/src/bot.ts +196 -0
- package/src/btw.e2e.test.ts +130 -0
- package/src/builtin-skills.test.ts +29 -0
- package/src/builtin-skills.ts +59 -0
- package/src/catalog-refresh.e2e.test.ts +112 -0
- package/src/cli/bot.ts +425 -0
- package/src/cli/discord.ts +116 -0
- package/src/cli/project.ts +147 -0
- package/src/cli/schedule.ts +151 -0
- package/src/cli/session.ts +252 -0
- package/src/cli/shared.ts +139 -0
- package/src/cli-discord.e2e.test.ts +79 -0
- package/src/cli-lock.e2e.test.ts +530 -0
- package/src/cli-read.e2e.test.ts +83 -0
- package/src/cli-sessions.e2e.test.ts +120 -0
- package/src/cli.ts +35 -418
- package/src/commands/login-commands.ts +360 -0
- package/src/commands/preference-commands.ts +599 -0
- package/src/commands/session-commands.ts +289 -0
- package/src/commands/thread-commands.ts +324 -0
- package/src/commands/worktree-commands.ts +288 -0
- package/src/commands.e2e.test.ts +290 -0
- package/src/credentials.ts +425 -0
- package/src/db.test.ts +344 -759
- package/src/db.ts +66 -284
- package/src/duration.ts +18 -0
- package/src/effects.ts +337 -0
- package/src/errors.ts +39 -228
- package/src/event-loop.ts +471 -0
- package/src/file-edit-log.test.ts +68 -272
- package/src/file-edit-log.ts +108 -231
- package/src/fixtures/v1-schema.sql +241 -0
- package/src/fixtures/voice.ogg +0 -0
- package/src/format-parts.test.ts +150 -0
- package/src/format-parts.ts +405 -0
- package/src/gateway-replay.e2e.test.ts +116 -0
- package/src/harness.e2e.test.ts +124 -0
- package/src/hello-thread.e2e.test.ts +223 -0
- package/src/ingress.ts +334 -0
- package/src/interaction-context.ts +131 -0
- package/src/interrupt.e2e.test.ts +151 -0
- package/src/legacy.e2e.test.ts +105 -0
- package/src/live-call.ts +249 -0
- package/src/lock-routes.ts +625 -0
- package/src/lock-server.ts +233 -0
- package/src/logger.ts +120 -207
- package/src/login.e2e.test.ts +86 -0
- package/src/main.ts +238 -0
- package/src/markdown/components.ts +102 -0
- package/src/markdown/markdown.test.ts +414 -0
- package/src/markdown/render-markdown.ts +288 -0
- package/src/migrations.ts +198 -0
- package/src/onboarding-cli.e2e.test.ts +215 -0
- package/src/onboarding.e2e.test.ts +171 -0
- package/src/onboarding.ts +297 -0
- package/src/opencode-server.test.ts +24 -0
- package/src/opencode-server.ts +464 -0
- package/src/permissions.e2e.test.ts +191 -0
- package/src/permissions.ts +121 -0
- package/src/plugin/anthropic/index.test.ts +39 -0
- package/src/plugin/anthropic/index.ts +213 -0
- package/src/plugin/index.ts +112 -0
- package/src/plugin.e2e.test.ts +117 -0
- package/src/preference-commands.e2e.test.ts +597 -0
- package/src/project.ts +216 -0
- package/src/prompt.ts +664 -0
- package/src/questions.e2e.test.ts +328 -0
- package/src/questions.ts +322 -0
- package/src/queue.e2e.test.ts +253 -0
- package/src/queue.ts +158 -0
- package/src/remote-send.e2e.test.ts +91 -0
- package/src/remote-send.ts +110 -0
- package/src/renderer.e2e.test.ts +390 -0
- package/src/restart.e2e.test.ts +90 -0
- package/src/routes.test.ts +81 -0
- package/src/routes.ts +48 -0
- package/src/routines.e2e.test.ts +210 -0
- package/src/scheduler.e2e.test.ts +182 -0
- package/src/scheduler.test.ts +183 -0
- package/src/scheduler.ts +648 -0
- package/src/schema-sql.ts +3 -0
- package/src/schema.ts +95 -271
- package/src/session-commands.e2e.test.ts +326 -0
- package/src/session-events.ts +301 -0
- package/src/session-ops.e2e.test.ts +141 -0
- package/src/sessions.ts +804 -0
- package/src/shell.e2e.test.ts +173 -0
- package/src/slash-commands.test.ts +89 -0
- package/src/slash-commands.ts +540 -0
- package/src/sleep.e2e.test.ts +135 -552
- package/src/sleeps.ts +230 -0
- package/src/store.ts +19 -217
- package/src/system-prompt.ts +923 -0
- package/src/test/auth-plugin/index.ts +17 -0
- package/src/test/fake-mcp-server.ts +49 -0
- package/src/test/harness.ts +957 -0
- package/src/test/replay.ts +90 -0
- package/src/thread-reducer.fixtures.test.ts +374 -0
- package/src/thread-reducer.test.ts +380 -0
- package/src/thread-reducer.ts +671 -0
- package/src/tts.test.ts +150 -0
- package/src/voice-agent.ts +196 -0
- package/src/voice-attachments.e2e.test.ts +301 -0
- package/src/voice-call.e2e.test.ts +293 -0
- package/src/voice-call.ts +764 -0
- package/src/voice-openai.e2e.test.ts +191 -0
- package/src/voice.ts +668 -988
- package/src/working-directory.e2e.test.ts +226 -0
- package/src/worktrees.test.ts +89 -1115
- package/src/worktrees.ts +195 -957
- package/bin.js +0 -2
- package/dist/agent-model.e2e.test.js +0 -1223
- package/dist/ai-tool-to-genai.js +0 -233
- package/dist/ai-tool-to-genai.test.js +0 -267
- package/dist/ai-tool.js +0 -6
- package/dist/anthropic-account-identity.js +0 -70
- package/dist/anthropic-account-identity.test.js +0 -38
- package/dist/anthropic-auth-plugin.js +0 -958
- package/dist/anthropic-auth-plugin.test.js +0 -115
- package/dist/anthropic-auth-state.js +0 -186
- package/dist/anthropic-auth-state.test.js +0 -203
- package/dist/bash-tool-schema-plugin.js +0 -50
- package/dist/bash-tool-schema-plugin.test.js +0 -68
- package/dist/bin.js +0 -151
- package/dist/bot-lifecycle.test.js +0 -206
- package/dist/btw-prefix-detection.js +0 -24
- package/dist/btw-prefix-detection.test.js +0 -130
- package/dist/cache-drift-plugin.js +0 -183
- package/dist/cache-rewrite.js +0 -39
- package/dist/cache-rewrite.test.js +0 -41
- package/dist/channel-management.js +0 -347
- package/dist/cli-commands/bot.js +0 -254
- package/dist/cli-commands/maintenance.js +0 -171
- package/dist/cli-commands/misc.js +0 -153
- package/dist/cli-commands/project.js +0 -510
- package/dist/cli-commands/send.js +0 -659
- package/dist/cli-commands/session.js +0 -889
- package/dist/cli-commands/task.js +0 -277
- package/dist/cli-commands/thread.js +0 -63
- package/dist/cli-commands/user.js +0 -145
- package/dist/cli-parsing.test.js +0 -226
- package/dist/cli-runner.js +0 -1591
- package/dist/cli-runner.test.js +0 -119
- package/dist/cli-send-thread.e2e.test.js +0 -470
- package/dist/cloudflare-transcription.js +0 -56
- package/dist/commands/abort.js +0 -84
- package/dist/commands/action-buttons.js +0 -248
- package/dist/commands/add-project.js +0 -111
- package/dist/commands/agent.js +0 -658
- package/dist/commands/ask-question.js +0 -371
- package/dist/commands/ask-question.test.js +0 -150
- package/dist/commands/btw.js +0 -275
- package/dist/commands/compact.js +0 -117
- package/dist/commands/context-usage.js +0 -194
- package/dist/commands/context-usage.test.js +0 -49
- package/dist/commands/create-new-project.js +0 -138
- package/dist/commands/diff.js +0 -63
- package/dist/commands/file-upload.js +0 -280
- package/dist/commands/fork-subagent.js +0 -175
- package/dist/commands/fork.js +0 -291
- package/dist/commands/gemini-apikey.js +0 -123
- package/dist/commands/last-sessions.js +0 -129
- package/dist/commands/login.js +0 -893
- package/dist/commands/mcp.js +0 -239
- package/dist/commands/memory-snapshot.js +0 -24
- package/dist/commands/mention-mode.js +0 -42
- package/dist/commands/merge-worktree.js +0 -205
- package/dist/commands/model-variant.js +0 -390
- package/dist/commands/model.js +0 -1012
- package/dist/commands/multioauth.js +0 -425
- package/dist/commands/new-worktree.js +0 -625
- package/dist/commands/paginated-select.js +0 -57
- package/dist/commands/permissions.js +0 -327
- package/dist/commands/queue.js +0 -347
- package/dist/commands/queue.test.js +0 -15
- package/dist/commands/remove-project.js +0 -111
- package/dist/commands/restart-opencode-server.js +0 -133
- package/dist/commands/resume.js +0 -148
- package/dist/commands/run-command.js +0 -79
- package/dist/commands/screenshare.js +0 -307
- package/dist/commands/screenshare.test.js +0 -20
- package/dist/commands/session-id.js +0 -78
- package/dist/commands/session.js +0 -248
- package/dist/commands/share.js +0 -80
- package/dist/commands/tasks.js +0 -296
- package/dist/commands/types.js +0 -2
- package/dist/commands/undo-redo.js +0 -313
- package/dist/commands/unset-model.js +0 -116
- package/dist/commands/upgrade.js +0 -41
- package/dist/commands/user-command.js +0 -196
- package/dist/commands/verbosity.js +0 -124
- package/dist/commands/vscode.js +0 -295
- package/dist/commands/worktrees.js +0 -548
- package/dist/condense-memory.js +0 -33
- package/dist/config.js +0 -126
- package/dist/context-awareness-plugin.js +0 -357
- package/dist/context-awareness-plugin.test.js +0 -126
- package/dist/cpu-profiler.js +0 -211
- package/dist/cpu-profiler.test.js +0 -160
- package/dist/critique-utils.js +0 -95
- package/dist/database.js +0 -1074
- package/dist/debounce-timeout.js +0 -28
- package/dist/debounced-process-flush.js +0 -77
- package/dist/default-channel-provisioning.test.js +0 -149
- package/dist/discord-bot.js +0 -1432
- package/dist/discord-command-registration.js +0 -519
- package/dist/discord-command-registration.test.js +0 -17
- package/dist/discord-urls.js +0 -81
- package/dist/discord-utils.js +0 -789
- package/dist/discord-utils.test.js +0 -400
- package/dist/escape-backticks.test.js +0 -429
- package/dist/event-stream-real-capture.e2e.test.js +0 -533
- package/dist/eventsource-parser.test.js +0 -327
- package/dist/exec-async.js +0 -38
- package/dist/external-directory-permissions.e2e.test.js +0 -86
- package/dist/external-directory-project-deny.e2e.test.js +0 -70
- package/dist/external-opencode-sync.js +0 -620
- package/dist/external-opencode-sync.test.js +0 -206
- package/dist/extract-sdk-error-message.test.js +0 -13
- package/dist/format-tables.js +0 -728
- package/dist/format-tables.test.js +0 -915
- package/dist/forum-sync/config.js +0 -79
- package/dist/forum-sync/discord-operations.js +0 -157
- package/dist/forum-sync/index.js +0 -5
- package/dist/forum-sync/markdown.js +0 -110
- package/dist/forum-sync/sync-to-discord.js +0 -417
- package/dist/forum-sync/sync-to-files.js +0 -190
- package/dist/forum-sync/types.js +0 -53
- package/dist/forum-sync/watchers.js +0 -322
- package/dist/gateway-proxy-reconnect.e2e.test.js +0 -414
- package/dist/gateway-proxy.e2e.test.js +0 -488
- package/dist/genai-worker-wrapper.js +0 -111
- package/dist/genai-worker.js +0 -309
- package/dist/genai.js +0 -232
- package/dist/git-worktree-core.js +0 -461
- package/dist/guild-categories.test.js +0 -225
- package/dist/heap-monitor.js +0 -122
- package/dist/hrana-server.js +0 -322
- package/dist/hrana-server.test.js +0 -99
- package/dist/html-actions.js +0 -123
- package/dist/html-actions.test.js +0 -70
- package/dist/html-components.js +0 -115
- package/dist/html-components.test.js +0 -34
- package/dist/image-optimizer-plugin.js +0 -153
- package/dist/image-utils.js +0 -112
- package/dist/interaction-handler.js +0 -578
- package/dist/ipc-polling.js +0 -245
- package/dist/ipc-tools-plugin.js +0 -251
- package/dist/kimaki-digital-twin.e2e.test.js +0 -161
- package/dist/kimaki-opencode-plugin-loading.e2e.test.js +0 -158
- package/dist/kimaki-opencode-plugin.js +0 -33
- package/dist/kimaki-opencode-plugin.test.js +0 -126
- package/dist/kimaki-workspace-adaptor.js +0 -118
- package/dist/limit-heading-depth.js +0 -25
- package/dist/limit-heading-depth.test.js +0 -105
- package/dist/list-channel-threads.js +0 -163
- package/dist/list-channel-threads.test.js +0 -80
- package/dist/markdown.js +0 -455
- package/dist/markdown.test.js +0 -411
- package/dist/memory-overview-plugin.js +0 -123
- package/dist/message-formatting.js +0 -788
- package/dist/message-formatting.test.js +0 -1132
- package/dist/message-preprocessing.js +0 -419
- package/dist/oauth-rotation-shared.js +0 -253
- package/dist/onboarding-tutorial.js +0 -163
- package/dist/onboarding-welcome.js +0 -37
- package/dist/openai-auth-plugin.js +0 -125
- package/dist/openai-auth-state.js +0 -237
- package/dist/openai-realtime.js +0 -224
- package/dist/opencode-command-detection.js +0 -65
- package/dist/opencode-command-detection.test.js +0 -240
- package/dist/opencode-command.js +0 -181
- package/dist/opencode-command.test.js +0 -218
- package/dist/opencode-interrupt-plugin.js +0 -253
- package/dist/opencode-interrupt-plugin.test.js +0 -293
- package/dist/opencode.js +0 -1217
- package/dist/parse-permission-rules.test.js +0 -117
- package/dist/patch-text-parser.js +0 -97
- package/dist/plugin-logger.js +0 -105
- package/dist/plugin-opencode-client.js +0 -54
- package/dist/privacy-sanitizer.js +0 -105
- package/dist/project-add.test.js +0 -62
- package/dist/question-abort-clears-dropdown.e2e.test.js +0 -89
- package/dist/question-abort-resume.e2e.test.js +0 -100
- package/dist/question-abort-retry-text-before-dropdown.e2e.test.js +0 -150
- package/dist/question-text-before-dropdown.e2e.test.js +0 -52
- package/dist/queue-advanced-abort.e2e.test.js +0 -348
- package/dist/queue-advanced-action-buttons.e2e.test.js +0 -209
- package/dist/queue-advanced-e2e-setup.js +0 -1043
- package/dist/queue-advanced-footer.e2e.test.js +0 -286
- package/dist/queue-advanced-model-switch.e2e.test.js +0 -297
- package/dist/queue-advanced-permissions-typing.e2e.test.js +0 -189
- package/dist/queue-advanced-question.e2e.test.js +0 -266
- package/dist/queue-advanced-typing-interrupt.e2e.test.js +0 -113
- package/dist/queue-advanced-typing.e2e.test.js +0 -151
- package/dist/queue-delete-message.e2e.test.js +0 -216
- package/dist/queue-drain-after-interactive-ui.e2e.test.js +0 -120
- package/dist/queue-interrupt-drain.e2e.test.js +0 -256
- package/dist/queue-question-select-drain.e2e.test.js +0 -162
- package/dist/runtime-idle-sweeper.js +0 -52
- package/dist/runtime-lifecycle.e2e.test.js +0 -570
- package/dist/sentry.js +0 -23
- package/dist/session-handler/agent-utils.js +0 -65
- package/dist/session-handler/event-stream-state.js +0 -1225
- package/dist/session-handler/event-stream-state.test.js +0 -3160
- package/dist/session-handler/global-event-listener.js +0 -212
- package/dist/session-handler/model-utils.js +0 -311
- package/dist/session-handler/model-utils.test.js +0 -445
- package/dist/session-handler/opencode-session-event-log.js +0 -121
- package/dist/session-handler/thread-ingress.test.js +0 -41
- package/dist/session-handler/thread-runtime-state.js +0 -209
- package/dist/session-handler/thread-session-runtime-summary.test.js +0 -121
- package/dist/session-handler/thread-session-runtime.js +0 -4320
- package/dist/session-handler.js +0 -9
- package/dist/session-search.js +0 -219
- package/dist/session-search.test.js +0 -287
- package/dist/session-sleep.test.js +0 -224
- package/dist/session-title-rename.test.js +0 -128
- package/dist/skill-filter.js +0 -43
- package/dist/skill-filter.test.js +0 -86
- package/dist/startup-service.js +0 -153
- package/dist/startup-time.e2e.test.js +0 -297
- package/dist/system-message.js +0 -806
- package/dist/system-message.test.js +0 -917
- package/dist/task-id-plugin.js +0 -16
- package/dist/task-runner.js +0 -554
- package/dist/task-schedule.js +0 -298
- package/dist/task-schedule.test.js +0 -366
- package/dist/test-utils.js +0 -385
- package/dist/thinking-utils.js +0 -45
- package/dist/thinking-utils.test.js +0 -35
- package/dist/thread-message-queue.e2e.test.js +0 -1227
- package/dist/tools.js +0 -357
- package/dist/undo-redo.e2e.test.js +0 -171
- package/dist/unnest-code-blocks.js +0 -146
- package/dist/unnest-code-blocks.test.js +0 -673
- package/dist/upgrade.js +0 -114
- package/dist/utils.js +0 -148
- package/dist/voice-attachment.js +0 -56
- package/dist/voice-handler.js +0 -727
- package/dist/voice-message.e2e.test.js +0 -1254
- package/dist/voice-routing-input.e2e.test.js +0 -195
- package/dist/voice-routing-question.e2e.test.js +0 -182
- package/dist/voice.test.js +0 -500
- package/dist/wait-session.js +0 -193
- package/dist/websockify.js +0 -69
- package/dist/worker-types.js +0 -4
- package/dist/worktree-clone-isolation.e2e.test.js +0 -188
- package/dist/worktree-lifecycle.e2e.test.js +0 -735
- package/dist/worktree-utils.js +0 -3
- package/dist/xai-auth-plugin.js +0 -238
- package/dist/xai-auth-state.js +0 -234
- package/dist/xai-auth-state.test.js +0 -183
- package/dist/xml.js +0 -92
- package/dist/xml.test.js +0 -32
- package/skills/bump-holocron-consumers/SKILL.md +0 -137
- package/skills/critique/SKILL.md +0 -116
- package/skills/egaki/SKILL.md +0 -86
- package/skills/errore/SKILL.md +0 -501
- package/skills/goke/SKILL.md +0 -695
- package/skills/holocron/SKILL.md +0 -942
- package/skills/lintcn/SKILL.md +0 -873
- package/skills/new-skill/SKILL.md +0 -339
- package/skills/npm-package/SKILL.md +0 -692
- package/skills/opensrc/SKILL.md +0 -102
- package/skills/playwriter/SKILL.md +0 -35
- package/skills/profano/SKILL.md +0 -33
- package/skills/readme.md +0 -20
- package/skills/sigillo/SKILL.md +0 -370
- package/skills/spiceflow/SKILL.md +0 -80
- package/skills/strada/SKILL.md +0 -104
- package/skills/termcast/SKILL.md +0 -133
- package/skills/tuistory/SKILL.md +0 -237
- package/skills/usecomputer/SKILL.md +0 -264
- package/skills/zele/SKILL.md +0 -81
- package/src/agent-model.e2e.test.ts +0 -1557
- package/src/ai-tool-to-genai.test.ts +0 -296
- package/src/ai-tool-to-genai.ts +0 -283
- package/src/ai-tool.ts +0 -39
- package/src/anthropic-account-identity.test.ts +0 -52
- package/src/anthropic-account-identity.ts +0 -96
- package/src/anthropic-auth-plugin.test.ts +0 -135
- package/src/anthropic-auth-plugin.ts +0 -1180
- package/src/anthropic-auth-state.test.ts +0 -259
- package/src/anthropic-auth-state.ts +0 -272
- package/src/bash-tool-schema-plugin.test.ts +0 -84
- package/src/bash-tool-schema-plugin.ts +0 -77
- package/src/bin.ts +0 -173
- package/src/bot-lifecycle.test.ts +0 -252
- package/src/btw-prefix-detection.test.ts +0 -142
- package/src/btw-prefix-detection.ts +0 -30
- package/src/cache-drift-plugin.ts +0 -249
- package/src/cache-rewrite.test.ts +0 -49
- package/src/cache-rewrite.ts +0 -96
- package/src/channel-management.ts +0 -494
- package/src/cli-commands/bot.ts +0 -374
- package/src/cli-commands/maintenance.ts +0 -237
- package/src/cli-commands/misc.ts +0 -208
- package/src/cli-commands/project.ts +0 -680
- package/src/cli-commands/send.ts +0 -885
- package/src/cli-commands/session.ts +0 -1181
- package/src/cli-commands/task.ts +0 -358
- package/src/cli-commands/thread.ts +0 -86
- package/src/cli-commands/user.ts +0 -195
- package/src/cli-parsing.test.ts +0 -305
- package/src/cli-runner.test.ts +0 -166
- package/src/cli-runner.ts +0 -2157
- package/src/cli-send-thread.e2e.test.ts +0 -609
- package/src/cloudflare-transcription.ts +0 -76
- package/src/commands/abort.ts +0 -113
- package/src/commands/action-buttons.ts +0 -371
- package/src/commands/add-project.ts +0 -146
- package/src/commands/agent.ts +0 -911
- package/src/commands/ask-question.test.ts +0 -177
- package/src/commands/ask-question.ts +0 -532
- package/src/commands/btw.ts +0 -356
- package/src/commands/compact.ts +0 -154
- package/src/commands/context-usage.test.ts +0 -57
- package/src/commands/context-usage.ts +0 -267
- package/src/commands/create-new-project.ts +0 -203
- package/src/commands/diff.ts +0 -91
- package/src/commands/file-upload.ts +0 -398
- package/src/commands/fork-subagent.ts +0 -262
- package/src/commands/fork.ts +0 -421
- package/src/commands/gemini-apikey.ts +0 -205
- package/src/commands/last-sessions.ts +0 -176
- package/src/commands/login.ts +0 -1182
- package/src/commands/mcp.ts +0 -307
- package/src/commands/memory-snapshot.ts +0 -30
- package/src/commands/mention-mode.ts +0 -66
- package/src/commands/merge-worktree.ts +0 -282
- package/src/commands/model-variant.ts +0 -522
- package/src/commands/model.ts +0 -1377
- package/src/commands/multioauth.ts +0 -508
- package/src/commands/new-worktree.ts +0 -835
- package/src/commands/paginated-select.ts +0 -81
- package/src/commands/permissions.ts +0 -458
- package/src/commands/queue.test.ts +0 -19
- package/src/commands/queue.ts +0 -471
- package/src/commands/remove-project.ts +0 -152
- package/src/commands/restart-opencode-server.ts +0 -173
- package/src/commands/resume.ts +0 -229
- package/src/commands/run-command.ts +0 -123
- package/src/commands/screenshare.test.ts +0 -30
- package/src/commands/screenshare.ts +0 -388
- package/src/commands/session-id.ts +0 -109
- package/src/commands/session.ts +0 -319
- package/src/commands/share.ts +0 -106
- package/src/commands/tasks.ts +0 -399
- package/src/commands/types.ts +0 -25
- package/src/commands/undo-redo.ts +0 -394
- package/src/commands/unset-model.ts +0 -152
- package/src/commands/upgrade.ts +0 -51
- package/src/commands/user-command.ts +0 -260
- package/src/commands/verbosity.ts +0 -172
- package/src/commands/vscode.ts +0 -378
- package/src/commands/worktrees.ts +0 -762
- package/src/condense-memory.ts +0 -36
- package/src/config.ts +0 -147
- package/src/context-awareness-plugin.test.ts +0 -144
- package/src/context-awareness-plugin.ts +0 -508
- package/src/cpu-profiler.test.ts +0 -183
- package/src/cpu-profiler.ts +0 -293
- package/src/critique-utils.ts +0 -139
- package/src/database.ts +0 -1484
- package/src/debounce-timeout.ts +0 -43
- package/src/debounced-process-flush.ts +0 -104
- package/src/default-channel-provisioning.test.ts +0 -156
- package/src/discord-bot.ts +0 -1852
- package/src/discord-command-registration.test.ts +0 -20
- package/src/discord-command-registration.ts +0 -704
- package/src/discord-urls.ts +0 -88
- package/src/discord-utils.test.ts +0 -470
- package/src/discord-utils.ts +0 -1079
- package/src/escape-backticks.test.ts +0 -469
- package/src/event-stream-real-capture.e2e.test.ts +0 -692
- package/src/eventsource-parser.test.ts +0 -351
- package/src/exec-async.ts +0 -44
- package/src/external-directory-permissions.e2e.test.ts +0 -103
- package/src/external-directory-project-deny.e2e.test.ts +0 -84
- package/src/external-opencode-sync.test.ts +0 -248
- package/src/external-opencode-sync.ts +0 -867
- package/src/extract-sdk-error-message.test.ts +0 -18
- package/src/format-tables.test.ts +0 -988
- package/src/format-tables.ts +0 -1031
- package/src/forum-sync/config.ts +0 -92
- package/src/forum-sync/discord-operations.ts +0 -245
- package/src/forum-sync/index.ts +0 -9
- package/src/forum-sync/markdown.ts +0 -172
- package/src/forum-sync/sync-to-discord.ts +0 -595
- package/src/forum-sync/sync-to-files.ts +0 -294
- package/src/forum-sync/types.ts +0 -175
- package/src/forum-sync/watchers.ts +0 -474
- package/src/gateway-proxy-reconnect.e2e.test.ts +0 -553
- package/src/gateway-proxy.e2e.test.ts +0 -648
- package/src/genai-worker-wrapper.ts +0 -164
- package/src/genai-worker.ts +0 -385
- package/src/genai.ts +0 -318
- package/src/git-worktree-core.ts +0 -616
- package/src/guild-categories.test.ts +0 -260
- package/src/heap-monitor.ts +0 -152
- package/src/hrana-server.test.ts +0 -130
- package/src/hrana-server.ts +0 -399
- package/src/html-actions.test.ts +0 -87
- package/src/html-actions.ts +0 -174
- package/src/html-components.test.ts +0 -38
- package/src/html-components.ts +0 -177
- package/src/image-optimizer-plugin.ts +0 -194
- package/src/image-utils.ts +0 -150
- package/src/interaction-handler.ts +0 -775
- package/src/ipc-polling.ts +0 -325
- package/src/ipc-tools-plugin.ts +0 -306
- package/src/kimaki-digital-twin.e2e.test.ts +0 -199
- package/src/kimaki-opencode-plugin-loading.e2e.test.ts +0 -208
- package/src/kimaki-opencode-plugin.test.ts +0 -142
- package/src/kimaki-opencode-plugin.ts +0 -34
- package/src/kimaki-workspace-adaptor.ts +0 -144
- package/src/limit-heading-depth.test.ts +0 -116
- package/src/limit-heading-depth.ts +0 -26
- package/src/list-channel-threads.test.ts +0 -90
- package/src/list-channel-threads.ts +0 -252
- package/src/markdown.test.ts +0 -498
- package/src/markdown.ts +0 -577
- package/src/memory-overview-plugin.ts +0 -159
- package/src/message-formatting.test.ts +0 -1401
- package/src/message-formatting.ts +0 -999
- package/src/message-preprocessing.ts +0 -557
- package/src/oauth-rotation-shared.ts +0 -332
- package/src/onboarding-tutorial.ts +0 -167
- package/src/onboarding-welcome.ts +0 -49
- package/src/openai-auth-plugin.ts +0 -158
- package/src/openai-auth-state.ts +0 -297
- package/src/openai-realtime.ts +0 -358
- package/src/opencode-command-detection.test.ts +0 -307
- package/src/opencode-command-detection.ts +0 -76
- package/src/opencode-command.test.ts +0 -290
- package/src/opencode-command.ts +0 -251
- package/src/opencode-interrupt-plugin.test.ts +0 -419
- package/src/opencode-interrupt-plugin.ts +0 -306
- package/src/opencode.ts +0 -1590
- package/src/parse-permission-rules.test.ts +0 -127
- package/src/patch-text-parser.ts +0 -107
- package/src/plugin-logger.ts +0 -139
- package/src/plugin-opencode-client.ts +0 -71
- package/src/privacy-sanitizer.ts +0 -142
- package/src/project-add.test.ts +0 -80
- package/src/question-abort-clears-dropdown.e2e.test.ts +0 -109
- package/src/question-abort-resume.e2e.test.ts +0 -121
- package/src/question-abort-retry-text-before-dropdown.e2e.test.ts +0 -172
- package/src/question-text-before-dropdown.e2e.test.ts +0 -67
- package/src/queue-advanced-abort.e2e.test.ts +0 -449
- package/src/queue-advanced-action-buttons.e2e.test.ts +0 -271
- package/src/queue-advanced-e2e-setup.ts +0 -1164
- package/src/queue-advanced-footer.e2e.test.ts +0 -357
- package/src/queue-advanced-model-switch.e2e.test.ts +0 -382
- package/src/queue-advanced-permissions-typing.e2e.test.ts +0 -256
- package/src/queue-advanced-question.e2e.test.ts +0 -322
- package/src/queue-advanced-typing-interrupt.e2e.test.ts +0 -147
- package/src/queue-advanced-typing.e2e.test.ts +0 -199
- package/src/queue-delete-message.e2e.test.ts +0 -262
- package/src/queue-drain-after-interactive-ui.e2e.test.ts +0 -152
- package/src/queue-interrupt-drain.e2e.test.ts +0 -299
- package/src/queue-question-select-drain.e2e.test.ts +0 -209
- package/src/runtime-idle-sweeper.ts +0 -76
- package/src/runtime-lifecycle.e2e.test.ts +0 -714
- package/src/schema.sql +0 -251
- package/src/sentry.ts +0 -26
- package/src/session-handler/agent-utils.ts +0 -104
- package/src/session-handler/event-stream-fixtures/real-session-action-buttons.jsonl +0 -45
- package/src/session-handler/event-stream-fixtures/real-session-footer-suppressed-on-pre-idle-interrupt.jsonl +0 -40
- package/src/session-handler/event-stream-fixtures/real-session-permission-external-file.jsonl +0 -23
- package/src/session-handler/event-stream-fixtures/real-session-task-normal.jsonl +0 -22
- package/src/session-handler/event-stream-fixtures/real-session-task-three-parallel-sleeps.jsonl +0 -277
- package/src/session-handler/event-stream-fixtures/real-session-task-user-interruption.jsonl +0 -46
- package/src/session-handler/event-stream-fixtures/session-abort-after-idle-race.jsonl +0 -21
- package/src/session-handler/event-stream-fixtures/session-concurrent-messages-serialized.jsonl +0 -56
- package/src/session-handler/event-stream-fixtures/session-explicit-abort.jsonl +0 -44
- package/src/session-handler/event-stream-fixtures/session-normal-completion.jsonl +0 -29
- package/src/session-handler/event-stream-fixtures/session-tool-call-noisy-stream.jsonl +0 -29
- package/src/session-handler/event-stream-fixtures/session-two-completions-same-session.jsonl +0 -50
- package/src/session-handler/event-stream-fixtures/session-user-interruption.jsonl +0 -59
- package/src/session-handler/event-stream-fixtures/session-voice-queued-followup.jsonl +0 -52
- package/src/session-handler/event-stream-state.test.ts +0 -3431
- package/src/session-handler/event-stream-state.ts +0 -1792
- package/src/session-handler/global-event-listener.ts +0 -258
- package/src/session-handler/model-utils.test.ts +0 -537
- package/src/session-handler/model-utils.ts +0 -489
- package/src/session-handler/opencode-session-event-log.ts +0 -159
- package/src/session-handler/thread-ingress.test.ts +0 -54
- package/src/session-handler/thread-runtime-state.ts +0 -358
- package/src/session-handler/thread-session-runtime-summary.test.ts +0 -169
- package/src/session-handler/thread-session-runtime.ts +0 -5696
- package/src/session-handler.ts +0 -15
- package/src/session-search.test.ts +0 -331
- package/src/session-search.ts +0 -382
- package/src/session-sleep.test.ts +0 -294
- package/src/session-title-rename.test.ts +0 -186
- package/src/skill-filter.test.ts +0 -110
- package/src/skill-filter.ts +0 -63
- package/src/startup-service.ts +0 -200
- package/src/startup-time.e2e.test.ts +0 -377
- package/src/system-message.test.ts +0 -1013
- package/src/system-message.ts +0 -1043
- package/src/task-id-plugin.ts +0 -17
- package/src/task-runner.ts +0 -768
- package/src/task-schedule.test.ts +0 -424
- package/src/task-schedule.ts +0 -470
- package/src/test-utils.ts +0 -549
- package/src/thinking-utils.test.ts +0 -46
- package/src/thinking-utils.ts +0 -82
- package/src/thread-message-queue.e2e.test.ts +0 -1468
- package/src/tools.ts +0 -430
- package/src/undici.d.ts +0 -12
- package/src/undo-redo.e2e.test.ts +0 -219
- package/src/unnest-code-blocks.test.ts +0 -713
- package/src/unnest-code-blocks.ts +0 -185
- package/src/upgrade.ts +0 -127
- package/src/utils.ts +0 -216
- package/src/voice-attachment.ts +0 -79
- package/src/voice-handler.ts +0 -1000
- package/src/voice-message.e2e.test.ts +0 -1513
- package/src/voice-routing-input.e2e.test.ts +0 -203
- package/src/voice-routing-question.e2e.test.ts +0 -188
- package/src/voice.test.ts +0 -565
- package/src/wait-session.ts +0 -291
- package/src/websockify.ts +0 -101
- package/src/worker-types.ts +0 -64
- package/src/worktree-clone-isolation.e2e.test.ts +0 -213
- package/src/worktree-lifecycle.e2e.test.ts +0 -900
- package/src/worktree-utils.ts +0 -4
- package/src/xai-auth-plugin.ts +0 -303
- package/src/xai-auth-state.test.ts +0 -224
- package/src/xai-auth-state.ts +0 -294
- package/src/xml.test.ts +0 -38
- package/src/xml.ts +0 -121
package/dist/worktrees.test.js
CHANGED
|
@@ -1,958 +1,103 @@
|
|
|
1
|
-
// Tests for reusable worktree and submodule initialization helpers.
|
|
2
|
-
// Uses temporary local git repositories to validate submodule behavior end to end.
|
|
3
1
|
import fs from 'node:fs';
|
|
2
|
+
import os from 'node:os';
|
|
4
3
|
import path from 'node:path';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
return result.stdout.trim();
|
|
4
|
+
import { afterEach, expect, test } from 'vitest';
|
|
5
|
+
import { createWorktree, deleteWorktree, git, listWorktrees, mergeWorktree, resolveWorkingDirectory } from "./worktrees.js";
|
|
6
|
+
const roots = [];
|
|
7
|
+
afterEach(() => { for (const root of roots.splice(0))
|
|
8
|
+
fs.rmSync(root, { recursive: true, force: true }); });
|
|
9
|
+
async function repo() {
|
|
10
|
+
const root = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'kimaki-worktrees-')));
|
|
11
|
+
roots.push(root);
|
|
12
|
+
const directory = path.join(root, 'project');
|
|
13
|
+
fs.mkdirSync(directory);
|
|
14
|
+
await checked(directory, ['init', '-q', '-b', 'main']);
|
|
15
|
+
await checked(directory, ['config', 'user.name', 'Test']);
|
|
16
|
+
await checked(directory, ['config', 'user.email', 'test@example.com']);
|
|
17
|
+
fs.writeFileSync(path.join(directory, 'file.txt'), 'original\n');
|
|
18
|
+
await checked(directory, ['add', '.']);
|
|
19
|
+
await checked(directory, ['commit', '-qm', 'initial']);
|
|
20
|
+
return { root, directory };
|
|
23
21
|
}
|
|
24
|
-
function
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
async function checked(directory, args) {
|
|
23
|
+
const result = await git({ directory, args });
|
|
24
|
+
if (result instanceof Error)
|
|
25
|
+
throw result;
|
|
26
|
+
return result;
|
|
28
27
|
}
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
args: ['config', 'user.email', 'kimaki-tests@example.com'],
|
|
84
|
-
});
|
|
85
|
-
await git({
|
|
86
|
-
cwd: parentRepo,
|
|
87
|
-
args: ['config', 'user.name', 'Kimaki Tests'],
|
|
88
|
-
});
|
|
89
|
-
await git({
|
|
90
|
-
cwd: parentRepo,
|
|
91
|
-
args: ['config', 'protocol.file.allow', 'always'],
|
|
92
|
-
});
|
|
93
|
-
fs.writeFileSync(path.join(parentRepo, 'README.md'), 'parent\n', 'utf-8');
|
|
94
|
-
await git({ cwd: parentRepo, args: ['add', 'README.md'] });
|
|
95
|
-
await git({ cwd: parentRepo, args: ['commit', '-m', 'init parent'] });
|
|
96
|
-
await git({
|
|
97
|
-
cwd: parentRepo,
|
|
98
|
-
args: [
|
|
99
|
-
'-c',
|
|
100
|
-
'protocol.file.allow=always',
|
|
101
|
-
'submodule',
|
|
102
|
-
'add',
|
|
103
|
-
submoduleRemote,
|
|
104
|
-
'errore',
|
|
105
|
-
],
|
|
106
|
-
});
|
|
107
|
-
await git({ cwd: parentRepo, args: ['commit', '-am', 'add submodule at v1'] });
|
|
108
|
-
fs.writeFileSync(path.join(submoduleLocal, 'README.md'), 'v2-local-only\n', 'utf-8');
|
|
109
|
-
await git({ cwd: submoduleLocal, args: ['add', 'README.md'] });
|
|
110
|
-
await git({ cwd: submoduleLocal, args: ['commit', '-m', 'v2 local only'] });
|
|
111
|
-
const localOnlySha = await git({
|
|
112
|
-
cwd: submoduleLocal,
|
|
113
|
-
args: ['rev-parse', 'HEAD'],
|
|
114
|
-
});
|
|
115
|
-
await git({
|
|
116
|
-
cwd: path.join(parentRepo, 'errore'),
|
|
117
|
-
args: ['fetch', submoduleLocal, localOnlySha],
|
|
118
|
-
});
|
|
119
|
-
await git({
|
|
120
|
-
cwd: path.join(parentRepo, 'errore'),
|
|
121
|
-
args: ['checkout', localOnlySha],
|
|
122
|
-
});
|
|
123
|
-
await git({
|
|
124
|
-
cwd: parentRepo,
|
|
125
|
-
args: ['add', 'errore'],
|
|
126
|
-
});
|
|
127
|
-
await git({
|
|
128
|
-
cwd: parentRepo,
|
|
129
|
-
args: ['commit', '-m', 'pin local-only submodule commit'],
|
|
130
|
-
});
|
|
131
|
-
const worktreeResult = await createTestWorktree({
|
|
132
|
-
directory: parentRepo,
|
|
133
|
-
name: worktreeName,
|
|
134
|
-
});
|
|
135
|
-
if (worktreeResult instanceof Error) {
|
|
136
|
-
throw worktreeResult;
|
|
137
|
-
}
|
|
138
|
-
createdWorktreeDirectory = worktreeResult.directory;
|
|
139
|
-
const worktreeSubmoduleSha = await git({
|
|
140
|
-
cwd: path.join(worktreeResult.directory, 'errore'),
|
|
141
|
-
args: ['rev-parse', 'HEAD'],
|
|
142
|
-
});
|
|
143
|
-
const parentCommonDirectory = await resolveGitCommonDirectory({
|
|
144
|
-
directory: parentRepo,
|
|
145
|
-
});
|
|
146
|
-
if (parentCommonDirectory instanceof Error) {
|
|
147
|
-
throw parentCommonDirectory;
|
|
148
|
-
}
|
|
149
|
-
const submoduleCommonDirectory = await resolveGitCommonDirectory({
|
|
150
|
-
directory: path.join(worktreeResult.directory, 'errore'),
|
|
151
|
-
});
|
|
152
|
-
if (submoduleCommonDirectory instanceof Error) {
|
|
153
|
-
throw submoduleCommonDirectory;
|
|
154
|
-
}
|
|
155
|
-
expect({
|
|
156
|
-
localOnlyShaLength: localOnlySha.length,
|
|
157
|
-
worktreeSubmoduleShaLength: worktreeSubmoduleSha.length,
|
|
158
|
-
sameCommit: localOnlySha === worktreeSubmoduleSha,
|
|
159
|
-
belongsToParentClone: !path
|
|
160
|
-
.relative(parentCommonDirectory, submoduleCommonDirectory)
|
|
161
|
-
.startsWith(`..${path.sep}`),
|
|
162
|
-
}).toMatchInlineSnapshot(`
|
|
163
|
-
{
|
|
164
|
-
"belongsToParentClone": true,
|
|
165
|
-
"localOnlyShaLength": 40,
|
|
166
|
-
"sameCommit": true,
|
|
167
|
-
"worktreeSubmoduleShaLength": 40,
|
|
168
|
-
}
|
|
169
|
-
`);
|
|
170
|
-
}
|
|
171
|
-
finally {
|
|
172
|
-
if (createdWorktreeDirectory) {
|
|
173
|
-
await git({
|
|
174
|
-
cwd: parentRepo,
|
|
175
|
-
args: ['worktree', 'remove', '--force', createdWorktreeDirectory],
|
|
176
|
-
}).catch(() => {
|
|
177
|
-
return '';
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
fs.rmSync(sandbox, { recursive: true, force: true });
|
|
181
|
-
}
|
|
182
|
-
});
|
|
183
|
-
test('worktree creation uses current HEAD even when origin does not have the commit', async () => {
|
|
184
|
-
const sandbox = createTestRoot();
|
|
185
|
-
const parentRemote = path.join(sandbox, 'parent-remote.git');
|
|
186
|
-
const parentLocal = path.join(sandbox, 'parent-local');
|
|
187
|
-
const worktreeName = `opencode/kimaki-local-head-${Date.now()}`;
|
|
188
|
-
let createdWorktreeDirectory = '';
|
|
189
|
-
try {
|
|
190
|
-
await git({ cwd: sandbox, args: ['init', '--bare', '-b', 'main', parentRemote] });
|
|
191
|
-
await git({ cwd: sandbox, args: ['clone', parentRemote, parentLocal] });
|
|
192
|
-
await git({
|
|
193
|
-
cwd: parentLocal,
|
|
194
|
-
args: ['config', 'user.email', 'kimaki-tests@example.com'],
|
|
195
|
-
});
|
|
196
|
-
await git({
|
|
197
|
-
cwd: parentLocal,
|
|
198
|
-
args: ['config', 'user.name', 'Kimaki Tests'],
|
|
199
|
-
});
|
|
200
|
-
fs.writeFileSync(path.join(parentLocal, 'README.md'), 'v1\n', 'utf-8');
|
|
201
|
-
await git({ cwd: parentLocal, args: ['add', 'README.md'] });
|
|
202
|
-
await git({ cwd: parentLocal, args: ['commit', '-m', 'v1'] });
|
|
203
|
-
await git({ cwd: parentLocal, args: ['push', 'origin', 'HEAD:main'] });
|
|
204
|
-
fs.writeFileSync(path.join(parentLocal, 'README.md'), 'v2-local-only\n', 'utf-8');
|
|
205
|
-
await git({ cwd: parentLocal, args: ['commit', '-am', 'v2 local only'] });
|
|
206
|
-
const localHeadSha = await git({
|
|
207
|
-
cwd: parentLocal,
|
|
208
|
-
args: ['rev-parse', 'HEAD'],
|
|
209
|
-
});
|
|
210
|
-
const originHeadSha = await git({
|
|
211
|
-
cwd: parentLocal,
|
|
212
|
-
args: ['rev-parse', 'origin/main'],
|
|
213
|
-
});
|
|
214
|
-
const worktreeResult = await createTestWorktree({
|
|
215
|
-
directory: parentLocal,
|
|
216
|
-
name: worktreeName,
|
|
217
|
-
});
|
|
218
|
-
if (worktreeResult instanceof Error) {
|
|
219
|
-
throw worktreeResult;
|
|
220
|
-
}
|
|
221
|
-
createdWorktreeDirectory = worktreeResult.directory;
|
|
222
|
-
const worktreeHeadSha = await git({
|
|
223
|
-
cwd: createdWorktreeDirectory,
|
|
224
|
-
args: ['rev-parse', 'HEAD'],
|
|
225
|
-
});
|
|
226
|
-
expect({
|
|
227
|
-
localHeadShaLength: localHeadSha.length,
|
|
228
|
-
originHeadShaLength: originHeadSha.length,
|
|
229
|
-
worktreeHeadShaLength: worktreeHeadSha.length,
|
|
230
|
-
usesLocalOnlyHead: localHeadSha === worktreeHeadSha,
|
|
231
|
-
differsFromOrigin: localHeadSha !== originHeadSha,
|
|
232
|
-
}).toMatchInlineSnapshot(`
|
|
233
|
-
{
|
|
234
|
-
"differsFromOrigin": true,
|
|
235
|
-
"localHeadShaLength": 40,
|
|
236
|
-
"originHeadShaLength": 40,
|
|
237
|
-
"usesLocalOnlyHead": true,
|
|
238
|
-
"worktreeHeadShaLength": 40,
|
|
239
|
-
}
|
|
240
|
-
`);
|
|
241
|
-
}
|
|
242
|
-
finally {
|
|
243
|
-
if (createdWorktreeDirectory) {
|
|
244
|
-
await git({
|
|
245
|
-
cwd: parentLocal,
|
|
246
|
-
args: ['worktree', 'remove', '--force', createdWorktreeDirectory],
|
|
247
|
-
}).catch(() => {
|
|
248
|
-
return '';
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
fs.rmSync(sandbox, { recursive: true, force: true });
|
|
252
|
-
}
|
|
253
|
-
});
|
|
254
|
-
test('worktree creation survives an unavailable submodule remote', async () => {
|
|
255
|
-
const sandbox = createTestRoot();
|
|
256
|
-
const submoduleRemote = path.join(sandbox, 'missing-remote.git');
|
|
257
|
-
const submoduleSource = path.join(sandbox, 'submodule-source');
|
|
258
|
-
const parentRepo = path.join(sandbox, 'parent');
|
|
259
|
-
const worktreeName = `opencode/kimaki-missing-submodule-${Date.now()}`;
|
|
260
|
-
try {
|
|
261
|
-
await git({ cwd: sandbox, args: ['init', '--bare', '-b', 'main', submoduleRemote] });
|
|
262
|
-
await git({ cwd: sandbox, args: ['clone', submoduleRemote, submoduleSource] });
|
|
263
|
-
await git({ cwd: submoduleSource, args: ['config', 'user.email', 'kimaki-tests@example.com'] });
|
|
264
|
-
await git({ cwd: submoduleSource, args: ['config', 'user.name', 'Kimaki Tests'] });
|
|
265
|
-
fs.writeFileSync(path.join(submoduleSource, 'README.md'), 'submodule\n');
|
|
266
|
-
await git({ cwd: submoduleSource, args: ['add', 'README.md'] });
|
|
267
|
-
await git({ cwd: submoduleSource, args: ['commit', '-m', 'submodule'] });
|
|
268
|
-
await git({ cwd: submoduleSource, args: ['push', 'origin', 'HEAD:main'] });
|
|
269
|
-
await git({ cwd: sandbox, args: ['init', '-b', 'main', parentRepo] });
|
|
270
|
-
await git({ cwd: parentRepo, args: ['config', 'user.email', 'kimaki-tests@example.com'] });
|
|
271
|
-
await git({ cwd: parentRepo, args: ['config', 'user.name', 'Kimaki Tests'] });
|
|
272
|
-
fs.writeFileSync(path.join(parentRepo, 'README.md'), 'parent\n');
|
|
273
|
-
await git({ cwd: parentRepo, args: ['add', 'README.md'] });
|
|
274
|
-
await git({ cwd: parentRepo, args: ['commit', '-m', 'parent'] });
|
|
275
|
-
await git({
|
|
276
|
-
cwd: parentRepo,
|
|
277
|
-
args: [
|
|
278
|
-
'-c',
|
|
279
|
-
'protocol.file.allow=always',
|
|
280
|
-
'submodule',
|
|
281
|
-
'add',
|
|
282
|
-
submoduleRemote,
|
|
283
|
-
'missing',
|
|
284
|
-
],
|
|
285
|
-
});
|
|
286
|
-
await git({ cwd: parentRepo, args: ['commit', '-am', 'add submodule'] });
|
|
287
|
-
await git({ cwd: parentRepo, args: ['submodule', 'deinit', '-f', '--all'] });
|
|
288
|
-
fs.rmSync(path.join(parentRepo, '.git', 'modules', 'missing'), {
|
|
289
|
-
recursive: true,
|
|
290
|
-
force: true,
|
|
291
|
-
});
|
|
292
|
-
fs.rmSync(submoduleRemote, { recursive: true, force: true });
|
|
293
|
-
const result = await createTestWorktree({
|
|
294
|
-
directory: parentRepo,
|
|
295
|
-
name: worktreeName,
|
|
296
|
-
});
|
|
297
|
-
if (result instanceof Error)
|
|
298
|
-
throw result;
|
|
299
|
-
expect({
|
|
300
|
-
directoryExists: fs.existsSync(result.directory),
|
|
301
|
-
submoduleUnavailable: !fs.existsSync(path.join(result.directory, 'missing', '.git')),
|
|
302
|
-
}).toMatchInlineSnapshot(`
|
|
303
|
-
{
|
|
304
|
-
"directoryExists": true,
|
|
305
|
-
"submoduleUnavailable": true,
|
|
306
|
-
}
|
|
307
|
-
`);
|
|
308
|
-
}
|
|
309
|
-
finally {
|
|
310
|
-
const managedDirectory = getManagedWorktreeDirectory({
|
|
311
|
-
directory: parentRepo,
|
|
312
|
-
name: worktreeName,
|
|
313
|
-
});
|
|
314
|
-
if (fs.existsSync(parentRepo)) {
|
|
315
|
-
await git({
|
|
316
|
-
cwd: parentRepo,
|
|
317
|
-
args: ['worktree', 'remove', '--force', managedDirectory],
|
|
318
|
-
}).catch(() => '');
|
|
319
|
-
}
|
|
320
|
-
fs.rmSync(sandbox, { recursive: true, force: true });
|
|
321
|
-
}
|
|
322
|
-
});
|
|
323
|
-
test('worktree removal succeeds when its branch was already deleted', async () => {
|
|
324
|
-
const sandbox = createTestRoot();
|
|
325
|
-
const parentRepo = path.join(sandbox, 'parent');
|
|
326
|
-
const worktreeDirectory = path.join(sandbox, 'worktree');
|
|
327
|
-
const branchName = 'opencode/kimaki-removed-branch';
|
|
328
|
-
try {
|
|
329
|
-
await git({ cwd: sandbox, args: ['init', '-b', 'main', parentRepo] });
|
|
330
|
-
await git({ cwd: parentRepo, args: ['config', 'user.email', 'kimaki-tests@example.com'] });
|
|
331
|
-
await git({ cwd: parentRepo, args: ['config', 'user.name', 'Kimaki Tests'] });
|
|
332
|
-
fs.writeFileSync(path.join(parentRepo, 'README.md'), 'parent\n');
|
|
333
|
-
await git({ cwd: parentRepo, args: ['add', 'README.md'] });
|
|
334
|
-
await git({ cwd: parentRepo, args: ['commit', '-m', 'parent'] });
|
|
335
|
-
await git({
|
|
336
|
-
cwd: parentRepo,
|
|
337
|
-
args: ['worktree', 'add', '-b', branchName, worktreeDirectory],
|
|
338
|
-
});
|
|
339
|
-
await git({ cwd: worktreeDirectory, args: ['switch', '--detach'] });
|
|
340
|
-
await git({ cwd: parentRepo, args: ['branch', '-D', branchName] });
|
|
341
|
-
const result = await removeWorktreeCore({
|
|
342
|
-
projectDirectory: parentRepo,
|
|
343
|
-
worktreeDirectory,
|
|
344
|
-
branchName,
|
|
345
|
-
});
|
|
346
|
-
if (result instanceof Error)
|
|
347
|
-
throw result;
|
|
348
|
-
expect(fs.existsSync(worktreeDirectory)).toBe(false);
|
|
349
|
-
}
|
|
350
|
-
finally {
|
|
351
|
-
fs.rmSync(sandbox, { recursive: true, force: true });
|
|
352
|
-
}
|
|
353
|
-
});
|
|
354
|
-
test('worktree identity mismatch is detected and cleaned from its actual clone', async () => {
|
|
355
|
-
const sandbox = createTestRoot();
|
|
356
|
-
const remote = path.join(sandbox, 'remote.git');
|
|
357
|
-
const requestedClone = path.join(sandbox, 'requested');
|
|
358
|
-
const otherClone = path.join(sandbox, 'other');
|
|
359
|
-
const worktreeDirectory = path.join(sandbox, 'wrong-worktree');
|
|
360
|
-
const branchName = 'opencode/kimaki-wrong-clone';
|
|
361
|
-
try {
|
|
362
|
-
await git({ cwd: sandbox, args: ['init', '--bare', '-b', 'main', remote] });
|
|
363
|
-
await git({ cwd: sandbox, args: ['clone', remote, otherClone] });
|
|
364
|
-
await git({ cwd: otherClone, args: ['config', 'user.email', 'kimaki-tests@example.com'] });
|
|
365
|
-
await git({ cwd: otherClone, args: ['config', 'user.name', 'Kimaki Tests'] });
|
|
366
|
-
fs.writeFileSync(path.join(otherClone, 'README.md'), 'old\n');
|
|
367
|
-
await git({ cwd: otherClone, args: ['add', 'README.md'] });
|
|
368
|
-
await git({ cwd: otherClone, args: ['commit', '-m', 'old'] });
|
|
369
|
-
await git({ cwd: otherClone, args: ['push', 'origin', 'HEAD:main'] });
|
|
370
|
-
await git({ cwd: sandbox, args: ['clone', remote, requestedClone] });
|
|
371
|
-
await git({ cwd: requestedClone, args: ['config', 'user.email', 'kimaki-tests@example.com'] });
|
|
372
|
-
await git({ cwd: requestedClone, args: ['config', 'user.name', 'Kimaki Tests'] });
|
|
373
|
-
fs.writeFileSync(path.join(requestedClone, 'requested.txt'), 'new\n');
|
|
374
|
-
await git({ cwd: requestedClone, args: ['add', 'requested.txt'] });
|
|
375
|
-
await git({ cwd: requestedClone, args: ['commit', '-m', 'requested'] });
|
|
376
|
-
const baseCommit = await git({
|
|
377
|
-
cwd: requestedClone,
|
|
378
|
-
args: ['rev-parse', 'HEAD'],
|
|
379
|
-
});
|
|
380
|
-
await git({
|
|
381
|
-
cwd: otherClone,
|
|
382
|
-
args: ['worktree', 'add', '-b', branchName, worktreeDirectory, 'HEAD'],
|
|
383
|
-
});
|
|
384
|
-
const validation = await validateWorktreeIdentity({
|
|
385
|
-
projectDirectory: requestedClone,
|
|
386
|
-
worktreeDirectory,
|
|
387
|
-
baseCommit,
|
|
388
|
-
});
|
|
389
|
-
expect(validation).toBeInstanceOf(Error);
|
|
390
|
-
const cleanup = await removeWorktreeFromOwnRepository({
|
|
391
|
-
worktreeDirectory,
|
|
392
|
-
branchName,
|
|
393
|
-
});
|
|
394
|
-
if (cleanup instanceof Error)
|
|
395
|
-
throw cleanup;
|
|
396
|
-
const otherWorktrees = await git({
|
|
397
|
-
cwd: otherClone,
|
|
398
|
-
args: ['worktree', 'list', '--porcelain'],
|
|
399
|
-
});
|
|
400
|
-
const branchExists = await execAsync(`git show-ref --verify --quiet ${JSON.stringify(`refs/heads/${branchName}`)}`, { cwd: otherClone })
|
|
401
|
-
.then(() => true)
|
|
402
|
-
.catch(() => false);
|
|
403
|
-
expect({
|
|
404
|
-
directoryRemoved: !fs.existsSync(worktreeDirectory),
|
|
405
|
-
registrationRemoved: !otherWorktrees.includes(worktreeDirectory),
|
|
406
|
-
branchRemoved: !branchExists,
|
|
407
|
-
}).toMatchInlineSnapshot(`
|
|
408
|
-
{
|
|
409
|
-
"branchRemoved": true,
|
|
410
|
-
"directoryRemoved": true,
|
|
411
|
-
"registrationRemoved": true,
|
|
412
|
-
}
|
|
413
|
-
`);
|
|
414
|
-
}
|
|
415
|
-
finally {
|
|
416
|
-
fs.rmSync(sandbox, { recursive: true, force: true });
|
|
417
|
-
}
|
|
418
|
-
});
|
|
419
|
-
test('mergeWorktree rejects dirty checked-out target before local push', async () => {
|
|
420
|
-
const sandbox = createTestRoot();
|
|
421
|
-
const parentRepo = path.join(sandbox, 'parent');
|
|
422
|
-
const worktreeDir = path.join(sandbox, 'feature-worktree');
|
|
423
|
-
try {
|
|
424
|
-
fs.mkdirSync(parentRepo, { recursive: true });
|
|
425
|
-
await git({ cwd: parentRepo, args: ['init', '-b', 'main'] });
|
|
426
|
-
await git({ cwd: parentRepo, args: ['config', 'user.email', 'kimaki-tests@example.com'] });
|
|
427
|
-
await git({ cwd: parentRepo, args: ['config', 'user.name', 'Kimaki Tests'] });
|
|
428
|
-
fs.writeFileSync(path.join(parentRepo, 'README.md'), 'v1\n', 'utf-8');
|
|
429
|
-
await git({ cwd: parentRepo, args: ['add', 'README.md'] });
|
|
430
|
-
await git({ cwd: parentRepo, args: ['commit', '-m', 'init'] });
|
|
431
|
-
await git({ cwd: parentRepo, args: ['worktree', 'add', '-b', 'feature', worktreeDir] });
|
|
432
|
-
fs.writeFileSync(path.join(worktreeDir, 'feature.md'), 'feature\n', 'utf-8');
|
|
433
|
-
await git({ cwd: worktreeDir, args: ['add', 'feature.md'] });
|
|
434
|
-
await git({ cwd: worktreeDir, args: ['commit', '-m', 'feature'] });
|
|
435
|
-
fs.writeFileSync(path.join(parentRepo, 'README.md'), 'dirty main\n', 'utf-8');
|
|
436
|
-
const result = await mergeWorktree({
|
|
437
|
-
worktreeDir,
|
|
438
|
-
mainRepoDir: parentRepo,
|
|
439
|
-
worktreeName: 'feature',
|
|
440
|
-
targetBranch: 'main',
|
|
441
|
-
});
|
|
442
|
-
expect(result).toBeInstanceOf(TargetDirtyWorktreeError);
|
|
443
|
-
expect(await git({ cwd: parentRepo, args: ['rev-parse', 'main'] })).not.toBe(await git({ cwd: worktreeDir, args: ['rev-parse', 'HEAD'] }));
|
|
444
|
-
}
|
|
445
|
-
finally {
|
|
446
|
-
fs.rmSync(sandbox, { recursive: true, force: true });
|
|
447
|
-
}
|
|
448
|
-
});
|
|
449
|
-
test('formatMergeWorktreeError includes git command, exit code, and stderr', () => {
|
|
450
|
-
const execErr = Object.assign(new Error('Command failed: git push'), {
|
|
451
|
-
stderr: 'fatal: refusing to update checked out branch: refs/heads/main\nhint: set receive.denyCurrentBranch to updateInstead\n',
|
|
452
|
-
stdout: '',
|
|
453
|
-
code: 1,
|
|
454
|
-
});
|
|
455
|
-
const gitErr = new GitCommandError({
|
|
456
|
-
command: 'git -C /wt push --receive-pack=git -c receive.denyCurrentBranch=updateInstead receive-pack /repo/.git HEAD:main',
|
|
457
|
-
cause: execErr,
|
|
458
|
-
});
|
|
459
|
-
const err = new PushError({ target: 'main', cause: gitErr });
|
|
460
|
-
expect(formatMergeWorktreeError(err)).toMatchInlineSnapshot(`
|
|
461
|
-
"Merge failed: Push to main failed
|
|
462
|
-
Worktree rebase succeeded. Local branch was not updated. This is not a push to origin.
|
|
463
|
-
|
|
464
|
-
\`\`\`
|
|
465
|
-
git -C /wt push --receive-pack=git -c receive.denyCurrentBranch=updateInstead receive-pack /repo/.git HEAD:main
|
|
466
|
-
exit 1
|
|
467
|
-
|
|
468
|
-
fatal: refusing to update checked out branch: refs/heads/main
|
|
469
|
-
hint: set receive.denyCurrentBranch to updateInstead
|
|
470
|
-
\`\`\`"
|
|
471
|
-
`);
|
|
472
|
-
});
|
|
473
|
-
test('formatMergeWorktreeError keeps timeout cause when git has no stderr', () => {
|
|
474
|
-
const timeoutErr = new Error('Command timed out after 30000ms: git -C /wt push /repo/.git HEAD:main');
|
|
475
|
-
const gitErr = new GitCommandError({
|
|
476
|
-
command: 'git -C /wt push /repo/.git HEAD:main',
|
|
477
|
-
cause: timeoutErr,
|
|
478
|
-
});
|
|
479
|
-
const err = new PushError({ target: 'main', cause: gitErr });
|
|
480
|
-
expect(formatMergeWorktreeError(err)).toMatchInlineSnapshot(`
|
|
481
|
-
"Merge failed: Push to main failed
|
|
482
|
-
Worktree rebase succeeded. Local branch was not updated. This is not a push to origin.
|
|
483
|
-
|
|
484
|
-
\`\`\`
|
|
485
|
-
git -C /wt push /repo/.git HEAD:main
|
|
486
|
-
|
|
487
|
-
Command timed out after 30000ms: git -C /wt push /repo/.git HEAD:main
|
|
488
|
-
\`\`\`"
|
|
489
|
-
`);
|
|
490
|
-
});
|
|
491
|
-
test('formatMergeWorktreeError truncates to maxLength', () => {
|
|
492
|
-
const execErr = Object.assign(new Error('Command failed: git push'), {
|
|
493
|
-
stderr: 'fatal: ' + 'x'.repeat(200),
|
|
494
|
-
code: 1,
|
|
495
|
-
});
|
|
496
|
-
const gitErr = new GitCommandError({
|
|
497
|
-
command: 'git -C /wt push /repo/.git HEAD:main',
|
|
498
|
-
cause: execErr,
|
|
499
|
-
});
|
|
500
|
-
const formatted = formatMergeWorktreeError(new PushError({ target: 'main', cause: gitErr }), { maxLength: 80 });
|
|
501
|
-
expect(formatted.length).toBeLessThanOrEqual(80);
|
|
502
|
-
expect(formatted.endsWith('… [truncated]')).toBe(true);
|
|
503
|
-
});
|
|
504
|
-
test('mergeWorktree push failure includes git stderr in formatted error', async () => {
|
|
505
|
-
const sandbox = createTestRoot();
|
|
506
|
-
const parentRepo = path.join(sandbox, 'parent');
|
|
507
|
-
const worktreeDir = path.join(sandbox, 'feature-worktree');
|
|
508
|
-
try {
|
|
509
|
-
fs.mkdirSync(parentRepo, { recursive: true });
|
|
510
|
-
await git({ cwd: parentRepo, args: ['init', '-b', 'main'] });
|
|
511
|
-
await git({ cwd: parentRepo, args: ['config', 'user.email', 'kimaki-tests@example.com'] });
|
|
512
|
-
await git({ cwd: parentRepo, args: ['config', 'user.name', 'Kimaki Tests'] });
|
|
513
|
-
await git({
|
|
514
|
-
cwd: parentRepo,
|
|
515
|
-
args: ['config', 'core.hooksPath', path.join(parentRepo, '.git', 'hooks')],
|
|
516
|
-
});
|
|
517
|
-
fs.writeFileSync(path.join(parentRepo, 'README.md'), 'v1\n', 'utf-8');
|
|
518
|
-
await git({ cwd: parentRepo, args: ['add', 'README.md'] });
|
|
519
|
-
await git({ cwd: parentRepo, args: ['commit', '-m', 'init'] });
|
|
520
|
-
await git({ cwd: parentRepo, args: ['worktree', 'add', '-b', 'feature', worktreeDir] });
|
|
521
|
-
fs.writeFileSync(path.join(worktreeDir, 'feature.md'), 'feature\n', 'utf-8');
|
|
522
|
-
await git({ cwd: worktreeDir, args: ['add', 'feature.md'] });
|
|
523
|
-
await git({ cwd: worktreeDir, args: ['commit', '-m', 'feature'] });
|
|
524
|
-
const hookPath = path.join(parentRepo, '.git', 'hooks', 'pre-receive');
|
|
525
|
-
fs.writeFileSync(hookPath, '#!/bin/sh\ncat >/dev/null\necho "hook rejected the push" >&2\nexit 1\n', 'utf-8');
|
|
526
|
-
fs.chmodSync(hookPath, 0o755);
|
|
527
|
-
const result = await mergeWorktree({
|
|
528
|
-
worktreeDir,
|
|
529
|
-
mainRepoDir: parentRepo,
|
|
530
|
-
worktreeName: 'feature',
|
|
531
|
-
targetBranch: 'main',
|
|
532
|
-
});
|
|
533
|
-
expect(result).toBeInstanceOf(PushError);
|
|
534
|
-
if (!(result instanceof PushError))
|
|
535
|
-
return;
|
|
536
|
-
const formatted = formatMergeWorktreeError(result);
|
|
537
|
-
expect(formatted.startsWith('Merge failed: Push to main failed')).toBe(true);
|
|
538
|
-
expect(formatted).toContain('hook rejected the push');
|
|
539
|
-
expect(formatted).toContain('exit 1');
|
|
540
|
-
expect(formatted).toContain('git -C ');
|
|
541
|
-
}
|
|
542
|
-
finally {
|
|
543
|
-
fs.rmSync(sandbox, { recursive: true, force: true });
|
|
544
|
-
}
|
|
545
|
-
});
|
|
546
|
-
test('mergeWorktree squash creates one target commit with the complete tree', async () => {
|
|
547
|
-
const sandbox = createTestRoot();
|
|
548
|
-
const parentRepo = path.join(sandbox, 'parent');
|
|
549
|
-
const worktreeDir = path.join(sandbox, 'feature-worktree');
|
|
550
|
-
try {
|
|
551
|
-
fs.mkdirSync(parentRepo, { recursive: true });
|
|
552
|
-
await git({ cwd: parentRepo, args: ['init', '-b', 'main'] });
|
|
553
|
-
await git({ cwd: parentRepo, args: ['config', 'user.email', 'kimaki-tests@example.com'] });
|
|
554
|
-
await git({ cwd: parentRepo, args: ['config', 'user.name', 'Kimaki Tests'] });
|
|
555
|
-
fs.writeFileSync(path.join(parentRepo, 'README.md'), 'base\n', 'utf-8');
|
|
556
|
-
await git({ cwd: parentRepo, args: ['add', 'README.md'] });
|
|
557
|
-
await git({ cwd: parentRepo, args: ['commit', '-m', 'init'] });
|
|
558
|
-
await git({ cwd: parentRepo, args: ['worktree', 'add', '-b', 'feature', worktreeDir] });
|
|
559
|
-
fs.writeFileSync(path.join(worktreeDir, 'first.md'), 'first\n', 'utf-8');
|
|
560
|
-
await git({ cwd: worktreeDir, args: ['add', 'first.md'] });
|
|
561
|
-
await git({ cwd: worktreeDir, args: ['commit', '-m', 'add first file'] });
|
|
562
|
-
fs.writeFileSync(path.join(worktreeDir, 'second.md'), 'second\n', 'utf-8');
|
|
563
|
-
await git({ cwd: worktreeDir, args: ['add', 'second.md'] });
|
|
564
|
-
await git({ cwd: worktreeDir, args: ['commit', '-m', 'add second file'] });
|
|
565
|
-
fs.writeFileSync(path.join(parentRepo, 'target.md'), 'target\n', 'utf-8');
|
|
566
|
-
await git({ cwd: parentRepo, args: ['add', 'target.md'] });
|
|
567
|
-
await git({ cwd: parentRepo, args: ['commit', '-m', 'advance target'] });
|
|
568
|
-
const targetBeforeMerge = await git({
|
|
569
|
-
cwd: parentRepo,
|
|
570
|
-
args: ['rev-parse', 'main'],
|
|
571
|
-
});
|
|
572
|
-
const result = await mergeWorktree({
|
|
573
|
-
worktreeDir,
|
|
574
|
-
mainRepoDir: parentRepo,
|
|
575
|
-
worktreeName: 'feature',
|
|
576
|
-
targetBranch: 'main',
|
|
577
|
-
strategy: 'squash',
|
|
578
|
-
});
|
|
579
|
-
if (result instanceof Error)
|
|
580
|
-
throw result;
|
|
581
|
-
const parent = await git({ cwd: parentRepo, args: ['rev-parse', 'main^'] });
|
|
582
|
-
expect({
|
|
583
|
-
sourceCommitCount: result.commitCount,
|
|
584
|
-
targetCommitCount: Number(await git({
|
|
585
|
-
cwd: parentRepo,
|
|
586
|
-
args: ['rev-list', '--count', `${targetBeforeMerge}..main`],
|
|
587
|
-
})),
|
|
588
|
-
parentMatchesTarget: parent === targetBeforeMerge,
|
|
589
|
-
subject: await git({ cwd: parentRepo, args: ['log', '-1', '--format=%s', 'main'] }),
|
|
590
|
-
files: (await git({ cwd: parentRepo, args: ['ls-tree', '-r', '--name-only', 'main'] })).split('\n'),
|
|
591
|
-
worktreeHead: await git({ cwd: worktreeDir, args: ['rev-parse', '--abbrev-ref', 'HEAD'] }),
|
|
592
|
-
featureBranchExists: await execAsync('git show-ref --verify --quiet refs/heads/feature', { cwd: parentRepo }).then(() => true, () => false),
|
|
593
|
-
}).toMatchInlineSnapshot(`
|
|
594
|
-
{
|
|
595
|
-
"featureBranchExists": false,
|
|
596
|
-
"files": [
|
|
597
|
-
"README.md",
|
|
598
|
-
"first.md",
|
|
599
|
-
"second.md",
|
|
600
|
-
"target.md",
|
|
601
|
-
],
|
|
602
|
-
"parentMatchesTarget": true,
|
|
603
|
-
"sourceCommitCount": 2,
|
|
604
|
-
"subject": "Merge worktree feature",
|
|
605
|
-
"targetCommitCount": 1,
|
|
606
|
-
"worktreeHead": "HEAD",
|
|
607
|
-
}
|
|
608
|
-
`);
|
|
609
|
-
}
|
|
610
|
-
finally {
|
|
611
|
-
fs.rmSync(sandbox, { recursive: true, force: true });
|
|
612
|
-
}
|
|
613
|
-
});
|
|
614
|
-
test('mergeWorktree keeps reporting a paused rebase conflict on retry', async () => {
|
|
615
|
-
const sandbox = createTestRoot();
|
|
616
|
-
const parentRepo = path.join(sandbox, 'parent');
|
|
617
|
-
const worktreeDir = path.join(sandbox, 'feature-worktree');
|
|
618
|
-
try {
|
|
619
|
-
fs.mkdirSync(parentRepo, { recursive: true });
|
|
620
|
-
await git({ cwd: parentRepo, args: ['init', '-b', 'main'] });
|
|
621
|
-
await git({ cwd: parentRepo, args: ['config', 'user.email', 'kimaki-tests@example.com'] });
|
|
622
|
-
await git({ cwd: parentRepo, args: ['config', 'user.name', 'Kimaki Tests'] });
|
|
623
|
-
fs.writeFileSync(path.join(parentRepo, 'conflict.txt'), 'base\n', 'utf-8');
|
|
624
|
-
await git({ cwd: parentRepo, args: ['add', 'conflict.txt'] });
|
|
625
|
-
await git({ cwd: parentRepo, args: ['commit', '-m', 'init'] });
|
|
626
|
-
await git({ cwd: parentRepo, args: ['worktree', 'add', '-b', 'feature', worktreeDir] });
|
|
627
|
-
fs.writeFileSync(path.join(worktreeDir, 'conflict.txt'), 'feature\n', 'utf-8');
|
|
628
|
-
await git({ cwd: worktreeDir, args: ['commit', '-am', 'feature change'] });
|
|
629
|
-
fs.writeFileSync(path.join(parentRepo, 'conflict.txt'), 'target\n', 'utf-8');
|
|
630
|
-
await git({ cwd: parentRepo, args: ['commit', '-am', 'target change'] });
|
|
631
|
-
const first = await mergeWorktree({
|
|
632
|
-
worktreeDir,
|
|
633
|
-
mainRepoDir: parentRepo,
|
|
634
|
-
worktreeName: 'feature',
|
|
635
|
-
targetBranch: 'main',
|
|
636
|
-
strategy: 'squash',
|
|
637
|
-
});
|
|
638
|
-
const retry = await mergeWorktree({
|
|
639
|
-
worktreeDir,
|
|
640
|
-
mainRepoDir: parentRepo,
|
|
641
|
-
worktreeName: 'feature',
|
|
642
|
-
targetBranch: 'main',
|
|
643
|
-
strategy: 'squash',
|
|
644
|
-
});
|
|
645
|
-
expect({
|
|
646
|
-
first: first instanceof Error ? first.name : 'success',
|
|
647
|
-
retry: retry instanceof Error ? retry.name : 'success',
|
|
648
|
-
}).toMatchInlineSnapshot(`
|
|
649
|
-
{
|
|
650
|
-
"first": "RebaseConflictError",
|
|
651
|
-
"retry": "RebaseConflictError",
|
|
652
|
-
}
|
|
653
|
-
`);
|
|
654
|
-
expect(first).toBeInstanceOf(RebaseConflictError);
|
|
655
|
-
expect(retry).toBeInstanceOf(RebaseConflictError);
|
|
656
|
-
}
|
|
657
|
-
finally {
|
|
658
|
-
await execAsync('git rebase --abort', { cwd: worktreeDir }).catch(() => undefined);
|
|
659
|
-
fs.rmSync(sandbox, { recursive: true, force: true });
|
|
660
|
-
}
|
|
661
|
-
});
|
|
662
|
-
test('validateBranchRef does not execute shell syntax from a branch value', async () => {
|
|
663
|
-
const sandbox = createTestRoot();
|
|
664
|
-
const marker = path.join(sandbox, 'injected');
|
|
665
|
-
try {
|
|
666
|
-
await git({ cwd: sandbox, args: ['init', '-b', 'main'] });
|
|
667
|
-
const result = await validateBranchRef({
|
|
668
|
-
directory: sandbox,
|
|
669
|
-
ref: `feature/$(touch ${marker})`,
|
|
670
|
-
});
|
|
671
|
-
expect({
|
|
672
|
-
rejected: result instanceof Error,
|
|
673
|
-
commandExecuted: fs.existsSync(marker),
|
|
674
|
-
}).toMatchInlineSnapshot(`
|
|
675
|
-
{
|
|
676
|
-
"commandExecuted": false,
|
|
677
|
-
"rejected": true,
|
|
678
|
-
}
|
|
679
|
-
`);
|
|
680
|
-
}
|
|
681
|
-
finally {
|
|
682
|
-
fs.rmSync(sandbox, { recursive: true, force: true });
|
|
683
|
-
}
|
|
684
|
-
});
|
|
685
|
-
test('shortenWorktreeSlug leaves short slugs alone', () => {
|
|
686
|
-
expect(shortenWorktreeSlug('short-name')).toMatchInlineSnapshot(`"short-name"`);
|
|
687
|
-
expect(shortenWorktreeSlug('exactly-twenty-chars')).toMatchInlineSnapshot(`"exactly-twenty-chars"`);
|
|
688
|
-
});
|
|
689
|
-
test('shortenWorktreeSlug strips vowels from long slugs', () => {
|
|
690
|
-
expect(shortenWorktreeSlug('configurable-sidebar-width-by-component')).toMatchInlineSnapshot(`"cnfgrbl-sdbr-wdth-by-cmpnnt"`);
|
|
691
|
-
expect(shortenWorktreeSlug('add-dark-mode-toggle-to-settings-page')).toMatchInlineSnapshot(`"add-drk-md-tggl-t-sttngs-pg"`);
|
|
692
|
-
});
|
|
693
|
-
test('formatWorktreeName keeps user-provided slugs verbatim', () => {
|
|
694
|
-
expect(formatWorktreeName('Configurable sidebar width by component')).toMatchInlineSnapshot(`"opencode/kimaki-configurable-sidebar-width-by-component"`);
|
|
695
|
-
expect(formatWorktreeName('my-feature')).toMatchInlineSnapshot(`"opencode/kimaki-my-feature"`);
|
|
696
|
-
});
|
|
697
|
-
test('formatAutoWorktreeName compresses long auto-derived slugs', () => {
|
|
698
|
-
expect(formatAutoWorktreeName('Configurable sidebar width by component')).toMatchInlineSnapshot(`"opencode/kimaki-cnfgrbl-sdbr-wdth-by-cmpnnt"`);
|
|
699
|
-
expect(formatAutoWorktreeName('my-feature')).toMatchInlineSnapshot(`"opencode/kimaki-my-feature"`);
|
|
700
|
-
});
|
|
701
|
-
test('getManagedWorktreeDirectory writes under kimaki data dir and strips prefix', () => {
|
|
702
|
-
const sandbox = createTestRoot();
|
|
703
|
-
try {
|
|
704
|
-
setDataDir(sandbox);
|
|
705
|
-
const dir = getManagedWorktreeDirectory({
|
|
706
|
-
directory: '/Users/test/projects/my-app',
|
|
707
|
-
name: 'opencode/kimaki-cnfgrbl-sdbr-wdth-by-cmpnnt',
|
|
708
|
-
});
|
|
709
|
-
// Must sit inside <dataDir>/worktrees/<8hash>/<basename>
|
|
710
|
-
const rel = path.relative(sandbox, dir);
|
|
711
|
-
const parts = rel.split(path.sep);
|
|
712
|
-
expect({
|
|
713
|
-
topLevel: parts[0],
|
|
714
|
-
hashLength: parts[1]?.length,
|
|
715
|
-
basename: parts[2],
|
|
716
|
-
partsCount: parts.length,
|
|
717
|
-
}).toMatchInlineSnapshot(`
|
|
718
|
-
{
|
|
719
|
-
"basename": "cnfgrbl-sdbr-wdth-by-cmpnnt",
|
|
720
|
-
"hashLength": 8,
|
|
721
|
-
"partsCount": 3,
|
|
722
|
-
"topLevel": "worktrees",
|
|
723
|
-
}
|
|
724
|
-
`);
|
|
725
|
-
}
|
|
726
|
-
finally {
|
|
727
|
-
fs.rmSync(sandbox, { recursive: true, force: true });
|
|
728
|
-
}
|
|
729
|
-
});
|
|
730
|
-
test('resolveSessionWorkingDirectory accepts the project root', async () => {
|
|
731
|
-
const sandbox = createTestRoot();
|
|
732
|
-
try {
|
|
733
|
-
const projectDirectory = path.join(sandbox, 'project');
|
|
734
|
-
fs.mkdirSync(projectDirectory, { recursive: true });
|
|
735
|
-
const result = await resolveSessionWorkingDirectory({
|
|
736
|
-
projectDirectory,
|
|
737
|
-
candidatePath: projectDirectory,
|
|
738
|
-
});
|
|
739
|
-
if (result instanceof Error) {
|
|
740
|
-
throw result;
|
|
741
|
-
}
|
|
742
|
-
expect({
|
|
743
|
-
kind: result.kind,
|
|
744
|
-
relativeDirectory: path.relative(projectDirectory, result.directory),
|
|
745
|
-
}).toMatchInlineSnapshot(`
|
|
746
|
-
{
|
|
747
|
-
"kind": "project",
|
|
748
|
-
"relativeDirectory": "",
|
|
749
|
-
}
|
|
750
|
-
`);
|
|
751
|
-
}
|
|
752
|
-
finally {
|
|
753
|
-
fs.rmSync(sandbox, { recursive: true, force: true });
|
|
754
|
-
}
|
|
755
|
-
});
|
|
756
|
-
test('resolveSessionWorkingDirectory accepts project subfolders', async () => {
|
|
757
|
-
const sandbox = createTestRoot();
|
|
758
|
-
try {
|
|
759
|
-
const projectDirectory = path.join(sandbox, 'project');
|
|
760
|
-
const subfolder = path.join(projectDirectory, 'restricted-task');
|
|
761
|
-
fs.mkdirSync(subfolder, { recursive: true });
|
|
762
|
-
const result = await resolveSessionWorkingDirectory({
|
|
763
|
-
projectDirectory,
|
|
764
|
-
candidatePath: subfolder,
|
|
765
|
-
});
|
|
766
|
-
if (result instanceof Error) {
|
|
767
|
-
throw result;
|
|
768
|
-
}
|
|
769
|
-
expect({
|
|
770
|
-
kind: result.kind,
|
|
771
|
-
relativeDirectory: path.relative(projectDirectory, result.directory),
|
|
772
|
-
}).toMatchInlineSnapshot(`
|
|
773
|
-
{
|
|
774
|
-
"kind": "project",
|
|
775
|
-
"relativeDirectory": "restricted-task",
|
|
776
|
-
}
|
|
777
|
-
`);
|
|
778
|
-
}
|
|
779
|
-
finally {
|
|
780
|
-
fs.rmSync(sandbox, { recursive: true, force: true });
|
|
781
|
-
}
|
|
782
|
-
});
|
|
783
|
-
test('resolveSessionWorkingDirectory accepts project worktrees', async () => {
|
|
784
|
-
const sandbox = createTestRoot();
|
|
785
|
-
const projectDirectory = path.join(sandbox, 'project');
|
|
786
|
-
const worktreeDirectory = path.join(sandbox, 'feature-worktree');
|
|
787
|
-
try {
|
|
788
|
-
fs.mkdirSync(projectDirectory, { recursive: true });
|
|
789
|
-
await git({ cwd: projectDirectory, args: ['init', '-b', 'main'] });
|
|
790
|
-
await git({
|
|
791
|
-
cwd: projectDirectory,
|
|
792
|
-
args: ['config', 'user.email', 'kimaki-tests@example.com'],
|
|
793
|
-
});
|
|
794
|
-
await git({
|
|
795
|
-
cwd: projectDirectory,
|
|
796
|
-
args: ['config', 'user.name', 'Kimaki Tests'],
|
|
797
|
-
});
|
|
798
|
-
fs.writeFileSync(path.join(projectDirectory, 'README.md'), 'project\n', 'utf-8');
|
|
799
|
-
await git({ cwd: projectDirectory, args: ['add', 'README.md'] });
|
|
800
|
-
await git({ cwd: projectDirectory, args: ['commit', '-m', 'init'] });
|
|
801
|
-
await git({
|
|
802
|
-
cwd: projectDirectory,
|
|
803
|
-
args: ['worktree', 'add', '-b', 'feature', worktreeDirectory],
|
|
804
|
-
});
|
|
805
|
-
const result = await resolveSessionWorkingDirectory({
|
|
806
|
-
projectDirectory,
|
|
807
|
-
candidatePath: worktreeDirectory,
|
|
808
|
-
});
|
|
809
|
-
if (result instanceof Error) {
|
|
810
|
-
throw result;
|
|
811
|
-
}
|
|
812
|
-
expect({
|
|
813
|
-
kind: result.kind,
|
|
814
|
-
relativeDirectory: path.relative(sandbox, result.directory),
|
|
815
|
-
}).toMatchInlineSnapshot(`
|
|
816
|
-
{
|
|
817
|
-
"kind": "worktree",
|
|
818
|
-
"relativeDirectory": "feature-worktree",
|
|
819
|
-
}
|
|
820
|
-
`);
|
|
821
|
-
}
|
|
822
|
-
finally {
|
|
823
|
-
fs.rmSync(sandbox, { recursive: true, force: true });
|
|
824
|
-
}
|
|
825
|
-
});
|
|
826
|
-
test('resolveSessionWorkingDirectory rejects unrelated directories', async () => {
|
|
827
|
-
const sandbox = createTestRoot();
|
|
828
|
-
try {
|
|
829
|
-
const projectDirectory = path.join(sandbox, 'project');
|
|
830
|
-
const siblingDirectory = path.join(sandbox, 'other-project');
|
|
831
|
-
fs.mkdirSync(projectDirectory, { recursive: true });
|
|
832
|
-
fs.mkdirSync(siblingDirectory, { recursive: true });
|
|
833
|
-
await git({ cwd: projectDirectory, args: ['init', '-b', 'main'] });
|
|
834
|
-
const result = await resolveSessionWorkingDirectory({
|
|
835
|
-
projectDirectory,
|
|
836
|
-
candidatePath: siblingDirectory,
|
|
837
|
-
});
|
|
838
|
-
expect(result).toBeInstanceOf(Error);
|
|
839
|
-
const message = result instanceof Error ? result.message : '';
|
|
840
|
-
expect(message
|
|
841
|
-
.replace(projectDirectory, '<project>')
|
|
842
|
-
.replace(siblingDirectory, '<sibling>')).toMatchInlineSnapshot(`"Working directory must be inside <project> or a git worktree of it: <sibling>"`);
|
|
843
|
-
}
|
|
844
|
-
finally {
|
|
845
|
-
fs.rmSync(sandbox, { recursive: true, force: true });
|
|
846
|
-
}
|
|
847
|
-
});
|
|
28
|
+
test('custom worktrees use the exact clone and committed HEAD; cwd resolves subfolders and symlinks safely', async () => {
|
|
29
|
+
const { root, directory } = await repo();
|
|
30
|
+
fs.writeFileSync(path.join(directory, 'file.txt'), 'uncommitted\n');
|
|
31
|
+
const created = await createWorktree({ projectDirectory: directory, dataDir: root, name: 'feature' });
|
|
32
|
+
if (created instanceof Error)
|
|
33
|
+
throw created;
|
|
34
|
+
fs.mkdirSync(path.join(created.directory, 'src'));
|
|
35
|
+
const alias = path.join(root, 'alias');
|
|
36
|
+
fs.symlinkSync(created.directory, alias);
|
|
37
|
+
const resolved = await resolveWorkingDirectory({ projectDirectory: directory, candidate: path.join(alias, 'src') });
|
|
38
|
+
expect(resolved).toBe(path.join(created.directory, 'src'));
|
|
39
|
+
expect(fs.readFileSync(path.join(created.directory, 'file.txt'), 'utf8')).toBe('original\n');
|
|
40
|
+
expect(created.branch).toBe('opencode/kimaki-feature');
|
|
41
|
+
expect(await createWorktree({ projectDirectory: directory, dataDir: root, name: '../escape' })).toBeInstanceOf(Error);
|
|
42
|
+
expect(await createWorktree({ projectDirectory: directory, dataDir: root, name: 'feature' })).toBeInstanceOf(Error);
|
|
43
|
+
const clone = path.join(root, 'clone');
|
|
44
|
+
await checked(root, ['clone', '-q', directory, clone]);
|
|
45
|
+
expect(await resolveWorkingDirectory({ projectDirectory: directory, candidate: clone })).toBeInstanceOf(Error);
|
|
46
|
+
const cloneTree = await createWorktree({ projectDirectory: clone, dataDir: root, name: 'feature' });
|
|
47
|
+
if (cloneTree instanceof Error)
|
|
48
|
+
throw cloneTree;
|
|
49
|
+
expect(cloneTree.directory).not.toBe(created.directory);
|
|
50
|
+
const listed = await listWorktrees({ projectDirectory: directory });
|
|
51
|
+
if (listed instanceof Error)
|
|
52
|
+
throw listed;
|
|
53
|
+
expect(listed.map((tree) => tree.directory)).toEqual([created.directory]);
|
|
54
|
+
});
|
|
55
|
+
test.each(['rebase', 'squash'])('%s merges locally and deletion rejects dirty and unmerged work', async (strategy) => {
|
|
56
|
+
const { root, directory } = await repo();
|
|
57
|
+
const created = await createWorktree({ projectDirectory: directory, dataDir: root, name: strategy });
|
|
58
|
+
if (created instanceof Error)
|
|
59
|
+
throw created;
|
|
60
|
+
fs.writeFileSync(path.join(created.directory, 'feature.txt'), 'feature\n');
|
|
61
|
+
expect(await deleteWorktree({ projectDirectory: directory, directory: created.directory })).toBeInstanceOf(Error);
|
|
62
|
+
await checked(created.directory, ['add', '.']);
|
|
63
|
+
await checked(created.directory, ['commit', '-qm', 'feature']);
|
|
64
|
+
expect(await deleteWorktree({ projectDirectory: directory, directory: created.directory })).toBeInstanceOf(Error);
|
|
65
|
+
fs.writeFileSync(path.join(created.directory, 'second.txt'), 'second\n');
|
|
66
|
+
await checked(created.directory, ['add', '.']);
|
|
67
|
+
await checked(created.directory, ['commit', '-qm', 'second feature']);
|
|
68
|
+
fs.writeFileSync(path.join(directory, 'file.txt'), 'dirty target\n');
|
|
69
|
+
expect(await mergeWorktree({ projectDirectory: directory, directory: created.directory, strategy })).toBeInstanceOf(Error);
|
|
70
|
+
fs.writeFileSync(path.join(directory, 'file.txt'), 'original\n');
|
|
71
|
+
fs.writeFileSync(path.join(directory, 'target.txt'), 'target\n');
|
|
72
|
+
await checked(directory, ['add', '.']);
|
|
73
|
+
await checked(directory, ['commit', '-qm', 'target advanced']);
|
|
74
|
+
const merged = await mergeWorktree({ projectDirectory: directory, directory: created.directory, strategy });
|
|
75
|
+
if (merged instanceof Error)
|
|
76
|
+
throw merged;
|
|
77
|
+
expect(fs.readFileSync(path.join(directory, 'feature.txt'), 'utf8')).toBe('feature\n');
|
|
78
|
+
expect(await checked(directory, ['rev-list', '--count', 'main'])).toBe(strategy === 'rebase' ? '4' : '3');
|
|
79
|
+
expect(await checked(created.directory, ['branch', '--show-current'])).toBe('');
|
|
80
|
+
expect(await deleteWorktree({ projectDirectory: directory, directory: created.directory })).toBeUndefined();
|
|
81
|
+
expect(await deleteWorktree({ projectDirectory: directory, directory })).toBeInstanceOf(Error);
|
|
848
82
|
});
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
"branch": "opencode/kimaki-feature",
|
|
869
|
-
"detached": false,
|
|
870
|
-
"directory": "/Users/me/.local/share/opencode/worktree/hash/opencode-kimaki-feature",
|
|
871
|
-
"head": "def456",
|
|
872
|
-
"locked": false,
|
|
873
|
-
"prunable": false,
|
|
874
|
-
},
|
|
875
|
-
{
|
|
876
|
-
"branch": "my-branch",
|
|
877
|
-
"detached": false,
|
|
878
|
-
"directory": "/Users/me/project-manual-wt",
|
|
879
|
-
"head": "789abc",
|
|
880
|
-
"locked": false,
|
|
881
|
-
"prunable": false,
|
|
882
|
-
},
|
|
883
|
-
]
|
|
884
|
-
`);
|
|
885
|
-
});
|
|
886
|
-
test('handles detached HEAD worktrees', () => {
|
|
887
|
-
const output = [
|
|
888
|
-
'worktree /Users/me/project',
|
|
889
|
-
'HEAD abc123',
|
|
890
|
-
'branch refs/heads/main',
|
|
891
|
-
'',
|
|
892
|
-
'worktree /Users/me/detached-wt',
|
|
893
|
-
'HEAD deadbeef',
|
|
894
|
-
'detached',
|
|
895
|
-
'',
|
|
896
|
-
].join('\n');
|
|
897
|
-
const result = parseGitWorktreeListPorcelain(output);
|
|
898
|
-
expect(result).toMatchInlineSnapshot(`
|
|
899
|
-
[
|
|
900
|
-
{
|
|
901
|
-
"branch": null,
|
|
902
|
-
"detached": true,
|
|
903
|
-
"directory": "/Users/me/detached-wt",
|
|
904
|
-
"head": "deadbeef",
|
|
905
|
-
"locked": false,
|
|
906
|
-
"prunable": false,
|
|
907
|
-
},
|
|
908
|
-
]
|
|
909
|
-
`);
|
|
910
|
-
});
|
|
911
|
-
test('parses locked and prunable flags', () => {
|
|
912
|
-
const output = [
|
|
913
|
-
'worktree /Users/me/project',
|
|
914
|
-
'HEAD abc123',
|
|
915
|
-
'branch refs/heads/main',
|
|
916
|
-
'',
|
|
917
|
-
'worktree /Users/me/locked-wt',
|
|
918
|
-
'HEAD aaa111',
|
|
919
|
-
'branch refs/heads/feature-locked',
|
|
920
|
-
'locked portable disk',
|
|
921
|
-
'',
|
|
922
|
-
'worktree /Users/me/prunable-wt',
|
|
923
|
-
'HEAD bbb222',
|
|
924
|
-
'branch refs/heads/stale-branch',
|
|
925
|
-
'prunable gitdir file points to non-existent location',
|
|
926
|
-
'',
|
|
927
|
-
].join('\n');
|
|
928
|
-
expect(parseGitWorktreeListPorcelain(output)).toMatchInlineSnapshot(`
|
|
929
|
-
[
|
|
930
|
-
{
|
|
931
|
-
"branch": "feature-locked",
|
|
932
|
-
"detached": false,
|
|
933
|
-
"directory": "/Users/me/locked-wt",
|
|
934
|
-
"head": "aaa111",
|
|
935
|
-
"locked": true,
|
|
936
|
-
"prunable": false,
|
|
937
|
-
},
|
|
938
|
-
{
|
|
939
|
-
"branch": "stale-branch",
|
|
940
|
-
"detached": false,
|
|
941
|
-
"directory": "/Users/me/prunable-wt",
|
|
942
|
-
"head": "bbb222",
|
|
943
|
-
"locked": false,
|
|
944
|
-
"prunable": true,
|
|
945
|
-
},
|
|
946
|
-
]
|
|
947
|
-
`);
|
|
948
|
-
});
|
|
949
|
-
test('returns empty array when only main worktree exists', () => {
|
|
950
|
-
const output = [
|
|
951
|
-
'worktree /Users/me/project',
|
|
952
|
-
'HEAD abc123',
|
|
953
|
-
'branch refs/heads/main',
|
|
954
|
-
'',
|
|
955
|
-
].join('\n');
|
|
956
|
-
expect(parseGitWorktreeListPorcelain(output)).toMatchInlineSnapshot(`[]`);
|
|
957
|
-
});
|
|
83
|
+
test('merge conflicts leave the worktree paused and a retry does not hide the rebase', async () => {
|
|
84
|
+
const { root, directory } = await repo();
|
|
85
|
+
const created = await createWorktree({ projectDirectory: directory, dataDir: root, name: 'conflict' });
|
|
86
|
+
if (created instanceof Error)
|
|
87
|
+
throw created;
|
|
88
|
+
fs.writeFileSync(path.join(created.directory, 'file.txt'), 'source\n');
|
|
89
|
+
await checked(created.directory, ['commit', '-am', 'source changed']);
|
|
90
|
+
fs.writeFileSync(path.join(directory, 'file.txt'), 'target\n');
|
|
91
|
+
await checked(directory, ['commit', '-am', 'target changed']);
|
|
92
|
+
const result = await mergeWorktree({ projectDirectory: directory, directory: created.directory });
|
|
93
|
+
if (!(result instanceof Error))
|
|
94
|
+
throw new Error('Expected a conflict');
|
|
95
|
+
expect(result.message.replaceAll(created.directory, 'WORKTREE')).toMatchInlineSnapshot(`"Rebase failed in WORKTREE. Resolve conflicts and run git rebase --continue, then retry the merge."`);
|
|
96
|
+
const retry = await mergeWorktree({ projectDirectory: directory, directory: created.directory });
|
|
97
|
+
if (!(retry instanceof Error))
|
|
98
|
+
throw new Error('Expected a paused rebase');
|
|
99
|
+
expect(retry.message).toMatchInlineSnapshot(`"A rebase is already paused. Resolve conflicts and run git rebase --continue, or git rebase --abort, before merging."`);
|
|
100
|
+
expect(fs.readFileSync(path.join(directory, 'file.txt'), 'utf8')).toBe('target\n');
|
|
101
|
+
expect(fs.readFileSync(path.join(created.directory, 'file.txt'), 'utf8')).toContain('<<<<<<<');
|
|
958
102
|
});
|
|
103
|
+
//# sourceMappingURL=worktrees.test.js.map
|