@hivehub/rulebook 5.2.1 → 5.3.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/.claude/commands/analysis.md +35 -0
- package/.claude/commands/rulebook-task-apply.md +7 -25
- package/.claude/commands/rulebook-task-archive.md +10 -19
- package/.claude/commands/rulebook-task-create.md +1 -1
- package/README.md +354 -965
- package/dist/cli/commands/analysis.d.ts +8 -0
- package/dist/cli/commands/analysis.d.ts.map +1 -0
- package/dist/cli/commands/analysis.js +78 -0
- package/dist/cli/commands/analysis.js.map +1 -0
- package/dist/cli/commands/context-intelligence.d.ts +33 -0
- package/dist/cli/commands/context-intelligence.d.ts.map +1 -0
- package/dist/cli/commands/context-intelligence.js +181 -0
- package/dist/cli/commands/context-intelligence.js.map +1 -0
- package/dist/cli/commands/index.d.ts +19 -0
- package/dist/cli/commands/index.d.ts.map +1 -0
- package/dist/cli/commands/index.js +19 -0
- package/dist/cli/commands/index.js.map +1 -0
- package/dist/cli/commands/init.d.ts +15 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +608 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/mcp.d.ts +10 -0
- package/dist/cli/commands/mcp.d.ts.map +1 -0
- package/dist/cli/commands/mcp.js +128 -0
- package/dist/cli/commands/mcp.js.map +1 -0
- package/dist/cli/commands/memory.d.ts +24 -0
- package/dist/cli/commands/memory.d.ts.map +1 -0
- package/dist/cli/commands/memory.js +265 -0
- package/dist/cli/commands/memory.js.map +1 -0
- package/dist/cli/commands/misc.d.ts +33 -0
- package/dist/cli/commands/misc.d.ts.map +1 -0
- package/dist/cli/commands/misc.js +576 -0
- package/dist/cli/commands/misc.js.map +1 -0
- package/dist/cli/commands/plans.d.ts +15 -0
- package/dist/cli/commands/plans.d.ts.map +1 -0
- package/dist/cli/commands/plans.js +266 -0
- package/dist/cli/commands/plans.js.map +1 -0
- package/dist/cli/commands/ralph.d.ts +45 -0
- package/dist/cli/commands/ralph.d.ts.map +1 -0
- package/dist/cli/commands/ralph.js +694 -0
- package/dist/cli/commands/ralph.js.map +1 -0
- package/dist/cli/commands/skills.d.ts +9 -0
- package/dist/cli/commands/skills.d.ts.map +1 -0
- package/dist/cli/commands/skills.js +249 -0
- package/dist/cli/commands/skills.js.map +1 -0
- package/dist/cli/commands/task.d.ts +16 -0
- package/dist/cli/commands/task.d.ts.map +1 -0
- package/dist/cli/commands/task.js +256 -0
- package/dist/cli/commands/task.js.map +1 -0
- package/dist/cli/commands/update.d.ts +14 -0
- package/dist/cli/commands/update.d.ts.map +1 -0
- package/dist/cli/commands/update.js +636 -0
- package/dist/cli/commands/update.js.map +1 -0
- package/dist/cli/commands/workspace.d.ts +6 -0
- package/dist/cli/commands/workspace.d.ts.map +1 -0
- package/dist/cli/commands/workspace.js +141 -0
- package/dist/cli/commands/workspace.js.map +1 -0
- package/dist/core/agent-template-engine.js +28 -28
- package/dist/core/analysis-manager.d.ts +56 -0
- package/dist/core/analysis-manager.d.ts.map +1 -0
- package/dist/core/analysis-manager.js +218 -0
- package/dist/core/analysis-manager.js.map +1 -0
- package/dist/core/claude-md-generator.d.ts +52 -0
- package/dist/core/claude-md-generator.d.ts.map +1 -0
- package/dist/core/claude-md-generator.js +104 -0
- package/dist/core/claude-md-generator.js.map +1 -0
- package/dist/core/claude-settings-manager.d.ts +37 -0
- package/dist/core/claude-settings-manager.d.ts.map +1 -0
- package/dist/core/claude-settings-manager.js +168 -0
- package/dist/core/claude-settings-manager.js.map +1 -0
- package/dist/core/compact-context-manager.d.ts +34 -0
- package/dist/core/compact-context-manager.d.ts.map +1 -0
- package/dist/core/compact-context-manager.js +60 -0
- package/dist/core/compact-context-manager.js.map +1 -0
- package/dist/core/doctor.d.ts +19 -0
- package/dist/core/doctor.d.ts.map +1 -0
- package/dist/core/doctor.js +163 -0
- package/dist/core/doctor.js.map +1 -0
- package/dist/core/generator.js +28 -28
- package/dist/core/mcp-reference-generator.d.ts +13 -0
- package/dist/core/mcp-reference-generator.d.ts.map +1 -0
- package/dist/core/mcp-reference-generator.js +66 -0
- package/dist/core/mcp-reference-generator.js.map +1 -0
- package/dist/core/merger.d.ts +35 -0
- package/dist/core/merger.d.ts.map +1 -1
- package/dist/core/merger.js +120 -0
- package/dist/core/merger.js.map +1 -1
- package/dist/core/prd-generator.d.ts.map +1 -1
- package/dist/core/prd-generator.js +7 -1
- package/dist/core/prd-generator.js.map +1 -1
- package/dist/core/ralph-manager.d.ts.map +1 -1
- package/dist/core/ralph-manager.js +17 -0
- package/dist/core/ralph-manager.js.map +1 -1
- package/dist/core/rules-generator.d.ts +73 -0
- package/dist/core/rules-generator.d.ts.map +1 -0
- package/dist/core/rules-generator.js +201 -0
- package/dist/core/rules-generator.js.map +1 -0
- package/dist/core/state-writer.d.ts +35 -0
- package/dist/core/state-writer.d.ts.map +1 -0
- package/dist/core/state-writer.js +81 -0
- package/dist/core/state-writer.js.map +1 -0
- package/dist/core/task-manager.d.ts +35 -0
- package/dist/core/task-manager.d.ts.map +1 -1
- package/dist/core/task-manager.js +135 -38
- package/dist/core/task-manager.js.map +1 -1
- package/dist/core/telemetry.d.ts +29 -0
- package/dist/core/telemetry.d.ts.map +1 -0
- package/dist/core/telemetry.js +57 -0
- package/dist/core/telemetry.js.map +1 -0
- package/dist/core/workflow-generator.d.ts.map +1 -1
- package/dist/core/workflow-generator.js +2 -177
- package/dist/core/workflow-generator.js.map +1 -1
- package/dist/index.js +28 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp/rulebook-server.d.ts.map +1 -1
- package/dist/mcp/rulebook-server.js +190 -7
- package/dist/mcp/rulebook-server.js.map +1 -1
- package/dist/memory/memory-store.js +91 -91
- package/dist/types.d.ts +11 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/gitignore.d.ts +10 -0
- package/dist/utils/gitignore.d.ts.map +1 -0
- package/dist/utils/gitignore.js +38 -0
- package/dist/utils/gitignore.js.map +1 -0
- package/package.json +1 -1
- package/templates/compact-context/_default.md +23 -0
- package/templates/compact-context/cpp.md +26 -0
- package/templates/compact-context/go.md +26 -0
- package/templates/compact-context/python.md +26 -0
- package/templates/compact-context/rust.md +28 -0
- package/templates/compact-context/typescript.md +29 -0
- package/templates/core/CLAUDE_MD_v2.md +71 -0
- package/templates/hooks/check-context-and-handoff.ps1 +50 -0
- package/templates/hooks/check-context-and-handoff.sh +69 -0
- package/templates/hooks/enforce-mcp-for-tasks.sh +31 -0
- package/templates/hooks/enforce-no-deferred.sh +21 -0
- package/templates/hooks/enforce-no-shortcuts.sh +31 -0
- package/templates/hooks/enforce-team-for-background-agents.ps1 +63 -0
- package/templates/hooks/enforce-team-for-background-agents.sh +55 -0
- package/templates/hooks/on-compact-reinject.sh +34 -0
- package/templates/hooks/resume-from-handoff.ps1 +33 -0
- package/templates/hooks/resume-from-handoff.sh +55 -0
- package/templates/rules/consult-analysis-before-implementing.md +23 -0
- package/templates/rules/cpp.md +46 -0
- package/templates/rules/csharp.md +44 -0
- package/templates/rules/diagnostic-first.md +39 -0
- package/templates/rules/fail-twice-escalate.md +46 -0
- package/templates/rules/go.md +40 -0
- package/templates/rules/java.md +43 -0
- package/templates/rules/javascript.md +39 -0
- package/templates/rules/multi-agent-teams.md +75 -0
- package/templates/rules/python.md +43 -0
- package/templates/rules/respect-handoff-trigger.md +41 -0
- package/templates/rules/rust.md +40 -0
- package/templates/rules/typescript.md +40 -0
- package/templates/skills/dev/analysis/SKILL.md +19 -0
- package/templates/skills/dev/handoff/SKILL.md +27 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# /analysis — Structured analysis workflow
|
|
2
|
+
|
|
3
|
+
Create a structured analysis for a topic. Scaffolds `docs/analysis/<slug>/` with skeleton files (README.md, findings.md, execution-plan.md, manifest.json).
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
/analysis <topic>
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## What it does
|
|
12
|
+
|
|
13
|
+
1. Slugifies the topic (e.g. "Auth Refactor v2" → `auth-refactor-v2`)
|
|
14
|
+
2. Creates `docs/analysis/<slug>/` with:
|
|
15
|
+
- **README.md** — executive summary, methodology, conclusion
|
|
16
|
+
- **findings.md** — numbered findings F-001..F-NNN (title, evidence, impact, confidence)
|
|
17
|
+
- **execution-plan.md** — phased implementation plan
|
|
18
|
+
- **manifest.json** — metadata (agents, timestamps, version)
|
|
19
|
+
3. Idempotent: re-running updates manifest but preserves user-edited content files
|
|
20
|
+
|
|
21
|
+
## After scaffolding
|
|
22
|
+
|
|
23
|
+
1. Fill `findings.md` with investigation results
|
|
24
|
+
2. Design the phases in `execution-plan.md`
|
|
25
|
+
3. Create implementation tasks from the plan: `rulebook task create phase1_<slug>-<name>`
|
|
26
|
+
4. Each task should reference the analysis: `Source: docs/analysis/<slug>/README.md#F-NNN`
|
|
27
|
+
5. Before implementing, consult the knowledge base: `rulebook_knowledge_list` filtered by `analysis:<slug>`
|
|
28
|
+
|
|
29
|
+
## MCP equivalent
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
rulebook_analysis_create({ topic: "<topic>" })
|
|
33
|
+
rulebook_analysis_list()
|
|
34
|
+
rulebook_analysis_show({ slug: "<slug>" })
|
|
35
|
+
```
|
|
@@ -14,35 +14,24 @@ description: Implement an approved Rulebook task and keep tasks checklist in syn
|
|
|
14
14
|
**Steps**
|
|
15
15
|
Track these steps as TODOs and complete them one by one.
|
|
16
16
|
|
|
17
|
-
1. **
|
|
18
|
-
Before writing any code, search for relevant patterns and anti-patterns:
|
|
19
|
-
```bash
|
|
20
|
-
rulebook knowledge list
|
|
21
|
-
```
|
|
22
|
-
Also search learnings related to this area:
|
|
23
|
-
```bash
|
|
24
|
-
rulebook learn list
|
|
25
|
-
```
|
|
26
|
-
Apply any relevant patterns. Avoid any documented anti-patterns.
|
|
27
|
-
|
|
28
|
-
2. **Read Task Details**:
|
|
17
|
+
1. **Read Task Details**:
|
|
29
18
|
```bash
|
|
30
19
|
rulebook task show <task-id>
|
|
31
20
|
```
|
|
32
21
|
Read `proposal.md`, `design.md` (if present), and `tasks.md` to confirm scope and acceptance criteria.
|
|
33
22
|
|
|
34
|
-
|
|
23
|
+
2. **Follow Priority Order (MANDATORY)**:
|
|
35
24
|
- **Tests** (HIGHEST PRIORITY) - Write tests first
|
|
36
25
|
- **Coverage Verification** (CRITICAL) - Verify coverage ≥95%
|
|
37
26
|
- **Update Task Status** (MANDATORY) - Mark completed items as `[x]` in `tasks.md`
|
|
38
27
|
- **Next Task** (Only after above steps)
|
|
39
28
|
|
|
40
|
-
|
|
29
|
+
3. **Work Through Tasks Sequentially**:
|
|
41
30
|
- Work through `tasks.md` checklist item by item
|
|
42
31
|
- Keep edits minimal and focused on the requested change
|
|
43
32
|
- Follow priority order (most critical first)
|
|
44
33
|
|
|
45
|
-
|
|
34
|
+
4. **After Each Implementation Step**:
|
|
46
35
|
- ✅ Implement the feature
|
|
47
36
|
- ✅ Test the implementation
|
|
48
37
|
- ✅ Verify test coverage (run `npm test -- --coverage`)
|
|
@@ -50,7 +39,7 @@ Track these steps as TODOs and complete them one by one.
|
|
|
50
39
|
- ✅ Commit locally (backup)
|
|
51
40
|
- ✅ Only then proceed to next task
|
|
52
41
|
|
|
53
|
-
|
|
42
|
+
5. **Update Tasks Checklist**:
|
|
54
43
|
After completing and testing each item:
|
|
55
44
|
```markdown
|
|
56
45
|
## 1. Implementation Phase
|
|
@@ -59,24 +48,17 @@ Track these steps as TODOs and complete them one by one.
|
|
|
59
48
|
- [ ] 1.3 Add archive functionality <!-- next: will start after status update -->
|
|
60
49
|
```
|
|
61
50
|
|
|
62
|
-
|
|
51
|
+
6. **Confirm Completion**:
|
|
63
52
|
- Make sure every item in `tasks.md` is finished
|
|
64
53
|
- All tests pass
|
|
65
54
|
- Coverage meets thresholds
|
|
66
55
|
- Documentation updated
|
|
67
56
|
|
|
68
|
-
|
|
57
|
+
7. **Update Checklist After All Work**:
|
|
69
58
|
- Mark each completed task as `[x]`
|
|
70
59
|
- Add comments with test status and coverage
|
|
71
60
|
- Reflect reality in the checklist
|
|
72
61
|
|
|
73
|
-
9. **Capture Learnings (MANDATORY)**:
|
|
74
|
-
After completing the task, record what you learned:
|
|
75
|
-
- **Patterns that worked** → `rulebook knowledge add pattern "<title>" --category <cat>`
|
|
76
|
-
- **Anti-patterns discovered** → `rulebook knowledge add anti-pattern "<title>" --category <cat>`
|
|
77
|
-
- **Debugging insights** → `rulebook learn capture --title "<title>" --content "<what you learned>"`
|
|
78
|
-
- If nothing significant was learned, record at minimum: `rulebook learn capture --title "Completed <task-id>" --content "Implemented <summary>. No unexpected issues."`
|
|
79
|
-
|
|
80
62
|
**Reference**
|
|
81
63
|
- Use `rulebook task show <task-id>` when additional context is required
|
|
82
64
|
- Use `rulebook task validate <task-id>` to check format before archiving
|
|
@@ -11,22 +11,13 @@ description: Archive a completed Rulebook task and apply spec deltas to main spe
|
|
|
11
11
|
- Refer to `/.rulebook/specs/RULEBOOK.md` for complete task management guidelines.
|
|
12
12
|
|
|
13
13
|
**Steps**
|
|
14
|
-
1. **
|
|
15
|
-
Before archiving, record what was learned during this task:
|
|
16
|
-
- **Patterns discovered** → `rulebook knowledge add pattern "<title>" --category <cat> --description "<desc>"`
|
|
17
|
-
- **Anti-patterns found** → `rulebook knowledge add anti-pattern "<title>" --category <cat> --description "<desc>"`
|
|
18
|
-
- **Implementation learnings** → `rulebook learn capture --title "<title>" --content "<what you learned>"`
|
|
19
|
-
- **Architectural decisions** → record via `rulebook decision create` if a significant design choice was made
|
|
20
|
-
|
|
21
|
-
Minimum: at least ONE learning must be captured per task archive. If the task was trivial, record: `rulebook learn capture --title "Completed <task-id>" --content "<1-line summary of what was done>"`
|
|
22
|
-
|
|
23
|
-
2. **Verify Task Completion**:
|
|
14
|
+
1. **Verify Task Completion**:
|
|
24
15
|
- All items in `tasks.md` must be marked as `[x]`
|
|
25
16
|
- All tests must pass
|
|
26
17
|
- Code review complete (if applicable)
|
|
27
18
|
- Documentation updated (README, CHANGELOG, specs)
|
|
28
19
|
|
|
29
|
-
|
|
20
|
+
2. **Run Quality Checks**:
|
|
30
21
|
```bash
|
|
31
22
|
npm test
|
|
32
23
|
npm run lint
|
|
@@ -35,13 +26,13 @@ description: Archive a completed Rulebook task and apply spec deltas to main spe
|
|
|
35
26
|
```
|
|
36
27
|
Ensure all checks pass before archiving.
|
|
37
28
|
|
|
38
|
-
|
|
29
|
+
3. **Validate Task Format**:
|
|
39
30
|
```bash
|
|
40
31
|
rulebook task validate <task-id>
|
|
41
32
|
```
|
|
42
33
|
Must pass all format checks.
|
|
43
34
|
|
|
44
|
-
|
|
35
|
+
4. **Archive Task**:
|
|
45
36
|
```bash
|
|
46
37
|
rulebook task archive <task-id>
|
|
47
38
|
```
|
|
@@ -51,27 +42,27 @@ description: Archive a completed Rulebook task and apply spec deltas to main spe
|
|
|
51
42
|
```
|
|
52
43
|
(Only use `--skip-validation` if you're certain the task is valid)
|
|
53
44
|
|
|
54
|
-
|
|
45
|
+
5. **Archive Process**:
|
|
55
46
|
- Validates task format (unless skipped)
|
|
56
47
|
- Checks task completion status
|
|
57
48
|
- Applies spec deltas to main specifications
|
|
58
|
-
- Moves task to `/.rulebook/archive/YYYY-MM-DD-<task-id>/`
|
|
49
|
+
- Moves task to `/.rulebook/tasks/archive/YYYY-MM-DD-<task-id>/`
|
|
59
50
|
- Updates related specifications
|
|
60
51
|
|
|
61
|
-
|
|
52
|
+
6. **Verify Archive**:
|
|
62
53
|
```bash
|
|
63
54
|
rulebook task list --archived
|
|
64
55
|
```
|
|
65
56
|
Task should appear in archived list.
|
|
66
57
|
|
|
67
|
-
|
|
58
|
+
7. **Post-Archive Actions**:
|
|
68
59
|
- Ensure spec deltas are applied to main specifications
|
|
69
60
|
- Update CHANGELOG.md with the change
|
|
70
61
|
- Document any breaking changes
|
|
71
62
|
- Create migration guides (if needed)
|
|
72
63
|
- Unblock related tasks (if any)
|
|
73
64
|
|
|
74
|
-
|
|
65
|
+
8. **🚨 MANDATORY: Deferred Items → Tasks Rule**:
|
|
75
66
|
**ABSOLUTE RULE — NO EXCEPTIONS**: Whenever a task is archived with items marked as "Deferred" or "Phase X+", you MUST immediately create Rulebook tasks for those deferred items **before archiving**.
|
|
76
67
|
|
|
77
68
|
```
|
|
@@ -81,7 +72,7 @@ description: Archive a completed Rulebook task and apply spec deltas to main spe
|
|
|
81
72
|
|
|
82
73
|
✅ CORRECT — defer with tracking:
|
|
83
74
|
1. Add "- [ ] D1. feature X — deferred Phase 4" to tasks.md
|
|
84
|
-
2. Call rulebook_task_create("
|
|
75
|
+
2. Call rulebook_task_create("phase4-feature-x")
|
|
85
76
|
3. Write tasks.md for the new task with full context
|
|
86
77
|
4. THEN call rulebook_task_archive
|
|
87
78
|
```
|
|
@@ -24,7 +24,7 @@ description: Create a new Rulebook task following OpenSpec-compatible format wit
|
|
|
24
24
|
- Review related code or docs (e.g., via `rg`/`ls`) to understand current behavior
|
|
25
25
|
- Note any gaps that require clarification
|
|
26
26
|
|
|
27
|
-
3. **Choose Task ID**:
|
|
27
|
+
3. **Choose Task ID**: Use verb-led kebab-case (e.g., `add-feature`, `update-api`, `refactor-module`). Must be unique.
|
|
28
28
|
|
|
29
29
|
4. **Create Task Structure**:
|
|
30
30
|
```bash
|