@inventarch/cli 3.5.1 → 3.7.0

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 (211) hide show
  1. package/NOTICE +2 -0
  2. package/README.md +2 -1
  3. package/SPEC.md +18 -5
  4. package/THIRD_PARTY_NOTICES.txt +49 -0
  5. package/assets/base/ee6e65018df2ebef705913d9da1947f040edf44c2e7ade6c9750c6fa0185985e.ia.tgz +0 -0
  6. package/assets/base.json +3 -3
  7. package/assets/host/e373b0f6699516f2ab8794f966728d2f82bca05ba3199c9fc642437cb79b13d5.tgz +0 -0
  8. package/assets/host.json +4 -4
  9. package/assets/vocabulary.json +1 -1
  10. package/dist/args.d.ts +9 -0
  11. package/dist/args.d.ts.map +1 -1
  12. package/dist/args.js.map +1 -1
  13. package/dist/bin.d.ts +3 -0
  14. package/dist/bin.d.ts.map +1 -0
  15. package/dist/bin.js +53 -0
  16. package/dist/bin.js.map +1 -0
  17. package/dist/claude-cli.d.ts +13 -1
  18. package/dist/claude-cli.d.ts.map +1 -1
  19. package/dist/claude-cli.js +31 -1
  20. package/dist/claude-cli.js.map +1 -1
  21. package/dist/commands.d.ts +17 -0
  22. package/dist/commands.d.ts.map +1 -1
  23. package/dist/commands.js +66 -3
  24. package/dist/commands.js.map +1 -1
  25. package/dist/committed-host.d.ts.map +1 -1
  26. package/dist/committed-host.js +14 -2
  27. package/dist/committed-host.js.map +1 -1
  28. package/dist/console/app.d.ts +47 -0
  29. package/dist/console/app.d.ts.map +1 -0
  30. package/dist/console/app.js +921 -0
  31. package/dist/console/app.js.map +1 -0
  32. package/dist/console/batch-next.d.ts +54 -0
  33. package/dist/console/batch-next.d.ts.map +1 -0
  34. package/dist/console/batch-next.js +260 -0
  35. package/dist/console/batch-next.js.map +1 -0
  36. package/dist/console/batch-plan.d.ts +109 -0
  37. package/dist/console/batch-plan.d.ts.map +1 -0
  38. package/dist/console/batch-plan.js +308 -0
  39. package/dist/console/batch-plan.js.map +1 -0
  40. package/dist/console/batch-run.d.ts +195 -0
  41. package/dist/console/batch-run.d.ts.map +1 -0
  42. package/dist/console/batch-run.js +868 -0
  43. package/dist/console/batch-run.js.map +1 -0
  44. package/dist/console/batch-screen.d.ts +36 -0
  45. package/dist/console/batch-screen.d.ts.map +1 -0
  46. package/dist/console/batch-screen.js +113 -0
  47. package/dist/console/batch-screen.js.map +1 -0
  48. package/dist/console/grid.d.ts +30 -0
  49. package/dist/console/grid.d.ts.map +1 -0
  50. package/dist/console/grid.js +87 -0
  51. package/dist/console/grid.js.map +1 -0
  52. package/dist/console/keys.d.ts +54 -0
  53. package/dist/console/keys.d.ts.map +1 -0
  54. package/dist/console/keys.js +204 -0
  55. package/dist/console/keys.js.map +1 -0
  56. package/dist/console/layout-all.d.ts +70 -0
  57. package/dist/console/layout-all.d.ts.map +1 -0
  58. package/dist/console/layout-all.js +401 -0
  59. package/dist/console/layout-all.js.map +1 -0
  60. package/dist/console/layout-repo.d.ts +65 -0
  61. package/dist/console/layout-repo.d.ts.map +1 -0
  62. package/dist/console/layout-repo.js +275 -0
  63. package/dist/console/layout-repo.js.map +1 -0
  64. package/dist/console/load.d.ts +33 -0
  65. package/dist/console/load.d.ts.map +1 -0
  66. package/dist/console/load.js +166 -0
  67. package/dist/console/load.js.map +1 -0
  68. package/dist/console/offers.d.ts +39 -0
  69. package/dist/console/offers.d.ts.map +1 -0
  70. package/dist/console/offers.js +285 -0
  71. package/dist/console/offers.js.map +1 -0
  72. package/dist/console/run.d.ts +56 -0
  73. package/dist/console/run.d.ts.map +1 -0
  74. package/dist/console/run.js +210 -0
  75. package/dist/console/run.js.map +1 -0
  76. package/dist/console/state.d.ts +127 -0
  77. package/dist/console/state.d.ts.map +1 -0
  78. package/dist/console/state.js +273 -0
  79. package/dist/console/state.js.map +1 -0
  80. package/dist/console/terminal.d.ts +60 -0
  81. package/dist/console/terminal.d.ts.map +1 -0
  82. package/dist/console/terminal.js +114 -0
  83. package/dist/console/terminal.js.map +1 -0
  84. package/dist/console/width-table.d.ts +10 -0
  85. package/dist/console/width-table.d.ts.map +1 -0
  86. package/dist/console/width-table.js +753 -0
  87. package/dist/console/width-table.js.map +1 -0
  88. package/dist/console/width.d.ts +18 -0
  89. package/dist/console/width.d.ts.map +1 -0
  90. package/dist/console/width.js +114 -0
  91. package/dist/console/width.js.map +1 -0
  92. package/dist/console/workspaces-state.d.ts +93 -0
  93. package/dist/console/workspaces-state.d.ts.map +1 -0
  94. package/dist/console/workspaces-state.js +192 -0
  95. package/dist/console/workspaces-state.js.map +1 -0
  96. package/dist/consumer.d.ts +13 -8
  97. package/dist/consumer.d.ts.map +1 -1
  98. package/dist/consumer.js +22 -34
  99. package/dist/consumer.js.map +1 -1
  100. package/dist/discovery.d.ts +8 -0
  101. package/dist/discovery.d.ts.map +1 -0
  102. package/dist/discovery.js +36 -0
  103. package/dist/discovery.js.map +1 -0
  104. package/dist/distribute.d.ts +9 -0
  105. package/dist/distribute.d.ts.map +1 -1
  106. package/dist/distribute.js +70 -13
  107. package/dist/distribute.js.map +1 -1
  108. package/dist/doctor-authority.d.ts.map +1 -1
  109. package/dist/doctor-authority.js +7 -4
  110. package/dist/doctor-authority.js.map +1 -1
  111. package/dist/doctor-extensions.d.ts +36 -0
  112. package/dist/doctor-extensions.d.ts.map +1 -0
  113. package/dist/doctor-extensions.js +118 -0
  114. package/dist/doctor-extensions.js.map +1 -0
  115. package/dist/doctor-mounts.d.ts.map +1 -1
  116. package/dist/doctor-mounts.js +3 -2
  117. package/dist/doctor-mounts.js.map +1 -1
  118. package/dist/doctor-user.d.ts +64 -0
  119. package/dist/doctor-user.d.ts.map +1 -1
  120. package/dist/doctor-user.js +309 -34
  121. package/dist/doctor-user.js.map +1 -1
  122. package/dist/doctor.d.ts +22 -1
  123. package/dist/doctor.d.ts.map +1 -1
  124. package/dist/doctor.js +81 -32
  125. package/dist/doctor.js.map +1 -1
  126. package/dist/fix.d.ts +67 -0
  127. package/dist/fix.d.ts.map +1 -0
  128. package/dist/fix.js +136 -0
  129. package/dist/fix.js.map +1 -0
  130. package/dist/handoff.d.ts +65 -0
  131. package/dist/handoff.d.ts.map +1 -0
  132. package/dist/handoff.js +264 -0
  133. package/dist/handoff.js.map +1 -0
  134. package/dist/host-projection.d.ts.map +1 -1
  135. package/dist/host-projection.js +1 -8
  136. package/dist/host-projection.js.map +1 -1
  137. package/dist/host.d.ts +9 -3
  138. package/dist/host.d.ts.map +1 -1
  139. package/dist/host.js +23 -7
  140. package/dist/host.js.map +1 -1
  141. package/dist/init.d.ts +4 -6
  142. package/dist/init.d.ts.map +1 -1
  143. package/dist/init.js +87 -14
  144. package/dist/init.js.map +1 -1
  145. package/dist/local-cli.d.ts +67 -0
  146. package/dist/local-cli.d.ts.map +1 -0
  147. package/dist/local-cli.js +269 -0
  148. package/dist/local-cli.js.map +1 -0
  149. package/dist/main.d.ts +47 -3
  150. package/dist/main.d.ts.map +1 -1
  151. package/dist/main.js +121 -26
  152. package/dist/main.js.map +1 -1
  153. package/dist/marketplace-record.d.ts +7 -1
  154. package/dist/marketplace-record.d.ts.map +1 -1
  155. package/dist/marketplace-record.js +6 -3
  156. package/dist/marketplace-record.js.map +1 -1
  157. package/dist/package-manager.d.ts +43 -0
  158. package/dist/package-manager.d.ts.map +1 -0
  159. package/dist/package-manager.js +164 -0
  160. package/dist/package-manager.js.map +1 -0
  161. package/dist/position.d.ts.map +1 -1
  162. package/dist/position.js +16 -2
  163. package/dist/position.js.map +1 -1
  164. package/dist/preview.d.ts.map +1 -1
  165. package/dist/preview.js +14 -5
  166. package/dist/preview.js.map +1 -1
  167. package/dist/profile.d.ts +1 -1
  168. package/dist/profile.d.ts.map +1 -1
  169. package/dist/profile.js +3 -4
  170. package/dist/profile.js.map +1 -1
  171. package/dist/program.d.ts +10 -0
  172. package/dist/program.d.ts.map +1 -1
  173. package/dist/program.js +38 -1
  174. package/dist/program.js.map +1 -1
  175. package/dist/project.js +2 -2
  176. package/dist/project.js.map +1 -1
  177. package/dist/render.d.ts +7 -2
  178. package/dist/render.d.ts.map +1 -1
  179. package/dist/render.js +42 -3
  180. package/dist/render.js.map +1 -1
  181. package/dist/self.d.ts +6 -0
  182. package/dist/self.d.ts.map +1 -0
  183. package/dist/self.js +20 -0
  184. package/dist/self.js.map +1 -0
  185. package/dist/tracked-lock.d.ts +15 -0
  186. package/dist/tracked-lock.d.ts.map +1 -0
  187. package/dist/tracked-lock.js +37 -0
  188. package/dist/tracked-lock.js.map +1 -0
  189. package/dist/tracked.d.ts +125 -0
  190. package/dist/tracked.d.ts.map +1 -0
  191. package/dist/tracked.js +436 -0
  192. package/dist/tracked.js.map +1 -0
  193. package/dist/user-host.d.ts +7 -3
  194. package/dist/user-host.d.ts.map +1 -1
  195. package/dist/user-host.js +24 -11
  196. package/dist/user-host.js.map +1 -1
  197. package/dist/validate.d.ts +3 -1
  198. package/dist/validate.d.ts.map +1 -1
  199. package/dist/validate.js +44 -1
  200. package/dist/validate.js.map +1 -1
  201. package/dist/workspace-state.d.ts +17 -0
  202. package/dist/workspace-state.d.ts.map +1 -0
  203. package/dist/workspace-state.js +38 -0
  204. package/dist/workspace-state.js.map +1 -0
  205. package/dist/workspaces.d.ts +37 -0
  206. package/dist/workspaces.d.ts.map +1 -0
  207. package/dist/workspaces.js +319 -0
  208. package/dist/workspaces.js.map +1 -0
  209. package/package.json +9 -8
  210. package/assets/base/7b36e4b4959a7bead1c57906cd346b419f32570dac0ac764af805ad20cd63b16.ia.tgz +0 -0
  211. package/assets/host/e594fd978a0f8a9f042bf40ab124779067e1c88e4a72b7ce57261ca0e48a984c.tgz +0 -0
@@ -0,0 +1,308 @@
1
+ /**
2
+ * Planning a batch (consumer CLI contract §1.2): one batchable offer applied to the selected workspaces, each in a new
3
+ * git worktree on a new branch. A plan names, per repository, the worktree path, the branch and the exact steps, so the
4
+ * preview shows what will run before anything does.
5
+ *
6
+ * Steps that write the user's home or the machine are left out of every repository's run: a worktree isolates only
7
+ * repository writes. They are collected, de-duplicated by their display text and offered once afterwards.
8
+ *
9
+ * A step does not run in the user's checkout, and `cwd` alone does not keep it out: a fix may carry `--root <the
10
+ * original>`, a package-manager step `--prefix <dir>`, and a relative `../x` can lead anywhere. So every path-bearing
11
+ * argument is resolved against the step's destination (the workspace inside the worktree), an absolute path inside the
12
+ * original repository is moved to the same place in the worktree, and anything that resolves outside the worktree
13
+ * refuses the repository. Each path is rewritten as its absolute destination, so the preview shows where a step acts.
14
+ * Symbolic links are judged when the batch runs (batch-run.ts), once the files exist. Pure: no filesystem, no git.
15
+ */
16
+ import { basename, dirname, isAbsolute, join, posix, relative, win32 } from 'node:path';
17
+ import { fileURLToPath } from 'node:url';
18
+ import { COMMANDS } from '../commands.js';
19
+ import { installsDependencies } from '../package-manager.js';
20
+ import { displayFix } from '../fix.js';
21
+ /** An offer that fires and can be batched: it answers a check, writes the repository, needs no input and is enabled. */
22
+ export const fires = (offer) => offer.batchable &&
23
+ offer.group !== 'more' &&
24
+ offer.input === undefined &&
25
+ offer.disabled === undefined &&
26
+ offer.view === undefined;
27
+ /** The batchable offers that fire on the selected rows, in the order first found, each with its repository count. */
28
+ export function batchChoices(rows, selected) {
29
+ const choices = new Map();
30
+ rows.forEach((row, index) => {
31
+ if (!selected.has(index))
32
+ return;
33
+ for (const offer of row.offers.filter(fires)) {
34
+ const seen = choices.get(offer.id);
35
+ if (seen === undefined)
36
+ choices.set(offer.id, { title: offer.title, repos: 1 });
37
+ else
38
+ seen.repos += 1;
39
+ }
40
+ });
41
+ return [...choices].map(([offerId, { title, repos }]) => ({ offerId, title, repos }));
42
+ }
43
+ /** The rows where a batchable offer fires. */
44
+ export function selectNeeding(rows) {
45
+ return new Set(rows.flatMap((row, index) => (row.offers.some(fires) ? [index] : [])));
46
+ }
47
+ /**
48
+ * The manager whose own install or pin is the offer's first step (doctor's `cli-version` remedy, the upgrade recipe),
49
+ * or null. The batch's frozen install is then left out: on the lockfile drift those steps exist to repair, a frozen
50
+ * install would fail first. The preview reads it as the run does (batch-run.ts), the run then holding it to the
51
+ * manager the base declares or locks.
52
+ */
53
+ export const installsFirst = (steps) => {
54
+ const first = steps[0];
55
+ return first?.program === 'external' && installsDependencies(first.argv) ? first.argv[0] : null;
56
+ };
57
+ /** `chore/<slug>`: `ia-<version>` for the upgrade, with dots as dashes; otherwise the offer id, prefixed `ia-` once. */
58
+ export function branchFor(offer) {
59
+ const slug = (text) => text
60
+ .toLowerCase()
61
+ .replace(/[^a-z0-9]+/g, '-')
62
+ .replace(/^-+|-+$/g, '');
63
+ if (offer.id === 'upgrade') {
64
+ const pinned = offer.steps.flatMap((step) => step.argv).find((token) => token.startsWith('@inventarch/cli@'));
65
+ if (pinned !== undefined)
66
+ return `chore/ia-${slug(pinned.slice('@inventarch/cli@'.length))}`;
67
+ }
68
+ const id = slug(offer.id);
69
+ return `chore/${id.startsWith('ia-') ? id : `ia-${id}`}`;
70
+ }
71
+ /** The branches tried, in order, after `origin/HEAD`'s, for the base (batch-run.ts `findBase`). */
72
+ export const BASE_FALLBACKS = ['origin/main', 'origin/master'];
73
+ /** The base every worktree starts from (batch-run.ts `findBase`), named before anything runs. */
74
+ export const BATCH_BASE = `origin's default branch after git fetch origin (${['origin/HEAD', ...BASE_FALLBACKS].join(', else ')})`;
75
+ /** The install every repository's run begins with, as a preview says it. */
76
+ export const installLine = (steps) => installsFirst(steps) !== null
77
+ ? "by the first step, the package manager's own install"
78
+ : "the package manager's install, first, where the worktree holds a package.json";
79
+ const api = (platform) => (platform === 'win32' ? win32 : posix);
80
+ /** `child` is `parent` or inside it, lexically; Windows compares without case and reads both separators alike. */
81
+ function inside(parent, child, platform = process.platform) {
82
+ const path = api(platform);
83
+ const rel = path.relative(path.resolve(parent), path.resolve(child));
84
+ return rel === '' || (!path.isAbsolute(rel) && rel !== '..' && !rel.startsWith(`..${path.sep}`));
85
+ }
86
+ /**
87
+ * The worktree for one repository, or why none may be made there. Wherever it is, it must not lie inside the IA home,
88
+ * this repository or any other repository of the batch (`others`), whose working tree git would then write into. Only
89
+ * the default place is held to `enclosing`: a `.ia-worktrees` beside a nested repository or a submodule would land in
90
+ * the work tree around it, while a configured `worktreeRoot` is where the user said to put them, and is the way out of
91
+ * that refusal.
92
+ */
93
+ function worktreeFor(top, branch, config, enclosing, others) {
94
+ const slug = branch.replace(/^chore\//, '');
95
+ const root = config.worktreeRoot;
96
+ if (root !== undefined && !isAbsolute(root))
97
+ return { refused: `the configured worktreeRoot must be an absolute path: ${root}` };
98
+ if (root !== undefined && inside(config.iaHome, root))
99
+ return { refused: `the configured worktreeRoot ${root} is inside the IA home` };
100
+ const path = join(root ?? join(dirname(top), '.ia-worktrees'), `${basename(top)}-${slug}`);
101
+ if (inside(config.iaHome, path))
102
+ return { refused: `the worktree path ${path} is inside the IA home` };
103
+ if (inside(top, path))
104
+ return { refused: `the worktree path ${path} is inside the repository ${top}` };
105
+ if (root === undefined) {
106
+ const around = enclosing(dirname(top));
107
+ if (around !== null && typeof around !== 'string')
108
+ return around;
109
+ if (around !== null)
110
+ return {
111
+ refused: `the worktree path ${path} is inside the enclosing repository ${around}; set worktreeRoot in the IA home's config.json to put worktrees elsewhere`,
112
+ };
113
+ }
114
+ const other = others.find((entry) => inside(entry, path));
115
+ if (other !== undefined)
116
+ return { refused: `the worktree path ${path} is inside ${other}, another repository of this batch` };
117
+ return { path };
118
+ }
119
+ /**
120
+ * One batch: every selected row that offers `offerId`, in table order. A row whose root is in no git repository, or
121
+ * whose worktree may not be made (inside the IA home, its own repository, another planned row's repository, or, in the
122
+ * default place, a work tree around it, or where git cannot say), or one of whose steps names a path outside its
123
+ * worktree, is refused, never skipped.
124
+ * So is a row whose worktree an earlier row of this plan already takes (a second workspace in one repository, or two
125
+ * repositories of one name under a `worktreeRoot`): the preview says so, rather than the second failing at run time.
126
+ */
127
+ export function planBatch(offerId, rows, selected, config, git) {
128
+ const repos = [];
129
+ const deferred = new Map();
130
+ const planned = new Map();
131
+ const key = (path) => (process.platform === 'win32' ? path.toLowerCase() : path);
132
+ // Every planned row's repository first, each probed once: no worktree may land in any of them.
133
+ const rowsOf = rows.flatMap((row, index) => {
134
+ if (!selected.has(index))
135
+ return [];
136
+ const offer = row.offers.find((entry) => entry.id === offerId && fires(entry));
137
+ return offer === undefined ? [] : [{ row, offer, found: git.top(row.tracked.root) }];
138
+ });
139
+ const allTops = rowsOf.flatMap(({ found }) => (typeof found === 'string' ? [found] : []));
140
+ rowsOf.forEach(({ row, offer, found }) => {
141
+ const root = row.tracked.root;
142
+ const branch = branchFor(offer);
143
+ const left = offer.steps.filter((step) => step.writesTo === 'user' || step.writesTo === 'machine');
144
+ for (const step of left)
145
+ if (!deferred.has(displayFix(step)))
146
+ deferred.set(displayFix(step), step);
147
+ const kept = offer.steps.filter((step) => !left.includes(step));
148
+ const refuse = (why, top = root, worktree = '', workspace = '') => {
149
+ repos.push({
150
+ root,
151
+ top,
152
+ worktree,
153
+ workspace,
154
+ branch,
155
+ steps: kept,
156
+ deferred: left,
157
+ refused: why,
158
+ iaHome: config.iaHome,
159
+ });
160
+ };
161
+ if (found === null)
162
+ return refuse(`${root} is not inside a git repository`);
163
+ if (typeof found !== 'string')
164
+ return refuse(found.refused);
165
+ const top = found;
166
+ const others = allTops.filter((entry) => key(entry) !== key(top));
167
+ const made = worktreeFor(top, branch, config, git.enclosing, others);
168
+ if ('refused' in made)
169
+ return refuse(made.refused, top);
170
+ const taken = planned.get(key(made.path));
171
+ // The branch is `chore/<offer>` in every batch, and a batch refuses a branch that exists, so a later batch for this
172
+ // workspace can run only once the first one's branch is gone.
173
+ if (taken !== undefined)
174
+ return refuse(`the worktree path ${made.path} is already planned for ${taken}; run this workspace in a later batch, once this batch's branch ${branch} is merged and deleted along with its worktree`, top);
175
+ const workspace = join(made.path, relative(top, root));
176
+ const steps = [];
177
+ for (const step of kept) {
178
+ const rebased = rebaseStep(step, { from: top, to: made.path, cwd: workspace });
179
+ if ('refused' in rebased)
180
+ return refuse(rebased.refused, top, made.path, workspace);
181
+ steps.push(rebased.step);
182
+ }
183
+ planned.set(key(made.path), root);
184
+ repos.push({
185
+ root,
186
+ top,
187
+ worktree: made.path,
188
+ workspace,
189
+ branch,
190
+ steps,
191
+ deferred: left,
192
+ refused: null,
193
+ iaHome: config.iaHome,
194
+ });
195
+ });
196
+ return { repos, deferred: [...deferred.values()] };
197
+ }
198
+ const SCHEME = /^[A-Za-z][A-Za-z0-9+.-]+:/;
199
+ const FILE_URL = /^file:/i;
200
+ /** A POSIX root, a drive path or a UNC path, whichever platform reads it. */
201
+ const ABSOLUTE = /^(?:\/|\\\\|[A-Za-z]:)/;
202
+ const hasParent = (value) => value.split(/[\\/]/).includes('..');
203
+ const spelledAsPath = (value) => ABSOLUTE.test(value) || value === '.' || value === '..' || /^\.\.?[\\/]/.test(value);
204
+ /** How a value is read: `null` when it is not a path (a URL with another scheme, or an unmarked plain token). */
205
+ function kindOf(value, mark) {
206
+ if (mark === 'always')
207
+ return 'path';
208
+ if (FILE_URL.test(value))
209
+ return 'file-url';
210
+ if (SCHEME.test(value) && !ABSOLUTE.test(value))
211
+ return null;
212
+ if (mark === 'maybe')
213
+ return spelledAsPath(value) ? 'path' : 'name';
214
+ return ABSOLUTE.test(value) || hasParent(value) ? 'path' : null;
215
+ }
216
+ /** The package managers' own directory options. */
217
+ const MANAGER_PATHS = new Set(['--prefix', '--dir', '--cwd', '-C']);
218
+ /**
219
+ * The path-bearing tokens of a step. For `ia`, the values of the options its grammar marks `path` and the positionals
220
+ * it marks; for an external package manager, `--prefix`, `--dir` and `--cwd`. Any other token that is an absolute path
221
+ * or holds a `..` segment, or is a `file:` URL, is path-bearing too, so no unmarked path passes unexamined; a URL with
222
+ * another scheme never is.
223
+ */
224
+ export function pathArguments(step) {
225
+ const argv = step.argv;
226
+ const out = [];
227
+ const spec = step.program === 'ia' ? COMMANDS.find((command) => command.name === argv[0]) : undefined;
228
+ const optionOf = (key) => {
229
+ if (step.program !== 'ia')
230
+ return MANAGER_PATHS.has(key) ? { name: key, kind: 'value', path: 'always', summary: '' } : undefined;
231
+ return spec?.grammar.options.find((entry) => `--${entry.name}` === key || `-${entry.short}` === key);
232
+ };
233
+ const add = (index, value, form, mark) => {
234
+ const kind = kindOf(value, mark);
235
+ if (kind !== null)
236
+ out.push({ index, value, form, kind });
237
+ };
238
+ let separated = false, positional = 0;
239
+ for (let index = 1; index < argv.length; index += 1) {
240
+ const token = argv[index];
241
+ if (!separated && token === '--') {
242
+ separated = true;
243
+ continue;
244
+ }
245
+ if (!separated && token.startsWith('-') && token !== '-') {
246
+ const split = token.indexOf('=');
247
+ const option = optionOf(split === -1 ? token : token.slice(0, split));
248
+ if (option !== undefined && option.kind === 'value') {
249
+ if (split !== -1)
250
+ add(index, token.slice(split + 1), 'inline', option.path ?? 'generic');
251
+ else if (index + 1 < argv.length) {
252
+ add(index + 1, argv[index + 1], 'separate', option.path ?? 'generic');
253
+ index += 1;
254
+ }
255
+ }
256
+ else if (split !== -1)
257
+ add(index, token.slice(split + 1), 'inline', 'generic');
258
+ continue;
259
+ }
260
+ const from = spec?.grammar.positionals.path?.from;
261
+ add(index, token, 'separate', from !== undefined && positional >= from ? 'always' : 'generic');
262
+ positional += 1;
263
+ }
264
+ return out;
265
+ }
266
+ /**
267
+ * The step rebuilt for its worktree: every path-bearing value resolved against `cwd` (the destination), a path inside
268
+ * `from` (the original top level) moved to the same place under `to` (the worktree), and the token rewritten as that
269
+ * absolute path (a `file:` URL as a native directory path, the one local form every reader takes). A value that
270
+ * resolves outside `to`, or a result that still names a path inside `from`, refuses the repository. Lexical only.
271
+ */
272
+ export function rebaseStep(step, map, platform = process.platform) {
273
+ const path = api(platform);
274
+ const outside = (value) => ({ refused: `step names a path outside the worktree: ${value}` });
275
+ const argv = [...step.argv];
276
+ for (const entry of pathArguments(step)) {
277
+ if (entry.kind === 'name')
278
+ continue;
279
+ let value = entry.value;
280
+ if (entry.kind === 'file-url')
281
+ try {
282
+ value = fileURLToPath(value, { windows: platform === 'win32' });
283
+ }
284
+ catch {
285
+ return outside(entry.value);
286
+ }
287
+ let target = path.resolve(map.cwd, value);
288
+ if (inside(map.from, target, platform) && !inside(map.to, target, platform))
289
+ target = path.join(map.to, path.relative(path.resolve(map.from), target));
290
+ if (!inside(map.to, target, platform))
291
+ return outside(entry.value);
292
+ const token = argv[entry.index];
293
+ argv[entry.index] = entry.form === 'inline' ? `${token.slice(0, token.indexOf('=') + 1)}${target}` : target;
294
+ }
295
+ const rebuilt = { ...step, argv };
296
+ // Checked once more on the result: nothing names the original, and every path-bearing value is in the worktree.
297
+ for (const token of argv) {
298
+ const values = [token, ...(token.includes('=') ? [token.slice(token.indexOf('=') + 1)] : [])];
299
+ for (const value of values)
300
+ if (ABSOLUTE.test(value) && inside(map.from, value, platform) && !inside(map.to, value, platform))
301
+ return { refused: `step still names the original checkout: ${value}` };
302
+ }
303
+ for (const entry of pathArguments(rebuilt))
304
+ if (entry.kind !== 'name' && !inside(map.to, path.resolve(map.cwd, entry.value), platform))
305
+ return outside(entry.value);
306
+ return { step: rebuilt };
307
+ }
308
+ //# sourceMappingURL=batch-plan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"batch-plan.js","sourceRoot":"","sources":["../../src/console/batch-plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AACxF,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AASvC,wHAAwH;AACxH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,KAAY,EAAW,EAAE,CAC7C,KAAK,CAAC,SAAS;IACf,KAAK,CAAC,KAAK,KAAK,MA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AChH,KAAK,MAAM,KAAK,IAAI,IAAI,EAAE,CAAC;QACzB,MAAM,MAAM,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC9F,KAAK,MAAM,KAAK,IAAI,MAAM;YACxB,IAAI,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,KAAK,EAAE,QAAQ,CAAC;gBAC/F,OAAO,EAAE,OAAO,EAAE,2CAA2C,KAAK,EAAE,EAAE,CAAC;IAC7E,CAAC;IACD,KAAK,MAAM,KAAK,IAAI,aAAa,CAAC,OAAO,CAAC;QACxC,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC;YACxF,OAAO,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAChC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AAC3B,CAAC"}
@@ -0,0 +1,195 @@
1
+ import type { LocalCli } from '../local-cli.js';
2
+ import type { Git } from '../channel.js';
3
+ import type { Env } from '../program.js';
4
+ import type { RepoPlan } from './batch-plan.js';
5
+ import type { Step } from './offers.js';
6
+ import type { ConsoleState } from './state.js';
7
+ export interface RunResult {
8
+ /** The exit code, or null when the program ended on a signal or could not start. */
9
+ readonly status: number | null;
10
+ readonly stdout: string;
11
+ readonly stderr: string;
12
+ /** Why the guarded spawn did not start the program at all (`spawnGuarded`), or absent when it ran. */
13
+ readonly refused?: string;
14
+ }
15
+ /** Starts a program with piped output and settles with its result; never throws. */
16
+ export interface Runner {
17
+ (file: string, args: readonly string[], options: {
18
+ readonly cwd: string;
19
+ readonly env: Env;
20
+ readonly argv0?: string;
21
+ /** The batch's stop: when it aborts, the command's process group gets SIGINT, as the terminal's Ctrl-C would. */
22
+ readonly signal?: AbortSignal;
23
+ }): Promise<RunResult>;
24
+ }
25
+ /** A program as a batch starts it: its canonical real path, and the name it was found by, when that was another. */
26
+ export interface Program {
27
+ readonly path: string;
28
+ /**
29
+ * The `argv[0]` to start it with: the link it was found through. A version manager's shim (mise, volta) is a link to
30
+ * one binary that reads `argv[0]` to know what to run, so started by its real path alone it runs nothing it should.
31
+ */
32
+ readonly argv0?: string;
33
+ }
34
+ export { GIT_LOCAL_ENV } from '../program.js';
35
+ /**
36
+ * What every batch child gets set, whatever the console inherited: git never asks on the terminal for a credential
37
+ * (stdin is ignored, but git opens the terminal itself) and Git Credential Manager never opens a dialog, either of which
38
+ * would hold the sequential batch with no one answering. A remote that needs a credential then fails for its repository.
39
+ */
40
+ export declare const NO_PROMPT: Readonly<Record<string, string>>;
41
+ /**
42
+ * The askpass programs no batch child inherits: git and ssh would start one (a terminal's credential dialog, such as
43
+ * an editor's) and the sequential batch would wait on it until the command's timeout.
44
+ */
45
+ export declare const ASKPASS_ENV: readonly string[];
46
+ /** What keeps ssh from asking, for a password, a passphrase or a host key, or opening an askpass dialog. */
47
+ export declare const SSH_NO_PROMPT = "ssh -o BatchMode=yes";
48
+ /**
49
+ * `env` for the commands of the repository at `directory`, with ssh that never asks (`SSH_NO_PROMPT`), unless the user
50
+ * names their own ssh: `GIT_SSH_COMMAND` or `GIT_SSH` in the environment, or `core.sshCommand`, which the variable
51
+ * would otherwise override and so lose the key or the program they chose. An ssh of their own is theirs; elsewhere than
52
+ * Windows it still has no terminal to ask on (`defaultRunner`), and everywhere it is bounded by the command's timeout.
53
+ */
54
+ export declare function withoutSshPrompt(env: Env, git: Git, directory: string): Env;
55
+ /**
56
+ * `env` without git's repository-local variables or an askpass program (`ASKPASS_ENV`), and with `NO_PROMPT` set;
57
+ * Windows compares names without case, as its environment does.
58
+ */
59
+ export declare function batchEnv(env: Env, platform?: NodeJS.Platform): Env;
60
+ /**
61
+ * How long one batch command may run before it is stopped and counted as failed: long enough for a cold install, short
62
+ * enough that a command waiting on something no one will give (a credential, a lock) never holds the batch for good.
63
+ */
64
+ export declare const BATCH_COMMAND_TIMEOUT_MS: number;
65
+ /** A synchronous `git -C <cwd> …` by the checked `git`, through the guarded spawn, for the lockfile probe. */
66
+ export declare const gitWith: (env: Env, git: Program, guard: SpawnGuard) => Git;
67
+ /**
68
+ * The real runner: an absolute file as given; any other name by the absolute path `findProgram` finds on a qualified
69
+ * PATH entry, with `programEnv`, and a Windows `.cmd` through cmd.exe named by its path, each argument quoted for it
70
+ * (`cmdArgument`; one it cannot pass refuses the call).
71
+ */
72
+ export declare function defaultRunner(env: Env, limits?: {
73
+ readonly timeoutMs?: number;
74
+ }): Runner;
75
+ /**
76
+ * The git commands that may run against the user's own repository, each as `git -C <its top level> <command> …`. They
77
+ * read refs or change metadata (a remote-tracking update, a worktree and a branch added, and afterwards, when chosen,
78
+ * the batch's own worktree removed, batch-next.ts, or what a failed `worktree add` made, `undoAdd`); none reads or
79
+ * writes the user's working tree.
80
+ */
81
+ export declare const METADATA_OPS: readonly string[];
82
+ /**
83
+ * The top level of the git repository holding `root`, by its real path; null when it is in none; a refusal when the
84
+ * `git` on PATH lies inside the repository (judged against `root` and the nearest folder above it that holds a `.git`,
85
+ * before it runs, and against the top level it reports).
86
+ */
87
+ export declare function gitTop(root: string, env: Env): string | null | {
88
+ readonly refused: string;
89
+ };
90
+ /**
91
+ * The top level of the work tree holding `path`, a folder above a repository, by its real path; null only when git
92
+ * says plainly that `path` is in no work tree; a refusal whenever git cannot say (it may not run, it fails for another
93
+ * reason, such as an enclosing repository of dubious ownership, or the top level it names cannot be resolved), since
94
+ * a worktree there could be inside a work tree no one checked. `git` was already judged against the repository
95
+ * (`gitTop`); that it lies under this folder is no refusal. git runs as a batch child does (`batchEnv`), in English, so
96
+ * its "not a git repository" is read the same in every locale.
97
+ */
98
+ export declare function enclosingTop(path: string, env: Env): string | null | {
99
+ readonly refused: string;
100
+ };
101
+ /** `git fetch origin`, then the first of `origin/HEAD`, `origin/main` and `origin/master` that resolves; null otherwise. */
102
+ export declare function chooseBase(top: string, run: Runner, env?: Env): Promise<string | null>;
103
+ /**
104
+ * The one rule for every program a batch starts (git, gh, the package manager, a step's program): found as `findProgram`
105
+ * finds it (or as given when absolute), its real path must not lie inside any of `checkouts`, so a program the user's
106
+ * repository holds is never run. `path` is what to spawn; null with a refusal when nothing was found.
107
+ */
108
+ export declare function programIn(name: string, env: Env, checkouts: readonly string[]): Program | {
109
+ readonly path: string | null;
110
+ readonly refused: string;
111
+ };
112
+ /**
113
+ * What every spawn of a batch must still hold, checked by the one guarded spawn immediately before it starts: the
114
+ * program's real path is still the canonical path it was found at and lies outside every checkout, and, when the
115
+ * command's working directory or any argument lies in the worktree, that worktree is still the folder pinned at its
116
+ * creation.
117
+ */
118
+ export interface SpawnGuard {
119
+ readonly checkouts: readonly string[];
120
+ readonly worktree?: {
121
+ readonly path: string;
122
+ readonly pinned: Pinned | null | undefined;
123
+ };
124
+ }
125
+ /**
126
+ * The one way a batch starts a child: `admit` checks it immediately before, and the child gets `env` without git's
127
+ * routing variables and with only qualified PATH entries, none inside a checkout (`childEnv`). A refused spawn starts
128
+ * nothing and settles with `refused` set.
129
+ */
130
+ export declare function spawnGuarded(run: Runner, program: string | Program, args: readonly string[], options: {
131
+ readonly cwd: string;
132
+ readonly env: Env;
133
+ }, guard: SpawnGuard): Promise<RunResult>;
134
+ /**
135
+ * `spawnGuarded` for the synchronous probes: the same check and environment; a Windows `.cmd` or `.bat` runs through
136
+ * cmd.exe named by its path, each argument quoted by `cmdArgument`, and one it cannot pass refuses the probe.
137
+ */
138
+ export declare function spawnGuardedSync(started: string | Program, args: readonly string[], options: {
139
+ readonly cwd: string;
140
+ readonly env: Env;
141
+ }, guard: SpawnGuard): RunResult;
142
+ /** What a created worktree is: its real path, and its device and inode where the volume reports them. */
143
+ export interface Pinned {
144
+ readonly real: string;
145
+ readonly dev: bigint;
146
+ readonly ino: bigint;
147
+ }
148
+ /** The worktree's identity now, or null when it cannot be read. */
149
+ export declare function pinWorktree(path: string): Pinned | null;
150
+ /**
151
+ * Null when the worktree is still the folder that was created: the same real path and, where the volume reports an
152
+ * identity (an inode that is neither 0 nor all ones), the same device and inode. A new real path is never adopted.
153
+ */
154
+ export declare function checkPinned(path: string, pinned: Pinned | undefined | null): string | null;
155
+ /**
156
+ * The run-time check, on the real filesystem, immediately before a step runs: the step's `cwd`, each path-bearing value
157
+ * (resolved against `cwd`) and each mixed-domain value kept as a name that names an existing entry under `cwd` must
158
+ * lead, through any link, into the worktree's real path. Null when they do; otherwise why the repository is refused.
159
+ */
160
+ export declare function containedStep(step: Step, cwd: string, worktree: string, pinned?: string): string | null;
161
+ export interface RepoResult {
162
+ readonly root: string;
163
+ readonly top: string;
164
+ readonly worktree: string;
165
+ readonly workspace: string;
166
+ readonly branch: string;
167
+ /** Every step passed. */
168
+ readonly ok: boolean;
169
+ /** The last thing that happened: the step that failed and its last line of output, or what passed. */
170
+ readonly last: string;
171
+ /** Why the repository was refused, or null; a refused repository is not ok. */
172
+ readonly refused: string | null;
173
+ /** The worktree and branch were made, so they can be opened, committed or removed. */
174
+ readonly created: boolean;
175
+ /** What the created worktree was, checked before every later command in it. */
176
+ readonly pinned?: Pinned | null;
177
+ /** Ctrl-C stopped the batch before this repository finished, or before it started (`not run: batch stopped`). */
178
+ readonly stopped?: boolean;
179
+ /** The base this repository resolved to (`origin/main`): what its worktree was made from, and its PR's target. */
180
+ readonly base?: string;
181
+ }
182
+ /** The last line of a repository a stopped batch never started. */
183
+ export declare const NOT_RUN = "not run: batch stopped";
184
+ /** The last line of a repository the batch was stopped in. */
185
+ export declare const STOPPED = "stopped: the batch was stopped";
186
+ export declare function runBatch(plan: {
187
+ readonly repos: readonly RepoPlan[];
188
+ }, state: Pick<ConsoleState, 'running'>, io: {
189
+ readonly run: Runner;
190
+ readonly resolveRepo: (root: string) => LocalCli | null;
191
+ readonly progress: (index: number, line: string) => void;
192
+ readonly signal: AbortSignal;
193
+ readonly env: Env;
194
+ }): Promise<readonly RepoResult[]>;
195
+ //# sourceMappingURL=batch-run.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"batch-run.d.ts","sourceRoot":"","sources":["../../src/console/batch-run.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAGzC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,MAAM,WAAW,SAAS;IACxB,oFAAoF;IACpF,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,sGAAsG;IACtG,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AACD,oFAAoF;AACpF,MAAM,WAAW,MAAM;IACrB,CACE,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,OAAO,EAAE;QACP,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;QACrB,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC;QAClB,QAAQ,CAAC,KAAK,CA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