@komatikai/trailhead 3.0.3 → 4.2.2
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 +55 -22
- package/dist/index.js +226 -19
- package/dist/index.js.map +1 -1
- package/dist/run-doctor.d.ts +1 -0
- package/dist/run-doctor.js +83 -0
- package/dist/run-doctor.js.map +1 -0
- package/dist/shared/ci-core.d.ts +18 -0
- package/dist/shared/ci-core.js +210 -0
- package/dist/shared/ci-core.js.map +1 -0
- package/dist/shared/ci-manifest.d.ts +82 -0
- package/dist/shared/ci-manifest.js +51 -0
- package/dist/shared/ci-manifest.js.map +1 -0
- package/dist/shared/config-core.d.ts +5 -0
- package/dist/shared/config-core.js +127 -0
- package/dist/shared/config-core.js.map +1 -0
- package/dist/shared/doctor.d.ts +48 -0
- package/dist/shared/doctor.js +308 -0
- package/dist/shared/doctor.js.map +1 -0
- package/dist/shared/release-ready.d.ts +27 -0
- package/dist/shared/release-ready.js +97 -0
- package/dist/shared/release-ready.js.map +1 -0
- package/dist/shared/types.d.ts +1813 -0
- package/dist/shared/types.js +338 -0
- package/dist/shared/types.js.map +1 -0
- package/package.json +7 -4
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
export const DEFAULT_SELF_CHECK_NAMES = ["Trailhead", "Trailhead — Release Ready"];
|
|
2
|
+
/**
|
|
3
|
+
* Map GitHub check conclusion/status to Trailhead CI status (ADR-009).
|
|
4
|
+
*/
|
|
5
|
+
export function classifyCheck(status, conclusion) {
|
|
6
|
+
if (status === "completed") {
|
|
7
|
+
switch (conclusion) {
|
|
8
|
+
case "success":
|
|
9
|
+
return "pass";
|
|
10
|
+
case "skipped":
|
|
11
|
+
case "neutral":
|
|
12
|
+
return "skip";
|
|
13
|
+
case "failure":
|
|
14
|
+
case "timed_out":
|
|
15
|
+
case "action_required":
|
|
16
|
+
case "cancelled":
|
|
17
|
+
return "fail";
|
|
18
|
+
default:
|
|
19
|
+
return "pending";
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
if (status === "in_progress" || status === "queued" || status === "pending") {
|
|
23
|
+
return "pending";
|
|
24
|
+
}
|
|
25
|
+
return "pending";
|
|
26
|
+
}
|
|
27
|
+
function isSelfCheck(name, excludeNames) {
|
|
28
|
+
const lower = name.toLowerCase();
|
|
29
|
+
return excludeNames.some((n) => n.toLowerCase() === lower);
|
|
30
|
+
}
|
|
31
|
+
export function checkNameMatches(configured, actual) {
|
|
32
|
+
if (configured === actual)
|
|
33
|
+
return true;
|
|
34
|
+
if (configured.toLowerCase() === actual.toLowerCase())
|
|
35
|
+
return true;
|
|
36
|
+
return actual.toLowerCase().startsWith(configured.toLowerCase());
|
|
37
|
+
}
|
|
38
|
+
function findManifestJob(manifest, configuredName) {
|
|
39
|
+
return manifest.jobs.find((job) => checkNameMatches(configuredName, job.name));
|
|
40
|
+
}
|
|
41
|
+
function statusFromManifestJob(job) {
|
|
42
|
+
switch (job.outcome) {
|
|
43
|
+
case "passed":
|
|
44
|
+
return "pass";
|
|
45
|
+
case "skipped":
|
|
46
|
+
return "skip";
|
|
47
|
+
case "failed":
|
|
48
|
+
case "cancelled":
|
|
49
|
+
return "fail";
|
|
50
|
+
case "pending":
|
|
51
|
+
return "pending";
|
|
52
|
+
case "ran":
|
|
53
|
+
return undefined;
|
|
54
|
+
default: {
|
|
55
|
+
const _exhaustive = job.outcome;
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function applyManifestToCheck(check, manifest, configuredName) {
|
|
61
|
+
if (!manifest)
|
|
62
|
+
return check;
|
|
63
|
+
const manifestJob = findManifestJob(manifest, configuredName);
|
|
64
|
+
if (!manifestJob)
|
|
65
|
+
return check;
|
|
66
|
+
const manifestStatus = statusFromManifestJob(manifestJob);
|
|
67
|
+
if (manifestStatus === "skip") {
|
|
68
|
+
return {
|
|
69
|
+
...check,
|
|
70
|
+
status: "skip",
|
|
71
|
+
conclusion: manifestJob.reason ?? check.conclusion,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
if (manifestStatus && (check.status === "missing" || check.status === "pending")) {
|
|
75
|
+
return {
|
|
76
|
+
...check,
|
|
77
|
+
status: manifestStatus,
|
|
78
|
+
conclusion: manifestJob.reason ?? check.conclusion,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
return check;
|
|
82
|
+
}
|
|
83
|
+
function checkFromManifestOnly(configuredName, manifest) {
|
|
84
|
+
const manifestJob = findManifestJob(manifest, configuredName);
|
|
85
|
+
if (!manifestJob)
|
|
86
|
+
return undefined;
|
|
87
|
+
const status = statusFromManifestJob(manifestJob);
|
|
88
|
+
if (!status)
|
|
89
|
+
return undefined;
|
|
90
|
+
return {
|
|
91
|
+
name: configuredName,
|
|
92
|
+
status,
|
|
93
|
+
conclusion: manifestJob.reason,
|
|
94
|
+
detailsUrl: manifestJob.details_url,
|
|
95
|
+
required: false,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
export function normalizeCheckRuns(runs, excludeCheckNames = DEFAULT_SELF_CHECK_NAMES) {
|
|
99
|
+
return runs
|
|
100
|
+
.filter((r) => !isSelfCheck(r.name, excludeCheckNames))
|
|
101
|
+
.map((r) => ({
|
|
102
|
+
name: r.name,
|
|
103
|
+
status: classifyCheck(r.status, r.conclusion),
|
|
104
|
+
conclusion: r.conclusion ?? undefined,
|
|
105
|
+
detailsUrl: r.details_url ?? r.html_url ?? undefined,
|
|
106
|
+
required: false,
|
|
107
|
+
}));
|
|
108
|
+
}
|
|
109
|
+
export function evaluateRequiredChecks(allChecks, ciConfig, manifest) {
|
|
110
|
+
const requiredNames = ciConfig.required_checks;
|
|
111
|
+
const optionalNames = ciConfig.optional_checks;
|
|
112
|
+
const missingPolicy = ciConfig.missing_required;
|
|
113
|
+
const evaluated = [];
|
|
114
|
+
const seen = new Set();
|
|
115
|
+
for (const reqName of requiredNames) {
|
|
116
|
+
const match = allChecks.find((c) => checkNameMatches(reqName, c.name));
|
|
117
|
+
if (match) {
|
|
118
|
+
const resolved = applyManifestToCheck({ ...match, name: reqName, required: true }, manifest ?? undefined, reqName);
|
|
119
|
+
evaluated.push(resolved);
|
|
120
|
+
seen.add(match.name);
|
|
121
|
+
}
|
|
122
|
+
else if (manifest) {
|
|
123
|
+
const fromManifest = checkFromManifestOnly(reqName, manifest);
|
|
124
|
+
if (fromManifest) {
|
|
125
|
+
evaluated.push({ ...fromManifest, name: reqName, required: true });
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
evaluated.push({
|
|
129
|
+
name: reqName,
|
|
130
|
+
status: missingPolicy === "skip" ? "skip" : "missing",
|
|
131
|
+
required: true,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
evaluated.push({
|
|
137
|
+
name: reqName,
|
|
138
|
+
status: missingPolicy === "skip" ? "skip" : "missing",
|
|
139
|
+
required: true,
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
for (const optName of optionalNames) {
|
|
144
|
+
const match = allChecks.find((c) => checkNameMatches(optName, c.name));
|
|
145
|
+
if (match) {
|
|
146
|
+
const resolved = applyManifestToCheck({ ...match, name: optName, required: false }, manifest ?? undefined, optName);
|
|
147
|
+
evaluated.push(resolved);
|
|
148
|
+
seen.add(match.name);
|
|
149
|
+
}
|
|
150
|
+
else if (manifest) {
|
|
151
|
+
const fromManifest = checkFromManifestOnly(optName, manifest);
|
|
152
|
+
if (fromManifest) {
|
|
153
|
+
evaluated.push({ ...fromManifest, name: optName, required: false });
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
evaluated.push({
|
|
157
|
+
name: optName,
|
|
158
|
+
status: "missing",
|
|
159
|
+
required: false,
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
evaluated.push({
|
|
165
|
+
name: optName,
|
|
166
|
+
status: "missing",
|
|
167
|
+
required: false,
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
for (const check of allChecks) {
|
|
172
|
+
if (!seen.has(check.name)) {
|
|
173
|
+
evaluated.push({ ...check, required: false });
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
const requiredChecks = evaluated.filter((c) => c.required);
|
|
177
|
+
const pendingCount = requiredChecks.filter((c) => c.status === "pending").length;
|
|
178
|
+
const failedCount = requiredChecks.filter((c) => c.status === "fail" || c.status === "missing" || c.status === "stale").length;
|
|
179
|
+
const missingCount = requiredChecks.filter((c) => c.status === "missing").length;
|
|
180
|
+
const allRequiredPassed = requiredNames.length === 0 ||
|
|
181
|
+
requiredChecks.every((c) => c.status === "pass" || c.status === "skip");
|
|
182
|
+
return {
|
|
183
|
+
checks: evaluated,
|
|
184
|
+
allRequiredPassed,
|
|
185
|
+
pendingCount,
|
|
186
|
+
failedCount,
|
|
187
|
+
missingCount,
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
export function formatCiStatusIcon(status) {
|
|
191
|
+
switch (status) {
|
|
192
|
+
case "pass":
|
|
193
|
+
return "✅";
|
|
194
|
+
case "fail":
|
|
195
|
+
return "❌";
|
|
196
|
+
case "skip":
|
|
197
|
+
return "⏭️";
|
|
198
|
+
case "pending":
|
|
199
|
+
return "⏳";
|
|
200
|
+
case "stale":
|
|
201
|
+
return "⚠️";
|
|
202
|
+
case "missing":
|
|
203
|
+
return "❓";
|
|
204
|
+
default: {
|
|
205
|
+
const _exhaustive = status;
|
|
206
|
+
return "•";
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
//# sourceMappingURL=ci-core.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ci-core.js","sourceRoot":"","sources":["../../src/shared/ci-core.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,WAAW,EAAE,2BAA2B,CAAC,CAAC;AAUn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;QACb,KAAK,OAAO;YACV,OAAO,IAAI,CAAC;QACd,KAAK,SAAS;YACZ,OAAO,GAAG,CAAC;QACb,OAAO,CAAC,CAAC,CAAC;YACR,MAAM,WAAW,GAAU,MAAM,CAAC;YAClC,OAAO,GAAG,CAAC;QACb,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** Job outcome as emitted by path-filtered workflows (E15). */
|
|
3
|
+
export declare const CiManifestJobOutcome: z.ZodEnum<["ran", "passed", "skipped", "failed", "pending", "cancelled"]>;
|
|
4
|
+
export type CiManifestJobOutcome = z.infer<typeof CiManifestJobOutcome>;
|
|
5
|
+
/** Why a job did not run — `paths-filter` is the primary v4.2 use case. */
|
|
6
|
+
export declare const CiManifestSkipReason: z.ZodEnum<["paths-filter", "paths-ignore", "manual", "condition", "concurrency", "workflow_dispatch", "other"]>;
|
|
7
|
+
export type CiManifestSkipReason = z.infer<typeof CiManifestSkipReason>;
|
|
8
|
+
export declare const CiManifestJob: z.ZodObject<{
|
|
9
|
+
name: z.ZodString;
|
|
10
|
+
outcome: z.ZodEnum<["ran", "passed", "skipped", "failed", "pending", "cancelled"]>;
|
|
11
|
+
reason: z.ZodOptional<z.ZodEnum<["paths-filter", "paths-ignore", "manual", "condition", "concurrency", "workflow_dispatch", "other"]>>;
|
|
12
|
+
check_run_id: z.ZodOptional<z.ZodNumber>;
|
|
13
|
+
details_url: z.ZodOptional<z.ZodString>;
|
|
14
|
+
}, "strip", z.ZodTypeAny, {
|
|
15
|
+
name: string;
|
|
16
|
+
outcome: "ran" | "passed" | "skipped" | "failed" | "pending" | "cancelled";
|
|
17
|
+
reason?: "paths-filter" | "paths-ignore" | "manual" | "condition" | "concurrency" | "workflow_dispatch" | "other" | undefined;
|
|
18
|
+
check_run_id?: number | undefined;
|
|
19
|
+
details_url?: string | undefined;
|
|
20
|
+
}, {
|
|
21
|
+
name: string;
|
|
22
|
+
outcome: "ran" | "passed" | "skipped" | "failed" | "pending" | "cancelled";
|
|
23
|
+
reason?: "paths-filter" | "paths-ignore" | "manual" | "condition" | "concurrency" | "workflow_dispatch" | "other" | undefined;
|
|
24
|
+
check_run_id?: number | undefined;
|
|
25
|
+
details_url?: string | undefined;
|
|
26
|
+
}>;
|
|
27
|
+
export type CiManifestJob = z.infer<typeof CiManifestJob>;
|
|
28
|
+
export declare const CiManifest: z.ZodObject<{
|
|
29
|
+
schema_version: z.ZodLiteral<1>;
|
|
30
|
+
generated_at: z.ZodOptional<z.ZodString>;
|
|
31
|
+
commit_sha: z.ZodOptional<z.ZodString>;
|
|
32
|
+
workflow: z.ZodOptional<z.ZodString>;
|
|
33
|
+
run_id: z.ZodOptional<z.ZodNumber>;
|
|
34
|
+
jobs: z.ZodArray<z.ZodObject<{
|
|
35
|
+
name: z.ZodString;
|
|
36
|
+
outcome: z.ZodEnum<["ran", "passed", "skipped", "failed", "pending", "cancelled"]>;
|
|
37
|
+
reason: z.ZodOptional<z.ZodEnum<["paths-filter", "paths-ignore", "manual", "condition", "concurrency", "workflow_dispatch", "other"]>>;
|
|
38
|
+
check_run_id: z.ZodOptional<z.ZodNumber>;
|
|
39
|
+
details_url: z.ZodOptional<z.ZodString>;
|
|
40
|
+
}, "strip", z.ZodTypeAny, {
|
|
41
|
+
name: string;
|
|
42
|
+
outcome: "ran" | "passed" | "skipped" | "failed" | "pending" | "cancelled";
|
|
43
|
+
reason?: "paths-filter" | "paths-ignore" | "manual" | "condition" | "concurrency" | "workflow_dispatch" | "other" | undefined;
|
|
44
|
+
check_run_id?: number | undefined;
|
|
45
|
+
details_url?: string | undefined;
|
|
46
|
+
}, {
|
|
47
|
+
name: string;
|
|
48
|
+
outcome: "ran" | "passed" | "skipped" | "failed" | "pending" | "cancelled";
|
|
49
|
+
reason?: "paths-filter" | "paths-ignore" | "manual" | "condition" | "concurrency" | "workflow_dispatch" | "other" | undefined;
|
|
50
|
+
check_run_id?: number | undefined;
|
|
51
|
+
details_url?: string | undefined;
|
|
52
|
+
}>, "many">;
|
|
53
|
+
}, "strip", z.ZodTypeAny, {
|
|
54
|
+
schema_version: 1;
|
|
55
|
+
jobs: {
|
|
56
|
+
name: string;
|
|
57
|
+
outcome: "ran" | "passed" | "skipped" | "failed" | "pending" | "cancelled";
|
|
58
|
+
reason?: "paths-filter" | "paths-ignore" | "manual" | "condition" | "concurrency" | "workflow_dispatch" | "other" | undefined;
|
|
59
|
+
check_run_id?: number | undefined;
|
|
60
|
+
details_url?: string | undefined;
|
|
61
|
+
}[];
|
|
62
|
+
generated_at?: string | undefined;
|
|
63
|
+
commit_sha?: string | undefined;
|
|
64
|
+
workflow?: string | undefined;
|
|
65
|
+
run_id?: number | undefined;
|
|
66
|
+
}, {
|
|
67
|
+
schema_version: 1;
|
|
68
|
+
jobs: {
|
|
69
|
+
name: string;
|
|
70
|
+
outcome: "ran" | "passed" | "skipped" | "failed" | "pending" | "cancelled";
|
|
71
|
+
reason?: "paths-filter" | "paths-ignore" | "manual" | "condition" | "concurrency" | "workflow_dispatch" | "other" | undefined;
|
|
72
|
+
check_run_id?: number | undefined;
|
|
73
|
+
details_url?: string | undefined;
|
|
74
|
+
}[];
|
|
75
|
+
generated_at?: string | undefined;
|
|
76
|
+
commit_sha?: string | undefined;
|
|
77
|
+
workflow?: string | undefined;
|
|
78
|
+
run_id?: number | undefined;
|
|
79
|
+
}>;
|
|
80
|
+
export type CiManifest = z.infer<typeof CiManifest>;
|
|
81
|
+
export declare function parseCiManifest(raw: unknown): CiManifest;
|
|
82
|
+
export declare function readCiManifestFile(filePath: string): CiManifest | null;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
/** Job outcome as emitted by path-filtered workflows (E15). */
|
|
5
|
+
export const CiManifestJobOutcome = z.enum([
|
|
6
|
+
"ran",
|
|
7
|
+
"passed",
|
|
8
|
+
"skipped",
|
|
9
|
+
"failed",
|
|
10
|
+
"pending",
|
|
11
|
+
"cancelled",
|
|
12
|
+
]);
|
|
13
|
+
/** Why a job did not run — `paths-filter` is the primary v4.2 use case. */
|
|
14
|
+
export const CiManifestSkipReason = z.enum([
|
|
15
|
+
"paths-filter",
|
|
16
|
+
"paths-ignore",
|
|
17
|
+
"manual",
|
|
18
|
+
"condition",
|
|
19
|
+
"concurrency",
|
|
20
|
+
"workflow_dispatch",
|
|
21
|
+
"other",
|
|
22
|
+
]);
|
|
23
|
+
export const CiManifestJob = z.object({
|
|
24
|
+
name: z.string().min(1),
|
|
25
|
+
outcome: CiManifestJobOutcome,
|
|
26
|
+
reason: CiManifestSkipReason.optional(),
|
|
27
|
+
check_run_id: z.number().int().positive().optional(),
|
|
28
|
+
details_url: z.string().url().optional(),
|
|
29
|
+
});
|
|
30
|
+
export const CiManifest = z.object({
|
|
31
|
+
schema_version: z.literal(1),
|
|
32
|
+
generated_at: z.string().optional(),
|
|
33
|
+
commit_sha: z.string().optional(),
|
|
34
|
+
workflow: z.string().optional(),
|
|
35
|
+
run_id: z.number().int().positive().optional(),
|
|
36
|
+
jobs: z.array(CiManifestJob),
|
|
37
|
+
});
|
|
38
|
+
export function parseCiManifest(raw) {
|
|
39
|
+
return CiManifest.parse(raw);
|
|
40
|
+
}
|
|
41
|
+
export function readCiManifestFile(filePath) {
|
|
42
|
+
try {
|
|
43
|
+
const resolved = path.resolve(filePath);
|
|
44
|
+
const contents = fs.readFileSync(resolved, "utf8");
|
|
45
|
+
return parseCiManifest(JSON.parse(contents));
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=ci-manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ci-manifest.js","sourceRoot":"","sources":["../../src/shared/ci-manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;A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9C,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC;CAC7B,CAAC,CAAC;AAGH,MAAM,UAAU,eAAe,CAAC,GAAY;IAC1C,OAAO,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AAC/B,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,QAAgB;IACjD,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QACxC,MAAM,QAAQ,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACnD,OAAO,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC/C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { RepoConfig as RepoConfigType } from "./types.js";
|
|
2
|
+
export declare const SUPPORTED_CONFIG_SCHEMA_VERSIONS: Set<number>;
|
|
3
|
+
export declare const CURRENT_CONFIG_SCHEMA_VERSION = 2;
|
|
4
|
+
export declare function parseYaml(input: string): unknown;
|
|
5
|
+
export declare function parseRepoConfigContent(content: string): RepoConfigType | null;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { RepoConfig } from "./types.js";
|
|
2
|
+
export const SUPPORTED_CONFIG_SCHEMA_VERSIONS = new Set([1, 2]);
|
|
3
|
+
export const CURRENT_CONFIG_SCHEMA_VERSION = 2;
|
|
4
|
+
export function parseYaml(input) {
|
|
5
|
+
const lines = input
|
|
6
|
+
.split("\n")
|
|
7
|
+
.map((line) => line.replace(/\r$/, ""))
|
|
8
|
+
.filter((line) => line.trim() !== "" && !line.trim().startsWith("#"));
|
|
9
|
+
const root = {};
|
|
10
|
+
const stack = [{ indent: -1, value: root }];
|
|
11
|
+
const parseScalar = (value) => {
|
|
12
|
+
const v = value.trim();
|
|
13
|
+
if ((v.startsWith('"') && v.endsWith('"')) ||
|
|
14
|
+
(v.startsWith("'") && v.endsWith("'"))) {
|
|
15
|
+
return v.slice(1, -1);
|
|
16
|
+
}
|
|
17
|
+
if (v === "true")
|
|
18
|
+
return true;
|
|
19
|
+
if (v === "false")
|
|
20
|
+
return false;
|
|
21
|
+
if (v === "null")
|
|
22
|
+
return null;
|
|
23
|
+
const n = Number(v);
|
|
24
|
+
if (!Number.isNaN(n) && v !== "")
|
|
25
|
+
return n;
|
|
26
|
+
return v;
|
|
27
|
+
};
|
|
28
|
+
const findNextSignificantLine = (fromIndex) => {
|
|
29
|
+
for (let i = fromIndex + 1; i < lines.length; i += 1) {
|
|
30
|
+
const candidate = lines[i];
|
|
31
|
+
if (candidate.trim() !== "" && !candidate.trim().startsWith("#")) {
|
|
32
|
+
return candidate;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return null;
|
|
36
|
+
};
|
|
37
|
+
for (let i = 0; i < lines.length; i += 1) {
|
|
38
|
+
const line = lines[i];
|
|
39
|
+
const indent = line.match(/^ */)?.[0].length ?? 0;
|
|
40
|
+
const trimmed = line.trim();
|
|
41
|
+
while (stack.length > 1 && indent <= stack[stack.length - 1].indent) {
|
|
42
|
+
stack.pop();
|
|
43
|
+
}
|
|
44
|
+
const container = stack[stack.length - 1].value;
|
|
45
|
+
if (trimmed.startsWith("- ")) {
|
|
46
|
+
if (!Array.isArray(container))
|
|
47
|
+
continue;
|
|
48
|
+
const itemRaw = trimmed.slice(2).trim();
|
|
49
|
+
if (itemRaw === "") {
|
|
50
|
+
const child = {};
|
|
51
|
+
container.push(child);
|
|
52
|
+
stack.push({ indent, value: child });
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
const itemKeyMatch = itemRaw.match(/^([A-Za-z0-9_-]+):\s*(.*)$/);
|
|
56
|
+
if (itemKeyMatch) {
|
|
57
|
+
const child = {};
|
|
58
|
+
const [, itemKey, itemVal] = itemKeyMatch;
|
|
59
|
+
if (itemVal === "") {
|
|
60
|
+
const nextLine = findNextSignificantLine(i);
|
|
61
|
+
const nextIndent = nextLine?.match(/^ */)?.[0].length ?? -1;
|
|
62
|
+
const nextTrimmed = nextLine?.trim() ?? "";
|
|
63
|
+
const useArray = nextLine !== null && nextIndent > indent && nextTrimmed.startsWith("- ");
|
|
64
|
+
child[itemKey] = useArray ? [] : {};
|
|
65
|
+
if (!useArray &&
|
|
66
|
+
typeof child[itemKey] === "object" &&
|
|
67
|
+
child[itemKey] !== null) {
|
|
68
|
+
stack.push({ indent, value: child[itemKey] });
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
const trimmedVal = itemVal.trim();
|
|
73
|
+
if (trimmedVal.startsWith("[") && trimmedVal.endsWith("]")) {
|
|
74
|
+
const inner = trimmedVal.slice(1, -1).trim();
|
|
75
|
+
child[itemKey] =
|
|
76
|
+
inner === ""
|
|
77
|
+
? []
|
|
78
|
+
: inner.split(",").map((item) => parseScalar(item.trim()));
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
child[itemKey] = parseScalar(itemVal);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
container.push(child);
|
|
85
|
+
stack.push({ indent, value: child });
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
container.push(parseScalar(itemRaw));
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
const keyMatch = trimmed.match(/^([A-Za-z0-9_-]+):\s*(.*)$/);
|
|
92
|
+
if (!keyMatch ||
|
|
93
|
+
typeof container !== "object" ||
|
|
94
|
+
container === null ||
|
|
95
|
+
Array.isArray(container)) {
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
const [, key, rawVal] = keyMatch;
|
|
99
|
+
if (rawVal !== "") {
|
|
100
|
+
const trimmedVal = rawVal.trim();
|
|
101
|
+
if (trimmedVal.startsWith("[") && trimmedVal.endsWith("]")) {
|
|
102
|
+
const inner = trimmedVal.slice(1, -1).trim();
|
|
103
|
+
container[key] =
|
|
104
|
+
inner === "" ? [] : inner.split(",").map((item) => parseScalar(item.trim()));
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
container[key] = parseScalar(rawVal);
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
const nextLine = findNextSignificantLine(i);
|
|
111
|
+
const nextIndent = nextLine?.match(/^ */)?.[0].length ?? -1;
|
|
112
|
+
const nextTrimmed = nextLine?.trim() ?? "";
|
|
113
|
+
const useArray = nextLine !== null && nextIndent > indent && nextTrimmed.startsWith("- ");
|
|
114
|
+
const child = useArray ? [] : {};
|
|
115
|
+
container[key] = child;
|
|
116
|
+
stack.push({ indent, value: child });
|
|
117
|
+
}
|
|
118
|
+
return root;
|
|
119
|
+
}
|
|
120
|
+
export function parseRepoConfigContent(content) {
|
|
121
|
+
const raw = parseYaml(content);
|
|
122
|
+
const parsed = RepoConfig.safeParse(raw);
|
|
123
|
+
if (!parsed.success)
|
|
124
|
+
return null;
|
|
125
|
+
return parsed.data;
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=config-core.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-core.js","sourceRoot":"","sources":["../../src/shared/config-core.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAGxC,MAAM,CAAC,MAAM,gCAAgC,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAChE,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAC;AAE/C,MAAM,UAAU,SAAS,CAAC,KAAa;IACrC,MAAM,KAAK,GAAG,KAAK;SAChB,KAAK,CAAC,IAAI,CAAC;SACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;SACtC,MAAM,CAAC,CAAC,IAAI,EAAE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;QAAE,OAAO,IAAI,CAAC;IACjC,OAAO,MAAM,CAAC,IAAI,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { GateMode, RepoConfig } from "./types.js";
|
|
2
|
+
export type DoctorSeverity = "error" | "warn" | "info";
|
|
3
|
+
export interface DoctorFinding {
|
|
4
|
+
severity: DoctorSeverity;
|
|
5
|
+
code: string;
|
|
6
|
+
message: string;
|
|
7
|
+
}
|
|
8
|
+
export interface DoctorReport {
|
|
9
|
+
configPath: string | null;
|
|
10
|
+
configValid: boolean;
|
|
11
|
+
gateMode: GateMode;
|
|
12
|
+
expectedCheckName: string;
|
|
13
|
+
configuredChecks: string[];
|
|
14
|
+
observedChecks: string[];
|
|
15
|
+
findings: DoctorFinding[];
|
|
16
|
+
ok: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface RunDoctorOptions {
|
|
19
|
+
cwd?: string;
|
|
20
|
+
offline?: boolean;
|
|
21
|
+
githubToken?: string;
|
|
22
|
+
repo?: string;
|
|
23
|
+
ref?: string;
|
|
24
|
+
}
|
|
25
|
+
export declare function findConfigPath(cwd: string): string | null;
|
|
26
|
+
export declare function loadRepoConfig(cwd: string): {
|
|
27
|
+
configPath: string | null;
|
|
28
|
+
config: RepoConfig | null;
|
|
29
|
+
error?: string;
|
|
30
|
+
};
|
|
31
|
+
export declare function collectConfiguredChecks(config: RepoConfig): string[];
|
|
32
|
+
export declare function validateConfigStructure(config: RepoConfig, configPath: string): DoctorFinding[];
|
|
33
|
+
export declare function compareConfiguredChecks(configuredChecks: string[], observedChecks: string[]): DoctorFinding[];
|
|
34
|
+
export interface GitHubRepoRef {
|
|
35
|
+
owner: string;
|
|
36
|
+
repo: string;
|
|
37
|
+
}
|
|
38
|
+
export declare function parseRepoRef(input: string): GitHubRepoRef | null;
|
|
39
|
+
export declare function fetchObservedCheckNames(options: {
|
|
40
|
+
token: string;
|
|
41
|
+
repo: GitHubRepoRef;
|
|
42
|
+
ref?: string;
|
|
43
|
+
}): Promise<{
|
|
44
|
+
checks: string[];
|
|
45
|
+
error?: string;
|
|
46
|
+
}>;
|
|
47
|
+
export declare function runDoctor(options?: RunDoctorOptions): Promise<DoctorReport>;
|
|
48
|
+
export declare function formatDoctorReport(report: DoctorReport): string;
|