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
@@ -0,0 +1,261 @@
1
+ /**
2
+ * Zod schemas for structured workflow run logs
3
+ *
4
+ * These schemas define the structure of JSON logs produced by `sequant run`
5
+ * for analysis, debugging, and automation purposes.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * import { RunLogSchema, type RunLog } from './run-log-schema';
10
+ *
11
+ * // Validate a log file
12
+ * const log = RunLogSchema.parse(JSON.parse(logContent));
13
+ *
14
+ * // Type-safe access
15
+ * console.log(log.summary.passed, log.summary.failed);
16
+ * ```
17
+ */
18
+ import { z } from "zod";
19
+ /**
20
+ * Available workflow phases
21
+ */
22
+ export declare const PhaseSchema: z.ZodEnum<{
23
+ loop: "loop";
24
+ spec: "spec";
25
+ exec: "exec";
26
+ qa: "qa";
27
+ testgen: "testgen";
28
+ test: "test";
29
+ }>;
30
+ export type Phase = z.infer<typeof PhaseSchema>;
31
+ /**
32
+ * Phase execution status
33
+ */
34
+ export declare const PhaseStatusSchema: z.ZodEnum<{
35
+ timeout: "timeout";
36
+ success: "success";
37
+ failure: "failure";
38
+ skipped: "skipped";
39
+ }>;
40
+ export type PhaseStatus = z.infer<typeof PhaseStatusSchema>;
41
+ /**
42
+ * Issue execution status
43
+ */
44
+ export declare const IssueStatusSchema: z.ZodEnum<{
45
+ success: "success";
46
+ failure: "failure";
47
+ partial: "partial";
48
+ }>;
49
+ export type IssueStatus = z.infer<typeof IssueStatusSchema>;
50
+ /**
51
+ * Log entry for a single phase execution
52
+ */
53
+ export declare const PhaseLogSchema: z.ZodObject<{
54
+ phase: z.ZodEnum<{
55
+ loop: "loop";
56
+ spec: "spec";
57
+ exec: "exec";
58
+ qa: "qa";
59
+ testgen: "testgen";
60
+ test: "test";
61
+ }>;
62
+ issueNumber: z.ZodNumber;
63
+ startTime: z.ZodString;
64
+ endTime: z.ZodString;
65
+ durationSeconds: z.ZodNumber;
66
+ status: z.ZodEnum<{
67
+ timeout: "timeout";
68
+ success: "success";
69
+ failure: "failure";
70
+ skipped: "skipped";
71
+ }>;
72
+ error: z.ZodOptional<z.ZodString>;
73
+ iterations: z.ZodOptional<z.ZodNumber>;
74
+ filesModified: z.ZodOptional<z.ZodArray<z.ZodString>>;
75
+ testsRun: z.ZodOptional<z.ZodNumber>;
76
+ testsPassed: z.ZodOptional<z.ZodNumber>;
77
+ }, z.core.$strip>;
78
+ export type PhaseLog = z.infer<typeof PhaseLogSchema>;
79
+ /**
80
+ * Complete execution record for a single issue
81
+ */
82
+ export declare const IssueLogSchema: z.ZodObject<{
83
+ issueNumber: z.ZodNumber;
84
+ title: z.ZodString;
85
+ labels: z.ZodArray<z.ZodString>;
86
+ status: z.ZodEnum<{
87
+ success: "success";
88
+ failure: "failure";
89
+ partial: "partial";
90
+ }>;
91
+ phases: z.ZodArray<z.ZodObject<{
92
+ phase: z.ZodEnum<{
93
+ loop: "loop";
94
+ spec: "spec";
95
+ exec: "exec";
96
+ qa: "qa";
97
+ testgen: "testgen";
98
+ test: "test";
99
+ }>;
100
+ issueNumber: z.ZodNumber;
101
+ startTime: z.ZodString;
102
+ endTime: z.ZodString;
103
+ durationSeconds: z.ZodNumber;
104
+ status: z.ZodEnum<{
105
+ timeout: "timeout";
106
+ success: "success";
107
+ failure: "failure";
108
+ skipped: "skipped";
109
+ }>;
110
+ error: z.ZodOptional<z.ZodString>;
111
+ iterations: z.ZodOptional<z.ZodNumber>;
112
+ filesModified: z.ZodOptional<z.ZodArray<z.ZodString>>;
113
+ testsRun: z.ZodOptional<z.ZodNumber>;
114
+ testsPassed: z.ZodOptional<z.ZodNumber>;
115
+ }, z.core.$strip>>;
116
+ totalDurationSeconds: z.ZodNumber;
117
+ }, z.core.$strip>;
118
+ export type IssueLog = z.infer<typeof IssueLogSchema>;
119
+ /**
120
+ * Run configuration
121
+ */
122
+ export declare const RunConfigSchema: z.ZodObject<{
123
+ phases: z.ZodArray<z.ZodEnum<{
124
+ loop: "loop";
125
+ spec: "spec";
126
+ exec: "exec";
127
+ qa: "qa";
128
+ testgen: "testgen";
129
+ test: "test";
130
+ }>>;
131
+ sequential: z.ZodBoolean;
132
+ qualityLoop: z.ZodBoolean;
133
+ maxIterations: z.ZodNumber;
134
+ }, z.core.$strip>;
135
+ export type RunConfig = z.infer<typeof RunConfigSchema>;
136
+ /**
137
+ * Summary statistics for a run
138
+ */
139
+ export declare const RunSummarySchema: z.ZodObject<{
140
+ totalIssues: z.ZodNumber;
141
+ passed: z.ZodNumber;
142
+ failed: z.ZodNumber;
143
+ totalDurationSeconds: z.ZodNumber;
144
+ }, z.core.$strip>;
145
+ export type RunSummary = z.infer<typeof RunSummarySchema>;
146
+ /**
147
+ * Complete run log schema
148
+ *
149
+ * This is the top-level schema for a workflow run log file.
150
+ */
151
+ export declare const RunLogSchema: z.ZodObject<{
152
+ version: z.ZodLiteral<1>;
153
+ runId: z.ZodString;
154
+ startTime: z.ZodString;
155
+ endTime: z.ZodString;
156
+ config: z.ZodObject<{
157
+ phases: z.ZodArray<z.ZodEnum<{
158
+ loop: "loop";
159
+ spec: "spec";
160
+ exec: "exec";
161
+ qa: "qa";
162
+ testgen: "testgen";
163
+ test: "test";
164
+ }>>;
165
+ sequential: z.ZodBoolean;
166
+ qualityLoop: z.ZodBoolean;
167
+ maxIterations: z.ZodNumber;
168
+ }, z.core.$strip>;
169
+ issues: z.ZodArray<z.ZodObject<{
170
+ issueNumber: z.ZodNumber;
171
+ title: z.ZodString;
172
+ labels: z.ZodArray<z.ZodString>;
173
+ status: z.ZodEnum<{
174
+ success: "success";
175
+ failure: "failure";
176
+ partial: "partial";
177
+ }>;
178
+ phases: z.ZodArray<z.ZodObject<{
179
+ phase: z.ZodEnum<{
180
+ loop: "loop";
181
+ spec: "spec";
182
+ exec: "exec";
183
+ qa: "qa";
184
+ testgen: "testgen";
185
+ test: "test";
186
+ }>;
187
+ issueNumber: z.ZodNumber;
188
+ startTime: z.ZodString;
189
+ endTime: z.ZodString;
190
+ durationSeconds: z.ZodNumber;
191
+ status: z.ZodEnum<{
192
+ timeout: "timeout";
193
+ success: "success";
194
+ failure: "failure";
195
+ skipped: "skipped";
196
+ }>;
197
+ error: z.ZodOptional<z.ZodString>;
198
+ iterations: z.ZodOptional<z.ZodNumber>;
199
+ filesModified: z.ZodOptional<z.ZodArray<z.ZodString>>;
200
+ testsRun: z.ZodOptional<z.ZodNumber>;
201
+ testsPassed: z.ZodOptional<z.ZodNumber>;
202
+ }, z.core.$strip>>;
203
+ totalDurationSeconds: z.ZodNumber;
204
+ }, z.core.$strip>>;
205
+ summary: z.ZodObject<{
206
+ totalIssues: z.ZodNumber;
207
+ passed: z.ZodNumber;
208
+ failed: z.ZodNumber;
209
+ totalDurationSeconds: z.ZodNumber;
210
+ }, z.core.$strip>;
211
+ }, z.core.$strip>;
212
+ export type RunLog = z.infer<typeof RunLogSchema>;
213
+ /**
214
+ * Default log directory paths
215
+ */
216
+ export declare const LOG_PATHS: {
217
+ /** User-level logs */
218
+ readonly user: "~/.sequant/logs";
219
+ /** Project-level logs */
220
+ readonly project: ".sequant/logs";
221
+ };
222
+ /**
223
+ * Generate a log filename from run metadata
224
+ *
225
+ * @param runId - Unique run identifier
226
+ * @param startTime - Run start time
227
+ * @returns Filename in format: run-<timestamp>-<runId>.json
228
+ */
229
+ export declare function generateLogFilename(runId: string, startTime: Date): string;
230
+ /**
231
+ * Create an empty run log with initial values
232
+ *
233
+ * @param config - Run configuration
234
+ * @returns Initial RunLog structure
235
+ */
236
+ export declare function createEmptyRunLog(config: RunConfig): Omit<RunLog, "endTime">;
237
+ /**
238
+ * Create a phase log entry
239
+ *
240
+ * @param phase - Phase being executed
241
+ * @param issueNumber - GitHub issue number
242
+ * @returns PhaseLog with start time set
243
+ */
244
+ export declare function createPhaseLog(phase: Phase, issueNumber: number): Omit<PhaseLog, "endTime" | "durationSeconds" | "status">;
245
+ /**
246
+ * Complete a phase log entry
247
+ *
248
+ * @param phaseLog - Partial phase log
249
+ * @param status - Final status
250
+ * @param options - Additional fields (error, filesModified, etc.)
251
+ * @returns Complete PhaseLog
252
+ */
253
+ export declare function completePhaseLog(phaseLog: Omit<PhaseLog, "endTime" | "durationSeconds" | "status">, status: PhaseStatus, options?: Partial<Pick<PhaseLog, "error" | "iterations" | "filesModified" | "testsRun" | "testsPassed">>): PhaseLog;
254
+ /**
255
+ * Finalize a run log with summary statistics
256
+ *
257
+ * @param runLog - Partial run log
258
+ * @returns Complete RunLog with endTime and summary
259
+ */
260
+ export declare function finalizeRunLog(runLog: Omit<RunLog, "endTime">): RunLog;
261
+ //# sourceMappingURL=run-log-schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-log-schema.d.ts","sourceRoot":"","sources":["../../../../src/lib/workflow/run-log-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,eAAO,MAAM,WAAW;;;;;;;EAOtB,CAAC;AAEH,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEhD;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;EAK5B,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;EAA4C,CAAC;AAE3E,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;iBAuBzB,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD;;GAE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EAClE,MAAM,EAAE,WAAW,EACnB,OAAO,CAAC,EAAE,OAAO,CACf,IAAI,CACF,QAAQ,EACR,OAAO,GAAG,YAAY,GAAG,eAAe,GAAG,UAAU,GAAG,aAAa,CACtE,CACF,GACA,QAAQ,CAYV;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,MAAM,CAsBtE"}
@@ -0,0 +1,234 @@
1
+ /**
2
+ * Zod schemas for structured workflow run logs
3
+ *
4
+ * These schemas define the structure of JSON logs produced by `sequant run`
5
+ * for analysis, debugging, and automation purposes.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * import { RunLogSchema, type RunLog } from './run-log-schema';
10
+ *
11
+ * // Validate a log file
12
+ * const log = RunLogSchema.parse(JSON.parse(logContent));
13
+ *
14
+ * // Type-safe access
15
+ * console.log(log.summary.passed, log.summary.failed);
16
+ * ```
17
+ */
18
+ import { z } from "zod";
19
+ /**
20
+ * Available workflow phases
21
+ */
22
+ export const PhaseSchema = z.enum([
23
+ "spec",
24
+ "testgen",
25
+ "exec",
26
+ "test",
27
+ "qa",
28
+ "loop",
29
+ ]);
30
+ /**
31
+ * Phase execution status
32
+ */
33
+ export const PhaseStatusSchema = z.enum([
34
+ "success",
35
+ "failure",
36
+ "timeout",
37
+ "skipped",
38
+ ]);
39
+ /**
40
+ * Issue execution status
41
+ */
42
+ export const IssueStatusSchema = z.enum(["success", "failure", "partial"]);
43
+ /**
44
+ * Log entry for a single phase execution
45
+ */
46
+ export const PhaseLogSchema = z.object({
47
+ /** Phase that was executed */
48
+ phase: PhaseSchema,
49
+ /** GitHub issue number */
50
+ issueNumber: z.number().int().positive(),
51
+ /** When the phase started */
52
+ startTime: z.string().datetime(),
53
+ /** When the phase ended */
54
+ endTime: z.string().datetime(),
55
+ /** Duration in seconds */
56
+ durationSeconds: z.number().nonnegative(),
57
+ /** Execution result */
58
+ status: PhaseStatusSchema,
59
+ /** Error message if failed */
60
+ error: z.string().optional(),
61
+ /** Number of iterations (for loop phase) */
62
+ iterations: z.number().int().nonnegative().optional(),
63
+ /** Files modified during this phase */
64
+ filesModified: z.array(z.string()).optional(),
65
+ /** Number of tests run (for test/qa phases) */
66
+ testsRun: z.number().int().nonnegative().optional(),
67
+ /** Number of tests passed */
68
+ testsPassed: z.number().int().nonnegative().optional(),
69
+ });
70
+ /**
71
+ * Complete execution record for a single issue
72
+ */
73
+ export const IssueLogSchema = z.object({
74
+ /** GitHub issue number */
75
+ issueNumber: z.number().int().positive(),
76
+ /** Issue title */
77
+ title: z.string(),
78
+ /** Issue labels */
79
+ labels: z.array(z.string()),
80
+ /** Overall execution result */
81
+ status: IssueStatusSchema,
82
+ /** Log entries for each phase executed */
83
+ phases: z.array(PhaseLogSchema),
84
+ /** Total execution time in seconds */
85
+ totalDurationSeconds: z.number().nonnegative(),
86
+ });
87
+ /**
88
+ * Run configuration
89
+ */
90
+ export const RunConfigSchema = z.object({
91
+ /** Phases that were configured to run */
92
+ phases: z.array(PhaseSchema),
93
+ /** Whether issues were run sequentially */
94
+ sequential: z.boolean(),
95
+ /** Whether quality loop was enabled */
96
+ qualityLoop: z.boolean(),
97
+ /** Maximum iterations for fix loops */
98
+ maxIterations: z.number().int().positive(),
99
+ });
100
+ /**
101
+ * Summary statistics for a run
102
+ */
103
+ export const RunSummarySchema = z.object({
104
+ /** Total number of issues processed */
105
+ totalIssues: z.number().int().nonnegative(),
106
+ /** Number of issues that passed */
107
+ passed: z.number().int().nonnegative(),
108
+ /** Number of issues that failed */
109
+ failed: z.number().int().nonnegative(),
110
+ /** Total execution time in seconds */
111
+ totalDurationSeconds: z.number().nonnegative(),
112
+ });
113
+ /**
114
+ * Complete run log schema
115
+ *
116
+ * This is the top-level schema for a workflow run log file.
117
+ */
118
+ export const RunLogSchema = z.object({
119
+ /** Schema version for backwards compatibility */
120
+ version: z.literal(1),
121
+ /** Unique identifier for this run */
122
+ runId: z.string().uuid(),
123
+ /** When the run started */
124
+ startTime: z.string().datetime(),
125
+ /** When the run ended */
126
+ endTime: z.string().datetime(),
127
+ /** Run configuration */
128
+ config: RunConfigSchema,
129
+ /** Execution logs for each issue */
130
+ issues: z.array(IssueLogSchema),
131
+ /** Summary statistics */
132
+ summary: RunSummarySchema,
133
+ });
134
+ /**
135
+ * Default log directory paths
136
+ */
137
+ export const LOG_PATHS = {
138
+ /** User-level logs */
139
+ user: "~/.sequant/logs",
140
+ /** Project-level logs */
141
+ project: ".sequant/logs",
142
+ };
143
+ /**
144
+ * Generate a log filename from run metadata
145
+ *
146
+ * @param runId - Unique run identifier
147
+ * @param startTime - Run start time
148
+ * @returns Filename in format: run-<timestamp>-<runId>.json
149
+ */
150
+ export function generateLogFilename(runId, startTime) {
151
+ const timestamp = startTime.toISOString().replace(/[:.]/g, "-").slice(0, 19);
152
+ return `run-${timestamp}-${runId}.json`;
153
+ }
154
+ /**
155
+ * Create an empty run log with initial values
156
+ *
157
+ * @param config - Run configuration
158
+ * @returns Initial RunLog structure
159
+ */
160
+ export function createEmptyRunLog(config) {
161
+ const runId = crypto.randomUUID();
162
+ const startTime = new Date().toISOString();
163
+ return {
164
+ version: 1,
165
+ runId,
166
+ startTime,
167
+ config,
168
+ issues: [],
169
+ summary: {
170
+ totalIssues: 0,
171
+ passed: 0,
172
+ failed: 0,
173
+ totalDurationSeconds: 0,
174
+ },
175
+ };
176
+ }
177
+ /**
178
+ * Create a phase log entry
179
+ *
180
+ * @param phase - Phase being executed
181
+ * @param issueNumber - GitHub issue number
182
+ * @returns PhaseLog with start time set
183
+ */
184
+ export function createPhaseLog(phase, issueNumber) {
185
+ return {
186
+ phase,
187
+ issueNumber,
188
+ startTime: new Date().toISOString(),
189
+ };
190
+ }
191
+ /**
192
+ * Complete a phase log entry
193
+ *
194
+ * @param phaseLog - Partial phase log
195
+ * @param status - Final status
196
+ * @param options - Additional fields (error, filesModified, etc.)
197
+ * @returns Complete PhaseLog
198
+ */
199
+ export function completePhaseLog(phaseLog, status, options) {
200
+ const endTime = new Date();
201
+ const startTime = new Date(phaseLog.startTime);
202
+ const durationSeconds = (endTime.getTime() - startTime.getTime()) / 1000;
203
+ return {
204
+ ...phaseLog,
205
+ endTime: endTime.toISOString(),
206
+ durationSeconds,
207
+ status,
208
+ ...options,
209
+ };
210
+ }
211
+ /**
212
+ * Finalize a run log with summary statistics
213
+ *
214
+ * @param runLog - Partial run log
215
+ * @returns Complete RunLog with endTime and summary
216
+ */
217
+ export function finalizeRunLog(runLog) {
218
+ const endTime = new Date();
219
+ const startTime = new Date(runLog.startTime);
220
+ const totalDurationSeconds = (endTime.getTime() - startTime.getTime()) / 1000;
221
+ const passed = runLog.issues.filter((i) => i.status === "success").length;
222
+ const failed = runLog.issues.filter((i) => i.status === "failure").length;
223
+ return {
224
+ ...runLog,
225
+ endTime: endTime.toISOString(),
226
+ summary: {
227
+ totalIssues: runLog.issues.length,
228
+ passed,
229
+ failed,
230
+ totalDurationSeconds,
231
+ },
232
+ };
233
+ }
234
+ //# sourceMappingURL=run-log-schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-log-schema.js","sourceRoot":"","sources":["../../../../src/lib/workflow/run-log-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,IAAI,CAAC;IAChC,MAAM;IACN,SAAS;IACT,MAAM;IACN,MAAM;IACN,IAAI;IACJ,MAAM;CACP,CAAC,CAAC;AAIH;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,IAAI,CAAC;IACtC,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;CACV,CAAC,CAAC;AAIH;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,SAAS,EA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C,CAAC,MAAM,CAAC;IAET,OAAO;QACL,GAAG,MAAM;QACT,OAAO,EAAE,OAAO,CAAC,WAAW,EAAE;QAC9B,OAAO,EAAE;YACP,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM;YACjC,MAAM;YACN,MAAM;YACN,oBAAoB;SACrB;KACF,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sequant",
3
- "version": "1.0.0",
3
+ "version": "1.1.1",
4
4
  "description": "Quantize your development workflow - Sequential AI phases with quality gates",
5
5
  "type": "module",
6
6
  "bin": {
@@ -22,7 +22,7 @@
22
22
  "scripts": {
23
23
  "build": "tsc",
24
24
  "dev": "tsx bin/cli.ts",
25
- "test": "echo \"No tests yet\" && exit 0",
25
+ "test": "vitest run",
26
26
  "lint": "echo \"No linter configured yet\" && exit 0",
27
27
  "validate:skills": "for skill in templates/skills/*/; do npx skills-ref validate \"$skill\"; done",
28
28
  "prepublishOnly": "npm run build"
@@ -57,13 +57,15 @@
57
57
  "commander": "^12.1.0",
58
58
  "diff": "^7.0.0",
59
59
  "inquirer": "^12.3.2",
60
- "yaml": "^2.7.0"
60
+ "yaml": "^2.7.0",
61
+ "zod": "^4.3.5"
61
62
  },
62
63
  "devDependencies": {
63
64
  "@types/diff": "^7.0.0",
64
65
  "@types/inquirer": "^9.0.7",
65
66
  "@types/node": "^22.10.5",
66
67
  "tsx": "^4.19.2",
67
- "typescript": "^5.7.2"
68
+ "typescript": "^5.7.2",
69
+ "vitest": "^3.2.4"
68
70
  }
69
71
  }
@@ -0,0 +1,35 @@
1
+ name: astro
2
+ displayName: Astro
3
+ description: The web framework for content-driven websites
4
+
5
+ detection:
6
+ files:
7
+ - astro.config.mjs
8
+ - astro.config.js
9
+ - astro.config.ts
10
+ packageDeps:
11
+ - astro
12
+
13
+ commands:
14
+ test: npm test
15
+ build: npm run build
16
+ lint: npm run lint
17
+ dev: npm run dev
18
+
19
+ variables:
20
+ TEST_COMMAND: npm test
21
+ BUILD_COMMAND: npm run build
22
+ LINT_COMMAND: npm run lint
23
+
24
+ patterns:
25
+ pages: src/pages/**/*.astro
26
+ components: src/components/**/*.astro
27
+ layouts: src/layouts/**/*.astro
28
+ content: src/content/**/*.{md,mdx}
29
+
30
+ notes: |
31
+ Astro projects may not have test or lint scripts by default.
32
+ Recommended setup:
33
+ - Testing: npm install -D vitest
34
+ - Linting: npm install -D eslint eslint-plugin-astro
35
+ Build output defaults to dist/
@@ -180,17 +180,6 @@ elif [[ "$TOOL_NAME" == "Edit" || "$TOOL_NAME" == "Write" ]]; then
180
180
  fi
181
181
  fi
182
182
 
183
- # === LOG SUPABASE QUERIES ===
184
- if [[ "$TOOL_NAME" == "mcp__supabase__execute_sql" ]]; then
185
- # Extract SQL query with jq or fallback
186
- if command -v jq &>/dev/null; then
187
- QUERY=$(echo "$TOOL_INPUT" | jq -r '.query // empty' 2>/dev/null | head -c 200)
188
- else
189
- QUERY=$(echo "$TOOL_INPUT" | head -c 200)
190
- fi
191
- echo "$(date +%H:%M:%S) SQL: $QUERY" >> "$QUALITY_LOG"
192
- fi
193
-
194
183
  # === TRACK GIT OPERATIONS ===
195
184
  if [[ "$TOOL_NAME" == "Bash" ]]; then
196
185
  if echo "$TOOL_INPUT" | grep -qE 'git (commit|push|pr create)'; then
@@ -1,6 +1,6 @@
1
1
  #!/bin/bash
2
2
  # Pre-tool hook for Claude Code
3
- # - Security guardrails for execute-issues.ts (blocks catastrophic commands)
3
+ # - Security guardrails (blocks catastrophic commands)
4
4
  # - Timing instrumentation for performance analysis
5
5
  # Exit 0 = allow, Exit 2 = block (Exit 1 = non-blocking error, logged but not blocked)
6
6
 
@@ -346,5 +346,5 @@ if [[ "${CLAUDE_HOOKS_FILE_LOCKING:-true}" == "true" ]]; then
346
346
  fi
347
347
 
348
348
  # === ALLOW EVERYTHING ELSE ===
349
- # Slash commands need: git, npm, file edits, gh pr/issue, supabase queries
349
+ # Slash commands need: git, npm, file edits, gh pr/issue, MCP tools
350
350
  exit 0
@@ -54,6 +54,14 @@ This document defines the core principles and patterns for AI-assisted developme
54
54
  | `/loop` | Fix iteration when tests fail |
55
55
  | `/docs` | Generate feature documentation |
56
56
 
57
+ ## Stack-Specific Notes
58
+
59
+ ### Astro Projects
60
+ - Astro projects may not have `test` or `lint` scripts configured by default
61
+ - If tests are needed, consider adding Vitest (`npm install -D vitest`)
62
+ - For linting, consider ESLint with the Astro plugin (`npm install -D eslint eslint-plugin-astro`)
63
+ - Build output goes to `dist/` by default
64
+
57
65
  ## Project-Specific Notes
58
66
 
59
67
  <!-- Add your project-specific guidelines below -->
@@ -2,7 +2,7 @@
2
2
 
3
3
  # Clean up a worktree after PR is merged
4
4
  # Usage: ./scripts/cleanup-worktree.sh <branch-name>
5
- # Example: ./scripts/cleanup-worktree.sh feature/4-build-shop-detail-pages
5
+ # Example: ./scripts/cleanup-worktree.sh feature/123-add-user-dashboard
6
6
 
7
7
  set -e
8
8
 
@@ -121,11 +121,13 @@ git worktree add "$WORKTREE_DIR" -b "$BRANCH_NAME"
121
121
  # Navigate to worktree
122
122
  cd "$WORKTREE_DIR"
123
123
 
124
- # Copy .env.local if it exists (use absolute path from main repo)
125
- if [ -f "${MAIN_REPO_DIR}/.env.local" ]; then
126
- echo -e "${BLUE}📋 Copying .env.local...${NC}"
127
- cp "${MAIN_REPO_DIR}/.env.local" .env.local
128
- fi
124
+ # Copy environment files if they exist (use absolute path from main repo)
125
+ for ENV_FILE in .env .env.local .env.development; do
126
+ if [ -f "${MAIN_REPO_DIR}/${ENV_FILE}" ]; then
127
+ echo -e "${BLUE}📋 Copying ${ENV_FILE}...${NC}"
128
+ cp "${MAIN_REPO_DIR}/${ENV_FILE}" "${ENV_FILE}"
129
+ fi
130
+ done
129
131
 
130
132
  # Copy .claude/settings.local.json for auto-approved permissions
131
133
  if [ -f "${MAIN_REPO_DIR}/.claude/settings.local.json" ]; then