@agimon-ai/doompi-git 0.0.1-alpha.1 → 0.0.1-alpha.11

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.
Files changed (148) hide show
  1. package/README.md +2 -0
  2. package/package.json +48 -35
  3. package/src/prompts/doompi-use-git/SKILL.md +5 -2
  4. package/dist/_virtual/_rolldown/runtime.cjs +0 -1
  5. package/dist/adapters/channel/worktreeChannel.cjs +0 -2
  6. package/dist/adapters/channel/worktreeChannel.cjs.map +0 -1
  7. package/dist/adapters/channel/worktreeChannel.d.cts +0 -40
  8. package/dist/adapters/channel/worktreeChannel.d.cts.map +0 -1
  9. package/dist/adapters/channel/worktreeChannel.d.mts +0 -40
  10. package/dist/adapters/channel/worktreeChannel.d.mts.map +0 -1
  11. package/dist/adapters/channel/worktreeChannel.mjs +0 -2
  12. package/dist/adapters/channel/worktreeChannel.mjs.map +0 -1
  13. package/dist/adapters/filesystem/atomicJson.cjs +0 -2
  14. package/dist/adapters/filesystem/atomicJson.cjs.map +0 -1
  15. package/dist/adapters/filesystem/atomicJson.mjs +0 -2
  16. package/dist/adapters/filesystem/atomicJson.mjs.map +0 -1
  17. package/dist/adapters/filesystem/paths.cjs +0 -2
  18. package/dist/adapters/filesystem/paths.cjs.map +0 -1
  19. package/dist/adapters/filesystem/paths.mjs +0 -2
  20. package/dist/adapters/filesystem/paths.mjs.map +0 -1
  21. package/dist/adapters/hub/hubClient.cjs +0 -2
  22. package/dist/adapters/hub/hubClient.cjs.map +0 -1
  23. package/dist/adapters/hub/hubClient.d.cts +0 -1
  24. package/dist/adapters/hub/hubClient.d.mts +0 -1
  25. package/dist/adapters/hub/hubClient.mjs +0 -2
  26. package/dist/adapters/hub/hubClient.mjs.map +0 -1
  27. package/dist/adapters/pi/extension.cjs +0 -2
  28. package/dist/adapters/pi/extension.cjs.map +0 -1
  29. package/dist/adapters/pi/extension.d.cts +0 -9
  30. package/dist/adapters/pi/extension.d.cts.map +0 -1
  31. package/dist/adapters/pi/extension.d.mts +0 -9
  32. package/dist/adapters/pi/extension.d.mts.map +0 -1
  33. package/dist/adapters/pi/extension.mjs +0 -2
  34. package/dist/adapters/pi/extension.mjs.map +0 -1
  35. package/dist/adapters/pi/extensions/runWorktreeTool.cjs +0 -15
  36. package/dist/adapters/pi/extensions/runWorktreeTool.cjs.map +0 -1
  37. package/dist/adapters/pi/extensions/runWorktreeTool.mjs +0 -15
  38. package/dist/adapters/pi/extensions/runWorktreeTool.mjs.map +0 -1
  39. package/dist/adapters/web/worktreesChannel.cjs +0 -2
  40. package/dist/adapters/web/worktreesChannel.cjs.map +0 -1
  41. package/dist/adapters/web/worktreesChannel.d.cts +0 -21
  42. package/dist/adapters/web/worktreesChannel.d.cts.map +0 -1
  43. package/dist/adapters/web/worktreesChannel.d.mts +0 -21
  44. package/dist/adapters/web/worktreesChannel.d.mts.map +0 -1
  45. package/dist/adapters/web/worktreesChannel.mjs +0 -2
  46. package/dist/adapters/web/worktreesChannel.mjs.map +0 -1
  47. package/dist/adapters/worktree/dependencyInstall.cjs +0 -2
  48. package/dist/adapters/worktree/dependencyInstall.cjs.map +0 -1
  49. package/dist/adapters/worktree/dependencyInstall.mjs +0 -2
  50. package/dist/adapters/worktree/dependencyInstall.mjs.map +0 -1
  51. package/dist/adapters/worktree/gitCli.cjs +0 -4
  52. package/dist/adapters/worktree/gitCli.cjs.map +0 -1
  53. package/dist/adapters/worktree/gitCli.mjs +0 -4
  54. package/dist/adapters/worktree/gitCli.mjs.map +0 -1
  55. package/dist/adapters/worktree/repositoryIdentity.cjs +0 -2
  56. package/dist/adapters/worktree/repositoryIdentity.cjs.map +0 -1
  57. package/dist/adapters/worktree/repositoryIdentity.mjs +0 -2
  58. package/dist/adapters/worktree/repositoryIdentity.mjs.map +0 -1
  59. package/dist/adapters/worktree/worktreeOperations.cjs +0 -2
  60. package/dist/adapters/worktree/worktreeOperations.cjs.map +0 -1
  61. package/dist/adapters/worktree/worktreeOperations.d.cts +0 -32
  62. package/dist/adapters/worktree/worktreeOperations.d.cts.map +0 -1
  63. package/dist/adapters/worktree/worktreeOperations.d.mts +0 -32
  64. package/dist/adapters/worktree/worktreeOperations.d.mts.map +0 -1
  65. package/dist/adapters/worktree/worktreeOperations.mjs +0 -2
  66. package/dist/adapters/worktree/worktreeOperations.mjs.map +0 -1
  67. package/dist/adapters/worktree/worktreeRegistry.cjs +0 -2
  68. package/dist/adapters/worktree/worktreeRegistry.cjs.map +0 -1
  69. package/dist/adapters/worktree/worktreeRegistry.mjs +0 -2
  70. package/dist/adapters/worktree/worktreeRegistry.mjs.map +0 -1
  71. package/dist/commands/doomGitCommand.cjs +0 -2
  72. package/dist/commands/doomGitCommand.cjs.map +0 -1
  73. package/dist/commands/doomGitCommand.mjs +0 -2
  74. package/dist/commands/doomGitCommand.mjs.map +0 -1
  75. package/dist/container/index.cjs +0 -2
  76. package/dist/container/index.cjs.map +0 -1
  77. package/dist/container/index.d.cts +0 -6
  78. package/dist/container/index.d.cts.map +0 -1
  79. package/dist/container/index.d.mts +0 -6
  80. package/dist/container/index.d.mts.map +0 -1
  81. package/dist/container/index.mjs +0 -2
  82. package/dist/container/index.mjs.map +0 -1
  83. package/dist/extensions/pi.cjs +0 -1
  84. package/dist/extensions/pi.d.cts +0 -2
  85. package/dist/extensions/pi.d.mts +0 -2
  86. package/dist/extensions/pi.mjs +0 -1
  87. package/dist/hubApi.cjs +0 -2
  88. package/dist/hubApi.cjs.map +0 -1
  89. package/dist/hubApi.d.cts +0 -6
  90. package/dist/hubApi.d.cts.map +0 -1
  91. package/dist/hubApi.d.mts +0 -6
  92. package/dist/hubApi.d.mts.map +0 -1
  93. package/dist/hubApi.mjs +0 -2
  94. package/dist/hubApi.mjs.map +0 -1
  95. package/dist/index.cjs +0 -1
  96. package/dist/index.d.cts +0 -5
  97. package/dist/index.d.mts +0 -5
  98. package/dist/index.mjs +0 -1
  99. package/dist/schemas/runWorktreeTool.cjs +0 -2
  100. package/dist/schemas/runWorktreeTool.cjs.map +0 -1
  101. package/dist/schemas/runWorktreeTool.mjs +0 -2
  102. package/dist/schemas/runWorktreeTool.mjs.map +0 -1
  103. package/dist/services/extensionService.cjs +0 -2
  104. package/dist/services/extensionService.cjs.map +0 -1
  105. package/dist/services/extensionService.d.cts +0 -8
  106. package/dist/services/extensionService.d.cts.map +0 -1
  107. package/dist/services/extensionService.d.mts +0 -8
  108. package/dist/services/extensionService.d.mts.map +0 -1
  109. package/dist/services/extensionService.mjs +0 -2
  110. package/dist/services/extensionService.mjs.map +0 -1
  111. package/dist/services/support/errors.cjs +0 -2
  112. package/dist/services/support/errors.cjs.map +0 -1
  113. package/dist/services/support/errors.mjs +0 -2
  114. package/dist/services/support/errors.mjs.map +0 -1
  115. package/dist/services/worktreeNaming.cjs +0 -2
  116. package/dist/services/worktreeNaming.cjs.map +0 -1
  117. package/dist/services/worktreeNaming.d.cts +0 -27
  118. package/dist/services/worktreeNaming.d.cts.map +0 -1
  119. package/dist/services/worktreeNaming.d.mts +0 -27
  120. package/dist/services/worktreeNaming.d.mts.map +0 -1
  121. package/dist/services/worktreeNaming.mjs +0 -2
  122. package/dist/services/worktreeNaming.mjs.map +0 -1
  123. package/dist/types/extension.d.cts +0 -17
  124. package/dist/types/extension.d.cts.map +0 -1
  125. package/dist/types/extension.d.mts +0 -17
  126. package/dist/types/extension.d.mts.map +0 -1
  127. package/dist/types/webWorktrees.cjs +0 -2
  128. package/dist/types/webWorktrees.cjs.map +0 -1
  129. package/dist/types/webWorktrees.mjs +0 -2
  130. package/dist/types/webWorktrees.mjs.map +0 -1
  131. package/dist/types/worktreeRegistry.d.cts +0 -41
  132. package/dist/types/worktreeRegistry.d.cts.map +0 -1
  133. package/dist/types/worktreeRegistry.d.mts +0 -41
  134. package/dist/types/worktreeRegistry.d.mts.map +0 -1
  135. package/dist/webHub.cjs +0 -1
  136. package/dist/webHub.d.cts +0 -2
  137. package/dist/webHub.d.mts +0 -2
  138. package/dist/webHub.mjs +0 -1
  139. package/src/exports/webClient.ts +0 -1
  140. package/src/types/webWorktrees.ts +0 -55
  141. package/src/types/worktreeRegistry.ts +0 -69
  142. package/src/web/components/RunWorktreeToolMessage.tsx +0 -37
  143. package/src/web/components/WorktreesActivitySection.tsx +0 -64
  144. package/src/web/components/WorktreesPanel.tsx +0 -125
  145. package/src/web/components/toolRenderers.ts +0 -7
  146. package/src/web/index.ts +0 -30
  147. package/src/web/stores/worktreesActivityStore.ts +0 -124
  148. package/src/web/tsconfig.json +0 -22
@@ -1 +0,0 @@
1
- {"version":3,"file":"doomGitCommand.cjs","names":[],"sources":["../../src/commands/doomGitCommand.ts"],"sourcesContent":["// @scaffold-generated\nimport type { ExtensionAPI } from '@earendil-works/pi-coding-agent';\nimport type { GitExtensionService } from '../types/extension.ts';\n\nexport const COMMAND_NAME = 'doom-git';\nexport const COMMAND_DESCRIPTION = 'Show git worktrees owned by this session';\n\nexport function registerGitCommand(pi: Pick<ExtensionAPI, 'registerCommand'>, service: GitExtensionService): void {\n pi.registerCommand(COMMAND_NAME, {\n description: COMMAND_DESCRIPTION,\n handler: async (_args, ctx) => {\n const result = await service.execute();\n if (ctx.hasUI) ctx.ui.notify(result.message, result.level);\n },\n });\n}\n"],"mappings":"AAIA,MAAa,EAAe,WACf,EAAsB,2CAEnC,SAAgB,EAAmB,EAA2C,EAAoC,CAChH,EAAG,gBAAgB,EAAc,CAC/B,YAAa,EACb,QAAS,MAAO,EAAO,IAAQ,CAC7B,IAAM,EAAS,MAAM,EAAQ,QAAQ,EACjC,EAAI,OAAO,EAAI,GAAG,OAAO,EAAO,QAAS,EAAO,KAAK,CAC3D,CACF,CAAC,CACH"}
@@ -1,2 +0,0 @@
1
- const e=`doom-git`,t=`Show git worktrees owned by this session`;function n(n,r){n.registerCommand(e,{description:t,handler:async(e,t)=>{let n=await r.execute();t.hasUI&&t.ui.notify(n.message,n.level)}})}export{t as COMMAND_DESCRIPTION,e as COMMAND_NAME,n as registerGitCommand};
2
- //# sourceMappingURL=doomGitCommand.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"doomGitCommand.mjs","names":[],"sources":["../../src/commands/doomGitCommand.ts"],"sourcesContent":["// @scaffold-generated\nimport type { ExtensionAPI } from '@earendil-works/pi-coding-agent';\nimport type { GitExtensionService } from '../types/extension.ts';\n\nexport const COMMAND_NAME = 'doom-git';\nexport const COMMAND_DESCRIPTION = 'Show git worktrees owned by this session';\n\nexport function registerGitCommand(pi: Pick<ExtensionAPI, 'registerCommand'>, service: GitExtensionService): void {\n pi.registerCommand(COMMAND_NAME, {\n description: COMMAND_DESCRIPTION,\n handler: async (_args, ctx) => {\n const result = await service.execute();\n if (ctx.hasUI) ctx.ui.notify(result.message, result.level);\n },\n });\n}\n"],"mappings":"AAIA,MAAa,EAAe,WACf,EAAsB,2CAEnC,SAAgB,EAAmB,EAA2C,EAAoC,CAChH,EAAG,gBAAgB,EAAc,CAC/B,YAAa,EACb,QAAS,MAAO,EAAO,IAAQ,CAC7B,IAAM,EAAS,MAAM,EAAQ,QAAQ,EACjC,EAAI,OAAO,EAAI,GAAG,OAAO,EAAO,QAAS,EAAO,KAAK,CAC3D,CACF,CAAC,CACH"}
@@ -1,2 +0,0 @@
1
- const e=require("../adapters/worktree/gitCli.cjs"),t=require("../adapters/worktree/worktreeOperations.cjs"),n=require("../services/extensionService.cjs");function r(r={}){return{service:r.service??new n.DefaultGitExtensionService,operations:r.operations??t.createWorktreeOperations({git:e.createWorktreeGit()})}}exports.createGitContainer=r;
2
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","names":["DefaultGitExtensionService","createWorktreeOperations","createWorktreeGit"],"sources":["../../src/container/index.ts"],"sourcesContent":["// @scaffold-generated\nimport { createWorktreeGit } from '../adapters/worktree/gitCli.ts';\nimport { DefaultGitExtensionService } from '../services/extensionService.ts';\nimport { createWorktreeOperations } from '../adapters/worktree/worktreeOperations.ts';\nimport type { GitExtensionDependencies } from '../types/extension.ts';\n\nexport function createGitContainer(overrides: Partial<GitExtensionDependencies> = {}): GitExtensionDependencies {\n return {\n service: overrides.service ?? new DefaultGitExtensionService(),\n operations: overrides.operations ?? createWorktreeOperations({ git: createWorktreeGit() }),\n };\n}\n"],"mappings":"0JAMA,SAAgB,EAAmB,EAA+C,CAAC,EAA6B,CAC9G,MAAO,CACL,QAAS,EAAU,SAAW,IAAIA,EAAAA,2BAClC,WAAY,EAAU,YAAcC,EAAAA,yBAAyB,CAAE,IAAKC,EAAAA,kBAAkB,CAAE,CAAC,CAC3F,CACF"}
@@ -1,6 +0,0 @@
1
- import { GitExtensionDependencies } from "../types/extension.cjs";
2
- //#region src/container/index.d.ts
3
- declare function createGitContainer(overrides?: Partial<GitExtensionDependencies>): GitExtensionDependencies;
4
- //#endregion
5
- export { createGitContainer };
6
- //# sourceMappingURL=index.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../../src/container/index.ts"],"mappings":";;iBAMgB,mBAAmB,YAAW,QAAQ,4BAAiC"}
@@ -1,6 +0,0 @@
1
- import { GitExtensionDependencies } from "../types/extension.mjs";
2
- //#region src/container/index.d.ts
3
- declare function createGitContainer(overrides?: Partial<GitExtensionDependencies>): GitExtensionDependencies;
4
- //#endregion
5
- export { createGitContainer };
6
- //# sourceMappingURL=index.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/container/index.ts"],"mappings":";;iBAMgB,mBAAmB,YAAW,QAAQ,4BAAiC"}
@@ -1,2 +0,0 @@
1
- import{createWorktreeGit as e}from"../adapters/worktree/gitCli.mjs";import{createWorktreeOperations as t}from"../adapters/worktree/worktreeOperations.mjs";import{DefaultGitExtensionService as n}from"../services/extensionService.mjs";function r(r={}){return{service:r.service??new n,operations:r.operations??t({git:e()})}}export{r as createGitContainer};
2
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../src/container/index.ts"],"sourcesContent":["// @scaffold-generated\nimport { createWorktreeGit } from '../adapters/worktree/gitCli.ts';\nimport { DefaultGitExtensionService } from '../services/extensionService.ts';\nimport { createWorktreeOperations } from '../adapters/worktree/worktreeOperations.ts';\nimport type { GitExtensionDependencies } from '../types/extension.ts';\n\nexport function createGitContainer(overrides: Partial<GitExtensionDependencies> = {}): GitExtensionDependencies {\n return {\n service: overrides.service ?? new DefaultGitExtensionService(),\n operations: overrides.operations ?? createWorktreeOperations({ git: createWorktreeGit() }),\n };\n}\n"],"mappings":"yOAMA,SAAgB,EAAmB,EAA+C,CAAC,EAA6B,CAC9G,MAAO,CACL,QAAS,EAAU,SAAW,IAAI,EAClC,WAAY,EAAU,YAAc,EAAyB,CAAE,IAAK,EAAkB,CAAE,CAAC,CAC3F,CACF"}
@@ -1 +0,0 @@
1
- Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../adapters/pi/extension.cjs");exports.activateGitExtension=e.activateGitExtension,exports.default=e.activateGitExtension;
@@ -1,2 +0,0 @@
1
- import { activateGitExtension } from "../adapters/pi/extension.cjs";
2
- export { activateGitExtension, activateGitExtension as default };
@@ -1,2 +0,0 @@
1
- import { activateGitExtension } from "../adapters/pi/extension.mjs";
2
- export { activateGitExtension, activateGitExtension as default };
@@ -1 +0,0 @@
1
- import{activateGitExtension as e}from"../adapters/pi/extension.mjs";export{e as activateGitExtension,e as default};
package/dist/hubApi.cjs DELETED
@@ -1,2 +0,0 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./adapters/worktree/gitCli.cjs"),t=require("./services/support/errors.cjs"),n=require("./adapters/worktree/worktreeOperations.cjs");function r(e){return Response.json({error:e},{status:400})}function i(e){return e instanceof t.DoomGitExpectedError?Response.json({error:e.message,code:e.code},{status:e.retryable?503:409}):Response.json({error:`The worktree operation failed.`},{status:500})}const a={basePath:`git`,start(t){let a=n.createWorktreeOperations({git:e.createWorktreeGit()}),o=e=>{let n=e.searchParams.get(`repositoryId`);if(n===null||n===``)return r(`A repositoryId is required.`);let i=t.resolveRepository?.(n);return i===void 0?r(`That repository is not admitted to this cockpit.`):i};return{async fetch(e){let n=new URL(e.url),s=o(n);if(s instanceof Response)return s;let c={cwd:s,sessionId:n.searchParams.get(`sessionId`)??``};try{if(e.method===`GET`&&n.pathname===`/worktrees`)return Response.json({worktrees:await a.list(c)});if(e.method===`POST`&&n.pathname===`/worktrees`){let t=await e.json();if(typeof t.branch!=`string`||t.branch.trim()===``)return r(`A branch is required.`);let n=await a.spawn(c,{branch:t.branch,...t.baseRef===void 0?{}:{baseRef:t.baseRef},...t.name===void 0?{}:{name:t.name}});return Response.json({worktree:n},{status:201})}let t=/^\/worktrees\/([^/]+)$/u.exec(n.pathname);if(e.method===`DELETE`&&t){let e=await a.close(c,decodeURIComponent(String(t[1])),n.searchParams.get(`force`)===`true`);return Response.json({worktree:e})}return Response.json({error:`No such worktree route.`},{status:404})}catch(e){return t.onNotice(`worktree request failed: ${e.name}`),i(e)}},close(){}}}};exports.api=a;
2
- //# sourceMappingURL=hubApi.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hubApi.cjs","names":["DoomGitExpectedError","createWorktreeOperations","createWorktreeGit"],"sources":["../src/exports/hubApi.ts"],"sourcesContent":["import type { DoomApi, DoomApiContext, DoomApiHandler } from '@agimon-ai/doompi-extension-contracts/package-api';\nimport { createWorktreeGit } from '../adapters/worktree/gitCli.ts';\nimport { createWorktreeOperations } from '../adapters/worktree/worktreeOperations.ts';\nimport { DoomGitExpectedError } from '../services/support/errors.ts';\n\n/**\n * The worktree surface the cockpit panel calls.\n *\n * Hub-scoped because worktrees are a property of a repository, not of one\n * session: the panel lists and creates them whether or not the session that\n * made them is focused, and a session-scoped API would disappear with it.\n *\n * The panel names a repository by the hub's opaque id and never by path.\n * `resolveRepository` turns that into an admitted root, so a browser cannot\n * point this at a directory the cockpit was never given.\n */\nfunction badRequest(message: string): Response {\n return Response.json({ error: message }, { status: 400 });\n}\n\nfunction failed(error: unknown): Response {\n if (error instanceof DoomGitExpectedError) {\n return Response.json({ error: error.message, code: error.code }, { status: error.retryable ? 503 : 409 });\n }\n // Never the raw message: a git failure can carry a remote URL with a token.\n return Response.json({ error: 'The worktree operation failed.' }, { status: 500 });\n}\n\nexport const api: DoomApi = {\n basePath: 'git',\n start(context: DoomApiContext): DoomApiHandler {\n const operations = createWorktreeOperations({ git: createWorktreeGit() });\n\n /** The admitted root for a request, or a response explaining why not. */\n const rootOf = (url: URL): string | Response => {\n const repositoryId = url.searchParams.get('repositoryId');\n if (repositoryId === null || repositoryId === '') return badRequest('A repositoryId is required.');\n const root = context.resolveRepository?.(repositoryId);\n if (root === undefined) return badRequest('That repository is not admitted to this cockpit.');\n return root;\n };\n\n return {\n async fetch(request) {\n const url = new URL(request.url);\n const root = rootOf(url);\n if (root instanceof Response) return root;\n // The operations layer works from a cwd, and an admitted repository\n // root is one.\n const callerContext = { cwd: root, sessionId: url.searchParams.get('sessionId') ?? '' };\n\n try {\n if (request.method === 'GET' && url.pathname === '/worktrees') {\n return Response.json({ worktrees: await operations.list(callerContext) });\n }\n if (request.method === 'POST' && url.pathname === '/worktrees') {\n const body = (await request.json()) as { branch?: string; baseRef?: string; name?: string };\n if (typeof body.branch !== 'string' || body.branch.trim() === '') {\n return badRequest('A branch is required.');\n }\n const record = await operations.spawn(callerContext, {\n branch: body.branch,\n ...(body.baseRef === undefined ? {} : { baseRef: body.baseRef }),\n ...(body.name === undefined ? {} : { name: body.name }),\n });\n return Response.json({ worktree: record }, { status: 201 });\n }\n const closing = /^\\/worktrees\\/([^/]+)$/u.exec(url.pathname);\n if (request.method === 'DELETE' && closing) {\n const record = await operations.close(\n callerContext,\n decodeURIComponent(String(closing[1])),\n url.searchParams.get('force') === 'true',\n );\n return Response.json({ worktree: record });\n }\n return Response.json({ error: 'No such worktree route.' }, { status: 404 });\n } catch (error) {\n context.onNotice(`worktree request failed: ${(error as Error).name}`);\n return failed(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AC5D,OAAO,EAAW,uBAAuB,EAE3C,IAAM,EAAS,MAAM,EAAW,MAAM,EAAe,CACnD,OAAQ,EAAK,OACb,GAAI,EAAK,UAAY,IAAA,GAAY,CAAC,EAAI,CAAE,QAAS,EAAK,OAAQ,EAC9D,GAAI,EAAK,OAAS,IAAA,GAAY,CAAC,EAAI,CAAE,KAAM,EAAK,IAAK,CACvD,CAAC,EACD,OAAO,SAAS,KAAK,CAAE,SAAU,CAAO,EAAG,CAAE,OAAQ,GAAI,CAAC,CAC5D,CACA,IAAM,EAAU,0BAA0B,KAAK,EAAI,QAAQ,EAC3D,GAAI,EAAQ,SAAW,UAAY,EAAS,CAC1C,IAAM,EAAS,MAAM,EAAW,MAC9B,EACA,mBAAmB,OAAO,EAAQ,EAAE,CAAC,EACrC,EAAI,aAAa,IAAI,OAAO,IAAM,MACpC,EACA,OAAO,SAAS,KAAK,CAAE,SAAU,CAAO,CAAC,CAC3C,CACA,OAAO,SAAS,KAAK,CAAE,MAAO,yBAA0B,EAAG,CAAE,OAAQ,GAAI,CAAC,CAC5E,OAAS,EAAO,CAEd,OADA,EAAQ,SAAS,4BAA6B,EAAgB,MAAM,EAC7D,EAAO,CAAK,CACrB,CACF,EACA,OAAQ,CAAC,CACX,CACF,CACF"}
package/dist/hubApi.d.cts DELETED
@@ -1,6 +0,0 @@
1
- import { DoomApi } from "@agimon-ai/doompi-extension-contracts/package-api";
2
- //#region src/exports/hubApi.d.ts
3
- declare const api: DoomApi;
4
- //#endregion
5
- export { api };
6
- //# sourceMappingURL=hubApi.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hubApi.d.cts","names":[],"sources":["../src/exports/hubApi.ts"],"mappings":";;cA4Ba,KAAK"}
package/dist/hubApi.d.mts DELETED
@@ -1,6 +0,0 @@
1
- import { DoomApi } from "@agimon-ai/doompi-extension-contracts/package-api";
2
- //#region src/exports/hubApi.d.ts
3
- declare const api: DoomApi;
4
- //#endregion
5
- export { api };
6
- //# sourceMappingURL=hubApi.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hubApi.d.mts","names":[],"sources":["../src/exports/hubApi.ts"],"mappings":";;cA4Ba,KAAK"}
package/dist/hubApi.mjs DELETED
@@ -1,2 +0,0 @@
1
- import{createWorktreeGit as e}from"./adapters/worktree/gitCli.mjs";import{DoomGitExpectedError as t}from"./services/support/errors.mjs";import{createWorktreeOperations as n}from"./adapters/worktree/worktreeOperations.mjs";function r(e){return Response.json({error:e},{status:400})}function i(e){return e instanceof t?Response.json({error:e.message,code:e.code},{status:e.retryable?503:409}):Response.json({error:`The worktree operation failed.`},{status:500})}const a={basePath:`git`,start(t){let a=n({git:e()}),o=e=>{let n=e.searchParams.get(`repositoryId`);if(n===null||n===``)return r(`A repositoryId is required.`);let i=t.resolveRepository?.(n);return i===void 0?r(`That repository is not admitted to this cockpit.`):i};return{async fetch(e){let n=new URL(e.url),s=o(n);if(s instanceof Response)return s;let c={cwd:s,sessionId:n.searchParams.get(`sessionId`)??``};try{if(e.method===`GET`&&n.pathname===`/worktrees`)return Response.json({worktrees:await a.list(c)});if(e.method===`POST`&&n.pathname===`/worktrees`){let t=await e.json();if(typeof t.branch!=`string`||t.branch.trim()===``)return r(`A branch is required.`);let n=await a.spawn(c,{branch:t.branch,...t.baseRef===void 0?{}:{baseRef:t.baseRef},...t.name===void 0?{}:{name:t.name}});return Response.json({worktree:n},{status:201})}let t=/^\/worktrees\/([^/]+)$/u.exec(n.pathname);if(e.method===`DELETE`&&t){let e=await a.close(c,decodeURIComponent(String(t[1])),n.searchParams.get(`force`)===`true`);return Response.json({worktree:e})}return Response.json({error:`No such worktree route.`},{status:404})}catch(e){return t.onNotice(`worktree request failed: ${e.name}`),i(e)}},close(){}}}};export{a as api};
2
- //# sourceMappingURL=hubApi.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hubApi.mjs","names":[],"sources":["../src/exports/hubApi.ts"],"sourcesContent":["import type { DoomApi, DoomApiContext, DoomApiHandler } from '@agimon-ai/doompi-extension-contracts/package-api';\nimport { createWorktreeGit } from '../adapters/worktree/gitCli.ts';\nimport { createWorktreeOperations } from '../adapters/worktree/worktreeOperations.ts';\nimport { DoomGitExpectedError } from '../services/support/errors.ts';\n\n/**\n * The worktree surface the cockpit panel calls.\n *\n * Hub-scoped because worktrees are a property of a repository, not of one\n * session: the panel lists and creates them whether or not the session that\n * made them is focused, and a session-scoped API would disappear with it.\n *\n * The panel names a repository by the hub's opaque id and never by path.\n * `resolveRepository` turns that into an admitted root, so a browser cannot\n * point this at a directory the cockpit was never given.\n */\nfunction badRequest(message: string): Response {\n return Response.json({ error: message }, { status: 400 });\n}\n\nfunction failed(error: unknown): Response {\n if (error instanceof DoomGitExpectedError) {\n return Response.json({ error: error.message, code: error.code }, { status: error.retryable ? 503 : 409 });\n }\n // Never the raw message: a git failure can carry a remote URL with a token.\n return Response.json({ error: 'The worktree operation failed.' }, { status: 500 });\n}\n\nexport const api: DoomApi = {\n basePath: 'git',\n start(context: DoomApiContext): DoomApiHandler {\n const operations = createWorktreeOperations({ git: createWorktreeGit() });\n\n /** The admitted root for a request, or a response explaining why not. */\n const rootOf = (url: URL): string | Response => {\n const repositoryId = url.searchParams.get('repositoryId');\n if (repositoryId === null || repositoryId === '') return badRequest('A repositoryId is required.');\n const root = context.resolveRepository?.(repositoryId);\n if (root === undefined) return badRequest('That repository is not admitted to this cockpit.');\n return root;\n };\n\n return {\n async fetch(request) {\n const url = new URL(request.url);\n const root = rootOf(url);\n if (root instanceof Response) return root;\n // The operations layer works from a cwd, and an admitted repository\n // root is one.\n const callerContext = { cwd: root, sessionId: url.searchParams.get('sessionId') ?? '' };\n\n try {\n if (request.method === 'GET' && url.pathname === '/worktrees') {\n return Response.json({ worktrees: await operations.list(callerContext) });\n }\n if (request.method === 'POST' && url.pathname === '/worktrees') {\n const body = (await request.json()) as { branch?: string; baseRef?: string; name?: string };\n if (typeof body.branch !== 'string' || body.branch.trim() === '') {\n return badRequest('A branch is required.');\n }\n const record = await operations.spawn(callerContext, {\n branch: body.branch,\n ...(body.baseRef === undefined ? {} : { baseRef: body.baseRef }),\n ...(body.name === undefined ? {} : { name: body.name }),\n });\n return Response.json({ worktree: record }, { status: 201 });\n }\n const closing = /^\\/worktrees\\/([^/]+)$/u.exec(url.pathname);\n if (request.method === 'DELETE' && closing) {\n const record = await operations.close(\n callerContext,\n decodeURIComponent(String(closing[1])),\n url.searchParams.get('force') === 'true',\n );\n return Response.json({ worktree: record });\n }\n return Response.json({ error: 'No such worktree route.' }, { status: 404 });\n } catch (error) {\n context.onNotice(`worktree request failed: ${(error as Error).name}`);\n return failed(error);\n }\n },\n close() {},\n };\n },\n};\n"],"mappings":"8NAgBA,SAAS,EAAW,EAA2B,CAC7C,OAAO,SAAS,KAAK,CAAE,MAAO,CAAQ,EAAG,CAAE,OAAQ,GAAI,CAAC,CAC1D,CAEA,SAAS,EAAO,EAA0B,CAKxC,OAJI,aAAiB,EACZ,SAAS,KAAK,CAAE,MAAO,EAAM,QAAS,KAAM,EAAM,IAAK,EAAG,CAAE,OAAQ,EAAM,UAAY,IAAM,GAAI,CAAC,EAGnG,SAAS,KAAK,CAAE,MAAO,gCAAiC,EAAG,CAAE,OAAQ,GAAI,CAAC,CACnF,CAEA,MAAa,EAAe,CAC1B,SAAU,MACV,MAAM,EAAyC,CAC7C,IAAM,EAAa,EAAyB,CAAE,IAAK,EAAkB,CAAE,CAAC,EAGlE,EAAU,GAAgC,CAC9C,IAAM,EAAe,EAAI,aAAa,IAAI,cAAc,EACxD,GAAI,IAAiB,MAAQ,IAAiB,GAAI,OAAO,EAAW,6BAA6B,EACjG,IAAM,EAAO,EAAQ,oBAAoB,CAAY,EAErD,OADI,IAAS,IAAA,GAAkB,EAAW,kDAAkD,EACrF,CACT,EAEA,MAAO,CACL,MAAM,MAAM,EAAS,CACnB,IAAM,EAAM,IAAI,IAAI,EAAQ,GAAG,EACzB,EAAO,EAAO,CAAG,EACvB,GAAI,aAAgB,SAAU,OAAO,EA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ensionService.cjs"),t=require("./container/index.cjs"),n=require("./adapters/pi/extension.cjs");exports.DefaultGitExtensionService=e.DefaultGitExtensionService,exports.activateGitExtension=n.activateGitExtension,exports.createGitContainer=t.createGitContainer;
package/dist/index.d.cts DELETED
@@ -1,5 +0,0 @@
1
- import { GitExtensionDependencies, GitExtensionResult, GitExtensionService } from "./types/extension.cjs";
2
- import { activateGitExtension } from "./adapters/pi/extension.cjs";
3
- import { DefaultGitExtensionService } from "./services/extensionService.cjs";
4
- import { createGitContainer } from "./container/index.cjs";
5
- export { DefaultGitExtensionService, type GitExtensionDependencies, type GitExtensionResult, type GitExtensionService, activateGitExtension, createGitContainer };
package/dist/index.d.mts DELETED
@@ -1,5 +0,0 @@
1
- import { GitExtensionDependencies, GitExtensionResult, GitExtensionService } from "./types/extension.mjs";
2
- import { activateGitExtension } from "./adapters/pi/extension.mjs";
3
- import { DefaultGitExtensionService } from "./services/extensionService.mjs";
4
- import { createGitContainer } from "./container/index.mjs";
5
- export { DefaultGitExtensionService, type GitExtensionDependencies, type GitExtensionResult, type GitExtensionService, activateGitExtension, createGitContainer };
package/dist/index.mjs DELETED
@@ -1 +0,0 @@
1
- import{DefaultGitExtensionService as e}from"./services/extensionService.mjs";import{createGitContainer as t}from"./container/index.mjs";import{activateGitExtension as n}from"./adapters/pi/extension.mjs";export{e as DefaultGitExtensionService,n as activateGitExtension,t as createGitContainer};
@@ -1,2 +0,0 @@
1
- let e=require("typebox");const t={spawn_worktree:`spawn_worktree`,close_worktree:`close_worktree`,list:`list`,status:`status`,merge:`merge`,prune:`prune`,send:`send`,messages:`messages`},n={spawn_worktree:[`action`,`branch`,`baseRef`,`task`,`name`],close_worktree:[`action`,`id`,`force`],list:[`action`],status:[`action`,`id`],merge:[`action`,`id`,`message`],prune:[`action`,`dryRun`],send:[`action`,`id`,`message`],messages:[`action`,`id`]},r=e.Type.Object({action:e.Type.Literal(t.spawn_worktree),branch:e.Type.String({minLength:1}),baseRef:e.Type.Optional(e.Type.String({minLength:1})),task:e.Type.Optional(e.Type.String({minLength:1})),name:e.Type.Optional(e.Type.String({minLength:1}))},{additionalProperties:!1}),i=e.Type.Object({action:e.Type.Literal(t.close_worktree),id:e.Type.String({minLength:1}),force:e.Type.Optional(e.Type.Boolean())},{additionalProperties:!1}),a=e.Type.Object({action:e.Type.Literal(t.list)},{additionalProperties:!1}),o=e.Type.Object({action:e.Type.Literal(t.status),id:e.Type.String({minLength:1})},{additionalProperties:!1}),s=e.Type.Object({action:e.Type.Literal(t.merge),id:e.Type.String({minLength:1}),message:e.Type.Optional(e.Type.String({minLength:1}))},{additionalProperties:!1}),c=e.Type.Object({action:e.Type.Literal(t.prune),dryRun:e.Type.Optional(e.Type.Boolean())},{additionalProperties:!1}),l=e.Type.Object({action:e.Type.Literal(t.send),id:e.Type.String({minLength:1}),message:e.Type.String({minLength:1})},{additionalProperties:!1}),u=e.Type.Object({action:e.Type.Literal(t.messages),id:e.Type.String({minLength:1})},{additionalProperties:!1}),d=e.Type.Union([r,i,a,o,s,c,l,u]);exports.RunWorktreeParams=d,exports.WORKTREE_ACTIONS=t,exports.WORKTREE_ACTION_FIELDS=n;
2
- //# sourceMappingURL=runWorktreeTool.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"runWorktreeTool.cjs","names":["Type"],"sources":["../../src/schemas/runWorktreeTool.ts"],"sourcesContent":["import { type Static, Type } from 'typebox';\n\n/**\n * The tool's action vocabulary.\n *\n * One tool with an action field rather than six tools, matching `subagent`:\n * the actions share a subject and are meaningless apart from it, and six\n * separate tools would spend six description budgets teaching the same nouns.\n */\nexport const WORKTREE_ACTIONS = {\n spawn_worktree: 'spawn_worktree',\n close_worktree: 'close_worktree',\n list: 'list',\n status: 'status',\n merge: 'merge',\n prune: 'prune',\n send: 'send',\n messages: 'messages',\n} as const;\n\nexport type WorktreeAction = (typeof WORKTREE_ACTIONS)[keyof typeof WORKTREE_ACTIONS];\n\n/**\n * Which fields each action accepts.\n *\n * Rejecting an unknown field is what stops a plausible-looking call from doing\n * something other than what it reads like: `close_worktree` with `branch`\n * instead of `id` would otherwise close whatever the default resolved to.\n */\nexport const WORKTREE_ACTION_FIELDS: Record<WorktreeAction, readonly string[]> = {\n spawn_worktree: ['action', 'branch', 'baseRef', 'task', 'name'],\n close_worktree: ['action', 'id', 'force'],\n list: ['action'],\n status: ['action', 'id'],\n merge: ['action', 'id', 'message'],\n prune: ['action', 'dryRun'],\n send: ['action', 'id', 'message'],\n messages: ['action', 'id'],\n};\n\nconst SpawnParams = Type.Object(\n {\n action: Type.Literal(WORKTREE_ACTIONS.spawn_worktree),\n branch: Type.String({ minLength: 1 }),\n baseRef: Type.Optional(Type.String({ minLength: 1 })),\n task: Type.Optional(Type.String({ minLength: 1 })),\n name: Type.Optional(Type.String({ minLength: 1 })),\n },\n { additionalProperties: false },\n);\n\nconst CloseParams = Type.Object(\n {\n action: Type.Literal(WORKTREE_ACTIONS.close_worktree),\n id: Type.String({ minLength: 1 }),\n force: Type.Optional(Type.Boolean()),\n },\n { additionalProperties: false },\n);\n\nconst ListParams = Type.Object({ action: Type.Literal(WORKTREE_ACTIONS.list) }, { additionalProperties: false });\n\nconst StatusParams = Type.Object(\n { action: Type.Literal(WORKTREE_ACTIONS.status), id: Type.String({ minLength: 1 }) },\n { additionalProperties: false },\n);\n\nconst MergeParams = Type.Object(\n {\n action: Type.Literal(WORKTREE_ACTIONS.merge),\n id: Type.String({ minLength: 1 }),\n message: Type.Optional(Type.String({ minLength: 1 })),\n },\n { additionalProperties: false },\n);\n\nconst PruneParams = Type.Object(\n { action: Type.Literal(WORKTREE_ACTIONS.prune), dryRun: Type.Optional(Type.Boolean()) },\n { additionalProperties: false },\n);\n\nconst SendParams = Type.Object(\n {\n action: Type.Literal(WORKTREE_ACTIONS.send),\n id: Type.String({ minLength: 1 }),\n message: Type.String({ minLength: 1 }),\n },\n { additionalProperties: false },\n);\n\nconst MessagesParams = Type.Object(\n { action: Type.Literal(WORKTREE_ACTIONS.messages), id: Type.String({ minLength: 1 }) },\n { additionalProperties: false },\n);\n\nexport const RunWorktreeParams = Type.Union([\n SpawnParams,\n CloseParams,\n ListParams,\n StatusParams,\n MergeParams,\n PruneParams,\n SendParams,\n MessagesParams,\n]);\n\nexport type RunWorktreeToolParams = Static<typeof RunWorktreeParams>;\n"],"mappings":"yBASA,MAAa,EAAmB,CAC9B,eAAgB,iBAChB,eAAgB,iBAChB,KAAM,OACN,OAAQ,SACR,MAAO,QACP,MAAO,QACP,KAAM,OACN,SAAU,UACZ,EAWa,EAAoE,CAC/E,eAAgB,CAAC,SAAU,SAAU,UAAW,OAAQ,MAAM,EAC9D,eAAgB,CAAC,SAAU,KAAM,OAAO,EACxC,KAAM,CAAC,QAAQ,EACf,OAAQ,CAAC,SAAU,IAAI,EACvB,MAAO,CAAC,SAAU,KAAM,SAAS,EACjC,MAAO,CAAC,SAAU,QAAQ,EAC1B,KAAM,CAAC,SAAU,KAAM,SAAS,EAChC,SAAU,CAAC,SAAU,IAAI,CAC3B,EAEM,EAAcA,EAAAA,KAAK,OACvB,CACE,OAAQA,EAAAA,KAAK,QAAQ,EAAiB,cAAc,EACpD,OAAQA,EAAAA,KAAK,OAAO,CAAE,UAAW,CAAE,CAAC,EACpC,QAASA,EAAAA,KAAK,SAASA,EAAAA,KAAK,OAAO,CAAE,UAAW,CAAE,CAAC,CAAC,EACpD,KAAMA,EAAAA,KAAK,SAASA,EAAAA,KAAK,OAAO,CAAE,UAAW,CAAE,CAAC,CAAC,EACjD,KAAMA,EAAAA,KAAK,SAASA,EAAAA,KAAK,OAAO,CAAE,UAAW,CAAE,CAAC,CAAC,CACnD,EACA,CAAE,qBAAsB,EAAM,CAChC,EAEM,EAAcA,EAAAA,KAAK,OACvB,CACE,OAAQA,EAAAA,KAAK,QAAQ,EAAiB,cAAc,EACpD,GAAIA,EAAAA,KAAK,OAAO,CAAE,UAAW,CAAE,CAAC,EAChC,MAAOA,EAAAA,KAAK,SAASA,EAAAA,KAAK,QAAQ,CAAC,C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EACA,EACA,CACF,CAAC"}
@@ -1,2 +0,0 @@
1
- import{Type as e}from"typebox";const t={spawn_worktree:`spawn_worktree`,close_worktree:`close_worktree`,list:`list`,status:`status`,merge:`merge`,prune:`prune`,send:`send`,messages:`messages`},n={spawn_worktree:[`action`,`branch`,`baseRef`,`task`,`name`],close_worktree:[`action`,`id`,`force`],list:[`action`],status:[`action`,`id`],merge:[`action`,`id`,`message`],prune:[`action`,`dryRun`],send:[`action`,`id`,`message`],messages:[`action`,`id`]},r=e.Object({action:e.Literal(t.spawn_worktree),branch:e.String({minLength:1}),baseRef:e.Optional(e.String({minLength:1})),task:e.Optional(e.String({minLength:1})),name:e.Optional(e.String({minLength:1}))},{additionalProperties:!1}),i=e.Object({action:e.Literal(t.close_worktree),id:e.String({minLength:1}),force:e.Optional(e.Boolean())},{additionalProperties:!1}),a=e.Object({action:e.Literal(t.list)},{additionalProperties:!1}),o=e.Object({action:e.Literal(t.status),id:e.String({minLength:1})},{additionalProperties:!1}),s=e.Object({action:e.Literal(t.merge),id:e.String({minLength:1}),message:e.Optional(e.String({minLength:1}))},{additionalProperties:!1}),c=e.Object({action:e.Literal(t.prune),dryRun:e.Optional(e.Boolean())},{additionalProperties:!1}),l=e.Object({action:e.Literal(t.send),id:e.String({minLength:1}),message:e.String({minLength:1})},{additionalProperties:!1}),u=e.Object({action:e.Literal(t.messages),id:e.String({minLength:1})},{additionalProperties:!1}),d=e.Union([r,i,a,o,s,c,l,u]);export{d as RunWorktreeParams,t as WORKTREE_ACTIONS,n as WORKTREE_ACTION_FIELDS};
2
- //# sourceMappingURL=runWorktreeTool.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"runWorktreeTool.mjs","names":[],"sources":["../../src/schemas/runWorktreeTool.ts"],"sourcesContent":["import { type Static, Type } from 'typebox';\n\n/**\n * The tool's action vocabulary.\n *\n * One tool with an action field rather than six tools, matching `subagent`:\n * the actions share a subject and are meaningless apart from it, and six\n * separate tools would spend six description budgets teaching the same nouns.\n */\nexport const WORKTREE_ACTIONS = {\n spawn_worktree: 'spawn_worktree',\n close_worktree: 'close_worktree',\n list: 'list',\n status: 'status',\n merge: 'merge',\n prune: 'prune',\n send: 'send',\n messages: 'messages',\n} as const;\n\nexport type WorktreeAction = (typeof WORKTREE_ACTIONS)[keyof typeof WORKTREE_ACTIONS];\n\n/**\n * Which fields each action accepts.\n *\n * Rejecting an unknown field is what stops a plausible-looking call from doing\n * something other than what it reads like: `close_worktree` with `branch`\n * instead of `id` would otherwise close whatever the default resolved to.\n */\nexport const WORKTREE_ACTION_FIELDS: Record<WorktreeAction, readonly string[]> = {\n spawn_worktree: ['action', 'branch', 'baseRef', 'task', 'name'],\n close_worktree: ['action', 'id', 'force'],\n list: ['action'],\n status: ['action', 'id'],\n merge: ['action', 'id', 'message'],\n prune: ['action', 'dryRun'],\n send: ['action', 'id', 'message'],\n messages: ['action', 'id'],\n};\n\nconst SpawnParams = Type.Object(\n {\n action: Type.Literal(WORKTREE_ACTIONS.spawn_worktree),\n branch: Type.String({ minLength: 1 }),\n baseRef: Type.Optional(Type.String({ minLength: 1 })),\n task: Type.Optional(Type.String({ minLength: 1 })),\n name: Type.Optional(Type.String({ minLength: 1 })),\n },\n { additionalProperties: false },\n);\n\nconst CloseParams = Type.Object(\n {\n action: Type.Literal(WORKTREE_ACTIONS.close_worktree),\n id: Type.String({ minLength: 1 }),\n force: Type.Optional(Type.Boolean()),\n },\n { additionalProperties: false },\n);\n\nconst ListParams = Type.Object({ action: Type.Literal(WORKTREE_ACTIONS.list) }, { additionalProperties: false });\n\nconst StatusParams = Type.Object(\n { action: Type.Literal(WORKTREE_ACTIONS.status), id: Type.String({ minLength: 1 }) },\n { additionalProperties: false },\n);\n\nconst MergeParams = Type.Object(\n {\n action: Type.Literal(WORKTREE_ACTIONS.merge),\n id: Type.String({ minLength: 1 }),\n message: Type.Optional(Type.String({ minLength: 1 })),\n },\n { additionalProperties: false },\n);\n\nconst PruneParams = Type.Object(\n { action: Type.Literal(WORKTREE_ACTIONS.prune), dryRun: Type.Optional(Type.Boolean()) },\n { additionalProperties: false },\n);\n\nconst SendParams = Type.Object(\n {\n action: Type.Literal(WORKTREE_ACTIONS.send),\n id: Type.String({ minLength: 1 }),\n message: Type.String({ minLength: 1 }),\n },\n { additionalProperties: false },\n);\n\nconst MessagesParams = Type.Object(\n { action: Type.Literal(WORKTREE_ACTIONS.messages), id: Type.String({ minLength: 1 }) },\n { additionalProperties: false },\n);\n\nexport const RunWorktreeParams = Type.Union([\n SpawnParams,\n CloseParams,\n ListParams,\n StatusParams,\n MergeParams,\n PruneParams,\n SendParams,\n MessagesParams,\n]);\n\nexport type RunWorktreeToolParams = Static<typeof RunWorktreeParams>;\n"],"mappings":"+BASA,MAAa,EAAmB,CAC9B,eAAgB,iBAChB,eAAgB,iBAChB,KAAM,OACN,OAAQ,SACR,MAAO,QACP,MAAO,QACP,KAAM,OACN,SAAU,UACZ,EAWa,EAAoE,CAC/E,eAAgB,CAAC,SAAU,SAAU,UAAW,OAAQ,MAAM,EAC9D,eAAgB,CAAC,SAAU,KAAM,OAAO,EACxC,KAAM,CAAC,QAAQ,EACf,OAAQ,CAAC,SAAU,IAAI,EACvB,MAAO,CAAC,SAAU,KAAM,SAAS,EACjC,MAAO,CAAC,SAAU,QAAQ,EAC1B,KAAM,CAAC,SAAU,KAAM,SAAS,EAChC,SAAU,CAAC,SAAU,IAAI,CAC3B,EAEM,EAAc,EAAK,OACvB,CACE,OAAQ,EAAK,QAAQ,EAAiB,cAAc,EACpD,OAAQ,EAAK,OAAO,CAAE,UAAW,CAAE,CAAC,EACpC,QAAS,EAAK,SAAS,EAAK,OAAO,CAAE,UAAW,CAAE,CAAC,CAAC,EACpD,KAAM,EAAK,SAAS,EAAK,OAAO,CAAE,UAAW,CAAE,CAAC,CAAC,EACjD,KAAM,EAAK,SAAS,EAAK,OAAO,CAAE,UAAW,CAAE,CAAC,CAAC,CACnD,EACA,CAAE,qBAAsB,EAAM,CAChC,EAEM,EAAc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1,2 +0,0 @@
1
- var e=class{async execute(){return{message:`Show git worktrees owned by this session`,level:`info`}}};exports.DefaultGitExtensionService=e;
2
- //# sourceMappingURL=extensionService.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"extensionService.cjs","names":[],"sources":["../../src/services/extensionService.ts"],"sourcesContent":["// @scaffold-generated\nimport type { GitExtensionResult, GitExtensionService } from '../types/extension.ts';\n\nexport class DefaultGitExtensionService implements GitExtensionService {\n async execute(): Promise<GitExtensionResult> {\n return { message: 'Show git worktrees owned by this session', level: 'info' };\n }\n}\n"],"mappings":"AAGA,IAAa,EAAb,KAAuE,CACrE,MAAM,SAAuC,CAC3C,MAAO,CAAE,QAAS,2CAA4C,MAAO,MAAO,CAC9E,CACF"}
@@ -1,8 +0,0 @@
1
- import { GitExtensionResult, GitExtensionService } from "../types/extension.cjs";
2
- //#region src/services/extensionService.d.ts
3
- declare class DefaultGitExtensionService implements GitExtensionService {
4
- execute(): Promise<GitExtensionResult>;
5
- }
6
- //#endregion
7
- export { DefaultGitExtensionService };
8
- //# sourceMappingURL=extensionService.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"extensionService.d.cts","names":[],"sources":["../../src/services/extensionService.ts"],"mappings":";;cAGa,sCAAsC;EAC3C,WAAW,QAAQ"}
@@ -1,8 +0,0 @@
1
- import { GitExtensionResult, GitExtensionService } from "../types/extension.mjs";
2
- //#region src/services/extensionService.d.ts
3
- declare class DefaultGitExtensionService implements GitExtensionService {
4
- execute(): Promise<GitExtensionResult>;
5
- }
6
- //#endregion
7
- export { DefaultGitExtensionService };
8
- //# sourceMappingURL=extensionService.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"extensionService.d.mts","names":[],"sources":["../../src/services/extensionService.ts"],"mappings":";;cAGa,sCAAsC;EAC3C,WAAW,QAAQ"}
@@ -1,2 +0,0 @@
1
- var e=class{async execute(){return{message:`Show git worktrees owned by this session`,level:`info`}}};export{e as DefaultGitExtensionService};
2
- //# sourceMappingURL=extensionService.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"extensionService.mjs","names":[],"sources":["../../src/services/extensionService.ts"],"sourcesContent":["// @scaffold-generated\nimport type { GitExtensionResult, GitExtensionService } from '../types/extension.ts';\n\nexport class DefaultGitExtensionService implements GitExtensionService {\n async execute(): Promise<GitExtensionResult> {\n return { message: 'Show git worktrees owned by this session', level: 'info' };\n }\n}\n"],"mappings":"AAGA,IAAa,EAAb,KAAuE,CACrE,MAAM,SAAuC,CAC3C,MAAO,CAAE,QAAS,2CAA4C,MAAO,MAAO,CAC9E,CACF"}
@@ -1,2 +0,0 @@
1
- var e=class extends Error{code;retryable;recovery;constructor(e,t,n,r){super(`[${e}] ${t}\nRecovery: ${r}`),this.code=e,this.retryable=n,this.recovery=r,this.name=`DoomGitExpectedError`}};function t(t,n){return new e(`invalid_request`,t,!1,n)}exports.DoomGitExpectedError=e,exports.invalidRequest=t;
2
- //# sourceMappingURL=errors.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors.cjs","names":[],"sources":["../../../src/services/support/errors.ts"],"sourcesContent":["/**\n * Expected failures, kept private to this package.\n *\n * `@agimon-ai/doompi-extension-contracts` does not export `invalidRequest` or\n * an expected-error base, so this mirrors doompi-team's shape rather than\n * reaching across a layer boundary for it. The duplication is deliberate and\n * small; a shared helper would be the better answer only once a third package\n * needs one.\n */\n\nexport type DoomGitErrorCode =\n | 'invalid_request'\n | 'not_a_repository'\n | 'worktree_exists'\n | 'worktree_not_found'\n | 'worktree_not_owned'\n | 'worktree_dirty'\n | 'hub_unavailable'\n | 'install_failed'\n | 'git_failed';\n\nexport class DoomGitExpectedError extends Error {\n constructor(\n readonly code: DoomGitErrorCode,\n message: string,\n readonly retryable: boolean,\n readonly recovery: string,\n ) {\n // The recovery line rides in the message because a tool result is read as\n // text: an error the model cannot act on costs a turn to rediscover.\n super(`[${code}] ${message}\\nRecovery: ${recovery}`);\n this.name = 'DoomGitExpectedError';\n }\n}\n\nexport function invalidRequest(message: string, recovery: string): DoomGitExpectedError {\n return new DoomGitExpectedError('invalid_request', message, false, recovery);\n}\n"],"mappings":"AAqBA,IAAa,EAAb,cAA0C,KAAM,CAEnC,KAEA,UACA,SAJX,YACE,EACA,EACA,EACA,EACA,CAGA,MAAM,IAAI,EAAK,IAAI,EAAQ,cAAc,GAAU,EAP1C,KAAA,KAAA,EAEA,KAAA,UAAA,EACA,KAAA,SAAA,EAKT,KAAK,KAAO,sBACd,CACF,EAEA,SAAgB,EAAe,EAAiB,EAAwC,CACtF,OAAO,IAAI,EAAqB,kBAAmB,EAAS,GAAO,CAAQ,CAC7E"}
@@ -1,2 +0,0 @@
1
- var e=class extends Error{code;retryable;recovery;constructor(e,t,n,r){super(`[${e}] ${t}\nRecovery: ${r}`),this.code=e,this.retryable=n,this.recovery=r,this.name=`DoomGitExpectedError`}};function t(t,n){return new e(`invalid_request`,t,!1,n)}export{e as DoomGitExpectedError,t as invalidRequest};
2
- //# sourceMappingURL=errors.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors.mjs","names":[],"sources":["../../../src/services/support/errors.ts"],"sourcesContent":["/**\n * Expected failures, kept private to this package.\n *\n * `@agimon-ai/doompi-extension-contracts` does not export `invalidRequest` or\n * an expected-error base, so this mirrors doompi-team's shape rather than\n * reaching across a layer boundary for it. The duplication is deliberate and\n * small; a shared helper would be the better answer only once a third package\n * needs one.\n */\n\nexport type DoomGitErrorCode =\n | 'invalid_request'\n | 'not_a_repository'\n | 'worktree_exists'\n | 'worktree_not_found'\n | 'worktree_not_owned'\n | 'worktree_dirty'\n | 'hub_unavailable'\n | 'install_failed'\n | 'git_failed';\n\nexport class DoomGitExpectedError extends Error {\n constructor(\n readonly code: DoomGitErrorCode,\n message: string,\n readonly retryable: boolean,\n readonly recovery: string,\n ) {\n // The recovery line rides in the message because a tool result is read as\n // text: an error the model cannot act on costs a turn to rediscover.\n super(`[${code}] ${message}\\nRecovery: ${recovery}`);\n this.name = 'DoomGitExpectedError';\n }\n}\n\nexport function invalidRequest(message: string, recovery: string): DoomGitExpectedError {\n return new DoomGitExpectedError('invalid_request', message, false, recovery);\n}\n"],"mappings":"AAqBA,IAAa,EAAb,cAA0C,KAAM,CAEnC,KAEA,UACA,SAJX,YACE,EACA,EACA,EACA,EACA,CAGA,MAAM,IAAI,EAAK,IAAI,EAAQ,cAAc,GAAU,EAP1C,KAAA,KAAA,EAEA,KAAA,UAAA,EACA,KAAA,SAAA,EAKT,KAAK,KAAO,sBACd,CACF,EAEA,SAAgB,EAAe,EAAiB,EAAwC,CACtF,OAAO,IAAI,EAAqB,kBAAmB,EAAS,GAAO,CAAQ,CAC7E"}
@@ -1,2 +0,0 @@
1
- function e(e){let t=e.toLowerCase().replace(/[^a-z0-9]+/gu,`-`).replace(/^-+|-+$/gu,``).slice(0,64).replace(/-+$/gu,``);return t===``?`worktree`:t}function t(t){let n=`${t.repositoryLabel}--${t.repositoryId}`;return`${t.worktreesRoot}/${n}/${e(t.branch)}--${t.shortId}`}function n(e){if(e.branch.trim()===``)return`A branch name is required.`;let t=e.existing.find(t=>t.branch===e.branch&&t.status!==`orphaned`);if(t)return`Branch ${e.branch} already has a worktree (${t.id}).`}function r(e){if(!e.record)return`No worktree with that id. Call list to see the current ids.`;if(e.dirtyFiles.length===0||e.force)return;let t=e.dirtyFiles.slice(0,10).join(`, `),n=e.dirtyFiles.length>10?`, and ${String(e.dirtyFiles.length-10)} more`:``;return`${String(e.dirtyFiles.length)} uncommitted file(s): ${t}${n}. Pass force: true to discard them.`}function i(e,t){let n=[];return{records:e.map(e=>e.status===`orphaned`||t.exists(e.path)&&t.alive(e)?e:(n.push(e.id),{...e,status:`orphaned`})),changed:n}}function a(e){let t={remove:[],forget:[],untracked:[],keptDirty:[]},n=new Set(e.records.map(e=>e.path)),r=new Set(e.gitPaths);for(let n of e.records)if(n.status===`orphaned`){if(!r.has(n.path)){t.forget.push(n);continue}if((e.dirtyByPath.get(n.path)??[]).length>0){t.keptDirty.push(n);continue}t.remove.push(n)}for(let r of e.gitPaths)r.startsWith(`${e.worktreesRoot}/`)&&!n.has(r)&&t.untracked.push(r);return t}exports.branchSlug=e,exports.planPrune=a,exports.reconcile=i,exports.refuseClose=r,exports.refuseSpawn=n,exports.worktreeDirectory=t;
2
- //# sourceMappingURL=worktreeNaming.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"worktreeNaming.cjs","names":[],"sources":["../../src/services/worktreeNaming.ts"],"sourcesContent":["/**\n * Naming and reconciliation rules for worktrees, as pure functions.\n *\n * Everything here is a function of its arguments so the interesting decisions,\n * which are the ones about destroying work, can be tested without a repository\n * or a filesystem.\n */\n\nimport type { WorktreeRecord } from '../types/worktreeRegistry.ts';\n\nconst MAX_SLUG_LENGTH = 64;\n\n/**\n * A branch name reduced to one safe path segment.\n *\n * Slashes are the point: `wt/fix-auth` is a perfectly good branch and a\n * terrible directory name, because the nested directory it implies is not the\n * one the worktree lives in.\n */\nexport function branchSlug(branch: string): string {\n const slug = branch\n .toLowerCase()\n .replace(/[^a-z0-9]+/gu, '-')\n .replace(/^-+|-+$/gu, '')\n .slice(0, MAX_SLUG_LENGTH)\n .replace(/-+$/gu, '');\n return slug === '' ? 'worktree' : slug;\n}\n\n/**\n * The directory for one worktree.\n *\n * The short id disambiguates two branches whose slugs collide, such as\n * `feature/x` and `feature_x`, which would otherwise want the same directory.\n */\nexport function worktreeDirectory(input: {\n worktreesRoot: string;\n repositoryLabel: string;\n repositoryId: string;\n branch: string;\n shortId: string;\n}): string {\n const repository = `${input.repositoryLabel}--${input.repositoryId}`;\n return `${input.worktreesRoot}/${repository}/${branchSlug(input.branch)}--${input.shortId}`;\n}\n\n/** Why a worktree cannot be created, or undefined when it can. */\nexport function refuseSpawn(input: { branch: string; existing: readonly WorktreeRecord[] }): string | undefined {\n if (input.branch.trim() === '') return 'A branch name is required.';\n // Git refuses a second worktree on one branch, but its message names a path\n // the caller never chose, so this says it in the caller's own terms first.\n const live = input.existing.find((record) => record.branch === input.branch && record.status !== 'orphaned');\n if (live) return `Branch ${input.branch} already has a worktree (${live.id}).`;\n return undefined;\n}\n\n/** Why a worktree cannot be closed, or undefined when it can. */\nexport function refuseClose(input: {\n record: WorktreeRecord | undefined;\n dirtyFiles: readonly string[];\n force: boolean;\n}): string | undefined {\n if (!input.record) return 'No worktree with that id. Call list to see the current ids.';\n if (input.dirtyFiles.length === 0 || input.force) return undefined;\n // Naming the files is the point: \"the tree is dirty\" sends the reader to go\n // look, and the answer is usually a file they forgot rather than one they\n // meant to keep.\n const names = input.dirtyFiles.slice(0, 10).join(', ');\n const more = input.dirtyFiles.length > 10 ? `, and ${String(input.dirtyFiles.length - 10)} more` : '';\n return `${String(input.dirtyFiles.length)} uncommitted file(s): ${names}${more}. Pass force: true to discard them.`;\n}\n\nexport interface Reconciliation {\n records: WorktreeRecord[];\n /** Ids whose status changed, so a caller can report what it noticed. */\n changed: string[];\n}\n\n/**\n * Marks records whose process or directory is gone as orphaned.\n *\n * Nothing is deleted here. A doompi-git orphan owns a directory that may hold\n * uncommitted work, so losing the record would lose the only pointer to it.\n * Deletion is always a separate, named decision.\n */\nexport function reconcile(\n records: readonly WorktreeRecord[],\n probe: { alive: (record: WorktreeRecord) => boolean; exists: (path: string) => boolean },\n): Reconciliation {\n const changed: string[] = [];\n const next = records.map((record) => {\n if (record.status === 'orphaned') return record;\n const gone = !probe.exists(record.path) || !probe.alive(record);\n if (!gone) return record;\n changed.push(record.id);\n return { ...record, status: 'orphaned' as const };\n });\n return { records: next, changed };\n}\n\nexport interface PrunePlan {\n /** Orphans whose directory git still lists, safe to remove. */\n remove: WorktreeRecord[];\n /** Orphans whose directory is already gone; drop the record only. */\n forget: WorktreeRecord[];\n /** Paths git lists under our root that we have no record of; report, never touch. */\n untracked: string[];\n /** Orphans left alone because they still hold uncommitted work. */\n keptDirty: WorktreeRecord[];\n}\n\n/**\n * What a prune would do, decided before anything is destroyed.\n *\n * Separating the plan from the execution is what makes dryRun honest and lets\n * the destructive half be reviewed on its own.\n */\nexport function planPrune(input: {\n records: readonly WorktreeRecord[];\n gitPaths: readonly string[];\n worktreesRoot: string;\n dirtyByPath: ReadonlyMap<string, readonly string[]>;\n}): PrunePlan {\n const plan: PrunePlan = { remove: [], forget: [], untracked: [], keptDirty: [] };\n const known = new Set(input.records.map((record) => record.path));\n const listed = new Set(input.gitPaths);\n for (const record of input.records) {\n if (record.status !== 'orphaned') continue;\n if (!listed.has(record.path)) {\n plan.forget.push(record);\n continue;\n }\n if ((input.dirtyByPath.get(record.path) ?? []).length > 0) {\n plan.keptDirty.push(record);\n continue;\n }\n plan.remove.push(record);\n }\n for (const path of input.gitPaths) {\n // Only ever inside our own root: a worktree the user made by hand is none\n // of this package's business, even when it looks abandoned.\n if (path.startsWith(`${input.worktreesRoot}/`) && !known.has(path)) plan.untracked.push(path);\n }\n return plan;\n}\n"],"mappings":"AAmBA,SAAgB,EAAW,EAAwB,CACjD,IAAM,EAAO,EACV,YAAY,CAAC,CACb,QAAQ,eAAgB,GAAG,CAAC,CAC5B,QAAQ,YAAa,EAAE,CAAC,CACxB,MAAM,EAAG,EAAe,CAAC,CACzB,QAAQ,QAAS,EAAE,EACtB,OAAO,IAAS,GAAK,WAAa,CACpC,CAQA,SAAgB,EAAkB,EAMvB,CACT,IAAM,EAAa,GAAG,EAAM,gBAAgB,IAAI,EAAM,eACtD,MAAO,GAAG,EAAM,cAAc,GAAG,EAAW,GAAG,EAAW,EAAM,MAAM,EAAE,IAAI,EAAM,SACpF,CAGA,SAAgB,EAAY,EAAoF,CAC9G,GAAI,EAAM,OAAO,KAAK,IAAM,GAAI,MAAO,6BAGvC,IAAM,EAAO,EAAM,SAAS,KAAM,GAAW,EAAO,SAAW,EAAM,QAAU,EAAO,SAAW,UAAU,EAC3G,GAAI,EAAM,MAAO,UAAU,EAAM,OAAO,2BAA2B,EAAK,GAAG,GAE7E,CAGA,SAAgB,EAAY,EAIL,CACrB,GAAI,CAAC,EAAM,OAAQ,MAAO,8DAC1B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@ -1,27 +0,0 @@
1
- import { WorktreeRecord } from "../types/worktreeRegistry.cjs";
2
- //#region src/services/worktreeNaming.d.ts
3
- interface PrunePlan {
4
- /** Orphans whose directory git still lists, safe to remove. */
5
- remove: WorktreeRecord[];
6
- /** Orphans whose directory is already gone; drop the record only. */
7
- forget: WorktreeRecord[];
8
- /** Paths git lists under our root that we have no record of; report, never touch. */
9
- untracked: string[];
10
- /** Orphans left alone because they still hold uncommitted work. */
11
- keptDirty: WorktreeRecord[];
12
- }
13
- /**
14
- * What a prune would do, decided before anything is destroyed.
15
- *
16
- * Separating the plan from the execution is what makes dryRun honest and lets
17
- * the destructive half be reviewed on its own.
18
- */
19
- declare function planPrune(input: {
20
- records: readonly WorktreeRecord[];
21
- gitPaths: readonly string[];
22
- worktreesRoot: string;
23
- dirtyByPath: ReadonlyMap<string, readonly string[]>;
24
- }): PrunePlan;
25
- //#endregion
26
- export { PrunePlan, planPrune };
27
- //# sourceMappingURL=worktreeNaming.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"worktreeNaming.d.cts","names":[],"sources":["../../src/services/worktreeNaming.ts"],"mappings":";;UAoGiB;;EAEf,QAAQ;;EAER,QAAQ;;EAER;;EAEA,WAAW;;;;;;;;iBASG,UAAU;EACxB,kBAAkB;EAClB;EACA;EACA,aAAa;IACX"}
@@ -1,27 +0,0 @@
1
- import { WorktreeRecord } from "../types/worktreeRegistry.mjs";
2
- //#region src/services/worktreeNaming.d.ts
3
- interface PrunePlan {
4
- /** Orphans whose directory git still lists, safe to remove. */
5
- remove: WorktreeRecord[];
6
- /** Orphans whose directory is already gone; drop the record only. */
7
- forget: WorktreeRecord[];
8
- /** Paths git lists under our root that we have no record of; report, never touch. */
9
- untracked: string[];
10
- /** Orphans left alone because they still hold uncommitted work. */
11
- keptDirty: WorktreeRecord[];
12
- }
13
- /**
14
- * What a prune would do, decided before anything is destroyed.
15
- *
16
- * Separating the plan from the execution is what makes dryRun honest and lets
17
- * the destructive half be reviewed on its own.
18
- */
19
- declare function planPrune(input: {
20
- records: readonly WorktreeRecord[];
21
- gitPaths: readonly string[];
22
- worktreesRoot: string;
23
- dirtyByPath: ReadonlyMap<string, readonly string[]>;
24
- }): PrunePlan;
25
- //#endregion
26
- export { PrunePlan, planPrune };
27
- //# sourceMappingURL=worktreeNaming.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"worktreeNaming.d.mts","names":[],"sources":["../../src/services/worktreeNaming.ts"],"mappings":";;UAoGiB;;EAEf,QAAQ;;EAER,QAAQ;;EAER;;EAEA,WAAW;;;;;;;;iBASG,UAAU;EACxB,kBAAkB;EAClB;EACA;EACA,aAAa;IACX"}
@@ -1,2 +0,0 @@
1
- function e(e){let t=e.toLowerCase().replace(/[^a-z0-9]+/gu,`-`).replace(/^-+|-+$/gu,``).slice(0,64).replace(/-+$/gu,``);return t===``?`worktree`:t}function t(t){let n=`${t.repositoryLabel}--${t.repositoryId}`;return`${t.worktreesRoot}/${n}/${e(t.branch)}--${t.shortId}`}function n(e){if(e.branch.trim()===``)return`A branch name is required.`;let t=e.existing.find(t=>t.branch===e.branch&&t.status!==`orphaned`);if(t)return`Branch ${e.branch} already has a worktree (${t.id}).`}function r(e){if(!e.record)return`No worktree with that id. Call list to see the current ids.`;if(e.dirtyFiles.length===0||e.force)return;let t=e.dirtyFiles.slice(0,10).join(`, `),n=e.dirtyFiles.length>10?`, and ${String(e.dirtyFiles.length-10)} more`:``;return`${String(e.dirtyFiles.length)} uncommitted file(s): ${t}${n}. Pass force: true to discard them.`}function i(e,t){let n=[];return{records:e.map(e=>e.status===`orphaned`||t.exists(e.path)&&t.alive(e)?e:(n.push(e.id),{...e,status:`orphaned`})),changed:n}}function a(e){let t={remove:[],forget:[],untracked:[],keptDirty:[]},n=new Set(e.records.map(e=>e.path)),r=new Set(e.gitPaths);for(let n of e.records)if(n.status===`orphaned`){if(!r.has(n.path)){t.forget.push(n);continue}if((e.dirtyByPath.get(n.path)??[]).length>0){t.keptDirty.push(n);continue}t.remove.push(n)}for(let r of e.gitPaths)r.startsWith(`${e.worktreesRoot}/`)&&!n.has(r)&&t.untracked.push(r);return t}export{e as branchSlug,a as planPrune,i as reconcile,r as refuseClose,n as refuseSpawn,t as worktreeDirectory};
2
- //# sourceMappingURL=worktreeNaming.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"worktreeNaming.mjs","names":[],"sources":["../../src/services/worktreeNaming.ts"],"sourcesContent":["/**\n * Naming and reconciliation rules for worktrees, as pure functions.\n *\n * Everything here is a function of its arguments so the interesting decisions,\n * which are the ones about destroying work, can be tested without a repository\n * or a filesystem.\n */\n\nimport type { WorktreeRecord } from '../types/worktreeRegistry.ts';\n\nconst MAX_SLUG_LENGTH = 64;\n\n/**\n * A branch name reduced to one safe path segment.\n *\n * Slashes are the point: `wt/fix-auth` is a perfectly good branch and a\n * terrible directory name, because the nested directory it implies is not the\n * one the worktree lives in.\n */\nexport function branchSlug(branch: string): string {\n const slug = branch\n .toLowerCase()\n .replace(/[^a-z0-9]+/gu, '-')\n .replace(/^-+|-+$/gu, '')\n .slice(0, MAX_SLUG_LENGTH)\n .replace(/-+$/gu, '');\n return slug === '' ? 'worktree' : slug;\n}\n\n/**\n * The directory for one worktree.\n *\n * The short id disambiguates two branches whose slugs collide, such as\n * `feature/x` and `feature_x`, which would otherwise want the same directory.\n */\nexport function worktreeDirectory(input: {\n worktreesRoot: string;\n repositoryLabel: string;\n repositoryId: string;\n branch: string;\n shortId: string;\n}): string {\n const repository = `${input.repositoryLabel}--${input.repositoryId}`;\n return `${input.worktreesRoot}/${repository}/${branchSlug(input.branch)}--${input.shortId}`;\n}\n\n/** Why a worktree cannot be created, or undefined when it can. */\nexport function refuseSpawn(input: { branch: string; existing: readonly WorktreeRecord[] }): string | undefined {\n if (input.branch.trim() === '') return 'A branch name is required.';\n // Git refuses a second worktree on one branch, but its message names a path\n // the caller never chose, so this says it in the caller's own terms first.\n const live = input.existing.find((record) => record.branch === input.branch && record.status !== 'orphaned');\n if (live) return `Branch ${input.branch} already has a worktree (${live.id}).`;\n return undefined;\n}\n\n/** Why a worktree cannot be closed, or undefined when it can. */\nexport function refuseClose(input: {\n record: WorktreeRecord | undefined;\n dirtyFiles: readonly string[];\n force: boolean;\n}): string | undefined {\n if (!input.record) return 'No worktree with that id. Call list to see the current ids.';\n if (input.dirtyFiles.length === 0 || input.force) return undefined;\n // Naming the files is the point: \"the tree is dirty\" sends the reader to go\n // look, and the answer is usually a file they forgot rather than one they\n // meant to keep.\n const names = input.dirtyFiles.slice(0, 10).join(', ');\n const more = input.dirtyFiles.length > 10 ? `, and ${String(input.dirtyFiles.length - 10)} more` : '';\n return `${String(input.dirtyFiles.length)} uncommitted file(s): ${names}${more}. Pass force: true to discard them.`;\n}\n\nexport interface Reconciliation {\n records: WorktreeRecord[];\n /** Ids whose status changed, so a caller can report what it noticed. */\n changed: string[];\n}\n\n/**\n * Marks records whose process or directory is gone as orphaned.\n *\n * Nothing is deleted here. A doompi-git orphan owns a directory that may hold\n * uncommitted work, so losing the record would lose the only pointer to it.\n * Deletion is always a separate, named decision.\n */\nexport function reconcile(\n records: readonly WorktreeRecord[],\n probe: { alive: (record: WorktreeRecord) => boolean; exists: (path: string) => boolean },\n): Reconciliation {\n const changed: string[] = [];\n const next = records.map((record) => {\n if (record.status === 'orphaned') return record;\n const gone = !probe.exists(record.path) || !probe.alive(record);\n if (!gone) return record;\n changed.push(record.id);\n return { ...record, status: 'orphaned' as const };\n });\n return { records: next, changed };\n}\n\nexport interface PrunePlan {\n /** Orphans whose directory git still lists, safe to remove. */\n remove: WorktreeRecord[];\n /** Orphans whose directory is already gone; drop the record only. */\n forget: WorktreeRecord[];\n /** Paths git lists under our root that we have no record of; report, never touch. */\n untracked: string[];\n /** Orphans left alone because they still hold uncommitted work. */\n keptDirty: WorktreeRecord[];\n}\n\n/**\n * What a prune would do, decided before anything is destroyed.\n *\n * Separating the plan from the execution is what makes dryRun honest and lets\n * the destructive half be reviewed on its own.\n */\nexport function planPrune(input: {\n records: readonly WorktreeRecord[];\n gitPaths: readonly string[];\n worktreesRoot: string;\n dirtyByPath: ReadonlyMap<string, readonly string[]>;\n}): PrunePlan {\n const plan: PrunePlan = { remove: [], forget: [], untracked: [], keptDirty: [] };\n const known = new Set(input.records.map((record) => record.path));\n const listed = new Set(input.gitPaths);\n for (const record of input.records) {\n if (record.status !== 'orphaned') continue;\n if (!listed.has(record.path)) {\n plan.forget.push(record);\n continue;\n }\n if ((input.dirtyByPath.get(record.path) ?? []).length > 0) {\n plan.keptDirty.push(record);\n continue;\n }\n plan.remove.push(record);\n }\n for (const path of input.gitPaths) {\n // Only ever inside our own root: a worktree the user made by hand is none\n // of this package's business, even when it looks abandoned.\n if (path.startsWith(`${input.worktreesRoot}/`) && !known.has(path)) plan.untracked.push(path);\n }\n return plan;\n}\n"],"mappings":"AAmBA,SAAgB,EAAW,EAAwB,CACjD,IAAM,EAAO,EACV,YAAY,CAAC,CACb,QAAQ,eAAgB,GAAG,CAAC,CAC5B,QAAQ,YAAa,EAAE,CAAC,CACxB,MAAM,EAAG,EAAe,CAAC,CACzB,QAAQ,QAAS,EAAE,EACtB,OAAO,IAAS,GAAK,WAAa,CACpC,CAQA,SAAgB,EAAkB,EAMvB,CACT,IAAM,EAAa,GAAG,EAAM,gBAAgB,IAAI,EAAM,eACtD,MAAO,GAAG,EAAM,cAAc,GAAG,EAAW,GAAG,EAAW,EAAM,MAAM,EAAE,IAAI,EAAM,SACpF,CAGA,SAAgB,EAAY,EAAoF,CAC9G,GAAI,EAAM,OAAO,KAAK,IAAM,GAAI,MAAO,6BAGvC,IAAM,EAAO,EAAM,SAAS,KAAM,GAAW,EAAO,SAAW,EAAM,QAAU,EAAO,SAAW,UAAU,EAC3G,GAAI,EAAM,MAAO,UAAU,EAAM,OAAO,2BAA2B,EAAK,GAAG,GAE7E,CAGA,SAAgB,EAAY,EAIL,CACrB,GAAI,CAAC,EAAM,OAAQ,MAAO,8DAC1B,GAAI,EAAM,WAAW,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
- import { WorktreeOperations } from "../adapters/worktree/worktreeOperations.cjs";
2
- //#region src/types/extension.d.ts
3
- type GitNotificationLevel = 'info';
4
- interface GitExtensionResult {
5
- message: string;
6
- level: GitNotificationLevel;
7
- }
8
- interface GitExtensionService {
9
- execute(): Promise<GitExtensionResult>;
10
- }
11
- interface GitExtensionDependencies {
12
- service: GitExtensionService;
13
- operations: WorktreeOperations;
14
- }
15
- //#endregion
16
- export { GitExtensionDependencies, GitExtensionResult, GitExtensionService, GitNotificationLevel };
17
- //# sourceMappingURL=extension.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"extension.d.cts","names":[],"sources":["../../src/types/extension.ts"],"mappings":";;KAGY;UAEK;EACf;EACA,OAAO;;UAGQ;EACf,WAAW,QAAQ;;UAGJ;EACf,SAAS;EACT,YAAY"}
@@ -1,17 +0,0 @@
1
- import { WorktreeOperations } from "../adapters/worktree/worktreeOperations.mjs";
2
- //#region src/types/extension.d.ts
3
- type GitNotificationLevel = 'info';
4
- interface GitExtensionResult {
5
- message: string;
6
- level: GitNotificationLevel;
7
- }
8
- interface GitExtensionService {
9
- execute(): Promise<GitExtensionResult>;
10
- }
11
- interface GitExtensionDependencies {
12
- service: GitExtensionService;
13
- operations: WorktreeOperations;
14
- }
15
- //#endregion
16
- export { GitExtensionDependencies, GitExtensionResult, GitExtensionService, GitNotificationLevel };
17
- //# sourceMappingURL=extension.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"extension.d.mts","names":[],"sources":["../../src/types/extension.ts"],"mappings":";;KAGY;UAEK;EACf;EACA,OAAO;;UAGQ;EACf,WAAW,QAAQ;;UAGJ;EACf,SAAS;EACT,YAAY"}
@@ -1,2 +0,0 @@
1
- exports.GIT_WORKTREES_TYPE=`git_worktrees`;
2
- //# sourceMappingURL=webWorktrees.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"webWorktrees.cjs","names":[],"sources":["../../src/types/webWorktrees.ts"],"sourcesContent":["/**\n * The cockpit's view of this session's worktrees.\n *\n * DESIGN PATTERNS:\n * - Declarations only. The channel frame type is a constant so the hub and the\n * page cannot drift apart on a string.\n * - A view is the subset of a record the dock needs, not the record. The\n * registry may hold paths and provenance the page has no business rendering.\n *\n * AVOID:\n * - Adding behaviour here. This file is imported by browser code, so it must\n * stay free of node builtins.\n */\n\n/** The data channel carrying one session's worktrees to the page. */\nexport const GIT_WORKTREES_TYPE = 'git_worktrees';\n\n/** One worktree, as the activity dock and its panel render it. */\nexport interface WorktreeView {\n id: string;\n branch: string;\n path: string;\n /** The session the hub started for this worktree, when it is still live. */\n sessionId: string | null;\n /** True once the directory the record names has gone missing. */\n orphaned: boolean;\n /**\n * True when the session that asked for this worktree is gone.\n *\n * An owned worktree is only ever shown to its own session. This flag marks\n * the exception: once the parent is dead nobody would see the worktree at\n * all, so every session in the repository does, and may close it.\n */\n unowned: boolean;\n}\n\n/**\n * What the panel asks the hub channel to do.\n *\n * The dock acts through its own channel rather than through the agent: a\n * worktree made from the panel and one made by the tool take the same\n * `worktreeOperations` path, but the panel no longer has to spend a turn of\n * the conversation to get there.\n */\nexport type GitWorktreesCommand =\n | { action: 'create'; branch: string; baseRef?: string }\n | { action: 'close'; id: string; force?: boolean };\n\nexport interface GitWorktreesPayload {\n worktrees: WorktreeView[];\n /** Label of the operation in flight, absent when the session is idle. */\n pending?: string;\n /** The last failure, cleared when the next command starts. */\n error?: string;\n}\n"],"mappings":""}
@@ -1,2 +0,0 @@
1
- const e=`git_worktrees`;export{e as GIT_WORKTREES_TYPE};
2
- //# sourceMappingURL=webWorktrees.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"webWorktrees.mjs","names":[],"sources":["../../src/types/webWorktrees.ts"],"sourcesContent":["/**\n * The cockpit's view of this session's worktrees.\n *\n * DESIGN PATTERNS:\n * - Declarations only. The channel frame type is a constant so the hub and the\n * page cannot drift apart on a string.\n * - A view is the subset of a record the dock needs, not the record. The\n * registry may hold paths and provenance the page has no business rendering.\n *\n * AVOID:\n * - Adding behaviour here. This file is imported by browser code, so it must\n * stay free of node builtins.\n */\n\n/** The data channel carrying one session's worktrees to the page. */\nexport const GIT_WORKTREES_TYPE = 'git_worktrees';\n\n/** One worktree, as the activity dock and its panel render it. */\nexport interface WorktreeView {\n id: string;\n branch: string;\n path: string;\n /** The session the hub started for this worktree, when it is still live. */\n sessionId: string | null;\n /** True once the directory the record names has gone missing. */\n orphaned: boolean;\n /**\n * True when the session that asked for this worktree is gone.\n *\n * An owned worktree is only ever shown to its own session. This flag marks\n * the exception: once the parent is dead nobody would see the worktree at\n * all, so every session in the repository does, and may close it.\n */\n unowned: boolean;\n}\n\n/**\n * What the panel asks the hub channel to do.\n *\n * The dock acts through its own channel rather than through the agent: a\n * worktree made from the panel and one made by the tool take the same\n * `worktreeOperations` path, but the panel no longer has to spend a turn of\n * the conversation to get there.\n */\nexport type GitWorktreesCommand =\n | { action: 'create'; branch: string; baseRef?: string }\n | { action: 'close'; id: string; force?: boolean };\n\nexport interface GitWorktreesPayload {\n worktrees: WorktreeView[];\n /** Label of the operation in flight, absent when the session is idle. */\n pending?: string;\n /** The last failure, cleared when the next command starts. */\n error?: string;\n}\n"],"mappings":"AAeA,MAAa,EAAqB"}
@@ -1,41 +0,0 @@
1
- //#region src/types/worktreeRegistry.d.ts
2
- /**
3
- * The worktree registry: what this package knows about the worktrees it made.
4
- *
5
- * It deliberately does not mirror `git worktree list`. Git knows which
6
- * worktrees exist; only this registry knows which of them this package created,
7
- * which session runs in each, and which process to signal. Reconciling the two
8
- * is how orphans are found, so the two views are kept separate on purpose.
9
- */
10
- /**
11
- * A worktree's lifecycle as this package sees it.
12
- *
13
- * `orphaned` is a finding, not a cleanup: the session process is gone or the
14
- * directory has vanished, but the worktree may still hold uncommitted work, so
15
- * the record is kept until someone decides what to do with it.
16
- */
17
- type WorktreeStatus = 'spawning' | 'running' | 'closing' | 'orphaned';
18
- declare const WORKTREE_RECORD_VERSION = 1;
19
- interface WorktreeRecord {
20
- version: typeof WORKTREE_RECORD_VERSION;
21
- /** This registry's own id, distinct from the session id, and stable across restarts. */
22
- id: string;
23
- /** The branch checked out in the worktree. */
24
- branch: string;
25
- /** The ref the branch was created from, kept so a merge can name its base. */
26
- baseRef: string;
27
- /** Absolute path to the worktree directory. */
28
- path: string;
29
- /** Absolute path to the repository the worktree belongs to. */
30
- repositoryRoot: string;
31
- /** The session spawned into the worktree. */
32
- sessionId: string;
33
- /** The session that asked for the worktree; the rail nests one under the other. */
34
- parentSessionId: string;
35
- status: WorktreeStatus;
36
- /** ISO 8601. */
37
- createdAt: string;
38
- }
39
- //#endregion
40
- export { WORKTREE_RECORD_VERSION, WorktreeRecord, WorktreeStatus };
41
- //# sourceMappingURL=worktreeRegistry.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"worktreeRegistry.d.cts","names":[],"sources":["../../src/types/worktreeRegistry.ts"],"mappings":";;;;;;;;;;;;;;;;KAgBY;cAEC;UAEI;EACf,gBAAgB;;EAEhB;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;EACA,QAAQ;;EAER"}
@@ -1,41 +0,0 @@
1
- //#region src/types/worktreeRegistry.d.ts
2
- /**
3
- * The worktree registry: what this package knows about the worktrees it made.
4
- *
5
- * It deliberately does not mirror `git worktree list`. Git knows which
6
- * worktrees exist; only this registry knows which of them this package created,
7
- * which session runs in each, and which process to signal. Reconciling the two
8
- * is how orphans are found, so the two views are kept separate on purpose.
9
- */
10
- /**
11
- * A worktree's lifecycle as this package sees it.
12
- *
13
- * `orphaned` is a finding, not a cleanup: the session process is gone or the
14
- * directory has vanished, but the worktree may still hold uncommitted work, so
15
- * the record is kept until someone decides what to do with it.
16
- */
17
- type WorktreeStatus = 'spawning' | 'running' | 'closing' | 'orphaned';
18
- declare const WORKTREE_RECORD_VERSION = 1;
19
- interface WorktreeRecord {
20
- version: typeof WORKTREE_RECORD_VERSION;
21
- /** This registry's own id, distinct from the session id, and stable across restarts. */
22
- id: string;
23
- /** The branch checked out in the worktree. */
24
- branch: string;
25
- /** The ref the branch was created from, kept so a merge can name its base. */
26
- baseRef: string;
27
- /** Absolute path to the worktree directory. */
28
- path: string;
29
- /** Absolute path to the repository the worktree belongs to. */
30
- repositoryRoot: string;
31
- /** The session spawned into the worktree. */
32
- sessionId: string;
33
- /** The session that asked for the worktree; the rail nests one under the other. */
34
- parentSessionId: string;
35
- status: WorktreeStatus;
36
- /** ISO 8601. */
37
- createdAt: string;
38
- }
39
- //#endregion
40
- export { WORKTREE_RECORD_VERSION, WorktreeRecord, WorktreeStatus };
41
- //# sourceMappingURL=worktreeRegistry.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"worktreeRegistry.d.mts","names":[],"sources":["../../src/types/worktreeRegistry.ts"],"mappings":";;;;;;;;;;;;;;;;KAgBY;cAEC;UAEI;EACf,gBAAgB;;EAEhB;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;EACA,QAAQ;;EAER"}
package/dist/webHub.cjs DELETED
@@ -1 +0,0 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./adapters/web/worktreesChannel.cjs");exports.createWorktreesChannel=e.createWorktreesChannel,exports.webHubChannels=e.webHubChannels;
package/dist/webHub.d.cts DELETED
@@ -1,2 +0,0 @@
1
- import { createWorktreesChannel, webHubChannels } from "./adapters/web/worktreesChannel.cjs";
2
- export { createWorktreesChannel, webHubChannels };
package/dist/webHub.d.mts DELETED
@@ -1,2 +0,0 @@
1
- import { createWorktreesChannel, webHubChannels } from "./adapters/web/worktreesChannel.mjs";
2
- export { createWorktreesChannel, webHubChannels };
package/dist/webHub.mjs DELETED
@@ -1 +0,0 @@
1
- import{createWorktreesChannel as e,webHubChannels as t}from"./adapters/web/worktreesChannel.mjs";export{e as createWorktreesChannel,t as webHubChannels};
@@ -1 +0,0 @@
1
- export { webPlugin } from '../web/index.ts';