bsmnt 0.1.2 → 0.1.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.
Files changed (42) hide show
  1. package/package.json +7 -2
  2. package/.changeset/README.md +0 -10
  3. package/.changeset/config.json +0 -16
  4. package/.cursor/rules/README.md +0 -184
  5. package/.cursor/rules/architecture.mdc +0 -437
  6. package/.cursor/rules/components.mdc +0 -436
  7. package/.cursor/rules/integrations.mdc +0 -447
  8. package/.cursor/rules/main.mdc +0 -278
  9. package/.cursor/rules/styling.mdc +0 -433
  10. package/.github/PULL_REQUEST_TEMPLATE.md +0 -14
  11. package/.github/workflows/.gitkeep +0 -0
  12. package/.github/workflows/ci.yml +0 -37
  13. package/.github/workflows/release.yml +0 -56
  14. package/.tldr/cache/call_graph.json +0 -7
  15. package/.tldr/languages.json +0 -6
  16. package/.tldr/status +0 -1
  17. package/.tldrignore +0 -84
  18. package/.vscode/extensions.json +0 -20
  19. package/.vscode/settings.json +0 -98
  20. package/CHANGELOG.md +0 -68
  21. package/CLAUDE.md +0 -156
  22. package/biome.json +0 -45
  23. package/bun.lock +0 -496
  24. package/changelog/04-02-26.md +0 -86
  25. package/changelog/05-02-26.md +0 -101
  26. package/changelog/09-02-26.md +0 -83
  27. package/docs/architecture.drawio +0 -250
  28. package/docs/architecture.mermaid +0 -85
  29. package/docs/fix-studio-hydration.md +0 -46
  30. package/docs/plans/2026-01-29-sanity-smart-merge-design.md +0 -196
  31. package/docs/plans/2026-01-29-sanity-smart-merge-implementation.md +0 -695
  32. package/docs/sanity-setup-steps.md +0 -199
  33. package/packages/cli/package.json +0 -16
  34. package/tasks/.last-branch +0 -1
  35. package/tasks/CLAUDE.md +0 -104
  36. package/tasks/archive/2026-02-09-next-starter-dynamic-layers/prd.json +0 -153
  37. package/tasks/archive/2026-02-09-next-starter-dynamic-layers/progress.txt +0 -115
  38. package/tasks/prd-next-starter-dynamic-layers.md +0 -184
  39. package/tasks/prd-project-restructure.md +0 -375
  40. package/tasks/prd.json +0 -289
  41. package/tasks/progress.txt +0 -309
  42. package/tasks/ralph.sh +0 -113
@@ -1,199 +0,0 @@
1
- # Sanity Project Setup — Automated Steps
2
-
3
- > Reproducible steps for programmatically creating a Sanity project, dataset, API token, and `.env.local` configuration. No browser or interactive prompts required.
4
-
5
- ---
6
-
7
- ## Prerequisites
8
-
9
- - `@sanity/cli` available via `npx` (comes with `sanity` package)
10
- - User must be logged in to Sanity CLI (`npx sanity login`)
11
- - Project already has `next-sanity`, `@sanity/client`, `sanity` installed
12
-
13
- ---
14
-
15
- ## Step 1: Verify Sanity CLI is available
16
-
17
- ```bash
18
- npx sanity --version
19
- ```
20
-
21
- If this fails, the sanity packages aren't installed. Run:
22
-
23
- ```bash
24
- bun add next-sanity @sanity/client @sanity/image-url sanity @sanity/vision
25
- ```
26
-
27
- ---
28
-
29
- ## Step 2: Verify user is authenticated
30
-
31
- ```bash
32
- npx sanity projects list
33
- ```
34
-
35
- - If this returns a list of projects, the user is logged in.
36
- - If it fails with an auth error, the user needs to run `npx sanity login` first (this is interactive and opens a browser — cannot be automated).
37
-
38
- ---
39
-
40
- ## Step 3: Create the Sanity project
41
-
42
- ```bash
43
- npx sanity projects create --name "<project-name>" --dataset production
44
- ```
45
-
46
- **Output to parse:**
47
-
48
- ```
49
- Project created successfully!
50
- ID: <project-id>
51
- Name: <project-name>
52
- Organization: <org>
53
- Dataset: production (public)
54
- ```
55
-
56
- **Extract the project ID** from the output. It's the alphanumeric string after `ID: ` (e.g., `1poovu2i`).
57
-
58
- ---
59
-
60
- ## Step 4: Get the user's auth token
61
-
62
- The Sanity CLI stores the user's session token locally. Retrieve it with:
63
-
64
- ```bash
65
- npx sanity debug --secrets 2>&1 | grep "Auth token"
66
- ```
67
-
68
- **Output:**
69
-
70
- ```
71
- Auth token: '<token-string>'
72
- ```
73
-
74
- **Parse the token** from between the single quotes. Note: the output includes ANSI color codes (`[32m` and `[39m`) that need to be stripped.
75
-
76
- ---
77
-
78
- ## Step 5: Create an API read token
79
-
80
- Use the Sanity HTTP API to create a viewer token for the project:
81
-
82
- ```bash
83
- curl -s -X POST "https://api.sanity.io/v2021-06-07/projects/<project-id>/tokens" \
84
- -H "Authorization: Bearer <auth-token-from-step-4>" \
85
- -H "Content-Type: application/json" \
86
- -d '{"label": "Next.js Read Token", "roleName": "viewer"}'
87
- ```
88
-
89
- **Response:**
90
-
91
- ```json
92
- {
93
- "id": "si8WgRxQuts4CN",
94
- "key": "<the-api-read-token>",
95
- "roles": [{ "name": "viewer", "title": "Viewer" }],
96
- "label": "Next.js Read Token"
97
- }
98
- ```
99
-
100
- **Extract the `key` field** — this is the `SANITY_API_READ_TOKEN`.
101
-
102
- ---
103
-
104
- ## Step 6: Write `.env.local`
105
-
106
- Create `.env.local` in the project root with:
107
-
108
- ```env
109
- # Sanity CMS
110
- NEXT_PUBLIC_SANITY_PROJECT_ID=<project-id>
111
- NEXT_PUBLIC_SANITY_DATASET=production
112
- SANITY_API_READ_TOKEN=<api-read-token>
113
- NEXT_PUBLIC_SANITY_API_READ_TOKEN=<api-read-token>
114
- ```
115
-
116
- **Why both `SANITY_API_READ_TOKEN` and `NEXT_PUBLIC_SANITY_API_READ_TOKEN`?**
117
-
118
- The next-starter template's `env.ts` reads from `NEXT_PUBLIC_SANITY_API_READ_TOKEN` (exposed to client for draft mode / visual editing). `SANITY_API_READ_TOKEN` is the conventional server-only name. Setting both ensures compatibility regardless of which convention the project follows.
119
-
120
- ---
121
-
122
- ## Step 7: Verify the connection
123
-
124
- Test that the token and project ID work by querying the API:
125
-
126
- ```bash
127
- curl -s "https://<project-id>.api.sanity.io/v2024-03-15/data/query/production?query=*%5B0%5D" \
128
- -H "Authorization: Bearer <api-read-token>"
129
- ```
130
-
131
- **Success response:**
132
-
133
- ```json
134
- {
135
- "query": "*[0]",
136
- "result": { ... },
137
- "ms": 2
138
- }
139
- ```
140
-
141
- If the response contains `"result"` (even if it's `null` for an empty dataset), the setup is correct.
142
-
143
- ---
144
-
145
- ## Step 8: Ensure `.env.local` is gitignored
146
-
147
- Check if `.gitignore` exists and includes `.env.local`. If not, add it:
148
-
149
- ```bash
150
- # Check
151
- grep -q ".env.local" .gitignore 2>/dev/null
152
-
153
- # If missing or .gitignore doesn't exist, ensure it's added
154
- echo ".env.local" >> .gitignore
155
- ```
156
-
157
- ---
158
-
159
- ## Summary of values produced
160
-
161
- | Variable | Source |
162
- |----------|--------|
163
- | `NEXT_PUBLIC_SANITY_PROJECT_ID` | Step 3 — `ID` field from project creation output |
164
- | `NEXT_PUBLIC_SANITY_DATASET` | Hardcoded to `production` (passed in Step 3) |
165
- | `SANITY_API_READ_TOKEN` | Step 5 — `key` field from token creation response |
166
- | `NEXT_PUBLIC_SANITY_API_READ_TOKEN` | Same as above |
167
-
168
- ---
169
-
170
- ## Error handling notes
171
-
172
- | Step | Possible failure | How to handle |
173
- |------|-----------------|---------------|
174
- | 2 | Not logged in | Prompt user to run `npx sanity login` — requires browser |
175
- | 3 | Org selection needed | Add `--organization <org-id>` flag if user has multiple orgs |
176
- | 4 | Token not found | Auth token location varies by OS. Fallback: read `~/.config/sanity/config.json` |
177
- | 5 | 401/403 from API | Auth token expired or invalid — user needs to `npx sanity login` again |
178
- | 5 | 400 bad request | Check project ID is correct, check auth header format |
179
- | 7 | Connection refused | Project ID or dataset name is wrong |
180
-
181
- ---
182
-
183
- ## CLI integration notes
184
-
185
- For a `basement init` command, the flow would be:
186
-
187
- ```
188
- 1. Check: `npx sanity projects list` → confirms auth
189
- 2. Prompt: "Project name?" (default: directory name)
190
- 3. Run: `npx sanity projects create --name <name> --dataset production`
191
- 4. Parse: project ID from stdout
192
- 5. Get: auth token from `npx sanity debug --secrets`
193
- 6. Create: API token via HTTP POST
194
- 7. Write: `.env.local` with all four variables
195
- 8. Verify: curl test query
196
- 9. Print: "Sanity Studio available at /studio"
197
- ```
198
-
199
- No interactive Sanity prompts needed. The only prerequisite is that `npx sanity login` has been run at least once.
@@ -1,16 +0,0 @@
1
- {
2
- "name": "@basementstudio/cli",
3
- "version": "0.2.2",
4
- "description": "CLI to scaffold basement projects and add integrations",
5
- "type": "module",
6
- "bin": {
7
- "basement": "./bin/index.js"
8
- },
9
- "dependencies": {
10
- "@basementstudio/create-basement-app": "workspace:*",
11
- "fs-extra": "^11.3.3",
12
- "ora": "^9.1.0",
13
- "picocolors": "^1.1.1",
14
- "prompts": "^2.4.2"
15
- }
16
- }
@@ -1 +0,0 @@
1
- BertovDev/project-restructure
package/tasks/CLAUDE.md DELETED
@@ -1,104 +0,0 @@
1
- # Ralph Agent Instructions
2
-
3
- You are an autonomous coding agent working on a software project.
4
-
5
- ## Your Task
6
-
7
- 1. Read the PRD at `prd.json` (in the same directory as this file)
8
- 2. Read the progress log at `progress.txt` (check Codebase Patterns section first)
9
- 3. Check you're on the correct branch from PRD `branchName`. If not, check it out or create from main.
10
- 4. Pick the **highest priority** user story where `passes: false`
11
- 5. Implement that single user story
12
- 6. Run quality checks (e.g., typecheck, lint, test - use whatever your project requires)
13
- 7. Update CLAUDE.md files if you discover reusable patterns (see below)
14
- 8. If checks pass, commit ALL changes with message: `feat: [Story ID] - [Story Title]`
15
- 9. Update the PRD to set `passes: true` for the completed story
16
- 10. Append your progress to `progress.txt`
17
-
18
- ## Progress Report Format
19
-
20
- APPEND to progress.txt (never replace, always append):
21
- ```
22
- ## [Date/Time] - [Story ID]
23
- - What was implemented
24
- - Files changed
25
- - **Learnings for future iterations:**
26
- - Patterns discovered (e.g., "this codebase uses X for Y")
27
- - Gotchas encountered (e.g., "don't forget to update Z when changing W")
28
- - Useful context (e.g., "the evaluation panel is in component X")
29
- ---
30
- ```
31
-
32
- The learnings section is critical - it helps future iterations avoid repeating mistakes and understand the codebase better.
33
-
34
- ## Consolidate Patterns
35
-
36
- If you discover a **reusable pattern** that future iterations should know, add it to the `## Codebase Patterns` section at the TOP of progress.txt (create it if it doesn't exist). This section should consolidate the most important learnings:
37
-
38
- ```
39
- ## Codebase Patterns
40
- - Example: Use `sql<number>` template for aggregations
41
- - Example: Always use `IF NOT EXISTS` for migrations
42
- - Example: Export types from actions.ts for UI components
43
- ```
44
-
45
- Only add patterns that are **general and reusable**, not story-specific details.
46
-
47
- ## Update CLAUDE.md Files
48
-
49
- Before committing, check if any edited files have learnings worth preserving in nearby CLAUDE.md files:
50
-
51
- 1. **Identify directories with edited files** - Look at which directories you modified
52
- 2. **Check for existing CLAUDE.md** - Look for CLAUDE.md in those directories or parent directories
53
- 3. **Add valuable learnings** - If you discovered something future developers/agents should know:
54
- - API patterns or conventions specific to that module
55
- - Gotchas or non-obvious requirements
56
- - Dependencies between files
57
- - Testing approaches for that area
58
- - Configuration or environment requirements
59
-
60
- **Examples of good CLAUDE.md additions:**
61
- - "When modifying X, also update Y to keep them in sync"
62
- - "This module uses pattern Z for all API calls"
63
- - "Tests require the dev server running on PORT 3000"
64
- - "Field names must match the template exactly"
65
-
66
- **Do NOT add:**
67
- - Story-specific implementation details
68
- - Temporary debugging notes
69
- - Information already in progress.txt
70
-
71
- Only update CLAUDE.md if you have **genuinely reusable knowledge** that would help future work in that directory.
72
-
73
- ## Quality Requirements
74
-
75
- - ALL commits must pass your project's quality checks (typecheck, lint, test)
76
- - Do NOT commit broken code
77
- - Keep changes focused and minimal
78
- - Follow existing code patterns
79
-
80
- ## Browser Testing (If Available)
81
-
82
- For any story that changes UI, verify it works in the browser if you have browser testing tools configured (e.g., via MCP):
83
-
84
- 1. Navigate to the relevant page
85
- 2. Verify the UI changes work as expected
86
- 3. Take a screenshot if helpful for the progress log
87
-
88
- If no browser tools are available, note in your progress report that manual browser verification is needed.
89
-
90
- ## Stop Condition
91
-
92
- After completing a user story, check if ALL stories have `passes: true`.
93
-
94
- If ALL stories are complete and passing, reply with:
95
- <promise>COMPLETE</promise>
96
-
97
- If there are still stories with `passes: false`, end your response normally (another iteration will pick up the next story).
98
-
99
- ## Important
100
-
101
- - Work on ONE story per iteration
102
- - Commit frequently
103
- - Keep CI green
104
- - Read the Codebase Patterns section in progress.txt before starting
@@ -1,153 +0,0 @@
1
- {
2
- "project": "basement-cli",
3
- "branchName": "ralph/next-starter-dynamic-layers",
4
- "description": "Replace 4 static templates with next-starter clone + dynamic technology layers to eliminate maintenance burden",
5
- "userStories": [
6
- {
7
- "id": "US-001",
8
- "title": "Create layer configuration system",
9
- "description": "As a CLI maintainer, I want technology layers defined in a config file so that adding or modifying layers only requires changing one file.",
10
- "acceptanceCriteria": [
11
- "Add LAYER_CONFIG export to src/mergers/config.js alongside existing CMS_CONFIG",
12
- "Each layer config defines: replaceFiles, additivePaths, dependencies, devDependencies",
13
- "Add getLayerConfig(layer) helper function export",
14
- "Config contains entries for webgl, webgpu, and experiment",
15
- "webgpu is a deps-only layer (empty replaceFiles and additivePaths arrays)",
16
- "webgl dependencies: @react-three/fiber ^9.5.0, @react-three/drei ^10.7.7, three ^0.182.0, @gsap/react ^2.0.0, @radix-ui/react-navigation-menu ^1.2.5, leva ^0.9.35, devDeps: @types/three ^0.182.0",
17
- "webgpu dependencies: @react-three/fiber 10.0.0-alpha.2, @react-three/drei ^11.0.0-alpha.4, three ^0.182.0, leva ^0.9.35, lucide-react ^0.474.0, @radix-ui/react-navigation-menu ^1.2.5, devDeps: @types/three ^0.182.0",
18
- "experiment dependencies: @react-three/fiber ^9.5.0, @react-three/drei ^10.7.7, three ^0.172.0, leva ^0.9.35, lucide-react ^0.474.0, @radix-ui/react-navigation-menu ^1.2.5, devDeps: @types/three ^0.182.0",
19
- "Typecheck passes"
20
- ],
21
- "priority": 1,
22
- "passes": true,
23
- "notes": ""
24
- },
25
- {
26
- "id": "US-002",
27
- "title": "Extract layer files from templates",
28
- "description": "As a CLI maintainer, I need the unique files from each template extracted into a layers/ directory so they can be overlaid on next-starter.",
29
- "acceptanceCriteria": [
30
- "Create layers/webgl/app/page.tsx copied from template/webgl/app/page.tsx (the one that imports DynamicCanvas)",
31
- "Create layers/webgl/components/webgl/canvas/dynamic.tsx from template/webgl/components/webgl/canvas/dynamic.tsx",
32
- "Create layers/webgl/components/webgl/canvas/index.tsx from template/webgl/components/webgl/canvas/index.tsx",
33
- "Create layers/webgl/components/webgl/components/scene/index.tsx from template/webgl/components/webgl/components/scene/index.tsx",
34
- "Create layers/experiment/components/layout/header/index.tsx from template/experiment/components/layout/header/index.tsx",
35
- "Create layers/experiment/components/layout/navigation-menu.tsx from template/experiment/components/layout/navigation-menu.tsx",
36
- "Create layers/experiment/lib/constats.ts from template/experiment/lib/constats.ts",
37
- "Create layers/experiment/lib/utils/cn.ts from template/experiment/lib/utils/cn.ts",
38
- "Create empty layers/webgpu/ directory with a .gitkeep file",
39
- "All copied files are byte-for-byte identical to their template source files",
40
- "Typecheck passes"
41
- ],
42
- "priority": 2,
43
- "passes": true,
44
- "notes": ""
45
- },
46
- {
47
- "id": "US-003",
48
- "title": "Implement layer injection function",
49
- "description": "As the CLI system, I need to overlay layer-specific files on top of the next-starter base so that WebGL/WebGPU/Experiment projects get their unique components.",
50
- "acceptanceCriteria": [
51
- "Add injectLayer(targetDir, layer, spinner) function to src/mergers/index.js",
52
- "Function resolves layer directory from CLI repo's layers/{type}/ path using __dirname",
53
- "Function calls existing detectPathPrefix() to handle src/ directory structure",
54
- "Function copies additive files from local layers/ directory (no tiged clone needed)",
55
- "Function replaces files listed in replaceFiles config (overwrites base version with overwrite: true)",
56
- "Function uses existing transformPath() for path prefix support",
57
- "Function returns results object with replaced, copied, skipped, and failed arrays",
58
- "When layer is 'default' or not found in config, function returns early with skipped result (no error)",
59
- "Extend formatMergeResults() to display replaced entries with checkmark prefix",
60
- "Typecheck passes"
61
- ],
62
- "priority": 3,
63
- "passes": true,
64
- "notes": "Reuses existing detectPathPrefix() and transformPath() from src/mergers/index.js. Layer files are local (no network request)."
65
- },
66
- {
67
- "id": "US-004",
68
- "title": "Change create.js to clone next-starter instead of template",
69
- "description": "As a developer using the CLI, I want my project scaffolded from the latest next-starter repo so I always get the most up-to-date base.",
70
- "acceptanceCriteria": [
71
- "Change tiged source on line 124 of src/commands/create.js from 'github:basementstudio/basement-cli/template/${type}#${branch}' to 'github:basementstudio/next-starter#main'",
72
- "Remove the BASEMENT_CLI_BRANCH env var usage for template (keep if used elsewhere)",
73
- "Delete bun.lock file after clone if it exists (since dependencies will be modified)",
74
- "Update download spinner text to say 'Downloading next-starter from GitHub...' instead of mentioning template type",
75
- "Update error/troubleshooting message in catch block to reference basementstudio/next-starter instead of basementstudio/basement-cli/template/{type}",
76
- "Typecheck passes"
77
- ],
78
- "priority": 4,
79
- "passes": true,
80
- "notes": ""
81
- },
82
- {
83
- "id": "US-005",
84
- "title": "Wire layer injection into create flow",
85
- "description": "As the CLI system, I need the layer injection step between template download and CMS integration so layers are applied at the right time.",
86
- "acceptanceCriteria": [
87
- "Add new step between template download (step 3) and CMS integration (step 3.5) in src/commands/create.js",
88
- "Layer injection only runs when type !== 'default'",
89
- "Import injectLayer and formatMergeResults from src/mergers/index.js",
90
- "Show ora spinner with layer name during injection (e.g. 'Applying webgl layer...')",
91
- "Display injection results to user using formatMergeResults",
92
- "On failure, show warning (not hard error) and continue with project creation",
93
- "Typecheck passes"
94
- ],
95
- "priority": 5,
96
- "passes": true,
97
- "notes": "Must run BEFORE CMS integration because layers don't modify layout.tsx, and CMS mergers need the base layout intact."
98
- },
99
- {
100
- "id": "US-006",
101
- "title": "Config-driven dependency injection in package.json hydration",
102
- "description": "As the CLI system, I need package.json hydration to read layer dependencies from LAYER_CONFIG instead of being hardcoded.",
103
- "acceptanceCriteria": [
104
- "Import getLayerConfig from src/mergers/config.js in create.js",
105
- "Read layer dependencies from LAYER_CONFIG and merge into package.json: pkg.dependencies = { ...pkg.dependencies, ...layerConfig.dependencies }",
106
- "Also merge devDependencies from layer config",
107
- "CMS dependency injection (Sanity/BaseHub) still works unchanged",
108
- "Animation library injection (GSAP/Framer Motion) still works unchanged",
109
- "Simplify package.json handling: next-starter uses package.json directly (not package.template.json), remove the rename logic",
110
- "Project name still set to user-provided name, version still set to 0.1.0",
111
- "Typecheck passes"
112
- ],
113
- "priority": 6,
114
- "passes": true,
115
- "notes": "next-starter uses package.json not package.template.json, so the existsSync check for package.template.json can be simplified."
116
- },
117
- {
118
- "id": "US-007",
119
- "title": "Delete template directory",
120
- "description": "As a CLI maintainer, I want the template/ directory removed so there's no duplicated code to maintain.",
121
- "acceptanceCriteria": [
122
- "Delete template/default/ directory and all contents",
123
- "Delete template/webgl/ directory and all contents",
124
- "Delete template/webgpu/ directory and all contents",
125
- "Delete template/experiment/ directory and all contents",
126
- "Grep source code for any remaining references to 'template/' paths and remove them",
127
- "Grep source code for any remaining references to 'basementstudio/basement-cli/template/' and remove them",
128
- "Typecheck passes"
129
- ],
130
- "priority": 7,
131
- "passes": true,
132
- "notes": ""
133
- },
134
- {
135
- "id": "US-008",
136
- "title": "End-to-end verification of all template types",
137
- "description": "As a CLI maintainer, I need to verify all template + CMS + animation combinations produce working projects.",
138
- "acceptanceCriteria": [
139
- "Run npm link to install CLI locally",
140
- "Run: basement -c test-default -d -no-cms -no-animation -claude -no-hooks — project creates successfully",
141
- "Run: basement -c test-webgl -webgl -no-cms -no-animation -claude -no-hooks — project has R3F components in components/webgl/",
142
- "Run: basement -c test-webgpu -webgpu -no-cms -no-animation -claude -no-hooks — project has WebGPU deps in package.json",
143
- "Run: basement -c test-experiment -exp -no-cms -no-animation -claude -no-hooks — project has custom header with NavigationMenu",
144
- "Run: basement -c test-sanity -webgl -sanity -gsap -claude -no-hooks — project has CMS + animation + layer deps",
145
- "All generated projects pass bun install without errors",
146
- "Typecheck passes"
147
- ],
148
- "priority": 8,
149
- "passes": true,
150
- "notes": "This is the final validation step. Each test project should be cleaned up after verification."
151
- }
152
- ]
153
- }
@@ -1,115 +0,0 @@
1
- ## Codebase Patterns
2
- - This is a plain JS (ESM) CLI project - no TypeScript, no typecheck command. "Typecheck passes" = no syntax errors.
3
- - Config pattern: export const CONFIG object + getXConfig(name) helper that returns config or null
4
- - src/mergers/config.js holds all configuration (CMS_CONFIG, LAYER_CONFIG)
5
- - src/mergers/index.js holds injection/merge logic (injectIntegration for CMS, injectLayer for layers)
6
- - src/commands/create.js is the main CLI flow
7
- - next-starter uses package.json directly (no template rename needed)
8
- - Layer files are local (in layers/ directory), CMS integration files are remote (fetched via tiged)
9
- - ESM requires __dirname workaround: `path.dirname(fileURLToPath(import.meta.url))`
10
- - CLI binary is basement (defined in package.json bin field)
11
- - Dependency injection order in create.js: layer deps → CMS deps → animation deps
12
-
13
- ---
14
-
15
- ## 2026-02-09 - US-001
16
- - Implemented LAYER_CONFIG export with webgl, webgpu, experiment entries
17
- - Added getLayerConfig() helper function
18
- - Each layer config has: replaceFiles, additivePaths, dependencies, devDependencies
19
- - webgpu is deps-only (empty replaceFiles and additivePaths)
20
- - Files changed: src/mergers/config.js
21
- - **Learnings for future iterations:**
22
- - The CLI project is plain JS ESM, verified by running `node --input-type=module -e "import {...}"`
23
- - Config pattern follows existing CMS_CONFIG style - object + getter helper
24
- - experiment uses three ^0.172.0 (not ^0.182.0 like webgl/webgpu) per PRD
25
- ---
26
-
27
- ## 2026-02-09 - US-002
28
- - Created layers/webgl/ with app/page.tsx and 3 webgl component files from template/webgl/
29
- - Created layers/experiment/ with header, navigation-menu, constats.ts, cn.ts from template/experiment/
30
- - Created layers/webgpu/.gitkeep (empty layer, deps-only)
31
- - Verified all files are byte-for-byte identical using diff
32
- - Files changed: 9 new files in layers/
33
- - **Learnings for future iterations:**
34
- - Layer files are local to CLI repo (no network clone needed, unlike CMS integrations)
35
- - webgl is the only layer with a different app/page.tsx (imports DynamicCanvas)
36
- - experiment has its own header and navigation-menu components
37
- ---
38
-
39
- ## 2026-02-09 - US-003
40
- - Added injectLayer(targetDir, layer, spinner) function to src/mergers/index.js
41
- - Uses __dirname (via import.meta.url + fileURLToPath) to resolve layers/ directory
42
- - Reuses detectPathPrefix() and transformPath() for src/ directory support
43
- - Handles replaceFiles (overwrite: true) and additivePaths (overwrite: false) separately
44
- - Returns results with replaced, copied, skipped, failed arrays
45
- - Extended formatMergeResults() with defensive optional chaining for replaced/merged/copied/etc
46
- - Files changed: src/mergers/index.js
47
- - **Learnings for future iterations:**
48
- - ESM doesn't have __dirname, must use: `const __dirname = path.dirname(fileURLToPath(import.meta.url))`
49
- - Layer injection is purely local file copy (no network), unlike CMS integration which uses tiged
50
- - formatMergeResults now handles both CMS results (merged) and layer results (replaced) gracefully
51
- ---
52
-
53
- ## 2026-02-09 - US-004
54
- - Changed tiged source from basement/template/${type} to basementstudio/next-starter#main
55
- - Removed BASEMENT_CLI_BRANCH env var usage (was only used for template, not used elsewhere)
56
- - Added bun.lock deletion after clone (since deps will be modified by layers/CMS/animation)
57
- - Updated spinner text to "Downloading next-starter from GitHub..."
58
- - Updated troubleshooting message to reference basementstudio/next-starter
59
- - Kept dotenv import as it may be used by merger modules
60
- - Files changed: src/commands/create.js
61
- - **Learnings for future iterations:**
62
- - dotenv is loaded in create.js but env vars are only used in merger modules (check-integration-merger.js)
63
- - bun.lock must be deleted before modifying package.json deps, otherwise bun install may conflict
64
- ---
65
-
66
- ## 2026-02-09 - US-005
67
- - Added layer injection step (3.2) between template download and CMS integration (3.5)
68
- - Layer injection only runs when type !== 'default'
69
- - Uses dynamic import for injectLayer and formatMergeResults from mergers/index.js
70
- - Shows ora spinner with layer name during injection
71
- - On failure, shows warning and continues (not a hard error)
72
- - Files changed: src/commands/create.js
73
- - **Learnings for future iterations:**
74
- - Layer injection MUST happen before CMS integration to keep layout.tsx intact for CMS mergers
75
- - Uses dynamic import (await import) consistent with existing CMS integration pattern
76
- ---
77
-
78
- ## 2026-02-09 - US-006
79
- - Imported getLayerConfig from src/mergers/config.js at top of create.js
80
- - Layer deps injected from LAYER_CONFIG before CMS and animation deps
81
- - Simplified package.json handling: removed package.template.json logic (next-starter uses package.json directly)
82
- - CMS and animation dependency injection unchanged
83
- - Project name and version still set correctly
84
- - Files changed: src/commands/create.js
85
- - **Learnings for future iterations:**
86
- - Dependency injection order matters: layer deps first, then CMS, then animation (later ones override earlier)
87
- - next-starter uses package.json directly, no need for package.template.json rename logic
88
- ---
89
-
90
- ## 2026-02-09 - US-007
91
- - Deleted template/default/, template/webgl/, template/webgpu/, template/experiment/ directories
92
- - Removed entire template/ directory (281 files, -27,778 lines)
93
- - Verified no remaining references to template/ paths in source code (src/)
94
- - Updated CLAUDE.md to reflect new architecture (layers/ instead of template/)
95
- - Files changed: template/ deleted, CLAUDE.md updated
96
- - **Learnings for future iterations:**
97
- - CLAUDE.md should be kept in sync with architecture changes
98
- - Only documentation files (CLAUDE.md, PRD) had remaining references to template/ paths, not source code
99
- ---
100
-
101
- ## 2026-02-09 - US-008
102
- - Installed CLI locally via npm link
103
- - E2E test results (all passed):
104
- - test-default: Created successfully, name=test-default, version=0.1.0, has next dep, no R3F deps
105
- - test-webgl: Created with layer applied (replaced page.tsx, added 3 webgl components), R3F ^9.5.0, three ^0.182.0, @types/three ^0.182.0
106
- - test-webgpu: Created with deps-only layer, R3F 10.0.0-alpha.2, drei ^11.0.0-alpha.4, lucide-react ^0.474.0
107
- - test-experiment: Created with layer (header, navigation-menu, constats.ts, cn.ts), three ^0.172.0
108
- - test-sanity: Combined webgl + sanity + gsap - all deps present (R3F, next-sanity, sanity, gsap, @gsap/react, sanity:extract script)
109
- - All 4 projects pass bun install without errors
110
- - CLI command is basement (not basement-starter as PRD mentions)
111
- - **Learnings for future iterations:**
112
- - Skills installation may fail without network (bunx skills add), but it's non-blocking
113
- - The sanity integration triggers an interactive Sanity setup prompt after project creation
114
- - bun install correctly resolves all dependency versions including alpha packages
115
- ---