@agimon-ai/doompi-git 0.0.1-alpha.7 → 0.0.1-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/_rolldown/runtime.cjs +23 -1
- package/dist/api-contracts.cjs +7 -1
- package/dist/api-contracts.d.cts +1 -1
- package/dist/api-contracts.d.mts +1 -1
- package/dist/api-contracts.mjs +2 -1
- package/dist/extensions/pi.cjs +38 -1
- package/dist/extensions/pi.cjs.map +1 -1
- package/dist/extensions/pi.d.cts +5 -4
- package/dist/extensions/pi.d.cts.map +1 -1
- package/dist/extensions/pi.d.mts +5 -4
- package/dist/extensions/pi.d.mts.map +1 -1
- package/dist/extensions/pi.mjs +33 -1
- package/dist/extensions/pi.mjs.map +1 -1
- package/dist/extensions/server.cjs +72 -1
- package/dist/extensions/server.cjs.map +1 -1
- package/dist/extensions/server.d.cts +3 -3
- package/dist/extensions/server.d.cts.map +1 -1
- package/dist/extensions/server.d.mts +3 -3
- package/dist/extensions/server.d.mts.map +1 -1
- package/dist/extensions/server.mjs +67 -1
- package/dist/extensions/server.mjs.map +1 -1
- package/dist/extensions/web.mjs +485 -0
- package/dist/extensions/web.mjs.map +1 -0
- package/dist/index.cjs +5 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +3 -1
- package/dist/src/constants/git.cjs +8 -0
- package/dist/src/constants/git.cjs.map +1 -0
- package/dist/src/constants/git.mjs +7 -0
- package/dist/src/constants/git.mjs.map +1 -0
- package/dist/src/extensions/(backend)/api/_lib/route.server.cjs +93 -0
- package/dist/src/extensions/(backend)/api/_lib/route.server.cjs.map +1 -0
- package/dist/src/extensions/(backend)/api/_lib/route.server.mjs +92 -0
- package/dist/src/extensions/(backend)/api/_lib/route.server.mjs.map +1 -0
- package/dist/src/extensions/(backend)/api/route.server.cjs +7 -0
- package/dist/src/extensions/(backend)/api/route.server.cjs.map +1 -0
- package/dist/src/extensions/(backend)/api/route.server.mjs +8 -0
- package/dist/src/extensions/(backend)/api/route.server.mjs.map +1 -0
- package/dist/src/extensions/(backend)/channel/_lib/git-worktrees.server.cjs +195 -0
- package/dist/src/extensions/(backend)/channel/_lib/git-worktrees.server.cjs.map +1 -0
- package/dist/src/extensions/(backend)/channel/_lib/git-worktrees.server.mjs +194 -0
- package/dist/src/extensions/(backend)/channel/_lib/git-worktrees.server.mjs.map +1 -0
- package/dist/src/extensions/(backend)/channel/git-worktrees.server.cjs +7 -0
- package/dist/src/extensions/(backend)/channel/git-worktrees.server.cjs.map +1 -0
- package/dist/src/extensions/(backend)/channel/git-worktrees.server.mjs +8 -0
- package/dist/src/extensions/(backend)/channel/git-worktrees.server.mjs.map +1 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/_lib/root.cli.cjs +7 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/_lib/root.cli.cjs.map +1 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/_lib/root.cli.mjs +8 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/_lib/root.cli.mjs.map +1 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/_lib/root.server.cjs +71 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/_lib/root.server.cjs.map +1 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/_lib/root.server.mjs +70 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/_lib/root.server.mjs.map +1 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/command/_lib/git.cli.cjs +17 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/command/_lib/git.cli.cjs.map +1 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/command/_lib/git.cli.mjs +16 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/command/_lib/git.cli.mjs.map +1 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/command/git.cli.cjs +7 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/command/git.cli.cjs.map +1 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/command/git.cli.mjs +8 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/command/git.cli.mjs.map +1 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompi-use-git.cli.cjs +15 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompi-use-git.cli.cjs.map +1 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompi-use-git.cli.mjs +15 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompi-use-git.cli.mjs.map +1 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompiGit.server.cjs +6 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompiGit.server.cjs.map +1 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompiGit.server.mjs +6 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompiGit.server.mjs.map +1 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompiGitReadme.server.cjs +6 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompiGitReadme.server.cjs.map +1 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompiGitReadme.server.mjs +6 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompiGitReadme.server.mjs.map +1 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompiUseGit.server.cjs +6 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompiUseGit.server.cjs.map +1 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompiUseGit.server.mjs +6 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/resource/_lib/doompiUseGit.server.mjs.map +1 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompi-use-git.cli.cjs +7 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompi-use-git.cli.cjs.map +1 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompi-use-git.cli.mjs +8 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompi-use-git.cli.mjs.map +1 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompiGit.server.cjs +7 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompiGit.server.cjs.map +1 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompiGit.server.mjs +8 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompiGit.server.mjs.map +1 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompiGitReadme.server.cjs +7 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompiGitReadme.server.cjs.map +1 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompiGitReadme.server.mjs +8 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompiGitReadme.server.mjs.map +1 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompiUseGit.server.cjs +7 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompiUseGit.server.cjs.map +1 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompiUseGit.server.mjs +8 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/resource/doompiUseGit.server.mjs.map +1 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/root.cli.cjs +7 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/root.cli.cjs.map +1 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/root.cli.mjs +8 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/root.cli.mjs.map +1 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/root.server.cjs +7 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/root.server.cjs.map +1 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/root.server.mjs +8 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/root.server.mjs.map +1 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/tool/_lib/runWorktree.cli.cjs +38 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/tool/_lib/runWorktree.cli.cjs.map +1 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/tool/_lib/runWorktree.cli.mjs +36 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/tool/_lib/runWorktree.cli.mjs.map +1 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/tool/runWorktree.cli.cjs +7 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/tool/runWorktree.cli.cjs.map +1 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/tool/runWorktree.cli.mjs +8 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/tool/runWorktree.cli.mjs.map +1 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/tool/runWorktree.server.cjs +6 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/tool/runWorktree.server.cjs.map +1 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/tool/runWorktree.server.mjs +7 -0
- package/dist/src/extensions/workspaces/sessions/(backend)/tool/runWorktree.server.mjs.map +1 -0
- package/dist/src/schemas/apiContracts.cjs +138 -0
- package/dist/src/schemas/apiContracts.cjs.map +1 -0
- package/dist/{schemas → src/schemas}/apiContracts.d.cts +2 -2
- package/dist/{schemas → src/schemas}/apiContracts.d.cts.map +1 -1
- package/dist/{schemas → src/schemas}/apiContracts.d.mts +2 -2
- package/dist/{schemas → src/schemas}/apiContracts.d.mts.map +1 -1
- package/dist/src/schemas/apiContracts.mjs +135 -0
- package/dist/src/schemas/apiContracts.mjs.map +1 -0
- package/dist/src/schemas/runWorktreeTool.cjs +152 -0
- package/dist/src/schemas/runWorktreeTool.cjs.map +1 -0
- package/dist/src/schemas/runWorktreeTool.mjs +150 -0
- package/dist/src/schemas/runWorktreeTool.mjs.map +1 -0
- package/dist/src/services/atomicJson/index.cjs +42 -0
- package/dist/src/services/atomicJson/index.cjs.map +1 -0
- package/dist/src/services/atomicJson/index.mjs +38 -0
- package/dist/src/services/atomicJson/index.mjs.map +1 -0
- package/dist/src/services/compositionMirror/index.cjs +119 -0
- package/dist/src/services/compositionMirror/index.cjs.map +1 -0
- package/dist/src/services/compositionMirror/index.mjs +116 -0
- package/dist/src/services/compositionMirror/index.mjs.map +1 -0
- package/dist/src/services/errors/index.cjs +29 -0
- package/dist/src/services/errors/index.cjs.map +1 -0
- package/dist/src/services/errors/index.mjs +27 -0
- package/dist/src/services/errors/index.mjs.map +1 -0
- package/dist/src/services/extensionService/index.cjs +13 -0
- package/dist/src/services/extensionService/index.cjs.map +1 -0
- package/dist/{services → src/services}/extensionService/index.d.cts +1 -2
- package/dist/src/services/extensionService/index.d.cts.map +1 -0
- package/dist/{services → src/services}/extensionService/index.d.mts +1 -2
- package/dist/src/services/extensionService/index.d.mts.map +1 -0
- package/dist/src/services/extensionService/index.mjs +13 -0
- package/dist/src/services/extensionService/index.mjs.map +1 -0
- package/dist/src/services/gitCli/index.cjs +144 -0
- package/dist/src/services/gitCli/index.cjs.map +1 -0
- package/dist/src/services/gitCli/index.mjs +142 -0
- package/dist/src/services/gitCli/index.mjs.map +1 -0
- package/dist/src/services/gitDependencies/index.cjs +14 -0
- package/dist/src/services/gitDependencies/index.cjs.map +1 -0
- package/dist/src/services/gitDependencies/index.d.cts +5 -0
- package/dist/src/services/gitDependencies/index.d.cts.map +1 -0
- package/dist/src/services/gitDependencies/index.d.mts +5 -0
- package/dist/src/services/gitDependencies/index.d.mts.map +1 -0
- package/dist/src/services/gitDependencies/index.mjs +14 -0
- package/dist/src/services/gitDependencies/index.mjs.map +1 -0
- package/dist/src/services/paths/index.cjs +35 -0
- package/dist/src/services/paths/index.cjs.map +1 -0
- package/dist/src/services/paths/index.mjs +30 -0
- package/dist/src/services/paths/index.mjs.map +1 -0
- package/dist/src/services/repositoryIdentity/index.cjs +71 -0
- package/dist/src/services/repositoryIdentity/index.cjs.map +1 -0
- package/dist/src/services/repositoryIdentity/index.mjs +65 -0
- package/dist/src/services/repositoryIdentity/index.mjs.map +1 -0
- package/dist/src/services/runWorktree/index.cjs +145 -0
- package/dist/src/services/runWorktree/index.cjs.map +1 -0
- package/dist/src/services/runWorktree/index.mjs +142 -0
- package/dist/src/services/runWorktree/index.mjs.map +1 -0
- package/dist/src/services/worktreeEvents/index.cjs +64 -0
- package/dist/src/services/worktreeEvents/index.cjs.map +1 -0
- package/dist/{services → src/services}/worktreeEvents/index.d.cts +3 -4
- package/dist/src/services/worktreeEvents/index.d.cts.map +1 -0
- package/dist/{services → src/services}/worktreeEvents/index.d.mts +3 -4
- package/dist/src/services/worktreeEvents/index.d.mts.map +1 -0
- package/dist/src/services/worktreeEvents/index.mjs +60 -0
- package/dist/src/services/worktreeEvents/index.mjs.map +1 -0
- package/dist/src/services/worktreeNaming/index.cjs +99 -0
- package/dist/src/services/worktreeNaming/index.cjs.map +1 -0
- package/dist/{services → src/services}/worktreeNaming/index.d.cts +2 -3
- package/dist/src/services/worktreeNaming/index.d.cts.map +1 -0
- package/dist/{services → src/services}/worktreeNaming/index.d.mts +2 -3
- package/dist/src/services/worktreeNaming/index.d.mts.map +1 -0
- package/dist/src/services/worktreeNaming/index.mjs +94 -0
- package/dist/src/services/worktreeNaming/index.mjs.map +1 -0
- package/dist/src/services/worktreeOperations/index.cjs +263 -0
- package/dist/src/services/worktreeOperations/index.cjs.map +1 -0
- package/dist/{services → src/services}/worktreeOperations/index.d.cts +4 -5
- package/dist/src/services/worktreeOperations/index.d.cts.map +1 -0
- package/dist/{services → src/services}/worktreeOperations/index.d.mts +4 -5
- package/dist/src/services/worktreeOperations/index.d.mts.map +1 -0
- package/dist/src/services/worktreeOperations/index.mjs +261 -0
- package/dist/src/services/worktreeOperations/index.mjs.map +1 -0
- package/dist/src/services/worktreeRegistry/index.cjs +38 -0
- package/dist/src/services/worktreeRegistry/index.cjs.map +1 -0
- package/dist/src/services/worktreeRegistry/index.mjs +38 -0
- package/dist/src/services/worktreeRegistry/index.mjs.map +1 -0
- package/dist/{types → src/types}/extension.d.cts +4 -5
- package/dist/src/types/extension.d.cts.map +1 -0
- package/dist/{types → src/types}/extension.d.mts +4 -5
- package/dist/src/types/extension.d.mts.map +1 -0
- package/dist/src/types/webWorktrees.cjs +20 -0
- package/dist/src/types/webWorktrees.cjs.map +1 -0
- package/dist/src/types/webWorktrees.mjs +20 -0
- package/dist/src/types/webWorktrees.mjs.map +1 -0
- package/dist/{types → src/types}/worktreeRegistry.d.cts +3 -4
- package/dist/src/types/worktreeRegistry.d.cts.map +1 -0
- package/dist/{types → src/types}/worktreeRegistry.d.mts +3 -4
- package/dist/src/types/worktreeRegistry.d.mts.map +1 -0
- package/package.json +31 -26
- package/dist/constants/git.cjs +0 -2
- package/dist/constants/git.cjs.map +0 -1
- package/dist/constants/git.mjs +0 -2
- package/dist/constants/git.mjs.map +0 -1
- package/dist/controllers/gitCommand.cjs +0 -2
- package/dist/controllers/gitCommand.cjs.map +0 -1
- package/dist/controllers/gitCommand.mjs +0 -2
- package/dist/controllers/gitCommand.mjs.map +0 -1
- package/dist/controllers/gitSession.cjs +0 -2
- package/dist/controllers/gitSession.cjs.map +0 -1
- package/dist/controllers/gitSession.mjs +0 -2
- package/dist/controllers/gitSession.mjs.map +0 -1
- package/dist/controllers/hubApi.cjs +0 -2
- package/dist/controllers/hubApi.cjs.map +0 -1
- package/dist/controllers/hubApi.mjs +0 -2
- package/dist/controllers/hubApi.mjs.map +0 -1
- package/dist/controllers/worktreesChannel.cjs +0 -2
- package/dist/controllers/worktreesChannel.cjs.map +0 -1
- package/dist/controllers/worktreesChannel.mjs +0 -2
- package/dist/controllers/worktreesChannel.mjs.map +0 -1
- package/dist/schemas/apiContracts.cjs +0 -2
- package/dist/schemas/apiContracts.cjs.map +0 -1
- package/dist/schemas/apiContracts.mjs +0 -2
- package/dist/schemas/apiContracts.mjs.map +0 -1
- 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/atomicJson/index.cjs +0 -2
- package/dist/services/atomicJson/index.cjs.map +0 -1
- package/dist/services/atomicJson/index.mjs +0 -2
- package/dist/services/atomicJson/index.mjs.map +0 -1
- package/dist/services/compositionMirror/index.cjs +0 -2
- package/dist/services/compositionMirror/index.cjs.map +0 -1
- package/dist/services/compositionMirror/index.mjs +0 -2
- package/dist/services/compositionMirror/index.mjs.map +0 -1
- package/dist/services/errors/index.cjs +0 -2
- package/dist/services/errors/index.cjs.map +0 -1
- package/dist/services/errors/index.mjs +0 -2
- package/dist/services/errors/index.mjs.map +0 -1
- package/dist/services/extensionService/index.cjs +0 -2
- package/dist/services/extensionService/index.cjs.map +0 -1
- package/dist/services/extensionService/index.d.cts.map +0 -1
- package/dist/services/extensionService/index.d.mts.map +0 -1
- package/dist/services/extensionService/index.mjs +0 -2
- package/dist/services/extensionService/index.mjs.map +0 -1
- package/dist/services/gitCli/index.cjs +0 -4
- package/dist/services/gitCli/index.cjs.map +0 -1
- package/dist/services/gitCli/index.mjs +0 -4
- package/dist/services/gitCli/index.mjs.map +0 -1
- package/dist/services/gitDependencies/index.cjs +0 -2
- package/dist/services/gitDependencies/index.cjs.map +0 -1
- package/dist/services/gitDependencies/index.d.cts +0 -6
- package/dist/services/gitDependencies/index.d.cts.map +0 -1
- package/dist/services/gitDependencies/index.d.mts +0 -6
- package/dist/services/gitDependencies/index.d.mts.map +0 -1
- package/dist/services/gitDependencies/index.mjs +0 -2
- package/dist/services/gitDependencies/index.mjs.map +0 -1
- package/dist/services/paths/index.cjs +0 -2
- package/dist/services/paths/index.cjs.map +0 -1
- package/dist/services/paths/index.mjs +0 -2
- package/dist/services/paths/index.mjs.map +0 -1
- package/dist/services/repositoryIdentity/index.cjs +0 -2
- package/dist/services/repositoryIdentity/index.cjs.map +0 -1
- package/dist/services/repositoryIdentity/index.mjs +0 -2
- package/dist/services/repositoryIdentity/index.mjs.map +0 -1
- package/dist/services/runWorktree/index.cjs +0 -15
- package/dist/services/runWorktree/index.cjs.map +0 -1
- package/dist/services/runWorktree/index.mjs +0 -15
- package/dist/services/runWorktree/index.mjs.map +0 -1
- package/dist/services/worktreeEvents/index.cjs +0 -2
- package/dist/services/worktreeEvents/index.cjs.map +0 -1
- package/dist/services/worktreeEvents/index.d.cts.map +0 -1
- package/dist/services/worktreeEvents/index.d.mts.map +0 -1
- package/dist/services/worktreeEvents/index.mjs +0 -2
- package/dist/services/worktreeEvents/index.mjs.map +0 -1
- package/dist/services/worktreeNaming/index.cjs +0 -2
- package/dist/services/worktreeNaming/index.cjs.map +0 -1
- package/dist/services/worktreeNaming/index.d.cts.map +0 -1
- package/dist/services/worktreeNaming/index.d.mts.map +0 -1
- package/dist/services/worktreeNaming/index.mjs +0 -2
- package/dist/services/worktreeNaming/index.mjs.map +0 -1
- package/dist/services/worktreeOperations/index.cjs +0 -2
- package/dist/services/worktreeOperations/index.cjs.map +0 -1
- package/dist/services/worktreeOperations/index.d.cts.map +0 -1
- package/dist/services/worktreeOperations/index.d.mts.map +0 -1
- package/dist/services/worktreeOperations/index.mjs +0 -2
- package/dist/services/worktreeOperations/index.mjs.map +0 -1
- package/dist/services/worktreeRegistry/index.cjs +0 -2
- package/dist/services/worktreeRegistry/index.cjs.map +0 -1
- package/dist/services/worktreeRegistry/index.mjs +0 -2
- package/dist/services/worktreeRegistry/index.mjs.map +0 -1
- package/dist/tools/runWorktree.cjs +0 -2
- package/dist/tools/runWorktree.cjs.map +0 -1
- package/dist/tools/runWorktree.mjs +0 -2
- package/dist/tools/runWorktree.mjs.map +0 -1
- package/dist/types/extension.d.cts.map +0 -1
- 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.map +0 -1
- package/dist/types/worktreeRegistry.d.mts.map +0 -1
- package/src/extensions/web.ts +0 -33
- 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 -80
- package/src/web/components/WorktreesPanel.tsx +0 -175
- package/src/web/components/toolRenderers.ts +0 -8
- package/src/web/stores/worktreesActivityStore.ts +0 -125
- package/src/web/tsconfig.json +0 -22
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
const require_runtime = require("../../../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
let node_fs = require("node:fs");
|
|
3
|
+
node_fs = require_runtime.__toESM(node_fs, 1);
|
|
4
|
+
let node_path = require("node:path");
|
|
5
|
+
node_path = require_runtime.__toESM(node_path, 1);
|
|
6
|
+
//#region src/services/compositionMirror/index.ts
|
|
7
|
+
/**
|
|
8
|
+
* Giving a new worktree the build output its parent checkout already has.
|
|
9
|
+
*
|
|
10
|
+
* DESIGN PATTERNS:
|
|
11
|
+
* - Mirrors, never builds. Everything here is a copy or a symlink of something
|
|
12
|
+
* the parent checkout already produced, so it costs seconds and cannot fail
|
|
13
|
+
* the way a package manager or a compiler can.
|
|
14
|
+
* - `node_modules` is linked, `dist` is copied. The module tree is gigabytes
|
|
15
|
+
* and read-only in practice, so a link is right; build output is small and a
|
|
16
|
+
* link would send a build run inside the worktree straight into the parent's
|
|
17
|
+
* directory.
|
|
18
|
+
* - Absent parent output means nothing to do. A repository with no
|
|
19
|
+
* `node_modules` at its root is either not a JS project or not installed, and
|
|
20
|
+
* either way this has no opinion about it, so a Rust, Go or Python worktree
|
|
21
|
+
* pays nothing.
|
|
22
|
+
*
|
|
23
|
+
* WHY THIS EXISTS:
|
|
24
|
+
* A DoomPi session composes the extensions its repository's config names, and
|
|
25
|
+
* this repository names its own workspace packages by relative path. Those
|
|
26
|
+
* packages declare `pi.extensions` under `dist/`, which git does not track, so
|
|
27
|
+
* a fresh worktree resolves none of them and the session dies on start. The
|
|
28
|
+
* parent checkout has already built exactly what the child needs.
|
|
29
|
+
*
|
|
30
|
+
* AVOID:
|
|
31
|
+
* - Recursing into `node_modules`. The scan is bounded and skips it; without
|
|
32
|
+
* that this walks a gigabyte to find nothing.
|
|
33
|
+
* - Treating a mirror failure as fatal. The worktree is good either way; only
|
|
34
|
+
* the session's composition is poorer for it.
|
|
35
|
+
*/
|
|
36
|
+
/** Directories that are build output worth copying into a new worktree. */
|
|
37
|
+
const OUTPUT_DIRECTORY = "dist";
|
|
38
|
+
const MODULES_DIRECTORY = "node_modules";
|
|
39
|
+
const GIT_DIRECTORY = ".git";
|
|
40
|
+
/**
|
|
41
|
+
* How deep the scan goes.
|
|
42
|
+
*
|
|
43
|
+
* Four levels reaches `layers/<group>/<package>/dist` in this repository's
|
|
44
|
+
* layout, and a workspace that buries a package deeper than that gets a
|
|
45
|
+
* partial mirror rather than a slow one.
|
|
46
|
+
*/
|
|
47
|
+
const MAX_DEPTH = 4;
|
|
48
|
+
function scan(root) {
|
|
49
|
+
const found = {
|
|
50
|
+
outputs: [],
|
|
51
|
+
modules: []
|
|
52
|
+
};
|
|
53
|
+
const walk = (relative, depth) => {
|
|
54
|
+
let entries;
|
|
55
|
+
try {
|
|
56
|
+
entries = node_fs.default.readdirSync(node_path.default.join(root, relative), { withFileTypes: true });
|
|
57
|
+
} catch {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
for (const entry of entries) {
|
|
61
|
+
if (!entry.isDirectory()) continue;
|
|
62
|
+
const child = relative === "" ? entry.name : `${relative}/${entry.name}`;
|
|
63
|
+
if (entry.name === GIT_DIRECTORY) continue;
|
|
64
|
+
if (entry.name === MODULES_DIRECTORY) {
|
|
65
|
+
found.modules.push(child);
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
if (entry.name === OUTPUT_DIRECTORY) {
|
|
69
|
+
found.outputs.push(child);
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
if (depth < MAX_DEPTH) walk(child, depth + 1);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
walk("", 1);
|
|
76
|
+
return found;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Copies the parent's build output into a worktree and links its modules.
|
|
80
|
+
*
|
|
81
|
+
* Individual failures are counted out rather than thrown: a mirror that lands
|
|
82
|
+
* partly is still better than none, and the caller has a worktree either way.
|
|
83
|
+
*/
|
|
84
|
+
function mirrorComposition(source, target) {
|
|
85
|
+
if (!node_fs.default.existsSync(node_path.default.join(source, MODULES_DIRECTORY))) return {
|
|
86
|
+
kind: "skipped",
|
|
87
|
+
reason: "no-modules"
|
|
88
|
+
};
|
|
89
|
+
const found = scan(source);
|
|
90
|
+
let copied = 0;
|
|
91
|
+
let linked = 0;
|
|
92
|
+
for (const relative of found.modules) {
|
|
93
|
+
const destination = node_path.default.join(target, relative);
|
|
94
|
+
if (node_fs.default.existsSync(destination)) continue;
|
|
95
|
+
try {
|
|
96
|
+
node_fs.default.mkdirSync(node_path.default.dirname(destination), { recursive: true });
|
|
97
|
+
node_fs.default.symlinkSync(node_path.default.join(source, relative), destination, "dir");
|
|
98
|
+
linked += 1;
|
|
99
|
+
} catch {}
|
|
100
|
+
}
|
|
101
|
+
for (const relative of found.outputs) {
|
|
102
|
+
const destination = node_path.default.join(target, relative);
|
|
103
|
+
if (node_fs.default.existsSync(destination)) continue;
|
|
104
|
+
try {
|
|
105
|
+
node_fs.default.mkdirSync(node_path.default.dirname(destination), { recursive: true });
|
|
106
|
+
node_fs.default.cpSync(node_path.default.join(source, relative), destination, { recursive: true });
|
|
107
|
+
copied += 1;
|
|
108
|
+
} catch {}
|
|
109
|
+
}
|
|
110
|
+
return {
|
|
111
|
+
kind: "mirrored",
|
|
112
|
+
copied,
|
|
113
|
+
linked
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
//#endregion
|
|
117
|
+
exports.mirrorComposition = mirrorComposition;
|
|
118
|
+
|
|
119
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["fs","path"],"sources":["../../../../src/services/compositionMirror/index.ts"],"sourcesContent":["/**\n * Giving a new worktree the build output its parent checkout already has.\n *\n * DESIGN PATTERNS:\n * - Mirrors, never builds. Everything here is a copy or a symlink of something\n * the parent checkout already produced, so it costs seconds and cannot fail\n * the way a package manager or a compiler can.\n * - `node_modules` is linked, `dist` is copied. The module tree is gigabytes\n * and read-only in practice, so a link is right; build output is small and a\n * link would send a build run inside the worktree straight into the parent's\n * directory.\n * - Absent parent output means nothing to do. A repository with no\n * `node_modules` at its root is either not a JS project or not installed, and\n * either way this has no opinion about it, so a Rust, Go or Python worktree\n * pays nothing.\n *\n * WHY THIS EXISTS:\n * A DoomPi session composes the extensions its repository's config names, and\n * this repository names its own workspace packages by relative path. Those\n * packages declare `pi.extensions` under `dist/`, which git does not track, so\n * a fresh worktree resolves none of them and the session dies on start. The\n * parent checkout has already built exactly what the child needs.\n *\n * AVOID:\n * - Recursing into `node_modules`. The scan is bounded and skips it; without\n * that this walks a gigabyte to find nothing.\n * - Treating a mirror failure as fatal. The worktree is good either way; only\n * the session's composition is poorer for it.\n */\nimport fs from 'node:fs';\nimport path from 'node:path';\n\n/** Directories that are build output worth copying into a new worktree. */\nconst OUTPUT_DIRECTORY = 'dist';\nconst MODULES_DIRECTORY = 'node_modules';\nconst GIT_DIRECTORY = '.git';\n/**\n * How deep the scan goes.\n *\n * Four levels reaches `layers/<group>/<package>/dist` in this repository's\n * layout, and a workspace that buries a package deeper than that gets a\n * partial mirror rather than a slow one.\n */\nconst MAX_DEPTH = 4;\n\nexport type MirrorOutcome =\n | { kind: 'skipped'; reason: 'no-modules' }\n | { kind: 'mirrored'; copied: number; linked: number };\n\ninterface Found {\n /** Paths relative to the source root. */\n outputs: string[];\n modules: string[];\n}\n\nfunction scan(root: string): Found {\n const found: Found = { outputs: [], modules: [] };\n const walk = (relative: string, depth: number): void => {\n let entries: fs.Dirent[];\n try {\n entries = fs.readdirSync(path.join(root, relative), { withFileTypes: true });\n } catch {\n return;\n }\n for (const entry of entries) {\n if (!entry.isDirectory()) continue;\n const child = relative === '' ? entry.name : `${relative}/${entry.name}`;\n if (entry.name === GIT_DIRECTORY) continue;\n // Both of these are destinations, not places to look inside.\n if (entry.name === MODULES_DIRECTORY) {\n found.modules.push(child);\n continue;\n }\n if (entry.name === OUTPUT_DIRECTORY) {\n found.outputs.push(child);\n continue;\n }\n if (depth < MAX_DEPTH) walk(child, depth + 1);\n }\n };\n walk('', 1);\n return found;\n}\n\n/**\n * Copies the parent's build output into a worktree and links its modules.\n *\n * Individual failures are counted out rather than thrown: a mirror that lands\n * partly is still better than none, and the caller has a worktree either way.\n */\nexport function mirrorComposition(source: string, target: string): MirrorOutcome {\n if (!fs.existsSync(path.join(source, MODULES_DIRECTORY))) return { kind: 'skipped', reason: 'no-modules' };\n\n const found = scan(source);\n let copied = 0;\n let linked = 0;\n\n for (const relative of found.modules) {\n const destination = path.join(target, relative);\n if (fs.existsSync(destination)) continue;\n try {\n fs.mkdirSync(path.dirname(destination), { recursive: true });\n fs.symlinkSync(path.join(source, relative), destination, 'dir');\n linked += 1;\n } catch {\n // A link the filesystem refuses costs this package one resolution, not\n // the worktree.\n }\n }\n\n for (const relative of found.outputs) {\n const destination = path.join(target, relative);\n if (fs.existsSync(destination)) continue;\n try {\n fs.mkdirSync(path.dirname(destination), { recursive: true });\n fs.cpSync(path.join(source, relative), destination, { recursive: true });\n copied += 1;\n } catch {\n // Same reasoning as a failed link.\n }\n }\n\n return { kind: 'mirrored', copied, linked };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,MAAM,mBAAmB;AACzB,MAAM,oBAAoB;AAC1B,MAAM,gBAAgB;;;;;;;;AAQtB,MAAM,YAAY;AAYlB,SAAS,KAAK,MAAqB;CACjC,MAAM,QAAe;EAAE,SAAS,CAAC;EAAG,SAAS,CAAC;CAAE;CAChD,MAAM,QAAQ,UAAkB,UAAwB;EACtD,IAAI;EACJ,IAAI;GACF,UAAUA,QAAAA,QAAG,YAAYC,UAAAA,QAAK,KAAK,MAAM,QAAQ,GAAG,EAAE,eAAe,KAAK,CAAC;EAC7E,QAAQ;GACN;EACF;EACA,KAAK,MAAM,SAAS,SAAS;GAC3B,IAAI,CAAC,MAAM,YAAY,GAAG;GAC1B,MAAM,QAAQ,aAAa,KAAK,MAAM,OAAO,GAAG,SAAS,GAAG,MAAM;GAClE,IAAI,MAAM,SAAS,eAAe;GAElC,IAAI,MAAM,SAAS,mBAAmB;IACpC,MAAM,QAAQ,KAAK,KAAK;IACxB;GACF;GACA,IAAI,MAAM,SAAS,kBAAkB;IACnC,MAAM,QAAQ,KAAK,KAAK;IACxB;GACF;GACA,IAAI,QAAQ,WAAW,KAAK,OAAO,QAAQ,CAAC;EAC9C;CACF;CACA,KAAK,IAAI,CAAC;CACV,OAAO;AACT;;;;;;;AAQA,SAAgB,kBAAkB,QAAgB,QAA+B;CAC/E,IAAI,CAACD,QAAAA,QAAG,WAAWC,UAAAA,QAAK,KAAK,QAAQ,iBAAiB,CAAC,GAAG,OAAO;EAAE,MAAM;EAAW,QAAQ;CAAa;CAEzG,MAAM,QAAQ,KAAK,MAAM;CACzB,IAAI,SAAS;CACb,IAAI,SAAS;CAEb,KAAK,MAAM,YAAY,MAAM,SAAS;EACpC,MAAM,cAAcA,UAAAA,QAAK,KAAK,QAAQ,QAAQ;EAC9C,IAAID,QAAAA,QAAG,WAAW,WAAW,GAAG;EAChC,IAAI;GACF,QAAA,QAAG,UAAUC,UAAAA,QAAK,QAAQ,WAAW,GAAG,EAAE,WAAW,KAAK,CAAC;GAC3D,QAAA,QAAG,YAAYA,UAAAA,QAAK,KAAK,QAAQ,QAAQ,GAAG,aAAa,KAAK;GAC9D,UAAU;EACZ,QAAQ,CAGR;CACF;CAEA,KAAK,MAAM,YAAY,MAAM,SAAS;EACpC,MAAM,cAAcA,UAAAA,QAAK,KAAK,QAAQ,QAAQ;EAC9C,IAAID,QAAAA,QAAG,WAAW,WAAW,GAAG;EAChC,IAAI;GACF,QAAA,QAAG,UAAUC,UAAAA,QAAK,QAAQ,WAAW,GAAG,EAAE,WAAW,KAAK,CAAC;GAC3D,QAAA,QAAG,OAAOA,UAAAA,QAAK,KAAK,QAAQ,QAAQ,GAAG,aAAa,EAAE,WAAW,KAAK,CAAC;GACvE,UAAU;EACZ,QAAQ,CAER;CACF;CAEA,OAAO;EAAE,MAAM;EAAY;EAAQ;CAAO;AAC5C"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
//#region src/services/compositionMirror/index.ts
|
|
4
|
+
/**
|
|
5
|
+
* Giving a new worktree the build output its parent checkout already has.
|
|
6
|
+
*
|
|
7
|
+
* DESIGN PATTERNS:
|
|
8
|
+
* - Mirrors, never builds. Everything here is a copy or a symlink of something
|
|
9
|
+
* the parent checkout already produced, so it costs seconds and cannot fail
|
|
10
|
+
* the way a package manager or a compiler can.
|
|
11
|
+
* - `node_modules` is linked, `dist` is copied. The module tree is gigabytes
|
|
12
|
+
* and read-only in practice, so a link is right; build output is small and a
|
|
13
|
+
* link would send a build run inside the worktree straight into the parent's
|
|
14
|
+
* directory.
|
|
15
|
+
* - Absent parent output means nothing to do. A repository with no
|
|
16
|
+
* `node_modules` at its root is either not a JS project or not installed, and
|
|
17
|
+
* either way this has no opinion about it, so a Rust, Go or Python worktree
|
|
18
|
+
* pays nothing.
|
|
19
|
+
*
|
|
20
|
+
* WHY THIS EXISTS:
|
|
21
|
+
* A DoomPi session composes the extensions its repository's config names, and
|
|
22
|
+
* this repository names its own workspace packages by relative path. Those
|
|
23
|
+
* packages declare `pi.extensions` under `dist/`, which git does not track, so
|
|
24
|
+
* a fresh worktree resolves none of them and the session dies on start. The
|
|
25
|
+
* parent checkout has already built exactly what the child needs.
|
|
26
|
+
*
|
|
27
|
+
* AVOID:
|
|
28
|
+
* - Recursing into `node_modules`. The scan is bounded and skips it; without
|
|
29
|
+
* that this walks a gigabyte to find nothing.
|
|
30
|
+
* - Treating a mirror failure as fatal. The worktree is good either way; only
|
|
31
|
+
* the session's composition is poorer for it.
|
|
32
|
+
*/
|
|
33
|
+
/** Directories that are build output worth copying into a new worktree. */
|
|
34
|
+
const OUTPUT_DIRECTORY = "dist";
|
|
35
|
+
const MODULES_DIRECTORY = "node_modules";
|
|
36
|
+
const GIT_DIRECTORY = ".git";
|
|
37
|
+
/**
|
|
38
|
+
* How deep the scan goes.
|
|
39
|
+
*
|
|
40
|
+
* Four levels reaches `layers/<group>/<package>/dist` in this repository's
|
|
41
|
+
* layout, and a workspace that buries a package deeper than that gets a
|
|
42
|
+
* partial mirror rather than a slow one.
|
|
43
|
+
*/
|
|
44
|
+
const MAX_DEPTH = 4;
|
|
45
|
+
function scan(root) {
|
|
46
|
+
const found = {
|
|
47
|
+
outputs: [],
|
|
48
|
+
modules: []
|
|
49
|
+
};
|
|
50
|
+
const walk = (relative, depth) => {
|
|
51
|
+
let entries;
|
|
52
|
+
try {
|
|
53
|
+
entries = fs.readdirSync(path.join(root, relative), { withFileTypes: true });
|
|
54
|
+
} catch {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
for (const entry of entries) {
|
|
58
|
+
if (!entry.isDirectory()) continue;
|
|
59
|
+
const child = relative === "" ? entry.name : `${relative}/${entry.name}`;
|
|
60
|
+
if (entry.name === GIT_DIRECTORY) continue;
|
|
61
|
+
if (entry.name === MODULES_DIRECTORY) {
|
|
62
|
+
found.modules.push(child);
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
if (entry.name === OUTPUT_DIRECTORY) {
|
|
66
|
+
found.outputs.push(child);
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
if (depth < MAX_DEPTH) walk(child, depth + 1);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
walk("", 1);
|
|
73
|
+
return found;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Copies the parent's build output into a worktree and links its modules.
|
|
77
|
+
*
|
|
78
|
+
* Individual failures are counted out rather than thrown: a mirror that lands
|
|
79
|
+
* partly is still better than none, and the caller has a worktree either way.
|
|
80
|
+
*/
|
|
81
|
+
function mirrorComposition(source, target) {
|
|
82
|
+
if (!fs.existsSync(path.join(source, MODULES_DIRECTORY))) return {
|
|
83
|
+
kind: "skipped",
|
|
84
|
+
reason: "no-modules"
|
|
85
|
+
};
|
|
86
|
+
const found = scan(source);
|
|
87
|
+
let copied = 0;
|
|
88
|
+
let linked = 0;
|
|
89
|
+
for (const relative of found.modules) {
|
|
90
|
+
const destination = path.join(target, relative);
|
|
91
|
+
if (fs.existsSync(destination)) continue;
|
|
92
|
+
try {
|
|
93
|
+
fs.mkdirSync(path.dirname(destination), { recursive: true });
|
|
94
|
+
fs.symlinkSync(path.join(source, relative), destination, "dir");
|
|
95
|
+
linked += 1;
|
|
96
|
+
} catch {}
|
|
97
|
+
}
|
|
98
|
+
for (const relative of found.outputs) {
|
|
99
|
+
const destination = path.join(target, relative);
|
|
100
|
+
if (fs.existsSync(destination)) continue;
|
|
101
|
+
try {
|
|
102
|
+
fs.mkdirSync(path.dirname(destination), { recursive: true });
|
|
103
|
+
fs.cpSync(path.join(source, relative), destination, { recursive: true });
|
|
104
|
+
copied += 1;
|
|
105
|
+
} catch {}
|
|
106
|
+
}
|
|
107
|
+
return {
|
|
108
|
+
kind: "mirrored",
|
|
109
|
+
copied,
|
|
110
|
+
linked
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
//#endregion
|
|
114
|
+
export { mirrorComposition };
|
|
115
|
+
|
|
116
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/services/compositionMirror/index.ts"],"sourcesContent":["/**\n * Giving a new worktree the build output its parent checkout already has.\n *\n * DESIGN PATTERNS:\n * - Mirrors, never builds. Everything here is a copy or a symlink of something\n * the parent checkout already produced, so it costs seconds and cannot fail\n * the way a package manager or a compiler can.\n * - `node_modules` is linked, `dist` is copied. The module tree is gigabytes\n * and read-only in practice, so a link is right; build output is small and a\n * link would send a build run inside the worktree straight into the parent's\n * directory.\n * - Absent parent output means nothing to do. A repository with no\n * `node_modules` at its root is either not a JS project or not installed, and\n * either way this has no opinion about it, so a Rust, Go or Python worktree\n * pays nothing.\n *\n * WHY THIS EXISTS:\n * A DoomPi session composes the extensions its repository's config names, and\n * this repository names its own workspace packages by relative path. Those\n * packages declare `pi.extensions` under `dist/`, which git does not track, so\n * a fresh worktree resolves none of them and the session dies on start. The\n * parent checkout has already built exactly what the child needs.\n *\n * AVOID:\n * - Recursing into `node_modules`. The scan is bounded and skips it; without\n * that this walks a gigabyte to find nothing.\n * - Treating a mirror failure as fatal. The worktree is good either way; only\n * the session's composition is poorer for it.\n */\nimport fs from 'node:fs';\nimport path from 'node:path';\n\n/** Directories that are build output worth copying into a new worktree. */\nconst OUTPUT_DIRECTORY = 'dist';\nconst MODULES_DIRECTORY = 'node_modules';\nconst GIT_DIRECTORY = '.git';\n/**\n * How deep the scan goes.\n *\n * Four levels reaches `layers/<group>/<package>/dist` in this repository's\n * layout, and a workspace that buries a package deeper than that gets a\n * partial mirror rather than a slow one.\n */\nconst MAX_DEPTH = 4;\n\nexport type MirrorOutcome =\n | { kind: 'skipped'; reason: 'no-modules' }\n | { kind: 'mirrored'; copied: number; linked: number };\n\ninterface Found {\n /** Paths relative to the source root. */\n outputs: string[];\n modules: string[];\n}\n\nfunction scan(root: string): Found {\n const found: Found = { outputs: [], modules: [] };\n const walk = (relative: string, depth: number): void => {\n let entries: fs.Dirent[];\n try {\n entries = fs.readdirSync(path.join(root, relative), { withFileTypes: true });\n } catch {\n return;\n }\n for (const entry of entries) {\n if (!entry.isDirectory()) continue;\n const child = relative === '' ? entry.name : `${relative}/${entry.name}`;\n if (entry.name === GIT_DIRECTORY) continue;\n // Both of these are destinations, not places to look inside.\n if (entry.name === MODULES_DIRECTORY) {\n found.modules.push(child);\n continue;\n }\n if (entry.name === OUTPUT_DIRECTORY) {\n found.outputs.push(child);\n continue;\n }\n if (depth < MAX_DEPTH) walk(child, depth + 1);\n }\n };\n walk('', 1);\n return found;\n}\n\n/**\n * Copies the parent's build output into a worktree and links its modules.\n *\n * Individual failures are counted out rather than thrown: a mirror that lands\n * partly is still better than none, and the caller has a worktree either way.\n */\nexport function mirrorComposition(source: string, target: string): MirrorOutcome {\n if (!fs.existsSync(path.join(source, MODULES_DIRECTORY))) return { kind: 'skipped', reason: 'no-modules' };\n\n const found = scan(source);\n let copied = 0;\n let linked = 0;\n\n for (const relative of found.modules) {\n const destination = path.join(target, relative);\n if (fs.existsSync(destination)) continue;\n try {\n fs.mkdirSync(path.dirname(destination), { recursive: true });\n fs.symlinkSync(path.join(source, relative), destination, 'dir');\n linked += 1;\n } catch {\n // A link the filesystem refuses costs this package one resolution, not\n // the worktree.\n }\n }\n\n for (const relative of found.outputs) {\n const destination = path.join(target, relative);\n if (fs.existsSync(destination)) continue;\n try {\n fs.mkdirSync(path.dirname(destination), { recursive: true });\n fs.cpSync(path.join(source, relative), destination, { recursive: true });\n copied += 1;\n } catch {\n // Same reasoning as a failed link.\n }\n }\n\n return { kind: 'mirrored', copied, linked };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,MAAM,mBAAmB;AACzB,MAAM,oBAAoB;AAC1B,MAAM,gBAAgB;;;;;;;;AAQtB,MAAM,YAAY;AAYlB,SAAS,KAAK,MAAqB;CACjC,MAAM,QAAe;EAAE,SAAS,CAAC;EAAG,SAAS,CAAC;CAAE;CAChD,MAAM,QAAQ,UAAkB,UAAwB;EACtD,IAAI;EACJ,IAAI;GACF,UAAU,GAAG,YAAY,KAAK,KAAK,MAAM,QAAQ,GAAG,EAAE,eAAe,KAAK,CAAC;EAC7E,QAAQ;GACN;EACF;EACA,KAAK,MAAM,SAAS,SAAS;GAC3B,IAAI,CAAC,MAAM,YAAY,GAAG;GAC1B,MAAM,QAAQ,aAAa,KAAK,MAAM,OAAO,GAAG,SAAS,GAAG,MAAM;GAClE,IAAI,MAAM,SAAS,eAAe;GAElC,IAAI,MAAM,SAAS,mBAAmB;IACpC,MAAM,QAAQ,KAAK,KAAK;IACxB;GACF;GACA,IAAI,MAAM,SAAS,kBAAkB;IACnC,MAAM,QAAQ,KAAK,KAAK;IACxB;GACF;GACA,IAAI,QAAQ,WAAW,KAAK,OAAO,QAAQ,CAAC;EAC9C;CACF;CACA,KAAK,IAAI,CAAC;CACV,OAAO;AACT;;;;;;;AAQA,SAAgB,kBAAkB,QAAgB,QAA+B;CAC/E,IAAI,CAAC,GAAG,WAAW,KAAK,KAAK,QAAQ,iBAAiB,CAAC,GAAG,OAAO;EAAE,MAAM;EAAW,QAAQ;CAAa;CAEzG,MAAM,QAAQ,KAAK,MAAM;CACzB,IAAI,SAAS;CACb,IAAI,SAAS;CAEb,KAAK,MAAM,YAAY,MAAM,SAAS;EACpC,MAAM,cAAc,KAAK,KAAK,QAAQ,QAAQ;EAC9C,IAAI,GAAG,WAAW,WAAW,GAAG;EAChC,IAAI;GACF,GAAG,UAAU,KAAK,QAAQ,WAAW,GAAG,EAAE,WAAW,KAAK,CAAC;GAC3D,GAAG,YAAY,KAAK,KAAK,QAAQ,QAAQ,GAAG,aAAa,KAAK;GAC9D,UAAU;EACZ,QAAQ,CAGR;CACF;CAEA,KAAK,MAAM,YAAY,MAAM,SAAS;EACpC,MAAM,cAAc,KAAK,KAAK,QAAQ,QAAQ;EAC9C,IAAI,GAAG,WAAW,WAAW,GAAG;EAChC,IAAI;GACF,GAAG,UAAU,KAAK,QAAQ,WAAW,GAAG,EAAE,WAAW,KAAK,CAAC;GAC3D,GAAG,OAAO,KAAK,KAAK,QAAQ,QAAQ,GAAG,aAAa,EAAE,WAAW,KAAK,CAAC;GACvE,UAAU;EACZ,QAAQ,CAER;CACF;CAEA,OAAO;EAAE,MAAM;EAAY;EAAQ;CAAO;AAC5C"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
//#region src/services/errors/index.ts
|
|
2
|
+
var DoomGitExpectedError = class extends Error {
|
|
3
|
+
code;
|
|
4
|
+
retryable;
|
|
5
|
+
recovery;
|
|
6
|
+
constructor(code, message, retryable, recovery) {
|
|
7
|
+
super(`[${code}] ${message}\nRecovery: ${recovery}`);
|
|
8
|
+
this.code = code;
|
|
9
|
+
this.retryable = retryable;
|
|
10
|
+
this.recovery = recovery;
|
|
11
|
+
this.name = "DoomGitExpectedError";
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
/** Raised when a worktree action needs the canonical hub but it is not injected. */
|
|
15
|
+
var HubUnavailableError = class extends Error {
|
|
16
|
+
constructor(message) {
|
|
17
|
+
super(message);
|
|
18
|
+
this.name = "HubUnavailableError";
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
function invalidRequest(message, recovery) {
|
|
22
|
+
return new DoomGitExpectedError("invalid_request", message, false, recovery);
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
exports.DoomGitExpectedError = DoomGitExpectedError;
|
|
26
|
+
exports.HubUnavailableError = HubUnavailableError;
|
|
27
|
+
exports.invalidRequest = invalidRequest;
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../../../src/services/errors/index.ts"],"sourcesContent":["/**\n * Expected failures, kept private to this package.\n *\n * `@agimon-ai/doompi-core` 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_peer_unavailable'\n | 'worktree_dirty'\n | 'hub_unavailable'\n | 'spawn_cancelled'\n | 'registry_write_failed'\n | 'message_too_large'\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\n/** Raised when a worktree action needs the canonical hub but it is not injected. */\nexport class HubUnavailableError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'HubUnavailableError';\n }\n}\n\nexport function invalidRequest(message: string, recovery: string): DoomGitExpectedError {\n return new DoomGitExpectedError('invalid_request', message, false, recovery);\n}\n"],"mappings":";AAwBA,IAAa,uBAAb,cAA0C,MAAM;CAEnC;CAEA;CACA;CAJX,YACE,MACA,SACA,WACA,UACA;EAGA,MAAM,IAAI,KAAK,IAAI,QAAQ,cAAc,UAAU;EAP1C,KAAA,OAAA;EAEA,KAAA,YAAA;EACA,KAAA,WAAA;EAKT,KAAK,OAAO;CACd;AACF;;AAGA,IAAa,sBAAb,cAAyC,MAAM;CAC7C,YAAY,SAAiB;EAC3B,MAAM,OAAO;EACb,KAAK,OAAO;CACd;AACF;AAEA,SAAgB,eAAe,SAAiB,UAAwC;CACtF,OAAO,IAAI,qBAAqB,mBAAmB,SAAS,OAAO,QAAQ;AAC7E"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//#region src/services/errors/index.ts
|
|
2
|
+
var DoomGitExpectedError = class extends Error {
|
|
3
|
+
code;
|
|
4
|
+
retryable;
|
|
5
|
+
recovery;
|
|
6
|
+
constructor(code, message, retryable, recovery) {
|
|
7
|
+
super(`[${code}] ${message}\nRecovery: ${recovery}`);
|
|
8
|
+
this.code = code;
|
|
9
|
+
this.retryable = retryable;
|
|
10
|
+
this.recovery = recovery;
|
|
11
|
+
this.name = "DoomGitExpectedError";
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
/** Raised when a worktree action needs the canonical hub but it is not injected. */
|
|
15
|
+
var HubUnavailableError = class extends Error {
|
|
16
|
+
constructor(message) {
|
|
17
|
+
super(message);
|
|
18
|
+
this.name = "HubUnavailableError";
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
function invalidRequest(message, recovery) {
|
|
22
|
+
return new DoomGitExpectedError("invalid_request", message, false, recovery);
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { DoomGitExpectedError, HubUnavailableError, invalidRequest };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/services/errors/index.ts"],"sourcesContent":["/**\n * Expected failures, kept private to this package.\n *\n * `@agimon-ai/doompi-core` 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_peer_unavailable'\n | 'worktree_dirty'\n | 'hub_unavailable'\n | 'spawn_cancelled'\n | 'registry_write_failed'\n | 'message_too_large'\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\n/** Raised when a worktree action needs the canonical hub but it is not injected. */\nexport class HubUnavailableError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'HubUnavailableError';\n }\n}\n\nexport function invalidRequest(message: string, recovery: string): DoomGitExpectedError {\n return new DoomGitExpectedError('invalid_request', message, false, recovery);\n}\n"],"mappings":";AAwBA,IAAa,uBAAb,cAA0C,MAAM;CAEnC;CAEA;CACA;CAJX,YACE,MACA,SACA,WACA,UACA;EAGA,MAAM,IAAI,KAAK,IAAI,QAAQ,cAAc,UAAU;EAP1C,KAAA,OAAA;EAEA,KAAA,YAAA;EACA,KAAA,WAAA;EAKT,KAAK,OAAO;CACd;AACF;;AAGA,IAAa,sBAAb,cAAyC,MAAM;CAC7C,YAAY,SAAiB;EAC3B,MAAM,OAAO;EACb,KAAK,OAAO;CACd;AACF;AAEA,SAAgB,eAAe,SAAiB,UAAwC;CACtF,OAAO,IAAI,qBAAqB,mBAAmB,SAAS,OAAO,QAAQ;AAC7E"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/services/extensionService/index.ts
|
|
2
|
+
var DefaultGitExtensionService = class {
|
|
3
|
+
async execute() {
|
|
4
|
+
return {
|
|
5
|
+
message: "Show git worktrees owned by this session",
|
|
6
|
+
level: "info"
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
//#endregion
|
|
11
|
+
exports.DefaultGitExtensionService = DefaultGitExtensionService;
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../../../src/services/extensionService/index.ts"],"sourcesContent":["// @scaffold-generated\nimport type { GitExtensionResult, GitExtensionService } from '../../types/extension';\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,6BAAb,MAAuE;CACrE,MAAM,UAAuC;EAC3C,OAAO;GAAE,SAAS;GAA4C,OAAO;EAAO;CAC9E;AACF"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { GitExtensionResult, GitExtensionService } from "../../types/extension.cjs";
|
|
2
2
|
//#region src/services/extensionService/index.d.ts
|
|
3
|
-
declare class DefaultGitExtensionService implements GitExtensionService {
|
|
3
|
+
export declare class DefaultGitExtensionService implements GitExtensionService {
|
|
4
4
|
execute(): Promise<GitExtensionResult>;
|
|
5
5
|
}
|
|
6
6
|
//#endregion
|
|
7
|
-
export { DefaultGitExtensionService };
|
|
8
7
|
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../../../src/services/extensionService/index.ts"],"mappings":";;qBAGa,sCAAsC;EAC3C,WAAW,QAAQ"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { GitExtensionResult, GitExtensionService } from "../../types/extension.mjs";
|
|
2
2
|
//#region src/services/extensionService/index.d.ts
|
|
3
|
-
declare class DefaultGitExtensionService implements GitExtensionService {
|
|
3
|
+
export declare class DefaultGitExtensionService implements GitExtensionService {
|
|
4
4
|
execute(): Promise<GitExtensionResult>;
|
|
5
5
|
}
|
|
6
6
|
//#endregion
|
|
7
|
-
export { DefaultGitExtensionService };
|
|
8
7
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../../src/services/extensionService/index.ts"],"mappings":";;qBAGa,sCAAsC;EAC3C,WAAW,QAAQ"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/services/extensionService/index.ts
|
|
2
|
+
var DefaultGitExtensionService = class {
|
|
3
|
+
async execute() {
|
|
4
|
+
return {
|
|
5
|
+
message: "Show git worktrees owned by this session",
|
|
6
|
+
level: "info"
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
//#endregion
|
|
11
|
+
export { DefaultGitExtensionService };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/services/extensionService/index.ts"],"sourcesContent":["// @scaffold-generated\nimport type { GitExtensionResult, GitExtensionService } from '../../types/extension';\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,6BAAb,MAAuE;CACrE,MAAM,UAAuC;EAC3C,OAAO;GAAE,SAAS;GAA4C,OAAO;EAAO;CAC9E;AACF"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
const require_runtime = require("../../../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
let node_child_process = require("node:child_process");
|
|
3
|
+
let node_fs = require("node:fs");
|
|
4
|
+
node_fs = require_runtime.__toESM(node_fs, 1);
|
|
5
|
+
//#region src/services/gitCli/index.ts
|
|
6
|
+
/**
|
|
7
|
+
* Git, as this package needs it.
|
|
8
|
+
*
|
|
9
|
+
* The timeouts are not uniform because the operations are not comparable. A
|
|
10
|
+
* read answers in milliseconds; `worktree add` copies an entire checkout and
|
|
11
|
+
* `worktree remove` deletes one, both bounded by the filesystem rather than by
|
|
12
|
+
* git, and both minutes rather than seconds on a large repository or on
|
|
13
|
+
* Windows. A single timeout would either fail honest work or hang on a wedged
|
|
14
|
+
* one.
|
|
15
|
+
*/
|
|
16
|
+
const READ_TIMEOUT_MS = 3e4;
|
|
17
|
+
const ADD_TIMEOUT_MS = 3e5;
|
|
18
|
+
const REMOVE_TIMEOUT_MS = 3e5;
|
|
19
|
+
const PRUNE_TIMEOUT_MS = 15e3;
|
|
20
|
+
const MAX_OUTPUT_BYTES = 1e6;
|
|
21
|
+
/**
|
|
22
|
+
* Runs git and reports the outcome without ever throwing on a non-zero exit.
|
|
23
|
+
*
|
|
24
|
+
* LC_ALL is pinned because two callers below decide what to do by matching
|
|
25
|
+
* git's own wording, and a translated message would silently turn a recognised
|
|
26
|
+
* condition into an unrecognised failure.
|
|
27
|
+
*/
|
|
28
|
+
function git(cwd, args, timeout) {
|
|
29
|
+
return new Promise((resolve) => {
|
|
30
|
+
(0, node_child_process.execFile)("git", [...args], {
|
|
31
|
+
cwd,
|
|
32
|
+
timeout,
|
|
33
|
+
maxBuffer: MAX_OUTPUT_BYTES,
|
|
34
|
+
env: {
|
|
35
|
+
...process.env,
|
|
36
|
+
LC_ALL: "C"
|
|
37
|
+
}
|
|
38
|
+
}, (error, stdout, stderr) => {
|
|
39
|
+
resolve({
|
|
40
|
+
code: error && typeof error.code === "number" ? error.code : error ? 1 : 0,
|
|
41
|
+
stdout: String(stdout),
|
|
42
|
+
stderr: String(stderr)
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The message a failed git call is allowed to surface.
|
|
49
|
+
*
|
|
50
|
+
* Raw stderr never travels: it can carry a remote URL with a token in it, and
|
|
51
|
+
* this text ends up in a tool result the model reads and may repeat.
|
|
52
|
+
*/
|
|
53
|
+
function failure(operation, result) {
|
|
54
|
+
return /* @__PURE__ */ new Error(`git ${operation} failed (exit ${String(result.code)}, ${String(result.stderr.length)} bytes of stderr)`);
|
|
55
|
+
}
|
|
56
|
+
/** Git's own words for "that worktree is not there any more". */
|
|
57
|
+
function missingWorktree(stderr) {
|
|
58
|
+
const normalized = stderr.toLowerCase();
|
|
59
|
+
return normalized.includes("is not a working tree") || normalized.includes("cannot remove working tree");
|
|
60
|
+
}
|
|
61
|
+
function createWorktreeGit() {
|
|
62
|
+
const prune = async (repositoryRoot) => {
|
|
63
|
+
await git(repositoryRoot, ["worktree", "prune"], PRUNE_TIMEOUT_MS);
|
|
64
|
+
};
|
|
65
|
+
return {
|
|
66
|
+
async addWorktree({ repositoryRoot, path, branch, baseRef }) {
|
|
67
|
+
const result = await git(repositoryRoot, [
|
|
68
|
+
"worktree",
|
|
69
|
+
"add",
|
|
70
|
+
"-b",
|
|
71
|
+
branch,
|
|
72
|
+
path,
|
|
73
|
+
baseRef
|
|
74
|
+
], ADD_TIMEOUT_MS);
|
|
75
|
+
if (result.code !== 0) throw failure("worktree add", result);
|
|
76
|
+
},
|
|
77
|
+
async removeWorktree({ repositoryRoot, path, force }) {
|
|
78
|
+
const result = await git(repositoryRoot, [
|
|
79
|
+
"worktree",
|
|
80
|
+
"remove",
|
|
81
|
+
...force ? ["--force"] : [],
|
|
82
|
+
path
|
|
83
|
+
], REMOVE_TIMEOUT_MS);
|
|
84
|
+
if (result.code === 0) return;
|
|
85
|
+
if (missingWorktree(result.stderr) && !node_fs.default.existsSync(path)) {
|
|
86
|
+
await prune(repositoryRoot);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
throw failure("worktree remove", result);
|
|
90
|
+
},
|
|
91
|
+
async deleteBranch({ repositoryRoot, branch }) {
|
|
92
|
+
return (await git(repositoryRoot, [
|
|
93
|
+
"branch",
|
|
94
|
+
"-d",
|
|
95
|
+
branch
|
|
96
|
+
], READ_TIMEOUT_MS)).code === 0;
|
|
97
|
+
},
|
|
98
|
+
pruneWorktrees: prune,
|
|
99
|
+
async listWorktreePaths(repositoryRoot) {
|
|
100
|
+
const result = await git(repositoryRoot, [
|
|
101
|
+
"worktree",
|
|
102
|
+
"list",
|
|
103
|
+
"--porcelain"
|
|
104
|
+
], READ_TIMEOUT_MS);
|
|
105
|
+
if (result.code !== 0) return [];
|
|
106
|
+
return result.stdout.split("\n").filter((line) => line.startsWith("worktree ")).map((line) => line.slice(9).trim()).filter((line) => line !== "");
|
|
107
|
+
},
|
|
108
|
+
async dirtyFiles(path) {
|
|
109
|
+
const result = await git(path, ["status", "--porcelain"], READ_TIMEOUT_MS);
|
|
110
|
+
if (result.code !== 0) return [];
|
|
111
|
+
return result.stdout.split("\n").map((line) => line.slice(3).trim()).filter((line) => line !== "");
|
|
112
|
+
},
|
|
113
|
+
async repositoryRoot(cwd) {
|
|
114
|
+
const result = await git(cwd, ["rev-parse", "--show-toplevel"], READ_TIMEOUT_MS);
|
|
115
|
+
if (result.code !== 0) return void 0;
|
|
116
|
+
const root = result.stdout.trim();
|
|
117
|
+
return root === "" ? void 0 : root;
|
|
118
|
+
},
|
|
119
|
+
async currentBranch(cwd) {
|
|
120
|
+
const result = await git(cwd, [
|
|
121
|
+
"rev-parse",
|
|
122
|
+
"--abbrev-ref",
|
|
123
|
+
"HEAD"
|
|
124
|
+
], READ_TIMEOUT_MS);
|
|
125
|
+
if (result.code !== 0) return void 0;
|
|
126
|
+
const branch = result.stdout.trim();
|
|
127
|
+
return branch === "" ? void 0 : branch;
|
|
128
|
+
},
|
|
129
|
+
async mergeBranch({ repositoryRoot, branch, message }) {
|
|
130
|
+
const result = await git(repositoryRoot, [
|
|
131
|
+
"merge",
|
|
132
|
+
"--no-ff",
|
|
133
|
+
...message === void 0 ? [] : ["-m", message],
|
|
134
|
+
branch
|
|
135
|
+
], READ_TIMEOUT_MS);
|
|
136
|
+
if (result.code === 0) return;
|
|
137
|
+
throw failure("merge", result);
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
//#endregion
|
|
142
|
+
exports.createWorktreeGit = createWorktreeGit;
|
|
143
|
+
|
|
144
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["fs"],"sources":["../../../../src/services/gitCli/index.ts"],"sourcesContent":["import { execFile } from 'node:child_process';\nimport fs from 'node:fs';\n\nimport type { WorktreeGit } from '../../types/worktreeRegistry';\n\n/**\n * Git, as this package needs it.\n *\n * The timeouts are not uniform because the operations are not comparable. A\n * read answers in milliseconds; `worktree add` copies an entire checkout and\n * `worktree remove` deletes one, both bounded by the filesystem rather than by\n * git, and both minutes rather than seconds on a large repository or on\n * Windows. A single timeout would either fail honest work or hang on a wedged\n * one.\n */\nconst READ_TIMEOUT_MS = 30_000;\nconst ADD_TIMEOUT_MS = 300_000;\nconst REMOVE_TIMEOUT_MS = 300_000;\nconst PRUNE_TIMEOUT_MS = 15_000;\nconst MAX_OUTPUT_BYTES = 1_000_000;\n\ninterface GitResult {\n code: number;\n stdout: string;\n stderr: string;\n}\n\n/**\n * Runs git and reports the outcome without ever throwing on a non-zero exit.\n *\n * LC_ALL is pinned because two callers below decide what to do by matching\n * git's own wording, and a translated message would silently turn a recognised\n * condition into an unrecognised failure.\n */\nfunction git(cwd: string, args: readonly string[], timeout: number): Promise<GitResult> {\n return new Promise((resolve) => {\n execFile(\n 'git',\n [...args],\n { cwd, timeout, maxBuffer: MAX_OUTPUT_BYTES, env: { ...process.env, LC_ALL: 'C' } },\n (error, stdout, stderr) => {\n const code = error && typeof error.code === 'number' ? error.code : error ? 1 : 0;\n resolve({ code, stdout: String(stdout), stderr: String(stderr) });\n },\n );\n });\n}\n\n/**\n * The message a failed git call is allowed to surface.\n *\n * Raw stderr never travels: it can carry a remote URL with a token in it, and\n * this text ends up in a tool result the model reads and may repeat.\n */\nfunction failure(operation: string, result: GitResult): Error {\n return new Error(\n `git ${operation} failed (exit ${String(result.code)}, ${String(result.stderr.length)} bytes of stderr)`,\n );\n}\n\n/** Git's own words for \"that worktree is not there any more\". */\nfunction missingWorktree(stderr: string): boolean {\n const normalized = stderr.toLowerCase();\n return normalized.includes('is not a working tree') || normalized.includes('cannot remove working tree');\n}\n\nexport function createWorktreeGit(): WorktreeGit {\n const prune = async (repositoryRoot: string): Promise<void> => {\n await git(repositoryRoot, ['worktree', 'prune'], PRUNE_TIMEOUT_MS);\n };\n\n return {\n async addWorktree({ repositoryRoot, path, branch, baseRef }) {\n const result = await git(repositoryRoot, ['worktree', 'add', '-b', branch, path, baseRef], ADD_TIMEOUT_MS);\n if (result.code !== 0) throw failure('worktree add', result);\n },\n\n async removeWorktree({ repositoryRoot, path, force }) {\n const args = ['worktree', 'remove', ...(force ? ['--force'] : []), path];\n const result = await git(repositoryRoot, args, REMOVE_TIMEOUT_MS);\n if (result.code === 0) return;\n // A directory deleted behind git's back leaves an administrative entry\n // that makes a later `worktree add` at the same path refuse. Treating\n // \"already gone\" as success and pruning is what keeps that path reusable,\n // and it makes remove idempotent for a caller retrying after a crash.\n if (missingWorktree(result.stderr) && !fs.existsSync(path)) {\n await prune(repositoryRoot);\n return;\n }\n throw failure('worktree remove', result);\n },\n\n async deleteBranch({ repositoryRoot, branch }) {\n // -d, never -D: git refuses a branch that still holds unmerged commits,\n // and that refusal is the whole safety property. A rollback that could\n // throw away work someone committed in the worktree is worse than a\n // branch left behind.\n const result = await git(repositoryRoot, ['branch', '-d', branch], READ_TIMEOUT_MS);\n return result.code === 0;\n },\n pruneWorktrees: prune,\n\n async listWorktreePaths(repositoryRoot) {\n const result = await git(repositoryRoot, ['worktree', 'list', '--porcelain'], READ_TIMEOUT_MS);\n if (result.code !== 0) return [];\n return result.stdout\n .split('\\n')\n .filter((line) => line.startsWith('worktree '))\n .map((line) => line.slice('worktree '.length).trim())\n .filter((line) => line !== '');\n },\n\n async dirtyFiles(path) {\n const result = await git(path, ['status', '--porcelain'], READ_TIMEOUT_MS);\n if (result.code !== 0) return [];\n return result.stdout\n .split('\\n')\n .map((line) => line.slice(3).trim())\n .filter((line) => line !== '');\n },\n\n async repositoryRoot(cwd) {\n const result = await git(cwd, ['rev-parse', '--show-toplevel'], READ_TIMEOUT_MS);\n if (result.code !== 0) return undefined;\n const root = result.stdout.trim();\n return root === '' ? undefined : root;\n },\n\n async currentBranch(cwd) {\n const result = await git(cwd, ['rev-parse', '--abbrev-ref', 'HEAD'], READ_TIMEOUT_MS);\n if (result.code !== 0) return undefined;\n const branch = result.stdout.trim();\n return branch === '' ? undefined : branch;\n },\n\n async mergeBranch({ repositoryRoot, branch, message }) {\n // --no-ff so the worktree's work stays identifiable as a unit after the\n // fact. A fast-forward would erase the fact that it was ever separate,\n // which is the one thing worth keeping about a worktree.\n const args = ['merge', '--no-ff', ...(message === undefined ? [] : ['-m', message]), branch];\n const result = await git(repositoryRoot, args, READ_TIMEOUT_MS);\n if (result.code === 0) return;\n // A conflicted merge leaves the parent mid-merge, which is a state the\n // person has to resolve; aborting for them would throw away the conflict\n // markers they need to see.\n throw failure('merge', result);\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAM,kBAAkB;AACxB,MAAM,iBAAiB;AACvB,MAAM,oBAAoB;AAC1B,MAAM,mBAAmB;AACzB,MAAM,mBAAmB;;;;;;;;AAezB,SAAS,IAAI,KAAa,MAAyB,SAAqC;CACtF,OAAO,IAAI,SAAS,YAAY;EAC9B,CAAA,GAAA,mBAAA,SAAA,CACE,OACA,CAAC,GAAG,IAAI,GACR;GAAE;GAAK;GAAS,WAAW;GAAkB,KAAK;IAAE,GAAG,QAAQ;IAAK,QAAQ;GAAI;EAAE,IACjF,OAAO,QAAQ,WAAW;GAEzB,QAAQ;IAAE,MADG,SAAS,OAAO,MAAM,SAAS,WAAW,MAAM,OAAO,QAAQ,IAAI;IAChE,QAAQ,OAAO,MAAM;IAAG,QAAQ,OAAO,MAAM;GAAE,CAAC;EAClE,CACF;CACF,CAAC;AACH;;;;;;;AAQA,SAAS,QAAQ,WAAmB,QAA0B;CAC5D,uBAAO,IAAI,MACT,OAAO,UAAU,gBAAgB,OAAO,OAAO,IAAI,EAAE,IAAI,OAAO,OAAO,OAAO,MAAM,EAAE,kBACxF;AACF;;AAGA,SAAS,gBAAgB,QAAyB;CAChD,MAAM,aAAa,OAAO,YAAY;CACtC,OAAO,WAAW,SAAS,uBAAuB,KAAK,WAAW,SAAS,4BAA4B;AACzG;AAEA,SAAgB,oBAAiC;CAC/C,MAAM,QAAQ,OAAO,mBAA0C;EAC7D,MAAM,IAAI,gBAAgB,CAAC,YAAY,OAAO,GAAG,gBAAgB;CACnE;CAEA,OAAO;EACL,MAAM,YAAY,EAAE,gBAAgB,MAAM,QAAQ,WAAW;GAC3D,MAAM,SAAS,MAAM,IAAI,gBAAgB;IAAC;IAAY;IAAO;IAAM;IAAQ;IAAM;GAAO,GAAG,cAAc;GACzG,IAAI,OAAO,SAAS,GAAG,MAAM,QAAQ,gBAAgB,MAAM;EAC7D;EAEA,MAAM,eAAe,EAAE,gBAAgB,MAAM,SAAS;GAEpD,MAAM,SAAS,MAAM,IAAI,gBAAgB;IAD3B;IAAY;IAAU,GAAI,QAAQ,CAAC,SAAS,IAAI,CAAC;IAAI;GACvB,GAAG,iBAAiB;GAChE,IAAI,OAAO,SAAS,GAAG;GAKvB,IAAI,gBAAgB,OAAO,MAAM,KAAK,CAACA,QAAAA,QAAG,WAAW,IAAI,GAAG;IAC1D,MAAM,MAAM,cAAc;IAC1B;GACF;GACA,MAAM,QAAQ,mBAAmB,MAAM;EACzC;EAEA,MAAM,aAAa,EAAE,gBAAgB,UAAU;GAM7C,QAAO,MADc,IAAI,gBAAgB;IAAC;IAAU;IAAM;GAAM,GAAG,eAAe,EAAA,CACpE,SAAS;EACzB;EACA,gBAAgB;EAEhB,MAAM,kBAAkB,gBAAgB;GACtC,MAAM,SAAS,MAAM,IAAI,gBAAgB;IAAC;IAAY;IAAQ;GAAa,GAAG,eAAe;GAC7F,IAAI,OAAO,SAAS,GAAG,OAAO,CAAC;GAC/B,OAAO,OAAO,OACX,MAAM,IAAI,CAAC,CACX,QAAQ,SAAS,KAAK,WAAW,WAAW,CAAC,CAAC,CAC9C,KAAK,SAAS,KAAK,MAAM,CAAkB,CAAC,CAAC,KAAK,CAAC,CAAC,CACpD,QAAQ,SAAS,SAAS,EAAE;EACjC;EAEA,MAAM,WAAW,MAAM;GACrB,MAAM,SAAS,MAAM,IAAI,MAAM,CAAC,UAAU,aAAa,GAAG,eAAe;GACzE,IAAI,OAAO,SAAS,GAAG,OAAO,CAAC;GAC/B,OAAO,OAAO,OACX,MAAM,IAAI,CAAC,CACX,KAAK,SAAS,KAAK,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CACnC,QAAQ,SAAS,SAAS,EAAE;EACjC;EAEA,MAAM,eAAe,KAAK;GACxB,MAAM,SAAS,MAAM,IAAI,KAAK,CAAC,aAAa,iBAAiB,GAAG,eAAe;GAC/E,IAAI,OAAO,SAAS,GAAG,OAAO,KAAA;GAC9B,MAAM,OAAO,OAAO,OAAO,KAAK;GAChC,OAAO,SAAS,KAAK,KAAA,IAAY;EACnC;EAEA,MAAM,cAAc,KAAK;GACvB,MAAM,SAAS,MAAM,IAAI,KAAK;IAAC;IAAa;IAAgB;GAAM,GAAG,eAAe;GACpF,IAAI,OAAO,SAAS,GAAG,OAAO,KAAA;GAC9B,MAAM,SAAS,OAAO,OAAO,KAAK;GAClC,OAAO,WAAW,KAAK,KAAA,IAAY;EACrC;EAEA,MAAM,YAAY,EAAE,gBAAgB,QAAQ,WAAW;GAKrD,MAAM,SAAS,MAAM,IAAI,gBAAgB;IAD3B;IAAS;IAAW,GAAI,YAAY,KAAA,IAAY,CAAC,IAAI,CAAC,MAAM,OAAO;IAAI;GACzC,GAAG,eAAe;GAC9D,IAAI,OAAO,SAAS,GAAG;GAIvB,MAAM,QAAQ,SAAS,MAAM;EAC/B;CACF;AACF"}
|