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,165 +0,0 @@
1
- /**
2
- * Workflow Analytics SQL Queries
3
- *
4
- * Use with Supabase MCP's execute_sql for /reflect workflow analysis.
5
- * The workflow_runs table stores phase completion data with duration, verdict, and errors.
6
- */
7
-
8
- export const WORKFLOW_QUERIES = {
9
- /**
10
- * Success rate by phase (last 30 days)
11
- */
12
- successRateByPhase: `
13
- SELECT
14
- phase,
15
- COUNT(*) as total_runs,
16
- COUNT(*) FILTER (WHERE status = 'completed' AND verdict IN ('pass', 'pass_with_notes')) as successful,
17
- ROUND(COUNT(*) FILTER (WHERE status = 'completed' AND verdict IN ('pass', 'pass_with_notes')) * 100.0 / NULLIF(COUNT(*), 0), 1) as success_rate,
18
- ROUND(AVG(duration_seconds) FILTER (WHERE status = 'completed'), 0) as avg_duration_sec
19
- FROM workflow_runs
20
- WHERE started_at > now() - INTERVAL '30 days'
21
- GROUP BY phase
22
- ORDER BY phase;
23
- `,
24
-
25
- /**
26
- * Most common error categories
27
- */
28
- errorCategories: `
29
- SELECT
30
- error_category,
31
- COUNT(*) as occurrences,
32
- ROUND(COUNT(*) * 100.0 / (SELECT COUNT(*) FROM workflow_runs WHERE error_category IS NOT NULL), 1) as percentage
33
- FROM workflow_runs
34
- WHERE error_category IS NOT NULL
35
- AND started_at > now() - INTERVAL '30 days'
36
- GROUP BY error_category
37
- ORDER BY occurrences DESC
38
- LIMIT 10;
39
- `,
40
-
41
- /**
42
- * Issues requiring most loop iterations
43
- */
44
- highIterationIssues: `
45
- SELECT
46
- issue_number,
47
- COUNT(*) as total_loop_runs,
48
- MAX(iteration_number) as max_iterations_used,
49
- COUNT(*) FILTER (WHERE verdict = 'pass') as eventually_passed
50
- FROM workflow_runs
51
- WHERE retry_type = 'loop'
52
- AND started_at > now() - INTERVAL '30 days'
53
- GROUP BY issue_number
54
- ORDER BY total_loop_runs DESC
55
- LIMIT 10;
56
- `,
57
-
58
- /**
59
- * /exec verification failure rate
60
- */
61
- execVerificationRate: `
62
- SELECT
63
- verification_result,
64
- COUNT(*) as occurrences,
65
- ROUND(COUNT(*) * 100.0 / (SELECT COUNT(*) FROM workflow_runs WHERE phase = 'exec' AND verification_result IS NOT NULL), 1) as percentage
66
- FROM workflow_runs
67
- WHERE phase = 'exec'
68
- AND verification_result IS NOT NULL
69
- AND started_at > now() - INTERVAL '30 days'
70
- GROUP BY verification_result
71
- ORDER BY occurrences DESC;
72
- `,
73
-
74
- /**
75
- * Average time to completion by issue labels
76
- */
77
- durationByLabel: `
78
- SELECT
79
- unnest(labels) as label,
80
- COUNT(*) as issues_with_label,
81
- ROUND(AVG(duration_seconds) FILTER (WHERE status = 'completed'), 0) as avg_duration_sec
82
- FROM workflow_runs
83
- WHERE phase = 'exec'
84
- AND status = 'completed'
85
- AND labels IS NOT NULL
86
- AND started_at > now() - INTERVAL '30 days'
87
- GROUP BY label
88
- HAVING COUNT(*) > 2
89
- ORDER BY avg_duration_sec DESC;
90
- `,
91
-
92
- /**
93
- * Daily workflow volume (trend analysis)
94
- */
95
- dailyVolume: `
96
- SELECT
97
- DATE(started_at) as date,
98
- COUNT(*) as total_runs,
99
- COUNT(*) FILTER (WHERE verdict IN ('pass', 'pass_with_notes')) as passed,
100
- COUNT(*) FILTER (WHERE verdict = 'fail') as failed
101
- FROM workflow_runs
102
- WHERE started_at > now() - INTERVAL '14 days'
103
- GROUP BY DATE(started_at)
104
- ORDER BY date DESC;
105
- `,
106
- };
107
-
108
- /**
109
- * Example usage in /reflect workflow:
110
- *
111
- * 1. Run the analysis script (preferred):
112
- * npx tsx --env-file=.env.local scripts/dev/analyze-workflow-patterns.ts --days 7 --skip-issue-creation
113
- *
114
- * 2. Or run queries individually via Supabase MCP:
115
- * mcp__supabase__execute_sql({ query: WORKFLOW_QUERIES.successRateByPhase })
116
- */
117
-
118
- export function formatWorkflowReport(results: {
119
- successRates: Array<{
120
- phase: string;
121
- success_rate: number;
122
- total_runs: number;
123
- }>;
124
- errorCategories: Array<{ error_category: string; occurrences: number }>;
125
- highIterationIssues: Array<{
126
- issue_number: number;
127
- total_loop_runs: number;
128
- eventually_passed: number;
129
- }>;
130
- }): string {
131
- const lines: string[] = [];
132
-
133
- lines.push("📊 Workflow Analysis (Last 7 days)");
134
- lines.push("");
135
- lines.push("Success Rates:");
136
-
137
- for (const row of results.successRates) {
138
- const passCount = Math.round((row.total_runs * row.success_rate) / 100);
139
- lines.push(
140
- ` /${row.phase}: ${row.success_rate}% (${passCount}/${row.total_runs})`,
141
- );
142
- }
143
-
144
- lines.push("");
145
- lines.push("Top Failure Categories:");
146
-
147
- for (let i = 0; i < Math.min(results.errorCategories.length, 5); i++) {
148
- const row = results.errorCategories[i];
149
- lines.push(
150
- ` ${i + 1}. ${row.error_category} (${row.occurrences} occurrences)`,
151
- );
152
- }
153
-
154
- lines.push("");
155
- lines.push("Issues Requiring Most Retries:");
156
-
157
- for (const row of results.highIterationIssues.slice(0, 5)) {
158
- const status = row.eventually_passed > 0 ? "passed" : "failed";
159
- lines.push(
160
- ` #${row.issue_number} - ${row.total_loop_runs} iterations (${status})`,
161
- );
162
- }
163
-
164
- return lines.join("\n");
165
- }