ghostrail 0.4.0 → 0.6.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/README.md +160 -2
- package/dist/cli/commands.d.ts +42 -1
- package/dist/cli/commands.d.ts.map +1 -1
- package/dist/cli/commands.js +150 -2
- package/dist/cli/commands.js.map +1 -1
- package/dist/cli/prompt.d.ts +26 -0
- package/dist/cli/prompt.d.ts.map +1 -0
- package/dist/cli/prompt.js +48 -0
- package/dist/cli/prompt.js.map +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +5 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/help.d.ts.map +1 -1
- package/dist/commands/help.js +13 -0
- package/dist/commands/help.js.map +1 -1
- package/dist/factory/build.d.ts +2 -7
- package/dist/factory/build.d.ts.map +1 -1
- package/dist/factory/build.js +2 -16
- package/dist/factory/build.js.map +1 -1
- package/dist/image/build.d.ts +28 -0
- package/dist/image/build.d.ts.map +1 -0
- package/dist/image/build.js +40 -0
- package/dist/image/build.js.map +1 -0
- package/dist/secrets/editor.d.ts +16 -0
- package/dist/secrets/editor.d.ts.map +1 -0
- package/dist/secrets/editor.js +35 -0
- package/dist/secrets/editor.js.map +1 -0
- package/dist/secrets/env-file.d.ts +0 -13
- package/dist/secrets/env-file.d.ts.map +1 -1
- package/dist/secrets/env-file.js +6 -2
- package/dist/secrets/env-file.js.map +1 -1
- package/dist/secrets/index.d.ts +3 -0
- package/dist/secrets/index.d.ts.map +1 -1
- package/dist/secrets/index.js +3 -0
- package/dist/secrets/index.js.map +1 -1
- package/dist/secrets/known.d.ts +19 -0
- package/dist/secrets/known.d.ts.map +1 -0
- package/dist/secrets/known.js +23 -0
- package/dist/secrets/known.js.map +1 -0
- package/dist/secrets/setup.d.ts +44 -0
- package/dist/secrets/setup.d.ts.map +1 -0
- package/dist/secrets/setup.js +124 -0
- package/dist/secrets/setup.js.map +1 -0
- package/package.json +2 -2
- package/scripts/build-factory-image.sh +10 -0
- package/skill/ghostrail/SKILL.md +11 -2
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { createInterface } from "node:readline/promises";
|
|
2
|
+
/**
|
|
3
|
+
* Read one line of a yes/no answer.
|
|
4
|
+
*
|
|
5
|
+
* Empty input takes the default, which is what makes `[y/N]` and `[Y/n]` mean
|
|
6
|
+
* what their capitalized letter advertises. Anything unrecognized takes the
|
|
7
|
+
* default too: a prompt during an install must never become a trap, and both
|
|
8
|
+
* things we ask about are safe either way.
|
|
9
|
+
*/
|
|
10
|
+
export function interpretAnswer(input, defaultYes) {
|
|
11
|
+
const answer = input.trim().toLowerCase();
|
|
12
|
+
if (answer === "y" || answer === "yes")
|
|
13
|
+
return true;
|
|
14
|
+
if (answer === "n" || answer === "no")
|
|
15
|
+
return false;
|
|
16
|
+
return defaultYes;
|
|
17
|
+
}
|
|
18
|
+
/** Ask on stdin/stdout, closing the readline interface whatever happens. */
|
|
19
|
+
export const askOnTerminal = async (question, defaultYes) => {
|
|
20
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
21
|
+
try {
|
|
22
|
+
const suffix = defaultYes ? "[Y/n]" : "[y/N]";
|
|
23
|
+
return interpretAnswer(await rl.question(`${question} ${suffix} `), defaultYes);
|
|
24
|
+
}
|
|
25
|
+
finally {
|
|
26
|
+
rl.close();
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Parse `--image`/`--no-image` and `--secrets`/`--no-secrets`. A negative flag
|
|
31
|
+
* wins over a positive one whatever the order, so a scripted `--no-image`
|
|
32
|
+
* cannot be undone by a stray `--image`. Unset stays `undefined`, which is
|
|
33
|
+
* "no preference stated" rather than a refusal.
|
|
34
|
+
*/
|
|
35
|
+
export function parseInstallOffers(argv) {
|
|
36
|
+
const decide = (yes, no) => {
|
|
37
|
+
if (argv.includes(no))
|
|
38
|
+
return false;
|
|
39
|
+
if (argv.includes(yes))
|
|
40
|
+
return true;
|
|
41
|
+
return undefined;
|
|
42
|
+
};
|
|
43
|
+
return {
|
|
44
|
+
image: decide("--image", "--no-image"),
|
|
45
|
+
secrets: decide("--secrets", "--no-secrets"),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../src/cli/prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAAC,KAAa,EAAE,UAAmB;IAChE,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC1C,IAAI,MAAM,KAAK,GAAG,IAAI,MAAM,KAAK,KAAK;QAAE,OAAO,IAAI,CAAC;IACpD,IAAI,MAAM,KAAK,GAAG,IAAI,MAAM,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IACpD,OAAO,UAAU,CAAC;AACpB,CAAC;AAKD,4EAA4E;AAC5E,MAAM,CAAC,MAAM,aAAa,GAAU,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE;IACjE,MAAM,EAAE,GAAG,eAAe,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC7E,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;QAC9C,OAAO,eAAe,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,GAAG,QAAQ,IAAI,MAAM,GAAG,CAAC,EAAE,UAAU,CAAC,CAAC;IAClF,CAAC;YAAS,CAAC;QACT,EAAE,CAAC,KAAK,EAAE,CAAC;IACb,CAAC;AACH,CAAC,CAAC;AAQF;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAuB;IACxD,MAAM,MAAM,GAAG,CAAC,GAAW,EAAE,EAAU,EAAuB,EAAE;QAC9D,IAAI,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;YAAE,OAAO,KAAK,CAAC;QACpC,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;YAAE,OAAO,IAAI,CAAC;QACpC,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC;IACF,OAAO;QACL,KAAK,EAAE,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC;QACtC,OAAO,EAAE,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC;KAC7C,CAAC;AACJ,CAAC"}
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAoBA,wEAAwE;AACxE,MAAM,WAAW,OAAO;IACtB,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5B,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7B;AAOD;;;;;;;;GAQG;AACH,wBAAsB,GAAG,CACvB,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,OAAO,GAAE,OAAwB,GAChC,OAAO,CAAC,MAAM,CAAC,CA6BjB"}
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import process from "node:process";
|
|
2
2
|
import { parseArgs } from "./args.js";
|
|
3
|
-
import { cmdArtifacts, cmdBoard, cmdClaudeSetup, cmdInit, cmdInstall, cmdRespond, cmdRun, cmdSelfUpdate, cmdSkill, cmdTriage, cmdWatch, } from "./cli/commands.js";
|
|
3
|
+
import { cmdArtifacts, cmdBoard, cmdClaudeSetup, cmdImage, cmdInit, cmdInstall, cmdRespond, cmdRun, cmdSecretsSetup, cmdSelfUpdate, cmdSkill, cmdTriage, cmdWatch, } from "./cli/commands.js";
|
|
4
4
|
import { renderHelp } from "./commands/help.js";
|
|
5
5
|
import { VERSION } from "./version.js";
|
|
6
6
|
const defaultStreams = {
|
|
@@ -34,12 +34,16 @@ export async function run(argv, streams = defaultStreams) {
|
|
|
34
34
|
return cmdSkill(rest, streams);
|
|
35
35
|
if (first === "install")
|
|
36
36
|
return cmdInstall(rest, streams);
|
|
37
|
+
if (first === "image")
|
|
38
|
+
return cmdImage(rest, streams);
|
|
37
39
|
if (first === "self-update")
|
|
38
40
|
return cmdSelfUpdate(rest, streams);
|
|
39
41
|
if (first === "artifacts")
|
|
40
42
|
return cmdArtifacts(rest, streams);
|
|
41
43
|
if (first === "claude-setup")
|
|
42
44
|
return cmdClaudeSetup(rest, streams);
|
|
45
|
+
if (first === "secrets-setup")
|
|
46
|
+
return cmdSecretsSetup(rest, streams);
|
|
43
47
|
const parsed = parseArgs(argv);
|
|
44
48
|
switch (parsed.command) {
|
|
45
49
|
case "version":
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EACL,YAAY,EACZ,QAAQ,EACR,cAAc,EACd,OAAO,EACP,UAAU,EACV,UAAU,EACV,MAAM,EACN,aAAa,EACb,QAAQ,EACR,SAAS,EACT,QAAQ,GACT,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAQvC,MAAM,cAAc,GAAY;IAC9B,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAA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"help.d.ts","sourceRoot":"","sources":["../../src/commands/help.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,UAAU,IAAI,MAAM,
|
|
1
|
+
{"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../../src/commands/help.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,UAAU,IAAI,MAAM,CA0DnC"}
|
package/dist/commands/help.js
CHANGED
|
@@ -15,6 +15,7 @@ export function renderHelp() {
|
|
|
15
15
|
" install Install the CLI globally + the /ghostrail agent skill",
|
|
16
16
|
" skill Install/update the /ghostrail skill for your coding agents",
|
|
17
17
|
" self-update Update the CLI, then its skill",
|
|
18
|
+
" image build Build the factory container image (container backend only)",
|
|
18
19
|
" run Drain eligible work once: claim, isolate, run, gate, open PRs",
|
|
19
20
|
" watch Run ticks on an interval until interrupted (no cron needed)",
|
|
20
21
|
" triage Decompose large issues in the triage queue into sub-issues",
|
|
@@ -22,6 +23,7 @@ export function renderHelp() {
|
|
|
22
23
|
" board Serve the run store as a local dashboard",
|
|
23
24
|
" artifacts List shared artifacts in the global store",
|
|
24
25
|
" claude-setup Propose/compose the factory Claude profile from your ~/.claude",
|
|
26
|
+
" secrets-setup Scaffold the global secrets.env, then open it in your editor",
|
|
25
27
|
" help Show this help",
|
|
26
28
|
" version Show the ghostrail version",
|
|
27
29
|
"",
|
|
@@ -42,6 +44,17 @@ export function renderHelp() {
|
|
|
42
44
|
" --force Overwrite a conflicting file",
|
|
43
45
|
" uninstall Remove the skill from every agent",
|
|
44
46
|
"",
|
|
47
|
+
"Options (install):",
|
|
48
|
+
" --image / --no-image Build the factory image (default: ask on a TTY)",
|
|
49
|
+
" --secrets / --no-secrets Create the credentials file (default: ask on a TTY)",
|
|
50
|
+
"",
|
|
51
|
+
"Options (image build):",
|
|
52
|
+
" -t, --tag <tag> Image tag (default: ghostrail-factory:local)",
|
|
53
|
+
"",
|
|
54
|
+
"Options (secrets-setup):",
|
|
55
|
+
" --write Create or top up the file (default: report only)",
|
|
56
|
+
" --no-edit Do not open an editor after writing",
|
|
57
|
+
"",
|
|
45
58
|
"Options (watch):",
|
|
46
59
|
" -i, --interval <dur> Poll interval, e.g. 30s, 5m, 1h (default: 60s)",
|
|
47
60
|
" --max-ticks <n> Stop after n ticks (default: run until interrupted)",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help.js","sourceRoot":"","sources":["../../src/commands/help.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC;;;GAGG;AACH,MAAM,UAAU,UAAU;IACxB,OAAO;QACL,aAAa,OAAO,mDAAmD;QACvE,EAAE;QACF,QAAQ;QACR,iCAAiC;QACjC,EAAE;QACF,WAAW;QACX,0EAA0E;QAC1E,qEAAqE;QACrE,0EAA0E;QAC1E,8CAA8C;QAC9C,6EAA6E;QAC7E,2EAA2E;QAC3E,0EAA0E;QAC1E,mEAAmE;QACnE,wDAAwD;QACxD,yDAAyD;QACzD,gFAAgF;QAChF,8BAA8B;QAC9B,0CAA0C;QAC1C,EAAE;QACF,gCAAgC;QAChC,+DAA+D;QAC/D,2DAA2D;QAC3D,EAAE;QACF,iBAAiB;QACjB,8DAA8D;QAC9D,wEAAwE;QACxE,wEAAwE;QACxE,EAAE;QACF,kBAAkB;QAClB,4EAA4E;QAC5E,yEAAyE;QACzE,sEAAsE;QACtE,iEAAiE;QACjE,sDAAsD;QACtD,2DAA2D;QAC3D,EAAE;QACF,kBAAkB;QAClB,wEAAwE;QACxE,6EAA6E;QAC7E,EAAE;QACF,6BAA6B;KAC9B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
|
|
1
|
+
{"version":3,"file":"help.js","sourceRoot":"","sources":["../../src/commands/help.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC;;;GAGG;AACH,MAAM,UAAU,UAAU;IACxB,OAAO;QACL,aAAa,OAAO,mDAAmD;QACvE,EAAE;QACF,QAAQ;QACR,iCAAiC;QACjC,EAAE;QACF,WAAW;QACX,0EAA0E;QAC1E,qEAAqE;QACrE,0EAA0E;QAC1E,8CAA8C;QAC9C,0EAA0E;QAC1E,6EAA6E;QAC7E,2EAA2E;QAC3E,0EAA0E;QAC1E,mEAAmE;QACnE,wDAAwD;QACxD,yDAAyD;QACzD,gFAAgF;QAChF,8EAA8E;QAC9E,8BAA8B;QAC9B,0CAA0C;QAC1C,EAAE;QACF,gCAAgC;QAChC,+DAA+D;QAC/D,2DAA2D;QAC3D,EAAE;QACF,iBAAiB;QACjB,8DAA8D;QAC9D,wEAAwE;QACxE,wEAAwE;QACxE,EAAE;QACF,kBAAkB;QAClB,4EAA4E;QAC5E,yEAAyE;QACzE,sEAAsE;QACtE,iEAAiE;QACjE,sDAAsD;QACtD,2DAA2D;QAC3D,EAAE;QACF,oBAAoB;QACpB,iFAAiF;QACjF,qFAAqF;QACrF,EAAE;QACF,wBAAwB;QACxB,sEAAsE;QACtE,EAAE;QACF,0BAA0B;QAC1B,0EAA0E;QAC1E,6DAA6D;QAC7D,EAAE;QACF,kBAAkB;QAClB,wEAAwE;QACxE,6EAA6E;QAC7E,EAAE;QACF,6BAA6B;KAC9B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
|
package/dist/factory/build.d.ts
CHANGED
|
@@ -5,16 +5,11 @@ import type { LoopDeps } from "../loop/engine.js";
|
|
|
5
5
|
import type { Lock, Logger, Source } from "../loop/ports.js";
|
|
6
6
|
import { type GhRunner } from "../publish/gh.js";
|
|
7
7
|
import type { RespondConfig, RespondDeps } from "../respond/respond.js";
|
|
8
|
+
import { DEFAULT_FORWARD_ENV } from "../secrets/known.js";
|
|
8
9
|
import type { TriageDeps } from "../triage/engine.js";
|
|
9
10
|
/** The store directory inside a repo (gitignored). */
|
|
10
11
|
export declare const STORE_DIR = ".factory";
|
|
11
|
-
|
|
12
|
-
* Host env names forwarded into every container `docker exec` by default, so the
|
|
13
|
-
* agent and gate have the credentials they need. Only names are configured;
|
|
14
|
-
* values come from the process environment (after the secrets loader has applied
|
|
15
|
-
* them), and unset names are simply skipped. The container inherits nothing else.
|
|
16
|
-
*/
|
|
17
|
-
export declare const DEFAULT_FORWARD_ENV: readonly string[];
|
|
12
|
+
export { DEFAULT_FORWARD_ENV };
|
|
18
13
|
/** Runtime inputs the config cannot supply: paths, secrets, and injectables. */
|
|
19
14
|
export interface BuildContext {
|
|
20
15
|
/** Absolute path to the repo the factory operates on. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/factory/build.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAU,KAAK,QAAQ,EAAiB,MAAM,kBAAkB,CAAC;AAExE,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/factory/build.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,M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AM,GAAG,SAAS,CAAC,CAQ7B;AAED,0DAA0D;AAC1D,wBAAgB,aAAa,CAAC,MAAM,EAAE,eAAe,EAAE,GAAG,EAAE,YAAY,GAAG,QAAQ,CAqBlF;AAED,+DAA+D;AAC/D,wBAAgB,eAAe,CAAC,MAAM,EAAE,eAAe,EAAE,GAAG,EAAE,YAAY,GAAG,UAAU,CA8BtF;AAED,0EAA0E;AAC1E,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,eAAe,EACvB,GAAG,EAAE,YAAY,GAChB;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,MAAM,EAAE,aAAa,CAAA;CAAE,CA0B9C"}
|
package/dist/factory/build.js
CHANGED
|
@@ -7,26 +7,12 @@ import { CommandGate } from "../gate/gate.js";
|
|
|
7
7
|
import { GhHost, parseRepoSlug } from "../publish/gh.js";
|
|
8
8
|
import { GitHubPublisher } from "../publish/github-publisher.js";
|
|
9
9
|
import { FileWatermarkStore } from "../respond/store.js";
|
|
10
|
+
import { DEFAULT_FORWARD_ENV } from "../secrets/known.js";
|
|
10
11
|
import { LinearSource, createFetchRequester } from "../source/linear.js";
|
|
11
12
|
import { FileStore } from "../store/file-store.js";
|
|
12
13
|
/** The store directory inside a repo (gitignored). */
|
|
13
14
|
export const STORE_DIR = ".factory";
|
|
14
|
-
|
|
15
|
-
* Host env names forwarded into every container `docker exec` by default, so the
|
|
16
|
-
* agent and gate have the credentials they need. Only names are configured;
|
|
17
|
-
* values come from the process environment (after the secrets loader has applied
|
|
18
|
-
* them), and unset names are simply skipped. The container inherits nothing else.
|
|
19
|
-
*/
|
|
20
|
-
export const DEFAULT_FORWARD_ENV = [
|
|
21
|
-
// Agent auth, both rails: ANTHROPIC_API_KEY bills metered API and wins if both
|
|
22
|
-
// are set; CLAUDE_CODE_OAUTH_TOKEN (from `claude setup-token`) bills the Pro/Max
|
|
23
|
-
// subscription when the API key is unset.
|
|
24
|
-
"ANTHROPIC_API_KEY",
|
|
25
|
-
"CLAUDE_CODE_OAUTH_TOKEN",
|
|
26
|
-
"GH_TOKEN",
|
|
27
|
-
"GITHUB_TOKEN",
|
|
28
|
-
"LINEAR_API_KEY",
|
|
29
|
-
];
|
|
15
|
+
export { DEFAULT_FORWARD_ENV };
|
|
30
16
|
/** Construct the isolation backend named by the config. */
|
|
31
17
|
export function buildBackend(config) {
|
|
32
18
|
switch (config.backend.kind) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/factory/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAI9C,OAAO,EAAE,MAAM,EAAiB,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGnD,sDAAsD;AACtD,MAAM,CAAC,MAAM,SAAS,GAAG,UAAU,CAAC;AAEpC
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/factory/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC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AChC,GAAG,CAAC,GAAG,CAAC,gBAAgB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,gBAAgB,EAAE,GAAG,CAAC,gBAAgB,EAAE,CAAC;QACzF,GAAG,CAAC,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC;KAC5D,CAAC;IACF,MAAM,aAAa,GAAkB;QACnC,KAAK,EAAE,WAAW;QAClB,UAAU,EAAE,GAAG,CAAC,UAAU,IAAI,EAAE;QAChC,0EAA0E;QAC1E,gFAAgF;QAChF,KAAK,EACH,MAAM,CAAC,OAAO,KAAK,SAAS;YAC1B,CAAC,CAAC,MAAM,CAAC,KAAK;YACd,CAAC,CAAC,EAAE,GAAG,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE;QACxD,UAAU,EAAE,MAAM,CAAC,UAAU;KAC9B,CAAC;IACF,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The factory toolchain image tag. The cutover runbook and the example configs
|
|
3
|
+
* already name this, so it is effectively part of the public surface.
|
|
4
|
+
*/
|
|
5
|
+
export declare const DEFAULT_FACTORY_IMAGE = "ghostrail-factory:local";
|
|
6
|
+
/**
|
|
7
|
+
* The `docker` directory that ships inside the installed package, holding
|
|
8
|
+
* `factory.Dockerfile`. Resolved from this module's own URL, so it works from a
|
|
9
|
+
* global install, an npx run, or a repo checkout alike.
|
|
10
|
+
*/
|
|
11
|
+
export declare function dockerDir(): string;
|
|
12
|
+
/**
|
|
13
|
+
* The argv for the image build, after the `docker` executable itself. Each
|
|
14
|
+
* value is its own element, so a path containing a space survives: the command
|
|
15
|
+
* is spawned directly, never through a shell.
|
|
16
|
+
*/
|
|
17
|
+
export declare function dockerBuildArgs(dockerfile: string, context: string, tag: string): string[];
|
|
18
|
+
/** Flags for `ghostrail image build`. */
|
|
19
|
+
export interface ImageFlags {
|
|
20
|
+
tag: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Parse `--tag`/`-t <value>`, defaulting to {@link DEFAULT_FACTORY_IMAGE}. A
|
|
24
|
+
* flag with no value, or an empty value, is ignored rather than producing an
|
|
25
|
+
* unusable `docker build -t ""`. The last valid occurrence wins.
|
|
26
|
+
*/
|
|
27
|
+
export declare function parseImageFlags(argv: readonly string[]): ImageFlags;
|
|
28
|
+
//# sourceMappingURL=build.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/image/build.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,qBAAqB,4BAA4B,CAAC;AAE/D;;;;GAIG;AACH,wBAAgB,SAAS,IAAI,MAAM,CAElC;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAE1F;AAED,yCAAyC;AACzC,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,UAAU,CAWnE"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { fileURLToPath } from "node:url";
|
|
2
|
+
/**
|
|
3
|
+
* The factory toolchain image tag. The cutover runbook and the example configs
|
|
4
|
+
* already name this, so it is effectively part of the public surface.
|
|
5
|
+
*/
|
|
6
|
+
export const DEFAULT_FACTORY_IMAGE = "ghostrail-factory:local";
|
|
7
|
+
/**
|
|
8
|
+
* The `docker` directory that ships inside the installed package, holding
|
|
9
|
+
* `factory.Dockerfile`. Resolved from this module's own URL, so it works from a
|
|
10
|
+
* global install, an npx run, or a repo checkout alike.
|
|
11
|
+
*/
|
|
12
|
+
export function dockerDir() {
|
|
13
|
+
return fileURLToPath(new URL("../../docker", import.meta.url));
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The argv for the image build, after the `docker` executable itself. Each
|
|
17
|
+
* value is its own element, so a path containing a space survives: the command
|
|
18
|
+
* is spawned directly, never through a shell.
|
|
19
|
+
*/
|
|
20
|
+
export function dockerBuildArgs(dockerfile, context, tag) {
|
|
21
|
+
return ["build", "-f", dockerfile, "-t", tag, context];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Parse `--tag`/`-t <value>`, defaulting to {@link DEFAULT_FACTORY_IMAGE}. A
|
|
25
|
+
* flag with no value, or an empty value, is ignored rather than producing an
|
|
26
|
+
* unusable `docker build -t ""`. The last valid occurrence wins.
|
|
27
|
+
*/
|
|
28
|
+
export function parseImageFlags(argv) {
|
|
29
|
+
let tag = DEFAULT_FACTORY_IMAGE;
|
|
30
|
+
for (let i = 0; i < argv.length; i++) {
|
|
31
|
+
const arg = argv[i];
|
|
32
|
+
const next = argv[i + 1];
|
|
33
|
+
if ((arg === "--tag" || arg === "-t") && next !== undefined && next.length > 0) {
|
|
34
|
+
tag = next;
|
|
35
|
+
i++;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return { tag };
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=build.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/image/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,yBAAyB,CAAC;AAE/D;;;;GAIG;AACH,MAAM,UAAU,SAAS;IACvB,OAAO,aAAa,CAAC,IAAI,GAAG,CAAC,cAAc,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AACjE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,UAAkB,EAAE,OAAe,EAAE,GAAW;IAC9E,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;AACzD,CAAC;AAOD;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,IAAuB;IACrD,IAAI,GAAG,GAAG,qBAAqB,CAAC;IAChC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QACzB,IAAI,CAAC,GAAG,KAAK,OAAO,IAAI,GAAG,KAAK,IAAI,CAAC,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC/E,GAAG,GAAG,IAAI,CAAC;YACX,CAAC,EAAE,CAAC;QACN,CAAC;IACH,CAAC;IACD,OAAO,EAAE,GAAG,EAAE,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The editor command to launch, as an argv array, from `$VISUAL` then
|
|
3
|
+
* `$EDITOR`. The value is split on whitespace so `code -w` works. A variable
|
|
4
|
+
* that is unset, empty, or only whitespace is skipped rather than chosen, so an
|
|
5
|
+
* empty `VISUAL` still falls through to `EDITOR`. Undefined when neither yields
|
|
6
|
+
* a command: the caller prints the path instead of guessing at an editor.
|
|
7
|
+
*/
|
|
8
|
+
export declare function resolveEditor(env: Record<string, string | undefined>): string[] | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Run the editor on `path`, inheriting the terminal so a full-screen editor
|
|
11
|
+
* works, and resolve its exit code. Never rejects: a spawn failure resolves
|
|
12
|
+
* non-zero, because the file is already written by the time this runs and a
|
|
13
|
+
* failing editor is not a failing setup.
|
|
14
|
+
*/
|
|
15
|
+
export declare function launchEditor(command: readonly string[], path: string): Promise<number>;
|
|
16
|
+
//# sourceMappingURL=editor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../src/secrets/editor.ts"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GAAG,MAAM,EAAE,GAAG,SAAS,CAM3F;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAQtF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
/** The env vars that name an editor, in preference order. */
|
|
3
|
+
const EDITOR_VARS = ["VISUAL", "EDITOR"];
|
|
4
|
+
/**
|
|
5
|
+
* The editor command to launch, as an argv array, from `$VISUAL` then
|
|
6
|
+
* `$EDITOR`. The value is split on whitespace so `code -w` works. A variable
|
|
7
|
+
* that is unset, empty, or only whitespace is skipped rather than chosen, so an
|
|
8
|
+
* empty `VISUAL` still falls through to `EDITOR`. Undefined when neither yields
|
|
9
|
+
* a command: the caller prints the path instead of guessing at an editor.
|
|
10
|
+
*/
|
|
11
|
+
export function resolveEditor(env) {
|
|
12
|
+
for (const name of EDITOR_VARS) {
|
|
13
|
+
const parts = (env[name] ?? "").split(/\s+/).filter((part) => part.length > 0);
|
|
14
|
+
if (parts.length > 0)
|
|
15
|
+
return parts;
|
|
16
|
+
}
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Run the editor on `path`, inheriting the terminal so a full-screen editor
|
|
21
|
+
* works, and resolve its exit code. Never rejects: a spawn failure resolves
|
|
22
|
+
* non-zero, because the file is already written by the time this runs and a
|
|
23
|
+
* failing editor is not a failing setup.
|
|
24
|
+
*/
|
|
25
|
+
export function launchEditor(command, path) {
|
|
26
|
+
const [file, ...args] = command;
|
|
27
|
+
if (file === undefined)
|
|
28
|
+
return Promise.resolve(1);
|
|
29
|
+
return new Promise((resolve) => {
|
|
30
|
+
const child = spawn(file, [...args, path], { stdio: "inherit" });
|
|
31
|
+
child.on("error", () => resolve(1));
|
|
32
|
+
child.on("close", (code) => resolve(code ?? 1));
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=editor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editor.js","sourceRoot":"","sources":["../../src/secrets/editor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,6DAA6D;AAC7D,MAAM,WAAW,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAU,CAAC;AAElD;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,GAAuC;IACnE,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE,CAAC;QAC/B,MAAM,KAAK,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC/E,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC;YAAE,OAAO,KAAK,CAAC;IACrC,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,OAA0B,EAAE,IAAY;IACnE,MAAM,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,GAAG,OAAO,CAAC;IAChC,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAClD,OAAO,IAAI,OAAO,CAAS,CAAC,OAAO,EAAE,EAAE;QACrC,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;QACjE,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;QACpC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Parse a dotenv-style file into key/value pairs.
|
|
3
|
-
*
|
|
4
|
-
* - One `KEY=VALUE` per line; an optional leading `export ` is stripped.
|
|
5
|
-
* - Blank lines and lines whose first non-space character is `#` are ignored.
|
|
6
|
-
* - The key is everything before the first `=`, trimmed. A line with no `=`, or
|
|
7
|
-
* an empty key, is skipped.
|
|
8
|
-
* - The value is everything after the first `=`, trimmed; if it is wholly wrapped
|
|
9
|
-
* in matching single or double quotes, the quotes are removed (and the inner
|
|
10
|
-
* text is not further trimmed). `=` characters in the value are preserved.
|
|
11
|
-
*
|
|
12
|
-
* Pure: no I/O, never throws for any string.
|
|
13
|
-
*/
|
|
14
1
|
export declare function parseEnvFile(content: string): Record<string, string>;
|
|
15
2
|
/** True if a variable name denotes a secret (by known name or suffix). */
|
|
16
3
|
export declare function isSecretKey(key: string): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env-file.d.ts","sourceRoot":"","sources":["../../src/secrets/env-file.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"env-file.d.ts","sourceRoot":"","sources":["../../src/secrets/env-file.ts"],"names":[],"mappings":"AAkBA,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAgBpE;AAwBD,0EAA0E;AAC1E,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEhD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GAAG,MAAM,EAAE,CAUhF"}
|
package/dist/secrets/env-file.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Parse a dotenv-style file into key/value pairs.
|
|
3
3
|
*
|
|
4
|
-
* - One `KEY=VALUE` per line;
|
|
4
|
+
* - One `KEY=VALUE` per line; a leading `export` and the whitespace after it are
|
|
5
|
+
* stripped. Any whitespace separates them, as in a shell, so `export\tKEY=v`
|
|
6
|
+
* yields the key `KEY` rather than one literally named `export\tKEY`.
|
|
5
7
|
* - Blank lines and lines whose first non-space character is `#` are ignored.
|
|
6
8
|
* - The key is everything before the first `=`, trimmed. A line with no `=`, or
|
|
7
9
|
* an empty key, is skipped.
|
|
@@ -11,13 +13,15 @@
|
|
|
11
13
|
*
|
|
12
14
|
* Pure: no I/O, never throws for any string.
|
|
13
15
|
*/
|
|
16
|
+
/** A leading shell `export` and whatever whitespace separates it from the key. */
|
|
17
|
+
const EXPORT_PREFIX = /^export\s+/;
|
|
14
18
|
export function parseEnvFile(content) {
|
|
15
19
|
const result = {};
|
|
16
20
|
for (const rawLine of content.split("\n")) {
|
|
17
21
|
const line = rawLine.trim();
|
|
18
22
|
if (line.length === 0 || line.startsWith("#"))
|
|
19
23
|
continue;
|
|
20
|
-
const withoutExport = line.
|
|
24
|
+
const withoutExport = line.replace(EXPORT_PREFIX, "");
|
|
21
25
|
const eq = withoutExport.indexOf("=");
|
|
22
26
|
if (eq === -1)
|
|
23
27
|
continue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env-file.js","sourceRoot":"","sources":["../../src/secrets/env-file.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"env-file.js","sourceRoot":"","sources":["../../src/secrets/env-file.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,kFAAkF;AAClF,MAAM,aAAa,GAAG,YAAY,CAAC;AAEnC,MAAM,UAAU,YAAY,CAAC,OAAe;IAC1C,MAAM,MAAM,GAA2B,EAAE,CAAC;IAC1C,KAAK,MAAM,OAAO,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1C,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;QAC5B,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,SAAS;QAExD,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;QACtD,MAAM,EAAE,GAAG,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACtC,IAAI,EAAE,KAAK,CAAC,CAAC;YAAE,SAAS;QAExB,MAAM,GAAG,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;QAC9C,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC;YAAE,SAAS;QAE/B,MAAM,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IAC5D,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,OAAO,CAAC,KAAa;IAC5B,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;QACtB,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,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.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
export { launchEditor, resolveEditor } from "./editor.js";
|
|
1
2
|
export { isSecretKey, parseEnvFile, secretValuesOf } from "./env-file.js";
|
|
3
|
+
export { type CredentialKey, DEFAULT_FORWARD_ENV } from "./known.js";
|
|
4
|
+
export { appendPlaceholders, KNOWN_SECRETS, mentionedKeys, missingSecrets, readSecretsFile, renderFile, SECRETS_DIR_MODE, SECRETS_FILE_MODE, type SecretSpec, writeSecretsFile, } from "./setup.js";
|
|
2
5
|
export { applyOverrides, GLOBAL_SECRETS_FILE, type LoadedEnv, loadEnvOverrides, REPO_SECRETS_FILE, } from "./load.js";
|
|
3
6
|
export { REDACTION, redactSecrets } from "./redact.js";
|
|
4
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/secrets/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC1E,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,KAAK,SAAS,EACd,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/secrets/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC1E,OAAO,EAAE,KAAK,aAAa,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACrE,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,KAAK,UAAU,EACf,gBAAgB,GACjB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,KAAK,SAAS,EACd,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/secrets/index.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
export { launchEditor, resolveEditor } from "./editor.js";
|
|
1
2
|
export { isSecretKey, parseEnvFile, secretValuesOf } from "./env-file.js";
|
|
3
|
+
export { DEFAULT_FORWARD_ENV } from "./known.js";
|
|
4
|
+
export { appendPlaceholders, KNOWN_SECRETS, mentionedKeys, missingSecrets, readSecretsFile, renderFile, SECRETS_DIR_MODE, SECRETS_FILE_MODE, writeSecretsFile, } from "./setup.js";
|
|
2
5
|
export { applyOverrides, GLOBAL_SECRETS_FILE, loadEnvOverrides, REPO_SECRETS_FILE, } from "./load.js";
|
|
3
6
|
export { REDACTION, redactSecrets } from "./redact.js";
|
|
4
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/secrets/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC1E,OAAO,EACL,cAAc,EACd,mBAAmB,EAEnB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/secrets/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC1E,OAAO,EAAsB,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACrE,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EAEjB,gBAAgB,GACjB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,cAAc,EACd,mBAAmB,EAEnB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host env names forwarded into every container `docker exec` by default, so the
|
|
3
|
+
* agent and gate have the credentials they need. Only names are configured;
|
|
4
|
+
* values come from the process environment (after the secrets loader has applied
|
|
5
|
+
* them), and unset names are simply skipped. The container inherits nothing else.
|
|
6
|
+
*
|
|
7
|
+
* This is also the canonical list of credentials ghostrail reads, so
|
|
8
|
+
* `secrets-setup` scaffolds a placeholder for exactly these names. It lives in a
|
|
9
|
+
* leaf module so both consumers can share it without dragging in the factory's
|
|
10
|
+
* dependency graph.
|
|
11
|
+
*
|
|
12
|
+
* Agent auth covers both rails: ANTHROPIC_API_KEY bills metered API and wins if
|
|
13
|
+
* both are set; CLAUDE_CODE_OAUTH_TOKEN (from `claude setup-token`) bills the
|
|
14
|
+
* Pro/Max subscription when the API key is unset.
|
|
15
|
+
*/
|
|
16
|
+
export declare const DEFAULT_FORWARD_ENV: readonly ["ANTHROPIC_API_KEY", "CLAUDE_CODE_OAUTH_TOKEN", "GH_TOKEN", "GITHUB_TOKEN", "LINEAR_API_KEY"];
|
|
17
|
+
/** A credential name ghostrail reads. */
|
|
18
|
+
export type CredentialKey = (typeof DEFAULT_FORWARD_ENV)[number];
|
|
19
|
+
//# sourceMappingURL=known.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"known.d.ts","sourceRoot":"","sources":["../../src/secrets/known.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,mBAAmB,yGAMtB,CAAC;AAEX,yCAAyC;AACzC,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host env names forwarded into every container `docker exec` by default, so the
|
|
3
|
+
* agent and gate have the credentials they need. Only names are configured;
|
|
4
|
+
* values come from the process environment (after the secrets loader has applied
|
|
5
|
+
* them), and unset names are simply skipped. The container inherits nothing else.
|
|
6
|
+
*
|
|
7
|
+
* This is also the canonical list of credentials ghostrail reads, so
|
|
8
|
+
* `secrets-setup` scaffolds a placeholder for exactly these names. It lives in a
|
|
9
|
+
* leaf module so both consumers can share it without dragging in the factory's
|
|
10
|
+
* dependency graph.
|
|
11
|
+
*
|
|
12
|
+
* Agent auth covers both rails: ANTHROPIC_API_KEY bills metered API and wins if
|
|
13
|
+
* both are set; CLAUDE_CODE_OAUTH_TOKEN (from `claude setup-token`) bills the
|
|
14
|
+
* Pro/Max subscription when the API key is unset.
|
|
15
|
+
*/
|
|
16
|
+
export const DEFAULT_FORWARD_ENV = [
|
|
17
|
+
"ANTHROPIC_API_KEY",
|
|
18
|
+
"CLAUDE_CODE_OAUTH_TOKEN",
|
|
19
|
+
"GH_TOKEN",
|
|
20
|
+
"GITHUB_TOKEN",
|
|
21
|
+
"LINEAR_API_KEY",
|
|
22
|
+
];
|
|
23
|
+
//# sourceMappingURL=known.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"known.js","sourceRoot":"","sources":["../../src/secrets/known.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,mBAAmB;IACnB,yBAAyB;IACzB,UAAU;IACV,cAAc;IACd,gBAAgB;CACR,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/** One credential the secrets file can carry. */
|
|
2
|
+
export interface SecretSpec {
|
|
3
|
+
/** The variable name. */
|
|
4
|
+
key: string;
|
|
5
|
+
/** One line: what it is and where to get it. */
|
|
6
|
+
description: string;
|
|
7
|
+
}
|
|
8
|
+
/** The secrets file holds credentials, so it is created owner-only. */
|
|
9
|
+
export declare const SECRETS_FILE_MODE = 384;
|
|
10
|
+
/** The global config dir, created owner-only for the same reason. */
|
|
11
|
+
export declare const SECRETS_DIR_MODE = 448;
|
|
12
|
+
/** Every credential ghostrail reads, in forwarding order. */
|
|
13
|
+
export declare const KNOWN_SECRETS: readonly SecretSpec[];
|
|
14
|
+
/**
|
|
15
|
+
* The variable names the content refers to, whether as a live assignment or as a
|
|
16
|
+
* commented placeholder. Both count, so topping a file up never re-adds a
|
|
17
|
+
* placeholder the file already carries.
|
|
18
|
+
*
|
|
19
|
+
* Only names are returned. No value is read, returned, or surfaced.
|
|
20
|
+
*/
|
|
21
|
+
export declare function mentionedKeys(content: string): Set<string>;
|
|
22
|
+
/**
|
|
23
|
+
* The known credentials the content does not mention, in `KNOWN_SECRETS` order.
|
|
24
|
+
* `undefined` content (no file yet) means every one of them is missing. Names
|
|
25
|
+
* the file carries that ghostrail does not read are ignored.
|
|
26
|
+
*/
|
|
27
|
+
export declare function missingSecrets(content: string | undefined): SecretSpec[];
|
|
28
|
+
/**
|
|
29
|
+
* The full content of a fresh secrets file: a header, then a commented
|
|
30
|
+
* placeholder per spec. Every line is a comment, so creating the file never
|
|
31
|
+
* changes what ghostrail resolves.
|
|
32
|
+
*/
|
|
33
|
+
export declare function renderFile(specs: readonly SecretSpec[]): string;
|
|
34
|
+
/**
|
|
35
|
+
* Append placeholder blocks for `specs` to existing content, preserving every
|
|
36
|
+
* byte of it up to its trailing newlines. Only the run of trailing newlines can
|
|
37
|
+
* change, which keeps repeated runs from stacking blank lines.
|
|
38
|
+
*/
|
|
39
|
+
export declare function appendPlaceholders(existing: string, specs: readonly SecretSpec[]): string;
|
|
40
|
+
/** The secrets file's content, or undefined when it does not exist. */
|
|
41
|
+
export declare function readSecretsFile(path: string): Promise<string | undefined>;
|
|
42
|
+
/** Write the secrets file owner-only, creating its directory owner-only too. */
|
|
43
|
+
export declare function writeSecretsFile(path: string, content: string): Promise<void>;
|
|
44
|
+
//# sourceMappingURL=setup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/secrets/setup.ts"],"names":[],"mappings":"AAKA,iDAAiD;AACjD,MAAM,WAAW,UAAU;IACzB,yBAAyB;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,gDAAgD;IAChD,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,uEAAuE;AACvE,eAAO,MAAM,iBAAiB,MAAQ,CAAC;AACvC,qEAAqE;AACrE,eAAO,MAAM,gBAAgB,MAAQ,CAAC;AAkBtC,6DAA6D;AAC7D,eAAO,MAAM,aAAa,EAAE,SAAS,UAAU,EAG5C,CAAC;AASJ;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAU1D;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,EAAE,CAIxE;AAyBD;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,UAAU,EAAE,GAAG,MAAM,CAI/D;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,UAAU,EAAE,GAAG,MAAM,CAOzF;AAED,uEAAuE;AACvE,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAM/E;AAED,gFAAgF;AAChF,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGnF"}
|