create-lacspace-app 2.2.1 → 2.3.0

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/README.md CHANGED
@@ -18,6 +18,12 @@ npx create-lacspace-app my-app --template saas
18
18
 
19
19
  You choose the *kind* of site you're building. It writes a **real Next.js 15 + React 19 + Tailwind v4 app** — not a hello-world, but a genuinely **polished, modern site**: a fluid `clamp()` type scale, tight display headings, a refined light **and** dark palette, glass chrome, soft layered shadows, a smooth logo marquee, animated counters, scroll reveals and a shimmering primary CTA — every page filled in, an SEO stack wired end-to-end, and a **26-component UI kit** you can drop in anywhere.
20
20
 
21
+ > **New in v2.3 — composable feature add-ons + flagship AI.** Layer optional, self-contained add-ons onto *any* template with `--with <a,b>` (or pick them in the interactive prompt, or `add` them later). Two ship today — both **free, keyless and local by default** (Ollama, no API key):
22
+ > - **`ai-chat`** — a streaming AI chat route (`/api/chat`) + a clean chat UI (`/chat`), guarded against prompt injection, built on the Lacspace AI Kit.
23
+ > - **`rag`** — "chat with your docs": index your markdown/text (`npm run rag:index`), then ask grounded, source-cited questions at `/ask`.
24
+ >
25
+ > Everything stays **strictly additive** — a scaffold with no features is byte-for-byte the same as before, and the CLI remains **zero runtime dependencies**.
26
+
21
27
  > **New in v2.1 — a design-quality pass.** Every template was rebuilt around a real design system: cohesive tokens (`--accent`, surfaces, hairlines, shadows), reusable utilities (`.glass`, `.card`, `.gradient-text`, `.grid-bg`/`.dot-bg`, `.shimmer`), a sticky glass header that shrinks on scroll, a richer multi-column footer with a newsletter island, a soft gradient-mesh backdrop, and confident, specific copy per template — all `prefers-reduced-motion`-aware. The signature sites ship as **LSFolio · LSStudio · LSStore · LSCloud · LSBlogs · LSDocs · LSAdmin · LSResto · LSBazaar**.
22
28
 
23
29
  ---
@@ -81,6 +87,44 @@ import { PricingSection } from "@/components/sections/pricing";
81
87
 
82
88
  **Available sections:** `hero` · `features` · `pricing` · `faq` · `testimonials` · `team` · `stats` · `timeline` · `gallery` · `logos` · `cta` · `bento` · `steps` · `feature-split` · `banner`. Run `add` with no arguments to list them.
83
89
 
90
+ `add` also accepts a **feature add-on** key (below) — it drops the feature's files into your project (skipping any that already exist) and prints the exact deps, env vars and next-steps to wire up:
91
+
92
+ ```bash
93
+ npx create-lacspace-app add ai-chat # drops app/api/chat/route.ts + app/chat/page.tsx
94
+ ```
95
+
96
+ ## 🤖 Feature add-ons — `--with`
97
+
98
+ Feature add-ons are optional, self-contained bundles you can layer onto **any** template: they contribute their own files (namespaced under their own routes), dependencies, `package.json` scripts, `.env.example` entries and an onboarding checklist (`LEARN.md`). They **compose** (order-independent, no collisions) and are **strictly additive** — leave them off and you get today's scaffold, unchanged.
99
+
100
+ ```bash
101
+ # scaffold with one or both, free & keyless (local Ollama by default)
102
+ npx create-lacspace-app my-app --template saas --with ai-chat
103
+ npx create-lacspace-app my-app --template saas --with ai-chat,rag # (alias: --features)
104
+ ```
105
+
106
+ In the interactive flow, after you pick a template you're offered the same list as a numbered picker — enter comma-separated numbers, or press Enter for none. (Non-TTY or `--yes` → uses your flags/defaults, no prompt.)
107
+
108
+ | Feature | What it adds | Packages (keyless) |
109
+ | --- | --- | --- |
110
+ | **`ai-chat`** | A streaming chat route `app/api/chat/route.ts` + a chat UI `app/chat/page.tsx`. Reads provider config from env, runs input through a prompt-injection guard, and streams the reply. | `@lacspace/ai` `@lacspace/prompt` `@lacspace/stream` `@lacspace/providers` `@lacspace/memory` `@lacspace/moderation` |
111
+ | **`rag`** | "Chat with your docs": `content/welcome.md`, an indexer `scripts/index-content.mjs` (+ `rag:index` script), a retrieval+rerank answer route `app/api/ask/route.ts`, and an ask UI `app/ask/page.tsx`. | `@lacspace/rag` `@lacspace/embeddings` `@lacspace/vector` `@lacspace/chunk` `@lacspace/rerank` `@lacspace/providers` `@lacspace/ai` |
112
+
113
+ ### 🆓 Free & local by default — no API key
114
+
115
+ Both AI add-ons default to **[Ollama](https://ollama.com)**, so they run **entirely on your machine — free, offline and keyless**. One-time setup:
116
+
117
+ ```bash
118
+ # ai-chat
119
+ ollama pull llama3.2 && npm run dev # then open /chat
120
+
121
+ # rag (adds an embedding model)
122
+ ollama pull nomic-embed-text && ollama pull llama3.2
123
+ npm run rag:index && npm run dev # then open /ask
124
+ ```
125
+
126
+ Prefer a hosted model? Set `LACSPACE_AI_*` in `.env` (e.g. `LACSPACE_AI_PROVIDER=groq` + `LACSPACE_AI_API_KEY=…`) — the same code path works against any OpenAI-compatible provider. The generated `LEARN.md` walks you through every step.
127
+
84
128
  ## Templates
85
129
 
86
130
  | Key | Ships as | What you get |
@@ -102,6 +146,7 @@ Every template is Next.js 15 App Router + React 19 + Tailwind v4 — dark, moder
102
146
  | Flag | Meaning |
103
147
  | --- | --- |
104
148
  | `-t, --template <key>` | `personal` · `business` · `ecommerce` · `saas` · `blog` · `docs` · `dashboard` · `restaurant` · `marketplace` |
149
+ | `--with <a,b>` | feature add-ons, comma-separated — `ai-chat` · `rag` (alias `--features`) |
105
150
  | `--theme <name\|hex>` | accent gradient — a preset, a `"#hex"`, or `"from,to"` (see below) |
106
151
  | `--pm <npm\|pnpm\|yarn\|bun>` | package manager (default `npm`) |
107
152
  | `--no-install` | skip installing dependencies |
@@ -130,10 +175,15 @@ import {
130
175
  scaffold, // Node: writes a project to disk
131
176
  listTemplates, // the 9 templates + their metadata
132
177
  listSections, // the 15 prebuilt sections
178
+ listFeatures, // the composable feature add-ons (ai-chat, rag)
133
179
  } from "create-lacspace-app";
134
180
 
135
181
  // 1. Pure — get the whole project as { "path": "contents" }. Runs anywhere.
136
182
  const files = generateProject({ name: "acme", template: "saas", theme: "#ff6a00" });
183
+
184
+ // Layer feature add-ons on — strictly additive, order-independent.
185
+ const ai = generateProject({ name: "acme", template: "saas", features: ["ai-chat", "rag"] });
186
+ ai["app/api/chat/route.ts"]; // → the streaming chat route source
137
187
  files["app/page.tsx"]; // → the generated home page source
138
188
  Object.keys(files).length; // → ~70 files
139
189
 
@@ -151,9 +201,38 @@ console.log(`Scaffolded ${written.length} files → ${dir}`);
151
201
  | `listTemplates()` / `templates` | The built-in templates with metadata (`key`, `label`, `description`, `accent`, defaults). |
152
202
  | `getTemplate(key)` | One template's metadata, or `undefined`. |
153
203
  | `listSections()` / `getSection(name)` | The prebuilt section names, and one section's source. |
204
+ | `listFeatures()` / `getFeature(key)` | The composable feature add-ons (`FeatureDef[]`), and one feature's definition. |
154
205
  | `templateKeys` | Every valid `template` key. |
155
206
 
156
- `options`: `{ name?, template?, theme? }` — the same choices as the CLI flags above.
207
+ `options`: `{ name?, template?, theme?, features? }` — the same choices as the CLI flags above (`features` mirrors `--with`; unknown keys are ignored, duplicates de-duped).
208
+
209
+ ## ❓ FAQ
210
+
211
+ More questions — about the packages, tools and this CLI — are answered at **[developer.lacspace.com/faq](https://developer.lacspace.com/faq)**.
212
+
213
+ **What is create-lacspace-app?**
214
+ A scaffolding CLI that writes a complete, production-ready **Next.js 15 + Tailwind** app in seconds — pre-wired with Lacspace SEO, security headers, robots.txt, a sitemap, a working contact form, a ⌘K command palette, dynamic Open Graph images and a CI workflow.
215
+
216
+ **How do I scaffold a new app?**
217
+ `npx create-lacspace-app`, or pass a name and template up front: `npx create-lacspace-app my-site --template saas`. It installs dependencies and hands you a running app.
218
+
219
+ **Which templates are included?**
220
+ Personal, business, ecommerce, SaaS, blog (a real Markdown blog), docs (a real Markdown docs site) and marketplace — each a complete, deployable Next.js app. Preview them all at [templates.lacspace.com](https://templates.lacspace.com).
221
+
222
+ **What comes pre-wired in a generated app?**
223
+ SEO metadata + JSON-LD via `@lacspace/seo`, a dynamic OG image endpoint via `@lacspace/og`, security headers, `robots.txt` and a sitemap, a typed contact form with a honeypot, a ⌘K command palette, and a GitHub Actions workflow that gates on an SEO crawl grade.
224
+
225
+ **Do I need to know the Lacspace packages to use it?**
226
+ No — the generated app works out of the box and you can build normally. The packages are wired in where they help; lean on them as much or as little as you like.
227
+
228
+ **Which Node version do I need?**
229
+ Node.js **20 or newer**.
230
+
231
+ **Is it really free — for commercial projects too?**
232
+ Yes. It's free under the permissive **Lacspace Free Licence v1.0**, commercial use included, and the apps you generate are entirely yours.
233
+
234
+ **Where do I report a bug or request a feature?**
235
+ Open an issue at [github.com/lacspace/npm-packages/issues](https://github.com/lacspace/npm-packages/issues).
157
236
 
158
237
  ## Licensing
159
238