Use existing UI docs when AI chat builds components

Merged
WE
1mo ago
+357-6

AI chat can generate code that compiles but uses Twenty UI incorrectly, for example rendering Card instead of Card.Root. This gives the chat access to the existing UI documentation before it writes a component.

Add get_front_component_ui_docs, a read-only tool that returns UI guides and generated API definitions for supported components. An empty request lists the catalog; a request can fetch up to five guides, with the source UI package version. The authoring instructions tell the model to consult those docs instead of relying on manually maintained examples. The preview query schema also clarifies singular object names, moved out of #29407.

The existing twenty-docs:generate:ui command produces a committed JSON asset alongside its generated references. The existing twenty-docs:check:ui verifies freshness, including when only that asset changes. Nest copies the asset into the server package. Server builds, startup, workers and integration tests require no documentation generation, and Docker no longer needs the raw documentation sources. Runtime lookup is local and lazily cached, with retry after a failed read.

Removing the extra integration task dependency also removes the shared-build cache restoration that could overlap the background database reset. The failed shards were missing shared output modules before tests started; the updated Nx graph contains only the integration test task.

Validation: 102 docs tests, 10 focused server tests, existing UI freshness and example checks, direct server typecheck, scoped lint and formatting. Stale and missing assets fail freshness checks without being rewritten. A normal Nest build packages byte-identical documentation; compiled runtime lookup returns Card and Tabs and rejects unsupported components. Full integration CI will rerun after push; no live model run for this change.

This provides authoring guidance. Checking generated code against the Workspace app's installed dependency types is handled separately in #29412.