@outerlayer/cli 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +124 -0
- package/README.md +226 -59
- package/dist/agent-setup-IFH3FB5X.js +197 -0
- package/dist/build-TZUUTRGH.js +9 -0
- package/dist/build-info.json +1 -1
- package/dist/check-WQP2CZDW.js +94 -0
- package/dist/chunk-2E54Z3P5.js +232 -0
- package/dist/chunk-3TT7RQYB.js +55 -0
- package/dist/{chunk-U32VSRLO.js → chunk-3YPKXE5L.js} +90 -632
- package/dist/{chunk-Q6CL5THG.js → chunk-5DLBAXY5.js} +208 -61
- package/dist/{chunk-R5KBGVII.js → chunk-5QRP3MVS.js} +30 -14
- package/dist/chunk-5Y3QQRUH.js +300 -0
- package/dist/chunk-6Y63SXFO.js +383 -0
- package/dist/chunk-774HEQL6.js +178 -0
- package/dist/chunk-7A6RVXPZ.js +2233 -0
- package/dist/chunk-7YIOOFVJ.js +71 -0
- package/dist/chunk-ABIWDUMS.js +104 -0
- package/dist/chunk-AUFG23AA.js +534 -0
- package/dist/chunk-B2G7JHHB.js +42 -0
- package/dist/chunk-BCJNHMZT.js +34 -0
- package/dist/chunk-BCLJSQCV.js +56 -0
- package/dist/chunk-BFESLKPP.js +61 -0
- package/dist/chunk-BJ3KTMDH.js +63 -0
- package/dist/chunk-BKO6JEZI.js +47 -0
- package/dist/chunk-BOLTI6LR.js +37 -0
- package/dist/chunk-CBPPJSAR.js +89 -0
- package/dist/chunk-CBZB6XY6.js +102 -0
- package/dist/{chunk-65WXAANR.js → chunk-DVDEBNQJ.js} +17 -2
- package/dist/{work-pr-cmd-AZQPWH4H.js → chunk-DVYHCMB2.js} +9 -26
- package/dist/{chunk-TFUIDMOB.js → chunk-EABW6AJQ.js} +12 -1
- package/dist/{chunk-KFYJV2ZG.js → chunk-EMY4I27X.js} +1 -1
- package/dist/{chunk-NTTPJV35.js → chunk-F47JBIAW.js} +3 -1
- package/dist/chunk-F6GFZXZ3.js +60 -0
- package/dist/{chunk-YOOSBOKS.js → chunk-F7CU5ABH.js} +1 -1
- package/dist/chunk-FAJSS2WN.js +1357 -0
- package/dist/chunk-FS2VYGZT.js +1764 -0
- package/dist/chunk-FV2CCGXK.js +9 -0
- package/dist/{chunk-4TNZMO7V.js → chunk-G7FSV7JX.js} +3452 -751
- package/dist/{emit-cmd-TWSYYEZI.js → chunk-H5NCNVDA.js} +68 -17
- package/dist/chunk-HE2D4EY5.js +83 -0
- package/dist/chunk-L2DBRKRA.js +94 -0
- package/dist/chunk-LF6MLJCY.js +38 -0
- package/dist/chunk-M5POMKKW.js +1051 -0
- package/dist/{mcp-install-cmd-FDQH6SEN.js → chunk-MQ3IPHIZ.js} +35 -18
- package/dist/{chunk-D77LS3UI.js → chunk-N5FOE5PS.js} +33 -4
- package/dist/chunk-N6LURUEF.js +64 -0
- package/dist/chunk-NYC54VBD.js +1084 -0
- package/dist/chunk-OGFGZQA3.js +23 -0
- package/dist/chunk-QOZKPLVJ.js +226 -0
- package/dist/chunk-RA3O54FC.js +30 -0
- package/dist/chunk-TBT347UY.js +41 -0
- package/dist/{chunk-NXLLURA4.js → chunk-UFFXNXLQ.js} +115 -71
- package/dist/chunk-USO2DKBD.js +421 -0
- package/dist/chunk-W4SQCOZU.js +206 -0
- package/dist/{chunk-A3WLZX2F.js → chunk-WIOZAJ2W.js} +15 -2
- package/dist/chunk-WO2BXCTQ.js +83 -0
- package/dist/{chunk-I3ETLSNE.js → chunk-XCCLFVXM.js} +120 -11
- package/dist/{context-materialize-6WKT3RBQ.js → chunk-XDDW4FRS.js} +134 -26
- package/dist/chunk-YYYXRJUW.js +101 -0
- package/dist/chunk-ZM2IMMYN.js +76 -0
- package/dist/chunk-ZMYPLFG3.js +71 -0
- package/dist/chunk-ZNA27WEV.js +470 -0
- package/dist/{cli-G7DILYJY.js → cli-NHUXABYH.js} +590 -876
- package/dist/{paths-D2VGWWFI.js → cli-build-K56DK4DS.js} +1 -1
- package/dist/config-XVJYZ4IQ.js +9 -0
- package/dist/connect-cmd-OOG4TPU7.js +16 -0
- package/dist/context-adopt-UMA4O5NY.js +105 -0
- package/dist/context-materialize-G2FUFC72.js +19 -0
- package/dist/dist-RW4UPPC2.js +6 -0
- package/dist/docker-NEGDLU6D.js +7 -0
- package/dist/doctor-53F2PYY7.js +43 -0
- package/dist/doctor-UFVL4PZY.js +426 -0
- package/dist/{emit-artifact-cmd-UQVT3OKW.js → emit-artifact-cmd-KTYW2TN2.js} +24 -20
- package/dist/emit-cmd-DCERAU27.js +9 -0
- package/dist/emit-criteria-cmd-VAUUSAYD.js +166 -0
- package/dist/{emit-finding-cmd-FDOU2OPD.js → emit-finding-cmd-UR4ID45Z.js} +34 -31
- package/dist/{emit-result-cmd-H2T4C2K3.js → emit-result-cmd-FDTUKGKE.js} +34 -62
- package/dist/exec-client-4XGXV3XN.js +8 -0
- package/dist/guest-init-GENRHNP7.js +8 -0
- package/dist/hook-fast-EYENPK6F.js +9 -0
- package/dist/{hook-wrap-fast-KXYNX3AD.js → hook-wrap-fast-NPLHJXFK.js} +2 -2
- package/dist/host-key-KDYZ5ECC.js +7 -0
- package/dist/import-capture-cmd-AVZ4VIVJ.js +68 -0
- package/dist/{import-ruler-cmd-7LH2QOMG.js → import-ruler-cmd-GUHL6IY5.js} +1 -1
- package/dist/index.js +4 -4
- package/dist/init-DXBCOAJK.js +36 -0
- package/dist/init-YEXK35CF.js +221 -0
- package/dist/init-cmd-NHR7PRSQ.js +135 -0
- package/dist/install-cmd-7WXOIFDO.js +55 -0
- package/dist/lima-XN65D7GN.js +55 -0
- package/dist/login-browser-7XGSV7MA.js +10 -0
- package/dist/{config-POF7DEQW.js → logout-cmd-QAUFDJ6J.js} +3 -1
- package/dist/{logs-TRNPQM42.js → logs-7RYUH5A6.js} +1 -1
- package/dist/loop-VZOLL4WQ.js +43 -0
- package/dist/machine-WSG52J75.js +35 -0
- package/dist/mcp-install-cmd-RLK4SO3N.js +9 -0
- package/dist/{mcp-serve-cmd-57EZZOTL.js → mcp-serve-cmd-JPTP5FMS.js} +20 -9
- package/dist/paths-OYKMVYJP.js +6 -0
- package/dist/{pidfile-PTW76F56.js → pidfile-UZRH774M.js} +2 -3
- package/dist/real-deps-SU24ZA2K.js +21 -0
- package/dist/relay-L76HDX72.js +46 -0
- package/dist/settings-J2652U5N.js +7 -0
- package/dist/starter-pack-LIZYMKYQ.js +10 -0
- package/dist/{status-I27IST4L.js → status-2UZKKNB7.js} +30 -13
- package/dist/{statusline-fast-3C5OXHDD.js → statusline-fast-SVTMBMD7.js} +3 -2
- package/dist/sync-cmd-VPPYCNNM.js +28 -0
- package/dist/version-BWM6VLDI.js +6 -0
- package/dist/{watch-3DTPJETH.js → watch-5C4ZBBGO.js} +19 -8
- package/dist/{work-claim-cmd-5AUNCLS2.js → work-claim-cmd-LSO2B2EX.js} +33 -20
- package/dist/work-cmd-UOQO2AD4.js +17 -0
- package/dist/work-comment-cmd-WF3EOLAE.js +106 -0
- package/dist/{work-launch-LT663PB3.js → work-launch-YI4CJDAP.js} +1 -1
- package/dist/work-open-pr-cmd-4SSQZMYG.js +156 -0
- package/dist/work-pr-cmd-6AN6RRQJ.js +16 -0
- package/package.json +13 -3
- package/skill-pack/maintained/amend/SKILL.md +104 -0
- package/skill-pack/maintained/emitting-evidence/SKILL.md +99 -0
- package/skill-pack/maintained/emitting-evidence/references/agents-snippet.md +20 -0
- package/skill-pack/maintained/outerlayer/SKILL.md +55 -0
- package/skill-pack/maintained/reporting-findings/SKILL.md +148 -0
- package/skill-pack/template/build/SKILL.md +193 -0
- package/skill-pack/template/build/references/agent-briefs.md +243 -0
- package/skill-pack/template/build/references/criteria-judge.md +91 -0
- package/skill-pack/template/build/references/evidence.md +42 -0
- package/skill-pack/template/build/references/release.md +74 -0
- package/skill-pack/template/build/references/review-briefs.md +275 -0
- package/skill-pack/template/build/references/review-loop.md +158 -0
- package/skill-pack/template/build/scripts/record-criteria.mjs +235 -0
- package/skill-pack/template/spec/SKILL.md +84 -0
- package/skill-pack/template/writing-specs/SKILL.md +134 -0
- package/dist/chunk-DCNOXRMV.js +0 -589
- package/dist/chunk-JJP7YLMN.js +0 -25
- package/dist/chunk-OZ7C3XUE.js +0 -34
- package/dist/chunk-WQ6VGRGZ.js +0 -150
- package/dist/hook-fast-J5LCDHUJ.js +0 -8
- package/dist/import-capture-cmd-EUMBGIV3.js +0 -176
- package/dist/init-PTBITAUO.js +0 -103
- package/dist/login-cmd-IRX6LZT7.js +0 -62
- package/dist/loop-ASZRX3CZ.js +0 -648
- package/dist/sync-cmd-BBAUZ5JD.js +0 -17
- package/dist/work-cmd-2P4BVX47.js +0 -18
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
|
+
import { RecipeError } from './chunk-QOZKPLVJ.js';
|
|
4
|
+
import { spawn } from 'child_process';
|
|
5
|
+
import { existsSync, mkdirSync, createWriteStream, readFileSync } from 'fs';
|
|
6
|
+
import { join, dirname } from 'path';
|
|
7
|
+
import { createRequire as createRequire$1 } from 'module';
|
|
8
|
+
import { fileURLToPath } from 'url';
|
|
9
|
+
|
|
10
|
+
createRequire(import.meta.url);
|
|
11
|
+
var PACKAGE = "@devcontainers/cli";
|
|
12
|
+
function buildRootFromDist(moduleDir = dirname(fileURLToPath(import.meta.url))) {
|
|
13
|
+
try {
|
|
14
|
+
const info = JSON.parse(readFileSync(join(moduleDir, "build-info.json"), "utf8"));
|
|
15
|
+
return typeof info.root === "string" ? info.root : void 0;
|
|
16
|
+
} catch {
|
|
17
|
+
return void 0;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function resolveDevcontainerCli(opts = {}) {
|
|
21
|
+
const resolve = opts.resolve ?? createRequire$1(import.meta.url).resolve;
|
|
22
|
+
try {
|
|
23
|
+
const bin = join(dirname(resolve(`${PACKAGE}/package.json`)), "devcontainer.js");
|
|
24
|
+
if (existsSync(bin)) return { command: process.execPath, args: [bin] };
|
|
25
|
+
} catch {
|
|
26
|
+
}
|
|
27
|
+
const buildRoot = opts.buildRoot ?? buildRootFromDist();
|
|
28
|
+
const fallback = buildRoot === void 0 ? void 0 : join(buildRoot, "node_modules", PACKAGE);
|
|
29
|
+
if (fallback !== void 0 && existsSync(join(fallback, "devcontainer.js"))) {
|
|
30
|
+
return { command: process.execPath, args: [join(fallback, "devcontainer.js")] };
|
|
31
|
+
}
|
|
32
|
+
throw new RecipeError(
|
|
33
|
+
"devcontainer_cli_missing",
|
|
34
|
+
`the devcontainer CLI is not installed: looked beside this package and in ${fallback ?? "the checkout this build came from (unknown)"}. Run yarn install in that checkout.`
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
function devcontainerBuildInvocation(cli, req) {
|
|
38
|
+
return {
|
|
39
|
+
command: cli.command,
|
|
40
|
+
args: [
|
|
41
|
+
...cli.args,
|
|
42
|
+
"build",
|
|
43
|
+
"--workspace-folder",
|
|
44
|
+
req.workspace,
|
|
45
|
+
"--config",
|
|
46
|
+
req.config,
|
|
47
|
+
"--image-name",
|
|
48
|
+
req.imageName,
|
|
49
|
+
...Object.entries(req.labels).flatMap(([key, value]) => ["--label", `${key}=${value}`]),
|
|
50
|
+
"--log-format",
|
|
51
|
+
"text"
|
|
52
|
+
]
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// src/runner/image/docker.ts
|
|
57
|
+
var CHILD_ENVIRONMENT_NAMES = [
|
|
58
|
+
"PATH",
|
|
59
|
+
"HOME",
|
|
60
|
+
"USER",
|
|
61
|
+
"LOGNAME",
|
|
62
|
+
"TMPDIR",
|
|
63
|
+
"LANG",
|
|
64
|
+
"LC_ALL",
|
|
65
|
+
"DOCKER_HOST",
|
|
66
|
+
"DOCKER_CONFIG",
|
|
67
|
+
"DOCKER_CONTEXT",
|
|
68
|
+
"DOCKER_CERT_PATH",
|
|
69
|
+
"DOCKER_TLS_VERIFY",
|
|
70
|
+
"DOCKER_API_VERSION",
|
|
71
|
+
"DOCKER_BUILDKIT",
|
|
72
|
+
"XDG_RUNTIME_DIR",
|
|
73
|
+
"XDG_CONFIG_HOME",
|
|
74
|
+
"XDG_DATA_HOME",
|
|
75
|
+
"XDG_CACHE_HOME",
|
|
76
|
+
"XDG_STATE_HOME"
|
|
77
|
+
];
|
|
78
|
+
function childEnvironment(base) {
|
|
79
|
+
const env = {};
|
|
80
|
+
for (const name of CHILD_ENVIRONMENT_NAMES) {
|
|
81
|
+
const value = base[name];
|
|
82
|
+
if (value !== void 0) env[name] = value;
|
|
83
|
+
}
|
|
84
|
+
return env;
|
|
85
|
+
}
|
|
86
|
+
var spawnRun = (command, args, opts = {}) => new Promise((resolve) => {
|
|
87
|
+
let log;
|
|
88
|
+
if (opts.logPath !== void 0) {
|
|
89
|
+
mkdirSync(dirname(opts.logPath), { recursive: true });
|
|
90
|
+
log = createWriteStream(opts.logPath, { flags: "a" });
|
|
91
|
+
}
|
|
92
|
+
let stdout = "";
|
|
93
|
+
let stderr = "";
|
|
94
|
+
let settled = false;
|
|
95
|
+
const finish = (status, extra = "") => {
|
|
96
|
+
if (settled) return;
|
|
97
|
+
settled = true;
|
|
98
|
+
const result = { status, stdout, stderr: stderr + extra };
|
|
99
|
+
if (log === void 0) {
|
|
100
|
+
resolve(result);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
if (extra) log.write(extra);
|
|
104
|
+
log.end(() => resolve(result));
|
|
105
|
+
};
|
|
106
|
+
const child = spawn(command, args, {
|
|
107
|
+
env: { ...childEnvironment(process.env), ...opts.env },
|
|
108
|
+
stdio: [opts.input === void 0 ? "ignore" : "pipe", "pipe", "pipe"]
|
|
109
|
+
});
|
|
110
|
+
child.stdout.on("data", (chunk) => {
|
|
111
|
+
stdout += chunk.toString();
|
|
112
|
+
log?.write(chunk);
|
|
113
|
+
});
|
|
114
|
+
child.stderr.on("data", (chunk) => {
|
|
115
|
+
stderr += chunk.toString();
|
|
116
|
+
log?.write(chunk);
|
|
117
|
+
});
|
|
118
|
+
child.on("error", (err) => finish(127, `${command}: ${err.message}
|
|
119
|
+
`));
|
|
120
|
+
child.on("close", (code, signal) => finish(code ?? (signal ? 128 : 1)));
|
|
121
|
+
if (opts.input !== void 0) {
|
|
122
|
+
child.stdin.on("error", () => void 0);
|
|
123
|
+
child.stdin.end(opts.input);
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
function toInfo(row) {
|
|
127
|
+
return { id: row.Id, createdAt: row.Created, labels: row.Config?.Labels ?? {} };
|
|
128
|
+
}
|
|
129
|
+
var lines = (text) => [...new Set(text.split("\n").map((l) => l.trim()).filter(Boolean))];
|
|
130
|
+
function createDockerHost(deps = {}) {
|
|
131
|
+
const run = deps.run ?? spawnRun;
|
|
132
|
+
const cli = deps.cli ?? resolveDevcontainerCli;
|
|
133
|
+
const inspectMany = async (refs) => {
|
|
134
|
+
const result = await run("docker", ["image", "inspect", ...refs]);
|
|
135
|
+
return result.status === 0 ? JSON.parse(result.stdout).map(toInfo) : [];
|
|
136
|
+
};
|
|
137
|
+
return {
|
|
138
|
+
async inspect(ref) {
|
|
139
|
+
return (await inspectMany([ref]))[0] ?? null;
|
|
140
|
+
},
|
|
141
|
+
async list(repository) {
|
|
142
|
+
const ids = await run("docker", [
|
|
143
|
+
"image",
|
|
144
|
+
"ls",
|
|
145
|
+
"--all",
|
|
146
|
+
"--no-trunc",
|
|
147
|
+
"--quiet",
|
|
148
|
+
"--filter",
|
|
149
|
+
`label=ai.outerlayer.repository=${repository}`
|
|
150
|
+
]);
|
|
151
|
+
const found = lines(ids.stdout);
|
|
152
|
+
return found.length === 0 ? [] : inspectMany(found);
|
|
153
|
+
},
|
|
154
|
+
async inUse() {
|
|
155
|
+
const containers = lines((await run("docker", ["ps", "--all", "--no-trunc", "--quiet"])).stdout);
|
|
156
|
+
if (containers.length === 0) return [];
|
|
157
|
+
return lines((await run("docker", ["inspect", "--format", "{{.Image}}", ...containers])).stdout);
|
|
158
|
+
},
|
|
159
|
+
async buildDockerfile(req) {
|
|
160
|
+
const labels = Object.entries(req.labels).flatMap(([key, value]) => ["--label", `${key}=${value}`]);
|
|
161
|
+
const result = await run("docker", ["build", "--tag", req.tag, ...labels, "--file", "-", req.context], {
|
|
162
|
+
logPath: req.logPath,
|
|
163
|
+
input: req.dockerfile
|
|
164
|
+
});
|
|
165
|
+
return result.status;
|
|
166
|
+
},
|
|
167
|
+
async devcontainerBuild(req) {
|
|
168
|
+
const { command, args } = devcontainerBuildInvocation(cli(), req);
|
|
169
|
+
return (await run(command, args, { logPath: req.logPath })).status;
|
|
170
|
+
},
|
|
171
|
+
async remove(id) {
|
|
172
|
+
const result = await run("docker", ["rmi", id]);
|
|
173
|
+
if (result.status !== 0) throw new Error(result.stderr.trim() || `docker rmi ${id} exited ${result.status}`);
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export { childEnvironment, createDockerHost, resolveDevcontainerCli, spawnRun };
|