@outerlayer/cli 0.22.1 → 0.23.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.
Files changed (114) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +4 -1
  3. package/dist/{agent-setup-LTSLXPS3.js → agent-setup-SNDCEHG2.js} +14 -12
  4. package/dist/{artifact-link-cmd-OWRI5AJX.js → artifact-link-cmd-LEI6EOZE.js} +2 -2
  5. package/dist/bridge-QFN3KJP6.js +8 -0
  6. package/dist/{build-6WRNZPVR.js → build-WHHFA7KM.js} +2 -2
  7. package/dist/build-info.json +1 -1
  8. package/dist/{builder-G3MLDMTI.js → builder-7FBQAWQZ.js} +3 -3
  9. package/dist/{check-UYKEMQNR.js → check-3CGLWMHM.js} +37 -37
  10. package/dist/{chunk-ZPSLJFGL.js → chunk-2TT7DEMZ.js} +2 -2
  11. package/dist/{chunk-3V5C64Y5.js → chunk-6AOZD3LY.js} +3 -4
  12. package/dist/{chunk-5NJIWKD4.js → chunk-BOG4ENP7.js} +9 -9
  13. package/dist/{chunk-G3IJ3N6F.js → chunk-BUP5N3X6.js} +1 -1
  14. package/dist/{chunk-FRNYCJ4W.js → chunk-C2XZBNHY.js} +1 -1
  15. package/dist/{chunk-BET347JZ.js → chunk-C64D7HR3.js} +6 -7
  16. package/dist/{chunk-AEKSX4EY.js → chunk-CBCKD6DO.js} +1 -1
  17. package/dist/{chunk-56X5TOJY.js → chunk-D64E222W.js} +5 -6
  18. package/dist/{chunk-URAKVDSI.js → chunk-DJYOCD65.js} +9 -10
  19. package/dist/{chunk-IZSVXRDR.js → chunk-DXDF43YG.js} +1 -1
  20. package/dist/{chunk-F7CU5ABH.js → chunk-DYEFPYME.js} +1 -1
  21. package/dist/{chunk-ORNJJ7XN.js → chunk-FX6IHR5C.js} +11 -12
  22. package/dist/{chunk-ENTHEUKT.js → chunk-G3LHWUBK.js} +4 -4
  23. package/dist/{chunk-5QRP3MVS.js → chunk-GNPTU4BM.js} +9 -4
  24. package/dist/{chunk-JRCSET55.js → chunk-GXV73IIS.js} +6 -6
  25. package/dist/{chunk-5OCIHFGE.js → chunk-HBISTTG3.js} +32 -23
  26. package/dist/chunk-JKNYTNYD.js +151 -0
  27. package/dist/{chunk-CUFFDEF3.js → chunk-KGKFEONR.js} +4 -4
  28. package/dist/{chunk-USWVXQIH.js → chunk-MQ743JX3.js} +3 -3
  29. package/dist/{chunk-XR56WEA5.js → chunk-OGMZJWWD.js} +1 -1
  30. package/dist/chunk-QS43O4DR.js +113 -0
  31. package/dist/{chunk-FOCML5FI.js → chunk-QSEPKZXR.js} +15 -14
  32. package/dist/{chunk-7VUK5RFS.js → chunk-QZBXLLTV.js} +36 -1
  33. package/dist/{chunk-WFSUUUAN.js → chunk-RKOTJQVG.js} +1 -1
  34. package/dist/{chunk-7FEY33MY.js → chunk-TFGXOHF6.js} +13 -13
  35. package/dist/{chunk-V7SAQ645.js → chunk-VJBFQP3H.js} +21 -12
  36. package/dist/{chunk-ZNPE7FW5.js → chunk-VPEGE3QZ.js} +1 -1
  37. package/dist/{chunk-W3SWJ2TD.js → chunk-VWFOKRYS.js} +5 -2
  38. package/dist/{chunk-XCRZTXRL.js → chunk-WX2WEERU.js} +63 -43
  39. package/dist/chunk-WXJXHZVB.js +73 -0
  40. package/dist/{chunk-BOMRFYTZ.js → chunk-WY7HFY62.js} +3 -3
  41. package/dist/{chunk-VSUXCMMH.js → chunk-XFGL53GU.js} +51 -33
  42. package/dist/{chunk-6YBLN4TR.js → chunk-XGPC3IOR.js} +4 -5
  43. package/dist/{chunk-QC72I5GQ.js → chunk-XOEV4FVK.js} +3 -3
  44. package/dist/{chunk-EAQSOE62.js → chunk-XSPA5ODY.js} +21 -19
  45. package/dist/{chunk-JZGFDTNC.js → chunk-Z42JY3LQ.js} +20 -3
  46. package/dist/{chunk-O6RJ3QMU.js → chunk-ZKWKQIJU.js} +86 -6
  47. package/dist/{chunk-QOALB6ZD.js → chunk-ZLZ3XVPI.js} +3 -3
  48. package/dist/{claude-launcher-TBWV3YL3.js → claude-launcher-KEESTJHO.js} +5 -5
  49. package/dist/{cli-U253V422.js → cli-44WGGICQ.js} +126 -112
  50. package/dist/{command-IQTPFSXY.js → command-4FAP2D3P.js} +22 -23
  51. package/dist/connect-cmd-6DUTUK63.js +22 -0
  52. package/dist/{context-cleanup-DSA3HGQU.js → context-cleanup-LTH77FC3.js} +3 -3
  53. package/dist/{control-plane-launch-OWSNH6YA.js → control-plane-launch-SEYCOZFH.js} +8 -9
  54. package/dist/{dist-7IH56ELA.js → dist-SOH3O24Y.js} +2 -2
  55. package/dist/{docker-JU422JL7.js → docker-KMK4LOET.js} +3 -3
  56. package/dist/{doctor-FZTS57ZO.js → doctor-4H77CEB7.js} +24 -25
  57. package/dist/{emit-artifact-cmd-YLZ5WLSF.js → emit-artifact-cmd-XCZ3ALLV.js} +15 -15
  58. package/dist/emit-cmd-WQH2NK7H.js +15 -0
  59. package/dist/{emit-criteria-cmd-MF6TVE7C.js → emit-criteria-cmd-JE72JHKJ.js} +10 -10
  60. package/dist/{emit-finding-cmd-S3YMFTZT.js → emit-finding-cmd-ILIDRMYN.js} +10 -10
  61. package/dist/{emit-result-cmd-JHEUFTPX.js → emit-result-cmd-WPKG5YAS.js} +15 -15
  62. package/dist/{emit-step-cmd-TUI2T3DS.js → emit-step-cmd-OVMLQSL6.js} +11 -11
  63. package/dist/{governing-source-XSEIRSBE.js → governing-source-EQBKPME7.js} +16 -17
  64. package/dist/{guest-init-DF7V5D2R.js → guest-init-HWSE7W6L.js} +3 -2
  65. package/dist/{hook-fast-O3UUN6SO.js → hook-fast-27SHD72I.js} +1 -1
  66. package/dist/{hook-wrap-fast-NPLHJXFK.js → hook-wrap-fast-NOOGDNSW.js} +2 -2
  67. package/dist/{import-capture-cmd-Q56DDZVO.js → import-capture-cmd-TCOKNVBM.js} +12 -7
  68. package/dist/{import-ruler-cmd-T6LLO6Q7.js → import-ruler-cmd-VJOHOJQ7.js} +2 -2
  69. package/dist/index.js +6 -6
  70. package/dist/{init-ZZZPYGUH.js → init-HAAHIQFN.js} +23 -24
  71. package/dist/{init-VZE72CR4.js → init-WQ62BXDN.js} +23 -24
  72. package/dist/{init-cmd-W5VV62ZN.js → init-cmd-VPFIDY64.js} +24 -24
  73. package/dist/init-update-UZIJ2FMU.js +529 -0
  74. package/dist/layout-UOJQGEPW.js +10 -0
  75. package/dist/{login-browser-BN5UKPHS.js → login-browser-4OMZFP3U.js} +4 -3
  76. package/dist/{logout-cmd-RZFWTNYD.js → logout-cmd-5V5MMBSY.js} +2 -2
  77. package/dist/{loop-6WENRS5S.js → loop-JPW2QJ64.js} +37 -37
  78. package/dist/{machine-M4MQBV5A.js → machine-PGDRWPI2.js} +22 -23
  79. package/dist/{mcp-install-cmd-GD4QUP7Z.js → mcp-install-cmd-GGWB3JJ2.js} +2 -2
  80. package/dist/{mcp-serve-cmd-SBW7HYKD.js → mcp-serve-cmd-CNRC5AL5.js} +3 -3
  81. package/dist/{runner-identity-FTHZFMGY.js → runner-identity-IIZ3RK7M.js} +3 -3
  82. package/dist/{runner-key-QT7GKGEE.js → runner-key-BPP5XRYR.js} +23 -24
  83. package/dist/{session-sender-BK6TGNVO.js → session-sender-EKKZ5DEU.js} +16 -16
  84. package/dist/{settings-J2652U5N.js → settings-AKYEOCC2.js} +1 -1
  85. package/dist/{spec-cmd-ZNJ3GXWC.js → spec-cmd-JDHGNFVJ.js} +11 -11
  86. package/dist/{starter-pack-5EQYGSJF.js → starter-pack-55EFILC5.js} +7 -4
  87. package/dist/{status-JOO7MGIC.js → status-UCQDEMFX.js} +30 -30
  88. package/dist/{statusline-fast-2OK3DVAA.js → statusline-fast-GVRSBHAF.js} +2 -2
  89. package/dist/{sync-cmd-W2FPY3T5.js → sync-cmd-NSVXOYFJ.js} +15 -15
  90. package/dist/{watch-WLH5ZUZU.js → watch-NQVZWPBJ.js} +15 -15
  91. package/dist/{work-claim-cmd-4PLDTEZR.js → work-claim-cmd-FPJXQAXP.js} +13 -13
  92. package/dist/{work-cmd-KWHAYUYB.js → work-cmd-FMPDXPU6.js} +11 -11
  93. package/dist/{work-comment-cmd-4CUI7ZDE.js → work-comment-cmd-ZVUE2IUN.js} +11 -11
  94. package/dist/{work-logs-cmd-AF253WLM.js → work-logs-cmd-CQH2SYT4.js} +11 -11
  95. package/dist/{work-open-pr-cmd-JETE6HRL.js → work-open-pr-cmd-YY2OGJOI.js} +12 -12
  96. package/dist/{work-pr-cmd-V5G4CPMG.js → work-pr-cmd-EHFTEVJO.js} +11 -11
  97. package/dist/{work-stop-cmd-FIEKUDGE.js → work-stop-cmd-LGWSBSBT.js} +11 -11
  98. package/package.json +1 -1
  99. package/skill-pack/maintained/outerlayer-amend/SKILL.md +83 -82
  100. package/skill-pack/maintained/outerlayer-build/SKILL.md +4 -2
  101. package/skill-pack/maintained/outerlayer-build/references/agent-briefs.md +17 -4
  102. package/skill-pack/maintained/outerlayer-build/references/criteria-judge.md +10 -0
  103. package/skill-pack/maintained/outerlayer-build/references/release.md +7 -4
  104. package/skill-pack/maintained/outerlayer-build/references/review-briefs.md +10 -3
  105. package/skill-pack/maintained/outerlayer-cli/SKILL.md +13 -4
  106. package/skill-pack/maintained/outerlayer-cli/references/merge-base-branch.md +54 -0
  107. package/dist/chunk-NTRCK4NH.js +0 -38
  108. package/dist/chunk-QF7WZUU6.js +0 -56
  109. package/dist/connect-cmd-ZFOK6HEL.js +0 -17
  110. package/dist/emit-cmd-3W5IO5ET.js +0 -14
  111. package/dist/init-update-YFPIQS5G.js +0 -211
  112. package/dist/{chunk-F35VMF5M.js → chunk-GOSFARMS.js} +1 -1
  113. package/dist/{chunk-3AZYLAJC.js → chunk-QILR6TZP.js} +1 -1
  114. package/dist/{chunk-DIB2WLBL.js → chunk-YVZJ6GKF.js} +1 -1
@@ -149,6 +149,10 @@ change to production code that still passes it?
149
149
  - Assertion strength: exact shapes over permissive matchers. Error-path tests
150
150
  assert the message or status a user would see, not only that something
151
151
  threw.
152
+ - Stand-in proofs: a test that checks something next to the outcome, not the
153
+ outcome. Examples are the arguments a program starts with instead of what it
154
+ does, or "unchanged from before" instead of the stated value. Name the code
155
+ that produces the outcome, and check that the citing test runs it.
152
156
  - Mutation survivors: for each new conditional and object literal, flip or
153
157
  empty it. If no test fails, write the assertion that would.
154
158
 
@@ -259,9 +263,12 @@ shared tree while you run, so no mutation may touch it.
259
263
 
260
264
  1. Run the repository's changed-lines mutation tool once over the whole diff.
261
265
  Every survivor it reports is a finding. Never rerun it per file, never
262
- lower its budget, and never run a whole suite or a coverage run. A run
263
- that ends over budget is reported as over budget with the mutants it
264
- scored. One rerun is allowed, and only when the tool reports no result
266
+ lower its budget, and never run a whole suite or a coverage run. The
267
+ tool can run longer than your shell's maximum timeout. Then your shell
268
+ moves it to the background. Wait for it to exit before you write your
269
+ report. Only the tool's own output can say that a run went over budget.
270
+ A run that ends over budget is reported as over budget with the mutants
271
+ it scored. One rerun is allowed, and only when the tool reports no result
265
272
  because a workspace dependency could not be resolved: build the
266
273
  dependencies, then run once more.
267
274
  2. Read the tool's report. For each criterion whose production lines were
@@ -38,7 +38,7 @@ from the output of `outerlayer work build`.
38
38
  4. `outerlayer emit artifact <file> --caption "<what it shows>"` attaches a
39
39
  screenshot, recording, report or log as evidence. The `outerlayer-evidence`
40
40
  skill says what to capture.
41
- 5. `/outerlayer-amend` answers the review threads a person handed to an agent.
41
+ 5. `/outerlayer-amend` answers the review threads a person handed to an agent. It also resolves a merge conflict on a pull request a host built.
42
42
 
43
43
  ## Several repositories
44
44
 
@@ -76,6 +76,13 @@ ended, which session ran in it, and what the runner did around the agent. The
76
76
  steps, and what each outcome and reason means, are in
77
77
  [references/find-out-why-a-build-ended.md](references/find-out-why-a-build-ended.md).
78
78
 
79
+ ## Merging the base branch
80
+
81
+ A build merges the base branch into its branch before the pull request opens.
82
+ A run that resolves a merge conflict does the same on an open pull request.
83
+ Both follow one procedure in
84
+ [references/merge-base-branch.md](references/merge-base-branch.md).
85
+
79
86
  ## Reading work items
80
87
 
81
88
  When the OuterLayer MCP server is configured in this repository, its
@@ -85,6 +92,8 @@ tools fail, run `outerlayer login` and reconnect the server.
85
92
 
86
93
  ## Keeping this repository's context current
87
94
 
88
- `outerlayer context emit` compiles `.outerlayer/` into the files each agent
89
- tool reads, such as `.claude/skills/`. This skill is maintained: that command
90
- rewrites it from the installed CLI, so edits to it do not last.
95
+ A repository with `AGENTS.md` and `.agents/skills/` compiles nothing.
96
+ `outerlayer init --update` rewrites this skill from the installed CLI. In an
97
+ older layout, `outerlayer context emit` compiles `.outerlayer/` into the files
98
+ each agent tool reads, such as `.claude/skills/`, and rewrites this skill.
99
+ Either way, edits to this skill do not last.
@@ -0,0 +1,54 @@
1
+ # Merge the base branch into a branch
2
+
3
+ Use this procedure when a branch must take in its base branch: a build's
4
+ last sync before the pull request opens, and a run that resolves a merge
5
+ conflict on a pull request already open. It is the one written procedure
6
+ for both.
7
+
8
+ Merge the base branch. Never rebase, and never force-push. A merge keeps the
9
+ commits a reviewer already read and keeps review comments on their lines.
10
+
11
+ 1. Fetch the base branch. Use the pull request's base, which the item's
12
+ `outerlayer work status --item "$OUTERLAYER_WORK" --json` names in
13
+ `pullRequests[].conflict.baseBranch`, or the repository's default branch
14
+ when the pull request has no conflict record.
15
+
16
+ git fetch origin <base>
17
+
18
+ 2. Record the base commit you merge. Read it after the fetch.
19
+
20
+ git rev-parse origin/<base>
21
+
22
+ 3. Merge it into the checked-out branch, and stop before git commits.
23
+
24
+ git merge origin/<base> --no-commit --no-ff
25
+
26
+ If git reports `Already up to date`, the branch holds the base already.
27
+ Stop: there is nothing to push. If the merge has no conflict, go to step 5.
28
+
29
+ 4. Resolve each conflict so that the result keeps the intent of both sides.
30
+ List the conflicting files with `git diff --name-only --diff-filter=U`.
31
+ For each file, read the base commits that changed it
32
+ (`git log --oneline HEAD..origin/<base> -- <file>`) and the work item's
33
+ spec. Do not pick one side to make the conflict go away. Mark a file
34
+ resolved with `git add <file>` only when its code and its tests agree
35
+ with both sides.
36
+
37
+ 5. Run the repository's pre-push gate in the foreground, with the maximum
38
+ timeout. It names its own command in the repository's instructions file.
39
+ Wait for it to end. If the gate fails, fix the cause and run it again once.
40
+ A second failure is a hand-off, not a third try.
41
+
42
+ 6. Commit the merge. Name the base sha from step 2 in the message, so a reader
43
+ can find the exact base commit.
44
+
45
+ git commit -m "Merge <base> at <base sha> into <branch>"
46
+
47
+ 7. Push the branch. The hooks run, and you never bypass them. A push goes to
48
+ the pull request's own branch only.
49
+
50
+ ## When you cannot resolve it
51
+
52
+ Abort the merge with `git merge --abort`. The branch returns to the state it
53
+ had before step 3. Push nothing. Hand the item to a person in the way the
54
+ calling skill says.
@@ -1,38 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire } from 'node:module';
3
- import { readRepoConnection, findGitDirs } from './chunk-BJ3KTMDH.js';
4
- import { readCloudConfig } from './chunk-EABW6AJQ.js';
5
- import { cliInvocation } from './chunk-CRB3POP4.js';
6
- import { homeFromEnv } from './chunk-VNVZDWO3.js';
7
-
8
- createRequire(import.meta.url);
9
-
10
- // src/credentials.ts
11
- var MISSING_HELP = `Run \`${cliInvocation()} login\` to sign in, or set OUTERLAYER_URL / OUTERLAYER_API_KEY / OUTERLAYER_APP_ID. Mint a key in the dashboard: Settings \u2192 API keys.`;
12
- var NO_FACTORY_MESSAGE = `you are logged in, but no factory is chosen for this repository. Run \`${cliInvocation()} connect\` to choose one, or pass --app-id / set OUTERLAYER_APP_ID.`;
13
- var NO_FACTORY_OUTSIDE_REPOSITORY_MESSAGE = "you are logged in, but this directory is not in a git repository, so no factory is chosen. Pass --app-id / set OUTERLAYER_APP_ID, or run this from inside a connected repository.";
14
- var LOGIN_TOKEN_PREFIX = "olu_";
15
- function unauthorizedMessage(credential) {
16
- return credential.startsWith(LOGIN_TOKEN_PREFIX) ? `not authorized \u2014 the login is expired or was revoked. Run \`${cliInvocation()} login\` to sign in again.` : "not authorized \u2014 the API key is unknown, expired, or bound to a different factory. Mint a fresh key: dashboard \u2192 Settings \u2192 API keys.";
17
- }
18
- function resolveGatewayCredentials(sources = {}) {
19
- const env = sources.env ?? process.env;
20
- const config = readCloudConfig(sources.home ?? homeFromEnv(env));
21
- const url = sources.url ?? env.OUTERLAYER_URL ?? config.url;
22
- const key = sources.apiKey ?? (env.OUTERLAYER_API_KEY || void 0) ?? config.apiKey;
23
- const kind = key ? "key" : "login";
24
- const credential = key ?? config.accountToken;
25
- const cwd = sources.cwd ?? process.cwd();
26
- const appId = sources.appId ?? (env.OUTERLAYER_APP_ID || void 0) ?? (kind === "key" ? config.appId : readRepoConnection(cwd)?.appId);
27
- if (credential && url && !appId && kind === "login") {
28
- const message = findGitDirs(cwd) === void 0 ? NO_FACTORY_OUTSIDE_REPOSITORY_MESSAGE : NO_FACTORY_MESSAGE;
29
- return { ok: false, message, url, credential, appId, kind };
30
- }
31
- if (!url || !credential || !appId) {
32
- const missing = [!url && "--url", !credential && "a login or OUTERLAYER_API_KEY", !appId && "--app-id"].filter(Boolean).join(", ");
33
- return { ok: false, message: `missing ${missing}. ${MISSING_HELP}`, url, credential, appId, kind };
34
- }
35
- return { ok: true, url, credential, appId, kind };
36
- }
37
-
38
- export { resolveGatewayCredentials, unauthorizedMessage };
@@ -1,56 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire } from 'node:module';
3
- import { readCloudConfig, cloudConfigPath } from './chunk-EABW6AJQ.js';
4
- import { homeFromEnv } from './chunk-VNVZDWO3.js';
5
- import { signRunnerRequest, signerFor } from './chunk-OW52QLK3.js';
6
-
7
- createRequire(import.meta.url);
8
-
9
- // src/signing-fetch.ts
10
- function bodyBytes(body) {
11
- if (body === void 0 || body === null) return new Uint8Array(0);
12
- if (typeof body === "string") return new TextEncoder().encode(body);
13
- if (body instanceof Uint8Array) return body;
14
- if (body instanceof ArrayBuffer) return new Uint8Array(body);
15
- return void 0;
16
- }
17
- async function savedKeySigner(headers, home) {
18
- const authorization = headers.get("authorization");
19
- if (authorization === null || !authorization.startsWith("Bearer ")) return void 0;
20
- if (headers.has("signature")) return void 0;
21
- if (readCloudConfig(home).apiKey !== authorization.slice("Bearer ".length)) return void 0;
22
- try {
23
- return await signerFor(cloudConfigPath(home));
24
- } catch {
25
- return void 0;
26
- }
27
- }
28
- function signedBy(base, signerOf) {
29
- return (async (input, init) => {
30
- if (input instanceof Request) return base(input, init);
31
- const headers = new Headers(init?.headers);
32
- const signer = await signerOf(headers);
33
- const body = bodyBytes(init?.body);
34
- if (signer === void 0 || body === void 0) return base(input, init);
35
- const signature = await signRunnerRequest({ method: init?.method ?? "GET", url: input.toString(), body, signer });
36
- for (const [name, value] of Object.entries(signature)) headers.set(name, value);
37
- return base(input, { ...init, headers });
38
- });
39
- }
40
- function signingFetch(base, home = () => homeFromEnv()) {
41
- return signedBy(base, (headers) => savedKeySigner(headers, home()));
42
- }
43
- function signingFetchFor(base, configPath, apiKey) {
44
- return signedBy(base, async (headers) => {
45
- const authorization = headers.get("authorization");
46
- if (authorization !== `Bearer ${apiKey}` || headers.has("signature")) return void 0;
47
- try {
48
- return await signerFor(configPath);
49
- } catch {
50
- return void 0;
51
- }
52
- });
53
- }
54
- var defaultFetch = signingFetch((input, init) => globalThis.fetch(input, init));
55
-
56
- export { defaultFetch, signingFetchFor };
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire } from 'node:module';
3
- export { COMMIT_LINE, autoConnectedLine, listText as factoryListText, slug as factorySlug, fetchFactories, promptOnTerminal, realConnectDeps, runConnect, runConnectCommand, saveFactoryConnection, selectFactory } from './chunk-JRCSET55.js';
4
- import './chunk-G3IJ3N6F.js';
5
- import './chunk-EAQSOE62.js';
6
- import './chunk-F35VMF5M.js';
7
- import './chunk-NTRCK4NH.js';
8
- import './chunk-BJ3KTMDH.js';
9
- import './chunk-AEKSX4EY.js';
10
- import './chunk-EABW6AJQ.js';
11
- import './chunk-ANPNT6PM.js';
12
- import './chunk-CRB3POP4.js';
13
- import './chunk-7VUK5RFS.js';
14
- import './chunk-VNVZDWO3.js';
15
- import './chunk-Z5GEFMRW.js';
16
-
17
- createRequire(import.meta.url);
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire } from 'node:module';
3
- export { EmitError, runEmit } from './chunk-XCRZTXRL.js';
4
- import './chunk-USWVXQIH.js';
5
- import './chunk-5OCIHFGE.js';
6
- import './chunk-ANPNT6PM.js';
7
- import './chunk-CRB3POP4.js';
8
- import './chunk-WFSUUUAN.js';
9
- import './chunk-7VUK5RFS.js';
10
- import './chunk-VNVZDWO3.js';
11
- import './chunk-RA3O54FC.js';
12
- import './chunk-Z5GEFMRW.js';
13
-
14
- createRequire(import.meta.url);
@@ -1,211 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire } from 'node:module';
3
- import { contextIsGoverned, inspectStarterFiles, readShippedManifest, skillsFolders, contentHash, canonical } from './chunk-VSUXCMMH.js';
4
- import { keepHandWritten } from './chunk-O6RJ3QMU.js';
5
- import { runEmit } from './chunk-XCRZTXRL.js';
6
- import { COMMIT_LINE } from './chunk-JRCSET55.js';
7
- import './chunk-G3IJ3N6F.js';
8
- import './chunk-EAQSOE62.js';
9
- import './chunk-F35VMF5M.js';
10
- import './chunk-6YBLN4TR.js';
11
- import './chunk-USWVXQIH.js';
12
- import './chunk-QF7WZUU6.js';
13
- import './chunk-NTRCK4NH.js';
14
- import './chunk-ZJSNLVCE.js';
15
- import { findGitDirs } from './chunk-BJ3KTMDH.js';
16
- import './chunk-AEKSX4EY.js';
17
- import { setMcpEntry } from './chunk-DIB2WLBL.js';
18
- import './chunk-EABW6AJQ.js';
19
- import './chunk-V7SAQ645.js';
20
- import { writeMaintainedFiles, maintainedFilesForExistingSkills, loadMaintainedFiles } from './chunk-5OCIHFGE.js';
21
- import { C } from './chunk-ANPNT6PM.js';
22
- import { cliInvocation } from './chunk-CRB3POP4.js';
23
- import { hasSymlinkComponent } from './chunk-W3SWJ2TD.js';
24
- import './chunk-YQR6E6OV.js';
25
- import './chunk-TUSYOL2O.js';
26
- import './chunk-WFSUUUAN.js';
27
- import './chunk-7VUK5RFS.js';
28
- import './chunk-VNVZDWO3.js';
29
- import './chunk-RA3O54FC.js';
30
- import './chunk-OW52QLK3.js';
31
- import './chunk-IHNQWF6F.js';
32
- import './chunk-URWYRAIC.js';
33
- import './chunk-GISNHSYL.js';
34
- import './chunk-Z5GEFMRW.js';
35
- import { existsSync, readFileSync, mkdirSync, writeFileSync, unlinkSync, readdirSync, rmdirSync } from 'fs';
36
- import { join, dirname } from 'path';
37
-
38
- createRequire(import.meta.url);
39
- var NOT_COMPILED = `There is no .outerlayer/config.json, so \`${cliInvocation()} context emit\` did not run.`;
40
- var errorMessage = (err) => err instanceof Error ? err.message : String(err);
41
- function actionFor(item) {
42
- if (item.state === "outdated") return "update";
43
- if (item.state === "missing") return "write";
44
- if (item.state === "current") return "none";
45
- return "keep";
46
- }
47
- var SKILLS_DIR = ".outerlayer/skills/";
48
- function removals(root, report, packRoot) {
49
- const manifest = readShippedManifest(packRoot);
50
- const planned = [];
51
- const add = (path) => planned.push({ path, state: "retired", action: "remove" });
52
- for (const file of report.retired.filter((f) => f.state === "unedited")) {
53
- add(file.path);
54
- const rel = file.path.slice(SKILLS_DIR.length);
55
- if (!manifest.ok || !/^[^/]+\/scripts\//.test(rel)) continue;
56
- for (const folder of skillsFolders().filter((f) => `${f}/` !== SKILLS_DIR)) {
57
- const native = `${folder}/${rel}`;
58
- if (hasSymlinkComponent(root, native)) continue;
59
- try {
60
- if (manifest.files.get(file.path)?.has(contentHash(readFileSync(join(root, native), "utf8"))) === true) add(native);
61
- } catch {
62
- }
63
- }
64
- }
65
- return planned;
66
- }
67
- function removeFile(root, path) {
68
- if (hasSymlinkComponent(root, path)) return false;
69
- unlinkSync(join(root, path));
70
- for (let dir = dirname(path); dir !== "."; dir = dirname(dir)) {
71
- try {
72
- if (readdirSync(join(root, dir)).length > 0) break;
73
- rmdirSync(join(root, dir));
74
- } catch {
75
- break;
76
- }
77
- }
78
- return true;
79
- }
80
- function plan(report) {
81
- return report.items.map((item) => {
82
- const planned = { path: item.path, state: item.state, action: actionFor(item) };
83
- if (item.kind === "mcp") planned.server = item.server;
84
- if (item.kind === "file" && item.state === "edited" && item.file.source !== void 0) {
85
- planned.compare = `git diff --no-index ${item.file.source} ${item.path}`;
86
- }
87
- return planned;
88
- });
89
- }
90
- function apply(root, item) {
91
- if (item.kind === "file") {
92
- const abs = join(root, item.path);
93
- mkdirSync(dirname(abs), { recursive: true });
94
- writeFileSync(abs, item.file.content);
95
- } else {
96
- setMcpEntry(root, item.server, { ...item.entry });
97
- }
98
- }
99
- var CLASHING_FLAGS = ["remove", "org", "local", "template", "factory"];
100
- function updateFlagProblem(flags) {
101
- if (flags.update !== true) return flags.dryRun === true ? "--dry-run only applies to --update." : void 0;
102
- const clash = CLASHING_FLAGS.find((name) => flags[name] !== void 0 && flags[name] !== false);
103
- return clash === void 0 ? void 0 : `--update changes only the files init wrote, so it cannot be combined with --${clash}.`;
104
- }
105
- var MCP_SOURCE = ".outerlayer/mcp.json";
106
- function sameJson(a, b) {
107
- try {
108
- return b !== void 0 && canonical(JSON.parse(a)) === canonical(JSON.parse(b));
109
- } catch {
110
- return false;
111
- }
112
- }
113
- function keepUnlessCompiled(keep, mcpSourceBefore) {
114
- return (output) => {
115
- if (output.kind === "file" && sameJson(output.existing, mcpSourceBefore)) return false;
116
- return keep(output);
117
- };
118
- }
119
- function runInitUpdate(opts) {
120
- const dryRun = opts.dryRun === true;
121
- const empty = { dryRun, items: [], emitted: [], kept: [], manifest: "ok" };
122
- const dirs = findGitDirs(opts.cwd);
123
- if (dirs === void 0) return { ...empty, status: "skipped", reason: "not a git repository" };
124
- const root = dirs.repoRoot;
125
- if (contextIsGoverned(dirs.gitCommonDir)) {
126
- return { ...empty, status: "skipped", reason: "this repository's context comes from a control plane and arrives at session start" };
127
- }
128
- const report = inspectStarterFiles(root, { packRoot: opts.packRoot });
129
- const dropped = removals(root, report, opts.packRoot);
130
- const items = [...plan(report), ...dropped];
131
- const base = { dryRun, items, emitted: [], kept: [], manifest: report.manifest };
132
- const changes = report.items.filter((i) => i.state === "outdated" || i.state === "missing");
133
- const nothing = changes.length === 0 && dropped.length === 0;
134
- if (dryRun || nothing) return { ...base, status: "done", reason: nothing ? "nothing to update" : "dry run" };
135
- const created = new Set(changes.filter((i) => i.kind === "file" && i.state === "missing").map((i) => i.path));
136
- const mcpSource = join(root, MCP_SOURCE);
137
- const mcpSourceBefore = existsSync(mcpSource) ? readFileSync(mcpSource, "utf8") : void 0;
138
- try {
139
- for (const item of changes) apply(root, item);
140
- for (const item of dropped) if (!removeFile(root, item.path)) item.action = "keep";
141
- } catch (err) {
142
- return { ...base, status: "failed", reason: `could not write the files: ${errorMessage(err)}` };
143
- }
144
- if (!existsSync(join(root, ".outerlayer", "config.json"))) {
145
- try {
146
- writeMaintainedFiles(root, maintainedFilesForExistingSkills(root, loadMaintainedFiles(opts.packRoot)));
147
- } catch (err) {
148
- return { ...base, status: "failed", reason: `could not write the files: ${errorMessage(err)}` };
149
- }
150
- return { ...base, status: "done", reason: NOT_COMPILED };
151
- }
152
- try {
153
- const keep = keepUnlessCompiled(keepHandWritten(created), mcpSourceBefore);
154
- const pending = runEmit({ cwd: root, check: true, quiet: true, keep }).drift ?? [];
155
- const emitted = runEmit({ cwd: root, quiet: true, keep });
156
- if (emitted.exitCode !== 0) throw new Error(emitted.errors.map((e) => `${e.path}: ${e.message}`).join("; "));
157
- return {
158
- ...base,
159
- status: "done",
160
- reason: "updated",
161
- emitted: pending.filter((d) => d.kind !== "orphaned").map((d) => d.path),
162
- kept: emitted.kept
163
- };
164
- } catch (err) {
165
- return { ...base, status: "failed", reason: `context emit failed: ${errorMessage(err)}` };
166
- }
167
- }
168
- var VERB = {
169
- update: { done: "updated", planned: "would update" },
170
- write: { done: "wrote", planned: "would write" },
171
- remove: { done: "removed", planned: "would remove" }
172
- };
173
- function formatInitUpdate(result) {
174
- if (result.status === "skipped") return `${C.dim}- Nothing to update: ${result.reason}${C.reset}
175
- `;
176
- const lines = [];
177
- const label = (p) => p.server === void 0 ? p.path : `${p.path} "${p.server}" server`;
178
- const changed = result.items.filter((p) => p.action === "update" || p.action === "write" || p.action === "remove");
179
- const kept = result.items.filter((p) => p.action === "keep" && p.state !== "retired");
180
- const current = result.items.filter((p) => p.action === "none");
181
- lines.push(result.dryRun ? `Plan for \`${cliInvocation()} init --update\` (nothing written):` : "Starter files:");
182
- for (const p of changed) {
183
- const verb = VERB[p.action];
184
- const why = p.action === "update" ? "outdated, unedited" : p.action === "remove" ? "no longer shipped, unedited" : "missing";
185
- lines.push(` ${result.dryRun ? verb.planned : `${C.green}${verb.done}${C.reset}`} ${label(p)} ${C.dim}(${why})${C.reset}`);
186
- }
187
- for (const p of kept) {
188
- const why = p.state === "unreadable" ? "not valid JSON" : "edited by you";
189
- lines.push(` ${C.yellow}kept${C.reset} ${label(p)} ${C.dim}(${why}, left as it is)${C.reset}`);
190
- if (p.compare !== void 0) lines.push(` ${C.dim}compare: ${p.compare}${C.reset}`);
191
- }
192
- if (current.length > 0) lines.push(` ${C.dim}${current.length} already current${C.reset}`);
193
- if (result.manifest !== "ok") {
194
- lines.push(
195
- ` ${C.yellow}!${C.reset} This CLI's record of earlier versions is ${result.manifest}, so every changed file counts as edited and is left as it is.`
196
- );
197
- }
198
- if (result.emitted.length > 0) {
199
- lines.push("", `Recompiled by \`${cliInvocation()} context emit\`:`, ...result.emitted.map((p) => ` ${p}`));
200
- }
201
- for (const p of result.kept) lines.push(` ${C.dim}kept ${p} (written by hand, not replaced)${C.reset}`);
202
- if (result.status === "failed") lines.push("", `${C.red}\u2717${C.reset} ${result.reason}`);
203
- else if (!result.dryRun && changed.length > 0) {
204
- if (result.reason === NOT_COMPILED) lines.push("", `${C.dim}${NOT_COMPILED}${C.reset}`);
205
- lines.push("", "The changes are left uncommitted.", COMMIT_LINE);
206
- } else if (changed.length === 0) lines.push("", `${C.green}\u2713${C.reset} Nothing to update.`);
207
- return `${lines.join("\n")}
208
- `;
209
- }
210
-
211
- export { formatInitUpdate, runInitUpdate, updateFlagProblem };
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { readCloudConfig, removeCloudConfigKeys } from './chunk-EABW6AJQ.js';
4
3
  import { C } from './chunk-ANPNT6PM.js';
4
+ import { readCloudConfig, removeCloudConfigKeys } from './chunk-EABW6AJQ.js';
5
5
  import { homeFromEnv } from './chunk-VNVZDWO3.js';
6
6
 
7
7
  createRequire(import.meta.url);
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { CLAUDE_CODE_VERSION, NODE_IMAGE, DEFAULT_BASE_IMAGE, RecipeError, locateRecipe, readRecipe, assertBuildable, TINI_VERSION, GH_VERSION, writeSanitizedRecipe, classifyProperties, GH_SHA256, TINI_SHA256, SANITIZED_NAME } from './chunk-3W333NFO.js';
4
3
  import { claimPidFile, RunnerAlreadyRunningError, releasePidFile } from './chunk-XACXXKQ5.js';
5
4
  import { startTimeOf } from './chunk-JBJTC3UU.js';
5
+ import { CLAUDE_CODE_VERSION, NODE_IMAGE, DEFAULT_BASE_IMAGE, RecipeError, locateRecipe, readRecipe, assertBuildable, TINI_VERSION, GH_VERSION, writeSanitizedRecipe, classifyProperties, GH_SHA256, TINI_SHA256, SANITIZED_NAME } from './chunk-3W333NFO.js';
6
6
  import { RUNNER_DIR_MODE, repoCacheDir, imagesDir, attemptStamp, runnerDir, rootfsPathFor, RUNNER_FILE_MODE } from './chunk-IHNQWF6F.js';
7
7
  import { withGitConfig, tokenHeader, PROXY_WARNING_FLAG } from './chunk-URWYRAIC.js';
8
8
  import { RELAY_ID, RELAY_USER } from './chunk-GISNHSYL.js';
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { readCloudConfig } from './chunk-EABW6AJQ.js';
4
3
  import { C } from './chunk-ANPNT6PM.js';
4
+ import { readCloudConfig } from './chunk-EABW6AJQ.js';
5
5
  import { cliInvocation } from './chunk-CRB3POP4.js';
6
6
  import { existsSync, writeFileSync, readFileSync, mkdirSync } from 'fs';
7
7
  import { join, dirname } from 'path';