···67676868**What it does:**
69697070-- Scans TypeScript files for exported lexicon namespace definitions
7171-- Extracts the `.json` property from each namespace
7070+- Scans TypeScript files for exported lexicon definitions
7171+- Extracts the `.json` property from each lexicon
7272- Emits properly formatted JSON lexicon schema files
7373- Names output files by lexicon ID (e.g., `app.bsky.feed.post.json`)
7474
+10-10
packages/cli/src/commands/gen-emit.ts
···5757 // Dynamically import the module
5858 const module = await import(fileUrl);
59596060- // Find all exported namespaces
6161- const namespaces: LexiconNamespace[] = [];
6060+ // Find all exported lexicons
6161+ const lexicons: LexiconNamespace[] = [];
6262 for (const key of Object.keys(module)) {
6363 const exported = module[key];
6464- // Check if it's a namespace with a json property
6464+ // Check if it's a lexicon with a json property
6565 if (
6666 exported &&
6767 typeof exported === "object" &&
···7272 "id" in exported.json &&
7373 "defs" in exported.json
7474 ) {
7575- namespaces.push(exported as LexiconNamespace);
7575+ lexicons.push(exported as LexiconNamespace);
7676 }
7777 }
78787979- if (namespaces.length === 0) {
8080- console.warn(` ⚠ ${sourcePath}: No lexicon namespaces found`);
7979+ if (lexicons.length === 0) {
8080+ console.warn(` ⚠ ${sourcePath}: No lexicon lexicons found`);
8181 return;
8282 }
83838484- // Emit JSON for each namespace
8585- for (const namespace of namespaces) {
8686- const { id } = namespace.json;
8484+ // Emit JSON for each lexicon
8585+ for (const lexicon of lexicons) {
8686+ const { id } = lexicon.json;
8787 const outputPath = join(outdir, `${id}.json`);
88888989 // Write the JSON file
9090 await writeFile(
9191 outputPath,
9292- JSON.stringify(namespace.json, null, "\t"),
9292+ JSON.stringify(lexicon.json, null, "\t"),
9393 "utf-8",
9494 );
9595