sqlew 4.1.2 → 4.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.
Files changed (232) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/README.md +268 -409
  3. package/assets/claude-md-snippets/plan-mode-integration.md +36 -10
  4. package/assets/config.example.toml +120 -282
  5. package/assets/sample-skills/sqlew-decision-format/SKILL.md +73 -0
  6. package/dist/cli/hooks/check-completion.d.ts.map +1 -1
  7. package/dist/cli/hooks/check-completion.js +90 -2
  8. package/dist/cli/hooks/check-completion.js.map +1 -1
  9. package/dist/cli/hooks/init-hooks.d.ts.map +1 -1
  10. package/dist/cli/hooks/init-hooks.js +97 -5
  11. package/dist/cli/hooks/init-hooks.js.map +1 -1
  12. package/dist/cli/hooks/on-enter-plan.d.ts +22 -0
  13. package/dist/cli/hooks/on-enter-plan.d.ts.map +1 -0
  14. package/dist/cli/hooks/on-enter-plan.js +51 -0
  15. package/dist/cli/hooks/on-enter-plan.js.map +1 -0
  16. package/dist/cli/hooks/on-exit-plan.d.ts +20 -0
  17. package/dist/cli/hooks/on-exit-plan.d.ts.map +1 -0
  18. package/dist/cli/hooks/on-exit-plan.js +66 -0
  19. package/dist/cli/hooks/on-exit-plan.js.map +1 -0
  20. package/dist/cli/hooks/on-stop.d.ts +19 -0
  21. package/dist/cli/hooks/on-stop.d.ts.map +1 -0
  22. package/dist/cli/hooks/on-stop.js +152 -0
  23. package/dist/cli/hooks/on-stop.js.map +1 -0
  24. package/dist/cli/hooks/on-subagent-stop.d.ts +20 -0
  25. package/dist/cli/hooks/on-subagent-stop.d.ts.map +1 -0
  26. package/dist/cli/hooks/on-subagent-stop.js +94 -0
  27. package/dist/cli/hooks/on-subagent-stop.js.map +1 -0
  28. package/dist/cli/hooks/plan-pattern-extractor.d.ts +87 -0
  29. package/dist/cli/hooks/plan-pattern-extractor.d.ts.map +1 -0
  30. package/dist/cli/hooks/plan-pattern-extractor.js +218 -0
  31. package/dist/cli/hooks/plan-pattern-extractor.js.map +1 -0
  32. package/dist/cli/hooks/plan-processor.d.ts +43 -0
  33. package/dist/cli/hooks/plan-processor.d.ts.map +1 -0
  34. package/dist/cli/hooks/plan-processor.js +115 -0
  35. package/dist/cli/hooks/plan-processor.js.map +1 -0
  36. package/dist/cli/hooks/plan-toml-parser.d.ts +42 -0
  37. package/dist/cli/hooks/plan-toml-parser.d.ts.map +1 -0
  38. package/dist/cli/hooks/plan-toml-parser.js +178 -0
  39. package/dist/cli/hooks/plan-toml-parser.js.map +1 -0
  40. package/dist/cli/hooks/save.d.ts +7 -9
  41. package/dist/cli/hooks/save.d.ts.map +1 -1
  42. package/dist/cli/hooks/save.js +50 -25
  43. package/dist/cli/hooks/save.js.map +1 -1
  44. package/dist/cli/hooks/stdin-parser.d.ts +66 -2
  45. package/dist/cli/hooks/stdin-parser.d.ts.map +1 -1
  46. package/dist/cli/hooks/stdin-parser.js +57 -2
  47. package/dist/cli/hooks/stdin-parser.js.map +1 -1
  48. package/dist/cli/hooks/suggest.d.ts +8 -4
  49. package/dist/cli/hooks/suggest.d.ts.map +1 -1
  50. package/dist/cli/hooks/suggest.js +21 -123
  51. package/dist/cli/hooks/suggest.js.map +1 -1
  52. package/dist/cli/hooks/track-plan.d.ts +8 -1
  53. package/dist/cli/hooks/track-plan.d.ts.map +1 -1
  54. package/dist/cli/hooks/track-plan.js +64 -66
  55. package/dist/cli/hooks/track-plan.js.map +1 -1
  56. package/dist/cli.d.ts.map +1 -1
  57. package/dist/cli.js +107 -6
  58. package/dist/cli.js.map +1 -1
  59. package/dist/config/global-config.d.ts +90 -0
  60. package/dist/config/global-config.d.ts.map +1 -1
  61. package/dist/config/global-config.js +86 -1
  62. package/dist/config/global-config.js.map +1 -1
  63. package/dist/database/initialization/init.js +3 -3
  64. package/dist/database/initialization/init.js.map +1 -1
  65. package/dist/database/migrations/v4/20260102204000_v4_fix_decision_set_example.d.ts +15 -0
  66. package/dist/database/migrations/v4/20260102204000_v4_fix_decision_set_example.d.ts.map +1 -0
  67. package/dist/database/migrations/v4/20260102204000_v4_fix_decision_set_example.js +74 -0
  68. package/dist/database/migrations/v4/20260102204000_v4_fix_decision_set_example.js.map +1 -0
  69. package/dist/index.js +8 -4
  70. package/dist/index.js.map +1 -1
  71. package/dist/init-skills.d.ts +12 -3
  72. package/dist/init-skills.d.ts.map +1 -1
  73. package/dist/init-skills.js +96 -24
  74. package/dist/init-skills.js.map +1 -1
  75. package/dist/knexfile.d.ts.map +1 -1
  76. package/dist/knexfile.js +16 -12
  77. package/dist/knexfile.js.map +1 -1
  78. package/dist/server/setup.js +5 -5
  79. package/dist/server/setup.js.map +1 -1
  80. package/dist/server/tool-handlers.d.ts.map +1 -1
  81. package/dist/server/tool-handlers.js +7 -1
  82. package/dist/server/tool-handlers.js.map +1 -1
  83. package/dist/server/tool-registry.js +1 -1
  84. package/dist/server/tool-registry.js.map +1 -1
  85. package/dist/tests/feature/decision/truncate.test.d.ts +8 -0
  86. package/dist/tests/feature/decision/truncate.test.d.ts.map +1 -0
  87. package/dist/tests/feature/decision/truncate.test.js +192 -0
  88. package/dist/tests/feature/decision/truncate.test.js.map +1 -0
  89. package/dist/tests/unit/config/plan-toml-cache.test.d.ts +9 -0
  90. package/dist/tests/unit/config/plan-toml-cache.test.d.ts.map +1 -0
  91. package/dist/tests/unit/config/plan-toml-cache.test.js +230 -0
  92. package/dist/tests/unit/config/plan-toml-cache.test.js.map +1 -0
  93. package/dist/tests/unit/hooks/plan-toml-parser.test.d.ts +10 -0
  94. package/dist/tests/unit/hooks/plan-toml-parser.test.d.ts.map +1 -0
  95. package/dist/tests/unit/hooks/plan-toml-parser.test.js +316 -0
  96. package/dist/tests/unit/hooks/plan-toml-parser.test.js.map +1 -0
  97. package/dist/tools/constraints/actions/activate.d.ts +46 -0
  98. package/dist/tools/constraints/actions/activate.d.ts.map +1 -0
  99. package/dist/tools/constraints/actions/activate.js +105 -0
  100. package/dist/tools/constraints/actions/activate.js.map +1 -0
  101. package/dist/tools/constraints/actions/add.d.ts.map +1 -1
  102. package/dist/tools/constraints/actions/add.js +30 -13
  103. package/dist/tools/constraints/actions/add.js.map +1 -1
  104. package/dist/tools/constraints/actions/deactivate.d.ts.map +1 -1
  105. package/dist/tools/constraints/actions/deactivate.js +7 -4
  106. package/dist/tools/constraints/actions/deactivate.js.map +1 -1
  107. package/dist/tools/constraints/actions/get.d.ts.map +1 -1
  108. package/dist/tools/constraints/actions/get.js +10 -7
  109. package/dist/tools/constraints/actions/get.js.map +1 -1
  110. package/dist/tools/constraints/actions/suggest-pending.d.ts +41 -0
  111. package/dist/tools/constraints/actions/suggest-pending.d.ts.map +1 -0
  112. package/dist/tools/constraints/actions/suggest-pending.js +71 -0
  113. package/dist/tools/constraints/actions/suggest-pending.js.map +1 -0
  114. package/dist/tools/constraints/help/example.d.ts.map +1 -1
  115. package/dist/tools/constraints/help/example.js +65 -1
  116. package/dist/tools/constraints/help/example.js.map +1 -1
  117. package/dist/tools/constraints/help/help.d.ts.map +1 -1
  118. package/dist/tools/constraints/help/help.js +10 -5
  119. package/dist/tools/constraints/help/help.js.map +1 -1
  120. package/dist/tools/constraints/index.d.ts +2 -0
  121. package/dist/tools/constraints/index.d.ts.map +1 -1
  122. package/dist/tools/constraints/index.js +2 -0
  123. package/dist/tools/constraints/index.js.map +1 -1
  124. package/dist/tools/context/actions/add-context.d.ts.map +1 -1
  125. package/dist/tools/context/actions/add-context.js +13 -6
  126. package/dist/tools/context/actions/add-context.js.map +1 -1
  127. package/dist/tools/context/actions/has-updates.d.ts.map +1 -1
  128. package/dist/tools/context/actions/has-updates.js +0 -4
  129. package/dist/tools/context/actions/has-updates.js.map +1 -1
  130. package/dist/tools/context/actions/list-contexts.d.ts.map +1 -1
  131. package/dist/tools/context/actions/list-contexts.js +12 -7
  132. package/dist/tools/context/actions/list-contexts.js.map +1 -1
  133. package/dist/tools/context/actions/list.d.ts.map +1 -1
  134. package/dist/tools/context/actions/list.js +8 -0
  135. package/dist/tools/context/actions/list.js.map +1 -1
  136. package/dist/tools/context/actions/search-advanced.d.ts.map +1 -1
  137. package/dist/tools/context/actions/search-advanced.js +41 -27
  138. package/dist/tools/context/actions/search-advanced.js.map +1 -1
  139. package/dist/tools/context/actions/search-layer.d.ts.map +1 -1
  140. package/dist/tools/context/actions/search-layer.js +8 -0
  141. package/dist/tools/context/actions/search-layer.js.map +1 -1
  142. package/dist/tools/context/actions/search-tags.d.ts.map +1 -1
  143. package/dist/tools/context/actions/search-tags.js +8 -0
  144. package/dist/tools/context/actions/search-tags.js.map +1 -1
  145. package/dist/tools/files/actions/check-lock.d.ts.map +1 -1
  146. package/dist/tools/files/actions/check-lock.js +9 -3
  147. package/dist/tools/files/actions/check-lock.js.map +1 -1
  148. package/dist/tools/files/actions/get.d.ts.map +1 -1
  149. package/dist/tools/files/actions/get.js +18 -13
  150. package/dist/tools/files/actions/get.js.map +1 -1
  151. package/dist/tools/files/actions/record-batch.d.ts.map +1 -1
  152. package/dist/tools/files/actions/record-batch.js +11 -6
  153. package/dist/tools/files/actions/record-batch.js.map +1 -1
  154. package/dist/tools/files/actions/record.d.ts.map +1 -1
  155. package/dist/tools/files/actions/record.js +8 -2
  156. package/dist/tools/files/actions/record.js.map +1 -1
  157. package/dist/tools/files/help/example.d.ts.map +1 -1
  158. package/dist/tools/files/help/example.js +11 -0
  159. package/dist/tools/files/help/example.js.map +1 -1
  160. package/dist/tools/files/help/help.d.ts.map +1 -1
  161. package/dist/tools/files/help/help.js +11 -0
  162. package/dist/tools/files/help/help.js.map +1 -1
  163. package/dist/tools/suggest/actions/by-context.d.ts.map +1 -1
  164. package/dist/tools/suggest/actions/by-context.js +5 -15
  165. package/dist/tools/suggest/actions/by-context.js.map +1 -1
  166. package/dist/tools/suggest/actions/by-key.d.ts.map +1 -1
  167. package/dist/tools/suggest/actions/by-key.js +5 -15
  168. package/dist/tools/suggest/actions/by-key.js.map +1 -1
  169. package/dist/tools/suggest/actions/by-tags.d.ts.map +1 -1
  170. package/dist/tools/suggest/actions/by-tags.js +5 -15
  171. package/dist/tools/suggest/actions/by-tags.js.map +1 -1
  172. package/dist/tools/suggest/actions/constraint-by-context.d.ts +1 -1
  173. package/dist/tools/suggest/actions/constraint-by-context.d.ts.map +1 -1
  174. package/dist/tools/suggest/actions/constraint-by-context.js +9 -16
  175. package/dist/tools/suggest/actions/constraint-by-context.js.map +1 -1
  176. package/dist/tools/suggest/actions/constraint-by-tags.d.ts +1 -1
  177. package/dist/tools/suggest/actions/constraint-by-tags.d.ts.map +1 -1
  178. package/dist/tools/suggest/actions/constraint-by-tags.js +11 -17
  179. package/dist/tools/suggest/actions/constraint-by-tags.js.map +1 -1
  180. package/dist/tools/suggest/actions/constraint-by-text.d.ts +1 -1
  181. package/dist/tools/suggest/actions/constraint-by-text.d.ts.map +1 -1
  182. package/dist/tools/suggest/actions/constraint-by-text.js +6 -15
  183. package/dist/tools/suggest/actions/constraint-by-text.js.map +1 -1
  184. package/dist/types/actions.d.ts +1 -1
  185. package/dist/types/actions.d.ts.map +1 -1
  186. package/dist/types.d.ts +9 -230
  187. package/dist/types.d.ts.map +1 -1
  188. package/dist/utils/action-specs/constraint-specs.d.ts +1 -1
  189. package/dist/utils/action-specs/constraint-specs.d.ts.map +1 -1
  190. package/dist/utils/action-specs/constraint-specs.js +22 -5
  191. package/dist/utils/action-specs/constraint-specs.js.map +1 -1
  192. package/dist/utils/action-specs/decision-specs.d.ts.map +1 -1
  193. package/dist/utils/action-specs/decision-specs.js +11 -10
  194. package/dist/utils/action-specs/decision-specs.js.map +1 -1
  195. package/dist/utils/action-specs/file-specs.js +4 -4
  196. package/dist/utils/action-specs/file-specs.js.map +1 -1
  197. package/dist/utils/hook-queue.d.ts +43 -3
  198. package/dist/utils/hook-queue.d.ts.map +1 -1
  199. package/dist/utils/hook-queue.js +326 -32
  200. package/dist/utils/hook-queue.js.map +1 -1
  201. package/dist/utils/param-normalizer.d.ts +52 -0
  202. package/dist/utils/param-normalizer.d.ts.map +1 -0
  203. package/dist/utils/param-normalizer.js +70 -0
  204. package/dist/utils/param-normalizer.js.map +1 -0
  205. package/dist/utils/parameter-validator.d.ts.map +1 -1
  206. package/dist/utils/parameter-validator.js +2 -0
  207. package/dist/utils/parameter-validator.js.map +1 -1
  208. package/dist/utils/suggest-helpers.d.ts +82 -0
  209. package/dist/utils/suggest-helpers.d.ts.map +1 -0
  210. package/dist/utils/suggest-helpers.js +93 -0
  211. package/dist/utils/suggest-helpers.js.map +1 -0
  212. package/dist/utils/text-truncate.d.ts +13 -0
  213. package/dist/utils/text-truncate.d.ts.map +1 -0
  214. package/dist/utils/text-truncate.js +18 -0
  215. package/dist/utils/text-truncate.js.map +1 -0
  216. package/dist/utils/validators.d.ts +1 -1
  217. package/dist/utils/validators.d.ts.map +1 -1
  218. package/dist/utils/validators.js +1 -1
  219. package/dist/utils/validators.js.map +1 -1
  220. package/dist/watcher/base-watcher.d.ts.map +1 -1
  221. package/dist/watcher/base-watcher.js +4 -3
  222. package/dist/watcher/base-watcher.js.map +1 -1
  223. package/dist/watcher/file-watcher.d.ts.map +1 -1
  224. package/dist/watcher/file-watcher.js +5 -1
  225. package/dist/watcher/file-watcher.js.map +1 -1
  226. package/dist/watcher/queue-watcher.d.ts +12 -1
  227. package/dist/watcher/queue-watcher.d.ts.map +1 -1
  228. package/dist/watcher/queue-watcher.js +92 -12
  229. package/dist/watcher/queue-watcher.js.map +1 -1
  230. package/docs/ADR_CONCEPTS.md +4 -0
  231. package/docs/HOOKS_GUIDE.md +1 -1
  232. package/package.json +1 -1
@@ -1,24 +1,50 @@
1
1
  ## Plan Mode Integration
2
2
 
3
+ ### REQUIRED: Decision & Constraint Recording
4
+
5
+ **When writing plans, you MUST include the following sections:**
6
+
7
+ 1. **📌 Decisions** - Technology choices, architecture patterns, implementation approaches
8
+ 2. **🚫 Constraints** - Rules, restrictions, limitations, prohibited patterns from user requirements
9
+
10
+ **IMPORTANT**: If the user mentions any restrictions, prohibitions, or "don't use X", these MUST be recorded as 🚫 Constraints.
11
+
12
+ ---
13
+
14
+ **Decision format (REQUIRED for any technical choice):**
15
+
16
+ ```markdown
17
+ ### 📌 Decision: [key/path]
18
+ - **Value**: Description of the decision
19
+ - **Layer**: presentation | business | data | infrastructure | cross-cutting
20
+ - **Tags**: tag1, tag2 (optional)
21
+ ```
22
+
23
+ **Constraint format (REQUIRED when user specifies restrictions):**
24
+
25
+ ```markdown
26
+ ### 🚫 Constraint: [category]
27
+ - **Rule**: Description of the constraint
28
+ - **Priority**: critical | high | medium | low
29
+ - **Tags**: tag1, tag2 (optional)
30
+ ```
31
+
32
+ Category options: `architecture` | `security` | `code-style` | `performance`
33
+
34
+ ---
35
+
3
36
  ### With Claude Code Hooks (Recommended)
4
37
 
5
- If you've run `sqlew init --hooks`, sqlew integration is **fully automatic**:
38
+ If you've run `sqlew --hooks`, sqlew integration is **fully automatic**:
39
+
40
+ - 📌/🚫 patterns are auto-detected and registered as draft on ExitPlanMode
6
41
  - Related decisions are auto-suggested before Task execution
7
- - Plan files are auto-tracked with unique IDs
8
42
  - Decisions are auto-saved when code is edited
9
- - Status updates to `in_review` when all tasks complete
10
- - Status updates to `implemented` after git merge/rebase
11
43
 
12
44
  ### Manual Usage (Without Hooks)
13
45
 
14
- When `<system-reminder>Plan mode is active</system-reminder>` appears:
15
-
16
46
  **Research Phase:**
17
47
  - `/sqlew search for <topic>` - find related decisions
18
- - `/sqlew show remaining tasks` - check active tasks
19
48
 
20
49
  **Final Plan Phase:**
21
50
  - `/sqlew record <decision>` - record key architectural decisions
22
- - `/sqlew create task <description>` - create implementation tasks
23
-
24
- **Quick Reference**: `.claude/skills/sqw-plan-guidance/SKILL.md`
@@ -1,282 +1,120 @@
1
- # sqlew Configuration File
2
- # Copy this file to .sqlew/config.toml and customize as needed
3
- #
4
- # Priority: CLI arguments > config.toml > database m_config > defaults
5
- # Documentation: docs/CONFIGURATION.md
6
-
7
- # ============================================================================
8
- # Database Settings
9
- # ============================================================================
10
- [database]
11
- # SQLite Configuration (default, local development)
12
- # Database file path (relative to project root or absolute)
13
- # Default: ".sqlew/sqlew.db"
14
- # path = ".sqlew/custom.db"
15
- # path = "/absolute/path/to/database.db"
16
-
17
- # PostgreSQL/MySQL/MariaDB Configuration (multi-agent production)
18
- # Uncomment and configure for remote database access
19
- # type = "postgres" # or "mysql" (also works with MariaDB 10.5+)
20
-
21
- # Connection settings (required for postgres/mysql/mariadb)
22
- # IMPORTANT: Database must already exist! User does NOT need CREATE DATABASE privilege.
23
- # [database.connection]
24
- # host = "localhost"
25
- # port = 5432 # PostgreSQL: 5432, MySQL/MariaDB: 3306
26
- # database = "sqlew" # Must be created beforehand!
27
-
28
- # Authentication settings (required for postgres/mysql/mariadb)
29
- # Required user privileges: SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, INDEX, DROP, REFERENCES
30
- # [database.auth]
31
- # type = "direct" # Options: "direct", "ssh", "aws-iam", "gcp-iam"
32
- # user = "postgres" # or mysql_user, etc.
33
- # password = "your-password"
34
-
35
- # SSL/TLS Configuration (optional, for encrypted connections)
36
- # [database.auth.ssl]
37
- # ca = "/path/to/ca-cert.pem" # or inline certificate content
38
- # cert = "/path/to/client-cert.pem" # for mutual TLS
39
- # key = "/path/to/client-key.pem" # for mutual TLS
40
- # rejectUnauthorized = true # set to false for self-signed certs (not recommended for production)
41
-
42
- # SSH Tunnel Configuration (when type = "ssh")
43
- # Used for bastion host / jump server access
44
- # [database.auth.ssh]
45
- # host = "bastion.example.com"
46
- # port = 22
47
- # username = "deploy"
48
- # privateKeyPath = "/home/user/.ssh/id_rsa" # or use password
49
- # password = "ssh-password" # alternative to privateKeyPath
50
- # passphrase = "key-passphrase" # if private key is encrypted
51
- # timeout = 30000 # SSH connection timeout in ms
52
- # keepalive = true
53
- # keepaliveInterval = 10000
54
- # localPort = 50000 # auto-allocated from 50000-60000 if not specified
55
-
56
- # ============================================================================
57
- # Auto-Deletion Settings
58
- # ============================================================================
59
- [autodelete]
60
- # Skip weekends when calculating retention periods
61
- # When true: 24 hours on Monday = previous Friday (skips Sat/Sun)
62
- # When false: 24 hours = exactly 24 hours ago
63
- # Default: false
64
- ignore_weekend = false
65
-
66
- # Message retention period in hours (1-720)
67
- # Messages older than this are automatically deleted
68
- # Default: 24 (1 day)
69
- message_hours = 24
70
-
71
- # File change history retention in days (1-365)
72
- # File changes older than this are automatically deleted
73
- # Default: 7 (1 week)
74
- file_history_days = 7
75
-
76
- # ============================================================================
77
- # Debug Logging Settings (v3.5.4)
78
- # ============================================================================
79
- [debug]
80
- # Debug log file path (optional)
81
- # When set, enables detailed debug logging for troubleshooting
82
- # Environment variable SQLEW_DEBUG takes precedence over this setting
83
- # Default: not set (logging disabled)
84
- # log_path = "/home/user/.sqlew/debug.log"
85
- # log_path = ".sqlew/debug.log"
86
-
87
- # Log level for debug output (case-insensitive)
88
- # Levels: "error", "warn", "info", "debug"
89
- # error: Only errors
90
- # warn: Errors and warnings
91
- # info: Errors, warnings, and informational messages
92
- # debug: All messages including debug details
93
- # Default: "info"
94
- # log_level = "info"
95
-
96
- # ============================================================================
97
- # Task Management Settings
98
- # ============================================================================
99
- [tasks]
100
- # Auto-archive done tasks after N days (1-365)
101
- # Tasks in 'done' status older than this are moved to 'archived'
102
- # Keeps task list clean while preserving history
103
- # Default: 2 (48 hours)
104
- auto_archive_done_days = 2
105
-
106
- # Stale detection threshold for 'in_progress' tasks (hours, 1-168)
107
- # Tasks stuck in 'in_progress' longer than this → move to 'waiting_review'
108
- # Helps recover from interrupted AI sessions
109
- # Default: 2 (2 hours)
110
- stale_hours_in_progress = 2
111
-
112
- # Stale detection threshold for 'waiting_review' tasks (hours, 1-720)
113
- # Tasks stuck in 'waiting_review' longer than this → move back to 'todo'
114
- # Prevents abandoned reviews from blocking workflow
115
- # Default: 24 (1 day)
116
- stale_hours_waiting_review = 24
117
-
118
- # Enable automatic stale detection
119
- # When true: Runs stale detection on startup and before task operations
120
- # When false: Stale detection disabled (manual only)
121
- # Default: true
122
- auto_stale_enabled = true
123
-
124
- # ============================================================================
125
- # VCS-Aware Auto-Complete Settings (v3.5.2)
126
- # ============================================================================
127
- [vcs]
128
- # Auto-complete tasks when files are staged (git add)
129
- # When true: waiting_review → done when files are staged
130
- # When false: Manual task completion required
131
- # Default: true
132
- git_auto_complete_on_stage = true
133
-
134
- # Auto-archive tasks when files are committed (git commit)
135
- # When true: done → archived when files are committed
136
- # When false: Manual task archiving required
137
- # Default: true
138
- git_auto_archive_on_commit = true
139
-
140
- # Require ALL watched files to be staged for auto-completion
141
- # When true: All files must be staged to trigger waiting_review → done
142
- # When false: At least one file staged is sufficient
143
- # Default: true
144
- require_all_files_staged = true
145
-
146
- # Require ALL watched files to be committed for auto-archiving
147
- # When true: All files must be committed to trigger done → archived
148
- # When false: At least one file committed is sufficient
149
- # Default: true
150
- require_all_files_committed_for_archive = true
151
-
152
- # ============================================================================
153
- # Specialized Agents Settings
154
- # ============================================================================
155
- [agents]
156
- # Which specialized agents to enable for your project
157
- # Set to false to skip agents you don't need (reduces token consumption)
158
- # Install by manually copying files from assets/sample-agents/ to ~/.claude/agents/
159
- # Note: Agents are only loaded into Claude Code conversations, not the MCP server
160
-
161
- # Scrum Master: Multi-agent coordination, task management, sprint planning
162
- # Token cost: ~12KB per conversation when loaded in Claude Code
163
- # Use when: Coordinating complex features, managing dependencies, tracking progress
164
- # Default: true
165
- scrum_master = true
166
-
167
- # Researcher: Query decisions, analyze patterns, investigate context
168
- # Token cost: ~14KB per conversation when loaded in Claude Code
169
- # Use when: Understanding past decisions, onboarding new members, sprint retrospectives
170
- # Default: true
171
- researcher = true
172
-
173
- # Architect: Document decisions, enforce constraints, maintain standards
174
- # Token cost: ~20KB per conversation when loaded in Claude Code
175
- # Use when: Making architectural choices, establishing rules, validating compliance
176
- # Default: true
177
- architect = true
178
-
179
- # Example: Minimal installation (only Scrum Master for task management)
180
- # [agents]
181
- # scrum_master = true
182
- # researcher = false
183
- # architect = false
184
-
185
- # Token Impact Examples:
186
- # - All 3 agents: ~46KB loaded per conversation (scrum 12KB + researcher 14KB + architect 20KB)
187
- # - Scrum + Architect: ~32KB (30% reduction)
188
- # - Scrum only: ~12KB (74% reduction)
189
-
190
-
191
- # ============================================================================
192
- # Slash Commands Settings
193
- # ============================================================================
194
- [commands]
195
- # Which slash commands to install on server startup
196
- # Set to false to skip commands you don't need
197
-
198
- # /sqlew: Unified natural language interface for decisions and tasks
199
- # Usage: /sqlew <what you want to do>
200
- # Examples:
201
- # /sqlew show remaining tasks
202
- # /sqlew search for auth decisions
203
- # /sqlew record that we use PostgreSQL 15
204
- # Default: true
205
- sqlew = true
206
-
207
- # ============================================================================
208
- # Example Configurations
209
- # ============================================================================
210
-
211
- # Example 1: PostgreSQL with Direct Authentication + SSL
212
- # [database]
213
- # type = "postgres"
214
- # [database.connection]
215
- # host = "db.example.com"
216
- # port = 5432
217
- # database = "sqlew_production"
218
- # [database.auth]
219
- # type = "direct"
220
- # user = "postgres"
221
- # password = "secure-password"
222
- # [database.auth.ssl]
223
- # ca = "/path/to/ca-cert.pem"
224
- # rejectUnauthorized = true
225
-
226
- # Example 2: PostgreSQL through SSH Tunnel
227
- # [database]
228
- # type = "postgres"
229
- # [database.connection]
230
- # host = "db.internal.example.com"
231
- # port = 5432
232
- # database = "sqlew_production"
233
- # [database.auth]
234
- # type = "ssh"
235
- # user = "postgres"
236
- # password = "db-password"
237
- # [database.auth.ssh]
238
- # host = "bastion.example.com"
239
- # username = "deploy"
240
- # privateKeyPath = "/home/user/.ssh/id_rsa"
241
-
242
- # Example 3: MySQL with SSL and SSH
243
- # [database]
244
- # type = "mysql"
245
- # [database.connection]
246
- # host = "mysql.internal.example.com"
247
- # port = 3306
248
- # database = "sqlew_db"
249
- # [database.auth]
250
- # type = "ssh"
251
- # user = "mysql_user"
252
- # password = "db-password"
253
- # [database.auth.ssl]
254
- # ca = "-----BEGIN CERTIFICATE-----\nMIIE...\n-----END CERTIFICATE-----"
255
- # rejectUnauthorized = true
256
- # [database.auth.ssh]
257
- # host = "jump.example.com"
258
- # port = 22
259
- # username = "deploy"
260
- # privateKeyPath = "/home/user/.ssh/deploy_key"
261
- # passphrase = "key-passphrase"
262
- # localPort = 53306
263
-
264
- # Aggressive cleanup (development)
265
- # [autodelete]
266
- # message_hours = 1
267
- # file_history_days = 1
268
- # [tasks]
269
- # auto_archive_done_days = 1
270
-
271
- # Conservative cleanup (production)
272
- # [autodelete]
273
- # message_hours = 168 # 7 days
274
- # file_history_days = 30
275
- # [tasks]
276
- # auto_archive_done_days = 7
277
-
278
- # Weekend-aware workflow (for developers)
279
- # [autodelete]
280
- # ignore_weekend = true
281
- # message_hours = 48
282
- # file_history_days = 14
1
+ # sqlew Configuration File
2
+ # Copy this file to .sqlew/config.toml and customize as needed
3
+ #
4
+ # Priority: CLI arguments > config.toml > database m_config > defaults
5
+ # Documentation: docs/CONFIGURATION.md
6
+
7
+ # ============================================================================
8
+ # Database Settings
9
+ # ============================================================================
10
+ [database]
11
+ # SQLite Configuration (default, local development)
12
+ # Database file path (relative to project root or absolute)
13
+ # Default: ".sqlew/sqlew.db"
14
+ # path = ".sqlew/custom.db"
15
+ # path = "/absolute/path/to/database.db"
16
+
17
+ # PostgreSQL/MySQL/MariaDB Configuration (multi-agent production)
18
+ # Uncomment and configure for remote database access
19
+ # type = "postgres" # or "mysql" (also works with MariaDB 10.5+)
20
+
21
+ # Connection settings (required for postgres/mysql/mariadb)
22
+ # IMPORTANT: Database must already exist! User does NOT need CREATE DATABASE privilege.
23
+ # [database.connection]
24
+ # host = "localhost"
25
+ # port = 5432 # PostgreSQL: 5432, MySQL/MariaDB: 3306
26
+ # database = "sqlew" # Must be created beforehand!
27
+
28
+ # Authentication settings (required for postgres/mysql/mariadb)
29
+ # Required user privileges: SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, INDEX, DROP, REFERENCES
30
+ # [database.auth]
31
+ # user = "postgres" # or mysql_user, etc.
32
+ # password = "your-password"
33
+
34
+
35
+ # ============================================================================
36
+ # Debug Logging Settings (v3.5.4)
37
+ # ============================================================================
38
+ [debug]
39
+ # Debug log file path (optional)
40
+ # When set, enables detailed debug logging for troubleshooting
41
+ # Environment variable SQLEW_DEBUG takes precedence over this setting
42
+ # Default: not set (logging disabled)
43
+ # log_path = "/home/user/.sqlew/debug.log"
44
+ # log_path = ".sqlew/debug.log"
45
+
46
+ # Log level for debug output (case-insensitive)
47
+ # Levels: "error", "warn", "info", "debug"
48
+ # error: Only errors
49
+ # warn: Errors and warnings
50
+ # info: Errors, warnings, and informational messages
51
+ # debug: All messages including debug details
52
+ # Default: "info"
53
+ # log_level = "info"
54
+
55
+
56
+ # ============================================================================
57
+ # Specialized Agents Settings (DEPRECATED)
58
+ # ============================================================================
59
+ [agents]
60
+ # DEPRECATED: With Claude Opus 4.5's improved capabilities, specialized agents
61
+ # are no longer necessary. The base model now handles coordination, research,
62
+ # and architectural decisions effectively without additional agent overhead.
63
+ #
64
+ # These settings are preserved for backward compatibility but all agents are
65
+ # disabled by default. Will be removed in v5.0.
66
+
67
+ # Scrum Master: Multi-agent coordination (DEPRECATED)
68
+ # Default: false
69
+ scrum_master = false
70
+
71
+ # Researcher: Query decisions, analyze patterns (DEPRECATED)
72
+ # Default: false
73
+ researcher = false
74
+
75
+ # Architect: Document decisions, enforce constraints (DEPRECATED)
76
+ # Default: false
77
+ architect = false
78
+
79
+
80
+ # ============================================================================
81
+ # Slash Commands Settings
82
+ # ============================================================================
83
+ [commands]
84
+ # Which slash commands to install on server startup
85
+ # Set to false to skip commands you don't need
86
+
87
+ # /sqlew: Unified natural language interface for decisions and tasks
88
+ # Usage: /sqlew <what you want to do>
89
+ # Examples:
90
+ # /sqlew show remaining tasks
91
+ # /sqlew search for auth decisions
92
+ # /sqlew record that we use PostgreSQL 15
93
+ # Default: true
94
+ sqlew = true
95
+
96
+ # ============================================================================
97
+ # Example Configurations
98
+ # ============================================================================
99
+
100
+ # Example 1: PostgreSQL with SSL
101
+ # [database]
102
+ # type = "postgres"
103
+ # [database.connection]
104
+ # host = "db.example.com"
105
+ # port = 5432
106
+ # database = "sqlew_production"
107
+ # [database.auth]
108
+ # user = "postgres"
109
+ # password = "secure-password"
110
+
111
+ # Example 2: MySQL/MariaDB
112
+ # [database]
113
+ # type = "mysql"
114
+ # [database.connection]
115
+ # host = "mysql.example.com"
116
+ # port = 3306
117
+ # database = "sqlew_db"
118
+ # [database.auth]
119
+ # user = "mysql_user"
120
+ # password = "db-password"
@@ -0,0 +1,73 @@
1
+ ---
2
+ name: sqlew-decision-format
3
+ description: |
4
+ Format guide for recording decisions and constraints in plan mode.
5
+ Auto-injected during plan creation to encourage structured documentation.
6
+ Auto-detected and registered as draft on ExitPlanMode.
7
+ ---
8
+
9
+ ## Plan Mode: Decision & Constraint Recording
10
+
11
+ When including decisions or constraints in your plan, use the following format.
12
+ They will be auto-detected on ExitPlanMode and registered as draft in sqlew.
13
+
14
+ ---
15
+
16
+ ### 📌 Decision: [hierarchical/key]
17
+
18
+ Record decisions using this format:
19
+
20
+ ```markdown
21
+ ### 📌 Decision: [key/path]
22
+ - **Value**: Description of the decision
23
+ - **Layer**: presentation | business | data | infrastructure | cross-cutting
24
+ - **Tags**: tag1, tag2 (optional)
25
+ ```
26
+
27
+ **Examples:**
28
+
29
+ ### 📌 Decision: frontend/framework
30
+ - **Value**: Use React 18
31
+ - **Layer**: presentation
32
+ - **Tags**: react, frontend
33
+
34
+ ### 📌 Decision: database/orm
35
+ - **Value**: Adopt Prisma
36
+ - **Layer**: data
37
+ - **Tags**: prisma, orm, typescript
38
+
39
+ ---
40
+
41
+ ### 🚫 Constraint: [category]
42
+
43
+ Record constraints using this format:
44
+
45
+ ```markdown
46
+ ### 🚫 Constraint: [category]
47
+ - **Rule**: Description of the constraint
48
+ - **Priority**: critical | high | medium | low
49
+ - **Tags**: tag1, tag2 (optional)
50
+ ```
51
+
52
+ **Category options:** `architecture` | `security` | `code-style` | `performance`
53
+
54
+ **Examples:**
55
+
56
+ ### 🚫 Constraint: code-style
57
+ - **Rule**: No inline styles, use CSS Modules
58
+ - **Priority**: medium
59
+ - **Tags**: css, styling
60
+
61
+ ### 🚫 Constraint: security
62
+ - **Rule**: No hardcoded API keys, use environment variables
63
+ - **Priority**: critical
64
+ - **Tags**: security, env
65
+
66
+ ---
67
+
68
+ ## Automatic Processing Flow
69
+
70
+ 1. **During Planning**: Write Decision/Constraint in the format above
71
+ 2. **On ExitPlanMode**: Auto-detected → registered as draft/inactive
72
+ 3. **On Implementation File Edit**: Auto-promoted to active
73
+ 4. **Check command**: `mcp__sqlew__decision({ action: "list", status: "draft" })`
@@ -1 +1 @@
1
- {"version":3,"file":"check-completion.d.ts","sourceRoot":"","sources":["../../../src/cli/hooks/check-completion.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAyBH;;;;;GAKG;AACH,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,IAAI,CAAC,CA4E5D"}
1
+ {"version":3,"file":"check-completion.d.ts","sourceRoot":"","sources":["../../../src/cli/hooks/check-completion.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAmHH;;;;;GAKG;AACH,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,IAAI,CAAC,CA4F5D"}
@@ -10,9 +10,10 @@
10
10
  * @since v4.1.0
11
11
  */
12
12
  import { readStdinJson, sendContinue, areAllTodosCompleted, getProjectPath } from './stdin-parser.js';
13
- import { loadCurrentPlan } from '../../config/global-config.js';
13
+ import { loadCurrentPlan, loadPlanTomlCache, savePlanTomlCache, } from '../../config/global-config.js';
14
14
  import { initializeDatabase } from '../../database.js';
15
15
  import { setDecision } from '../../tools/context/actions/set.js';
16
+ import { enqueueDecisionCreate } from '../../utils/hook-queue.js';
16
17
  import { join } from 'path';
17
18
  // ============================================================================
18
19
  // Constants
@@ -24,6 +25,77 @@ const IN_REVIEW_STATUS = 'active';
24
25
  /** Workflow tag for in-review state */
25
26
  const WORKFLOW_TAG_IN_REVIEW = 'workflow:in_review';
26
27
  // ============================================================================
28
+ // TOML Decision/Constraint Processing (v4.2.0+)
29
+ // ============================================================================
30
+ /**
31
+ * Format constraint candidates as a registration prompt
32
+ *
33
+ * @param cache - Plan TOML cache with constraint candidates
34
+ * @returns Formatted prompt string with MCP command examples
35
+ */
36
+ function formatConstraintPrompt(cache) {
37
+ if (cache.constraints.length === 0) {
38
+ return '';
39
+ }
40
+ const lines = [
41
+ '',
42
+ '🎯 **Constraint Candidates Ready for Registration**',
43
+ '',
44
+ `Found ${cache.constraints.length} constraint candidate(s) from plan TOML:`,
45
+ '',
46
+ ];
47
+ cache.constraints.forEach((c, i) => {
48
+ const priority = c.priority || 'medium';
49
+ lines.push(`${i + 1}. [${c.category}/${priority}] ${c.text}`);
50
+ if (c.rationale) {
51
+ lines.push(` Rationale: ${c.rationale}`);
52
+ }
53
+ });
54
+ lines.push('');
55
+ lines.push('To register, use mcp__sqlew__constraint with action="add":');
56
+ lines.push('```');
57
+ // Show example for first constraint
58
+ const first = cache.constraints[0];
59
+ lines.push(`mcp__sqlew__constraint action="add" constraint_text="${first.text}" category="${first.category}" priority="${first.priority || 'medium'}"`);
60
+ lines.push('```');
61
+ lines.push('');
62
+ return lines.join('\n');
63
+ }
64
+ /**
65
+ * Process TOML decisions and constraints from plan cache
66
+ *
67
+ * @param projectPath - Project root path
68
+ * @param cache - Plan TOML cache
69
+ * @returns Context message with results
70
+ */
71
+ function processPlanTomlCache(projectPath, cache) {
72
+ const messages = [];
73
+ // Auto-register decisions (queued for MCP server processing)
74
+ if (!cache.decisions_registered && cache.decisions.length > 0) {
75
+ for (const d of cache.decisions) {
76
+ enqueueDecisionCreate(projectPath, {
77
+ key: d.key,
78
+ value: d.value,
79
+ status: d.status || 'active',
80
+ layer: d.layer || 'cross-cutting',
81
+ tags: d.tags || [],
82
+ });
83
+ }
84
+ cache.decisions_registered = true;
85
+ messages.push(`✅ Registered ${cache.decisions.length} decision(s) to queue`);
86
+ }
87
+ // Prompt for constraints (user decision required)
88
+ if (!cache.constraints_prompted && cache.constraints.length > 0) {
89
+ messages.push(formatConstraintPrompt(cache));
90
+ cache.constraints_prompted = true;
91
+ }
92
+ // Save updated cache
93
+ if (cache.decisions_registered || cache.constraints_prompted) {
94
+ savePlanTomlCache(projectPath, cache);
95
+ }
96
+ return messages.join('\n');
97
+ }
98
+ // ============================================================================
27
99
  // Main Entry Point
28
100
  // ============================================================================
29
101
  /**
@@ -85,12 +157,28 @@ export async function checkCompletionCommand() {
85
157
  layer: 'cross-cutting',
86
158
  tags: ['plan', 'implementation', WORKFLOW_TAG_IN_REVIEW, planInfo.plan_id.slice(0, 8)],
87
159
  });
88
- sendContinue(`[sqlew] All tasks completed! Decision updated to status: ${IN_REVIEW_STATUS}`);
160
+ // Process TOML decisions and constraints (v4.2.0+)
161
+ let tomlContext = '';
162
+ const tomlCache = loadPlanTomlCache(projectPath);
163
+ if (tomlCache && tomlCache.plan_id === planInfo.plan_id) {
164
+ tomlContext = processPlanTomlCache(projectPath, tomlCache);
165
+ }
166
+ const baseMessage = `[sqlew] All tasks completed! Decision updated to status: ${IN_REVIEW_STATUS}`;
167
+ sendContinue(tomlContext ? `${baseMessage}\n${tomlContext}` : baseMessage);
89
168
  }
90
169
  catch (error) {
91
170
  // Log error but continue
92
171
  const message = error instanceof Error ? error.message : String(error);
93
172
  console.error(`[sqlew check-completion] Error updating decision: ${message}`);
173
+ // Still process TOML even if decision update failed
174
+ const tomlCache = loadPlanTomlCache(projectPath);
175
+ if (tomlCache && tomlCache.plan_id === planInfo.plan_id) {
176
+ const tomlContext = processPlanTomlCache(projectPath, tomlCache);
177
+ if (tomlContext) {
178
+ sendContinue(tomlContext);
179
+ return;
180
+ }
181
+ }
94
182
  sendContinue();
95
183
  }
96
184
  }