sequant 1.1.0 → 1.1.2

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 (64) hide show
  1. package/dist/bin/cli.js +21 -3
  2. package/dist/bin/cli.js.map +1 -1
  3. package/dist/src/commands/doctor.d.ts.map +1 -1
  4. package/dist/src/commands/doctor.js +1 -25
  5. package/dist/src/commands/doctor.js.map +1 -1
  6. package/dist/src/commands/doctor.test.js +28 -97
  7. package/dist/src/commands/doctor.test.js.map +1 -1
  8. package/dist/src/commands/init.d.ts.map +1 -1
  9. package/dist/src/commands/init.js +3 -27
  10. package/dist/src/commands/init.js.map +1 -1
  11. package/dist/src/commands/init.test.js +32 -75
  12. package/dist/src/commands/init.test.js.map +1 -1
  13. package/dist/src/commands/logs.d.ts +18 -0
  14. package/dist/src/commands/logs.d.ts.map +1 -0
  15. package/dist/src/commands/logs.js +188 -0
  16. package/dist/src/commands/logs.js.map +1 -0
  17. package/dist/src/commands/run.d.ts +10 -1
  18. package/dist/src/commands/run.d.ts.map +1 -1
  19. package/dist/src/commands/run.js +429 -98
  20. package/dist/src/commands/run.js.map +1 -1
  21. package/dist/src/commands/update.d.ts.map +1 -1
  22. package/dist/src/commands/update.js +16 -0
  23. package/dist/src/commands/update.js.map +1 -1
  24. package/dist/src/lib/system.d.ts +16 -0
  25. package/dist/src/lib/system.d.ts.map +1 -0
  26. package/dist/src/lib/system.js +52 -0
  27. package/dist/src/lib/system.js.map +1 -0
  28. package/dist/src/lib/system.test.d.ts +2 -0
  29. package/dist/src/lib/system.test.d.ts.map +1 -0
  30. package/dist/src/lib/system.test.js +80 -0
  31. package/dist/src/lib/system.test.js.map +1 -0
  32. package/dist/src/lib/workflow/log-writer.d.ts +83 -0
  33. package/dist/src/lib/workflow/log-writer.d.ts.map +1 -0
  34. package/dist/src/lib/workflow/log-writer.js +193 -0
  35. package/dist/src/lib/workflow/log-writer.js.map +1 -0
  36. package/dist/src/lib/workflow/log-writer.test.d.ts +7 -0
  37. package/dist/src/lib/workflow/log-writer.test.d.ts.map +1 -0
  38. package/dist/src/lib/workflow/log-writer.test.js +451 -0
  39. package/dist/src/lib/workflow/log-writer.test.js.map +1 -0
  40. package/dist/src/lib/workflow/run-log-schema.d.ts +261 -0
  41. package/dist/src/lib/workflow/run-log-schema.d.ts.map +1 -0
  42. package/dist/src/lib/workflow/run-log-schema.js +234 -0
  43. package/dist/src/lib/workflow/run-log-schema.js.map +1 -0
  44. package/dist/src/lib/workflow/run-log-schema.test.d.ts +2 -0
  45. package/dist/src/lib/workflow/run-log-schema.test.d.ts.map +1 -0
  46. package/dist/src/lib/workflow/run-log-schema.test.js +455 -0
  47. package/dist/src/lib/workflow/run-log-schema.test.js.map +1 -0
  48. package/package.json +4 -2
  49. package/templates/hooks/pre-tool.sh +14 -2
  50. package/templates/scripts/cleanup-worktree.sh +23 -1
  51. package/templates/skills/assess/SKILL.md +15 -0
  52. package/templates/skills/clean/SKILL.md +15 -0
  53. package/templates/skills/docs/SKILL.md +16 -0
  54. package/templates/skills/exec/SKILL.md +32 -0
  55. package/templates/skills/fullsolve/SKILL.md +42 -0
  56. package/templates/skills/loop/SKILL.md +14 -0
  57. package/templates/skills/qa/SKILL.md +67 -0
  58. package/templates/skills/reflect/SKILL.md +14 -0
  59. package/templates/skills/security-review/SKILL.md +15 -0
  60. package/templates/skills/solve/SKILL.md +44 -0
  61. package/templates/skills/spec/SKILL.md +59 -0
  62. package/templates/skills/test/SKILL.md +14 -0
  63. package/templates/skills/testgen/SKILL.md +15 -0
  64. package/templates/skills/verify/SKILL.md +15 -0
@@ -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;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAazB,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;iBAS1B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;iBAS3B,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D;;;;GAIG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAevB,CAAC;AAEH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAElD;;GAEG;AACH,eAAO,MAAM,SAAS;IACpB,sBAAsB;;IAEtB,yBAAyB;;CAEjB,CAAC;AAEX;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,GAAG,MAAM,CAG1E;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC,CAiB5E;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,MAAM,GAClB,IAAI,CAAC,QAAQ,EAAE,SAAS,GAAG,iBAAiB,GAAG,QAAQ,CAAC,CAM1D;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,SAAS,GAAG,iBAAiB,GAAG,QAAQ,CAAC,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,EAAE,SAAS,CAAC,CAAC,CAAC;AAI3E;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,8BAA8B;IAC9B,KAAK,EAAE,WAAW;IAClB,0BAA0B;IAC1B,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACxC,6BAA6B;IAC7B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,2BAA2B;IAC3B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,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AAI,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC/C,MAAM,eAAe,GAAG,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,SAAS,CAAC,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC;IAEzE,OAAO;QACL,GAAG,QAAQ;QACX,OAAO,EAAE,OAAO,CAAC,WAAW,EAAE;QAC9B,eAAe;QACf,MAAM;QACN,GAAG,OAAO;KACX,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,MAA+B;IAC5D,MAAM,OAAO,GAAG,IAAI,IAAI,EAAE,CAAC;IAC3B,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAC7C,MAAM,oBAAoB,GAAG,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,SAAS,CAAC,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC;IAE9E,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CACjC,CAAC,CAAW,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,SAAS,CACxC,CAAC,MAAM,CAAC;IACT,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CACjC,CAAC,CAAW,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,SAAS,CACxC,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"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=run-log-schema.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-log-schema.test.d.ts","sourceRoot":"","sources":["../../../../src/lib/workflow/run-log-schema.test.ts"],"names":[],"mappings":""}