@dadado/agent-kit-cli 6.28.0 → 6.30.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/cursor-audit/cursor-3-features.md +57 -0
- package/cursor-audit/cursor-native-audit.md +292 -0
- package/dashboard/lib/guards.d.mts +16 -5
- package/dashboard/lib/guards.mjs +55 -7
- package/dashboard/serve.mjs +1 -0
- package/dashboard/start.mjs +8 -1
- package/dist/{add-WILYTGO7.js → add-CMQ3S2GH.js} +3 -3
- package/dist/build-stamp.json +2 -2
- package/dist/{chunk-TI7BX6JV.js → chunk-2JKKO7FF.js} +4 -4
- package/dist/{chunk-CHYROVQB.js → chunk-2PKJOMTI.js} +1 -1
- package/dist/{chunk-BDTB7AUO.js → chunk-37INM5QP.js} +3 -3
- package/dist/{chunk-VI4UEKRN.js → chunk-7HPYWUC7.js} +4 -4
- package/dist/{chunk-I3GF72CH.js → chunk-BM5RR7LT.js} +3 -2
- package/dist/{chunk-KXC6NCX2.js → chunk-CY4TDI4S.js} +9 -9
- package/dist/{chunk-Y575INEC.js → chunk-DA5VLMNL.js} +1 -1
- package/dist/{chunk-SOSU22LZ.js → chunk-DQD6KPWJ.js} +1 -1
- package/dist/{chunk-WMMFTZ6O.js → chunk-EJJET3CA.js} +6 -1
- package/dist/{chunk-RHP44DQQ.js → chunk-GSVUCEMH.js} +3 -1
- package/dist/{chunk-43JHKSN4.js → chunk-GSZ2WZYY.js} +2 -2
- package/dist/{chunk-KWQEY6OG.js → chunk-HO7VEYAD.js} +1 -1
- package/dist/{chunk-RX2ZWBQM.js → chunk-KNEVGAOO.js} +3 -3
- package/dist/{chunk-PIL4G5SI.js → chunk-N7L4ARYK.js} +1 -1
- package/dist/{chunk-XSNKZM3M.js → chunk-O3OEYLXW.js} +10 -10
- package/dist/{chunk-MCH3E46V.js → chunk-RPJA7Q2F.js} +94 -35
- package/dist/{chunk-5EJHIT2K.js → chunk-SXMGHRLU.js} +2 -2
- package/dist/{chunk-YFRG3CMS.js → chunk-SZMIKKSA.js} +1 -1
- package/dist/{commands-6LJACZME.js → commands-WGCC5YOR.js} +2 -2
- package/dist/{contribute-SGMAG35M.js → contribute-E5HOW57P.js} +4 -4
- package/dist/{cursor-awareness-TN5JXD2C.js → cursor-awareness-ANT44WHK.js} +1 -1
- package/dist/{dashboard-6V6PCNYF.js → dashboard-3RBOYKZW.js} +1 -1
- package/dist/{dashboard-broadcast-PMVQ7PXU.js → dashboard-broadcast-K3PAGFBO.js} +1 -1
- package/dist/{diff-WPNZDMB2.js → diff-D3S7D6RK.js} +5 -5
- package/dist/{doctor-SW42AH5D.js → doctor-QAWK3NHG.js} +9 -9
- package/dist/{dogfood-2JAHSYQA.js → dogfood-2SYGZFTJ.js} +49 -2
- package/dist/{engine-info-VM4VPGQM.js → engine-info-OTYCQUQB.js} +1 -1
- package/dist/{guard-CH4A7QIZ.js → guard-SSDUD7CH.js} +1 -1
- package/dist/{hook-ASKMJGBB.js → hook-DKX7CH6S.js} +8 -8
- package/dist/index.js +24 -24
- package/dist/{init-IJ53YMKS.js → init-ZQ56SONI.js} +13 -13
- package/dist/{install-BHOMUS2G.js → install-FY7337TL.js} +13 -13
- package/dist/{mission-control-IGOI3WHS.js → mission-control-3D46DA2Z.js} +2 -2
- package/dist/{paths-PSG64N6P.js → paths-YV6O6JFK.js} +2 -2
- package/dist/{promote-H5MIMVEB.js → promote-MAQ44EMD.js} +100 -9
- package/dist/{run-RGIY5JTX.js → run-2MN2HRUC.js} +3 -3
- package/dist/{run-plan-DHB3ZXJS.js → run-plan-MYAVTBY4.js} +3 -3
- package/dist/{session-start-RWPMRY6N.js → session-start-WNVFNJFF.js} +8 -8
- package/dist/{sessions-4IDYAFBL.js → sessions-OCJOE6HR.js} +1 -1
- package/dist/{setup-global-QEGG3OG2.js → setup-global-ZYLEOFLF.js} +6 -6
- package/dist/{status-A375W7ZU.js → status-6OEQTXJE.js} +6 -6
- package/dist/{update-B2I3VDIG.js → update-DJG3GR24.js} +11 -11
- package/dist/{update-all-PIEDQUGQ.js → update-all-TSF6GZFZ.js} +11 -11
- package/package.json +4 -3
- /package/dist/{chunk-LEVNLHH3.js → chunk-7Z2E2PWM.js} +0 -0
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
2
|
REGISTRY_CLI_ARGS,
|
|
3
3
|
resolveRegistryFromCli
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-BM5RR7LT.js";
|
|
5
5
|
import {
|
|
6
6
|
logger
|
|
7
7
|
} from "./chunk-ZB43YMHW.js";
|
|
8
8
|
import {
|
|
9
9
|
diffAgainstRegistry,
|
|
10
10
|
summarizeDiff
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-37INM5QP.js";
|
|
12
|
+
import "./chunk-SXMGHRLU.js";
|
|
13
13
|
import "./chunk-CGXLR77R.js";
|
|
14
14
|
import {
|
|
15
15
|
canonicalizePackIds,
|
|
16
16
|
formatUnknownPack,
|
|
17
17
|
loadAgentKitManifest
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import "./chunk-
|
|
18
|
+
} from "./chunk-GSVUCEMH.js";
|
|
19
|
+
import "./chunk-EJJET3CA.js";
|
|
20
20
|
import "./chunk-IHVJTGYR.js";
|
|
21
21
|
import "./chunk-KMK4T4ZM.js";
|
|
22
22
|
import "./chunk-O7VMHCNN.js";
|
|
@@ -2,16 +2,16 @@ import {
|
|
|
2
2
|
assessHooksHealth,
|
|
3
3
|
executeSafeReadinessFixes,
|
|
4
4
|
refreshRepositoryProfile
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-KNEVGAOO.js";
|
|
6
6
|
import {
|
|
7
7
|
assessInstallHealth,
|
|
8
8
|
cachedCliNpmLatest,
|
|
9
9
|
npmLatestCheckAllowed,
|
|
10
10
|
writeInstallHealthSnapshot,
|
|
11
11
|
writeReadinessSnapshot
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-HO7VEYAD.js";
|
|
13
|
+
import "./chunk-DQD6KPWJ.js";
|
|
14
|
+
import "./chunk-2PKJOMTI.js";
|
|
15
15
|
import {
|
|
16
16
|
feedInstallsRegistry
|
|
17
17
|
} from "./chunk-NHJ4IAVN.js";
|
|
@@ -45,17 +45,17 @@ import {
|
|
|
45
45
|
CLI_NPM_PACKAGES,
|
|
46
46
|
fetchLatestCliNpmVersion,
|
|
47
47
|
warnIfRunningCliBehindNpm
|
|
48
|
-
} from "./chunk-
|
|
49
|
-
import "./chunk-
|
|
50
|
-
import "./chunk-
|
|
48
|
+
} from "./chunk-GSZ2WZYY.js";
|
|
49
|
+
import "./chunk-37INM5QP.js";
|
|
50
|
+
import "./chunk-SXMGHRLU.js";
|
|
51
51
|
import "./chunk-CGXLR77R.js";
|
|
52
52
|
import {
|
|
53
53
|
loadContextConfig
|
|
54
54
|
} from "./chunk-PFEUZXVT.js";
|
|
55
55
|
import {
|
|
56
56
|
loadAgentKitManifest
|
|
57
|
-
} from "./chunk-
|
|
58
|
-
import "./chunk-
|
|
57
|
+
} from "./chunk-GSVUCEMH.js";
|
|
58
|
+
import "./chunk-EJJET3CA.js";
|
|
59
59
|
import "./chunk-IHVJTGYR.js";
|
|
60
60
|
import "./chunk-KMK4T4ZM.js";
|
|
61
61
|
import {
|
|
@@ -16,6 +16,7 @@ import { defineCommand } from "citty";
|
|
|
16
16
|
|
|
17
17
|
// src/lifecycle/dogfood-file.ts
|
|
18
18
|
import { execFile } from "child_process";
|
|
19
|
+
import { constants as fsConstants } from "fs";
|
|
19
20
|
import { access, mkdir, readFile, writeFile } from "fs/promises";
|
|
20
21
|
import path from "path";
|
|
21
22
|
import { promisify } from "util";
|
|
@@ -104,6 +105,26 @@ async function defaultGetRemoteUrl(cwd, name) {
|
|
|
104
105
|
return null;
|
|
105
106
|
}
|
|
106
107
|
}
|
|
108
|
+
async function defaultGetPushUrls(cwd, name) {
|
|
109
|
+
try {
|
|
110
|
+
const { stdout } = await execFileAsync(
|
|
111
|
+
"git",
|
|
112
|
+
["config", "--get-all", `remote.${name}.pushurl`],
|
|
113
|
+
{ cwd, encoding: "utf8", timeout: 5e3 }
|
|
114
|
+
);
|
|
115
|
+
return stdout.split(/\r?\n/).map((line) => line.trim()).filter(Boolean);
|
|
116
|
+
} catch {
|
|
117
|
+
return [];
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
async function defaultIsWritable(target) {
|
|
121
|
+
try {
|
|
122
|
+
await access(target, fsConstants.W_OK);
|
|
123
|
+
return true;
|
|
124
|
+
} catch {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
107
128
|
async function defaultRunCli(bin, args, options) {
|
|
108
129
|
const { stdout } = await execFileAsync(bin, args, {
|
|
109
130
|
cwd: options?.cwd,
|
|
@@ -113,14 +134,32 @@ async function defaultRunCli(bin, args, options) {
|
|
|
113
134
|
});
|
|
114
135
|
return stdout;
|
|
115
136
|
}
|
|
137
|
+
async function detectForeignCheckout(root, deps = {}) {
|
|
138
|
+
const getPushUrls = deps.getPushUrls ?? defaultGetPushUrls;
|
|
139
|
+
const isWritable = deps.isWritable ?? defaultIsWritable;
|
|
140
|
+
const pushUrls = await getPushUrls(root, "origin");
|
|
141
|
+
if (pushUrls.some((url) => /^no-push/i.test(url))) return "no-push-pushurl";
|
|
142
|
+
for (const target of [
|
|
143
|
+
root,
|
|
144
|
+
path.join(root, "dogfood"),
|
|
145
|
+
path.join(root, "dogfood", "README.md")
|
|
146
|
+
]) {
|
|
147
|
+
if (await exists(target) && !await isWritable(target)) return "read-only-tree";
|
|
148
|
+
}
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
116
151
|
async function detectDogfoodLane(root, deps = {}) {
|
|
117
152
|
const getRemoteUrl = deps.getRemoteUrl ?? defaultGetRemoteUrl;
|
|
118
153
|
const origin = await getRemoteUrl(root, "origin");
|
|
119
|
-
|
|
120
|
-
if (await
|
|
154
|
+
const factoryLike = origin !== null && /agent-kit-dev/i.test(origin) || await exists(path.join(root, "dogfood", "README.md"));
|
|
155
|
+
if (factoryLike) return await detectForeignCheckout(root, deps) ? "foreign" : "factory";
|
|
121
156
|
if (await exists(path.join(root, ".cursor", "agent-kit.json"))) return "consumer";
|
|
122
157
|
return null;
|
|
123
158
|
}
|
|
159
|
+
function foreignMessage(reason) {
|
|
160
|
+
const why = reason === "no-push-pushurl" ? "origin pushurl is a no-push sentinel" : "the checkout is not writable";
|
|
161
|
+
return `Factory lane refused: ${why}, so another system owns this checkout. Nothing written; run /dogfood from the operator's factory checkout or ask the operator.`;
|
|
162
|
+
}
|
|
124
163
|
function inboxDir(root, lane) {
|
|
125
164
|
return lane === "factory" ? path.join(root, "dogfood") : path.join(root, ".cursor", "dogfood");
|
|
126
165
|
}
|
|
@@ -150,6 +189,10 @@ ${tail}` : ""}`;
|
|
|
150
189
|
async function addDogfoodNote(root, input, deps = {}) {
|
|
151
190
|
const lane = await detectDogfoodLane(root, deps);
|
|
152
191
|
if (!lane) return { status: "unknown-lane" };
|
|
192
|
+
if (lane === "foreign") {
|
|
193
|
+
const reason = await detectForeignCheckout(root, deps) ?? "read-only-tree";
|
|
194
|
+
return { status: "refused-foreign-checkout", reason, message: foreignMessage(reason) };
|
|
195
|
+
}
|
|
153
196
|
const now = deps.now?.() ?? /* @__PURE__ */ new Date();
|
|
154
197
|
const topic = hygieneStrip(input.topic);
|
|
155
198
|
const observation = hygieneStrip(input.summary ?? input.topic);
|
|
@@ -232,6 +275,10 @@ async function fileDogfoodIssue(root, input, deps = {}) {
|
|
|
232
275
|
const lane = await detectDogfoodLane(root, deps);
|
|
233
276
|
if (!lane)
|
|
234
277
|
return stop("refused-unknown-lane", "Lane unknown: not the factory nor a kit install.");
|
|
278
|
+
if (lane === "foreign") {
|
|
279
|
+
const reason = await detectForeignCheckout(root, deps) ?? "read-only-tree";
|
|
280
|
+
return stop("refused-foreign-checkout", foreignMessage(reason));
|
|
281
|
+
}
|
|
235
282
|
let target;
|
|
236
283
|
if (input.visibility === "public") {
|
|
237
284
|
if (lane !== "factory") {
|
|
@@ -304,7 +304,7 @@ function segmentAllowsMainPush(segment) {
|
|
|
304
304
|
if (!segmentHasAllowMainPushEnv(segment)) return false;
|
|
305
305
|
return isAuthorizedProdMainPush(stripLeadingEnvAssignments(segment));
|
|
306
306
|
}
|
|
307
|
-
var PUBLIC_REPO_RE = /agent-kit-startup\/agent-kit(?![\w-])/i;
|
|
307
|
+
var PUBLIC_REPO_RE = /(?:agent-kit-startup\/agent-kit|mission-kit\/cli)(?![\w-])/i;
|
|
308
308
|
function segmentHasAllowPublicPushEnv(segment) {
|
|
309
309
|
if (process.env.ALLOW_PUBLIC_PUSH === "1") return true;
|
|
310
310
|
const leading = segment.match(/^(?:\w+=\S+\s+)*/)?.[0] ?? "";
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
2
|
buildSessionStartAdditionalContext,
|
|
3
3
|
resolveSessionRoot
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-7HPYWUC7.js";
|
|
5
5
|
import "./chunk-XXPI4H4D.js";
|
|
6
6
|
import "./chunk-2YU2H7I6.js";
|
|
7
7
|
import {
|
|
8
8
|
readStdinJson
|
|
9
9
|
} from "./chunk-DE3LQFSJ.js";
|
|
10
10
|
import "./chunk-FOVHFMSH.js";
|
|
11
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-RPJA7Q2F.js";
|
|
12
12
|
import "./chunk-4CRBUEJ6.js";
|
|
13
13
|
import "./chunk-TTUFIE26.js";
|
|
14
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-HO7VEYAD.js";
|
|
15
15
|
import "./chunk-NHJ4IAVN.js";
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-GSZ2WZYY.js";
|
|
17
|
+
import "./chunk-37INM5QP.js";
|
|
18
|
+
import "./chunk-SXMGHRLU.js";
|
|
19
19
|
import "./chunk-CGXLR77R.js";
|
|
20
20
|
import "./chunk-PFEUZXVT.js";
|
|
21
|
-
import "./chunk-
|
|
22
|
-
import "./chunk-
|
|
21
|
+
import "./chunk-GSVUCEMH.js";
|
|
22
|
+
import "./chunk-EJJET3CA.js";
|
|
23
23
|
import "./chunk-IHVJTGYR.js";
|
|
24
24
|
import "./chunk-KMK4T4ZM.js";
|
|
25
25
|
import "./chunk-2G4K4ZI5.js";
|
package/dist/index.js
CHANGED
|
@@ -251,43 +251,43 @@ var main = defineCommand({
|
|
|
251
251
|
version: KIT_VERSION
|
|
252
252
|
},
|
|
253
253
|
subCommands: {
|
|
254
|
-
init: () => import("./init-
|
|
255
|
-
install: () => import("./install-
|
|
254
|
+
init: () => import("./init-ZQ56SONI.js").then((m) => m.initCommand),
|
|
255
|
+
install: () => import("./install-FY7337TL.js").then((m) => m.installCommand),
|
|
256
256
|
scan: () => import("./scan-7D3RMO34.js").then((m) => m.scanCommand),
|
|
257
|
-
add: () => import("./add-
|
|
258
|
-
doctor: () => import("./doctor-
|
|
259
|
-
"setup-global": () => import("./setup-global-
|
|
260
|
-
status: () => import("./status-
|
|
261
|
-
update: () => import("./update-
|
|
257
|
+
add: () => import("./add-CMQ3S2GH.js").then((m) => m.addCommand),
|
|
258
|
+
doctor: () => import("./doctor-QAWK3NHG.js").then((m) => m.doctorCommand),
|
|
259
|
+
"setup-global": () => import("./setup-global-ZYLEOFLF.js").then((m) => m.setupGlobalCommand),
|
|
260
|
+
status: () => import("./status-6OEQTXJE.js").then((m) => m.statusCommand),
|
|
261
|
+
update: () => import("./update-DJG3GR24.js").then((m) => m.updateCommand),
|
|
262
262
|
installs: () => import("./installs-2ROXPO6M.js").then((m) => m.installsCommand),
|
|
263
|
-
"cursor-awareness": () => import("./cursor-awareness-
|
|
263
|
+
"cursor-awareness": () => import("./cursor-awareness-ANT44WHK.js").then((m) => m.cursorAwarenessCommand),
|
|
264
264
|
"public-inbound-radar": () => import("./public-inbound-radar-5U4JMBRU.js").then((m) => m.publicInboundRadarCommand),
|
|
265
265
|
"remote-issues": () => import("./remote-issues-APYOMIJC.js").then((m) => m.remoteIssuesCommand),
|
|
266
|
-
dogfood: () => import("./dogfood-
|
|
267
|
-
diff: () => import("./diff-
|
|
268
|
-
contribute: () => import("./contribute-
|
|
266
|
+
dogfood: () => import("./dogfood-2SYGZFTJ.js").then((m) => m.dogfoodCommand),
|
|
267
|
+
diff: () => import("./diff-D3S7D6RK.js").then((m) => m.diffCommand),
|
|
268
|
+
contribute: () => import("./contribute-E5HOW57P.js").then((m) => m.contributeCommand),
|
|
269
269
|
handoff: () => import("./handoff-LLT4CI6H.js").then((m) => m.handoffCommand),
|
|
270
270
|
"plan-index": () => import("./plan-index-5QZJK4AG.js").then((m) => m.planIndexCommand),
|
|
271
|
-
run: () => import("./run-
|
|
272
|
-
"run-plan": () => import("./run-plan-
|
|
273
|
-
"run-plan-all": () => import("./run-
|
|
271
|
+
run: () => import("./run-2MN2HRUC.js").then((m) => m.runCommand),
|
|
272
|
+
"run-plan": () => import("./run-plan-MYAVTBY4.js").then((m) => m.runPlanCommand),
|
|
273
|
+
"run-plan-all": () => import("./run-2MN2HRUC.js").then((m) => m.runPlanAllCommand),
|
|
274
274
|
queue: () => import("./queue-HDR5ER25.js").then((m) => m.queueCommand),
|
|
275
|
-
promote: () => import("./promote-
|
|
275
|
+
promote: () => import("./promote-MAQ44EMD.js").then((m) => m.promoteCommand),
|
|
276
276
|
countdown: () => import("./countdown-VXOFV23S.js").then((m) => m.countdownCommand),
|
|
277
277
|
"ground-control": () => import("./ground-control-J4AMA4S4.js").then((m) => m.groundControlCommand),
|
|
278
278
|
conflicts: () => import("./conflicts-4GLQOMJF.js").then((m) => m.conflictsCommand),
|
|
279
|
-
dashboard: () => import("./dashboard-
|
|
280
|
-
"dashboard-broadcast": () => import("./dashboard-broadcast-
|
|
281
|
-
"mission-control": () => import("./mission-control-
|
|
282
|
-
hook: () => import("./hook-
|
|
283
|
-
guard: () => import("./guard-
|
|
279
|
+
dashboard: () => import("./dashboard-3RBOYKZW.js").then((m) => m.dashboardCommand),
|
|
280
|
+
"dashboard-broadcast": () => import("./dashboard-broadcast-K3PAGFBO.js").then((m) => m.dashboardBroadcastCommand),
|
|
281
|
+
"mission-control": () => import("./mission-control-3D46DA2Z.js").then((m) => m.missionControlCommand),
|
|
282
|
+
hook: () => import("./hook-DKX7CH6S.js").then((m) => m.hookCommand),
|
|
283
|
+
guard: () => import("./guard-SSDUD7CH.js").then((m) => m.guardCommand),
|
|
284
284
|
monitors: () => import("./monitors-PDXBLB3U.js").then((m) => m.monitorsCommand),
|
|
285
|
-
sessions: () => import("./sessions-
|
|
285
|
+
sessions: () => import("./sessions-OCJOE6HR.js").then((m) => m.sessionsCommand),
|
|
286
286
|
"outcome-ledger": () => import("./outcome-ledger-XLWHWPVQ.js").then((m) => m.outcomeLedgerCommand),
|
|
287
287
|
validate: () => import("./validate-V2CW7J4B.js").then((m) => m.validateCommand),
|
|
288
|
-
"engine-info": () => import("./engine-info-
|
|
289
|
-
commands: () => import("./commands-
|
|
290
|
-
paths: () => import("./paths-
|
|
288
|
+
"engine-info": () => import("./engine-info-OTYCQUQB.js").then((m) => m.engineInfoCommand),
|
|
289
|
+
commands: () => import("./commands-WGCC5YOR.js").then((m) => m.commandsCommand),
|
|
290
|
+
paths: () => import("./paths-YV6O6JFK.js").then((m) => m.pathsCommand),
|
|
291
291
|
pi: () => import("./pi-DCMDOY65.js").then((m) => m.piCommand),
|
|
292
292
|
models: () => import("./models-SNB5Q3YU.js").then((m) => m.modelsCommand)
|
|
293
293
|
},
|
|
@@ -2,19 +2,19 @@ import {
|
|
|
2
2
|
nextStepAfterInstall,
|
|
3
3
|
performInstall,
|
|
4
4
|
printInstallEpilogue
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-CY4TDI4S.js";
|
|
6
6
|
import {
|
|
7
7
|
NON_INTERACTIVE_ROOT_ARGS
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-2JKKO7FF.js";
|
|
9
9
|
import {
|
|
10
10
|
SkippedSymlinkError,
|
|
11
11
|
logApplyStats
|
|
12
12
|
} from "./chunk-HS7LVVLO.js";
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-BM5RR7LT.js";
|
|
14
|
+
import "./chunk-KNEVGAOO.js";
|
|
15
|
+
import "./chunk-HO7VEYAD.js";
|
|
16
|
+
import "./chunk-DQD6KPWJ.js";
|
|
17
|
+
import "./chunk-2PKJOMTI.js";
|
|
18
18
|
import {
|
|
19
19
|
feedInstallsRegistry
|
|
20
20
|
} from "./chunk-NHJ4IAVN.js";
|
|
@@ -36,17 +36,17 @@ import {
|
|
|
36
36
|
confirmProjectRoot,
|
|
37
37
|
isNonInteractive,
|
|
38
38
|
syncPathCliToRuntime
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-N7L4ARYK.js";
|
|
40
40
|
import {
|
|
41
41
|
assessEnvironment
|
|
42
42
|
} from "./chunk-2TW7ENWC.js";
|
|
43
|
-
import "./chunk-
|
|
44
|
-
import "./chunk-
|
|
45
|
-
import "./chunk-
|
|
43
|
+
import "./chunk-GSZ2WZYY.js";
|
|
44
|
+
import "./chunk-37INM5QP.js";
|
|
45
|
+
import "./chunk-SXMGHRLU.js";
|
|
46
46
|
import "./chunk-CGXLR77R.js";
|
|
47
47
|
import "./chunk-PFEUZXVT.js";
|
|
48
|
-
import "./chunk-
|
|
49
|
-
import "./chunk-
|
|
48
|
+
import "./chunk-GSVUCEMH.js";
|
|
49
|
+
import "./chunk-EJJET3CA.js";
|
|
50
50
|
import "./chunk-IHVJTGYR.js";
|
|
51
51
|
import "./chunk-KMK4T4ZM.js";
|
|
52
52
|
import {
|
|
@@ -3,14 +3,14 @@ import {
|
|
|
3
3
|
nextStepAfterInstall,
|
|
4
4
|
performInstall,
|
|
5
5
|
printInstallEpilogue
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-CY4TDI4S.js";
|
|
7
|
+
import "./chunk-2JKKO7FF.js";
|
|
8
8
|
import "./chunk-HS7LVVLO.js";
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-BM5RR7LT.js";
|
|
10
|
+
import "./chunk-KNEVGAOO.js";
|
|
11
|
+
import "./chunk-HO7VEYAD.js";
|
|
12
|
+
import "./chunk-DQD6KPWJ.js";
|
|
13
|
+
import "./chunk-2PKJOMTI.js";
|
|
14
14
|
import "./chunk-NHJ4IAVN.js";
|
|
15
15
|
import "./chunk-WGLPZXNU.js";
|
|
16
16
|
import "./chunk-Q35TWISF.js";
|
|
@@ -20,15 +20,15 @@ import "./chunk-AXQMVQ6O.js";
|
|
|
20
20
|
import "./chunk-F6C3GFKV.js";
|
|
21
21
|
import "./chunk-2QYWMSI5.js";
|
|
22
22
|
import "./chunk-ZB43YMHW.js";
|
|
23
|
-
import "./chunk-
|
|
23
|
+
import "./chunk-N7L4ARYK.js";
|
|
24
24
|
import "./chunk-2TW7ENWC.js";
|
|
25
|
-
import "./chunk-
|
|
26
|
-
import "./chunk-
|
|
27
|
-
import "./chunk-
|
|
25
|
+
import "./chunk-GSZ2WZYY.js";
|
|
26
|
+
import "./chunk-37INM5QP.js";
|
|
27
|
+
import "./chunk-SXMGHRLU.js";
|
|
28
28
|
import "./chunk-CGXLR77R.js";
|
|
29
29
|
import "./chunk-PFEUZXVT.js";
|
|
30
|
-
import "./chunk-
|
|
31
|
-
import "./chunk-
|
|
30
|
+
import "./chunk-GSVUCEMH.js";
|
|
31
|
+
import "./chunk-EJJET3CA.js";
|
|
32
32
|
import "./chunk-IHVJTGYR.js";
|
|
33
33
|
import "./chunk-KMK4T4ZM.js";
|
|
34
34
|
import "./chunk-2G4K4ZI5.js";
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
findDashboardDataScript,
|
|
4
4
|
loadDashboardSnapshot,
|
|
5
5
|
runMcTuiLoop
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-DA5VLMNL.js";
|
|
7
7
|
import {
|
|
8
8
|
resolveDashboardSnapshotRoot
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-7Z2E2PWM.js";
|
|
10
10
|
import "./chunk-QTON2GQX.js";
|
|
11
11
|
import {
|
|
12
12
|
logger
|
|
@@ -41,7 +41,7 @@ function promoteMergePollDelays(capMs, initialMs = PROMOTE_MERGE_POLL_INITIAL_MS
|
|
|
41
41
|
}
|
|
42
42
|
return delays;
|
|
43
43
|
}
|
|
44
|
-
var PROMOTE_PR_VIEW_FIELDS = "state,mergedAt,mergeCommit,mergeStateStatus,url";
|
|
44
|
+
var PROMOTE_PR_VIEW_FIELDS = "state,mergedAt,mergeCommit,mergeStateStatus,url,headRefOid";
|
|
45
45
|
function parsePromotePrView(json) {
|
|
46
46
|
let data;
|
|
47
47
|
try {
|
|
@@ -59,9 +59,49 @@ function parsePromotePrView(json) {
|
|
|
59
59
|
mergedAt: str(o.mergedAt),
|
|
60
60
|
mergeCommit: str(commit?.oid),
|
|
61
61
|
mergeStateStatus: str(o.mergeStateStatus),
|
|
62
|
-
url: str(o.url)
|
|
62
|
+
url: str(o.url),
|
|
63
|
+
headRefOid: str(o.headRefOid)
|
|
63
64
|
};
|
|
64
65
|
}
|
|
66
|
+
var PROMOTE_ANCESTRY_BROKEN_EXIT_CODE = 4;
|
|
67
|
+
function promoteCompareArgs(mergeCommit, head, repo) {
|
|
68
|
+
return [
|
|
69
|
+
"api",
|
|
70
|
+
`repos/${repo ?? "{owner}/{repo}"}/compare/${mergeCommit}...${head}`,
|
|
71
|
+
"--jq",
|
|
72
|
+
"{status: .status, ahead_by: .ahead_by}"
|
|
73
|
+
];
|
|
74
|
+
}
|
|
75
|
+
function parsePromoteCompare(json) {
|
|
76
|
+
let data;
|
|
77
|
+
try {
|
|
78
|
+
data = JSON.parse(json);
|
|
79
|
+
} catch {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
if (!data || typeof data !== "object" || Array.isArray(data)) return null;
|
|
83
|
+
const o = data;
|
|
84
|
+
if (typeof o.status !== "string" || typeof o.ahead_by !== "number") return null;
|
|
85
|
+
if (!Number.isInteger(o.ahead_by) || o.ahead_by < 0) return null;
|
|
86
|
+
return { status: o.status, aheadBy: o.ahead_by };
|
|
87
|
+
}
|
|
88
|
+
async function checkPromoteAncestry(opts) {
|
|
89
|
+
const { mergeCommit, headRefOid: head } = opts.pr;
|
|
90
|
+
if (!mergeCommit) return { status: "unknown", note: "the PR has no merge commit" };
|
|
91
|
+
if (!head) return { status: "unknown", note: "the PR has no head SHA" };
|
|
92
|
+
let raw;
|
|
93
|
+
try {
|
|
94
|
+
raw = await opts.readCompare(mergeCommit, head);
|
|
95
|
+
} catch (err) {
|
|
96
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
97
|
+
const first = msg.split(/\r?\n/).find((l) => l.trim()) ?? "gh api compare failed";
|
|
98
|
+
return { status: "unknown", note: first.trim().slice(0, 200) };
|
|
99
|
+
}
|
|
100
|
+
const cmp = parsePromoteCompare(raw);
|
|
101
|
+
if (!cmp) return { status: "unknown", note: "unreadable compare response" };
|
|
102
|
+
if (cmp.aheadBy === 0) return { status: "ok", head, mergeCommit };
|
|
103
|
+
return { status: "squash_or_rebase", head, mergeCommit, aheadBy: cmp.aheadBy };
|
|
104
|
+
}
|
|
65
105
|
async function waitForPromoteMerge(opts) {
|
|
66
106
|
const sleep = opts.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
|
|
67
107
|
const delays = promoteMergePollDelays(opts.capMs, opts.initialDelayMs, opts.maxDelayMs);
|
|
@@ -105,7 +145,18 @@ function formatPromoteMergeWaitResult(pr, result) {
|
|
|
105
145
|
if (result.outcome === "merged") {
|
|
106
146
|
const sha = result.pr.mergeCommit ? ` as ${result.pr.mergeCommit}` : "";
|
|
107
147
|
const at = result.pr.mergedAt ? ` at ${result.pr.mergedAt}` : "";
|
|
108
|
-
|
|
148
|
+
const a = result.ancestry;
|
|
149
|
+
if (a?.status === "squash_or_rebase") {
|
|
150
|
+
return `${[
|
|
151
|
+
`PR #${pr} merged${sha}${at}, but not as a merge commit (exit ${PROMOTE_ANCESTRY_BROKEN_EXIT_CODE}).`,
|
|
152
|
+
`What broke: the PR head ${a.head} (the staging tip) is not a parent of main's merge commit ${a.mergeCommit}; it is ${a.aheadBy} commit(s) outside main's history (squash or rebase merge). origin/staging is no longer an ancestor of origin/main, so the staging fast-forward sync after the promote cannot run.`,
|
|
153
|
+
"Next: main carries the release, so the tag and the post-prod verification still run. Skip only the staging fast-forward sync, do not back-merge in this prod session, and report this repair; the promote is not Done until the repair PR is merged.",
|
|
154
|
+
"Repair (its own staging PR, operator-merged): branch from origin/staging, run `git merge --no-ff origin/main` (empty diff), open a PR to staging and merge it with a merge commit, never squash or rebase. Then staging is an ancestor of main again. Merge the next promote PR with a merge commit; `agent-kit promote rules --base main` warns while the base still allows squash or rebase."
|
|
155
|
+
].join("\n")}
|
|
156
|
+
`;
|
|
157
|
+
}
|
|
158
|
+
const skipped = a?.status === "unknown" ? ` Ancestry check skipped (${a.note}); the step 10 \`git merge-base --is-ancestor\` test stays the gate.` : "";
|
|
159
|
+
return `PR #${pr} merged${sha}${at}. Continue the promote routine.${skipped}
|
|
109
160
|
`;
|
|
110
161
|
}
|
|
111
162
|
if (result.outcome === "closed") {
|
|
@@ -201,22 +252,49 @@ function findUnmodeledRuleParameters(rules) {
|
|
|
201
252
|
}
|
|
202
253
|
return out;
|
|
203
254
|
}
|
|
255
|
+
var PROMOTE_RISKY_MERGE_METHODS = ["squash", "rebase"];
|
|
256
|
+
function findPromoteMergeMethodRisk(rules) {
|
|
257
|
+
let allowed = null;
|
|
258
|
+
const rulesetIds = [];
|
|
259
|
+
for (const rule of rules) {
|
|
260
|
+
if (rule.type !== "pull_request") continue;
|
|
261
|
+
const methods = rule.parameters?.allowed_merge_methods;
|
|
262
|
+
if (!Array.isArray(methods)) continue;
|
|
263
|
+
const list = methods.filter((m) => typeof m === "string");
|
|
264
|
+
allowed = allowed === null ? [...new Set(list)] : allowed.filter((m) => list.includes(m));
|
|
265
|
+
if (rule.rulesetId !== void 0 && !rulesetIds.includes(rule.rulesetId)) {
|
|
266
|
+
rulesetIds.push(rule.rulesetId);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
if (allowed === null) return null;
|
|
270
|
+
const risky = PROMOTE_RISKY_MERGE_METHODS.filter((m) => allowed.includes(m));
|
|
271
|
+
return { allowed, risky, rulesetIds };
|
|
272
|
+
}
|
|
273
|
+
function formatPromoteMergeMethodWarning(base, rules) {
|
|
274
|
+
const risk = findPromoteMergeMethodRisk(rules);
|
|
275
|
+
if (!risk || risk.risky.length === 0) return null;
|
|
276
|
+
const ruleset = risk.rulesetIds.length === 0 ? "" : ` (ruleset${risk.rulesetIds.length > 1 ? "s" : ""} ${risk.rulesetIds.join(", ")})`;
|
|
277
|
+
return `ruleset warning (${base}): pull_request.allowed_merge_methods = ${JSON.stringify(risk.allowed)}${ruleset} allows ${risk.risky.join(" and ")}; a squash or rebase promote drops the promote PR head from ${base}'s history, so the staging fast-forward sync after it cannot run. Merge the promote PR with a merge commit; restricting ${base} to merge commits is the operator's ruleset change.`;
|
|
278
|
+
}
|
|
204
279
|
function formatRulesetPreflight(base, result) {
|
|
205
280
|
if (!result.ok) {
|
|
206
281
|
return `ruleset preflight (${base}): skipped (${result.note}); advisory only, not a blocker.
|
|
207
282
|
`;
|
|
208
283
|
}
|
|
284
|
+
const warning = formatPromoteMergeMethodWarning(base, result.rules);
|
|
285
|
+
const tail = warning ? `${warning}
|
|
286
|
+
` : "";
|
|
209
287
|
const unmodeled = findUnmodeledRuleParameters(result.rules);
|
|
210
288
|
if (unmodeled.length === 0) {
|
|
211
289
|
return `ruleset preflight (${base}): every rule parameter is modeled by the kit.
|
|
212
|
-
`;
|
|
290
|
+
${tail}`;
|
|
213
291
|
}
|
|
214
292
|
return `${unmodeled.map((u) => {
|
|
215
293
|
const value = u.value === void 0 ? "" : ` = ${JSON.stringify(u.value)}`;
|
|
216
294
|
const ruleset = u.rulesetId === void 0 ? "" : ` (ruleset ${u.rulesetId})`;
|
|
217
295
|
return `ruleset advisory (${base}): ${u.name}${value}${ruleset} has no model in the kit; GitHub may refuse the merge while it reports CLEAN.`;
|
|
218
296
|
}).join("\n")}
|
|
219
|
-
`;
|
|
297
|
+
${tail}`;
|
|
220
298
|
}
|
|
221
299
|
function failureNote(err) {
|
|
222
300
|
const code = err?.code;
|
|
@@ -253,7 +331,9 @@ var defaultRunGh = async (args, opts) => {
|
|
|
253
331
|
return stdout;
|
|
254
332
|
};
|
|
255
333
|
function promoteWaitExitCode(result) {
|
|
256
|
-
if (result.outcome === "merged")
|
|
334
|
+
if (result.outcome === "merged") {
|
|
335
|
+
return result.ancestry?.status === "squash_or_rebase" ? PROMOTE_ANCESTRY_BROKEN_EXIT_CODE : 0;
|
|
336
|
+
}
|
|
257
337
|
if (result.outcome === "timeout") return 3;
|
|
258
338
|
return 1;
|
|
259
339
|
}
|
|
@@ -270,12 +350,18 @@ async function runPromoteWait(opts) {
|
|
|
270
350
|
sleep: opts.sleep,
|
|
271
351
|
readPr: async () => parsePromotePrView(await runGh(promotePrViewArgs(opts.pr, opts.repo), { cwd: opts.cwd }))
|
|
272
352
|
});
|
|
353
|
+
if (result.outcome === "merged") {
|
|
354
|
+
result.ancestry = await checkPromoteAncestry({
|
|
355
|
+
pr: result.pr,
|
|
356
|
+
readCompare: (mergeCommit, head) => runGh(promoteCompareArgs(mergeCommit, head, opts.repo), { cwd: opts.cwd })
|
|
357
|
+
});
|
|
358
|
+
}
|
|
273
359
|
return { result, capMs };
|
|
274
360
|
}
|
|
275
361
|
var waitCommand = defineCommand({
|
|
276
362
|
meta: {
|
|
277
363
|
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"
|
|
364
|
+
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; exit 4 when it was merged as a squash or rebase (staging no longer an ancestor of main)"
|
|
279
365
|
},
|
|
280
366
|
args: {
|
|
281
367
|
pr: { type: "string", description: "Promote PR number", required: true },
|
|
@@ -321,7 +407,7 @@ async function runPromoteRules(opts) {
|
|
|
321
407
|
var rulesCommand = defineCommand({
|
|
322
408
|
meta: {
|
|
323
409
|
name: "rules",
|
|
324
|
-
description: "Promote preflight: read the base branch rules (gh api .../rules/branches/<base>)
|
|
410
|
+
description: "Promote preflight: read the base branch rules (gh api .../rules/branches/<base>), print each rule parameter the kit does not model and warn when the base allows a squash or rebase merge; advisory, always exit 0"
|
|
325
411
|
},
|
|
326
412
|
args: {
|
|
327
413
|
base: { type: "string", description: "Promote base branch (default: main)", default: "main" },
|
|
@@ -342,7 +428,12 @@ var rulesCommand = defineCommand({
|
|
|
342
428
|
repo: typeof args.repo === "string" && args.repo ? args.repo : void 0
|
|
343
429
|
});
|
|
344
430
|
if (args.json) {
|
|
345
|
-
const payload = result.ok ? {
|
|
431
|
+
const payload = result.ok ? {
|
|
432
|
+
ok: true,
|
|
433
|
+
base,
|
|
434
|
+
unmodeled: findUnmodeledRuleParameters(result.rules),
|
|
435
|
+
mergeMethods: findPromoteMergeMethodRisk(result.rules)
|
|
436
|
+
} : { ok: false, base, note: result.note };
|
|
346
437
|
process.stdout.write(`${JSON.stringify(payload, null, 2)}
|
|
347
438
|
`);
|
|
348
439
|
} else {
|
|
@@ -2,17 +2,17 @@ import {
|
|
|
2
2
|
runPlanLoop,
|
|
3
3
|
shouldUseLiveTui,
|
|
4
4
|
withLiveTui
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-SZMIKKSA.js";
|
|
6
6
|
import "./chunk-WOXTL43E.js";
|
|
7
7
|
import {
|
|
8
8
|
REVIEW_PACK_SLASH,
|
|
9
9
|
runReviewJob
|
|
10
10
|
} from "./chunk-NW5SWKJV.js";
|
|
11
11
|
import "./chunk-ARJRICI2.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-DA5VLMNL.js";
|
|
13
13
|
import {
|
|
14
14
|
negatedFlag
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-7Z2E2PWM.js";
|
|
16
16
|
import {
|
|
17
17
|
landDispatchOutcome,
|
|
18
18
|
runDispatchDriver
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runPlanLoop
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-SZMIKKSA.js";
|
|
4
4
|
import "./chunk-WOXTL43E.js";
|
|
5
5
|
import "./chunk-NW5SWKJV.js";
|
|
6
6
|
import "./chunk-ARJRICI2.js";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-DA5VLMNL.js";
|
|
8
8
|
import {
|
|
9
9
|
negatedFlag
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-7Z2E2PWM.js";
|
|
11
11
|
import {
|
|
12
12
|
DRIVER_EVENTS_FORMATS
|
|
13
13
|
} from "./chunk-BIFTTL2O.js";
|