@lumenflow/cli 2.2.1 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +147 -57
- package/dist/__tests__/agent-log-issue.test.js +56 -0
- package/dist/__tests__/cli-entry-point.test.js +66 -17
- package/dist/__tests__/cli-subprocess.test.js +25 -0
- package/dist/__tests__/init.test.js +298 -0
- package/dist/__tests__/initiative-plan.test.js +340 -0
- package/dist/__tests__/mem-cleanup-execution.test.js +19 -0
- package/dist/__tests__/merge-block.test.js +220 -0
- package/dist/__tests__/release.test.js +28 -0
- package/dist/__tests__/safe-git.test.js +191 -0
- package/dist/__tests__/state-doctor.test.js +274 -0
- package/dist/__tests__/wu-done.test.js +36 -0
- package/dist/__tests__/wu-edit.test.js +119 -0
- package/dist/__tests__/wu-prep.test.js +108 -0
- package/dist/agent-issues-query.js +4 -3
- package/dist/agent-log-issue.js +25 -4
- package/dist/backlog-prune.js +5 -4
- package/dist/cli-entry-point.js +11 -1
- package/dist/doctor.js +368 -0
- package/dist/flow-bottlenecks.js +6 -5
- package/dist/flow-report.js +4 -3
- package/dist/gates.js +468 -116
- package/dist/guard-locked.js +4 -3
- package/dist/guard-worktree-commit.js +4 -3
- package/dist/init.js +508 -86
- package/dist/initiative-add-wu.js +4 -3
- package/dist/initiative-bulk-assign-wus.js +8 -5
- package/dist/initiative-create.js +73 -37
- package/dist/initiative-edit.js +37 -21
- package/dist/initiative-list.js +4 -3
- package/dist/initiative-plan.js +337 -0
- package/dist/initiative-status.js +4 -3
- package/dist/lane-health.js +377 -0
- package/dist/lane-suggest.js +382 -0
- package/dist/mem-checkpoint.js +2 -2
- package/dist/mem-cleanup.js +2 -2
- package/dist/mem-context.js +306 -0
- package/dist/mem-create.js +2 -2
- package/dist/mem-delete.js +293 -0
- package/dist/mem-inbox.js +2 -2
- package/dist/mem-index.js +211 -0
- package/dist/mem-init.js +1 -1
- package/dist/mem-profile.js +207 -0
- package/dist/mem-promote.js +254 -0
- package/dist/mem-ready.js +2 -2
- package/dist/mem-signal.js +2 -2
- package/dist/mem-start.js +2 -2
- package/dist/mem-summarize.js +2 -2
- package/dist/mem-triage.js +2 -2
- package/dist/merge-block.js +222 -0
- package/dist/metrics-cli.js +7 -4
- package/dist/metrics-snapshot.js +4 -3
- package/dist/orchestrate-initiative.js +10 -4
- package/dist/orchestrate-monitor.js +379 -31
- package/dist/signal-cleanup.js +296 -0
- package/dist/spawn-list.js +6 -5
- package/dist/state-bootstrap.js +5 -4
- package/dist/state-cleanup.js +360 -0
- package/dist/state-doctor-fix.js +196 -0
- package/dist/state-doctor.js +501 -0
- package/dist/validate-agent-skills.js +4 -3
- package/dist/validate-agent-sync.js +4 -3
- package/dist/validate-backlog-sync.js +7 -84
- package/dist/validate-skills-spec.js +4 -3
- package/dist/validate.js +7 -107
- package/dist/wu-block.js +3 -3
- package/dist/wu-claim.js +208 -98
- package/dist/wu-cleanup.js +5 -4
- package/dist/wu-create.js +71 -46
- package/dist/wu-delete.js +88 -60
- package/dist/wu-deps.js +6 -5
- package/dist/wu-done-check.js +34 -0
- package/dist/wu-done.js +60 -24
- package/dist/wu-edit.js +63 -28
- package/dist/wu-infer-lane.js +7 -6
- package/dist/wu-preflight.js +23 -81
- package/dist/wu-prep.js +125 -0
- package/dist/wu-prune.js +4 -3
- package/dist/wu-recover.js +88 -22
- package/dist/wu-repair.js +7 -6
- package/dist/wu-spawn.js +226 -270
- package/dist/wu-status.js +4 -3
- package/dist/wu-unblock.js +5 -5
- package/dist/wu-unlock-lane.js +4 -3
- package/dist/wu-validate.js +5 -4
- package/package.json +16 -7
- package/templates/core/.lumenflow/constraints.md.template +192 -0
- package/templates/core/.lumenflow/rules/git-safety.md.template +27 -0
- package/templates/core/.lumenflow/rules/wu-workflow.md.template +48 -0
- package/templates/core/AGENTS.md.template +60 -0
- package/templates/core/LUMENFLOW.md.template +255 -0
- package/templates/core/UPGRADING.md.template +121 -0
- package/templates/core/ai/onboarding/agent-safety-card.md.template +106 -0
- package/templates/core/ai/onboarding/first-wu-mistakes.md.template +198 -0
- package/templates/core/ai/onboarding/quick-ref-commands.md.template +186 -0
- package/templates/core/ai/onboarding/release-process.md.template +362 -0
- package/templates/core/ai/onboarding/troubleshooting-wu-done.md.template +159 -0
- package/templates/core/ai/onboarding/wu-create-checklist.md.template +117 -0
- package/templates/vendors/aider/.aider.conf.yml.template +27 -0
- package/templates/vendors/claude/.claude/CLAUDE.md.template +52 -0
- package/templates/vendors/claude/.claude/settings.json.template +49 -0
- package/templates/vendors/claude/.claude/skills/bug-classification/SKILL.md.template +192 -0
- package/templates/vendors/claude/.claude/skills/code-quality/SKILL.md.template +152 -0
- package/templates/vendors/claude/.claude/skills/context-management/SKILL.md.template +155 -0
- package/templates/vendors/claude/.claude/skills/execution-memory/SKILL.md.template +304 -0
- package/templates/vendors/claude/.claude/skills/frontend-design/SKILL.md.template +131 -0
- package/templates/vendors/claude/.claude/skills/initiative-management/SKILL.md.template +164 -0
- package/templates/vendors/claude/.claude/skills/library-first/SKILL.md.template +98 -0
- package/templates/vendors/claude/.claude/skills/lumenflow-gates/SKILL.md.template +87 -0
- package/templates/vendors/claude/.claude/skills/multi-agent-coordination/SKILL.md.template +84 -0
- package/templates/vendors/claude/.claude/skills/ops-maintenance/SKILL.md.template +254 -0
- package/templates/vendors/claude/.claude/skills/orchestration/SKILL.md.template +189 -0
- package/templates/vendors/claude/.claude/skills/tdd-workflow/SKILL.md.template +139 -0
- package/templates/vendors/claude/.claude/skills/worktree-discipline/SKILL.md.template +138 -0
- package/templates/vendors/claude/.claude/skills/wu-lifecycle/SKILL.md.template +106 -0
- package/templates/vendors/cline/.clinerules.template +53 -0
- package/templates/vendors/cursor/.cursor/rules/lumenflow.md.template +34 -0
- package/templates/vendors/cursor/.cursor/rules.md.template +28 -0
- package/templates/vendors/windsurf/.windsurf/rules/lumenflow.md.template +34 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# WU Creation Checklist
|
|
2
|
+
|
|
3
|
+
**Last updated:** {{DATE}}
|
|
4
|
+
|
|
5
|
+
Before running `pnpm wu:create`, verify these items.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Step 1: Check Valid Lanes
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
grep -A 30 "lanes:" .lumenflow.config.yaml
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
**Format:** `"Parent: Sublane"` (colon + single space)
|
|
16
|
+
|
|
17
|
+
Examples:
|
|
18
|
+
|
|
19
|
+
- `"Framework: CLI"`
|
|
20
|
+
- `"Framework: Core"`
|
|
21
|
+
- `"Operations: CI/CD"`
|
|
22
|
+
- `"Content: Documentation"`
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Step 2: Required Fields
|
|
27
|
+
|
|
28
|
+
| Field | Required For | Example |
|
|
29
|
+
| ------------------ | ------------ | ------------------------------------------------ |
|
|
30
|
+
| `--id` | All | `WU-1234` |
|
|
31
|
+
| `--lane` | All | `"Experience: Chat"` |
|
|
32
|
+
| `--title` | All | `"Add feature"` |
|
|
33
|
+
| `--description` | All | `"Context: ... Problem: ... Solution: ..."` |
|
|
34
|
+
| `--acceptance` | All | `--acceptance "Works"` (repeatable) |
|
|
35
|
+
| `--exposure` | All | `ui`, `api`, `backend-only`, `documentation` |
|
|
36
|
+
| `--code-paths` | Code WUs | `"src/a.ts,src/b.ts"` |
|
|
37
|
+
| `--test-paths-unit`| Code WUs | `"src/__tests__/a.test.ts"` |
|
|
38
|
+
| `--spec-refs` | Feature WUs | `"lumenflow://plans/WU-XXX-plan.md"` |
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Step 3: Plan Storage
|
|
43
|
+
|
|
44
|
+
Plans go in `$LUMENFLOW_HOME/plans/` (NOT in project):
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
mkdir -p $LUMENFLOW_HOME/plans
|
|
48
|
+
# or if LUMENFLOW_HOME is not set:
|
|
49
|
+
mkdir -p ~/.lumenflow/plans
|
|
50
|
+
|
|
51
|
+
# Create your plan
|
|
52
|
+
vim ~/.lumenflow/plans/WU-XXX-plan.md
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Reference in wu:create:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
--spec-refs "lumenflow://plans/WU-XXX-plan.md"
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Step 4: Validate First
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
pnpm wu:create --id WU-XXX ... --validate
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Fix errors, then remove `--validate` to create.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Complete Example
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
pnpm wu:create \
|
|
77
|
+
--id WU-1234 \
|
|
78
|
+
--lane "Framework: CLI" \
|
|
79
|
+
--title "Add feature X" \
|
|
80
|
+
--description "Context: Users need X. Problem: X doesn't exist. Solution: Add X." \
|
|
81
|
+
--acceptance "Feature X works as specified" \
|
|
82
|
+
--acceptance "Unit tests pass with >90% coverage" \
|
|
83
|
+
--code-paths "packages/@lumenflow/cli/src/x.ts" \
|
|
84
|
+
--test-paths-unit "packages/@lumenflow/cli/__tests__/x.test.ts" \
|
|
85
|
+
--exposure backend-only \
|
|
86
|
+
--spec-refs "lumenflow://plans/WU-1234-plan.md"
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Common Errors
|
|
92
|
+
|
|
93
|
+
### "Lane format invalid"
|
|
94
|
+
|
|
95
|
+
**Cause:** Missing colon or space in lane format.
|
|
96
|
+
|
|
97
|
+
**Fix:** Use `"Parent: Sublane"` format (colon + space).
|
|
98
|
+
|
|
99
|
+
### "Missing required field"
|
|
100
|
+
|
|
101
|
+
**Cause:** Required field not provided.
|
|
102
|
+
|
|
103
|
+
**Fix:** Add the missing `--field` argument.
|
|
104
|
+
|
|
105
|
+
### "WU already exists"
|
|
106
|
+
|
|
107
|
+
**Cause:** WU with this ID already exists.
|
|
108
|
+
|
|
109
|
+
**Fix:** Use a different ID or check existing WUs.
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## After Creation
|
|
114
|
+
|
|
115
|
+
1. Review the created YAML: `cat docs/04-operations/tasks/wu/WU-XXX.yaml`
|
|
116
|
+
2. Claim the WU: `pnpm wu:claim --id WU-XXX --lane "Lane"`
|
|
117
|
+
3. cd to worktree: `cd worktrees/<lane>-wu-xxx`
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Aider Configuration for LumenFlow Projects
|
|
2
|
+
# See LUMENFLOW.md for workflow documentation
|
|
3
|
+
|
|
4
|
+
# Model settings
|
|
5
|
+
model: gpt-4-turbo
|
|
6
|
+
|
|
7
|
+
# Git settings
|
|
8
|
+
auto-commits: false
|
|
9
|
+
dirty-commits: false
|
|
10
|
+
|
|
11
|
+
# Read these files for context
|
|
12
|
+
read:
|
|
13
|
+
- LUMENFLOW.md
|
|
14
|
+
- .lumenflow/constraints.md
|
|
15
|
+
- ai/onboarding/troubleshooting-wu-done.md
|
|
16
|
+
- ai/onboarding/quick-ref-commands.md
|
|
17
|
+
|
|
18
|
+
# Message to remind about workflow
|
|
19
|
+
message: |
|
|
20
|
+
This project uses LumenFlow workflow.
|
|
21
|
+
|
|
22
|
+
Critical Rules:
|
|
23
|
+
1. Work only in worktrees after wu:claim
|
|
24
|
+
2. Run pnpm gates before completing
|
|
25
|
+
3. ALWAYS run pnpm wu:done --id WU-XXX to complete
|
|
26
|
+
|
|
27
|
+
See LUMENFLOW.md for full documentation.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Claude Code Configuration
|
|
2
|
+
|
|
3
|
+
**Last updated:** {{DATE}}
|
|
4
|
+
|
|
5
|
+
This project uses LumenFlow workflow. For workflow documentation, see [LUMENFLOW.md](../LUMENFLOW.md).
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Quick Start
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# 1. Read workflow documentation
|
|
13
|
+
# See LUMENFLOW.md for complete workflow
|
|
14
|
+
|
|
15
|
+
# 2. Claim a WU
|
|
16
|
+
pnpm wu:claim --id WU-XXXX --lane <Lane>
|
|
17
|
+
cd worktrees/<lane>-wu-xxxx
|
|
18
|
+
|
|
19
|
+
# 3. Work in worktree, run gates
|
|
20
|
+
pnpm gates
|
|
21
|
+
|
|
22
|
+
# 4. Complete (ALWAYS run this!)
|
|
23
|
+
cd {{PROJECT_ROOT}}
|
|
24
|
+
pnpm wu:done --id WU-XXXX
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
> **Complete CLI reference:** See [quick-ref-commands.md](../ai/onboarding/quick-ref-commands.md)
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Critical: Always wu:done
|
|
32
|
+
|
|
33
|
+
After completing work, ALWAYS run `pnpm wu:done --id WU-XXXX`.
|
|
34
|
+
|
|
35
|
+
See [LUMENFLOW.md](../LUMENFLOW.md) and [ai/onboarding/troubleshooting-wu-done.md](../ai/onboarding/troubleshooting-wu-done.md).
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Claude-Specific Settings
|
|
40
|
+
|
|
41
|
+
This directory contains Claude Code-specific configuration:
|
|
42
|
+
|
|
43
|
+
- `settings.json` - Permissions and hooks
|
|
44
|
+
- `hooks/` - Pre-tool validation hooks
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## References
|
|
49
|
+
|
|
50
|
+
- [LUMENFLOW.md](../LUMENFLOW.md) - Main workflow documentation
|
|
51
|
+
- [.lumenflow/constraints.md](../.lumenflow/constraints.md) - Non-negotiable rules
|
|
52
|
+
- [ai/onboarding/](../ai/onboarding/) - Agent onboarding docs
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/claude-code-settings.json",
|
|
3
|
+
"permissions": {
|
|
4
|
+
"allow": [
|
|
5
|
+
"Bash",
|
|
6
|
+
"Read",
|
|
7
|
+
"Write",
|
|
8
|
+
"Edit",
|
|
9
|
+
"WebFetch",
|
|
10
|
+
"WebSearch",
|
|
11
|
+
"Skill",
|
|
12
|
+
"mcp__context7__*",
|
|
13
|
+
"mcp__github__*"
|
|
14
|
+
],
|
|
15
|
+
"deny": [
|
|
16
|
+
"Read(./.env)",
|
|
17
|
+
"Read(./.env.*)",
|
|
18
|
+
"Write(./.env*)",
|
|
19
|
+
"Bash(git reset --hard *)",
|
|
20
|
+
"Bash(git stash *)",
|
|
21
|
+
"Bash(git clean -fd *)",
|
|
22
|
+
"Bash(git push --force *)",
|
|
23
|
+
"Bash(git push -f *)",
|
|
24
|
+
"Bash(git checkout -f *)",
|
|
25
|
+
"Bash(git commit --no-verify *)",
|
|
26
|
+
"Bash(/usr/bin/git reset --hard *)",
|
|
27
|
+
"Bash(/usr/bin/git stash *)",
|
|
28
|
+
"Bash(/usr/bin/git clean -fd *)",
|
|
29
|
+
"Bash(/usr/bin/git push --force *)",
|
|
30
|
+
"Bash(/usr/bin/git push -f *)",
|
|
31
|
+
"Bash(/usr/bin/git commit --no-verify *)",
|
|
32
|
+
"Bash(HUSKY=0 *)",
|
|
33
|
+
"Bash(rm -rf /*)",
|
|
34
|
+
"Bash(rm -rf /home/*)",
|
|
35
|
+
"Bash(rm -rf ~/*)",
|
|
36
|
+
"Read(~/.aws/**)",
|
|
37
|
+
"Read(~/.ssh/**)",
|
|
38
|
+
"Write(~/.aws/**)",
|
|
39
|
+
"Write(~/.ssh/**)",
|
|
40
|
+
"Bash(sudo *)",
|
|
41
|
+
"Bash(su *)",
|
|
42
|
+
"Bash(git worktree remove *)",
|
|
43
|
+
"Bash(/usr/bin/git worktree remove *)",
|
|
44
|
+
"Bash(git worktree prune *)",
|
|
45
|
+
"Bash(/usr/bin/git worktree prune *)"
|
|
46
|
+
],
|
|
47
|
+
"disableBypassPermissionsMode": "disable"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: bug-classification
|
|
3
|
+
description: Classify bugs (P0-P3) and determine fix-in-place vs separate Bug WU. Use when bug discovered mid-WU, deciding bug priority, or handling production issues.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
source: docs/04-operations/_frameworks/lumenflow/lumenflow-complete.md
|
|
6
|
+
source_sections: §8 (Bug Handling Mid-WU)
|
|
7
|
+
last_updated: {{DATE}}
|
|
8
|
+
allowed-tools: Read, Grep
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Bug Classification Skill
|
|
12
|
+
|
|
13
|
+
## Purpose
|
|
14
|
+
|
|
15
|
+
Classify bugs (P0/P1/P2/P3) and determine whether to fix-in-place or create separate Bug WU.
|
|
16
|
+
|
|
17
|
+
## When to Use
|
|
18
|
+
|
|
19
|
+
- Bug discovered while working on a WU
|
|
20
|
+
- Need to determine bug priority
|
|
21
|
+
- Deciding fix-in-place vs separate WU
|
|
22
|
+
- Production issues requiring immediate attention
|
|
23
|
+
|
|
24
|
+
## Bug Classification (Priority Levels)
|
|
25
|
+
|
|
26
|
+
### P0 (CRITICAL - Emergency Response)
|
|
27
|
+
|
|
28
|
+
**Criteria:**
|
|
29
|
+
|
|
30
|
+
- Production outage (service unavailable)
|
|
31
|
+
- Data loss or corruption
|
|
32
|
+
- Auth/security breakage (users can't login, data exposed)
|
|
33
|
+
- Payment processing failure
|
|
34
|
+
- Critical safety issue
|
|
35
|
+
|
|
36
|
+
**Response:**
|
|
37
|
+
|
|
38
|
+
1. Classify as P0 per this guide
|
|
39
|
+
2. Create Bug WU with failing test
|
|
40
|
+
3. May preempt ANY lane: `pnpm wu:block --id WU-<current> --reason "Preempted by P0 WU-###"`
|
|
41
|
+
4. Immediately claim P0 WU: `pnpm wu:claim --id WU-### --lane <lane>`
|
|
42
|
+
5. Fix via TDD → gates → `pnpm wu:done`
|
|
43
|
+
6. Commit with `fix(EMERGENCY): <description>` convention
|
|
44
|
+
7. Restore preempted WU: `pnpm wu:unblock --id WU-<previous>`
|
|
45
|
+
|
|
46
|
+
**SLA**: Fix within 1-4 hours
|
|
47
|
+
|
|
48
|
+
### P1 (HIGH - Fix This Sprint)
|
|
49
|
+
|
|
50
|
+
**Criteria:**
|
|
51
|
+
|
|
52
|
+
- Major feature broken (but service still available)
|
|
53
|
+
- Significant user impact (affects >50% of workflows)
|
|
54
|
+
- Performance degradation (2x+ slower than baseline)
|
|
55
|
+
- Security vulnerability (non-critical)
|
|
56
|
+
- Data integrity issue (recoverable)
|
|
57
|
+
|
|
58
|
+
**Response:**
|
|
59
|
+
|
|
60
|
+
- Create Bug WU if not fixable in current WU
|
|
61
|
+
- Schedule for current sprint
|
|
62
|
+
- May preempt P2/P3 work
|
|
63
|
+
|
|
64
|
+
**SLA**: Fix within 1-3 days
|
|
65
|
+
|
|
66
|
+
### P2 (MEDIUM - Fix Next Sprint)
|
|
67
|
+
|
|
68
|
+
**Criteria:**
|
|
69
|
+
|
|
70
|
+
- Minor feature broken (workarounds exist)
|
|
71
|
+
- Moderate user impact (affects <50% of workflows)
|
|
72
|
+
- UI/UX issues (confusing but functional)
|
|
73
|
+
- Performance issue (noticeable but not blocking)
|
|
74
|
+
|
|
75
|
+
**Response:**
|
|
76
|
+
|
|
77
|
+
- Create Bug WU
|
|
78
|
+
- Schedule for next sprint
|
|
79
|
+
- Does not preempt P0/P1 work
|
|
80
|
+
|
|
81
|
+
**SLA**: Fix within 1-2 weeks
|
|
82
|
+
|
|
83
|
+
### P3 (LOW - Backlog)
|
|
84
|
+
|
|
85
|
+
**Criteria:**
|
|
86
|
+
|
|
87
|
+
- Cosmetic issues (typos, minor visual bugs)
|
|
88
|
+
- Edge case failures (rare scenarios)
|
|
89
|
+
- Nice-to-have improvements
|
|
90
|
+
- Tech debt
|
|
91
|
+
|
|
92
|
+
**Response:**
|
|
93
|
+
|
|
94
|
+
- Add to backlog
|
|
95
|
+
- Fix when capacity allows
|
|
96
|
+
- Does not preempt P0/P1/P2 work
|
|
97
|
+
|
|
98
|
+
**SLA**: No specific timeline
|
|
99
|
+
|
|
100
|
+
## Fix-in-Place vs Bug WU Decision Tree
|
|
101
|
+
|
|
102
|
+
### Fix-in-Place (Expand Current WU Scope)
|
|
103
|
+
|
|
104
|
+
Use when ALL of the following are true:
|
|
105
|
+
|
|
106
|
+
- Bug is in code touched by current WU
|
|
107
|
+
- Fix is small (< 50 lines of code)
|
|
108
|
+
- Fix doesn't require new tests beyond current WU acceptance
|
|
109
|
+
- Bug is related to current WU's feature/refactor
|
|
110
|
+
- Fix won't delay current WU by >1 hour
|
|
111
|
+
|
|
112
|
+
**Process:**
|
|
113
|
+
|
|
114
|
+
1. Update current WU acceptance criteria (add fix to checklist)
|
|
115
|
+
2. Update `code_paths` to include bug fix
|
|
116
|
+
3. Update `notes` to document bug discovery and fix
|
|
117
|
+
4. Implement fix + tests
|
|
118
|
+
5. Commit with WU convention: `wu(wu-xxx): fix <description> + original work`
|
|
119
|
+
6. Complete via `pnpm wu:done` (includes both original work and bug fix)
|
|
120
|
+
|
|
121
|
+
### Create Bug WU
|
|
122
|
+
|
|
123
|
+
Use when ANY of the following are true:
|
|
124
|
+
|
|
125
|
+
- Bug is in unrelated code (different feature/module)
|
|
126
|
+
- Fix is large (> 50 lines of code)
|
|
127
|
+
- Fix requires significant new tests
|
|
128
|
+
- Bug is unrelated to current WU's feature
|
|
129
|
+
- Fix will delay current WU by >1 hour
|
|
130
|
+
- Bug is P0/P1 and current WU is P2/P3
|
|
131
|
+
|
|
132
|
+
**Process:**
|
|
133
|
+
|
|
134
|
+
1. Create Bug WU with:
|
|
135
|
+
- Type: `bug`
|
|
136
|
+
- Priority: P0/P1/P2/P3 (use classification above)
|
|
137
|
+
- Context: Bug description, steps to reproduce
|
|
138
|
+
- Acceptance: Failing test + fix + regression prevention
|
|
139
|
+
2. If P0/P1: Block current WU and claim Bug WU immediately
|
|
140
|
+
3. If P2/P3: Add to backlog, finish current WU first
|
|
141
|
+
4. Implement fix via TDD (failing test first)
|
|
142
|
+
5. Complete via `pnpm wu:done`
|
|
143
|
+
|
|
144
|
+
## Bug WU Template
|
|
145
|
+
|
|
146
|
+
```yaml
|
|
147
|
+
id: WU-XXX
|
|
148
|
+
title: 'BUG: <concise description>'
|
|
149
|
+
type: bug
|
|
150
|
+
lane: <affected-lane>
|
|
151
|
+
status: ready
|
|
152
|
+
priority: <P0|P1|P2|P3>
|
|
153
|
+
created: YYYY-MM-DD
|
|
154
|
+
|
|
155
|
+
context: |
|
|
156
|
+
Bug discovered: <when and where>
|
|
157
|
+
|
|
158
|
+
Symptoms:
|
|
159
|
+
- <what's broken>
|
|
160
|
+
- <user impact>
|
|
161
|
+
|
|
162
|
+
Root cause: <why it's broken>
|
|
163
|
+
|
|
164
|
+
Reproduction:
|
|
165
|
+
1. <step 1>
|
|
166
|
+
2. <step 2>
|
|
167
|
+
3. <observe failure>
|
|
168
|
+
|
|
169
|
+
acceptance:
|
|
170
|
+
- '[ ] Failing test demonstrates bug'
|
|
171
|
+
- '[ ] Fix implements correct behavior'
|
|
172
|
+
- '[ ] Regression test prevents recurrence'
|
|
173
|
+
- '[ ] Related edge cases tested'
|
|
174
|
+
|
|
175
|
+
code_paths:
|
|
176
|
+
- <file with bug>
|
|
177
|
+
- <test file>
|
|
178
|
+
|
|
179
|
+
tests:
|
|
180
|
+
- <test file path>
|
|
181
|
+
|
|
182
|
+
notes: |
|
|
183
|
+
Discovered during: WU-YYY
|
|
184
|
+
Affects: <list of affected features/workflows>
|
|
185
|
+
|
|
186
|
+
blocked_by: []
|
|
187
|
+
blocking: []
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## Reference
|
|
191
|
+
|
|
192
|
+
See [lumenflow-complete.md §8](../../../docs/04-operations/_frameworks/lumenflow/lumenflow-complete.md) for complete bug handling guide.
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-quality
|
|
3
|
+
description: Shared patterns for SOLID/DRY code review, hexagonal architecture compliance, TypeScript best practices, and performance anti-patterns. Use when reviewing code quality, checking architecture boundaries, or validating TypeScript patterns.
|
|
4
|
+
version: 1.1.0
|
|
5
|
+
source: docs/04-operations/_frameworks/lumenflow/lumenflow-complete.md
|
|
6
|
+
source_sections: §2 (Core Principles), §4 (Hexagonal Architecture)
|
|
7
|
+
last_updated: {{DATE}}
|
|
8
|
+
allowed-tools: Read, Grep, Glob
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Code Quality Skill
|
|
12
|
+
|
|
13
|
+
**Source**: `docs/04-operations/_frameworks/lumenflow/lumenflow-complete.md` §2, §4 (canonical)
|
|
14
|
+
|
|
15
|
+
## When to Use
|
|
16
|
+
|
|
17
|
+
Activate this skill when:
|
|
18
|
+
|
|
19
|
+
- Reviewing code for SOLID/DRY compliance
|
|
20
|
+
- Checking hexagonal architecture boundaries
|
|
21
|
+
- Validating TypeScript best practices
|
|
22
|
+
- Identifying performance anti-patterns
|
|
23
|
+
- Preparing for code review
|
|
24
|
+
|
|
25
|
+
**Use skill first**: Validate code against quality patterns.
|
|
26
|
+
|
|
27
|
+
**Spawn code-reviewer agent when**: Multi-package changes need holistic review, architecture boundary violations require refactoring guidance, or pre-wu:done final review is needed.
|
|
28
|
+
|
|
29
|
+
## Quick Reference: SOLID Principles
|
|
30
|
+
|
|
31
|
+
| Principle | Check | Violation |
|
|
32
|
+
| ------------------------- | ---------------------- | ----------------------------------- |
|
|
33
|
+
| **S**ingle Responsibility | One reason to change | Class handles UI + DB + validation |
|
|
34
|
+
| **O**pen/Closed | Extend, don't modify | Adding `if` branches for new types |
|
|
35
|
+
| **L**iskov Substitution | Subtypes replaceable | Override throws unexpected errors |
|
|
36
|
+
| **I**nterface Segregation | Small interfaces | Fat interfaces force unused methods |
|
|
37
|
+
| **D**ependency Inversion | Depend on abstractions | Direct `new ConcreteService()` |
|
|
38
|
+
|
|
39
|
+
## Hexagonal Architecture Boundaries
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
┌─────────────────────────────────────────────────┐
|
|
43
|
+
│ apps/ │
|
|
44
|
+
│ (API routes, UI components, entry points) │
|
|
45
|
+
├─────────────────────────────────────────────────┤
|
|
46
|
+
│ application │
|
|
47
|
+
│ (Use cases, business logic, orchestration) │
|
|
48
|
+
│ DEPENDS ON ↓ │
|
|
49
|
+
├─────────────────────────────────────────────────┤
|
|
50
|
+
│ ports │
|
|
51
|
+
│ (Interfaces ONLY - no implementations) │
|
|
52
|
+
├─────────────────────────────────────────────────┤
|
|
53
|
+
│ infrastructure │
|
|
54
|
+
│ (Adapters: DB, APIs, external services) │
|
|
55
|
+
│ IMPLEMENTS ↑ │
|
|
56
|
+
└─────────────────────────────────────────────────┘
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Forbidden imports**:
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
// ❌ FORBIDDEN: application importing infrastructure
|
|
63
|
+
import { DatabaseClient } from './infrastructure';
|
|
64
|
+
|
|
65
|
+
// ✅ CORRECT: application imports port interface only
|
|
66
|
+
import type { DatabasePort } from './ports';
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## TypeScript Standards
|
|
70
|
+
|
|
71
|
+
### Required Patterns
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
// ✅ Explicit return types on exported functions
|
|
75
|
+
export function calculate(input: Input): Result { ... }
|
|
76
|
+
|
|
77
|
+
// ✅ Strict null checks - handle undefined
|
|
78
|
+
const value = data?.field ?? defaultValue;
|
|
79
|
+
|
|
80
|
+
// ✅ Discriminated unions over type assertions
|
|
81
|
+
type Result = { success: true; data: T } | { success: false; error: string };
|
|
82
|
+
|
|
83
|
+
// ✅ Const assertions for literals
|
|
84
|
+
const MODES = ['default', 'strict', 'loose'] as const;
|
|
85
|
+
type Mode = typeof MODES[number];
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Anti-Patterns to Reject
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
// ❌ Using `any` - loses type safety
|
|
92
|
+
function process(data: any) { ... }
|
|
93
|
+
|
|
94
|
+
// ❌ Type assertions without validation
|
|
95
|
+
const user = response as User;
|
|
96
|
+
|
|
97
|
+
// ❌ Non-null assertions without guards
|
|
98
|
+
const name = user!.name;
|
|
99
|
+
|
|
100
|
+
// ❌ Implicit any in callbacks
|
|
101
|
+
items.map(item => item.value); // Missing type annotation
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## DRY Validation
|
|
105
|
+
|
|
106
|
+
**Duplication threshold**: 3+ repetitions → extract
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
// ❌ Duplicated validation logic
|
|
110
|
+
if (!data.title || data.title.length < 3) { ... }
|
|
111
|
+
// ... repeated in 4 places
|
|
112
|
+
|
|
113
|
+
// ✅ Extracted to reusable validator
|
|
114
|
+
import { validateTitle } from '@/lib/validators';
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Performance Anti-Patterns
|
|
118
|
+
|
|
119
|
+
| Pattern | Problem | Fix |
|
|
120
|
+
| -------------------- | ----------------- | ---------------------------- |
|
|
121
|
+
| N+1 queries | Loop with DB call | Batch fetch, use `IN` clause |
|
|
122
|
+
| Unbounded lists | Memory exhaustion | Add pagination, limits |
|
|
123
|
+
| Missing memoization | Expensive recalc | `useMemo`, `React.memo` |
|
|
124
|
+
| Sync in async path | Blocks event loop | Use async/await |
|
|
125
|
+
| Large bundle imports | Slow page load | Tree-shake, lazy load |
|
|
126
|
+
|
|
127
|
+
## Common Violations Checklist
|
|
128
|
+
|
|
129
|
+
Before approving code, verify:
|
|
130
|
+
|
|
131
|
+
- [ ] No application → infrastructure imports
|
|
132
|
+
- [ ] No `any` types (use `unknown` + type guards if needed)
|
|
133
|
+
- [ ] No magic numbers (extract to named constants)
|
|
134
|
+
- [ ] No hardcoded strings (use constants or config)
|
|
135
|
+
- [ ] No regex for structured data (use libraries: date-fns, yaml, etc.)
|
|
136
|
+
- [ ] Error handling present (try/catch or Result type)
|
|
137
|
+
- [ ] Tests exist for new/changed code
|
|
138
|
+
- [ ] No console.log (use logger)
|
|
139
|
+
|
|
140
|
+
## When to Escalate
|
|
141
|
+
|
|
142
|
+
Flag for human review if:
|
|
143
|
+
|
|
144
|
+
- Architecture boundary violation requires refactor
|
|
145
|
+
- Performance issue needs profiling
|
|
146
|
+
- Security pattern unclear
|
|
147
|
+
- Business logic ambiguous
|
|
148
|
+
|
|
149
|
+
## Integration with Other Skills
|
|
150
|
+
|
|
151
|
+
- **tdd-workflow**: Use together when implementing new features
|
|
152
|
+
- **lumenflow-gates**: Quality checks overlap with gate requirements
|