sqlew 5.0.4 → 5.0.6

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.
Files changed (36) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +7 -13
  3. package/dist/cli/hooks/on-prompt.d.ts +31 -0
  4. package/dist/cli/hooks/on-prompt.d.ts.map +1 -0
  5. package/dist/cli/hooks/on-prompt.js +55 -0
  6. package/dist/cli/hooks/on-prompt.js.map +1 -0
  7. package/dist/cli/hooks/track-plan.d.ts.map +1 -1
  8. package/dist/cli/hooks/track-plan.js +17 -16
  9. package/dist/cli/hooks/track-plan.js.map +1 -1
  10. package/dist/cli.d.ts.map +1 -1
  11. package/dist/cli.js +14 -7
  12. package/dist/cli.js.map +1 -1
  13. package/dist/help-data/constraint.toml +9 -9
  14. package/dist/index.js +1 -1
  15. package/dist/index.js.map +1 -1
  16. package/dist/init-rules.d.ts +15 -16
  17. package/dist/init-rules.d.ts.map +1 -1
  18. package/dist/init-rules.js +36 -92
  19. package/dist/init-rules.js.map +1 -1
  20. package/dist/tools/constraints/actions/add.d.ts.map +1 -1
  21. package/dist/tools/constraints/actions/add.js +2 -3
  22. package/dist/tools/constraints/actions/add.js.map +1 -1
  23. package/dist/tools/constraints/actions/get.js +9 -9
  24. package/dist/tools/constraints/actions/get.js.map +1 -1
  25. package/dist/types.d.ts +2 -2
  26. package/dist/types.d.ts.map +1 -1
  27. package/dist/utils/action-specs/constraint-specs.js +1 -1
  28. package/dist/utils/action-specs/constraint-specs.js.map +1 -1
  29. package/dist/utils/validators.d.ts +3 -2
  30. package/dist/utils/validators.d.ts.map +1 -1
  31. package/dist/utils/validators.js +11 -2
  32. package/dist/utils/validators.js.map +1 -1
  33. package/package.json +1 -1
  34. package/scripts/filter-test-output.js +5 -1
  35. package/assets/claude-md-snippets/plan-mode-integration.md +0 -107
  36. package/assets/claude-md-snippets/queue-monitoring.md +0 -84
@@ -1,107 +0,0 @@
1
- ## Plan Mode Integration
2
-
3
- ### REQUIRED: Suggest Search BEFORE Planning
4
-
5
- **CRITICAL**: Before writing any plan, you MUST search for related context.
6
-
7
- **Step 1**: Extract keywords from the user's task (e.g., migration, auth, database)
8
-
9
- **Step 2**: Run suggest search:
10
- ```
11
- suggest { action: "by_context", key: "<keyword>", tags: ["<relevant-tags>"] }
12
- suggest { action: "by_context", target: "constraint", text: "<topic>" }
13
- ```
14
-
15
- **Step 3**: Include results in plan (MANDATORY section):
16
- ```markdown
17
- ## Related Context (from sqlew)
18
-
19
- ### Past Decisions
20
- | Key | Value | Score |
21
- |-----|-------|-------|
22
- | path/to/decision | description | 85 |
23
-
24
- > If empty: "No related decisions found for: <keywords>"
25
-
26
- ### Applicable Constraints
27
- - **[category]**: constraint text (Priority: high)
28
-
29
- > If empty: "No constraints found for: <keywords>"
30
- ```
31
-
32
- **FAILURE TO INCLUDE "Related Context" SECTION = INVALID PLAN**
33
-
34
- ---
35
-
36
- ### REQUIRED: Decision & Constraint Recording
37
-
38
- **When writing plans, you MUST include the following sections:**
39
-
40
- 1. **📌 Decisions** - Technology choices, architecture patterns, implementation approaches
41
- 2. **🚫 Constraints** - Rules, restrictions, limitations, prohibited patterns from user requirements
42
-
43
- **IMPORTANT**: If the user mentions any restrictions, prohibitions, or "don't use X", these MUST be recorded as 🚫 Constraints.
44
-
45
- ---
46
-
47
- **Decision format (REQUIRED for any technical choice):**
48
-
49
- ```markdown
50
- ### 📌 Decision: [key/path]
51
- - **Value**: Description of the decision
52
- - **Layer**: presentation | business | data | infrastructure | cross-cutting
53
- - **Tags**: tag1, tag2 (optional)
54
- - **Rationale**: Why this decision was made (optional)
55
- - **Alternatives**: Option A, Option B (optional, comma-separated)
56
- - **Tradeoffs**: Pros and cons description (optional)
57
- ```
58
-
59
- **Constraint format (REQUIRED when user specifies restrictions):**
60
-
61
- ```markdown
62
- ### 🚫 Constraint: [category]
63
- - **Rule**: Description of the constraint
64
- - **Priority**: critical | high | medium | low
65
- - **Tags**: tag1, tag2 (optional)
66
- ```
67
-
68
- Category options: `architecture` | `security` | `code-style` | `performance`
69
-
70
- ---
71
-
72
- ### With Claude Code Hooks (Recommended)
73
-
74
- If you've run `sqlew --hooks`, sqlew integration is **fully automatic**:
75
-
76
- - 📌/🚫 patterns are auto-detected and registered as draft on ExitPlanMode
77
- - Related decisions are auto-suggested before Task execution
78
- - Decisions are auto-saved when code is edited
79
-
80
- ### Manual Usage (Without Hooks)
81
-
82
- **Research Phase:**
83
- - `/sqlew search for <topic>` - find related decisions
84
-
85
- **Final Plan Phase:**
86
- - `/sqlew record <decision>` - record key architectural decisions
87
-
88
- ---
89
-
90
- ### Failed Queue Check (IMPORTANT)
91
-
92
- **At the start of plan mode**, check if `.sqlew/queue/failed.json` exists:
93
-
94
- ```bash
95
- # Check failed queue status
96
- queue { action: "list" } # Shows both pending and failed items
97
- ```
98
-
99
- **If failed items exist:**
100
-
101
- 1. **Review each failed item** - Common failure: HighSimilarity (60%+) means the item is similar to an existing decision
102
- 2. **Resolution options:**
103
- - **If truly duplicate**: Delete the failed queue file or use `queue { action: "clear" }` with `target: "failed"`
104
- - **If different intent**: Use a more specific key and re-register manually via `/sqlew record <decision>`
105
- 3. **After resolving**: Delete or empty the failed queue file
106
-
107
- **Why this happens**: Items that fail processing (e.g., high similarity to existing decisions) are moved to `failed.json` instead of being retried indefinitely. This prevents infinite retry loops.
@@ -1,84 +0,0 @@
1
- ## Queue Monitoring After Plan Mode
2
-
3
- ### When to Check
4
-
5
- After ExitPlanMode or when Plan-to-ADR processing completes, check if there are unprocessed items in the queue.
6
-
7
- **Queue file locations:**
8
- - Pending: `.sqlew/queue/pending.json`
9
- - Failed: `.sqlew/queue/failed.json`
10
-
11
- ### How to Check
12
-
13
- Use the `queue` MCP tool to check the queue status:
14
-
15
- ```
16
- queue { action: "list" }
17
- ```
18
-
19
- The response includes:
20
- - `count`: Number of pending items
21
- - `failedCount`: Number of failed items (if any)
22
-
23
- ### Failed Queue (v5.0.1+)
24
-
25
- Items that fail processing (e.g., HighSimilarity errors) are automatically moved to `failed.json` instead of being retried indefinitely.
26
-
27
- **Why items fail:**
28
- - **HighSimilarity (60%+)**: Item is too similar to an existing decision
29
- - **Validation errors**: Invalid layer, category, or other data issues
30
-
31
- **Resolution:**
32
- 1. Check `failedItems` in `queue { action: "list" }` response
33
- 2. For duplicates: Clear with `queue { action: "clear", target: "failed" }`
34
- 3. For different intent: Re-register manually with a more specific key via `/sqlew record <decision>`
35
-
36
- ### Queue Tool Actions
37
-
38
- | Action | Description | Example |
39
- |--------|-------------|---------|
40
- | `list` | Show pending and failed items | `queue { action: "list" }` |
41
- | `remove` | Remove specific pending item | `queue { action: "remove", index: 0 }` |
42
- | `clear` | Clear pending queue (default) | `queue { action: "clear" }` |
43
- | `clear` | Clear failed queue | `queue { action: "clear", target: "failed" }` |
44
- | `clear` | Clear both queues | `queue { action: "clear", target: "all" }` |
45
-
46
- ### Queue File Formats
47
-
48
- **pending.json:**
49
- ```json
50
- {
51
- "items": [
52
- {
53
- "type": "decision",
54
- "action": "create",
55
- "timestamp": "2026-01-13T00:00:00.000Z",
56
- "data": {
57
- "key": "path/to/decision",
58
- "value": "description",
59
- "status": "draft",
60
- "layer": "infrastructure",
61
- "tags": ["plan", "auto-extracted", "..."]
62
- }
63
- }
64
- ]
65
- }
66
- ```
67
-
68
- **failed.json:**
69
- ```json
70
- {
71
- "items": [
72
- {
73
- "item": {
74
- "type": "decision",
75
- "action": "create",
76
- "timestamp": "2026-01-24T...",
77
- "data": { "key": "...", "value": "..." }
78
- },
79
- "error": "HighSimilarity: 65% match with existing decision 'path/to/existing'",
80
- "failedAt": "2026-01-24T..."
81
- }
82
- ]
83
- }
84
- ```