dsh-showcase 0.1.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 +22 -0
- package/CHARACTER_ASSET_NOTICE.md +25 -0
- package/LICENSE +21 -0
- package/README.md +401 -0
- package/README.zh-CN.md +23 -0
- package/SECURITY.md +22 -0
- package/cordis.patch.yml +5 -0
- package/package.json +78 -0
- package/plugin/assets/dijiang-survey-surface.webp +0 -0
- package/plugin/assets/whale-girl-keyvisual.webp +0 -0
- package/plugin/client-host.js +3 -0
- package/plugin/client.js +328 -0
- package/plugin/index.d.ts +18 -0
- package/plugin/index.js +130 -0
- package/plugin/layout-summary.d.ts +31 -0
- package/plugin/layout-summary.js +961 -0
- package/plugin/poster-html.js +1049 -0
- package/plugin/report-schema.js +86 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
const isoDate = z.string().datetime();
|
|
4
|
+
|
|
5
|
+
const taskSchema = z.object({
|
|
6
|
+
id: z.string().min(1),
|
|
7
|
+
goal: z.string().min(1),
|
|
8
|
+
status: z.enum(["completed", "partial", "failed"]),
|
|
9
|
+
startedAt: isoDate,
|
|
10
|
+
completedAt: isoDate.optional(),
|
|
11
|
+
durationMs: z.number().int().nonnegative(),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const gitChangeSchema = z.object({
|
|
15
|
+
baseRef: z.string().min(1).optional(),
|
|
16
|
+
headRef: z.string().min(1).optional(),
|
|
17
|
+
files: z.array(z.object({
|
|
18
|
+
path: z.string().min(1),
|
|
19
|
+
status: z.enum(["added", "modified", "deleted", "renamed", "untracked"]),
|
|
20
|
+
additions: z.number().int().nonnegative(),
|
|
21
|
+
deletions: z.number().int().nonnegative(),
|
|
22
|
+
previousPath: z.string().min(1).optional(),
|
|
23
|
+
})),
|
|
24
|
+
summary: z.object({
|
|
25
|
+
changedFiles: z.number().int().nonnegative(),
|
|
26
|
+
additions: z.number().int().nonnegative(),
|
|
27
|
+
deletions: z.number().int().nonnegative(),
|
|
28
|
+
}),
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const testReceiptSchema = z.object({
|
|
32
|
+
id: z.string().min(1).optional().default("test"),
|
|
33
|
+
command: z.string().min(1),
|
|
34
|
+
startedAt: isoDate.optional().default("1970-01-01T00:00:00.000Z"),
|
|
35
|
+
durationMs: z.number().int().nonnegative().optional().default(0),
|
|
36
|
+
exitCode: z.number().int(),
|
|
37
|
+
status: z.enum(["passed", "failed", "skipped"]),
|
|
38
|
+
output: z.string().optional().default(""),
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const screenshotEvidenceSchema = z.object({
|
|
42
|
+
id: z.string().min(1).optional().default("capture"),
|
|
43
|
+
label: z.string().min(1).optional().default("capture"),
|
|
44
|
+
// Accept the two legacy URL/theme aliases so reports created before the
|
|
45
|
+
// settings rename can still be read and isolated safely.
|
|
46
|
+
theme: z.enum(["frontier-signal", "blue-big-fish", "field", "fish"]).optional(),
|
|
47
|
+
viewport: z.object({
|
|
48
|
+
name: z.enum(["desktop", "tablet", "mobile"]),
|
|
49
|
+
width: z.number().int().positive().max(16384),
|
|
50
|
+
height: z.number().int().positive().max(16384),
|
|
51
|
+
}),
|
|
52
|
+
url: z.string().url().optional().default("http://localhost/"),
|
|
53
|
+
imagePath: z.string().min(1),
|
|
54
|
+
capturedAt: isoDate.optional().default("1970-01-01T00:00:00.000Z"),
|
|
55
|
+
kind: z.enum(["after", "before"]).optional().default("after"),
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
const redactionSummarySchema = z.object({
|
|
59
|
+
originalLength: z.number().int().nonnegative().optional().default(0),
|
|
60
|
+
redactedLength: z.number().int().nonnegative().optional().default(0),
|
|
61
|
+
replacements: z.record(z.string(), z.number().int().nonnegative()).default({}),
|
|
62
|
+
totalReplacements: z.number().int().nonnegative().default(0),
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
// This is the runtime mirror of src/core/report-schema.ts. It lives beside
|
|
66
|
+
// the plugin because the published plugin is plain ESM JavaScript and cannot
|
|
67
|
+
// import the source-only TypeScript module at runtime.
|
|
68
|
+
export const reportSchema = z.object({
|
|
69
|
+
version: z.literal(1),
|
|
70
|
+
generatedAt: isoDate,
|
|
71
|
+
project: z.object({ name: z.string().min(1) }).optional(),
|
|
72
|
+
task: taskSchema,
|
|
73
|
+
git: gitChangeSchema,
|
|
74
|
+
tests: z.array(testReceiptSchema),
|
|
75
|
+
screenshots: z.array(screenshotEvidenceSchema),
|
|
76
|
+
redaction: redactionSummarySchema,
|
|
77
|
+
}).passthrough();
|
|
78
|
+
|
|
79
|
+
export function formatReportIssues(error) {
|
|
80
|
+
const issues = Array.isArray(error?.issues) ? error.issues : [];
|
|
81
|
+
if (!issues.length) return error instanceof Error ? error.message : String(error);
|
|
82
|
+
return issues.slice(0, 8).map((issue) => {
|
|
83
|
+
const path = issue.path?.length ? issue.path.join(".") : "<root>";
|
|
84
|
+
return `${path}: ${issue.message}`;
|
|
85
|
+
}).join("; ");
|
|
86
|
+
}
|