@withmata/blueprints 0.3.2 → 0.3.3

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.
@@ -138,7 +138,7 @@ Based on the project structure, project context, and user answers, adapt the blu
138
138
  - Replace `{{APP_NAME}}`, `{{EMAIL_FROM}}`, `{{SCOPE}}`
139
139
  - Copy/adapt `files/server/auth-db.ts` -> `apis/server/src/db/auth.ts`
140
140
  - Copy/adapt `files/server/middleware.ts` -> `apis/server/src/middleware/auth.ts`
141
- - Merge auth env vars into `apis/server/src/env.ts`
141
+ - Merge auth env vars into `apis/server/src/env.ts` (if env-t3 is installed, this uses `@t3-oss/env-core` with Zod schemas — add vars to the `server` schema object)
142
142
 
143
143
  **If single-repo:**
144
144
  - Copy/adapt `files/server/auth.ts` -> `src/lib/auth/index.ts`
@@ -146,7 +146,7 @@ Based on the project structure, project context, and user answers, adapt the blu
146
146
  - Adjust DB import to use direct path: `import { db } from "@/db/auth/client"` or `#db/auth/client`
147
147
  - Copy/adapt `files/server/auth-db.ts` -> `src/lib/db/auth.ts`
148
148
  - Default to Next.js API routes (no separate Hono server)
149
- - Merge auth env vars into existing `env.ts` (or create one)
149
+ - Merge auth env vars into existing env files. If env-t3 is installed (check for `src/env/server.ts`), add server vars to `src/env/server.ts` and client vars to `src/env/client.ts`. Otherwise merge into `env.ts` (or create one).
150
150
 
151
151
  **Both:**
152
152
  - If the project uses a different server framework than Hono, adapt the middleware while keeping the core `auth.api.getSession({ headers })` pattern
@@ -7,18 +7,34 @@ description: Set up a Turborepo + pnpm monorepo skeleton (skip for single-repo a
7
7
 
8
8
  Set up the monorepo project skeleton using the foundation blueprint. **For single-repo applications** (standalone Next.js, Node, or Bun apps), skip this command and go directly to feature blueprints (`/scaffold-db`, `/scaffold-auth`) — they detect single-repo projects and adapt automatically.
9
9
 
10
- ## Step 1: Read the Blueprint
10
+ This skill operates in two modes:
11
11
 
12
- Read the full foundation blueprint and all template files:
12
+ - **Install mode** (default) fresh scaffold of the full monorepo skeleton
13
+ - **Upgrade mode** — detects an existing foundation install and offers to apply updates (new features added to blueprints since the original install)
14
+
15
+ ## Step 1: Read the Blueprints
16
+
17
+ Read the foundation blueprint and all template files:
13
18
 
14
19
  ```
15
20
  ~/.withmata/blueprints/blueprints/foundation/monorepo-turbo/BLUEPRINT.md
16
21
  ~/.withmata/blueprints/blueprints/foundation/monorepo-turbo/files/**/*
17
22
  ```
18
23
 
24
+ Also read the feature blueprints that foundation can optionally include:
25
+
26
+ ```
27
+ ~/.withmata/blueprints/blueprints/features/env-t3/BLUEPRINT.md
28
+ ~/.withmata/blueprints/blueprints/features/env-t3/files/**/*
29
+ ~/.withmata/blueprints/blueprints/features/tailwind-v4/BLUEPRINT.md
30
+ ~/.withmata/blueprints/blueprints/features/tailwind-v4/files/**/*
31
+ ~/.withmata/blueprints/blueprints/features/ui-shared-components/BLUEPRINT.md
32
+ ~/.withmata/blueprints/blueprints/features/ui-shared-components/files/**/*
33
+ ```
34
+
19
35
  If not found, run `npx @withmata/blueprints` to install.
20
36
 
21
- The BLUEPRINT.md contains the full architecture documentation, naming conventions, folder conventions, and file manifest. Follow it precisely.
37
+ The BLUEPRINT.md files contain the full architecture documentation, naming conventions, folder conventions, and file manifests. Follow them precisely.
22
38
 
23
39
  ## Step 2: Read Project Context
24
40
 
@@ -26,12 +42,48 @@ Check if `.project-context.md` exists in the target project root:
26
42
 
27
43
  - **If it has a Discovery section**: use the product name to derive the npm scope (e.g., "Acme Dashboard" -> `@acme`). Use technical constraints to inform any decisions.
28
44
 
29
- - **If it has a Foundation section already**: warn the user. Ask: "Foundation was already set up. Do you want to re-scaffold (destructive replaces existing structure) or skip?"
45
+ - **If it has a Foundation section already**: **switch to upgrade mode** (see Step 2b below).
46
+
47
+ - **If no context file exists**: that is fine. Ask the user directly for the product name and npm scope. Proceed with install mode.
48
+
49
+ ### Step 2b: Upgrade Mode Detection
50
+
51
+ When foundation is already installed, compare what's currently in the project against what the blueprints now offer. Check for:
52
+
53
+ 1. **Foundation file updates** — Compare each foundation template file against the installed version. Flag files where the blueprint template has changed (e.g., updated `turbo.json` task structure, new fields in `package.json`).
54
+
55
+ 2. **Missing features** — Check `.project-context.md` Installed Blueprints for:
56
+ - `env-t3` — Is it installed? If not, apply it automatically (env validation is not optional).
57
+ - `tailwind-v4` + `ui-shared-components` — Are they installed? If not, flag as available (frontend UI is optional).
58
+
59
+ 3. **Present findings to the user:**
60
+
61
+ ```
62
+ Foundation was installed on <date>. Here's what's available:
30
63
 
31
- - **If no context file exists**: that is fine. Ask the user directly for the product name and npm scope.
64
+ Updates to existing files:
65
+ ☐ turbo.json — new task caching strategy
66
+ ☐ apps/web/next.config.ts — updated config pattern
67
+
68
+ Auto-applying:
69
+ ✓ Validated environment variables (env-t3) — type-safe env with client/server split
70
+
71
+ New features (not yet installed):
72
+ ☐ Frontend UI setup (tailwind-v4 + ui-shared-components) — full design system and shared component library
73
+
74
+ Which would you like to apply?
75
+ ```
76
+
77
+ 4. Apply only what the user selects. For each selected feature, follow its blueprint's integration steps (adapted to the existing project). Skip configuration questions where the answer is already in `.project-context.md`.
78
+
79
+ 5. Update `.project-context.md` with the newly installed features and update `foundation_completed` date.
80
+
81
+ After upgrade mode completes, skip to Step 7 (Summarize).
32
82
 
33
83
  ## Step 3: Understand Current State
34
84
 
85
+ *(Install mode only — skipped in upgrade mode)*
86
+
35
87
  Explore the target project directory:
36
88
 
37
89
  - Is it empty? Fresh start — scaffold everything.
@@ -40,12 +92,20 @@ Explore the target project directory:
40
92
 
41
93
  ## Step 4: Ask Configuration Questions
42
94
 
43
- Only three questionsskip any already answered by project context:
95
+ *(Install mode onlyskipped in upgrade mode)*
96
+
97
+ Core questions — skip any already answered by project context:
44
98
 
45
99
  1. **npm scope** — "What npm scope should internal packages use? (e.g., @acme)" Default: derive from product name.
46
100
  2. **Project name** — "What is the human-readable project name?" (for metadata, page titles). Default: from discovery context.
47
101
  3. **Node.js version** — "Target Node.js version?" Default: `>=22`.
48
102
 
103
+ Optional feature question — ask after the core questions:
104
+
105
+ 4. **Frontend UI** — "Will this project have frontend work? If yes, I'll set up the full Tailwind design system and a shared UI component library (`packages/ui/`) with shadcn/ui. (Y/n)" Default: yes. If yes, applies both tailwind-v4 and ui-shared-components together.
106
+
107
+ **Note:** Validated environment variables (env-t3) are always set up — not optional. Every app gets type-safe env validation.
108
+
49
109
  ## Step 5: Scaffold
50
110
 
51
111
  Create the monorepo skeleton by adapting all files from the blueprint. Replace placeholders:
@@ -66,7 +126,7 @@ From `files/root/`, create at project root:
66
126
 
67
127
  From `files/config/`, create:
68
128
  - `config/typescript-config/` — base.json, nextjs.json, react-library.json, package.json
69
- - `config/tailwind-config/` — shared-styles.css, postcss.config.js, package.json
129
+ - `config/tailwind-config/` — shared-styles.css, postcss.config.mjs, package.json
70
130
 
71
131
  ### 5c. Next.js App Shell
72
132
 
@@ -93,9 +153,73 @@ After creating all files:
93
153
  2. Run `pnpm install` to verify the workspace configuration is valid
94
154
  3. Verify the dev server starts: `pnpm dev` (briefly — just check it boots)
95
155
 
156
+ ## Step 5.5: Optional Features
157
+
158
+ Apply the optional features the user said yes to in Step 4. Each feature follows its own blueprint's integration steps but within the same session — no need to run separate scaffold commands.
159
+
160
+ ### 5.5a. Environment Variables (always applied)
161
+
162
+ Follow the `env-t3` blueprint's integration steps:
163
+
164
+ 1. Create `apps/web/src/env/client.ts` and `apps/web/src/env/server.ts` from env-t3 templates
165
+ 2. Replace the foundation's `apps/web/env.ts` with the split pattern
166
+ 3. Update `apps/web/next.config.ts` — replace `import "./env"` with:
167
+ ```typescript
168
+ import "./src/env/server";
169
+ import "./src/env/client";
170
+ ```
171
+ 4. Create `apps/web/.env.example` from env-t3 template — replace `{{APP_NAME}}`
172
+ 5. Create `apps/web/.env.local` (empty)
173
+ 6. Ensure `@t3-oss/env-nextjs` and `zod` are in `apps/web/package.json` dependencies
174
+
175
+ ### 5.5b. Frontend UI Setup (if opted in)
176
+
177
+ When the user opts in to frontend work, apply both tailwind-v4 and ui-shared-components together as a single step.
178
+
179
+ **Tailwind design system** — follow the `tailwind-v4` blueprint's integration steps:
180
+
181
+ 1. Replace `config/tailwind-config/shared-styles.css` with the full version from the tailwind-v4 blueprint (includes `tw-animate-css`, `shadcn/tailwind.css`, `tailwind-scrollbar-hide`, sidebar tokens, chart tokens)
182
+ 2. Merge tailwind-v4 dependencies into `config/tailwind-config/package.json`:
183
+ - Add `@tailwindcss/typography`, `shadcn`, `tailwind-scrollbar-hide`, `tw-animate-css` to `dependencies`
184
+
185
+ **Shared UI package** — follow the `ui-shared-components` blueprint's integration steps:
186
+
187
+ 1. Create `packages/ui/` with all files from the ui blueprint:
188
+ - `package.json` — replace `{{SCOPE}}`
189
+ - `tsconfig.json` — replace `{{SCOPE}}`
190
+ - `components.json`
191
+ - `styles/globals.css` — replace `{{SCOPE}}`
192
+ - `utils/cn.ts`
193
+ - `utils/cva.ts`
194
+ 2. Create empty directories: `packages/ui/components/ui/`, `packages/ui/icons/`, `packages/ui/icons/logos/`
195
+ 3. Update `apps/web/app/globals.css` to import UI styles:
196
+ ```css
197
+ @import "tailwindcss";
198
+ @import "{{SCOPE}}/tailwind-config";
199
+ @import "{{SCOPE}}/ui/styles";
200
+ @plugin "@tailwindcss/typography";
201
+
202
+ @source "../../packages/ui";
203
+ ```
204
+ Compute the `@source` relative path based on the actual directory structure.
205
+
206
+ ### 5.5d. Re-install
207
+
208
+ If any optional features were applied:
209
+ 1. Run `pnpm install` again to wire new workspace dependencies
210
+ 2. Verify `pnpm dev` still boots cleanly
211
+
96
212
  ## Step 6: Update Project Context
97
213
 
98
- Append the `## Foundation` section to `.project-context.md`:
214
+ **This step is mandatory.** The `.project-context.md` file is how other blueprints and future runs of `/scaffold-foundation` (upgrade mode) know what's been set up. Without it, every subsequent blueprint runs blind.
215
+
216
+ If `.project-context.md` does not exist, create it now:
217
+
218
+ ```markdown
219
+ # Project Context
220
+ ```
221
+
222
+ Then append the `## Foundation` section:
99
223
 
100
224
  ```yaml
101
225
  ## Foundation
@@ -103,10 +227,11 @@ monorepo_tool: turborepo
103
227
  package_manager: pnpm
104
228
  npm_scope: "<scope>"
105
229
  node_version: ">=22"
230
+ project_type: monorepo
106
231
  workspaces:
107
232
  apps: ["web"]
108
233
  apis: []
109
- packages: []
234
+ packages: ["ui"] # if frontend UI was applied, otherwise []
110
235
  config: ["typescript-config", "tailwind-config"]
111
236
  framework: next.js (app router)
112
237
  typescript: strict
@@ -117,11 +242,20 @@ module_resolution: node subpath imports (#prefix)
117
242
  foundation_completed: <date>
118
243
  ```
119
244
 
120
- If `.project-context.md` does not exist, create it with the standard header and the Foundation section.
245
+ Then append `## Installed Blueprints` with entries for every feature that was applied:
246
+
247
+ ```markdown
248
+ ## Installed Blueprints
249
+ ```
250
+
251
+ - Always add the `env-t3` project context block (see env-t3 BLUEPRINT.md)
252
+ - If frontend UI was applied: add both the `tailwind-v4` and `ui-shared-components` project context blocks (see their BLUEPRINT.md files)
253
+
254
+ **Verify the file exists and is well-formed before proceeding to Step 7.** If it's missing or empty, that is a bug — fix it before summarizing.
121
255
 
122
- ### Create Maintenance Skill
256
+ ### Create Maintenance Skills
123
257
 
124
- Create a project-level maintenance skill for the monorepo foundation:
258
+ Create the foundation maintenance skill:
125
259
 
126
260
  **File:** `<project>/.claude/skills/monorepo-maintenance/SKILL.md`
127
261
 
@@ -141,19 +275,35 @@ user-invocable: false
141
275
  - Keep `turbo.json` tasks with `cache: false` for any task with side effects (migrations, code generation)
142
276
  ```
143
277
 
278
+ Also create maintenance skills:
279
+ - Always create `env-maintenance/SKILL.md` (see scaffold-env skill for template)
280
+ - If frontend UI: create both `tailwind-maintenance/SKILL.md` and `ui-maintenance/SKILL.md` (see scaffold-tailwind and scaffold-ui skills for templates)
281
+
144
282
  ## Step 7: Summarize
145
283
 
146
284
  Tell the user:
147
285
 
148
- - Project structure overview (directory tree)
286
+ ### Install Mode Summary
287
+
288
+ - Project structure overview (directory tree — include optional features that were applied)
149
289
  - What was configured (scope, Node version, tooling)
290
+ - Which optional features were included
150
291
  - How to start development: `pnpm dev`
151
- - Available feature blueprints to install next
152
- - Suggest: "Run `/scaffold-auth` to add authentication. Other feature blueprints: ui-shared-components, tailwind-v4, db-drizzle-postgres."
292
+ - If frontend UI was set up: how to add shadcn components (`cd packages/ui && pnpm dlx shadcn@latest add button`)
293
+ - Available feature blueprints to install next: `/scaffold-db`, `/scaffold-auth`
294
+
295
+ ### Upgrade Mode Summary
296
+
297
+ - What was updated (list files that changed)
298
+ - What new features were added (env, tailwind, UI)
299
+ - Any manual steps remaining
300
+ - Suggest next steps based on what's still not installed
153
301
 
154
302
  ## Important Notes
155
303
 
156
304
  - Never overwrite existing files without asking.
157
305
  - Preserve all `// CONFIGURE:` comments in generated files so the user can find customization points.
158
- - The Tailwind config is intentionally minimal — the UI feature blueprint extends it with shadcn, animations, and component-specific styles.
306
+ - In upgrade mode, be conservativeonly modify files that the blueprints own. Don't touch user-customized files (check for differences from the template before replacing).
307
+ - If the user has customized colors in `shared-styles.css` or added variables to `env.ts`, ask before replacing. Offer to merge their customizations into the new version.
159
308
  - Feature blueprints will add scripts to root `package.json` and tasks to `turbo.json` — the foundation provides the base that they extend.
309
+ - The individual `/scaffold-env`, `/scaffold-tailwind`, and `/scaffold-ui` skills still exist for projects that didn't use foundation or want to add features later. The foundation's optional feature steps follow the same blueprints — no duplication.
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import pc3 from "picocolors";
6
6
 
7
7
  // src/constants.ts
8
8
  var API_URL = process.env["WITHMATA_API_URL"] || "https://blueprints.withmata.dev";
9
- var VERSION = "0.3.2";
9
+ var VERSION = "0.3.3";
10
10
 
11
11
  // src/steps/auth.ts
12
12
  import { log } from "@clack/prompts";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@withmata/blueprints",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "description": "Set up AI-powered project blueprints for Claude Code, OpenCode, and Cursor",
5
5
  "type": "module",
6
6
  "bin": {