Files
nibiru-framework.com/docs/scripts/sync-design-system.mjs
stephan 48c839d927 Initial public push: docs cosmos v4 + AI module + framework groundwork
This is the snapshot the production landing site (nibiru-framework.com) is
deployed from. Brings together the recent splash + docs migration to the v4
"Cosmos" design system, the new in-framework AI module, and the framework
groundwork that backs the framework-reference extraction.

What lands:
- docs/: Astro + Starlight site with the v4 dark cosmic palette, GalaxyHero
  canvas constellation, Mission Control chat (wired to /api/oracle →
  api.neuronetz.ai via providers.mjs Ollama), 5-panel MMVC stage
  (Model · AI · Module · Controller · View), translated EN/DE/JA/ES/FR
  content, PWA + sitemap + llms.txt + Umami analytics.
- docs/design-system/: canonical mockup bundle (source/index-v2.html for
  splash, source/docs-system.html + preview/ for docs, SPEC.md, tokens).
- docs/scripts/extraction/framework-reference-v2.md: deep framework
  reference (~1.6k lines, file:line citations, every public factory and
  idiom — basis for the LoRA training corpus.
- application/module/ai/: AI module with chat / embed / RAG / agent
  plugins, plus pdoQuery / httpGet / fileRead tools and Modelfile +
  smoke-test in training/.
- application/module/users/: user / ACL / form-factory traits used as the
  reference plugin pattern for the framework docs.
- application/settings/config/database/: schema + seed migrations
  including the AI module tables (200–203).
- Form factory + autogenerator changes the framework-reference-v2 covers.

Production secrets stay out: docs/.env, settings.production.ini and
ai.production.ini are all gitignored (.example files are in tree).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-08 15:22:18 +02:00

83 lines
2.3 KiB
JavaScript

#!/usr/bin/env node
/**
* Mirror /design-system/ → /public/design-system/ AND /src/styles/design-system/
*
* The canonical tokens live at the project root in design-system/. They need
* to land in two places before the build runs:
*
* • public/design-system/ — served as static assets so partner sites can
* `<link rel="stylesheet" href="https://nibiru-framework.com/design-system/tokens.css">`.
*
* • src/styles/design-system/ — Starlight's `customCss` only accepts paths
* under src/, so the site itself imports the tokens from here.
*
* Both are copies of the same source. Rather than hand-maintain three trees,
* this script syncs them on every install / build.
*/
import { mkdir, readdir, copyFile, stat, rm } from 'node:fs/promises';
import { dirname, join, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
const __dirname = dirname(fileURLToPath(import.meta.url));
const SRC = resolve(__dirname, '..', 'design-system');
const DSTS = [
resolve(__dirname, '..', 'public', 'design-system'),
resolve(__dirname, '..', 'src', 'styles', 'design-system'),
];
// Files we publish. Anything else (zips, internal notes) stays out of public/.
const PUBLISHED = new Set([
'README.md',
'tokens.css',
'tokens.scss',
'tokens.json',
'tailwind.preset.js',
'docs-page-mockup.html',
]);
async function ensure(dir) {
await mkdir(dir, { recursive: true });
}
async function copyTree(src, dst) {
await ensure(dst);
const entries = await readdir(src, { withFileTypes: true });
for (const entry of entries) {
if (!PUBLISHED.has(entry.name)) continue;
const from = join(src, entry.name);
const to = join(dst, entry.name);
if (entry.isDirectory()) {
await copyTree(from, to);
} else {
await copyFile(from, to);
}
}
}
async function pruneStale(dst) {
try {
const entries = await readdir(dst, { withFileTypes: true });
for (const entry of entries) {
if (!PUBLISHED.has(entry.name)) {
await rm(join(dst, entry.name), { recursive: true, force: true });
}
}
} catch (err) {
if (err.code !== 'ENOENT') throw err;
}
}
try {
await stat(SRC);
} catch {
console.error(`[sync-design-system] no source directory at ${SRC}`);
process.exit(1);
}
for (const dst of DSTS) {
await pruneStale(dst);
await copyTree(SRC, dst);
console.log(`[sync-design-system] mirrored ${SRC}${dst}`);
}