Skip to content

feat: corpus-back all 4 shadcn components (Button, Dialog, Field, Select)#85

Merged
KailasMahavarkar merged 5 commits intomainfrom
feat/corpus-shadcn-components
Apr 21, 2026
Merged

feat: corpus-back all 4 shadcn components (Button, Dialog, Field, Select)#85
KailasMahavarkar merged 5 commits intomainfrom
feat/corpus-shadcn-components

Conversation

@KailasMahavarkar
Copy link
Copy Markdown
Collaborator

Summary

  • Adds corpus support to src/plugins/shadcn/tools/get-component.ts with a generic per-component loader that validates required fields and falls back to the in-file SHADCN_COMPONENTS registry when a slice is missing or invalid
  • Creates the frontend.shadcn corpus namespace and 4 component slices: Button, Dialog, Field, Select
  • Registers frontend.shadcn in corpus/index.yaml
  • New tests/shadcn-component-corpus-backed-tools-behaviour.test.ts asserts corpus source for every migrated component

Test plan

  • bun test tests/shadcn-component-corpus-backed-tools-behaviour.test.ts - 4 pass
  • bun run build - typecheck exit 0
  • Full regression across 20 test files - no failures

KailasMahavarkar and others added 5 commits April 22, 2026 02:21
Adds corpus support to `src/plugins/shadcn/tools/get-component.ts`. The tool now reads per-component slices from `corpus/frontend/shadcn/<name>.yaml`, validates required fields (category, basePrimitive, dataSlots, usageSnippet, requiresUseClient, pairsWith), and falls back to the in-file `SHADCN_COMPONENTS` registry when the corpus entry is missing or invalid.

Creates the shadcn corpus namespace:
- `corpus/frontend/shadcn/index.yaml` registers the `frontend.shadcn` namespace and component files
- `corpus/frontend/shadcn/button.yaml` captures the Button contract (category, variants, sizes, usage snippet, pairs)
- `corpus/index.yaml` registers the new namespace

New `tests/shadcn-component-corpus-backed-tools-behaviour.test.ts` asserts corpus source for Button and fallback for Dialog.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds corpus/frontend/shadcn/dialog.yaml with Dialog contract (base-ui primitive, 6 data slots, use-client requirement, full modal usage snippet).
Registers dialog in namespace index.
Test asserts corpus source for Dialog; fallback check moves to Field.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds corpus/frontend/shadcn/field.yaml with Field contract (base-ui field primitive, vertical/horizontal variants, container-query orientation usage snippet, form-pair components).
Registers field in namespace index.
Test asserts corpus source for Field; fallback check moves to Select.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds corpus/frontend/shadcn/select.yaml with Select contract (base-ui select primitive, sm/md/lg sizes, accessible trigger/value/content/item slots, form pair).
Registers select in namespace index so all 4 shadcn components are now corpus-backed.
Test asserts corpus source for Select; the former fallback assertion is replaced because no un-migrated component remains.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@KailasMahavarkar KailasMahavarkar merged commit 283db9c into main Apr 21, 2026
4 checks passed
@KailasMahavarkar KailasMahavarkar deleted the feat/corpus-shadcn-components branch April 21, 2026 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant