Skip to content

v0.8.1 — path-based kindGuess + directory-tree

Choose a tag to compare

@marianif marianif released this 24 May 18:54
· 3 commits to main since this release

Correctness fixes to /design-system scan based on real-world testing.

What was broken

  • EntityCarousel (sitting in components/organisms/) was classified as atom because the structural heuristic only looked at composition + prop count
  • Typed Text wrappers (7+ props but rendering a single RN primitive) were classified as molecule
  • The scanner could only see components in hardcoded default folders (components/, src/components/, app/components/) — components hidden in non-default layouts (atomic-design, feature folders) were invisible

The root cause was the same in all three cases: the scanner ignored stated developer intent encoded in folder placement. Folder kind is the most authoritative signal available; structural inference is a fallback.

What's new

directory-tree.mjs — first script in Act 1. Maps the codebase shape with strict folder-kind recognition:

  • Atomic design (atoms/molecules/organisms/templates/pages) — only when sitting directly under a components/ root or at top-level. Filters out .specify/templates and other false positives.
  • Expo-router app/ and React Navigation screens/
  • Feature folders (features/<name>/components/)
  • Component-per-folder vs flat layouts; barrel exports; test/story colocation; naming convention
  • Unknown folders (shared/, primitives/, etc.) surfaced in needsClarification[] with a reason the agent can quote

component-inventory.mjs upgrades:

  • Reads --tree=path.json (auto-generates if absent)
  • Component roots derived from tree.roots.components — invisible-components problem solved
  • Path-based kindGuess wins; structural heuristic kept as kindStructural fallback
  • Per-entry kindSource, kindConflict, folderKind so disagreement is surfaced rather than hidden
  • missingComponentFolders[] for leaf folders yielding zero components (barrel re-exports, wrapper chains)
  • Structural fallback improvements: atom prop threshold 4 → 6, single-primitive-wrapper escape (renders only RN built-ins → atom regardless of prop count), molecule threshold raised to 7

design-system-scan.mjs orchestrator:

  • Runs directory-tree first, threads its path to all downstream scripts
  • Three new readiness flags:
    • unknown-folders — count of needsClarification entries
    • parser-misses — count of missing-component folders
    • kind-conflicts — count of path-vs-structural disagreements
  • Terminal output now shows a tree row with conventions + inline conflict/missing counts on the components row

Verified

Test case Before After
EntityCarousel in organisms/ with trivial structure atom organism (path), with kindConflict: true for Act 2 review
Typed Text wrapping <RNText> with 7 props molecule atom (path AND structural — wrapper escape)
Barrel-only folder (organisms/EmptyExport/index.ts re-export) silently dropped surfaced in missingComponentFolders
Component in components/atoms/Button/ (default scan didn't find it) invisible found via tree-derived roots
.specify/templates/ directory in skill source repo false-classified as templates-folder filtered (depth + parent check)

84/84 tests pass.

🤖 Generated with Claude Code