@outerlayer/cli 0.40.0-next.20261115191619 → 0.40.0-next.20261116010428
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 +8 -0
- package/dist/{agent-setup-URENTDUL.js → agent-setup-KUOWKHAG.js} +3 -3
- package/dist/{build-EORAZMYD.js → build-3BX3EJC3.js} +1 -1
- package/dist/build-info.json +1 -1
- package/dist/{check-BEXALLQK.js → check-CDO3XBCB.js} +17 -17
- package/dist/{chunk-3M2CYL3D.js → chunk-2HFE6POD.js} +1 -1
- package/dist/{chunk-UOP4OSVB.js → chunk-2YKSBXWU.js} +1 -1
- package/dist/{chunk-LHL666SD.js → chunk-4SAXGCD2.js} +2 -2
- package/dist/{chunk-B3GYDE4G.js → chunk-6PON5OB7.js} +16 -16
- package/dist/{chunk-F7AOOV5N.js → chunk-BAPRSDUR.js} +2 -2
- package/dist/{chunk-AFMLQMC3.js → chunk-CPE4SWRZ.js} +2 -2
- package/dist/{chunk-HJFTCOU5.js → chunk-DEPV3XZE.js} +3 -3
- package/dist/{chunk-4TVL4E53.js → chunk-DHB3M244.js} +88 -16
- package/dist/{chunk-VQ57S72O.js → chunk-EGYZGB2P.js} +1 -1
- package/dist/{chunk-XTUTQVBU.js → chunk-EVMSDUK7.js} +2 -2
- package/dist/{chunk-NFD6N7YJ.js → chunk-G5TK5XLA.js} +13 -11
- package/dist/{chunk-4KCQHUUH.js → chunk-GJCC6GXH.js} +1 -1
- package/dist/{chunk-L6B4O4UB.js → chunk-GODZ6QAN.js} +1 -1
- package/dist/{init-cmd-CKX3IZWR.js → chunk-HQIGQL6W.js} +2 -44
- package/dist/{chunk-5EU2V6W2.js → chunk-ICY3T4MI.js} +4 -4
- package/dist/{chunk-IGVOCKAC.js → chunk-IQWBUZ75.js} +23 -2
- package/dist/{chunk-R34OLRY7.js → chunk-LCZGMJXD.js} +1 -1
- package/dist/{chunk-5EQ2B6UE.js → chunk-QFAH525L.js} +1 -1
- package/dist/{chunk-IKJEN5R4.js → chunk-SDLWJF6H.js} +1 -1
- package/dist/{chunk-IXZG7OJ6.js → chunk-SEKJKOOB.js} +1 -1
- package/dist/chunk-SYFVCV2V.js +124 -0
- package/dist/{chunk-BAE5M4N3.js → chunk-TQ3PXYPJ.js} +1 -1
- package/dist/{chunk-AHDX5KXH.js → chunk-W2SZ5SLF.js} +2 -2
- package/dist/{chunk-ASHPKDV4.js → chunk-WKPOKOUQ.js} +1 -1
- package/dist/{chunk-VL3IS7S2.js → chunk-YDB72T5Z.js} +1 -1
- package/dist/{chunk-QW7T7OMV.js → chunk-YYSW7OKI.js} +1 -1
- package/dist/{cli-JOQ7XODJ.js → cli-BK35Y57F.js} +133 -92
- package/dist/{command-V5DNIID2.js → command-7U4LHEYA.js} +14 -14
- package/dist/{connect-cmd-QX7WJ65U.js → connect-cmd-UYJV435V.js} +2 -2
- package/dist/{container-start-OF6XTAQZ.js → container-start-UCKTFOIU.js} +14 -14
- package/dist/{context-show-cmd-2ABJ5B66.js → context-show-cmd-XIPY7JXC.js} +3 -3
- package/dist/{demo-voice-cmd-ZGT6ZKH4.js → demo-voice-cmd-ABTYSDTU.js} +7 -7
- package/dist/{doctor-7I2OAX3E.js → doctor-EPWDQQKT.js} +14 -14
- package/dist/{emit-artifact-cmd-2KQYKVRF.js → emit-artifact-cmd-R5BOINKV.js} +6 -6
- package/dist/{emit-criteria-cmd-JOYI5L6K.js → emit-criteria-cmd-VWCPZ3TV.js} +4 -4
- package/dist/{emit-demo-cmd-J4N2P7MS.js → emit-demo-cmd-QPF3MGY3.js} +7 -7
- package/dist/{emit-finding-cmd-QPSTTD7U.js → emit-finding-cmd-O2HNKNSU.js} +4 -4
- package/dist/{emit-result-cmd-KPAS6BS4.js → emit-result-cmd-CFS2YAS5.js} +5 -5
- package/dist/{emit-step-cmd-GQDRQ6JS.js → emit-step-cmd-Q43ESQ5J.js} +4 -4
- package/dist/{findings-cmd-57E6BXM2.js → findings-cmd-ZWNSAECA.js} +4 -4
- package/dist/{governing-source-O6VIHNZG.js → governing-source-MIRABOUE.js} +5 -5
- package/dist/{host-checks-TYNZW3BL.js → host-checks-NCV7XV2D.js} +12 -12
- package/dist/index.js +1 -1
- package/dist/{init-DZ6FIJ76.js → init-M3TDJHO7.js} +12 -12
- package/dist/{init-IJB3AHGA.js → init-Z7XXH24Q.js} +12 -12
- package/dist/{init-agent-OMJ24Z6I.js → init-agent-3IOE4J7S.js} +12 -12
- package/dist/init-cmd-HEFGRQBE.js +53 -0
- package/dist/{init-update-W3CNPIEJ.js → init-update-GHLRW7BP.js} +3 -3
- package/dist/{login-browser-KJPWH65X.js → login-browser-OA4R4PEQ.js} +1 -1
- package/dist/{loop-G3OTFQXF.js → loop-VJF7N3KN.js} +17 -17
- package/dist/{machine-SNJTMFTB.js → machine-FPD6GHWQ.js} +12 -12
- package/dist/{run-cmd-NEZVPFFG.js → run-cmd-W2XIBU2G.js} +4 -4
- package/dist/{runner-key-QOHUYHY3.js → runner-key-GYBBYSEX.js} +12 -12
- package/dist/{session-sender-6HKSOFQ2.js → session-sender-NDP6HVSG.js} +6 -6
- package/dist/setup-cmd-PQTTUAXH.js +214 -0
- package/dist/setup-wiring-K3MWFPIV.js +200 -0
- package/dist/{spec-cmd-53UFNXNH.js → spec-cmd-LEU2PGWP.js} +5 -5
- package/dist/{status-WBMU7ZGL.js → status-HN2P42KT.js} +12 -12
- package/dist/{sync-cmd-5FAB4CAX.js → sync-cmd-Q3FERZNI.js} +5 -5
- package/dist/{update-steps-UZWYIHPS.js → update-steps-PUM35QNI.js} +13 -13
- package/dist/{watch-GKQOIY7F.js → watch-2Z2HFUIL.js} +5 -5
- package/dist/{work-claim-cmd-PZFPD3NS.js → work-claim-cmd-D35DOCE6.js} +5 -5
- package/dist/{work-cmd-JANDUCNE.js → work-cmd-JNSI6X5D.js} +4 -4
- package/dist/{work-comment-cmd-ZIDXYWNH.js → work-comment-cmd-4AD66BWL.js} +5 -5
- package/dist/{work-demo-cmd-7OKBQG37.js → work-demo-cmd-BBNNMB4P.js} +4 -4
- package/dist/{work-logs-cmd-2XDRIBM2.js → work-logs-cmd-EU2Z2P2F.js} +4 -4
- package/dist/{work-mock-cmd-RFBGDQST.js → work-mock-cmd-5W52S7J5.js} +4 -4
- package/dist/{work-needs-attention-cmd-EY5FLR35.js → work-needs-attention-cmd-6X3DMFB3.js} +4 -4
- package/dist/{work-no-change-cmd-UOLGPCI2.js → work-no-change-cmd-JS5GWIV5.js} +4 -4
- package/dist/{work-open-pr-cmd-WBWODWGY.js → work-open-pr-cmd-3KHOY5KT.js} +5 -5
- package/dist/{work-pr-cmd-6733KSPR.js → work-pr-cmd-LJDDDQS4.js} +4 -4
- package/dist/{work-proofs-cmd-6SAG6KV5.js → work-proofs-cmd-GB5D3YAW.js} +5 -5
- package/dist/{work-proofs-record-TGTMNKBG.js → work-proofs-record-JMWVM7FR.js} +10 -10
- package/dist/{work-stop-cmd-A32J3PL7.js → work-stop-cmd-WTKUFCEF.js} +4 -4
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
3
|
import { criteriaOf, loadCitationFinder, testFileMatcher, hostItemsOf, runnerMatcher, NO_VERDICT_REASON } from './chunk-PG4UW6QW.js';
|
|
4
|
-
import { WorkCommandError, resolveCredentials, getJson } from './chunk-
|
|
4
|
+
import { WorkCommandError, resolveCredentials, getJson } from './chunk-BAPRSDUR.js';
|
|
5
5
|
import { sanitizeTerminal } from './chunk-DV44KCM6.js';
|
|
6
6
|
import { C } from './chunk-2AM6Z5BP.js';
|
|
7
7
|
import { defaultFetch } from './chunk-N7PG5JAD.js';
|
|
@@ -129,14 +129,14 @@ function governingDir(cwd) {
|
|
|
129
129
|
async function testProofMode(cwd) {
|
|
130
130
|
const dir = governingDir(cwd);
|
|
131
131
|
if (dir === void 0) return "any";
|
|
132
|
-
const { testProofIn } = await import('./host-checks-
|
|
132
|
+
const { testProofIn } = await import('./host-checks-NCV7XV2D.js');
|
|
133
133
|
return testProofIn(dir);
|
|
134
134
|
}
|
|
135
135
|
async function judgeCheckName(cwd) {
|
|
136
136
|
const dir = governingDir(cwd);
|
|
137
137
|
if (dir === void 0) return {};
|
|
138
138
|
if (!existsSync(dir)) return { note: `the governed context at ${dir} is not readable` };
|
|
139
|
-
const { checksIn, isJudgeCheck } = await import('./host-checks-
|
|
139
|
+
const { checksIn, isJudgeCheck } = await import('./host-checks-NCV7XV2D.js');
|
|
140
140
|
const quiet = { line: () => void 0, error: () => void 0 };
|
|
141
141
|
const check = checksIn(dir, quiet, "").checks.find((c) => isJudgeCheck(c) && c.judge.subjects === "criteria");
|
|
142
142
|
return check === void 0 ? {} : { name: check.name };
|
|
@@ -372,7 +372,7 @@ async function runWorkProofs(opts) {
|
|
|
372
372
|
async function runWorkProofsCommand(opts) {
|
|
373
373
|
try {
|
|
374
374
|
if (opts.record || opts.check) {
|
|
375
|
-
const { runWorkProofsRecord } = await import('./work-proofs-record-
|
|
375
|
+
const { runWorkProofsRecord } = await import('./work-proofs-record-JMWVM7FR.js');
|
|
376
376
|
const result2 = await runWorkProofsRecord(opts);
|
|
377
377
|
process.exitCode = result2.exitCode;
|
|
378
378
|
return;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
3
|
import { sanitizeTerminal } from './chunk-DV44KCM6.js';
|
|
4
4
|
import { mcpFiles, skillLinkFolders, isAgentsMdLayout } from './chunk-XDBHRWPQ.js';
|
|
5
|
-
import { DEFAULT_DASHBOARD } from './chunk-
|
|
5
|
+
import { DEFAULT_DASHBOARD } from './chunk-DHB3M244.js';
|
|
6
6
|
import { cliFetch, resolveGatewayCredentials } from './chunk-N7PG5JAD.js';
|
|
7
7
|
import { readCloudConfig } from './chunk-HWVMRETT.js';
|
|
8
8
|
import { findGitDirs, writeRepoConnection, readRepoConnection } from './chunk-BJ3KTMDH.js';
|
|
@@ -43,6 +43,24 @@ async function isRepositoryLinked(fetchImpl, gatewayUrl, token, appId, repositor
|
|
|
43
43
|
if (!Array.isArray(listed)) return null;
|
|
44
44
|
return listed.some((entry) => isLinkedRepository(repository, entry ?? {}));
|
|
45
45
|
}
|
|
46
|
+
async function linkedBranches(fetchImpl, gatewayUrl, token, appId, repository) {
|
|
47
|
+
let res;
|
|
48
|
+
try {
|
|
49
|
+
res = await fetchImpl(`${gatewayUrl.replace(/\/+$/, "")}/v1/apps/${encodeURIComponent(appId)}/git/links`, {
|
|
50
|
+
method: "GET",
|
|
51
|
+
headers: { authorization: `Bearer ${token}`, "x-outerlayer-app-id": appId },
|
|
52
|
+
signal: AbortSignal.timeout(LINKS_TIMEOUT_MS)
|
|
53
|
+
});
|
|
54
|
+
} catch {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
if (!res.ok) return null;
|
|
58
|
+
const listed = (await res.json().catch(() => void 0))?.data;
|
|
59
|
+
if (!Array.isArray(listed)) return null;
|
|
60
|
+
const entry = listed.find((e) => isLinkedRepository(repository, e ?? {}));
|
|
61
|
+
if (entry === void 0 || !Array.isArray(entry.branches)) return null;
|
|
62
|
+
return entry.branches.filter((b) => typeof b === "string" && b !== "");
|
|
63
|
+
}
|
|
46
64
|
function dashboardBase(home) {
|
|
47
65
|
const saved = readCloudConfig(home).dashboard;
|
|
48
66
|
const base = typeof saved === "string" && saved.trim() !== "" ? saved : DEFAULT_DASHBOARD;
|
|
@@ -106,6 +124,9 @@ function existsOnDisk(path) {
|
|
|
106
124
|
return false;
|
|
107
125
|
}
|
|
108
126
|
}
|
|
127
|
+
function setupCommitPaths(repoRoot) {
|
|
128
|
+
return setupPathsFor(repoRoot).filter((path) => existsOnDisk(join(repoRoot, path)) && !isGitIgnored(repoRoot, path));
|
|
129
|
+
}
|
|
109
130
|
function commitCommandsFor(cwd) {
|
|
110
131
|
const dirs = findGitDirs(cwd);
|
|
111
132
|
if (dirs === void 0) return commitLineFor(cwd);
|
|
@@ -416,4 +437,4 @@ ${commitLineFor(deps.cwd)}
|
|
|
416
437
|
return r.code;
|
|
417
438
|
}
|
|
418
439
|
|
|
419
|
-
export { COMMIT_LINE, agentsLayoutCommitLine, autoConnectedLine, commitCommandsFor, commitLineFor, dashboardBase, fetchFactories, findNamedFactory, hasUncommittedPolicy, isLinkedRepository, listText, listWithAnd, promptOnTerminal, realConnectDeps, runConnect, runConnectCommand, saveFactoryConnection, selectFactory, slug, workPageUrl };
|
|
440
|
+
export { COMMIT_LINE, agentsLayoutCommitLine, autoConnectedLine, commitCommandsFor, commitLineFor, dashboardBase, fetchFactories, findNamedFactory, hasUncommittedPolicy, isLinkedRepository, linkedBranches, listText, listWithAnd, ownerAndName, promptOnTerminal, realConnectDeps, runConnect, runConnectCommand, saveFactoryConnection, selectFactory, setupCommitPaths, slug, workPageUrl };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { LiveUploader } from './chunk-
|
|
3
|
+
import { LiveUploader } from './chunk-TQ3PXYPJ.js';
|
|
4
4
|
import { spoolDir } from './chunk-E5PWV6H2.js';
|
|
5
5
|
import { parseRunEnv, parseWorkItemEnv } from './chunk-LGJ56FCM.js';
|
|
6
6
|
import { sessionFolderIn, legacyAgent } from './chunk-LPQJ5LXP.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { fetchFactories, selectFactory, saveFactoryConnection, autoConnectedLine } from './chunk-
|
|
3
|
+
import { fetchFactories, selectFactory, saveFactoryConnection, autoConnectedLine } from './chunk-IQWBUZ75.js';
|
|
4
4
|
import { resolveGatewayCredentials } from './chunk-N7PG5JAD.js';
|
|
5
5
|
import { readCloudConfig } from './chunk-HWVMRETT.js';
|
|
6
6
|
import { findGitDirs, readRepoConnection } from './chunk-BJ3KTMDH.js';
|
|
@@ -426,7 +426,7 @@ async function readRepositoryRecipe(opts) {
|
|
|
426
426
|
} finally {
|
|
427
427
|
release?.();
|
|
428
428
|
}
|
|
429
|
-
const location = locateRecipe(checkout.dir);
|
|
429
|
+
const location = opts.universal === true ? { kind: "default" } : locateRecipe(checkout.dir);
|
|
430
430
|
const recipe = readRecipe(checkout.dir, location);
|
|
431
431
|
return {
|
|
432
432
|
sourceCommit: checkout.commit,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
3
|
import { detectActiveSession } from './chunk-IKGAVS5X.js';
|
|
4
|
-
import { autoConnect } from './chunk-
|
|
4
|
+
import { autoConnect } from './chunk-QFAH525L.js';
|
|
5
5
|
import { C } from './chunk-2AM6Z5BP.js';
|
|
6
6
|
import { defaultFetch, unauthorizedMessage, resolveGatewayCredentials } from './chunk-N7PG5JAD.js';
|
|
7
7
|
import { parseWorkItemEnv } from './chunk-LGJ56FCM.js';
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
|
+
import { linkedBranches, setupCommitPaths, commitCommandsFor, ownerAndName } from './chunk-IQWBUZ75.js';
|
|
4
|
+
import { resolveGatewayCredentials } from './chunk-N7PG5JAD.js';
|
|
5
|
+
import { findGitDirs } from './chunk-BJ3KTMDH.js';
|
|
6
|
+
import { execFileSync } from 'child_process';
|
|
7
|
+
import { existsSync, mkdirSync, writeFileSync } from 'fs';
|
|
8
|
+
import { join, dirname } from 'path';
|
|
9
|
+
|
|
10
|
+
createRequire(import.meta.url);
|
|
11
|
+
var SETUP_BRANCH = "outerlayer-setup";
|
|
12
|
+
var SETUP_MARKER = ".outerlayer/config.json";
|
|
13
|
+
var GIT_TIMEOUT_MS = 6e4;
|
|
14
|
+
var PR_TITLE = "Add OuterLayer setup";
|
|
15
|
+
var PR_BODY = "Adds the OuterLayer setup that `outerlayer setup` wrote: the policy in `.outerlayer/`, the agent instructions and skills, and the MCP server entries. Checks run on a pull request only once the policy is on the branch it targets.";
|
|
16
|
+
function run(command, args, cwd) {
|
|
17
|
+
try {
|
|
18
|
+
const stdout = execFileSync(command, args, { cwd, encoding: "utf8", stdio: ["ignore", "pipe", "pipe"], timeout: GIT_TIMEOUT_MS });
|
|
19
|
+
return { ok: true, stdout: stdout.trim(), stderr: "" };
|
|
20
|
+
} catch (err) {
|
|
21
|
+
const e = err;
|
|
22
|
+
return { ok: false, stdout: String(e.stdout ?? "").trim(), stderr: String(e.stderr ?? e.message ?? "").trim() };
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
var git = (cwd, args) => run("git", args, cwd);
|
|
26
|
+
var realGh = (args, cwd) => run("gh", args, cwd);
|
|
27
|
+
async function setupBaseBranch(cwd, home, repository, fetchImpl = fetch) {
|
|
28
|
+
const resolved = resolveGatewayCredentials({ cwd, home });
|
|
29
|
+
const linked = resolved.ok && repository !== void 0 ? await linkedBranches(fetchImpl, resolved.url, resolved.credential, resolved.appId, repository) : null;
|
|
30
|
+
return linked?.[0] ?? originDefaultBranch(cwd) ?? "main";
|
|
31
|
+
}
|
|
32
|
+
function originDefaultBranch(cwd) {
|
|
33
|
+
const ref = git(cwd, ["symbolic-ref", "--short", "refs/remotes/origin/HEAD"]);
|
|
34
|
+
return ref.ok && ref.stdout.startsWith("origin/") ? ref.stdout.slice("origin/".length) : void 0;
|
|
35
|
+
}
|
|
36
|
+
function currentBranch(cwd) {
|
|
37
|
+
const ref = git(cwd, ["symbolic-ref", "--short", "-q", "HEAD"]);
|
|
38
|
+
return ref.ok && ref.stdout !== "" ? ref.stdout : void 0;
|
|
39
|
+
}
|
|
40
|
+
function setupMerged(cwd, base) {
|
|
41
|
+
if (!git(cwd, ["fetch", "--quiet", "origin", `refs/heads/${base}:refs/remotes/origin/${base}`]).ok) return null;
|
|
42
|
+
return git(cwd, ["cat-file", "-e", `refs/remotes/origin/${base}:${SETUP_MARKER}`]).ok;
|
|
43
|
+
}
|
|
44
|
+
function setupBranchPushed(cwd) {
|
|
45
|
+
const heads = git(cwd, ["ls-remote", "--heads", "origin", SETUP_BRANCH]);
|
|
46
|
+
return heads.ok && heads.stdout !== "";
|
|
47
|
+
}
|
|
48
|
+
function compareUrl(repository, base) {
|
|
49
|
+
if (repository === void 0 || !repository.toLowerCase().startsWith("github.com/")) return void 0;
|
|
50
|
+
return `https://github.com/${ownerAndName(repository)}/compare/${encodeURIComponent(base)}...${SETUP_BRANCH}?expand=1`;
|
|
51
|
+
}
|
|
52
|
+
function ghReady(gh, cwd) {
|
|
53
|
+
return gh(["auth", "status"], cwd).ok;
|
|
54
|
+
}
|
|
55
|
+
function setupPullRequestUrl(cwd, base, repository, gh = realGh) {
|
|
56
|
+
if (compareUrl(repository, base) !== void 0 && ghReady(gh, cwd)) {
|
|
57
|
+
const open = gh(["pr", "view", SETUP_BRANCH, "--json", "url", "--jq", ".url"], cwd);
|
|
58
|
+
if (open.ok && open.stdout.startsWith("https://")) return open.stdout;
|
|
59
|
+
}
|
|
60
|
+
return compareUrl(repository, base);
|
|
61
|
+
}
|
|
62
|
+
function openSetupPullRequest(cwd, base, repository, gh = realGh) {
|
|
63
|
+
const dirs = findGitDirs(cwd);
|
|
64
|
+
if (dirs === void 0) return { ok: false, message: "this directory is not in a git repository." };
|
|
65
|
+
const paths = setupCommitPaths(dirs.repoRoot);
|
|
66
|
+
if (paths.length === 0) return { ok: false, message: "there are no setup files to commit. Run `outerlayer setup` without --open-pr first." };
|
|
67
|
+
return pushSetupBranch({ root: dirs.repoRoot, paths, base, repository, commitCommands: commitCommandsFor(cwd) }, git, gh);
|
|
68
|
+
}
|
|
69
|
+
function pushSetupBranch(plan, runGit, gh) {
|
|
70
|
+
const { root, paths, base, repository } = plan;
|
|
71
|
+
const instead = (why) => ({
|
|
72
|
+
ok: false,
|
|
73
|
+
message: `${why} Commit the setup yourself instead, then open a pull request into ${base}:
|
|
74
|
+
${plan.commitCommands}`
|
|
75
|
+
});
|
|
76
|
+
const head = runGit(root, ["symbolic-ref", "--short", "-q", "HEAD"]);
|
|
77
|
+
const branch = head.ok && head.stdout !== "" ? head.stdout : void 0;
|
|
78
|
+
if (branch !== SETUP_BRANCH) {
|
|
79
|
+
if (branch !== base) return instead(`this checkout is on ${branch ?? "a detached HEAD"}, not ${base}, so a branch from it could carry other work.`);
|
|
80
|
+
runGit(root, ["fetch", "--quiet", "origin", `refs/heads/${base}:refs/remotes/origin/${base}`]);
|
|
81
|
+
const ahead = runGit(root, ["rev-list", "--count", `refs/remotes/origin/${base}..HEAD`]);
|
|
82
|
+
if (!ahead.ok) return instead(`git could not compare ${base} with origin/${base}.`);
|
|
83
|
+
if (ahead.stdout !== "0") return instead(`${base} has ${ahead.stdout} commits that origin does not have, and the pull request would carry them.`);
|
|
84
|
+
if (runGit(root, ["rev-parse", "--verify", "--quiet", `refs/heads/${SETUP_BRANCH}`]).ok) {
|
|
85
|
+
return instead(`a branch named ${SETUP_BRANCH} already exists here.`);
|
|
86
|
+
}
|
|
87
|
+
const created2 = runGit(root, ["switch", "--quiet", "-c", SETUP_BRANCH]);
|
|
88
|
+
if (!created2.ok) return { ok: false, message: `could not create the ${SETUP_BRANCH} branch: ${created2.stderr}` };
|
|
89
|
+
}
|
|
90
|
+
const added = runGit(root, ["add", "--", ...paths]);
|
|
91
|
+
if (!added.ok) return { ok: false, message: `git add failed: ${added.stderr}` };
|
|
92
|
+
const staged = runGit(root, ["diff", "--cached", "--quiet", "--", ...paths]);
|
|
93
|
+
if (!staged.ok) {
|
|
94
|
+
const committed = runGit(root, ["commit", "--quiet", "-m", PR_TITLE, "--", ...paths]);
|
|
95
|
+
if (!committed.ok) return { ok: false, message: `git commit failed: ${committed.stderr || committed.stdout}` };
|
|
96
|
+
}
|
|
97
|
+
const pushed = runGit(root, ["push", "--quiet", "-u", "origin", SETUP_BRANCH]);
|
|
98
|
+
if (!pushed.ok) return { ok: false, message: `git push failed: ${pushed.stderr}` };
|
|
99
|
+
const page = compareUrl(repository, base);
|
|
100
|
+
if (page === void 0 || !ghReady(gh, root)) return { ok: true, url: page, opened: false };
|
|
101
|
+
const existing = gh(["pr", "view", SETUP_BRANCH, "--json", "url", "--jq", ".url"], root);
|
|
102
|
+
if (existing.ok && existing.stdout.startsWith("https://")) return { ok: true, url: existing.stdout, opened: true };
|
|
103
|
+
const created = gh(["pr", "create", "--base", base, "--head", SETUP_BRANCH, "--title", PR_TITLE, "--body", PR_BODY], root);
|
|
104
|
+
const url = created.stdout.split("\n").reverse().find((line) => line.startsWith("https://"));
|
|
105
|
+
return created.ok && url !== void 0 ? { ok: true, url, opened: true } : { ok: true, url: page, opened: false };
|
|
106
|
+
}
|
|
107
|
+
function installedPath(cwd) {
|
|
108
|
+
const dirs = findGitDirs(cwd);
|
|
109
|
+
return dirs === void 0 ? void 0 : join(dirs.gitCommonDir, "outerlayer", "setup.json");
|
|
110
|
+
}
|
|
111
|
+
function setupInstalled(cwd) {
|
|
112
|
+
const path = installedPath(cwd);
|
|
113
|
+
const dirs = findGitDirs(cwd);
|
|
114
|
+
return path !== void 0 && dirs !== void 0 && existsSync(path) && existsSync(join(dirs.repoRoot, SETUP_MARKER));
|
|
115
|
+
}
|
|
116
|
+
function markSetupInstalled(cwd, now) {
|
|
117
|
+
const path = installedPath(cwd);
|
|
118
|
+
if (path === void 0) return;
|
|
119
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
120
|
+
writeFileSync(path, `${JSON.stringify({ installedAt: now.toISOString() })}
|
|
121
|
+
`);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export { SETUP_BRANCH, currentBranch, markSetupInstalled, openSetupPullRequest, setupBaseBranch, setupBranchPushed, setupInstalled, setupMerged, setupPullRequestUrl };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { uploadSpooledSteps } from './chunk-
|
|
3
|
+
import { uploadSpooledSteps } from './chunk-EGYZGB2P.js';
|
|
4
4
|
import { LaunchFilter } from './chunk-C2PZOLN7.js';
|
|
5
5
|
import { migrateLegacyArtifactSidecars, planArtifactUpload, artifactsStatePath, sanitizeTerminal, acquireArtifactSpoolLock, artifactBlobsDir, resolveArtifactTurnIndex, isArtifactTombstoned, ARTIFACT_RETRY_MAX_AGE_MS, writeArtifactSpoolState, reclaimUnneededArtifactBlobs, neededArtifactShas } from './chunk-DV44KCM6.js';
|
|
6
6
|
import { C } from './chunk-2AM6Z5BP.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { placeholderQueues, placeholderProblem } from './chunk-
|
|
3
|
+
import { placeholderQueues, placeholderProblem } from './chunk-G5TK5XLA.js';
|
|
4
4
|
import { checkFit, RUNNER_RESERVE_BYTES } from './chunk-4L3WCEOI.js';
|
|
5
|
-
import { getJson, WorkCommandError } from './chunk-
|
|
5
|
+
import { getJson, WorkCommandError } from './chunk-BAPRSDUR.js';
|
|
6
6
|
import { isBuiltinVm, isBuiltinSandbox, builtinKind, EGRESS_SWITCHABLE_KEYS, imageBuildOf, keepsHostBuilder } from './chunk-V2O6KLTQ.js';
|
|
7
7
|
import { realBuildDiskProbe, checkDiskFit, DEFAULT_CACHE_DISK, DEFAULT_BUILD_DISK } from './chunk-OC3BSNNE.js';
|
|
8
8
|
import { ensureHostKey } from './chunk-NDDXBJMX.js';
|
|
@@ -3,7 +3,7 @@ import { createRequire } from 'node:module';
|
|
|
3
3
|
import { runEmit } from './chunk-BFZDVD7T.js';
|
|
4
4
|
import { addStdioMcpEntryIfAbsent, addDocsMcpEntryIfAbsent, DOCS_MCP_SERVER_NAME } from './chunk-7PFRNOSF.js';
|
|
5
5
|
import { installStarterPack } from './chunk-TQPFWWND.js';
|
|
6
|
-
import { listWithAnd } from './chunk-
|
|
6
|
+
import { listWithAnd } from './chunk-IQWBUZ75.js';
|
|
7
7
|
import { AGENTS_MD_LAYOUT, mcpFiles, declareAgentsMdLayout, linkAgentSkills, describeSkillsLink, isAgentsMdLayout, holdsTodaysLayoutSources, discoverOuterlayerPaths } from './chunk-XDBHRWPQ.js';
|
|
8
8
|
import { C } from './chunk-2AM6Z5BP.js';
|
|
9
9
|
import { resolveGitCommonDir, defaultGitRunner } from './chunk-ISRMDI2H.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
3
|
import { newTokenRetry } from './chunk-FJGYU2EK.js';
|
|
4
|
-
import { WorkCommandError, postJson } from './chunk-
|
|
4
|
+
import { WorkCommandError, postJson } from './chunk-BAPRSDUR.js';
|
|
5
5
|
import { defaultGitRunner, materializeContext, fetchControlPlaneCommit, lookupGoverningSource } from './chunk-ISRMDI2H.js';
|
|
6
6
|
import { buildRefusalReason } from './chunk-ZCOIE7ZJ.js';
|
|
7
7
|
import { unsupportedLayout, layoutRefusalReason, composeDelivery } from './chunk-IIYDYHS5.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { resolveCredentials, postBytes, RateLimitedError, postJson, getJson, getBytes } from './chunk-
|
|
3
|
+
import { resolveCredentials, postBytes, RateLimitedError, postJson, getJson, getBytes } from './chunk-BAPRSDUR.js';
|
|
4
4
|
import { detectActiveSession } from './chunk-IKGAVS5X.js';
|
|
5
5
|
import { sanitizeTerminal } from './chunk-DV44KCM6.js';
|
|
6
6
|
import { C } from './chunk-2AM6Z5BP.js';
|