@lumpcode/cli 0.0.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/DOCS/advanced-config.md +261 -0
- package/DOCS/commands.md +492 -0
- package/DOCS/concepts.md +148 -0
- package/DOCS/examples.md +244 -0
- package/DOCS/get-started.md +222 -0
- package/DOCS/local-config.md +80 -0
- package/DOCS/lump-config.md +276 -0
- package/DOCS/project-config.md +56 -0
- package/DOCS/publishing.md +79 -0
- package/DOCS/types.md +267 -0
- package/LICENSE +202 -0
- package/README.md +192 -0
- package/bin/lumpcode.js +42 -0
- package/dist/index.js +7 -0
- package/dist/presets/commands/copilot.js +25 -0
- package/dist/presets/commands/cursor.js +70 -0
- package/dist/schemas/localConfig.schema.json +29 -0
- package/dist/schemas/lumpConfig.schema.json +195 -0
- package/package.json +61 -0
- package/scripts/native-binary.mjs +180 -0
- package/scripts/postinstall.mjs +52 -0
package/DOCS/commands.md
ADDED
|
@@ -0,0 +1,492 @@
|
|
|
1
|
+
# Lumpcode CLI — command reference
|
|
2
|
+
|
|
3
|
+
This page documents every `lumpcode` subcommand and its options.
|
|
4
|
+
|
|
5
|
+
## Contents
|
|
6
|
+
|
|
7
|
+
**[Global conventions](#ref-global-conventions)** — [Working directory](#ref-working-directory) · [`--json`](#ref-json-output) · [Booleans](#ref-boolean-options) · [Validation](#ref-project-validation) · [`--help`](#ref-lumpcode-help)
|
|
8
|
+
|
|
9
|
+
**[Auth](#ref-auth)** — [`lumpcode login`](#ref-cmd-login) · [`lumpcode logout`](#ref-cmd-logout)
|
|
10
|
+
|
|
11
|
+
**[Project setup](#ref-section-project-setup)** — [`lumpcode project-setup`](#ref-cmd-project-setup) · [`lumpcode lump-create`](#ref-cmd-lump-create)
|
|
12
|
+
|
|
13
|
+
**[Run](#ref-section-run)** — [`lumpcode run`](#ref-cmd-run) · [`lumpcode lump-plan`](#ref-cmd-lump-plan)
|
|
14
|
+
|
|
15
|
+
**[Daemon](#ref-daemon)** — [`lumpcode start`](#ref-cmd-start) · [`lumpcode stop`](#ref-cmd-stop) · [`lumpcode restart`](#ref-cmd-restart) · [`lumpcode daemon-status`](#ref-cmd-daemon-status) · [`lumpcode daemon-log`](#ref-cmd-daemon-log)
|
|
16
|
+
|
|
17
|
+
**[Status & cleanup](#ref-status-cleanup)** — [`lumpcode lump-status`](#ref-cmd-lump-status) · [`lumpcode context-status`](#ref-cmd-context-status) · [`lumpcode clean`](#ref-cmd-clean)
|
|
18
|
+
|
|
19
|
+
**[Related documentation](#ref-related-documentation)** · **[Three “status” commands](#three-commands-that-mention-status)**
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
<a id="ref-global-conventions"></a>
|
|
24
|
+
|
|
25
|
+
## Global conventions
|
|
26
|
+
|
|
27
|
+
<a id="ref-working-directory"></a>
|
|
28
|
+
|
|
29
|
+
### Working directory
|
|
30
|
+
|
|
31
|
+
Most commands use the current working directory as the project root. Run `lumpcode` from the root of the git repository that contains `.lumpcode/`.
|
|
32
|
+
|
|
33
|
+
If a lump uses a **workspace copy** under `~/.lumpcode/project-copies/`, you still invoke the CLI from your real repo root; see [Workspace setup](./concepts.md#workspace-setup).
|
|
34
|
+
|
|
35
|
+
<h3 id="ref-json-output"><code>--json</code> output</h3>
|
|
36
|
+
|
|
37
|
+
Every subcommand accepts **`--json`**. Option tables below list only **command-specific** options.
|
|
38
|
+
|
|
39
|
+
When **`--json`** is set, the CLI prints a single JSON object instead of human-oriented lines:
|
|
40
|
+
|
|
41
|
+
```json
|
|
42
|
+
{
|
|
43
|
+
"messages": ["…"],
|
|
44
|
+
"data": { }
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
- **`messages`** — Always an array of strings (summary lines or errors).
|
|
49
|
+
- **`data`** — Optional structured payload (command-specific).
|
|
50
|
+
|
|
51
|
+
On failure the process exits non-zero; error lines go to stderr, success output to stdout.
|
|
52
|
+
|
|
53
|
+
<a id="ref-boolean-options"></a>
|
|
54
|
+
|
|
55
|
+
### Boolean options
|
|
56
|
+
|
|
57
|
+
Boolean options are **flags**: omit the flag for the default, pass the flag to select the non-default behavior.
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
lumpcode start --foreground
|
|
61
|
+
lumpcode context-status myLump myContext --setToFinished
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
For **`lumpcode lump-status`**, verbose status JSON is default; pass **`--silent`** for summary-only output.
|
|
65
|
+
|
|
66
|
+
**Windows / PowerShell:** single-quoted cron strings are safest: `--cronSetup '*/10 * * * *'`.
|
|
67
|
+
|
|
68
|
+
<a id="ref-project-validation"></a>
|
|
69
|
+
|
|
70
|
+
### Project validation
|
|
71
|
+
|
|
72
|
+
Commands that need a Lumpcode project verify that **`.lumpcode/`** and **`.git/`** exist under the effective project root. If not, they fail with a clear error message.
|
|
73
|
+
|
|
74
|
+
<h3 id="ref-lumpcode-help"><code>lumpcode --help</code></h3>
|
|
75
|
+
|
|
76
|
+
The program and each subcommand support **`--help`** (e.g. `lumpcode run --help`).
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
<a id="ref-auth"></a>
|
|
81
|
+
|
|
82
|
+
## Auth
|
|
83
|
+
|
|
84
|
+
<a id="ref-cmd-login"></a>
|
|
85
|
+
|
|
86
|
+
### `lumpcode login`
|
|
87
|
+
|
|
88
|
+
**Description:** Authenticate against the Lumpcode API and persist the session token locally. You need a Lumpcode account ([lumpcode.com](https://lumpcode.com)); same prerequisite as the [README](../README.md#before-you-run-anything).
|
|
89
|
+
|
|
90
|
+
**Usage:** `lumpcode login [options]`
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
| Option | Type | Required | Description |
|
|
94
|
+
| ------------ | ------ | -------- | ------------------------------------------------------------------------------------------------- |
|
|
95
|
+
| `--email` | string | No | Email; if omitted, you are prompted |
|
|
96
|
+
| `--password` | string | No | Password for non-interactive login; **not recommended** (visible in process list / shell history) |
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
**Behavior:**
|
|
100
|
+
|
|
101
|
+
- If a valid token already exists in `~/.lumpcode/auth.json`, prints that you are already logged in.
|
|
102
|
+
- Otherwise authenticates with the Lumpcode service, then writes `~/.lumpcode/auth.json`.
|
|
103
|
+
|
|
104
|
+
**See also:** [get-started.md](./get-started.md#step-1-log-in).
|
|
105
|
+
|
|
106
|
+
<a id="ref-cmd-logout"></a>
|
|
107
|
+
|
|
108
|
+
### `lumpcode logout`
|
|
109
|
+
|
|
110
|
+
**Description:** Delete stored authentication.
|
|
111
|
+
|
|
112
|
+
**Usage:** `lumpcode logout [options]`
|
|
113
|
+
|
|
114
|
+
**Options:** None besides global [`--json`](#ref-json-output).
|
|
115
|
+
|
|
116
|
+
**Behavior:** Removes `~/.lumpcode/auth.json`.
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
<a id="ref-section-project-setup"></a>
|
|
121
|
+
|
|
122
|
+
## Project setup
|
|
123
|
+
|
|
124
|
+
<a id="ref-cmd-project-setup"></a>
|
|
125
|
+
|
|
126
|
+
### `lumpcode project-setup`
|
|
127
|
+
|
|
128
|
+
**Description:** Create a fresh `.lumpcode/` tree in a git repository.
|
|
129
|
+
|
|
130
|
+
**Usage:** `lumpcode project-setup [options]`
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
| Option | Type | Required | Description |
|
|
134
|
+
| ------ | ---- | -------- | ----------- |
|
|
135
|
+
| `--projectPath` | string | No | Directory to initialize (default: `.` resolved from cwd) |
|
|
136
|
+
| `--projectName` | string | No | Stored in `project.json`; must be letters, digits, `_`, `-` only; if omitted, inferred from `origin` or directory basename and normalized |
|
|
137
|
+
| `--mode` | `shared` \| `dedicated` | No | Initial `local.json.mode` (default `shared`) — see [local-config.md](./local-config.md) |
|
|
138
|
+
| `--projectBaseBranch` | string | No | Initial `local.json.projectBaseBranch` (default `main`) |
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
**Creates:**
|
|
142
|
+
|
|
143
|
+
- `.lumpcode/project.json` — minimal `{ "projectName": "…" }`
|
|
144
|
+
- `.lumpcode/local.json` — `{ "mode": "shared", "projectBaseBranch": "main" }` (per machine, gitignored)
|
|
145
|
+
- `.lumpcode/lumps/` — empty
|
|
146
|
+
- `.lumpcode/commands/` — empty
|
|
147
|
+
- Appends `.lumpcode/**/contextStatusRecord.json`, `.lumpcode/**/history/`, and `.lumpcode/local.json` to `.gitignore`
|
|
148
|
+
|
|
149
|
+
**Fails if:**
|
|
150
|
+
|
|
151
|
+
- Path does not exist or is not a directory
|
|
152
|
+
- Path is not a git work tree
|
|
153
|
+
- `.lumpcode/` already exists
|
|
154
|
+
|
|
155
|
+
**See also:** [project-config.md](./project-config.md), [get-started.md](./get-started.md#step-2-initialize-the-lumpcode-project).
|
|
156
|
+
|
|
157
|
+
<a id="ref-cmd-lump-create"></a>
|
|
158
|
+
|
|
159
|
+
### `lumpcode lump-create`
|
|
160
|
+
|
|
161
|
+
**Description:** Scaffold a new lump configuration file.
|
|
162
|
+
|
|
163
|
+
**Usage:** `lumpcode lump-create <lumpName> [options]`
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
| Argument | Required | Description |
|
|
167
|
+
| ---------- | -------- | ----------------------------------------------------------------------------------------- |
|
|
168
|
+
| `lumpName` | Yes | Folder name under `.lumpcode/lumps/`; no `/`, `\`, leading/trailing spaces, or `.` / `..` |
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
| Option | Type | Required | Description |
|
|
173
|
+
| ---------- | --------------- | -------- | -------------------------------- |
|
|
174
|
+
| `--config` | `json` \| `js` | No | Output format (default `json`) |
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
**Creates:** `.lumpcode/lumps/<lumpName>/config.json` or `config.js`.
|
|
178
|
+
|
|
179
|
+
**Fails if:** A `config.json` or `config.js` already exists in that lump folder.
|
|
180
|
+
|
|
181
|
+
**See also:** [lump-config.md](./lump-config.md).
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
<a id="ref-section-run"></a>
|
|
186
|
+
|
|
187
|
+
## Run
|
|
188
|
+
|
|
189
|
+
<a id="ref-cmd-run"></a>
|
|
190
|
+
|
|
191
|
+
### `lumpcode run`
|
|
192
|
+
|
|
193
|
+
**Description:** Execute **one** tick for a single lump (load config, resolve contexts, run the agent, refresh status).
|
|
194
|
+
|
|
195
|
+
**Usage:** `lumpcode run <lumpName> [options]`
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
| Argument | Required | Description |
|
|
199
|
+
| ---------- | -------- | ------------------------------------------- |
|
|
200
|
+
| `lumpName` | Yes | Name of the folder under `.lumpcode/lumps/` |
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
Plus global [`--json`](#ref-json-output).
|
|
204
|
+
|
|
205
|
+
**Behavior:**
|
|
206
|
+
|
|
207
|
+
1. Reads `.lumpcode/local.json` (hard-fails if missing); resolves `mode`, then runs **pre-flight** (`git fetch && git switch <projectBaseBranch> && git reset --hard origin/<projectBaseBranch> && git pull`) in the resolved workspace.
|
|
208
|
+
2. Runs the lump, then switches the workspace back to `projectBaseBranch`.
|
|
209
|
+
|
|
210
|
+
**Success cases:**
|
|
211
|
+
|
|
212
|
+
- Normal completion: message includes `SUCCESS: Lump run successfully` and `data` may include details of the run (branch name, context names, etc.).
|
|
213
|
+
- **Skipped run** when `maximumNumberOfConcurrentBranches` is reached: still a success but nothing is done.
|
|
214
|
+
|
|
215
|
+
**Fails if:** `local.json` missing or invalid, pre-flight git commands fail, config missing/invalid, or engine errors.
|
|
216
|
+
|
|
217
|
+
**See also:** [concepts.md](./concepts.md#one-run-end-to-end), [lump-config.md](./lump-config.md#optional-top-level-fields) (`maximumNumberOfConcurrentBranches`), [get-started.md](./get-started.md#step-5-run-once).
|
|
218
|
+
|
|
219
|
+
<a id="ref-cmd-lump-plan"></a>
|
|
220
|
+
|
|
221
|
+
### `lumpcode lump-plan`
|
|
222
|
+
|
|
223
|
+
**Description:** Preview a lump configuration before running it: validate config and hooks, list contexts, show generated prompts, or dry-run the next tick. Does **not** run pre-flight (no `git reset --hard`), does **not** invoke the coding agent, and does **not** push or commit.
|
|
224
|
+
|
|
225
|
+
**Usage:** `lumpcode lump-plan <lumpName> [options]`
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
| Argument | Required | Description |
|
|
229
|
+
| ---------- | -------- | ------------------------------------------- |
|
|
230
|
+
| `lumpName` | Yes | Name of the folder under `.lumpcode/lumps/` |
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
| Option | Type | Required | Description |
|
|
235
|
+
| --------------- | ------ | -------- | --------------------------------------------------------------------------- |
|
|
236
|
+
| `--contexts` | flag | No | Include resolved context names and variables |
|
|
237
|
+
| `--todoOnly` | flag | No | With `--contexts`, `--prompts`, or `--plan`: only contexts `run` would pick next (read-only git status queries) |
|
|
238
|
+
| `--prompts` | flag | No | Include per-context prompt text and resolved agent command (`executable` + `args`) |
|
|
239
|
+
| `--plan` | flag | No | Full dry-run: branch name, workspace setup/teardown shell commands, batch contexts, git add/commit/push strings, concurrent-branch skip reason |
|
|
240
|
+
| `--contextName` | string | No | Scope contexts / prompts / plan to one context |
|
|
241
|
+
|
|
242
|
+
Plus global [`--json`](#ref-json-output).
|
|
243
|
+
|
|
244
|
+
**Depth:** flags stack by specificity: `--plan` > `--prompts` > `--contexts` > default (validate only).
|
|
245
|
+
|
|
246
|
+
**Behavior:**
|
|
247
|
+
|
|
248
|
+
1. Validates project root (`.lumpcode/` + `.git/`).
|
|
249
|
+
2. Loads lump config (`config.json` is checked against the JSON schema; `config.js` is imported and resolved).
|
|
250
|
+
3. Resolves hooks, command modules, and `disabled` the same way as `run` (shared pipeline).
|
|
251
|
+
4. Optionally lists contexts, expands prompts, or simulates one run tick.
|
|
252
|
+
|
|
253
|
+
**Note:** `--prompts` and `--plan` may **execute** user-defined hooks (`setupFn`, `promptFn`, dynamic `steps` functions) to produce accurate output. They do not run the agent binary or git mutations.
|
|
254
|
+
|
|
255
|
+
**Fails if:** Project validation fails, `local.json` missing or invalid, config missing/invalid, or resolution errors.
|
|
256
|
+
|
|
257
|
+
**See also:** [lump-config.md](./lump-config.md), [`lumpcode run`](#ref-cmd-run).
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
<a id="ref-daemon"></a>
|
|
262
|
+
|
|
263
|
+
## Daemon
|
|
264
|
+
|
|
265
|
+
<a id="ref-cmd-start"></a>
|
|
266
|
+
|
|
267
|
+
### `lumpcode start`
|
|
268
|
+
|
|
269
|
+
**Description:** Run the **scheduler** that periodically executes lumps in the project (all loadable lumps by default, or one lump with `--lumpName`).
|
|
270
|
+
|
|
271
|
+
**Usage:** `lumpcode start [options]`
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
| Option | Type | Required | Description |
|
|
275
|
+
| -------------- | ------- | -------- | ------------------------------------------------------------------------ |
|
|
276
|
+
| `--foreground` | flag | No | Blocking in this terminal; omit to detach a background daemon |
|
|
277
|
+
| `--cronSetup` | string | No | Cron expression (default `*/5 * * * *` — every 5 minutes) |
|
|
278
|
+
| `--lumpName` | string | No | Run the scheduler for a single lump only |
|
|
279
|
+
|
|
280
|
+
With **`--json`**, all the logs even the ones of the deamon will be with json output.
|
|
281
|
+
|
|
282
|
+
**`local.json` at startup:** `.lumpcode/local.json` is read **once** when the daemon starts (`mode`, `projectBaseBranch`, `workspaceStrategy`, `disabled`). Those values are frozen for every tick until you restart the daemon. Edit the file and restart to pick up changes.
|
|
283
|
+
|
|
284
|
+
**Pre-flight per tick:** skips the tick when `disabled` is `true` in the frozen config (no pre-flight, no lump runs). Otherwise it runs pre-flight (`git fetch && git switch <projectBaseBranch> && git reset --hard origin/<projectBaseBranch> && git pull`), then runs every targeted loadable lump whose own config is not `disabled`. If pre-flight fails the tick is **skipped** with an error logged to the daemon log file; the next tick tries again.
|
|
285
|
+
|
|
286
|
+
**Daemon files** under `~/.lumpcode/daemons/`:
|
|
287
|
+
|
|
288
|
+
| Scope | PID / log / meta |
|
|
289
|
+
| ----- | ---------------- |
|
|
290
|
+
| Project (default) | `<projectName>.daemon.pid`, `.daemon.log`, `.daemon.meta.json` |
|
|
291
|
+
| Single lump (`--lumpName`) | `<projectName>.<lumpName>.daemon.pid`, `.daemon.log`, `.daemon.meta.json` |
|
|
292
|
+
|
|
293
|
+
Meta JSON includes `{ "cronSetup": "…" }`, `"workspaceStrategy": "checkout" | "worktree"` (frozen from `local.json` at daemon start), and for per-lump daemons optional `"lumpName": "…"`.
|
|
294
|
+
|
|
295
|
+
**Collision rules:**
|
|
296
|
+
|
|
297
|
+
- Starting the **global** daemon fails if **any** daemon for this project is already running (global or per-lump).
|
|
298
|
+
- With **`checkout`** workspace strategy, only **one** daemon may run for the project (global or per-lump). Starting a new daemon fails while any other is alive.
|
|
299
|
+
- With **`worktree`** strategy, multiple **per-lump** daemons may run together only when **all** running daemons (including any you start against) use `worktree`. Starting a `worktree` daemon fails while a daemon started with **`checkout`** is still running — stop it first.
|
|
300
|
+
- The workspace strategy recorded in each daemon's meta file is the value frozen at **that daemon's** startup (not re-read from `local.json` on each tick).
|
|
301
|
+
|
|
302
|
+
**Detached mode (default):**
|
|
303
|
+
|
|
304
|
+
- Ensures `~/.lumpcode/daemons/` exists.
|
|
305
|
+
- Applies the collision rules above.
|
|
306
|
+
- Re-launches itself with `--foreground --cronSetup <expr>` (and `--lumpName` when scoped) and detaches, redirecting stdio to the log file.
|
|
307
|
+
- Writes PID + meta for `restart` and `daemon-status`.
|
|
308
|
+
|
|
309
|
+
**Foreground mode:**
|
|
310
|
+
|
|
311
|
+
- Validates cron, runs an immediate tick, then schedules ticks on the same cron.
|
|
312
|
+
- On SIGINT/SIGTERM, stops the scheduler and removes PID/meta if they belong to this process.
|
|
313
|
+
|
|
314
|
+
**Fails if:** No lumps with loadable config (or unknown `--lumpName`), invalid cron, daemon already running per the rules above, cannot write PID/log/meta, or `local.json` missing/invalid.
|
|
315
|
+
|
|
316
|
+
**See also:** [concepts.md](./concepts.md#when-to-use-run-vs-start-daemon), [get-started.md](./get-started.md#step-6-run-continuously-optional).
|
|
317
|
+
|
|
318
|
+
<a id="ref-cmd-stop"></a>
|
|
319
|
+
|
|
320
|
+
### `lumpcode stop`
|
|
321
|
+
|
|
322
|
+
**Description:** Stop the background daemon using the PID file (project-wide or per-lump).
|
|
323
|
+
|
|
324
|
+
**Usage:** `lumpcode stop [options]`
|
|
325
|
+
|
|
326
|
+
| Option | Type | Required | Description |
|
|
327
|
+
| ------------ | ------ | -------- | ------------------------------------------------ |
|
|
328
|
+
| `--lumpName` | string | No | Stop the daemon scoped to a single lump |
|
|
329
|
+
|
|
330
|
+
**Behavior:** Reads the scoped PID file under `~/.lumpcode/daemons/`, sends **SIGTERM**, waits up to **5 seconds** for exit, then deletes PID and meta files on success.
|
|
331
|
+
|
|
332
|
+
**Fails if:** No PID file, invalid PID, cannot signal process, or process does not exit within the deadline.
|
|
333
|
+
|
|
334
|
+
**See also:** [concepts.md](./concepts.md#when-to-use-run-vs-start-daemon).
|
|
335
|
+
|
|
336
|
+
<a id="ref-cmd-restart"></a>
|
|
337
|
+
|
|
338
|
+
### `lumpcode restart`
|
|
339
|
+
|
|
340
|
+
**Description:** `lumpcode stop` then `lumpcode start` with the **same** `cronSetup` and scope read from meta (or the default if missing).
|
|
341
|
+
|
|
342
|
+
**Usage:** `lumpcode restart [options]`
|
|
343
|
+
|
|
344
|
+
| Option | Type | Required | Description |
|
|
345
|
+
| ------------ | ------ | -------- | ------------------------------------------------ |
|
|
346
|
+
| `--lumpName` | string | No | Restart the daemon scoped to a single lump |
|
|
347
|
+
|
|
348
|
+
When `--lumpName` is omitted, `lumpName` from the meta file is used if present (so a bare `restart` preserves a per-lump daemon).
|
|
349
|
+
|
|
350
|
+
**See also:** [concepts.md](./concepts.md#when-to-use-run-vs-start-daemon).
|
|
351
|
+
|
|
352
|
+
<a id="ref-cmd-daemon-status"></a>
|
|
353
|
+
|
|
354
|
+
### `lumpcode daemon-status`
|
|
355
|
+
|
|
356
|
+
**Description:** Inspect daemon PID file and process liveness (project-wide or per-lump).
|
|
357
|
+
|
|
358
|
+
**Usage:** `lumpcode daemon-status [options]`
|
|
359
|
+
|
|
360
|
+
| Option | Type | Required | Description |
|
|
361
|
+
| ------------ | ------ | -------- | ------------------------------------------------ |
|
|
362
|
+
| `--lumpName` | string | No | Inspect the daemon scoped to a single lump |
|
|
363
|
+
|
|
364
|
+
**Output highlights:**
|
|
365
|
+
|
|
366
|
+
- Whether a daemon is currently running for this scope
|
|
367
|
+
- Paths to the PID, log, and meta files
|
|
368
|
+
- Stale PID detection (process no longer exists)
|
|
369
|
+
- `cronSetup` and optional `lumpName` from meta when present
|
|
370
|
+
|
|
371
|
+
**See also:** [concepts.md](./concepts.md#when-to-use-run-vs-start-daemon) (daemon files table).
|
|
372
|
+
|
|
373
|
+
<a id="ref-cmd-daemon-log"></a>
|
|
374
|
+
|
|
375
|
+
### `lumpcode daemon-log`
|
|
376
|
+
|
|
377
|
+
**Description:** Tail the background daemon log file (project-wide or per-lump). **Follows live by default** (`tail -f`); pass **`--noFollow`** to print and exit.
|
|
378
|
+
|
|
379
|
+
**Usage:** `lumpcode daemon-log [options]`
|
|
380
|
+
|
|
381
|
+
| Option | Type | Required | Description |
|
|
382
|
+
| ------------ | ------- | -------- | --------------------------------------------------------------------------- |
|
|
383
|
+
| `--lumpName` | string | No | Read the log for a per-lump daemon |
|
|
384
|
+
| `--lines` | number | No | Number of initial lines to show (with follow, uses `tail -n N -f`) |
|
|
385
|
+
| `--noFollow` | flag | No | Print lines and exit instead of following live |
|
|
386
|
+
| `--json` | flag | No | With `--noFollow`, output structured JSON (`logFilePath`, `lines`, …) |
|
|
387
|
+
|
|
388
|
+
**Behavior:**
|
|
389
|
+
|
|
390
|
+
- Default: `tail -f` on the scoped log file until Ctrl+C / SIGTERM.
|
|
391
|
+
- With `--lines N` (no `--noFollow`): `tail -n N -f` — show the last *N* lines, then keep following.
|
|
392
|
+
- With `--noFollow`: print and exit (`tail` or `tail -n N` when `--lines` is set).
|
|
393
|
+
- Does not require the daemon to be running; fails if the log file does not exist for that scope.
|
|
394
|
+
|
|
395
|
+
**See also:** [concepts.md](./concepts.md#when-to-use-run-vs-start-daemon) (daemon files table).
|
|
396
|
+
|
|
397
|
+
---
|
|
398
|
+
|
|
399
|
+
<h2 id="ref-status-cleanup">Status & cleanup</h2>
|
|
400
|
+
|
|
401
|
+
<a id="ref-cmd-lump-status"></a>
|
|
402
|
+
|
|
403
|
+
### `lumpcode lump-status`
|
|
404
|
+
|
|
405
|
+
**Description:** For one lump (or all lumps), **recompute** `contextStatusRecord.json` from remote git state and print a summary.
|
|
406
|
+
|
|
407
|
+
**Usage:** `lumpcode lump-status [options]`
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
| Option | Type | Default | Description |
|
|
411
|
+
| ------------ | ------ | ------- | ----------------------------------------------------------------------------------------------------------------------------- |
|
|
412
|
+
| `--lumpName` | string | — | If omitted, all lumps with loadable configs |
|
|
413
|
+
| `--silent` | flag | No | Omit pretty-printed status JSON; print summary lines only (default is verbose when not using `--json`) |
|
|
414
|
+
| `--json` | flag | No | JSON output mode |
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
**Data:** `data.statusByLump` holds the in-memory maps keyed by lump name.
|
|
418
|
+
|
|
419
|
+
**See also:** [concepts.md](./concepts.md#status-lifecycle), [lump-config.md](./lump-config.md#contextstatusrecordjson).
|
|
420
|
+
|
|
421
|
+
<a id="ref-cmd-context-status"></a>
|
|
422
|
+
|
|
423
|
+
### `lumpcode context-status`
|
|
424
|
+
|
|
425
|
+
**Description:** Show or mutate a **single** context entry after refreshing the lump’s status record.
|
|
426
|
+
|
|
427
|
+
**Usage:** `lumpcode context-status <lumpName> <contextName> [options]`
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
| Argument | Required | Description |
|
|
431
|
+
| ------------- | -------- | ----------------------------- |
|
|
432
|
+
| `lumpName` | Yes | Lump folder name |
|
|
433
|
+
| `contextName` | Yes | Context key inside the record |
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
| Option | Type | Required | Description |
|
|
438
|
+
| ----------------- | ------- | -------- | -------------------------------------------------------------------------------------------------------------------------- |
|
|
439
|
+
| `--setToFinished` | flag | No | Creates an **empty** marker commit on `baseBranch` with the lump’s normalized message and pushes `baseBranch` |
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
**Output:** Prints one JSON object for the context row (synthesized `toDo` row if missing).
|
|
443
|
+
|
|
444
|
+
**See also:** [concepts.md](./concepts.md#status-lifecycle).
|
|
445
|
+
|
|
446
|
+
<a id="ref-cmd-clean"></a>
|
|
447
|
+
|
|
448
|
+
### `lumpcode clean`
|
|
449
|
+
|
|
450
|
+
**Description:** Delete Lumpcode-created branches **locally** and on **`origin`**.
|
|
451
|
+
|
|
452
|
+
**Usage:** `lumpcode clean [options]`
|
|
453
|
+
|
|
454
|
+
|
|
455
|
+
| Option | Type | Required | Description |
|
|
456
|
+
| --------------- | ------ | -------- | ----------------------------------------------------------------------------------- |
|
|
457
|
+
| `--lumpName` | string | No | Only branches under `lump/<lumpName>/…` |
|
|
458
|
+
| `--contextName` | string | No | Requires `--lumpName`; finds branches containing the marker commit for that context |
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
**Behavior:** Runs `git fetch --all` first, then deletes matching remote refs (`git push --delete origin …`) and local branches (`git branch -D …`).
|
|
462
|
+
|
|
463
|
+
**Rules:**
|
|
464
|
+
|
|
465
|
+
- `--contextName` without `--lumpName` is rejected.
|
|
466
|
+
|
|
467
|
+
**See also:** [lump-config.md](./lump-config.md#commit-messages) (marker format).
|
|
468
|
+
|
|
469
|
+
---
|
|
470
|
+
|
|
471
|
+
<a id="ref-related-documentation"></a>
|
|
472
|
+
|
|
473
|
+
## Related documentation
|
|
474
|
+
|
|
475
|
+
- [get-started.md](./get-started.md) — Tutorial
|
|
476
|
+
- [concepts.md](./concepts.md) — Mental model and daemon
|
|
477
|
+
- [project-config.md](./project-config.md) — `project.json`
|
|
478
|
+
- [local-config.md](./local-config.md) — Per-machine `.lumpcode/local.json` (`mode`, `projectBaseBranch`)
|
|
479
|
+
- [lump-config.md](./lump-config.md) — Lump configuration
|
|
480
|
+
- [advanced-config.md](./advanced-config.md) — Hooks, dynamic prompts, custom commands
|
|
481
|
+
|
|
482
|
+
<a id="three-commands-that-mention-status"></a>
|
|
483
|
+
|
|
484
|
+
## Three commands that mention “status”
|
|
485
|
+
|
|
486
|
+
Do not confuse the **three CLI subcommands** below with the three per-context **status values** (`toDo`, `branchPushed`, `finished`) explained in [concepts.md](./concepts.md#core-terms).
|
|
487
|
+
|
|
488
|
+
| Command | What it checks |
|
|
489
|
+
|--------|----------------|
|
|
490
|
+
| **`lumpcode daemon-status`** | Is the **background daemon process** running? PID file, log path, `cronSetup` from meta. |
|
|
491
|
+
| **`lumpcode lump-status`** | For each lump, **recompute** `contextStatusRecord.json` from **remote git** (per-context `toDo` / `branchPushed` / `finished`). |
|
|
492
|
+
| **`lumpcode context-status`** | One **context** row after refresh; optional `--setToFinished` to push a marker on `baseBranch`. |
|
package/DOCS/concepts.md
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# Lumpcode concepts
|
|
2
|
+
|
|
3
|
+
This page is the **mental model** for Lumpcode CLI: what a project, lump, context, and status mean, how one run flows through git, and when to use `lumpcode run` vs `lumpcode start`. Tutorial: [get-started.md](./get-started.md). Field reference: [lump-config.md](./lump-config.md). Commands: [commands.md](./commands.md).
|
|
4
|
+
|
|
5
|
+
## Core terms
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
| Term | Meaning |
|
|
9
|
+
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
10
|
+
| **Project** | A git repo containing both `.git/` and `.lumpcode/`. The CLI stores shared settings in `.lumpcode/project.json` and per-campaign configs under `.lumpcode/lumps/` ([project-config.md](./project-config.md)). |
|
|
11
|
+
| **Lump** | One automated **campaign** living in `.lumpcode/lumps/<lumpName>/`: how contexts are discovered, what prompt(s) to send, and which agent command to run. |
|
|
12
|
+
| **Context** | One **unit of work** inside a lump (component, file, group of files, ticket). Has a unique `name` as identifier and string `variables` substituted into prompts as `{VAR}`. |
|
|
13
|
+
| **Prompt step** | One agent invocation. Multiple steps via `steps`; hooks can branch between them ([lump-config.md](./lump-config.md#prompt-configuration), [advanced-config.md](./advanced-config.md#dynamic-steps)). |
|
|
14
|
+
| **Batch** | The set of contexts processed in one `run` / daemon tick (often one context, more if `numberOfContextsPerBranch > 1`). |
|
|
15
|
+
| **Tick** | One scheduler iteration: for each enabled lump, run the same engine path as `lumpcode run <lumpName>`. |
|
|
16
|
+
| **Work branch** | Branch Lumpcode creates/updates for the batch. Default `lump/<lumpName>/<contextName…>`, customizable with `branchFn`. |
|
|
17
|
+
| **Marker commit** | Commit whose subject is exactly `LUMP: <lumpName> - <contextName>`. **Not configurable** so `clean`, `lump-status`, and `context-status` stay aligned with the engine. |
|
|
18
|
+
| **projectBaseBranch** | Branch declared in `.lumpcode/local.json`. Lumpcode pulls it before every run, lumps default to it as their `baseBranch`, and status is judged against `origin/<projectBaseBranch>`. |
|
|
19
|
+
| **baseBranch** | Per-lump override of `projectBaseBranch`. Use when one lump needs to branch off a different upstream (e.g. a long-lived release branch). |
|
|
20
|
+
| **mode** | `shared` or `dedicated` (in `.lumpcode/local.json`). Decides whether Lumpcode operates on the current checkout or a separate copy under `~/.lumpcode/project-copies/<projectName>/`. |
|
|
21
|
+
|
|
22
|
+
**Status** — Per-context progress, derived from **remote** git history and cached in `.lumpcode/lumps/<lumpName>/contextStatusRecord.json`:
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
| Status | Meaning |
|
|
26
|
+
| -------------- | ----------------------------------------------------------------- |
|
|
27
|
+
| `toDo` | No marker commit for this context on any remote ref yet |
|
|
28
|
+
| `branchPushed` | Marker commit exists on a branch other than `origin/<baseBranch>` |
|
|
29
|
+
| `finished` | Marker commit is an ancestor of `origin/<baseBranch>` (typically merged) |
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
Repeated `run` or daemon ticks are **resumable**: finished contexts are skipped until you change remote history or use `context-status` to mark done manually.
|
|
33
|
+
|
|
34
|
+
**Safety:** Lumpcode does **not** push routine agent work to `baseBranch`; work lives on `lump/<lumpName>/…` branches for normal review and merge. Cap how many such branches are in flight with **`maximumNumberOfConcurrentBranches`** (per lump or default in `project.json`).
|
|
35
|
+
|
|
36
|
+
## Three workspaces
|
|
37
|
+
|
|
38
|
+
Lumpcode uses three path concepts during a run. Engine and command-module APIs keep the historical names `projectRoot` and `workspacePath`; CLI internals use `executionWorkspacePath` for the middle layer.
|
|
39
|
+
|
|
40
|
+
| Concept | Engine / command API | Meaning |
|
|
41
|
+
| ------- | -------------------- | ------- |
|
|
42
|
+
| **Project workspace** | `projectRoot` | Source checkout where `.lumpcode/` lives. In `shared` mode your editor clone is never touched; config and history paths are always under this tree. |
|
|
43
|
+
| **Execution workspace** | *(CLI only)* | Git repo root Lumpcode runs in after pre-flight: project copy in `shared` mode, the checkout itself in `dedicated` mode. |
|
|
44
|
+
| **Branch workspace** | `workspacePath` on `CommandFn` / `SetupWorkspaceFn` | Where the agent and per-context `git add` / `git commit` run for this lump. With `workspaceStrategy: "checkout"`, equals the execution workspace. With `"worktree"`, a linked tree under `.lumpcode/worktrees/<branch>/` inside the execution workspace. |
|
|
45
|
+
|
|
46
|
+
```text
|
|
47
|
+
shared mode:
|
|
48
|
+
project workspace ~/your-repo/ (untouched)
|
|
49
|
+
execution workspace ~/.lumpcode/project-copies/<projectName>/
|
|
50
|
+
branch workspace same as execution (checkout) OR .../worktrees/lump/... (worktree)
|
|
51
|
+
|
|
52
|
+
dedicated mode:
|
|
53
|
+
project workspace = execution workspace = your checkout
|
|
54
|
+
branch workspace checkout: same path; worktree: .lumpcode/worktrees/...
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
There are **three subcommands whose names include “status”** (not the same thing as the three **status values** `toDo` / `branchPushed` / `finished` in the table above): do not confuse **`daemon-status`** (daemon process), **`lump-status`** (recompute all context rows from remote git), and **`context-status`** (one context row). Comparison table: [commands.md § Three commands…](./commands.md#three-commands-that-mention-status).
|
|
58
|
+
|
|
59
|
+
## One run, end to end
|
|
60
|
+
|
|
61
|
+
```mermaid
|
|
62
|
+
flowchart LR
|
|
63
|
+
start["lumpcode run myLump"]
|
|
64
|
+
preflight["Pre-flight: pull projectBaseBranch<br/>(in copy or in place per mode)"]
|
|
65
|
+
discover["Discover contexts<br/>contextListJson / fn / matchFn"]
|
|
66
|
+
checkout["Pull lump baseBranch<br/>work branch lump/myLump/..."]
|
|
67
|
+
agent["Run agent with prompt"]
|
|
68
|
+
history["Optional: append to history/<context>.json<br/>when keepHistory is true"]
|
|
69
|
+
commit["git commit<br/>LUMP: myLump - ctx"]
|
|
70
|
+
push["git push origin"]
|
|
71
|
+
refresh["Refresh contextStatusRecord.json"]
|
|
72
|
+
back["Switch back to projectBaseBranch"]
|
|
73
|
+
start --> preflight --> discover --> checkout --> agent --> history --> commit --> push --> back --> refresh
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
Pre-flight resolves the **execution workspace** from `local.json.mode`: the checkout itself in `dedicated` mode, or a copy under `~/.lumpcode/project-copies/<projectName>/` in `shared` mode—see [Pre-flight and modes](#pre-flight-and-modes) and [Three workspaces](#three-workspaces).
|
|
79
|
+
|
|
80
|
+
When a lump sets **`keepHistory: true`**, each prompt step appends prompt text and agent output to `.lumpcode/lumps/<lumpName>/history/<contextName>.json` on disk (gitignored by `project-setup`). See [lump-config.md § Prompt run history](./lump-config.md#prompt-run-history-keephistory).
|
|
81
|
+
|
|
82
|
+
## Status lifecycle
|
|
83
|
+
|
|
84
|
+
```mermaid
|
|
85
|
+
stateDiagram-v2
|
|
86
|
+
[*] --> toDo
|
|
87
|
+
toDo --> branchPushed: agent runs, branch pushed
|
|
88
|
+
branchPushed --> finished: marker commit reaches origin/baseBranch
|
|
89
|
+
toDo --> finished: lumpcode context-status --setToFinished
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
## When to use `run` vs `start` (daemon)
|
|
95
|
+
|
|
96
|
+
- **`lumpcode run <lumpName>`** — Run **one tick** for one lump, then exit. Best for **sporadic** work: tickets you step through locally, one-off codemods, or anything you start and review in the same session.
|
|
97
|
+
- **`lumpcode start`** — **Scheduler**: on a cron (default every 5 minutes), runs sequentially **every** lump in the project that has a loadable `config.json` or `config.js`, skipping lumps with `"disabled": true`. Best for **sustained** campaigns: run it on a **machine that stays on** (your dev box or a small remote server with the same git push access). You merge good branches; the next tick picks up the next eligible context.
|
|
98
|
+
|
|
99
|
+
Useful pairings on a server:
|
|
100
|
+
|
|
101
|
+
- **`maximumNumberOfConcurrentBranches`** (per lump or default in `project.json`) — caps how many open `lump/<lumpName>/*` branches on `origin` exist before a run is skipped (local-only branches are not counted). See [lump-config.md](./lump-config.md#optional-top-level-fields).
|
|
102
|
+
- **`mode: "dedicated"`** in `.lumpcode/local.json` — on a server you don't develop on, skip the copy and run pre-flight directly on the checkout. Pre-flight destructively resets the checkout to `projectBaseBranch` before each tick. See [Pre-flight and modes](#pre-flight-and-modes).
|
|
103
|
+
- **`"disabled": true`** on a lump — daemon skips that lump on the next tick without stopping the daemon. No need to restart the daemon either, on next tick, the lump will be ignored
|
|
104
|
+
|
|
105
|
+
**Daemon files** (under `~/.lumpcode/daemons/`):
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
| File | Role |
|
|
109
|
+
| ------------------------------------ | -------------------------------------------------- |
|
|
110
|
+
| `<projectName>.daemon.pid` | PID of the foreground scheduler child |
|
|
111
|
+
| `<projectName>.daemon.log` | Child stdout/stderr |
|
|
112
|
+
| `<projectName>.daemon.meta.json` | Stores `cronSetup` for `restart` / `daemon-status` |
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
**Common flags:** `lumpcode start --foreground` (blocking), `lumpcode start --cronSetup '*/10 * * * *'`. Inspect: `lumpcode daemon-status`. Stop: `lumpcode stop`. Restart: `lumpcode restart`.
|
|
116
|
+
|
|
117
|
+
**Tick behavior:** list `.lumpcode/lumps/`*, keep directories with loadable `config.json` or `config.js`, skip `disabled` lumps, then run the same engine path as `lumpcode run <lumpName>` for each.
|
|
118
|
+
|
|
119
|
+
Full flag reference: [commands.md](./commands.md).
|
|
120
|
+
|
|
121
|
+
## Pre-flight and modes
|
|
122
|
+
|
|
123
|
+
Before every `run` and every daemon tick, Lumpcode runs a **pre-flight** that:
|
|
124
|
+
|
|
125
|
+
1. Resolves the execution workspace from `local.json.mode`.
|
|
126
|
+
2. In that workspace runs `git fetch --all`, switches to `projectBaseBranch`, `git reset --hard origin/<projectBaseBranch>`, then `git pull`.
|
|
127
|
+
|
|
128
|
+
After pre-flight, each lump prepares git inside the execution workspace according to `local.json.workspaceStrategy` (default `checkout`):
|
|
129
|
+
|
|
130
|
+
- **`checkout`:** fetch/pull `baseBranch`, create a fresh `lump/<lumpName>/<context…>` branch in the main worktree, run, commit, push, then switch back to `projectBaseBranch`.
|
|
131
|
+
- **`worktree`:** add a linked worktree at `.lumpcode/worktrees/<branch>/` (paths mirror branch segments), run the agent there, commit, push, then remove the worktree. The main worktree stays on `projectBaseBranch`.
|
|
132
|
+
|
|
133
|
+
The next lump in the same tick starts from a clean, known state.
|
|
134
|
+
|
|
135
|
+
| `local.json.mode` | Execution workspace | Use when |
|
|
136
|
+
| ----------------- | ------------------- | -------- |
|
|
137
|
+
| `shared` | A full copy at `~/.lumpcode/project-copies/<projectName>/` (created once, reused thereafter) | You use lumpcode on your personal device next to your day-to-day work — Lumpcode never touches your work and only works on the copy |
|
|
138
|
+
| `dedicated` | The current checkout itself | You setup lumpcode as a daemon on a distant server machine you don't develop on; pre-flight runs the destructive in-place reset |
|
|
139
|
+
|
|
140
|
+
Worktrees always live under the execution workspace (the copy in `shared`, the checkout in `dedicated`). See [local-config.md](./local-config.md#workspace-strategies).
|
|
141
|
+
|
|
142
|
+
## Related documentation
|
|
143
|
+
|
|
144
|
+
- [get-started.md](./get-started.md) — First lump from zero
|
|
145
|
+
- [local-config.md](./local-config.md) — Per-machine `local.json` (`mode`, `projectBaseBranch`, `workspaceStrategy`)
|
|
146
|
+
- [lump-config.md](./lump-config.md) — All config keys
|
|
147
|
+
- [commands.md](./commands.md) — Every subcommand
|
|
148
|
+
|