@mytechtoday/augment-extensions 2.2.0 → 2.3.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/README.md +121 -11
- package/augment-extensions/coding-standards/perl/README.md +173 -0
- package/cli/dist/commands/generate-shot-list/formatter/json-formatter.d.ts +1 -0
- package/cli/dist/commands/generate-shot-list/formatter/json-formatter.d.ts.map +1 -1
- package/cli/dist/commands/generate-shot-list/formatter/json-formatter.js +6 -0
- package/cli/dist/commands/generate-shot-list/formatter/json-formatter.js.map +1 -1
- package/cli/dist/commands/generate-shot-list/formatter/jsonl-formatter.d.ts +1 -0
- package/cli/dist/commands/generate-shot-list/formatter/jsonl-formatter.d.ts.map +1 -1
- package/cli/dist/commands/generate-shot-list/formatter/jsonl-formatter.js +6 -0
- package/cli/dist/commands/generate-shot-list/formatter/jsonl-formatter.js.map +1 -1
- package/cli/dist/commands/generate-shot-list/formatter/markdown-formatter.d.ts +14 -0
- package/cli/dist/commands/generate-shot-list/formatter/markdown-formatter.d.ts.map +1 -1
- package/cli/dist/commands/generate-shot-list/formatter/markdown-formatter.js +46 -3
- package/cli/dist/commands/generate-shot-list/formatter/markdown-formatter.js.map +1 -1
- package/cli/dist/commands/generate-shot-list/generator/context-builder.d.ts +29 -1
- package/cli/dist/commands/generate-shot-list/generator/context-builder.d.ts.map +1 -1
- package/cli/dist/commands/generate-shot-list/generator/context-builder.js +310 -27
- package/cli/dist/commands/generate-shot-list/generator/context-builder.js.map +1 -1
- package/cli/dist/commands/generate-shot-list/generator/index.d.ts +18 -0
- package/cli/dist/commands/generate-shot-list/generator/index.d.ts.map +1 -1
- package/cli/dist/commands/generate-shot-list/generator/index.js +146 -19
- package/cli/dist/commands/generate-shot-list/generator/index.js.map +1 -1
- package/cli/dist/commands/generate-shot-list/generator/metadata-extractor.d.ts.map +1 -1
- package/cli/dist/commands/generate-shot-list/generator/metadata-extractor.js +1 -0
- package/cli/dist/commands/generate-shot-list/generator/metadata-extractor.js.map +1 -1
- package/cli/dist/commands/generate-shot-list/generator/types.d.ts +10 -3
- package/cli/dist/commands/generate-shot-list/generator/types.d.ts.map +1 -1
- package/cli/dist/commands/generate-shot-list/schema/shot-list.schema.json +341 -0
- package/cli/dist/commands/generate-shot-list/schema/validator.d.ts +55 -0
- package/cli/dist/commands/generate-shot-list/schema/validator.d.ts.map +1 -0
- package/cli/dist/commands/generate-shot-list/schema/validator.js +180 -0
- package/cli/dist/commands/generate-shot-list/schema/validator.js.map +1 -0
- package/cli/dist/commands/generate-shot-list.d.ts.map +1 -1
- package/cli/dist/commands/generate-shot-list.js +35 -24
- package/cli/dist/commands/generate-shot-list.js.map +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "https://augment.dev/schemas/shot-list/shot-list.json",
|
|
4
|
+
"title": "Shot List",
|
|
5
|
+
"description": "JSON schema for AI-optimized shot lists generated from screenplays",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": ["metadata", "summary", "shots"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"metadata": {
|
|
10
|
+
"type": "object",
|
|
11
|
+
"required": ["generatedAt", "sourceFormat", "maxCharacters", "maxShotLength"],
|
|
12
|
+
"properties": {
|
|
13
|
+
"title": {
|
|
14
|
+
"type": ["string", "null"],
|
|
15
|
+
"description": "Screenplay title"
|
|
16
|
+
},
|
|
17
|
+
"author": {
|
|
18
|
+
"type": ["string", "null"],
|
|
19
|
+
"description": "Screenplay author"
|
|
20
|
+
},
|
|
21
|
+
"generatedAt": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"format": "date-time",
|
|
24
|
+
"description": "ISO 8601 timestamp of generation"
|
|
25
|
+
},
|
|
26
|
+
"sourceFormat": {
|
|
27
|
+
"type": "string",
|
|
28
|
+
"enum": ["fountain", "markdown", "plaintext"],
|
|
29
|
+
"description": "Source screenplay format"
|
|
30
|
+
},
|
|
31
|
+
"maxCharacters": {
|
|
32
|
+
"type": "integer",
|
|
33
|
+
"minimum": 1,
|
|
34
|
+
"description": "Maximum characters per shot"
|
|
35
|
+
},
|
|
36
|
+
"maxShotLength": {
|
|
37
|
+
"type": "integer",
|
|
38
|
+
"minimum": 1,
|
|
39
|
+
"description": "Maximum shot length in seconds"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"summary": {
|
|
44
|
+
"type": "object",
|
|
45
|
+
"required": ["totalShots", "totalDuration", "totalCharacters"],
|
|
46
|
+
"properties": {
|
|
47
|
+
"totalShots": {
|
|
48
|
+
"type": "integer",
|
|
49
|
+
"minimum": 0,
|
|
50
|
+
"description": "Total number of shots"
|
|
51
|
+
},
|
|
52
|
+
"totalDuration": {
|
|
53
|
+
"type": "number",
|
|
54
|
+
"minimum": 0,
|
|
55
|
+
"description": "Total duration in seconds"
|
|
56
|
+
},
|
|
57
|
+
"totalDurationFormatted": {
|
|
58
|
+
"type": "string",
|
|
59
|
+
"pattern": "^([0-9]+h )?([0-9]+m )?[0-9]+s$",
|
|
60
|
+
"description": "Total duration in human-readable format (e.g., '8s', '1m 30s', '2h 15m 30s')"
|
|
61
|
+
},
|
|
62
|
+
"totalCharacters": {
|
|
63
|
+
"type": "integer",
|
|
64
|
+
"minimum": 0,
|
|
65
|
+
"description": "Total character count across all shots"
|
|
66
|
+
},
|
|
67
|
+
"averageShotLength": {
|
|
68
|
+
"type": "number",
|
|
69
|
+
"minimum": 0,
|
|
70
|
+
"description": "Average shot length in seconds"
|
|
71
|
+
},
|
|
72
|
+
"averageCharacters": {
|
|
73
|
+
"type": "integer",
|
|
74
|
+
"minimum": 0,
|
|
75
|
+
"description": "Average character count per shot"
|
|
76
|
+
},
|
|
77
|
+
"maxCharacters": {
|
|
78
|
+
"type": "integer",
|
|
79
|
+
"minimum": 0,
|
|
80
|
+
"description": "Maximum character count in any single shot"
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
"warnings": {
|
|
85
|
+
"type": "array",
|
|
86
|
+
"items": {
|
|
87
|
+
"$ref": "#/definitions/warning"
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
"shots": {
|
|
91
|
+
"type": "array",
|
|
92
|
+
"items": {
|
|
93
|
+
"$ref": "#/definitions/shot"
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
"definitions": {
|
|
98
|
+
"shot": {
|
|
99
|
+
"type": "object",
|
|
100
|
+
"required": ["number", "sceneNumber", "heading", "context", "characters", "description", "dialogue", "metadata", "duration", "characterCount", "warnings"],
|
|
101
|
+
"properties": {
|
|
102
|
+
"number": {
|
|
103
|
+
"oneOf": [
|
|
104
|
+
{ "type": "integer", "minimum": 1 },
|
|
105
|
+
{ "type": "string", "pattern": "^[0-9]+[a-z]$" }
|
|
106
|
+
],
|
|
107
|
+
"description": "Shot number (integer or sub-shot like '3a')"
|
|
108
|
+
},
|
|
109
|
+
"sceneNumber": {
|
|
110
|
+
"type": "integer",
|
|
111
|
+
"minimum": 1,
|
|
112
|
+
"description": "Scene number"
|
|
113
|
+
},
|
|
114
|
+
"heading": {
|
|
115
|
+
"$ref": "#/definitions/sceneHeading"
|
|
116
|
+
},
|
|
117
|
+
"context": {
|
|
118
|
+
"$ref": "#/definitions/sceneContext"
|
|
119
|
+
},
|
|
120
|
+
"characters": {
|
|
121
|
+
"type": "array",
|
|
122
|
+
"items": {
|
|
123
|
+
"$ref": "#/definitions/characterState"
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
"description": {
|
|
127
|
+
"type": "string",
|
|
128
|
+
"description": "Shot description"
|
|
129
|
+
},
|
|
130
|
+
"dialogue": {
|
|
131
|
+
"type": "string",
|
|
132
|
+
"description": "Dialogue in MPAA format or 'No dialogue in this shot'"
|
|
133
|
+
},
|
|
134
|
+
"metadata": {
|
|
135
|
+
"$ref": "#/definitions/shotMetadata"
|
|
136
|
+
},
|
|
137
|
+
"duration": {
|
|
138
|
+
"$ref": "#/definitions/duration"
|
|
139
|
+
},
|
|
140
|
+
"characterCount": {
|
|
141
|
+
"$ref": "#/definitions/characterCount"
|
|
142
|
+
},
|
|
143
|
+
"warnings": {
|
|
144
|
+
"type": "array",
|
|
145
|
+
"items": {
|
|
146
|
+
"$ref": "#/definitions/warning"
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
"sceneHeading": {
|
|
152
|
+
"type": "object",
|
|
153
|
+
"required": ["raw", "intExt", "location", "timeOfDay"],
|
|
154
|
+
"properties": {
|
|
155
|
+
"raw": {
|
|
156
|
+
"type": "string",
|
|
157
|
+
"description": "Raw scene heading text"
|
|
158
|
+
},
|
|
159
|
+
"intExt": {
|
|
160
|
+
"type": "string",
|
|
161
|
+
"enum": ["INT", "EXT", "INT/EXT"],
|
|
162
|
+
"description": "Interior or exterior"
|
|
163
|
+
},
|
|
164
|
+
"location": {
|
|
165
|
+
"type": "string",
|
|
166
|
+
"description": "Scene location"
|
|
167
|
+
},
|
|
168
|
+
"timeOfDay": {
|
|
169
|
+
"type": "string",
|
|
170
|
+
"description": "Time of day"
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
"sceneContext": {
|
|
175
|
+
"type": "object",
|
|
176
|
+
"required": ["set", "lighting", "timeOfDay"],
|
|
177
|
+
"properties": {
|
|
178
|
+
"set": {
|
|
179
|
+
"type": "string",
|
|
180
|
+
"description": "Set description"
|
|
181
|
+
},
|
|
182
|
+
"lighting": {
|
|
183
|
+
"type": "string",
|
|
184
|
+
"description": "Lighting description"
|
|
185
|
+
},
|
|
186
|
+
"timeOfDay": {
|
|
187
|
+
"type": "string",
|
|
188
|
+
"description": "Time of day"
|
|
189
|
+
},
|
|
190
|
+
"atmosphere": {
|
|
191
|
+
"type": ["string", "null"],
|
|
192
|
+
"description": "Atmosphere description"
|
|
193
|
+
},
|
|
194
|
+
"weather": {
|
|
195
|
+
"type": ["string", "null"],
|
|
196
|
+
"description": "Weather description"
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
"characterState": {
|
|
201
|
+
"type": "object",
|
|
202
|
+
"required": ["name", "position", "appearance"],
|
|
203
|
+
"properties": {
|
|
204
|
+
"name": {
|
|
205
|
+
"type": "string",
|
|
206
|
+
"description": "Character name"
|
|
207
|
+
},
|
|
208
|
+
"position": {
|
|
209
|
+
"type": "string",
|
|
210
|
+
"description": "Character position/blocking"
|
|
211
|
+
},
|
|
212
|
+
"appearance": {
|
|
213
|
+
"type": "string",
|
|
214
|
+
"description": "Character appearance"
|
|
215
|
+
},
|
|
216
|
+
"wardrobe": {
|
|
217
|
+
"type": ["string", "null"],
|
|
218
|
+
"description": "Full wardrobe description"
|
|
219
|
+
},
|
|
220
|
+
"physicalAppearance": {
|
|
221
|
+
"type": ["string", "null"],
|
|
222
|
+
"description": "Physical appearance details"
|
|
223
|
+
},
|
|
224
|
+
"emotion": {
|
|
225
|
+
"type": ["string", "null"],
|
|
226
|
+
"description": "Emotional state"
|
|
227
|
+
},
|
|
228
|
+
"action": {
|
|
229
|
+
"type": ["string", "null"],
|
|
230
|
+
"description": "Current action"
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
"shotMetadata": {
|
|
235
|
+
"type": "object",
|
|
236
|
+
"required": ["shotType", "cameraMovement", "framing", "visualStyle"],
|
|
237
|
+
"properties": {
|
|
238
|
+
"shotType": {
|
|
239
|
+
"type": "string",
|
|
240
|
+
"enum": ["establishing", "wide", "medium", "close-up", "extreme-close-up", "over-the-shoulder", "point-of-view", "insert", "cutaway"],
|
|
241
|
+
"description": "Shot type classification"
|
|
242
|
+
},
|
|
243
|
+
"cameraMovement": {
|
|
244
|
+
"type": "string",
|
|
245
|
+
"enum": ["static", "pan", "tilt", "dolly", "track", "crane", "handheld", "steadicam", "zoom"],
|
|
246
|
+
"description": "Camera movement type"
|
|
247
|
+
},
|
|
248
|
+
"framing": {
|
|
249
|
+
"type": "string",
|
|
250
|
+
"enum": ["wide", "medium", "close-up", "extreme-close-up", "full-shot", "medium-shot", "medium-close-up"],
|
|
251
|
+
"description": "Camera framing"
|
|
252
|
+
},
|
|
253
|
+
"visualStyle": {
|
|
254
|
+
"type": "string",
|
|
255
|
+
"enum": ["Reality", "Animation", "CGI", "Hybrid"],
|
|
256
|
+
"description": "Visual style classification"
|
|
257
|
+
},
|
|
258
|
+
"cinematicStyle": {
|
|
259
|
+
"type": ["string", "null"],
|
|
260
|
+
"description": "Cinematic style name(s)"
|
|
261
|
+
},
|
|
262
|
+
"technicalNotes": {
|
|
263
|
+
"type": "array",
|
|
264
|
+
"items": {
|
|
265
|
+
"type": "string"
|
|
266
|
+
},
|
|
267
|
+
"description": "Technical notes"
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
"duration": {
|
|
272
|
+
"type": "object",
|
|
273
|
+
"required": ["seconds", "formatted"],
|
|
274
|
+
"properties": {
|
|
275
|
+
"seconds": {
|
|
276
|
+
"type": "number",
|
|
277
|
+
"minimum": 0,
|
|
278
|
+
"description": "Duration in seconds"
|
|
279
|
+
},
|
|
280
|
+
"formatted": {
|
|
281
|
+
"type": "string",
|
|
282
|
+
"pattern": "^[0-9]+:[0-5][0-9]$",
|
|
283
|
+
"description": "Duration in MM:SS format"
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
"characterCount": {
|
|
288
|
+
"type": "object",
|
|
289
|
+
"required": ["count", "limit", "percentage"],
|
|
290
|
+
"properties": {
|
|
291
|
+
"count": {
|
|
292
|
+
"type": "integer",
|
|
293
|
+
"minimum": 0,
|
|
294
|
+
"description": "Character count"
|
|
295
|
+
},
|
|
296
|
+
"limit": {
|
|
297
|
+
"type": "integer",
|
|
298
|
+
"minimum": 1,
|
|
299
|
+
"description": "Character limit"
|
|
300
|
+
},
|
|
301
|
+
"percentage": {
|
|
302
|
+
"type": "integer",
|
|
303
|
+
"minimum": 0,
|
|
304
|
+
"maximum": 100,
|
|
305
|
+
"description": "Percentage of limit used"
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
},
|
|
309
|
+
"warning": {
|
|
310
|
+
"type": "object",
|
|
311
|
+
"required": ["type", "message", "shotNumber", "severity"],
|
|
312
|
+
"properties": {
|
|
313
|
+
"type": {
|
|
314
|
+
"type": "string",
|
|
315
|
+
"enum": ["character-limit-warning", "character-limit-error", "duration-limit-warning", "duration-limit-error", "missing-context", "ambiguous-action"],
|
|
316
|
+
"description": "Warning type"
|
|
317
|
+
},
|
|
318
|
+
"message": {
|
|
319
|
+
"type": "string",
|
|
320
|
+
"description": "Warning message"
|
|
321
|
+
},
|
|
322
|
+
"shotNumber": {
|
|
323
|
+
"oneOf": [
|
|
324
|
+
{ "type": "integer", "minimum": 1 },
|
|
325
|
+
{ "type": "string", "pattern": "^[0-9]+[a-z]?$" }
|
|
326
|
+
],
|
|
327
|
+
"description": "Shot number"
|
|
328
|
+
},
|
|
329
|
+
"severity": {
|
|
330
|
+
"type": "string",
|
|
331
|
+
"enum": ["warning", "error"],
|
|
332
|
+
"description": "Severity level"
|
|
333
|
+
},
|
|
334
|
+
"suggestion": {
|
|
335
|
+
"type": ["string", "null"],
|
|
336
|
+
"description": "Suggested fix"
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON Schema Validator
|
|
3
|
+
*
|
|
4
|
+
* Validates shot list JSON output against the JSON schema
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Validation result
|
|
8
|
+
*/
|
|
9
|
+
export interface ValidationResult {
|
|
10
|
+
valid: boolean;
|
|
11
|
+
errors?: ValidationError[];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Validation error
|
|
15
|
+
*/
|
|
16
|
+
export interface ValidationError {
|
|
17
|
+
path: string;
|
|
18
|
+
message: string;
|
|
19
|
+
keyword?: string;
|
|
20
|
+
params?: Record<string, any>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Schema validator for shot lists
|
|
24
|
+
*/
|
|
25
|
+
export declare class SchemaValidator {
|
|
26
|
+
private ajv;
|
|
27
|
+
private validator;
|
|
28
|
+
private shotValidator;
|
|
29
|
+
constructor();
|
|
30
|
+
/**
|
|
31
|
+
* Validate shot list JSON against schema
|
|
32
|
+
*/
|
|
33
|
+
validate(data: any): ValidationResult;
|
|
34
|
+
/**
|
|
35
|
+
* Validate JSON string
|
|
36
|
+
*/
|
|
37
|
+
validateJSON(jsonString: string): ValidationResult;
|
|
38
|
+
/**
|
|
39
|
+
* Validate JSONL string (one shot per line)
|
|
40
|
+
*/
|
|
41
|
+
validateJSONL(jsonlString: string): ValidationResult;
|
|
42
|
+
/**
|
|
43
|
+
* Format AJV errors into readable format
|
|
44
|
+
*/
|
|
45
|
+
private formatErrors;
|
|
46
|
+
/**
|
|
47
|
+
* Get human-readable error summary
|
|
48
|
+
*/
|
|
49
|
+
getErrorSummary(result: ValidationResult): string;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Get or create validator instance
|
|
53
|
+
*/
|
|
54
|
+
export declare function getValidator(): SchemaValidator;
|
|
55
|
+
//# sourceMappingURL=validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../../../src/commands/generate-shot-list/schema/validator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,eAAe,EAAE,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC9B;AAED;;GAEG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,GAAG,CAAM;IACjB,OAAO,CAAC,SAAS,CAAmB;IACpC,OAAO,CAAC,aAAa,CAAiC;;IAyBtD;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,GAAG,GAAG,gBAAgB;IAYrC;;OAEG;IACH,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,gBAAgB;IAelD;;OAEG;IACH,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,gBAAgB;IA2CpD;;OAEG;IACH,OAAO,CAAC,YAAY;IASpB;;OAEG;IACH,eAAe,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM;CAYlD;AAOD;;GAEG;AACH,wBAAgB,YAAY,IAAI,eAAe,CAK9C"}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* JSON Schema Validator
|
|
4
|
+
*
|
|
5
|
+
* Validates shot list JSON output against the JSON schema
|
|
6
|
+
*/
|
|
7
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
+
}
|
|
13
|
+
Object.defineProperty(o, k2, desc);
|
|
14
|
+
}) : (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
o[k2] = m[k];
|
|
17
|
+
}));
|
|
18
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
19
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
20
|
+
}) : function(o, v) {
|
|
21
|
+
o["default"] = v;
|
|
22
|
+
});
|
|
23
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
24
|
+
var ownKeys = function(o) {
|
|
25
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
26
|
+
var ar = [];
|
|
27
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
28
|
+
return ar;
|
|
29
|
+
};
|
|
30
|
+
return ownKeys(o);
|
|
31
|
+
};
|
|
32
|
+
return function (mod) {
|
|
33
|
+
if (mod && mod.__esModule) return mod;
|
|
34
|
+
var result = {};
|
|
35
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
36
|
+
__setModuleDefault(result, mod);
|
|
37
|
+
return result;
|
|
38
|
+
};
|
|
39
|
+
})();
|
|
40
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
41
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
42
|
+
};
|
|
43
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
+
exports.SchemaValidator = void 0;
|
|
45
|
+
exports.getValidator = getValidator;
|
|
46
|
+
const ajv_1 = __importDefault(require("ajv"));
|
|
47
|
+
const ajv_formats_1 = __importDefault(require("ajv-formats"));
|
|
48
|
+
const schema = __importStar(require("./shot-list.schema.json"));
|
|
49
|
+
/**
|
|
50
|
+
* Schema validator for shot lists
|
|
51
|
+
*/
|
|
52
|
+
class SchemaValidator {
|
|
53
|
+
constructor() {
|
|
54
|
+
this.shotValidator = null;
|
|
55
|
+
// Initialize AJV with strict mode and formats
|
|
56
|
+
this.ajv = new ajv_1.default({
|
|
57
|
+
strict: true,
|
|
58
|
+
allErrors: true,
|
|
59
|
+
verbose: true
|
|
60
|
+
});
|
|
61
|
+
// Add format validators (date-time, etc.)
|
|
62
|
+
(0, ajv_formats_1.default)(this.ajv);
|
|
63
|
+
// Compile schema
|
|
64
|
+
this.validator = this.ajv.compile(schema);
|
|
65
|
+
// Compile shot schema for JSONL validation
|
|
66
|
+
if (schema.definitions?.shot) {
|
|
67
|
+
this.shotValidator = this.ajv.compile({
|
|
68
|
+
...schema.definitions.shot,
|
|
69
|
+
definitions: schema.definitions
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Validate shot list JSON against schema
|
|
75
|
+
*/
|
|
76
|
+
validate(data) {
|
|
77
|
+
const valid = this.validator(data);
|
|
78
|
+
if (valid) {
|
|
79
|
+
return { valid: true };
|
|
80
|
+
}
|
|
81
|
+
// Format errors
|
|
82
|
+
const errors = this.formatErrors(this.validator.errors || []);
|
|
83
|
+
return { valid: false, errors };
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Validate JSON string
|
|
87
|
+
*/
|
|
88
|
+
validateJSON(jsonString) {
|
|
89
|
+
try {
|
|
90
|
+
const data = JSON.parse(jsonString);
|
|
91
|
+
return this.validate(data);
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
return {
|
|
95
|
+
valid: false,
|
|
96
|
+
errors: [{
|
|
97
|
+
path: '',
|
|
98
|
+
message: `Invalid JSON: ${error instanceof Error ? error.message : String(error)}`
|
|
99
|
+
}]
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Validate JSONL string (one shot per line)
|
|
105
|
+
*/
|
|
106
|
+
validateJSONL(jsonlString) {
|
|
107
|
+
const lines = jsonlString.trim().split('\n');
|
|
108
|
+
const errors = [];
|
|
109
|
+
if (!this.shotValidator) {
|
|
110
|
+
return {
|
|
111
|
+
valid: false,
|
|
112
|
+
errors: [{
|
|
113
|
+
path: '',
|
|
114
|
+
message: 'Shot schema not available for JSONL validation'
|
|
115
|
+
}]
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
for (let i = 0; i < lines.length; i++) {
|
|
119
|
+
const line = lines[i].trim();
|
|
120
|
+
if (!line)
|
|
121
|
+
continue;
|
|
122
|
+
try {
|
|
123
|
+
const shot = JSON.parse(line);
|
|
124
|
+
// Validate against shot schema
|
|
125
|
+
const valid = this.shotValidator(shot);
|
|
126
|
+
if (!valid) {
|
|
127
|
+
const lineErrors = this.formatErrors(this.shotValidator.errors || [], `line ${i + 1}`);
|
|
128
|
+
errors.push(...lineErrors);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
catch (error) {
|
|
132
|
+
errors.push({
|
|
133
|
+
path: `line ${i + 1}`,
|
|
134
|
+
message: `Invalid JSON: ${error instanceof Error ? error.message : String(error)}`
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
if (errors.length > 0) {
|
|
139
|
+
return { valid: false, errors };
|
|
140
|
+
}
|
|
141
|
+
return { valid: true };
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Format AJV errors into readable format
|
|
145
|
+
*/
|
|
146
|
+
formatErrors(ajvErrors, prefix = '') {
|
|
147
|
+
return ajvErrors.map(error => ({
|
|
148
|
+
path: prefix ? `${prefix}${error.instancePath}` : error.instancePath,
|
|
149
|
+
message: error.message || 'Validation error',
|
|
150
|
+
keyword: error.keyword,
|
|
151
|
+
params: error.params
|
|
152
|
+
}));
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Get human-readable error summary
|
|
156
|
+
*/
|
|
157
|
+
getErrorSummary(result) {
|
|
158
|
+
if (result.valid) {
|
|
159
|
+
return 'Validation passed';
|
|
160
|
+
}
|
|
161
|
+
const errors = result.errors || [];
|
|
162
|
+
const summary = errors.map(err => ` - ${err.path || 'root'}: ${err.message}`).join('\n');
|
|
163
|
+
return `Validation failed with ${errors.length} error(s):\n${summary}`;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
exports.SchemaValidator = SchemaValidator;
|
|
167
|
+
/**
|
|
168
|
+
* Singleton validator instance
|
|
169
|
+
*/
|
|
170
|
+
let validatorInstance = null;
|
|
171
|
+
/**
|
|
172
|
+
* Get or create validator instance
|
|
173
|
+
*/
|
|
174
|
+
function getValidator() {
|
|
175
|
+
if (!validatorInstance) {
|
|
176
|
+
validatorInstance = new SchemaValidator();
|
|
177
|
+
}
|
|
178
|
+
return validatorInstance;
|
|
179
|
+
}
|
|
180
|
+
//# sourceMappingURL=validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validator.js","sourceRoot":"","sources":["../../../../src/commands/generate-shot-list/schema/validator.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2KH,oCAKC;AA9KD,8CAAyD;AACzD,8DAAqC;AACrC,gEAAkD;AAoBlD;;GAEG;AACH,MAAa,eAAe;IAK1B;QAFQ,kBAAa,GAA4B,IAAI,CAAC;QAGpD,8CAA8C;QAC9C,IAAI,CAAC,GAAG,GAAG,IAAI,aAAG,CAAC;YACjB,MAAM,EAAE,IAAI;YACZ,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,IAAI;SACd,CAAC,CAAC;QAEH,0CAA0C;QAC1C,IAAA,qBAAU,EAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAErB,iBAAiB;QACjB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAE1C,2CAA2C;QAC3C,IAAI,MAAM,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC;YAC7B,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC;gBACpC,GAAG,MAAM,CAAC,WAAW,CAAC,IAAI;gBAC1B,WAAW,EAAE,MAAM,CAAC,WAAW;aAChC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED;;OAEG;IACH,QAAQ,CAAC,IAAS;QAChB,MAAM,KAAK,GAAG,I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AK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC1B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,CAAC,CAAC,EAAE,OAAO,CAAC;CACb;AAED,wBAAsB,uBAAuB,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"generate-shot-list.d.ts","sourceRoot":"","sources":["../../src/commands/generate-shot-list.ts"],"names":[],"mappings":"AAaA,UAAU,uBAAuB;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC1B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,CAAC,CAAC,EAAE,OAAO,CAAC;CACb;AAED,wBAAsB,uBAAuB,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC,CAoR7F"}
|