ndrstnd 0.1.2 → 0.2.0
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.
- package/CHANGELOG.md +41 -0
- package/README.md +6 -0
- package/dist/server/analysis-core.js +173 -21
- package/dist/server/analysis-core.js.map +1 -1
- package/dist/server/analyze.d.ts +13 -0
- package/dist/server/analyze.js +102 -28
- package/dist/server/analyze.js.map +1 -1
- package/dist/server/cli.js +39 -10
- package/dist/server/cli.js.map +1 -1
- package/dist/server/diagnostic.d.ts +34 -0
- package/dist/server/diagnostic.js +155 -0
- package/dist/server/diagnostic.js.map +1 -0
- package/dist/shared/diagnostic-schema.d.ts +572 -0
- package/dist/shared/diagnostic-schema.js +83 -0
- package/dist/shared/diagnostic-schema.js.map +1 -0
- package/package.json +3 -2
- package/src/skill-assets/ndrstnd/SKILL.md +4 -3
|
@@ -0,0 +1,572 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const DIAGNOSTIC_ARTIFACT_VERSION = 1;
|
|
3
|
+
declare const TextMetadataSchema: z.ZodObject<{
|
|
4
|
+
length: z.ZodNumber;
|
|
5
|
+
sha256: z.ZodString;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
length: number;
|
|
8
|
+
sha256: string;
|
|
9
|
+
}, {
|
|
10
|
+
length: number;
|
|
11
|
+
sha256: string;
|
|
12
|
+
}>;
|
|
13
|
+
export type DiagnosticTextMetadata = z.infer<typeof TextMetadataSchema>;
|
|
14
|
+
declare const ResponseMetadataSchema: z.ZodObject<{
|
|
15
|
+
length: z.ZodNumber;
|
|
16
|
+
sha256: z.ZodString;
|
|
17
|
+
} & {
|
|
18
|
+
extractedLength: z.ZodNumber;
|
|
19
|
+
extractedSha256: z.ZodString;
|
|
20
|
+
fenced: z.ZodBoolean;
|
|
21
|
+
candidateStartsWithObject: z.ZodBoolean;
|
|
22
|
+
}, "strip", z.ZodTypeAny, {
|
|
23
|
+
length: number;
|
|
24
|
+
sha256: string;
|
|
25
|
+
extractedLength: number;
|
|
26
|
+
extractedSha256: string;
|
|
27
|
+
fenced: boolean;
|
|
28
|
+
candidateStartsWithObject: boolean;
|
|
29
|
+
}, {
|
|
30
|
+
length: number;
|
|
31
|
+
sha256: string;
|
|
32
|
+
extractedLength: number;
|
|
33
|
+
extractedSha256: string;
|
|
34
|
+
fenced: boolean;
|
|
35
|
+
candidateStartsWithObject: boolean;
|
|
36
|
+
}>;
|
|
37
|
+
export type DiagnosticResponseMetadata = z.infer<typeof ResponseMetadataSchema>;
|
|
38
|
+
declare const ActivitySchema: z.ZodObject<{
|
|
39
|
+
label: z.ZodString;
|
|
40
|
+
notifications: z.ZodNumber;
|
|
41
|
+
draftCharacters: z.ZodNumber;
|
|
42
|
+
}, "strip", z.ZodTypeAny, {
|
|
43
|
+
label: string;
|
|
44
|
+
notifications: number;
|
|
45
|
+
draftCharacters: number;
|
|
46
|
+
}, {
|
|
47
|
+
label: string;
|
|
48
|
+
notifications: number;
|
|
49
|
+
draftCharacters: number;
|
|
50
|
+
}>;
|
|
51
|
+
export type DiagnosticActivity = z.infer<typeof ActivitySchema>;
|
|
52
|
+
declare const ValidationSchema: z.ZodObject<{
|
|
53
|
+
phase: z.ZodEnum<["json-parsing", "wire-validation", "review-validation"]>;
|
|
54
|
+
message: z.ZodString;
|
|
55
|
+
}, "strip", z.ZodTypeAny, {
|
|
56
|
+
message: string;
|
|
57
|
+
phase: "json-parsing" | "wire-validation" | "review-validation";
|
|
58
|
+
}, {
|
|
59
|
+
message: string;
|
|
60
|
+
phase: "json-parsing" | "wire-validation" | "review-validation";
|
|
61
|
+
}>;
|
|
62
|
+
export type DiagnosticValidation = z.infer<typeof ValidationSchema>;
|
|
63
|
+
declare const DiagnosticAttemptSchema: z.ZodObject<{
|
|
64
|
+
kind: z.ZodEnum<["initial", "repair"]>;
|
|
65
|
+
durationMs: z.ZodNumber;
|
|
66
|
+
prompt: z.ZodObject<{
|
|
67
|
+
length: z.ZodNumber;
|
|
68
|
+
sha256: z.ZodString;
|
|
69
|
+
}, "strip", z.ZodTypeAny, {
|
|
70
|
+
length: number;
|
|
71
|
+
sha256: string;
|
|
72
|
+
}, {
|
|
73
|
+
length: number;
|
|
74
|
+
sha256: string;
|
|
75
|
+
}>;
|
|
76
|
+
response: z.ZodOptional<z.ZodObject<{
|
|
77
|
+
length: z.ZodNumber;
|
|
78
|
+
sha256: z.ZodString;
|
|
79
|
+
} & {
|
|
80
|
+
extractedLength: z.ZodNumber;
|
|
81
|
+
extractedSha256: z.ZodString;
|
|
82
|
+
fenced: z.ZodBoolean;
|
|
83
|
+
candidateStartsWithObject: z.ZodBoolean;
|
|
84
|
+
}, "strip", z.ZodTypeAny, {
|
|
85
|
+
length: number;
|
|
86
|
+
sha256: string;
|
|
87
|
+
extractedLength: number;
|
|
88
|
+
extractedSha256: string;
|
|
89
|
+
fenced: boolean;
|
|
90
|
+
candidateStartsWithObject: boolean;
|
|
91
|
+
}, {
|
|
92
|
+
length: number;
|
|
93
|
+
sha256: string;
|
|
94
|
+
extractedLength: number;
|
|
95
|
+
extractedSha256: string;
|
|
96
|
+
fenced: boolean;
|
|
97
|
+
candidateStartsWithObject: boolean;
|
|
98
|
+
}>>;
|
|
99
|
+
activity: z.ZodOptional<z.ZodObject<{
|
|
100
|
+
label: z.ZodString;
|
|
101
|
+
notifications: z.ZodNumber;
|
|
102
|
+
draftCharacters: z.ZodNumber;
|
|
103
|
+
}, "strip", z.ZodTypeAny, {
|
|
104
|
+
label: string;
|
|
105
|
+
notifications: number;
|
|
106
|
+
draftCharacters: number;
|
|
107
|
+
}, {
|
|
108
|
+
label: string;
|
|
109
|
+
notifications: number;
|
|
110
|
+
draftCharacters: number;
|
|
111
|
+
}>>;
|
|
112
|
+
validation: z.ZodOptional<z.ZodObject<{
|
|
113
|
+
phase: z.ZodEnum<["json-parsing", "wire-validation", "review-validation"]>;
|
|
114
|
+
message: z.ZodString;
|
|
115
|
+
}, "strip", z.ZodTypeAny, {
|
|
116
|
+
message: string;
|
|
117
|
+
phase: "json-parsing" | "wire-validation" | "review-validation";
|
|
118
|
+
}, {
|
|
119
|
+
message: string;
|
|
120
|
+
phase: "json-parsing" | "wire-validation" | "review-validation";
|
|
121
|
+
}>>;
|
|
122
|
+
error: z.ZodOptional<z.ZodString>;
|
|
123
|
+
}, "strip", z.ZodTypeAny, {
|
|
124
|
+
kind: "initial" | "repair";
|
|
125
|
+
durationMs: number;
|
|
126
|
+
prompt: {
|
|
127
|
+
length: number;
|
|
128
|
+
sha256: string;
|
|
129
|
+
};
|
|
130
|
+
error?: string | undefined;
|
|
131
|
+
validation?: {
|
|
132
|
+
message: string;
|
|
133
|
+
phase: "json-parsing" | "wire-validation" | "review-validation";
|
|
134
|
+
} | undefined;
|
|
135
|
+
response?: {
|
|
136
|
+
length: number;
|
|
137
|
+
sha256: string;
|
|
138
|
+
extractedLength: number;
|
|
139
|
+
extractedSha256: string;
|
|
140
|
+
fenced: boolean;
|
|
141
|
+
candidateStartsWithObject: boolean;
|
|
142
|
+
} | undefined;
|
|
143
|
+
activity?: {
|
|
144
|
+
label: string;
|
|
145
|
+
notifications: number;
|
|
146
|
+
draftCharacters: number;
|
|
147
|
+
} | undefined;
|
|
148
|
+
}, {
|
|
149
|
+
kind: "initial" | "repair";
|
|
150
|
+
durationMs: number;
|
|
151
|
+
prompt: {
|
|
152
|
+
length: number;
|
|
153
|
+
sha256: string;
|
|
154
|
+
};
|
|
155
|
+
error?: string | undefined;
|
|
156
|
+
validation?: {
|
|
157
|
+
message: string;
|
|
158
|
+
phase: "json-parsing" | "wire-validation" | "review-validation";
|
|
159
|
+
} | undefined;
|
|
160
|
+
response?: {
|
|
161
|
+
length: number;
|
|
162
|
+
sha256: string;
|
|
163
|
+
extractedLength: number;
|
|
164
|
+
extractedSha256: string;
|
|
165
|
+
fenced: boolean;
|
|
166
|
+
candidateStartsWithObject: boolean;
|
|
167
|
+
} | undefined;
|
|
168
|
+
activity?: {
|
|
169
|
+
label: string;
|
|
170
|
+
notifications: number;
|
|
171
|
+
draftCharacters: number;
|
|
172
|
+
} | undefined;
|
|
173
|
+
}>;
|
|
174
|
+
export declare const DiagnosticArtifactSchema: z.ZodObject<{
|
|
175
|
+
kind: z.ZodLiteral<"ndrstnd-analysis-diagnostic">;
|
|
176
|
+
version: z.ZodLiteral<1>;
|
|
177
|
+
createdAt: z.ZodString;
|
|
178
|
+
tool: z.ZodObject<{
|
|
179
|
+
version: z.ZodString;
|
|
180
|
+
node: z.ZodString;
|
|
181
|
+
platform: z.ZodString;
|
|
182
|
+
arch: z.ZodString;
|
|
183
|
+
}, "strip", z.ZodTypeAny, {
|
|
184
|
+
version: string;
|
|
185
|
+
node: string;
|
|
186
|
+
platform: string;
|
|
187
|
+
arch: string;
|
|
188
|
+
}, {
|
|
189
|
+
version: string;
|
|
190
|
+
node: string;
|
|
191
|
+
platform: string;
|
|
192
|
+
arch: string;
|
|
193
|
+
}>;
|
|
194
|
+
command: z.ZodObject<{
|
|
195
|
+
name: z.ZodLiteral<"review">;
|
|
196
|
+
args: z.ZodArray<z.ZodString, "many">;
|
|
197
|
+
}, "strip", z.ZodTypeAny, {
|
|
198
|
+
name: "review";
|
|
199
|
+
args: string[];
|
|
200
|
+
}, {
|
|
201
|
+
name: "review";
|
|
202
|
+
args: string[];
|
|
203
|
+
}>;
|
|
204
|
+
agent: z.ZodOptional<z.ZodObject<{
|
|
205
|
+
id: z.ZodEnum<["codex", "claude"]>;
|
|
206
|
+
name: z.ZodString;
|
|
207
|
+
command: z.ZodString;
|
|
208
|
+
}, "strip", z.ZodTypeAny, {
|
|
209
|
+
command: string;
|
|
210
|
+
id: "codex" | "claude";
|
|
211
|
+
name: string;
|
|
212
|
+
}, {
|
|
213
|
+
command: string;
|
|
214
|
+
id: "codex" | "claude";
|
|
215
|
+
name: string;
|
|
216
|
+
}>>;
|
|
217
|
+
scope: z.ZodOptional<z.ZodObject<{
|
|
218
|
+
repoPath: z.ZodString;
|
|
219
|
+
targetRef: z.ZodString;
|
|
220
|
+
baseRef: z.ZodString;
|
|
221
|
+
mergeBase: z.ZodString;
|
|
222
|
+
includesWorkingTree: z.ZodBoolean;
|
|
223
|
+
inputHash: z.ZodString;
|
|
224
|
+
fileCount: z.ZodNumber;
|
|
225
|
+
meaningfulFileCount: z.ZodNumber;
|
|
226
|
+
hunkCount: z.ZodNumber;
|
|
227
|
+
files: z.ZodArray<z.ZodObject<{
|
|
228
|
+
path: z.ZodString;
|
|
229
|
+
status: z.ZodString;
|
|
230
|
+
binary: z.ZodBoolean;
|
|
231
|
+
signal: z.ZodEnum<["meaningful", "low-signal"]>;
|
|
232
|
+
signalReason: z.ZodOptional<z.ZodString>;
|
|
233
|
+
hunkCount: z.ZodNumber;
|
|
234
|
+
}, "strip", z.ZodTypeAny, {
|
|
235
|
+
binary: boolean;
|
|
236
|
+
status: string;
|
|
237
|
+
path: string;
|
|
238
|
+
signal: "meaningful" | "low-signal";
|
|
239
|
+
hunkCount: number;
|
|
240
|
+
signalReason?: string | undefined;
|
|
241
|
+
}, {
|
|
242
|
+
binary: boolean;
|
|
243
|
+
status: string;
|
|
244
|
+
path: string;
|
|
245
|
+
signal: "meaningful" | "low-signal";
|
|
246
|
+
hunkCount: number;
|
|
247
|
+
signalReason?: string | undefined;
|
|
248
|
+
}>, "many">;
|
|
249
|
+
}, "strip", z.ZodTypeAny, {
|
|
250
|
+
repoPath: string;
|
|
251
|
+
targetRef: string;
|
|
252
|
+
mergeBase: string;
|
|
253
|
+
includesWorkingTree: boolean;
|
|
254
|
+
files: {
|
|
255
|
+
binary: boolean;
|
|
256
|
+
status: string;
|
|
257
|
+
path: string;
|
|
258
|
+
signal: "meaningful" | "low-signal";
|
|
259
|
+
hunkCount: number;
|
|
260
|
+
signalReason?: string | undefined;
|
|
261
|
+
}[];
|
|
262
|
+
baseRef: string;
|
|
263
|
+
hunkCount: number;
|
|
264
|
+
inputHash: string;
|
|
265
|
+
fileCount: number;
|
|
266
|
+
meaningfulFileCount: number;
|
|
267
|
+
}, {
|
|
268
|
+
repoPath: string;
|
|
269
|
+
targetRef: string;
|
|
270
|
+
mergeBase: string;
|
|
271
|
+
includesWorkingTree: boolean;
|
|
272
|
+
files: {
|
|
273
|
+
binary: boolean;
|
|
274
|
+
status: string;
|
|
275
|
+
path: string;
|
|
276
|
+
signal: "meaningful" | "low-signal";
|
|
277
|
+
hunkCount: number;
|
|
278
|
+
signalReason?: string | undefined;
|
|
279
|
+
}[];
|
|
280
|
+
baseRef: string;
|
|
281
|
+
hunkCount: number;
|
|
282
|
+
inputHash: string;
|
|
283
|
+
fileCount: number;
|
|
284
|
+
meaningfulFileCount: number;
|
|
285
|
+
}>>;
|
|
286
|
+
failure: z.ZodObject<{
|
|
287
|
+
phase: z.ZodEnum<["setup", "authentication", "collection", "analysis", "artifact-writing", "unknown"]>;
|
|
288
|
+
message: z.ZodString;
|
|
289
|
+
}, "strip", z.ZodTypeAny, {
|
|
290
|
+
message: string;
|
|
291
|
+
phase: "unknown" | "setup" | "authentication" | "collection" | "analysis" | "artifact-writing";
|
|
292
|
+
}, {
|
|
293
|
+
message: string;
|
|
294
|
+
phase: "unknown" | "setup" | "authentication" | "collection" | "analysis" | "artifact-writing";
|
|
295
|
+
}>;
|
|
296
|
+
attempts: z.ZodArray<z.ZodObject<{
|
|
297
|
+
kind: z.ZodEnum<["initial", "repair"]>;
|
|
298
|
+
durationMs: z.ZodNumber;
|
|
299
|
+
prompt: z.ZodObject<{
|
|
300
|
+
length: z.ZodNumber;
|
|
301
|
+
sha256: z.ZodString;
|
|
302
|
+
}, "strip", z.ZodTypeAny, {
|
|
303
|
+
length: number;
|
|
304
|
+
sha256: string;
|
|
305
|
+
}, {
|
|
306
|
+
length: number;
|
|
307
|
+
sha256: string;
|
|
308
|
+
}>;
|
|
309
|
+
response: z.ZodOptional<z.ZodObject<{
|
|
310
|
+
length: z.ZodNumber;
|
|
311
|
+
sha256: z.ZodString;
|
|
312
|
+
} & {
|
|
313
|
+
extractedLength: z.ZodNumber;
|
|
314
|
+
extractedSha256: z.ZodString;
|
|
315
|
+
fenced: z.ZodBoolean;
|
|
316
|
+
candidateStartsWithObject: z.ZodBoolean;
|
|
317
|
+
}, "strip", z.ZodTypeAny, {
|
|
318
|
+
length: number;
|
|
319
|
+
sha256: string;
|
|
320
|
+
extractedLength: number;
|
|
321
|
+
extractedSha256: string;
|
|
322
|
+
fenced: boolean;
|
|
323
|
+
candidateStartsWithObject: boolean;
|
|
324
|
+
}, {
|
|
325
|
+
length: number;
|
|
326
|
+
sha256: string;
|
|
327
|
+
extractedLength: number;
|
|
328
|
+
extractedSha256: string;
|
|
329
|
+
fenced: boolean;
|
|
330
|
+
candidateStartsWithObject: boolean;
|
|
331
|
+
}>>;
|
|
332
|
+
activity: z.ZodOptional<z.ZodObject<{
|
|
333
|
+
label: z.ZodString;
|
|
334
|
+
notifications: z.ZodNumber;
|
|
335
|
+
draftCharacters: z.ZodNumber;
|
|
336
|
+
}, "strip", z.ZodTypeAny, {
|
|
337
|
+
label: string;
|
|
338
|
+
notifications: number;
|
|
339
|
+
draftCharacters: number;
|
|
340
|
+
}, {
|
|
341
|
+
label: string;
|
|
342
|
+
notifications: number;
|
|
343
|
+
draftCharacters: number;
|
|
344
|
+
}>>;
|
|
345
|
+
validation: z.ZodOptional<z.ZodObject<{
|
|
346
|
+
phase: z.ZodEnum<["json-parsing", "wire-validation", "review-validation"]>;
|
|
347
|
+
message: z.ZodString;
|
|
348
|
+
}, "strip", z.ZodTypeAny, {
|
|
349
|
+
message: string;
|
|
350
|
+
phase: "json-parsing" | "wire-validation" | "review-validation";
|
|
351
|
+
}, {
|
|
352
|
+
message: string;
|
|
353
|
+
phase: "json-parsing" | "wire-validation" | "review-validation";
|
|
354
|
+
}>>;
|
|
355
|
+
error: z.ZodOptional<z.ZodString>;
|
|
356
|
+
}, "strip", z.ZodTypeAny, {
|
|
357
|
+
kind: "initial" | "repair";
|
|
358
|
+
durationMs: number;
|
|
359
|
+
prompt: {
|
|
360
|
+
length: number;
|
|
361
|
+
sha256: string;
|
|
362
|
+
};
|
|
363
|
+
error?: string | undefined;
|
|
364
|
+
validation?: {
|
|
365
|
+
message: string;
|
|
366
|
+
phase: "json-parsing" | "wire-validation" | "review-validation";
|
|
367
|
+
} | undefined;
|
|
368
|
+
response?: {
|
|
369
|
+
length: number;
|
|
370
|
+
sha256: string;
|
|
371
|
+
extractedLength: number;
|
|
372
|
+
extractedSha256: string;
|
|
373
|
+
fenced: boolean;
|
|
374
|
+
candidateStartsWithObject: boolean;
|
|
375
|
+
} | undefined;
|
|
376
|
+
activity?: {
|
|
377
|
+
label: string;
|
|
378
|
+
notifications: number;
|
|
379
|
+
draftCharacters: number;
|
|
380
|
+
} | undefined;
|
|
381
|
+
}, {
|
|
382
|
+
kind: "initial" | "repair";
|
|
383
|
+
durationMs: number;
|
|
384
|
+
prompt: {
|
|
385
|
+
length: number;
|
|
386
|
+
sha256: string;
|
|
387
|
+
};
|
|
388
|
+
error?: string | undefined;
|
|
389
|
+
validation?: {
|
|
390
|
+
message: string;
|
|
391
|
+
phase: "json-parsing" | "wire-validation" | "review-validation";
|
|
392
|
+
} | undefined;
|
|
393
|
+
response?: {
|
|
394
|
+
length: number;
|
|
395
|
+
sha256: string;
|
|
396
|
+
extractedLength: number;
|
|
397
|
+
extractedSha256: string;
|
|
398
|
+
fenced: boolean;
|
|
399
|
+
candidateStartsWithObject: boolean;
|
|
400
|
+
} | undefined;
|
|
401
|
+
activity?: {
|
|
402
|
+
label: string;
|
|
403
|
+
notifications: number;
|
|
404
|
+
draftCharacters: number;
|
|
405
|
+
} | undefined;
|
|
406
|
+
}>, "many">;
|
|
407
|
+
sensitiveDataIncluded: z.ZodBoolean;
|
|
408
|
+
rawAgentResponses: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
409
|
+
turn: z.ZodNumber;
|
|
410
|
+
response: z.ZodString;
|
|
411
|
+
}, "strip", z.ZodTypeAny, {
|
|
412
|
+
response: string;
|
|
413
|
+
turn: number;
|
|
414
|
+
}, {
|
|
415
|
+
response: string;
|
|
416
|
+
turn: number;
|
|
417
|
+
}>, "many">>;
|
|
418
|
+
nextSteps: z.ZodArray<z.ZodString, "many">;
|
|
419
|
+
}, "strip", z.ZodTypeAny, {
|
|
420
|
+
command: {
|
|
421
|
+
name: "review";
|
|
422
|
+
args: string[];
|
|
423
|
+
};
|
|
424
|
+
kind: "ndrstnd-analysis-diagnostic";
|
|
425
|
+
version: 1;
|
|
426
|
+
createdAt: string;
|
|
427
|
+
tool: {
|
|
428
|
+
version: string;
|
|
429
|
+
node: string;
|
|
430
|
+
platform: string;
|
|
431
|
+
arch: string;
|
|
432
|
+
};
|
|
433
|
+
failure: {
|
|
434
|
+
message: string;
|
|
435
|
+
phase: "unknown" | "setup" | "authentication" | "collection" | "analysis" | "artifact-writing";
|
|
436
|
+
};
|
|
437
|
+
attempts: {
|
|
438
|
+
kind: "initial" | "repair";
|
|
439
|
+
durationMs: number;
|
|
440
|
+
prompt: {
|
|
441
|
+
length: number;
|
|
442
|
+
sha256: string;
|
|
443
|
+
};
|
|
444
|
+
error?: string | undefined;
|
|
445
|
+
validation?: {
|
|
446
|
+
message: string;
|
|
447
|
+
phase: "json-parsing" | "wire-validation" | "review-validation";
|
|
448
|
+
} | undefined;
|
|
449
|
+
response?: {
|
|
450
|
+
length: number;
|
|
451
|
+
sha256: string;
|
|
452
|
+
extractedLength: number;
|
|
453
|
+
extractedSha256: string;
|
|
454
|
+
fenced: boolean;
|
|
455
|
+
candidateStartsWithObject: boolean;
|
|
456
|
+
} | undefined;
|
|
457
|
+
activity?: {
|
|
458
|
+
label: string;
|
|
459
|
+
notifications: number;
|
|
460
|
+
draftCharacters: number;
|
|
461
|
+
} | undefined;
|
|
462
|
+
}[];
|
|
463
|
+
sensitiveDataIncluded: boolean;
|
|
464
|
+
nextSteps: string[];
|
|
465
|
+
agent?: {
|
|
466
|
+
command: string;
|
|
467
|
+
id: "codex" | "claude";
|
|
468
|
+
name: string;
|
|
469
|
+
} | undefined;
|
|
470
|
+
scope?: {
|
|
471
|
+
repoPath: string;
|
|
472
|
+
targetRef: string;
|
|
473
|
+
mergeBase: string;
|
|
474
|
+
includesWorkingTree: boolean;
|
|
475
|
+
files: {
|
|
476
|
+
binary: boolean;
|
|
477
|
+
status: string;
|
|
478
|
+
path: string;
|
|
479
|
+
signal: "meaningful" | "low-signal";
|
|
480
|
+
hunkCount: number;
|
|
481
|
+
signalReason?: string | undefined;
|
|
482
|
+
}[];
|
|
483
|
+
baseRef: string;
|
|
484
|
+
hunkCount: number;
|
|
485
|
+
inputHash: string;
|
|
486
|
+
fileCount: number;
|
|
487
|
+
meaningfulFileCount: number;
|
|
488
|
+
} | undefined;
|
|
489
|
+
rawAgentResponses?: {
|
|
490
|
+
response: string;
|
|
491
|
+
turn: number;
|
|
492
|
+
}[] | undefined;
|
|
493
|
+
}, {
|
|
494
|
+
command: {
|
|
495
|
+
name: "review";
|
|
496
|
+
args: string[];
|
|
497
|
+
};
|
|
498
|
+
kind: "ndrstnd-analysis-diagnostic";
|
|
499
|
+
version: 1;
|
|
500
|
+
createdAt: string;
|
|
501
|
+
tool: {
|
|
502
|
+
version: string;
|
|
503
|
+
node: string;
|
|
504
|
+
platform: string;
|
|
505
|
+
arch: string;
|
|
506
|
+
};
|
|
507
|
+
failure: {
|
|
508
|
+
message: string;
|
|
509
|
+
phase: "unknown" | "setup" | "authentication" | "collection" | "analysis" | "artifact-writing";
|
|
510
|
+
};
|
|
511
|
+
attempts: {
|
|
512
|
+
kind: "initial" | "repair";
|
|
513
|
+
durationMs: number;
|
|
514
|
+
prompt: {
|
|
515
|
+
length: number;
|
|
516
|
+
sha256: string;
|
|
517
|
+
};
|
|
518
|
+
error?: string | undefined;
|
|
519
|
+
validation?: {
|
|
520
|
+
message: string;
|
|
521
|
+
phase: "json-parsing" | "wire-validation" | "review-validation";
|
|
522
|
+
} | undefined;
|
|
523
|
+
response?: {
|
|
524
|
+
length: number;
|
|
525
|
+
sha256: string;
|
|
526
|
+
extractedLength: number;
|
|
527
|
+
extractedSha256: string;
|
|
528
|
+
fenced: boolean;
|
|
529
|
+
candidateStartsWithObject: boolean;
|
|
530
|
+
} | undefined;
|
|
531
|
+
activity?: {
|
|
532
|
+
label: string;
|
|
533
|
+
notifications: number;
|
|
534
|
+
draftCharacters: number;
|
|
535
|
+
} | undefined;
|
|
536
|
+
}[];
|
|
537
|
+
sensitiveDataIncluded: boolean;
|
|
538
|
+
nextSteps: string[];
|
|
539
|
+
agent?: {
|
|
540
|
+
command: string;
|
|
541
|
+
id: "codex" | "claude";
|
|
542
|
+
name: string;
|
|
543
|
+
} | undefined;
|
|
544
|
+
scope?: {
|
|
545
|
+
repoPath: string;
|
|
546
|
+
targetRef: string;
|
|
547
|
+
mergeBase: string;
|
|
548
|
+
includesWorkingTree: boolean;
|
|
549
|
+
files: {
|
|
550
|
+
binary: boolean;
|
|
551
|
+
status: string;
|
|
552
|
+
path: string;
|
|
553
|
+
signal: "meaningful" | "low-signal";
|
|
554
|
+
hunkCount: number;
|
|
555
|
+
signalReason?: string | undefined;
|
|
556
|
+
}[];
|
|
557
|
+
baseRef: string;
|
|
558
|
+
hunkCount: number;
|
|
559
|
+
inputHash: string;
|
|
560
|
+
fileCount: number;
|
|
561
|
+
meaningfulFileCount: number;
|
|
562
|
+
} | undefined;
|
|
563
|
+
rawAgentResponses?: {
|
|
564
|
+
response: string;
|
|
565
|
+
turn: number;
|
|
566
|
+
}[] | undefined;
|
|
567
|
+
}>;
|
|
568
|
+
export type DiagnosticArtifact = z.infer<typeof DiagnosticArtifactSchema>;
|
|
569
|
+
export type DiagnosticAttempt = z.infer<typeof DiagnosticAttemptSchema>;
|
|
570
|
+
export type DiagnosticPhase = z.infer<typeof DiagnosticArtifactSchema>["failure"]["phase"];
|
|
571
|
+
export type DiagnosticFailure = DiagnosticArtifact["failure"];
|
|
572
|
+
export {};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const DIAGNOSTIC_ARTIFACT_VERSION = 1;
|
|
3
|
+
const TextMetadataSchema = z.object({
|
|
4
|
+
length: z.number().int().min(0),
|
|
5
|
+
sha256: z.string().regex(/^[a-f0-9]{64}$/),
|
|
6
|
+
});
|
|
7
|
+
const ResponseMetadataSchema = TextMetadataSchema.extend({
|
|
8
|
+
extractedLength: z.number().int().min(0),
|
|
9
|
+
extractedSha256: z.string().regex(/^[a-f0-9]{64}$/),
|
|
10
|
+
fenced: z.boolean(),
|
|
11
|
+
candidateStartsWithObject: z.boolean(),
|
|
12
|
+
});
|
|
13
|
+
const ActivitySchema = z.object({
|
|
14
|
+
label: z.string().min(1).max(300),
|
|
15
|
+
notifications: z.number().int().min(0),
|
|
16
|
+
draftCharacters: z.number().int().min(0),
|
|
17
|
+
});
|
|
18
|
+
const ValidationSchema = z.object({
|
|
19
|
+
phase: z.enum(["json-parsing", "wire-validation", "review-validation"]),
|
|
20
|
+
message: z.string().min(1).max(8_000),
|
|
21
|
+
});
|
|
22
|
+
const DiagnosticAttemptSchema = z.object({
|
|
23
|
+
kind: z.enum(["initial", "repair"]),
|
|
24
|
+
durationMs: z.number().int().min(0),
|
|
25
|
+
prompt: TextMetadataSchema,
|
|
26
|
+
response: ResponseMetadataSchema.optional(),
|
|
27
|
+
activity: ActivitySchema.optional(),
|
|
28
|
+
validation: ValidationSchema.optional(),
|
|
29
|
+
error: z.string().min(1).max(8_000).optional(),
|
|
30
|
+
});
|
|
31
|
+
const ReviewFileDiagnosticSchema = z.object({
|
|
32
|
+
path: z.string().min(1).max(1_000),
|
|
33
|
+
status: z.string().min(1).max(40),
|
|
34
|
+
binary: z.boolean(),
|
|
35
|
+
signal: z.enum(["meaningful", "low-signal"]),
|
|
36
|
+
signalReason: z.string().max(300).optional(),
|
|
37
|
+
hunkCount: z.number().int().min(0),
|
|
38
|
+
});
|
|
39
|
+
const ReviewScopeDiagnosticSchema = z.object({
|
|
40
|
+
repoPath: z.string().min(1),
|
|
41
|
+
targetRef: z.string().min(1),
|
|
42
|
+
baseRef: z.string().min(1),
|
|
43
|
+
mergeBase: z.string().min(1),
|
|
44
|
+
includesWorkingTree: z.boolean(),
|
|
45
|
+
inputHash: z.string().regex(/^[a-f0-9]{64}$/),
|
|
46
|
+
fileCount: z.number().int().min(0),
|
|
47
|
+
meaningfulFileCount: z.number().int().min(0),
|
|
48
|
+
hunkCount: z.number().int().min(0),
|
|
49
|
+
files: z.array(ReviewFileDiagnosticSchema),
|
|
50
|
+
});
|
|
51
|
+
export const DiagnosticArtifactSchema = z.object({
|
|
52
|
+
kind: z.literal("ndrstnd-analysis-diagnostic"),
|
|
53
|
+
version: z.literal(DIAGNOSTIC_ARTIFACT_VERSION),
|
|
54
|
+
createdAt: z.string().datetime(),
|
|
55
|
+
tool: z.object({
|
|
56
|
+
version: z.string().min(1),
|
|
57
|
+
node: z.string().min(1),
|
|
58
|
+
platform: z.string().min(1),
|
|
59
|
+
arch: z.string().min(1),
|
|
60
|
+
}),
|
|
61
|
+
command: z.object({
|
|
62
|
+
name: z.literal("review"),
|
|
63
|
+
args: z.array(z.string().max(2_000)),
|
|
64
|
+
}),
|
|
65
|
+
agent: z.object({
|
|
66
|
+
id: z.enum(["codex", "claude"]),
|
|
67
|
+
name: z.string().min(1),
|
|
68
|
+
command: z.string().min(1),
|
|
69
|
+
}).optional(),
|
|
70
|
+
scope: ReviewScopeDiagnosticSchema.optional(),
|
|
71
|
+
failure: z.object({
|
|
72
|
+
phase: z.enum(["setup", "authentication", "collection", "analysis", "artifact-writing", "unknown"]),
|
|
73
|
+
message: z.string().min(1).max(8_000),
|
|
74
|
+
}),
|
|
75
|
+
attempts: z.array(DiagnosticAttemptSchema),
|
|
76
|
+
sensitiveDataIncluded: z.boolean(),
|
|
77
|
+
rawAgentResponses: z.array(z.object({
|
|
78
|
+
turn: z.number().int().min(1),
|
|
79
|
+
response: z.string(),
|
|
80
|
+
})).optional(),
|
|
81
|
+
nextSteps: z.array(z.string().min(1).max(1_000)).min(1),
|
|
82
|
+
});
|
|
83
|
+
//# sourceMappingURL=diagnostic-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnostic-schema.js","sourceRoot":"","sources":["../../src/shared/diagnostic-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC;AAE7C,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAAC;CAC3C,CAAC,CAAC;AAGH,MAAM,sBAAsB,GAAG,kBAAkB,CAAC,MAAM,CAAC;IACvD,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACxC,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAAC;IACnD,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE;IACnB,yBAAyB,EAAE,CAAC,CAAC,OAAO,EAAE;CACvC,CAAC,CAAC;AAGH,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;IACjC,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACtC,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACzC,CAAC,CAAC;AAGH,MAAM,gBAAgB,GAAG,CAAC,CAAC,M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E,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;QAClC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QAC7B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;KACrB,CAAC,CAAC,CAAC,QAAQ,EAAE;IACd,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;CACxD,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ndrstnd",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -26,7 +26,8 @@
|
|
|
26
26
|
"files": [
|
|
27
27
|
"dist",
|
|
28
28
|
"src/skill-assets",
|
|
29
|
-
"README.md"
|
|
29
|
+
"README.md",
|
|
30
|
+
"CHANGELOG.md"
|
|
30
31
|
],
|
|
31
32
|
"engines": {
|
|
32
33
|
"node": ">=22"
|