@lumoai/cli 1.31.0 → 1.32.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.
|
@@ -64,6 +64,13 @@ must track the size of the work — it is not a fixed ritual:
|
|
|
64
64
|
HUMAN** — the server rejects checkpointer-less MACHINE criteria rather
|
|
65
65
|
than silently rewriting them. Don't invent a fake checkpointer to keep it
|
|
66
66
|
MACHINE.
|
|
67
|
+
- **Jest-by-name checkpointers must go through the zero-match guard.** A
|
|
68
|
+
bare `npx jest -t '<name>'` exits 0 even when the pattern matches **no**
|
|
69
|
+
test — rename or delete the test and the checkpointer silently fake-PASSes
|
|
70
|
+
(same trap class as the BSD-grep `-P` incident, LUM-401). Write
|
|
71
|
+
`npx tsx scripts/jest-t.ts '<exact test name>' [test file path]` instead:
|
|
72
|
+
it fails unless ≥1 matching test ran and passed. The optional path scopes
|
|
73
|
+
the run to one file (much faster than name-filtering the whole suite).
|
|
67
74
|
- `evidenceRequired: true` marks criteria whose verdict must point at proof
|
|
68
75
|
(a MACHINE PASS always requires evidence regardless of this flag).
|
|
69
76
|
|
|
@@ -2,6 +2,34 @@
|
|
|
2
2
|
|
|
3
3
|
## Document Management
|
|
4
4
|
|
|
5
|
+
### Content channels: prefer stdin / `--content`
|
|
6
|
+
|
|
7
|
+
`doc create` / `doc update` / `doc patch` / `doc append` all take the body from one of three mutually-exclusive channels. **For agent write-back, prefer stdin or `--content`** — pipe the markdown you already hold in memory, or pass it inline:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
printf '%s' "$body" | lumo doc update cmd_xxx # stdin — best for multi-line / generated content
|
|
11
|
+
lumo doc append cmd_xxx --section "F 待办队列" --content "- [ ] 评估 XYZ 论文" # --content — short inline edits
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
`--file` is the **fallback for content that already lives in an authoritative file on disk** (e.g. a repo-tracked `docs/live-docs/<file>.md` source you are editing). It is **not** the default channel: `--file` is sandboxed — the CLI rejects any path outside the current project directory or matching the sensitive-file denylist (`.env*`, keys, `credentials`, …), with no override. So feeding it generated content forces you to first write a scratch file _inside the repo_ just to pass it — an extra step that is the real-world friction that gets `--file` rejected. Pipe via stdin instead and skip the temp file; reach for `--file` only when the file _is_ the source of truth you're editing.
|
|
15
|
+
|
|
16
|
+
### Markdown tables: keep them compact (no alignment padding)
|
|
17
|
+
|
|
18
|
+
When you author or edit a markdown doc that contains tables (live-docs, registers, reports), write the cells **compact — one space around each pipe, no column-alignment padding**:
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
| col | meaning |
|
|
22
|
+
| --- | --- |
|
|
23
|
+
| a | first |
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
not the aligned form (`| col | meaning |` padded so columns line up). Two reasons, both about local editability:
|
|
27
|
+
|
|
28
|
+
- **prettier re-pads tables.** A compact table gets re-aligned and a padded one churns the diff on every prettier run — so repo-tracked live-doc sources under `docs/live-docs/` are in `.prettierignore` to stay byte-stable (see the live-docs README).
|
|
29
|
+
- **the Edit tool's exact-match fails on padding.** Incremental edits match on exact cell text; alignment whitespace makes that match fragile (measured to fail). Compact cells edit reliably.
|
|
30
|
+
|
|
31
|
+
This is a pure authoring convention — the server stores your markdown **byte-for-byte** (`sourceMarkdown`), so `doc show --raw` and `doc diff` stay byte-exact (LUM-408); there is **no** server-side table normalization to lean on. The structure guard (LUM-410) compares _rendered_ structure and is whitespace-insensitive, so compactness buys local editability, not a verify pass.
|
|
32
|
+
|
|
5
33
|
### `lumo doc create [title] [flags]` — create a new document
|
|
6
34
|
|
|
7
35
|
Use this when the user wants to write a new document from the terminal. Title is positional and optional. When omitted, the doc title defaults to empty (server renders as "Untitled" via i18n).
|
|
@@ -10,9 +10,11 @@ there); `list` is read-only and runnable from anywhere.
|
|
|
10
10
|
|
|
11
11
|
Creates `.worktrees/<LUM-N>[-slug]` on branch `lumo/<LUM-N>[-slug]`, branched off
|
|
12
12
|
`origin/main` (after a fetch), and symlinks its `node_modules` to the main
|
|
13
|
-
checkout so jest/tsc work immediately.
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
checkout so jest/tsc work immediately. In the same scaffold step it copies the
|
|
14
|
+
main checkout's `.husky/_` hooks shim into the worktree so git hooks actually
|
|
15
|
+
fire there (see below). With no slug, the dir and branch use the bare `LUM-N`
|
|
16
|
+
form. Prints next-step guidance plus the two gotchas it can't fix for you
|
|
17
|
+
(shared prisma client, jest cwd).
|
|
16
18
|
|
|
17
19
|
```bash
|
|
18
20
|
lumo worktree add LUM-267 worktree-scaffold # → .worktrees/LUM-267-worktree-scaffold
|
|
@@ -36,6 +38,19 @@ do `generate + tsc` atomically once at the end.
|
|
|
36
38
|
in first) — `cli/` has no jest config, and running from the main checkout hits
|
|
37
39
|
the `cli/package.json` haste collision and silently runs the wrong tests.
|
|
38
40
|
|
|
41
|
+
**The husky hooks it copies in:** husky owns git hooks via
|
|
42
|
+
`core.hooksPath = .husky/_`, a relative path git resolves against each
|
|
43
|
+
worktree's own root. That `_` shim dir is **untracked** (husky regenerates it on
|
|
44
|
+
the main checkout's `npm install`/`prepare`), so a fresh worktree would lack it
|
|
45
|
+
and git would **silently skip every hook** — pre-commit (lint-staged) and
|
|
46
|
+
commit-msg (LUM-405 drift-check) included. Since this repo has no GitHub CI,
|
|
47
|
+
husky is the only deterministic quality gate, so `add` copies `.husky/_` into the
|
|
48
|
+
new worktree (copy, not symlink — the shim is tiny and the hooks it invokes
|
|
49
|
+
resolve relative to the worktree). If the main checkout itself has no `.husky/_`
|
|
50
|
+
(husky never installed there), `add` prints a warning telling you to run
|
|
51
|
+
`npm install` in the main checkout to regenerate it, rather than skipping
|
|
52
|
+
silently.
|
|
53
|
+
|
|
39
54
|
**Never run `npm install` / `npm ci` inside a worktree.** The worktree shares
|
|
40
55
|
the main checkout's `node_modules` via a symlink; npm does not respect the link
|
|
41
56
|
— it deletes it and reifies a full standalone `node_modules` (thousands of
|
|
@@ -96,6 +96,23 @@ async function worktreeAdd(rawId, slug, opts) {
|
|
|
96
96
|
else {
|
|
97
97
|
console.log('Warning: main checkout has no node_modules; run `npm install` there, then symlink manually');
|
|
98
98
|
}
|
|
99
|
+
// husky owns git hooks via `core.hooksPath = .husky/_` (a relative path git
|
|
100
|
+
// resolves against each worktree's root). That `_` shim dir is untracked
|
|
101
|
+
// (generated by husky on the main checkout's `npm install`/`prepare`), so a
|
|
102
|
+
// fresh worktree lacks it and git SILENTLY skips every hook — pre-commit
|
|
103
|
+
// (lint-staged) and commit-msg (LUM-405 drift-check) included. This repo has
|
|
104
|
+
// no CI, so husky is the only deterministic gate; copy the shim in so hooks
|
|
105
|
+
// fire. Copy (not symlink) is the stable choice: the shim is tiny, rarely
|
|
106
|
+
// changes, and the hooks it invokes resolve relative to the worktree.
|
|
107
|
+
const srcHusky = path.join(root, '.husky', '_');
|
|
108
|
+
if (fs.existsSync(srcHusky)) {
|
|
109
|
+
fs.cpSync(srcHusky, path.join(dir, '.husky', '_'), { recursive: true });
|
|
110
|
+
console.log(' git hooks: husky shim copied (pre-commit + commit-msg active)');
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
console.log('Warning: main checkout has no .husky/_ shim; git hooks will NOT run in this worktree.');
|
|
114
|
+
console.log(' Run `npm install` in the main checkout to (re)generate husky, then re-run `lumo worktree add`.');
|
|
115
|
+
}
|
|
99
116
|
printGuidance(dir, branch);
|
|
100
117
|
if (opts.verify) {
|
|
101
118
|
console.log('Running baseline jest …');
|