@dadado/agent-kit-cli 6.12.0 → 6.14.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 (46) hide show
  1. package/dashboard/README.md +8 -8
  2. package/dashboard/dashboard-data.mjs +19 -3
  3. package/dashboard/lib/live-refresh.mjs +1 -0
  4. package/dashboard/lib/workspace-docs.d.mts +49 -0
  5. package/dashboard/lib/workspace-docs.mjs +231 -0
  6. package/dist/{add-CLRIMPN4.js → add-LJAE4FRZ.js} +3 -3
  7. package/dist/{chunk-PGCRP5A6.js → chunk-2DYKEP5V.js} +8 -8
  8. package/dist/{chunk-ODI2N2BN.js → chunk-7DFEN3FF.js} +2 -2
  9. package/dist/{chunk-UX6FHSO7.js → chunk-AEUE74EZ.js} +1 -1
  10. package/dist/{chunk-DVCNJNCF.js → chunk-AXQJX4DC.js} +3 -3
  11. package/dist/{chunk-2KIOZMTV.js → chunk-BMU74QWR.js} +8 -0
  12. package/dist/{chunk-WAWCS5PJ.js → chunk-CFJRCJWD.js} +12 -2
  13. package/dist/{chunk-I2SG2VPJ.js → chunk-GBHOP62P.js} +2 -2
  14. package/dist/{chunk-TFKEHC2D.js → chunk-GYPCR4UO.js} +8 -4
  15. package/dist/{chunk-2R4HYPQH.js → chunk-H5OSZ7HQ.js} +2 -2
  16. package/dist/{chunk-HWYVLEET.js → chunk-IS35XTGX.js} +4 -4
  17. package/dist/{chunk-IBE2EJZS.js → chunk-KTWDHHIO.js} +2 -1
  18. package/dist/{chunk-7TEEGAED.js → chunk-NDKSOPP7.js} +1 -0
  19. package/dist/{chunk-5RWTDCJ7.js → chunk-NEMOV327.js} +11 -1
  20. package/dist/{chunk-OKQ3SAHK.js → chunk-OLDRCWHE.js} +1 -1
  21. package/dist/{chunk-4WHPZGF4.js → chunk-SKC6QZW4.js} +30 -5
  22. package/dist/{chunk-FX6BIH4C.js → chunk-TR6AC5FW.js} +2 -2
  23. package/dist/{chunk-LAYMAMPL.js → chunk-UNDPOCWT.js} +1 -1
  24. package/dist/{chunk-5T4CHRRR.js → chunk-WSJLLK3U.js} +1 -1
  25. package/dist/{chunk-XJWCL4PO.js → chunk-YZSPNXR2.js} +1 -1
  26. package/dist/{chunk-LFWPB2JR.js → chunk-ZFJIJUZ4.js} +1 -0
  27. package/dist/{commands-DVEZOEEO.js → commands-K7OOH3AR.js} +4 -4
  28. package/dist/{contribute-E3COXKH4.js → contribute-QPBEPIKP.js} +5 -5
  29. package/dist/{countdown-F6EIHGDR.js → countdown-TFKPAYIQ.js} +2 -2
  30. package/dist/{diff-SCGNC4SF.js → diff-5IQGV5VL.js} +6 -6
  31. package/dist/{doctor-QGO4QB7R.js → doctor-TKYJ3VRI.js} +10 -10
  32. package/dist/{engine-info-MNCKB55Y.js → engine-info-R6GXZ2VO.js} +3 -3
  33. package/dist/{guard-X6FNFZ27.js → guard-RJZEEKSL.js} +50 -8
  34. package/dist/{hook-R7V4NG3C.js → hook-SHR3NXPV.js} +6 -6
  35. package/dist/index.js +22 -20
  36. package/dist/{init-ONPKZS63.js → init-E2HI3TJY.js} +13 -13
  37. package/dist/{install-NHTYTVSG.js → install-3TGZ4TIY.js} +13 -13
  38. package/dist/{mission-control-C2QV5D25.js → mission-control-JIF6GFSV.js} +1 -1
  39. package/dist/promote-H5MIMVEB.js +367 -0
  40. package/dist/{queue-XI4HUFLJ.js → queue-VLIWWVKM.js} +3 -3
  41. package/dist/{run-EO5P2YZG.js → run-O6IDZ6WI.js} +10 -10
  42. package/dist/{run-plan-VMW34QY6.js → run-plan-2HIJ4CD2.js} +6 -6
  43. package/dist/{setup-global-PMKGHX2S.js → setup-global-G27JZ2IN.js} +7 -7
  44. package/dist/{status-P2I6LE6Y.js → status-3J26V7QS.js} +8 -8
  45. package/dist/{update-K6L24JDP.js → update-KWIHFGPI.js} +11 -11
  46. package/package.json +5 -5
@@ -2,19 +2,19 @@ import {
2
2
  nextStepAfterInstall,
3
3
  performInstall,
4
4
  printInstallEpilogue
5
- } from "./chunk-PGCRP5A6.js";
5
+ } from "./chunk-2DYKEP5V.js";
6
6
  import {
7
7
  NON_INTERACTIVE_ROOT_ARGS
8
- } from "./chunk-HWYVLEET.js";
8
+ } from "./chunk-IS35XTGX.js";
9
9
  import {
10
10
  SkippedSymlinkError,
11
11
  logApplyStats
12
12
  } from "./chunk-HS7LVVLO.js";
13
- import "./chunk-5T4CHRRR.js";
14
- import "./chunk-ODI2N2BN.js";
13
+ import "./chunk-WSJLLK3U.js";
14
+ import "./chunk-7DFEN3FF.js";
15
15
  import "./chunk-HAFRAXGV.js";
16
- import "./chunk-LAYMAMPL.js";
17
- import "./chunk-IBE2EJZS.js";
16
+ import "./chunk-UNDPOCWT.js";
17
+ import "./chunk-KTWDHHIO.js";
18
18
  import "./chunk-WGLPZXNU.js";
19
19
  import "./chunk-6RRG3WOE.js";
20
20
  import {
@@ -32,17 +32,17 @@ import {
32
32
  confirmProjectRoot,
33
33
  isNonInteractive,
34
34
  syncPathCliToRuntime
35
- } from "./chunk-I2SG2VPJ.js";
35
+ } from "./chunk-GBHOP62P.js";
36
36
  import {
37
37
  assessEnvironment
38
38
  } from "./chunk-B3VR5YBQ.js";
39
- import "./chunk-2R4HYPQH.js";
39
+ import "./chunk-H5OSZ7HQ.js";
40
40
  import "./chunk-PFEUZXVT.js";
41
- import "./chunk-DVCNJNCF.js";
42
- import "./chunk-FX6BIH4C.js";
43
- import "./chunk-2KIOZMTV.js";
44
- import "./chunk-XJWCL4PO.js";
45
- import "./chunk-5RWTDCJ7.js";
41
+ import "./chunk-AXQJX4DC.js";
42
+ import "./chunk-TR6AC5FW.js";
43
+ import "./chunk-BMU74QWR.js";
44
+ import "./chunk-YZSPNXR2.js";
45
+ import "./chunk-NEMOV327.js";
46
46
  import {
47
47
  KIT_VERSION
48
48
  } from "./chunk-7HDQEK6T.js";
@@ -3,14 +3,14 @@ import {
3
3
  nextStepAfterInstall,
4
4
  performInstall,
5
5
  printInstallEpilogue
6
- } from "./chunk-PGCRP5A6.js";
7
- import "./chunk-HWYVLEET.js";
6
+ } from "./chunk-2DYKEP5V.js";
7
+ import "./chunk-IS35XTGX.js";
8
8
  import "./chunk-HS7LVVLO.js";
9
- import "./chunk-5T4CHRRR.js";
10
- import "./chunk-ODI2N2BN.js";
9
+ import "./chunk-WSJLLK3U.js";
10
+ import "./chunk-7DFEN3FF.js";
11
11
  import "./chunk-HAFRAXGV.js";
12
- import "./chunk-LAYMAMPL.js";
13
- import "./chunk-IBE2EJZS.js";
12
+ import "./chunk-UNDPOCWT.js";
13
+ import "./chunk-KTWDHHIO.js";
14
14
  import "./chunk-WGLPZXNU.js";
15
15
  import "./chunk-6RRG3WOE.js";
16
16
  import "./chunk-QTON2GQX.js";
@@ -18,15 +18,15 @@ import "./chunk-PNFF6OU3.js";
18
18
  import "./chunk-SC2DBY2R.js";
19
19
  import "./chunk-F6C3GFKV.js";
20
20
  import "./chunk-ZB43YMHW.js";
21
- import "./chunk-I2SG2VPJ.js";
21
+ import "./chunk-GBHOP62P.js";
22
22
  import "./chunk-B3VR5YBQ.js";
23
- import "./chunk-2R4HYPQH.js";
23
+ import "./chunk-H5OSZ7HQ.js";
24
24
  import "./chunk-PFEUZXVT.js";
25
- import "./chunk-DVCNJNCF.js";
26
- import "./chunk-FX6BIH4C.js";
27
- import "./chunk-2KIOZMTV.js";
28
- import "./chunk-XJWCL4PO.js";
29
- import "./chunk-5RWTDCJ7.js";
25
+ import "./chunk-AXQJX4DC.js";
26
+ import "./chunk-TR6AC5FW.js";
27
+ import "./chunk-BMU74QWR.js";
28
+ import "./chunk-YZSPNXR2.js";
29
+ import "./chunk-NEMOV327.js";
30
30
  import "./chunk-7HDQEK6T.js";
31
31
  import "./chunk-C4Q77GGJ.js";
32
32
  import "./chunk-5B4DVO6C.js";
@@ -3,7 +3,7 @@ import {
3
3
  findDashboardDataScript,
4
4
  loadDashboardSnapshot,
5
5
  runMcTuiLoop
6
- } from "./chunk-LFWPB2JR.js";
6
+ } from "./chunk-ZFJIJUZ4.js";
7
7
  import {
8
8
  resolveDashboardSnapshotRoot
9
9
  } from "./chunk-XDCCYBCJ.js";
@@ -0,0 +1,367 @@
1
+ import {
2
+ loadContextConfig
3
+ } from "./chunk-PFEUZXVT.js";
4
+ import "./chunk-5B4DVO6C.js";
5
+
6
+ // src/commands/promote.ts
7
+ import { execFile } from "child_process";
8
+ import path from "path";
9
+ import { promisify } from "util";
10
+ import { defineCommand } from "citty";
11
+
12
+ // src/plan-loop/promote-merge-wait.ts
13
+ var PROMOTE_MERGE_WAIT_ASK_ID = "promote-merge-wait";
14
+ var PROMOTE_MERGE_WAIT_LABELS = [
15
+ "Keep waiting",
16
+ "Show the merge box reason",
17
+ "Stop and hand off"
18
+ ];
19
+ var PROMOTE_MERGE_WAIT_CONFIG_KEY = "promoteMergeWaitMs";
20
+ var DEFAULT_PROMOTE_MERGE_WAIT_MS = 60 * 60 * 1e3;
21
+ var MIN_PROMOTE_MERGE_WAIT_MS = 60 * 1e3;
22
+ var MAX_PROMOTE_MERGE_WAIT_MS = 24 * 60 * 60 * 1e3;
23
+ var PROMOTE_MERGE_POLL_INITIAL_MS = 3e4;
24
+ var PROMOTE_MERGE_POLL_MAX_MS = 5 * 60 * 1e3;
25
+ function resolvePromoteMergeWaitMs(config) {
26
+ const raw = config?.[PROMOTE_MERGE_WAIT_CONFIG_KEY];
27
+ if (typeof raw !== "number" || !Number.isFinite(raw)) return DEFAULT_PROMOTE_MERGE_WAIT_MS;
28
+ return Math.min(MAX_PROMOTE_MERGE_WAIT_MS, Math.max(MIN_PROMOTE_MERGE_WAIT_MS, Math.trunc(raw)));
29
+ }
30
+ function promoteMergePollDelays(capMs, initialMs = PROMOTE_MERGE_POLL_INITIAL_MS, maxMs = PROMOTE_MERGE_POLL_MAX_MS) {
31
+ const cap = Math.max(1, Math.trunc(Number(capMs) || 0));
32
+ const max = Math.max(1, Math.trunc(maxMs));
33
+ let next = Math.min(max, Math.max(1, Math.trunc(initialMs)));
34
+ const delays = [];
35
+ let total = 0;
36
+ while (total < cap) {
37
+ const d = Math.min(next, cap - total);
38
+ delays.push(d);
39
+ total += d;
40
+ next = Math.min(max, next * 2);
41
+ }
42
+ return delays;
43
+ }
44
+ var PROMOTE_PR_VIEW_FIELDS = "state,mergedAt,mergeCommit,mergeStateStatus,url";
45
+ function parsePromotePrView(json) {
46
+ let data;
47
+ try {
48
+ data = JSON.parse(json);
49
+ } catch {
50
+ return null;
51
+ }
52
+ if (!data || typeof data !== "object" || Array.isArray(data)) return null;
53
+ const o = data;
54
+ if (o.state !== "OPEN" && o.state !== "MERGED" && o.state !== "CLOSED") return null;
55
+ const commit = o.mergeCommit;
56
+ const str = (v) => typeof v === "string" && v ? v : null;
57
+ return {
58
+ state: o.state,
59
+ mergedAt: str(o.mergedAt),
60
+ mergeCommit: str(commit?.oid),
61
+ mergeStateStatus: str(o.mergeStateStatus),
62
+ url: str(o.url)
63
+ };
64
+ }
65
+ async function waitForPromoteMerge(opts) {
66
+ const sleep = opts.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
67
+ const delays = promoteMergePollDelays(opts.capMs, opts.initialDelayMs, opts.maxDelayMs);
68
+ let last = null;
69
+ let lastError = null;
70
+ let polls = 0;
71
+ let waitedMs = 0;
72
+ for (let i = 0; i <= delays.length; i++) {
73
+ polls += 1;
74
+ try {
75
+ const pr = await opts.readPr();
76
+ if (pr) {
77
+ last = pr;
78
+ if (pr.state === "MERGED") return { outcome: "merged", pr, polls };
79
+ if (pr.state === "CLOSED") return { outcome: "closed", pr, polls };
80
+ } else {
81
+ lastError = "unreadable PR state";
82
+ }
83
+ } catch (err) {
84
+ lastError = err instanceof Error ? err.message : String(err);
85
+ }
86
+ const delay = delays[i];
87
+ if (delay === void 0) break;
88
+ await sleep(delay);
89
+ waitedMs += delay;
90
+ }
91
+ return {
92
+ outcome: "timeout",
93
+ last,
94
+ lastError,
95
+ polls,
96
+ waitedMs,
97
+ ask: { id: PROMOTE_MERGE_WAIT_ASK_ID, labels: [...PROMOTE_MERGE_WAIT_LABELS] }
98
+ };
99
+ }
100
+ function minutes(ms) {
101
+ const m = ms / 6e4;
102
+ return Number.isInteger(m) ? `${m} min` : `${m.toFixed(1)} min`;
103
+ }
104
+ function formatPromoteMergeWaitResult(pr, result) {
105
+ if (result.outcome === "merged") {
106
+ const sha = result.pr.mergeCommit ? ` as ${result.pr.mergeCommit}` : "";
107
+ const at = result.pr.mergedAt ? ` at ${result.pr.mergedAt}` : "";
108
+ return `PR #${pr} merged${sha}${at}. Continue the promote routine.
109
+ `;
110
+ }
111
+ if (result.outcome === "closed") {
112
+ return `PR #${pr} was closed without a merge. Stop: do not tag, do not reopen it, report to the operator.
113
+ `;
114
+ }
115
+ const lines = [
116
+ `PR #${pr} is still not merged after ${minutes(result.waitedMs)} (${result.polls} reads; cap: ${PROMOTE_MERGE_WAIT_CONFIG_KEY}).`
117
+ ];
118
+ if (result.last) {
119
+ lines.push(
120
+ `Last read: state ${result.last.state}, mergeStateStatus ${result.last.mergeStateStatus ?? "unknown"}${result.last.url ? `, ${result.last.url}` : ""}.`
121
+ );
122
+ }
123
+ if (result.lastError) lines.push(`Last read error: ${result.lastError}.`);
124
+ if (result.last?.mergeStateStatus === "CLEAN") {
125
+ lines.push(
126
+ "CLEAN plus green checks is not proof that GitHub will accept the merge: a ruleset can still refuse it. The PR page merge box names the reason."
127
+ );
128
+ }
129
+ lines.push(
130
+ `Ask ${result.ask.id}: ${result.ask.labels.join(" / ")}. Never merge the PR yourself and never run /git-prod.`
131
+ );
132
+ return `${lines.join("\n")}
133
+ `;
134
+ }
135
+
136
+ // src/plan-loop/promote-ruleset-preflight.ts
137
+ var MODELED_RULE_TYPES = /* @__PURE__ */ new Set([
138
+ "deletion",
139
+ "non_fast_forward",
140
+ "pull_request",
141
+ "required_status_checks"
142
+ ]);
143
+ var MODELED_RULE_PARAMETERS = {
144
+ "pull_request.required_approving_review_count": (v) => v === 0,
145
+ "pull_request.allowed_merge_methods": () => true,
146
+ "pull_request.dismiss_stale_reviews_on_push": () => true,
147
+ "required_status_checks.required_status_checks": () => true,
148
+ "required_status_checks.strict_required_status_checks_policy": () => true,
149
+ "required_status_checks.do_not_enforce_on_create": () => true
150
+ };
151
+ function parseBranchRules(json) {
152
+ let data;
153
+ try {
154
+ data = JSON.parse(json);
155
+ } catch {
156
+ return null;
157
+ }
158
+ if (!Array.isArray(data)) return null;
159
+ const rules = [];
160
+ for (const item of data) {
161
+ if (!item || typeof item !== "object") return null;
162
+ const o = item;
163
+ if (typeof o.type !== "string" || !o.type) return null;
164
+ const rule = { type: o.type };
165
+ if (o.parameters && typeof o.parameters === "object" && !Array.isArray(o.parameters)) {
166
+ rule.parameters = o.parameters;
167
+ }
168
+ if (typeof o.ruleset_id === "number") rule.rulesetId = o.ruleset_id;
169
+ rules.push(rule);
170
+ }
171
+ return rules;
172
+ }
173
+ function restricts(value) {
174
+ if (value === true) return true;
175
+ if (typeof value === "number") return value !== 0;
176
+ if (typeof value === "string") return value.length > 0;
177
+ if (Array.isArray(value)) return value.length > 0;
178
+ if (value && typeof value === "object") return Object.keys(value).length > 0;
179
+ return false;
180
+ }
181
+ function findUnmodeledRuleParameters(rules) {
182
+ const out = [];
183
+ const seen = /* @__PURE__ */ new Set();
184
+ const push = (u) => {
185
+ const key = `${u.name}@${u.rulesetId ?? ""}`;
186
+ if (seen.has(key)) return;
187
+ seen.add(key);
188
+ out.push(u);
189
+ };
190
+ for (const rule of rules) {
191
+ if (!MODELED_RULE_TYPES.has(rule.type)) {
192
+ push({ name: rule.type, rulesetId: rule.rulesetId });
193
+ continue;
194
+ }
195
+ for (const [param, value] of Object.entries(rule.parameters ?? {})) {
196
+ const name = `${rule.type}.${param}`;
197
+ const handled = MODELED_RULE_PARAMETERS[name];
198
+ const unmodeled = handled ? !handled(value) : restricts(value);
199
+ if (unmodeled) push({ name, value, rulesetId: rule.rulesetId });
200
+ }
201
+ }
202
+ return out;
203
+ }
204
+ function formatRulesetPreflight(base, result) {
205
+ if (!result.ok) {
206
+ return `ruleset preflight (${base}): skipped (${result.note}); advisory only, not a blocker.
207
+ `;
208
+ }
209
+ const unmodeled = findUnmodeledRuleParameters(result.rules);
210
+ if (unmodeled.length === 0) {
211
+ return `ruleset preflight (${base}): every rule parameter is modeled by the kit.
212
+ `;
213
+ }
214
+ return `${unmodeled.map((u) => {
215
+ const value = u.value === void 0 ? "" : ` = ${JSON.stringify(u.value)}`;
216
+ const ruleset = u.rulesetId === void 0 ? "" : ` (ruleset ${u.rulesetId})`;
217
+ return `ruleset advisory (${base}): ${u.name}${value}${ruleset} has no model in the kit; GitHub may refuse the merge while it reports CLEAN.`;
218
+ }).join("\n")}
219
+ `;
220
+ }
221
+ function failureNote(err) {
222
+ const code = err?.code;
223
+ if (code === "ENOENT") return "gh not found";
224
+ const msg = err instanceof Error ? err.message : String(err);
225
+ const first = msg.split(/\r?\n/).find((l) => l.trim()) ?? "gh api failed";
226
+ return first.trim().slice(0, 200);
227
+ }
228
+ async function rulesetPreflightFromGh(opts) {
229
+ const repo = opts.repo ?? "{owner}/{repo}";
230
+ let stdout;
231
+ try {
232
+ stdout = await opts.runGh([
233
+ "api",
234
+ `repos/${repo}/rules/branches/${encodeURIComponent(opts.base)}`
235
+ ]);
236
+ } catch (err) {
237
+ return { ok: false, note: failureNote(err) };
238
+ }
239
+ const rules = parseBranchRules(stdout);
240
+ if (!rules) return { ok: false, note: "unreadable rules response" };
241
+ return { ok: true, rules };
242
+ }
243
+
244
+ // src/commands/promote.ts
245
+ var execFileAsync = promisify(execFile);
246
+ var defaultRunGh = async (args, opts) => {
247
+ const { stdout } = await execFileAsync("gh", args, {
248
+ cwd: opts.cwd,
249
+ encoding: "utf8",
250
+ maxBuffer: 4 * 1024 * 1024,
251
+ timeout: 3e4
252
+ });
253
+ return stdout;
254
+ };
255
+ function promoteWaitExitCode(result) {
256
+ if (result.outcome === "merged") return 0;
257
+ if (result.outcome === "timeout") return 3;
258
+ return 1;
259
+ }
260
+ function promotePrViewArgs(pr, repo) {
261
+ const args = ["pr", "view", String(pr), "--json", PROMOTE_PR_VIEW_FIELDS];
262
+ if (repo) args.push("--repo", repo);
263
+ return args;
264
+ }
265
+ async function runPromoteWait(opts) {
266
+ const runGh = opts.runGh ?? defaultRunGh;
267
+ const capMs = opts.capMs ?? resolvePromoteMergeWaitMs(await loadContextConfig(opts.cwd));
268
+ const result = await waitForPromoteMerge({
269
+ capMs,
270
+ sleep: opts.sleep,
271
+ readPr: async () => parsePromotePrView(await runGh(promotePrViewArgs(opts.pr, opts.repo), { cwd: opts.cwd }))
272
+ });
273
+ return { result, capMs };
274
+ }
275
+ var waitCommand = defineCommand({
276
+ meta: {
277
+ name: "wait",
278
+ description: "Wait, read-only and bounded, for the operator merge of a staging\u2192main promote PR; at the cap (config promoteMergeWaitMs, default 60 min) print the promote-merge-wait Ask and exit 3"
279
+ },
280
+ args: {
281
+ pr: { type: "string", description: "Promote PR number", required: true },
282
+ repo: { type: "string", description: "owner/name (default: the checkout's gh repo)" },
283
+ "cap-minutes": {
284
+ type: "string",
285
+ description: "Override the cap for this run (minutes; clamped like the config key)"
286
+ },
287
+ json: { type: "boolean", description: "Print the result as JSON", default: false },
288
+ cwd: { type: "string", description: "Workspace folder (default: current directory)" }
289
+ },
290
+ async run({ args }) {
291
+ const pr = Number.parseInt(String(args.pr), 10);
292
+ if (!Number.isInteger(pr) || pr <= 0) {
293
+ process.stderr.write("--pr must be a positive PR number.\n");
294
+ process.exitCode = 1;
295
+ return;
296
+ }
297
+ const root = path.resolve(typeof args.cwd === "string" && args.cwd ? args.cwd : ".");
298
+ const capArg = args["cap-minutes"];
299
+ const capMs = typeof capArg === "string" && capArg ? resolvePromoteMergeWaitMs({ promoteMergeWaitMs: Number(capArg) * 6e4 }) : void 0;
300
+ const { result } = await runPromoteWait({
301
+ pr,
302
+ cwd: root,
303
+ repo: typeof args.repo === "string" && args.repo ? args.repo : void 0,
304
+ capMs
305
+ });
306
+ process.stdout.write(
307
+ args.json ? `${JSON.stringify(result, null, 2)}
308
+ ` : formatPromoteMergeWaitResult(pr, result)
309
+ );
310
+ process.exitCode = promoteWaitExitCode(result);
311
+ }
312
+ });
313
+ async function runPromoteRules(opts) {
314
+ const runGh = opts.runGh ?? defaultRunGh;
315
+ return rulesetPreflightFromGh({
316
+ base: opts.base,
317
+ repo: opts.repo,
318
+ runGh: (args) => runGh(args, { cwd: opts.cwd })
319
+ });
320
+ }
321
+ var rulesCommand = defineCommand({
322
+ meta: {
323
+ name: "rules",
324
+ description: "Promote preflight: read the base branch rules (gh api .../rules/branches/<base>) and print each rule parameter the kit does not model; advisory, always exit 0"
325
+ },
326
+ args: {
327
+ base: { type: "string", description: "Promote base branch (default: main)", default: "main" },
328
+ repo: { type: "string", description: "owner/name (default: the checkout's gh repo)" },
329
+ json: {
330
+ type: "boolean",
331
+ description: "Print the unmodeled parameters as JSON",
332
+ default: false
333
+ },
334
+ cwd: { type: "string", description: "Workspace folder (default: current directory)" }
335
+ },
336
+ async run({ args }) {
337
+ const base = typeof args.base === "string" && args.base ? args.base : "main";
338
+ const root = path.resolve(typeof args.cwd === "string" && args.cwd ? args.cwd : ".");
339
+ const result = await runPromoteRules({
340
+ base,
341
+ cwd: root,
342
+ repo: typeof args.repo === "string" && args.repo ? args.repo : void 0
343
+ });
344
+ if (args.json) {
345
+ const payload = result.ok ? { ok: true, base, unmodeled: findUnmodeledRuleParameters(result.rules) } : { ok: false, base, note: result.note };
346
+ process.stdout.write(`${JSON.stringify(payload, null, 2)}
347
+ `);
348
+ } else {
349
+ process.stdout.write(formatRulesetPreflight(base, result));
350
+ }
351
+ process.exitCode = 0;
352
+ }
353
+ });
354
+ var promoteCommand = defineCommand({
355
+ meta: {
356
+ name: "promote",
357
+ description: "Read-only helpers for the staging\u2192main promote PR (`wait`: bounded wait for the operator merge; `rules`: ruleset preflight)"
358
+ },
359
+ subCommands: { wait: waitCommand, rules: rulesCommand }
360
+ });
361
+ export {
362
+ promoteCommand,
363
+ promotePrViewArgs,
364
+ promoteWaitExitCode,
365
+ runPromoteRules,
366
+ runPromoteWait
367
+ };
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  readHandoffText
3
- } from "./chunk-TFKEHC2D.js";
3
+ } from "./chunk-GYPCR4UO.js";
4
4
  import "./chunk-7ABY6DYH.js";
5
- import "./chunk-4WHPZGF4.js";
5
+ import "./chunk-SKC6QZW4.js";
6
6
  import "./chunk-EE3LTOBZ.js";
7
7
  import "./chunk-2TKPKRHO.js";
8
8
  import {
9
9
  extractFieldBlock
10
10
  } from "./chunk-L5V3W3DY.js";
11
11
  import "./chunk-MUTTNRX4.js";
12
- import "./chunk-7TEEGAED.js";
12
+ import "./chunk-NDKSOPP7.js";
13
13
  import "./chunk-GDKTTV2A.js";
14
14
  import "./chunk-WRCXRV2U.js";
15
15
  import "./chunk-WGLPZXNU.js";
@@ -2,20 +2,23 @@ import {
2
2
  runPlanLoop,
3
3
  shouldUseLiveTui,
4
4
  withLiveTui
5
- } from "./chunk-WAWCS5PJ.js";
6
- import "./chunk-LFWPB2JR.js";
5
+ } from "./chunk-CFJRCJWD.js";
6
+ import "./chunk-ZFJIJUZ4.js";
7
+ import {
8
+ negatedFlag
9
+ } from "./chunk-XDCCYBCJ.js";
7
10
  import {
8
11
  landDispatchOutcome,
9
12
  runDispatchDriver
10
- } from "./chunk-TFKEHC2D.js";
13
+ } from "./chunk-GYPCR4UO.js";
11
14
  import "./chunk-7ABY6DYH.js";
12
15
  import {
13
16
  DRIVER_EVENTS_FORMATS
14
- } from "./chunk-4WHPZGF4.js";
17
+ } from "./chunk-SKC6QZW4.js";
15
18
  import {
16
19
  REVIEW_PACK_SLASH,
17
20
  runReviewJob
18
- } from "./chunk-UX6FHSO7.js";
21
+ } from "./chunk-AEUE74EZ.js";
19
22
  import {
20
23
  detectAgentBackend,
21
24
  listDetectBackendIds
@@ -24,9 +27,6 @@ import "./chunk-CRLMS2JX.js";
24
27
  import {
25
28
  LAND_ON_GATE_DESCRIPTION
26
29
  } from "./chunk-2TKPKRHO.js";
27
- import {
28
- negatedFlag
29
- } from "./chunk-XDCCYBCJ.js";
30
30
  import "./chunk-L5V3W3DY.js";
31
31
  import "./chunk-MUTTNRX4.js";
32
32
  import {
@@ -39,7 +39,7 @@ import {
39
39
  resolveOperatorNote,
40
40
  runHeadlessDispatch,
41
41
  unknownSlashMessage
42
- } from "./chunk-7TEEGAED.js";
42
+ } from "./chunk-NDKSOPP7.js";
43
43
  import {
44
44
  getBackend
45
45
  } from "./chunk-GDKTTV2A.js";
@@ -356,7 +356,7 @@ var runPlanAllCommand = defineCommand({
356
356
  ...runDispatchArgs,
357
357
  events: {
358
358
  type: "string",
359
- description: "Driver mode for apps: `ndjson` writes only NDJSON events to stdout and reads HITL answers as JSON lines on stdin (no TTY needed; driver protocol 1.4.0, see docs/driver-events-protocol.md)",
359
+ description: "Driver mode for apps: `ndjson` writes only NDJSON events to stdout and reads HITL answers as JSON lines on stdin (no TTY needed; driver protocol 1.5.0, see docs/driver-events-protocol.md)",
360
360
  default: ""
361
361
  },
362
362
  note: {
@@ -1,11 +1,14 @@
1
1
  import {
2
2
  runPlanLoop
3
- } from "./chunk-WAWCS5PJ.js";
4
- import "./chunk-LFWPB2JR.js";
3
+ } from "./chunk-CFJRCJWD.js";
4
+ import "./chunk-ZFJIJUZ4.js";
5
+ import {
6
+ negatedFlag
7
+ } from "./chunk-XDCCYBCJ.js";
5
8
  import "./chunk-7ABY6DYH.js";
6
9
  import {
7
10
  DRIVER_EVENTS_FORMATS
8
- } from "./chunk-4WHPZGF4.js";
11
+ } from "./chunk-SKC6QZW4.js";
9
12
  import {
10
13
  detectAgentBackend,
11
14
  listDetectBackendIds
@@ -13,9 +16,6 @@ import {
13
16
  import {
14
17
  LAND_ON_GATE_DESCRIPTION
15
18
  } from "./chunk-2TKPKRHO.js";
16
- import {
17
- negatedFlag
18
- } from "./chunk-XDCCYBCJ.js";
19
19
  import "./chunk-L5V3W3DY.js";
20
20
  import "./chunk-MUTTNRX4.js";
21
21
  import {
@@ -2,17 +2,17 @@ import {
2
2
  classifyInstallError,
3
3
  isNonInteractive,
4
4
  pathCliStatus
5
- } from "./chunk-I2SG2VPJ.js";
5
+ } from "./chunk-GBHOP62P.js";
6
6
  import {
7
7
  assessEnvironment
8
8
  } from "./chunk-B3VR5YBQ.js";
9
- import "./chunk-2R4HYPQH.js";
9
+ import "./chunk-H5OSZ7HQ.js";
10
10
  import "./chunk-PFEUZXVT.js";
11
- import "./chunk-DVCNJNCF.js";
12
- import "./chunk-FX6BIH4C.js";
13
- import "./chunk-2KIOZMTV.js";
14
- import "./chunk-XJWCL4PO.js";
15
- import "./chunk-5RWTDCJ7.js";
11
+ import "./chunk-AXQJX4DC.js";
12
+ import "./chunk-TR6AC5FW.js";
13
+ import "./chunk-BMU74QWR.js";
14
+ import "./chunk-YZSPNXR2.js";
15
+ import "./chunk-NEMOV327.js";
16
16
  import {
17
17
  KIT_VERSION,
18
18
  pinnedCliSpec
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  detectWorkspaceParent,
3
3
  workspaceParentAdvisoryLines
4
- } from "./chunk-OKQ3SAHK.js";
4
+ } from "./chunk-OLDRCWHE.js";
5
5
  import {
6
6
  createReadinessReport
7
7
  } from "./chunk-PNFF6OU3.js";
@@ -15,21 +15,21 @@ import {
15
15
  import {
16
16
  npxPinned,
17
17
  pathCliStatus
18
- } from "./chunk-I2SG2VPJ.js";
18
+ } from "./chunk-GBHOP62P.js";
19
19
  import {
20
20
  assessEnvironment
21
21
  } from "./chunk-B3VR5YBQ.js";
22
- import "./chunk-2R4HYPQH.js";
22
+ import "./chunk-H5OSZ7HQ.js";
23
23
  import "./chunk-PFEUZXVT.js";
24
- import "./chunk-DVCNJNCF.js";
25
- import "./chunk-FX6BIH4C.js";
26
- import "./chunk-2KIOZMTV.js";
24
+ import "./chunk-AXQJX4DC.js";
25
+ import "./chunk-TR6AC5FW.js";
26
+ import "./chunk-BMU74QWR.js";
27
27
  import {
28
28
  MANIFEST_RELATIVE_PATH,
29
29
  loadAgentKitManifest,
30
30
  resolveProtectedGlobs
31
- } from "./chunk-XJWCL4PO.js";
32
- import "./chunk-5RWTDCJ7.js";
31
+ } from "./chunk-YZSPNXR2.js";
32
+ import "./chunk-NEMOV327.js";
33
33
  import {
34
34
  KIT_VERSION
35
35
  } from "./chunk-7HDQEK6T.js";