@outerlayer/cli 0.33.0 → 0.34.0-next.20261023233807
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 +4 -1
- package/dist/{agent-setup-YHEW3WXB.js → agent-setup-FBAT5LGX.js} +10 -10
- package/dist/{artifact-link-cmd-7FYKWA7J.js → artifact-link-cmd-LWPY3V4N.js} +2 -2
- package/dist/{build-SEAQVLD5.js → build-LSU25G3M.js} +2 -2
- package/dist/{build-disk-ECTLWTPC.js → build-disk-ZDGSJLPA.js} +5 -5
- package/dist/build-info.json +1 -1
- package/dist/{builder-LUPHKUFM.js → builder-QKH2HBAO.js} +4 -4
- package/dist/{check-XPMN4GHD.js → check-4MYU7S73.js} +32 -32
- package/dist/{chunk-QKNFU5GA.js → chunk-2GWMYY4M.js} +5 -5
- package/dist/{chunk-HLZMAJJD.js → chunk-2HCXEIJD.js} +2 -2
- package/dist/{chunk-VWQCYOBS.js → chunk-2UF4H4PG.js} +2 -2
- package/dist/{chunk-Z57X4KNC.js → chunk-3CUGPUCP.js} +2 -2
- package/dist/{chunk-EXZACZ2P.js → chunk-3FMARI3L.js} +1 -1
- package/dist/{chunk-6SPD266O.js → chunk-4H2DWORO.js} +3 -3
- package/dist/{chunk-EHOFFTVX.js → chunk-4V5V2HAQ.js} +2 -2
- package/dist/{chunk-VMIOUVJF.js → chunk-5CHRWX3K.js} +5 -5
- package/dist/{chunk-L6MDOEHN.js → chunk-74Q24R3B.js} +7 -7
- package/dist/{chunk-BLHUFOOB.js → chunk-7JETLQED.js} +12 -12
- package/dist/{chunk-AKZRGFGT.js → chunk-B44BFR2Q.js} +3 -3
- package/dist/{chunk-V673DFOL.js → chunk-B5MSDF5B.js} +4 -4
- package/dist/{chunk-X4JEBMYN.js → chunk-BBGVXGSO.js} +1 -1
- package/dist/{chunk-NIY2UBT6.js → chunk-BO42KT3D.js} +1 -1
- package/dist/{chunk-6CXNWKWD.js → chunk-CQRPR4WZ.js} +143 -22
- package/dist/{chunk-F2D5BSXS.js → chunk-EOTMDIYC.js} +1 -1
- package/dist/{chunk-NE63JADS.js → chunk-ES4ULBAL.js} +2 -2
- package/dist/{emit-demo-cmd-IQRS7BP2.js → chunk-GODAKHDD.js} +6 -35
- package/dist/{chunk-RZOO7X4G.js → chunk-HG6INMG3.js} +3 -3
- package/dist/{chunk-JEVKOZBB.js → chunk-HMCBX3PL.js} +1 -1
- package/dist/{chunk-7UPMYRPS.js → chunk-HUUYTDFV.js} +4 -4
- package/dist/{chunk-VSLJ6PPG.js → chunk-J32AF6D2.js} +5 -5
- package/dist/{chunk-D3EDZPJR.js → chunk-KLGYSJ3A.js} +5 -5
- package/dist/{chunk-4YLL2E7Y.js → chunk-KSZXJE3R.js} +12 -12
- package/dist/{chunk-YY3OQJ4X.js → chunk-LFBMXXE6.js} +14 -14
- package/dist/{chunk-MPC2UAW2.js → chunk-MECW77XP.js} +1 -1
- package/dist/{work-proofs-cmd-XBESDEPM.js → chunk-NYHQF6BT.js} +30 -30
- package/dist/{chunk-DKFUXYGD.js → chunk-OLCIPTST.js} +4 -4
- package/dist/{chunk-S5CNYXUA.js → chunk-OVRNGOD2.js} +4 -4
- package/dist/{chunk-UK4RGH46.js → chunk-SHIGGHZO.js} +2 -2
- package/dist/{chunk-EJL6CWSP.js → chunk-SVLFZLTE.js} +6 -6
- package/dist/{chunk-5M2J7B5N.js → chunk-TCGVYHII.js} +2 -2
- package/dist/{chunk-LYGI3T66.js → chunk-TIRHZC2M.js} +2 -2
- package/dist/{chunk-OGMXVPCS.js → chunk-TYBK2UCW.js} +2 -2
- package/dist/{chunk-FT7MUQGO.js → chunk-UF2FU3CM.js} +2 -2
- package/dist/{work-comment-cmd-QEZHRXC5.js → chunk-VY2FE5VT.js} +4 -24
- package/dist/{chunk-GO2DUPQS.js → chunk-WEUCD3J3.js} +3 -3
- package/dist/{chunk-KUE4V2SK.js → chunk-XFAJQZN2.js} +2 -2
- package/dist/{chunk-2LFWCIIE.js → chunk-XXTXM47K.js} +15 -15
- package/dist/{chunk-7V5GUEDU.js → chunk-Y5YCX6AL.js} +1 -1
- package/dist/chunk-YNJUN6BB.js +148 -0
- package/dist/{chunk-ZF24JN7R.js → chunk-YPCDDQFU.js} +1 -1
- package/dist/{chunk-7IFYI7XF.js → chunk-YQ5BEACL.js} +3 -3
- package/dist/{chunk-44V5SD4G.js → chunk-ZGB4ZJ5E.js} +1 -1
- package/dist/{chunk-YXHKCHWG.js → chunk-ZVLSYWDF.js} +1 -1
- package/dist/{claude-launcher-YRPW4SWA.js → claude-launcher-YXRS4EZE.js} +5 -5
- package/dist/{cli-65ZQJ622.js → cli-QQBC67PY.js} +132 -108
- package/dist/{command-QENZQGZL.js → command-27SJOFEM.js} +21 -21
- package/dist/{config-MVA7YTFW.js → config-7M4PJUZ5.js} +6 -6
- package/dist/{connect-cmd-KWXV2CGC.js → connect-cmd-XPSJT6JW.js} +8 -8
- package/dist/{container-start-RVH5743X.js → container-start-FDUQKTOF.js} +27 -27
- package/dist/{context-cleanup-A2FGVVPH.js → context-cleanup-YGWYIFFV.js} +3 -3
- package/dist/{context-show-cmd-6F4UF4ND.js → context-show-cmd-4HLZ6DEB.js} +9 -9
- package/dist/{control-plane-launch-7SOH6IMA.js → control-plane-launch-AXBWT5CC.js} +6 -6
- package/dist/{dist-IG2DKUJJ.js → dist-ELNMCU72.js} +2 -2
- package/dist/{docker-YKYQJHL2.js → docker-7XRXEGMX.js} +4 -4
- package/dist/{doctor-MFLM7DMY.js → doctor-Y3F7KETW.js} +22 -22
- package/dist/{emit-artifact-cmd-6QTTWBVN.js → emit-artifact-cmd-SX6A3N46.js} +13 -13
- package/dist/{emit-cmd-3FG7FEGO.js → emit-cmd-A4CB7BEC.js} +6 -6
- package/dist/{emit-criteria-cmd-22VVCL2W.js → emit-criteria-cmd-4LXKENTI.js} +10 -10
- package/dist/emit-demo-cmd-ECMS73O6.js +48 -0
- package/dist/{emit-finding-cmd-TXDPJFVT.js → emit-finding-cmd-K73WX2UP.js} +10 -10
- package/dist/{emit-result-cmd-QHJDUC7J.js → emit-result-cmd-SUQASZMD.js} +12 -12
- package/dist/{emit-step-cmd-TQCOLXAA.js → emit-step-cmd-5NQ6W4F3.js} +10 -10
- package/dist/{findings-cmd-EURKADAY.js → findings-cmd-2BOST4CX.js} +10 -10
- package/dist/{fleet-readiness-GXDSFTLP.js → fleet-readiness-VAKMSSWI.js} +8 -8
- package/dist/{governing-source-INEXO2CK.js → governing-source-NSQ5TIMO.js} +13 -13
- package/dist/{hook-fast-3IYSWDL4.js → hook-fast-WENTLDMA.js} +1 -1
- package/dist/index.js +4 -4
- package/dist/{init-WIHSXL74.js → init-E2N3A4MB.js} +21 -21
- package/dist/{init-VWJIINBC.js → init-SFZ5VUZ6.js} +21 -21
- package/dist/{init-cmd-3VWJUWXA.js → init-cmd-BNOWYMNA.js} +18 -18
- package/dist/{init-update-LFKSC6Y4.js → init-update-6QK5URLQ.js} +17 -17
- package/dist/{install-47Z7VNWP.js → install-E6DEU5NV.js} +7 -7
- package/dist/{layout-44S4OYLK.js → layout-NAPG4SX2.js} +4 -4
- package/dist/{login-browser-BJZYKWHF.js → login-browser-DQ6YRXUB.js} +2 -2
- package/dist/{loop-5QV4VZOF.js → loop-6RHTIIIE.js} +32 -32
- package/dist/{machine-XTSUAX3K.js → machine-OYI4ZWQS.js} +21 -21
- package/dist/{machine-skills-GOKW3U5N.js → machine-skills-2TT3RXMJ.js} +4 -4
- package/dist/{runner-env-ILP6BAC2.js → runner-env-EKBC5EYE.js} +8 -8
- package/dist/{runner-identity-MF3AYBR6.js → runner-identity-KN4CW5VQ.js} +4 -4
- package/dist/{runner-key-N4IIFMUX.js → runner-key-W6KG4QD7.js} +21 -21
- package/dist/{session-sender-2DYAJIMM.js → session-sender-Q7I6NUJU.js} +13 -13
- package/dist/{spec-cmd-7W4ERDL7.js → spec-cmd-3RWLOGZW.js} +11 -11
- package/dist/{starter-pack-FWTXE6XB.js → starter-pack-5D4BANFU.js} +5 -5
- package/dist/{status-VBUCLDN5.js → status-G26SS4VW.js} +26 -26
- package/dist/{sync-cmd-NGX2PGIW.js → sync-cmd-2W5F23IM.js} +12 -12
- package/dist/{watch-ZIWZVU3Z.js → watch-QW4LMB23.js} +12 -12
- package/dist/{work-claim-cmd-G3DC5LJK.js → work-claim-cmd-D2VABY7U.js} +16 -16
- package/dist/{work-cmd-J2LJ3V4A.js → work-cmd-FVDCWSPE.js} +10 -10
- package/dist/work-comment-cmd-RW7FZBBH.js +33 -0
- package/dist/{work-demo-cmd-A7XE4NKA.js → work-demo-cmd-M5NL3IPF.js} +10 -10
- package/dist/{work-logs-cmd-UA5PAXRP.js → work-logs-cmd-KUG5JARJ.js} +10 -10
- package/dist/{work-open-pr-cmd-ZYKNAJJM.js → work-open-pr-cmd-HSVGGLFC.js} +11 -11
- package/dist/{work-pr-cmd-DH43AH3V.js → work-pr-cmd-KBHTEAIT.js} +10 -10
- package/dist/work-proofs-cmd-A6QNVO6B.js +34 -0
- package/dist/work-proofs-init-QB2UL3BC.js +35 -0
- package/dist/work-proofs-record-APK4VWRB.js +402 -0
- package/dist/{work-stop-cmd-ZDIW3MVX.js → work-stop-cmd-HSGFTRIX.js} +10 -10
- package/package.json +1 -1
- package/skill-pack/maintained/outerlayer-amend/SKILL.md +5 -5
- package/skill-pack/maintained/outerlayer-build/SKILL.md +4 -3
- package/skill-pack/maintained/outerlayer-build/references/agent-briefs.md +30 -17
- package/skill-pack/maintained/outerlayer-build/references/evidence.md +17 -15
- package/skill-pack/maintained/outerlayer-amend/scripts/rerecord-demo.mjs +0 -187
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// Records an item's demo again at the pull request's new head, after an
|
|
3
|
-
// amend pushed. It reads the item's newest demo record, and records again
|
|
4
|
-
// only a demo that was recorded at an earlier commit and names the test that
|
|
5
|
-
// recorded it. Needs only Node.
|
|
6
|
-
//
|
|
7
|
-
// node rerecord-demo.mjs --item <number> --pr <number> [--repository <owner/name>] [--project <playwright project>]
|
|
8
|
-
//
|
|
9
|
-
// Run it after the amend's last push, with the app running as the
|
|
10
|
-
// repository's instructions say. It prints one line for the amend's report:
|
|
11
|
-
// recorded again, current, or why not. It posts one comment on the item's
|
|
12
|
-
// general thread when the demo is out of date and cannot be recorded again,
|
|
13
|
-
// when a chapter failed its checks, or when the recording failed. It posts
|
|
14
|
-
// nothing when the item has no demo, or the demo is current.
|
|
15
|
-
import { spawnSync } from "node:child_process";
|
|
16
|
-
import { existsSync, mkdtempSync, readdirSync, rmSync } from "node:fs";
|
|
17
|
-
import { tmpdir } from "node:os";
|
|
18
|
-
import { basename, dirname, isAbsolute, join, relative } from "node:path";
|
|
19
|
-
import { pathToFileURL } from "node:url";
|
|
20
|
-
|
|
21
|
-
const USAGE = "usage: rerecord-demo.mjs --item <number> --pr <number> [--repository <owner/name>] [--project <playwright project>]";
|
|
22
|
-
const CONFIG_NAMES = ["ts", "js", "mjs", "cjs", "mts", "cts"].map((extension) => `playwright.config.${extension}`);
|
|
23
|
-
|
|
24
|
-
/** The `spawnSync` that runs a program in `cwd`; tests pass a stand-in. */
|
|
25
|
-
function runProgram(command, args, options) {
|
|
26
|
-
return spawnSync(command, args, { encoding: "utf8", maxBuffer: 256 * 1024 * 1024, ...options });
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/** `owner/name` of a repository in any spelling the factory stores, lower-case. */
|
|
30
|
-
function repositoryName(repository) {
|
|
31
|
-
return repository
|
|
32
|
-
.replace(/\.git$/, "")
|
|
33
|
-
.split("/")
|
|
34
|
-
.filter((part) => part !== "")
|
|
35
|
-
.slice(-2)
|
|
36
|
-
.join("/")
|
|
37
|
-
.toLowerCase();
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/** A test path inside the repository, or `null` when the path is absolute or leaves it. */
|
|
41
|
-
function insidePath(test) {
|
|
42
|
-
if (typeof test !== "string" || test === "" || isAbsolute(test) || test.split("/").includes("..")) return null;
|
|
43
|
-
return test;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/** The nearest folder from the test's own up to the root that holds a Playwright config, else the root. */
|
|
47
|
-
function configFolder(root, testFile) {
|
|
48
|
-
let folder = dirname(testFile);
|
|
49
|
-
while (folder.startsWith(root)) {
|
|
50
|
-
if (CONFIG_NAMES.some((name) => existsSync(join(folder, name)))) return folder;
|
|
51
|
-
if (folder === root) break;
|
|
52
|
-
folder = dirname(folder);
|
|
53
|
-
}
|
|
54
|
-
return root;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/** Every `demo/manifest.json` under `folder`. */
|
|
58
|
-
function findManifests(folder) {
|
|
59
|
-
const found = [];
|
|
60
|
-
for (const entry of readdirSync(folder, { withFileTypes: true })) {
|
|
61
|
-
const path = join(folder, entry.name);
|
|
62
|
-
if (entry.isDirectory()) found.push(...findManifests(path));
|
|
63
|
-
else if (entry.name === "manifest.json" && basename(folder) === "demo") found.push(path);
|
|
64
|
-
}
|
|
65
|
-
return found;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/** The last line of a command's output that parses as a JSON object, or `null`. */
|
|
69
|
-
function lastJson(text) {
|
|
70
|
-
for (const line of String(text).split("\n").reverse()) {
|
|
71
|
-
try {
|
|
72
|
-
const value = JSON.parse(line);
|
|
73
|
-
if (value !== null && typeof value === "object") return value;
|
|
74
|
-
} catch {
|
|
75
|
-
// not the JSON line
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
return null;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Records the demo again when it is out of date and names its test.
|
|
83
|
-
* `spawn(command, args, { cwd })` returns `{ status, stdout, stderr }`.
|
|
84
|
-
* Returns the outcome and the line for the amend's report.
|
|
85
|
-
*/
|
|
86
|
-
export function rerecordDemo({ item, pr, repository, project, cwd, spawn = runProgram }) {
|
|
87
|
-
const cli = (args) => {
|
|
88
|
-
const result = spawn("outerlayer", args, { cwd });
|
|
89
|
-
// Without `outerlayer` on PATH, the CLI runs through npx.
|
|
90
|
-
return result.error?.code === "ENOENT" ? spawn("npx", ["-y", "@outerlayer/cli", ...args], { cwd }) : result;
|
|
91
|
-
};
|
|
92
|
-
// The line for the amend's report says so when a comment did not post, so nobody waits for it.
|
|
93
|
-
const comment = (body) => (cli(["work", "comment", "--item", String(item), "--body", body]).status === 0 ? "" : " The comment on the item's thread was not posted.");
|
|
94
|
-
|
|
95
|
-
const read = cli(["work", "demo", "--item", String(item), "--json"]);
|
|
96
|
-
const answer = read.status === 0 ? lastJson(read.stdout) : null;
|
|
97
|
-
if (answer === null) {
|
|
98
|
-
const detail = String(read.stderr ?? "").trim();
|
|
99
|
-
return { outcome: "error", line: `Demo: could not read the item's demo${detail === "" ? "" : ` (${detail})`}.` };
|
|
100
|
-
}
|
|
101
|
-
const demo = answer.demo ?? null;
|
|
102
|
-
if (demo === null) return { outcome: "none", line: "Demo: the item has no demo to record again." };
|
|
103
|
-
if (repository !== undefined && repositoryName(String(demo.repository ?? "")) !== repositoryName(repository)) {
|
|
104
|
-
return { outcome: "other-repository", line: `Demo: the item's demo is in ${demo.repository}, not ${repository}.` };
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
const head = String(spawn("git", ["rev-parse", "HEAD"], { cwd }).stdout ?? "").trim();
|
|
108
|
-
const short = (sha) => (sha === "" ? "an unknown commit" : sha.slice(0, 7));
|
|
109
|
-
if (demo.commitSha === head) return { outcome: "current", line: `Demo: current, recorded at ${short(head)}.` };
|
|
110
|
-
|
|
111
|
-
const byHand = `outerlayer emit demo <manifest> --item ${item} --pr ${pr} --replaces ${demo.artifactId}`;
|
|
112
|
-
const stale = `The demo is out of date: it was recorded at ${short(String(demo.commitSha ?? ""))}, and the branch is now at ${short(head)}.`;
|
|
113
|
-
const root = String(spawn("git", ["rev-parse", "--show-toplevel"], { cwd }).stdout ?? "").trim() || cwd;
|
|
114
|
-
if (demo.record === null) {
|
|
115
|
-
const why = "Its record cannot be read, so the amend cannot tell which test to run.";
|
|
116
|
-
const unposted = comment(`${stale} ${why} To record it again, run the demo test, then run \`${byHand}\`.`);
|
|
117
|
-
return { outcome: "not-recorded", line: `Demo: out of date at ${short(String(demo.commitSha ?? ""))}; ${why.charAt(0).toLowerCase()}${why.slice(1)}${unposted}` };
|
|
118
|
-
}
|
|
119
|
-
const test = insidePath(demo.record?.test);
|
|
120
|
-
const testFile = test === null ? null : join(root, test);
|
|
121
|
-
|
|
122
|
-
if (test === null || !existsSync(testFile)) {
|
|
123
|
-
const why =
|
|
124
|
-
demo.record?.test === undefined || demo.record?.test === null
|
|
125
|
-
? "Its record names no test, so the amend cannot record it again."
|
|
126
|
-
: `The test ${demo.record.test} is not in the checkout, so the amend cannot record it again.`;
|
|
127
|
-
const unposted = comment(`${stale} ${why} To record it again, run the demo test, then run \`${byHand}\`.`);
|
|
128
|
-
return { outcome: "not-recorded", line: `Demo: out of date at ${short(String(demo.commitSha ?? ""))}; ${why.charAt(0).toLowerCase()}${why.slice(1)}${unposted}` };
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
const output = mkdtempSync(join(tmpdir(), "outerlayer-rerecord-"));
|
|
132
|
-
try {
|
|
133
|
-
const folder = configFolder(root, testFile);
|
|
134
|
-
// Playwright reads the filter as a regular expression, so a path such as app/[id]/x.spec.ts needs its characters escaped.
|
|
135
|
-
const filter = relative(folder, testFile).split("\\").join("/").replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
136
|
-
const run = spawn("npx", ["playwright", "test", filter, "--output", output, ...(project === undefined ? [] : ["--project", project])], { cwd: folder });
|
|
137
|
-
// A failed check still writes the manifest, and emit demo reports the failed chapter. Only a missing manifest stops here.
|
|
138
|
-
const manifests = existsSync(output) ? findManifests(output) : [];
|
|
139
|
-
if (manifests.length !== 1) {
|
|
140
|
-
const why =
|
|
141
|
-
manifests.length === 0
|
|
142
|
-
? `Running ${test} left no demo manifest (exit ${run.status}).`
|
|
143
|
-
: `Running ${test} left ${manifests.length} demo manifests, so the amend cannot tell which to store. Pass --project <name> so the test runs once.`;
|
|
144
|
-
const unposted = comment(`${stale} ${why} To record it again, run the demo test, then run \`${byHand}\`.`);
|
|
145
|
-
return { outcome: "error", line: `Demo: out of date at ${short(String(demo.commitSha ?? ""))}; ${why}${unposted}` };
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
const emit = cli(["emit", "demo", manifests[0], "--item", String(item), "--pr", String(pr), "--replaces", demo.artifactId, "--json"]);
|
|
149
|
-
const result = emit.status === 0 || emit.status === 1 ? lastJson(emit.stdout) : null;
|
|
150
|
-
if (result === null) {
|
|
151
|
-
const why = `Storing the new demo failed: ${String(emit.stderr ?? "").trim().split("\n")[0] || `exit ${emit.status}`}.`;
|
|
152
|
-
const unposted = comment(`${stale} ${why} To record it again, run \`${byHand}\` on the manifest of a new run.`);
|
|
153
|
-
return { outcome: "error", line: `Demo: out of date at ${short(String(demo.commitSha ?? ""))}; ${why}${unposted}` };
|
|
154
|
-
}
|
|
155
|
-
const synced = cli(["sync"]);
|
|
156
|
-
const unsynced = synced.status === 0 ? "" : ` The sync failed (exit ${synced.status}), so the new demo is stored but the session record is not uploaded. Run \`outerlayer sync\`.`;
|
|
157
|
-
const failures = Array.isArray(result.failures) ? result.failures : [];
|
|
158
|
-
if (failures.length > 0) {
|
|
159
|
-
const unposted = comment(`The demo was recorded again at ${short(head)}, but a chapter failed its checks. A failed chapter is stored but not bound to its criterion:\n${failures.map((line) => `- ${line}`).join("\n")}`);
|
|
160
|
-
return { outcome: "failed-chapters", line: `Demo: recorded again at ${short(head)}, but ${failures.join("; ")}.${unsynced}${unposted}` };
|
|
161
|
-
}
|
|
162
|
-
if (unsynced !== "") return { outcome: "sync-failed", line: `Demo: recorded again at ${short(head)}.${unsynced}` };
|
|
163
|
-
return { outcome: "recorded", line: `Demo: recorded again at ${short(head)}.` };
|
|
164
|
-
} finally {
|
|
165
|
-
rmSync(output, { recursive: true, force: true });
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
/** The value after `flag`, or `undefined`. */
|
|
170
|
-
function flagValue(argv, flag) {
|
|
171
|
-
const at = argv.indexOf(flag);
|
|
172
|
-
return at === -1 ? undefined : argv[at + 1];
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
function main(argv) {
|
|
176
|
-
const item = Number(flagValue(argv, "--item"));
|
|
177
|
-
const pr = Number(flagValue(argv, "--pr"));
|
|
178
|
-
if (!Number.isInteger(item) || item <= 0 || !Number.isInteger(pr) || pr <= 0) {
|
|
179
|
-
process.stderr.write(`${USAGE}\n`);
|
|
180
|
-
return 2;
|
|
181
|
-
}
|
|
182
|
-
const { line } = rerecordDemo({ item, pr, repository: flagValue(argv, "--repository"), project: flagValue(argv, "--project"), cwd: process.cwd() });
|
|
183
|
-
process.stdout.write(`${line}\n`);
|
|
184
|
-
return 0;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) process.exitCode = main(process.argv.slice(2));
|