fix(components): do not filter custom components in workspaces named ui/#43
Closed
neilwashere wants to merge 6 commits into
Closed
Conversation
* feat: add customSections to plugin API for first-class plugin output Plugins could previously only return routes, schemas, components, and middleware — they had no way to contribute new types of content to CODESIGHT.md. This meant plugin-generated insights were invisible to agents unless they knew to look for a separate file. Add customSections to PluginDetectorResult and ScanResult so plugins can return arbitrary markdown sections that get rendered into CODESIGHT.md alongside built-in sections, written as individual .md files, and referenced in AI config files (CLAUDE.md, .cursorrules, etc). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: add terraform infrastructure plugin (AWS-focused) Add a plugin that scans Terraform/HCL files and generates infrastructure.md with deployment context for AI agents — where a service runs, what env vars and SSM secrets it receives, whether it's public-facing, what it depends on, and per-environment overrides. Supports two modes: in-project (terraform/ subdir alongside code) and external path (separate infrastructure repo, default ../infrastructure). Uses regex + brace-counting for zero-dependency HCL parsing, following the same approach as the Go extractor. The HCL parser and service matcher are provider-agnostic, but the infrastructure extractor currently targets AWS patterns (ECS, SSM Parameter Store, ALB, Route53, CloudWatch). Azure and GCP extraction would require additional provider-specific logic in the extractor — the parser and matcher layers would not need changes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address PR review comments - formatter.ts: sanitise customSections names to safe basenames and reject collisions with built-in section names - hcl-parser.ts: skip comment stripping inside heredoc bodies to avoid corrupting literal content - extractor.ts: fix IAM statement extraction to read action/actions instead of falling back to effect - package.json: add dist/* wildcard export to preserve deep imports, update test script to run all test files Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address review findings — reserved name bypass, name mismatch, regex safety - Fix reserved name "CODESIGHT" casing mismatch in formatter.ts (was uppercase, safeName is always lowercased so the guard never matched) - Sanitize section names in ai-config.ts to match filenames written by formatter.ts - Move BLOCK_HEADER regex inside function body to prevent shared mutable state under concurrent use - Add string-aware bracket counting in multi-line list parser - Remove dead TF_EXTENSIONS constant - Add informational TODOs for parallel file reads, parseTfvars multiline limitation, and custom section name collision Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Tests dynamically create fixtures via writeFixture() — no need to track them. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Remove duplicate scan() from index.ts (now lives in core.ts since upstream refactor) - Port customSections plugin API into core.ts scan() to preserve the feature - Narrow .gitignore pattern from tests/fixtures/ to only ignore generated .codesight/ output - Restore terraform fixture files deleted by the overly-broad gitignore commit Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The ../infrastructure sibling scan was specific to a particular monorepo layout. The general case is terraform co-located in the project; users with a separate infra repo should set infraPath explicitly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
First release of the emerge fork on top of upstream Houseofmvps/codesight@v1.14.0. Adds customSections plugin API, terraform plugin (with sibling-repo discovery removed), and CI/CD plugin deltas not yet upstreamed in this exact form. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
`isUIPrimitive` had a `filePath.includes("/ui/")` check intended to filter
shadcn primitives. That check is too broad: it matches every file under a
monorepo workspace literally named `ui/` (e.g. `ui/src/components/*.tsx`),
so every custom component in such a repo was wrongly dropped.
The real shadcn case (`components/ui/<primitive>.tsx`) is still caught by
the more specific `/components/ui/` check, and lowercase primitive file
names are still caught by the `UI_PRIMITIVES` set. Vendor path checks
(`@radix-ui`, `@shadcn`) are unchanged.
Repro: morgan monorepo (`packages: shared, server, ui`) reported 0
components. After the fix, 130 components are detected with prop
signatures extracted via AST. Includes a regression test fixture that
asserts a workspace-level `ui/src/components/AppShell.tsx` is detected
while a sibling `ui/src/components/ui/button.tsx` is still filtered.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.
Summary
isUIPrimitiveinsrc/detectors/components.tshad afilePath.includes(\"/ui/\")check intended to filter shadcn primitives. The check is too broad: it matches every file under a monorepo workspace literally named `ui/` (e.g. `ui/src/components/*.tsx`), so every custom component in such a repo is wrongly dropped.The real shadcn case (`components/ui/.tsx`) is still caught by the more specific `/components/ui/` check; lowercase primitive file names are still caught by the `UI_PRIMITIVES` set; vendor path checks (`@radix-ui`, `@shadcn`) are unchanged.
Reproduction
In our internal use we ran `codesight --wiki` against a pnpm workspace where the frontend package is literally named `ui` (the workspace tree is roughly `packages: shared, server, ui`). The scanner correctly identified `react` in the aggregated workspace deps and set `project.componentFramework = "react"`, but `detectComponents` returned an empty array, so the generated wiki reported `0 components` and skipped the `ui.md` article entirely.
After the fix the same repo reports 130 components with prop signatures extracted via AST (component names + props from `AppShell`, `BubbleContextMenu`, `ChatBubble`, etc.), and the `ui.md` article is generated as expected.
Change
One-line removal of the over-broad path check, plus a comment explaining why the bare `/ui/` segment is unsafe.
function isUIPrimitive(filePath: string): boolean { const name = basename(filePath, extname(filePath)).toLowerCase(); return ( UI_PRIMITIVES.has(name) || - filePath.includes(\"/ui/\") || filePath.includes(\"/components/ui/\") || filePath.includes(\"@radix-ui\") || filePath.includes(\"@shadcn\") ); }Test plan
🤖 Generated with Claude Code