@dadado/agent-kit-cli 6.13.1 → 6.15.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.
- package/dashboard/README.md +8 -8
- package/dashboard/dashboard-data.mjs +134 -4
- package/dashboard/lib/ship-lane.mjs +238 -18
- package/dist/{add-FTPXOOZD.js → add-5VIXRO5Z.js} +3 -3
- package/dist/{chunk-JRCI2GNS.js → chunk-2MDFNC34.js} +1 -1
- package/dist/{chunk-NDKSOPP7.js → chunk-2Y27P6KC.js} +1 -1
- package/dist/{chunk-2KATW2O4.js → chunk-5WJRUM23.js} +2 -2
- package/dist/{chunk-2TKPKRHO.js → chunk-CJ3JAH7L.js} +1 -1
- package/dist/{chunk-DONKV6MA.js → chunk-CMYT6QE6.js} +2 -2
- package/dist/{chunk-PHH3H5EQ.js → chunk-D43WS55A.js} +1 -1
- package/dist/{chunk-PXURVVVO.js → chunk-D46W3SEU.js} +2 -2
- package/dist/{chunk-6QBU4DQF.js → chunk-D6SJQ25H.js} +3 -3
- package/dist/{chunk-N7HMTWS5.js → chunk-DXYCBLRT.js} +4 -4
- package/dist/{chunk-EE3LTOBZ.js → chunk-IJQAFPY3.js} +1 -1
- package/dist/{chunk-CRLMS2JX.js → chunk-MEZU47IB.js} +1 -1
- package/dist/{chunk-GDKTTV2A.js → chunk-OQNJRQPZ.js} +1 -0
- package/dist/{chunk-OVRWRZ5S.js → chunk-P4CAPXSX.js} +2 -2
- package/dist/{chunk-JGEGTOF6.js → chunk-PDEYXAJH.js} +1 -1
- package/dist/{chunk-A4PHFHYO.js → chunk-QD42L2LW.js} +9 -1
- package/dist/{chunk-DQLIEJFK.js → chunk-QF3534M4.js} +1 -1
- package/dist/{chunk-GYPCR4UO.js → chunk-QYIV6ZP6.js} +3 -3
- package/dist/{chunk-LQJNGECA.js → chunk-RSOUQRPT.js} +1 -1
- package/dist/{chunk-AEUE74EZ.js → chunk-TICKIKCQ.js} +4 -4
- package/dist/{chunk-4PL57BZ5.js → chunk-WS6OX2IG.js} +8 -0
- package/dist/{chunk-W6U3Z2RU.js → chunk-XKM3K3VY.js} +8 -8
- package/dist/{chunk-CFJRCJWD.js → chunk-YO4BLHDT.js} +2 -2
- package/dist/{commands-MVUJZEJ6.js → commands-FIJLHKEL.js} +5 -5
- package/dist/conflicts-UY6VTYIO.js +1125 -0
- package/dist/{contribute-EKTMMEYU.js → contribute-54IQQZVI.js} +5 -5
- package/dist/{countdown-TFKPAYIQ.js → countdown-JX3DZ2QU.js} +6 -6
- package/dist/{diff-RFW6K4X5.js → diff-E6ZMMKMG.js} +6 -6
- package/dist/{doctor-3KNZI3CK.js → doctor-HJSMCNFE.js} +10 -10
- package/dist/{ground-control-DB5RSYAT.js → ground-control-D2X6CI66.js} +3 -3
- package/dist/{hook-VXHZ4ICK.js → hook-JHV4HTJL.js} +6 -6
- package/dist/index.js +25 -21
- package/dist/{init-BDWKZGMP.js → init-VHNLK3SA.js} +13 -13
- package/dist/{install-NXNO4RTU.js → install-WDKBEUTW.js} +13 -13
- package/dist/promote-H5MIMVEB.js +367 -0
- package/dist/{queue-VLIWWVKM.js → queue-X7IOE525.js} +5 -5
- package/dist/{run-NKCDKMTC.js → run-L63NZHAJ.js} +11 -11
- package/dist/{run-plan-3PCINKTY.js → run-plan-BWJX6R7Q.js} +7 -7
- package/dist/{setup-global-K53H3ZEH.js → setup-global-OKGV2IUV.js} +7 -7
- package/dist/{status-GFV3KCUR.js → status-N4U56UXW.js} +8 -8
- package/dist/{update-25WSBSWM.js → update-PQGDJYL2.js} +11 -11
- package/package.json +4 -4
- package/dist/{engine-info-CYDRD7SW.js → engine-info-R6GXZ2VO.js} +3 -3
|
@@ -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,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
readHandoffText
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-QYIV6ZP6.js";
|
|
4
4
|
import "./chunk-7ABY6DYH.js";
|
|
5
5
|
import "./chunk-SKC6QZW4.js";
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-IJQAFPY3.js";
|
|
7
|
+
import "./chunk-CJ3JAH7L.js";
|
|
8
8
|
import {
|
|
9
9
|
extractFieldBlock
|
|
10
10
|
} from "./chunk-L5V3W3DY.js";
|
|
11
11
|
import "./chunk-MUTTNRX4.js";
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-2Y27P6KC.js";
|
|
13
|
+
import "./chunk-OQNJRQPZ.js";
|
|
14
14
|
import "./chunk-WRCXRV2U.js";
|
|
15
15
|
import "./chunk-WGLPZXNU.js";
|
|
16
16
|
import "./chunk-6RRG3WOE.js";
|
|
@@ -2,12 +2,15 @@ import {
|
|
|
2
2
|
runPlanLoop,
|
|
3
3
|
shouldUseLiveTui,
|
|
4
4
|
withLiveTui
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-YO4BLHDT.js";
|
|
6
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-
|
|
13
|
+
} from "./chunk-QYIV6ZP6.js";
|
|
11
14
|
import "./chunk-7ABY6DYH.js";
|
|
12
15
|
import {
|
|
13
16
|
DRIVER_EVENTS_FORMATS
|
|
@@ -15,18 +18,15 @@ import {
|
|
|
15
18
|
import {
|
|
16
19
|
REVIEW_PACK_SLASH,
|
|
17
20
|
runReviewJob
|
|
18
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-TICKIKCQ.js";
|
|
19
22
|
import {
|
|
20
23
|
detectAgentBackend,
|
|
21
24
|
listDetectBackendIds
|
|
22
|
-
} from "./chunk-
|
|
23
|
-
import "./chunk-
|
|
25
|
+
} from "./chunk-IJQAFPY3.js";
|
|
26
|
+
import "./chunk-MEZU47IB.js";
|
|
24
27
|
import {
|
|
25
28
|
LAND_ON_GATE_DESCRIPTION
|
|
26
|
-
} from "./chunk-
|
|
27
|
-
import {
|
|
28
|
-
negatedFlag
|
|
29
|
-
} from "./chunk-XDCCYBCJ.js";
|
|
29
|
+
} from "./chunk-CJ3JAH7L.js";
|
|
30
30
|
import "./chunk-L5V3W3DY.js";
|
|
31
31
|
import "./chunk-MUTTNRX4.js";
|
|
32
32
|
import {
|
|
@@ -39,10 +39,10 @@ import {
|
|
|
39
39
|
resolveOperatorNote,
|
|
40
40
|
runHeadlessDispatch,
|
|
41
41
|
unknownSlashMessage
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-2Y27P6KC.js";
|
|
43
43
|
import {
|
|
44
44
|
getBackend
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-OQNJRQPZ.js";
|
|
46
46
|
import {
|
|
47
47
|
HITL_UNANSWERED_EXIT_CODE,
|
|
48
48
|
formatHitlSummary,
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runPlanLoop
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-YO4BLHDT.js";
|
|
4
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
|
|
@@ -9,18 +12,15 @@ import {
|
|
|
9
12
|
import {
|
|
10
13
|
detectAgentBackend,
|
|
11
14
|
listDetectBackendIds
|
|
12
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-IJQAFPY3.js";
|
|
13
16
|
import {
|
|
14
17
|
LAND_ON_GATE_DESCRIPTION
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import {
|
|
17
|
-
negatedFlag
|
|
18
|
-
} from "./chunk-XDCCYBCJ.js";
|
|
18
|
+
} from "./chunk-CJ3JAH7L.js";
|
|
19
19
|
import "./chunk-L5V3W3DY.js";
|
|
20
20
|
import "./chunk-MUTTNRX4.js";
|
|
21
21
|
import {
|
|
22
22
|
getBackend
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-OQNJRQPZ.js";
|
|
24
24
|
import {
|
|
25
25
|
HITL_UNANSWERED_EXIT_CODE
|
|
26
26
|
} from "./chunk-WRCXRV2U.js";
|
|
@@ -2,17 +2,17 @@ import {
|
|
|
2
2
|
classifyInstallError,
|
|
3
3
|
isNonInteractive,
|
|
4
4
|
pathCliStatus
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-5WJRUM23.js";
|
|
6
6
|
import {
|
|
7
7
|
assessEnvironment
|
|
8
8
|
} from "./chunk-B3VR5YBQ.js";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-CMYT6QE6.js";
|
|
10
10
|
import "./chunk-PFEUZXVT.js";
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-D6SJQ25H.js";
|
|
12
|
+
import "./chunk-P4CAPXSX.js";
|
|
13
|
+
import "./chunk-WS6OX2IG.js";
|
|
14
|
+
import "./chunk-QF3534M4.js";
|
|
15
|
+
import "./chunk-QD42L2LW.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-
|
|
4
|
+
} from "./chunk-2MDFNC34.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-
|
|
18
|
+
} from "./chunk-5WJRUM23.js";
|
|
19
19
|
import {
|
|
20
20
|
assessEnvironment
|
|
21
21
|
} from "./chunk-B3VR5YBQ.js";
|
|
22
|
-
import "./chunk-
|
|
22
|
+
import "./chunk-CMYT6QE6.js";
|
|
23
23
|
import "./chunk-PFEUZXVT.js";
|
|
24
|
-
import "./chunk-
|
|
25
|
-
import "./chunk-
|
|
26
|
-
import "./chunk-
|
|
24
|
+
import "./chunk-D6SJQ25H.js";
|
|
25
|
+
import "./chunk-P4CAPXSX.js";
|
|
26
|
+
import "./chunk-WS6OX2IG.js";
|
|
27
27
|
import {
|
|
28
28
|
MANIFEST_RELATIVE_PATH,
|
|
29
29
|
loadAgentKitManifest,
|
|
30
30
|
resolveProtectedGlobs
|
|
31
|
-
} from "./chunk-
|
|
32
|
-
import "./chunk-
|
|
31
|
+
} from "./chunk-QF3534M4.js";
|
|
32
|
+
import "./chunk-QD42L2LW.js";
|
|
33
33
|
import {
|
|
34
34
|
KIT_VERSION
|
|
35
35
|
} from "./chunk-7HDQEK6T.js";
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
formatRerunFlags,
|
|
5
5
|
formatStaleCliRefusal,
|
|
6
6
|
syncFromManifest
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-DXYCBLRT.js";
|
|
8
8
|
import {
|
|
9
9
|
formatSkippedSymlinks,
|
|
10
10
|
logApplyStats
|
|
@@ -12,16 +12,16 @@ import {
|
|
|
12
12
|
import {
|
|
13
13
|
REGISTRY_CLI_ARGS,
|
|
14
14
|
resolveRegistryFromCli
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-D43WS55A.js";
|
|
16
16
|
import {
|
|
17
17
|
CLAUDE_SETTINGS_REL,
|
|
18
18
|
formatClaudeSettingsDrift,
|
|
19
19
|
planClaudeSettingsDrift,
|
|
20
20
|
writeClaudeSessionStartHook
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-PDEYXAJH.js";
|
|
22
22
|
import {
|
|
23
23
|
generateClaudeCommandAdapters
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-RSOUQRPT.js";
|
|
25
25
|
import "./chunk-6RRG3WOE.js";
|
|
26
26
|
import {
|
|
27
27
|
withCliProgress
|
|
@@ -34,25 +34,25 @@ import {
|
|
|
34
34
|
confirmProjectRoot,
|
|
35
35
|
isNonInteractive,
|
|
36
36
|
syncPathCliToRuntime
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-5WJRUM23.js";
|
|
38
38
|
import "./chunk-B3VR5YBQ.js";
|
|
39
39
|
import {
|
|
40
40
|
checkForUpdates
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-CMYT6QE6.js";
|
|
42
42
|
import "./chunk-PFEUZXVT.js";
|
|
43
|
-
import "./chunk-
|
|
44
|
-
import "./chunk-
|
|
45
|
-
import "./chunk-
|
|
43
|
+
import "./chunk-D6SJQ25H.js";
|
|
44
|
+
import "./chunk-P4CAPXSX.js";
|
|
45
|
+
import "./chunk-WS6OX2IG.js";
|
|
46
46
|
import {
|
|
47
47
|
buildManifest,
|
|
48
48
|
isProtectedPath,
|
|
49
49
|
loadAgentKitManifest,
|
|
50
50
|
resolveProtectedGlobs,
|
|
51
51
|
saveManifest
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-QF3534M4.js";
|
|
53
53
|
import {
|
|
54
54
|
seedManagedHashLedger
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-QD42L2LW.js";
|
|
56
56
|
import {
|
|
57
57
|
KIT_VERSION
|
|
58
58
|
} from "./chunk-7HDQEK6T.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dadado/agent-kit-cli",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.15.0",
|
|
4
4
|
"description": "Agent Kit CLI: HITL framework install and tooling for AI-assisted IDEs (rules, skills, plan/handoff, context).",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -42,10 +42,10 @@
|
|
|
42
42
|
"kolorist": "^1.8.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@types/node": "^22.
|
|
45
|
+
"@types/node": "^22.20.5",
|
|
46
46
|
"tsup": "^9.0.0",
|
|
47
47
|
"tsx": "^4.23.15",
|
|
48
|
-
"vite": "^8.3.
|
|
49
|
-
"vitest": "^5.0.
|
|
48
|
+
"vite": "^8.3.5",
|
|
49
|
+
"vitest": "^5.0.5"
|
|
50
50
|
}
|
|
51
51
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DRIVER_PROTOCOL_VERSION
|
|
3
|
-
} from "./chunk-SKC6QZW4.js";
|
|
4
1
|
import {
|
|
5
2
|
bundledDashboardCandidates
|
|
6
3
|
} from "./chunk-XDCCYBCJ.js";
|
|
4
|
+
import {
|
|
5
|
+
DRIVER_PROTOCOL_VERSION
|
|
6
|
+
} from "./chunk-SKC6QZW4.js";
|
|
7
7
|
import "./chunk-WRCXRV2U.js";
|
|
8
8
|
import "./chunk-ZB43YMHW.js";
|
|
9
9
|
|