slateboard 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +217 -2
  3. package/dist/bin.js +363 -0
  4. package/dist/chunk-3TOSW3FU.js +83 -0
  5. package/dist/chunk-3ZLMW2RI.js +74 -0
  6. package/dist/chunk-7GQK2VEN.js +44 -0
  7. package/dist/chunk-BWNUX4FT.js +65 -0
  8. package/dist/chunk-FMO5B2KJ.js +142 -0
  9. package/dist/chunk-FNBCYJA2.js +44 -0
  10. package/dist/chunk-GD6AEWOM.js +16028 -0
  11. package/dist/chunk-I5SMACZY.js +27 -0
  12. package/dist/chunk-KPOE4I3O.js +47 -0
  13. package/dist/chunk-LDIOPHXZ.js +269 -0
  14. package/dist/chunk-MKT3PGWK.js +43 -0
  15. package/dist/chunk-ONZFKR4I.js +6726 -0
  16. package/dist/chunk-SQHGMBUM.js +2499 -0
  17. package/dist/chunk-TCKAXJOM.js +9 -0
  18. package/dist/chunk-WKKEXOKW.js +19712 -0
  19. package/dist/chunk-WXM4BB4D.js +10706 -0
  20. package/dist/client-JHI2EG6J.js +286 -0
  21. package/dist/commands-ONES545N.js +21 -0
  22. package/dist/daemon-PALF5CS6.js +17 -0
  23. package/dist/doctor-H5Y5L2JZ.js +148 -0
  24. package/dist/hooks-2TI5OLAU.js +21 -0
  25. package/dist/http-APU3FWKO.js +13 -0
  26. package/dist/isomorphic-git-BZUKICXS.js +18761 -0
  27. package/dist/lifecycle-ZB5HEO5P.js +29 -0
  28. package/dist/local-6MC4LZJK.js +28 -0
  29. package/dist/service-FAEKZ3X2.js +15 -0
  30. package/dist/service-command-26BPMBK3.js +100 -0
  31. package/dist/src-QZIVUACM.js +69 -0
  32. package/dist/src-YVFB3ZLM.js +175 -0
  33. package/dist/ui/apple-touch-icon.png +0 -0
  34. package/dist/ui/assets/atkinson-hyperlegible-mono-latin-ext-wght-normal-CXgNM06D.woff2 +0 -0
  35. package/dist/ui/assets/atkinson-hyperlegible-mono-latin-wght-normal-CoA7y8X5.woff2 +0 -0
  36. package/dist/ui/assets/atkinson-hyperlegible-next-latin-ext-wght-normal-C6vrW8VD.woff2 +0 -0
  37. package/dist/ui/assets/atkinson-hyperlegible-next-latin-wght-normal-BcXVPD7q.woff2 +0 -0
  38. package/dist/ui/assets/index-4WzXlYHs.css +1 -0
  39. package/dist/ui/assets/index-ZKfByx7Q.js +42 -0
  40. package/dist/ui/favicon.ico +0 -0
  41. package/dist/ui/favicon.svg +1 -0
  42. package/dist/ui/icon-192.png +0 -0
  43. package/dist/ui/icon-512.png +0 -0
  44. package/dist/ui/icon-maskable-512.png +0 -0
  45. package/dist/ui/index.html +25 -0
  46. package/dist/ui/manifest.webmanifest +13 -0
  47. package/dist/upgrade-FND3UBJR.js +213 -0
  48. package/migrations/0001_init.sql +75 -0
  49. package/migrations/0002_item_keys.sql +23 -0
  50. package/migrations/0003_item_claims.sql +4 -0
  51. package/migrations/0004_git_transitions.sql +2 -0
  52. package/migrations/0005_roadmap_file.sql +4 -0
  53. package/package.json +38 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Amen
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,218 @@
1
- # Temporary Holding Version
1
+ # slate
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A local roadmap board for developers, with a web UI and an MCP server over the same core.
4
+ Workspaces group projects, projects hold ordered items that move through a configurable
5
+ workflow, items can block each other, and every item can link to its spec or
6
+ implementation plan. Runs as a user service and upgrades in one command.
7
+
8
+ See [docs/SPEC.md](docs/SPEC.md) for the specification and [docs/UI.md](docs/UI.md) with
9
+ [docs/design/](docs/design/) for the interface.
10
+
11
+ ## Install
12
+
13
+ Requires Node 22.13 or newer (for the built-in `node:sqlite`).
14
+
15
+ ```sh
16
+ npm i -g slateboard # or: pnpm add -g slateboard
17
+ slate # starts on http://127.0.0.1:4848 and opens the browser
18
+ ```
19
+
20
+ With no workspace yet, the UI opens on settings: create a workspace for a directory that
21
+ holds your repositories, scan it, and register the projects. The same from the terminal:
22
+
23
+ ```sh
24
+ slate ws add code ~/code
25
+ slate ws scan code --register
26
+ cd ~/code/my-app && slate add "Ship the importer" --milestone v1
27
+ slate next
28
+ ```
29
+
30
+ Data lives in `~/.slate` (database, lock file, logs, backups) unless `SLATE_HOME`
31
+ points elsewhere. `--port <n>` or `SLATE_PORT` picks another port.
32
+
33
+ ## Run as a service
34
+
35
+ ```sh
36
+ slate service install # macOS launchd agent or Linux systemd --user unit; starts now and at login
37
+ slate status # version, pid, port, uptime, db, schema, service state, update available
38
+ slate stop | restart # go through the service when one is installed
39
+ slate service uninstall
40
+ ```
41
+
42
+ The unit runs the absolute paths of the current `node` and the installed `slate`, with
43
+ your `SLATE_HOME` and `PATH`; output goes to `$SLATE_HOME/logs/server.log`. No
44
+ `sudo` anywhere. Without a service, `slate start --daemon` runs it detached.
45
+
46
+ `slate doctor` checks the database, schema version, lock file, port, project paths and
47
+ that the service unit points at the binary you are running.
48
+
49
+ ## Upgrade
50
+
51
+ ```sh
52
+ slate upgrade --check # compare with the latest version on npm
53
+ slate upgrade # stop, back up the database, install, migrate, start again
54
+ ```
55
+
56
+ Backups go to `$SLATE_HOME/backups/` (the last five are kept). If a migration fails
57
+ on the first boot of the new version, the server restores that backup and exits with the
58
+ migration's name. `upgrade` handles global npm and pnpm installs and prints manual steps
59
+ otherwise. The server also checks for a newer version once a day; `status` shows it (set
60
+ `SLATE_NO_UPDATE_CHECK=1` to turn that off).
61
+
62
+ ## Claude Code
63
+
64
+ Add the stdio bridge as an MCP server at user scope, so it is available in every directory
65
+ rather than only the project you ran the command in. It talks to the running server and
66
+ starts one if none is listening, so the board is shared with the UI and updates live:
67
+
68
+ ```sh
69
+ claude mcp add --scope user slate -- slate mcp
70
+ ```
71
+
72
+ or in `.mcp.json` / your Claude Code settings:
73
+
74
+ ```json
75
+ { "mcpServers": { "slate": { "command": "slate", "args": ["mcp"] } } }
76
+ ```
77
+
78
+ Tools resolve the project from the directory Claude Code was started in. Clients that speak
79
+ streamable HTTP can use `http://127.0.0.1:4848/mcp` directly.
80
+
81
+ ## Working from the board
82
+
83
+ Every item has a readable key, such as `SLT-42`: its project's key and its number. It is shown on
84
+ cards and at the top of the drawer (click to copy), returned by every tool as `key`, and accepted
85
+ wherever an item id is (a bare `42` works too inside the project's directory). Put it in the commit
86
+ messages for that work, for example as a trailing line:
87
+
88
+ ```
89
+ feat(ui): show commit subjects in the drawer
90
+
91
+ slate: SLT-42
92
+ ```
93
+
94
+ The item's id (`UGCLcTfJze`) still works in commit messages and everywhere else.
95
+
96
+ The board reads the git history of every project repository in the workspace in-process (no
97
+ `git` is run), so a planning board finds work shipped in sibling repositories, and lists commits
98
+ that mention the id under **Commits** in the item's drawer, with the project name beside commits
99
+ from another repository; Attach turns one into a ref. Agents see the same list through `get_item`
100
+ (`discovered_commits`) and `get_item_commits`.
101
+
102
+ When an item is finished, move it to a done column with the sha that completed it:
103
+
104
+ ```
105
+ move_item item_id: UGCLcTfJze status: done commit: 5f4f377
106
+ ```
107
+
108
+ The sha is looked up in the item's project repository, then the workspace's other project
109
+ repositories (a sha none of them has fails with `invalid_argument`), and attached as a commit
110
+ ref in the same step; passing it again is a no-op.
111
+ The MCP server's instructions tell agents to follow this convention.
112
+
113
+ ## Board files
114
+
115
+ `slate export -o docs/ROADMAP.md` writes the project as a markdown checklist that reads well on
116
+ GitHub and loads back with `slate import`:
117
+
118
+ ```markdown
119
+ ## Backlog
120
+
121
+ - [ ] `pNPWQkmJL0` Design schema <!-- slate id:pNPWQkmJL0 rev:3 -->
122
+ - `v1` · high · #db · blocked by `5ylfZMblA2`
123
+ - file `docs/SPEC.md` — spec
124
+ <details><summary>Details</summary>
125
+
126
+ The item's details.
127
+
128
+ </details>
129
+ ```
130
+
131
+ Frontmatter holds the columns and milestones. Edit the file and run `slate import docs/ROADMAP.md`:
132
+
133
+ - Renamed, retagged, moved or reordered items are updated to match.
134
+ - A new line such as `- [ ] Write the docs` creates an item.
135
+ - Ticking a box moves the item to done.
136
+
137
+ `--dry-run` prints the plan first. An item changed on the board since the export is skipped
138
+ and reported as a conflict (exit code 1) unless you pass `--force`. Items the file lacks stay
139
+ unless you pass `--prune`. The same file restores the board into an empty slate, with its ids.
140
+ Agents get the same through the `export_board` and `import_board` tools. The format is
141
+ specified in [docs/SPEC.md](docs/SPEC.md), section 3, "Board files".
142
+
143
+ ## Commands
144
+
145
+ ```
146
+ slate start in the foreground and open the browser
147
+ slate start [--daemon] start (detached with --daemon)
148
+ slate stop | restart | status
149
+ slate service install [--port <n>] | uninstall | start | stop | restart | status
150
+ slate upgrade [--check]
151
+ slate doctor
152
+ slate mcp stdio MCP server for Claude Code
153
+ slate ws add <name> <path>
154
+ slate ws scan <name> [--register]
155
+ slate add "title" [--status <key>] [--milestone <name>] [--blocked-by <id>]...
156
+ slate next next unblocked item for the project in this directory
157
+ slate export [project] [-o <file>] the board file to stdout or a file; works without a running server
158
+ slate import <file> [--project <p>] [--dry-run] [--prune] [--force]
159
+ apply an edited board file
160
+ ```
161
+
162
+ ## Run from source
163
+
164
+ ```sh
165
+ pnpm install
166
+ pnpm -r build # builds core, mcp, server, the UI, then bundles the cli
167
+ node packages/cli/dist/bin.js start # serves UI, REST API and MCP at http://127.0.0.1:4848
168
+ ```
169
+
170
+ Until the package is on npm, `slate` is not on your PATH, so `claude mcp add slate --
171
+ slate mcp` fails with ENOENT. Install the local build globally first:
172
+
173
+ ```sh
174
+ pnpm install:local # builds, packs and installs the cli globally: `slate` on PATH
175
+ claude mcp add --scope user slate -- slate mcp # then register it with Claude Code
176
+ ```
177
+
178
+ `slate mcp` is only a proxy to the running server, so a global snapshot keeps working while
179
+ the server itself runs from source under `pnpm dev`. Re-run `pnpm install:local` after
180
+ changing the cli package. To try the package without touching your global prefix:
181
+
182
+ ```sh
183
+ cd packages/cli && npm pack && npm i -g --prefix /tmp/rb ./slateboard-*.tgz && /tmp/rb/bin/slate --version
184
+ ```
185
+
186
+ ## Claude Code plugin
187
+
188
+ `/plugin marketplace add amenophis1er/slate` then `/plugin install slate@slate` adds the slate MCP
189
+ server, a `/slate:work [item]` skill that takes an item from the board to a commit, and a
190
+ SessionStart hook that puts the current branch's item in context. See
191
+ [plugin/README.md](plugin/README.md), including how to show the item in the status line.
192
+
193
+ ## Develop
194
+
195
+ ```sh
196
+ pnpm dev # server from source in watch mode on :4848, plus Vite with HMR on :5173
197
+ pnpm -r typecheck
198
+ pnpm -r test
199
+ ```
200
+
201
+ `pnpm dev` runs `slate start` through tsx (restarting on changes to core, mcp, server or
202
+ cli) and the Vite dev server, which proxies `/api`, `/events` and `/mcp` to port 4848. Use
203
+ http://127.0.0.1:5173 while developing; port 4848 serves the last production build of the UI.
204
+ Set `SLATE_HOME` to keep development data away from your real board.
205
+
206
+ The UI's design tokens are generated from `docs/design/tokens.json` into
207
+ `packages/ui/src/styles/tokens.css` by `packages/ui/scripts/tokens.mjs`, which runs before
208
+ every UI dev, build and typecheck.
209
+
210
+ ## Layout
211
+
212
+ ```
213
+ packages/core store, services, schemas, events
214
+ packages/mcp MCP tools, resources and prompts over core
215
+ packages/server Hono app: REST /api, SSE /events, /mcp, static UI
216
+ packages/ui React + Vite board UI
217
+ packages/cli slate binary and the published package (esbuild bundle of everything above)
218
+ ```
package/dist/bin.js ADDED
@@ -0,0 +1,363 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
3
+ import {
4
+ VERSION
5
+ } from "./chunk-TCKAXJOM.js";
6
+ import "./chunk-KPOE4I3O.js";
7
+
8
+ // src/args.ts
9
+ import { parseArgs } from "node:util";
10
+ var UsageError = class extends Error {
11
+ };
12
+ var SERVICE_ACTIONS = ["install", "uninstall", "start", "stop", "restart", "status"];
13
+ var port = { port: { type: "string" } };
14
+ function parse(args, options, positionals, usage) {
15
+ const [min, max] = typeof positionals === "number" ? [positionals, positionals] : positionals;
16
+ let parsed;
17
+ try {
18
+ parsed = parseArgs({ args, options, allowPositionals: true, strict: true });
19
+ } catch (err) {
20
+ throw new UsageError(`${err.message.split("\n")[0]}; usage: ${usage}`);
21
+ }
22
+ if (parsed.positionals.length < min || parsed.positionals.length > max) throw new UsageError(`usage: ${usage}`);
23
+ return parsed;
24
+ }
25
+ var str = (v) => typeof v === "string" ? v : void 0;
26
+ var withPort = (values) => str(values.port) !== void 0 ? { port: str(values.port) } : {};
27
+ function parseCommand(argv) {
28
+ const [command, ...rest] = argv;
29
+ switch (command) {
30
+ case void 0:
31
+ return { name: "start", daemon: false, service: false, open: true };
32
+ case "start": {
33
+ const { values, positionals } = parse(
34
+ rest,
35
+ { daemon: { type: "boolean" }, service: { type: "boolean" }, ...port },
36
+ [0, 1],
37
+ "slate start [--daemon | --service] [--port <n>] or slate start <item>"
38
+ );
39
+ if (positionals[0] !== void 0) {
40
+ if (values.daemon || values.service) throw new UsageError("slate start <item> takes no --daemon or --service");
41
+ return { name: "start-item", item: positionals[0], ...withPort(values) };
42
+ }
43
+ if (values.daemon && values.service) throw new UsageError("--daemon and --service cannot be combined");
44
+ return { name: "start", daemon: values.daemon === true, service: values.service === true, open: false, ...withPort(values) };
45
+ }
46
+ case "ls": {
47
+ const { values } = parse(rest, { all: { type: "boolean" }, status: { type: "string" }, milestone: { type: "string" }, ...port }, 0, "slate ls [--all] [--status <column>] [--milestone <name>]");
48
+ return {
49
+ name: "ls",
50
+ all: values.all === true,
51
+ ...str(values.status) ? { status: str(values.status) } : {},
52
+ ...str(values.milestone) ? { milestone: str(values.milestone) } : {},
53
+ ...withPort(values)
54
+ };
55
+ }
56
+ case "show": {
57
+ const { values, positionals } = parse(rest, port, [0, 1], "slate show [item]");
58
+ return { name: "show", ...positionals[0] ? { item: positionals[0] } : {}, ...withPort(values) };
59
+ }
60
+ case "mv": {
61
+ const { values, positionals } = parse(rest, { top: { type: "boolean" }, ...port }, 2, "slate mv <item> <column> [--top]");
62
+ return { name: "mv", item: positionals[0], column: positionals[1], top: values.top === true, ...withPort(values) };
63
+ }
64
+ case "done": {
65
+ const { values, positionals } = parse(rest, { commit: { type: "string" }, ...port }, [0, 1], "slate done [item] [--commit <sha>|HEAD]");
66
+ return { name: "done", ...positionals[0] ? { item: positionals[0] } : {}, ...str(values.commit) ? { commit: str(values.commit) } : {}, ...withPort(values) };
67
+ }
68
+ case "current": {
69
+ const { values } = parse(rest, port, 0, "slate current [--port <n>]");
70
+ return { name: "current", ...withPort(values) };
71
+ }
72
+ case "stop":
73
+ case "restart":
74
+ case "status":
75
+ case "doctor":
76
+ case "mcp": {
77
+ const { values } = parse(rest, port, 0, `slate ${command} [--port <n>]`);
78
+ return { name: command, ...withPort(values) };
79
+ }
80
+ case "next": {
81
+ const { values } = parse(rest, { milestone: { type: "string" }, ...port }, 0, "slate next [--milestone <name>|none] [--port <n>]");
82
+ const milestone = str(values.milestone)?.trim();
83
+ if (milestone === "") throw new UsageError("the milestone cannot be empty; use --milestone none for items without one");
84
+ return { name: "next", ...milestone === void 0 ? {} : { milestone: milestone === "none" ? null : milestone }, ...withPort(values) };
85
+ }
86
+ case "service": {
87
+ const [action, ...more] = rest;
88
+ const usage = `slate service ${SERVICE_ACTIONS.join("|")}`;
89
+ if (!SERVICE_ACTIONS.includes(action)) throw new UsageError(`usage: ${usage}`);
90
+ const { values } = parse(more, action === "install" ? port : {}, 0, action === "install" ? "slate service install [--port <n>]" : usage);
91
+ return { name: "service", action, ...withPort(values) };
92
+ }
93
+ case "hooks": {
94
+ const [action, ...more] = rest;
95
+ const usage = "slate hooks install|uninstall|status";
96
+ if (action !== "install" && action !== "uninstall" && action !== "status") throw new UsageError(`usage: ${usage}`);
97
+ parse(more, {}, 0, usage);
98
+ return { name: "hooks", action };
99
+ }
100
+ case "upgrade": {
101
+ const { values } = parse(rest, { check: { type: "boolean" } }, 0, "slate upgrade [--check]");
102
+ return { name: "upgrade", check: values.check === true };
103
+ }
104
+ case "ws": {
105
+ const [sub, ...more] = rest;
106
+ if (sub === "add") {
107
+ const { values, positionals } = parse(more, port, 2, "slate ws add <name> <path>");
108
+ return { name: "ws-add", workspace: positionals[0], path: positionals[1], ...withPort(values) };
109
+ }
110
+ if (sub === "scan") {
111
+ const { values, positionals } = parse(more, { register: { type: "boolean" }, ...port }, 1, "slate ws scan <name> [--register]");
112
+ return { name: "ws-scan", workspace: positionals[0], register: values.register === true, ...withPort(values) };
113
+ }
114
+ throw new UsageError("usage: slate ws add <name> <path> | slate ws scan <name> [--register]");
115
+ }
116
+ case "scan": {
117
+ const [sub, ...more] = rest;
118
+ if (sub !== "todos") throw new UsageError("usage: slate scan todos [--add]");
119
+ const { values } = parse(more, { add: { type: "boolean" }, ...port }, 0, "slate scan todos [--add] [--port <n>]");
120
+ return { name: "scan-todos", add: values.add === true, ...withPort(values) };
121
+ }
122
+ case "add": {
123
+ const { values, positionals } = parse(
124
+ rest,
125
+ { status: { type: "string" }, milestone: { type: "string" }, "blocked-by": { type: "string", multiple: true }, ...port },
126
+ 1,
127
+ 'slate add "title" [--status <key>] [--milestone <name>] [--blocked-by <id>]...'
128
+ );
129
+ const title = positionals[0].trim();
130
+ if (!title) throw new UsageError("the item title cannot be empty");
131
+ return {
132
+ name: "add",
133
+ title,
134
+ ...str(values.status) ? { status: str(values.status) } : {},
135
+ ...str(values.milestone) ? { milestone: str(values.milestone) } : {},
136
+ blockedBy: values["blocked-by"] ?? [],
137
+ ...withPort(values)
138
+ };
139
+ }
140
+ case "export": {
141
+ const { values, positionals } = parse(rest, { output: { type: "string", short: "o" }, ...port }, [0, 1], "slate export [project] [-o <file>] [--port <n>]");
142
+ return {
143
+ name: "export",
144
+ ...positionals[0] ? { project: positionals[0] } : {},
145
+ ...str(values.output) ? { output: str(values.output) } : {},
146
+ ...withPort(values)
147
+ };
148
+ }
149
+ case "import": {
150
+ const { values, positionals } = parse(
151
+ rest,
152
+ { project: { type: "string" }, "dry-run": { type: "boolean" }, prune: { type: "boolean" }, force: { type: "boolean" }, ...port },
153
+ 1,
154
+ "slate import <file> [--project <name|id>] [--dry-run] [--prune] [--force]"
155
+ );
156
+ return {
157
+ name: "import",
158
+ file: positionals[0],
159
+ ...str(values.project) ? { project: str(values.project) } : {},
160
+ dryRun: values["dry-run"] === true,
161
+ prune: values.prune === true,
162
+ force: values.force === true,
163
+ ...withPort(values)
164
+ };
165
+ }
166
+ case "--version":
167
+ case "-v":
168
+ case "version":
169
+ return { name: "version" };
170
+ case "help":
171
+ case "--help":
172
+ case "-h":
173
+ return { name: "help" };
174
+ default:
175
+ throw new UsageError(`unknown command: ${command}`);
176
+ }
177
+ }
178
+
179
+ // src/bin.ts
180
+ var USAGE = `slate ${VERSION}
181
+
182
+ Usage:
183
+ slate start in the foreground and open the browser
184
+ slate start [--daemon|--service] start (detached with --daemon; --service is for the init system)
185
+ slate stop | restart | status control the running server or service
186
+ slate service install [--port <n>] register a user service that starts at login (launchd / systemd --user)
187
+ slate service uninstall|start|stop|restart|status
188
+ slate upgrade [--check] back up, install the latest version, migrate, restart
189
+ slate doctor check database, schema, lock, service unit, port, project paths
190
+ slate mcp stdio MCP server for Claude Code; starts the server if needed
191
+ slate ws add <name> <path> create a workspace
192
+ slate ws scan <name> [--register] find git repositories; --register adds them as projects
193
+ slate add "title" [--status <key>] [--milestone <name>] [--blocked-by <id>]...
194
+ slate start <item> branch slate/<key>-<title> for an item (key, number or id), checked
195
+ out, and the item moved to the first active column
196
+ slate current the item the current branch names
197
+ slate ls [--all] [--status <col>] [--milestone <m>]
198
+ the project's items by column (done columns only with --all)
199
+ slate show [item] an item in full, with its commits (default: the branch's item)
200
+ slate mv <item> <column> [--top] move an item to a column (key or label)
201
+ slate done [item] [--commit HEAD] to the first done column; --commit attaches the sha (HEAD works)
202
+ slate hooks install|uninstall|status
203
+ a git commit-msg hook adding "slate: <key>" on slate/<key> branches
204
+ slate next [--milestone <name>] the next unblocked item for the project in this directory;
205
+ --milestone none keeps to items without a milestone
206
+ slate scan todos [--add] TODO/FIXME comments in this directory's project (git-ignored files
207
+ skipped); --add makes backlog items of the untracked ones
208
+ slate export [project] [-o <file>] the project as a board file (markdown) to stdout or a file
209
+ slate import <file> [--project <p>] [--dry-run] [--prune] [--force]
210
+ apply a board file; --dry-run shows the plan, --prune deletes
211
+ what the file lacks, --force overwrites items changed since export
212
+
213
+ Every command that talks to the server takes --port <n> (default 4848, or SLATE_PORT).
214
+ Data lives in $SLATE_HOME (default ~/.slate). With SLATE_NO_START=1, commands fail instead of
215
+ starting a server when none is running.
216
+ `;
217
+ async function execute(cmd) {
218
+ if (cmd.name === "version") {
219
+ console.log(VERSION);
220
+ return 0;
221
+ }
222
+ if (cmd.name === "help") {
223
+ process.stdout.write(USAGE);
224
+ return 0;
225
+ }
226
+ const { resolvePort, home, health } = await import("./local-6MC4LZJK.js");
227
+ const { serviceFor } = await import("./service-FAEKZ3X2.js");
228
+ const service = serviceFor();
229
+ const port2 = resolvePort("port" in cmd ? cmd.port : void 0, service?.unit()?.port);
230
+ const print = (lines) => {
231
+ for (const line of lines) console.log(line);
232
+ return 0;
233
+ };
234
+ switch (cmd.name) {
235
+ case "start": {
236
+ const { startDaemon, startForeground } = await import("./commands-ONES545N.js");
237
+ if (cmd.daemon) return startDaemon(port2, service);
238
+ return startForeground(port2, { open: cmd.open, service: cmd.service });
239
+ }
240
+ case "mcp": {
241
+ const { mcpStdio } = await import("./commands-ONES545N.js");
242
+ return mcpStdio(port2);
243
+ }
244
+ case "stop":
245
+ return (await import("./lifecycle-ZB5HEO5P.js")).stopCommand(service);
246
+ case "restart":
247
+ return (await import("./lifecycle-ZB5HEO5P.js")).restartCommand(service, port2);
248
+ case "status":
249
+ return (await import("./lifecycle-ZB5HEO5P.js")).statusCommand(service, port2, VERSION);
250
+ case "service": {
251
+ const { serviceCommand } = await import("./service-command-26BPMBK3.js");
252
+ return serviceCommand(cmd.action, service, cmd.port !== void 0 ? port2 : void 0);
253
+ }
254
+ case "hooks": {
255
+ const hooks = await import("./hooks-2TI5OLAU.js");
256
+ if (cmd.action === "status") {
257
+ const on = await hooks.hookInstalled(process.cwd());
258
+ console.log(on ? "slate commit-msg hook: installed" : "slate commit-msg hook: not installed (slate hooks install)");
259
+ return on ? 0 : 1;
260
+ }
261
+ for (const line of await (cmd.action === "install" ? hooks.installHook : hooks.uninstallHook)(process.cwd())) console.log(line);
262
+ return 0;
263
+ }
264
+ case "upgrade": {
265
+ const { realUpgradeDeps, upgrade } = await import("./upgrade-FND3UBJR.js");
266
+ return upgrade(realUpgradeDeps(service, VERSION, port2), { check: cmd.check });
267
+ }
268
+ case "doctor": {
269
+ const [{ doctor, formatCheck }, { loadMigrations }, { BIN }, { api }, { health: health2 }] = await Promise.all([
270
+ import("./doctor-H5Y5L2JZ.js"),
271
+ import("./src-YVFB3ZLM.js"),
272
+ import("./daemon-PALF5CS6.js"),
273
+ import("./http-APU3FWKO.js"),
274
+ import("./local-6MC4LZJK.js")
275
+ ]);
276
+ const checks = await doctor({
277
+ home: home(),
278
+ port: port2,
279
+ service,
280
+ bin: BIN,
281
+ expectedSchema: loadMigrations().at(-1)?.version ?? 0,
282
+ health: health2,
283
+ projects: async (p) => (await api(p, "GET", "/projects")).map(({ name, path }) => ({ name, path })),
284
+ roadmaps: async (p) => {
285
+ const kept = (await api(p, "GET", "/projects")).filter((x) => x.roadmapFile);
286
+ return Promise.all(kept.map(async (x) => ({ name: x.name, ...await api(p, "GET", `/projects/${x.id}/roadmap-file`) })));
287
+ }
288
+ });
289
+ for (const c of checks) console.log(formatCheck(c));
290
+ return checks.some((c) => c.level === "fail") ? 1 : 0;
291
+ }
292
+ case "export": {
293
+ const { exportProject } = await import("./client-JHI2EG6J.js");
294
+ const markdown = await exportProject(port2, home(), process.cwd(), cmd.project);
295
+ if (!cmd.output) {
296
+ process.stdout.write(markdown);
297
+ return 0;
298
+ }
299
+ const { writeFileSync } = await import("node:fs");
300
+ writeFileSync(cmd.output, markdown);
301
+ console.log(`wrote ${cmd.output}`);
302
+ return 0;
303
+ }
304
+ }
305
+ const [{ ensureServer }, client] = await Promise.all([import("./commands-ONES545N.js"), import("./client-JHI2EG6J.js")]);
306
+ if (process.env.SLATE_NO_START) {
307
+ if (!await health(port2)) throw new Error(`no slate server on port ${port2} (SLATE_NO_START is set)`);
308
+ } else await ensureServer(port2);
309
+ switch (cmd.name) {
310
+ case "ws-add":
311
+ return print(await client.wsAdd(port2, cmd.workspace, cmd.path));
312
+ case "ws-scan":
313
+ return print(await client.wsScan(port2, cmd.workspace, cmd.register));
314
+ case "add":
315
+ return print(await client.addItem(port2, process.cwd(), cmd));
316
+ case "next":
317
+ return print(await client.nextItem(port2, process.cwd(), cmd.milestone));
318
+ case "scan-todos":
319
+ return print(await client.scanTodos(port2, process.cwd(), cmd.add));
320
+ case "ls":
321
+ return print(await client.listItems(port2, process.cwd(), cmd));
322
+ case "show":
323
+ return print(await client.showItem(port2, process.cwd(), cmd.item));
324
+ case "mv":
325
+ return print(await client.moveItem(port2, process.cwd(), cmd.item, cmd.column, cmd.top));
326
+ case "done":
327
+ return print(await client.doneItem(port2, process.cwd(), cmd.item, cmd.commit));
328
+ case "start-item":
329
+ return print(await client.startItem(port2, process.cwd(), cmd.item));
330
+ case "current": {
331
+ const lines = await client.currentItem(port2, process.cwd());
332
+ print(lines);
333
+ return lines[0]?.startsWith("no current item") ? 1 : 0;
334
+ }
335
+ case "import": {
336
+ const { readFileSync } = await import("node:fs");
337
+ const { project, result } = await client.importProject(port2, process.cwd(), readFileSync(cmd.file, "utf8"), cmd);
338
+ print(client.formatImport(cmd.file, project, result));
339
+ return result.conflicts.length > 0 ? 1 : 0;
340
+ }
341
+ }
342
+ }
343
+ async function main(argv) {
344
+ let cmd;
345
+ try {
346
+ cmd = parseCommand(argv);
347
+ } catch (err) {
348
+ if (err instanceof UsageError) {
349
+ console.error(`slate: ${err.message}
350
+ run \`slate help\` for usage`);
351
+ return 2;
352
+ }
353
+ throw err;
354
+ }
355
+ return execute(cmd);
356
+ }
357
+ main(process.argv.slice(2)).then(
358
+ (code) => process.exit(code),
359
+ (err) => {
360
+ console.error(`slate: ${err instanceof Error ? err.message : String(err)}`);
361
+ process.exit(1);
362
+ }
363
+ );
@@ -0,0 +1,83 @@
1
+ import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
2
+
3
+ // src/local.ts
4
+ import { readFileSync } from "node:fs";
5
+ import { homedir } from "node:os";
6
+ import path from "node:path";
7
+ var DEFAULT_PORT = 4848;
8
+ function home() {
9
+ const env = process.env.SLATE_HOME;
10
+ if (!env) return path.join(homedir(), ".slate");
11
+ return path.resolve(env.startsWith("~/") ? path.join(homedir(), env.slice(2)) : env);
12
+ }
13
+ function dbFile(dir = home()) {
14
+ return path.join(dir, "slate.db");
15
+ }
16
+ function baseUrl(port) {
17
+ return `http://127.0.0.1:${port}`;
18
+ }
19
+ function mcpUrl(port) {
20
+ return `${baseUrl(port)}/mcp`;
21
+ }
22
+ function connectCommand(port) {
23
+ return `claude mcp add --scope user slate -- slate mcp${port === DEFAULT_PORT ? "" : ` --port ${port}`}`;
24
+ }
25
+ function connectLines(port) {
26
+ return [` ${"mcp".padEnd(9)}${mcpUrl(port)}`, ` ${"connect".padEnd(9)}${connectCommand(port)}`];
27
+ }
28
+ function liveLock(dir = home()) {
29
+ let lock;
30
+ try {
31
+ lock = JSON.parse(readFileSync(path.join(dir, "server.lock"), "utf8"));
32
+ } catch {
33
+ return null;
34
+ }
35
+ try {
36
+ process.kill(lock.pid, 0);
37
+ return lock;
38
+ } catch (err) {
39
+ return err.code === "EPERM" ? lock : null;
40
+ }
41
+ }
42
+ function resolvePort(flag, fallback) {
43
+ const lockPort = liveLock()?.port;
44
+ const raw = flag ?? (lockPort !== void 0 ? String(lockPort) : void 0) ?? process.env.SLATE_PORT;
45
+ if (raw === void 0) return fallback ?? DEFAULT_PORT;
46
+ const port = Number(raw);
47
+ if (!Number.isInteger(port) || port < 1 || port > 65535) throw new Error(`invalid port: ${raw}`);
48
+ return port;
49
+ }
50
+ async function health(port) {
51
+ try {
52
+ const res = await fetch(`${baseUrl(port)}/health`, { signal: AbortSignal.timeout(1e3) });
53
+ if (!res.ok) return null;
54
+ const body = await res.json();
55
+ return body.ok ? body : null;
56
+ } catch {
57
+ return null;
58
+ }
59
+ }
60
+ async function waitForHealth(port, timeoutMs, gaveUp = () => false) {
61
+ const deadline = Date.now() + timeoutMs;
62
+ while (Date.now() < deadline) {
63
+ const h = await health(port);
64
+ if (h) return h;
65
+ if (gaveUp()) return null;
66
+ await new Promise((r) => setTimeout(r, 100));
67
+ }
68
+ return null;
69
+ }
70
+
71
+ export {
72
+ DEFAULT_PORT,
73
+ home,
74
+ dbFile,
75
+ baseUrl,
76
+ mcpUrl,
77
+ connectCommand,
78
+ connectLines,
79
+ liveLock,
80
+ resolvePort,
81
+ health,
82
+ waitForHealth
83
+ };