bsmnt 0.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/.changeset/2026-02-11-test-patch-bump.md +5 -0
- package/.changeset/README.md +10 -0
- package/.changeset/config.json +16 -0
- package/.cursor/rules/README.md +184 -0
- package/.cursor/rules/architecture.mdc +437 -0
- package/.cursor/rules/components.mdc +436 -0
- package/.cursor/rules/integrations.mdc +447 -0
- package/.cursor/rules/main.mdc +278 -0
- package/.cursor/rules/styling.mdc +433 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +14 -0
- package/.github/workflows/.gitkeep +0 -0
- package/.github/workflows/ci.yml +37 -0
- package/.github/workflows/release.yml +54 -0
- package/.tldr/cache/call_graph.json +7 -0
- package/.tldr/languages.json +6 -0
- package/.tldr/status +1 -0
- package/.tldrignore +84 -0
- package/.vscode/extensions.json +20 -0
- package/.vscode/settings.json +98 -0
- package/CHANGELOG.md +13 -0
- package/CLAUDE.md +138 -0
- package/README.md +176 -0
- package/bin/index.js +262 -0
- package/biome.json +44 -0
- package/bun.lock +496 -0
- package/changelog/04-02-26.md +86 -0
- package/changelog/05-02-26.md +101 -0
- package/changelog/09-02-26.md +83 -0
- package/docs/fix-studio-hydration.md +46 -0
- package/docs/plans/2026-01-29-sanity-smart-merge-design.md +196 -0
- package/docs/plans/2026-01-29-sanity-smart-merge-implementation.md +695 -0
- package/docs/sanity-setup-steps.md +199 -0
- package/integrations/basehub/README.md +3 -0
- package/integrations/sanity/app/api/draft-mode/disable/route.ts +7 -0
- package/integrations/sanity/app/api/draft-mode/enable/route.ts +21 -0
- package/integrations/sanity/app/api/revalidate/route.ts +37 -0
- package/integrations/sanity/app/layout.tsx +111 -0
- package/integrations/sanity/app/sitemap.ts +80 -0
- package/integrations/sanity/app/studio/[[...tool]]/page.tsx +8 -0
- package/integrations/sanity/app/studio/layout.tsx +7 -0
- package/integrations/sanity/components/ui/sanity-image/index.tsx +37 -0
- package/integrations/sanity/lib/integrations/README.md +58 -0
- package/integrations/sanity/lib/integrations/check-integration.ts +62 -0
- package/integrations/sanity/lib/integrations/sanity/README.md +144 -0
- package/integrations/sanity/lib/integrations/sanity/client.ts +30 -0
- package/integrations/sanity/lib/integrations/sanity/components/disable-draft-mode.tsx +29 -0
- package/integrations/sanity/lib/integrations/sanity/components/rich-text.tsx +73 -0
- package/integrations/sanity/lib/integrations/sanity/env.ts +38 -0
- package/integrations/sanity/lib/integrations/sanity/live/index.tsx +34 -0
- package/integrations/sanity/lib/integrations/sanity/queries.ts +99 -0
- package/integrations/sanity/lib/integrations/sanity/sanity.cli.ts +20 -0
- package/integrations/sanity/lib/integrations/sanity/sanity.config.ts +94 -0
- package/integrations/sanity/lib/integrations/sanity/sanity.types.ts +337 -0
- package/integrations/sanity/lib/integrations/sanity/schema.json +1850 -0
- package/integrations/sanity/lib/integrations/sanity/schemas/article.ts +132 -0
- package/integrations/sanity/lib/integrations/sanity/schemas/example.ts +203 -0
- package/integrations/sanity/lib/integrations/sanity/schemas/index.ts +37 -0
- package/integrations/sanity/lib/integrations/sanity/schemas/link.ts +127 -0
- package/integrations/sanity/lib/integrations/sanity/schemas/metadata.ts +68 -0
- package/integrations/sanity/lib/integrations/sanity/schemas/navigation.ts +39 -0
- package/integrations/sanity/lib/integrations/sanity/schemas/page.ts +77 -0
- package/integrations/sanity/lib/integrations/sanity/schemas/richText.ts +59 -0
- package/integrations/sanity/lib/integrations/sanity/structure.ts +5 -0
- package/integrations/sanity/lib/integrations/sanity/utils/image.ts +11 -0
- package/integrations/sanity/lib/integrations/sanity/utils/link.ts +61 -0
- package/integrations/sanity/lib/scripts/copy-sanity-mcp.ts +23 -0
- package/integrations/sanity/lib/scripts/generate-page.ts +310 -0
- package/integrations/sanity/lib/utils/metadata.ts +190 -0
- package/layers/experiment/components/layout/header/index.tsx +58 -0
- package/layers/experiment/components/layout/navigation-menu.tsx +127 -0
- package/layers/experiment/lib/constants.ts +12 -0
- package/layers/webgl/app/page.tsx +10 -0
- package/layers/webgl/components/webgl/canvas/dynamic.tsx +34 -0
- package/layers/webgl/components/webgl/canvas/index.tsx +43 -0
- package/layers/webgl/components/webgl/components/scene/index.tsx +21 -0
- package/layers/webgpu/.gitkeep +0 -0
- package/package.json +44 -0
- package/plugins/README.md +21 -0
- package/plugins/no-anchor-element.grit +11 -0
- package/plugins/no-relative-parent-imports.grit +6 -0
- package/plugins/no-unnecessary-forwardref.grit +5 -0
- package/src/commands/add-integration.js +325 -0
- package/src/commands/create.js +415 -0
- package/src/commands/setup-sanity.js +426 -0
- package/src/commands/worktree.js +805 -0
- package/src/mergers/check-integration-merger.js +105 -0
- package/src/mergers/config.js +137 -0
- package/src/mergers/index.js +355 -0
- package/src/mergers/layout-merger.js +223 -0
- package/src/mergers/next-config-merger.js +63 -0
- package/src/mergers/sitemap-merger.js +121 -0
- package/tasks/prd-next-starter-dynamic-layers.md +184 -0
- package/tasks/prd.json +153 -0
- package/tasks/progress.txt +115 -0
- package/template-hooks/use-battery.ts +126 -0
- package/template-hooks/use-device-perf.ts +184 -0
- package/template-hooks/use-intersection-observer.ts +32 -0
- package/template-hooks/use-media.ts +33 -0
|
File without changes
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
push:
|
|
8
|
+
branches:
|
|
9
|
+
- main
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
validate:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- name: Checkout
|
|
17
|
+
uses: actions/checkout@v4
|
|
18
|
+
with:
|
|
19
|
+
fetch-depth: 0
|
|
20
|
+
|
|
21
|
+
- name: Setup Bun
|
|
22
|
+
uses: oven-sh/setup-bun@v2
|
|
23
|
+
with:
|
|
24
|
+
bun-version: latest
|
|
25
|
+
|
|
26
|
+
- name: Install dependencies
|
|
27
|
+
run: bun install --frozen-lockfile
|
|
28
|
+
|
|
29
|
+
- name: Type check
|
|
30
|
+
run: bun run check
|
|
31
|
+
|
|
32
|
+
- name: Build
|
|
33
|
+
run: bun run build
|
|
34
|
+
|
|
35
|
+
- name: Ensure changeset exists for PR changes
|
|
36
|
+
if: github.event_name == 'pull_request'
|
|
37
|
+
run: bunx changeset status --since=origin/${{ github.base_ref }}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
name: Version and Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: write
|
|
11
|
+
pull-requests: write
|
|
12
|
+
id-token: write
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
release:
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
|
|
18
|
+
steps:
|
|
19
|
+
- name: Checkout
|
|
20
|
+
uses: actions/checkout@v4
|
|
21
|
+
with:
|
|
22
|
+
fetch-depth: 0
|
|
23
|
+
|
|
24
|
+
- name: Setup Bun
|
|
25
|
+
uses: oven-sh/setup-bun@v2
|
|
26
|
+
with:
|
|
27
|
+
bun-version: latest
|
|
28
|
+
|
|
29
|
+
- name: Setup Node for npm publishing
|
|
30
|
+
uses: actions/setup-node@v4
|
|
31
|
+
with:
|
|
32
|
+
node-version: 24
|
|
33
|
+
|
|
34
|
+
- name: Use npm 11.6.2
|
|
35
|
+
run: npm i -g npm@11.6.2
|
|
36
|
+
|
|
37
|
+
- name: Install dependencies
|
|
38
|
+
run: bun install --frozen-lockfile
|
|
39
|
+
|
|
40
|
+
- name: Configure npm for publishing
|
|
41
|
+
run: |
|
|
42
|
+
cat > ~/.npmrc <<'EOF'
|
|
43
|
+
registry=https://registry.npmjs.org/
|
|
44
|
+
access=public
|
|
45
|
+
EOF
|
|
46
|
+
|
|
47
|
+
- name: Version packages or publish
|
|
48
|
+
uses: changesets/action@v1
|
|
49
|
+
with:
|
|
50
|
+
version: bun run version-packages
|
|
51
|
+
publish: bun run release
|
|
52
|
+
createGithubReleases: true
|
|
53
|
+
env:
|
|
54
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
package/.tldr/status
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
stopped
|
package/.tldrignore
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# TLDR ignore patterns (gitignore syntax)
|
|
2
|
+
# Auto-generated - review and customize for your project
|
|
3
|
+
# Docs: https://git-scm.com/docs/gitignore
|
|
4
|
+
|
|
5
|
+
# ===================
|
|
6
|
+
# Dependencies
|
|
7
|
+
# ===================
|
|
8
|
+
node_modules/
|
|
9
|
+
.venv/
|
|
10
|
+
venv/
|
|
11
|
+
env/
|
|
12
|
+
__pycache__/
|
|
13
|
+
.tox/
|
|
14
|
+
.nox/
|
|
15
|
+
.pytest_cache/
|
|
16
|
+
.mypy_cache/
|
|
17
|
+
.ruff_cache/
|
|
18
|
+
vendor/
|
|
19
|
+
Pods/
|
|
20
|
+
|
|
21
|
+
# ===================
|
|
22
|
+
# Build outputs
|
|
23
|
+
# ===================
|
|
24
|
+
dist/
|
|
25
|
+
build/
|
|
26
|
+
out/
|
|
27
|
+
target/
|
|
28
|
+
*.egg-info/
|
|
29
|
+
*.whl
|
|
30
|
+
*.pyc
|
|
31
|
+
*.pyo
|
|
32
|
+
|
|
33
|
+
# ===================
|
|
34
|
+
# Binary/large files
|
|
35
|
+
# ===================
|
|
36
|
+
*.so
|
|
37
|
+
*.dylib
|
|
38
|
+
*.dll
|
|
39
|
+
*.exe
|
|
40
|
+
*.bin
|
|
41
|
+
*.o
|
|
42
|
+
*.a
|
|
43
|
+
*.lib
|
|
44
|
+
|
|
45
|
+
# ===================
|
|
46
|
+
# IDE/editors
|
|
47
|
+
# ===================
|
|
48
|
+
.idea/
|
|
49
|
+
.vscode/
|
|
50
|
+
*.swp
|
|
51
|
+
*.swo
|
|
52
|
+
*~
|
|
53
|
+
|
|
54
|
+
# ===================
|
|
55
|
+
# Security (always exclude)
|
|
56
|
+
# ===================
|
|
57
|
+
.env
|
|
58
|
+
.env.*
|
|
59
|
+
*.pem
|
|
60
|
+
*.key
|
|
61
|
+
*.p12
|
|
62
|
+
*.pfx
|
|
63
|
+
credentials.*
|
|
64
|
+
secrets.*
|
|
65
|
+
|
|
66
|
+
# ===================
|
|
67
|
+
# Version control
|
|
68
|
+
# ===================
|
|
69
|
+
.git/
|
|
70
|
+
.hg/
|
|
71
|
+
.svn/
|
|
72
|
+
|
|
73
|
+
# ===================
|
|
74
|
+
# OS files
|
|
75
|
+
# ===================
|
|
76
|
+
.DS_Store
|
|
77
|
+
Thumbs.db
|
|
78
|
+
|
|
79
|
+
# ===================
|
|
80
|
+
# Project-specific
|
|
81
|
+
# Add your custom patterns below
|
|
82
|
+
# ===================
|
|
83
|
+
# large_test_fixtures/
|
|
84
|
+
# data/
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"recommendations": [
|
|
3
|
+
// Formatting & Linting
|
|
4
|
+
"biomejs.biome",
|
|
5
|
+
|
|
6
|
+
// CSS & Styling
|
|
7
|
+
"bradlc.vscode-tailwindcss",
|
|
8
|
+
"csstools.postcss",
|
|
9
|
+
|
|
10
|
+
// GraphQL (Shopify, etc.)
|
|
11
|
+
"graphql.vscode-graphql-syntax",
|
|
12
|
+
|
|
13
|
+
// Sanity CMS (GROQ syntax + validation)
|
|
14
|
+
"sanity-io.vscode-sanity",
|
|
15
|
+
|
|
16
|
+
// DX Enhancements
|
|
17
|
+
"yoavbls.pretty-ts-errors",
|
|
18
|
+
"waderyan.gitblame"
|
|
19
|
+
]
|
|
20
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
{
|
|
2
|
+
// Formatting
|
|
3
|
+
"editor.formatOnSave": true,
|
|
4
|
+
"editor.defaultFormatter": "biomejs.biome",
|
|
5
|
+
"editor.codeActionsOnSave": {
|
|
6
|
+
"source.fixAll.biome": "always",
|
|
7
|
+
"source.organizeImports.biome": "always"
|
|
8
|
+
},
|
|
9
|
+
|
|
10
|
+
// TypeScript
|
|
11
|
+
"typescript.suggest.autoImports": true,
|
|
12
|
+
"typescript.preferences.importModuleSpecifier": "non-relative",
|
|
13
|
+
"typescript.tsdk": "node_modules/typescript/lib",
|
|
14
|
+
// "typescript.experimental.useTsgo": true, // Disabled: tsgo doesn't support Next.js plugin
|
|
15
|
+
"javascript.suggest.autoImports": true,
|
|
16
|
+
|
|
17
|
+
// Editor labels (fixed for .tsx files)
|
|
18
|
+
"workbench.editor.customLabels.patterns": {
|
|
19
|
+
"**/app/**/page.tsx": "${dirname(1)}/${dirname} <page>",
|
|
20
|
+
"**/app/**/layout.tsx": "${dirname(1)}/${dirname} <layout>",
|
|
21
|
+
"**/app/api/**/route.ts": "${dirname(1)}/${dirname} <route>",
|
|
22
|
+
"**/components/**/index.tsx": "${dirname} <component>"
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
// File associations
|
|
26
|
+
"files.associations": {
|
|
27
|
+
"*.json": "jsonc"
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
// CSS (Tailwind v4)
|
|
31
|
+
"css.lint.validProperties": ["user-drag"],
|
|
32
|
+
"css.lint.unknownAtRules": "ignore",
|
|
33
|
+
"tailwindCSS.experimental.configFile": "./lib/styles/css/tailwind.css",
|
|
34
|
+
"tailwindCSS.includeLanguages": {
|
|
35
|
+
"typescriptreact": "html"
|
|
36
|
+
},
|
|
37
|
+
"tailwindCSS.classFunctions": ["cn", "cva", "twMerge", "cx"],
|
|
38
|
+
"tailwindCSS.classAttributes": [
|
|
39
|
+
"class",
|
|
40
|
+
"className",
|
|
41
|
+
".*ClassName",
|
|
42
|
+
".*Styles"
|
|
43
|
+
],
|
|
44
|
+
"tailwindCSS.experimental.classRegex": [
|
|
45
|
+
["cn\\(([^)]*)\\)", "(?:'|\"|`)([^\"'`]*)(?:'|\"|`)"],
|
|
46
|
+
["cva\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"]
|
|
47
|
+
],
|
|
48
|
+
|
|
49
|
+
// Search exclusions (performance)
|
|
50
|
+
"search.exclude": {
|
|
51
|
+
"**/node_modules": true,
|
|
52
|
+
"**/.next": true,
|
|
53
|
+
"**/bun.lock": true,
|
|
54
|
+
"**/.vercel": true,
|
|
55
|
+
"**/lib/integrations/sanity/sanity.types.ts": true
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
// Language-specific formatters
|
|
59
|
+
"[css]": {
|
|
60
|
+
"editor.defaultFormatter": "biomejs.biome"
|
|
61
|
+
},
|
|
62
|
+
"[javascript]": {
|
|
63
|
+
"editor.defaultFormatter": "biomejs.biome"
|
|
64
|
+
},
|
|
65
|
+
"[typescript]": {
|
|
66
|
+
"editor.defaultFormatter": "biomejs.biome"
|
|
67
|
+
},
|
|
68
|
+
"[javascriptreact]": {
|
|
69
|
+
"editor.defaultFormatter": "biomejs.biome"
|
|
70
|
+
},
|
|
71
|
+
"[typescriptreact]": {
|
|
72
|
+
"editor.defaultFormatter": "biomejs.biome"
|
|
73
|
+
},
|
|
74
|
+
"[json]": {
|
|
75
|
+
"editor.defaultFormatter": "biomejs.biome"
|
|
76
|
+
},
|
|
77
|
+
"[jsonc]": {
|
|
78
|
+
"editor.defaultFormatter": "biomejs.biome"
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
// General
|
|
82
|
+
"files.eol": "\n",
|
|
83
|
+
"workbench.editorAssociations": {
|
|
84
|
+
"*.svg": "default"
|
|
85
|
+
},
|
|
86
|
+
"colorize.languages": [
|
|
87
|
+
"javascript",
|
|
88
|
+
"typescript",
|
|
89
|
+
"css",
|
|
90
|
+
"scss",
|
|
91
|
+
"less",
|
|
92
|
+
"html",
|
|
93
|
+
"json",
|
|
94
|
+
"yaml",
|
|
95
|
+
"markdown",
|
|
96
|
+
"glsl"
|
|
97
|
+
]
|
|
98
|
+
}
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# @basementstudio/cli
|
|
2
|
+
|
|
3
|
+
## 0.2.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#14](https://github.com/basementstudio/basement-cli/pull/14) [`c3e43db`](https://github.com/basementstudio/basement-cli/commit/c3e43db93e417b46ffc6dbe9d7120a5600a1bf08) Thanks [@valebearzotti](https://github.com/valebearzotti)! - Retry npm release after fixing trusted publisher workflow configuration.
|
|
8
|
+
|
|
9
|
+
## 0.2.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#12](https://github.com/basementstudio/basement-cli/pull/12) [`9af1be7`](https://github.com/basementstudio/basement-cli/commit/9af1be7701eeea3d1843cacdce52e144954aac0d) Thanks [@valebearzotti](https://github.com/valebearzotti)! - Set up automated npm releases with Changesets and GitHub Actions.
|
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
This is **basement**, a CLI tool that scaffolds Next.js projects with AI agent integration. It creates projects from templates (Default, WebGL, WebGPU, Experiment) and optionally injects CMS integrations (Sanity, BaseHub) and animation libraries (GSAP, Framer Motion).
|
|
8
|
+
|
|
9
|
+
## Commands
|
|
10
|
+
|
|
11
|
+
### CLI Development
|
|
12
|
+
```bash
|
|
13
|
+
npm link # Install CLI locally for testing
|
|
14
|
+
basement # Run the CLI
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Generated Project Commands
|
|
18
|
+
Projects created by this CLI use these commands:
|
|
19
|
+
```bash
|
|
20
|
+
bun dev # Start dev server with Turbopack
|
|
21
|
+
bun build # Build for production
|
|
22
|
+
bun lint # Run Biome linter
|
|
23
|
+
bun lint:fix # Auto-fix linting issues
|
|
24
|
+
bun typecheck # Type check with tsgo
|
|
25
|
+
bun generate # Scaffold components/hooks
|
|
26
|
+
bun analyze # Bundle size analysis
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Sanity-specific (when Sanity CMS is selected):
|
|
30
|
+
```bash
|
|
31
|
+
bun sanity:extract # Extract Sanity schema
|
|
32
|
+
bun sanity:typegen # Generate TS types from Sanity schema
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Architecture
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
basement-starter-cli/
|
|
39
|
+
├── bin/index.js # CLI entry point (basement command)
|
|
40
|
+
├── src/commands/create.js # Main project creation logic
|
|
41
|
+
├── layers/ # Technology layer overlays (applied on top of next-starter)
|
|
42
|
+
│ ├── webgl/ # Three.js WebGL components (page, canvas, scene)
|
|
43
|
+
│ ├── webgpu/ # WebGPU (deps-only, .gitkeep)
|
|
44
|
+
│ └── experiment/ # Creative coding (header, navigation, utils)
|
|
45
|
+
├── integrations/ # CMS integrations (injected on top of templates)
|
|
46
|
+
│ └── sanity/ # Sanity CMS files
|
|
47
|
+
├── template-hooks/ # Reusable React hooks (selected during setup)
|
|
48
|
+
└── plugins/ # Biome linting rules (Grit patterns)
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### CLI Flow (src/commands/create.js)
|
|
52
|
+
1. **Prompts**: Collect project name, template type, CMS, animation library, agent preference, hooks
|
|
53
|
+
2. **Template Download**: Clone from `basementstudio/next-starter#main`
|
|
54
|
+
3. **Layer Injection**: Overlay technology layer files from local `layers/{type}/` directory
|
|
55
|
+
4. **Integration Injection**: Overlay CMS files from `basementstudio/basement/integrations/{cms}#sanity-integration`
|
|
56
|
+
5. **Package Hydration**: Inject layer deps (from LAYER_CONFIG), CMS deps, animation deps, and scripts
|
|
57
|
+
6. **Agent Skills**: Install AI agent skills via `bunx skills add`
|
|
58
|
+
7. **Hooks**: Copy selected hooks from `template-hooks/`
|
|
59
|
+
|
|
60
|
+
## Generated Project Stack
|
|
61
|
+
|
|
62
|
+
Projects created by this CLI use:
|
|
63
|
+
- **Next.js 16+** with App Router, Turbopack, Cache Components
|
|
64
|
+
- **React 19+** with React Compiler (no manual useMemo/useCallback needed)
|
|
65
|
+
- **TypeScript** strict mode with `noUncheckedIndexedAccess`
|
|
66
|
+
- **Tailwind CSS v4** (CSS-first configuration)
|
|
67
|
+
- **Biome** for linting/formatting
|
|
68
|
+
- **Zustand** for state management
|
|
69
|
+
- **Bun** as runtime/package manager
|
|
70
|
+
|
|
71
|
+
## Key Guidelines from Cursor Rules
|
|
72
|
+
|
|
73
|
+
### React Compiler
|
|
74
|
+
React Compiler is enabled - do NOT use `useMemo`, `useCallback`, or `React.memo`. Exception: use `useRef` for object instantiation to prevent infinite loops.
|
|
75
|
+
|
|
76
|
+
```tsx
|
|
77
|
+
// ❌ DON'T
|
|
78
|
+
const instance = new SomeClass()
|
|
79
|
+
|
|
80
|
+
// ✅ DO
|
|
81
|
+
const instanceRef = useRef<SomeClass | null>(null)
|
|
82
|
+
if (!instanceRef.current) instanceRef.current = new SomeClass()
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### React 19 Features
|
|
86
|
+
- `<Activity />` - Defer off-screen component updates (tabs, carousels, WebGL scenes)
|
|
87
|
+
- `useEffectEvent` - Separate event logic from effect dependencies
|
|
88
|
+
- `cacheSignal()` - Auto-abort signal for server component data fetching
|
|
89
|
+
- Refs as regular props (no forwardRef needed)
|
|
90
|
+
|
|
91
|
+
### Image Components
|
|
92
|
+
- Use `@/components/ui/image` for standard images (not `next/image` directly)
|
|
93
|
+
- For WebGL: use `@/lib/webgl/components/image`
|
|
94
|
+
|
|
95
|
+
### CSS Modules
|
|
96
|
+
Import as `s`, use `cn` from `@/styles/cn` for className conditionals:
|
|
97
|
+
```tsx
|
|
98
|
+
import s from './component.module.css'
|
|
99
|
+
import { cn } from '@/styles/cn'
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Custom PostCSS Functions
|
|
103
|
+
- `tovw(pixels)` - Convert to viewport width
|
|
104
|
+
- `torem(pixels)` - Convert to rem
|
|
105
|
+
- `columns(n)` - Width based on grid columns
|
|
106
|
+
|
|
107
|
+
### Sanity CMS
|
|
108
|
+
- All files in `/lib/integrations/sanity/`
|
|
109
|
+
- Use `defineType`, `defineField`, `defineArrayMember` for schemas
|
|
110
|
+
- GROQ queries use `SCREAMING_SNAKE_CASE`, wrap with `defineQuery`
|
|
111
|
+
- Use `sanityFetch` (includes `cacheSignal()` automatically)
|
|
112
|
+
- Visual editing: add `data-sanity` attributes
|
|
113
|
+
- Nested layouts (e.g. `app/studio/layout.tsx`) must NOT render `<html>` or `<body>` tags — the root layout already provides them. Just return `children`.
|
|
114
|
+
- Studio route guard: site chrome (nav, skip link, footer) is wrapped in `<SanityStudioGuard>` — a `"use client"` component using `useSelectedLayoutSegment()` that returns `null` on `/studio` routes. This prevents layout duplication in the Sanity Presentation tool.
|
|
115
|
+
|
|
116
|
+
### Next.js Dynamic Rendering Rules
|
|
117
|
+
**NEVER call `headers()`, `cookies()`, `draftMode()`, or `searchParams` in root layouts** — these trigger "uncached data / Runtime data accessed outside `<Suspense>`" errors that block the entire page. Instead:
|
|
118
|
+
- For route detection in layouts: use `useSelectedLayoutSegment()` in a `"use client"` wrapper component
|
|
119
|
+
- For draft mode / visual editing: extract into an async server component wrapped in its own `<Suspense>` boundary (see `components/sanity/visual-editing.tsx`)
|
|
120
|
+
- Root layouts should have ZERO dynamic function calls — encapsulate all dynamic behavior in child components with proper Suspense boundaries
|
|
121
|
+
|
|
122
|
+
### Integration File Sources
|
|
123
|
+
- **Technology layers** (`layers/`) are LOCAL files in this CLI repo
|
|
124
|
+
- **CMS integrations** (`integrations/`) are downloaded from REMOTE GitHub branches via `tiged` — the local `integrations/` directory is only a reference copy
|
|
125
|
+
- Files that need to exist in generated projects but aren't on the remote branch must be **generated inline by the merger** (e.g., `SanityStudioGuard` component is written by `layout-merger.js`)
|
|
126
|
+
|
|
127
|
+
### Debug Components
|
|
128
|
+
Always gate debug UI (not auto-removed in production):
|
|
129
|
+
```tsx
|
|
130
|
+
{process.env.NODE_ENV === 'development' && <Stats />}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Biome Plugins
|
|
134
|
+
|
|
135
|
+
Custom linting rules in `plugins/`:
|
|
136
|
+
- `no-anchor-element.grit` - Enforce Next.js `<Link>` over `<a>`
|
|
137
|
+
- `no-unnecessary-forwardref.grit` - Prevent forwardRef with React 19
|
|
138
|
+
- `no-relative-parent-imports.grit` - Enforce `@/` alias imports
|
package/README.md
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
# basement `1.0.0`
|
|
2
|
+
|
|
3
|
+
Your project starts here. One command to go from zero to a fully configured Next.js project with our stack, CMS, agent skills, and everything wired up.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
basement
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## What's in 1.0
|
|
10
|
+
|
|
11
|
+
### Instant project scaffolding from templates
|
|
12
|
+
|
|
13
|
+
Spin up a new project based on the stack we actually use. Pick a template, answer a few prompts, and you're running.
|
|
14
|
+
|
|
15
|
+
| Template | What you get |
|
|
16
|
+
|----------|-------------|
|
|
17
|
+
| **Default** | Next.js 16 + React 19 + Tailwind v4 + Biome + Zustand |
|
|
18
|
+
| **WebGL** | + React Three Fiber + Three.js |
|
|
19
|
+
| **WebGPU** | + R3F WebGPU renderer (alpha) |
|
|
20
|
+
| **Experiment** | + Creative coding setup with navigation UI |
|
|
21
|
+
|
|
22
|
+
Every template ships with TypeScript strict mode, React Compiler, Turbopack, PostCSS functions (`tovw`, `torem`, `columns`), component generation scripts, and the full `lib/` architecture.
|
|
23
|
+
|
|
24
|
+
### Full Sanity integration — code and infrastructure
|
|
25
|
+
|
|
26
|
+
Not just boilerplate files. The CLI sets up your entire Sanity stack:
|
|
27
|
+
|
|
28
|
+
- Embedded Studio at `/studio` with schemas, structure builder, and live preview
|
|
29
|
+
- GROQ queries with TypeScript type generation
|
|
30
|
+
- Draft mode with visual editing
|
|
31
|
+
- API routes for revalidation webhooks
|
|
32
|
+
- `.env.local` with all credentials
|
|
33
|
+
|
|
34
|
+
**Automated project creation** — The CLI creates a Sanity project on your dashboard, generates API tokens, and wires everything into your repo. If you're not logged in, it opens `sanity login` inline — you never leave the terminal.
|
|
35
|
+
|
|
36
|
+
### Add Sanity to existing projects
|
|
37
|
+
|
|
38
|
+
Already have a project running? The `--add` command injects Sanity into it. It detects your project structure (`app/` or `src/app/`) and smart-merges layout, sitemap, and integration files without overwriting your code.
|
|
39
|
+
|
|
40
|
+
Real-world validated — this is how we integrated Sanity into the ROX project.
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
basement --add
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Agent skills out of the box
|
|
47
|
+
|
|
48
|
+
Pick your agent (Claude Code or OpenCode) and the CLI installs curated skills so it understands our stack from the start:
|
|
49
|
+
|
|
50
|
+
- React + Next.js performance patterns
|
|
51
|
+
- Web design and accessibility guidelines
|
|
52
|
+
- Frontend design standards
|
|
53
|
+
- WebGPU/TSL guides (for WebGPU and Experiment templates)
|
|
54
|
+
- Sanity agent toolkit (when Sanity is selected)
|
|
55
|
+
|
|
56
|
+
For Claude Code + Sanity, it also registers the Sanity MCP server automatically.
|
|
57
|
+
|
|
58
|
+
### Git worktrees for parallel agent work
|
|
59
|
+
|
|
60
|
+
Run multiple Claude Code instances on separate branches without conflicts. The CLI manages worktree creation, switching, and cleanup.
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
basement -wc -b=feature/auth,feature/dashboard,fix/bug-123
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Creates three isolated worktrees with dependencies auto-installed. Each one is a full working copy your agent can run in independently.
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## (SOON) Installation
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
npm install -g basement
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
For local development — clone the repo and run:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
npm link
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Usage
|
|
83
|
+
|
|
84
|
+
Interactive mode — answer prompts step by step:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
basement
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Skip everything with flags:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
basement --create my-app --webgpu --sanity --gsap --claude
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Add Sanity to an existing project:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
basement --add
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Manage worktrees:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
basement --worktree
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## All Flags
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
basement [mode] [project-name] [flags]
|
|
112
|
+
|
|
113
|
+
Modes:
|
|
114
|
+
-c, --create Setup a new project
|
|
115
|
+
-a, --add Add integration to existing project
|
|
116
|
+
-w, --worktree Manage git worktrees
|
|
117
|
+
|
|
118
|
+
Templates:
|
|
119
|
+
-d, --default Next.js starter
|
|
120
|
+
--webgl Three.js WebGL
|
|
121
|
+
--webgpu WebGPU graphics
|
|
122
|
+
--experiment Creative coding
|
|
123
|
+
|
|
124
|
+
CMS:
|
|
125
|
+
--sanity Sanity CMS
|
|
126
|
+
--basehub BaseHub CMS
|
|
127
|
+
--no-cms No CMS
|
|
128
|
+
|
|
129
|
+
Animation:
|
|
130
|
+
--gsap GSAP
|
|
131
|
+
--motion Framer Motion
|
|
132
|
+
--no-animation No animation library
|
|
133
|
+
|
|
134
|
+
Agent:
|
|
135
|
+
--claude Claude Code
|
|
136
|
+
--opencode OpenCode
|
|
137
|
+
|
|
138
|
+
Hooks:
|
|
139
|
+
--no-hooks Skip hook selection
|
|
140
|
+
|
|
141
|
+
Worktrees:
|
|
142
|
+
-wc, --worktree-create Create worktree(s)
|
|
143
|
+
-wl, --worktree-list List worktrees
|
|
144
|
+
-ws, --worktree-switch Switch to a worktree
|
|
145
|
+
-wr, --worktree-remove Remove a worktree
|
|
146
|
+
-wp, --worktree-prune Clean up stale references
|
|
147
|
+
-b=<branch> Branch name (comma-separated for multiple)
|
|
148
|
+
-db Delete branch on remove
|
|
149
|
+
-f Skip confirmations
|
|
150
|
+
|
|
151
|
+
Other:
|
|
152
|
+
-h, --help Show help
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Generated Project Commands
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
bun dev # Dev server with Turbopack
|
|
159
|
+
bun build # Production build
|
|
160
|
+
bun lint # Biome linter
|
|
161
|
+
bun lint:fix # Auto-fix lint issues
|
|
162
|
+
bun typecheck # Type check with tsgo
|
|
163
|
+
bun generate # Scaffold components/hooks
|
|
164
|
+
bun analyze # Bundle size analysis
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
With Sanity:
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
bun sanity:extract # Extract Sanity schema
|
|
171
|
+
bun sanity:typegen # Generate TS types from schema
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## License
|
|
175
|
+
|
|
176
|
+
ISC
|