lurqrun 0.1.7 → 0.1.9
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/README.md +312 -148
- package/dist/{auditHandler-JCOJSUYW.js → auditHandler-G7PHKMZR.js} +12 -11
- package/dist/autopilotInit-JO2SH5K3.js +266 -0
- package/dist/bin/lurq.js +238 -83
- package/dist/{browserAuth-B6G27USY.js → browserAuth-PVYODBNR.js} +4 -3
- package/dist/{cache-DKI34SVS.js → cache-ND4VOUVY.js} +2 -2
- package/dist/check-A3FJE62G.js +2613 -0
- package/dist/{check-2FDGUOV7.js → check-PQSQ2MMA.js} +1 -1
- package/dist/checkUpgrade-Q4CV7GXG.js +24 -0
- package/dist/{chunk-BCANRN5B.js → chunk-2GAYNIHG.js} +8 -1
- package/dist/chunk-2LXYRDUN.js +92 -0
- package/dist/chunk-2XMD4H2I.js +243 -0
- package/dist/chunk-3D2MPGOQ.js +181 -0
- package/dist/chunk-53SG6XWA.js +141 -0
- package/dist/chunk-5ABNDB3I.js +37 -0
- package/dist/chunk-5ALIJFDA.js +114 -0
- package/dist/{chunk-LYMPYETA.js → chunk-6353IJJ5.js} +270 -6
- package/dist/{chunk-M6NYEXCW.js → chunk-64DPQSXV.js} +1 -1
- package/dist/chunk-64YOP5BQ.js +320 -0
- package/dist/{chunk-2VMOWSRY.js → chunk-6DM6UQFD.js} +19 -1
- package/dist/{chunk-NH5I4KHH.js → chunk-75LMEMJ3.js} +1 -5
- package/dist/{chunk-FW6BD2NO.js → chunk-ABH4BTK4.js} +458 -121
- package/dist/chunk-AHRDDKNO.js +90 -0
- package/dist/chunk-AQ6IVSFB.js +119 -0
- package/dist/chunk-BM3LF5T6.js +132 -0
- package/dist/chunk-D3K6IZVR.js +12845 -0
- package/dist/chunk-DONTW3NE.js +171 -0
- package/dist/{chunk-UDVNA7EA.js → chunk-ETY4FSOW.js} +161 -8
- package/dist/{chunk-VL2E5T2A.js → chunk-FHRT32JH.js} +6 -3
- package/dist/{chunk-DWAGCNEL.js → chunk-GM5Y555O.js} +36 -103
- package/dist/{chunk-6L3U7DZ5.js → chunk-GNNGXVCG.js} +1 -1
- package/dist/{chunk-PSX3GIAN.js → chunk-HWFX4BC4.js} +2 -1
- package/dist/{checkUpgrade-F2WESBPM.js → chunk-ILKYIVYV.js} +72 -10
- package/dist/{chunk-HWBBVLOT.js → chunk-J3NUERU7.js} +1 -1
- package/dist/chunk-J3U2CPSK.js +136 -0
- package/dist/{chunk-Y5GI7RL3.js → chunk-J6XQ7OPZ.js} +9 -1
- package/dist/{chunk-3N3Q3DSW.js → chunk-JGIJZJ3X.js} +8 -8
- package/dist/{chunk-DB2VF5UD.js → chunk-JJCQVOC6.js} +16 -11
- package/dist/{chunk-LBFGSSF2.js → chunk-KMV4Y6R3.js} +2 -1
- package/dist/{chunk-L6N4JFW2.js → chunk-KP5ZDDPE.js} +81 -4
- package/dist/{chunk-CW5HJ3LX.js → chunk-KT7PWDNV.js} +1 -1
- package/dist/{chunk-SJOVFF7B.js → chunk-KYKSZ3XZ.js} +3 -2
- package/dist/{chunk-GPTKSNR6.js → chunk-L3V7AVM6.js} +2 -1
- package/dist/{chunk-CUP36ND3.js → chunk-M2CYYBAH.js} +145 -36
- package/dist/{chunk-IQ4SDKKY.js → chunk-N2NYPTRU.js} +31 -228
- package/dist/chunk-N4TJO44E.js +603 -0
- package/dist/chunk-NEZNAPPN.js +41 -0
- package/dist/{chunk-WQ23REYT.js → chunk-NGMJQBOV.js} +1 -1
- package/dist/{chunk-BULZAX2U.js → chunk-POHTPT37.js} +55 -38
- package/dist/{chunk-EA3DP5HG.js → chunk-PZZU3FQY.js} +155 -25
- package/dist/{chunk-4F7ZESPO.js → chunk-Q7CMOU5C.js} +3 -5
- package/dist/{chunk-LRD4GBYE.js → chunk-QUIMQ7YL.js} +1 -1
- package/dist/chunk-RG3YLU6E.js +49 -0
- package/dist/{chunk-4ZYCIMY4.js → chunk-SFY5MPJE.js} +25 -4
- package/dist/{chunk-ST2X2GYN.js → chunk-SHZFOSXC.js} +109 -20
- package/dist/{chunk-CIDWNUAP.js → chunk-SOXFMMXC.js} +8 -2
- package/dist/{chunk-B43LCXBM.js → chunk-SWMWVK2R.js} +81 -16
- package/dist/{chunk-J5FZYN4A.js → chunk-TVOCVIM7.js} +1 -1
- package/dist/{chunk-U5AT3TD4.js → chunk-X4W64MHU.js} +1735 -1858
- package/dist/{chunk-BV32UNLL.js → chunk-XA2SLNBR.js} +2 -2
- package/dist/{chunk-AHBP533R.js → chunk-XBTYJQEK.js} +7 -5
- package/dist/chunk-XGOV6KV4.js +413 -0
- package/dist/{chunk-OQS4GUSI.js → chunk-XIFQIFSZ.js} +210 -661
- package/dist/{chunk-XBIDMHSK.js → chunk-XLXPVN3Y.js} +2 -34
- package/dist/{chunk-LO35HLQZ.js → chunk-ZJ5XHA77.js} +25 -4
- package/dist/{client-IRKAMDYZ.js → client-SJIWK4CK.js} +3 -3
- package/dist/{commands-FIL5ET6P.js → commands-6BBLN5N5.js} +145 -33
- package/dist/{compat-R3UTFQ5Q.js → compat-6B3CRT5F.js} +6 -6
- package/dist/constants-HX3RTD6Q.js +24 -0
- package/dist/{dashboardIssue-WYYMBFIB.js → dashboardIssue-KBKLQMGC.js} +105 -23
- package/dist/{diff-GZA2774U.js → diff-I4SNUHU3.js} +1 -1
- package/dist/domains-RKRPVP5A.js +14 -0
- package/dist/env-UN6KGZ7S.js +15 -0
- package/dist/envCheck-IL22OTSC.js +71 -0
- package/dist/{extract-NKGKLIVT.js → extract-6WG265BL.js} +14 -3
- package/dist/{fetch-QYTUJVG2.js → fetch-GHIP3VHN.js} +4 -4
- package/dist/{firstTouch-QQTJH4QX.js → firstTouch-M64T2MWF.js} +1 -1
- package/dist/fix-Z7ZY55HB.js +220 -0
- package/dist/{handlers-GEJAVZDK.js → handlers-GOXW2GWZ.js} +19 -17
- package/dist/hook-TWFLIDK3.js +412 -0
- package/dist/{http-ETPYMBGD.js → http-7VF2RE2D.js} +2097 -509
- package/dist/{ingestQueue-VKN4KBIF.js → ingestQueue-RSEPMORK.js} +14 -12
- package/dist/{install-EK3W2COX.js → install-55EPX34C.js} +6 -6
- package/dist/{installSkill-VQJWJVCL.js → installSkill-A7KKPDMS.js} +21 -3
- package/dist/manifest-ENMIC54B.js +13 -0
- package/dist/{mcp-3JHD5SUZ.js → mcp-CM6CDLHM.js} +60 -32
- package/dist/mcpConfig-FENV6NI7.js +80 -0
- package/dist/{mcpHandlers-QFN4MCFL.js → mcpHandlers-2UCLKMWN.js} +7 -7
- package/dist/{mcpScan-QZHWENIP.js → mcpScan-CKBQNK5H.js} +306 -442
- package/dist/{mcpScanWorkflow-JPYCBGC4.js → mcpScanWorkflow-NFUD3S7U.js} +29 -12
- package/dist/{mcpStack-BYJCZNIV.js → mcpStack-FLQ6XY2P.js} +1 -1
- package/dist/model-ASMZWLM7.js +214 -0
- package/dist/{packages-THVFMWFP.js → packages-2XRHNBJ7.js} +3 -5
- package/dist/{plan-V4OEI3J4.js → plan-XRZS6C7Z.js} +23 -21
- package/dist/{planView-JRXGCG2N.js → planView-ZAKRTGVS.js} +4 -1
- package/dist/{policy-3P6BGRDN.js → policy-EQT43P7S.js} +5 -5
- package/dist/probe-ZEZFNIQZ.js +610 -0
- package/dist/publicUpgrades-JZEOV24A.js +42 -0
- package/dist/{references-6N7VEPHT.js → references-I6Y4BSRR.js} +3 -1
- package/dist/{release-4U4ABNSJ.js → release-EUOM5I3R.js} +5 -5
- package/dist/{remote-YGCXYI4V.js → remote-I5O43WAY.js} +13 -3
- package/dist/rename-OS6JYBZQ.js +204 -0
- package/dist/{reportRuns-CKQQYLY4.js → reportRuns-O4X7ZFTX.js} +15 -2
- package/dist/safeFetch-COERXGFN.js +19 -0
- package/dist/{sandbox-MEZLAODF.js → sandbox-46TZNYZT.js} +4 -4
- package/dist/sarif-WLVJFJ7U.js +125 -0
- package/dist/server-LROMHS62.js +59 -0
- package/dist/{surface-YL6O67W3.js → surface-CZMHQLV3.js} +5 -3
- package/dist/{surface-V62GE554.js → surface-OH4TZR32.js} +18 -16
- package/dist/{surfaceHandlers-X2IZKA3E.js → surfaceHandlers-BDYRZMAC.js} +5 -5
- package/dist/{typecheck-X7U5ELMR.js → typecheck-NGOKNAJY.js} +23 -9
- package/dist/{uninstall-P7RGBX6G.js → uninstall-4E5YUDQO.js} +30 -4
- package/dist/{upgrade-NQ5IWFZB.js → upgrade-S72W7JVC.js} +86 -32
- package/dist/{upgradePlan-A4LRKLEG.js → upgradePlan-F3OUNL3E.js} +46 -11
- package/dist/upkeepHandler-7Q56A4UA.js +13 -0
- package/dist/{userConfig-Z3GQE776.js → userConfig-ICASHI47.js} +1 -1
- package/dist/{watch-DGFMWUDL.js → watch-LZPOKWCL.js} +24 -34
- package/package.json +3 -2
- package/templates/skill-instructions.md +22 -3
- package/dist/chunk-6AAEVQ7I.js +0 -6336
- package/dist/chunk-I2JUKN6Z.js +0 -24
- package/dist/server-KFUD5X57.js +0 -55
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import { createRequire as __lurqCreateRequire } from 'node:module'; const require = __lurqCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
WORKFLOW_PATH,
|
|
4
|
+
detectInstallCommand,
|
|
5
|
+
renderWorkflow
|
|
6
|
+
} from "./chunk-SWMWVK2R.js";
|
|
7
|
+
import {
|
|
8
|
+
bold,
|
|
9
|
+
dim,
|
|
10
|
+
green,
|
|
11
|
+
red,
|
|
12
|
+
yellow
|
|
13
|
+
} from "./chunk-4KCPOMG6.js";
|
|
14
|
+
import {
|
|
15
|
+
logger
|
|
16
|
+
} from "./chunk-MYGSLK44.js";
|
|
17
|
+
import {
|
|
18
|
+
resolveApiKey
|
|
19
|
+
} from "./chunk-J6XQ7OPZ.js";
|
|
20
|
+
import "./chunk-L3V7AVM6.js";
|
|
21
|
+
import {
|
|
22
|
+
init_esm_shims
|
|
23
|
+
} from "./chunk-I3M2KJXB.js";
|
|
24
|
+
|
|
25
|
+
// src/cli/autopilotInit.ts
|
|
26
|
+
init_esm_shims();
|
|
27
|
+
import { spawnSync } from "child_process";
|
|
28
|
+
var LOCKFILES = ["package-lock.json", "yarn.lock", "pnpm-lock.yaml", "bun.lockb", "bun.lock"];
|
|
29
|
+
var SETUP_BRANCH = "lurq/autopilot-setup";
|
|
30
|
+
var COMMIT_MESSAGE = "ci: lurq upgrade autopilot";
|
|
31
|
+
function parseRepoFromRemote(url) {
|
|
32
|
+
const trimmed = url.trim().replace(/\.git$/, "");
|
|
33
|
+
if (!trimmed) return null;
|
|
34
|
+
const match = (
|
|
35
|
+
// git@github.com:owner/name | ssh://git@github.com/owner/name
|
|
36
|
+
trimmed.match(/^(?:ssh:\/\/)?git@[^:/]+[:/]([^/]+)\/([^/]+)$/) ?? // https://github.com/owner/name
|
|
37
|
+
trimmed.match(/^https?:\/\/[^/]+\/([^/]+)\/([^/]+)$/)
|
|
38
|
+
);
|
|
39
|
+
if (!match) return null;
|
|
40
|
+
const [, owner, name] = match;
|
|
41
|
+
return owner && name ? `${owner}/${name}` : null;
|
|
42
|
+
}
|
|
43
|
+
function needsAgentCredential(mode) {
|
|
44
|
+
return mode === "pr";
|
|
45
|
+
}
|
|
46
|
+
function missingWorkflowScope(authStatus) {
|
|
47
|
+
const line = authStatus.split("\n").find((l) => /token scopes:/i.test(l));
|
|
48
|
+
return line !== void 0 && !/['"]workflow['"]/.test(line);
|
|
49
|
+
}
|
|
50
|
+
function parseMode(raw) {
|
|
51
|
+
if (!raw) return "fix";
|
|
52
|
+
if (raw === "comment" || raw === "fix" || raw === "pr") return raw;
|
|
53
|
+
throw new Error(`Unknown mode "${raw}". Use comment, fix, or pr.`);
|
|
54
|
+
}
|
|
55
|
+
function run(cmd, args, input, cwd) {
|
|
56
|
+
return spawnSync(cmd, args, { cwd, input, encoding: "utf8" });
|
|
57
|
+
}
|
|
58
|
+
function have(cmd) {
|
|
59
|
+
return run(cmd, ["--version"]).status === 0;
|
|
60
|
+
}
|
|
61
|
+
function errorText(res) {
|
|
62
|
+
return (res.stderr || res.stdout || "").trim().split("\n")[0] ?? "unknown error";
|
|
63
|
+
}
|
|
64
|
+
function ghApi(path, method = "GET", body) {
|
|
65
|
+
const args = ["api", "-X", method, path];
|
|
66
|
+
if (body !== void 0) args.push("--input", "-");
|
|
67
|
+
const res = run("gh", args, body === void 0 ? void 0 : JSON.stringify(body));
|
|
68
|
+
if (res.status !== 0) throw new Error(errorText(res));
|
|
69
|
+
return res.stdout.trim() ? JSON.parse(res.stdout) : null;
|
|
70
|
+
}
|
|
71
|
+
function setSecret(repo, name, value) {
|
|
72
|
+
const res = run("gh", ["secret", "set", name, "--repo", repo], value);
|
|
73
|
+
return res.status === 0 ? null : `could not set ${name}: ${errorText(res)}`;
|
|
74
|
+
}
|
|
75
|
+
function mintClaudeToken() {
|
|
76
|
+
const res = spawnSync("claude", ["setup-token"], {
|
|
77
|
+
stdio: ["inherit", "pipe", "inherit"],
|
|
78
|
+
encoding: "utf8"
|
|
79
|
+
});
|
|
80
|
+
if (res.status !== 0) return null;
|
|
81
|
+
const lines = (res.stdout ?? "").split("\n").map((l) => l.trim()).filter(Boolean);
|
|
82
|
+
const token = lines[lines.length - 1];
|
|
83
|
+
if (!token || token.includes(" ") || token.length < 20) return null;
|
|
84
|
+
return token;
|
|
85
|
+
}
|
|
86
|
+
function putWorkflow(repo, branch, content, sha) {
|
|
87
|
+
ghApi(`repos/${repo}/contents/${WORKFLOW_PATH}`, "PUT", {
|
|
88
|
+
message: COMMIT_MESSAGE,
|
|
89
|
+
content: Buffer.from(content).toString("base64"),
|
|
90
|
+
branch,
|
|
91
|
+
...sha ? { sha } : {}
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
function openSetupPr(repo, base, content) {
|
|
95
|
+
const head = ghApi(`repos/${repo}/git/ref/heads/${base}`).object.sha;
|
|
96
|
+
try {
|
|
97
|
+
ghApi(`repos/${repo}/git/refs`, "POST", { ref: `refs/heads/${SETUP_BRANCH}`, sha: head });
|
|
98
|
+
} catch {
|
|
99
|
+
ghApi(`repos/${repo}/git/refs/heads/${SETUP_BRANCH}`, "PATCH", { sha: head, force: true });
|
|
100
|
+
}
|
|
101
|
+
putWorkflow(repo, SETUP_BRANCH, content, existingSha(repo, SETUP_BRANCH));
|
|
102
|
+
const res = run("gh", [
|
|
103
|
+
"pr",
|
|
104
|
+
"create",
|
|
105
|
+
"--repo",
|
|
106
|
+
repo,
|
|
107
|
+
"--base",
|
|
108
|
+
base,
|
|
109
|
+
"--head",
|
|
110
|
+
SETUP_BRANCH,
|
|
111
|
+
"--title",
|
|
112
|
+
COMMIT_MESSAGE,
|
|
113
|
+
"--body",
|
|
114
|
+
"Adds the lurq upgrade autopilot. Merge to turn it on; delete the file to turn it off. https://lurq.run/docs/autopilot"
|
|
115
|
+
]);
|
|
116
|
+
if (res.status !== 0) throw new Error(errorText(res));
|
|
117
|
+
return res.stdout.trim();
|
|
118
|
+
}
|
|
119
|
+
function existingSha(repo, branch) {
|
|
120
|
+
try {
|
|
121
|
+
return ghApi(`repos/${repo}/contents/${WORKFLOW_PATH}?ref=${branch}`).sha;
|
|
122
|
+
} catch {
|
|
123
|
+
return void 0;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
function initRepo(repo, mode, secrets, opts) {
|
|
127
|
+
try {
|
|
128
|
+
for (const [name, value] of Object.entries(secrets)) {
|
|
129
|
+
const err = setSecret(repo, name, value);
|
|
130
|
+
if (err) return { repo, outcome: "failed", detail: err };
|
|
131
|
+
}
|
|
132
|
+
const base = ghApi(`repos/${repo}`).default_branch;
|
|
133
|
+
const sha = existingSha(repo, base);
|
|
134
|
+
if (sha && !opts.force) {
|
|
135
|
+
return {
|
|
136
|
+
repo,
|
|
137
|
+
outcome: "exists",
|
|
138
|
+
detail: "workflow already committed (--force replaces it)"
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
const root = ghApi(`repos/${repo}/contents/?ref=${base}`).map(
|
|
142
|
+
(e) => e.name
|
|
143
|
+
);
|
|
144
|
+
const content = renderWorkflow({
|
|
145
|
+
mode,
|
|
146
|
+
installCommand: detectInstallCommand(LOCKFILES.filter((f) => root.includes(f)))
|
|
147
|
+
});
|
|
148
|
+
if (!opts.pr) {
|
|
149
|
+
try {
|
|
150
|
+
putWorkflow(repo, base, content, sha);
|
|
151
|
+
const started = run("gh", [
|
|
152
|
+
"workflow",
|
|
153
|
+
"run",
|
|
154
|
+
WORKFLOW_PATH.split("/").pop(),
|
|
155
|
+
"--repo",
|
|
156
|
+
repo
|
|
157
|
+
]);
|
|
158
|
+
return {
|
|
159
|
+
repo,
|
|
160
|
+
outcome: "committed",
|
|
161
|
+
detail: started.status === 0 ? "first run started" : "first run starts on schedule"
|
|
162
|
+
};
|
|
163
|
+
} catch {
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return { repo, outcome: "pull-request", detail: openSetupPr(repo, base, content) };
|
|
167
|
+
} catch (err) {
|
|
168
|
+
return { repo, outcome: "failed", detail: err instanceof Error ? err.message : String(err) };
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
async function runAutopilotInit(opts) {
|
|
172
|
+
const mode = parseMode(opts.mode);
|
|
173
|
+
let repos = (opts.repo ?? []).map((r) => r.trim()).filter(Boolean);
|
|
174
|
+
if (repos.length === 0) {
|
|
175
|
+
const remote = run("git", ["remote", "get-url", "origin"], void 0, opts.cwd);
|
|
176
|
+
const here = remote.status === 0 ? parseRepoFromRemote(remote.stdout) : null;
|
|
177
|
+
if (here) repos = [here];
|
|
178
|
+
}
|
|
179
|
+
if (repos.length === 0) {
|
|
180
|
+
logger.error("Could not work out which repository this is.");
|
|
181
|
+
logger.error("Pass one or more: lurq autopilot init --repo owner/a owner/b");
|
|
182
|
+
process.exitCode = 1;
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
const apiKey = resolveApiKey(opts.apiKey);
|
|
186
|
+
if (!apiKey) {
|
|
187
|
+
logger.error(
|
|
188
|
+
"No lurq API key on this machine. Run `npx lurqrun setup` first, then this again."
|
|
189
|
+
);
|
|
190
|
+
process.exitCode = 1;
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
if (!have("gh")) {
|
|
194
|
+
logger.error("The GitHub CLI (`gh`) is not installed. https://cli.github.com");
|
|
195
|
+
process.exitCode = 1;
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
const auth = run("gh", ["auth", "status"]);
|
|
199
|
+
if (auth.status !== 0) {
|
|
200
|
+
logger.error("`gh` is not signed in. Run `gh auth login`, then this again.");
|
|
201
|
+
process.exitCode = 1;
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
if (missingWorkflowScope(`${auth.stdout}
|
|
205
|
+
${auth.stderr}`)) {
|
|
206
|
+
logger.error(
|
|
207
|
+
"GitHub only lets a token write workflow files with the `workflow` scope. Add it:"
|
|
208
|
+
);
|
|
209
|
+
logger.error(" gh auth refresh -s workflow");
|
|
210
|
+
process.exitCode = 1;
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
const secrets = { LURQ_API_KEY: apiKey };
|
|
214
|
+
const notes = [];
|
|
215
|
+
if (needsAgentCredential(mode) && opts.credential !== false) {
|
|
216
|
+
const token = have("claude") ? (logger.info(dim("Minting a Claude token \u2014 sign in when prompted.")), mintClaudeToken()) : null;
|
|
217
|
+
if (token) {
|
|
218
|
+
secrets.CLAUDE_CODE_OAUTH_TOKEN = token;
|
|
219
|
+
notes.push(
|
|
220
|
+
`${yellow("The Claude token expires one year from today, with no warning.")} An ANTHROPIC_API_KEY does not:
|
|
221
|
+
gh secret set ANTHROPIC_API_KEY --repo <owner/name>`
|
|
222
|
+
);
|
|
223
|
+
} else {
|
|
224
|
+
notes.push(
|
|
225
|
+
"pr mode needs an Anthropic credential and none was set. Per repo:\n gh secret set ANTHROPIC_API_KEY --repo <owner/name>"
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
if (!opts.json)
|
|
230
|
+
logger.info(
|
|
231
|
+
`${bold("mode")} ${mode} \xB7 ${repos.length} ${repos.length === 1 ? "repository" : "repositories"}
|
|
232
|
+
`
|
|
233
|
+
);
|
|
234
|
+
const results = [];
|
|
235
|
+
for (const repo of repos) {
|
|
236
|
+
const result = initRepo(repo, mode, secrets, opts);
|
|
237
|
+
results.push(result);
|
|
238
|
+
if (!opts.json)
|
|
239
|
+
logger.info(`${resultMark(result)} ${repo}${result.detail ? dim(` ${result.detail}`) : ""}`);
|
|
240
|
+
}
|
|
241
|
+
if (results.some((r) => r.outcome === "failed")) process.exitCode = 1;
|
|
242
|
+
if (opts.json) {
|
|
243
|
+
logger.info(JSON.stringify({ mode, results }, null, 2));
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
if (results.some((r) => r.outcome === "pull-request")) {
|
|
247
|
+
notes.push("Merge the pull requests above to turn those repositories on.");
|
|
248
|
+
}
|
|
249
|
+
if (results.some((r) => r.outcome === "committed") && !opts.repo?.length) {
|
|
250
|
+
notes.push("Committed on GitHub, not locally: `git pull` to see it in this checkout.");
|
|
251
|
+
}
|
|
252
|
+
for (const note of notes) logger.info(`
|
|
253
|
+
\xB7 ${note}`);
|
|
254
|
+
}
|
|
255
|
+
function resultMark(r) {
|
|
256
|
+
if (r.outcome === "failed") return red("\u2717");
|
|
257
|
+
if (r.outcome === "pull-request") return yellow("\u2197");
|
|
258
|
+
if (r.outcome === "exists") return dim("\xB7");
|
|
259
|
+
return green("\u2713");
|
|
260
|
+
}
|
|
261
|
+
export {
|
|
262
|
+
missingWorkflowScope,
|
|
263
|
+
needsAgentCredential,
|
|
264
|
+
parseRepoFromRemote,
|
|
265
|
+
runAutopilotInit
|
|
266
|
+
};
|