@devstationlabs/cli 0.1.1

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 ADDED
@@ -0,0 +1,104 @@
1
+ # devstation
2
+
3
+ The DevStation coding agent, in your terminal. It reads a project, edits it,
4
+ runs the tests, and shows you the diff before anything leaves your machine.
5
+
6
+ ## Install
7
+
8
+ The binary carries its own runtime, so it needs nothing installed first:
9
+
10
+ ```sh
11
+ curl -fsSL https://devstation.online/install.sh | sh
12
+ ```
13
+
14
+ Or through npm, which needs nothing else either — it fetches the same binary
15
+ and verifies the same checksums:
16
+
17
+ ```sh
18
+ npm install -g @devstationlabs/cli
19
+ ```
20
+
21
+ > Plain `devstation` on npm is an **unrelated package** — a dashboard for
22
+ > managing dev servers. `npm i -g devstation` installs that, not this.
23
+
24
+ Either way, check the install:
25
+
26
+ ```sh
27
+ devstation doctor
28
+ ```
29
+
30
+ ## A key
31
+
32
+ The agent needs a model. Set one of these and `doctor` will go green:
33
+
34
+ ```sh
35
+ export ANTHROPIC_API_KEY=... # preferred: prompt caching, native tool use
36
+ export OPENROUTER_API_KEY=... # also works
37
+ ```
38
+
39
+ Put it in your shell profile so it survives a new terminal.
40
+
41
+ ## Use it
42
+
43
+ ```sh
44
+ cd your-project
45
+ devstation
46
+ ```
47
+
48
+ That starts a session: say what you want, and the transcript carries across
49
+ turns, so the second thing you ask can be about the first.
50
+
51
+ For one job and out:
52
+
53
+ ```sh
54
+ devstation run "fix the failing test in src/total.test.js, change the source not the test"
55
+ ```
56
+
57
+ For a repository on GitHub, ending in a pull request you approve:
58
+
59
+ ```sh
60
+ export GITHUB_TOKEN=$(gh auth token)
61
+ devstation repo owner/name "add a Usage section to the README"
62
+ ```
63
+
64
+ ## What it will not do on its own
65
+
66
+ Editing files, reading, searching and running the tests happen without asking.
67
+ Anything that deletes, installs, runs an arbitrary command, or reaches outside
68
+ the project asks first, and a plain Enter means no.
69
+
70
+ Pushing and opening a pull request it cannot do at all. It proposes; you
71
+ decide, with the diff in front of you.
72
+
73
+ ## Everything else
74
+
75
+ ```
76
+ devstation start a session and talk to it
77
+ devstation run <goal> do one thing and stop
78
+ devstation repo <owner/name> <goal>
79
+ work on a GitHub repository
80
+ devstation resume [id] [note] carry on from a stopped or crashed run
81
+ devstation status [id] [-f] watch a run, from another terminal if you like
82
+ devstation sessions runs in this workspace
83
+ devstation undo rewind the last checkpoint it made
84
+ devstation checkpoints what it can rewind to
85
+ devstation diff everything it has changed
86
+ devstation index index this project so it can search it
87
+ devstation memory what it has been told about this project
88
+ devstation tools its tools, and which ask first
89
+ devstation config the settings a run would use
90
+ devstation doctor check this machine
91
+ ```
92
+
93
+ Inside a session, `/help` lists the same things as slash commands.
94
+
95
+ **[The full reference](../../docs/CLI.md)** covers every flag, the sandbox, MCP
96
+ servers, troubleshooting, and how to uninstall.
97
+
98
+ ## Notes
99
+
100
+ Runs are checkpointed to git as they go, which is what `undo` rewinds. Sessions
101
+ are written to `.agent/` in the workspace after every message, so a crash is
102
+ resumable and a second terminal can follow a run with `devstation status -f`.
103
+
104
+ `.agent/` ignores itself, so none of it reaches your history.
@@ -0,0 +1,55 @@
1
+ #!/usr/bin/env node
2
+ import { spawnSync } from "node:child_process";
3
+ import { existsSync } from "node:fs";
4
+ import { dirname, join } from "node:path";
5
+ import { fileURLToPath } from "node:url";
6
+ import { targetFor } from "../scripts/target.mjs";
7
+
8
+ // What `devstation` runs when it was installed from npm.
9
+ //
10
+ // Three routes, in order of how well they work.
11
+ //
12
+ // The standalone binary, fetched at install time, carries its own runtime and
13
+ // needs nothing on the machine. That is the normal case.
14
+ //
15
+ // The bundled JavaScript through Bun, for anyone who installed with
16
+ // --ignore-scripts, or on a platform with no published binary. The project
17
+ // index is SQLite through `bun:sqlite`, which is why this route needs Bun
18
+ // rather than running on the node that just launched it.
19
+ //
20
+ // And if neither is available, a sentence saying which and what to do. A stack
21
+ // trace about a missing module is the same information, worse.
22
+
23
+ const here = dirname(fileURLToPath(import.meta.url));
24
+ const args = process.argv.slice(2);
25
+
26
+ const target = targetFor();
27
+ const binary = target ? join(here, "..", "scripts", target) : null;
28
+
29
+ if (binary && existsSync(binary)) {
30
+ const run = spawnSync(binary, args, { stdio: "inherit" });
31
+ process.exit(run.status ?? 1);
32
+ }
33
+
34
+ const bundle = join(here, "..", "devstation.js");
35
+ if (existsSync(bundle)) {
36
+ const bun = spawnSync("bun", [bundle, ...args], { stdio: "inherit" });
37
+ if (!(bun.error && bun.error.code === "ENOENT")) process.exit(bun.status ?? 1);
38
+ }
39
+
40
+ process.stderr.write(
41
+ [
42
+ "DevStation could not start: neither the standalone binary nor Bun is here.",
43
+ "",
44
+ target
45
+ ? " Reinstall to fetch the binary: npm install -g @devstationlabs/cli"
46
+ : ` No prebuilt binary for ${process.platform}-${process.arch}.`,
47
+ " Or install Bun: curl -fsSL https://bun.sh/install | bash",
48
+ " Or take the binary directly: https://github.com/linoxbt/dev-shipyard/releases/latest",
49
+ "",
50
+ "If your installer skips scripts (--ignore-scripts), the download above",
51
+ "never ran. Either allow it, or use one of the other two routes.",
52
+ "",
53
+ ].join("\n"),
54
+ );
55
+ process.exit(127);