actradeck 0.0.1 → 0.5.2

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/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 ActraDeck authors
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,57 @@
1
- # actradeck (placeholder)
2
- The real bootstrap CLI ships at v0.5.0. See
3
- https://github.com/actradeck/actradeck for install instructions.
1
+ # actradeck
2
+
3
+ > Bootstrap CLI for **ActraDeck** — a local-first control plane for coding agents (Claude
4
+ > Code, Codex, …): observe them, redact secrets before they're stored, gate high-risk actions
5
+ > behind approvals, and keep a tamper-evident audit trail.
6
+
7
+ This package is a **thin, dependency-free bootstrapper**. It does not contain the product —
8
+ the full four-tier stack ships as a **signed GitHub Release** and a **signed GHCR image**.
9
+ The CLI helps you _get to_ a running cockpit and verify what you download.
10
+
11
+ - **Zero runtime dependencies** (Node 20+ built-ins only).
12
+ - **No install hooks.** `npm install`/`npx` never changes your machine. Only the explicit
13
+ `actradeck install` fetches anything, and only after verifying it.
14
+ - **Fail-closed verification.** `install` checks the release's sha256 checksum _and_ its
15
+ SLSA build provenance before extracting a single file.
16
+
17
+ ## Usage
18
+
19
+ ```sh
20
+ npx actradeck@latest doctor # diagnose: platform / Node / pnpm / git / Docker (offline-safe)
21
+ npx actradeck@latest install # verify + fetch the latest signed release, then quickstart
22
+ npx actradeck@latest up # print the Docker cockpit command (prints only; runs nothing)
23
+ npx actradeck@latest version # your CLI version + whether a newer stable release exists
24
+ ```
25
+
26
+ > **Not published yet.** The first npm publish is planned for **v0.5** (see the project's ADR
27
+ > 0013). Until then the commands above describe the intended flow; the canonical, already-signed
28
+ > way to get ActraDeck is the GitHub Release / GHCR image or `scripts/install.sh` from the repo.
29
+
30
+ ### `install`
31
+
32
+ Resolves the latest stable GitHub Release (or `--version vX.Y.Z`), downloads the source
33
+ tarball + `checksums.txt`, verifies the **sha256 digest** (Node `crypto`) **and** the build
34
+ provenance (`gh attestation verify`), then extracts and hands off to the repo's own
35
+ `scripts/quickstart`.
36
+
37
+ ```sh
38
+ npx actradeck@latest install --version v0.4.0 # a specific tag
39
+ npx actradeck@latest install --dry-run # resolve + verify only; change nothing
40
+ npx actradeck@latest install --skip-provenance # explicit opt-out (checksum still enforced)
41
+ ```
42
+
43
+ Verification is **fail-closed** and never silently skipped: the checksum is always enforced,
44
+ and provenance is verified unless you pass `--skip-provenance` (which requires you to accept
45
+ the reduced guarantee). `--skip-provenance` exists only for machines that cannot install the
46
+ GitHub CLI.
47
+
48
+ ## Environment
49
+
50
+ | Variable | Default | Meaning |
51
+ | ----------------------- | -------------------- | --------------------------------------------------- |
52
+ | `ACTRADECK_REPO` | `actradeck/actradeck`| `owner/name` (or git URL) to resolve releases from |
53
+ | `ACTRADECK_INSTALL_DIR` | `~/actradeck` | where `install` extracts the verified source |
54
+
55
+ ## License
56
+
57
+ [Apache-2.0](./LICENSE).
package/dist/cli.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ import type { Deps } from "./lib/types.js";
2
+ import { type InstallOpts } from "./commands/install.js";
3
+ export declare function parseInstallOpts(args: string[]): InstallOpts;
4
+ export declare function run(deps: Deps, argv: string[]): Promise<number>;
package/dist/cli.js ADDED
@@ -0,0 +1,89 @@
1
+ import { cmdDoctor } from "./commands/doctor.js";
2
+ import { cmdUp } from "./commands/up.js";
3
+ import { cmdVersion } from "./commands/version.js";
4
+ import { cmdInstall } from "./commands/install.js";
5
+ const USAGE = `actradeck — bootstrap CLI for ActraDeck (local-first control plane for coding agents)
6
+
7
+ Usage:
8
+ actradeck <command> [options]
9
+
10
+ Commands:
11
+ doctor Diagnose this machine (platform / Node / pnpm / git / Docker). Offline-safe.
12
+ install Fetch + VERIFY a signed release (checksum + provenance), then hand off to quickstart.
13
+ --version vX.Y.Z install a specific release tag (default: latest stable)
14
+ --dry-run, -n resolve + verify only; stop before extracting / quickstart
15
+ --skip-provenance checksum-only (explicit opt-out; not recommended)
16
+ up Print the Docker cockpit bring-up command (prints only — does not run it).
17
+ version Print this CLI's version and whether a newer stable release is available.
18
+
19
+ Global:
20
+ -h, --help show this help
21
+ -v, --version print the CLI version
22
+
23
+ Environment:
24
+ ACTRADECK_REPO owner/name (or git URL) to resolve releases from (default: actradeck/actradeck)
25
+ ACTRADECK_INSTALL_DIR where 'install' extracts the source (default: ~/actradeck)
26
+
27
+ The full product ships as a signed GitHub Release + GHCR image; this CLI is a thin,
28
+ dependency-free bootstrapper. It never installs anything on 'npm install' — only the
29
+ explicit 'actradeck install' fetches and verifies a release.`;
30
+ export function parseInstallOpts(args) {
31
+ let version;
32
+ let dryRun = false;
33
+ let skipProvenance = false;
34
+ for (let i = 0; i < args.length; i++) {
35
+ const a = args[i];
36
+ if (a === "--dry-run" || a === "-n") {
37
+ dryRun = true;
38
+ }
39
+ else if (a === "--skip-provenance") {
40
+ skipProvenance = true;
41
+ }
42
+ else if (a === "--version") {
43
+ version = args[++i];
44
+ if (!version)
45
+ throw new Error("--version needs a value (e.g. --version v0.4.0).");
46
+ }
47
+ else if (a.startsWith("--version=")) {
48
+ version = a.slice("--version=".length);
49
+ }
50
+ else {
51
+ throw new Error(`Unknown install option: ${a}`);
52
+ }
53
+ }
54
+ return { version, dryRun, skipProvenance };
55
+ }
56
+ export async function run(deps, argv) {
57
+ const cmd = argv[0];
58
+ const rest = argv.slice(1);
59
+ try {
60
+ switch (cmd) {
61
+ case undefined:
62
+ case "help":
63
+ case "-h":
64
+ case "--help":
65
+ deps.io.out(USAGE);
66
+ return 0;
67
+ case "-v":
68
+ case "--version":
69
+ deps.io.out(deps.selfVersion);
70
+ return 0;
71
+ case "doctor":
72
+ return await cmdDoctor(deps);
73
+ case "up":
74
+ return await cmdUp(deps);
75
+ case "version":
76
+ return await cmdVersion(deps);
77
+ case "install":
78
+ return await cmdInstall(deps, parseInstallOpts(rest));
79
+ default:
80
+ deps.io.err(`Unknown command: ${cmd}`);
81
+ deps.io.out(USAGE);
82
+ return 2;
83
+ }
84
+ }
85
+ catch (e) {
86
+ deps.io.err(`error: ${e instanceof Error ? e.message : String(e)}`);
87
+ return 1;
88
+ }
89
+ }
@@ -0,0 +1,3 @@
1
+ import type { Deps } from "../lib/types.js";
2
+ export declare function nodeMajor(nodeVersion: string): number | null;
3
+ export declare function cmdDoctor(deps: Deps): Promise<number>;
@@ -0,0 +1,66 @@
1
+ export function nodeMajor(nodeVersion) {
2
+ const m = /^v?(\d+)\./.exec(nodeVersion.trim());
3
+ return m ? Number(m[1]) : null;
4
+ }
5
+ async function toolVersion(deps, cmd, args) {
6
+ if (!(await deps.which(cmd)))
7
+ return null;
8
+ const r = await deps.exec(cmd, args);
9
+ if (r.code !== 0)
10
+ return null;
11
+ const line = (r.stdout || r.stderr).split("\n")[0]?.trim();
12
+ return line && line.length > 0 ? line : `${cmd} (version unknown)`;
13
+ }
14
+ export async function cmdDoctor(deps) {
15
+ const checks = [];
16
+ checks.push({
17
+ name: "platform",
18
+ ok: true,
19
+ detail: `${deps.platform}/${deps.arch}`,
20
+ required: false,
21
+ });
22
+ const major = nodeMajor(deps.nodeVersion);
23
+ const nodeOk = major !== null && major >= 20;
24
+ checks.push({
25
+ name: "node",
26
+ ok: nodeOk,
27
+ detail: nodeOk
28
+ ? `${deps.nodeVersion} (CLI needs >=20; ActraDeck itself needs >=22.16)`
29
+ : `${deps.nodeVersion} — need Node >=20 (install e.g. 'nvm install 22')`,
30
+ required: true,
31
+ });
32
+ const pnpm = await toolVersion(deps, "pnpm", ["--version"]);
33
+ checks.push({
34
+ name: "pnpm",
35
+ ok: pnpm !== null,
36
+ detail: pnpm ?? "not found — install with 'npm i -g pnpm' (required to build/run ActraDeck)",
37
+ required: true,
38
+ });
39
+ const git = await toolVersion(deps, "git", ["--version"]);
40
+ checks.push({
41
+ name: "git",
42
+ ok: git !== null,
43
+ detail: git ?? "not found — only needed to install from source (git clone)",
44
+ required: false,
45
+ });
46
+ const docker = await toolVersion(deps, "docker", ["--version"]);
47
+ checks.push({
48
+ name: "docker",
49
+ ok: docker !== null,
50
+ detail: docker ?? "not found — only needed for the Docker cockpit path ('actradeck up')",
51
+ required: false,
52
+ });
53
+ let failed = false;
54
+ for (const c of checks) {
55
+ const mark = c.ok ? "ok " : c.required ? "FAIL" : "warn";
56
+ deps.io.out(`[${mark}] ${c.name.padEnd(9)} ${c.detail}`);
57
+ if (!c.ok && c.required)
58
+ failed = true;
59
+ }
60
+ if (failed) {
61
+ deps.io.err("doctor: a required prerequisite is missing — resolve the FAIL line(s) above before installing.");
62
+ return 1;
63
+ }
64
+ deps.io.out("doctor: all required prerequisites present.");
65
+ return 0;
66
+ }
@@ -0,0 +1,7 @@
1
+ import type { Deps } from "../lib/types.js";
2
+ export interface InstallOpts {
3
+ version: string | undefined;
4
+ dryRun: boolean;
5
+ skipProvenance: boolean;
6
+ }
7
+ export declare function cmdInstall(deps: Deps, opts: InstallOpts): Promise<number>;
@@ -0,0 +1,84 @@
1
+ import { resolveRepo } from "../lib/repo.js";
2
+ import { parseSemver } from "../lib/semver.js";
3
+ import { fetchReleaseByTag, fetchLatestStableTag, findAsset, tarballName } from "../lib/release.js";
4
+ import { expectedDigestFor, verifySha256 } from "../lib/checksum.js";
5
+ export async function cmdInstall(deps, opts) {
6
+ const slug = resolveRepo(deps.env);
7
+ let tag;
8
+ if (opts.version) {
9
+ if (!/^v/.test(opts.version) || !parseSemver(opts.version)) {
10
+ throw new Error("--version must be a release tag like v0.4.0 (branches/commits are unsigned).");
11
+ }
12
+ tag = opts.version;
13
+ }
14
+ else {
15
+ const latest = await fetchLatestStableTag(deps.fetchJson, slug);
16
+ if (!latest) {
17
+ throw new Error(`No stable release found for ${slug}. Pass --version vX.Y.Z, or check that a signed release exists.`);
18
+ }
19
+ tag = latest;
20
+ }
21
+ const version = tag.replace(/^v/, "");
22
+ const tarName = tarballName(version);
23
+ deps.io.out(`Resolving release ${tag} from ${slug} ...`);
24
+ const rel = await fetchReleaseByTag(deps.fetchJson, slug, tag);
25
+ const tarAsset = findAsset(rel, tarName);
26
+ const csAsset = findAsset(rel, "checksums.txt");
27
+ if (!tarAsset)
28
+ throw new Error(`Release ${tag} has no ${tarName} asset (not a signed source release?).`);
29
+ if (!csAsset)
30
+ throw new Error(`Release ${tag} has no checksums.txt — cannot verify the digest (fail-closed).`);
31
+ deps.io.out("Downloading source tarball + checksums ...");
32
+ const tarBytes = await deps.fetchBytes(tarAsset.url);
33
+ const csText = new TextDecoder().decode(await deps.fetchBytes(csAsset.url));
34
+ const expected = expectedDigestFor(csText, tarName);
35
+ if (!verifySha256(tarBytes, expected)) {
36
+ throw new Error(`Checksum verification FAILED for ${tarName} — refusing to install (fail-closed).`);
37
+ }
38
+ deps.io.out("Checksum verified (sha256).");
39
+ if (opts.skipProvenance) {
40
+ deps.io.err("WARNING: --skip-provenance set — build provenance was NOT verified (checksum is still enforced). " +
41
+ "Prefer installing the GitHub CLI 'gh' so provenance can be checked.");
42
+ }
43
+ else {
44
+ if (!(await deps.which("gh"))) {
45
+ throw new Error("Provenance verification requires the GitHub CLI 'gh' (https://cli.github.com). " +
46
+ "Install it, or pass --skip-provenance to proceed on checksum only (not recommended).");
47
+ }
48
+ const work = await deps.mkdtemp();
49
+ try {
50
+ const tarPath = `${work}/${tarName}`;
51
+ await deps.writeFile(tarPath, tarBytes);
52
+ deps.io.out("Verifying build provenance (gh attestation verify) ...");
53
+ const r = await deps.exec("gh", ["attestation", "verify", tarPath, "--repo", slug]);
54
+ if (r.code !== 0) {
55
+ throw new Error(`Provenance verification FAILED for ${tarName} — refusing to install (fail-closed).`);
56
+ }
57
+ deps.io.out("Provenance verified.");
58
+ }
59
+ finally {
60
+ await deps.rmrf(work);
61
+ }
62
+ }
63
+ if (opts.dryRun) {
64
+ const what = opts.skipProvenance ? "checksum" : "checksum + provenance";
65
+ deps.io.out(`Dry run: ${tag} resolved and verified (${what}). Stopping before extraction / quickstart hand-off. Nothing was changed.`);
66
+ return 0;
67
+ }
68
+ const installDir = deps.env["ACTRADECK_INSTALL_DIR"]?.trim() || `${deps.homedir()}/actradeck`;
69
+ if (await deps.dirHasContent(installDir)) {
70
+ throw new Error("Install directory is not empty. Set ACTRADECK_INSTALL_DIR to a fresh path and re-run (a verified install is a clean extraction).");
71
+ }
72
+ const work = await deps.mkdtemp();
73
+ try {
74
+ const tarPath = `${work}/${tarName}`;
75
+ await deps.writeFile(tarPath, tarBytes);
76
+ deps.io.out(`Extracting verified source into ${installDir} ...`);
77
+ await deps.extractTarball(tarPath, installDir);
78
+ }
79
+ finally {
80
+ await deps.rmrf(work);
81
+ }
82
+ deps.io.out("Handing off to quickstart ...");
83
+ return await deps.handoffQuickstart(installDir);
84
+ }
@@ -0,0 +1,2 @@
1
+ import type { Deps } from "../lib/types.js";
2
+ export declare function cmdUp(deps: Deps): Promise<number>;
@@ -0,0 +1,16 @@
1
+ import { resolveRepo, ghcrImage } from "../lib/repo.js";
2
+ export async function cmdUp(deps) {
3
+ const slug = resolveRepo(deps.env);
4
+ const image = `${ghcrImage(slug)}:latest`;
5
+ deps.io.out("# ActraDeck cockpit in Docker — copy & run this yourself (the CLI prints, it does not execute):");
6
+ deps.io.out("docker run --rm \\");
7
+ deps.io.out(" -p 127.0.0.1:55400:55400 \\");
8
+ deps.io.out(" -v actradeck_pgdata:/data \\");
9
+ deps.io.out(` ${image}`);
10
+ deps.io.out("# then open http://localhost:55400");
11
+ deps.io.out("#");
12
+ deps.io.out("# Notes: -p binds loopback ONLY (single-operator by design); -v persists the embedded DB.");
13
+ deps.io.out("# The container is the cockpit stack; observing your own agents needs a host-side sidecar.");
14
+ deps.io.out("# See docs/docker.md for verifying the image signature and wiring the sidecar.");
15
+ return 0;
16
+ }
@@ -0,0 +1,2 @@
1
+ import type { Deps } from "../lib/types.js";
2
+ export declare function cmdVersion(deps: Deps): Promise<number>;
@@ -0,0 +1,28 @@
1
+ import { resolveRepo } from "../lib/repo.js";
2
+ import { fetchLatestStableTag, updateStatus } from "../lib/release.js";
3
+ export async function cmdVersion(deps) {
4
+ deps.io.out(`actradeck ${deps.selfVersion}`);
5
+ const slug = resolveRepo(deps.env);
6
+ try {
7
+ const latest = await fetchLatestStableTag(deps.fetchJson, slug);
8
+ if (!latest) {
9
+ deps.io.out(`Latest stable release: unknown (no stable release published for ${slug} yet).`);
10
+ return 0;
11
+ }
12
+ const status = updateStatus(deps.selfVersion, latest);
13
+ if (status === "update") {
14
+ deps.io.out(`A newer stable release is available: ${latest} (you have ${deps.selfVersion}). Update: npx actradeck@latest`);
15
+ }
16
+ else if (status === "current") {
17
+ deps.io.out(`You are on the latest stable release (${latest}).`);
18
+ }
19
+ else {
20
+ deps.io.out(`Latest stable release: ${latest}.`);
21
+ }
22
+ return 0;
23
+ }
24
+ catch {
25
+ deps.io.out("Could not reach GitHub to check for updates (offline?). Showing the local version only.");
26
+ return 0;
27
+ }
28
+ }
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ import { makeRealDeps } from "./lib/deps.js";
3
+ import { run } from "./cli.js";
4
+ const deps = await makeRealDeps();
5
+ const code = await run(deps, process.argv.slice(2));
6
+ process.exit(code);
@@ -0,0 +1,3 @@
1
+ export declare function sha256Hex(bytes: Uint8Array): string;
2
+ export declare function expectedDigestFor(checksums: string, assetName: string): string | null;
3
+ export declare function verifySha256(bytes: Uint8Array, expected: string | null): boolean;
@@ -0,0 +1,24 @@
1
+ import { createHash } from "node:crypto";
2
+ export function sha256Hex(bytes) {
3
+ return createHash("sha256").update(bytes).digest("hex");
4
+ }
5
+ export function expectedDigestFor(checksums, assetName) {
6
+ for (const raw of checksums.split("\n")) {
7
+ const line = raw.trim();
8
+ if (!line)
9
+ continue;
10
+ const m = /^([0-9a-fA-F]{64})[ \t]+\*?(.+)$/.exec(line);
11
+ if (m) {
12
+ const hex = m[1];
13
+ const name = m[2];
14
+ if (hex && name === assetName)
15
+ return hex.toLowerCase();
16
+ }
17
+ }
18
+ return null;
19
+ }
20
+ export function verifySha256(bytes, expected) {
21
+ if (!expected)
22
+ return false;
23
+ return sha256Hex(bytes) === expected.toLowerCase();
24
+ }
@@ -0,0 +1,2 @@
1
+ import type { Deps } from "./types.js";
2
+ export declare function makeRealDeps(): Promise<Deps>;
@@ -0,0 +1,111 @@
1
+ import { spawn } from "node:child_process";
2
+ import { access, mkdtemp, mkdir, readdir, readFile, rm, writeFile } from "node:fs/promises";
3
+ import { constants as FS } from "node:fs";
4
+ import { homedir, tmpdir } from "node:os";
5
+ import { delimiter, join } from "node:path";
6
+ import { fileURLToPath } from "node:url";
7
+ const UA = "actradeck-cli";
8
+ function runCapture(cmd, args, opts) {
9
+ return new Promise((resolve) => {
10
+ const child = spawn(cmd, args, { cwd: opts?.cwd, stdio: ["ignore", "pipe", "pipe"] });
11
+ let stdout = "";
12
+ let stderr = "";
13
+ child.stdout.on("data", (d) => (stdout += d.toString()));
14
+ child.stderr.on("data", (d) => (stderr += d.toString()));
15
+ child.on("error", () => resolve({ code: 127, stdout, stderr }));
16
+ child.on("close", (code) => resolve({ code: code ?? 0, stdout, stderr }));
17
+ });
18
+ }
19
+ async function whichCmd(cmd) {
20
+ const path = process.env["PATH"] ?? "";
21
+ const exts = process.platform === "win32" ? (process.env["PATHEXT"] ?? ".EXE;.CMD;.BAT").split(";") : [""];
22
+ for (const dir of path.split(delimiter)) {
23
+ if (!dir)
24
+ continue;
25
+ for (const ext of exts) {
26
+ try {
27
+ await access(join(dir, cmd + ext), FS.X_OK);
28
+ return true;
29
+ }
30
+ catch {
31
+ }
32
+ }
33
+ }
34
+ return false;
35
+ }
36
+ async function fetchOk(url) {
37
+ const res = await fetch(url, {
38
+ headers: { "User-Agent": UA, Accept: "application/vnd.github+json" },
39
+ redirect: "follow",
40
+ signal: AbortSignal.timeout(8000),
41
+ });
42
+ if (!res.ok)
43
+ throw new Error(`HTTP ${res.status} for ${new URL(url).host}`);
44
+ return res;
45
+ }
46
+ async function readSelfVersion() {
47
+ try {
48
+ const pkgUrl = new URL("../../package.json", import.meta.url);
49
+ const raw = await readFile(fileURLToPath(pkgUrl), "utf8");
50
+ const v = JSON.parse(raw).version;
51
+ return typeof v === "string" ? v : "0.0.0";
52
+ }
53
+ catch {
54
+ return "0.0.0";
55
+ }
56
+ }
57
+ export async function makeRealDeps() {
58
+ const selfVersion = await readSelfVersion();
59
+ return {
60
+ io: {
61
+ out: (m) => process.stdout.write(m + "\n"),
62
+ err: (m) => process.stderr.write(m + "\n"),
63
+ },
64
+ env: process.env,
65
+ platform: process.platform,
66
+ arch: process.arch,
67
+ nodeVersion: process.version,
68
+ selfVersion,
69
+ homedir,
70
+ which: whichCmd,
71
+ exec: runCapture,
72
+ async fetchJson(url) {
73
+ return (await fetchOk(url)).json();
74
+ },
75
+ async fetchBytes(url) {
76
+ return new Uint8Array(await (await fetchOk(url)).arrayBuffer());
77
+ },
78
+ async mkdtemp() {
79
+ return mkdtemp(join(tmpdir(), "actradeck-"));
80
+ },
81
+ async writeFile(path, bytes) {
82
+ await writeFile(path, bytes);
83
+ },
84
+ async dirHasContent(path) {
85
+ try {
86
+ const entries = await readdir(path);
87
+ return entries.length > 0;
88
+ }
89
+ catch {
90
+ return false;
91
+ }
92
+ },
93
+ async extractTarball(tarPath, destDir) {
94
+ await mkdir(destDir, { recursive: true });
95
+ const r = await runCapture("tar", ["xzf", tarPath, "-C", destDir, "--strip-components=1"]);
96
+ if (r.code !== 0)
97
+ throw new Error(`tar extraction failed (exit ${r.code}).`);
98
+ },
99
+ async rmrf(path) {
100
+ await rm(path, { recursive: true, force: true });
101
+ },
102
+ handoffQuickstart(installDir) {
103
+ return new Promise((resolve) => {
104
+ const qs = join(installDir, "scripts", "quickstart");
105
+ const child = spawn(qs, [], { cwd: installDir, stdio: "inherit" });
106
+ child.on("error", () => resolve(1));
107
+ child.on("close", (code) => resolve(code ?? 0));
108
+ });
109
+ },
110
+ };
111
+ }
@@ -0,0 +1,13 @@
1
+ export interface ReleaseAsset {
2
+ name: string;
3
+ url: string;
4
+ }
5
+ export interface ReleaseInfo {
6
+ tag: string;
7
+ assets: ReleaseAsset[];
8
+ }
9
+ export declare function fetchReleaseByTag(fetchJson: (url: string) => Promise<unknown>, slug: string, tag: string): Promise<ReleaseInfo>;
10
+ export declare function fetchLatestStableTag(fetchJson: (url: string) => Promise<unknown>, slug: string): Promise<string | null>;
11
+ export declare function tarballName(version: string): string;
12
+ export declare function findAsset(rel: ReleaseInfo, name: string): ReleaseAsset | null;
13
+ export declare function updateStatus(selfVersion: string, latestTag: string): "update" | "current" | "unknown";
@@ -0,0 +1,43 @@
1
+ import { parseSemver, isStable, compareSemver } from "./semver.js";
2
+ const API = "https://api.github.com";
3
+ function toAssets(raw) {
4
+ if (!Array.isArray(raw))
5
+ return [];
6
+ const out = [];
7
+ for (const a of raw) {
8
+ if (a && typeof a.name === "string" && typeof a.browser_download_url === "string") {
9
+ out.push({ name: a.name, url: a.browser_download_url });
10
+ }
11
+ }
12
+ return out;
13
+ }
14
+ export async function fetchReleaseByTag(fetchJson, slug, tag) {
15
+ const body = (await fetchJson(`${API}/repos/${slug}/releases/tags/${encodeURIComponent(tag)}`));
16
+ const tagName = typeof body.tag_name === "string" ? body.tag_name : tag;
17
+ return { tag: tagName, assets: toAssets(body.assets) };
18
+ }
19
+ export async function fetchLatestStableTag(fetchJson, slug) {
20
+ const body = (await fetchJson(`${API}/repos/${slug}/releases/latest`));
21
+ if (body.prerelease === true || body.draft === true)
22
+ return null;
23
+ const tag = typeof body.tag_name === "string" ? body.tag_name : null;
24
+ if (!tag)
25
+ return null;
26
+ const v = parseSemver(tag);
27
+ if (!v || !isStable(v))
28
+ return null;
29
+ return tag;
30
+ }
31
+ export function tarballName(version) {
32
+ return `actradeck-${version}.tar.gz`;
33
+ }
34
+ export function findAsset(rel, name) {
35
+ return rel.assets.find((a) => a.name === name) ?? null;
36
+ }
37
+ export function updateStatus(selfVersion, latestTag) {
38
+ const self = parseSemver(selfVersion);
39
+ const latest = parseSemver(latestTag);
40
+ if (!self || !latest)
41
+ return "unknown";
42
+ return compareSemver(latest, self) > 0 ? "update" : "current";
43
+ }
@@ -0,0 +1,4 @@
1
+ export declare const DEFAULT_REPO = "actradeck/actradeck";
2
+ export declare function repoSlug(ref: string): string | null;
3
+ export declare function resolveRepo(env: Record<string, string | undefined>): string;
4
+ export declare function ghcrImage(slug: string): string;
@@ -0,0 +1,25 @@
1
+ export const DEFAULT_REPO = "actradeck/actradeck";
2
+ export function repoSlug(ref) {
3
+ let s = ref.trim();
4
+ s = s.replace(/^[a-z0-9+.-]+:\/\//i, "");
5
+ s = s.replace(/^[^@/]+@/, "");
6
+ const host = /^([^/:]+)[/:]/.exec(s);
7
+ if (host && host[1].includes("."))
8
+ s = s.slice(host[0].length);
9
+ s = s.replace(/\.git$/i, "").replace(/\/+$/, "");
10
+ if (!/^[A-Za-z0-9._-]+\/[A-Za-z0-9._-]+$/.test(s))
11
+ return null;
12
+ return s;
13
+ }
14
+ export function resolveRepo(env) {
15
+ const raw = env["ACTRADECK_REPO"];
16
+ const ref = raw && raw.trim() ? raw : DEFAULT_REPO;
17
+ const slug = repoSlug(ref);
18
+ if (!slug) {
19
+ throw new Error("ACTRADECK_REPO does not resolve to an 'owner/name' repository. Set it to e.g. actradeck/actradeck.");
20
+ }
21
+ return slug;
22
+ }
23
+ export function ghcrImage(slug) {
24
+ return `ghcr.io/${slug.toLowerCase()}`;
25
+ }
@@ -0,0 +1,9 @@
1
+ export interface SemVer {
2
+ major: number;
3
+ minor: number;
4
+ patch: number;
5
+ prerelease: string[] | null;
6
+ }
7
+ export declare function parseSemver(input: string): SemVer | null;
8
+ export declare function isStable(v: SemVer): boolean;
9
+ export declare function compareSemver(a: SemVer, b: SemVer): number;
@@ -0,0 +1,56 @@
1
+ const CORE = /^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/;
2
+ export function parseSemver(input) {
3
+ const m = CORE.exec(input.trim());
4
+ if (!m)
5
+ return null;
6
+ const [, maj, min, pat, pre] = m;
7
+ return {
8
+ major: Number(maj),
9
+ minor: Number(min),
10
+ patch: Number(pat),
11
+ prerelease: pre ? pre.split(".") : null,
12
+ };
13
+ }
14
+ export function isStable(v) {
15
+ return v.prerelease === null;
16
+ }
17
+ function comparePre(a, b) {
18
+ if (a === null && b === null)
19
+ return 0;
20
+ if (a === null)
21
+ return 1;
22
+ if (b === null)
23
+ return -1;
24
+ const n = Math.max(a.length, b.length);
25
+ for (let i = 0; i < n; i++) {
26
+ const ai = a[i];
27
+ const bi = b[i];
28
+ if (ai === undefined)
29
+ return -1;
30
+ if (bi === undefined)
31
+ return 1;
32
+ const an = /^\d+$/.test(ai);
33
+ const bn = /^\d+$/.test(bi);
34
+ if (an && bn) {
35
+ const d = Number(ai) - Number(bi);
36
+ if (d !== 0)
37
+ return d < 0 ? -1 : 1;
38
+ }
39
+ else if (an !== bn) {
40
+ return an ? -1 : 1;
41
+ }
42
+ else if (ai !== bi) {
43
+ return ai < bi ? -1 : 1;
44
+ }
45
+ }
46
+ return 0;
47
+ }
48
+ export function compareSemver(a, b) {
49
+ if (a.major !== b.major)
50
+ return a.major < b.major ? -1 : 1;
51
+ if (a.minor !== b.minor)
52
+ return a.minor < b.minor ? -1 : 1;
53
+ if (a.patch !== b.patch)
54
+ return a.patch < b.patch ? -1 : 1;
55
+ return comparePre(a.prerelease, b.prerelease);
56
+ }
@@ -0,0 +1,30 @@
1
+ export interface IO {
2
+ out(msg: string): void;
3
+ err(msg: string): void;
4
+ }
5
+ export interface ExecResult {
6
+ code: number;
7
+ stdout: string;
8
+ stderr: string;
9
+ }
10
+ export interface Deps {
11
+ io: IO;
12
+ env: Record<string, string | undefined>;
13
+ platform: string;
14
+ arch: string;
15
+ nodeVersion: string;
16
+ selfVersion: string;
17
+ homedir(): string;
18
+ which(cmd: string): Promise<boolean>;
19
+ exec(cmd: string, args: string[], opts?: {
20
+ cwd?: string;
21
+ }): Promise<ExecResult>;
22
+ fetchJson(url: string): Promise<unknown>;
23
+ fetchBytes(url: string): Promise<Uint8Array>;
24
+ mkdtemp(): Promise<string>;
25
+ writeFile(path: string, bytes: Uint8Array): Promise<void>;
26
+ dirHasContent(path: string): Promise<boolean>;
27
+ extractTarball(tarPath: string, destDir: string): Promise<void>;
28
+ rmrf(path: string): Promise<void>;
29
+ handoffQuickstart(installDir: string): Promise<number>;
30
+ }
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,7 +1,45 @@
1
1
  {
2
2
  "name": "actradeck",
3
- "version": "0.0.1",
4
- "description": "Placeholder. The real ActraDeck bootstrap CLI ships at v0.5.0 — see https://github.com/actradeck/actradeck",
3
+ "version": "0.5.2",
5
4
  "license": "Apache-2.0",
6
- "repository": { "type": "git", "url": "https://github.com/actradeck/actradeck.git" }
5
+ "description": "ActraDeck bootstrap CLI — verify-and-fetch a signed release, diagnose your machine, and hand off to quickstart. A thin, dependency-free wrapper; the full product ships as a signed GitHub Release + GHCR image.",
6
+ "type": "module",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/actradeck/actradeck.git",
10
+ "directory": "packages/cli"
11
+ },
12
+ "bin": {
13
+ "actradeck": "dist/index.js"
14
+ },
15
+ "engines": {
16
+ "node": ">=20"
17
+ },
18
+ "files": [
19
+ "dist",
20
+ "README.md",
21
+ "LICENSE"
22
+ ],
23
+ "publishConfig": {
24
+ "access": "public",
25
+ "provenance": true
26
+ },
27
+ "keywords": [
28
+ "actradeck",
29
+ "coding-agent",
30
+ "observability",
31
+ "cli",
32
+ "bootstrap"
33
+ ],
34
+ "scripts": {
35
+ "build": "tsc -b",
36
+ "type-check": "tsc --noEmit",
37
+ "test": "vitest run",
38
+ "test:coverage": "vitest run --coverage"
39
+ },
40
+ "devDependencies": {
41
+ "@types/node": "25.9.1",
42
+ "typescript": "6.0.3",
43
+ "vitest": "4.1.8"
44
+ }
7
45
  }