fix: stabilize workspace gateway and scaffolding

This commit is contained in:
2026-07-13 12:54:07 +05:30
parent 6dfef7da3c
commit 88e907783a
63 changed files with 380 additions and 206 deletions
+35 -8
View File
@@ -8,12 +8,15 @@
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
import { dirname, join, resolve } from "node:path";
import { AI_GUIDE, CLAUDE_MD } from "./ai-guide.ts";
import { currentCliVersion } from "./update-notifier.ts";
const frameworkVersion = currentCliVersion();
/** Map of file (relative to app root) -> contents. */
const TEMPLATE: Record<string, string> = {
// AI/agent context: teaches Claude Code / Cursor / Copilot the WrNexus conventions.
"CLAUDE.md": CLAUDE_MD,
"llms.txt": AI_GUIDE,
"public/llms.txt": AI_GUIDE,
".gitignore": `# Dependencies
node_modules/
@@ -64,6 +67,9 @@ Thumbs.db
"version": "0.1.0",
"private": true,
"type": "module",
"wrnexus": {
"version": "${frameworkVersion}"
},
"scripts": {
"dev": "wrnexus dev .",
"build": "wrnexus build .",
@@ -76,14 +82,14 @@ Thumbs.db
"check": "bun run lint && bun run format:check"
},
"dependencies": {
"@wrnexus/ai": "^0.2.0",
"@wrnexus/core": "^0.2.0",
"@wrnexus/styles": "^0.2.0",
"@wrnexus/validation": "^0.2.0",
"@wrnexus/db": "^0.2.0"
"@wrnexus/ai": "${frameworkVersion}",
"@wrnexus/core": "${frameworkVersion}",
"@wrnexus/styles": "${frameworkVersion}",
"@wrnexus/validation": "${frameworkVersion}",
"@wrnexus/db": "${frameworkVersion}"
},
"devDependencies": {
"@wrnexus/cli": "^0.2.0",
"@wrnexus/cli": "${frameworkVersion}",
"@eslint/js": "^9.0.0",
"@tailwindcss/cli": "^4.0.0",
"@types/bun": "latest",
@@ -306,7 +312,7 @@ page Home {
<div class="mt-8 flex flex-wrap items-center justify-center gap-3">
<a href="/about" class="rounded-lg bg-slate-900 px-5 py-2.5 text-sm font-medium text-white shadow-sm transition hover:bg-slate-700 dark:bg-white dark:text-slate-900 dark:hover:bg-slate-200">Get started</a>
<a href="/hello" class="rounded-lg border border-slate-200 px-5 py-2.5 text-sm font-medium text-slate-700 transition hover:border-slate-300 dark:border-white/10 dark:text-slate-300 dark:hover:border-white/20">View demo</a>
<a href="/api/hello" class="rounded-lg border border-slate-200 px-5 py-2.5 text-sm font-medium text-slate-700 transition hover:border-slate-300 dark:border-white/10 dark:text-slate-300 dark:hover:border-white/20">View API</a>
</div>
<div class="mt-14 w-full max-w-md rounded-2xl border border-slate-200 bg-white p-6 text-left shadow-sm dark:border-white/10 dark:bg-white/5">
@@ -332,6 +338,27 @@ page Home {
</main>
}
}
`,
"app/pages/about.wrn": `page About {
seo {
title = "About"
description = "Learn how APP_NAME is built with WrNexus."
}
view {
<main class="min-h-screen bg-white px-6 py-20 text-slate-900 dark:bg-[#0b0f1e] dark:text-slate-100">
<article class="mx-auto max-w-2xl">
<a href="/" class="text-sm text-indigo-600 hover:underline dark:text-indigo-400">← Home</a>
<p class="mt-12 font-mono text-xs uppercase tracking-[0.2em] text-indigo-500">WrNexus application</p>
<h1 class="mt-4 text-4xl font-bold tracking-tight">About APP_NAME</h1>
<p class="mt-6 text-lg leading-8 text-slate-600 dark:text-slate-400">
This page is server-rendered from <code>app/pages/about.wrn</code>. Add state,
events, components, APIs, and data without switching to another UI framework.
</p>
</article>
</main>
}
}
`,
"app/components/counter.wrn": `// A reusable component. Route: none — mounted inside a page with
// <div data-component="counter" ...props></div>.