@lumenflow/cli 2.5.0 → 2.6.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/README.md +11 -8
- package/dist/__tests__/gates-config.test.js +304 -0
- package/dist/__tests__/init-scripts.test.js +111 -0
- package/dist/__tests__/templates-sync.test.js +219 -0
- package/dist/gates.js +64 -15
- package/dist/init.js +90 -0
- package/dist/orchestrate-init-status.js +37 -9
- package/dist/orchestrate-initiative.js +10 -4
- package/dist/sync-templates.js +137 -5
- package/dist/wu-prep.js +131 -8
- package/dist/wu-spawn.js +7 -2
- package/package.json +7 -7
- package/templates/core/.lumenflow/constraints.md.template +61 -3
- package/templates/core/LUMENFLOW.md.template +85 -23
- package/templates/core/ai/onboarding/agent-invocation-guide.md.template +157 -0
- package/templates/core/ai/onboarding/agent-safety-card.md.template +227 -0
- package/templates/core/ai/onboarding/docs-generation.md.template +277 -0
- package/templates/core/ai/onboarding/first-wu-mistakes.md.template +49 -7
- package/templates/core/ai/onboarding/quick-ref-commands.md.template +343 -110
- package/templates/core/ai/onboarding/release-process.md.template +8 -2
- package/templates/core/ai/onboarding/starting-prompt.md.template +407 -0
- package/templates/core/ai/onboarding/test-ratchet.md.template +131 -0
- package/templates/core/ai/onboarding/troubleshooting-wu-done.md.template +91 -38
- package/templates/core/ai/onboarding/vendor-support.md.template +219 -0
- package/templates/vendors/claude/.claude/skills/context-management/SKILL.md.template +13 -1
- package/templates/vendors/claude/.claude/skills/execution-memory/SKILL.md.template +14 -16
- package/templates/vendors/claude/.claude/skills/orchestration/SKILL.md.template +48 -4
- package/templates/vendors/claude/.claude/skills/worktree-discipline/SKILL.md.template +5 -1
- package/templates/vendors/claude/.claude/skills/wu-lifecycle/SKILL.md.template +19 -8
|
@@ -44,6 +44,35 @@ Quick reference for AI agents working in LumenFlow projects.
|
|
|
44
44
|
|
|
45
45
|
---
|
|
46
46
|
|
|
47
|
+
## Universal Safety Mechanisms
|
|
48
|
+
|
|
49
|
+
### Git Safety Wrapper
|
|
50
|
+
|
|
51
|
+
Use `scripts/safe-git` instead of system `git` when possible.
|
|
52
|
+
|
|
53
|
+
It blocks:
|
|
54
|
+
|
|
55
|
+
- `git worktree remove`
|
|
56
|
+
- `git reset --hard`
|
|
57
|
+
- `git clean -fd`
|
|
58
|
+
- `git push --force`
|
|
59
|
+
|
|
60
|
+
### Repo Hooks (Husky)
|
|
61
|
+
|
|
62
|
+
These run for everyone:
|
|
63
|
+
|
|
64
|
+
- Secret scanning on staged content
|
|
65
|
+
- Absolute path scanning on staged content
|
|
66
|
+
- Lockfile sync checks
|
|
67
|
+
- Worktree discipline checks
|
|
68
|
+
|
|
69
|
+
Audit logs:
|
|
70
|
+
|
|
71
|
+
- `.beacon/safety-blocks.log` (blocked safety actions)
|
|
72
|
+
- `.beacon/force-bypasses.log` (LUMENFLOW_FORCE bypasses)
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
47
76
|
## Error Handling
|
|
48
77
|
|
|
49
78
|
### Max 3 Attempts
|
|
@@ -104,3 +133,201 @@ Choose the safer path:
|
|
|
104
133
|
- Don't bypass hooks
|
|
105
134
|
- Don't skip gates
|
|
106
135
|
- Ask rather than assume
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## Emergency Override (LUMENFLOW_FORCE)
|
|
140
|
+
|
|
141
|
+
In rare cases, you may need to bypass safety mechanisms. This requires explicit user approval and creates an audit trail.
|
|
142
|
+
|
|
143
|
+
### When Emergency Override is Appropriate
|
|
144
|
+
|
|
145
|
+
- Fixing YAML parsing bugs in WU specs (spec infrastructure issue)
|
|
146
|
+
- Emergency production hotfixes (with user present)
|
|
147
|
+
- Recovering from corrupted workflow state
|
|
148
|
+
- Bootstrap operations when CLI not yet built
|
|
149
|
+
|
|
150
|
+
### When NOT to Use Emergency Override
|
|
151
|
+
|
|
152
|
+
- Skipping failing tests
|
|
153
|
+
- Avoiding code review
|
|
154
|
+
- Working around gate failures
|
|
155
|
+
- Convenience or speed
|
|
156
|
+
|
|
157
|
+
### How to Use LUMENFLOW_FORCE
|
|
158
|
+
|
|
159
|
+
**Step 1: Get user approval**
|
|
160
|
+
|
|
161
|
+
Agents MUST stop and ask before using LUMENFLOW_FORCE. Present the situation to the user:
|
|
162
|
+
|
|
163
|
+
```
|
|
164
|
+
I need to bypass the safety check for [reason].
|
|
165
|
+
This will be logged to .beacon/force-bypasses.log.
|
|
166
|
+
Do you approve? (yes/no)
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
**Step 2: Execute with audit trail**
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
# With reason (preferred)
|
|
173
|
+
LUMENFLOW_FORCE_REASON="user-approved: <reason>" LUMENFLOW_FORCE=1 git <command>
|
|
174
|
+
|
|
175
|
+
# Example: bypass safe-git for reset --hard
|
|
176
|
+
LUMENFLOW_FORCE_REASON="user-approved: recovering corrupted state" LUMENFLOW_FORCE=1 git reset --hard HEAD
|
|
177
|
+
|
|
178
|
+
# Example: bypass hook for commit
|
|
179
|
+
LUMENFLOW_FORCE_REASON="user-approved: false positive secret detection" LUMENFLOW_FORCE=1 git commit -m "fix: update config"
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
**Step 3: Document in WU notes**
|
|
183
|
+
|
|
184
|
+
Add a note to the WU YAML explaining the bypass:
|
|
185
|
+
|
|
186
|
+
```yaml
|
|
187
|
+
notes: |
|
|
188
|
+
Used LUMENFLOW_FORCE to bypass [mechanism] because [reason].
|
|
189
|
+
Approved by user at [timestamp].
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Audit Log Format
|
|
193
|
+
|
|
194
|
+
All bypasses are logged to `.beacon/force-bypasses.log`:
|
|
195
|
+
|
|
196
|
+
```
|
|
197
|
+
ISO_TIMESTAMP|BYPASSED|COMMAND_OR_HOOK|USER|BRANCH|REASON|CWD
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
Example:
|
|
201
|
+
|
|
202
|
+
```
|
|
203
|
+
{{DATE}}T12:34:56Z|BYPASSED|git reset --hard HEAD|tom|lane/core/wu-1172|user-approved: recovering state|/home/tom/source/project
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Warning When No Reason Provided
|
|
207
|
+
|
|
208
|
+
If LUMENFLOW_FORCE=1 is used without LUMENFLOW_FORCE_REASON, a warning is printed:
|
|
209
|
+
|
|
210
|
+
```
|
|
211
|
+
=== LUMENFLOW FORCE WARNING ===
|
|
212
|
+
LUMENFLOW_FORCE used without LUMENFLOW_FORCE_REASON.
|
|
213
|
+
Please provide a reason for audit trail:
|
|
214
|
+
LUMENFLOW_FORCE_REASON="your reason" LUMENFLOW_FORCE=1 git ...
|
|
215
|
+
===============================
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
The command still proceeds, but "NO_REASON" is logged.
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
## Task Tool Hook Limitation (WU-1282)
|
|
223
|
+
|
|
224
|
+
**Critical**: Claude Code's Task tool spawns sub-agents in a new session that does NOT inherit PreToolUse hooks from `.claude/settings.json`.
|
|
225
|
+
|
|
226
|
+
### What This Means
|
|
227
|
+
|
|
228
|
+
When you spawn a sub-agent via Task tool:
|
|
229
|
+
|
|
230
|
+
- The sub-agent runs in a fresh context
|
|
231
|
+
- PreToolUse hooks (like `validate-worktree-path.sh`) do NOT run
|
|
232
|
+
- Sub-agents can write to main checkout even when worktrees exist
|
|
233
|
+
|
|
234
|
+
### Workaround for Sub-Agents
|
|
235
|
+
|
|
236
|
+
Sub-agents MUST manually verify worktree discipline before any Write/Edit:
|
|
237
|
+
|
|
238
|
+
```bash
|
|
239
|
+
# BEFORE any file operation, verify location
|
|
240
|
+
pwd
|
|
241
|
+
# Must show: /path/to/repo/worktrees/<lane>-wu-xxx
|
|
242
|
+
|
|
243
|
+
# If not in worktree, navigate first
|
|
244
|
+
cd worktrees/<lane>-wu-xxx
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### For Orchestrators
|
|
248
|
+
|
|
249
|
+
When spawning sub-agents via `pnpm wu:spawn`:
|
|
250
|
+
|
|
251
|
+
1. The spawn prompt includes constraint #9 (WORKTREE DISCIPLINE)
|
|
252
|
+
2. Sub-agents are instructed to manually verify worktree location
|
|
253
|
+
3. This constraint compensates for the missing hook enforcement
|
|
254
|
+
|
|
255
|
+
### Root Cause
|
|
256
|
+
|
|
257
|
+
This is a Claude Code platform limitation, not a LumenFlow bug. Hooks defined in `.claude/settings.json` only apply to the parent session that loaded the settings file. Task-spawned sub-agents start fresh sessions without hook inheritance.
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
## Setup and Verification
|
|
262
|
+
|
|
263
|
+
### Claude Code
|
|
264
|
+
|
|
265
|
+
Claude Code automatically respects LumenFlow safety through:
|
|
266
|
+
|
|
267
|
+
1. **CLAUDE.md** - Entry point that references safety rules
|
|
268
|
+
2. **.claude/skills/** - Skills include safety context
|
|
269
|
+
3. **.claude/agents/** - Agent definitions include constraints
|
|
270
|
+
|
|
271
|
+
No additional setup required. Claude Code will read these files on startup.
|
|
272
|
+
|
|
273
|
+
### Cursor
|
|
274
|
+
|
|
275
|
+
Cursor uses `.cursor/rules/lumenflow.md` for safety rules.
|
|
276
|
+
|
|
277
|
+
**Setup:**
|
|
278
|
+
|
|
279
|
+
```bash
|
|
280
|
+
# Initialize LumenFlow with Cursor overlay
|
|
281
|
+
lumenflow init --client cursor
|
|
282
|
+
|
|
283
|
+
# Or add to existing project
|
|
284
|
+
mkdir -p .cursor/rules
|
|
285
|
+
# Copy lumenflow.md template to .cursor/rules/
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
**Verification:**
|
|
289
|
+
|
|
290
|
+
1. Open a file in Cursor
|
|
291
|
+
2. Start a chat with Cursor AI
|
|
292
|
+
3. Ask: "What are the LumenFlow safety rules?"
|
|
293
|
+
4. Verify it mentions: worktree discipline, forbidden git commands, LUMENFLOW_FORCE
|
|
294
|
+
|
|
295
|
+
### Windsurf
|
|
296
|
+
|
|
297
|
+
Windsurf uses `.windsurf/rules/lumenflow.md` for safety rules.
|
|
298
|
+
|
|
299
|
+
**Setup:**
|
|
300
|
+
|
|
301
|
+
```bash
|
|
302
|
+
# Initialize LumenFlow with Windsurf overlay
|
|
303
|
+
lumenflow init --client windsurf
|
|
304
|
+
|
|
305
|
+
# Or add to existing project
|
|
306
|
+
mkdir -p .windsurf/rules
|
|
307
|
+
# Copy lumenflow.md template to .windsurf/rules/
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
**Verification:**
|
|
311
|
+
|
|
312
|
+
1. Open project in Windsurf
|
|
313
|
+
2. Start a Cascade session
|
|
314
|
+
3. Ask: "What safety mechanisms does this project use?"
|
|
315
|
+
4. Verify it mentions: safe-git wrapper, Husky hooks, audit logs
|
|
316
|
+
|
|
317
|
+
### Manual Verification
|
|
318
|
+
|
|
319
|
+
Test that safety mechanisms work:
|
|
320
|
+
|
|
321
|
+
```bash
|
|
322
|
+
# Verify safe-git blocks dangerous commands
|
|
323
|
+
./scripts/safe-git reset --hard HEAD
|
|
324
|
+
# Should show: === LUMENFLOW SAFETY BLOCK ===
|
|
325
|
+
|
|
326
|
+
# Verify hooks are installed
|
|
327
|
+
ls -la .husky/
|
|
328
|
+
# Should show: pre-commit, commit-msg, etc.
|
|
329
|
+
|
|
330
|
+
# Verify bypass works with audit
|
|
331
|
+
LUMENFLOW_FORCE_REASON="testing" LUMENFLOW_FORCE=1 ./scripts/safe-git --version
|
|
332
|
+
# Should succeed and log to .beacon/force-bypasses.log
|
|
333
|
+
```
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
# Automatic CLI/Config Documentation Generation
|
|
2
|
+
|
|
3
|
+
**Last updated:** {{DATE}}
|
|
4
|
+
|
|
5
|
+
This document explains LumenFlow's automatic documentation generation system, which keeps Starlight docs in sync with code using a single-source-of-truth pattern.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
LumenFlow automatically generates CLI and configuration reference documentation from source code. This ensures documentation never drifts from implementation.
|
|
12
|
+
|
|
13
|
+
| Component | Source | Output |
|
|
14
|
+
| ---------------- | --------------------------------------------------------- | ------------------------------------------------- |
|
|
15
|
+
| CLI Reference | `packages/@lumenflow/cli/src/**` | `apps/docs/src/content/docs/reference/cli.mdx` |
|
|
16
|
+
| Config Reference | `packages/@lumenflow/core/src/lumenflow-config-schema.ts` | `apps/docs/src/content/docs/reference/config.mdx` |
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Single-Source-of-Truth Pattern
|
|
21
|
+
|
|
22
|
+
The documentation generator imports directly from built packages rather than parsing source files with regex:
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
// tools/generate-cli-docs.ts
|
|
26
|
+
import {
|
|
27
|
+
WU_OPTIONS,
|
|
28
|
+
DirectoriesSchema,
|
|
29
|
+
GatesConfigSchema,
|
|
30
|
+
// ... other schemas
|
|
31
|
+
} from '../packages/@lumenflow/core/dist/index.js';
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**Benefits:**
|
|
35
|
+
|
|
36
|
+
- **No regex parsing**: Uses proper TypeScript imports
|
|
37
|
+
- **Type safety**: Schemas validate at build time
|
|
38
|
+
- **Consistent**: Same definitions used by CLI and docs
|
|
39
|
+
- **Maintainable**: Update code once, docs follow automatically
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Trigger Files
|
|
44
|
+
|
|
45
|
+
Changes to these files trigger documentation regeneration:
|
|
46
|
+
|
|
47
|
+
| File/Directory | Description |
|
|
48
|
+
| --------------------------------------------------------- | ------------------------------------- |
|
|
49
|
+
| `tools/generate-cli-docs.ts` | The generator script itself |
|
|
50
|
+
| `packages/@lumenflow/core/src/arg-parser.ts` | CLI argument definitions (WU_OPTIONS) |
|
|
51
|
+
| `packages/@lumenflow/core/src/lumenflow-config-schema.ts` | Config schema definitions |
|
|
52
|
+
| `packages/@lumenflow/core/src/index.ts` | Core exports |
|
|
53
|
+
| `packages/@lumenflow/cli/package.json` | CLI bin entries |
|
|
54
|
+
| `packages/@lumenflow/cli/src/**` | All CLI command sources |
|
|
55
|
+
|
|
56
|
+
These pathspecs are defined in `DOC_SOURCE_PATHSPECS` within `packages/@lumenflow/core/src/wu-done-docs-generate.ts`.
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## wu:done Auto-Detection Flow
|
|
61
|
+
|
|
62
|
+
When you run `pnpm wu:done`, the system automatically detects if docs need regeneration:
|
|
63
|
+
|
|
64
|
+
```mermaid
|
|
65
|
+
flowchart TD
|
|
66
|
+
A[wu:done starts] --> B[Run gates in worktree]
|
|
67
|
+
B --> C{Gates pass?}
|
|
68
|
+
C -->|No| D[Fix gates first]
|
|
69
|
+
C -->|Yes| E[Check doc-source changes]
|
|
70
|
+
E --> F{Any trigger files changed?}
|
|
71
|
+
F -->|No| G[Skip docs:generate]
|
|
72
|
+
F -->|Yes| H[Run turbo docs:generate]
|
|
73
|
+
H --> I[Format doc outputs]
|
|
74
|
+
I --> J[Stage doc files]
|
|
75
|
+
J --> K[Continue with metadata commit]
|
|
76
|
+
G --> K
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Detection Logic
|
|
80
|
+
|
|
81
|
+
The detection uses efficient `git diff` with pathspecs:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
git diff main...HEAD --name-only -- <pathspecs>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
- **Zero overhead** when no doc-source files changed (~0ms)
|
|
88
|
+
- **Turbo caching** when docs:generate runs (incremental builds)
|
|
89
|
+
|
|
90
|
+
### Integration Point
|
|
91
|
+
|
|
92
|
+
In `executeWorktreeCompletion()` (after gates pass, before metadata commit):
|
|
93
|
+
|
|
94
|
+
```typescript
|
|
95
|
+
await maybeRegenerateAndStageDocs({
|
|
96
|
+
baseBranch: 'main',
|
|
97
|
+
repoRoot: repoRoot,
|
|
98
|
+
});
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
This ensures regenerated docs are included in the single atomic completion commit.
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Manual Commands
|
|
106
|
+
|
|
107
|
+
### Generate Documentation
|
|
108
|
+
|
|
109
|
+
Regenerate all CLI/config documentation:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
pnpm docs:generate
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
This runs `tools/generate-cli-docs.ts` which:
|
|
116
|
+
|
|
117
|
+
1. Extracts command metadata from CLI package.json bin entries
|
|
118
|
+
2. Imports WU_OPTIONS from `@lumenflow/core` for option definitions
|
|
119
|
+
3. Extracts config schemas using Zod 4's native `toJSONSchema()`
|
|
120
|
+
4. Generates MDX files with tables and code blocks
|
|
121
|
+
5. Formats output with Prettier
|
|
122
|
+
|
|
123
|
+
### Validate Documentation
|
|
124
|
+
|
|
125
|
+
Check if documentation is in sync with code (useful for CI):
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
pnpm docs:validate
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
- **Exit 0**: Documentation is up to date
|
|
132
|
+
- **Exit 1**: Documentation drift detected, run `pnpm docs:generate`
|
|
133
|
+
|
|
134
|
+
### Turbo Integration
|
|
135
|
+
|
|
136
|
+
The generator is integrated into Turbo for caching:
|
|
137
|
+
|
|
138
|
+
```json
|
|
139
|
+
// turbo.json
|
|
140
|
+
"docs:generate": {
|
|
141
|
+
"dependsOn": ["@lumenflow/core#build"],
|
|
142
|
+
"inputs": [
|
|
143
|
+
"tools/generate-cli-docs.ts",
|
|
144
|
+
"packages/@lumenflow/core/src/arg-parser.ts",
|
|
145
|
+
"packages/@lumenflow/core/src/lumenflow-config-schema.ts",
|
|
146
|
+
"packages/@lumenflow/core/src/index.ts",
|
|
147
|
+
"packages/@lumenflow/cli/src/**/*.ts",
|
|
148
|
+
"packages/@lumenflow/cli/package.json"
|
|
149
|
+
],
|
|
150
|
+
"outputs": [
|
|
151
|
+
"apps/docs/src/content/docs/reference/cli.mdx",
|
|
152
|
+
"apps/docs/src/content/docs/reference/config.mdx"
|
|
153
|
+
]
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
**Key points:**
|
|
158
|
+
|
|
159
|
+
- Depends on `@lumenflow/core#build` (requires built packages for imports)
|
|
160
|
+
- Inputs match `DOC_SOURCE_PATHSPECS` for consistent detection
|
|
161
|
+
- Outputs are cached; unchanged inputs skip regeneration
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## Output Files
|
|
166
|
+
|
|
167
|
+
The generator produces two MDX files:
|
|
168
|
+
|
|
169
|
+
### CLI Reference (`cli.mdx`)
|
|
170
|
+
|
|
171
|
+
- Generated from CLI package.json bin entries
|
|
172
|
+
- Options extracted from WU_OPTIONS in `@lumenflow/core`
|
|
173
|
+
- Grouped by category (Work Units, Memory Layer, Initiatives, etc.)
|
|
174
|
+
- Includes required/optional flags and descriptions
|
|
175
|
+
|
|
176
|
+
### Config Reference (`config.mdx`)
|
|
177
|
+
|
|
178
|
+
- Generated from Zod schemas in `@lumenflow/core`
|
|
179
|
+
- Each config section documented with fields, types, defaults
|
|
180
|
+
- Environment variable overrides documented
|
|
181
|
+
- Validation command shown
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## Adding New CLI Commands
|
|
186
|
+
|
|
187
|
+
When you add a new CLI command:
|
|
188
|
+
|
|
189
|
+
1. **Add bin entry** to `packages/@lumenflow/cli/package.json`
|
|
190
|
+
2. **Add options** to `WU_OPTIONS` in `packages/@lumenflow/core/src/arg-parser.ts`
|
|
191
|
+
3. **Run** `pnpm docs:generate` to update documentation
|
|
192
|
+
4. **Verify** the command appears in `cli.mdx`
|
|
193
|
+
|
|
194
|
+
The generator automatically:
|
|
195
|
+
|
|
196
|
+
- Discovers the new command from package.json
|
|
197
|
+
- Extracts options from WU_OPTIONS references in source
|
|
198
|
+
- Categorizes based on command prefix (wu-, mem-, etc.)
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## Adding New Config Options
|
|
203
|
+
|
|
204
|
+
When you add new configuration options:
|
|
205
|
+
|
|
206
|
+
1. **Add to schema** in `packages/@lumenflow/core/src/lumenflow-config-schema.ts`
|
|
207
|
+
2. **Export** from `packages/@lumenflow/core/src/index.ts`
|
|
208
|
+
3. **Add to SCHEMA_DEFINITIONS** in `tools/generate-cli-docs.ts`
|
|
209
|
+
4. **Run** `pnpm docs:generate` to update documentation
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## Troubleshooting
|
|
214
|
+
|
|
215
|
+
### Documentation Drift in CI
|
|
216
|
+
|
|
217
|
+
If CI fails with documentation drift:
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
# Regenerate and commit
|
|
221
|
+
pnpm docs:generate
|
|
222
|
+
git add apps/docs/src/content/docs/reference/
|
|
223
|
+
git commit -m "docs: regenerate CLI/config reference"
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### Import Errors in Generator
|
|
227
|
+
|
|
228
|
+
If `tools/generate-cli-docs.ts` fails with import errors:
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
# Ensure packages are built
|
|
232
|
+
pnpm build
|
|
233
|
+
# Then regenerate
|
|
234
|
+
pnpm docs:generate
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### Turbo Cache Issues
|
|
238
|
+
|
|
239
|
+
If docs aren't regenerating when they should:
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
# Clear Turbo cache and regenerate
|
|
243
|
+
pnpm clean
|
|
244
|
+
pnpm build
|
|
245
|
+
pnpm docs:generate
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
## Architecture Summary
|
|
251
|
+
|
|
252
|
+
```
|
|
253
|
+
Source Code Generator Output
|
|
254
|
+
────────────────────────────────────────────────────────────────────────
|
|
255
|
+
@lumenflow/core
|
|
256
|
+
└── arg-parser.ts ─┐
|
|
257
|
+
└── lumenflow-config- ─┼── tools/generate-cli-docs.ts ──┬─► cli.mdx
|
|
258
|
+
schema.ts ─┤ (imports from dist/) │
|
|
259
|
+
@lumenflow/cli │ │
|
|
260
|
+
└── package.json ─┤ └─► config.mdx
|
|
261
|
+
└── src/**/*.ts ─┘
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
**Key design decisions:**
|
|
265
|
+
|
|
266
|
+
- **Library imports over regex**: Reliable, type-safe extraction
|
|
267
|
+
- **Turbo integration**: Caching, dependency management
|
|
268
|
+
- **wu:done integration**: Zero-effort doc updates
|
|
269
|
+
- **CI validation**: Drift detection prevents stale docs
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
273
|
+
## Related Documentation
|
|
274
|
+
|
|
275
|
+
- [Release Process](./release-process.md) - Deployment workflow including docs
|
|
276
|
+
- [LumenFlow Complete Guide](../../lumenflow-complete.md) - Full framework reference
|
|
277
|
+
- [Quick Reference Commands](./quick-ref-commands.md) - Command cheat sheet
|
|
@@ -26,17 +26,20 @@ cd worktrees/core-wu-123
|
|
|
26
26
|
vim src/feature.ts
|
|
27
27
|
git commit -m "feat: add feature"
|
|
28
28
|
git push origin lane/core/wu-123
|
|
29
|
-
|
|
30
|
-
pnpm wu:done --id WU-123
|
|
29
|
+
pnpm wu:prep --id WU-123 # WU-1223: runs gates, prints copy-paste instruction
|
|
30
|
+
cd /path/to/main && pnpm wu:done --id WU-123 # Copy-paste from wu:prep output
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
---
|
|
34
34
|
|
|
35
|
-
## Mistake 2: Forgetting to Run wu:done
|
|
35
|
+
## Mistake 2: Forgetting to Run wu:prep and wu:done
|
|
36
36
|
|
|
37
37
|
See [troubleshooting-wu-done.md](troubleshooting-wu-done.md) for the full explanation.
|
|
38
38
|
|
|
39
|
-
**TL;DR
|
|
39
|
+
**TL;DR (WU-1223):**
|
|
40
|
+
|
|
41
|
+
1. From worktree: `pnpm wu:prep --id WU-XXX` (runs gates)
|
|
42
|
+
2. From main: `pnpm wu:done --id WU-XXX` (copy-paste from wu:prep output)
|
|
40
43
|
|
|
41
44
|
---
|
|
42
45
|
|
|
@@ -159,7 +162,8 @@ Start coding immediately based on the title.
|
|
|
159
162
|
2. Understand acceptance criteria
|
|
160
163
|
3. Review code_paths
|
|
161
164
|
4. Check dependencies
|
|
162
|
-
5.
|
|
165
|
+
5. Check spec_refs for linked plans (if present, read the plan document)
|
|
166
|
+
6. Then start
|
|
163
167
|
|
|
164
168
|
---
|
|
165
169
|
|
|
@@ -183,16 +187,54 @@ vim src/feature.ts # Now it's safe
|
|
|
183
187
|
|
|
184
188
|
---
|
|
185
189
|
|
|
190
|
+
## Mistake 11: "Quick Fixing" on Main
|
|
191
|
+
|
|
192
|
+
### Wrong
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
# On main, see failing format check
|
|
196
|
+
pnpm gates
|
|
197
|
+
# Output: format:check failed
|
|
198
|
+
|
|
199
|
+
# Instinct: "I should help fix this!"
|
|
200
|
+
pnpm prettier --write apps/docs/src/content/docs/concepts/lanes.mdx
|
|
201
|
+
# Files modified on main - BAD!
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### Right
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
# On main, see failing format check
|
|
208
|
+
pnpm gates
|
|
209
|
+
# Output: format:check failed
|
|
210
|
+
|
|
211
|
+
# Report to user or create a WU
|
|
212
|
+
# "Format check is failing on main. Should I create a WU to fix it?"
|
|
213
|
+
|
|
214
|
+
# If yes:
|
|
215
|
+
pnpm wu:create --lane "Content: Documentation" --title "Fix format issues" ...
|
|
216
|
+
pnpm wu:claim --id WU-XXX --lane "Content: Documentation"
|
|
217
|
+
cd worktrees/content-documentation-wu-xxx
|
|
218
|
+
pnpm prettier --write <files> # Safe in worktree
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
**Why:** The "helpful fix" instinct is dangerous. Even small fixes (format, typos, lint) must go through a worktree. Commits are blocked by hooks, but files are still modified, requiring cleanup with `git checkout -- <files>`.
|
|
222
|
+
|
|
223
|
+
**Rule:** If you're on main and want to change something—STOP. Create a WU first.
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
186
227
|
## Quick Checklist
|
|
187
228
|
|
|
188
229
|
Before starting any WU:
|
|
189
230
|
|
|
190
231
|
- [ ] Read the full WU spec
|
|
191
232
|
- [ ] Understand acceptance criteria
|
|
233
|
+
- [ ] Check spec_refs for plans (read linked plans if present)
|
|
192
234
|
- [ ] Claim the WU with `pnpm wu:claim`
|
|
193
235
|
- [ ] cd to the worktree IMMEDIATELY
|
|
194
236
|
- [ ] Work only in the worktree
|
|
195
237
|
- [ ] Stay within code_paths
|
|
196
238
|
- [ ] Follow TDD
|
|
197
|
-
- [ ] Run
|
|
198
|
-
- [ ]
|
|
239
|
+
- [ ] Run wu:prep from worktree (runs gates)
|
|
240
|
+
- [ ] Run wu:done from main (copy-paste from wu:prep output)
|