infra-kit 0.1.113 → 0.1.115
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/.eslintcache +1 -1
- package/.omc/state/agent-replay-0d1515ce-4ebe-4ce8-a865-2897f68de168.jsonl +1 -0
- package/.omc/state/agent-replay-1fcfe0ec-7567-41c3-9bfd-501e99e86819.jsonl +19 -0
- package/.omc/state/agent-replay-38382db5-3088-4b5a-aff7-2561a60827c7.jsonl +17 -0
- package/.omc/state/agent-replay-50c36be9-a3a2-42b9-9c85-5a06d3e22f6a.jsonl +5 -0
- package/.omc/state/agent-replay-8198b3e5-fad6-4ee0-9c59-ef773ad89af4.jsonl +1 -0
- package/.omc/state/agent-replay-8cd7652a-b8b5-49cf-9b1f-bee8e5972458.jsonl +3 -0
- package/.omc/state/agent-replay-9bea518f-a9ee-4d14-bb53-a936ebaf647c.jsonl +7 -0
- package/.omc/state/agent-replay-b52d89fb-0e24-4901-bc66-27e3c1697126.jsonl +2 -0
- package/.omc/state/agent-replay-f581a1ae-0ee4-48a3-96f3-ce31a0633bb0.jsonl +1 -0
- package/.omc/state/agent-replay-f99d8dad-81d1-4987-8183-62edf0843d0c.jsonl +2 -0
- package/.omc/state/agent-replay-fe1057b4-9a25-4e8e-8c3f-3e11652ee697.jsonl +5 -0
- package/.omc/state/idle-notif-cooldown.json +1 -1
- package/.omc/state/sessions/0d1515ce-4ebe-4ce8-a865-2897f68de168/pre-tool-advisory-throttle.json +10 -0
- package/.omc/state/sessions/1fcfe0ec-7567-41c3-9bfd-501e99e86819/last-tool-error-state.json +7 -0
- package/.omc/state/sessions/1fcfe0ec-7567-41c3-9bfd-501e99e86819/mission-state.json +109 -0
- package/.omc/state/sessions/1fcfe0ec-7567-41c3-9bfd-501e99e86819/pre-tool-advisory-throttle.json +42 -0
- package/.omc/state/sessions/1fcfe0ec-7567-41c3-9bfd-501e99e86819/ralph-state.json +13 -0
- package/.omc/state/sessions/1fcfe0ec-7567-41c3-9bfd-501e99e86819/skill-active-state.json +15 -0
- package/.omc/state/sessions/1fcfe0ec-7567-41c3-9bfd-501e99e86819/subagent-tracking-state.json +62 -0
- package/.omc/state/sessions/1fcfe0ec-7567-41c3-9bfd-501e99e86819/ultrawork-state.json +11 -0
- package/.omc/state/sessions/23d0ff82-17e5-428b-8743-38f7979bb6f3/last-tool-error-state.json +7 -0
- package/.omc/state/sessions/23d0ff82-17e5-428b-8743-38f7979bb6f3/pre-tool-advisory-throttle.json +18 -0
- package/.omc/state/sessions/38382db5-3088-4b5a-aff7-2561a60827c7/last-tool-error-state.json +7 -0
- package/.omc/state/sessions/38382db5-3088-4b5a-aff7-2561a60827c7/mission-state.json +145 -0
- package/.omc/state/sessions/38382db5-3088-4b5a-aff7-2561a60827c7/pre-tool-advisory-throttle.json +38 -0
- package/.omc/state/sessions/38382db5-3088-4b5a-aff7-2561a60827c7/ralplan-state.json +11 -0
- package/.omc/state/sessions/38382db5-3088-4b5a-aff7-2561a60827c7/subagent-tracking-state.json +98 -0
- package/.omc/state/sessions/41336850-028c-476b-be1a-2164e1e46cac/last-tool-error-state.json +7 -0
- package/.omc/state/sessions/41336850-028c-476b-be1a-2164e1e46cac/pre-tool-advisory-throttle.json +18 -0
- package/.omc/state/sessions/50c36be9-a3a2-42b9-9c85-5a06d3e22f6a/mission-state.json +61 -0
- package/.omc/state/sessions/50c36be9-a3a2-42b9-9c85-5a06d3e22f6a/pre-tool-advisory-throttle.json +22 -0
- package/.omc/state/sessions/50c36be9-a3a2-42b9-9c85-5a06d3e22f6a/skill-active-state.json +15 -0
- package/.omc/state/sessions/50c36be9-a3a2-42b9-9c85-5a06d3e22f6a/subagent-tracking-state.json +26 -0
- package/.omc/state/sessions/560ea519-574a-4713-b134-5bf6cfaf3c33/pre-tool-advisory-throttle.json +18 -0
- package/.omc/state/sessions/8198b3e5-fad6-4ee0-9c59-ef773ad89af4/pre-tool-advisory-throttle.json +14 -0
- package/.omc/state/sessions/8198b3e5-fad6-4ee0-9c59-ef773ad89af4/subagent-tracking-state.json +17 -0
- package/.omc/state/sessions/8cd7652a-b8b5-49cf-9b1f-bee8e5972458/pre-tool-advisory-throttle.json +18 -0
- package/.omc/state/sessions/8cd7652a-b8b5-49cf-9b1f-bee8e5972458/ralplan-state.json +11 -0
- package/.omc/state/sessions/8cd7652a-b8b5-49cf-9b1f-bee8e5972458/subagent-tracking-state.json +35 -0
- package/.omc/state/sessions/9bea518f-a9ee-4d14-bb53-a936ebaf647c/last-tool-error-state.json +7 -0
- package/.omc/state/sessions/9bea518f-a9ee-4d14-bb53-a936ebaf647c/mission-state.json +79 -0
- package/.omc/state/sessions/9bea518f-a9ee-4d14-bb53-a936ebaf647c/pre-tool-advisory-throttle.json +22 -0
- package/.omc/state/sessions/9bea518f-a9ee-4d14-bb53-a936ebaf647c/progress.txt +7 -0
- package/.omc/state/sessions/9bea518f-a9ee-4d14-bb53-a936ebaf647c/skill-active-state.json +15 -0
- package/.omc/state/sessions/9bea518f-a9ee-4d14-bb53-a936ebaf647c/subagent-tracking-state.json +26 -0
- package/.omc/state/sessions/b52d89fb-0e24-4901-bc66-27e3c1697126/pre-tool-advisory-throttle.json +14 -0
- package/.omc/state/sessions/b52d89fb-0e24-4901-bc66-27e3c1697126/subagent-tracking-state.json +17 -0
- package/.omc/state/sessions/c513ef38-cc3e-4a29-9c4c-1e0137245dd5/pre-tool-advisory-throttle.json +18 -0
- package/.omc/state/sessions/ed3e2cfb-a666-4bb1-bcc1-569d5d0b837a/pre-tool-advisory-throttle.json +18 -0
- package/.omc/state/sessions/f581a1ae-0ee4-48a3-96f3-ce31a0633bb0/pre-tool-advisory-throttle.json +18 -0
- package/.omc/state/sessions/f581a1ae-0ee4-48a3-96f3-ce31a0633bb0/subagent-tracking-state.json +17 -0
- package/.omc/state/sessions/f99d8dad-81d1-4987-8183-62edf0843d0c/pre-tool-advisory-throttle.json +14 -0
- package/.omc/state/sessions/f99d8dad-81d1-4987-8183-62edf0843d0c/ralph-state.json +13 -0
- package/.omc/state/sessions/f99d8dad-81d1-4987-8183-62edf0843d0c/ultrawork-state.json +11 -0
- package/.omc/state/sessions/fe1057b4-9a25-4e8e-8c3f-3e11652ee697/last-tool-error-state.json +7 -0
- package/.omc/state/sessions/fe1057b4-9a25-4e8e-8c3f-3e11652ee697/mission-state.json +61 -0
- package/.omc/state/sessions/fe1057b4-9a25-4e8e-8c3f-3e11652ee697/prd.json +22 -0
- package/.omc/state/sessions/fe1057b4-9a25-4e8e-8c3f-3e11652ee697/pre-tool-advisory-throttle.json +22 -0
- package/.omc/state/sessions/fe1057b4-9a25-4e8e-8c3f-3e11652ee697/progress.txt +22 -0
- package/.omc/state/sessions/fe1057b4-9a25-4e8e-8c3f-3e11652ee697/skill-active-state.json +15 -0
- package/.omc/state/sessions/fe1057b4-9a25-4e8e-8c3f-3e11652ee697/subagent-tracking-state.json +26 -0
- package/.turbo/turbo-build.log +3 -3
- package/.turbo/turbo-test.log +92 -44
- package/dist/boot-K4QUAFSP.js +2 -0
- package/dist/boot-K4QUAFSP.js.map +7 -0
- package/dist/chunk-RTSP2FCA.js +2 -0
- package/dist/chunk-RTSP2FCA.js.map +7 -0
- package/dist/chunk-VPBZR2PY.js +166 -0
- package/dist/chunk-VPBZR2PY.js.map +7 -0
- package/dist/cli.js +11 -107
- package/dist/cli.js.map +4 -4
- package/dist/entry/index.d.ts +2 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +4 -4
- package/dist/lib/vendor/config-schema.d.ts +58 -0
- package/dist/mcp.js +1 -54
- package/dist/mcp.js.map +4 -4
- package/eslint.config.js +33 -1
- package/package.json +5 -1
- package/scripts/build.js +11 -1
- package/src/.omc/state/agent-replay-c513ef38-cc3e-4a29-9c4c-1e0137245dd5.jsonl +4 -0
- package/src/.omc/state/agent-replay-ed3e2cfb-a666-4bb1-bcc1-569d5d0b837a.jsonl +2 -0
- package/src/.omc/state/idle-notif-cooldown.json +1 -1
- package/src/.omc/state/sessions/c513ef38-cc3e-4a29-9c4c-1e0137245dd5/mission-state.json +79 -0
- package/src/.omc/state/sessions/c513ef38-cc3e-4a29-9c4c-1e0137245dd5/pre-tool-advisory-throttle.json +22 -0
- package/src/.omc/state/sessions/c513ef38-cc3e-4a29-9c4c-1e0137245dd5/subagent-tracking-state.json +26 -0
- package/src/.omc/state/sessions/ed3e2cfb-a666-4bb1-bcc1-569d5d0b837a/pre-tool-advisory-throttle.json +18 -0
- package/src/.omc/state/sessions/ed3e2cfb-a666-4bb1-bcc1-569d5d0b837a/ralph-state.json +13 -0
- package/src/.omc/state/sessions/ed3e2cfb-a666-4bb1-bcc1-569d5d0b837a/ultrawork-state.json +11 -0
- package/src/.omc/state/sessions/f99d8dad-81d1-4987-8183-62edf0843d0c/pre-tool-advisory-throttle.json +14 -0
- package/src/commands/config/.omc/state/sessions/41336850-028c-476b-be1a-2164e1e46cac/last-tool-error-state.json +7 -0
- package/src/commands/config/.omc/state/sessions/41336850-028c-476b-be1a-2164e1e46cac/pre-tool-advisory-throttle.json +18 -0
- package/src/commands/config/config.ts +7 -37
- package/src/commands/doctor/__tests__/agent-files.test.ts +8 -30
- package/src/commands/doctor/__tests__/check-legacy-user-global-config.test.ts +110 -0
- package/src/commands/doctor/doctor.ts +110 -44
- package/src/commands/env-autoload/env-autoload.ts +12 -0
- package/src/commands/env-autoload/index.ts +1 -0
- package/src/commands/env-clear/__tests__/env-clear.test.ts +27 -0
- package/src/commands/env-clear/env-clear.ts +22 -8
- package/src/commands/env-load/__tests__/env-load.test.ts +36 -1
- package/src/commands/env-load/env-load.ts +152 -35
- package/src/commands/env-load/index.ts +2 -1
- package/src/commands/env-status/__tests__/env-status.test.ts +78 -0
- package/src/commands/env-status/env-status.ts +19 -7
- package/src/commands/gh-release-deploy-all/gh-release-deploy-all.ts +45 -1
- package/src/commands/gh-release-deploy-selected/gh-release-deploy-selected.ts +46 -1
- package/src/commands/init/__tests__/agent-files.test.ts +145 -27
- package/src/commands/init/__tests__/migrate-config.test.ts +136 -5
- package/src/commands/init/__tests__/migrate-factory-config.test.ts +93 -0
- package/src/commands/init/__tests__/seed-user-global-config.test.ts +64 -0
- package/src/commands/init/__tests__/shell-body.test.ts +30 -0
- package/src/commands/init/agent-files.ts +65 -45
- package/src/commands/init/init.ts +140 -31
- package/src/commands/init/migrate-config.ts +160 -32
- package/src/commands/vendor-check/__tests__/runtime-isolation.test.ts +71 -0
- package/src/commands/vendor-check/__tests__/vendor-check.test.ts +87 -0
- package/src/commands/vendor-check/index.ts +1 -0
- package/src/commands/vendor-check/vendor-check.ts +127 -0
- package/src/commands/vendor-config/__tests__/vendor-config.test.ts +103 -0
- package/src/commands/vendor-config/index.ts +1 -0
- package/src/commands/vendor-config/vendor-config.ts +162 -0
- package/src/commands/vendor-diff/__tests__/vendor-diff.test.ts +74 -0
- package/src/commands/vendor-diff/index.ts +1 -0
- package/src/commands/vendor-diff/vendor-diff.ts +77 -0
- package/src/commands/vendor-manifest/index.ts +1 -0
- package/src/commands/vendor-manifest/vendor-manifest.ts +60 -0
- package/src/commands/vendor-sync/__tests__/vendor-write.test.ts +86 -0
- package/src/commands/vendor-sync/index.ts +1 -0
- package/src/commands/vendor-sync/vendor-sync.ts +90 -0
- package/src/commands/worktrees-add/worktrees-add.ts +1 -1
- package/src/commands/worktrees-reload/worktrees-reload.ts +6 -5
- package/src/commands/worktrees-remove/worktrees-remove.ts +10 -1
- package/src/commands/worktrees-sync/worktrees-sync.ts +9 -1
- package/src/entry/cli.ts +417 -210
- package/src/entry/index.ts +7 -1
- package/src/integrations/cmux/__tests__/open-workspace-with-layout.test.ts +127 -0
- package/src/integrations/cmux/close-workspace-by-title.ts +2 -2
- package/src/integrations/cmux/list-workspace-titles.ts +1 -1
- package/src/integrations/cmux/open-workspace-with-layout.ts +15 -4
- package/src/integrations/cursor/.omc/state/agent-replay-f99d8dad-81d1-4987-8183-62edf0843d0c.jsonl +2 -0
- package/src/integrations/cursor/.omc/state/idle-notif-cooldown.json +3 -0
- package/src/integrations/cursor/.omc/state/sessions/f99d8dad-81d1-4987-8183-62edf0843d0c/pre-tool-advisory-throttle.json +18 -0
- package/src/integrations/cursor/.omc/state/sessions/f99d8dad-81d1-4987-8183-62edf0843d0c/subagent-tracking-state.json +17 -0
- package/src/integrations/cursor/index.ts +1 -0
- package/src/integrations/cursor/launch-cursor.ts +12 -0
- package/src/integrations/cursor/open-cursor-workspace.ts +8 -14
- package/src/integrations/doppler/__tests__/doppler-errors.test.ts +76 -0
- package/src/integrations/doppler/doppler-cli-auth.ts +12 -4
- package/src/integrations/doppler/doppler-errors.ts +88 -0
- package/src/integrations/doppler/doppler-project.ts +80 -0
- package/src/integrations/doppler/index.ts +3 -1
- package/src/integrations/gh/gh-cli-auth/gh-cli-auth.ts +9 -5
- package/src/integrations/gh/gh-release-prs/gh-release-prs.ts +16 -8
- package/src/integrations/ide/__tests__/ide-facade.test.ts +57 -10
- package/src/integrations/ide/add-ide-worktree-folders.ts +2 -4
- package/src/integrations/ide/open-ide-workspace.ts +6 -6
- package/src/integrations/ide/remove-ide-worktree-folders.ts +95 -30
- package/src/integrations/ide/types.ts +10 -1
- package/src/integrations/zed/__tests__/open-zed-workspace.test.ts +1 -17
- package/src/integrations/zed/__tests__/reuse-zed-workspace.test.ts +86 -0
- package/src/integrations/zed/index.ts +1 -0
- package/src/integrations/zed/open-zed-workspace.ts +4 -10
- package/src/integrations/zed/reuse-zed-workspace.ts +57 -0
- package/src/lib/command-catalog/__tests__/__snapshots__/command-catalog.test.ts.snap +212 -0
- package/src/lib/command-catalog/__tests__/command-catalog.test.ts +193 -0
- package/src/lib/command-catalog/command-catalog.ts +141 -0
- package/src/lib/command-catalog/index.ts +2 -0
- package/src/lib/command-echo/__tests__/command-echo.test.ts +127 -0
- package/src/lib/constants/constants.ts +13 -0
- package/src/lib/constants/index.ts +2 -0
- package/src/lib/env-autoload/__tests__/env-autoload.test.ts +288 -0
- package/src/lib/env-autoload/env-autoload.ts +294 -0
- package/src/lib/env-autoload/index.ts +9 -0
- package/src/lib/errors/operation-error.ts +1 -1
- package/src/lib/infra-kit-config/__tests__/env-autoload-schema.test.ts +71 -0
- package/src/lib/infra-kit-config/__tests__/infra-kit-config.test.ts +77 -6
- package/src/lib/infra-kit-config/index.ts +9 -1
- package/src/lib/infra-kit-config/infra-kit-config.ts +71 -11
- package/src/lib/json-output/__tests__/json-output.test.ts +139 -0
- package/src/lib/json-output/index.ts +1 -0
- package/src/lib/json-output/json-output.ts +47 -0
- package/src/lib/managed-block/managed-block.ts +4 -4
- package/src/lib/path-display/index.ts +1 -0
- package/src/lib/path-display/path-display.ts +42 -0
- package/src/lib/render/__tests__/render.test.ts +48 -0
- package/src/lib/render/index.ts +1 -0
- package/src/lib/render/render.ts +24 -0
- package/src/lib/vendor/__tests__/config-schema.test.ts +31 -0
- package/src/lib/vendor/__tests__/config.test.ts +63 -0
- package/src/lib/vendor/__tests__/factory-config.test.ts +92 -0
- package/src/lib/vendor/__tests__/vendor-lib.test.ts +158 -0
- package/src/lib/vendor/__tests__/zx-mock.ts +32 -0
- package/src/lib/vendor/config-schema.ts +78 -0
- package/src/lib/vendor/config.ts +58 -0
- package/src/lib/vendor/factory-config-schema.ts +35 -0
- package/src/lib/vendor/factory-config.ts +91 -0
- package/src/lib/vendor/hash.ts +16 -0
- package/src/lib/vendor/index.ts +23 -0
- package/src/lib/vendor/manifest.ts +151 -0
- package/src/lib/vendor/skip-sets.ts +48 -0
- package/src/lib/vendor/sync-ops.ts +290 -0
- package/src/lib/vendor/walk.ts +56 -0
- package/src/lib/worktrees/remove-worktrees.ts +15 -0
- package/src/mcp/tools/index.ts +5 -42
- package/src/sanity.test.tsx +1 -0
- package/src/tui/__tests__/no-react-boundary.test.ts +51 -0
- package/src/tui/boot.tsx +45 -0
- package/src/tui/screens/__tests__/command-palette.test.tsx +136 -0
- package/src/tui/screens/command-palette.tsx +159 -0
- package/src/tui/types.ts +8 -0
- package/tsconfig.json +1 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/vitest.config.ts +8 -0
- package/src/commands/worktrees-open/__tests__/open-cmux.test.ts +0 -96
- package/src/commands/worktrees-open/index.ts +0 -1
- package/src/commands/worktrees-open/worktrees-open.ts +0 -195
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import fs from 'node:fs'
|
|
2
|
+
import os from 'node:os'
|
|
3
|
+
import path from 'node:path'
|
|
4
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
|
5
|
+
|
|
6
|
+
import { execMock, zxModuleMock } from 'src/lib/vendor/__tests__/zx-mock'
|
|
7
|
+
|
|
8
|
+
import { vendorSync } from '../vendor-sync'
|
|
9
|
+
|
|
10
|
+
// Mock zx so the write commands run without shelling out to rsync/cp/git.
|
|
11
|
+
vi.mock('zx', () => {
|
|
12
|
+
return zxModuleMock()
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
let parent: string
|
|
16
|
+
let home: string
|
|
17
|
+
let sourceRoot: string
|
|
18
|
+
let targetRoot: string
|
|
19
|
+
|
|
20
|
+
const write = (root: string, rel: string, content: string): void => {
|
|
21
|
+
const full = path.join(root, rel)
|
|
22
|
+
|
|
23
|
+
fs.mkdirSync(path.dirname(full), { recursive: true })
|
|
24
|
+
fs.writeFileSync(full, content, 'utf8')
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
beforeEach(() => {
|
|
28
|
+
vi.clearAllMocks()
|
|
29
|
+
execMock.mockResolvedValue({ stdout: 'deadbeef\n' })
|
|
30
|
+
|
|
31
|
+
parent = fs.mkdtempSync(path.join(os.tmpdir(), 'vendor-write-test-'))
|
|
32
|
+
sourceRoot = path.join(parent, 'source-repo')
|
|
33
|
+
targetRoot = path.join(parent, 'target-repo')
|
|
34
|
+
|
|
35
|
+
// Machine-local factory config (workspaceDir + targets) lives under ~/.infra-kit;
|
|
36
|
+
// point os.homedir() at a fixture so the loader finds it.
|
|
37
|
+
home = fs.mkdtempSync(path.join(os.tmpdir(), 'vendor-write-home-'))
|
|
38
|
+
vi.spyOn(os, 'homedir').mockReturnValue(home)
|
|
39
|
+
write(home, '.infra-kit/vendor.json', JSON.stringify({ workspaceDir: parent, targets: ['target-repo'] }))
|
|
40
|
+
|
|
41
|
+
// Source repo: vendor content + config (copy[] only — targets is machine-local now).
|
|
42
|
+
write(sourceRoot, 'vendor/configs/a.js', 'aaa')
|
|
43
|
+
write(
|
|
44
|
+
sourceRoot,
|
|
45
|
+
'vendor.config.ts',
|
|
46
|
+
`export default { copy: [{ name: 'Configs', source: 'vendor/configs', target: 'vendor/configs', type: 'directory', vendored: true }] }`,
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
// Target repo: pre-existing vendor content (rsync is mocked, so this stays).
|
|
50
|
+
write(targetRoot, 'vendor/configs/a.js', 'aaa')
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
afterEach(() => {
|
|
54
|
+
vi.restoreAllMocks()
|
|
55
|
+
fs.rmSync(parent, { recursive: true, force: true })
|
|
56
|
+
fs.rmSync(home, { recursive: true, force: true })
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
describe('vendorSync', () => {
|
|
60
|
+
it('writes a manifest + README into the target vendor/ tree', async () => {
|
|
61
|
+
const { structuredContent } = await vendorSync({ cwd: sourceRoot, confirmedCommand: true })
|
|
62
|
+
|
|
63
|
+
expect(structuredContent.source).toBe('source-repo')
|
|
64
|
+
expect(structuredContent.repos).toHaveLength(1)
|
|
65
|
+
expect(structuredContent.repos[0]?.skipped).toBe(false)
|
|
66
|
+
|
|
67
|
+
const manifestPath = path.join(targetRoot, 'vendor', '.sync-manifest.json')
|
|
68
|
+
const readmePath = path.join(targetRoot, 'vendor', 'README.md')
|
|
69
|
+
|
|
70
|
+
expect(fs.existsSync(manifestPath)).toBe(true)
|
|
71
|
+
expect(fs.existsSync(readmePath)).toBe(true)
|
|
72
|
+
|
|
73
|
+
const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'))
|
|
74
|
+
|
|
75
|
+
expect(manifest.schemaVersion).toBe(1)
|
|
76
|
+
expect(Object.keys(manifest.files)).toContain('configs/a.js')
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
it('marks a non-existent target as skipped', async () => {
|
|
80
|
+
fs.rmSync(targetRoot, { recursive: true, force: true })
|
|
81
|
+
|
|
82
|
+
const { structuredContent } = await vendorSync({ cwd: sourceRoot, confirmedCommand: true })
|
|
83
|
+
|
|
84
|
+
expect(structuredContent.repos[0]?.skipped).toBe(true)
|
|
85
|
+
})
|
|
86
|
+
})
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { vendorSync, vendorSyncMcpTool } from './vendor-sync'
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import confirm from '@inquirer/confirm'
|
|
2
|
+
import path from 'node:path'
|
|
3
|
+
import process from 'node:process'
|
|
4
|
+
import { z } from 'zod'
|
|
5
|
+
|
|
6
|
+
import { getProjectRoot } from 'src/lib/git-utils'
|
|
7
|
+
import { logger } from 'src/lib/logger'
|
|
8
|
+
import { loadVendorConfig } from 'src/lib/vendor/config'
|
|
9
|
+
import { loadFactoryConfig } from 'src/lib/vendor/factory-config'
|
|
10
|
+
import { getSourceCommit, runSync, selectTargets } from 'src/lib/vendor/sync-ops'
|
|
11
|
+
import { defineMcpTool, textContent } from 'src/types'
|
|
12
|
+
import type { RequiredConfirmedOptionArg } from 'src/types'
|
|
13
|
+
|
|
14
|
+
interface VendorSyncOptions extends RequiredConfirmedOptionArg {
|
|
15
|
+
/** Source repo root. Defaults to the git toplevel. */
|
|
16
|
+
cwd?: string
|
|
17
|
+
/** Restrict the sync to these target repo names (defaults to all configured targets). */
|
|
18
|
+
repos?: string[]
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Copy every item declared in the source repo's `vendor.config.ts` into each
|
|
23
|
+
* target repo, then (re)write each target's `vendor/README.md` +
|
|
24
|
+
* `.sync-manifest.json`. Mutating: extends {@link RequiredConfirmedOptionArg} and
|
|
25
|
+
* prompts for confirmation unless `confirmedCommand` is set (MCP injects it).
|
|
26
|
+
*
|
|
27
|
+
* The config loader and `zx`/rsync live in `config`/`sync-ops`. `vendor check`
|
|
28
|
+
* stays free of them because it never imports the write commands — not because
|
|
29
|
+
* of how they are imported here.
|
|
30
|
+
*/
|
|
31
|
+
export const vendorSync = async (options: VendorSyncOptions) => {
|
|
32
|
+
const sourceRoot = options.cwd ?? (await getProjectRoot())
|
|
33
|
+
|
|
34
|
+
const config = await loadVendorConfig(sourceRoot)
|
|
35
|
+
const factory = await loadFactoryConfig()
|
|
36
|
+
const targets = selectTargets(factory.targets, options.repos)
|
|
37
|
+
|
|
38
|
+
if (!options.confirmedCommand) {
|
|
39
|
+
const proceed = await confirm(
|
|
40
|
+
{ message: `Sync vendor files from ${path.basename(sourceRoot)} into ${targets.length} repo(s)?` },
|
|
41
|
+
{ output: process.stderr },
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
if (!proceed) {
|
|
45
|
+
process.exit(0)
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const commit = await getSourceCommit(sourceRoot)
|
|
50
|
+
const source = path.basename(sourceRoot)
|
|
51
|
+
|
|
52
|
+
const structuredContent = await runSync(config, sourceRoot, factory.workspaceDir, targets, { source, commit })
|
|
53
|
+
|
|
54
|
+
for (const repo of structuredContent.repos) {
|
|
55
|
+
if (repo.skipped) {
|
|
56
|
+
logger.info(`⚠️ ${repo.repo}: target does not exist — skipped`)
|
|
57
|
+
} else {
|
|
58
|
+
logger.info(`✅ ${repo.repo}: copied ${repo.copied}/${repo.total} items + manifest`)
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return { content: textContent(JSON.stringify(structuredContent, null, 2)), structuredContent }
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const vendorSyncOutputSchema = {
|
|
66
|
+
source: z.string(),
|
|
67
|
+
commit: z.string(),
|
|
68
|
+
repos: z.array(
|
|
69
|
+
z.object({
|
|
70
|
+
repo: z.string(),
|
|
71
|
+
copied: z.number(),
|
|
72
|
+
total: z.number(),
|
|
73
|
+
skipped: z.boolean(),
|
|
74
|
+
}),
|
|
75
|
+
),
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// MCP Tool Registration (mutating — createToolHandler injects confirmedCommand:true).
|
|
79
|
+
export const vendorSyncMcpTool = defineMcpTool({
|
|
80
|
+
name: 'vendor-sync',
|
|
81
|
+
description:
|
|
82
|
+
'Copy vendored files from the source repo (vendor.config.ts) into each target repo and regenerate their vendor/.sync-manifest.json + README. Mutating; run from the source repo root.',
|
|
83
|
+
inputSchema: {
|
|
84
|
+
repos: z.array(z.string()).optional().describe('Restrict to these target repo names'),
|
|
85
|
+
},
|
|
86
|
+
outputSchema: vendorSyncOutputSchema,
|
|
87
|
+
handler: (params) => {
|
|
88
|
+
return vendorSync({ repos: params.repos, confirmedCommand: params.confirmedCommand })
|
|
89
|
+
},
|
|
90
|
+
})
|
|
@@ -349,7 +349,7 @@ export const worktreesAddMcpTool = defineMcpTool({
|
|
|
349
349
|
.boolean()
|
|
350
350
|
.optional()
|
|
351
351
|
.describe(
|
|
352
|
-
'Open each created worktree in a new cmux workspace
|
|
352
|
+
'Open each created worktree in a new cmux workspace, all rooted at the worktree directory. Pane layout follows "worktrees.cmux.layout" (default "two-columns": left | right; or "three-pane": left split top/bottom + full-height right). Resolution order: this flag → "worktrees.openInCmux" from infra-kit config → interactive prompt (CLI) / false (MCP, no TTY).',
|
|
353
353
|
),
|
|
354
354
|
},
|
|
355
355
|
outputSchema: {
|
|
@@ -27,8 +27,9 @@ interface WorktreesReloadResult {
|
|
|
27
27
|
/**
|
|
28
28
|
* Reload command: closes every open cmux workspace for the release worktrees on
|
|
29
29
|
* disk, then reopens the full set — cmux workspaces are recreated fresh and the
|
|
30
|
-
* configured editor workspace is reconciled and relaunched.
|
|
31
|
-
*
|
|
30
|
+
* configured editor workspace is reconciled and relaunched. The single
|
|
31
|
+
* window-restore command: also serves the cold-start case (editor + cmux closed),
|
|
32
|
+
* at the cost of tearing down any live cmux windows first.
|
|
32
33
|
*
|
|
33
34
|
* The editor has no per-window close primitive, so its "reload" is a reconcile +
|
|
34
35
|
* relaunch of the configured workspace. Safe to run from any branch
|
|
@@ -49,7 +50,7 @@ export const worktreesReload = async () => {
|
|
|
49
50
|
// Phase 2 — reopen. cmux and Cursor are independent surfaces, so reopen them
|
|
50
51
|
// concurrently to shrink the window where the just-closed cmux workspaces are gone.
|
|
51
52
|
const [ideOutcomes, { opened: openedCmux }] = await Promise.all([
|
|
52
|
-
openIdeWorkspace({ projectRoot, worktreeDir, currentBranches
|
|
53
|
+
openIdeWorkspace({ projectRoot, worktreeDir, currentBranches }),
|
|
53
54
|
reopenCmux({ worktreeDir, currentBranches, repoName }),
|
|
54
55
|
])
|
|
55
56
|
|
|
@@ -144,7 +145,7 @@ interface ReopenCmuxOutcome {
|
|
|
144
145
|
* Recreate a cmux workspace for every release worktree on disk. Force-opens each
|
|
145
146
|
* branch (no dedup against the live workspace list): reload has just awaited the
|
|
146
147
|
* close of these workspaces, so it favours liveness — guaranteeing every branch
|
|
147
|
-
* ends up open
|
|
148
|
+
* ends up open.
|
|
148
149
|
*/
|
|
149
150
|
export const reopenCmux = async (args: ReopenCmuxArgs): Promise<ReopenCmuxOutcome> => {
|
|
150
151
|
const { worktreeDir, currentBranches, repoName } = args
|
|
@@ -212,7 +213,7 @@ const logResults = (result: WorktreesReloadResult, context: LogResultsContext):
|
|
|
212
213
|
export const worktreesReloadMcpTool = defineMcpTool({
|
|
213
214
|
name: 'worktrees-reload',
|
|
214
215
|
description:
|
|
215
|
-
'Close all open cmux workspaces for the current release worktrees, then reopen the full set
|
|
216
|
+
'Close all open cmux workspaces for the current release worktrees, then reopen the full set — the single window-restore command. Every configured editor (Cursor and/or Zed) is reconciled + relaunched (no per-window close). Disruptive: closes live cmux windows first. Safe to run from any branch. Use to refresh stale windows or to restore everything after a cold start (editor + cmux closed).',
|
|
216
217
|
inputSchema: {},
|
|
217
218
|
outputSchema: {
|
|
218
219
|
closedCmux: z.array(z.string()).describe('Titles of cmux workspaces a close was attempted for (best-effort)'),
|
|
@@ -118,7 +118,16 @@ export const worktreesRemove = async (options: WorktreeManagementArgs) => {
|
|
|
118
118
|
pruneFolder: allSelected,
|
|
119
119
|
})
|
|
120
120
|
|
|
121
|
-
|
|
121
|
+
// `!confirmedCommand` is the interactive path (a human used the picker/confirm). Only there
|
|
122
|
+
// do we let Zed's destructive `--reuse` relaunch fire; MCP/--yes runs (confirmedCommand=true)
|
|
123
|
+
// and worktrees-sync never relaunch an editor window.
|
|
124
|
+
await removeIdeWorktreeFolders({
|
|
125
|
+
projectRoot,
|
|
126
|
+
worktreeDir,
|
|
127
|
+
currentWorktrees,
|
|
128
|
+
removedWorktrees,
|
|
129
|
+
allowEditorRelaunch: !confirmedCommand,
|
|
130
|
+
})
|
|
122
131
|
|
|
123
132
|
logResults(removedWorktrees)
|
|
124
133
|
|
|
@@ -72,7 +72,15 @@ export const worktreesSync = async (options: WorktreeSyncArgs) => {
|
|
|
72
72
|
repoName,
|
|
73
73
|
})
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
// Hard `false`: sync is background/stale-cleanup (predominantly the MCP path) — it must never
|
|
76
|
+
// relaunch and overwrite a focused Zed window. Zed removal stays a no-op here.
|
|
77
|
+
await removeIdeWorktreeFolders({
|
|
78
|
+
projectRoot,
|
|
79
|
+
worktreeDir,
|
|
80
|
+
currentWorktrees,
|
|
81
|
+
removedWorktrees,
|
|
82
|
+
allowEditorRelaunch: false,
|
|
83
|
+
})
|
|
76
84
|
|
|
77
85
|
logResults(removedWorktrees)
|
|
78
86
|
|