infra-kit 0.1.111 → 0.1.114

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/.eslintcache +1 -1
  2. package/.omc/state/agent-replay-0d1515ce-4ebe-4ce8-a865-2897f68de168.jsonl +1 -0
  3. package/.omc/state/agent-replay-127837d3-a000-4656-9453-2324ab353723.jsonl +5 -0
  4. package/.omc/state/agent-replay-15c409af-24fa-4026-88d3-a82dd1e68b87.jsonl +11 -0
  5. package/.omc/state/agent-replay-74afa912-1443-4011-b4f2-db9f055cdd9f.jsonl +3 -0
  6. package/.omc/state/agent-replay-8dd0ad2f-3a90-4158-b9de-ec8e19a7c983.jsonl +3 -0
  7. package/.omc/state/agent-replay-f99d8dad-81d1-4987-8183-62edf0843d0c.jsonl +2 -0
  8. package/.omc/state/idle-notif-cooldown.json +1 -1
  9. package/.omc/state/sessions/0d1515ce-4ebe-4ce8-a865-2897f68de168/pre-tool-advisory-throttle.json +10 -0
  10. package/.omc/state/sessions/127837d3-a000-4656-9453-2324ab353723/mission-state.json +61 -0
  11. package/.omc/state/sessions/127837d3-a000-4656-9453-2324ab353723/pre-tool-advisory-throttle.json +22 -0
  12. package/.omc/state/sessions/127837d3-a000-4656-9453-2324ab353723/skill-active-state.json +15 -0
  13. package/.omc/state/sessions/127837d3-a000-4656-9453-2324ab353723/subagent-tracking-state.json +26 -0
  14. package/.omc/state/sessions/15c409af-24fa-4026-88d3-a82dd1e68b87/last-tool-error-state.json +7 -0
  15. package/.omc/state/sessions/15c409af-24fa-4026-88d3-a82dd1e68b87/mission-state.json +89 -0
  16. package/.omc/state/sessions/15c409af-24fa-4026-88d3-a82dd1e68b87/pre-tool-advisory-throttle.json +34 -0
  17. package/.omc/state/sessions/15c409af-24fa-4026-88d3-a82dd1e68b87/ralph-state.json +13 -0
  18. package/.omc/state/sessions/15c409af-24fa-4026-88d3-a82dd1e68b87/skill-active-state.json +15 -0
  19. package/.omc/state/sessions/15c409af-24fa-4026-88d3-a82dd1e68b87/subagent-tracking-state.json +44 -0
  20. package/.omc/state/sessions/15c409af-24fa-4026-88d3-a82dd1e68b87/ultrawork-state.json +11 -0
  21. package/.omc/state/sessions/560ea519-574a-4713-b134-5bf6cfaf3c33/pre-tool-advisory-throttle.json +18 -0
  22. package/.omc/state/sessions/74afa912-1443-4011-b4f2-db9f055cdd9f/pre-tool-advisory-throttle.json +18 -0
  23. package/.omc/state/sessions/74afa912-1443-4011-b4f2-db9f055cdd9f/skill-active-state.json +15 -0
  24. package/.omc/state/sessions/74afa912-1443-4011-b4f2-db9f055cdd9f/subagent-tracking-state.json +17 -0
  25. package/.omc/state/sessions/8dd0ad2f-3a90-4158-b9de-ec8e19a7c983/pre-tool-advisory-throttle.json +14 -0
  26. package/.omc/state/sessions/8dd0ad2f-3a90-4158-b9de-ec8e19a7c983/ralph-state.json +13 -0
  27. package/.omc/state/sessions/8dd0ad2f-3a90-4158-b9de-ec8e19a7c983/subagent-tracking-state.json +17 -0
  28. package/.omc/state/sessions/8dd0ad2f-3a90-4158-b9de-ec8e19a7c983/ultrawork-state.json +11 -0
  29. package/.omc/state/sessions/f99d8dad-81d1-4987-8183-62edf0843d0c/pre-tool-advisory-throttle.json +14 -0
  30. package/.omc/state/sessions/f99d8dad-81d1-4987-8183-62edf0843d0c/ralph-state.json +13 -0
  31. package/.omc/state/sessions/f99d8dad-81d1-4987-8183-62edf0843d0c/ultrawork-state.json +11 -0
  32. package/.turbo/turbo-build.log +3 -4
  33. package/.turbo/turbo-eslint-check.log +1 -2
  34. package/.turbo/turbo-prettier-check.log +1 -2
  35. package/.turbo/turbo-prettier-fix.log +1 -2
  36. package/.turbo/turbo-test.log +25 -18
  37. package/.turbo/turbo-ts-check.log +1 -2
  38. package/dist/cli.js +62 -54
  39. package/dist/cli.js.map +4 -4
  40. package/dist/mcp.js +36 -36
  41. package/dist/mcp.js.map +4 -4
  42. package/package.json +1 -1
  43. package/src/.omc/state/agent-replay-8dd0ad2f-3a90-4158-b9de-ec8e19a7c983.jsonl +11 -0
  44. package/src/.omc/state/idle-notif-cooldown.json +3 -0
  45. package/src/.omc/state/sessions/8dd0ad2f-3a90-4158-b9de-ec8e19a7c983/mission-state.json +79 -0
  46. package/src/.omc/state/sessions/8dd0ad2f-3a90-4158-b9de-ec8e19a7c983/pre-tool-advisory-throttle.json +22 -0
  47. package/src/.omc/state/sessions/8dd0ad2f-3a90-4158-b9de-ec8e19a7c983/ralph-state.json +13 -0
  48. package/src/.omc/state/sessions/8dd0ad2f-3a90-4158-b9de-ec8e19a7c983/subagent-tracking-state.json +26 -0
  49. package/src/.omc/state/sessions/8dd0ad2f-3a90-4158-b9de-ec8e19a7c983/ultrawork-state.json +11 -0
  50. package/src/.omc/state/sessions/f99d8dad-81d1-4987-8183-62edf0843d0c/pre-tool-advisory-throttle.json +14 -0
  51. package/src/commands/doctor/.omc/state/sessions/8dd0ad2f-3a90-4158-b9de-ec8e19a7c983/pre-tool-advisory-throttle.json +14 -0
  52. package/src/commands/doctor/__tests__/check-ide-installed.test.ts +142 -0
  53. package/src/commands/doctor/doctor.ts +104 -1
  54. package/src/commands/gh-release-deliver/gh-release-deliver.ts +32 -1
  55. package/src/commands/init/.omc/state/sessions/8dd0ad2f-3a90-4158-b9de-ec8e19a7c983/pre-tool-advisory-throttle.json +18 -0
  56. package/src/commands/init/__tests__/migrate-config.test.ts +132 -1
  57. package/src/commands/init/init.ts +19 -6
  58. package/src/commands/init/migrate-config.ts +104 -0
  59. package/src/commands/worktrees-add/index.ts +1 -2
  60. package/src/commands/worktrees-add/worktrees-add.ts +24 -60
  61. package/src/commands/worktrees-open/worktrees-open.ts +55 -68
  62. package/src/commands/worktrees-reload/__tests__/reload-cmux.test.ts +119 -0
  63. package/src/commands/worktrees-reload/index.ts +1 -0
  64. package/src/commands/worktrees-reload/worktrees-reload.ts +229 -0
  65. package/src/commands/worktrees-remove/worktrees-remove.ts +2 -44
  66. package/src/commands/worktrees-sync/worktrees-sync.ts +2 -44
  67. package/src/entry/cli.ts +32 -11
  68. package/src/integrations/cursor/.omc/state/agent-replay-f99d8dad-81d1-4987-8183-62edf0843d0c.jsonl +2 -0
  69. package/src/integrations/cursor/.omc/state/idle-notif-cooldown.json +3 -0
  70. package/src/integrations/cursor/.omc/state/sessions/f99d8dad-81d1-4987-8183-62edf0843d0c/pre-tool-advisory-throttle.json +18 -0
  71. package/src/integrations/cursor/.omc/state/sessions/f99d8dad-81d1-4987-8183-62edf0843d0c/subagent-tracking-state.json +17 -0
  72. package/src/integrations/cursor/index.ts +2 -0
  73. package/src/integrations/cursor/launch-cursor.ts +12 -0
  74. package/src/integrations/cursor/open-cursor-workspace.ts +69 -0
  75. package/src/integrations/ide/__tests__/ide-facade.test.ts +250 -0
  76. package/src/integrations/ide/add-ide-worktree-folders.ts +77 -0
  77. package/src/integrations/ide/index.ts +6 -0
  78. package/src/integrations/ide/open-ide-workspace.ts +51 -0
  79. package/src/integrations/ide/provider-label.ts +24 -0
  80. package/src/integrations/ide/remove-ide-worktree-folders.ts +80 -0
  81. package/src/integrations/ide/types.ts +32 -0
  82. package/src/integrations/zed/__tests__/open-zed-workspace.test.ts +85 -0
  83. package/src/integrations/zed/add-folders-to-zed-workspace.ts +30 -0
  84. package/src/integrations/zed/index.ts +2 -0
  85. package/src/integrations/zed/open-zed-workspace.ts +57 -0
  86. package/src/lib/assert-never/assert-never.ts +15 -0
  87. package/src/lib/assert-never/index.ts +1 -0
  88. package/src/lib/git-utils/__tests__/git-primitives.test.ts +122 -1
  89. package/src/lib/git-utils/git-utils.ts +35 -0
  90. package/src/lib/git-utils/index.ts +2 -0
  91. package/src/lib/infra-kit-config/.omc/state/sessions/8dd0ad2f-3a90-4158-b9de-ec8e19a7c983/pre-tool-advisory-throttle.json +18 -0
  92. package/src/lib/infra-kit-config/__tests__/infra-kit-config.test.ts +172 -9
  93. package/src/lib/infra-kit-config/index.ts +2 -1
  94. package/src/lib/infra-kit-config/infra-kit-config.ts +80 -22
  95. package/src/lib/package-config/.omc/state/sessions/dde22a92-a0e9-4948-905d-25c9a812ab35/last-tool-error-state.json +7 -0
  96. package/src/lib/package-config/.omc/state/sessions/dde22a92-a0e9-4948-905d-25c9a812ab35/pre-tool-advisory-throttle.json +10 -0
  97. package/src/lib/worktrees/remove-worktrees.ts +15 -0
  98. package/src/mcp/tools/index.ts +2 -0
  99. package/tsconfig.tsbuildinfo +1 -1
@@ -22,27 +22,36 @@ const dopplerEnvManagementSchema = z.object({
22
22
  const envManagementSchema = z.discriminatedUnion('provider', [dopplerEnvManagementSchema])
23
23
 
24
24
  // ide
25
- const cursorIdeConfigSchema = z
26
- .object({
27
- mode: z.enum(['workspace', 'windows']).default('workspace'),
28
- workspaceConfigPath: z.string().min(1).optional(),
29
- })
30
- .refine(
31
- (v) => {
32
- return v.mode !== 'workspace' || !!v.workspaceConfigPath
33
- },
34
- {
35
- message: 'workspaceConfigPath is required when mode is "workspace"',
36
- path: ['workspaceConfigPath'],
37
- },
38
- )
25
+ // There is one attach style: each worktree is added to the configured editor's
26
+ // workspace and opened (no per-window mode). Cursor needs a `.code-workspace`
27
+ // path to reconcile its `folders` array against.
28
+ const cursorIdeConfigSchema = z.object({
29
+ workspaceConfigPath: z.string().min(1),
30
+ })
39
31
 
40
32
  const cursorIdeSchema = z.object({
41
33
  provider: z.literal('cursor'),
42
34
  config: cursorIdeConfigSchema,
43
35
  })
44
36
 
45
- const ideSchema = z.discriminatedUnion('provider', [cursorIdeSchema])
37
+ // Zed has no portable workspace file (no `.code-workspace`) and no folder-remove
38
+ // CLI: a multi-worktree workspace is realized by a single `zed <root> <wt...>`
39
+ // invocation. So `config` carries no settings — there's no path to point at.
40
+ const zedIdeConfigSchema = z.object({})
41
+
42
+ const zedIdeSchema = z.object({
43
+ provider: z.literal('zed'),
44
+ config: zedIdeConfigSchema,
45
+ })
46
+
47
+ const ideSchema = z.discriminatedUnion('provider', [cursorIdeSchema, zedIdeSchema])
48
+
49
+ // `ide` accepts a single provider (back-compat) OR an array to drive multiple
50
+ // editors at once (e.g. Cursor + Zed). Normalized to an array everywhere via
51
+ // `resolveConfiguredIdes`. Uniqueness-by-provider is enforced at parse time by a
52
+ // `.superRefine` on the full config schema (see below) — not here, so the message
53
+ // survives `z.union` error aggregation.
54
+ const idesSchema = z.union([ideSchema, z.array(ideSchema).min(1)])
46
55
 
47
56
  // taskManager
48
57
  const jiraTaskManagerSchema = z.object({
@@ -61,18 +70,67 @@ const worktreesConfigSchema = z.object({
61
70
  openInCmux: z.boolean().optional(),
62
71
  })
63
72
 
64
- export const infraKitConfigSchema = z.object({
73
+ // Base object shape, kept separate so `.partial()` (which only works on a plain
74
+ // ZodObject, not the `.superRefine`-wrapped full schema) can derive the override
75
+ // schema from it.
76
+ const infraKitConfigObject = z.object({
65
77
  environments: z.array(z.string().min(1)).min(1),
66
78
  envManagement: envManagementSchema,
67
- ide: ideSchema.optional(),
79
+ ide: idesSchema.optional(),
68
80
  taskManager: taskManagerSchema.optional(),
69
81
  worktrees: worktreesConfigSchema.optional(),
70
82
  })
71
83
 
72
- export const infraKitOverrideConfigSchema = infraKitConfigSchema.partial()
84
+ // Full schema = base object + a parse-time uniqueness check on the `ide` array.
85
+ // This runs inside the *merged* `safeParse` in getInfraKitConfig, so it's the
86
+ // gate for the final config. (The override layers use the `.partial()` form
87
+ // below, which drops this object-level refinement — acceptable, the merged
88
+ // parse is authoritative.)
89
+ export const infraKitConfigSchema = infraKitConfigObject.superRefine((cfg, ctx) => {
90
+ if (!Array.isArray(cfg.ide)) return
91
+
92
+ const seen = new Set<string>()
93
+
94
+ for (const entry of cfg.ide) {
95
+ if (seen.has(entry.provider)) {
96
+ ctx.addIssue({
97
+ code: 'custom',
98
+ message: 'each IDE provider may appear at most once',
99
+ path: ['ide'],
100
+ })
101
+
102
+ return
103
+ }
104
+
105
+ seen.add(entry.provider)
106
+ }
107
+ })
108
+
109
+ export const infraKitOverrideConfigSchema = infraKitConfigObject.partial()
73
110
 
74
111
  export type InfraKitConfig = z.infer<typeof infraKitConfigSchema>
75
112
 
113
+ /** A single resolved IDE entry (`{ provider, config }`). */
114
+ export type ConfiguredIde = z.infer<typeof ideSchema>
115
+
116
+ /**
117
+ * Normalize the `ide` config (single object, array, or unset) into a flat list.
118
+ * Validation-free: assumes already-parsed input (uniqueness is enforced by the
119
+ * schema). The one source of truth for "which editors are configured."
120
+ *
121
+ * @example
122
+ * resolveConfiguredIdes({ ide: { provider: 'cursor', config: {...} } }) // => [cursor]
123
+ * resolveConfiguredIdes({ ide: [cursor, zed] }) // => [cursor, zed]
124
+ * resolveConfiguredIdes({}) // => []
125
+ */
126
+ export const resolveConfiguredIdes = (config: InfraKitConfig): ConfiguredIde[] => {
127
+ const ide = config.ide
128
+
129
+ if (!ide) return []
130
+
131
+ return Array.isArray(ide) ? ide : [ide]
132
+ }
133
+
76
134
  export interface InfraKitConfigPaths {
77
135
  /** Committed project config (required). */
78
136
  main: string
@@ -131,9 +189,9 @@ export const getInfraKitConfigPaths = async (): Promise<InfraKitConfigPaths> =>
131
189
  *
132
190
  * @example
133
191
  * // infra-kit.json: { "environments": ["dev"], "envManagement": { "provider": "doppler", "config": { "name": "p" } } }
134
- * // ~/.infra-kit/config.json: { "ide": { "provider": "cursor", "config": { "mode": "windows" } } }
192
+ * // ~/.infra-kit/config.json: { "ide": { "provider": "cursor", "config": { "workspaceConfigPath": "./ws.code-workspace" } } }
135
193
  * const cfg = await getInfraKitConfig()
136
- * // => { environments: ['dev'], envManagement: {...}, ide: { provider: 'cursor', config: { mode: 'windows' } } }
194
+ * // => { environments: ['dev'], envManagement: {...}, ide: { provider: 'cursor', config: { workspaceConfigPath: './ws.code-workspace' } } }
137
195
  */
138
196
  export const getInfraKitConfig = async (): Promise<InfraKitConfig> => {
139
197
  const paths = await getInfraKitConfigPaths()
@@ -281,9 +339,9 @@ interface ConfigLayer {
281
339
  * // => null
282
340
  *
283
341
  * @example
284
- * // /home/me/.infra-kit/config.json: '{ "ide": { "provider": "cursor", "config": { "mode": "windows" } } }'
342
+ * // /home/me/.infra-kit/config.json: '{ "ide": { "provider": "cursor", "config": { "workspaceConfigPath": "./ws.code-workspace" } } }'
285
343
  * await loadLayer({ label: '~/.infra-kit/config.json', path: '/home/me/.infra-kit/config.json', required: false })
286
- * // => { ide: { provider: 'cursor', config: { mode: 'windows' } } }
344
+ * // => { ide: { provider: 'cursor', config: { workspaceConfigPath: './ws.code-workspace' } } }
287
345
  */
288
346
  const loadLayer = async (layer: ConfigLayer): Promise<Record<string, unknown> | null> => {
289
347
  const raw = await readIfExists(layer.path)
@@ -0,0 +1,7 @@
1
+ {
2
+ "tool_name": "Bash",
3
+ "tool_input_preview": "{\"command\":\"rtk ls -1 infra-kit.config.ts apps/*/*/infra-kit.config.* packages/*/infra-kit.config.* vendor/packages/*/infra-kit.config.* vendor/configs/*/infra-kit.config.* 2>/dev/null\",\"description\":...",
4
+ "error": "Exit code 1\n(eval):1: no matches found: apps/*/*/infra-kit.config.*",
5
+ "timestamp": "2026-06-20T09:23:27.849Z",
6
+ "retry_count": 1
7
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 1,
3
+ "entries": {
4
+ "79a93d4a2f8f50b95f852280616242fee1855dc99a3c75211917f55e72e95fae": {
5
+ "last_emitted_at_ms": 1781947394826,
6
+ "message": "Use parallel execution for independent tasks. Use run_in_background for long operations (npm install, builds, tests)."
7
+ }
8
+ },
9
+ "updated_at": "2026-06-20T09:23:14.826Z"
10
+ }
@@ -53,6 +53,21 @@ export const removeWorktrees = async (args: RemoveWorktreesArgs): Promise<string
53
53
  }
54
54
  }
55
55
 
56
+ // `git worktree remove` only deletes the leaf worktree, leaving the group
57
+ // folder (e.g. `release/`, `feature/`) behind. Remove it when it's now empty;
58
+ // `rmdir` is a no-op when the folder still holds other worktrees.
59
+ const groupDirs = new Set<string>()
60
+
61
+ for (const branch of removed) {
62
+ if (branch.includes('/')) {
63
+ groupDirs.add(`${worktreeDir}/${branch.split('/')[0]}`)
64
+ }
65
+ }
66
+
67
+ for (const groupDir of groupDirs) {
68
+ await $`rmdir ${groupDir}`.nothrow()
69
+ }
70
+
56
71
  if (pruneFolder && removed.length === branches.length) {
57
72
  await $`git worktree prune`
58
73
  await $`rm -rf ${worktreeDir}`
@@ -16,6 +16,7 @@ import { versionMcpTool } from 'src/commands/version'
16
16
  import { worktreesAddMcpTool } from 'src/commands/worktrees-add'
17
17
  import { worktreesListMcpTool } from 'src/commands/worktrees-list'
18
18
  import { worktreesOpenMcpTool } from 'src/commands/worktrees-open'
19
+ import { worktreesReloadMcpTool } from 'src/commands/worktrees-reload'
19
20
  import { worktreesRemoveMcpTool } from 'src/commands/worktrees-remove'
20
21
  import { worktreesSyncMcpTool } from 'src/commands/worktrees-sync'
21
22
  import { createToolHandler } from 'src/lib/tool-handler'
@@ -37,6 +38,7 @@ const tools = [
37
38
  worktreesAddMcpTool,
38
39
  worktreesListMcpTool,
39
40
  worktreesOpenMcpTool,
41
+ worktreesReloadMcpTool,
40
42
  worktreesRemoveMcpTool,
41
43
  worktreesSyncMcpTool,
42
44
  ]