@pavanyn/docugen 1.0.5 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/dist/adapters/instructions.d.ts.map +1 -1
- package/dist/adapters/instructions.js +3 -0
- package/dist/adapters/instructions.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +46 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/walkthrough.d.ts +28 -0
- package/dist/commands/walkthrough.d.ts.map +1 -0
- package/dist/commands/walkthrough.js +102 -0
- package/dist/commands/walkthrough.js.map +1 -0
- package/dist/config/gitignore.d.ts +5 -7
- package/dist/config/gitignore.d.ts.map +1 -1
- package/dist/config/gitignore.js +49 -6
- package/dist/config/gitignore.js.map +1 -1
- package/dist/config/load.d.ts.map +1 -1
- package/dist/config/load.js +3 -1
- package/dist/config/load.js.map +1 -1
- package/dist/config/paths.d.ts +2 -0
- package/dist/config/paths.d.ts.map +1 -1
- package/dist/config/paths.js +2 -0
- package/dist/config/paths.js.map +1 -1
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +1 -0
- package/dist/config/schema.js.map +1 -1
- package/dist/extract/config/index.d.ts.map +1 -1
- package/dist/extract/config/index.js +14 -6
- package/dist/extract/config/index.js.map +1 -1
- package/dist/extract/endpoints/index.d.ts.map +1 -1
- package/dist/extract/endpoints/index.js +8 -1
- package/dist/extract/endpoints/index.js.map +1 -1
- package/dist/extract/endpoints/vercel.d.ts +13 -0
- package/dist/extract/endpoints/vercel.d.ts.map +1 -0
- package/dist/extract/endpoints/vercel.js +51 -0
- package/dist/extract/endpoints/vercel.js.map +1 -0
- package/dist/extract/routes/react-router.d.ts.map +1 -1
- package/dist/extract/routes/react-router.js +13 -5
- package/dist/extract/routes/react-router.js.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/infer/context.d.ts.map +1 -1
- package/dist/infer/context.js +25 -6
- package/dist/infer/context.js.map +1 -1
- package/dist/legacy/inventory.d.ts.map +1 -1
- package/dist/legacy/inventory.js +1 -0
- package/dist/legacy/inventory.js.map +1 -1
- package/dist/pilot/schema.d.ts +4 -4
- package/dist/render/diagrams.d.ts.map +1 -1
- package/dist/render/diagrams.js +20 -2
- package/dist/render/diagrams.js.map +1 -1
- package/dist/render/index.d.ts +1 -0
- package/dist/render/index.d.ts.map +1 -1
- package/dist/render/index.js +4 -0
- package/dist/render/index.js.map +1 -1
- package/dist/render/pages/readme.d.ts +1 -0
- package/dist/render/pages/readme.d.ts.map +1 -1
- package/dist/render/pages/readme.js +4 -1
- package/dist/render/pages/readme.js.map +1 -1
- package/dist/util/atomic.d.ts +1 -1
- package/dist/util/atomic.d.ts.map +1 -1
- package/dist/util/atomic.js.map +1 -1
- package/dist/util/generated.js +1 -1
- package/dist/util/generated.js.map +1 -1
- package/dist/verify/expected.d.ts +4 -1
- package/dist/verify/expected.d.ts.map +1 -1
- package/dist/verify/expected.js +5 -1
- package/dist/verify/expected.js.map +1 -1
- package/dist/walkthrough/capture.d.ts +222 -0
- package/dist/walkthrough/capture.d.ts.map +1 -0
- package/dist/walkthrough/capture.js +179 -0
- package/dist/walkthrough/capture.js.map +1 -0
- package/dist/walkthrough/render.d.ts +7 -0
- package/dist/walkthrough/render.d.ts.map +1 -0
- package/dist/walkthrough/render.js +54 -0
- package/dist/walkthrough/render.js.map +1 -0
- package/dist/walkthrough/schema.d.ts +248 -0
- package/dist/walkthrough/schema.d.ts.map +1 -0
- package/dist/walkthrough/schema.js +72 -0
- package/dist/walkthrough/schema.js.map +1 -0
- package/dist/walkthrough/store.d.ts +28 -0
- package/dist/walkthrough/store.d.ts.map +1 -0
- package/dist/walkthrough/store.js +204 -0
- package/dist/walkthrough/store.js.map +1 -0
- package/package.json +10 -1
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const WALKTHROUGH_SCHEMA_VERSION: 1;
|
|
3
|
+
export declare const MAX_SCREENSHOT_BYTES: number;
|
|
4
|
+
export declare function safeRelativeFile(value: string): boolean;
|
|
5
|
+
export declare const relativeFileSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
6
|
+
export declare const publicUrlSchema: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
7
|
+
export declare const walkthroughInputSchema: z.ZodObject<{
|
|
8
|
+
schemaVersion: z.ZodDefault<z.ZodLiteral<1>>;
|
|
9
|
+
id: z.ZodString;
|
|
10
|
+
title: z.ZodEffects<z.ZodString, string, string>;
|
|
11
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
12
|
+
steps: z.ZodArray<z.ZodObject<{
|
|
13
|
+
title: z.ZodEffects<z.ZodString, string, string>;
|
|
14
|
+
instruction: z.ZodString;
|
|
15
|
+
alt: z.ZodEffects<z.ZodString, string, string>;
|
|
16
|
+
expected: z.ZodOptional<z.ZodString>;
|
|
17
|
+
url: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
18
|
+
} & {
|
|
19
|
+
screenshot: z.ZodEffects<z.ZodString, string, string>;
|
|
20
|
+
}, "strict", z.ZodTypeAny, {
|
|
21
|
+
title: string;
|
|
22
|
+
instruction: string;
|
|
23
|
+
alt: string;
|
|
24
|
+
screenshot: string;
|
|
25
|
+
expected?: string | undefined;
|
|
26
|
+
url?: string | undefined;
|
|
27
|
+
}, {
|
|
28
|
+
title: string;
|
|
29
|
+
instruction: string;
|
|
30
|
+
alt: string;
|
|
31
|
+
screenshot: string;
|
|
32
|
+
expected?: string | undefined;
|
|
33
|
+
url?: string | undefined;
|
|
34
|
+
}>, "many">;
|
|
35
|
+
}, "strict", z.ZodTypeAny, {
|
|
36
|
+
id: string;
|
|
37
|
+
title: string;
|
|
38
|
+
schemaVersion: 1;
|
|
39
|
+
steps: {
|
|
40
|
+
title: string;
|
|
41
|
+
instruction: string;
|
|
42
|
+
alt: string;
|
|
43
|
+
screenshot: string;
|
|
44
|
+
expected?: string | undefined;
|
|
45
|
+
url?: string | undefined;
|
|
46
|
+
}[];
|
|
47
|
+
summary?: string | undefined;
|
|
48
|
+
}, {
|
|
49
|
+
id: string;
|
|
50
|
+
title: string;
|
|
51
|
+
steps: {
|
|
52
|
+
title: string;
|
|
53
|
+
instruction: string;
|
|
54
|
+
alt: string;
|
|
55
|
+
screenshot: string;
|
|
56
|
+
expected?: string | undefined;
|
|
57
|
+
url?: string | undefined;
|
|
58
|
+
}[];
|
|
59
|
+
summary?: string | undefined;
|
|
60
|
+
schemaVersion?: 1 | undefined;
|
|
61
|
+
}>;
|
|
62
|
+
export declare const walkthroughRecordSchema: z.ZodEffects<z.ZodObject<{
|
|
63
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
64
|
+
id: z.ZodString;
|
|
65
|
+
title: z.ZodEffects<z.ZodString, string, string>;
|
|
66
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
67
|
+
source: z.ZodEnum<["import", "capture"]>;
|
|
68
|
+
recordedBy: z.ZodString;
|
|
69
|
+
recordedAt: z.ZodString;
|
|
70
|
+
status: z.ZodEnum<["draft", "reviewed"]>;
|
|
71
|
+
contentHash: z.ZodString;
|
|
72
|
+
steps: z.ZodArray<z.ZodObject<{
|
|
73
|
+
title: z.ZodEffects<z.ZodString, string, string>;
|
|
74
|
+
instruction: z.ZodString;
|
|
75
|
+
alt: z.ZodEffects<z.ZodString, string, string>;
|
|
76
|
+
expected: z.ZodOptional<z.ZodString>;
|
|
77
|
+
url: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>>;
|
|
78
|
+
} & {
|
|
79
|
+
screenshot: z.ZodObject<{
|
|
80
|
+
file: z.ZodEffects<z.ZodString, string, string>;
|
|
81
|
+
sha256: z.ZodString;
|
|
82
|
+
mediaType: z.ZodEnum<["image/png", "image/jpeg", "image/webp"]>;
|
|
83
|
+
bytes: z.ZodNumber;
|
|
84
|
+
}, "strict", z.ZodTypeAny, {
|
|
85
|
+
file: string;
|
|
86
|
+
sha256: string;
|
|
87
|
+
mediaType: "image/png" | "image/jpeg" | "image/webp";
|
|
88
|
+
bytes: number;
|
|
89
|
+
}, {
|
|
90
|
+
file: string;
|
|
91
|
+
sha256: string;
|
|
92
|
+
mediaType: "image/png" | "image/jpeg" | "image/webp";
|
|
93
|
+
bytes: number;
|
|
94
|
+
}>;
|
|
95
|
+
}, "strict", z.ZodTypeAny, {
|
|
96
|
+
title: string;
|
|
97
|
+
instruction: string;
|
|
98
|
+
alt: string;
|
|
99
|
+
screenshot: {
|
|
100
|
+
file: string;
|
|
101
|
+
sha256: string;
|
|
102
|
+
mediaType: "image/png" | "image/jpeg" | "image/webp";
|
|
103
|
+
bytes: number;
|
|
104
|
+
};
|
|
105
|
+
expected?: string | undefined;
|
|
106
|
+
url?: string | undefined;
|
|
107
|
+
}, {
|
|
108
|
+
title: string;
|
|
109
|
+
instruction: string;
|
|
110
|
+
alt: string;
|
|
111
|
+
screenshot: {
|
|
112
|
+
file: string;
|
|
113
|
+
sha256: string;
|
|
114
|
+
mediaType: "image/png" | "image/jpeg" | "image/webp";
|
|
115
|
+
bytes: number;
|
|
116
|
+
};
|
|
117
|
+
expected?: string | undefined;
|
|
118
|
+
url?: string | undefined;
|
|
119
|
+
}>, "many">;
|
|
120
|
+
review: z.ZodOptional<z.ZodObject<{
|
|
121
|
+
reviewedBy: z.ZodString;
|
|
122
|
+
reviewedAt: z.ZodString;
|
|
123
|
+
contentHash: z.ZodString;
|
|
124
|
+
}, "strict", z.ZodTypeAny, {
|
|
125
|
+
contentHash: string;
|
|
126
|
+
reviewedBy: string;
|
|
127
|
+
reviewedAt: string;
|
|
128
|
+
}, {
|
|
129
|
+
contentHash: string;
|
|
130
|
+
reviewedBy: string;
|
|
131
|
+
reviewedAt: string;
|
|
132
|
+
}>>;
|
|
133
|
+
}, "strict", z.ZodTypeAny, {
|
|
134
|
+
status: "draft" | "reviewed";
|
|
135
|
+
id: string;
|
|
136
|
+
title: string;
|
|
137
|
+
source: "import" | "capture";
|
|
138
|
+
recordedAt: string;
|
|
139
|
+
schemaVersion: 1;
|
|
140
|
+
recordedBy: string;
|
|
141
|
+
steps: {
|
|
142
|
+
title: string;
|
|
143
|
+
instruction: string;
|
|
144
|
+
alt: string;
|
|
145
|
+
screenshot: {
|
|
146
|
+
file: string;
|
|
147
|
+
sha256: string;
|
|
148
|
+
mediaType: "image/png" | "image/jpeg" | "image/webp";
|
|
149
|
+
bytes: number;
|
|
150
|
+
};
|
|
151
|
+
expected?: string | undefined;
|
|
152
|
+
url?: string | undefined;
|
|
153
|
+
}[];
|
|
154
|
+
contentHash: string;
|
|
155
|
+
summary?: string | undefined;
|
|
156
|
+
review?: {
|
|
157
|
+
contentHash: string;
|
|
158
|
+
reviewedBy: string;
|
|
159
|
+
reviewedAt: string;
|
|
160
|
+
} | undefined;
|
|
161
|
+
}, {
|
|
162
|
+
status: "draft" | "reviewed";
|
|
163
|
+
id: string;
|
|
164
|
+
title: string;
|
|
165
|
+
source: "import" | "capture";
|
|
166
|
+
recordedAt: string;
|
|
167
|
+
schemaVersion: 1;
|
|
168
|
+
recordedBy: string;
|
|
169
|
+
steps: {
|
|
170
|
+
title: string;
|
|
171
|
+
instruction: string;
|
|
172
|
+
alt: string;
|
|
173
|
+
screenshot: {
|
|
174
|
+
file: string;
|
|
175
|
+
sha256: string;
|
|
176
|
+
mediaType: "image/png" | "image/jpeg" | "image/webp";
|
|
177
|
+
bytes: number;
|
|
178
|
+
};
|
|
179
|
+
expected?: string | undefined;
|
|
180
|
+
url?: string | undefined;
|
|
181
|
+
}[];
|
|
182
|
+
contentHash: string;
|
|
183
|
+
summary?: string | undefined;
|
|
184
|
+
review?: {
|
|
185
|
+
contentHash: string;
|
|
186
|
+
reviewedBy: string;
|
|
187
|
+
reviewedAt: string;
|
|
188
|
+
} | undefined;
|
|
189
|
+
}>, {
|
|
190
|
+
status: "draft" | "reviewed";
|
|
191
|
+
id: string;
|
|
192
|
+
title: string;
|
|
193
|
+
source: "import" | "capture";
|
|
194
|
+
recordedAt: string;
|
|
195
|
+
schemaVersion: 1;
|
|
196
|
+
recordedBy: string;
|
|
197
|
+
steps: {
|
|
198
|
+
title: string;
|
|
199
|
+
instruction: string;
|
|
200
|
+
alt: string;
|
|
201
|
+
screenshot: {
|
|
202
|
+
file: string;
|
|
203
|
+
sha256: string;
|
|
204
|
+
mediaType: "image/png" | "image/jpeg" | "image/webp";
|
|
205
|
+
bytes: number;
|
|
206
|
+
};
|
|
207
|
+
expected?: string | undefined;
|
|
208
|
+
url?: string | undefined;
|
|
209
|
+
}[];
|
|
210
|
+
contentHash: string;
|
|
211
|
+
summary?: string | undefined;
|
|
212
|
+
review?: {
|
|
213
|
+
contentHash: string;
|
|
214
|
+
reviewedBy: string;
|
|
215
|
+
reviewedAt: string;
|
|
216
|
+
} | undefined;
|
|
217
|
+
}, {
|
|
218
|
+
status: "draft" | "reviewed";
|
|
219
|
+
id: string;
|
|
220
|
+
title: string;
|
|
221
|
+
source: "import" | "capture";
|
|
222
|
+
recordedAt: string;
|
|
223
|
+
schemaVersion: 1;
|
|
224
|
+
recordedBy: string;
|
|
225
|
+
steps: {
|
|
226
|
+
title: string;
|
|
227
|
+
instruction: string;
|
|
228
|
+
alt: string;
|
|
229
|
+
screenshot: {
|
|
230
|
+
file: string;
|
|
231
|
+
sha256: string;
|
|
232
|
+
mediaType: "image/png" | "image/jpeg" | "image/webp";
|
|
233
|
+
bytes: number;
|
|
234
|
+
};
|
|
235
|
+
expected?: string | undefined;
|
|
236
|
+
url?: string | undefined;
|
|
237
|
+
}[];
|
|
238
|
+
contentHash: string;
|
|
239
|
+
summary?: string | undefined;
|
|
240
|
+
review?: {
|
|
241
|
+
contentHash: string;
|
|
242
|
+
reviewedBy: string;
|
|
243
|
+
reviewedAt: string;
|
|
244
|
+
} | undefined;
|
|
245
|
+
}>;
|
|
246
|
+
export type WalkthroughInput = z.output<typeof walkthroughInputSchema>;
|
|
247
|
+
export type WalkthroughRecord = z.output<typeof walkthroughRecordSchema>;
|
|
248
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/walkthrough/schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,0BAA0B,EAAG,CAAU,CAAC;AACrD,eAAO,MAAM,oBAAoB,QAAmB,CAAC;AAMrD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAIvD;AAED,eAAO,MAAM,kBAAkB,2CAAsF,CAAC;AACtH,eAAO,MAAM,eAAe,yEAY1B,CAAC;AAUH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMxB,CAAC;AAEZ,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4BlC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACvE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
export const WALKTHROUGH_SCHEMA_VERSION = 1;
|
|
4
|
+
export const MAX_SCREENSHOT_BYTES = 15 * 1024 * 1024;
|
|
5
|
+
const id = z.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/, 'must be lowercase kebab-case').max(80);
|
|
6
|
+
const heading = z.string().trim().min(1).max(200).refine((text) => !/[\r\n]/.test(text), 'must use one line');
|
|
7
|
+
const text = z.string().trim().min(1).max(4000);
|
|
8
|
+
const hash = z.string().regex(/^[a-f0-9]{64}$/);
|
|
9
|
+
export function safeRelativeFile(value) {
|
|
10
|
+
return value.length > 0 && value === value.trim() && !/[\u0000-\u001f\u007f\\:?#]/.test(value) &&
|
|
11
|
+
!path.posix.isAbsolute(value) && !path.win32.isAbsolute(value) &&
|
|
12
|
+
value.split('/').every((part) => part !== '..' && part !== '' && !/[. ]$/.test(part));
|
|
13
|
+
}
|
|
14
|
+
export const relativeFileSchema = z.string().refine(safeRelativeFile, 'must be a safe repository-relative file path');
|
|
15
|
+
export const publicUrlSchema = z.string().url().refine((value) => {
|
|
16
|
+
try {
|
|
17
|
+
const url = new URL(value);
|
|
18
|
+
return ['http:', 'https:'].includes(url.protocol) && url.username === '' && url.password === '';
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
}, 'must be an HTTP(S) URL without embedded credentials').transform((value) => {
|
|
24
|
+
const url = new URL(value);
|
|
25
|
+
url.search = '';
|
|
26
|
+
url.hash = '';
|
|
27
|
+
return url.toString();
|
|
28
|
+
});
|
|
29
|
+
const stepText = z.object({
|
|
30
|
+
title: heading,
|
|
31
|
+
instruction: text,
|
|
32
|
+
alt: heading,
|
|
33
|
+
expected: text.optional(),
|
|
34
|
+
url: publicUrlSchema.optional(),
|
|
35
|
+
}).strict();
|
|
36
|
+
export const walkthroughInputSchema = z.object({
|
|
37
|
+
schemaVersion: z.literal(WALKTHROUGH_SCHEMA_VERSION).default(WALKTHROUGH_SCHEMA_VERSION),
|
|
38
|
+
id,
|
|
39
|
+
title: heading,
|
|
40
|
+
summary: text.optional(),
|
|
41
|
+
steps: z.array(stepText.extend({ screenshot: relativeFileSchema }).strict()).min(1).max(50),
|
|
42
|
+
}).strict();
|
|
43
|
+
export const walkthroughRecordSchema = z.object({
|
|
44
|
+
schemaVersion: z.literal(WALKTHROUGH_SCHEMA_VERSION),
|
|
45
|
+
id,
|
|
46
|
+
title: heading,
|
|
47
|
+
summary: text.optional(),
|
|
48
|
+
source: z.enum(['import', 'capture']),
|
|
49
|
+
recordedBy: z.string().trim().min(1),
|
|
50
|
+
recordedAt: z.string().datetime({ offset: true }),
|
|
51
|
+
status: z.enum(['draft', 'reviewed']),
|
|
52
|
+
contentHash: hash,
|
|
53
|
+
steps: z.array(stepText.extend({ screenshot: z.object({
|
|
54
|
+
file: relativeFileSchema,
|
|
55
|
+
sha256: hash,
|
|
56
|
+
mediaType: z.enum(['image/png', 'image/jpeg', 'image/webp']),
|
|
57
|
+
bytes: z.number().int().positive().max(MAX_SCREENSHOT_BYTES),
|
|
58
|
+
}).strict() }).strict()).min(1).max(50),
|
|
59
|
+
review: z.object({
|
|
60
|
+
reviewedBy: z.string().trim().min(1),
|
|
61
|
+
reviewedAt: z.string().datetime({ offset: true }),
|
|
62
|
+
contentHash: hash,
|
|
63
|
+
}).strict().optional(),
|
|
64
|
+
}).strict().superRefine((record, context) => {
|
|
65
|
+
if (record.status === 'reviewed' && (record.review === undefined || record.review.contentHash !== record.contentHash)) {
|
|
66
|
+
context.addIssue({ code: z.ZodIssueCode.custom, path: ['review'], message: 'review must identify this exact walkthrough snapshot' });
|
|
67
|
+
}
|
|
68
|
+
if (record.status === 'draft' && record.review !== undefined) {
|
|
69
|
+
context.addIssue({ code: z.ZodIssueCode.custom, path: ['review'], message: 'a draft cannot retain a review receipt' });
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/walkthrough/schema.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAA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ughRecord } from './schema.js';
|
|
2
|
+
export declare function screenshotHash(bytes: Uint8Array): string;
|
|
3
|
+
export declare function walkthroughContentHash(record: Pick<WalkthroughRecord, 'id' | 'title' | 'summary' | 'steps'>): string;
|
|
4
|
+
export declare function readWalkthroughInput(root: string, file: string): Promise<{
|
|
5
|
+
input: WalkthroughInput;
|
|
6
|
+
directory: string;
|
|
7
|
+
}>;
|
|
8
|
+
export declare function prepareWalkthrough(args: {
|
|
9
|
+
root: string;
|
|
10
|
+
input: WalkthroughInput;
|
|
11
|
+
directory?: string;
|
|
12
|
+
images?: ReadonlyMap<string, Buffer>;
|
|
13
|
+
source: 'import' | 'capture';
|
|
14
|
+
recordedBy: string;
|
|
15
|
+
recordedAt?: string;
|
|
16
|
+
}): Promise<{
|
|
17
|
+
record: WalkthroughRecord;
|
|
18
|
+
assets: ReadonlyMap<string, Buffer>;
|
|
19
|
+
}>;
|
|
20
|
+
export declare function loadWalkthroughs(root: string, options?: {
|
|
21
|
+
readonly replacingId?: string;
|
|
22
|
+
}): Promise<readonly WalkthroughRecord[]>;
|
|
23
|
+
export declare function saveWalkthrough(root: string, prepared: {
|
|
24
|
+
record: WalkthroughRecord;
|
|
25
|
+
assets: ReadonlyMap<string, Buffer>;
|
|
26
|
+
}, update?: boolean): Promise<string>;
|
|
27
|
+
export declare function reviewWalkthrough(root: string, id: string, reviewedBy: string): Promise<WalkthroughRecord>;
|
|
28
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/walkthrough/store.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEvE,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAExD;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,IAAI,CAAC,iBAAiB,EAAE,IAAI,GAAG,OAAO,GA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
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import fs from 'node:fs/promises';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { WALKTHROUGHS_DIR } from '../config/paths.js';
|
|
5
|
+
import { writeFileAtomically } from '../util/atomic.js';
|
|
6
|
+
import { DocgenError, validationMessages } from '../util/errors.js';
|
|
7
|
+
import { assertGeneratedPath } from '../util/generated.js';
|
|
8
|
+
import { compareStrings } from '../util/sort.js';
|
|
9
|
+
import { MAX_SCREENSHOT_BYTES, relativeFileSchema, walkthroughInputSchema, walkthroughRecordSchema } from './schema.js';
|
|
10
|
+
export function screenshotHash(bytes) {
|
|
11
|
+
return createHash('sha256').update(bytes).digest('hex');
|
|
12
|
+
}
|
|
13
|
+
export function walkthroughContentHash(record) {
|
|
14
|
+
return screenshotHash(Buffer.from(JSON.stringify({ id: record.id, title: record.title, summary: record.summary ?? null, steps: record.steps })));
|
|
15
|
+
}
|
|
16
|
+
function failure(code, message, file) {
|
|
17
|
+
return new DocgenError({ code, message, remedy: 'Correct the walkthrough or image, then explicitly import the corrected snapshot and review it again.', ...(file === undefined ? {} : { file }) });
|
|
18
|
+
}
|
|
19
|
+
function imageType(bytes, file) {
|
|
20
|
+
if (bytes.length === 0 || bytes.length > MAX_SCREENSHOT_BYTES)
|
|
21
|
+
throw failure('walkthrough-image-invalid', 'Screenshots must be nonempty and no larger than 15 MiB.', file);
|
|
22
|
+
const extension = path.posix.extname(file).toLowerCase();
|
|
23
|
+
if (extension === '.png' && bytes.length >= 24 && bytes.subarray(0, 8).equals(Buffer.from([137, 80, 78, 71, 13, 10, 26, 10])) && bytes.toString('ascii', 12, 16) === 'IHDR' && bytes.readUInt32BE(16) > 0 && bytes.readUInt32BE(20) > 0)
|
|
24
|
+
return { mediaType: 'image/png', extension: 'png' };
|
|
25
|
+
if (['.jpg', '.jpeg'].includes(extension) && bytes.length > 4 && bytes[0] === 255 && bytes[1] === 216 && bytes[2] === 255 && bytes.at(-2) === 255 && bytes.at(-1) === 217)
|
|
26
|
+
return { mediaType: 'image/jpeg', extension: 'jpg' };
|
|
27
|
+
if (extension === '.webp' && bytes.length >= 20 && bytes.toString('ascii', 0, 4) === 'RIFF' && bytes.toString('ascii', 8, 12) === 'WEBP')
|
|
28
|
+
return { mediaType: 'image/webp', extension: 'webp' };
|
|
29
|
+
throw failure('walkthrough-image-invalid', 'The screenshot must be a PNG, JPEG, or WebP image matching its extension.', file);
|
|
30
|
+
}
|
|
31
|
+
export async function readWalkthroughInput(root, file) {
|
|
32
|
+
if (!relativeFileSchema.safeParse(file).success)
|
|
33
|
+
throw failure('walkthrough-input-invalid', 'The manifest must use a repository-relative path.', file);
|
|
34
|
+
await assertGeneratedPath(root, file);
|
|
35
|
+
let raw;
|
|
36
|
+
try {
|
|
37
|
+
raw = JSON.parse(await fs.readFile(path.join(root, file), 'utf8'));
|
|
38
|
+
}
|
|
39
|
+
catch (cause) {
|
|
40
|
+
throw new DocgenError({ code: 'walkthrough-input-invalid', message: `Cannot read walkthrough manifest '${file}'.`, remedy: 'Provide a readable JSON walkthrough manifest.', file, cause });
|
|
41
|
+
}
|
|
42
|
+
const parsed = walkthroughInputSchema.safeParse(raw);
|
|
43
|
+
if (!parsed.success)
|
|
44
|
+
throw failure('walkthrough-input-invalid', validationMessages(parsed.error.issues), file);
|
|
45
|
+
return { input: parsed.data, directory: path.posix.dirname(file) };
|
|
46
|
+
}
|
|
47
|
+
export async function prepareWalkthrough(args) {
|
|
48
|
+
const input = walkthroughInputSchema.parse(args.input);
|
|
49
|
+
const assets = new Map();
|
|
50
|
+
const steps = [];
|
|
51
|
+
for (const step of input.steps) {
|
|
52
|
+
let bytes = args.images?.get(step.screenshot);
|
|
53
|
+
if (args.images !== undefined && bytes === undefined)
|
|
54
|
+
throw failure('walkthrough-image-missing', 'The captured screenshot is missing.', step.screenshot);
|
|
55
|
+
if (bytes === undefined) {
|
|
56
|
+
const file = path.posix.join(args.directory ?? '.', step.screenshot);
|
|
57
|
+
await assertGeneratedPath(args.root, file);
|
|
58
|
+
try {
|
|
59
|
+
const stat = await fs.stat(path.join(args.root, file));
|
|
60
|
+
if (!stat.isFile() || stat.size > MAX_SCREENSHOT_BYTES)
|
|
61
|
+
throw failure('walkthrough-image-invalid', 'Screenshot is not an ordinary image within the size limit.', file);
|
|
62
|
+
bytes = await fs.readFile(path.join(args.root, file));
|
|
63
|
+
}
|
|
64
|
+
catch (cause) {
|
|
65
|
+
if (cause instanceof DocgenError)
|
|
66
|
+
throw cause;
|
|
67
|
+
throw new DocgenError({ code: 'walkthrough-image-missing', message: `Cannot read screenshot '${file}'.`, remedy: 'Provide every screenshot before importing the guide.', file, cause });
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const type = imageType(bytes, step.screenshot);
|
|
71
|
+
const sha256 = screenshotHash(bytes);
|
|
72
|
+
const file = `${WALKTHROUGHS_DIR}/assets/${input.id}/${sha256}.${type.extension}`;
|
|
73
|
+
const { screenshot: _source, ...details } = step;
|
|
74
|
+
steps.push({ ...details, screenshot: { file, sha256, mediaType: type.mediaType, bytes: bytes.length } });
|
|
75
|
+
assets.set(file, bytes);
|
|
76
|
+
}
|
|
77
|
+
const record = {
|
|
78
|
+
schemaVersion: 1, id: input.id, title: input.title,
|
|
79
|
+
...(input.summary === undefined ? {} : { summary: input.summary }),
|
|
80
|
+
source: args.source, recordedBy: args.recordedBy, recordedAt: args.recordedAt ?? new Date().toISOString(),
|
|
81
|
+
status: 'draft', contentHash: '', steps,
|
|
82
|
+
};
|
|
83
|
+
return { record: walkthroughRecordSchema.parse({ ...record, contentHash: walkthroughContentHash(record) }), assets };
|
|
84
|
+
}
|
|
85
|
+
export async function loadWalkthroughs(root, options = {}) {
|
|
86
|
+
await assertGeneratedPath(root, WALKTHROUGHS_DIR);
|
|
87
|
+
let names;
|
|
88
|
+
try {
|
|
89
|
+
names = await fs.readdir(path.join(root, WALKTHROUGHS_DIR));
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
if (error.code === 'ENOENT')
|
|
93
|
+
return [];
|
|
94
|
+
throw error;
|
|
95
|
+
}
|
|
96
|
+
const records = [];
|
|
97
|
+
for (const name of names.filter((name) => name.endsWith('.json')).sort(compareStrings)) {
|
|
98
|
+
const file = `${WALKTHROUGHS_DIR}/${name}`;
|
|
99
|
+
await assertGeneratedPath(root, file);
|
|
100
|
+
let raw;
|
|
101
|
+
try {
|
|
102
|
+
raw = JSON.parse(await fs.readFile(path.join(root, file), 'utf8'));
|
|
103
|
+
}
|
|
104
|
+
catch (cause) {
|
|
105
|
+
throw new DocgenError({ code: 'walkthrough-record-invalid', message: `Cannot read '${file}'.`, remedy: 'Repair this human-owned walkthrough record; it is never silently skipped.', file, cause });
|
|
106
|
+
}
|
|
107
|
+
const parsed = walkthroughRecordSchema.safeParse(raw);
|
|
108
|
+
if (!parsed.success)
|
|
109
|
+
throw failure('walkthrough-record-invalid', validationMessages(parsed.error.issues), file);
|
|
110
|
+
const record = parsed.data;
|
|
111
|
+
if (name !== `${record.id}.json` || record.contentHash !== walkthroughContentHash(record))
|
|
112
|
+
throw failure('walkthrough-record-changed', 'The walkthrough snapshot or identity has changed without an explicit import.', file);
|
|
113
|
+
for (const step of record.steps) {
|
|
114
|
+
const image = step.screenshot;
|
|
115
|
+
const extension = image.mediaType === 'image/png' ? 'png' : image.mediaType === 'image/jpeg' ? 'jpg' : 'webp';
|
|
116
|
+
if (image.file !== `${WALKTHROUGHS_DIR}/assets/${record.id}/${image.sha256}.${extension}`)
|
|
117
|
+
throw failure('walkthrough-record-invalid', 'Screenshot references must use their content-addressed walkthrough asset paths.', file);
|
|
118
|
+
if (options.replacingId === record.id)
|
|
119
|
+
continue;
|
|
120
|
+
await assertGeneratedPath(root, image.file);
|
|
121
|
+
let bytes;
|
|
122
|
+
try {
|
|
123
|
+
bytes = await fs.readFile(path.join(root, image.file));
|
|
124
|
+
}
|
|
125
|
+
catch (cause) {
|
|
126
|
+
throw new DocgenError({ code: 'walkthrough-image-missing', message: `Missing walkthrough screenshot '${image.file}'.`, remedy: 'Restore the recorded image or explicitly import an updated snapshot.', file: image.file, cause });
|
|
127
|
+
}
|
|
128
|
+
if (bytes.length !== image.bytes || screenshotHash(bytes) !== image.sha256)
|
|
129
|
+
throw failure('walkthrough-image-changed', 'The walkthrough screenshot differs from its recorded hash.', image.file);
|
|
130
|
+
imageType(bytes, image.file);
|
|
131
|
+
}
|
|
132
|
+
records.push(record);
|
|
133
|
+
}
|
|
134
|
+
return records.sort((a, b) => compareStrings(a.id, b.id));
|
|
135
|
+
}
|
|
136
|
+
export async function saveWalkthrough(root, prepared, update = false) {
|
|
137
|
+
const record = walkthroughRecordSchema.parse(prepared.record);
|
|
138
|
+
const file = `${WALKTHROUGHS_DIR}/${record.id}.json`;
|
|
139
|
+
for (const step of record.steps) {
|
|
140
|
+
const image = step.screenshot;
|
|
141
|
+
const extension = image.mediaType === 'image/png' ? 'png' : image.mediaType === 'image/jpeg' ? 'jpg' : 'webp';
|
|
142
|
+
if (image.file !== `${WALKTHROUGHS_DIR}/assets/${record.id}/${image.sha256}.${extension}`)
|
|
143
|
+
throw failure('walkthrough-record-invalid', 'Prepared screenshots must use their content-addressed asset paths.', file);
|
|
144
|
+
}
|
|
145
|
+
await assertGeneratedPath(root, file);
|
|
146
|
+
const existing = (await loadWalkthroughs(root, update ? { replacingId: record.id } : {})).find((item) => item.id === record.id);
|
|
147
|
+
if (existing !== undefined && !update)
|
|
148
|
+
throw failure('walkthrough-already-exists', `Walkthrough '${record.id}' already exists. Use --update to record a new unreviewed snapshot.`, file);
|
|
149
|
+
if (existing === undefined && update)
|
|
150
|
+
throw failure('walkthrough-not-found', `Walkthrough '${record.id}' does not exist. Import it without --update.`, file);
|
|
151
|
+
const expectedAssets = new Map(record.steps.map((step) => [step.screenshot.file, step.screenshot]));
|
|
152
|
+
if (record.contentHash !== walkthroughContentHash(record) || prepared.assets.size !== expectedAssets.size)
|
|
153
|
+
throw failure('walkthrough-record-invalid', 'Prepared screenshot assets must match the recorded walkthrough snapshot.', file);
|
|
154
|
+
const repairs = new Set();
|
|
155
|
+
const oldAssets = new Set(existing?.steps.map((step) => step.screenshot.file) ?? []);
|
|
156
|
+
for (const [asset, bytes] of prepared.assets) {
|
|
157
|
+
const expected = expectedAssets.get(asset);
|
|
158
|
+
if (expected === undefined || bytes.length !== expected.bytes || screenshotHash(bytes) !== expected.sha256)
|
|
159
|
+
throw failure('walkthrough-image-invalid', 'Prepared image bytes must match the recorded screenshot.', asset);
|
|
160
|
+
if (imageType(bytes, asset).mediaType !== expected.mediaType)
|
|
161
|
+
throw failure('walkthrough-image-invalid', 'Screenshot format does not match the recorded media type.', asset);
|
|
162
|
+
await assertGeneratedPath(root, asset);
|
|
163
|
+
let previous;
|
|
164
|
+
try {
|
|
165
|
+
previous = await fs.readFile(path.join(root, asset));
|
|
166
|
+
}
|
|
167
|
+
catch (error) {
|
|
168
|
+
if (error.code !== 'ENOENT')
|
|
169
|
+
throw error;
|
|
170
|
+
}
|
|
171
|
+
if (previous !== undefined && !previous.equals(bytes)) {
|
|
172
|
+
if (update && oldAssets.has(asset))
|
|
173
|
+
repairs.add(asset);
|
|
174
|
+
else
|
|
175
|
+
throw failure('walkthrough-image-changed', 'Refusing to overwrite a different screenshot at an immutable asset path.', asset);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
for (const [asset, bytes] of prepared.assets) {
|
|
179
|
+
const target = path.join(root, asset);
|
|
180
|
+
try {
|
|
181
|
+
await writeFileAtomically(target, bytes, { createOnly: !repairs.has(asset) });
|
|
182
|
+
}
|
|
183
|
+
catch (error) {
|
|
184
|
+
if (error.code !== 'EEXIST')
|
|
185
|
+
throw error;
|
|
186
|
+
const winner = await fs.readFile(target);
|
|
187
|
+
if (!winner.equals(bytes))
|
|
188
|
+
throw failure('walkthrough-image-changed', 'A concurrent import published different screenshot bytes.', asset);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
await writeFileAtomically(path.join(root, file), `${JSON.stringify(record, null, 2)}\n`, { createOnly: !update });
|
|
192
|
+
return file;
|
|
193
|
+
}
|
|
194
|
+
export async function reviewWalkthrough(root, id, reviewedBy) {
|
|
195
|
+
if (reviewedBy.trim().length === 0 || reviewedBy === 'unknown')
|
|
196
|
+
throw failure('walkthrough-review-identity-required', 'Review requires an explicit Git identity.');
|
|
197
|
+
const record = (await loadWalkthroughs(root)).find((item) => item.id === id);
|
|
198
|
+
if (record === undefined)
|
|
199
|
+
throw failure('walkthrough-not-found', `Walkthrough '${id}' does not exist.`);
|
|
200
|
+
const reviewed = walkthroughRecordSchema.parse({ ...record, status: 'reviewed', review: { reviewedBy, reviewedAt: new Date().toISOString(), contentHash: record.contentHash } });
|
|
201
|
+
await writeFileAtomically(path.join(root, `${WALKTHROUGHS_DIR}/${id}.json`), `${JSON.stringify(reviewed, null, 2)}\n`);
|
|
202
|
+
return reviewed;
|
|
203
|
+
}
|
|
204
|
+
//# sourceMappingURL=store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/walkthrough/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAGxH,MAAM,UAAU,cAAc,CAAC,KAAiB;IAC9C,O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CAAC,CAAC;IAC7E,IAAI,MAAM,KAAK,SAAS;QAAE,MAAM,OAAO,CAAC,uBAAuB,EAAE,gBAAgB,EAAE,mBAAmB,CAAC,CAAC;IACxG,MAAM,QAAQ,GAAG,uBAAuB,CAAC,KAAK,CAAC,EAAE,GAAG,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IACjL,MAAM,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,gBAAgB,IAAI,EAAE,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;IACvH,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pavanyn/docugen",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Deterministic codebase documentation engine. Extracts what the code proves; never states what it cannot verify.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -65,8 +65,17 @@
|
|
|
65
65
|
"@vitest/coverage-v8": "^4.1.10",
|
|
66
66
|
"jsdom": "^25.0.1",
|
|
67
67
|
"mermaid": "^11.16.1",
|
|
68
|
+
"playwright": "1.63.0",
|
|
68
69
|
"vitest": "^4.1.10"
|
|
69
70
|
},
|
|
71
|
+
"peerDependencies": {
|
|
72
|
+
"playwright": ">=1.50.0 <2"
|
|
73
|
+
},
|
|
74
|
+
"peerDependenciesMeta": {
|
|
75
|
+
"playwright": {
|
|
76
|
+
"optional": true
|
|
77
|
+
}
|
|
78
|
+
},
|
|
70
79
|
"keywords": [
|
|
71
80
|
"documentation",
|
|
72
81
|
"static-analysis",
|