@cyanautomation/kaseki-agent 1.62.1 → 1.64.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/dist/config/ConfigManager.d.ts +4 -4
- package/dist/kaseki-api/npm-version.d.ts +19 -0
- package/dist/kaseki-api/npm-version.d.ts.map +1 -0
- package/dist/kaseki-api/npm-version.js +43 -0
- package/dist/kaseki-api/npm-version.js.map +1 -0
- package/dist/kaseki-api/service-bootstrapper.d.ts.map +1 -1
- package/dist/kaseki-api/service-bootstrapper.js +41 -7
- package/dist/kaseki-api/service-bootstrapper.js.map +1 -1
- package/dist/kaseki-api/startup-health-reporter.d.ts +30 -0
- package/dist/kaseki-api/startup-health-reporter.d.ts.map +1 -0
- package/dist/kaseki-api/startup-health-reporter.js +174 -0
- package/dist/kaseki-api/startup-health-reporter.js.map +1 -0
- package/dist/kaseki-api/startup-summary-artifact.d.ts +29 -0
- package/dist/kaseki-api/startup-summary-artifact.d.ts.map +1 -0
- package/dist/kaseki-api/startup-summary-artifact.js +63 -0
- package/dist/kaseki-api/startup-summary-artifact.js.map +1 -0
- package/dist/kaseki-api-routes.d.ts.map +1 -1
- package/dist/kaseki-api-routes.js +49 -0
- package/dist/kaseki-api-routes.js.map +1 -1
- package/dist/kaseki-api-service.d.ts.map +1 -1
- package/dist/kaseki-api-service.js +45 -2
- package/dist/kaseki-api-service.js.map +1 -1
- package/dist/kaseki-api-types.d.ts +58 -0
- package/dist/kaseki-api-types.d.ts.map +1 -1
- package/dist/startup/checklist-renderer.d.ts +71 -0
- package/dist/startup/checklist-renderer.d.ts.map +1 -0
- package/dist/startup/checklist-renderer.js +174 -0
- package/dist/startup/checklist-renderer.js.map +1 -0
- package/dist/startup/container-preflight.d.ts +4 -0
- package/dist/startup/container-preflight.d.ts.map +1 -1
- package/dist/startup/container-preflight.js +37 -8
- package/dist/startup/container-preflight.js.map +1 -1
- package/dist/startup/event-categorizer.d.ts +49 -0
- package/dist/startup/event-categorizer.d.ts.map +1 -0
- package/dist/startup/event-categorizer.js +118 -0
- package/dist/startup/event-categorizer.js.map +1 -0
- package/dist/startup/preflight-summary.d.ts +26 -0
- package/dist/startup/preflight-summary.d.ts.map +1 -0
- package/dist/startup/preflight-summary.js +106 -0
- package/dist/startup/preflight-summary.js.map +1 -0
- package/dist/startup/progress-tracker.d.ts +75 -0
- package/dist/startup/progress-tracker.d.ts.map +1 -0
- package/dist/startup/progress-tracker.js +115 -0
- package/dist/startup/progress-tracker.js.map +1 -0
- package/dist/startup/timing-formatter.d.ts +58 -0
- package/dist/startup/timing-formatter.d.ts.map +1 -0
- package/dist/startup/timing-formatter.js +99 -0
- package/dist/startup/timing-formatter.js.map +1 -0
- package/kaseki-agent.sh +54 -168
- package/package.json +1 -1
- package/scripts/collect-feedback.js +12 -9
- package/scripts/docker-entrypoint.sh +2 -0
- package/scripts/kaseki-setup-host.sh +96 -36
- package/scripts/scouting-allowlist.js +229 -0
- package/scripts/startup-checks.sh +78 -2
|
@@ -180,14 +180,14 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
180
180
|
port?: number | undefined;
|
|
181
181
|
base_url?: string | undefined;
|
|
182
182
|
key?: string | undefined;
|
|
183
|
-
log_level?: "error" | "
|
|
183
|
+
log_level?: "error" | "info" | "debug" | "warn" | undefined;
|
|
184
184
|
max_concurrent_runs?: number | undefined;
|
|
185
185
|
}, {
|
|
186
186
|
keys?: string[] | undefined;
|
|
187
187
|
port?: number | undefined;
|
|
188
188
|
base_url?: string | undefined;
|
|
189
189
|
key?: string | undefined;
|
|
190
|
-
log_level?: "error" | "
|
|
190
|
+
log_level?: "error" | "info" | "debug" | "warn" | undefined;
|
|
191
191
|
max_concurrent_runs?: number | undefined;
|
|
192
192
|
}>>;
|
|
193
193
|
directories: z.ZodOptional<z.ZodObject<{
|
|
@@ -294,7 +294,7 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
294
294
|
port?: number | undefined;
|
|
295
295
|
base_url?: string | undefined;
|
|
296
296
|
key?: string | undefined;
|
|
297
|
-
log_level?: "error" | "
|
|
297
|
+
log_level?: "error" | "info" | "debug" | "warn" | undefined;
|
|
298
298
|
max_concurrent_runs?: number | undefined;
|
|
299
299
|
} | undefined;
|
|
300
300
|
directories?: {
|
|
@@ -371,7 +371,7 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
371
371
|
port?: number | undefined;
|
|
372
372
|
base_url?: string | undefined;
|
|
373
373
|
key?: string | undefined;
|
|
374
|
-
log_level?: "error" | "
|
|
374
|
+
log_level?: "error" | "info" | "debug" | "warn" | undefined;
|
|
375
375
|
max_concurrent_runs?: number | undefined;
|
|
376
376
|
} | undefined;
|
|
377
377
|
directories?: {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NPM Version Detection
|
|
3
|
+
*
|
|
4
|
+
* Detects the npm version installed in the container.
|
|
5
|
+
* Falls back gracefully to 'unknown' if detection fails.
|
|
6
|
+
*
|
|
7
|
+
* @returns npm version string (e.g., "10.2.4") or "unknown" on failure
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Get the installed npm version
|
|
11
|
+
*
|
|
12
|
+
* Uses process.versions.npm first (fast, no subprocess),
|
|
13
|
+
* falls back to `npm --version` command if that's unavailable,
|
|
14
|
+
* and gracefully returns 'unknown' if both fail.
|
|
15
|
+
*
|
|
16
|
+
* @returns Promise<string> - npm version or 'unknown'
|
|
17
|
+
*/
|
|
18
|
+
export declare function getNpmVersion(): Promise<string>;
|
|
19
|
+
//# sourceMappingURL=npm-version.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"npm-version.d.ts","sourceRoot":"","sources":["../../src/kaseki-api/npm-version.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH;;;;;;;;GAQG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC,CAyBrD"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NPM Version Detection
|
|
3
|
+
*
|
|
4
|
+
* Detects the npm version installed in the container.
|
|
5
|
+
* Falls back gracefully to 'unknown' if detection fails.
|
|
6
|
+
*
|
|
7
|
+
* @returns npm version string (e.g., "10.2.4") or "unknown" on failure
|
|
8
|
+
*/
|
|
9
|
+
import { execSync } from 'child_process';
|
|
10
|
+
/**
|
|
11
|
+
* Get the installed npm version
|
|
12
|
+
*
|
|
13
|
+
* Uses process.versions.npm first (fast, no subprocess),
|
|
14
|
+
* falls back to `npm --version` command if that's unavailable,
|
|
15
|
+
* and gracefully returns 'unknown' if both fail.
|
|
16
|
+
*
|
|
17
|
+
* @returns Promise<string> - npm version or 'unknown'
|
|
18
|
+
*/
|
|
19
|
+
export async function getNpmVersion() {
|
|
20
|
+
// Try process.versions.npm first (should be available in Node.js with npm)
|
|
21
|
+
// This is fast and requires no subprocess
|
|
22
|
+
if (process.versions.npm) {
|
|
23
|
+
return process.versions.npm;
|
|
24
|
+
}
|
|
25
|
+
// Fallback: try `npm --version` command
|
|
26
|
+
try {
|
|
27
|
+
const version = execSync('npm --version', {
|
|
28
|
+
encoding: 'utf-8',
|
|
29
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
30
|
+
timeout: 5000,
|
|
31
|
+
}).trim();
|
|
32
|
+
// Validate it looks like a version (basic sanity check)
|
|
33
|
+
if (version && /^\d+\.\d+\.\d+/.test(version)) {
|
|
34
|
+
return version;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
// npm command failed or timed out; silently fall through
|
|
39
|
+
}
|
|
40
|
+
// Graceful fallback: don't break startup, just indicate version is unknown
|
|
41
|
+
return 'unknown';
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=npm-version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"npm-version.js","sourceRoot":"","sources":["../../src/kaseki-api/npm-version.ts"],"names":[],"mappings":"AAAA;;;;;;;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/B,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,SAAS,EAAE,YAAY,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,IAAI,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;IAC1C,cAAc,EAAE,IAAI,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;IACjD,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC,CAAC;IACrD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,KAAK,CAAC;CAChC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,eAAe,GACtB,OAAO,CAAC,oBAAoB,CAAC,CAoH/B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAoDxE"}
|
|
@@ -20,47 +20,77 @@ const logger = createEventLogger('service-bootstrapper');
|
|
|
20
20
|
* @throws Error with context if any service initialization fails
|
|
21
21
|
*/
|
|
22
22
|
export async function bootstrapServices(config) {
|
|
23
|
+
const bootstrapStartTime = performance.now();
|
|
23
24
|
logger.info('Starting service bootstrap');
|
|
24
25
|
const cleanupTasks = [];
|
|
26
|
+
const componentTimings = [];
|
|
25
27
|
try {
|
|
26
28
|
// 1. Create artifact cache (no dependencies)
|
|
29
|
+
const cacheStartTime = performance.now();
|
|
27
30
|
logger.info('Initializing ResultCache');
|
|
28
31
|
const artifactCache = new ResultCache({
|
|
29
32
|
maxEntries: config.artifactCacheMaxEntries,
|
|
30
33
|
ttlMs: config.artifactCacheTtlMs,
|
|
31
34
|
maxFileBytes: config.artifactCacheMaxFileBytes,
|
|
32
35
|
});
|
|
33
|
-
|
|
36
|
+
const cacheDuration = performance.now() - cacheStartTime;
|
|
37
|
+
componentTimings.push({ name: 'ResultCache', durationMs: cacheDuration });
|
|
38
|
+
logger.info(`ResultCache initialized (${cacheDuration.toFixed(1)}ms)`);
|
|
34
39
|
cleanupTasks.push({
|
|
35
40
|
name: 'ResultCache',
|
|
36
41
|
run: () => artifactCache.clearAll(),
|
|
37
42
|
});
|
|
38
43
|
// 2. Create webhook manager (depends on: resultsDir)
|
|
44
|
+
const webhookStartTime = performance.now();
|
|
39
45
|
logger.info('Initializing WebhookManager');
|
|
40
46
|
const webhookManager = new WebhookManager(config.resultsDir);
|
|
41
|
-
|
|
47
|
+
const webhookDuration = performance.now() - webhookStartTime;
|
|
48
|
+
componentTimings.push({ name: 'WebhookManager', durationMs: webhookDuration });
|
|
49
|
+
logger.info(`WebhookManager initialized (${webhookDuration.toFixed(1)}ms)`);
|
|
42
50
|
cleanupTasks.push({
|
|
43
51
|
name: 'WebhookManager',
|
|
44
52
|
run: () => webhookManager.shutdown(),
|
|
45
53
|
});
|
|
46
54
|
// 3. Create idempotency store (depends on: resultsDir)
|
|
55
|
+
const idempotencyStartTime = performance.now();
|
|
47
56
|
logger.info('Initializing IdempotencyStore');
|
|
48
57
|
const idempotencyStore = new IdempotencyStore(config.resultsDir, 24);
|
|
49
|
-
|
|
58
|
+
const idempotencyDuration = performance.now() - idempotencyStartTime;
|
|
59
|
+
componentTimings.push({ name: 'IdempotencyStore', durationMs: idempotencyDuration });
|
|
60
|
+
logger.info(`IdempotencyStore initialized (${idempotencyDuration.toFixed(1)}ms)`);
|
|
50
61
|
cleanupTasks.push({
|
|
51
62
|
name: 'IdempotencyStore',
|
|
52
63
|
run: () => idempotencyStore.shutdown(),
|
|
53
64
|
});
|
|
54
65
|
// 4. Create pre-flight validator (no dependencies)
|
|
66
|
+
const validatorStartTime = performance.now();
|
|
55
67
|
logger.info('Initializing PreFlightValidator');
|
|
56
68
|
const preFlightValidator = new PreFlightValidator();
|
|
57
|
-
|
|
69
|
+
const validatorDuration = performance.now() - validatorStartTime;
|
|
70
|
+
componentTimings.push({ name: 'PreFlightValidator', durationMs: validatorDuration });
|
|
71
|
+
logger.info(`PreFlightValidator initialized (${validatorDuration.toFixed(1)}ms)`);
|
|
58
72
|
// 5. Create scheduler (depends on: config, webhookManager, artifactCache)
|
|
73
|
+
const schedulerStartTime = performance.now();
|
|
59
74
|
logger.info('Initializing JobScheduler');
|
|
60
75
|
const scheduler = new JobScheduler(config, webhookManager, artifactCache);
|
|
61
76
|
await scheduler.ready();
|
|
62
|
-
|
|
63
|
-
|
|
77
|
+
const schedulerDuration = performance.now() - schedulerStartTime;
|
|
78
|
+
componentTimings.push({ name: 'JobScheduler', durationMs: schedulerDuration });
|
|
79
|
+
logger.info(`JobScheduler initialized (${schedulerDuration.toFixed(1)}ms)`);
|
|
80
|
+
// Detect slow components and warn
|
|
81
|
+
const slowComponentThreshold = 1000; // 1 second
|
|
82
|
+
const slowComponents = componentTimings.filter(c => c.durationMs > slowComponentThreshold);
|
|
83
|
+
if (slowComponents.length > 0) {
|
|
84
|
+
logger.warn('Slow component initialization detected during bootstrap:', {
|
|
85
|
+
slowComponents: slowComponents.map(c => `${c.name} (${c.durationMs.toFixed(1)}ms)`),
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
const totalBootstrapDuration = performance.now() - bootstrapStartTime;
|
|
89
|
+
logger.info('Service bootstrap complete', {
|
|
90
|
+
totalDurationMs: totalBootstrapDuration.toFixed(1),
|
|
91
|
+
componentCount: componentTimings.length,
|
|
92
|
+
components: componentTimings,
|
|
93
|
+
});
|
|
64
94
|
return {
|
|
65
95
|
artifactCache,
|
|
66
96
|
webhookManager,
|
|
@@ -85,7 +115,11 @@ export async function bootstrapServices(config) {
|
|
|
85
115
|
}
|
|
86
116
|
}
|
|
87
117
|
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
88
|
-
|
|
118
|
+
const totalBootstrapDuration = performance.now() - bootstrapStartTime;
|
|
119
|
+
logger.error('Failed to bootstrap services', {
|
|
120
|
+
error: errorMessage,
|
|
121
|
+
durationMs: totalBootstrapDuration.toFixed(1),
|
|
122
|
+
});
|
|
89
123
|
throw new Error(`Service bootstrap failed: ${errorMessage}`, {
|
|
90
124
|
cause: err,
|
|
91
125
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-bootstrapper.js","sourceRoot":"","sources":["../../src/kaseki-api/service-bootstrapper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,MAAM,MAAM,GAAG,iBAAiB,CAAC,sBAAsB,CAAC,CAAC;AAyBzD;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,MAAuB;IAEvB,MAAM,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;IAE1C,MAAM,YAAY,GAChB,EAAE,CAAC;IAEL,IAAI,CAAC;QACH,6CAA6C;QAC7C,MAAM,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;QACxC,MAAM,aAAa,GAAG,IAAI,WAAW,CAAC;YACpC,UAAU,EAAE,MAAM,CAAC,uBAAuB;YAC1C,KAAK,EAAE,MAAM,CAAC,kBAAkB;YAChC,YAAY,EAAE,MAAM,CAAC,yBAAyB;SAC/C,CAAC,CAAC;QACH,MAAM,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"service-bootstrapper.js","sourceRoot":"","sources":["../../src/kaseki-api/service-bootstrapper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,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L,CAAC,CAAC,CAAC;QAEH,wBAAwB;QACxB,SAAS,CAAC,QAAQ,EAAE,CAAC;QACrB,MAAM,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;QAEtC,8BAA8B;QAC9B,MAAM,cAAc,CAAC,QAAQ,EAAE,CAAC;QAChC,MAAM,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;QAExC,gCAAgC;QAChC,gBAAgB,CAAC,QAAQ,EAAE,CAAC;QAC5B,MAAM,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;QAE1C,MAAM,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;QAC1C,IAAI,CAAC,CAAC,CAAC,CAAC;IACV,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,CAAC,KAAK,CAAC,gCAAgC,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACvE,IAAI,CAAC,CAAC,CAAC,CAAC;IACV,CAAC;YAAS,CAAC;QACT,YAAY,CAAC,WAAW,CAAC,CAAC;IAC5B,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Startup Health Reporter
|
|
3
|
+
*
|
|
4
|
+
* Consolidates bootstrap timing, preflight checks, and environment data
|
|
5
|
+
* into a unified health report for external monitoring and user visibility
|
|
6
|
+
*/
|
|
7
|
+
import type { PreflightCheck, StartupHealthReport, StartupIssue } from '../kaseki-api-types';
|
|
8
|
+
/**
|
|
9
|
+
* Categorizes preflight check failures into startup issues
|
|
10
|
+
* Groups by severity and includes remediation information
|
|
11
|
+
*
|
|
12
|
+
* @param checks - Array of preflight check results
|
|
13
|
+
* @returns Array of StartupIssue objects categorized by severity
|
|
14
|
+
*/
|
|
15
|
+
export declare function categorizeStartupIssues(checks: PreflightCheck[]): StartupIssue[];
|
|
16
|
+
/**
|
|
17
|
+
* Generates a unified startup health report
|
|
18
|
+
*
|
|
19
|
+
* @param bootstrapDurationMs - Time to bootstrap all services
|
|
20
|
+
* @param preflightDurationMs - Time to run preflight checks
|
|
21
|
+
* @param preflight Checks - Array of preflight check results
|
|
22
|
+
* @param componentTimings - Map of component name to duration in ms
|
|
23
|
+
* @returns StartupHealthReport with consolidated health data
|
|
24
|
+
*/
|
|
25
|
+
export declare function generateStartupHealthReport(bootstrapDurationMs: number, preflightDurationMs: number, preflightChecks: PreflightCheck[], componentTimings?: Record<string, number>): StartupHealthReport;
|
|
26
|
+
/**
|
|
27
|
+
* Converts health report to human-readable markdown
|
|
28
|
+
*/
|
|
29
|
+
export declare function healthReportToMarkdown(report: StartupHealthReport): string;
|
|
30
|
+
//# sourceMappingURL=startup-health-reporter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"startup-health-reporter.d.ts","sourceRoot":"","sources":["../../src/kaseki-api/startup-health-reporter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAE7F;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,cAAc,EAAE,GAAG,YAAY,EAAE,CAgBhF;AA4BD;;;;;;;;GAQG;AACH,wBAAgB,2BAA2B,CACzC,mBAAmB,EAAE,MAAM,EAC3B,mBAAmB,EAAE,MAAM,EAC3B,eAAe,EAAE,cAAc,EAAE,EACjC,gBAAgB,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GAC5C,mBAAmB,CAsDrB;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,mBAAmB,GAAG,MAAM,CAuD1E"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Startup Health Reporter
|
|
3
|
+
*
|
|
4
|
+
* Consolidates bootstrap timing, preflight checks, and environment data
|
|
5
|
+
* into a unified health report for external monitoring and user visibility
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Categorizes preflight check failures into startup issues
|
|
9
|
+
* Groups by severity and includes remediation information
|
|
10
|
+
*
|
|
11
|
+
* @param checks - Array of preflight check results
|
|
12
|
+
* @returns Array of StartupIssue objects categorized by severity
|
|
13
|
+
*/
|
|
14
|
+
export function categorizeStartupIssues(checks) {
|
|
15
|
+
const failedChecks = checks.filter(check => !check.ok);
|
|
16
|
+
return failedChecks.map(check => {
|
|
17
|
+
const severity = determineSeverity(check.name);
|
|
18
|
+
const autoFixable = isAutoFixable(check.name);
|
|
19
|
+
return {
|
|
20
|
+
severity,
|
|
21
|
+
component: check.name,
|
|
22
|
+
detail: check.detail || 'Check failed',
|
|
23
|
+
remediation: check.remediation,
|
|
24
|
+
autoFixable,
|
|
25
|
+
timestamp: new Date().toISOString(),
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Determines severity level based on check type
|
|
31
|
+
*/
|
|
32
|
+
function determineSeverity(checkName) {
|
|
33
|
+
const blockingChecks = [
|
|
34
|
+
'setup-completeness',
|
|
35
|
+
'secrets-readable',
|
|
36
|
+
'checkout-exists',
|
|
37
|
+
];
|
|
38
|
+
if (blockingChecks.includes(checkName)) {
|
|
39
|
+
return 'blocking';
|
|
40
|
+
}
|
|
41
|
+
// Most preflight checks are warnings (non-blocking)
|
|
42
|
+
return 'warning';
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Determines if an issue can be auto-fixed
|
|
46
|
+
*/
|
|
47
|
+
function isAutoFixable(checkName) {
|
|
48
|
+
const autoFixableChecks = ['git-safe-directory'];
|
|
49
|
+
return autoFixableChecks.includes(checkName);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Generates a unified startup health report
|
|
53
|
+
*
|
|
54
|
+
* @param bootstrapDurationMs - Time to bootstrap all services
|
|
55
|
+
* @param preflightDurationMs - Time to run preflight checks
|
|
56
|
+
* @param preflight Checks - Array of preflight check results
|
|
57
|
+
* @param componentTimings - Map of component name to duration in ms
|
|
58
|
+
* @returns StartupHealthReport with consolidated health data
|
|
59
|
+
*/
|
|
60
|
+
export function generateStartupHealthReport(bootstrapDurationMs, preflightDurationMs, preflightChecks, componentTimings = {}) {
|
|
61
|
+
const issues = categorizeStartupIssues(preflightChecks);
|
|
62
|
+
// Build component timing info
|
|
63
|
+
const components = {};
|
|
64
|
+
const slowComponentThreshold = 1000; // 1 second
|
|
65
|
+
for (const [name, durationMs] of Object.entries(componentTimings)) {
|
|
66
|
+
const status = durationMs > slowComponentThreshold ? 'warning' : 'ok';
|
|
67
|
+
const reason = durationMs > slowComponentThreshold ? 'slow_init' : undefined;
|
|
68
|
+
components[name] = {
|
|
69
|
+
name,
|
|
70
|
+
durationMs,
|
|
71
|
+
status,
|
|
72
|
+
...(reason && { reason }),
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
// Build preflight check summary
|
|
76
|
+
const preflight = {};
|
|
77
|
+
const passedChecks = preflightChecks.filter(c => c.ok);
|
|
78
|
+
for (const check of preflightChecks) {
|
|
79
|
+
preflight[check.name] = {
|
|
80
|
+
ok: check.ok,
|
|
81
|
+
...(check.elapsedMs && { elapsedMs: check.elapsedMs }),
|
|
82
|
+
...(check.detail && { detail: check.detail }),
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
const totalMs = bootstrapDurationMs + preflightDurationMs;
|
|
86
|
+
// Determine overall status
|
|
87
|
+
const blockingIssues = issues.filter(i => i.severity === 'blocking');
|
|
88
|
+
const status = blockingIssues.length > 0 ? 'error' : issues.length > 0 ? 'degraded' : 'ok';
|
|
89
|
+
return {
|
|
90
|
+
timestamp: new Date().toISOString(),
|
|
91
|
+
status,
|
|
92
|
+
summary: {
|
|
93
|
+
passed: passedChecks.length,
|
|
94
|
+
warnings: issues.filter(i => i.severity === 'warning').length,
|
|
95
|
+
blocking: blockingIssues.length,
|
|
96
|
+
},
|
|
97
|
+
timing: {
|
|
98
|
+
bootstrapMs: Math.round(bootstrapDurationMs),
|
|
99
|
+
preflightMs: Math.round(preflightDurationMs),
|
|
100
|
+
totalMs: Math.round(totalMs),
|
|
101
|
+
},
|
|
102
|
+
components: components,
|
|
103
|
+
preflight,
|
|
104
|
+
issues,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Converts health report to human-readable markdown
|
|
109
|
+
*/
|
|
110
|
+
export function healthReportToMarkdown(report) {
|
|
111
|
+
const lines = [];
|
|
112
|
+
lines.push('# Startup Health Report\n');
|
|
113
|
+
lines.push(`**Status:** ${getStatusEmoji(report.status)} ${report.status.toUpperCase()}\n`);
|
|
114
|
+
lines.push('## Summary');
|
|
115
|
+
lines.push(`- Passed: ${report.summary.passed}`);
|
|
116
|
+
lines.push(`- Warnings: ${report.summary.warnings}`);
|
|
117
|
+
lines.push(`- Blocking Issues: ${report.summary.blocking}\n`);
|
|
118
|
+
lines.push('## Timing');
|
|
119
|
+
lines.push(`- Bootstrap: ${report.timing.bootstrapMs}ms`);
|
|
120
|
+
lines.push(`- Preflight: ${report.timing.preflightMs}ms`);
|
|
121
|
+
lines.push(`- **Total: ${report.timing.totalMs}ms**\n`);
|
|
122
|
+
if (Object.keys(report.components).length > 0) {
|
|
123
|
+
lines.push('## Components');
|
|
124
|
+
for (const [name, timing] of Object.entries(report.components)) {
|
|
125
|
+
const icon = timing.status === 'warning' ? '⚠️' : '✓';
|
|
126
|
+
lines.push(`${icon} ${name} (${timing.durationMs.toFixed(1)}ms)`);
|
|
127
|
+
if (timing.reason) {
|
|
128
|
+
lines.push(` └─ ${timing.reason}`);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
lines.push('');
|
|
132
|
+
}
|
|
133
|
+
if (report.issues.length > 0) {
|
|
134
|
+
lines.push('## Issues\n');
|
|
135
|
+
for (const issue of report.issues) {
|
|
136
|
+
const severityIcon = issue.severity === 'blocking'
|
|
137
|
+
? '🔴'
|
|
138
|
+
: issue.severity === 'warning'
|
|
139
|
+
? '🟡'
|
|
140
|
+
: '🔵';
|
|
141
|
+
lines.push(`${severityIcon} **${issue.component}** (${issue.severity})`);
|
|
142
|
+
lines.push(` ${issue.detail}`);
|
|
143
|
+
if (issue.remediation) {
|
|
144
|
+
lines.push(` → Fix: \`${issue.remediation}\``);
|
|
145
|
+
}
|
|
146
|
+
if (issue.autoFixable) {
|
|
147
|
+
lines.push(' → Auto-fixable: Yes');
|
|
148
|
+
}
|
|
149
|
+
lines.push('');
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
lines.push('## Issues\n');
|
|
154
|
+
lines.push('✓ No issues found\n');
|
|
155
|
+
}
|
|
156
|
+
lines.push(`_Generated: ${report.timestamp}_`);
|
|
157
|
+
return lines.join('\n');
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Get emoji for status
|
|
161
|
+
*/
|
|
162
|
+
function getStatusEmoji(status) {
|
|
163
|
+
switch (status) {
|
|
164
|
+
case 'ok':
|
|
165
|
+
return '✅';
|
|
166
|
+
case 'degraded':
|
|
167
|
+
return '⚠️';
|
|
168
|
+
case 'error':
|
|
169
|
+
return '❌';
|
|
170
|
+
default:
|
|
171
|
+
return '❓';
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
//# sourceMappingURL=startup-health-reporter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"startup-health-reporter.js","sourceRoot":"","sources":["../../src/kaseki-api/startup-health-reporter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;;;;;GAMG;AACH,MAAM,UAAU,uBAAuB,CAAC,MAAwB;IAC9D,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAEvD,OAAO,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;QAC9B,MAAM,QAAQ,GAAG,iB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AY,MAAM,KAAK,CAAC,SAAS,OAAO,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAC;YACzE,KAAK,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;YACjC,IAAI,KAAK,CAAC,WAAW,EAAE,CAAC;gBACtB,KAAK,CAAC,IAAI,CAAC,eAAe,KAAK,CAAC,WAAW,IAAI,CAAC,CAAC;YACnD,CAAC;YACD,IAAI,KAAK,CAAC,WAAW,EAAE,CAAC;gBACtB,KAAK,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;YACvC,CAAC;YACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACjB,CAAC;IACH,CAAC;SAAM,CAAC;QACN,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC1B,KAAK,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;IACpC,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,eAAe,MAAM,CAAC,SAAS,GAAG,CAAC,CAAC;IAE/C,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED;;GAEG;AACH,SAAS,cAAc,CAAC,MAAc;IACpC,QAAQ,MAAM,EAAE,CAAC;QACjB,KAAK,IAAI;YACP,OAAO,GAAG,CAAC;QACb,KAAK,UAAU;YACb,OAAO,IAAI,CAAC;QACd,KAAK,OAAO;YACV,OAAO,GAAG,CAAC;QACb;YACE,OAAO,GAAG,CAAC;IACb,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Startup Summary Artifact Writer
|
|
3
|
+
*
|
|
4
|
+
* Writes startup health reports to JSON and markdown artifacts
|
|
5
|
+
* Caches in memory for API endpoint access
|
|
6
|
+
*/
|
|
7
|
+
import type { StartupHealthReport } from '../kaseki-api-types';
|
|
8
|
+
/**
|
|
9
|
+
* Write startup health report to artifacts directory
|
|
10
|
+
*
|
|
11
|
+
* Writes two files:
|
|
12
|
+
* - startup-health-report.json (structured for parsing)
|
|
13
|
+
* - startup-summary.md (human-readable)
|
|
14
|
+
*
|
|
15
|
+
* @param resultsDir - Directory to write artifacts to
|
|
16
|
+
* @param report - Health report to write
|
|
17
|
+
* @throws Error if write fails
|
|
18
|
+
*/
|
|
19
|
+
export declare function writeStartupHealthArtifacts(resultsDir: string, report: StartupHealthReport): void;
|
|
20
|
+
/**
|
|
21
|
+
* Get cached startup health report (populated after startup)
|
|
22
|
+
* Returns null if not yet generated
|
|
23
|
+
*/
|
|
24
|
+
export declare function getCachedStartupHealthReport(): StartupHealthReport | null;
|
|
25
|
+
/**
|
|
26
|
+
* Clear cached report (for testing)
|
|
27
|
+
*/
|
|
28
|
+
export declare function clearCachedStartupHealthReport(): void;
|
|
29
|
+
//# sourceMappingURL=startup-summary-artifact.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"startup-summary-artifact.d.ts","sourceRoot":"","sources":["../../src/kaseki-api/startup-summary-artifact.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAO/D;;;;;;;;;;GAUG;AACH,wBAAgB,2BAA2B,CACzC,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,mBAAmB,GAC1B,IAAI,CA2BN;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,IAAI,mBAAmB,GAAG,IAAI,CAEzE;AAED;;GAEG;AACH,wBAAgB,8BAA8B,IAAI,IAAI,CAErD"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Startup Summary Artifact Writer
|
|
3
|
+
*
|
|
4
|
+
* Writes startup health reports to JSON and markdown artifacts
|
|
5
|
+
* Caches in memory for API endpoint access
|
|
6
|
+
*/
|
|
7
|
+
import * as fs from 'fs';
|
|
8
|
+
import * as path from 'path';
|
|
9
|
+
import { createEventLogger } from '../logger.js';
|
|
10
|
+
import { healthReportToMarkdown } from './startup-health-reporter.js';
|
|
11
|
+
const logger = createEventLogger('startup-artifacts');
|
|
12
|
+
let cachedHealthReport = null;
|
|
13
|
+
/**
|
|
14
|
+
* Write startup health report to artifacts directory
|
|
15
|
+
*
|
|
16
|
+
* Writes two files:
|
|
17
|
+
* - startup-health-report.json (structured for parsing)
|
|
18
|
+
* - startup-summary.md (human-readable)
|
|
19
|
+
*
|
|
20
|
+
* @param resultsDir - Directory to write artifacts to
|
|
21
|
+
* @param report - Health report to write
|
|
22
|
+
* @throws Error if write fails
|
|
23
|
+
*/
|
|
24
|
+
export function writeStartupHealthArtifacts(resultsDir, report) {
|
|
25
|
+
try {
|
|
26
|
+
// Ensure directory exists
|
|
27
|
+
fs.mkdirSync(resultsDir, { recursive: true });
|
|
28
|
+
// Write JSON
|
|
29
|
+
const jsonPath = path.join(resultsDir, 'startup-health-report.json');
|
|
30
|
+
fs.writeFileSync(jsonPath, JSON.stringify(report, null, 2), 'utf-8');
|
|
31
|
+
logger.debug('Wrote startup health report (JSON)', { filePath: jsonPath });
|
|
32
|
+
// Write Markdown
|
|
33
|
+
const markdown = healthReportToMarkdown(report);
|
|
34
|
+
const mdPath = path.join(resultsDir, 'startup-summary.md');
|
|
35
|
+
fs.writeFileSync(mdPath, markdown, 'utf-8');
|
|
36
|
+
logger.debug('Wrote startup health report (Markdown)', { filePath: mdPath });
|
|
37
|
+
// Cache for API access
|
|
38
|
+
cachedHealthReport = report;
|
|
39
|
+
logger.debug('Cached startup health report in memory');
|
|
40
|
+
}
|
|
41
|
+
catch (err) {
|
|
42
|
+
const errorMsg = err instanceof Error ? err.message : String(err);
|
|
43
|
+
logger.error('Failed to write startup health artifacts', {
|
|
44
|
+
error: errorMsg,
|
|
45
|
+
resultsDir,
|
|
46
|
+
});
|
|
47
|
+
throw new Error(`Failed to write startup artifacts: ${errorMsg}`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Get cached startup health report (populated after startup)
|
|
52
|
+
* Returns null if not yet generated
|
|
53
|
+
*/
|
|
54
|
+
export function getCachedStartupHealthReport() {
|
|
55
|
+
return cachedHealthReport;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Clear cached report (for testing)
|
|
59
|
+
*/
|
|
60
|
+
export function clearCachedStartupHealthReport() {
|
|
61
|
+
cachedHealthReport = null;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=startup-summary-artifact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"startup-summary-artifact.js","sourceRoot":"","sources":["../../src/kaseki-api/startup-summary-artifact.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAEnE,MAAM,MAAM,GAAG,iBAAiB,CAAC,mBAAmB,CAAC,CAAC;AAEtD,IAAI,kBAAkB,GAA+B,IAAI,CAAC;AAE1D;;;;;;;;;;GAUG;AACH,MAAM,UAAU,2BAA2B,CACzC,UAAkB,EAClB,MAA2B;IAE3B,IAAI,CAAC;QACH,0BAA0B;QAC1B,EAAE,CAAC,SAAS,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAE9C,aAAa;QACb,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,4BAA4B,CAAC,CAAC;QACrE,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;QACrE,MAAM,CAAC,KAAK,CAAC,oCAAoC,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,CA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BAAkB,EAAE,MAAM,wBAAwB,CAAC;AAY5D,OAAO,EAAE,eAAe,EAAkB,MAAM,qBAAqB,CAAC;AAWtE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"kaseki-api-routes.d.ts","sourceRoot":"","sources":["../src/kaseki-api-routes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAmC,MAAM,SAAS,CAAC;AAWlE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAY5D,OAAO,EAAE,eAAe,EAAkB,MAAM,qBAAqB,CAAC;AAWtE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAO7C,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAwoB5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AA+gBjE;;GAEG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,YAAY,EACvB,MAAM,EAAE,eAAe,EACvB,gBAAgB,EAAE,gBAAgB,EAClC,kBAAkB,EAAE,kBAAkB,EACtC,aAAa,cAIX,GACD,MAAM,CA2kBR"}
|
|
@@ -22,6 +22,8 @@ import { createGitHubIssuesRoutes } from './routes/github-issues-routes.js';
|
|
|
22
22
|
import { ResultCache } from './result-cache.js';
|
|
23
23
|
import { validateGitHubAppPrivateKey } from './github-app-private-key.js';
|
|
24
24
|
import { metricsRegistry } from './metrics.js';
|
|
25
|
+
import { getCachedStartupHealthReport } from './kaseki-api/startup-summary-artifact.js';
|
|
26
|
+
import { healthReportToMarkdown } from './kaseki-api/startup-health-reporter.js';
|
|
25
27
|
// Re-export UTF-8 helpers for backward compatibility
|
|
26
28
|
export { decodeUtf8TailSafely, tailLogByLines } from './utils/utf8-helpers.js';
|
|
27
29
|
const TEMPLATE_REMEDIATION = 'Run scripts/kaseki-activate.sh --controller bootstrap.';
|
|
@@ -980,6 +982,53 @@ export function createApiRouter(scheduler, config, idempotencyStore, preFlightVa
|
|
|
980
982
|
}
|
|
981
983
|
res.status(response.status === 'error' ? 503 : 200).json(response);
|
|
982
984
|
});
|
|
985
|
+
/**
|
|
986
|
+
* GET /api/startup-health — Unified startup health report (Phase 4)
|
|
987
|
+
* Returns consolidated health status with bootstrap timing, preflight checks, and component status
|
|
988
|
+
*/
|
|
989
|
+
router.get('/startup-health', (_req, res) => {
|
|
990
|
+
try {
|
|
991
|
+
const report = getCachedStartupHealthReport();
|
|
992
|
+
if (!report) {
|
|
993
|
+
res.status(404).json({
|
|
994
|
+
error: 'startup-health-not-available',
|
|
995
|
+
detail: 'Startup health report not yet generated. Check back after service initialization.',
|
|
996
|
+
});
|
|
997
|
+
return;
|
|
998
|
+
}
|
|
999
|
+
res.status(200).json(report);
|
|
1000
|
+
}
|
|
1001
|
+
catch (err) {
|
|
1002
|
+
logger.error('Failed to retrieve startup health report', {
|
|
1003
|
+
error: err instanceof Error ? err.message : String(err),
|
|
1004
|
+
});
|
|
1005
|
+
res.status(500).json({
|
|
1006
|
+
error: 'health-report-error',
|
|
1007
|
+
detail: 'Failed to retrieve startup health report',
|
|
1008
|
+
});
|
|
1009
|
+
}
|
|
1010
|
+
});
|
|
1011
|
+
/**
|
|
1012
|
+
* GET /api/startup-health/markdown — Startup health report in markdown format
|
|
1013
|
+
* Human-readable summary for logs and documentation
|
|
1014
|
+
*/
|
|
1015
|
+
router.get('/startup-health/markdown', (_req, res) => {
|
|
1016
|
+
try {
|
|
1017
|
+
const report = getCachedStartupHealthReport();
|
|
1018
|
+
if (!report) {
|
|
1019
|
+
res.status(404).type('text/markdown').send('# Startup Health Report\n\nReport not yet available.\n');
|
|
1020
|
+
return;
|
|
1021
|
+
}
|
|
1022
|
+
const markdown = healthReportToMarkdown(report);
|
|
1023
|
+
res.type('text/markdown').status(200).send(markdown);
|
|
1024
|
+
}
|
|
1025
|
+
catch (err) {
|
|
1026
|
+
logger.error('Failed to generate startup health markdown', {
|
|
1027
|
+
error: err instanceof Error ? err.message : String(err),
|
|
1028
|
+
});
|
|
1029
|
+
res.status(500).type('text/markdown').send('# Error\n\nFailed to generate health report.\n');
|
|
1030
|
+
}
|
|
1031
|
+
});
|
|
983
1032
|
/**
|
|
984
1033
|
* Extract: Validate publish mode has proper authentication.
|
|
985
1034
|
*/
|