Add MCP dashboard-schema generator - #1072
Draft
dillan wants to merge 10 commits into
Draft
Conversation
Begin the KIP dashboard-schema generator test-first. The new vitest suite (run via test:mcp-schema, in an isolated node environment) describes the widget catalog the generator must extract from widget.service.ts. These tests fail on purpose: the generator is still a stub. The ts-morph implementation lands in the next commit.
Extract KIP's widget catalog from widget.service.ts using the TypeScript Compiler API (already a KIP dependency, so no new packages). The _widgetDefinition literal is read statically and each entry validated; the generator fails loudly if the shape changes, and commented-out widgets are naturally excluded. For stable, consistent diffs of the generated artifact, output is canonical: object keys sorted recursively (serialize.ts), widgets sorted by selector, and plugin lists sorted.
Extend the generator test-first to cover per-widget DEFAULT_CONFIG, the structural binding kind (paths-record / paths-array / datachart / none), and path-slot extraction. These tests fail on purpose against a stub; the implementation lands in the next commit.
Read each widget component's static DEFAULT_CONFIG via the TypeScript Compiler API, resolving the component file from its import in widget.service.ts. Derive bindingKind structurally and extract path slots for record-bound widgets. The 'every widget' test confirms all active widget DEFAULT_CONFIGs are pure static literals, so static extraction is sound.
Cover the 24-column grid geometry, colour tokens, theme names, dashboard icons, and unit groups the generator must read from KIP source. These fail on purpose against a stub.
Read the 24-column grid geometry from dashboard.component.ts, colour tokens from app-service.ts, unit groups from units.service.ts, and dashboard icons from the SVG sprite. Colours and unit groups keep their authored order; icons are sorted and de-duplicated.
Cover buildSchema: version-stamped meta plus the assembled widgets and design system. Fails on purpose against a stub.
Add buildSchema (version-stamped meta + widgets + design system) and generate src/assets/kip-dashboard-schema.json, which KIP's static host serves at /@mxtommy/kip/assets/kip-dashboard-schema.json for the kip-mcp-server to fetch. The artifact is deterministic (no timestamps) and canonical. The new gen:mcp-schema script regenerates it; a drift-gate test fails if a widget or the design system changes without regenerating.
Read each token's base hex from the $kip-dark-color SCSS map and add it to the generated schema's colour list, so previews can render the real KIP palette instead of guessing.
This was referenced Jun 30, 2026
dillan
marked this pull request as draft
July 1, 2026 20:00
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this adds
A build-time generator that extracts KIP's design vocabulary into a single,
versioned JSON artifact for the external kip-mcp-server to consume, so an AI
assistant can design valid KIP dashboards.
tools/gen-mcp-schema/reads KIP source statically with the TypeScript CompilerAPI (already a KIP dependency — no new packages) and emits
src/assets/kip-dashboard-schema.json: the widget catalog, each widget'sDEFAULT_CONFIG, its binding kind and path slots, plus the design system (24-columngrid, colour tokens, theme names, dashboard icons, unit groups).
loudly if a widget's
DEFAULT_CONFIGis ever not a pure literal (so the artifactcan't go silently wrong).
timestamps), so the committed artifact diffs cleanly between versions.
npm run gen:mcp-schemaregenerates it; a drift-gate test fails if it's out of date.Scope and safety
tools/gen-mcp-schema/and the generatedsrc/assets/kip-dashboard-schema.json. No app code changes.nodeconfig, so it does not touch theapp's
ng testor the production build.src/assets, so the artifact is reachable at/@mxtommy/kip/assets/kip-dashboard-schema.jsonwith no new server code.