@svadmin/devtools
v0.3.3
Published
Headless diagnostics core for svadmin — query traces, provider diagnostics, permission/resource/route inspection
Maintainers
Readme
@svadmin/devtools
Headless diagnostics core for svadmin.
@svadmin/devtools-contract defines the JSON-safe snapshot, event, and
diagnostic vocabulary. This package adds the runtime pieces that adapters, SSR,
and the CLI can share:
createDevtoolsCollector()— a bounded, redacting in-memory collector withrecordEvent,recordDiagnostic,snapshot,subscribe, andclear.buildProviderDiagnostics(bundle)— provider configuration/capability matrix.buildResourceDiagnostics(resources)/buildRouteDiagnostics(resources)— resource operations, menu visibility, provider routing, and route paths.toPermissionDiagnostic(resource, action, result)— normalizes access-control results for display.buildAdminDiagnostics(options)— combines the complete application snapshot, provider/resource/route diagnostics, and a healthy/warning/error summary.buildDevtoolsHealthSummary(input)— derives a small health summary for a panel badge, CLI output, or readiness check.- Re-exports the whole
@svadmin/devtools-contractsurface.
UI rendering stays in @svadmin/ui (DevTools.svelte); this package is the
headless boundary so non-UI consumers do not depend on devframe or Svelte.
Usage
import { createDevtoolsCollector, buildProviderDiagnostics } from '@svadmin/devtools';
const collector = createDevtoolsCollector({ source: 'frontend', maxEvents: 200 });
collector.recordDiagnostic({
code: 'provider.missing',
source: 'frontend',
severity: 'warning',
message: 'liveProvider is not configured',
});
const snapshot = collector.snapshot({ requestId: 'req-1' });
const providers = buildProviderDiagnostics(config.providers);
const diagnostics = buildAdminDiagnostics({
providers: config.providers,
resources: config.resources,
basePath: '/admin',
});
diagnostics.health.status; // 'healthy' | 'warning' | 'error'Secrets are redacted by redactDevtoolsRecord before a snapshot is produced.
