@agimon-ai/doompi-git 0.0.1-alpha.5 → 0.0.1-alpha.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -1
- package/dist/apiContracts.cjs +387 -0
- package/dist/apiContracts.cjs.map +1 -0
- package/dist/apiContracts.d.mts +53 -0
- package/dist/apiContracts.d.mts.map +1 -0
- package/dist/apiContracts.mjs +382 -0
- package/dist/apiContracts.mjs.map +1 -0
- package/dist/extensions/pi.cjs +105 -1
- package/dist/extensions/pi.cjs.map +1 -0
- package/dist/extensions/pi.d.mts +6 -2
- package/dist/extensions/pi.d.mts.map +1 -0
- package/dist/extensions/pi.mjs +100 -1
- package/dist/extensions/pi.mjs.map +1 -0
- package/dist/extensions/server.cjs +1828 -0
- package/dist/extensions/server.cjs.map +1 -0
- package/dist/extensions/server.d.mts +5 -0
- package/dist/extensions/server.d.mts.map +1 -0
- package/dist/extensions/server.mjs +1820 -0
- package/dist/extensions/server.mjs.map +1 -0
- package/dist/extensions/web.mjs +2639 -0
- package/dist/extensions/web.mjs.map +1 -0
- package/dist/gitDependencies-CtVubYvU.mjs +22 -0
- package/dist/gitDependencies-CtVubYvU.mjs.map +1 -0
- package/dist/gitDependencies-Dqsz2HjK.cjs +33 -0
- package/dist/gitDependencies-Dqsz2HjK.cjs.map +1 -0
- package/dist/index-D79MSCee.d.mts +145 -0
- package/dist/index-D79MSCee.d.mts.map +1 -0
- package/dist/index.cjs +4 -1
- package/dist/index.d.mts +2 -5
- package/dist/index.mjs +2 -1
- package/dist/runWorktree-BE795LxL.cjs +374 -0
- package/dist/runWorktree-BE795LxL.cjs.map +1 -0
- package/dist/runWorktree-SPzJvIBt.mjs +303 -0
- package/dist/runWorktree-SPzJvIBt.mjs.map +1 -0
- package/dist/worktreeOperations-BYmVU0UV.cjs +1350 -0
- package/dist/worktreeOperations-BYmVU0UV.cjs.map +1 -0
- package/dist/worktreeOperations-BrWG2muV.mjs +1194 -0
- package/dist/worktreeOperations-BrWG2muV.mjs.map +1 -0
- package/llms.txt +4 -0
- package/package.json +59 -44
- package/src/prompts/doompi-use-git/SKILL.md +21 -1
- package/dist/_virtual/_rolldown/runtime.cjs +0 -1
- package/dist/adapters/channel/worktreeChannel.cjs +0 -2
- package/dist/adapters/channel/worktreeChannel.cjs.map +0 -1
- package/dist/adapters/channel/worktreeChannel.d.cts +0 -40
- package/dist/adapters/channel/worktreeChannel.d.cts.map +0 -1
- package/dist/adapters/channel/worktreeChannel.d.mts +0 -40
- package/dist/adapters/channel/worktreeChannel.d.mts.map +0 -1
- package/dist/adapters/channel/worktreeChannel.mjs +0 -2
- package/dist/adapters/channel/worktreeChannel.mjs.map +0 -1
- package/dist/adapters/filesystem/atomicJson.cjs +0 -2
- package/dist/adapters/filesystem/atomicJson.cjs.map +0 -1
- package/dist/adapters/filesystem/atomicJson.mjs +0 -2
- package/dist/adapters/filesystem/atomicJson.mjs.map +0 -1
- package/dist/adapters/filesystem/paths.cjs +0 -2
- package/dist/adapters/filesystem/paths.cjs.map +0 -1
- package/dist/adapters/filesystem/paths.mjs +0 -2
- package/dist/adapters/filesystem/paths.mjs.map +0 -1
- package/dist/adapters/hub/hubClient.cjs +0 -2
- package/dist/adapters/hub/hubClient.cjs.map +0 -1
- package/dist/adapters/hub/hubClient.d.cts +0 -1
- package/dist/adapters/hub/hubClient.d.mts +0 -1
- package/dist/adapters/hub/hubClient.mjs +0 -2
- package/dist/adapters/hub/hubClient.mjs.map +0 -1
- package/dist/adapters/pi/extension.cjs +0 -2
- package/dist/adapters/pi/extension.cjs.map +0 -1
- package/dist/adapters/pi/extension.d.cts +0 -9
- package/dist/adapters/pi/extension.d.cts.map +0 -1
- package/dist/adapters/pi/extension.d.mts +0 -9
- package/dist/adapters/pi/extension.d.mts.map +0 -1
- package/dist/adapters/pi/extension.mjs +0 -2
- package/dist/adapters/pi/extension.mjs.map +0 -1
- package/dist/adapters/pi/extensions/runWorktreeTool.cjs +0 -15
- package/dist/adapters/pi/extensions/runWorktreeTool.cjs.map +0 -1
- package/dist/adapters/pi/extensions/runWorktreeTool.mjs +0 -15
- package/dist/adapters/pi/extensions/runWorktreeTool.mjs.map +0 -1
- package/dist/adapters/web/worktreesChannel.cjs +0 -2
- package/dist/adapters/web/worktreesChannel.cjs.map +0 -1
- package/dist/adapters/web/worktreesChannel.d.cts +0 -21
- package/dist/adapters/web/worktreesChannel.d.cts.map +0 -1
- package/dist/adapters/web/worktreesChannel.d.mts +0 -21
- package/dist/adapters/web/worktreesChannel.d.mts.map +0 -1
- package/dist/adapters/web/worktreesChannel.mjs +0 -2
- package/dist/adapters/web/worktreesChannel.mjs.map +0 -1
- package/dist/adapters/worktree/compositionMirror.cjs +0 -2
- package/dist/adapters/worktree/compositionMirror.cjs.map +0 -1
- package/dist/adapters/worktree/compositionMirror.mjs +0 -2
- package/dist/adapters/worktree/compositionMirror.mjs.map +0 -1
- package/dist/adapters/worktree/gitCli.cjs +0 -4
- package/dist/adapters/worktree/gitCli.cjs.map +0 -1
- package/dist/adapters/worktree/gitCli.mjs +0 -4
- package/dist/adapters/worktree/gitCli.mjs.map +0 -1
- package/dist/adapters/worktree/repositoryIdentity.cjs +0 -2
- package/dist/adapters/worktree/repositoryIdentity.cjs.map +0 -1
- package/dist/adapters/worktree/repositoryIdentity.mjs +0 -2
- package/dist/adapters/worktree/repositoryIdentity.mjs.map +0 -1
- package/dist/adapters/worktree/worktreeOperations.cjs +0 -2
- package/dist/adapters/worktree/worktreeOperations.cjs.map +0 -1
- package/dist/adapters/worktree/worktreeOperations.d.cts +0 -38
- package/dist/adapters/worktree/worktreeOperations.d.cts.map +0 -1
- package/dist/adapters/worktree/worktreeOperations.d.mts +0 -38
- package/dist/adapters/worktree/worktreeOperations.d.mts.map +0 -1
- package/dist/adapters/worktree/worktreeOperations.mjs +0 -2
- package/dist/adapters/worktree/worktreeOperations.mjs.map +0 -1
- package/dist/adapters/worktree/worktreeRegistry.cjs +0 -2
- package/dist/adapters/worktree/worktreeRegistry.cjs.map +0 -1
- package/dist/adapters/worktree/worktreeRegistry.mjs +0 -2
- package/dist/adapters/worktree/worktreeRegistry.mjs.map +0 -1
- package/dist/commands/doomGitCommand.cjs +0 -2
- package/dist/commands/doomGitCommand.cjs.map +0 -1
- package/dist/commands/doomGitCommand.mjs +0 -2
- package/dist/commands/doomGitCommand.mjs.map +0 -1
- package/dist/container/index.cjs +0 -2
- package/dist/container/index.cjs.map +0 -1
- package/dist/container/index.d.cts +0 -6
- package/dist/container/index.d.cts.map +0 -1
- package/dist/container/index.d.mts +0 -6
- package/dist/container/index.d.mts.map +0 -1
- package/dist/container/index.mjs +0 -2
- package/dist/container/index.mjs.map +0 -1
- package/dist/extensions/pi.d.cts +0 -2
- package/dist/hubApi.cjs +0 -2
- package/dist/hubApi.cjs.map +0 -1
- package/dist/hubApi.d.cts +0 -6
- package/dist/hubApi.d.cts.map +0 -1
- package/dist/hubApi.d.mts +0 -6
- package/dist/hubApi.d.mts.map +0 -1
- package/dist/hubApi.mjs +0 -2
- package/dist/hubApi.mjs.map +0 -1
- package/dist/index.d.cts +0 -5
- package/dist/schemas/runWorktreeTool.cjs +0 -2
- package/dist/schemas/runWorktreeTool.cjs.map +0 -1
- package/dist/schemas/runWorktreeTool.mjs +0 -2
- package/dist/schemas/runWorktreeTool.mjs.map +0 -1
- package/dist/services/extensionService.cjs +0 -2
- package/dist/services/extensionService.cjs.map +0 -1
- package/dist/services/extensionService.d.cts +0 -8
- package/dist/services/extensionService.d.cts.map +0 -1
- package/dist/services/extensionService.d.mts +0 -8
- package/dist/services/extensionService.d.mts.map +0 -1
- package/dist/services/extensionService.mjs +0 -2
- package/dist/services/extensionService.mjs.map +0 -1
- package/dist/services/support/errors.cjs +0 -2
- package/dist/services/support/errors.cjs.map +0 -1
- package/dist/services/support/errors.mjs +0 -2
- package/dist/services/support/errors.mjs.map +0 -1
- package/dist/services/worktreeNaming.cjs +0 -2
- package/dist/services/worktreeNaming.cjs.map +0 -1
- package/dist/services/worktreeNaming.d.cts +0 -34
- package/dist/services/worktreeNaming.d.cts.map +0 -1
- package/dist/services/worktreeNaming.d.mts +0 -34
- package/dist/services/worktreeNaming.d.mts.map +0 -1
- package/dist/services/worktreeNaming.mjs +0 -2
- package/dist/services/worktreeNaming.mjs.map +0 -1
- package/dist/types/extension.d.cts +0 -17
- package/dist/types/extension.d.cts.map +0 -1
- package/dist/types/extension.d.mts +0 -17
- package/dist/types/extension.d.mts.map +0 -1
- package/dist/types/webWorktrees.cjs +0 -2
- package/dist/types/webWorktrees.cjs.map +0 -1
- package/dist/types/webWorktrees.mjs +0 -2
- package/dist/types/webWorktrees.mjs.map +0 -1
- package/dist/types/worktreeRegistry.d.cts +0 -41
- package/dist/types/worktreeRegistry.d.cts.map +0 -1
- package/dist/types/worktreeRegistry.d.mts +0 -41
- package/dist/types/worktreeRegistry.d.mts.map +0 -1
- package/dist/webHub.cjs +0 -1
- package/dist/webHub.d.cts +0 -2
- package/dist/webHub.d.mts +0 -2
- package/dist/webHub.mjs +0 -1
- package/src/exports/webClient.ts +0 -1
- package/src/types/webWorktrees.ts +0 -55
- package/src/types/worktreeRegistry.ts +0 -78
- package/src/web/components/RunWorktreeToolMessage.tsx +0 -45
- package/src/web/components/WorktreesActivitySection.tsx +0 -79
- package/src/web/components/WorktreesPanel.tsx +0 -174
- package/src/web/components/toolRenderers.ts +0 -7
- package/src/web/index.ts +0 -30
- package/src/web/stores/worktreesActivityStore.ts +0 -124
- package/src/web/tsconfig.json +0 -22
|
@@ -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 | 'spawn_cancelled'\n | 'registry_write_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":"AAsBA,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 | 'spawn_cancelled'\n | 'registry_write_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":"AAsBA,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:[],keptBranches:[]},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 * Branches git refused to delete because they hold commits.\n *\n * Filled by the prune itself, not by the plan: a dry run destroys nothing, so\n * it has nothing to report here and leaves it empty.\n */\n keptBranches: string[];\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: [], keptBranches: [] };\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,SAAW,GAAK,EAAM,MAAO,OAIlD,IAAM,EAAQ,EAAM,WAAW,MAAM,EAAG,EAAE,CAAC,CAAC,KAAK,IAAI,EAC/C,EAAO,EAAM,WAAW,OAAS,GAAK,SAAS,OAAO,EAAM,WAAW,OAAS,EAAE,EAAE,OAAS,GACnG,MAAO,GAAG,OAAO,EAAM,WAAW,MAAM,EAAE,wBAAwB,IAAQ,EAAK,oCACjF,CAeA,SAAgB,EACd,EACA,EACgB,CAChB,IAAM,EAAoB,CAAC,EAQ3B,MAAO,CAAE,QAPI,EAAQ,IAAK,GACpB,EAAO,SAAW,YACR,EAAM,OAAO,EAAO,IAAI,GAAM,EAAM,MAAM,CAAM,EAC5C,GAClB,EAAQ,KAAK,EAAO,EAAE,EACf,CAAE,GAAG,EAAQ,OAAQ,UAAoB,EAE7B,EAAG,SAAQ,CAClC,CA0BA,SAAgB,EAAU,EAKZ,CACZ,IAAM,EAAkB,CAAE,OAAQ,CAAC,EAAG,OAAQ,CAAC,EAAG,UAAW,CAAC,EAAG,UAAW,CAAC,EAAG,aAAc,CAAC,CAAE,EAC3F,EAAQ,IAAI,IAAI,EAAM,QAAQ,IAAK,GAAW,EAAO,IAAI,CAAC,EAC1D,EAAS,IAAI,IAAI,EAAM,QAAQ,EACrC,IAAK,IAAM,KAAU,EAAM,QACrB,KAAO,SAAW,WACtB,IAAI,CAAC,EAAO,IAAI,EAAO,IAAI,EAAG,CAC5B,EAAK,OAAO,KAAK,CAAM,EACvB,QACF,CACA,IAAK,EAAM,YAAY,IAAI,EAAO,IAAI,GAAK,CAAC,EAAA,CAAG,OAAS,EAAG,CACzD,EAAK,UAAU,KAAK,CAAM,EAC1B,QACF,CACA,EAAK,OAAO,KAAK,CAAM,CALvB,CAOF,IAAK,IAAM,KAAQ,EAAM,SAGnB,EAAK,WAAW,GAAG,EAAM,cAAc,EAAE,GAAK,CAAC,EAAM,IAAI,CAAI,GAAG,EAAK,UAAU,KAAK,CAAI,EAE9F,OAAO,CACT"}
|
|
@@ -1,34 +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
|
-
* Branches git refused to delete because they hold commits.
|
|
14
|
-
*
|
|
15
|
-
* Filled by the prune itself, not by the plan: a dry run destroys nothing, so
|
|
16
|
-
* it has nothing to report here and leaves it empty.
|
|
17
|
-
*/
|
|
18
|
-
keptBranches: string[];
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* What a prune would do, decided before anything is destroyed.
|
|
22
|
-
*
|
|
23
|
-
* Separating the plan from the execution is what makes dryRun honest and lets
|
|
24
|
-
* the destructive half be reviewed on its own.
|
|
25
|
-
*/
|
|
26
|
-
declare function planPrune(input: {
|
|
27
|
-
records: readonly WorktreeRecord[];
|
|
28
|
-
gitPaths: readonly string[];
|
|
29
|
-
worktreesRoot: string;
|
|
30
|
-
dirtyByPath: ReadonlyMap<string, readonly string[]>;
|
|
31
|
-
}): PrunePlan;
|
|
32
|
-
//#endregion
|
|
33
|
-
export { PrunePlan, planPrune };
|
|
34
|
-
//# 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;;;;;;;EAOX;;;;;;;;iBASc,UAAU;EACxB,kBAAkB;EAClB;EACA;EACA,aAAa;IACX"}
|
|
@@ -1,34 +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
|
-
* Branches git refused to delete because they hold commits.
|
|
14
|
-
*
|
|
15
|
-
* Filled by the prune itself, not by the plan: a dry run destroys nothing, so
|
|
16
|
-
* it has nothing to report here and leaves it empty.
|
|
17
|
-
*/
|
|
18
|
-
keptBranches: string[];
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* What a prune would do, decided before anything is destroyed.
|
|
22
|
-
*
|
|
23
|
-
* Separating the plan from the execution is what makes dryRun honest and lets
|
|
24
|
-
* the destructive half be reviewed on its own.
|
|
25
|
-
*/
|
|
26
|
-
declare function planPrune(input: {
|
|
27
|
-
records: readonly WorktreeRecord[];
|
|
28
|
-
gitPaths: readonly string[];
|
|
29
|
-
worktreesRoot: string;
|
|
30
|
-
dirtyByPath: ReadonlyMap<string, readonly string[]>;
|
|
31
|
-
}): PrunePlan;
|
|
32
|
-
//#endregion
|
|
33
|
-
export { PrunePlan, planPrune };
|
|
34
|
-
//# 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;;;;;;;EAOX;;;;;;;;iBASc,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:[],keptBranches:[]},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 * Branches git refused to delete because they hold commits.\n *\n * Filled by the prune itself, not by the plan: a dry run destroys nothing, so\n * it has nothing to report here and leaves it empty.\n */\n keptBranches: string[];\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: [], keptBranches: [] };\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,SAAW,GAAK,EAAM,MAAO,OAIlD,IAAM,EAAQ,EAAM,WAAW,MAAM,EAAG,EAAE,CAAC,CAAC,KAAK,IAAI,EAC/C,EAAO,EAAM,WAAW,OAAS,GAAK,SAAS,OAAO,EAAM,WAAW,OAAS,EAAE,EAAE,OAAS,GACnG,MAAO,GAAG,OAAO,EAAM,WAAW,MAAM,EAAE,wBAAwB,IAAQ,EAAK,oCACjF,CAeA,SAAgB,EACd,EACA,EACgB,CAChB,IAAM,EAAoB,CAAC,EAQ3B,MAAO,CAAE,QAPI,EAAQ,IAAK,GACpB,EAAO,SAAW,YACR,EAAM,OAAO,EAAO,IAAI,GAAM,EAAM,MAAM,CAAM,EAC5C,GAClB,EAAQ,KAAK,EAAO,EAAE,EACf,CAAE,GAAG,EAAQ,OAAQ,UAAoB,EAE7B,EAAG,SAAQ,CAClC,CA0BA,SAAgB,EAAU,EAKZ,CACZ,IAAM,EAAkB,CAAE,OAAQ,CAAC,EAAG,OAAQ,CAAC,EAAG,UAAW,CAAC,EAAG,UAAW,CAAC,EAAG,aAAc,CAAC,CAAE,EAC3F,EAAQ,IAAI,IAAI,EAAM,QAAQ,IAAK,GAAW,EAAO,IAAI,CAAC,EAC1D,EAAS,IAAI,IAAI,EAAM,QAAQ,EACrC,IAAK,IAAM,KAAU,EAAM,QACrB,KAAO,SAAW,WACtB,IAAI,CAAC,EAAO,IAAI,EAAO,IAAI,EAAG,CAC5B,EAAK,OAAO,KAAK,CAAM,EACvB,QACF,CACA,IAAK,EAAM,YAAY,IAAI,EAAO,IAAI,GAAK,CAAC,EAAA,CAAG,OAAS,EAAG,CACzD,EAAK,UAAU,KAAK,CAAM,EAC1B,QACF,CACA,EAAK,OAAO,KAAK,CAAM,CALvB,CAOF,IAAK,IAAM,KAAQ,EAAM,SAGnB,EAAK,WAAW,GAAG,EAAM,cAAc,EAAE,GAAK,CAAC,EAAM,IAAI,CAAI,GAAG,EAAK,UAAU,KAAK,CAAI,EAE9F,OAAO,CACT"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
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 +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 +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
package/dist/webHub.d.mts
DELETED
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};
|
package/src/exports/webClient.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { webPlugin } from '../web/index.ts';
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The cockpit's view of this session's worktrees.
|
|
3
|
-
*
|
|
4
|
-
* DESIGN PATTERNS:
|
|
5
|
-
* - Declarations only. The channel frame type is a constant so the hub and the
|
|
6
|
-
* page cannot drift apart on a string.
|
|
7
|
-
* - A view is the subset of a record the dock needs, not the record. The
|
|
8
|
-
* registry may hold paths and provenance the page has no business rendering.
|
|
9
|
-
*
|
|
10
|
-
* AVOID:
|
|
11
|
-
* - Adding behaviour here. This file is imported by browser code, so it must
|
|
12
|
-
* stay free of node builtins.
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
/** The data channel carrying one session's worktrees to the page. */
|
|
16
|
-
export const GIT_WORKTREES_TYPE = 'git_worktrees';
|
|
17
|
-
|
|
18
|
-
/** One worktree, as the activity dock and its panel render it. */
|
|
19
|
-
export interface WorktreeView {
|
|
20
|
-
id: string;
|
|
21
|
-
branch: string;
|
|
22
|
-
path: string;
|
|
23
|
-
/** The session the hub started for this worktree, when it is still live. */
|
|
24
|
-
sessionId: string | null;
|
|
25
|
-
/** True once the directory the record names has gone missing. */
|
|
26
|
-
orphaned: boolean;
|
|
27
|
-
/**
|
|
28
|
-
* True when the session that asked for this worktree is gone.
|
|
29
|
-
*
|
|
30
|
-
* An owned worktree is only ever shown to its own session. This flag marks
|
|
31
|
-
* the exception: once the parent is dead nobody would see the worktree at
|
|
32
|
-
* all, so every session in the repository does, and may close it.
|
|
33
|
-
*/
|
|
34
|
-
unowned: boolean;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* What the panel asks the hub channel to do.
|
|
39
|
-
*
|
|
40
|
-
* The dock acts through its own channel rather than through the agent: a
|
|
41
|
-
* worktree made from the panel and one made by the tool take the same
|
|
42
|
-
* `worktreeOperations` path, but the panel no longer has to spend a turn of
|
|
43
|
-
* the conversation to get there.
|
|
44
|
-
*/
|
|
45
|
-
export type GitWorktreesCommand =
|
|
46
|
-
| { action: 'create'; branch: string; baseRef?: string }
|
|
47
|
-
| { action: 'close'; id: string; force?: boolean };
|
|
48
|
-
|
|
49
|
-
export interface GitWorktreesPayload {
|
|
50
|
-
worktrees: WorktreeView[];
|
|
51
|
-
/** Label of the operation in flight, absent when the session is idle. */
|
|
52
|
-
pending?: string;
|
|
53
|
-
/** The last failure, cleared when the next command starts. */
|
|
54
|
-
error?: string;
|
|
55
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The worktree registry: what this package knows about the worktrees it made.
|
|
3
|
-
*
|
|
4
|
-
* It deliberately does not mirror `git worktree list`. Git knows which
|
|
5
|
-
* worktrees exist; only this registry knows which of them this package created,
|
|
6
|
-
* which session runs in each, and which process to signal. Reconciling the two
|
|
7
|
-
* is how orphans are found, so the two views are kept separate on purpose.
|
|
8
|
-
*/
|
|
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
|
-
export type WorktreeStatus = 'spawning' | 'running' | 'closing' | 'orphaned';
|
|
18
|
-
|
|
19
|
-
export const WORKTREE_RECORD_VERSION = 1;
|
|
20
|
-
|
|
21
|
-
export interface WorktreeRecord {
|
|
22
|
-
version: typeof WORKTREE_RECORD_VERSION;
|
|
23
|
-
/** This registry's own id, distinct from the session id, and stable across restarts. */
|
|
24
|
-
id: string;
|
|
25
|
-
/** The branch checked out in the worktree. */
|
|
26
|
-
branch: string;
|
|
27
|
-
/** The ref the branch was created from, kept so a merge can name its base. */
|
|
28
|
-
baseRef: string;
|
|
29
|
-
/** Absolute path to the worktree directory. */
|
|
30
|
-
path: string;
|
|
31
|
-
/** Absolute path to the repository the worktree belongs to. */
|
|
32
|
-
repositoryRoot: string;
|
|
33
|
-
/** The session spawned into the worktree. */
|
|
34
|
-
sessionId: string;
|
|
35
|
-
/** The session that asked for the worktree; the rail nests one under the other. */
|
|
36
|
-
parentSessionId: string;
|
|
37
|
-
status: WorktreeStatus;
|
|
38
|
-
/** ISO 8601. */
|
|
39
|
-
createdAt: string;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export interface WorktreeRegistryFile {
|
|
43
|
-
version: typeof WORKTREE_RECORD_VERSION;
|
|
44
|
-
entries: readonly WorktreeRecord[];
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/** Reads the registry back, treating anything unusable as an empty registry. */
|
|
48
|
-
export interface WorktreeRegistryStore {
|
|
49
|
-
list(): WorktreeRecord[];
|
|
50
|
-
/** Replaces the whole file. One writer per repository, so no merge is attempted. */
|
|
51
|
-
replace(entries: readonly WorktreeRecord[]): void;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/** The git operations this package needs, named in its own vocabulary. */
|
|
55
|
-
export interface WorktreeGit {
|
|
56
|
-
addWorktree(input: { repositoryRoot: string; path: string; branch: string; baseRef: string }): Promise<void>;
|
|
57
|
-
removeWorktree(input: { repositoryRoot: string; path: string; force: boolean }): Promise<void>;
|
|
58
|
-
/**
|
|
59
|
-
* Safe branch delete, reporting refusal rather than throwing.
|
|
60
|
-
*
|
|
61
|
-
* `worktree remove` leaves the branch behind, so undoing a spawn needs this
|
|
62
|
-
* too. It is always the safe form: git refuses a branch holding unmerged
|
|
63
|
-
* work, and false says the branch is still there rather than pretending it
|
|
64
|
-
* went.
|
|
65
|
-
*/
|
|
66
|
-
deleteBranch(input: { repositoryRoot: string; branch: string }): Promise<boolean>;
|
|
67
|
-
pruneWorktrees(repositoryRoot: string): Promise<void>;
|
|
68
|
-
/** Paths git currently lists for the repository, used to find orphans. */
|
|
69
|
-
listWorktreePaths(repositoryRoot: string): Promise<string[]>;
|
|
70
|
-
/** Files with uncommitted changes, empty when the tree is clean. */
|
|
71
|
-
dirtyFiles(path: string): Promise<string[]>;
|
|
72
|
-
/** The repository root for a directory, or undefined when it is not a repository. */
|
|
73
|
-
repositoryRoot(cwd: string): Promise<string | undefined>;
|
|
74
|
-
/** The branch currently checked out, used as the default base ref. */
|
|
75
|
-
currentBranch(cwd: string): Promise<string | undefined>;
|
|
76
|
-
/** Merges a worktree's branch into whatever the given root has checked out. */
|
|
77
|
-
mergeBranch(input: { repositoryRoot: string; branch: string; message?: string }): Promise<void>;
|
|
78
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { MessageItem, MessageItemBody, MessageItemHeader, toolTone } from '@agimon-ai/doompi-web-components';
|
|
2
|
-
import type { ToolMessageRenderProps } from '@agimon-ai/doompi-web-contracts';
|
|
3
|
-
|
|
4
|
-
const ACTION_LABEL: Readonly<Record<string, string>> = {
|
|
5
|
-
spawn_worktree: 'Create worktree',
|
|
6
|
-
close_worktree: 'Close worktree',
|
|
7
|
-
list: 'List worktrees',
|
|
8
|
-
status: 'Worktree status',
|
|
9
|
-
merge: 'Merge worktree',
|
|
10
|
-
prune: 'Prune worktrees',
|
|
11
|
-
send: 'Message worktree',
|
|
12
|
-
messages: 'Read worktree messages',
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* The timeline item for `run_worktree`.
|
|
17
|
-
*
|
|
18
|
-
* DESIGN PATTERNS:
|
|
19
|
-
* - Built on MessageItem, like every other tool renderer in the cockpit. That
|
|
20
|
-
* is what gives it the shared collapse toggle and the RUNNING/OK/ERROR badge
|
|
21
|
-
* rather than a hand-rolled ellipsis that never resolves.
|
|
22
|
-
* - The action and its subject go in the heading because that is what a reader
|
|
23
|
-
* scanning a transcript needs: "close_worktree a1b2c3d4" answers the question
|
|
24
|
-
* the raw JSON arguments make them decode.
|
|
25
|
-
* - A create takes as long as the cockpit needs to start a session, and the
|
|
26
|
-
* tool streams each phase into `output`, so the body is where the wait is
|
|
27
|
-
* visible.
|
|
28
|
-
*/
|
|
29
|
-
export function RunWorktreeToolMessage({ args, output, running, isError }: ToolMessageRenderProps) {
|
|
30
|
-
const action = typeof args.action === 'string' ? args.action : '';
|
|
31
|
-
const subject = typeof args.branch === 'string' ? args.branch : typeof args.id === 'string' ? args.id : '';
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<MessageItem tone={toolTone({ running, isError })} expandable={output !== ''}>
|
|
35
|
-
<MessageItemHeader title={ACTION_LABEL[action] ?? 'Worktree'}>
|
|
36
|
-
{subject === '' ? null : <span className="min-w-0 truncate text-doom-dim">{subject}</span>}
|
|
37
|
-
</MessageItemHeader>
|
|
38
|
-
{output === '' ? null : (
|
|
39
|
-
<MessageItemBody>
|
|
40
|
-
<pre className={`whitespace-pre-wrap text-xs ${isError ? 'text-doom-red' : 'text-doom-dim'}`}>{output}</pre>
|
|
41
|
-
</MessageItemBody>
|
|
42
|
-
)}
|
|
43
|
-
</MessageItem>
|
|
44
|
-
);
|
|
45
|
-
}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The '# git' group's body in the activity dock.
|
|
3
|
-
*
|
|
4
|
-
* DESIGN PATTERNS:
|
|
5
|
-
* - One line per worktree, the same rule the runners rail follows: enough to
|
|
6
|
-
* notice it, not enough to work with it. The group's own name opens the tab
|
|
7
|
-
* that has room.
|
|
8
|
-
* - Idle still shows the launcher. A repository with no worktrees is the state
|
|
9
|
-
* where someone most wants to make one.
|
|
10
|
-
*
|
|
11
|
-
* AVOID:
|
|
12
|
-
* - Doing work here. This section reports and launches; the panel and the tool
|
|
13
|
-
* own everything else.
|
|
14
|
-
*/
|
|
15
|
-
import { Button, Dot, Spinner, StatusBadge } from '@agimon-ai/doompi-web-components';
|
|
16
|
-
import type { WebPluginSlotProps } from '@agimon-ai/doompi-web-contracts';
|
|
17
|
-
import { useStore } from '@tanstack/react-store';
|
|
18
|
-
import type { WorktreeView } from '../../types/webWorktrees.ts';
|
|
19
|
-
import { worktreeActivity } from '../stores/worktreesActivityStore.ts';
|
|
20
|
-
import { worktreesTab } from './WorktreesPanel.tsx';
|
|
21
|
-
|
|
22
|
-
export function WorktreesActivitySection({ sessionId, openTransientTab }: WebPluginSlotProps) {
|
|
23
|
-
const session = useStore(worktreeActivity.store, (state) => worktreeActivity.select(state, sessionId));
|
|
24
|
-
|
|
25
|
-
if (session.worktrees.length === 0 && session.pending === undefined) {
|
|
26
|
-
return (
|
|
27
|
-
<div className="flex items-center gap-2 px-1">
|
|
28
|
-
<p data-testid="activity-summary-git" className="px-1 text-xs text-doom-faint">
|
|
29
|
-
idle
|
|
30
|
-
</p>
|
|
31
|
-
{sessionId === null ? null : (
|
|
32
|
-
<Button
|
|
33
|
-
variant="link"
|
|
34
|
-
size="xs"
|
|
35
|
-
data-testid="activity-git-create"
|
|
36
|
-
className="px-0"
|
|
37
|
-
onClick={() => openTransientTab(worktreesTab())}
|
|
38
|
-
>
|
|
39
|
-
create a worktree
|
|
40
|
-
</Button>
|
|
41
|
-
)}
|
|
42
|
-
</div>
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return (
|
|
47
|
-
<div data-testid="activity-git-worktrees" className="flex flex-col gap-0.5">
|
|
48
|
-
{session.pending === undefined ? null : (
|
|
49
|
-
<span className="flex min-w-0 items-center gap-1.5 px-1">
|
|
50
|
-
<Spinner className="h-3 w-3 shrink-0 text-doom-faint" label={session.pending} />
|
|
51
|
-
<span className="min-w-0 truncate text-xs text-doom-dim">{session.pending}</span>
|
|
52
|
-
</span>
|
|
53
|
-
)}
|
|
54
|
-
{session.worktrees.map((worktree: WorktreeView) => (
|
|
55
|
-
<Button
|
|
56
|
-
key={worktree.id}
|
|
57
|
-
variant="ghost"
|
|
58
|
-
size="card"
|
|
59
|
-
data-testid={`activity-git-worktree-${worktree.id}`}
|
|
60
|
-
className="min-w-0 gap-1.5 px-1"
|
|
61
|
-
onClick={() => openTransientTab(worktreesTab())}
|
|
62
|
-
>
|
|
63
|
-
<Dot tone={worktree.orphaned ? 'red' : worktree.sessionId === null ? 'muted' : 'blue'} />
|
|
64
|
-
<span className="min-w-0 flex-1 truncate text-left text-xs font-bold text-doom-hi">{worktree.branch}</span>
|
|
65
|
-
{worktree.orphaned ? (
|
|
66
|
-
<StatusBadge tone="error" size="xs">
|
|
67
|
-
orphaned
|
|
68
|
-
</StatusBadge>
|
|
69
|
-
) : null}
|
|
70
|
-
{worktree.unowned ? (
|
|
71
|
-
<StatusBadge tone="info" size="xs">
|
|
72
|
-
unowned
|
|
73
|
-
</StatusBadge>
|
|
74
|
-
) : null}
|
|
75
|
-
</Button>
|
|
76
|
-
))}
|
|
77
|
-
</div>
|
|
78
|
-
);
|
|
79
|
-
}
|