sequant 1.0.0 → 1.1.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 (77) hide show
  1. package/README.md +12 -8
  2. package/dist/bin/cli.js +12 -0
  3. package/dist/bin/cli.js.map +1 -1
  4. package/dist/src/commands/doctor.d.ts.map +1 -1
  5. package/dist/src/commands/doctor.js +46 -0
  6. package/dist/src/commands/doctor.js.map +1 -1
  7. package/dist/src/commands/doctor.test.d.ts +2 -0
  8. package/dist/src/commands/doctor.test.d.ts.map +1 -0
  9. package/dist/src/commands/doctor.test.js +140 -0
  10. package/dist/src/commands/doctor.test.js.map +1 -0
  11. package/dist/src/commands/init.d.ts.map +1 -1
  12. package/dist/src/commands/init.js +45 -2
  13. package/dist/src/commands/init.js.map +1 -1
  14. package/dist/src/commands/init.test.d.ts +2 -0
  15. package/dist/src/commands/init.test.d.ts.map +1 -0
  16. package/dist/src/commands/init.test.js +152 -0
  17. package/dist/src/commands/init.test.js.map +1 -0
  18. package/dist/src/commands/logs.d.ts +18 -0
  19. package/dist/src/commands/logs.d.ts.map +1 -0
  20. package/dist/src/commands/logs.js +188 -0
  21. package/dist/src/commands/logs.js.map +1 -0
  22. package/dist/src/commands/run.d.ts +2 -0
  23. package/dist/src/commands/run.d.ts.map +1 -1
  24. package/dist/src/commands/run.js +114 -29
  25. package/dist/src/commands/run.js.map +1 -1
  26. package/dist/src/lib/stacks.d.ts.map +1 -1
  27. package/dist/src/lib/stacks.js +39 -0
  28. package/dist/src/lib/stacks.js.map +1 -1
  29. package/dist/src/lib/stacks.test.d.ts +2 -0
  30. package/dist/src/lib/stacks.test.d.ts.map +1 -0
  31. package/dist/src/lib/stacks.test.js +145 -0
  32. package/dist/src/lib/stacks.test.js.map +1 -0
  33. package/dist/src/lib/system.d.ts +16 -0
  34. package/dist/src/lib/system.d.ts.map +1 -0
  35. package/dist/src/lib/system.js +52 -0
  36. package/dist/src/lib/system.js.map +1 -0
  37. package/dist/src/lib/system.test.d.ts +2 -0
  38. package/dist/src/lib/system.test.d.ts.map +1 -0
  39. package/dist/src/lib/system.test.js +80 -0
  40. package/dist/src/lib/system.test.js.map +1 -0
  41. package/dist/src/lib/workflow/log-writer.d.ts +83 -0
  42. package/dist/src/lib/workflow/log-writer.d.ts.map +1 -0
  43. package/dist/src/lib/workflow/log-writer.js +193 -0
  44. package/dist/src/lib/workflow/log-writer.js.map +1 -0
  45. package/dist/src/lib/workflow/run-log-schema.d.ts +261 -0
  46. package/dist/src/lib/workflow/run-log-schema.d.ts.map +1 -0
  47. package/dist/src/lib/workflow/run-log-schema.js +234 -0
  48. package/dist/src/lib/workflow/run-log-schema.js.map +1 -0
  49. package/package.json +6 -4
  50. package/stacks/astro.yaml +35 -0
  51. package/templates/hooks/post-tool.sh +0 -11
  52. package/templates/hooks/pre-tool.sh +2 -2
  53. package/templates/memory/constitution.md +8 -0
  54. package/templates/scripts/cleanup-worktree.sh +1 -1
  55. package/templates/scripts/new-feature.sh +7 -5
  56. package/templates/skills/assess/SKILL.md +31 -16
  57. package/templates/skills/clean/SKILL.md +17 -2
  58. package/templates/skills/docs/SKILL.md +48 -34
  59. package/templates/skills/exec/SKILL.md +31 -25
  60. package/templates/skills/fullsolve/SKILL.md +34 -16
  61. package/templates/skills/loop/SKILL.md +22 -5
  62. package/templates/skills/qa/SKILL.md +89 -4
  63. package/templates/skills/qa/references/code-quality-exemplars.md +23 -28
  64. package/templates/skills/qa/references/code-review-checklist.md +6 -17
  65. package/templates/skills/qa/scripts/quality-checks.sh +4 -17
  66. package/templates/skills/reflect/SKILL.md +18 -2
  67. package/templates/skills/reflect/references/documentation-tiers.md +3 -3
  68. package/templates/skills/security-review/SKILL.md +15 -0
  69. package/templates/skills/security-review/references/security-checklists.md +10 -8
  70. package/templates/skills/solve/SKILL.md +147 -149
  71. package/templates/skills/spec/SKILL.md +61 -3
  72. package/templates/skills/spec/references/parallel-groups.md +1 -1
  73. package/templates/skills/spec/references/verification-criteria.md +1 -1
  74. package/templates/skills/test/SKILL.md +20 -5
  75. package/templates/skills/testgen/SKILL.md +15 -1
  76. package/templates/skills/verify/SKILL.md +20 -5
  77. package/templates/skills/reflect/scripts/workflow-queries.ts +0 -165
@@ -1,36 +1,31 @@
1
1
  # Code Quality Exemplars
2
2
 
3
- ## ✅ Good Example: Content Ideas Queue (Issue #146)
3
+ ## ✅ Good Example: Feature Dashboard (Complex Feature)
4
4
 
5
-
6
-
7
- **AC:** Content Ideas Queue with filtering, pagination, bulk actions, and scoring (17 AC items)
5
+ **AC:** Dashboard with filtering, pagination, bulk actions, and analytics (17 AC items)
8
6
 
9
7
  **Changes** (1553 net LOC, 20 files):
10
- - `components/admin/news/ContentIdeasList.tsx` (new, 349 LOC) - Main queue interface
11
- - `components/admin/news/IdeaDetailModal.tsx` (new, 205 LOC) - Full-screen review modal
12
- - `components/admin/news/IdeaScoringForm.tsx` (new, 160 LOC) - Interactive scoring UI
13
- - `components/admin/news/IdeasFilters.tsx` (new, 134 LOC) - Multi-criteria filtering
14
- - `components/admin/news/IdeaCard.tsx` (new, 125 LOC) - Compact card view
15
- - `components/admin/news/IdeaActions.tsx` (new, 44 LOC) - Action buttons
16
- - `lib/queries/news.ts` (modified, +318 LOC) - Database queries for ideas
17
- - `app/admin/news/ideas/page.tsx` (modified, +137 LOC) - Main route
18
- - `types/database.ts` (modified, type regeneration with +383/-554 LOC)
19
- - `types/news.ts` (new, 87 LOC) - Type definitions
20
- - 5 API routes (promote, archive, score, bulk actions)
8
+ - `components/feature/Dashboard.tsx` (new, 349 LOC) - Main interface
9
+ - `components/feature/DetailModal.tsx` (new, 205 LOC) - Full-screen detail view
10
+ - `components/feature/FilterPanel.tsx` (new, 134 LOC) - Multi-criteria filtering
11
+ - `components/feature/ItemCard.tsx` (new, 125 LOC) - Compact card view
12
+ - `components/feature/ActionButtons.tsx` (new, 44 LOC) - Action buttons
13
+ - `lib/queries/feature.ts` (modified, +318 LOC) - Database queries
14
+ - `app/dashboard/page.tsx` (modified, +137 LOC) - Main route
15
+ - `types/feature.ts` (new, 87 LOC) - Type definitions
16
+ - 5 API routes (create, update, delete, bulk actions)
21
17
 
22
18
  **Why it's A+:**
23
19
  - ✅ Every file directly serves an AC item (17 AC → ~1500 LOC = 88 LOC/AC)
24
20
  - ✅ Size proportional to scope (complex feature with 6 components + 5 API routes)
25
21
  - ✅ Zero scope creep - no refactoring of unrelated code
26
- - ✅ Type safety improved (removed all 'as never' assertions, added proper types)
27
- - ✅ Follows existing admin patterns (List + Card + Modal + Actions)
22
+ - ✅ Type safety maintained (proper types, no `any` usage)
23
+ - ✅ Follows existing patterns in codebase
28
24
  - ✅ Clear separation of concerns (UI, data, types, API)
29
- - ✅ Comprehensive: filtering, pagination, bulk operations, scoring
30
- - ✅ Build succeeds, all 280 tests pass
25
+ - ✅ Build succeeds, all tests pass
31
26
 
32
27
  **Automated Checks:**
33
- - Type issues: 0 (actually improved type safety)
28
+ - Type issues: 0
34
29
  - Deleted tests: 0
35
30
  - Files changed: 20
36
31
  - Diff size: +2107 -554 (net: +1553)
@@ -42,17 +37,17 @@
42
37
 
43
38
  ## ⚠️ Acceptable but Not A+
44
39
 
45
- **AC:** Add bulk edit modal for shops (6 AC items)
40
+ **AC:** Add bulk edit modal (6 AC items)
46
41
 
47
42
  **Changes** (420 net LOC, 12 files):
48
- - `components/admin/shops/BulkEditModal.tsx` (new, 280 LOC)
49
- - `lib/queries/shops.ts` (modified, +85 LOC)
50
- - `app/admin/shops/review/actions.ts` (modified, +45 LOC)
43
+ - `components/feature/BulkEditModal.tsx` (new, 280 LOC)
44
+ - `lib/queries/items.ts` (modified, +85 LOC)
45
+ - `app/feature/actions.ts` (modified, +45 LOC)
51
46
  - 9 other files (minor changes, imports, types)
52
47
 
53
48
  **Issues:**
54
49
  - ⚠️ BulkEditModal is 280 LOC - could be split into smaller components
55
- - ⚠️ Added 3 utility functions to `lib/utils/formatting.ts` not directly used
50
+ - ⚠️ Added 3 utility functions not directly used by AC
56
51
  - ⚠️ Changed formatting in 2 unrelated files ("while I was here" changes)
57
52
 
58
53
  **Why it's acceptable:**
@@ -79,12 +74,12 @@
79
74
 
80
75
  ## ❌ Needs Rework
81
76
 
82
- **AC:** Display shop reviews on detail page (3 simple AC items)
77
+ **AC:** Display reviews on detail page (3 simple AC items)
83
78
 
84
79
  **Changes** (890 net LOC, 23 files):
85
80
  - Rewrote entire reviews system (not in AC)
86
- - Added new reviews API routes (not in AC)
87
- - Refactored unrelated shop queries (not in AC)
81
+ - Added new API routes (not in AC)
82
+ - Refactored unrelated queries (not in AC)
88
83
  - Changed database schema without migration (BLOCKER)
89
84
  - Removed type annotations from 5 functions (type safety violation)
90
85
  - Deleted 2 test files to "make build pass" (BLOCKER)
@@ -21,7 +21,7 @@ git diff main...HEAD --name-only | grep "^scripts/"
21
21
 
22
22
  ### 2. Pattern Compliance
23
23
  Do new scripts follow existing patterns?
24
- - Scripts: Inline Supabase client, env validation, CLI flags (`--dry-run`, `--limit`)
24
+ - Scripts: Database client setup, env validation, CLI flags (`--dry-run`, `--limit`)
25
25
  - Components: Follow established admin patterns (List + Card + Modal)
26
26
  - Compare with similar files: `ls scripts/fix/` or `ls components/admin/`
27
27
 
@@ -42,23 +42,12 @@ If adding new scripts/commands, should they be documented?
42
42
 
43
43
  Skip trivial formatting if the repo already has automated formatting tools.
44
44
 
45
- ## RLS-Protected Table Access Check
45
+ ## Database Access Check
46
46
 
47
- Admin pages must use `supabaseAdmin`:
48
-
49
- ```bash
50
- rls_tables="content_updates|content_ideas|fact_check_logs"
51
- admin_files=$(git diff main...HEAD --name-only | grep -E "^app/admin/")
52
- if [[ -n "$admin_files" ]]; then
53
- for file in $admin_files; do
54
- if [[ -f "$file" ]]; then
55
- if grep -q "from '@/lib/supabase'" "$file" && grep -qE "\.from\(['\"]($rls_tables)['\"]" "$file"; then
56
- echo "❌ BLOCKER: $file uses anon client for RLS-protected table"
57
- fi
58
- fi
59
- done
60
- fi
61
- ```
47
+ If project uses a database with access controls:
48
+ - Verify admin pages use admin/service client (not anonymous client)
49
+ - Check that sensitive tables are accessed with proper permissions
50
+ - Review any new database queries for proper authorization
62
51
 
63
52
  ## Integration Check
64
53
 
@@ -45,26 +45,13 @@ else
45
45
  echo "❌ Size: Very large (>500 net LOC) - may indicate scope creep"
46
46
  fi
47
47
 
48
- # 6. RLS-protected table access check (admin pages must use supabaseAdmin)
48
+ # 6. Database access check (admin pages should use proper access controls)
49
49
  echo ""
50
- echo "🔒 Checking RLS-protected table access..."
51
- rls_tables="content_updates|content_ideas|fact_check_logs"
50
+ echo "🔒 Checking database access patterns..."
52
51
  admin_files=$(git diff main...HEAD --name-only | grep -E "^app/admin/" || true)
53
52
  if [[ -n "$admin_files" ]]; then
54
- rls_violations=0
55
- for file in $admin_files; do
56
- if [[ -f "$file" ]]; then
57
- # Check if file imports anon client and queries RLS-protected tables
58
- if grep -q "from '@/lib/supabase'" "$file" && grep -qE "\.from\(['\"]($rls_tables)['\"]" "$file"; then
59
- echo "❌ BLOCKER: $file uses anon client for RLS-protected table"
60
- echo " Fix: Use supabaseAdmin from '@/lib/supabase-admin' instead"
61
- rls_violations=$((rls_violations + 1))
62
- fi
63
- fi
64
- done
65
- if [[ $rls_violations -eq 0 ]]; then
66
- echo "✅ RLS access: No violations found in admin files"
67
- fi
53
+ echo " Admin files modified - manually verify proper database access controls"
54
+ echo " (admin pages should use service/admin clients, not anonymous clients)"
68
55
  else
69
56
  echo " No admin files modified"
70
57
  fi
@@ -10,7 +10,6 @@ allowed-tools:
10
10
  - Write
11
11
  - Glob
12
12
  - Grep
13
- - mcp__supabase__execute_sql
14
13
  ---
15
14
 
16
15
  # Reflection Agent
@@ -137,7 +136,10 @@ Generate a checklist:
137
136
 
138
137
  ## Workflow Analytics
139
138
 
140
- For `/reflect workflow`, use the SQL queries in [workflow-queries.ts](scripts/workflow-queries.ts) to analyze historical data.
139
+ For `/reflect workflow`, analyze:
140
+ - Log files in `/tmp/claude-issue-*.log`
141
+ - Git history and commit patterns
142
+ - Issue comments and PR history
141
143
 
142
144
  See [phase-reflection.md](references/phase-reflection.md) for phase-specific guidance.
143
145
 
@@ -157,3 +159,17 @@ At the end of reflection, ask:
157
159
  - Did I identify root causes or just symptoms?
158
160
  - Will these changes be maintainable long-term?
159
161
  - Am I in the right workflow phase for this reflection focus?
162
+
163
+ ---
164
+
165
+ ## Output Verification
166
+
167
+ **Before responding, verify your output includes ALL of these:**
168
+
169
+ - [ ] **Session Summary** - What was accomplished, what went well, friction points
170
+ - [ ] **Effectiveness Analysis** - Token efficiency, context gathering, pattern reuse
171
+ - [ ] **Proposed Changes** - Specific changes with target files and rationale
172
+ - [ ] **Documentation Health** - Line count, bloat assessment, recommendations
173
+ - [ ] **Action Items** - Checklist of concrete next steps
174
+
175
+ **DO NOT respond until all items are verified.**
@@ -25,9 +25,9 @@ Organize information by access frequency:
25
25
  - Review quarterly
26
26
 
27
27
  **Current specialized docs:**
28
- - `CITY_COVERAGE.md` - Coverage analysis workflow
29
- - `SHOP_DISCOVERY.md` - Discovery & enrichment pipeline
30
- - `TESTING.md` - UI testing patterns
28
+ - `ARCHITECTURE.md` - System architecture overview
29
+ - `DATA_PIPELINE.md` - Data processing workflows
30
+ - `TESTING.md` - Testing patterns and strategies
31
31
  - `ADMIN_CMS_ARCHITECTURE.md` - Full CMS architecture
32
32
 
33
33
  ## Tier 3: Archive (docs/archive/)
@@ -342,3 +342,18 @@ EOF
342
342
  - Trace session lifecycle
343
343
  - Review token handling
344
344
  - Check for timing vulnerabilities
345
+
346
+ ---
347
+
348
+ ## Output Verification
349
+
350
+ **Before responding, verify your output includes ALL of these:**
351
+
352
+ - [ ] **Security Domain** - Identified domains (Auth, API, Admin, Data, Infra)
353
+ - [ ] **Threat Model Summary** - Attack surface, threat actors, attack vectors
354
+ - [ ] **Findings by Severity** - Critical, High, Medium, Low/Informational
355
+ - [ ] **Checklist Status Table** - Passed/Failed/Manual counts per domain
356
+ - [ ] **Verdict** - SECURE, WARNINGS, or ISSUES_FOUND
357
+ - [ ] **GitHub Comment** - Security review posted to issue
358
+
359
+ **DO NOT respond until all items are verified.**
@@ -151,8 +151,8 @@ if (user.role !== 'admin') throw new ForbiddenError()
151
151
 
152
152
  **Bad:**
153
153
  ```typescript
154
- const shop = await db.shops.findUnique({ where: { id: shopId } })
155
- // Missing: .eq('owner_id', user.id)
154
+ const item = await db.items.findUnique({ where: { id: itemId } })
155
+ // Missing: ownership verification (e.g., where: { id: itemId, owner_id: user.id })
156
156
  ```
157
157
 
158
158
  ### AUTHZ-4: Horizontal Privilege Escalation
@@ -174,12 +174,12 @@ const shop = await db.shops.findUnique({ where: { id: shopId } })
174
174
 
175
175
  **How to Verify:**
176
176
  ```bash
177
- grep -r "audit\|logAction\|shop_enrichment_log" lib/ app/admin/
177
+ grep -r "audit\|logAction\|createAuditLog" lib/ app/admin/
178
178
  ```
179
179
 
180
180
  **Good:**
181
181
  ```typescript
182
- await logAuditEvent({ action: 'approve_shop', actor: userId, target: shopId })
182
+ await logAuditEvent({ action: 'approve_item', actor: userId, target: itemId })
183
183
  ```
184
184
 
185
185
  ---
@@ -217,18 +217,20 @@ const { name } = req.body // No validation
217
217
 
218
218
  **How to Verify:**
219
219
  ```bash
220
- grep -r "\.from\(" lib/ app/ | grep -v "supabase"
221
220
  grep -r "raw\|execute\|query" lib/ app/
222
221
  ```
223
222
 
224
223
  **Good:**
225
224
  ```typescript
226
- supabase.from('shops').select('*').eq('id', shopId)
225
+ // Using ORM with parameterized queries
226
+ db.items.findUnique({ where: { id: itemId } })
227
+ // Or query builder with parameters
228
+ db.from('items').select('*').eq('id', itemId)
227
229
  ```
228
230
 
229
231
  **Bad:**
230
232
  ```typescript
231
- db.query(`SELECT * FROM shops WHERE id = ${shopId}`)
233
+ db.query(`SELECT * FROM items WHERE id = ${itemId}`)
232
234
  ```
233
235
 
234
236
  ### API-4: Rate Limiting
@@ -290,7 +292,7 @@ if (file.size > 5 * 1024 * 1024) throw Error
290
292
  **Requirement:** Sensitive data must be encrypted in database.
291
293
 
292
294
  **How to Verify:**
293
- - Supabase uses encryption by default
295
+ - Verify database uses encryption at rest (most cloud providers enable by default)
294
296
  - Check for additional encryption on highly sensitive fields
295
297
 
296
298
  ### DATA-2: Encryption in Transit