@isaacriehm/cairn-state 0.22.5
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.
- package/LICENSE +21 -0
- package/README.md +11 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/alignment-pending.d.ts +28 -0
- package/dist/alignment-pending.js +83 -0
- package/dist/alignment-pending.js.map +1 -0
- package/dist/anchor-map.d.ts +14 -0
- package/dist/anchor-map.js +56 -0
- package/dist/anchor-map.js.map +1 -0
- package/dist/archive.d.ts +48 -0
- package/dist/archive.js +96 -0
- package/dist/archive.js.map +1 -0
- package/dist/cache.d.ts +48 -0
- package/dist/cache.js +241 -0
- package/dist/cache.js.map +1 -0
- package/dist/component-registry.d.ts +93 -0
- package/dist/component-registry.js +0 -0
- package/dist/component-registry.js.map +1 -0
- package/dist/components.d.ts +192 -0
- package/dist/components.js +603 -0
- package/dist/components.js.map +1 -0
- package/dist/config.d.ts +9 -0
- package/dist/config.js +26 -0
- package/dist/config.js.map +1 -0
- package/dist/drift.d.ts +8 -0
- package/dist/drift.js +23 -0
- package/dist/drift.js.map +1 -0
- package/dist/file-candidates-map.d.ts +23 -0
- package/dist/file-candidates-map.js +76 -0
- package/dist/file-candidates-map.js.map +1 -0
- package/dist/frontmatter.d.ts +32 -0
- package/dist/frontmatter.js +77 -0
- package/dist/frontmatter.js.map +1 -0
- package/dist/fs.d.ts +36 -0
- package/dist/fs.js +47 -0
- package/dist/fs.js.map +1 -0
- package/dist/glob.d.ts +10 -0
- package/dist/glob.js +46 -0
- package/dist/glob.js.map +1 -0
- package/dist/home.d.ts +69 -0
- package/dist/home.js +168 -0
- package/dist/home.js.map +1 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -0
- package/dist/languages.d.ts +113 -0
- package/dist/languages.js +512 -0
- package/dist/languages.js.map +1 -0
- package/dist/ledgers.d.ts +14 -0
- package/dist/ledgers.js +105 -0
- package/dist/ledgers.js.map +1 -0
- package/dist/logger.d.ts +13 -0
- package/dist/logger.js +17 -0
- package/dist/logger.js.map +1 -0
- package/dist/manifest.d.ts +10 -0
- package/dist/manifest.js +84 -0
- package/dist/manifest.js.map +1 -0
- package/dist/missions.d.ts +119 -0
- package/dist/missions.js +414 -0
- package/dist/missions.js.map +1 -0
- package/dist/paths.d.ts +117 -0
- package/dist/paths.js +241 -0
- package/dist/paths.js.map +1 -0
- package/dist/quality-grades.d.ts +11 -0
- package/dist/quality-grades.js +100 -0
- package/dist/quality-grades.js.map +1 -0
- package/dist/rejected.d.ts +42 -0
- package/dist/rejected.js +100 -0
- package/dist/rejected.js.map +1 -0
- package/dist/schemas.d.ts +789 -0
- package/dist/schemas.js +506 -0
- package/dist/schemas.js.map +1 -0
- package/dist/scope-index.d.ts +96 -0
- package/dist/scope-index.js +299 -0
- package/dist/scope-index.js.map +1 -0
- package/dist/slug.d.ts +81 -0
- package/dist/slug.js +138 -0
- package/dist/slug.js.map +1 -0
- package/dist/sot-bindings.d.ts +14 -0
- package/dist/sot-bindings.js +79 -0
- package/dist/sot-bindings.js.map +1 -0
- package/dist/sot-cache.d.ts +18 -0
- package/dist/sot-cache.js +62 -0
- package/dist/sot-cache.js.map +1 -0
- package/dist/text.d.ts +27 -0
- package/dist/text.js +63 -0
- package/dist/text.js.map +1 -0
- package/dist/topic-index.d.ts +27 -0
- package/dist/topic-index.js +82 -0
- package/dist/topic-index.js.map +1 -0
- package/dist/walk.d.ts +7 -0
- package/dist/walk.js +34 -0
- package/dist/walk.js.map +1 -0
- package/package.json +35 -0
|
@@ -0,0 +1,603 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Component registry — Cairn's fourth ground store.
|
|
3
|
+
*
|
|
4
|
+
* Headers in source (`@cairn <ExportName>` comments) are the committed
|
|
5
|
+
* source of truth; `.cairn/ground/components/` holds the *derived* index the
|
|
6
|
+
* agent reads in full before UI work. This module is the pure state layer:
|
|
7
|
+
* config loading, header parsing, repo walking, deterministic index
|
|
8
|
+
* rendering, and validation. Disk writes, the advisory audit, MCP tools, and
|
|
9
|
+
* adoption phases live in cairn-core.
|
|
10
|
+
*
|
|
11
|
+
* The registry header is recognized in EVERY comment form (language-agnostic):
|
|
12
|
+
* block `/* */` / JSDoc, `//` line runs, `#` hash runs, `<!-- -->` (Vue /
|
|
13
|
+
* Svelte / Razor / HTML), `--` (Lua / SQL), and Python `"""` docstrings. The
|
|
14
|
+
* earliest comment carrying the `@cairn <Name>` signal wins. Export extraction
|
|
15
|
+
* and unit-shape detection are routed through the shared `languages.ts`
|
|
16
|
+
* profile table, so a Python `def`, a Go capitalized ident, a SwiftUI `View`,
|
|
17
|
+
* or a Vue SFC are all first-class — there is no JS/React default.
|
|
18
|
+
*
|
|
19
|
+
* The `@cairn <Name>` registry header is disjoint from the pre-existing
|
|
20
|
+
* `@cairn:decision` / `@cairn:rule` SoT markers: the header detector requires
|
|
21
|
+
* whitespace then an identifier start, so a colon-form marker can never be
|
|
22
|
+
* misread as a header.
|
|
23
|
+
*/
|
|
24
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
25
|
+
import { extname, join } from "node:path";
|
|
26
|
+
import { z } from "zod";
|
|
27
|
+
import { parse as parseYaml } from "yaml";
|
|
28
|
+
import { cairnDir, isGhost } from "./home.js";
|
|
29
|
+
import { lookupComponentEntry, readComponentRegistry, } from "./component-registry.js";
|
|
30
|
+
import { walkFs } from "./fs.js";
|
|
31
|
+
import { escapeRegExp, splitCsv, HEADER_SIGNAL_RE } from "./text.js";
|
|
32
|
+
import { extractExportName, extractExportNames, profileForFile, UI_EXTENSIONS, } from "./languages.js";
|
|
33
|
+
/* -------------------------------------------------------------------------- */
|
|
34
|
+
/* Defaults — overridable per project in config.yaml. */
|
|
35
|
+
/* -------------------------------------------------------------------------- */
|
|
36
|
+
export const DEFAULT_CATEGORIES = [
|
|
37
|
+
"layout",
|
|
38
|
+
"navigation",
|
|
39
|
+
"data-display",
|
|
40
|
+
"forms",
|
|
41
|
+
"feedback",
|
|
42
|
+
"overlay",
|
|
43
|
+
"media",
|
|
44
|
+
"marketing",
|
|
45
|
+
"utility",
|
|
46
|
+
];
|
|
47
|
+
// The fallback when a config omits `extensions` — every UI file type (web +
|
|
48
|
+
// native), NOT a silent React default. The LLM detector normally writes a
|
|
49
|
+
// precise list; this only fires for hand-written configs that omit it.
|
|
50
|
+
export const DEFAULT_EXTENSIONS = UI_EXTENSIONS;
|
|
51
|
+
export const DEFAULT_EXCLUDE = [
|
|
52
|
+
"node_modules",
|
|
53
|
+
"dist",
|
|
54
|
+
".next",
|
|
55
|
+
"build",
|
|
56
|
+
"coverage",
|
|
57
|
+
"__tests__",
|
|
58
|
+
"__mocks__",
|
|
59
|
+
"stories",
|
|
60
|
+
];
|
|
61
|
+
/** Tags a header MUST carry. */
|
|
62
|
+
export const COMPONENT_REQUIRED_TAGS = ["cairn", "category", "purpose", "aliases"];
|
|
63
|
+
/* -------------------------------------------------------------------------- */
|
|
64
|
+
/* Config — the `components:` section of .cairn/config.yaml */
|
|
65
|
+
/* -------------------------------------------------------------------------- */
|
|
66
|
+
export const ComponentsWorkspaceConfig = z
|
|
67
|
+
.object({
|
|
68
|
+
componentDirs: z.array(z.string()).default([]),
|
|
69
|
+
extensions: z.array(z.string()).optional(),
|
|
70
|
+
categories: z.array(z.string()).optional(),
|
|
71
|
+
exclude: z.array(z.string()).optional(),
|
|
72
|
+
shared: z.boolean().optional(),
|
|
73
|
+
})
|
|
74
|
+
.passthrough();
|
|
75
|
+
export const ComponentsConfig = z
|
|
76
|
+
.object({
|
|
77
|
+
componentDirs: z.array(z.string()).optional(),
|
|
78
|
+
extensions: z.array(z.string()).optional(),
|
|
79
|
+
categories: z.array(z.string()).optional(),
|
|
80
|
+
exclude: z.array(z.string()).optional(),
|
|
81
|
+
workspaces: z.record(z.string(), ComponentsWorkspaceConfig).optional(),
|
|
82
|
+
})
|
|
83
|
+
.passthrough();
|
|
84
|
+
/**
|
|
85
|
+
* Fold the raw `components:` config into a normalized workspace list.
|
|
86
|
+
* Flat (single-app) config becomes one unnamed workspace; a `workspaces`
|
|
87
|
+
* map becomes one entry per key, each inheriting the top-level
|
|
88
|
+
* exclude/extensions/categories unless it overrides them.
|
|
89
|
+
*/
|
|
90
|
+
export function normalizeComponentsConfig(raw) {
|
|
91
|
+
const base = {
|
|
92
|
+
exclude: raw.exclude ?? [...DEFAULT_EXCLUDE],
|
|
93
|
+
extensions: raw.extensions ?? [...DEFAULT_EXTENSIONS],
|
|
94
|
+
categories: raw.categories ?? [...DEFAULT_CATEGORIES],
|
|
95
|
+
};
|
|
96
|
+
if (raw.workspaces && Object.keys(raw.workspaces).length > 0) {
|
|
97
|
+
return {
|
|
98
|
+
workspaces: Object.entries(raw.workspaces).map(([name, ws]) => ({
|
|
99
|
+
name,
|
|
100
|
+
componentDirs: ws.componentDirs ?? [],
|
|
101
|
+
exclude: ws.exclude ?? base.exclude,
|
|
102
|
+
extensions: ws.extensions ?? base.extensions,
|
|
103
|
+
categories: ws.categories ?? base.categories,
|
|
104
|
+
// Isolation policy: a workspace is ISOLATED unless explicitly shared.
|
|
105
|
+
shared: ws.shared === true,
|
|
106
|
+
})),
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
return {
|
|
110
|
+
workspaces: [
|
|
111
|
+
{
|
|
112
|
+
name: "",
|
|
113
|
+
componentDirs: raw.componentDirs ?? [],
|
|
114
|
+
...base,
|
|
115
|
+
shared: false,
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
/** Read + normalize the `components:` config from `.cairn/config.yaml`. */
|
|
121
|
+
export function loadComponentsConfig(repoRoot) {
|
|
122
|
+
const p = cairnDir(repoRoot, "config.yaml");
|
|
123
|
+
let rawDoc = {};
|
|
124
|
+
if (existsSync(p)) {
|
|
125
|
+
try {
|
|
126
|
+
rawDoc = parseYaml(readFileSync(p, "utf8"));
|
|
127
|
+
}
|
|
128
|
+
catch {
|
|
129
|
+
rawDoc = {};
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
const comp = typeof rawDoc === "object" && rawDoc !== null
|
|
133
|
+
? rawDoc["components"]
|
|
134
|
+
: undefined;
|
|
135
|
+
const parsed = ComponentsConfig.safeParse(comp ?? {});
|
|
136
|
+
return normalizeComponentsConfig(parsed.success ? parsed.data : {});
|
|
137
|
+
}
|
|
138
|
+
/** True when any workspace declares at least one component dir. */
|
|
139
|
+
export function hasComponentConfig(config) {
|
|
140
|
+
return config.workspaces.some((ws) => ws.componentDirs.length > 0);
|
|
141
|
+
}
|
|
142
|
+
/** True for monorepo configs (more than one workspace). */
|
|
143
|
+
export function isMonorepoComponents(config) {
|
|
144
|
+
return config.workspaces.length > 1;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* True when a raw comment block is a `@cairn` registry header. Exported so
|
|
148
|
+
* the source-comment + curator walkers can exclude headers from candidate
|
|
149
|
+
* registration (headers must not pollute the topic index or be stripped).
|
|
150
|
+
*/
|
|
151
|
+
export function isComponentHeaderBlock(rawBlockText) {
|
|
152
|
+
return HEADER_SIGNAL_RE.test(rawBlockText);
|
|
153
|
+
}
|
|
154
|
+
function parseTagLines(lines) {
|
|
155
|
+
const tags = {};
|
|
156
|
+
for (const line of lines) {
|
|
157
|
+
const m = line.match(/@([a-zA-Z]+)\b(?:[ \t]+(.*))?/);
|
|
158
|
+
if (m) {
|
|
159
|
+
const value = (m[2] ?? "").trim();
|
|
160
|
+
tags[m[1].toLowerCase()] = value.length > 0 ? value : "true";
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return tags;
|
|
164
|
+
}
|
|
165
|
+
/** Delimited comment forms: block / JSDoc, `<!-- -->`, and `""" """` docstrings. */
|
|
166
|
+
const DELIMITED_COMMENT_RES = [
|
|
167
|
+
/\/\*+[\s\S]*?\*\//g, // block + JSDoc
|
|
168
|
+
/<!--[\s\S]*?-->/g, // html / Vue / Svelte / Razor
|
|
169
|
+
/(?:"""|''')[\s\S]*?(?:"""|''')/g, // python docstring
|
|
170
|
+
];
|
|
171
|
+
/** Single-line comment markers whose contiguous runs form a header block. */
|
|
172
|
+
const LINE_COMMENT_MARKERS = ["//", "#", "--"];
|
|
173
|
+
/** Contiguous runs of lines that (ignoring indent) start with `marker`. */
|
|
174
|
+
function lineRuns(source, marker) {
|
|
175
|
+
const out = [];
|
|
176
|
+
const lines = source.split("\n");
|
|
177
|
+
const offsets = [];
|
|
178
|
+
let o = 0;
|
|
179
|
+
for (const ln of lines) {
|
|
180
|
+
offsets.push(o);
|
|
181
|
+
o += ln.length + 1;
|
|
182
|
+
}
|
|
183
|
+
let i = 0;
|
|
184
|
+
while (i < lines.length) {
|
|
185
|
+
if ((lines[i] ?? "").trimStart().startsWith(marker)) {
|
|
186
|
+
let j = i;
|
|
187
|
+
const buf = [];
|
|
188
|
+
while (j < lines.length && (lines[j] ?? "").trimStart().startsWith(marker)) {
|
|
189
|
+
buf.push(lines[j] ?? "");
|
|
190
|
+
j++;
|
|
191
|
+
}
|
|
192
|
+
out.push({ index: offsets[i], raw: buf.join("\n") });
|
|
193
|
+
i = j;
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
i++;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return out;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Parse a file's component header into a tag map, or null if absent. The
|
|
203
|
+
* header is the EARLIEST comment — in any supported form — that carries the
|
|
204
|
+
* `@cairn <Name>` signal. The per-line tag finder is tolerant of leading
|
|
205
|
+
* markers (`*`, `//`, `#`, `--`), so raw comment text parses directly.
|
|
206
|
+
*/
|
|
207
|
+
export function parseComponentHeader(source) {
|
|
208
|
+
const candidates = [];
|
|
209
|
+
for (const re of DELIMITED_COMMENT_RES) {
|
|
210
|
+
for (const m of source.matchAll(re)) {
|
|
211
|
+
candidates.push({ index: m.index ?? 0, raw: m[0] });
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
for (const marker of LINE_COMMENT_MARKERS) {
|
|
215
|
+
candidates.push(...lineRuns(source, marker));
|
|
216
|
+
}
|
|
217
|
+
candidates.sort((a, b) => a.index - b.index);
|
|
218
|
+
for (const c of candidates) {
|
|
219
|
+
if (HEADER_SIGNAL_RE.test(c.raw))
|
|
220
|
+
return parseTagLines(c.raw.split("\n"));
|
|
221
|
+
}
|
|
222
|
+
return null;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Project a headerless registry entry into the same `ComponentTags` shape the
|
|
226
|
+
* in-file `@cairn` header parses to, so everything downstream of
|
|
227
|
+
* `collectComponents` (index render, validation, ledger, in-scope, get) is
|
|
228
|
+
* byte-for-byte mode-agnostic.
|
|
229
|
+
*/
|
|
230
|
+
function entryToTags(entry) {
|
|
231
|
+
const tags = {
|
|
232
|
+
cairn: entry.name,
|
|
233
|
+
category: entry.category,
|
|
234
|
+
purpose: entry.purpose,
|
|
235
|
+
aliases: entry.aliases.join(", "),
|
|
236
|
+
};
|
|
237
|
+
if (entry.uses.length > 0)
|
|
238
|
+
tags.uses = entry.uses.join(", ");
|
|
239
|
+
if (entry.singleton === true)
|
|
240
|
+
tags.singleton = "true";
|
|
241
|
+
if (entry.status)
|
|
242
|
+
tags.status = entry.status;
|
|
243
|
+
return tags;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Walk every workspace's component dirs and parse headers. Returns the
|
|
247
|
+
* parsed components plus the files that are missing a header. Output is
|
|
248
|
+
* deterministically sorted (workspace, then component name).
|
|
249
|
+
*/
|
|
250
|
+
export function collectComponents(repoRoot, config) {
|
|
251
|
+
const components = [];
|
|
252
|
+
const missing = [];
|
|
253
|
+
const seen = new Set();
|
|
254
|
+
// Mode-aware tag source (§3.8.1). Committed: the in-file `@cairn` header is
|
|
255
|
+
// the SoT (`parseComponentHeader`). Ghost: the out-of-repo registry, keyed
|
|
256
|
+
// (workspace, file, export) — source is never read for tags. The
|
|
257
|
+
// `ComponentRecord` shape is identical either way, so nothing downstream
|
|
258
|
+
// branches.
|
|
259
|
+
const ghost = isGhost(repoRoot);
|
|
260
|
+
const registry = ghost ? readComponentRegistry(repoRoot) : null;
|
|
261
|
+
for (const ws of config.workspaces) {
|
|
262
|
+
const skipDirs = new Set(ws.exclude);
|
|
263
|
+
const exts = new Set(ws.extensions);
|
|
264
|
+
for (const dir of ws.componentDirs) {
|
|
265
|
+
const absDir = join(repoRoot, dir);
|
|
266
|
+
if (!existsSync(absDir))
|
|
267
|
+
continue;
|
|
268
|
+
walkFs({
|
|
269
|
+
dir: absDir,
|
|
270
|
+
repoRoot,
|
|
271
|
+
skipDirs,
|
|
272
|
+
onFile: (rel, abs) => {
|
|
273
|
+
if (!exts.has(extname(abs)))
|
|
274
|
+
return;
|
|
275
|
+
if (seen.has(`${ws.name} ${rel}`))
|
|
276
|
+
return;
|
|
277
|
+
seen.add(`${ws.name} ${rel}`);
|
|
278
|
+
let source;
|
|
279
|
+
try {
|
|
280
|
+
source = readFileSync(abs, "utf8");
|
|
281
|
+
}
|
|
282
|
+
catch {
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
const exportNames = extractExportNames(source, rel);
|
|
286
|
+
const tags = ghost && registry !== null
|
|
287
|
+
? ((entry) => (entry === null ? null : entryToTags(entry)))(lookupComponentEntry(registry, ws.name, rel, exportNames))
|
|
288
|
+
: parseComponentHeader(source);
|
|
289
|
+
if (tags === null) {
|
|
290
|
+
// Only a unit-shaped file (a real component/widget/view) is
|
|
291
|
+
// "missing". Committed: no `@cairn` header. Ghost: not in the
|
|
292
|
+
// registry (an *unregistered unit*). Non-unit files co-located in a
|
|
293
|
+
// component dir — route/entry files like page.tsx / layout.tsx
|
|
294
|
+
// (lowercase, not unit-shaped) — are skipped, so a mixed dir (e.g.
|
|
295
|
+
// app/) can be added to componentDirs without flooding the gate.
|
|
296
|
+
if (profileForFile(rel)?.isUnitShaped(source, rel))
|
|
297
|
+
missing.push(rel);
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
components.push({
|
|
301
|
+
file: rel,
|
|
302
|
+
workspace: ws.name,
|
|
303
|
+
tags,
|
|
304
|
+
exportName: extractExportName(source, rel),
|
|
305
|
+
exportNames,
|
|
306
|
+
});
|
|
307
|
+
},
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
components.sort((a, b) => (a.workspace || "").localeCompare(b.workspace || "") ||
|
|
312
|
+
(a.tags.cairn || "").localeCompare(b.tags.cairn || ""));
|
|
313
|
+
missing.sort();
|
|
314
|
+
return { components, missing, ghost };
|
|
315
|
+
}
|
|
316
|
+
/* -------------------------------------------------------------------------- */
|
|
317
|
+
/* Index rendering — deterministic, sorted, no timestamps */
|
|
318
|
+
/* -------------------------------------------------------------------------- */
|
|
319
|
+
const GENERATED_NOTE = "<!-- GENERATED — do not edit. Rebuild: `cairn components index`. Source of truth is the @cairn headers in code. -->";
|
|
320
|
+
const FORMAT_LEGEND = [
|
|
321
|
+
"Line format: `Name [S]? | aliases | purpose` — file is `<dir heading>/<Name>.<ext>` unless `file:` says otherwise.",
|
|
322
|
+
"`[S]` = singleton: exists exactly once by project decision — extend in place, NEVER fork or rebuild.",
|
|
323
|
+
];
|
|
324
|
+
/** Filesystem-safe slice slug for a workspace name. */
|
|
325
|
+
export function sliceSlug(name) {
|
|
326
|
+
return name.replace(/[^a-zA-Z0-9_-]+/g, "-");
|
|
327
|
+
}
|
|
328
|
+
/** Relative path (under the components ground dir) of a workspace slice. */
|
|
329
|
+
export function sliceRelPath(name) {
|
|
330
|
+
return `index/${sliceSlug(name)}.md`;
|
|
331
|
+
}
|
|
332
|
+
function renderGroup(lines, components, categories, extensions, depth) {
|
|
333
|
+
const extRe = new RegExp(`(${extensions.map(escapeRegExp).join("|")})$`);
|
|
334
|
+
const byCat = new Map();
|
|
335
|
+
for (const c of components) {
|
|
336
|
+
const cat = c.tags.category || "uncategorized";
|
|
337
|
+
if (!byCat.has(cat))
|
|
338
|
+
byCat.set(cat, []);
|
|
339
|
+
byCat.get(cat).push(c);
|
|
340
|
+
}
|
|
341
|
+
const order = [
|
|
342
|
+
...categories,
|
|
343
|
+
...[...byCat.keys()].filter((k) => !categories.includes(k)).sort(),
|
|
344
|
+
];
|
|
345
|
+
for (const cat of order) {
|
|
346
|
+
const list = byCat.get(cat);
|
|
347
|
+
if (!list || list.length === 0)
|
|
348
|
+
continue;
|
|
349
|
+
lines.push("", `${"#".repeat(depth)} ${cat}`);
|
|
350
|
+
const byDir = new Map();
|
|
351
|
+
for (const c of list) {
|
|
352
|
+
const dir = c.file.includes("/")
|
|
353
|
+
? c.file.slice(0, c.file.lastIndexOf("/"))
|
|
354
|
+
: ".";
|
|
355
|
+
if (!byDir.has(dir))
|
|
356
|
+
byDir.set(dir, []);
|
|
357
|
+
byDir.get(dir).push(c);
|
|
358
|
+
}
|
|
359
|
+
for (const dir of [...byDir.keys()].sort()) {
|
|
360
|
+
lines.push(`${"#".repeat(depth + 1)} ${dir}/`);
|
|
361
|
+
for (const c of byDir.get(dir)) {
|
|
362
|
+
const t = c.tags;
|
|
363
|
+
const s = t.singleton ? " [S]" : "";
|
|
364
|
+
const base = c.file.slice(c.file.lastIndexOf("/") + 1);
|
|
365
|
+
const stem = base.replace(extRe, "");
|
|
366
|
+
const fileNote = stem === t.cairn ? "" : ` | file: ${base}`;
|
|
367
|
+
lines.push(`${t.cairn || "?"}${s} | ${t.aliases || ""} | ${t.purpose || ""}${fileNote}`);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
function renderSingle(components, ws) {
|
|
373
|
+
const lines = [
|
|
374
|
+
"# Cairn Components — Index",
|
|
375
|
+
"",
|
|
376
|
+
GENERATED_NOTE,
|
|
377
|
+
"Read this entire file before any UI work — it is the complete component inventory.",
|
|
378
|
+
...FORMAT_LEGEND,
|
|
379
|
+
];
|
|
380
|
+
renderGroup(lines, components, ws.categories, ws.extensions, 2);
|
|
381
|
+
return `${lines.join("\n")}\n`;
|
|
382
|
+
}
|
|
383
|
+
function renderManifest(components, config) {
|
|
384
|
+
const hasShared = config.workspaces.some((w) => w.shared);
|
|
385
|
+
const lines = [
|
|
386
|
+
"# Cairn Components — Manifest",
|
|
387
|
+
"",
|
|
388
|
+
GENERATED_NOTE,
|
|
389
|
+
"This is a MANIFEST, not the inventory. Resolve your workspace from the file paths you are touching",
|
|
390
|
+
"(longest prefix match below), then read ONLY that workspace slice — it contains everything you may use.",
|
|
391
|
+
"Do NOT read other slices unless the task explicitly spans multiple workspaces.",
|
|
392
|
+
hasShared
|
|
393
|
+
? "Sharing policy: `[shared]` workspace components are included in every slice and usable everywhere. All other workspaces are ISOLATED."
|
|
394
|
+
: "Sharing policy: ALL workspaces are ISOLATED — never import, copy, or adapt a component from another workspace.",
|
|
395
|
+
"",
|
|
396
|
+
"| Workspace | Paths | Slice | Components |",
|
|
397
|
+
"| --- | --- | --- | --- |",
|
|
398
|
+
];
|
|
399
|
+
for (const ws of config.workspaces) {
|
|
400
|
+
const count = components.filter((c) => c.workspace === ws.name).length;
|
|
401
|
+
lines.push(`| ${ws.name}${ws.shared ? " [shared]" : ""} | ${ws.componentDirs.join(", ")} | ${sliceRelPath(ws.name)} | ${count} |`);
|
|
402
|
+
}
|
|
403
|
+
return `${lines.join("\n")}\n`;
|
|
404
|
+
}
|
|
405
|
+
function renderSlice(ws, components, config) {
|
|
406
|
+
const own = components.filter((c) => c.workspace === ws.name);
|
|
407
|
+
const sharedOthers = config.workspaces.filter((w) => w.shared && w.name !== ws.name);
|
|
408
|
+
const isolatedOthers = config.workspaces
|
|
409
|
+
.filter((w) => !w.shared && w.name !== ws.name)
|
|
410
|
+
.map((w) => w.name);
|
|
411
|
+
const lines = [
|
|
412
|
+
`# Cairn Components — workspace: ${ws.name}${ws.shared ? " [shared]" : ""}`,
|
|
413
|
+
"",
|
|
414
|
+
GENERATED_NOTE,
|
|
415
|
+
"Read this entire file before any UI work in this workspace — it is the complete inventory you are allowed to use.",
|
|
416
|
+
...FORMAT_LEGEND,
|
|
417
|
+
];
|
|
418
|
+
if (isolatedOthers.length > 0) {
|
|
419
|
+
lines.push(`OFF-LIMITS workspaces (isolated — never import, copy, or adapt their components): ${isolatedOthers.join(", ")}.`);
|
|
420
|
+
}
|
|
421
|
+
renderGroup(lines, own, ws.categories, ws.extensions, 2);
|
|
422
|
+
for (const sw of sharedOthers) {
|
|
423
|
+
const swComponents = components.filter((c) => c.workspace === sw.name);
|
|
424
|
+
if (swComponents.length === 0)
|
|
425
|
+
continue;
|
|
426
|
+
lines.push("", `## shared workspace: ${sw.name} — usable from here`);
|
|
427
|
+
renderGroup(lines, swComponents, sw.categories, sw.extensions, 3);
|
|
428
|
+
}
|
|
429
|
+
return `${lines.join("\n")}\n`;
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* Render every index artifact as a Map of relative path (under
|
|
433
|
+
* `.cairn/ground/components/`) → content. Single workspace: one flat
|
|
434
|
+
* INDEX.md. Monorepo: INDEX.md manifest + index/<ws>.md slices — never an
|
|
435
|
+
* all-workspace inventory file (the honeypot invariant).
|
|
436
|
+
*/
|
|
437
|
+
export function renderComponentsIndex(components, config) {
|
|
438
|
+
const files = new Map();
|
|
439
|
+
if (config.workspaces.length <= 1) {
|
|
440
|
+
files.set("INDEX.md", renderSingle(components, config.workspaces[0]));
|
|
441
|
+
return files;
|
|
442
|
+
}
|
|
443
|
+
files.set("INDEX.md", renderManifest(components, config));
|
|
444
|
+
for (const ws of config.workspaces) {
|
|
445
|
+
files.set(sliceRelPath(ws.name), renderSlice(ws, components, config));
|
|
446
|
+
}
|
|
447
|
+
return files;
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* Validate headers across all workspaces. Name uniqueness is scoped per
|
|
451
|
+
* workspace — platform/Button and site/Button may coexist. Hard findings are
|
|
452
|
+
* gate failures; soft findings are warnings.
|
|
453
|
+
*
|
|
454
|
+
* `@aliases` overlap is NOT a finding: aliases are intentionally-overlapping
|
|
455
|
+
* fuzzy search hints (two components both findable by "activity log" is
|
|
456
|
+
* correct), so collision is a non-constraint — flagging it drove edits that
|
|
457
|
+
* deleted valid aliases and degraded search recall.
|
|
458
|
+
*/
|
|
459
|
+
export function validateComponents(result, config) {
|
|
460
|
+
const findings = [];
|
|
461
|
+
const wsCategories = new Map(config.workspaces.map((w) => [w.name, w.categories]));
|
|
462
|
+
for (const f of result.missing) {
|
|
463
|
+
// Committed: a unit-shaped file with no `@cairn` header is hard debt.
|
|
464
|
+
// Ghost: the header is forbidden in client source, so the same file is an
|
|
465
|
+
// *unregistered unit* — a soft offer to register it in the out-of-repo
|
|
466
|
+
// store (never a nag to mutate source). Same detection, inverted finding.
|
|
467
|
+
findings.push(result.ghost
|
|
468
|
+
? {
|
|
469
|
+
kind: "unregistered-unit",
|
|
470
|
+
severity: "soft",
|
|
471
|
+
file: f,
|
|
472
|
+
message: `unregistered unit: ${f} — register it via cairn_component_register (no source edit)`,
|
|
473
|
+
}
|
|
474
|
+
: {
|
|
475
|
+
kind: "missing-header",
|
|
476
|
+
severity: "hard",
|
|
477
|
+
file: f,
|
|
478
|
+
message: `missing @cairn header: ${f}`,
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
const names = new Map();
|
|
482
|
+
for (const c of result.components) {
|
|
483
|
+
const t = c.tags;
|
|
484
|
+
for (const tag of COMPONENT_REQUIRED_TAGS) {
|
|
485
|
+
if (!t[tag]) {
|
|
486
|
+
findings.push({
|
|
487
|
+
kind: "missing-tag",
|
|
488
|
+
severity: "hard",
|
|
489
|
+
file: c.file,
|
|
490
|
+
message: `${c.file}: missing required @${tag}`,
|
|
491
|
+
});
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
const categories = wsCategories.get(c.workspace) ?? [...DEFAULT_CATEGORIES];
|
|
495
|
+
if (t.category && !categories.includes(t.category)) {
|
|
496
|
+
findings.push({
|
|
497
|
+
kind: "invalid-category",
|
|
498
|
+
severity: "hard",
|
|
499
|
+
file: c.file,
|
|
500
|
+
message: `${c.file}: invalid @category "${t.category}" (allowed: ${categories.join(", ")})`,
|
|
501
|
+
});
|
|
502
|
+
}
|
|
503
|
+
if (t.cairn) {
|
|
504
|
+
const key = `${c.workspace} ${t.cairn}`;
|
|
505
|
+
const prior = names.get(key);
|
|
506
|
+
if (prior !== undefined) {
|
|
507
|
+
findings.push({
|
|
508
|
+
kind: "duplicate-name",
|
|
509
|
+
severity: "hard",
|
|
510
|
+
file: c.file,
|
|
511
|
+
message: `duplicate @cairn name "${t.cairn}": ${prior} and ${c.file}`,
|
|
512
|
+
});
|
|
513
|
+
}
|
|
514
|
+
else {
|
|
515
|
+
names.set(key, c.file);
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
// Flag only when the header names something the file does NOT export at
|
|
519
|
+
// all — a file with multiple exports (component + hooks/consts/schemas)
|
|
520
|
+
// is valid as long as the `@cairn` name is one of them.
|
|
521
|
+
if (t.cairn && c.exportNames.length > 0 && !c.exportNames.includes(t.cairn)) {
|
|
522
|
+
findings.push({
|
|
523
|
+
kind: "export-mismatch",
|
|
524
|
+
severity: "soft",
|
|
525
|
+
file: c.file,
|
|
526
|
+
message: `${c.file}: @cairn "${t.cairn}" is not an exported name of the file (exports: ${c.exportNames.join(", ")}) — the registry must not lie about the code; rename the export or fix the header`,
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
return findings;
|
|
531
|
+
}
|
|
532
|
+
function toLedgerEntry(c) {
|
|
533
|
+
const entry = {
|
|
534
|
+
name: c.tags.cairn ?? "?",
|
|
535
|
+
workspace: c.workspace,
|
|
536
|
+
file: c.file,
|
|
537
|
+
category: c.tags.category ?? "",
|
|
538
|
+
purpose: c.tags.purpose ?? "",
|
|
539
|
+
aliases: splitCsv(c.tags.aliases),
|
|
540
|
+
singleton: Boolean(c.tags.singleton),
|
|
541
|
+
uses: splitCsv(c.tags.uses),
|
|
542
|
+
};
|
|
543
|
+
if (c.tags.status)
|
|
544
|
+
entry.status = c.tags.status;
|
|
545
|
+
return entry;
|
|
546
|
+
}
|
|
547
|
+
/** Collect + project the component registry into ledger entries. */
|
|
548
|
+
export function buildComponentsLedger(repoRoot) {
|
|
549
|
+
const config = loadComponentsConfig(repoRoot);
|
|
550
|
+
const { components } = collectComponents(repoRoot, config);
|
|
551
|
+
return components.map(toLedgerEntry);
|
|
552
|
+
}
|
|
553
|
+
/**
|
|
554
|
+
* Resolve which workspace(s) the given repo-relative path globs touch
|
|
555
|
+
* (longest-prefix match against component dirs), and return the entitled
|
|
556
|
+
* inventory: own workspace(s) + any `[shared]` workspace, with isolated
|
|
557
|
+
* workspaces named in `offLimits`. Single-app → the whole inventory.
|
|
558
|
+
*/
|
|
559
|
+
export function componentsInScope(repoRoot, pathGlobs) {
|
|
560
|
+
const config = loadComponentsConfig(repoRoot);
|
|
561
|
+
const { components } = collectComponents(repoRoot, config);
|
|
562
|
+
const ledger = components.map(toLedgerEntry);
|
|
563
|
+
if (config.workspaces.length <= 1) {
|
|
564
|
+
return { workspaces: [config.workspaces[0]?.name ?? ""], offLimits: [], components: ledger };
|
|
565
|
+
}
|
|
566
|
+
// Resolve target workspaces by longest-prefix dir match against the globs.
|
|
567
|
+
const targets = new Set();
|
|
568
|
+
for (const glob of pathGlobs) {
|
|
569
|
+
let bestWs = null;
|
|
570
|
+
let bestLen = -1;
|
|
571
|
+
for (const ws of config.workspaces) {
|
|
572
|
+
for (const dir of ws.componentDirs) {
|
|
573
|
+
if ((glob === dir || glob.startsWith(`${dir}/`)) && dir.length > bestLen) {
|
|
574
|
+
bestLen = dir.length;
|
|
575
|
+
bestWs = ws.name;
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
if (bestWs !== null)
|
|
580
|
+
targets.add(bestWs);
|
|
581
|
+
}
|
|
582
|
+
const sharedNames = config.workspaces.filter((w) => w.shared).map((w) => w.name);
|
|
583
|
+
const entitled = new Set([...targets, ...sharedNames]);
|
|
584
|
+
const offLimits = config.workspaces
|
|
585
|
+
.filter((w) => !entitled.has(w.name))
|
|
586
|
+
.map((w) => w.name);
|
|
587
|
+
return {
|
|
588
|
+
workspaces: [...entitled].sort(),
|
|
589
|
+
offLimits: offLimits.sort(),
|
|
590
|
+
components: ledger.filter((c) => entitled.has(c.workspace)),
|
|
591
|
+
};
|
|
592
|
+
}
|
|
593
|
+
/** Look up a single component by name (optionally scoped to a workspace). */
|
|
594
|
+
export function getComponent(repoRoot, name, workspace) {
|
|
595
|
+
const config = loadComponentsConfig(repoRoot);
|
|
596
|
+
const { components } = collectComponents(repoRoot, config);
|
|
597
|
+
const match = components.find((c) => c.tags.cairn === name &&
|
|
598
|
+
(workspace === undefined || c.workspace === workspace));
|
|
599
|
+
if (match === undefined)
|
|
600
|
+
return null;
|
|
601
|
+
return { entry: toLedgerEntry(match), record: match };
|
|
602
|
+
}
|
|
603
|
+
//# sourceMappingURL=components.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components.js","sourceRoot":"","sources":["../src/components.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EACL,oBAAoB,EACpB,qBAAqB,GAEtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AACrE,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,a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ChC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;SACpC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAEtB,OAAO;QACL,UAAU,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,IAAI,EAAE;QAChC,SAAS,EAAE,SAAS,CAAC,IAAI,EAAE;QAC3B,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;KAC5D,CAAC;AACJ,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,YAAY,CAC1B,QAAgB,EAChB,IAAY,EACZ,SAAkB;IAElB,MAAM,MAAM,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IAC9C,MAAM,EAAE,UAAU,EAAE,GAAG,iBAAiB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC3D,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAC3B,CAAC,CAAC,EAAE,EAAE,CACJ,CAAC,CAAC,IAAI,CAAC,KAAK,KAAK,IAAI;QACrB,CAAC,SAAS,KAAK,SAAS,IAAI,CAAC,CAAC,SAAS,KAAK,SAAS,CAAC,CACzD,CAAC;IACF,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IACrC,OAAO,EAAE,KAAK,EAAE,aAAa,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;AACxD,CAAC"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Top-level `.cairn/config.yaml` reader for the non-component sections.
|
|
3
|
+
*
|
|
4
|
+
* (The `components:` block has its own typed loader in components.ts.)
|
|
5
|
+
* Kept deliberately small + tolerant: a missing or malformed config is
|
|
6
|
+
* never fatal — callers get the documented defaults.
|
|
7
|
+
*/
|
|
8
|
+
/** Parse `.cairn/config.yaml` into a plain object ({} when absent/broken). */
|
|
9
|
+
export declare function loadCairnConfig(repoRoot: string): Record<string, unknown>;
|