@withmata/blueprints 0.5.0 → 3.0.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/.claude/skills/audit/SKILL.md +6 -6
- package/.claude/skills/blueprint-catalog/SKILL.md +4 -0
- package/.claude/skills/design-system/SKILL.md +11 -5
- package/.claude/skills/reflect/SKILL.md +119 -0
- package/.claude/skills/scaffold-env/SKILL.md +10 -13
- package/.claude/skills/scaffold-foundation/SKILL.md +5 -6
- package/.claude/skills/scaffold-infisical/SKILL.md +173 -0
- package/ENGINEERING.md +1 -1
- package/blueprints/features/env-t3/BLUEPRINT.md +26 -33
- package/blueprints/features/secrets-infisical/BLUEPRINT.md +295 -0
- package/blueprints/features/secrets-infisical/files/docs/INFISICAL.md +119 -0
- package/blueprints/features/secrets-infisical/files/scripts/infisical-map.sh +115 -0
- package/blueprints/features/secrets-infisical/files/scripts/infisical-sync.sh +89 -0
- package/blueprints/thinking/thinking-partner/BLUEPRINT.md +333 -0
- package/blueprints/thinking/thinking-partner/templates/_patterns.md +61 -0
- package/blueprints/thinking/thinking-partner/templates/reflection-template.md +131 -0
- package/dist/index.js +11 -2
- package/package.json +1 -1
- package/blueprints/features/env-t3/files/nextjs/.env.example +0 -17
- package/blueprints/features/env-t3/files/server/.env.example +0 -14
|
@@ -76,7 +76,7 @@ Regardless of whether project context exists, explore the actual project to unde
|
|
|
76
76
|
### 3f. Environment & Validation
|
|
77
77
|
|
|
78
78
|
- How are env vars handled? t3-env with client/server split, single env.ts, raw `process.env`, dotenv only?
|
|
79
|
-
-
|
|
79
|
+
- Are the Zod schema files well-commented as the variable registry? (No `.env.example` — values come from Infisical or the platform.)
|
|
80
80
|
- Is there build-time validation (env imported in `next.config.ts`)?
|
|
81
81
|
|
|
82
82
|
### 3g. Code Quality
|
|
@@ -172,10 +172,10 @@ For each installed blueprint with updates, show detailed information. Use plain
|
|
|
172
172
|
│ File: src/env/server.ts
|
|
173
173
|
│
|
|
174
174
|
│ • Clearer documentation for teammates
|
|
175
|
-
│ The
|
|
176
|
-
│
|
|
177
|
-
│
|
|
178
|
-
│ File:
|
|
175
|
+
│ The env schema files now document each variable
|
|
176
|
+
│ (purpose, local/production hints) — the schema is
|
|
177
|
+
│ the registry; values come from Infisical.
|
|
178
|
+
│ File: src/env/server.ts
|
|
179
179
|
│
|
|
180
180
|
│ To apply: /scaffold-env
|
|
181
181
|
└─────────────────────────────────────────────────────
|
|
@@ -316,7 +316,7 @@ What was done
|
|
|
316
316
|
Blueprint upgrades:
|
|
317
317
|
✓ foundation — consolidated maintenance rules,
|
|
318
318
|
cleaned up legacy patterns
|
|
319
|
-
✓ env-t3 — updated server.ts
|
|
319
|
+
✓ env-t3 — updated server.ts schema (the registry)
|
|
320
320
|
✓ tailwind-v4 — updated shared-styles.css, added
|
|
321
321
|
tailwind-scrollbar-hide
|
|
322
322
|
|
|
@@ -21,6 +21,7 @@ user-invocable: false
|
|
|
21
21
|
| Environment Variables | Feature | T3 Env + Zod: validated, type-safe env vars for Next.js (client/server split) and backend apps. | None | `/scaffold-env` |
|
|
22
22
|
| Tailwind v4 Design System | Feature | Full Tailwind v4 upgrade: shadcn tokens, shadows, easing, animations, sidebar/chart tokens, dark mode. Auto-detects `/design-system` output. | Foundation (recommended) | `/scaffold-tailwind` |
|
|
23
23
|
| UI Shared Components | Feature | 31 base components (Base UI + Phosphor): compound patterns, form system, app shell, data display. Auto-installs Tailwind. | Tailwind v4 (auto-installed) | `/scaffold-ui` |
|
|
24
|
+
| Secrets (Infisical) | Feature | Centralized secret management: /shared domain folders with environment-aware references, placeholder injection, and `infisical run` wiring. | Environment Variables (env-t3) | `/scaffold-infisical` |
|
|
24
25
|
|
|
25
26
|
## Project Context
|
|
26
27
|
|
|
@@ -50,6 +51,8 @@ Suggest a blueprint when you observe these signals. Be helpful, not pushy — me
|
|
|
50
51
|
|
|
51
52
|
**`/scaffold-ui`** — User mentions shared components, UI package, component library, shadcn in monorepo, or needs to share components across apps. Recommend `/scaffold-tailwind` first if not installed.
|
|
52
53
|
|
|
54
|
+
**`/scaffold-infisical`** — User mentions Infisical, secret management, shared secrets across apps, secret references, rotating keys in one place, or has the same secret duplicated across multiple `.env`/Infisical folders. Requires `/scaffold-env` first (reads the T3 schemas).
|
|
55
|
+
|
|
53
56
|
**`/audit`** — User asks "what should I do next?", wants to understand their project's state, or has hand-rolled infrastructure that a blueprint could improve.
|
|
54
57
|
|
|
55
58
|
## Lifecycle & Dependencies
|
|
@@ -64,6 +67,7 @@ Discovery → Foundation → Features is the recommended flow, but blueprints ca
|
|
|
64
67
|
- **Need marketing pages:** Run `/copywrite-landing` for landing pages, `/copywrite` for other pages (pricing, about, features)
|
|
65
68
|
- **Dependencies:** `/scaffold-auth` works best after `/scaffold-db` (auth builds on db patterns). `/scaffold-ui` auto-installs `/scaffold-tailwind`. `/scaffold-tailwind` auto-detects design system tokens.
|
|
66
69
|
- **Environment setup:** `/scaffold-env` is recommended for all projects — it's standalone
|
|
70
|
+
- **Secret management:** after `/scaffold-env`, run `/scaffold-infisical` to move secret delivery into Infisical with a shared single-source-of-truth structure (env-aware references). Best for multi-app/multi-environment projects
|
|
67
71
|
|
|
68
72
|
## Important
|
|
69
73
|
|
|
@@ -949,11 +949,17 @@ Tell the user:
|
|
|
949
949
|
<link href="https://fonts.googleapis.com/css2?family=..." rel="stylesheet" />
|
|
950
950
|
```
|
|
951
951
|
- **Tailwind sync status** — whether tokens were synced to the scaffolded `shared-styles.css`, or whether the user needs to run `/scaffold-tailwind` first
|
|
952
|
-
- **
|
|
953
|
-
- If tailwind is
|
|
954
|
-
- If
|
|
955
|
-
- If
|
|
956
|
-
-
|
|
952
|
+
- **Apply to existing project** — this is the most important post-generation step:
|
|
953
|
+
- If tailwind is scaffolded: "Want me to apply the new design tokens to your project now? I'll copy `docs/design/shared-styles.css` to `config/tailwind-config/shared-styles.css` (monorepo) or `src/styles/shared-styles.css` (single-repo). Your existing UI components will immediately pick up the new colors, typography, shadows, and radius on the next dev server restart."
|
|
954
|
+
- If the user confirms, copy the file and report what changed (new colors, new fonts, new shadows, etc.)
|
|
955
|
+
- If tailwind is NOT scaffolded: "Run `/scaffold-tailwind` — it will auto-detect your design tokens from `docs/design/shared-styles.css` and use them instead of the generic defaults."
|
|
956
|
+
- If tailwind is scaffolded but UI is not: "Run `/scaffold-ui` — it will auto-install Tailwind first (using your custom tokens) and then scaffold 31 components that inherit your design system."
|
|
957
|
+
- If both are already scaffolded and tokens were synced: "Your design tokens are live. All 31 UI components will reflect your new visual identity on the next dev server restart — new colors, typography, shadows, and radius across every button, card, input, and modal."
|
|
958
|
+
- **Suggested UI improvements** — based on the design system decisions, note any component-specific suggestions. Be specific:
|
|
959
|
+
- "Your round personality suggests pill-shaped buttons — the current `rounded-4xl` in button.tsx already matches."
|
|
960
|
+
- "Consider adjusting card shadows to use the tinted shadow scale for a warmer feel."
|
|
961
|
+
- "The sidebar tokens now use your brand colors — the sidebar will match the rest of the app."
|
|
962
|
+
- "Your chosen font needs to be imported — add the Google Fonts link to `layout.tsx`."
|
|
957
963
|
|
|
958
964
|
## Important Rules
|
|
959
965
|
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: reflect
|
|
3
|
+
description: Run a structured thinking-partner session on any personal topic — life, relationships, career, decisions — and produce a reflection document capturing the journey
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Run a Reflection Session
|
|
7
|
+
|
|
8
|
+
Run a deep, structured thinking session with the user on any personal topic they bring — relationships, career moves, life direction, family decisions, big purchases, identity questions, anything. This is NOT for software development, product discovery, or business strategy — it's for the user thinking through their own life with a partner that pushes, researches, and applies real frameworks.
|
|
9
|
+
|
|
10
|
+
The session produces a reflection document that captures the *walkthrough*, not just the conclusion.
|
|
11
|
+
|
|
12
|
+
## Step 1: Read the Blueprint
|
|
13
|
+
|
|
14
|
+
Read the full thinking-partner blueprint and all templates:
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
~/.withmata/blueprints/blueprints/thinking/thinking-partner/BLUEPRINT.md
|
|
18
|
+
~/.withmata/blueprints/blueprints/thinking/thinking-partner/templates/*
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
If not found, run `npx @withmata/blueprints` to install.
|
|
22
|
+
|
|
23
|
+
The BLUEPRINT.md contains the full methodology: phased session structure, framework library, operating principles, research strategy, challenge patterns, and quality checkpoints. Follow it precisely.
|
|
24
|
+
|
|
25
|
+
## Step 2: Check for Prior Reflections
|
|
26
|
+
|
|
27
|
+
Check whether a `reflections/` folder exists in the current working directory.
|
|
28
|
+
|
|
29
|
+
- **If it doesn't exist:** This is the user's first session. Note that you'll create the folder when generating the document. Do NOT create `_patterns.md` after a first session.
|
|
30
|
+
- **If it does exist and contains prior reflections:** Read each prior `reflection-*.md` file (or at least skim the headings — direction, what they're sitting with, what to revisit). Also read `_patterns.md` if it exists.
|
|
31
|
+
- Briefly acknowledge to the user what you noticed: e.g. "I see you've reflected on [topic] before, and a pattern that came up was [X]. Just flagging — let me know if it's relevant to today, or if today is something different."
|
|
32
|
+
- Do not assume continuity. The user might be here for something completely different.
|
|
33
|
+
|
|
34
|
+
## Step 3: Open the Session
|
|
35
|
+
|
|
36
|
+
Open with the Phase 1 questions from the blueprint, in order:
|
|
37
|
+
|
|
38
|
+
1. "What's on your mind? What do you want to think through?"
|
|
39
|
+
2. "What's the goal here? What would 'figured this out' look like?"
|
|
40
|
+
3. "Why is this the goal? Why now?"
|
|
41
|
+
|
|
42
|
+
Stay in Phase 1 until the *real* question — not the surface question — has been named. This often takes longer than feels comfortable. That's expected.
|
|
43
|
+
|
|
44
|
+
## Step 4: Run the Session
|
|
45
|
+
|
|
46
|
+
Follow the full 5-phase process documented in BLUEPRINT.md. The blueprint is the source of truth for: phase structure, framework selection and use, when to research, how to push back, and quality gates.
|
|
47
|
+
|
|
48
|
+
Quick reference for the phases:
|
|
49
|
+
1. **Goal & Why** — surface the real question
|
|
50
|
+
2. **Reality & Context** — facts, evidence, surfaced assumptions; auto-research as needed
|
|
51
|
+
3. **Framework Exploration** — apply 2–4 named frameworks chosen for this topic
|
|
52
|
+
4. **Challenge & Steelman** — pre-mortem the chosen path; steelman the rejected path
|
|
53
|
+
5. **Direction & Reflection Document** — only when the user signals readiness
|
|
54
|
+
|
|
55
|
+
Critical reminders from the blueprint:
|
|
56
|
+
- **Always name the framework you're using** ("I'm going to use Steelmanning here, which means...") — the user is learning these tools.
|
|
57
|
+
- **Auto-research personal topics too** — base rates, what experts actually say, market data, what the research really shows. Don't ask permission.
|
|
58
|
+
- **Recommend when the analysis points somewhere** — don't hide behind "only you can decide." The user takes recommendations as input.
|
|
59
|
+
- **Sessions are not time-boxed** — the user signals when they're done.
|
|
60
|
+
- **Maximum 4 frameworks per session** — two well-applied beats six glancing.
|
|
61
|
+
|
|
62
|
+
## Step 5: Verify Quality Checkpoints
|
|
63
|
+
|
|
64
|
+
Before generating the reflection document, verify ALL quality checkpoints listed in BLUEPRINT.md pass. If any fail, keep working — do not rush to generate the document. Specifically:
|
|
65
|
+
|
|
66
|
+
- The *real* question is named (not just the surface frame)
|
|
67
|
+
- Concrete events have replaced interpretations
|
|
68
|
+
- Major factual claims have been checked, not assumed
|
|
69
|
+
- At least 2 frameworks have been applied and named
|
|
70
|
+
- Both the chosen path AND the rejected path have been pressure-tested
|
|
71
|
+
- The user has articulated direction in their own words
|
|
72
|
+
|
|
73
|
+
## Step 6: Generate the Reflection Document
|
|
74
|
+
|
|
75
|
+
Once the user signals readiness AND the quality checkpoints pass:
|
|
76
|
+
|
|
77
|
+
1. Ask the closing questions:
|
|
78
|
+
- "What's the direction you're taking from this?"
|
|
79
|
+
- "What's the *why* in one sentence?"
|
|
80
|
+
- "What are you going to revisit, and when?"
|
|
81
|
+
|
|
82
|
+
2. Determine the output path:
|
|
83
|
+
- Default: `reflections/` in the current working directory
|
|
84
|
+
- Ask once if the user wants it elsewhere (e.g. `~/journal/reflections/`); remember for the rest of the session
|
|
85
|
+
- Create the folder if it doesn't exist
|
|
86
|
+
|
|
87
|
+
3. Generate a topic slug (lowercase, hyphenated, descriptive — e.g. `leaving-current-job`, `whether-to-have-kids`, `how-to-respond-to-mom`).
|
|
88
|
+
|
|
89
|
+
4. Write the document to:
|
|
90
|
+
```
|
|
91
|
+
reflections/reflection-[topic-slug]-[YYYY-MM-DD].md
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
5. Use `templates/reflection-template.md` from the blueprint as the structural guide. Fill it with the actual content from this session — the narrative, the frameworks that were used, the quotes from the user, the direction, the recommendation (if you made one).
|
|
95
|
+
|
|
96
|
+
The reflection document is a NARRATIVE WALKTHROUGH, not a summary. It should read as the story of how the thinking moved. See "Document Quality Checklist" in BLUEPRINT.md.
|
|
97
|
+
|
|
98
|
+
## Step 7: Update `_patterns.md` (2nd+ session only)
|
|
99
|
+
|
|
100
|
+
If `reflections/` already contained at least one prior `reflection-*.md` file when the session started, update (or create) `reflections/_patterns.md` using `templates/_patterns.md` as the structural guide.
|
|
101
|
+
|
|
102
|
+
- **First time creating it (2nd session):** populate from this session + the prior session(s) you read in Step 2.
|
|
103
|
+
- **Updating an existing one:** add to it additively. Don't rewrite. New theme? Add it. New blind spot noticed? Add it. Update "sessions to date", "most recent", and the "Direction History" table.
|
|
104
|
+
|
|
105
|
+
Be honest in `_patterns.md`. Don't fabricate patterns from a single data point. If you only have 2 sessions and they're on totally different topics, say so — note "patterns will become clearer with more sessions" and leave most sections sparse.
|
|
106
|
+
|
|
107
|
+
## Step 8: Close
|
|
108
|
+
|
|
109
|
+
Tell the user:
|
|
110
|
+
|
|
111
|
+
- Where the reflection document was written (full path)
|
|
112
|
+
- One sentence on what the document captures
|
|
113
|
+
- If `_patterns.md` was created/updated, note that and what was added
|
|
114
|
+
- Remind them: this is their artifact. They can edit it, share it, or revisit it whenever the situation looks different
|
|
115
|
+
|
|
116
|
+
Do NOT:
|
|
117
|
+
- Suggest a "next blueprint" or "next step" — this is not part of a lifecycle
|
|
118
|
+
- Write to `.project-context.md` — this blueprint is intentionally outside the product-build system
|
|
119
|
+
- Push the user toward another session — let them come back when they want to
|
|
@@ -54,7 +54,6 @@ If `env-t3` is found in `.project-context.md` under `## Installed Blueprints`, s
|
|
|
54
54
|
|
|
55
55
|
Updated templates:
|
|
56
56
|
☐ src/env/server.ts — updated Zod patterns
|
|
57
|
-
☐ .env.example — new documentation sections
|
|
58
57
|
|
|
59
58
|
New files available:
|
|
60
59
|
☐ apis/server/src/env.ts — backend env validation (not set up previously)
|
|
@@ -100,7 +99,6 @@ Find all applications that need env setup:
|
|
|
100
99
|
For each app found:
|
|
101
100
|
- Does `env.ts` already exist? (Foundation blueprint creates a basic one)
|
|
102
101
|
- Does `src/env/` directory exist? (Already has the split pattern)
|
|
103
|
-
- Does `.env.example` exist?
|
|
104
102
|
- Does `next.config.ts` already import env files?
|
|
105
103
|
- Are `@t3-oss/env-nextjs` or `@t3-oss/env-core` already installed?
|
|
106
104
|
|
|
@@ -144,9 +142,8 @@ For each Next.js app:
|
|
|
144
142
|
3. Update `next.config.ts` — add imports at the top
|
|
145
143
|
|
|
146
144
|
**For all Next.js apps:**
|
|
147
|
-
4. Create `.env.
|
|
148
|
-
5.
|
|
149
|
-
6. If other blueprints are installed, merge their env vars into the appropriate schema
|
|
145
|
+
4. Create `.env.local` (empty file)
|
|
146
|
+
5. If other blueprints are installed, merge their env vars into the appropriate schema
|
|
150
147
|
|
|
151
148
|
### 4b. Backend Apps
|
|
152
149
|
|
|
@@ -157,9 +154,8 @@ For each backend app:
|
|
|
157
154
|
```typescript
|
|
158
155
|
import { env } from "./env.js";
|
|
159
156
|
```
|
|
160
|
-
3. Create `.env.
|
|
161
|
-
4.
|
|
162
|
-
5. If the app has hardcoded `process.env.PORT` or similar, refactor to use `env.PORT`
|
|
157
|
+
3. Create `.env.local` (empty file)
|
|
158
|
+
4. If the app has hardcoded `process.env.PORT` or similar, refactor to use `env.PORT`
|
|
163
159
|
|
|
164
160
|
### 4c. Dependency Installation
|
|
165
161
|
|
|
@@ -209,11 +205,11 @@ Then append:
|
|
|
209
205
|
|
|
210
206
|
```markdown
|
|
211
207
|
### env-t3 maintenance
|
|
212
|
-
-
|
|
208
|
+
- The Zod schema files (client.ts/server.ts/env.ts) are the registry of env vars — keep them well-commented. There is no .env.example; values come from Infisical or the platform.
|
|
209
|
+
- After adding a new env var: add it to the env schema file (client.ts or server.ts) and, if used locally, .env.local
|
|
213
210
|
- NEXT_PUBLIC_* vars go in env/client.ts with explicit runtimeEnv mapping; server vars go in env/server.ts
|
|
214
|
-
- After removing an env var: remove from schema
|
|
211
|
+
- After removing an env var: remove from the schema and .env.local
|
|
215
212
|
- Never access process.env directly — always use the typed env objects (clientEnv, serverEnv, or env)
|
|
216
|
-
- Keep .env.example documented with section headers and local/production hints
|
|
217
213
|
```
|
|
218
214
|
|
|
219
215
|
If a `### env-t3 maintenance` section already exists in the file, skip — do not duplicate.
|
|
@@ -253,9 +249,10 @@ import { env } from "./env.js";
|
|
|
253
249
|
|
|
254
250
|
### Next Steps
|
|
255
251
|
|
|
256
|
-
- Fill in `.env.local` with your actual values (
|
|
257
|
-
- As you add features, add their env vars to the schema files
|
|
252
|
+
- Fill in `.env.local` with your actual values (the env schema files document what's needed), or run via `infisical run` once `/scaffold-infisical` is set up
|
|
253
|
+
- As you add features, add their env vars to the schema files (the registry)
|
|
258
254
|
- Run `bun dev` to verify env validation passes
|
|
255
|
+
- For multi-app/multi-environment projects, run `/scaffold-infisical` next to centralize secret delivery (a /shared single source of truth with environment-aware references) instead of per-app `.env` files
|
|
259
256
|
|
|
260
257
|
## Important Notes
|
|
261
258
|
|
|
@@ -205,9 +205,8 @@ Follow the `env-t3` blueprint's integration steps:
|
|
|
205
205
|
import "./src/env/server";
|
|
206
206
|
import "./src/env/client";
|
|
207
207
|
```
|
|
208
|
-
4. Create `apps/web/.env.
|
|
209
|
-
5.
|
|
210
|
-
6. Ensure `@t3-oss/env-nextjs` and `zod` are in `apps/web/package.json` dependencies
|
|
208
|
+
4. Create `apps/web/.env.local` (empty)
|
|
209
|
+
5. Ensure `@t3-oss/env-nextjs` and `zod` are in `apps/web/package.json` dependencies
|
|
211
210
|
|
|
212
211
|
### 5.5b. Frontend UI Setup (if opted in)
|
|
213
212
|
|
|
@@ -318,11 +317,11 @@ Then append sections for each blueprint applied in this run. Foundation always a
|
|
|
318
317
|
- Keep `turbo.json` tasks with `cache: false` for any task with side effects (migrations, code generation)
|
|
319
318
|
|
|
320
319
|
### env-t3 maintenance
|
|
321
|
-
-
|
|
320
|
+
- The Zod schema files (client.ts/server.ts/env.ts) are the registry of env vars — keep them well-commented. There is no .env.example; values come from Infisical or the platform.
|
|
321
|
+
- After adding a new env var: add it to the env schema file (client.ts or server.ts) and, if used locally, .env.local
|
|
322
322
|
- NEXT_PUBLIC_* vars go in env/client.ts with explicit runtimeEnv mapping; server vars go in env/server.ts
|
|
323
|
-
- After removing an env var: remove from schema
|
|
323
|
+
- After removing an env var: remove from the schema and .env.local
|
|
324
324
|
- Never access process.env directly — always use the typed env objects (clientEnv, serverEnv, or env)
|
|
325
|
-
- Keep .env.example documented with section headers and local/production hints
|
|
326
325
|
```
|
|
327
326
|
|
|
328
327
|
If frontend UI was applied, also append:
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: scaffold-infisical
|
|
3
|
+
description: Scaffold Infisical secret management — a /shared domain structure with environment-aware references, placeholder injection, and infisical run wiring — driven by the project's T3 env schemas
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Scaffold Infisical Secrets Blueprint
|
|
7
|
+
|
|
8
|
+
Scaffold the `secrets-infisical` blueprint into the current project. Read the full blueprint first, then adapt it to this project's stack. This blueprint **depends on `env-t3`** — it reads the T3 Zod schemas to learn which variables exist, then builds the Infisical structure around them.
|
|
9
|
+
|
|
10
|
+
## Step 1: Read the Blueprint
|
|
11
|
+
|
|
12
|
+
Read the full BLUEPRINT.md and all template files:
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
~/.withmata/blueprints/blueprints/features/secrets-infisical/BLUEPRINT.md
|
|
16
|
+
~/.withmata/blueprints/blueprints/features/secrets-infisical/files/**/*
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
If not found at these paths, run `npx @withmata/blueprints` to install.
|
|
20
|
+
|
|
21
|
+
## Step 1.5: Read Project Context
|
|
22
|
+
|
|
23
|
+
Check if `.project-context.md` exists in the target project root:
|
|
24
|
+
|
|
25
|
+
- **If it exists**: read it to understand:
|
|
26
|
+
- Confirm `env-t3` is installed. If NOT, **stop** and tell the user to run `/scaffold-env` first (hard dependency — the T3 schemas are the source of truth for the variable list).
|
|
27
|
+
- Note `db-drizzle-postgres` / `auth-better-auth` — they define the natural domains (databases, auth).
|
|
28
|
+
- npm scope, workspace layout, project type.
|
|
29
|
+
- If `secrets-infisical` is already listed → switch to upgrade mode (Step 1.6).
|
|
30
|
+
|
|
31
|
+
- **If it does not exist**: env-t3 cannot be confirmed installed. Ask the user whether the project has T3 env schemas; if not, point them to `/scaffold-env` first.
|
|
32
|
+
|
|
33
|
+
## Step 1.6: Upgrade Mode
|
|
34
|
+
|
|
35
|
+
If `secrets-infisical` is found in `.project-context.md` under `## Installed Blueprints`:
|
|
36
|
+
|
|
37
|
+
1. Read the recorded domain map, environments, and apps wired.
|
|
38
|
+
2. Re-read the T3 schemas; diff against the recorded shared keys.
|
|
39
|
+
3. For each NEW var: classify (shared vs app-native), pick its domain, plan a placeholder in `/shared/<domain>` for every env + an env-aware reference in each consuming app folder.
|
|
40
|
+
4. Present additions; never delete user secrets without confirmation.
|
|
41
|
+
5. Update `scripts/infisical-map.sh`, re-run the sync script in dry-run, then apply.
|
|
42
|
+
6. Update `installed_at`; skip to Step 9 (Output Summary).
|
|
43
|
+
|
|
44
|
+
## Step 0: Preconditions (verify before any changes)
|
|
45
|
+
|
|
46
|
+
- `infisical --version` works (else: `brew install infisical/get-cli/infisical`).
|
|
47
|
+
- `infisical login` done.
|
|
48
|
+
- An Infisical project exists and `infisical init` has produced a committed `.infisical.json` in each app/package dir (workspaceId only — no secrets).
|
|
49
|
+
- The project's environments are known (default `dev`, `staging`, `prod`). Confirm with the user; capture the exact environment **slugs** — these go into the reference prefix and MUST match Infisical's env slugs.
|
|
50
|
+
|
|
51
|
+
## Step 2: Understand the Target Project
|
|
52
|
+
|
|
53
|
+
- Detect project type (monorepo vs single-repo) — reuse the same detection as scaffold-env (`turbo.json`, `"workspaces"`, `pnpm-workspace.yaml`, etc.).
|
|
54
|
+
- Discover apps/packages that need secrets (`apps/web`, `apps/server`, `packages/db`, …).
|
|
55
|
+
- **Read the T3 env schemas** in each (`env/client.ts`, `env/server.ts`, backend `env.ts`, plus how `packages/db` reads `process.env`) → the full variable list per app.
|
|
56
|
+
|
|
57
|
+
## Step 3: Derive and Confirm the Plan (do not apply yet)
|
|
58
|
+
|
|
59
|
+
- Classify each var:
|
|
60
|
+
- **app-native** (`NEXT_PUBLIC_*`, `PORT`, single-app config) → real value in the app folder, never referenced.
|
|
61
|
+
- **shared** (DB URLs, API keys, anything >1 app uses, or a domain's canonical key) → goes in `/shared/<domain>` + an env-aware reference in each consuming app.
|
|
62
|
+
- When ambiguous, ask.
|
|
63
|
+
- Group shared vars into domains (derive from installed blueprints + schema groups; see the BLUEPRINT domain table).
|
|
64
|
+
- Build a dry-run plan: folders, shared placeholders, app references, app-native vars left in place.
|
|
65
|
+
- **Present the domain map + plan and ask the user to confirm/edit.** Encourage verbose, self-describing names (`IMAGE_BUCKET_ENDPOINT`, not `STORAGE_ENDPOINT`). Offer an optional rename/cleanup sub-step if the project has vague names or dead vars.
|
|
66
|
+
|
|
67
|
+
## Step 4: Generate the Sync Script + Data Map
|
|
68
|
+
|
|
69
|
+
- Write `scripts/infisical-sync.sh` (idempotent, dry-run by default, `APPLY=1` to apply, loops the environments list) and `scripts/infisical-map.sh` (the confirmed `ENVIRONMENTS`, `DOMAINS`, `APP_PATHS`, `SHARED_MAP`, `REF_MAP`).
|
|
70
|
+
- The reference helper MUST emit the env-prefixed form, substituting the current loop environment's slug:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
REF() { printf '${%s.shared.%s.%s}' "$ENV" "$1" "$2"; } # $ENV is the slug
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
- Shared placeholders use the `REPLACE_ME` sentinel (or sensible non-secret defaults). Never overwrite an existing value.
|
|
77
|
+
- `chmod +x scripts/infisical-sync.sh`.
|
|
78
|
+
|
|
79
|
+
## Step 5: Apply
|
|
80
|
+
|
|
81
|
+
- Run dry-run (`APPLY=0`), show the plan, get the OK, then run with `APPLY=1`. The script loops every environment.
|
|
82
|
+
|
|
83
|
+
## Step 6: Wire package.json
|
|
84
|
+
|
|
85
|
+
- Add/adjust `infisical run --path=/apps/<app> --env=<env>` wrappers in dev/run scripts; add `:dev` variants for `packages/db` scripts. Leave production scripts clean (the host injects Infisical).
|
|
86
|
+
|
|
87
|
+
## Step 7: Verify (do not skip)
|
|
88
|
+
|
|
89
|
+
For at least the dev environment, resolve a reference end to end:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
infisical run --path=/apps/server --env=dev -- printenv CORE_DATABASE_URL
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
- Prints a value → good.
|
|
96
|
+
- Prints the literal `${dev.shared...}` → the reference is malformed or the shared key/folder is missing. Fix before continuing. (Most common past failure: the bare `${shared...}` form without the env slug.)
|
|
97
|
+
|
|
98
|
+
## Step 8: Record + Maintenance Skill
|
|
99
|
+
|
|
100
|
+
Append an entry to `.project-context.md` under `## Installed Blueprints`:
|
|
101
|
+
|
|
102
|
+
```yaml
|
|
103
|
+
### secrets-infisical
|
|
104
|
+
blueprint: secrets-infisical
|
|
105
|
+
installed_at: <date>
|
|
106
|
+
choices:
|
|
107
|
+
placeholder_sentinel: REPLACE_ME
|
|
108
|
+
script_language: bash
|
|
109
|
+
environments:
|
|
110
|
+
- <env slugs>
|
|
111
|
+
domain_map:
|
|
112
|
+
<domain>: [<keys>]
|
|
113
|
+
apps_wired:
|
|
114
|
+
- path: <appPath>
|
|
115
|
+
references: [<domains>]
|
|
116
|
+
script_path: scripts/infisical-sync.sh
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
If `.project-context.md` does not exist, create it with the standard header and the Installed Blueprints section.
|
|
120
|
+
|
|
121
|
+
### Create Maintenance Skill
|
|
122
|
+
|
|
123
|
+
Append to the shared project-level maintenance skill at `<project>/.claude/skills/project-maintenance/SKILL.md`. If the file does not exist, create it with frontmatter:
|
|
124
|
+
|
|
125
|
+
```yaml
|
|
126
|
+
---
|
|
127
|
+
name: project-maintenance
|
|
128
|
+
description: Maintenance rules for all installed blueprints. Invoke when modifying schemas, env vars, auth config, workspace configs, UI components, or Tailwind tokens.
|
|
129
|
+
user-invocable: false
|
|
130
|
+
---
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Then append (skip if `### secrets-infisical maintenance` already exists — do not duplicate):
|
|
134
|
+
|
|
135
|
+
```markdown
|
|
136
|
+
### secrets-infisical maintenance
|
|
137
|
+
- Adding a SHARED env var (used by >1 app, or a domain's canonical value):
|
|
138
|
+
1. Add the key to its `/shared/<domain>` folder in EVERY environment, set to
|
|
139
|
+
`REPLACE_ME` (or a non-secret default).
|
|
140
|
+
2. Add an environment-aware reference `${<env>.shared.<domain>.<KEY>}` in each
|
|
141
|
+
consuming app/package folder, for every environment.
|
|
142
|
+
3. Add the key to scripts/infisical-map.sh (SHARED_MAP + REF_MAP) and re-run
|
|
143
|
+
`APPLY=1 ./scripts/infisical-sync.sh`.
|
|
144
|
+
4. Tell the human which `/shared/<domain>/<KEY>` placeholders to fill.
|
|
145
|
+
- Adding an APP-NATIVE var (PORT, NEXT_PUBLIC_*, single-app config): set it
|
|
146
|
+
directly in that app's Infisical folder as a real value — do NOT create a
|
|
147
|
+
shared key or reference.
|
|
148
|
+
- Reference syntax is ALWAYS `${<env-slug>.shared.<domain>.<KEY>}` where the slug
|
|
149
|
+
matches the environment the reference lives in. The bare `${shared...}` form
|
|
150
|
+
DOES NOT resolve. Verify with:
|
|
151
|
+
`infisical run --path=/apps/<app> --env=dev -- printenv <KEY>`.
|
|
152
|
+
- Rotating a secret: edit the single `/shared/<domain>/<KEY>` value; all
|
|
153
|
+
referencing apps inherit it. Never edit the value in an app folder.
|
|
154
|
+
- Removing a var: delete the shared key AND every app reference to it; remove from
|
|
155
|
+
infisical-map.sh.
|
|
156
|
+
- Never commit real secret values. `.infisical.json` is safe to commit; `.env*`
|
|
157
|
+
stays gitignored.
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Step 9: Output Summary
|
|
161
|
+
|
|
162
|
+
- List files created/modified, with a one-line description each.
|
|
163
|
+
- Print the full domain map and the per-app reference list.
|
|
164
|
+
- Print the app-native vars as "set directly — not referenced."
|
|
165
|
+
- Print the **`REPLACE_ME` checklist**: every `/shared/<domain>/<KEY>` still set to the placeholder, per environment, so the user knows exactly what to paste into the Infisical dashboard.
|
|
166
|
+
- Remind: real values are pasted in Infisical; the agent never sets them.
|
|
167
|
+
|
|
168
|
+
## Important Notes
|
|
169
|
+
|
|
170
|
+
- The reference slug MUST match the environment it lives in. The script iterates per env and substitutes `$ENV` into both `--env` and the reference string.
|
|
171
|
+
- Never write real secret values — only placeholders and plumbing.
|
|
172
|
+
- `.infisical.json` is safe to commit; `.env*` stays gitignored.
|
|
173
|
+
- Idempotent: re-running the sync script must be safe — `stub` only sets when empty, `link` just rewrites the same reference.
|
package/ENGINEERING.md
CHANGED
|
@@ -43,5 +43,5 @@ These preferences apply to ALL blueprints in this repo and to any project scaffo
|
|
|
43
43
|
- **Project context:** Every blueprint appends to `.project-context.md` in the target project root — tool-agnostic location readable by any AI coding tool
|
|
44
44
|
- **Skills live in `.claude/skills/<name>/SKILL.md`** — single source of truth. Installed globally to `~/.claude/skills/`, `~/.config/opencode/skills/`, `~/.cursor/skills/` via the CLI. OpenCode and Cursor also read `~/.claude/skills/` as a cross-tool fallback.
|
|
45
45
|
- **Rules/preferences are in `ENGINEERING.md`** — tool-specific files (`CLAUDE.md`, `AGENTS.md`, `.cursor/rules/engineering.mdc`) point to it
|
|
46
|
-
- **Available skills:** `/new-project`, `/discover`, `/copywrite`, `/copywrite-landing`, `/design-system`, `/scaffold-foundation`, `/scaffold-env`, `/scaffold-tailwind`, `/scaffold-ui`, `/scaffold-auth`, `/scaffold-db`, `/audit`, plus `blueprint-catalog` (background, auto-invoked)
|
|
46
|
+
- **Available skills:** `/new-project`, `/discover`, `/copywrite`, `/copywrite-landing`, `/design-system`, `/scaffold-foundation`, `/scaffold-env`, `/scaffold-tailwind`, `/scaffold-ui`, `/scaffold-auth`, `/scaffold-db`, `/scaffold-infisical`, `/audit`, plus `blueprint-catalog` (background, auto-invoked)
|
|
47
47
|
- **BLUEPRINT.md required** in every blueprint directory. Placeholder blueprints must still have a BLUEPRINT.md documenting intended scope.
|