@imenam/mcp-feature-analyzer 1.0.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.
Files changed (111) hide show
  1. package/LICENSE +15 -0
  2. package/README.md +295 -0
  3. package/dist/shared/diagram-geometry.d.ts +45 -0
  4. package/dist/shared/diagram-geometry.js +120 -0
  5. package/dist/shared/diagram-layout.d.ts +98 -0
  6. package/dist/shared/diagram-layout.js +1156 -0
  7. package/dist/shared/diagram-quality.d.ts +30 -0
  8. package/dist/shared/diagram-quality.js +26 -0
  9. package/dist/shared/labels.d.ts +31 -0
  10. package/dist/shared/labels.js +53 -0
  11. package/dist/shared/mindmap-tree.d.ts +28 -0
  12. package/dist/shared/mindmap-tree.js +62 -0
  13. package/dist/shared/prompt.d.ts +17 -0
  14. package/dist/shared/prompt.js +97 -0
  15. package/dist/shared/review-state.d.ts +10 -0
  16. package/dist/shared/review-state.js +17 -0
  17. package/dist/shared/schemas/analysis.schema.d.ts +372 -0
  18. package/dist/shared/schemas/analysis.schema.js +152 -0
  19. package/dist/shared/schemas/api.schema.d.ts +92 -0
  20. package/dist/shared/schemas/api.schema.js +46 -0
  21. package/dist/shared/schemas/diff.schema.d.ts +91 -0
  22. package/dist/shared/schemas/diff.schema.js +37 -0
  23. package/dist/shared/schemas/ipc.schema.d.ts +29 -0
  24. package/dist/shared/schemas/ipc.schema.js +30 -0
  25. package/dist/shared/severity.d.ts +11 -0
  26. package/dist/shared/severity.js +17 -0
  27. package/dist/shared/text.d.ts +12 -0
  28. package/dist/shared/text.js +20 -0
  29. package/dist/src/cli/setup-mcp.d.ts +24 -0
  30. package/dist/src/cli/setup-mcp.js +145 -0
  31. package/dist/src/core/analysis-store.d.ts +95 -0
  32. package/dist/src/core/analysis-store.js +387 -0
  33. package/dist/src/core/data-dir.d.ts +5 -0
  34. package/dist/src/core/data-dir.js +11 -0
  35. package/dist/src/core/diff-parser.d.ts +22 -0
  36. package/dist/src/core/diff-parser.js +225 -0
  37. package/dist/src/core/errors.d.ts +16 -0
  38. package/dist/src/core/errors.js +28 -0
  39. package/dist/src/core/git.d.ts +35 -0
  40. package/dist/src/core/git.js +257 -0
  41. package/dist/src/core/ids.d.ts +16 -0
  42. package/dist/src/core/ids.js +41 -0
  43. package/dist/src/core/invariants.d.ts +24 -0
  44. package/dist/src/core/invariants.js +157 -0
  45. package/dist/src/core/locations.d.ts +30 -0
  46. package/dist/src/core/locations.js +66 -0
  47. package/dist/src/core/log-dir.d.ts +6 -0
  48. package/dist/src/core/log-dir.js +13 -0
  49. package/dist/src/core/migrate.d.ts +24 -0
  50. package/dist/src/core/migrate.js +53 -0
  51. package/dist/src/core/refresh.d.ts +30 -0
  52. package/dist/src/core/refresh.js +113 -0
  53. package/dist/src/core/request-guard.d.ts +32 -0
  54. package/dist/src/core/request-guard.js +72 -0
  55. package/dist/src/core/review-actions.d.ts +27 -0
  56. package/dist/src/core/review-actions.js +99 -0
  57. package/dist/src/gui-worker.d.ts +1 -0
  58. package/dist/src/gui-worker.js +401 -0
  59. package/dist/src/index.d.ts +2 -0
  60. package/dist/src/index.js +658 -0
  61. package/dist/src/tools/add-findings.d.ts +9 -0
  62. package/dist/src/tools/add-findings.js +106 -0
  63. package/dist/src/tools/create-analysis.d.ts +4 -0
  64. package/dist/src/tools/create-analysis.js +36 -0
  65. package/dist/src/tools/delete-analysis.d.ts +4 -0
  66. package/dist/src/tools/delete-analysis.js +11 -0
  67. package/dist/src/tools/delete-diagram.d.ts +4 -0
  68. package/dist/src/tools/delete-diagram.js +22 -0
  69. package/dist/src/tools/delete-findings.d.ts +7 -0
  70. package/dist/src/tools/delete-findings.js +27 -0
  71. package/dist/src/tools/format.d.ts +27 -0
  72. package/dist/src/tools/format.js +92 -0
  73. package/dist/src/tools/get-analysis.d.ts +4 -0
  74. package/dist/src/tools/get-analysis.js +87 -0
  75. package/dist/src/tools/get-diff.d.ts +4 -0
  76. package/dist/src/tools/get-diff.js +67 -0
  77. package/dist/src/tools/get-review-feedback.d.ts +4 -0
  78. package/dist/src/tools/get-review-feedback.js +71 -0
  79. package/dist/src/tools/inputs.d.ts +14 -0
  80. package/dist/src/tools/inputs.js +40 -0
  81. package/dist/src/tools/list-analyses.d.ts +8 -0
  82. package/dist/src/tools/list-analyses.js +71 -0
  83. package/dist/src/tools/refresh-analysis.d.ts +7 -0
  84. package/dist/src/tools/refresh-analysis.js +39 -0
  85. package/dist/src/tools/set-diagram.d.ts +16 -0
  86. package/dist/src/tools/set-diagram.js +207 -0
  87. package/dist/src/tools/types.d.ts +52 -0
  88. package/dist/src/tools/types.js +133 -0
  89. package/dist/src/tools/update-analysis.d.ts +4 -0
  90. package/dist/src/tools/update-analysis.js +121 -0
  91. package/dist/src/tools/update-finding.d.ts +8 -0
  92. package/dist/src/tools/update-finding.js +91 -0
  93. package/dist/src/version.d.ts +1 -0
  94. package/dist/src/version.js +2 -0
  95. package/gui/dist/assets/index-CU9pNYDp.js +72 -0
  96. package/gui/dist/assets/index-Du5eL78F.css +1 -0
  97. package/gui/dist/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
  98. package/gui/dist/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
  99. package/gui/dist/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
  100. package/gui/dist/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
  101. package/gui/dist/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
  102. package/gui/dist/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
  103. package/gui/dist/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
  104. package/gui/dist/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
  105. package/gui/dist/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
  106. package/gui/dist/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
  107. package/gui/dist/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
  108. package/gui/dist/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
  109. package/gui/dist/index.html +13 -0
  110. package/package.json +56 -0
  111. package/scripts/generate-version.js +20 -0
@@ -0,0 +1,372 @@
1
+ import { z } from "zod";
2
+ export declare const ANALYSIS_MODES: readonly ["branch", "working_tree"];
3
+ export declare const FILE_STATUSES: readonly ["added", "modified", "deleted", "renamed"];
4
+ export declare const SEVERITIES: readonly ["critical", "major", "minor", "trivial"];
5
+ export declare const FINDING_KINDS: readonly ["issue", "requirement_gap"];
6
+ export declare const FINDING_STATUSES: readonly ["open", "ignored", "outdated"];
7
+ export declare const DIAGRAM_KINDS: readonly ["flow", "layers", "mindmap"];
8
+ export declare const NODE_SHAPES: readonly ["box", "pill", "decision"];
9
+ export declare const NODE_STATUSES: readonly ["new", "modified", "impacted", "existing", "finding", "missing"];
10
+ export declare const REVIEW_STATES: readonly ["pending", "submitted"];
11
+ export declare const REVIEW_DECISIONS: readonly ["approve", "request_changes", "reject"];
12
+ export declare const EDITORS: readonly ["agent", "user"];
13
+ /** Identifiant d'analyse : slug en minuscules, sert aussi de nom de fichier. */
14
+ export declare const ANALYSIS_ID_PATTERN: RegExp;
15
+ /** Identifiant d'un constat, d'une remarque, d'un schéma ou d'un nœud. */
16
+ export declare const ITEM_ID_PATTERN: RegExp;
17
+ /** Fichier modifié par la feature, tel que figé au dernier snapshot. */
18
+ export declare const FileEntrySchema: z.ZodObject<{
19
+ path: z.ZodString;
20
+ oldPath: z.ZodNullable<z.ZodString>;
21
+ status: z.ZodEnum<{
22
+ added: "added";
23
+ deleted: "deleted";
24
+ modified: "modified";
25
+ renamed: "renamed";
26
+ }>;
27
+ additions: z.ZodNumber;
28
+ deletions: z.ZodNumber;
29
+ binary: z.ZodBoolean;
30
+ contentAvailable: z.ZodBoolean;
31
+ lineCount: z.ZodNumber;
32
+ reviewed: z.ZodBoolean;
33
+ }, z.core.$strip>;
34
+ /** Plage de lignes du côté « nouveau » du diff, bornes incluses. */
35
+ export declare const FindingLocationSchema: z.ZodObject<{
36
+ path: z.ZodString;
37
+ startLine: z.ZodNumber;
38
+ endLine: z.ZodNumber;
39
+ }, z.core.$strip>;
40
+ export declare const FindingSchema: z.ZodObject<{
41
+ id: z.ZodString;
42
+ severity: z.ZodEnum<{
43
+ critical: "critical";
44
+ major: "major";
45
+ minor: "minor";
46
+ trivial: "trivial";
47
+ }>;
48
+ kind: z.ZodEnum<{
49
+ issue: "issue";
50
+ requirement_gap: "requirement_gap";
51
+ }>;
52
+ title: z.ZodString;
53
+ body: z.ZodString;
54
+ location: z.ZodNullable<z.ZodObject<{
55
+ path: z.ZodString;
56
+ startLine: z.ZodNumber;
57
+ endLine: z.ZodNumber;
58
+ }, z.core.$strip>>;
59
+ anchorText: z.ZodNullable<z.ZodString>;
60
+ suggestion: z.ZodNullable<z.ZodString>;
61
+ prompt: z.ZodNullable<z.ZodString>;
62
+ status: z.ZodEnum<{
63
+ ignored: "ignored";
64
+ open: "open";
65
+ outdated: "outdated";
66
+ }>;
67
+ createdAt: z.ZodString;
68
+ }, z.core.$strip>;
69
+ /** Emplacement d'une remarque : une ligne du côté « nouveau », ou le fichier entier (`line` null). */
70
+ export declare const NoteLocationSchema: z.ZodObject<{
71
+ path: z.ZodString;
72
+ line: z.ZodNullable<z.ZodNumber>;
73
+ }, z.core.$strip>;
74
+ export declare const NoteSchema: z.ZodObject<{
75
+ id: z.ZodString;
76
+ location: z.ZodNullable<z.ZodObject<{
77
+ path: z.ZodString;
78
+ line: z.ZodNullable<z.ZodNumber>;
79
+ }, z.core.$strip>>;
80
+ text: z.ZodString;
81
+ createdAt: z.ZodString;
82
+ }, z.core.$strip>;
83
+ export declare const DiagramNodeLocationSchema: z.ZodObject<{
84
+ path: z.ZodString;
85
+ line: z.ZodNullable<z.ZodNumber>;
86
+ }, z.core.$strip>;
87
+ export declare const DiagramNodeSchema: z.ZodObject<{
88
+ id: z.ZodString;
89
+ label: z.ZodString;
90
+ shape: z.ZodEnum<{
91
+ box: "box";
92
+ decision: "decision";
93
+ pill: "pill";
94
+ }>;
95
+ status: z.ZodEnum<{
96
+ existing: "existing";
97
+ finding: "finding";
98
+ impacted: "impacted";
99
+ missing: "missing";
100
+ modified: "modified";
101
+ new: "new";
102
+ }>;
103
+ layer: z.ZodNullable<z.ZodString>;
104
+ detail: z.ZodNullable<z.ZodString>;
105
+ location: z.ZodNullable<z.ZodObject<{
106
+ path: z.ZodString;
107
+ line: z.ZodNullable<z.ZodNumber>;
108
+ }, z.core.$strip>>;
109
+ }, z.core.$strip>;
110
+ export declare const DiagramLinkSchema: z.ZodObject<{
111
+ from: z.ZodString;
112
+ to: z.ZodString;
113
+ label: z.ZodNullable<z.ZodString>;
114
+ }, z.core.$strip>;
115
+ export declare const DiagramSchema: z.ZodObject<{
116
+ id: z.ZodString;
117
+ title: z.ZodString;
118
+ kind: z.ZodEnum<{
119
+ flow: "flow";
120
+ layers: "layers";
121
+ mindmap: "mindmap";
122
+ }>;
123
+ layers: z.ZodArray<z.ZodString>;
124
+ nodes: z.ZodArray<z.ZodObject<{
125
+ id: z.ZodString;
126
+ label: z.ZodString;
127
+ shape: z.ZodEnum<{
128
+ box: "box";
129
+ decision: "decision";
130
+ pill: "pill";
131
+ }>;
132
+ status: z.ZodEnum<{
133
+ existing: "existing";
134
+ finding: "finding";
135
+ impacted: "impacted";
136
+ missing: "missing";
137
+ modified: "modified";
138
+ new: "new";
139
+ }>;
140
+ layer: z.ZodNullable<z.ZodString>;
141
+ detail: z.ZodNullable<z.ZodString>;
142
+ location: z.ZodNullable<z.ZodObject<{
143
+ path: z.ZodString;
144
+ line: z.ZodNullable<z.ZodNumber>;
145
+ }, z.core.$strip>>;
146
+ }, z.core.$strip>>;
147
+ links: z.ZodArray<z.ZodObject<{
148
+ from: z.ZodString;
149
+ to: z.ZodString;
150
+ label: z.ZodNullable<z.ZodString>;
151
+ }, z.core.$strip>>;
152
+ updatedAt: z.ZodString;
153
+ }, z.core.$strip>;
154
+ export declare const ReviewSchema: z.ZodObject<{
155
+ state: z.ZodEnum<{
156
+ pending: "pending";
157
+ submitted: "submitted";
158
+ }>;
159
+ decision: z.ZodNullable<z.ZodEnum<{
160
+ approve: "approve";
161
+ reject: "reject";
162
+ request_changes: "request_changes";
163
+ }>>;
164
+ selectedFindingIds: z.ZodArray<z.ZodString>;
165
+ selectedNoteIds: z.ZodArray<z.ZodString>;
166
+ prompt: z.ZodNullable<z.ZodString>;
167
+ submittedAt: z.ZodNullable<z.ZodString>;
168
+ }, z.core.$strip>;
169
+ export declare const RequestSchema: z.ZodObject<{
170
+ text: z.ZodString;
171
+ source: z.ZodNullable<z.ZodString>;
172
+ }, z.core.$strip>;
173
+ /** Vue d'ensemble de la feature : objectif, approche et points d'attention pour le relecteur. */
174
+ export declare const OverviewSchema: z.ZodObject<{
175
+ objective: z.ZodString;
176
+ approach: z.ZodString;
177
+ attentionPoints: z.ZodArray<z.ZodString>;
178
+ }, z.core.$strip>;
179
+ /** Nom de projet : non vide, sans espace en tête ni en fin. */
180
+ export declare const ProjectNameSchema: z.ZodString;
181
+ export declare const AnalysisSchema: z.ZodObject<{
182
+ id: z.ZodString;
183
+ title: z.ZodString;
184
+ project: z.ZodString;
185
+ repoPath: z.ZodString;
186
+ mode: z.ZodEnum<{
187
+ branch: "branch";
188
+ working_tree: "working_tree";
189
+ }>;
190
+ base: z.ZodString;
191
+ head: z.ZodNullable<z.ZodString>;
192
+ baseCommit: z.ZodString;
193
+ headCommit: z.ZodNullable<z.ZodString>;
194
+ snapshotAt: z.ZodString;
195
+ request: z.ZodNullable<z.ZodObject<{
196
+ text: z.ZodString;
197
+ source: z.ZodNullable<z.ZodString>;
198
+ }, z.core.$strip>>;
199
+ overview: z.ZodNullable<z.ZodObject<{
200
+ objective: z.ZodString;
201
+ approach: z.ZodString;
202
+ attentionPoints: z.ZodArray<z.ZodString>;
203
+ }, z.core.$strip>>;
204
+ summary: z.ZodArray<z.ZodString>;
205
+ files: z.ZodArray<z.ZodObject<{
206
+ path: z.ZodString;
207
+ oldPath: z.ZodNullable<z.ZodString>;
208
+ status: z.ZodEnum<{
209
+ added: "added";
210
+ deleted: "deleted";
211
+ modified: "modified";
212
+ renamed: "renamed";
213
+ }>;
214
+ additions: z.ZodNumber;
215
+ deletions: z.ZodNumber;
216
+ binary: z.ZodBoolean;
217
+ contentAvailable: z.ZodBoolean;
218
+ lineCount: z.ZodNumber;
219
+ reviewed: z.ZodBoolean;
220
+ }, z.core.$strip>>;
221
+ findings: z.ZodArray<z.ZodObject<{
222
+ id: z.ZodString;
223
+ severity: z.ZodEnum<{
224
+ critical: "critical";
225
+ major: "major";
226
+ minor: "minor";
227
+ trivial: "trivial";
228
+ }>;
229
+ kind: z.ZodEnum<{
230
+ issue: "issue";
231
+ requirement_gap: "requirement_gap";
232
+ }>;
233
+ title: z.ZodString;
234
+ body: z.ZodString;
235
+ location: z.ZodNullable<z.ZodObject<{
236
+ path: z.ZodString;
237
+ startLine: z.ZodNumber;
238
+ endLine: z.ZodNumber;
239
+ }, z.core.$strip>>;
240
+ anchorText: z.ZodNullable<z.ZodString>;
241
+ suggestion: z.ZodNullable<z.ZodString>;
242
+ prompt: z.ZodNullable<z.ZodString>;
243
+ status: z.ZodEnum<{
244
+ ignored: "ignored";
245
+ open: "open";
246
+ outdated: "outdated";
247
+ }>;
248
+ createdAt: z.ZodString;
249
+ }, z.core.$strip>>;
250
+ notes: z.ZodArray<z.ZodObject<{
251
+ id: z.ZodString;
252
+ location: z.ZodNullable<z.ZodObject<{
253
+ path: z.ZodString;
254
+ line: z.ZodNullable<z.ZodNumber>;
255
+ }, z.core.$strip>>;
256
+ text: z.ZodString;
257
+ createdAt: z.ZodString;
258
+ }, z.core.$strip>>;
259
+ diagrams: z.ZodArray<z.ZodObject<{
260
+ id: z.ZodString;
261
+ title: z.ZodString;
262
+ kind: z.ZodEnum<{
263
+ flow: "flow";
264
+ layers: "layers";
265
+ mindmap: "mindmap";
266
+ }>;
267
+ layers: z.ZodArray<z.ZodString>;
268
+ nodes: z.ZodArray<z.ZodObject<{
269
+ id: z.ZodString;
270
+ label: z.ZodString;
271
+ shape: z.ZodEnum<{
272
+ box: "box";
273
+ decision: "decision";
274
+ pill: "pill";
275
+ }>;
276
+ status: z.ZodEnum<{
277
+ existing: "existing";
278
+ finding: "finding";
279
+ impacted: "impacted";
280
+ missing: "missing";
281
+ modified: "modified";
282
+ new: "new";
283
+ }>;
284
+ layer: z.ZodNullable<z.ZodString>;
285
+ detail: z.ZodNullable<z.ZodString>;
286
+ location: z.ZodNullable<z.ZodObject<{
287
+ path: z.ZodString;
288
+ line: z.ZodNullable<z.ZodNumber>;
289
+ }, z.core.$strip>>;
290
+ }, z.core.$strip>>;
291
+ links: z.ZodArray<z.ZodObject<{
292
+ from: z.ZodString;
293
+ to: z.ZodString;
294
+ label: z.ZodNullable<z.ZodString>;
295
+ }, z.core.$strip>>;
296
+ updatedAt: z.ZodString;
297
+ }, z.core.$strip>>;
298
+ review: z.ZodObject<{
299
+ state: z.ZodEnum<{
300
+ pending: "pending";
301
+ submitted: "submitted";
302
+ }>;
303
+ decision: z.ZodNullable<z.ZodEnum<{
304
+ approve: "approve";
305
+ reject: "reject";
306
+ request_changes: "request_changes";
307
+ }>>;
308
+ selectedFindingIds: z.ZodArray<z.ZodString>;
309
+ selectedNoteIds: z.ZodArray<z.ZodString>;
310
+ prompt: z.ZodNullable<z.ZodString>;
311
+ submittedAt: z.ZodNullable<z.ZodString>;
312
+ }, z.core.$strip>;
313
+ revision: z.ZodNumber;
314
+ createdAt: z.ZodString;
315
+ updatedAt: z.ZodString;
316
+ lastEditor: z.ZodEnum<{
317
+ agent: "agent";
318
+ user: "user";
319
+ }>;
320
+ }, z.core.$strip>;
321
+ export type AnalysisMode = (typeof ANALYSIS_MODES)[number];
322
+ export type FileStatus = (typeof FILE_STATUSES)[number];
323
+ export type Severity = (typeof SEVERITIES)[number];
324
+ export type FindingKind = (typeof FINDING_KINDS)[number];
325
+ export type FindingStatus = (typeof FINDING_STATUSES)[number];
326
+ export type DiagramKind = (typeof DIAGRAM_KINDS)[number];
327
+ export type NodeShape = (typeof NODE_SHAPES)[number];
328
+ export type NodeStatus = (typeof NODE_STATUSES)[number];
329
+ export type ReviewState = (typeof REVIEW_STATES)[number];
330
+ export type ReviewDecision = (typeof REVIEW_DECISIONS)[number];
331
+ export type Editor = (typeof EDITORS)[number];
332
+ export type FileEntry = z.infer<typeof FileEntrySchema>;
333
+ export type FindingLocation = z.infer<typeof FindingLocationSchema>;
334
+ export type Finding = z.infer<typeof FindingSchema>;
335
+ export type NoteLocation = z.infer<typeof NoteLocationSchema>;
336
+ export type Note = z.infer<typeof NoteSchema>;
337
+ export type DiagramNodeLocation = z.infer<typeof DiagramNodeLocationSchema>;
338
+ export type DiagramNode = z.infer<typeof DiagramNodeSchema>;
339
+ export type DiagramLink = z.infer<typeof DiagramLinkSchema>;
340
+ export type Diagram = z.infer<typeof DiagramSchema>;
341
+ export type Review = z.infer<typeof ReviewSchema>;
342
+ export type AnalysisRequest = z.infer<typeof RequestSchema>;
343
+ export type Overview = z.infer<typeof OverviewSchema>;
344
+ export type Analysis = z.infer<typeof AnalysisSchema>;
345
+ /** État d'avancement d'une revue, dérivé des fichiers revus et de la soumission. */
346
+ export declare const REVIEW_PROGRESS_STATES: readonly ["not_started", "in_progress", "files_reviewed", "submitted"];
347
+ export type ReviewProgressState = (typeof REVIEW_PROGRESS_STATES)[number];
348
+ /** Avancement d'une revue (voir `reviewProgress` dans `shared/review-state.ts`). */
349
+ export interface ReviewProgress {
350
+ state: ReviewProgressState;
351
+ reviewedFiles: number;
352
+ totalFiles: number;
353
+ /** Décision de la revue soumise ; null tant qu'elle ne l'est pas. */
354
+ decision: ReviewDecision | null;
355
+ }
356
+ /** Vue légère d'une analyse, pour les listes. */
357
+ export interface AnalysisSummary {
358
+ id: string;
359
+ title: string;
360
+ project: string;
361
+ mode: AnalysisMode;
362
+ base: string;
363
+ head: string | null;
364
+ fileCount: number;
365
+ reviewedCount: number;
366
+ /** Constats au statut `open`, par gravité. */
367
+ openFindings: Record<Severity, number>;
368
+ diagramCount: number;
369
+ progress: ReviewProgress;
370
+ updatedAt: string;
371
+ revision: number;
372
+ }
@@ -0,0 +1,152 @@
1
+ import { z } from "zod";
2
+ export const ANALYSIS_MODES = ["branch", "working_tree"];
3
+ export const FILE_STATUSES = ["added", "modified", "deleted", "renamed"];
4
+ export const SEVERITIES = ["critical", "major", "minor", "trivial"];
5
+ export const FINDING_KINDS = ["issue", "requirement_gap"];
6
+ export const FINDING_STATUSES = ["open", "ignored", "outdated"];
7
+ export const DIAGRAM_KINDS = ["flow", "layers", "mindmap"];
8
+ export const NODE_SHAPES = ["box", "pill", "decision"];
9
+ export const NODE_STATUSES = ["new", "modified", "impacted", "existing", "finding", "missing"];
10
+ export const REVIEW_STATES = ["pending", "submitted"];
11
+ export const REVIEW_DECISIONS = ["approve", "request_changes", "reject"];
12
+ export const EDITORS = ["agent", "user"];
13
+ /** Identifiant d'analyse : slug en minuscules, sert aussi de nom de fichier. */
14
+ export const ANALYSIS_ID_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
15
+ /** Identifiant d'un constat, d'une remarque, d'un schéma ou d'un nœud. */
16
+ export const ITEM_ID_PATTERN = /^[A-Za-z0-9_-]{1,64}$/;
17
+ const ItemIdSchema = z
18
+ .string()
19
+ .regex(ITEM_ID_PATTERN, "must contain only letters, digits, '_' or '-' (1 to 64 characters)");
20
+ const LineSchema = z.number().int().positive();
21
+ const IsoDateSchema = z.string().min(1);
22
+ /** Fichier modifié par la feature, tel que figé au dernier snapshot. */
23
+ export const FileEntrySchema = z.object({
24
+ path: z.string().min(1),
25
+ oldPath: z.string().min(1).nullable(),
26
+ status: z.enum(FILE_STATUSES),
27
+ additions: z.number().int().nonnegative(),
28
+ deletions: z.number().int().nonnegative(),
29
+ binary: z.boolean(),
30
+ /** Vrai quand le texte du côté « nouveau » est conservé dans le snapshot. */
31
+ contentAvailable: z.boolean(),
32
+ /** Nombre de lignes du côté « nouveau » ; 0 quand le contenu n'est pas disponible. */
33
+ lineCount: z.number().int().nonnegative(),
34
+ reviewed: z.boolean(),
35
+ });
36
+ /** Plage de lignes du côté « nouveau » du diff, bornes incluses. */
37
+ export const FindingLocationSchema = z.object({
38
+ path: z.string().min(1),
39
+ startLine: LineSchema,
40
+ endLine: LineSchema,
41
+ });
42
+ export const FindingSchema = z.object({
43
+ id: ItemIdSchema,
44
+ severity: z.enum(SEVERITIES),
45
+ kind: z.enum(FINDING_KINDS),
46
+ title: z.string().min(1),
47
+ body: z.string(),
48
+ location: FindingLocationSchema.nullable(),
49
+ /** Texte exact des lignes visées au moment où le constat a été ancré. */
50
+ anchorText: z.string().nullable(),
51
+ /** Texte de remplacement proposé pour les lignes visées. */
52
+ suggestion: z.string().nullable(),
53
+ /** Prompt fourni par l'agent ; remplace le corps généré dans le retour. */
54
+ prompt: z.string().nullable(),
55
+ status: z.enum(FINDING_STATUSES),
56
+ createdAt: IsoDateSchema,
57
+ });
58
+ /** Emplacement d'une remarque : une ligne du côté « nouveau », ou le fichier entier (`line` null). */
59
+ export const NoteLocationSchema = z.object({
60
+ path: z.string().min(1),
61
+ line: LineSchema.nullable(),
62
+ });
63
+ export const NoteSchema = z.object({
64
+ id: ItemIdSchema,
65
+ location: NoteLocationSchema.nullable(),
66
+ text: z.string().min(1),
67
+ createdAt: IsoDateSchema,
68
+ });
69
+ export const DiagramNodeLocationSchema = z.object({
70
+ path: z.string().min(1),
71
+ line: LineSchema.nullable(),
72
+ });
73
+ export const DiagramNodeSchema = z.object({
74
+ id: ItemIdSchema,
75
+ label: z.string().min(1),
76
+ shape: z.enum(NODE_SHAPES),
77
+ status: z.enum(NODE_STATUSES),
78
+ layer: z.string().min(1).nullable(),
79
+ detail: z.string().nullable(),
80
+ location: DiagramNodeLocationSchema.nullable(),
81
+ });
82
+ export const DiagramLinkSchema = z.object({
83
+ from: ItemIdSchema,
84
+ to: ItemIdSchema,
85
+ label: z.string().nullable(),
86
+ });
87
+ export const DiagramSchema = z.object({
88
+ id: ItemIdSchema,
89
+ title: z.string().min(1),
90
+ kind: z.enum(DIAGRAM_KINDS),
91
+ /** Ordre des colonnes quand `kind` vaut `layers`. */
92
+ layers: z.array(z.string().min(1)),
93
+ nodes: z.array(DiagramNodeSchema),
94
+ links: z.array(DiagramLinkSchema),
95
+ updatedAt: IsoDateSchema,
96
+ });
97
+ export const ReviewSchema = z.object({
98
+ state: z.enum(REVIEW_STATES),
99
+ decision: z.enum(REVIEW_DECISIONS).nullable(),
100
+ selectedFindingIds: z.array(ItemIdSchema),
101
+ selectedNoteIds: z.array(ItemIdSchema),
102
+ prompt: z.string().nullable(),
103
+ submittedAt: IsoDateSchema.nullable(),
104
+ });
105
+ export const RequestSchema = z.object({
106
+ text: z.string().min(1),
107
+ source: z.string().min(1).nullable(),
108
+ });
109
+ /** Vue d'ensemble de la feature : objectif, approche et points d'attention pour le relecteur. */
110
+ export const OverviewSchema = z.object({
111
+ /** Ce que la feature doit permettre, du point de vue fonctionnel. */
112
+ objective: z.string().min(1),
113
+ /** Comment elle y parvient : choix d'architecture, flux principal. */
114
+ approach: z.string().min(1),
115
+ /** Risques et points à vérifier en priorité. */
116
+ attentionPoints: z.array(z.string().min(1)),
117
+ });
118
+ /** Nom de projet : non vide, sans espace en tête ni en fin. */
119
+ export const ProjectNameSchema = z
120
+ .string()
121
+ .min(1)
122
+ .refine((value) => value === value.trim(), "must not start or end with whitespace");
123
+ export const AnalysisSchema = z.object({
124
+ id: z.string().regex(ANALYSIS_ID_PATTERN),
125
+ title: z.string().min(1),
126
+ /** Projet ou feature auquel l'analyse appartient ; sert de dossier de rangement. */
127
+ project: ProjectNameSchema,
128
+ repoPath: z.string().min(1),
129
+ mode: z.enum(ANALYSIS_MODES),
130
+ /** Ref de base en mode `branch` ; "HEAD" en mode `working_tree`. */
131
+ base: z.string().min(1),
132
+ /** Ref de tête en mode `branch` ; null en mode `working_tree`. */
133
+ head: z.string().min(1).nullable(),
134
+ baseCommit: z.string().min(1),
135
+ headCommit: z.string().min(1).nullable(),
136
+ snapshotAt: IsoDateSchema,
137
+ request: RequestSchema.nullable(),
138
+ overview: OverviewSchema.nullable(),
139
+ /** Changements fonctionnels de la feature, une puce par changement. */
140
+ summary: z.array(z.string().min(1)),
141
+ files: z.array(FileEntrySchema),
142
+ findings: z.array(FindingSchema),
143
+ notes: z.array(NoteSchema),
144
+ diagrams: z.array(DiagramSchema),
145
+ review: ReviewSchema,
146
+ revision: z.number().int().nonnegative(),
147
+ createdAt: IsoDateSchema,
148
+ updatedAt: IsoDateSchema,
149
+ lastEditor: z.enum(EDITORS),
150
+ });
151
+ /** État d'avancement d'une revue, dérivé des fichiers revus et de la soumission. */
152
+ export const REVIEW_PROGRESS_STATES = ["not_started", "in_progress", "files_reviewed", "submitted"];
@@ -0,0 +1,92 @@
1
+ import { z } from "zod";
2
+ export declare const SetFileReviewedBodySchema: z.ZodObject<{
3
+ path: z.ZodString;
4
+ reviewed: z.ZodBoolean;
5
+ baseRevision: z.ZodNumber;
6
+ }, z.core.$strict>;
7
+ export declare const SetFindingStatusBodySchema: z.ZodObject<{
8
+ status: z.ZodEnum<{
9
+ ignored: "ignored";
10
+ open: "open";
11
+ outdated: "outdated";
12
+ }>;
13
+ baseRevision: z.ZodNumber;
14
+ }, z.core.$strict>;
15
+ /** Remarque sur une ligne du côté « nouveau » (`line`), ou sur le fichier entier (`line` absent ou null). */
16
+ export declare const AddNoteBodySchema: z.ZodObject<{
17
+ path: z.ZodString;
18
+ line: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
19
+ text: z.ZodString;
20
+ baseRevision: z.ZodNumber;
21
+ }, z.core.$strict>;
22
+ export declare const DeleteNoteBodySchema: z.ZodObject<{
23
+ baseRevision: z.ZodNumber;
24
+ }, z.core.$strict>;
25
+ export declare const SubmitReviewBodySchema: z.ZodObject<{
26
+ decision: z.ZodEnum<{
27
+ approve: "approve";
28
+ reject: "reject";
29
+ request_changes: "request_changes";
30
+ }>;
31
+ findingIds: z.ZodArray<z.ZodString>;
32
+ noteIds: z.ZodArray<z.ZodString>;
33
+ baseRevision: z.ZodNumber;
34
+ }, z.core.$strict>;
35
+ export type SetFileReviewedBody = z.infer<typeof SetFileReviewedBodySchema>;
36
+ export type SetFindingStatusBody = z.infer<typeof SetFindingStatusBodySchema>;
37
+ export type AddNoteBody = z.infer<typeof AddNoteBodySchema>;
38
+ export type DeleteNoteBody = z.infer<typeof DeleteNoteBodySchema>;
39
+ export type SubmitReviewBody = z.infer<typeof SubmitReviewBodySchema>;
40
+ /** Données IPC des requêtes de la GUI qui visent une analyse. */
41
+ export declare const AnalysisRequestSchema: z.ZodObject<{
42
+ analysisId: z.ZodString;
43
+ }, z.core.$strict>;
44
+ export declare const SetFileReviewedRequestSchema: z.ZodObject<{
45
+ analysisId: z.ZodString;
46
+ body: z.ZodObject<{
47
+ path: z.ZodString;
48
+ reviewed: z.ZodBoolean;
49
+ baseRevision: z.ZodNumber;
50
+ }, z.core.$strict>;
51
+ }, z.core.$strict>;
52
+ export declare const SetFindingStatusRequestSchema: z.ZodObject<{
53
+ analysisId: z.ZodString;
54
+ findingId: z.ZodString;
55
+ body: z.ZodObject<{
56
+ status: z.ZodEnum<{
57
+ ignored: "ignored";
58
+ open: "open";
59
+ outdated: "outdated";
60
+ }>;
61
+ baseRevision: z.ZodNumber;
62
+ }, z.core.$strict>;
63
+ }, z.core.$strict>;
64
+ export declare const AddNoteRequestSchema: z.ZodObject<{
65
+ analysisId: z.ZodString;
66
+ body: z.ZodObject<{
67
+ path: z.ZodString;
68
+ line: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
69
+ text: z.ZodString;
70
+ baseRevision: z.ZodNumber;
71
+ }, z.core.$strict>;
72
+ }, z.core.$strict>;
73
+ export declare const DeleteNoteRequestSchema: z.ZodObject<{
74
+ analysisId: z.ZodString;
75
+ noteId: z.ZodString;
76
+ body: z.ZodObject<{
77
+ baseRevision: z.ZodNumber;
78
+ }, z.core.$strict>;
79
+ }, z.core.$strict>;
80
+ export declare const SubmitReviewRequestSchema: z.ZodObject<{
81
+ analysisId: z.ZodString;
82
+ body: z.ZodObject<{
83
+ decision: z.ZodEnum<{
84
+ approve: "approve";
85
+ reject: "reject";
86
+ request_changes: "request_changes";
87
+ }>;
88
+ findingIds: z.ZodArray<z.ZodString>;
89
+ noteIds: z.ZodArray<z.ZodString>;
90
+ baseRevision: z.ZodNumber;
91
+ }, z.core.$strict>;
92
+ }, z.core.$strict>;
@@ -0,0 +1,46 @@
1
+ import { z } from "zod";
2
+ import { FINDING_STATUSES, REVIEW_DECISIONS } from "./analysis.schema.js";
3
+ /**
4
+ * Corps des requêtes de modification envoyées par la GUI. Chaque corps porte
5
+ * `baseRevision`, la révision de l'analyse affichée : le serveur refuse la
6
+ * modification si l'analyse a avancé depuis.
7
+ */
8
+ const BaseRevisionSchema = z.number().int().nonnegative();
9
+ export const SetFileReviewedBodySchema = z.strictObject({
10
+ path: z.string().min(1),
11
+ reviewed: z.boolean(),
12
+ baseRevision: BaseRevisionSchema,
13
+ });
14
+ export const SetFindingStatusBodySchema = z.strictObject({
15
+ status: z.enum(FINDING_STATUSES),
16
+ baseRevision: BaseRevisionSchema,
17
+ });
18
+ /** Remarque sur une ligne du côté « nouveau » (`line`), ou sur le fichier entier (`line` absent ou null). */
19
+ export const AddNoteBodySchema = z.strictObject({
20
+ path: z.string().min(1),
21
+ line: z.number().int().nullable().optional(),
22
+ text: z.string().trim().min(1, "the note text is empty"),
23
+ baseRevision: BaseRevisionSchema,
24
+ });
25
+ export const DeleteNoteBodySchema = z.strictObject({
26
+ baseRevision: BaseRevisionSchema,
27
+ });
28
+ export const SubmitReviewBodySchema = z.strictObject({
29
+ decision: z.enum(REVIEW_DECISIONS),
30
+ findingIds: z.array(z.string().min(1)),
31
+ noteIds: z.array(z.string().min(1)),
32
+ baseRevision: BaseRevisionSchema,
33
+ });
34
+ /** Données IPC des requêtes de la GUI qui visent une analyse. */
35
+ export const AnalysisRequestSchema = z.strictObject({ analysisId: z.string().min(1) });
36
+ export const SetFileReviewedRequestSchema = AnalysisRequestSchema.extend({ body: SetFileReviewedBodySchema });
37
+ export const SetFindingStatusRequestSchema = AnalysisRequestSchema.extend({
38
+ findingId: z.string().min(1),
39
+ body: SetFindingStatusBodySchema,
40
+ });
41
+ export const AddNoteRequestSchema = AnalysisRequestSchema.extend({ body: AddNoteBodySchema });
42
+ export const DeleteNoteRequestSchema = AnalysisRequestSchema.extend({
43
+ noteId: z.string().min(1),
44
+ body: DeleteNoteBodySchema,
45
+ });
46
+ export const SubmitReviewRequestSchema = AnalysisRequestSchema.extend({ body: SubmitReviewBodySchema });