@outerlayer/cli 0.2.0 → 0.4.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/CHANGELOG.md +124 -0
- package/README.md +226 -59
- package/dist/agent-setup-IFH3FB5X.js +197 -0
- package/dist/build-TZUUTRGH.js +9 -0
- package/dist/build-info.json +1 -1
- package/dist/check-WQP2CZDW.js +94 -0
- package/dist/chunk-2E54Z3P5.js +232 -0
- package/dist/chunk-3TT7RQYB.js +55 -0
- package/dist/{chunk-U32VSRLO.js → chunk-3YPKXE5L.js} +90 -632
- package/dist/{chunk-Q6CL5THG.js → chunk-5DLBAXY5.js} +208 -61
- package/dist/{chunk-R5KBGVII.js → chunk-5QRP3MVS.js} +30 -14
- package/dist/chunk-5Y3QQRUH.js +300 -0
- package/dist/chunk-6Y63SXFO.js +383 -0
- package/dist/chunk-774HEQL6.js +178 -0
- package/dist/chunk-7A6RVXPZ.js +2233 -0
- package/dist/chunk-7YIOOFVJ.js +71 -0
- package/dist/chunk-ABIWDUMS.js +104 -0
- package/dist/chunk-AUFG23AA.js +534 -0
- package/dist/chunk-B2G7JHHB.js +42 -0
- package/dist/chunk-BCJNHMZT.js +34 -0
- package/dist/chunk-BCLJSQCV.js +56 -0
- package/dist/chunk-BFESLKPP.js +61 -0
- package/dist/chunk-BJ3KTMDH.js +63 -0
- package/dist/chunk-BKO6JEZI.js +47 -0
- package/dist/chunk-BOLTI6LR.js +37 -0
- package/dist/chunk-CBPPJSAR.js +89 -0
- package/dist/chunk-CBZB6XY6.js +102 -0
- package/dist/{chunk-65WXAANR.js → chunk-DVDEBNQJ.js} +17 -2
- package/dist/{work-pr-cmd-AZQPWH4H.js → chunk-DVYHCMB2.js} +9 -26
- package/dist/{chunk-TFUIDMOB.js → chunk-EABW6AJQ.js} +12 -1
- package/dist/{chunk-KFYJV2ZG.js → chunk-EMY4I27X.js} +1 -1
- package/dist/{chunk-NTTPJV35.js → chunk-F47JBIAW.js} +3 -1
- package/dist/chunk-F6GFZXZ3.js +60 -0
- package/dist/{chunk-YOOSBOKS.js → chunk-F7CU5ABH.js} +1 -1
- package/dist/chunk-FAJSS2WN.js +1357 -0
- package/dist/chunk-FS2VYGZT.js +1764 -0
- package/dist/chunk-FV2CCGXK.js +9 -0
- package/dist/{chunk-4TNZMO7V.js → chunk-G7FSV7JX.js} +3452 -751
- package/dist/{emit-cmd-TWSYYEZI.js → chunk-H5NCNVDA.js} +68 -17
- package/dist/chunk-HE2D4EY5.js +83 -0
- package/dist/chunk-L2DBRKRA.js +94 -0
- package/dist/chunk-LF6MLJCY.js +38 -0
- package/dist/chunk-M5POMKKW.js +1051 -0
- package/dist/{mcp-install-cmd-FDQH6SEN.js → chunk-MQ3IPHIZ.js} +35 -18
- package/dist/{chunk-D77LS3UI.js → chunk-N5FOE5PS.js} +33 -4
- package/dist/chunk-N6LURUEF.js +64 -0
- package/dist/chunk-NYC54VBD.js +1084 -0
- package/dist/chunk-OGFGZQA3.js +23 -0
- package/dist/chunk-QOZKPLVJ.js +226 -0
- package/dist/chunk-RA3O54FC.js +30 -0
- package/dist/chunk-TBT347UY.js +41 -0
- package/dist/{chunk-NXLLURA4.js → chunk-UFFXNXLQ.js} +115 -71
- package/dist/chunk-USO2DKBD.js +421 -0
- package/dist/chunk-W4SQCOZU.js +206 -0
- package/dist/{chunk-A3WLZX2F.js → chunk-WIOZAJ2W.js} +15 -2
- package/dist/chunk-WO2BXCTQ.js +83 -0
- package/dist/{chunk-I3ETLSNE.js → chunk-XCCLFVXM.js} +120 -11
- package/dist/{context-materialize-6WKT3RBQ.js → chunk-XDDW4FRS.js} +134 -26
- package/dist/chunk-YYYXRJUW.js +101 -0
- package/dist/chunk-ZM2IMMYN.js +76 -0
- package/dist/chunk-ZMYPLFG3.js +71 -0
- package/dist/chunk-ZNA27WEV.js +470 -0
- package/dist/{cli-G7DILYJY.js → cli-NHUXABYH.js} +590 -876
- package/dist/{paths-D2VGWWFI.js → cli-build-K56DK4DS.js} +1 -1
- package/dist/config-XVJYZ4IQ.js +9 -0
- package/dist/connect-cmd-OOG4TPU7.js +16 -0
- package/dist/context-adopt-UMA4O5NY.js +105 -0
- package/dist/context-materialize-G2FUFC72.js +19 -0
- package/dist/dist-RW4UPPC2.js +6 -0
- package/dist/docker-NEGDLU6D.js +7 -0
- package/dist/doctor-53F2PYY7.js +43 -0
- package/dist/doctor-UFVL4PZY.js +426 -0
- package/dist/{emit-artifact-cmd-UQVT3OKW.js → emit-artifact-cmd-KTYW2TN2.js} +24 -20
- package/dist/emit-cmd-DCERAU27.js +9 -0
- package/dist/emit-criteria-cmd-VAUUSAYD.js +166 -0
- package/dist/{emit-finding-cmd-FDOU2OPD.js → emit-finding-cmd-UR4ID45Z.js} +34 -31
- package/dist/{emit-result-cmd-H2T4C2K3.js → emit-result-cmd-FDTUKGKE.js} +34 -62
- package/dist/exec-client-4XGXV3XN.js +8 -0
- package/dist/guest-init-GENRHNP7.js +8 -0
- package/dist/hook-fast-EYENPK6F.js +9 -0
- package/dist/{hook-wrap-fast-KXYNX3AD.js → hook-wrap-fast-NPLHJXFK.js} +2 -2
- package/dist/host-key-KDYZ5ECC.js +7 -0
- package/dist/import-capture-cmd-AVZ4VIVJ.js +68 -0
- package/dist/{import-ruler-cmd-7LH2QOMG.js → import-ruler-cmd-GUHL6IY5.js} +1 -1
- package/dist/index.js +4 -4
- package/dist/init-DXBCOAJK.js +36 -0
- package/dist/init-YEXK35CF.js +221 -0
- package/dist/init-cmd-NHR7PRSQ.js +135 -0
- package/dist/install-cmd-7WXOIFDO.js +55 -0
- package/dist/lima-XN65D7GN.js +55 -0
- package/dist/login-browser-7XGSV7MA.js +10 -0
- package/dist/{config-POF7DEQW.js → logout-cmd-QAUFDJ6J.js} +3 -1
- package/dist/{logs-TRNPQM42.js → logs-7RYUH5A6.js} +1 -1
- package/dist/loop-VZOLL4WQ.js +43 -0
- package/dist/machine-WSG52J75.js +35 -0
- package/dist/mcp-install-cmd-RLK4SO3N.js +9 -0
- package/dist/{mcp-serve-cmd-57EZZOTL.js → mcp-serve-cmd-JPTP5FMS.js} +20 -9
- package/dist/paths-OYKMVYJP.js +6 -0
- package/dist/{pidfile-PTW76F56.js → pidfile-UZRH774M.js} +2 -3
- package/dist/real-deps-SU24ZA2K.js +21 -0
- package/dist/relay-L76HDX72.js +46 -0
- package/dist/settings-J2652U5N.js +7 -0
- package/dist/starter-pack-LIZYMKYQ.js +10 -0
- package/dist/{status-I27IST4L.js → status-2UZKKNB7.js} +30 -13
- package/dist/{statusline-fast-3C5OXHDD.js → statusline-fast-SVTMBMD7.js} +3 -2
- package/dist/sync-cmd-VPPYCNNM.js +28 -0
- package/dist/version-BWM6VLDI.js +6 -0
- package/dist/{watch-3DTPJETH.js → watch-5C4ZBBGO.js} +19 -8
- package/dist/{work-claim-cmd-5AUNCLS2.js → work-claim-cmd-LSO2B2EX.js} +33 -20
- package/dist/work-cmd-UOQO2AD4.js +17 -0
- package/dist/work-comment-cmd-WF3EOLAE.js +106 -0
- package/dist/{work-launch-LT663PB3.js → work-launch-YI4CJDAP.js} +1 -1
- package/dist/work-open-pr-cmd-4SSQZMYG.js +156 -0
- package/dist/work-pr-cmd-6AN6RRQJ.js +16 -0
- package/package.json +13 -3
- package/skill-pack/maintained/amend/SKILL.md +104 -0
- package/skill-pack/maintained/emitting-evidence/SKILL.md +99 -0
- package/skill-pack/maintained/emitting-evidence/references/agents-snippet.md +20 -0
- package/skill-pack/maintained/outerlayer/SKILL.md +55 -0
- package/skill-pack/maintained/reporting-findings/SKILL.md +148 -0
- package/skill-pack/template/build/SKILL.md +193 -0
- package/skill-pack/template/build/references/agent-briefs.md +243 -0
- package/skill-pack/template/build/references/criteria-judge.md +91 -0
- package/skill-pack/template/build/references/evidence.md +42 -0
- package/skill-pack/template/build/references/release.md +74 -0
- package/skill-pack/template/build/references/review-briefs.md +275 -0
- package/skill-pack/template/build/references/review-loop.md +158 -0
- package/skill-pack/template/build/scripts/record-criteria.mjs +235 -0
- package/skill-pack/template/spec/SKILL.md +84 -0
- package/skill-pack/template/writing-specs/SKILL.md +134 -0
- package/dist/chunk-DCNOXRMV.js +0 -589
- package/dist/chunk-JJP7YLMN.js +0 -25
- package/dist/chunk-OZ7C3XUE.js +0 -34
- package/dist/chunk-WQ6VGRGZ.js +0 -150
- package/dist/hook-fast-J5LCDHUJ.js +0 -8
- package/dist/import-capture-cmd-EUMBGIV3.js +0 -176
- package/dist/init-PTBITAUO.js +0 -103
- package/dist/login-cmd-IRX6LZT7.js +0 -62
- package/dist/loop-ASZRX3CZ.js +0 -648
- package/dist/sync-cmd-BBAUZ5JD.js +0 -17
- package/dist/work-cmd-2P4BVX47.js +0 -18
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
|
+
export { RunnerStartError, listJobFiles, probeCredentials, requestStop, runnerProcessState, start, tick, watchTick } from './chunk-FS2VYGZT.js';
|
|
4
|
+
import './chunk-FAJSS2WN.js';
|
|
5
|
+
import './chunk-FV2CCGXK.js';
|
|
6
|
+
import './chunk-ABIWDUMS.js';
|
|
7
|
+
import './chunk-YYYXRJUW.js';
|
|
8
|
+
import './chunk-CBPPJSAR.js';
|
|
9
|
+
import './chunk-HE2D4EY5.js';
|
|
10
|
+
import './chunk-TBT347UY.js';
|
|
11
|
+
import './chunk-7A6RVXPZ.js';
|
|
12
|
+
import './chunk-ZNA27WEV.js';
|
|
13
|
+
import './chunk-N5FOE5PS.js';
|
|
14
|
+
import './chunk-OGFGZQA3.js';
|
|
15
|
+
import './chunk-774HEQL6.js';
|
|
16
|
+
import './chunk-QOZKPLVJ.js';
|
|
17
|
+
import './chunk-W4SQCOZU.js';
|
|
18
|
+
import './chunk-B2G7JHHB.js';
|
|
19
|
+
import './chunk-5DLBAXY5.js';
|
|
20
|
+
import './chunk-BFESLKPP.js';
|
|
21
|
+
import './chunk-6Y63SXFO.js';
|
|
22
|
+
import './chunk-G7FSV7JX.js';
|
|
23
|
+
import './chunk-5Y3QQRUH.js';
|
|
24
|
+
import './chunk-F6GFZXZ3.js';
|
|
25
|
+
import './chunk-AUFG23AA.js';
|
|
26
|
+
import './chunk-WZBHBH3J.js';
|
|
27
|
+
import './chunk-XDDW4FRS.js';
|
|
28
|
+
import './chunk-WIOZAJ2W.js';
|
|
29
|
+
import './chunk-WO2BXCTQ.js';
|
|
30
|
+
import './chunk-EMY4I27X.js';
|
|
31
|
+
import './chunk-ZJSNLVCE.js';
|
|
32
|
+
import './chunk-BCLJSQCV.js';
|
|
33
|
+
import './chunk-BOLTI6LR.js';
|
|
34
|
+
import './chunk-EABW6AJQ.js';
|
|
35
|
+
import './chunk-RA3O54FC.js';
|
|
36
|
+
import './chunk-M5POMKKW.js';
|
|
37
|
+
import './chunk-ZM2IMMYN.js';
|
|
38
|
+
import './chunk-XCCLFVXM.js';
|
|
39
|
+
import './chunk-BJ3KTMDH.js';
|
|
40
|
+
import './chunk-VNVZDWO3.js';
|
|
41
|
+
import './chunk-Z5GEFMRW.js';
|
|
42
|
+
|
|
43
|
+
createRequire(import.meta.url);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
|
+
export { describeMachineDocker, detectMachine, microVmArchSupported, microVmAssetsPinned, reachDockerStep, supportsContainerBuilds, supportsMicroVmBuilds } from './chunk-L2DBRKRA.js';
|
|
4
|
+
import './chunk-7A6RVXPZ.js';
|
|
5
|
+
import './chunk-ZNA27WEV.js';
|
|
6
|
+
import './chunk-N5FOE5PS.js';
|
|
7
|
+
import './chunk-OGFGZQA3.js';
|
|
8
|
+
import './chunk-774HEQL6.js';
|
|
9
|
+
import './chunk-QOZKPLVJ.js';
|
|
10
|
+
import './chunk-W4SQCOZU.js';
|
|
11
|
+
import './chunk-B2G7JHHB.js';
|
|
12
|
+
import './chunk-5DLBAXY5.js';
|
|
13
|
+
import './chunk-BFESLKPP.js';
|
|
14
|
+
import './chunk-6Y63SXFO.js';
|
|
15
|
+
import './chunk-G7FSV7JX.js';
|
|
16
|
+
import './chunk-F6GFZXZ3.js';
|
|
17
|
+
import './chunk-AUFG23AA.js';
|
|
18
|
+
import './chunk-WZBHBH3J.js';
|
|
19
|
+
import './chunk-XDDW4FRS.js';
|
|
20
|
+
import './chunk-WIOZAJ2W.js';
|
|
21
|
+
import './chunk-WO2BXCTQ.js';
|
|
22
|
+
import './chunk-EMY4I27X.js';
|
|
23
|
+
import './chunk-ZJSNLVCE.js';
|
|
24
|
+
import './chunk-BCLJSQCV.js';
|
|
25
|
+
import './chunk-BOLTI6LR.js';
|
|
26
|
+
import './chunk-EABW6AJQ.js';
|
|
27
|
+
import './chunk-RA3O54FC.js';
|
|
28
|
+
import './chunk-M5POMKKW.js';
|
|
29
|
+
import './chunk-ZM2IMMYN.js';
|
|
30
|
+
import './chunk-XCCLFVXM.js';
|
|
31
|
+
import './chunk-BJ3KTMDH.js';
|
|
32
|
+
import './chunk-VNVZDWO3.js';
|
|
33
|
+
import './chunk-Z5GEFMRW.js';
|
|
34
|
+
|
|
35
|
+
createRequire(import.meta.url);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
|
+
export { DEFAULT_MCP_COMMAND, McpInstallError, addStdioMcpEntryIfAbsent, buildServerEntry, buildStdioServerEntry, defaultMcpUrl, handleMcpInstallError, runMcpInstall } from './chunk-MQ3IPHIZ.js';
|
|
4
|
+
import './chunk-YRYMNBGQ.js';
|
|
5
|
+
import './chunk-EABW6AJQ.js';
|
|
6
|
+
import './chunk-VNVZDWO3.js';
|
|
7
|
+
import './chunk-Z5GEFMRW.js';
|
|
8
|
+
|
|
9
|
+
createRequire(import.meta.url);
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
3
|
import { C } from './chunk-YRYMNBGQ.js';
|
|
4
|
-
import {
|
|
4
|
+
import { defaultFetch } from './chunk-BCLJSQCV.js';
|
|
5
|
+
import { resolveGatewayCredentials } from './chunk-BOLTI6LR.js';
|
|
6
|
+
import { cloudConfigPath } from './chunk-EABW6AJQ.js';
|
|
7
|
+
import './chunk-M5POMKKW.js';
|
|
8
|
+
import './chunk-ZM2IMMYN.js';
|
|
9
|
+
import './chunk-BJ3KTMDH.js';
|
|
5
10
|
import { homeFromEnv } from './chunk-VNVZDWO3.js';
|
|
6
11
|
import './chunk-Z5GEFMRW.js';
|
|
7
12
|
import { createInterface } from 'readline';
|
|
@@ -17,21 +22,24 @@ function mcpEndpointFromOrigin(origin) {
|
|
|
17
22
|
function resolveMcpServeTarget(opts = {}) {
|
|
18
23
|
const env = opts.env ?? process.env;
|
|
19
24
|
const home = opts.home ?? homeFromEnv(env);
|
|
20
|
-
const
|
|
21
|
-
const apiKey =
|
|
25
|
+
const resolved = resolveGatewayCredentials({ env, home, appId: opts.appId, cwd: opts.cwd });
|
|
26
|
+
const apiKey = resolved.credential;
|
|
22
27
|
if (!apiKey) {
|
|
23
28
|
throw new McpServeConfigError(
|
|
24
|
-
`no API key: set OUTERLAYER_API_KEY or save "apiKey" to ${cloudConfigPath(home)} (run "outerlayer sync" once with --api-key, or mint a key in the dashboard: Settings \u2192 API keys).`
|
|
29
|
+
`no API key: set OUTERLAYER_API_KEY, run "outerlayer login", or save "apiKey" to ${cloudConfigPath(home)} (run "outerlayer sync" once with --api-key, or mint a key in the dashboard: Settings \u2192 API keys).`
|
|
25
30
|
);
|
|
26
31
|
}
|
|
27
|
-
|
|
32
|
+
if (!resolved.ok && resolved.kind === "login" && !resolved.appId && resolved.url) {
|
|
33
|
+
throw new McpServeConfigError(resolved.message);
|
|
34
|
+
}
|
|
35
|
+
const origin = resolved.url;
|
|
28
36
|
if (!opts.url && !origin) {
|
|
29
37
|
throw new McpServeConfigError(
|
|
30
|
-
`no gateway URL: set OUTERLAYER_URL or save "url" to ${cloudConfigPath(home)} (run \`outerlayer login
|
|
38
|
+
`no gateway URL: set OUTERLAYER_URL or save "url" to ${cloudConfigPath(home)} (run \`outerlayer login\`), or pass --url.`
|
|
31
39
|
);
|
|
32
40
|
}
|
|
33
41
|
const url = opts.url ?? mcpEndpointFromOrigin(origin);
|
|
34
|
-
const appId =
|
|
42
|
+
const appId = resolved.appId;
|
|
35
43
|
const headers = { Authorization: `Bearer ${apiKey}` };
|
|
36
44
|
if (appId) headers["X-Outerlayer-App-Id"] = appId;
|
|
37
45
|
return { url, headers };
|
|
@@ -64,7 +72,7 @@ async function bridgeMessage(line, opts) {
|
|
|
64
72
|
}
|
|
65
73
|
const notification = isNotification(message);
|
|
66
74
|
const id = requestId(message);
|
|
67
|
-
const doFetch = opts.fetch ??
|
|
75
|
+
const doFetch = opts.fetch ?? defaultFetch;
|
|
68
76
|
let status;
|
|
69
77
|
let text;
|
|
70
78
|
try {
|
|
@@ -93,9 +101,12 @@ async function bridgeMessage(line, opts) {
|
|
|
93
101
|
return JSON.stringify(body);
|
|
94
102
|
}
|
|
95
103
|
const detail = gatewayErrorMessage(body) ?? text.slice(0, 200);
|
|
96
|
-
const hint = status === 401 ? ` \u2014 check the API key in ${cloudConfigPath(opts.home ?? homeFromEnv())} (or OUTERLAYER_API_KEY)` : "";
|
|
104
|
+
const hint = status === 401 ? usesLoginToken(opts.target.headers) ? " \u2014 the login is expired or was revoked; run `outerlayer login` to sign in again" : ` \u2014 check the API key in ${cloudConfigPath(opts.home ?? homeFromEnv())} (or OUTERLAYER_API_KEY)` : "";
|
|
97
105
|
return errorResponse(id, JSON_RPC_GATEWAY_ERROR, `OuterLayer gateway returned HTTP ${status}: ${detail}${hint}`);
|
|
98
106
|
}
|
|
107
|
+
function usesLoginToken(headers) {
|
|
108
|
+
return (headers.Authorization ?? "").startsWith("Bearer olu_");
|
|
109
|
+
}
|
|
99
110
|
async function runMcpServe(opts = {}) {
|
|
100
111
|
const target = resolveMcpServeTarget(opts);
|
|
101
112
|
const stdin = opts.stdin ?? process.stdin;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
|
+
export { RUNNER_DIR_MODE, RUNNER_FILE_MODE, attemptStamp, buildDir, contextHomeDir, diskTemplatesDir, ghConfigDir, hostKeyPath, imagesDir, jobDir, jobsDir, mirrorDir, pidFilePath, repoCacheDir, rootfsDir, rootfsPathFor, runnerDir, runnerDirOfBuild, spoolDir, stagedContextDir, vmAssetsDir, vsockPath } from './chunk-ZM2IMMYN.js';
|
|
4
|
+
import './chunk-Z5GEFMRW.js';
|
|
5
|
+
|
|
6
|
+
createRequire(import.meta.url);
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
export { RunnerAlreadyRunningError, claimPidFile, readPidFile, releasePidFile } from './chunk-
|
|
4
|
-
import './chunk-
|
|
5
|
-
import './chunk-JJP7YLMN.js';
|
|
3
|
+
export { RunnerAlreadyRunningError, claimPidFile, readPidFile, releasePidFile } from './chunk-N5FOE5PS.js';
|
|
4
|
+
import './chunk-ZM2IMMYN.js';
|
|
6
5
|
import './chunk-Z5GEFMRW.js';
|
|
7
6
|
|
|
8
7
|
createRequire(import.meta.url);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
|
+
import { realRunNode, realRunNpm } from './chunk-ABIWDUMS.js';
|
|
4
|
+
import './chunk-Z5GEFMRW.js';
|
|
5
|
+
|
|
6
|
+
createRequire(import.meta.url);
|
|
7
|
+
|
|
8
|
+
// src/runner/update/real-deps.ts
|
|
9
|
+
function realUpdateDeps() {
|
|
10
|
+
const nodePath = process.execPath;
|
|
11
|
+
return {
|
|
12
|
+
runNpm: realRunNpm(nodePath),
|
|
13
|
+
runNode: realRunNode(nodePath),
|
|
14
|
+
entryPath: process.argv[1] ?? "",
|
|
15
|
+
nodePath,
|
|
16
|
+
exit: (code) => process.exit(code),
|
|
17
|
+
fetchImpl: fetch
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { realUpdateDeps };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
|
+
import './chunk-Z5GEFMRW.js';
|
|
4
|
+
import { createServer, connect } from 'net';
|
|
5
|
+
|
|
6
|
+
createRequire(import.meta.url);
|
|
7
|
+
async function startRelay(opts) {
|
|
8
|
+
const main = await listenRelay(opts.port, opts.socketPath);
|
|
9
|
+
const extra = [];
|
|
10
|
+
try {
|
|
11
|
+
for (const forward of opts.forwards ?? []) extra.push(await listenRelay(forward.port, forward.socketPath));
|
|
12
|
+
} catch (err) {
|
|
13
|
+
await Promise.all([main, ...extra].map((relay) => relay.close()));
|
|
14
|
+
throw err;
|
|
15
|
+
}
|
|
16
|
+
return { port: main.port, close: async () => void await Promise.all([main, ...extra].map((relay) => relay.close())) };
|
|
17
|
+
}
|
|
18
|
+
async function listenRelay(port, socketPath) {
|
|
19
|
+
const open = /* @__PURE__ */ new Set();
|
|
20
|
+
const server = createServer((client) => {
|
|
21
|
+
const upstream = connect(socketPath);
|
|
22
|
+
open.add(client);
|
|
23
|
+
client.on("error", () => void 0);
|
|
24
|
+
upstream.on("error", () => void 0);
|
|
25
|
+
client.on("close", () => {
|
|
26
|
+
open.delete(client);
|
|
27
|
+
upstream.destroy();
|
|
28
|
+
});
|
|
29
|
+
upstream.on("close", () => client.destroy());
|
|
30
|
+
client.pipe(upstream);
|
|
31
|
+
upstream.pipe(client);
|
|
32
|
+
});
|
|
33
|
+
await new Promise((resolve, reject) => {
|
|
34
|
+
server.once("error", reject);
|
|
35
|
+
server.listen(port, "127.0.0.1", () => resolve());
|
|
36
|
+
});
|
|
37
|
+
return {
|
|
38
|
+
port: server.address().port,
|
|
39
|
+
close: () => new Promise((resolve) => {
|
|
40
|
+
for (const socket of open) socket.destroy();
|
|
41
|
+
server.close(() => resolve());
|
|
42
|
+
})
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export { startRelay };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
|
+
export { AUTO_WRAP_EVENTS, REGISTERED_EVENTS, SettingsParseError, cliBinResolvable, cliCommand, decodeWrappedCommand, encodeWrappedCommand, isOurHookCommand, isOurHookCommandFor, isOurStatuslineSlot, isWrapped, listHookCandidates, mergeHooks, mergeStatusline, ourCommandBins, ourDirectScriptBins, parseLifecycleHookCommand, readSettings, removeHooks, removeStatusline, repointWrappedHooks, settingsPath, statuslineCommand, statuslineWrappedOriginal, unwrapHooks, wrapHooks, wrappedOriginalCommand, writeSettings } from './chunk-5QRP3MVS.js';
|
|
4
|
+
import './chunk-VNVZDWO3.js';
|
|
5
|
+
import './chunk-Z5GEFMRW.js';
|
|
6
|
+
|
|
7
|
+
createRequire(import.meta.url);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
|
+
export { StarterPackError, assertKnownTemplate, formatStarterPackOutput, installStarterPack } from './chunk-ZMYPLFG3.js';
|
|
4
|
+
import './chunk-YRYMNBGQ.js';
|
|
5
|
+
import './chunk-WO2BXCTQ.js';
|
|
6
|
+
import './chunk-EMY4I27X.js';
|
|
7
|
+
import './chunk-RA3O54FC.js';
|
|
8
|
+
import './chunk-Z5GEFMRW.js';
|
|
9
|
+
|
|
10
|
+
createRequire(import.meta.url);
|
|
@@ -1,20 +1,37 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import {
|
|
4
|
-
import './chunk-
|
|
5
|
-
import
|
|
6
|
-
import './chunk-
|
|
7
|
-
import './chunk-
|
|
8
|
-
import './chunk-
|
|
9
|
-
import './chunk-
|
|
10
|
-
import './chunk-
|
|
3
|
+
import { LEASE_SECONDS, RENEW_INTERVAL_SECONDS } from './chunk-FAJSS2WN.js';
|
|
4
|
+
import './chunk-CBPPJSAR.js';
|
|
5
|
+
import './chunk-HE2D4EY5.js';
|
|
6
|
+
import { formatDuration, formatClock, relativeToRunner } from './chunk-7A6RVXPZ.js';
|
|
7
|
+
import './chunk-ZNA27WEV.js';
|
|
8
|
+
import './chunk-N5FOE5PS.js';
|
|
9
|
+
import './chunk-OGFGZQA3.js';
|
|
10
|
+
import './chunk-774HEQL6.js';
|
|
11
|
+
import './chunk-QOZKPLVJ.js';
|
|
12
|
+
import './chunk-W4SQCOZU.js';
|
|
13
|
+
import './chunk-B2G7JHHB.js';
|
|
14
|
+
import './chunk-5DLBAXY5.js';
|
|
15
|
+
import './chunk-BFESLKPP.js';
|
|
16
|
+
import './chunk-6Y63SXFO.js';
|
|
17
|
+
import './chunk-G7FSV7JX.js';
|
|
18
|
+
import './chunk-5Y3QQRUH.js';
|
|
19
|
+
import './chunk-F6GFZXZ3.js';
|
|
20
|
+
import './chunk-AUFG23AA.js';
|
|
11
21
|
import './chunk-WZBHBH3J.js';
|
|
22
|
+
import './chunk-XDDW4FRS.js';
|
|
23
|
+
import './chunk-WIOZAJ2W.js';
|
|
24
|
+
import './chunk-WO2BXCTQ.js';
|
|
25
|
+
import './chunk-EMY4I27X.js';
|
|
12
26
|
import './chunk-ZJSNLVCE.js';
|
|
13
|
-
import './chunk-
|
|
14
|
-
import './chunk-
|
|
15
|
-
import './chunk-
|
|
16
|
-
import './chunk-
|
|
17
|
-
import './chunk-
|
|
27
|
+
import './chunk-BCLJSQCV.js';
|
|
28
|
+
import './chunk-BOLTI6LR.js';
|
|
29
|
+
import './chunk-EABW6AJQ.js';
|
|
30
|
+
import './chunk-RA3O54FC.js';
|
|
31
|
+
import './chunk-M5POMKKW.js';
|
|
32
|
+
import { runnerDir, jobsDir } from './chunk-ZM2IMMYN.js';
|
|
33
|
+
import './chunk-XCCLFVXM.js';
|
|
34
|
+
import './chunk-BJ3KTMDH.js';
|
|
18
35
|
import './chunk-VNVZDWO3.js';
|
|
19
36
|
import './chunk-Z5GEFMRW.js';
|
|
20
37
|
import { join } from 'path';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
export { STATE_FRESH_MS, WRAP_TIMEOUT_MS, localDateString, parseStatuslineArgs, parseStatuslineStdin, readStatuslineState, renderStatusline, runStatuslineFast, runWrappedStatusline, statuslineStatePath } from './chunk-
|
|
4
|
-
import './chunk-
|
|
3
|
+
export { STATE_FRESH_MS, WRAP_TIMEOUT_MS, localDateString, parseStatuslineArgs, parseStatuslineStdin, readStatuslineState, renderStatusline, runStatuslineFast, runWrappedStatusline, statuslineStatePath } from './chunk-F47JBIAW.js';
|
|
4
|
+
import './chunk-BKO6JEZI.js';
|
|
5
|
+
import './chunk-5QRP3MVS.js';
|
|
5
6
|
import './chunk-VNVZDWO3.js';
|
|
6
7
|
import './chunk-Z5GEFMRW.js';
|
|
7
8
|
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
|
+
export { CHUNK_PART_TARGET_BYTES, RETRYABLE_STATUSES, SyncConfigError, SyncTransportError, isLoopbackUrl, resolveTier, runSync } from './chunk-3YPKXE5L.js';
|
|
4
|
+
export { detectCi } from './chunk-HE2D4EY5.js';
|
|
5
|
+
import './chunk-BCJNHMZT.js';
|
|
6
|
+
import './chunk-TBT347UY.js';
|
|
7
|
+
import './chunk-F7CU5ABH.js';
|
|
8
|
+
import './chunk-BKO6JEZI.js';
|
|
9
|
+
import './chunk-BFESLKPP.js';
|
|
10
|
+
import './chunk-6Y63SXFO.js';
|
|
11
|
+
import './chunk-G7FSV7JX.js';
|
|
12
|
+
import './chunk-YRYMNBGQ.js';
|
|
13
|
+
import './chunk-DVDEBNQJ.js';
|
|
14
|
+
import './chunk-WZBHBH3J.js';
|
|
15
|
+
import './chunk-5QRP3MVS.js';
|
|
16
|
+
import './chunk-ZJSNLVCE.js';
|
|
17
|
+
import './chunk-BCLJSQCV.js';
|
|
18
|
+
import './chunk-BOLTI6LR.js';
|
|
19
|
+
export { cloudConfigPath, readCloudConfig, writeCloudConfig } from './chunk-EABW6AJQ.js';
|
|
20
|
+
import './chunk-M5POMKKW.js';
|
|
21
|
+
import './chunk-ZM2IMMYN.js';
|
|
22
|
+
import './chunk-UFFXNXLQ.js';
|
|
23
|
+
import './chunk-XCCLFVXM.js';
|
|
24
|
+
import './chunk-BJ3KTMDH.js';
|
|
25
|
+
import './chunk-VNVZDWO3.js';
|
|
26
|
+
import './chunk-Z5GEFMRW.js';
|
|
27
|
+
|
|
28
|
+
createRequire(import.meta.url);
|
|
@@ -1,16 +1,27 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { LiveUploader } from './chunk-
|
|
4
|
-
import
|
|
3
|
+
import { LiveUploader } from './chunk-3YPKXE5L.js';
|
|
4
|
+
import './chunk-HE2D4EY5.js';
|
|
5
|
+
import './chunk-BCJNHMZT.js';
|
|
6
|
+
import './chunk-TBT347UY.js';
|
|
7
|
+
import './chunk-F7CU5ABH.js';
|
|
8
|
+
import './chunk-BKO6JEZI.js';
|
|
9
|
+
import './chunk-BFESLKPP.js';
|
|
10
|
+
import './chunk-6Y63SXFO.js';
|
|
11
|
+
import { StatuslineAggregator, CaptureDaemon } from './chunk-G7FSV7JX.js';
|
|
5
12
|
import './chunk-YRYMNBGQ.js';
|
|
6
|
-
import './chunk-
|
|
13
|
+
import './chunk-DVDEBNQJ.js';
|
|
7
14
|
import './chunk-WZBHBH3J.js';
|
|
15
|
+
import './chunk-5QRP3MVS.js';
|
|
8
16
|
import './chunk-ZJSNLVCE.js';
|
|
9
|
-
import './chunk-
|
|
10
|
-
import './chunk-
|
|
11
|
-
import './chunk-
|
|
12
|
-
import './chunk-
|
|
13
|
-
import './chunk-
|
|
17
|
+
import './chunk-BCLJSQCV.js';
|
|
18
|
+
import './chunk-BOLTI6LR.js';
|
|
19
|
+
import './chunk-EABW6AJQ.js';
|
|
20
|
+
import './chunk-M5POMKKW.js';
|
|
21
|
+
import './chunk-ZM2IMMYN.js';
|
|
22
|
+
import './chunk-UFFXNXLQ.js';
|
|
23
|
+
import './chunk-XCCLFVXM.js';
|
|
24
|
+
import './chunk-BJ3KTMDH.js';
|
|
14
25
|
import { homeFromEnv } from './chunk-VNVZDWO3.js';
|
|
15
26
|
import './chunk-Z5GEFMRW.js';
|
|
16
27
|
import { mkdirSync, writeFileSync } from 'fs';
|
|
@@ -1,24 +1,30 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import './chunk-
|
|
7
|
-
import './chunk-
|
|
8
|
-
import './chunk-
|
|
3
|
+
import { RUNNER_PROTOCOL } from './chunk-FV2CCGXK.js';
|
|
4
|
+
import { resolveCredentials, WorkCommandError, parsePositiveInt, postJson, resolveRepository, findLiveItem } from './chunk-5DLBAXY5.js';
|
|
5
|
+
export { WorkCommandError } from './chunk-5DLBAXY5.js';
|
|
6
|
+
import './chunk-BFESLKPP.js';
|
|
7
|
+
import './chunk-6Y63SXFO.js';
|
|
8
|
+
import './chunk-G7FSV7JX.js';
|
|
9
|
+
import { defaultRunnerConfigPath } from './chunk-5Y3QQRUH.js';
|
|
10
|
+
import './chunk-F6GFZXZ3.js';
|
|
11
|
+
import './chunk-AUFG23AA.js';
|
|
9
12
|
import './chunk-WZBHBH3J.js';
|
|
10
|
-
import './chunk-
|
|
11
|
-
import './chunk-
|
|
12
|
-
import './chunk-
|
|
13
|
-
import './chunk-
|
|
14
|
-
import './chunk-
|
|
15
|
-
import './chunk-
|
|
16
|
-
import './chunk-VNVZDWO3.js';
|
|
13
|
+
import { defaultFetch } from './chunk-BCLJSQCV.js';
|
|
14
|
+
import './chunk-BOLTI6LR.js';
|
|
15
|
+
import './chunk-EABW6AJQ.js';
|
|
16
|
+
import { ensureHostKey } from './chunk-M5POMKKW.js';
|
|
17
|
+
import './chunk-ZM2IMMYN.js';
|
|
18
|
+
import './chunk-BJ3KTMDH.js';
|
|
19
|
+
import { homeFromEnv } from './chunk-VNVZDWO3.js';
|
|
17
20
|
import './chunk-Z5GEFMRW.js';
|
|
18
21
|
import { hostname } from 'os';
|
|
19
22
|
|
|
20
23
|
createRequire(import.meta.url);
|
|
21
24
|
var DEFAULT_LEASE_SECONDS = 900;
|
|
25
|
+
function hostKeyFor(opts) {
|
|
26
|
+
return ensureHostKey(defaultRunnerConfigPath(opts.home ?? homeFromEnv()));
|
|
27
|
+
}
|
|
22
28
|
var CLAIM_OUTCOMES = ["ok", "failed", "timed_out", "idle", "lease_lost", "interrupted", "stopped"];
|
|
23
29
|
async function resolveItemIdentifier(opts, creds, cwd, fetchImpl) {
|
|
24
30
|
const itemNumber = parsePositiveInt(opts.item, "--item");
|
|
@@ -37,20 +43,23 @@ async function resolveItemIdentifier(opts, creds, cwd, fetchImpl) {
|
|
|
37
43
|
async function runWorkClaim(opts) {
|
|
38
44
|
const cwd = opts.cwd ?? process.cwd();
|
|
39
45
|
const creds = resolveCredentials(opts);
|
|
40
|
-
const fetchImpl = opts.fetchImpl ??
|
|
46
|
+
const fetchImpl = opts.fetchImpl ?? defaultFetch;
|
|
41
47
|
if (opts.kind !== "implement" && opts.kind !== "amend") {
|
|
42
48
|
throw new WorkCommandError('--kind is required \u2014 pass "implement" or "amend"');
|
|
43
49
|
}
|
|
44
50
|
const host = opts.host ?? hostname();
|
|
45
51
|
const seconds = parsePositiveInt(opts.seconds, "--seconds") ?? DEFAULT_LEASE_SECONDS;
|
|
46
52
|
const itemId = await resolveItemIdentifier(opts, creds, cwd, fetchImpl);
|
|
53
|
+
const hostKey = await hostKeyFor(opts);
|
|
47
54
|
const { data } = await postJson(
|
|
48
55
|
creds.url,
|
|
49
56
|
`/v1/work-items/${itemId}/claim`,
|
|
50
57
|
creds.apiKey,
|
|
51
58
|
creds.appId,
|
|
52
|
-
{ host, kind: opts.kind, seconds },
|
|
53
|
-
fetchImpl
|
|
59
|
+
{ host, kind: opts.kind, seconds, runnerProtocol: RUNNER_PROTOCOL, hostKey: hostKey.hostKey },
|
|
60
|
+
fetchImpl,
|
|
61
|
+
void 0,
|
|
62
|
+
hostKey.signer
|
|
54
63
|
);
|
|
55
64
|
const output = opts.json ? JSON.stringify(data) : `claimed until ${String(data.expiresAt)}`;
|
|
56
65
|
if (!opts.quiet) process.stdout.write(output + "\n");
|
|
@@ -59,7 +68,7 @@ async function runWorkClaim(opts) {
|
|
|
59
68
|
async function runWorkRenew(opts) {
|
|
60
69
|
const cwd = opts.cwd ?? process.cwd();
|
|
61
70
|
const creds = resolveCredentials(opts);
|
|
62
|
-
const fetchImpl = opts.fetchImpl ??
|
|
71
|
+
const fetchImpl = opts.fetchImpl ?? defaultFetch;
|
|
63
72
|
const host = opts.host ?? hostname();
|
|
64
73
|
const seconds = parsePositiveInt(opts.seconds, "--seconds") ?? DEFAULT_LEASE_SECONDS;
|
|
65
74
|
const itemId = await resolveItemIdentifier(opts, creds, cwd, fetchImpl);
|
|
@@ -69,7 +78,9 @@ async function runWorkRenew(opts) {
|
|
|
69
78
|
creds.apiKey,
|
|
70
79
|
creds.appId,
|
|
71
80
|
{ host, seconds },
|
|
72
|
-
fetchImpl
|
|
81
|
+
fetchImpl,
|
|
82
|
+
void 0,
|
|
83
|
+
(await hostKeyFor(opts)).signer
|
|
73
84
|
);
|
|
74
85
|
const output = opts.json ? JSON.stringify(data) : `claimed until ${String(data.expiresAt)}`;
|
|
75
86
|
if (!opts.quiet) process.stdout.write(output + "\n");
|
|
@@ -78,7 +89,7 @@ async function runWorkRenew(opts) {
|
|
|
78
89
|
async function runWorkRelease(opts) {
|
|
79
90
|
const cwd = opts.cwd ?? process.cwd();
|
|
80
91
|
const creds = resolveCredentials(opts);
|
|
81
|
-
const fetchImpl = opts.fetchImpl ??
|
|
92
|
+
const fetchImpl = opts.fetchImpl ?? defaultFetch;
|
|
82
93
|
if (opts.outcome !== void 0 && !CLAIM_OUTCOMES.includes(opts.outcome)) {
|
|
83
94
|
throw new WorkCommandError(`--outcome must be one of: ${CLAIM_OUTCOMES.join(", ")}`);
|
|
84
95
|
}
|
|
@@ -90,7 +101,9 @@ async function runWorkRelease(opts) {
|
|
|
90
101
|
creds.apiKey,
|
|
91
102
|
creds.appId,
|
|
92
103
|
opts.outcome === void 0 ? { host } : { host, outcome: opts.outcome },
|
|
93
|
-
fetchImpl
|
|
104
|
+
fetchImpl,
|
|
105
|
+
void 0,
|
|
106
|
+
(await hostKeyFor(opts)).signer
|
|
94
107
|
);
|
|
95
108
|
const output = opts.json ? JSON.stringify(data) : `released at ${String(data.releasedAt)}`;
|
|
96
109
|
if (!opts.quiet) process.stdout.write(output + "\n");
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
|
+
export { WorkCommandError, findLiveItem, getJson, parsePositiveInt, postJson, resolveCredentials, resolveRepository, runWorkBuild, runWorkLinkSession, runWorkList, runWorkRemove, runWorkStatus } from './chunk-5DLBAXY5.js';
|
|
4
|
+
import './chunk-BFESLKPP.js';
|
|
5
|
+
import './chunk-6Y63SXFO.js';
|
|
6
|
+
import './chunk-G7FSV7JX.js';
|
|
7
|
+
import './chunk-WZBHBH3J.js';
|
|
8
|
+
import './chunk-BCLJSQCV.js';
|
|
9
|
+
import './chunk-BOLTI6LR.js';
|
|
10
|
+
import './chunk-EABW6AJQ.js';
|
|
11
|
+
import './chunk-M5POMKKW.js';
|
|
12
|
+
import './chunk-ZM2IMMYN.js';
|
|
13
|
+
import './chunk-BJ3KTMDH.js';
|
|
14
|
+
import './chunk-VNVZDWO3.js';
|
|
15
|
+
import './chunk-Z5GEFMRW.js';
|
|
16
|
+
|
|
17
|
+
createRequire(import.meta.url);
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
|
+
import { resolveCredentials, postJson, getJson } from './chunk-5DLBAXY5.js';
|
|
4
|
+
import { detectActiveSession } from './chunk-BFESLKPP.js';
|
|
5
|
+
import { sanitizeTerminal } from './chunk-6Y63SXFO.js';
|
|
6
|
+
import { resolveRepoIdentity } from './chunk-G7FSV7JX.js';
|
|
7
|
+
import { parseTrackerNumber, trackerNumberError } from './chunk-WZBHBH3J.js';
|
|
8
|
+
import { defaultFetch } from './chunk-BCLJSQCV.js';
|
|
9
|
+
import './chunk-BOLTI6LR.js';
|
|
10
|
+
import './chunk-EABW6AJQ.js';
|
|
11
|
+
import './chunk-M5POMKKW.js';
|
|
12
|
+
import './chunk-ZM2IMMYN.js';
|
|
13
|
+
import './chunk-BJ3KTMDH.js';
|
|
14
|
+
import { homeFromEnv } from './chunk-VNVZDWO3.js';
|
|
15
|
+
import './chunk-Z5GEFMRW.js';
|
|
16
|
+
import { randomUUID } from 'crypto';
|
|
17
|
+
|
|
18
|
+
createRequire(import.meta.url);
|
|
19
|
+
var GREEN = "\x1B[32m";
|
|
20
|
+
var DIM = "\x1B[2m";
|
|
21
|
+
var RESET = "\x1B[0m";
|
|
22
|
+
var WorkCommentCommandError = class extends Error {
|
|
23
|
+
};
|
|
24
|
+
function resolveAction(opts) {
|
|
25
|
+
const set = ["pass", "fail", "attach", "ready"].filter((flag) => opts[flag] === true);
|
|
26
|
+
if (set.length > 1) {
|
|
27
|
+
throw new WorkCommentCommandError(`only one of --${set.join(", --")} may be given \u2014 a comment carries at most one action`);
|
|
28
|
+
}
|
|
29
|
+
return set[0];
|
|
30
|
+
}
|
|
31
|
+
async function runWorkComment(opts) {
|
|
32
|
+
const cwd = opts.cwd ?? process.cwd();
|
|
33
|
+
const home = opts.home ?? homeFromEnv();
|
|
34
|
+
const env = opts.env ?? process.env;
|
|
35
|
+
const now = opts.now ?? (() => /* @__PURE__ */ new Date());
|
|
36
|
+
const itemNumber = parseTrackerNumber(opts.item);
|
|
37
|
+
if (itemNumber === void 0) {
|
|
38
|
+
throw new WorkCommentCommandError(trackerNumberError("--item", opts.item ?? ""));
|
|
39
|
+
}
|
|
40
|
+
const action = resolveAction(opts);
|
|
41
|
+
if (action === "attach" && !opts.artifact) {
|
|
42
|
+
throw new WorkCommentCommandError("--attach needs --artifact <id>, naming the artifact that becomes the criterion's proof");
|
|
43
|
+
}
|
|
44
|
+
if (action === "attach" && !opts.criterion) {
|
|
45
|
+
throw new WorkCommentCommandError("--attach needs --criterion <id> \u2014 it names which criterion the artifact becomes proof for");
|
|
46
|
+
}
|
|
47
|
+
const identity = resolveRepoIdentity(cwd);
|
|
48
|
+
const sessionId = opts.sessionId ?? detectActiveSession({
|
|
49
|
+
env,
|
|
50
|
+
home,
|
|
51
|
+
cwds: identity.repoRoot !== void 0 ? [identity.repoRoot, cwd] : [cwd],
|
|
52
|
+
nowMs: now().getTime()
|
|
53
|
+
});
|
|
54
|
+
const creds = resolveCredentials({ ...opts, cwd, home, env });
|
|
55
|
+
const comment = {
|
|
56
|
+
clientCommentId: randomUUID(),
|
|
57
|
+
body: opts.body ?? "",
|
|
58
|
+
...opts.criterion !== void 0 ? { criterion: opts.criterion } : {},
|
|
59
|
+
...action !== void 0 ? { action } : {},
|
|
60
|
+
...opts.artifact !== void 0 ? { artifact: opts.artifact } : {},
|
|
61
|
+
...sessionId !== void 0 ? { sessionId } : {}
|
|
62
|
+
};
|
|
63
|
+
const fetchImpl = opts.fetchImpl ?? defaultFetch;
|
|
64
|
+
const { data } = await postJson(
|
|
65
|
+
creds.url,
|
|
66
|
+
`/v1/work-items/${itemNumber}/comments`,
|
|
67
|
+
creds.apiKey,
|
|
68
|
+
creds.appId,
|
|
69
|
+
{ schemaVersion: 1, comment },
|
|
70
|
+
fetchImpl
|
|
71
|
+
);
|
|
72
|
+
const thread = data.thread;
|
|
73
|
+
const waitingOn = thread?.waitingOn ?? null;
|
|
74
|
+
const criterionLabel = opts.criterion ? `criterion ${opts.criterion}` : "the general thread";
|
|
75
|
+
const output = opts.json ? JSON.stringify(data) : `${GREEN}\u2713${RESET} commented on ${criterionLabel} of item #${itemNumber} ${DIM}\xB7${RESET} waiting on ${waitingOn ?? "no one"}`;
|
|
76
|
+
if (!opts.quiet) process.stdout.write(output + "\n");
|
|
77
|
+
return { data, output };
|
|
78
|
+
}
|
|
79
|
+
async function runWorkThreads(opts) {
|
|
80
|
+
const itemNumber = parseTrackerNumber(opts.item);
|
|
81
|
+
if (itemNumber === void 0) {
|
|
82
|
+
throw new WorkCommentCommandError(trackerNumberError("--item", opts.item ?? ""));
|
|
83
|
+
}
|
|
84
|
+
const creds = resolveCredentials(opts);
|
|
85
|
+
const fetchImpl = opts.fetchImpl ?? defaultFetch;
|
|
86
|
+
const { data } = await getJson(creds.url, `/v1/work-items/${itemNumber}/threads`, creds.apiKey, creds.appId, fetchImpl);
|
|
87
|
+
if (opts.json) {
|
|
88
|
+
const output2 = JSON.stringify(data);
|
|
89
|
+
if (!opts.quiet) process.stdout.write(output2 + "\n");
|
|
90
|
+
return { data, output: output2 };
|
|
91
|
+
}
|
|
92
|
+
const page = data;
|
|
93
|
+
const lines = [renderThread("general", page.general), ...page.criteria.map((t) => renderThread(t.criterion ?? "", t))];
|
|
94
|
+
const output = lines.join("\n");
|
|
95
|
+
if (!opts.quiet) process.stdout.write(output + "\n");
|
|
96
|
+
return { data, output };
|
|
97
|
+
}
|
|
98
|
+
function renderThread(label, thread) {
|
|
99
|
+
const header = `${DIM}${label === "general" ? "general" : `criterion ${label}`} \xB7 waiting on ${thread.waitingOn ?? "no one"}${RESET}`;
|
|
100
|
+
const comments = thread.comments.map(
|
|
101
|
+
(c) => ` ${c.author.kind === "person" ? "person" : "agent"} ${sanitizeTerminal(c.author.name)}: ${sanitizeTerminal(c.body)}${c.action ? ` (${c.action})` : ""}`
|
|
102
|
+
);
|
|
103
|
+
return [header, ...comments].join("\n");
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export { WorkCommentCommandError, runWorkComment, runWorkThreads };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
export { appendLaunchRecord, launchStatusIsDecisive, launchedItemForSession, launchesPath, parseWorkItemEnv, readLaunchSpoolState } from './chunk-
|
|
3
|
+
export { appendLaunchRecord, launchStatusIsDecisive, launchedItemForSession, launchedItemsBySession, launchesPath, parseWorkItemEnv, readLaunchSpoolState } from './chunk-DVDEBNQJ.js';
|
|
4
4
|
import './chunk-WZBHBH3J.js';
|
|
5
5
|
import './chunk-Z5GEFMRW.js';
|
|
6
6
|
|