docs: refresh AI references from installed CLI
This commit is contained in:
+152
-2
@@ -1,4 +1,5 @@
|
||||
import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from "node:fs";
|
||||
import { execFileSync } from "node:child_process";
|
||||
import { join, resolve } from "node:path";
|
||||
import { format } from "prettier";
|
||||
|
||||
@@ -15,6 +16,151 @@ const packageNames = [...Object.keys(pkg.dependencies), ...Object.keys(pkg.devDe
|
||||
.filter((name, index, all) => all.indexOf(name) === index)
|
||||
.sort();
|
||||
const packageCount = packageNames.length;
|
||||
const cliEntry = join(root, "node_modules", "@wrnexus", "cli", "dist", "index.js");
|
||||
const cliHelp = execFileSync(process.execPath, [cliEntry, "--help"], {
|
||||
cwd: root,
|
||||
encoding: "utf8",
|
||||
env: { ...process.env, WRNEXUS_DISABLE_UPDATE_CHECK: "1" },
|
||||
}).trim();
|
||||
const cliReference = `# Complete CLI command reference
|
||||
|
||||
This section is generated from the installed \`@wrnexus/cli@${version}\` executable. It is the canonical command inventory for this release.
|
||||
|
||||
\`\`\`text
|
||||
${cliHelp}
|
||||
\`\`\`
|
||||
|
||||
## CLI workflows with expected output
|
||||
|
||||
Commands below are copy-ready. Paths, ports, counts, and timings vary by project; the shown output identifies the success condition to check.
|
||||
|
||||
### Create, check, build, and preview an application
|
||||
|
||||
\`\`\`bash
|
||||
bunx @wrnexus/cli@${version} create my-app
|
||||
cd my-app
|
||||
bun install
|
||||
bunx wrnexus typecheck .
|
||||
bunx wrnexus build .
|
||||
bunx wrnexus preview . --port=3000
|
||||
\`\`\`
|
||||
|
||||
Expected output:
|
||||
|
||||
\`\`\`text
|
||||
✓ Application types are valid
|
||||
✓ Runtime: .../dist/reactive.js
|
||||
✓ Styles: .../dist/styles.css
|
||||
✓ Server: .../dist/server.js
|
||||
Run it: bun .../dist/server.js
|
||||
\`\`\`
|
||||
|
||||
### Generate framework files and committed application types
|
||||
|
||||
\`\`\`bash
|
||||
bunx wrnexus generate page Dashboard
|
||||
bunx wrnexus generate component status-card
|
||||
bunx wrnexus generate api health
|
||||
bunx wrnexus generate schema account
|
||||
bunx wrnexus generate routes
|
||||
bunx wrnexus generate types .
|
||||
\`\`\`
|
||||
|
||||
Expected output includes created source paths followed by:
|
||||
|
||||
\`\`\`text
|
||||
✓ Generated app/routes.gen.ts (... routes)
|
||||
✓ Generated .../app/types/wrnexus.generated.d.ts (... routes, ... components)
|
||||
\`\`\`
|
||||
|
||||
### Run development and production-runtime modes
|
||||
|
||||
\`\`\`bash
|
||||
bunx wrnexus dev . --port=3000
|
||||
bunx wrnexus dev . --services --services-port=3099
|
||||
bunx wrnexus dev . --production-runtime --port=3000
|
||||
\`\`\`
|
||||
|
||||
Expected output reports the active profile, discovered plugins/routes, generated cache path, and listening URL. Production-runtime mode rebuilds and reloads the exact production artifact.
|
||||
|
||||
### Database lifecycle
|
||||
|
||||
\`\`\`bash
|
||||
bunx wrnexus db status
|
||||
bunx wrnexus db new create_accounts --from-models
|
||||
bunx wrnexus db migrate
|
||||
bunx wrnexus db generate
|
||||
bunx wrnexus db seed
|
||||
\`\`\`
|
||||
|
||||
Expected output identifies the selected profile/dialect, migration state, applied migration names, and generated typed query files. Run \`db rollback\` only when intentionally reverting the latest migration.
|
||||
|
||||
### Diagnose, inspect, and enforce contracts
|
||||
|
||||
\`\`\`bash
|
||||
bunx wrnexus doctor .
|
||||
bunx wrnexus typecheck .
|
||||
bunx wrnexus compatibility check .
|
||||
bunx wrnexus contracts check .
|
||||
bunx wrnexus security audit .
|
||||
bunx wrnexus inspect packages .
|
||||
bunx wrnexus inspect routes .
|
||||
bunx wrnexus inspect component Navbar .
|
||||
bunx wrnexus analyze .
|
||||
\`\`\`
|
||||
|
||||
Successful checks exit with status 0. Inspect commands print the resolved package, route, component, asset, runtime, style, migration, or bundle contract without changing the application.
|
||||
|
||||
### Tests, API artifacts, SDKs, and deployment manifests
|
||||
|
||||
\`\`\`bash
|
||||
bunx wrnexus test unit .
|
||||
bunx wrnexus test component .
|
||||
bunx wrnexus test api .
|
||||
bunx wrnexus test browser .
|
||||
bunx wrnexus api generate .
|
||||
bunx wrnexus api docs .
|
||||
bunx wrnexus sdk generate typescript .
|
||||
bunx wrnexus deploy docker .
|
||||
\`\`\`
|
||||
|
||||
Test commands return the underlying suite summary and a nonzero status on failure. API/SDK/deploy commands report each generated artifact; review and commit generated files after validation.
|
||||
|
||||
### Workspaces and environments
|
||||
|
||||
\`\`\`bash
|
||||
bunx wrnexus workspace company-platform
|
||||
cd company-platform
|
||||
bunx wrnexus workspace add reports --domain=reports.localhost
|
||||
bunx wrnexus gateway --port=3000
|
||||
bunx wrnexus production . --prepare-only
|
||||
bunx wrnexus staging .
|
||||
\`\`\`
|
||||
|
||||
Expected output lists created apps, domain mappings, selected environment/profile, build and migration decisions, and the gateway address.
|
||||
|
||||
### Internationalization, native targets, MCP, and support bundles
|
||||
|
||||
\`\`\`bash
|
||||
bunx wrnexus i18n extract .
|
||||
bunx wrnexus i18n validate .
|
||||
bunx wrnexus generate mobile
|
||||
bunx wrnexus mobile compile
|
||||
bunx wrnexus native list
|
||||
bunx wrnexus mcp .
|
||||
bunx wrnexus report . --file=app/pages/index.wrn
|
||||
\`\`\`
|
||||
|
||||
Expected output identifies extracted/validated translation keys, generated native routes, available capabilities, MCP stdio startup, or the sanitized reproduction archive. MCP uses stdio, so protocol messages—not a web URL—are its normal runtime output.
|
||||
|
||||
### Safe upgrades
|
||||
|
||||
\`\`\`bash
|
||||
bunx wrnexus update . --latest --dry-run
|
||||
bunx wrnexus update . --latest
|
||||
\`\`\`
|
||||
|
||||
The dry run previews dependency and migration changes. A real update prints the source and target versions, backup directory, each migration action, installation result, and verification result. Commit or back up the application before upgrading.`;
|
||||
const uiReferencePath = join(root, "node_modules", "@wrnexus", "ui", "component-reference.json");
|
||||
const uiReference = existsSync(uiReferencePath)
|
||||
? (JSON.parse(readFileSync(uiReferencePath, "utf8")) as {
|
||||
@@ -529,6 +675,10 @@ if (frameworkGuide.startsWith("# WRNexusJS documentation ")) {
|
||||
} else {
|
||||
frameworkGuide = `# WRNexusJS documentation ${version}\n\nStatus: Private Developer Preview. This site documents ${packageCount} release-aligned packages.\n\n${frameworkGuide}`;
|
||||
}
|
||||
frameworkGuide = frameworkGuide.replace(
|
||||
/\n## CLI\n[\s\S]*?\n## When asked to "create a page\/component\/feature"/,
|
||||
`\n## CLI\n\nSee the generated **Complete CLI command reference** below. It is sourced from the installed ${version} executable so command names and options cannot drift.\n\n## When asked to "create a page/component/feature"`,
|
||||
);
|
||||
const installedPackageDocs = packageNames
|
||||
.map((name) => {
|
||||
const packageRoot = join(root, "node_modules", "@wrnexus", name);
|
||||
@@ -558,11 +708,11 @@ const componentSources =
|
||||
.join("\n\n---\n\n") ?? "";
|
||||
writeFileSync(
|
||||
join(pub, "llms.txt"),
|
||||
`${frameworkGuide}\n\n# Canonical documentation locations\n\n- Framework and package documentation: https://wrnexusjs.dev/\n- Interactive UI component showcase and examples: https://component.wrnexusjs.dev/\n- Comprehensive AI reference: https://wrnexusjs.dev/llms-full.txt\n\n# Installed package index\n\n${packageIndex}\n\n# UI component catalog\n\nThe installed @wrnexus/ui ${version} release contains ${uiReference?.count ?? 0} documented components. The contracts below include every mount name, purpose, prop type, required/default status, slot, and event. Interactive examples live only on the dedicated component showcase.\n\n${uiReferenceText}\n`,
|
||||
`${frameworkGuide}\n\n${cliReference}\n\n# Canonical documentation locations\n\n- Framework and package documentation: https://wrnexusjs.dev/\n- Interactive UI component showcase and examples: https://component.wrnexusjs.dev/\n- Comprehensive AI reference: https://wrnexusjs.dev/llms-full.txt\n\n# Installed package index\n\n${packageIndex}\n\n# UI component catalog\n\nThe installed @wrnexus/ui ${version} release contains ${uiReference?.count ?? 0} documented components. The contracts below include every mount name, purpose, prop type, required/default status, slot, and event. Interactive examples live only on the dedicated component showcase.\n\n${uiReferenceText}\n`,
|
||||
);
|
||||
writeFileSync(
|
||||
join(pub, "llms-full.txt"),
|
||||
`${frameworkGuide}\n\nRelease: WRNexusJS ${version}\n\n# Canonical documentation locations\n\n- Framework and package documentation: https://wrnexusjs.dev/\n- Interactive UI component showcase and examples: https://component.wrnexusjs.dev/\n\n${packageMarker}\n\nThe following README files and declarations come from the installed private ${version} release.\n\n${installedPackageDocs}\n\n# Complete @wrnexus/ui component reference and source contracts\n\n${componentSources}\n`,
|
||||
`${frameworkGuide}\n\nRelease: WRNexusJS ${version}\n\n${cliReference}\n\n# Canonical documentation locations\n\n- Framework and package documentation: https://wrnexusjs.dev/\n- Interactive UI component showcase and examples: https://component.wrnexusjs.dev/\n\n${packageMarker}\n\nThe following README files and declarations come from the installed private ${version} release.\n\n${installedPackageDocs}\n\n# Complete @wrnexus/ui component reference and source contracts\n\n${componentSources}\n`,
|
||||
);
|
||||
|
||||
const auditDocs: Record<string, string> = {
|
||||
|
||||
Reference in New Issue
Block a user