@outerlayer/cli 0.9.0 → 0.10.1
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 +12 -0
- package/README.md +5 -3
- package/dist/build-info.json +1 -1
- package/dist/{builder-5DKTBWT3.js → builder-EVO6F2NO.js} +2 -2
- package/dist/{check-VJRJ2KQ4.js → check-RBRRI77E.js} +15 -15
- package/dist/{chunk-QPPPUKQJ.js → chunk-472KC6JV.js} +1 -1
- package/dist/{chunk-YCPV7FN6.js → chunk-4AVAETSU.js} +8 -8
- package/dist/{chunk-LBU4CLK5.js → chunk-BREEX2Z7.js} +4 -4
- package/dist/{chunk-KWCJLAHQ.js → chunk-DTDZXDQ3.js} +3 -3
- package/dist/{chunk-XGCJNSI7.js → chunk-ESZJ5QIC.js} +4 -4
- package/dist/{chunk-VMK7I3TB.js → chunk-HKUH5AR2.js} +2 -2
- package/dist/chunk-I263FZ3A.js +178 -0
- package/dist/{chunk-LTJPX7TX.js → chunk-IU4NZROR.js} +249 -18
- package/dist/{chunk-TV36SKEN.js → chunk-JSUUXA5W.js} +1 -1
- package/dist/{chunk-OSKO3PAL.js → chunk-KZ5M4QOB.js} +7 -7
- package/dist/{chunk-WJBJY5DQ.js → chunk-MC6J453K.js} +2 -2
- package/dist/{chunk-XZNO4QED.js → chunk-R2UYH4QV.js} +5 -5
- package/dist/{chunk-LYESSQUA.js → chunk-UES67HLJ.js} +2 -2
- package/dist/{chunk-ZEQMTBRD.js → chunk-VDI5POCC.js} +80 -2
- package/dist/{chunk-FKFGQJNN.js → chunk-VVIRHTH4.js} +1 -1
- package/dist/{chunk-543OT6V5.js → chunk-Y6P5XX2B.js} +25 -7
- package/dist/{chunk-KPUJGBA4.js → chunk-ZQ5JGHUO.js} +2 -2
- package/dist/{cli-7RQYILJT.js → cli-G6TH4YMK.js} +49 -49
- package/dist/{command-2LYWVGIK.js → command-LNEFKIVC.js} +9 -9
- package/dist/{connect-cmd-MPZWSEKY.js → connect-cmd-5MIUNYAY.js} +3 -3
- package/dist/{dist-QY5CL5LB.js → dist-3M3ZMEZF.js} +1 -1
- package/dist/{docker-V7B6UKPF.js → docker-GM526LGX.js} +3 -3
- package/dist/{doctor-PUAL5LTL.js → doctor-QSV4DYT2.js} +11 -11
- package/dist/{emit-artifact-cmd-P3IWNSQY.js → emit-artifact-cmd-VKPW577P.js} +5 -5
- package/dist/{emit-criteria-cmd-GOSP6X74.js → emit-criteria-cmd-U2TL6FYY.js} +4 -4
- package/dist/{emit-finding-cmd-D554IQKU.js → emit-finding-cmd-TMOOKHPD.js} +4 -4
- package/dist/{emit-result-cmd-QACXTIBV.js → emit-result-cmd-GKBVPMU4.js} +5 -5
- package/dist/index.js +1 -1
- package/dist/{init-TMBE3BRN.js → init-OKCDXEOG.js} +10 -10
- package/dist/{init-WX5XE6L3.js → init-ORDCPTFD.js} +10 -10
- package/dist/{init-cmd-4FQKQLJ5.js → init-cmd-5TEM2QNH.js} +6 -6
- package/dist/{loop-QLL4DKRF.js → loop-ZNUQT736.js} +15 -15
- package/dist/{machine-7T7FBSUL.js → machine-TBJKZ6TN.js} +9 -9
- package/dist/{session-sender-HVWTYG35.js → session-sender-E3UHGSNV.js} +4 -4
- package/dist/{status-SMF5JG2K.js → status-KPDVZMJ6.js} +11 -11
- package/dist/{sync-cmd-SLMPCUXO.js → sync-cmd-ULKXCHO2.js} +3 -3
- package/dist/{watch-TLM5QN5X.js → watch-IU6NHB4K.js} +3 -3
- package/dist/{work-claim-cmd-VSSZDFY5.js → work-claim-cmd-DYD6II56.js} +6 -6
- package/dist/{work-cmd-TK4VOOHL.js → work-cmd-ZJY3NA2G.js} +5 -5
- package/dist/{work-comment-cmd-VQCG72ZQ.js → work-comment-cmd-34FTLPUO.js} +5 -5
- package/dist/{work-open-pr-cmd-ZYOC5SPB.js → work-open-pr-cmd-N2RBDKZ4.js} +16 -8
- package/dist/{work-pr-cmd-MX6UO5GO.js → work-pr-cmd-EXTOGBJC.js} +6 -5
- package/package.json +1 -1
- package/dist/chunk-5MF73XCV.js +0 -103
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @outerlayer/cli
|
|
2
2
|
|
|
3
|
+
## 0.10.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 92fa05e: `outerlayer sync` no longer drops freshly emitted artifacts as "blob missing from the spool" when another sync runs at the same time. Syncs now take turns on the artifact spool and re-read it before uploading, so a record another sync already handled is left alone. When a blob really is missing, the warning names the artifact id and the file it looked for.
|
|
8
|
+
|
|
9
|
+
## 0.10.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 60067bc: `outerlayer work pr` and `outerlayer work open-pr` now declare a pull request onto the work item named by `OUTERLAYER_WORK`, and refuse when the session is not on that item. The message names both item numbers and `--session-id`. A successful declaration prints the item's number and title. `outerlayer work pr <n> --withdraw --item <number>` removes a wrong declaration.
|
|
14
|
+
|
|
3
15
|
## 0.9.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -74,8 +74,10 @@ content:
|
|
|
74
74
|
hook spawns `outerlayer work link-session` when you launch a session with
|
|
75
75
|
`OUTERLAYER_WORK`, naming the item and the session id — the item itself
|
|
76
76
|
must already exist, created ahead of time with `outerlayer work build --local`.
|
|
77
|
-
`outerlayer work pr` sends the session id
|
|
78
|
-
repository — never the session's
|
|
77
|
+
`outerlayer work pr` sends the session id, the `OUTERLAYER_WORK` item
|
|
78
|
+
number and the pull request number and repository — never the session's
|
|
79
|
+
own content. With `--withdraw` it sends a DELETE naming the item, the
|
|
80
|
+
repository and the pull request number. `outerlayer work open-pr`
|
|
79
81
|
sends the pull request's title and the text of the body file you name. In a
|
|
80
82
|
host build, which holds an item key, it goes to the gateway, which opens or
|
|
81
83
|
edits the pull request as the factory's GitHub App on the branch the claim
|
|
@@ -375,7 +377,7 @@ before it gives up.
|
|
|
375
377
|
| `outerlayer work remove --issue <n>\|--pr <n> --reason <text> [--repo]` | Withdraws the caller's own addition, recording the reason. Never deletes anything; the item leaves the Work page only once no live addition remains on it. Removing again is a no-op that still succeeds. |
|
|
376
378
|
| `outerlayer work status --issue <n>\|--pr <n> [--repo]` | Shows one item's stage, section, gate ledger, linked pull requests and sessions, and its additions. |
|
|
377
379
|
| `outerlayer work list [--stage] [--section] [--repo] [--claimed] [--unclaimed] [--startable] [--needs amend]` | Lists live work items for the current factory, filterable by stage, section, claim state, startability and whether a comment thread is waiting on an agent. |
|
|
378
|
-
| `outerlayer work pr <n> [--repo] [--session-id]` | Run inside a session on a work item: declares that pull request `<n>` in the checkout's repository belongs to
|
|
380
|
+
| `outerlayer work pr <n> [--repo] [--session-id] [--withdraw --item <number>]` | Run inside a session on a work item: declares that pull request `<n>` in the checkout's repository belongs to the `OUTERLAYER_WORK` item. Idempotent — declaring the same pull request twice is a no-op. Refuses when the session is not on that item, or the repository is not connected. `--withdraw --item <number>` removes that item's declaration; it needs your own login. |
|
|
379
381
|
| `outerlayer work open-pr --title <text> --body-file <path> [--repo] [--session-id] [--json]` | Opens the pull request for the work item this session is on, or edits the one already open on its branch. A host build, which holds an item key, sends it to the gateway, which opens it as the factory's GitHub App from the branch the claim named; no `gh` command runs. Your own session runs `gh pr create` or `gh pr edit` under your login and then declares the pull request on the item. Run it again after changing the title or description. |
|
|
380
382
|
| `outerlayer work claim --item <n>\|--issue <n> --kind implement\|amend [--repo] [--host] [--seconds]` | Records a lease for this host (default: its own hostname), so two hosts never build the same item at once. The lease belongs to the runner key that claimed it: a live lease held by a different key is refused, even under the same host name, and claiming again with the same key extends it. The first claim creates the host key (`host-key.pem` beside the config file) and binds the runner key to it; from then on every request made with that key is signed. Lease length defaults to 900 seconds, the server's own cap. |
|
|
381
383
|
| `outerlayer work renew --item <n>\|--issue <n> [--repo] [--host] [--seconds]` | Extends this host's own live lease. Refused if the lease has expired, or if a different runner key holds it (403 `claim_not_held`). |
|
package/dist/build-info.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"id":"2026-10-
|
|
1
|
+
{"id":"2026-10-07T13:16:15.617Z+e27c8d7","root":"/home/runner/_work/outerlayer/outerlayer","pkg":"outerlayer"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
export { MIN_BUILDX_VERSION, builderName, builderSpec, buildxState, ensureBuilder, ensureFailureCount, isOutOfMemory, proxyEnvironment, trackImageBuild } from './chunk-
|
|
3
|
+
export { MIN_BUILDX_VERSION, builderName, builderSpec, buildxState, ensureBuilder, ensureFailureCount, isOutOfMemory, proxyEnvironment, trackImageBuild } from './chunk-JSUUXA5W.js';
|
|
4
4
|
import './chunk-CX22S5BA.js';
|
|
5
|
-
import './chunk-
|
|
5
|
+
import './chunk-IU4NZROR.js';
|
|
6
6
|
import './chunk-7RQ73DLO.js';
|
|
7
7
|
import './chunk-M6G7TJVF.js';
|
|
8
8
|
import './chunk-YT35WGIP.js';
|
|
@@ -1,43 +1,43 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { probeCredentials } from './chunk-
|
|
3
|
+
import { probeCredentials } from './chunk-4AVAETSU.js';
|
|
4
4
|
import './chunk-3JVYMD4G.js';
|
|
5
5
|
import './chunk-I2UOAV7X.js';
|
|
6
6
|
import './chunk-ABIWDUMS.js';
|
|
7
|
-
import './chunk-
|
|
7
|
+
import './chunk-KZ5M4QOB.js';
|
|
8
8
|
import './chunk-T6OIJQRT.js';
|
|
9
9
|
import './chunk-PDTSUOVT.js';
|
|
10
10
|
import './chunk-UGP76IZ5.js';
|
|
11
|
-
import './chunk-
|
|
11
|
+
import './chunk-HKUH5AR2.js';
|
|
12
12
|
import './chunk-V42JY4F6.js';
|
|
13
|
-
import './chunk-
|
|
13
|
+
import './chunk-Y6P5XX2B.js';
|
|
14
14
|
import './chunk-HHJDN6AU.js';
|
|
15
|
-
import { placeholderQueues, placeholderProblem, permissionModeProblems, permissionModeProblem, needsClaudeCredential, claudeCredentialCheck, claimPermissionProblem } from './chunk-
|
|
15
|
+
import { placeholderQueues, placeholderProblem, permissionModeProblems, permissionModeProblem, needsClaudeCredential, claudeCredentialCheck, claimPermissionProblem } from './chunk-ESZJ5QIC.js';
|
|
16
16
|
import './chunk-TI7B7UEO.js';
|
|
17
17
|
import './chunk-YYYRBYWG.js';
|
|
18
18
|
import './chunk-TBT347UY.js';
|
|
19
|
-
import './chunk-
|
|
20
|
-
import './chunk-
|
|
21
|
-
import './chunk-
|
|
19
|
+
import './chunk-MC6J453K.js';
|
|
20
|
+
import './chunk-472KC6JV.js';
|
|
21
|
+
import './chunk-BREEX2Z7.js';
|
|
22
22
|
import { parseRunnerEnv } from './chunk-6MZSX4M7.js';
|
|
23
23
|
import './chunk-JKIWMRFH.js';
|
|
24
24
|
import './chunk-3FMPZPJQ.js';
|
|
25
25
|
import './chunk-N5FOE5PS.js';
|
|
26
26
|
import './chunk-OGFGZQA3.js';
|
|
27
|
-
import './chunk-
|
|
27
|
+
import './chunk-VVIRHTH4.js';
|
|
28
28
|
import './chunk-QOZKPLVJ.js';
|
|
29
|
-
import './chunk-
|
|
29
|
+
import './chunk-JSUUXA5W.js';
|
|
30
30
|
import './chunk-CX22S5BA.js';
|
|
31
31
|
import './chunk-6CXYORUS.js';
|
|
32
32
|
import './chunk-S6IUUNCD.js';
|
|
33
33
|
import './chunk-F7CU5ABH.js';
|
|
34
34
|
import './chunk-BKO6JEZI.js';
|
|
35
|
-
import './chunk-
|
|
36
|
-
import './chunk-
|
|
35
|
+
import './chunk-DTDZXDQ3.js';
|
|
36
|
+
import './chunk-ZQ5JGHUO.js';
|
|
37
37
|
import './chunk-BFESLKPP.js';
|
|
38
|
-
import './chunk-
|
|
39
|
-
import './chunk-
|
|
40
|
-
import './chunk-
|
|
38
|
+
import './chunk-UES67HLJ.js';
|
|
39
|
+
import './chunk-VDI5POCC.js';
|
|
40
|
+
import './chunk-IU4NZROR.js';
|
|
41
41
|
import './chunk-USO2DKBD.js';
|
|
42
42
|
import './chunk-N6LURUEF.js';
|
|
43
43
|
import './chunk-YRYMNBGQ.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { MIN_ENGINE_MAJOR } from './chunk-
|
|
3
|
+
import { MIN_ENGINE_MAJOR } from './chunk-BREEX2Z7.js';
|
|
4
4
|
import { firecrackerArch, MICROVM_ARCHES, guestAssetsPinned } from './chunk-CX22S5BA.js';
|
|
5
5
|
import { spawnSync } from 'child_process';
|
|
6
6
|
import { existsSync, accessSync, constants, statSync, readFileSync } from 'fs';
|
|
@@ -3,20 +3,20 @@ import { createRequire } from 'node:module';
|
|
|
3
3
|
import { decideInstalledSwitch } from './chunk-3JVYMD4G.js';
|
|
4
4
|
import { compareVersions, satisfiesRange } from './chunk-I2UOAV7X.js';
|
|
5
5
|
import { fetchVersionMeta, npmVersion, npmSupportsProvenance, fetchTarballDigest, fetchProvenance, installVersion, auditSignatures } from './chunk-ABIWDUMS.js';
|
|
6
|
-
import { LEASE_SECONDS, releaseLease, isUnfinished, setStage, jobEnv, runHook, describeHookEnd, provisionMicroVm, deliverCommitHooks, provisionProcess, provisionEnvironment, readProvisionOut, resolveHostBuild, workdirProblem, listenOnBroker, hostEnvironment, hostCommandEnvironment, execArgv, microVmCommandLine, runCommand, execCommandLine, startSender, startHostServices, finishJob, isGroupAlive, outcomeFromExitCode, isTimedOut, readCpuUsec, isIdle, stopOrphanedMicroVms, unfinishedJobs, listAdoptableJobs, retryFailedReleases, recoverLostJobs, hookLimitsFor, needsRenew, renewLease, RENEW_INTERVAL_SECONDS, ALREADY_RELEASED } from './chunk-
|
|
6
|
+
import { LEASE_SECONDS, releaseLease, isUnfinished, setStage, jobEnv, runHook, describeHookEnd, provisionMicroVm, deliverCommitHooks, provisionProcess, provisionEnvironment, readProvisionOut, resolveHostBuild, workdirProblem, listenOnBroker, hostEnvironment, hostCommandEnvironment, execArgv, microVmCommandLine, runCommand, execCommandLine, startSender, startHostServices, finishJob, isGroupAlive, outcomeFromExitCode, isTimedOut, readCpuUsec, isIdle, stopOrphanedMicroVms, unfinishedJobs, listAdoptableJobs, retryFailedReleases, recoverLostJobs, hookLimitsFor, needsRenew, renewLease, RENEW_INTERVAL_SECONDS, ALREADY_RELEASED } from './chunk-KZ5M4QOB.js';
|
|
7
7
|
import { writeJobFile, readJobFile, readJobFileChecked } from './chunk-T6OIJQRT.js';
|
|
8
8
|
import { RUNNER_PROTOCOL } from './chunk-PDTSUOVT.js';
|
|
9
9
|
import { readHousekeepingRecord, writeHousekeepingRecord } from './chunk-UGP76IZ5.js';
|
|
10
|
-
import { placeholderQueues, placeholderProblem } from './chunk-
|
|
10
|
+
import { placeholderQueues, placeholderProblem } from './chunk-ESZJ5QIC.js';
|
|
11
11
|
import { writeMarker, readMarker, currentVersion, removeMarker, entryIn, versionDir, startedThroughCurrent, switchCurrent, cleanVersions, isInLayout, stagingDir } from './chunk-TI7B7UEO.js';
|
|
12
12
|
import { freeBytes, formatBytes } from './chunk-YYYRBYWG.js';
|
|
13
13
|
import { RepoFilter } from './chunk-TBT347UY.js';
|
|
14
|
-
import { describeCallFailure, retrySend, shortClaim, relativeToRunner, formatDuration, provisionContainer, lifecycleSteps, lifecycleFailureReason, prepareBranch, containerCommandLine, BuildTokens, classifyRefusal, refusalCode, measureDisk, createRunnerLog, setUpRunnerCgroup, parseCpuList, ensureTunnel, keepGhConfigCurrent, createContainerRuntime, formatClock } from './chunk-
|
|
14
|
+
import { describeCallFailure, retrySend, shortClaim, relativeToRunner, formatDuration, provisionContainer, lifecycleSteps, lifecycleFailureReason, prepareBranch, containerCommandLine, BuildTokens, classifyRefusal, refusalCode, measureDisk, createRunnerLog, setUpRunnerCgroup, parseCpuList, ensureTunnel, keepGhConfigCurrent, createContainerRuntime, formatClock } from './chunk-BREEX2Z7.js';
|
|
15
15
|
import { checkFit } from './chunk-JKIWMRFH.js';
|
|
16
16
|
import { startTimeOf, claimPidFile, readPidFile, isSameProcess, releasePidFile } from './chunk-N5FOE5PS.js';
|
|
17
|
-
import { spawnRun } from './chunk-
|
|
18
|
-
import { builderName, runnerLabelValue, ensureFailureCount, builderSpec, ensureBuilder, BUILD_LABEL, RUNNER_LABEL } from './chunk-
|
|
19
|
-
import { isSignatureRefusal, WorkCommandError, getJson, postJson } from './chunk-
|
|
17
|
+
import { spawnRun } from './chunk-VVIRHTH4.js';
|
|
18
|
+
import { builderName, runnerLabelValue, ensureFailureCount, builderSpec, ensureBuilder, BUILD_LABEL, RUNNER_LABEL } from './chunk-JSUUXA5W.js';
|
|
19
|
+
import { isSignatureRefusal, WorkCommandError, getJson, postJson } from './chunk-DTDZXDQ3.js';
|
|
20
20
|
import { isBuiltinContainer, isBuiltinVm, isBuiltinProcess, loadRunnerConfig, checkHooks, builtinKind } from './chunk-M2PBLRB7.js';
|
|
21
21
|
import { exceedsDisk } from './chunk-7RQ73DLO.js';
|
|
22
22
|
import { sharedUserEnvironment, JOB_MOUNT, claudeCredential } from './chunk-M6G7TJVF.js';
|
|
@@ -1236,7 +1236,7 @@ var CLAIM_REFUSAL_CODES = new Set(
|
|
|
1236
1236
|
"pull_request_from_fork pull_request_on_default_branch pull_request_ambiguous branch_claimed_elsewhere".split(" ")
|
|
1237
1237
|
);
|
|
1238
1238
|
async function tryClaimAndStart(state, item, queue) {
|
|
1239
|
-
const { postJson: postJson2 } = await import('./work-cmd-
|
|
1239
|
+
const { postJson: postJson2 } = await import('./work-cmd-ZJY3NA2G.js');
|
|
1240
1240
|
const log = logOf(state);
|
|
1241
1241
|
const hostKey = await loadHostKey(state.config.configPath);
|
|
1242
1242
|
const claim = await retrySend(
|
|
@@ -1972,7 +1972,7 @@ async function start(configPath, deps = { fetchImpl: fetch }) {
|
|
|
1972
1972
|
const outcome = await onStartUnderMarker({
|
|
1973
1973
|
configPath,
|
|
1974
1974
|
own: ownVersionOf(deps),
|
|
1975
|
-
check: update.check ? () => update.check(configPath) : async () => (await import('./check-
|
|
1975
|
+
check: update.check ? () => update.check(configPath) : async () => (await import('./check-RBRRI77E.js')).runRunnerCheck(configPath, { fetchImpl: deps.fetchImpl }),
|
|
1976
1976
|
now: () => (deps.now ?? (() => /* @__PURE__ */ new Date()))().getTime(),
|
|
1977
1977
|
log
|
|
1978
1978
|
});
|
|
@@ -3,14 +3,14 @@ import { createRequire } from 'node:module';
|
|
|
3
3
|
import { readDefaultBranchHead, cloneRepository, buildRepositoryImage } from './chunk-3FMPZPJQ.js';
|
|
4
4
|
import { startTimeOf, isSameProcess } from './chunk-N5FOE5PS.js';
|
|
5
5
|
import { currentCliBuild } from './chunk-OGFGZQA3.js';
|
|
6
|
-
import { createDockerHost, childEnvironment, spawnRun } from './chunk-
|
|
6
|
+
import { createDockerHost, childEnvironment, spawnRun } from './chunk-VVIRHTH4.js';
|
|
7
7
|
import { RecipeError } from './chunk-QOZKPLVJ.js';
|
|
8
|
-
import { builderSpec, runnerLabelValue, RUNNER_LABEL, BUILD_LABEL, prepareRunArgs, containerRunArgs, containerExecArgs } from './chunk-
|
|
8
|
+
import { builderSpec, runnerLabelValue, RUNNER_LABEL, BUILD_LABEL, prepareRunArgs, containerRunArgs, containerExecArgs } from './chunk-JSUUXA5W.js';
|
|
9
9
|
import { CLAUDE_CODE_VERSION, firecrackerArch, MICROVM_ARCHES, DEFAULT_BASE_IMAGE, GUEST_HELPER_SHA256, GUEST_ASSETS_BASE_URL, GUEST_KERNEL_SHA256, FIRECRACKER_BINARY_SHA256, FIRECRACKER_SHA256, FIRECRACKER_VERSION, GUEST_ASSETS_VERSION } from './chunk-CX22S5BA.js';
|
|
10
10
|
import { execCapture } from './chunk-6CXYORUS.js';
|
|
11
11
|
import { GUEST_CID } from './chunk-S6IUUNCD.js';
|
|
12
|
-
import { WorkCommandError, postJson } from './chunk-
|
|
13
|
-
import { setCustomScrubbers, setLocalIdentity, setRepoRoot, parseTranscript, scrubDeep, scrubText } from './chunk-
|
|
12
|
+
import { WorkCommandError, postJson } from './chunk-DTDZXDQ3.js';
|
|
13
|
+
import { setCustomScrubbers, setLocalIdentity, setRepoRoot, parseTranscript, scrubDeep, scrubText } from './chunk-IU4NZROR.js';
|
|
14
14
|
import { hostAllowed } from './chunk-UXYLWVTQ.js';
|
|
15
15
|
import { parseDuKilobytes } from './chunk-7RQ73DLO.js';
|
|
16
16
|
import { RELAY_PORT, CHECKOUT_DIR, JOB_MOUNT, claudeCredential, buildEnvironment, startBuildServices, checkEnvironment, AGENT_CREDENTIAL_MISSING } from './chunk-M6G7TJVF.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { autoConnect } from './chunk-
|
|
3
|
+
import { autoConnect } from './chunk-ZQ5JGHUO.js';
|
|
4
4
|
import { detectActiveSession } from './chunk-BFESLKPP.js';
|
|
5
|
-
import { sanitizeTerminal } from './chunk-
|
|
6
|
-
import { resolveRepoIdentity } from './chunk-
|
|
5
|
+
import { sanitizeTerminal } from './chunk-VDI5POCC.js';
|
|
6
|
+
import { resolveRepoIdentity } from './chunk-IU4NZROR.js';
|
|
7
7
|
import { parseTrackerNumber, trackerNumberError } from './chunk-WZBHBH3J.js';
|
|
8
8
|
import { defaultFetch } from './chunk-YO4PSLVB.js';
|
|
9
9
|
import { resolveGatewayCredentials, unauthorizedMessage } from './chunk-PLMTLGYH.js';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { isPlaceholderCommand } from './chunk-
|
|
4
|
-
import { describeCallFailure } from './chunk-
|
|
5
|
-
import { WorkCommandError, getJson } from './chunk-
|
|
6
|
-
import { sanitizeTerminal } from './chunk-
|
|
3
|
+
import { isPlaceholderCommand } from './chunk-MC6J453K.js';
|
|
4
|
+
import { describeCallFailure } from './chunk-BREEX2Z7.js';
|
|
5
|
+
import { WorkCommandError, getJson } from './chunk-DTDZXDQ3.js';
|
|
6
|
+
import { sanitizeTerminal } from './chunk-VDI5POCC.js';
|
|
7
7
|
import { builtinKind } from './chunk-M2PBLRB7.js';
|
|
8
8
|
import { CLAUDE_CREDENTIAL_VARIABLES, claudeCredential } from './chunk-M6G7TJVF.js';
|
|
9
9
|
import { signerFor } from './chunk-V7NIVOFD.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { LiveUploader } from './chunk-
|
|
4
|
-
import { CaptureDaemon } from './chunk-
|
|
3
|
+
import { LiveUploader } from './chunk-Y6P5XX2B.js';
|
|
4
|
+
import { CaptureDaemon } from './chunk-IU4NZROR.js';
|
|
5
5
|
import { parseWorkItemEnv } from './chunk-GQD22KKN.js';
|
|
6
6
|
import { spoolDir } from './chunk-4HMXH2OA.js';
|
|
7
7
|
import { homeFromEnv } from './chunk-VNVZDWO3.js';
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
|
+
import { autoConnect } from './chunk-ZQ5JGHUO.js';
|
|
4
|
+
import { detectActiveSession } from './chunk-BFESLKPP.js';
|
|
5
|
+
import { resolveRepoIdentity } from './chunk-IU4NZROR.js';
|
|
6
|
+
import { parseWorkItemEnv } from './chunk-GQD22KKN.js';
|
|
7
|
+
import { parseTrackerNumber, trackerNumberError } from './chunk-WZBHBH3J.js';
|
|
8
|
+
import { defaultFetch } from './chunk-YO4PSLVB.js';
|
|
9
|
+
import { unauthorizedMessage, resolveGatewayCredentials } from './chunk-PLMTLGYH.js';
|
|
10
|
+
import { homeFromEnv } from './chunk-VNVZDWO3.js';
|
|
11
|
+
|
|
12
|
+
createRequire(import.meta.url);
|
|
13
|
+
|
|
14
|
+
// src/work-pr-cmd.ts
|
|
15
|
+
var GREEN = "\x1B[32m";
|
|
16
|
+
var DIM = "\x1B[2m";
|
|
17
|
+
var RESET = "\x1B[0m";
|
|
18
|
+
var WorkPrCommandError = class extends Error {
|
|
19
|
+
};
|
|
20
|
+
function resolveCredentials(opts) {
|
|
21
|
+
const resolved = resolveGatewayCredentials(opts);
|
|
22
|
+
if (!resolved.ok) throw new WorkPrCommandError(resolved.message);
|
|
23
|
+
return { url: resolved.url, apiKey: resolved.credential, appId: resolved.appId };
|
|
24
|
+
}
|
|
25
|
+
function resolveRepository(repoFlag, cwd) {
|
|
26
|
+
if (repoFlag) return repoFlag;
|
|
27
|
+
const identity = resolveRepoIdentity(cwd);
|
|
28
|
+
if (identity.gitRepo) return identity.gitRepo;
|
|
29
|
+
throw new WorkPrCommandError(
|
|
30
|
+
"no repository. Pass --repo <owner/name>, or run from a git checkout with a remote."
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
function resolvePrNumber(raw) {
|
|
34
|
+
const n = parseTrackerNumber(raw);
|
|
35
|
+
if (n === void 0) throw new WorkPrCommandError(trackerNumberError("<n>", raw ?? ""));
|
|
36
|
+
return n;
|
|
37
|
+
}
|
|
38
|
+
var SESSION_ID_HINT = "pass --session-id <id> to name the session that was launched on the item";
|
|
39
|
+
function sessionNotOnItemMessage(error, sessionId) {
|
|
40
|
+
const on = error.sessionItems;
|
|
41
|
+
const onText = on === void 0 ? "" : `; it is on ${on.length === 0 ? "no work item" : on.map((n) => `item ${n}`).join(", ")}`;
|
|
42
|
+
return `session ${sessionId} is not on item ${error.workItem ?? "?"} (OUTERLAYER_WORK)${onText}. Nothing was declared. If another session was launched for item ${error.workItem ?? "?"}, ${SESSION_ID_HINT}.`;
|
|
43
|
+
}
|
|
44
|
+
function itemLabel(data) {
|
|
45
|
+
if (data.workItemNumber == null) return data.workItemId;
|
|
46
|
+
return data.workItemTitle ? `item ${data.workItemNumber} ${DIM}\xB7${RESET} ${data.workItemTitle}` : `item ${data.workItemNumber}`;
|
|
47
|
+
}
|
|
48
|
+
async function runWorkPrWithdraw(opts, ctx) {
|
|
49
|
+
const itemNumber = parseTrackerNumber(opts.item);
|
|
50
|
+
if (itemNumber === void 0) {
|
|
51
|
+
throw new WorkPrCommandError("--withdraw needs --item <number>, the item to remove the declaration from.");
|
|
52
|
+
}
|
|
53
|
+
const { creds, prNumber, repository, sessionId } = ctx;
|
|
54
|
+
const fetchImpl = opts.fetchImpl ?? defaultFetch;
|
|
55
|
+
const query = sessionId === void 0 ? "" : `?sessionId=${encodeURIComponent(sessionId)}`;
|
|
56
|
+
const endpoint = new URL(
|
|
57
|
+
`/v1/work-items/${itemNumber}/pull-requests/${encodeURIComponent(repository)}/${prNumber}${query}`,
|
|
58
|
+
creds.url
|
|
59
|
+
).toString();
|
|
60
|
+
let response;
|
|
61
|
+
try {
|
|
62
|
+
response = await fetchImpl(endpoint, {
|
|
63
|
+
method: "DELETE",
|
|
64
|
+
headers: { authorization: `Bearer ${creds.apiKey}`, "x-outerlayer-app-id": creds.appId }
|
|
65
|
+
});
|
|
66
|
+
} catch (err) {
|
|
67
|
+
throw new WorkPrCommandError(`network error reaching ${endpoint}: ${String(err)}`);
|
|
68
|
+
}
|
|
69
|
+
if (response.status === 401) throw new WorkPrCommandError(unauthorizedMessage(creds.apiKey));
|
|
70
|
+
let json;
|
|
71
|
+
try {
|
|
72
|
+
json = await response.json();
|
|
73
|
+
} catch {
|
|
74
|
+
throw new WorkPrCommandError(
|
|
75
|
+
`${endpoint} answered ${response.status} with a body that is not JSON \u2014 the request may not have reached the gateway`
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
if (!response.ok || !json.data) {
|
|
79
|
+
if (json.error?.code === "withdraw_needs_person") {
|
|
80
|
+
throw new WorkPrCommandError("only a person can withdraw a declaration; run this from your own login, not an agent session or a factory key.");
|
|
81
|
+
}
|
|
82
|
+
if (json.error?.code === "declaration_not_found") {
|
|
83
|
+
throw new WorkPrCommandError(`item ${itemNumber} has no declaration of ${repository}#${prNumber}.`);
|
|
84
|
+
}
|
|
85
|
+
if (json.error?.code === "work_item_not_found") {
|
|
86
|
+
throw new WorkPrCommandError(`item ${itemNumber} does not exist in this factory.`);
|
|
87
|
+
}
|
|
88
|
+
throw new WorkPrCommandError(json.error?.message ?? `request failed (${response.status})`);
|
|
89
|
+
}
|
|
90
|
+
const data = json.data;
|
|
91
|
+
const output = opts.json ? JSON.stringify(data) : `${GREEN}\u2713${RESET} withdrawn ${DIM}\xB7${RESET} ${data.repository}#${data.prNumber} ${DIM}from${RESET} item ${itemNumber}`;
|
|
92
|
+
if (!opts.quiet) process.stdout.write(output + "\n");
|
|
93
|
+
return { data, output };
|
|
94
|
+
}
|
|
95
|
+
async function runWorkPr(opts) {
|
|
96
|
+
const cwd = opts.cwd ?? process.cwd();
|
|
97
|
+
const env = opts.env ?? process.env;
|
|
98
|
+
const home = opts.home ?? homeFromEnv(env);
|
|
99
|
+
const refusal = await autoConnect({ ...opts, repository: opts.repo });
|
|
100
|
+
if (refusal !== void 0) throw new WorkPrCommandError(refusal);
|
|
101
|
+
const creds = resolveCredentials(opts);
|
|
102
|
+
const prNumber = resolvePrNumber(opts.number);
|
|
103
|
+
const repository = resolveRepository(opts.repo, cwd);
|
|
104
|
+
const identity = resolveRepoIdentity(cwd);
|
|
105
|
+
const sessionId = opts.sessionId ?? detectActiveSession({
|
|
106
|
+
env,
|
|
107
|
+
home,
|
|
108
|
+
cwds: identity.repoRoot !== void 0 ? [identity.repoRoot, cwd] : [cwd],
|
|
109
|
+
nowMs: Date.now()
|
|
110
|
+
});
|
|
111
|
+
if (opts.withdraw) return runWorkPrWithdraw(opts, { creds, prNumber, repository, sessionId });
|
|
112
|
+
let workItem;
|
|
113
|
+
if (env.OUTERLAYER_WORK !== void 0) {
|
|
114
|
+
const parsed = parseWorkItemEnv(env.OUTERLAYER_WORK);
|
|
115
|
+
if (!("number" in parsed)) throw new WorkPrCommandError(parsed.reason);
|
|
116
|
+
workItem = parsed.number;
|
|
117
|
+
}
|
|
118
|
+
if (sessionId === void 0) {
|
|
119
|
+
throw new WorkPrCommandError(
|
|
120
|
+
`no active session detected. \`work pr\` declares a pull request from inside the session that opened it, or ${SESSION_ID_HINT}.`
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
const fetchImpl = opts.fetchImpl ?? defaultFetch;
|
|
124
|
+
const headers = {
|
|
125
|
+
"content-type": "application/json",
|
|
126
|
+
authorization: `Bearer ${creds.apiKey}`,
|
|
127
|
+
"x-outerlayer-app-id": creds.appId
|
|
128
|
+
};
|
|
129
|
+
const endpoint = new URL("/v1/work-items/pull-requests", creds.url).toString();
|
|
130
|
+
let response;
|
|
131
|
+
try {
|
|
132
|
+
response = await fetchImpl(endpoint, {
|
|
133
|
+
method: "POST",
|
|
134
|
+
headers,
|
|
135
|
+
body: JSON.stringify({
|
|
136
|
+
sessionId,
|
|
137
|
+
workItem,
|
|
138
|
+
// JSON.stringify omits it when undefined
|
|
139
|
+
pullRequest: { repository, number: prNumber }
|
|
140
|
+
})
|
|
141
|
+
});
|
|
142
|
+
} catch (err) {
|
|
143
|
+
throw new WorkPrCommandError(`network error reaching ${endpoint}: ${String(err)}`);
|
|
144
|
+
}
|
|
145
|
+
if (response.status === 401) {
|
|
146
|
+
throw new WorkPrCommandError(
|
|
147
|
+
unauthorizedMessage(creds.apiKey)
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
let json;
|
|
151
|
+
try {
|
|
152
|
+
json = await response.json();
|
|
153
|
+
} catch {
|
|
154
|
+
throw new WorkPrCommandError(
|
|
155
|
+
`${endpoint} answered ${response.status} with a body that is not JSON \u2014 the request may not have reached the gateway`
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
if (!response.ok || !json.data) {
|
|
159
|
+
if (json.error?.code === "session_not_on_item") {
|
|
160
|
+
if (response.status === 409) throw new WorkPrCommandError(sessionNotOnItemMessage(json.error, sessionId));
|
|
161
|
+
throw new WorkPrCommandError("this session is not launched on a work item.");
|
|
162
|
+
}
|
|
163
|
+
if (json.error?.code === "work_item_not_found" && workItem !== void 0) {
|
|
164
|
+
throw new WorkPrCommandError(`OUTERLAYER_WORK names item ${workItem}, which does not exist in this factory.`);
|
|
165
|
+
}
|
|
166
|
+
if (json.error?.code === "repository_not_connected") {
|
|
167
|
+
throw new WorkPrCommandError(`${repository} is not a workpiece of this factory.`);
|
|
168
|
+
}
|
|
169
|
+
throw new WorkPrCommandError(json.error?.message ?? `request failed (${response.status})`);
|
|
170
|
+
}
|
|
171
|
+
const data = json.data;
|
|
172
|
+
const verb = data.created ? "declared" : "already declared";
|
|
173
|
+
const output = opts.json ? JSON.stringify(data) : `${GREEN}\u2713${RESET} ${verb} ${DIM}\xB7${RESET} ${data.repository}#${data.prNumber} ${DIM}\u2192${RESET} ${itemLabel(data)}`;
|
|
174
|
+
if (!opts.quiet) process.stdout.write(output + "\n");
|
|
175
|
+
return { data, output };
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export { WorkPrCommandError, itemLabel, runWorkPr };
|