@isaacriehm/cairn-core 0.19.0 → 0.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,12 +5,23 @@
5
5
  * 1. Probable inline rebuilds — `className` lists in non-component code
6
6
  * whose Tailwind utility ROOTS closely match an indexed component's
7
7
  * (max-w-2xl ≈ max-w-4xl, so value-tweaked copies still match).
8
+ * Similarity is IDF-weighted over the component corpus: a utility root
9
+ * that nearly every component uses (`flex`, `gap`, `mx`, `px`) carries
10
+ * almost no weight, so a page sharing only generic layout scaffolding
11
+ * does NOT match — only overlap on DISTINCTIVE class roots counts. This
12
+ * is self-tuning to the project's own CSS; no hardcoded utility list.
8
13
  * 2. Name collisions — `@cairn` names colliding with a type/interface name.
14
+ * 3. Unregistered components — a component-shaped file (PascalCase
15
+ * basename, real exports, JSX markup) sitting OUTSIDE the declared
16
+ * component dirs. These are co-located components the registry can't
17
+ * see; route entry files (page.tsx/layout.tsx — lowercase) are
18
+ * naturally excluded, so no framework convention list is hardcoded.
19
+ * Surfaced as an offer to relocate or register the dir — never moved.
9
20
  *
10
21
  * Findings are triage input surfaced to the attention queue with EXTEND /
11
- * rename recommendations; never auto-fixed.
22
+ * rename / register recommendations; never auto-fixed.
12
23
  */
13
- export type ComponentAuditKind = "inline-rebuild" | "name-collision";
24
+ export type ComponentAuditKind = "inline-rebuild" | "name-collision" | "unregistered-component";
14
25
  export interface ComponentAuditFinding {
15
26
  kind: ComponentAuditKind;
16
27
  /** Where the probable violation lives (repo-relative POSIX). */
@@ -5,18 +5,34 @@
5
5
  * 1. Probable inline rebuilds — `className` lists in non-component code
6
6
  * whose Tailwind utility ROOTS closely match an indexed component's
7
7
  * (max-w-2xl ≈ max-w-4xl, so value-tweaked copies still match).
8
+ * Similarity is IDF-weighted over the component corpus: a utility root
9
+ * that nearly every component uses (`flex`, `gap`, `mx`, `px`) carries
10
+ * almost no weight, so a page sharing only generic layout scaffolding
11
+ * does NOT match — only overlap on DISTINCTIVE class roots counts. This
12
+ * is self-tuning to the project's own CSS; no hardcoded utility list.
8
13
  * 2. Name collisions — `@cairn` names colliding with a type/interface name.
14
+ * 3. Unregistered components — a component-shaped file (PascalCase
15
+ * basename, real exports, JSX markup) sitting OUTSIDE the declared
16
+ * component dirs. These are co-located components the registry can't
17
+ * see; route entry files (page.tsx/layout.tsx — lowercase) are
18
+ * naturally excluded, so no framework convention list is hardcoded.
19
+ * Surfaced as an offer to relocate or register the dir — never moved.
9
20
  *
10
21
  * Findings are triage input surfaced to the attention queue with EXTEND /
11
- * rename recommendations; never auto-fixed.
22
+ * rename / register recommendations; never auto-fixed.
12
23
  */
13
24
  import { readFileSync } from "node:fs";
14
25
  import { join } from "node:path";
15
- import { collectComponents, hasComponentConfig, loadComponentsConfig, walkFs, } from "@isaacriehm/cairn-state";
16
- import { jaccard } from "../text/jaccard.js";
26
+ import { collectComponents, extractExportName, extractExportNames, hasComponentConfig, loadComponentsConfig, walkFs, } from "@isaacriehm/cairn-state";
17
27
  const SIMILARITY_THRESHOLD = 0.7;
18
28
  const MIN_SHARED_ROOTS = 3;
19
29
  const MIN_CLASSES = 3;
30
+ /**
31
+ * A shared root only counts toward MIN_SHARED_ROOTS if it is distinctive —
32
+ * idf ≥ ln(2), i.e. the root appears in fewer than ~half of all components.
33
+ * Ubiquitous layout utilities fall below this and never satisfy the gate.
34
+ */
35
+ const IDF_DISTINCTIVE_FLOOR = Math.log(2);
20
36
  const CLASS_ATTR_RE = /className\s*=\s*(?:"([^"]+)"|'([^']+)'|\{`([^`]+)`\})/g;
21
37
  const VALUE_SUFFIX = /-(?:\d[^-]*|xs|sm|md|lg|xl|\dxl|auto|full|none|screen|px)$/;
22
38
  const SKIP_DIRS = new Set([".git", ".cairn", "node_modules", "dist", ".next", "build", "coverage"]);
@@ -43,18 +59,38 @@ function classLists(source) {
43
59
  }
44
60
  return lists;
45
61
  }
46
- function rootSimilarity(a, b) {
47
- const ra = new Set(a.map(utilityRoot));
48
- const rb = new Set(b.map(utilityRoot));
49
- let shared = 0;
50
- for (const r of ra)
51
- if (rb.has(r))
52
- shared += 1;
53
- return { score: jaccard(ra, rb), shared };
62
+ /** Distinct utility roots of a class list. */
63
+ function rootSet(classes) {
64
+ return new Set(classes.map(utilityRoot));
54
65
  }
55
66
  function inComponentDirs(rel, config) {
56
67
  return config.workspaces.some((ws) => ws.componentDirs.some((d) => rel === d || rel.startsWith(`${d}/`)));
57
68
  }
69
+ /** JSX markup signal — a tag or a className attribute. */
70
+ const JSX_RE = /<[A-Za-z][^>]*\/?>|className\s*=/;
71
+ /**
72
+ * If a file outside the component dirs looks like a misplaced COMPONENT
73
+ * (rather than a hook/context/util, or markup duplicated inside
74
+ * non-component code), return its exported names; otherwise null. Three
75
+ * convention-based signals, no framework list:
76
+ * 1. PascalCase basename — named component files are `FeaturedShell.tsx`;
77
+ * framework route entry files are lowercase (`page.tsx`, `layout.tsx`).
78
+ * 2. Exports a PascalCase symbol — a component-like export exists (a file
79
+ * exporting only `useThing` / consts is a hook/util, not a component).
80
+ * 3. Renders JSX — excludes type-only / pure-logic files.
81
+ */
82
+ function misplacedComponentExports(rel, source) {
83
+ const base = rel.slice(rel.lastIndexOf("/") + 1);
84
+ const stem = base.includes(".") ? base.slice(0, base.indexOf(".")) : base;
85
+ if (!/^[A-Z][a-z]/.test(stem))
86
+ return null;
87
+ const names = extractExportNames(source);
88
+ if (!names.some((n) => /^[A-Z][a-z]/.test(n)))
89
+ return null;
90
+ if (!JSX_RE.test(source))
91
+ return null;
92
+ return names;
93
+ }
58
94
  export function runComponentAudit(repoRoot) {
59
95
  const config = loadComponentsConfig(repoRoot);
60
96
  if (!hasComponentConfig(config))
@@ -66,6 +102,7 @@ export function runComponentAudit(repoRoot) {
66
102
  const findings = [];
67
103
  let scanned = 0;
68
104
  // ── 1. Inline-rebuild scan ────────────────────────────────────────────
105
+ // Each component's className lists, with utility roots precomputed.
69
106
  const signatures = components
70
107
  .map((c) => {
71
108
  let src = "";
@@ -75,9 +112,48 @@ export function runComponentAudit(repoRoot) {
75
112
  catch {
76
113
  /* skip unreadable */
77
114
  }
78
- return { name: c.tags.cairn ?? "?", file: c.file, lists: classLists(src) };
115
+ const lists = classLists(src).map((l) => ({
116
+ line: l.line,
117
+ roots: rootSet(l.classes),
118
+ }));
119
+ return { name: c.tags.cairn ?? "?", file: c.file, lists };
79
120
  })
80
121
  .filter((c) => c.lists.length > 0);
122
+ // Corpus IDF: how distinctive each utility root is. A root present in many
123
+ // components (df → N) gets idf → 0; a rare root gets a high weight. Document
124
+ // = one component (union of its lists' roots), so repetition within a file
125
+ // doesn't inflate frequency.
126
+ const corpusN = signatures.length;
127
+ const docFreq = new Map();
128
+ for (const c of signatures) {
129
+ const compRoots = new Set();
130
+ for (const l of c.lists)
131
+ for (const r of l.roots)
132
+ compRoots.add(r);
133
+ for (const r of compRoots)
134
+ docFreq.set(r, (docFreq.get(r) ?? 0) + 1);
135
+ }
136
+ const idf = (root) => Math.log((corpusN + 1) / ((docFreq.get(root) ?? 0) + 1));
137
+ // IDF-weighted Jaccard between two root sets, plus the count of shared
138
+ // DISTINCTIVE roots (ubiquitous roots don't count toward the gate).
139
+ const weightedSimilarity = (target, comp) => {
140
+ let inter = 0;
141
+ let union = 0;
142
+ let shared = 0;
143
+ for (const r of target) {
144
+ const w = idf(r);
145
+ union += w;
146
+ if (comp.has(r)) {
147
+ inter += w;
148
+ if (w >= IDF_DISTINCTIVE_FLOOR)
149
+ shared += 1;
150
+ }
151
+ }
152
+ for (const r of comp)
153
+ if (!target.has(r))
154
+ union += idf(r);
155
+ return { score: union > 0 ? inter / union : 0, shared };
156
+ };
81
157
  // ── 2. Name-collision prep ────────────────────────────────────────────
82
158
  const nameToComponent = new Map();
83
159
  for (const c of components)
@@ -105,14 +181,35 @@ export function runComponentAudit(repoRoot) {
105
181
  scanned += 1;
106
182
  // Inline rebuild — only in non-component code with a UI extension.
107
183
  if (extensions.has(ext) && !inComponentDirs(rel, config)) {
184
+ // A component-shaped file outside the component dirs is not a
185
+ // rebuild — it is a co-located component the registry can't see.
186
+ // Surface it (with its export names + file) as an offer to
187
+ // relocate/register; skip the rebuild scan for it.
188
+ const exports = misplacedComponentExports(rel, source);
189
+ if (exports !== null) {
190
+ const primary = extractExportName(source) ?? exports[0];
191
+ const others = exports.filter((n) => n !== primary);
192
+ const dirs = config.workspaces.flatMap((w) => w.componentDirs).join(", ");
193
+ findings.push({
194
+ kind: "unregistered-component",
195
+ file: rel,
196
+ component: primary,
197
+ componentFile: rel,
198
+ message: `${primary} (${rel})${others.length > 0 ? ` — also exports ${others.join(", ")}` : ""} ` +
199
+ `looks like a component but lives outside the declared component dir(s) (${dirs}); the registry can't see it`,
200
+ recommendation: `move ${rel} into a component dir, or add its directory to the workspace's componentDirs — then header + index ${primary}`,
201
+ });
202
+ return;
203
+ }
108
204
  for (const target of classLists(source)) {
205
+ const troots = rootSet(target.classes);
109
206
  let best = null;
110
207
  for (const comp of signatures) {
111
208
  for (const list of comp.lists) {
112
- const { score, shared } = rootSimilarity(target.classes, list.classes);
209
+ const { score, shared } = weightedSimilarity(troots, list.roots);
113
210
  if (score >= SIMILARITY_THRESHOLD && shared >= MIN_SHARED_ROOTS) {
114
211
  if (best === null || score > best.score) {
115
- best = { name: comp.name, file: comp.file, classes: list.classes, score };
212
+ best = { name: comp.name, file: comp.file, score };
116
213
  }
117
214
  }
118
215
  }
@@ -1 +1 @@
1
- {"version":3,"file":"audit.js","sourceRoot":"","sources":["../../src/components/audit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,MAAM,GAGP,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,MAAM,oB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,IAAI,IAAI,CAAC,IAAI,KAAK,GAAG;oBAAE,SAAS;gBAChC,MAAM,EAAE,GAAG,IAAI,MAAM,CAAC,4BAA4B,IAAI,KAAK,CAAC,CAAC;gBAC7D,IAAI,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;oBACpB,QAAQ,CAAC,IAAI,CAAC;wBACZ,IAAI,EAAE,gBAAgB;wBACtB,IAAI,EAAE,GAAG;wBACT,SAAS,EAAE,IAAI;wBACf,aAAa,EAAE,IAAI,CAAC,IAAI;wBACxB,OAAO,EAAE,WAAW,IAAI,MAAM,IAAI,CAAC,IAAI,uCAAuC,GAAG,EAAE;wBACnF,cAAc,EAAE,wCAAwC;qBACzD,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;QACH,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;AAC/B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@isaacriehm/cairn-core",
3
- "version": "0.19.0",
3
+ "version": "0.19.1",
4
4
  "description": "Cairn core — state + context layer. Curated `.cairn/ground/` (decisions, §INV invariants, canonical-map, brand, quality-grades), MCP server, init wizard, hook runners, sensors, GC drift sweep.",
5
5
  "author": "Isaac Riehm",
6
6
  "license": "MIT",
@@ -39,7 +39,7 @@
39
39
  "simple-git": "^3.36.0",
40
40
  "yaml": "^2.9.0",
41
41
  "zod": "^4.4.3",
42
- "@isaacriehm/cairn-state": "0.19.0"
42
+ "@isaacriehm/cairn-state": "0.19.1"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/cli-progress": "^3.11.6",