create-lumen 2.0.0-alpha.0 → 2.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -12
- package/bin/cli.js +1 -0
- package/package.json +3 -2
- package/schema/fixtures/v2/invalid/architecture-preset-type-mismatch.json +35 -0
- package/schema/fixtures/v2/invalid/harness-empty-commands.json +37 -0
- package/schema/fixtures/v2/invalid/harness-missing-command.json +41 -0
- package/schema/fixtures/v2/invalid/invalid-validation-mode.json +34 -0
- package/schema/fixtures/v2/invalid/shadcn-without-tailwind.json +1 -1
- package/schema/fixtures/v2/valid/harness-full.json +44 -0
- package/schema/fixtures/v2/valid/react-vite-type-based.json +1 -1
- package/schema/fixtures/v2/valid/validation-none.json +41 -0
- package/schema/fixtures/v2/valid/validation-relaxed.json +41 -0
- package/schema/lumen.config.v2.json +54 -2
- package/skills/create-lumen/SKILL.md +110 -0
- package/skills/create-lumen/references/manifest-v2.md +9 -0
- package/src/agent-context.js +114 -0
- package/src/cli-args.js +65 -3
- package/src/configure.js +4 -0
- package/src/css.js +14 -30
- package/src/dependencies.js +28 -18
- package/src/engine/capabilities.js +174 -4
- package/src/engine/composition.js +644 -0
- package/src/engine/index.js +1 -0
- package/src/injector.js +294 -446
- package/src/main.js +20 -7
- package/src/manifest/emit.js +49 -3
- package/src/manifest/schema.js +65 -7
- package/src/prompts.js +459 -247
- package/src/readme.js +23 -2
- package/src/scaffold.js +17 -0
- package/templates/architectures/hybrid/main.jsx +10 -0
- package/templates/architectures/hybrid/main.tsx +10 -0
- package/templates/architectures/hybrid/src/App.jsx +20 -0
- package/templates/architectures/hybrid/src/App.tsx +20 -0
- package/templates/architectures/hybrid/src/shared/components/ui/Button.jsx +31 -0
- package/templates/architectures/hybrid/src/shared/components/ui/Button.tsx +36 -0
- package/templates/architectures/hybrid/src/shared/components/ui/index.js +1 -0
- package/templates/architectures/hybrid/src/shared/components/ui/index.ts +1 -0
- package/templates/architectures/hybrid/src/shared/hooks/useLocalStorage.jsx +28 -0
- package/templates/architectures/hybrid/src/shared/hooks/useLocalStorage.ts +28 -0
- package/templates/architectures/hybrid/src/shared/layouts/.gitkeep +0 -0
- package/templates/architectures/hybrid/src/shared/stores/.gitkeep +0 -0
- package/templates/architectures/hybrid/src/shared/styles/.gitkeep +0 -0
- package/templates/architectures/hybrid/src/shared/types/index.js +20 -0
- package/templates/architectures/hybrid/src/shared/types/index.ts +16 -0
- package/templates/architectures/hybrid/src/shared/utils/cn.jsx +3 -0
- package/templates/architectures/hybrid/src/shared/utils/cn.ts +5 -0
- package/templates/architectures/none/main.jsx +10 -0
- package/templates/architectures/none/main.tsx +10 -0
- package/templates/architectures/none/src/App.jsx +15 -0
- package/templates/architectures/none/src/App.tsx +15 -0
- package/templates/architectures/none/src/styles/.gitkeep +1 -0
- package/templates/architectures/none/src/types/index.js +20 -0
- package/templates/architectures/none/src/types/index.ts +16 -0
- package/templates/conditional/testing/jest/hybrid/src/__tests__/App.test.jsx +11 -0
- package/templates/conditional/testing/jest/hybrid/src/__tests__/App.test.tsx +11 -0
- package/templates/conditional/testing/jest/none/src/__tests__/App.test.jsx +11 -0
- package/templates/conditional/testing/jest/none/src/__tests__/App.test.tsx +11 -0
- package/templates/conditional/testing/vitest/hybrid/src/__tests__/App.test.jsx +10 -0
- package/templates/conditional/testing/vitest/hybrid/src/__tests__/App.test.tsx +10 -0
- package/templates/conditional/testing/vitest/none/src/__tests__/App.test.jsx +10 -0
- package/templates/conditional/testing/vitest/none/src/__tests__/App.test.tsx +10 -0
- package/templates/css/tailwind/src/globals.css +10 -0
- package/templates/css/tailwind/src/themes.css +86 -4
- package/templates/ui/shadcn/lib/utils.js +6 -0
- package/templates/ui/shadcn/lib/utils.ts +6 -0
- package/templates/ui/shadcn/primitives/Button.jsx +48 -0
- package/templates/ui/shadcn/primitives/Button.tsx +59 -0
- package/templates/ui/shadcn/primitives/Card.jsx +55 -0
- package/templates/ui/shadcn/primitives/Card.tsx +73 -0
- package/templates/ui/shadcn/primitives/index.js +9 -0
- package/templates/ui/shadcn/primitives/index.ts +9 -0
- package/templates/css/bootstrap/src/themes.css +0 -14
- /package/templates/{css/bootstrap/src/globals.css → architectures/hybrid/src/features/.gitkeep} +0 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# create-lumen
|
|
2
2
|
|
|
3
|
-
A scaffolder that generates production-ready React + Vite projects (feature-based
|
|
3
|
+
A scaffolder that generates production-ready React + Vite projects (feature-based, type-based, hybrid, or none).
|
|
4
4
|
|
|
5
5
|
Note: this repository is the CLI scaffolder itself, not a generated app. Generated projects live in the target folder you create.
|
|
6
6
|
|
|
@@ -34,6 +34,12 @@ npm create lumen my-app -- --template react-ts
|
|
|
34
34
|
npm create lumen my-app -- -t react-type-js
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
+
Choose framework and architecture directly:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm create lumen my-app -- --framework react --arch none
|
|
41
|
+
```
|
|
42
|
+
|
|
37
43
|
Drive scaffolding directly from a manifest file or inline JSON (manifest v2):
|
|
38
44
|
|
|
39
45
|
```bash
|
|
@@ -64,15 +70,15 @@ create-lumen my-app # after npm link
|
|
|
64
70
|
|
|
65
71
|
## Features
|
|
66
72
|
|
|
67
|
-
- Architecture choice: feature-based
|
|
73
|
+
- Architecture choice: feature-based, type-based, hybrid, or none (per-framework availability)
|
|
68
74
|
- TypeScript or JavaScript output
|
|
69
|
-
- CSS frameworks: Tailwind CSS v4 (CSS-first `@theme`, v3 dropped)
|
|
75
|
+
- CSS frameworks: Tailwind CSS v4 (CSS-first `@theme`, v3 dropped) or none
|
|
70
76
|
- Optional state management: Zustand or Redux Toolkit
|
|
71
77
|
- Optional router (React Router)
|
|
72
78
|
- Optional testing: Vitest or Jest
|
|
73
79
|
- Linting: ESLint (default), Oxlint, or Biome
|
|
74
80
|
- Code formatter: Prettier or Oxfmt (chosen after the linter; `eslint-config-prettier` is auto-wired for the ESLint + Prettier combo)
|
|
75
|
-
- Manifest v2: Emits a deterministic `lumen.config.json` validated against JSON Schema Draft 2020-12
|
|
81
|
+
- Manifest v2: Emits a deterministic `lumen.config.json` (optional but recommended) validated against JSON Schema Draft 2020-12, including architecture validation modes and harness command configuration.
|
|
76
82
|
- Explicit path mapping: Target directories declared for `lumen-cli` code generation
|
|
77
83
|
- Optional Axios setup and icon libraries
|
|
78
84
|
- Auto `git init`, generated `README` (with a project description reflecting the chosen tooling) and `LICENSE`
|
|
@@ -148,8 +154,8 @@ src/
|
|
|
148
154
|
├── layouts
|
|
149
155
|
├── stores
|
|
150
156
|
├── styles
|
|
151
|
-
│ ├── globals.css # Tailwind
|
|
152
|
-
│ └── themes.css # Theme tokens (Tailwind @theme /
|
|
157
|
+
│ ├── globals.css # Tailwind directives (or main.css for vanilla)
|
|
158
|
+
│ └── themes.css # Theme tokens (Tailwind @theme / CSS vars)
|
|
153
159
|
├── types
|
|
154
160
|
└── utils
|
|
155
161
|
```
|
|
@@ -177,8 +183,8 @@ src/
|
|
|
177
183
|
├── services
|
|
178
184
|
├── store
|
|
179
185
|
├── styles
|
|
180
|
-
│ ├── globals.css # Tailwind
|
|
181
|
-
│ └── themes.css # Theme tokens (Tailwind @theme /
|
|
186
|
+
│ ├── globals.css # Tailwind directives (or main.css for vanilla)
|
|
187
|
+
│ └── themes.css # Theme tokens (Tailwind @theme / CSS vars)
|
|
182
188
|
├── test
|
|
183
189
|
└── utils
|
|
184
190
|
```
|
|
@@ -187,15 +193,32 @@ src/
|
|
|
187
193
|
|
|
188
194
|
`create-lumen` is part of the Lumen ecosystem alongside **`lumen-cli`**:
|
|
189
195
|
|
|
190
|
-
- **`create-lumen` (this repo):** The bootstrap scaffolder that initializes project repositories and writes an explicit, strictly validated `lumen.config.json` manifest (`manifestVersion: 2`) into the project root.
|
|
191
|
-
- **`lumen-cli`:** The companion developer CLI that reads `lumen.config.json` to generate components, features, hooks, and
|
|
196
|
+
- **`create-lumen` (this repo):** The bootstrap scaffolder that initializes project repositories and writes an explicit, strictly validated `lumen.config.json` manifest (`manifestVersion: 2`) into the project root. The manifest is **optional but highly recommended** for full editor integration and agent interoperability. If omitted, `lumen-cli` will attempt to infer a basic configuration, but advanced features (like configurable harness and architecture validation) require the manifest.
|
|
197
|
+
- **`lumen-cli`:** The companion developer CLI that reads `lumen.config.json` to generate components, features, hooks, services, and run diagnostics (harness and doctor) at the paths declared in `manifest.paths`. It also provides commands to inspect and update the manifest.
|
|
198
|
+
|
|
199
|
+
### Manifest v2 Schema (v2.0.0-alpha.1+)
|
|
200
|
+
|
|
201
|
+
The manifest now includes:
|
|
202
|
+
- **`architecture.preset`**: The base architecture (`feature-based`, `type-based`, `hybrid`, `none`).
|
|
203
|
+
- **`architecture.validation`**: Validation mode for `lumen doctor` (`strict`, `relaxed`, `none`).
|
|
204
|
+
- **`harness.commands`**: An array of commands to run with `lumen harness` (e.g., lint, format, types, test, build), each with a name, shell command, required flag, and description.
|
|
192
205
|
|
|
193
206
|
### Ecosystem Documentation & Contracts
|
|
194
207
|
|
|
195
|
-
- **[
|
|
196
|
-
- **[
|
|
208
|
+
- **[Documentation Index](./docs/README.md):** Complete overview of specifications, ADRs, and developer guides.
|
|
209
|
+
- **[Generator Engine & Capabilities Guide (M2)](./docs/engine-capabilities.md):** Capability model, template composition, shadcn/ui on Tailwind v4, architecture presets, and Bootstrap removal.
|
|
210
|
+
- **[Manifest v2 Overview](./docs/manifest-v2.md):** Specification of the nested schema, validation behavior, and the new harness and architecture validation fields.
|
|
211
|
+
- **[Shared Contract: `create-lumen` ↔ `lumen-cli`](./docs/contracts/manifest-v2-contract.md):** The agreed contract for path mapping, barrel conventions, version negotiation, and the harness/configuration interface.
|
|
197
212
|
- **[v1 to v2 Migration Guide](./docs/migration/v1-to-v2.md):** Complete guide for migrating generated projects and legacy flat configs to v2.
|
|
198
213
|
|
|
214
|
+
### Agent Interoperability
|
|
215
|
+
|
|
216
|
+
Lumen is designed for both people and agents. When `agentDocs: true` is set in the manifest (or via the `--agent-docs` flag), `create-lumen` generates a `.lumen/` directory in the project root containing:
|
|
217
|
+
- `project.json`: The resolved manifest.
|
|
218
|
+
- `architecture.json`: The effective architecture preset and validation mode.
|
|
219
|
+
- `conventions.md`: A markdown file documenting project-specific conventions (e.g., component naming, file organization).
|
|
220
|
+
These files enable agents to understand the project without parsing the source code.
|
|
221
|
+
|
|
199
222
|
## Roadmap & Planning
|
|
200
223
|
|
|
201
224
|
- **Changelog:** Notable changes are documented in [`docs/CHANGELOG.md`](./docs/CHANGELOG.md) (Keep a Changelog format).
|
package/bin/cli.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-lumen",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
4
|
-
"description": "Scaffold a React + Vite project with architecture choice: feature-based
|
|
3
|
+
"version": "2.0.0-alpha.2",
|
|
4
|
+
"description": "Scaffold a React + Vite project with architecture choice: feature-based, type-based, hybrid, or none.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"create-lumen": "bin/cli.js"
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"register.js",
|
|
16
16
|
"src/",
|
|
17
17
|
"templates/",
|
|
18
|
+
"skills/",
|
|
18
19
|
"schema/",
|
|
19
20
|
"README.md",
|
|
20
21
|
"LICENSE"
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://lumen-sh.github.io/create-lumen/schema/lumen.config.v2.json",
|
|
3
|
+
"manifestVersion": 2,
|
|
4
|
+
"framework": {
|
|
5
|
+
"name": "react",
|
|
6
|
+
"variant": "vite"
|
|
7
|
+
},
|
|
8
|
+
"styling": {
|
|
9
|
+
"engine": "tailwind"
|
|
10
|
+
},
|
|
11
|
+
"architecture": {
|
|
12
|
+
"preset": "feature-based",
|
|
13
|
+
"type": "type-based",
|
|
14
|
+
"validation": "strict"
|
|
15
|
+
},
|
|
16
|
+
"ui": {
|
|
17
|
+
"kit": "none"
|
|
18
|
+
},
|
|
19
|
+
"docs": {
|
|
20
|
+
"language": "en"
|
|
21
|
+
},
|
|
22
|
+
"paths": {
|
|
23
|
+
"features": "src/features",
|
|
24
|
+
"components": "src/shared/components",
|
|
25
|
+
"services": "src/shared/services",
|
|
26
|
+
"hooks": "src/shared/hooks",
|
|
27
|
+
"pages": "src/app/router",
|
|
28
|
+
"ui": "src/shared/components/ui"
|
|
29
|
+
},
|
|
30
|
+
"tooling": {
|
|
31
|
+
"language": "ts",
|
|
32
|
+
"linter": "eslint",
|
|
33
|
+
"formatter": "prettier"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://lumen-sh.github.io/create-lumen/schema/lumen.config.v2.json",
|
|
3
|
+
"manifestVersion": 2,
|
|
4
|
+
"framework": {
|
|
5
|
+
"name": "react",
|
|
6
|
+
"variant": "vite"
|
|
7
|
+
},
|
|
8
|
+
"styling": {
|
|
9
|
+
"engine": "tailwind"
|
|
10
|
+
},
|
|
11
|
+
"architecture": {
|
|
12
|
+
"preset": "feature-based",
|
|
13
|
+
"validation": "strict"
|
|
14
|
+
},
|
|
15
|
+
"harness": {
|
|
16
|
+
"commands": []
|
|
17
|
+
},
|
|
18
|
+
"ui": {
|
|
19
|
+
"kit": "none"
|
|
20
|
+
},
|
|
21
|
+
"docs": {
|
|
22
|
+
"language": "en"
|
|
23
|
+
},
|
|
24
|
+
"paths": {
|
|
25
|
+
"features": "src/features",
|
|
26
|
+
"components": "src/shared/components",
|
|
27
|
+
"services": "src/shared/services",
|
|
28
|
+
"hooks": "src/shared/hooks",
|
|
29
|
+
"pages": "src/app/router",
|
|
30
|
+
"ui": "src/shared/components/ui"
|
|
31
|
+
},
|
|
32
|
+
"tooling": {
|
|
33
|
+
"language": "ts",
|
|
34
|
+
"linter": "eslint",
|
|
35
|
+
"formatter": "prettier"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://lumen-sh.github.io/create-lumen/schema/lumen.config.v2.json",
|
|
3
|
+
"manifestVersion": 2,
|
|
4
|
+
"framework": {
|
|
5
|
+
"name": "react",
|
|
6
|
+
"variant": "vite"
|
|
7
|
+
},
|
|
8
|
+
"styling": {
|
|
9
|
+
"engine": "tailwind"
|
|
10
|
+
},
|
|
11
|
+
"architecture": {
|
|
12
|
+
"preset": "feature-based",
|
|
13
|
+
"validation": "strict"
|
|
14
|
+
},
|
|
15
|
+
"harness": {
|
|
16
|
+
"commands": [
|
|
17
|
+
{ "name": "lint", "required": true },
|
|
18
|
+
{ "name": "test", "command": "vitest run", "required": true },
|
|
19
|
+
{ "name": "build", "command": "npm run build", "required": true }
|
|
20
|
+
]
|
|
21
|
+
},
|
|
22
|
+
"ui": {
|
|
23
|
+
"kit": "none"
|
|
24
|
+
},
|
|
25
|
+
"docs": {
|
|
26
|
+
"language": "en"
|
|
27
|
+
},
|
|
28
|
+
"paths": {
|
|
29
|
+
"features": "src/features",
|
|
30
|
+
"components": "src/shared/components",
|
|
31
|
+
"services": "src/shared/services",
|
|
32
|
+
"hooks": "src/shared/hooks",
|
|
33
|
+
"pages": "src/app/router",
|
|
34
|
+
"ui": "src/shared/components/ui"
|
|
35
|
+
},
|
|
36
|
+
"tooling": {
|
|
37
|
+
"language": "ts",
|
|
38
|
+
"linter": "eslint",
|
|
39
|
+
"formatter": "prettier"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://lumen-sh.github.io/create-lumen/schema/lumen.config.v2.json",
|
|
3
|
+
"manifestVersion": 2,
|
|
4
|
+
"framework": {
|
|
5
|
+
"name": "react",
|
|
6
|
+
"variant": "vite"
|
|
7
|
+
},
|
|
8
|
+
"styling": {
|
|
9
|
+
"engine": "tailwind"
|
|
10
|
+
},
|
|
11
|
+
"architecture": {
|
|
12
|
+
"preset": "feature-based",
|
|
13
|
+
"validation": "super-strict"
|
|
14
|
+
},
|
|
15
|
+
"ui": {
|
|
16
|
+
"kit": "none"
|
|
17
|
+
},
|
|
18
|
+
"docs": {
|
|
19
|
+
"language": "en"
|
|
20
|
+
},
|
|
21
|
+
"paths": {
|
|
22
|
+
"features": "src/features",
|
|
23
|
+
"components": "src/shared/components",
|
|
24
|
+
"services": "src/shared/services",
|
|
25
|
+
"hooks": "src/shared/hooks",
|
|
26
|
+
"pages": "src/app/router",
|
|
27
|
+
"ui": "src/shared/components/ui"
|
|
28
|
+
},
|
|
29
|
+
"tooling": {
|
|
30
|
+
"language": "ts",
|
|
31
|
+
"linter": "eslint",
|
|
32
|
+
"formatter": "prettier"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://lumen-sh.github.io/create-lumen/schema/lumen.config.v2.json",
|
|
3
|
+
"manifestVersion": 2,
|
|
4
|
+
"framework": {
|
|
5
|
+
"name": "react",
|
|
6
|
+
"variant": "vite"
|
|
7
|
+
},
|
|
8
|
+
"styling": {
|
|
9
|
+
"engine": "tailwind"
|
|
10
|
+
},
|
|
11
|
+
"architecture": {
|
|
12
|
+
"preset": "feature-based",
|
|
13
|
+
"type": "feature-based",
|
|
14
|
+
"validation": "strict"
|
|
15
|
+
},
|
|
16
|
+
"harness": {
|
|
17
|
+
"commands": [
|
|
18
|
+
{ "name": "lint", "command": "oxlint .", "required": true },
|
|
19
|
+
{ "name": "format", "command": "oxfmt --check .", "required": true },
|
|
20
|
+
{ "name": "types", "command": "tsc -b", "required": true },
|
|
21
|
+
{ "name": "test", "command": "vitest run", "required": true },
|
|
22
|
+
{ "name": "build", "command": "npm run build", "required": true }
|
|
23
|
+
]
|
|
24
|
+
},
|
|
25
|
+
"ui": {
|
|
26
|
+
"kit": "none"
|
|
27
|
+
},
|
|
28
|
+
"docs": {
|
|
29
|
+
"language": "en"
|
|
30
|
+
},
|
|
31
|
+
"paths": {
|
|
32
|
+
"features": "src/features",
|
|
33
|
+
"components": "src/shared/components",
|
|
34
|
+
"services": "src/shared/services",
|
|
35
|
+
"hooks": "src/shared/hooks",
|
|
36
|
+
"pages": "src/app/router",
|
|
37
|
+
"ui": "src/shared/components/ui"
|
|
38
|
+
},
|
|
39
|
+
"tooling": {
|
|
40
|
+
"language": "ts",
|
|
41
|
+
"linter": "eslint",
|
|
42
|
+
"formatter": "prettier"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://lumen-sh.github.io/create-lumen/schema/lumen.config.v2.json",
|
|
3
|
+
"manifestVersion": 2,
|
|
4
|
+
"framework": {
|
|
5
|
+
"name": "react",
|
|
6
|
+
"variant": "vite"
|
|
7
|
+
},
|
|
8
|
+
"styling": {
|
|
9
|
+
"engine": "tailwind"
|
|
10
|
+
},
|
|
11
|
+
"architecture": {
|
|
12
|
+
"preset": "feature-based",
|
|
13
|
+
"validation": "none"
|
|
14
|
+
},
|
|
15
|
+
"harness": {
|
|
16
|
+
"commands": [
|
|
17
|
+
{ "name": "lint", "command": "oxlint .", "required": true },
|
|
18
|
+
{ "name": "test", "command": "vitest run", "required": true },
|
|
19
|
+
{ "name": "build", "command": "npm run build", "required": true }
|
|
20
|
+
]
|
|
21
|
+
},
|
|
22
|
+
"ui": {
|
|
23
|
+
"kit": "none"
|
|
24
|
+
},
|
|
25
|
+
"docs": {
|
|
26
|
+
"language": "en"
|
|
27
|
+
},
|
|
28
|
+
"paths": {
|
|
29
|
+
"features": "src/features",
|
|
30
|
+
"components": "src/shared/components",
|
|
31
|
+
"services": "src/shared/services",
|
|
32
|
+
"hooks": "src/shared/hooks",
|
|
33
|
+
"pages": "src/app/router",
|
|
34
|
+
"ui": "src/shared/components/ui"
|
|
35
|
+
},
|
|
36
|
+
"tooling": {
|
|
37
|
+
"language": "ts",
|
|
38
|
+
"linter": "eslint",
|
|
39
|
+
"formatter": "prettier"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://lumen-sh.github.io/create-lumen/schema/lumen.config.v2.json",
|
|
3
|
+
"manifestVersion": 2,
|
|
4
|
+
"framework": {
|
|
5
|
+
"name": "react",
|
|
6
|
+
"variant": "vite"
|
|
7
|
+
},
|
|
8
|
+
"styling": {
|
|
9
|
+
"engine": "tailwind"
|
|
10
|
+
},
|
|
11
|
+
"architecture": {
|
|
12
|
+
"preset": "feature-based",
|
|
13
|
+
"validation": "relaxed"
|
|
14
|
+
},
|
|
15
|
+
"harness": {
|
|
16
|
+
"commands": [
|
|
17
|
+
{ "name": "lint", "command": "oxlint .", "required": true },
|
|
18
|
+
{ "name": "test", "command": "vitest run", "required": true },
|
|
19
|
+
{ "name": "build", "command": "npm run build", "required": true }
|
|
20
|
+
]
|
|
21
|
+
},
|
|
22
|
+
"ui": {
|
|
23
|
+
"kit": "none"
|
|
24
|
+
},
|
|
25
|
+
"docs": {
|
|
26
|
+
"language": "en"
|
|
27
|
+
},
|
|
28
|
+
"paths": {
|
|
29
|
+
"features": "src/features",
|
|
30
|
+
"components": "src/shared/components",
|
|
31
|
+
"services": "src/shared/services",
|
|
32
|
+
"hooks": "src/shared/hooks",
|
|
33
|
+
"pages": "src/app/router",
|
|
34
|
+
"ui": "src/shared/components/ui"
|
|
35
|
+
},
|
|
36
|
+
"tooling": {
|
|
37
|
+
"language": "ts",
|
|
38
|
+
"linter": "eslint",
|
|
39
|
+
"formatter": "prettier"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -62,7 +62,6 @@
|
|
|
62
62
|
"type": "string",
|
|
63
63
|
"enum": [
|
|
64
64
|
"tailwind",
|
|
65
|
-
"bootstrap",
|
|
66
65
|
"none"
|
|
67
66
|
]
|
|
68
67
|
}
|
|
@@ -75,6 +74,15 @@
|
|
|
75
74
|
"architecture": {
|
|
76
75
|
"type": "object",
|
|
77
76
|
"properties": {
|
|
77
|
+
"preset": {
|
|
78
|
+
"type": "string",
|
|
79
|
+
"enum": [
|
|
80
|
+
"feature-based",
|
|
81
|
+
"type-based",
|
|
82
|
+
"hybrid",
|
|
83
|
+
"none"
|
|
84
|
+
]
|
|
85
|
+
},
|
|
78
86
|
"type": {
|
|
79
87
|
"type": "string",
|
|
80
88
|
"enum": [
|
|
@@ -83,10 +91,54 @@
|
|
|
83
91
|
"hybrid",
|
|
84
92
|
"none"
|
|
85
93
|
]
|
|
94
|
+
},
|
|
95
|
+
"validation": {
|
|
96
|
+
"default": "strict",
|
|
97
|
+
"type": "string",
|
|
98
|
+
"enum": [
|
|
99
|
+
"strict",
|
|
100
|
+
"relaxed",
|
|
101
|
+
"none"
|
|
102
|
+
]
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
"additionalProperties": false
|
|
106
|
+
},
|
|
107
|
+
"harness": {
|
|
108
|
+
"type": "object",
|
|
109
|
+
"properties": {
|
|
110
|
+
"commands": {
|
|
111
|
+
"minItems": 1,
|
|
112
|
+
"type": "array",
|
|
113
|
+
"items": {
|
|
114
|
+
"type": "object",
|
|
115
|
+
"properties": {
|
|
116
|
+
"name": {
|
|
117
|
+
"type": "string",
|
|
118
|
+
"minLength": 1
|
|
119
|
+
},
|
|
120
|
+
"command": {
|
|
121
|
+
"type": "string",
|
|
122
|
+
"minLength": 1
|
|
123
|
+
},
|
|
124
|
+
"required": {
|
|
125
|
+
"default": true,
|
|
126
|
+
"type": "boolean"
|
|
127
|
+
},
|
|
128
|
+
"description": {
|
|
129
|
+
"type": "string"
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
"required": [
|
|
133
|
+
"name",
|
|
134
|
+
"command"
|
|
135
|
+
],
|
|
136
|
+
"additionalProperties": false
|
|
137
|
+
}
|
|
86
138
|
}
|
|
87
139
|
},
|
|
88
140
|
"required": [
|
|
89
|
-
"
|
|
141
|
+
"commands"
|
|
90
142
|
],
|
|
91
143
|
"additionalProperties": false
|
|
92
144
|
},
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: create-lumen
|
|
3
|
+
description: Scaffold and extend a lumen v2 project (manifestVersion 2). Read lumen.config.json, resolve generator paths via manifest.paths, respect feature barrels, @/* alias, harness commands, and validation modes.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# create-lumen
|
|
7
|
+
|
|
8
|
+
## When to use
|
|
9
|
+
|
|
10
|
+
Use this skill when the working directory contains (or should contain) a
|
|
11
|
+
`lumen.config.json` with `manifestVersion: 2`: scaffolding follow-ups,
|
|
12
|
+
`lumen g` generation, `lumen doctor` / `lumen harness` diagnostics.
|
|
13
|
+
|
|
14
|
+
Do NOT guess layout. Every target directory comes from the manifest.
|
|
15
|
+
|
|
16
|
+
## 1. Read `lumen.config.json`
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
cat lumen.config.json
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Required top-level keys: `manifestVersion: 2`, `framework`, `styling`,
|
|
23
|
+
`architecture`, `ui`, `docs`, `paths`, `tooling`, `harness`.
|
|
24
|
+
Source of truth: `src/manifest/schema.js` (`parseManifest`, Zod strict).
|
|
25
|
+
Full spec: `docs/contracts/manifest-v2-contract.md`, `docs/manifest-v2.md`.
|
|
26
|
+
|
|
27
|
+
If `manifestVersion` is missing / `framework` is a string → **v1 manifest**:
|
|
28
|
+
fail fast (exit 1), generate nothing, point to
|
|
29
|
+
`docs/migration/v1-to-v2.md`.
|
|
30
|
+
|
|
31
|
+
## 2. Resolve paths via `manifest.paths` (never hardcode)
|
|
32
|
+
|
|
33
|
+
Generators MUST do `<root>/<manifest.paths.<key>>`. POSIX `/` separators.
|
|
34
|
+
|
|
35
|
+
| Framework | Preset | features | components | services | hooks | pages | ui |
|
|
36
|
+
|---|---|---|---|---|---|---|---|
|
|
37
|
+
| React+Vite | `feature-based` | `src/features` | `src/shared/components` | `src/shared/services` | `src/shared/hooks` | `src/app/router` | `src/shared/components/ui` |
|
|
38
|
+
| React+Vite | `type-based` | `src/features` | `src/components` | `src/services` | `src/hooks` | `src/pages` | `src/ui` |
|
|
39
|
+
| Next App | `feature-based`/`hybrid` | `src/features` | `src/shared/components` | `src/shared/services` | `src/shared/hooks` | `app` | `src/shared/components/ui` |
|
|
40
|
+
| Next Pages | `feature-based` | `src/features` | `src/shared/components` | `src/shared/services` | `src/shared/hooks` | `pages` | `src/shared/components/ui` |
|
|
41
|
+
| Any | `none` | `src` | `src` (`components/` for Next) | `src/services` | `src/hooks` | per framework | `src…/ui` |
|
|
42
|
+
|
|
43
|
+
Resolver: `src/manifest/paths.js` (`resolvePaths`). Fixtures:
|
|
44
|
+
`schema/fixtures/v2/valid/react-vite-feature-based.json`,
|
|
45
|
+
`full-kitchen-sink.json`.
|
|
46
|
+
|
|
47
|
+
## 3. Feature structure + barrels
|
|
48
|
+
|
|
49
|
+
New feature at `<paths.features>/<name>/` (e.g. `src/features/billing`):
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
lumen g feature billing
|
|
53
|
+
lumen g component billing/InvoiceCard --feature billing
|
|
54
|
+
lumen g hook useBilling --feature billing
|
|
55
|
+
lumen g service billing-api --feature billing
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Rules:
|
|
59
|
+
|
|
60
|
+
- Private subfolders: `components/ hooks/ layouts/ pages/ services/ store/ types/`.
|
|
61
|
+
- Public barrel required: `<feature>/index.ts` (or `.js` when
|
|
62
|
+
`tooling.language === "js"`). External code imports only the barrel:
|
|
63
|
+
`import { InvoiceCard } from "@/features/billing"`.
|
|
64
|
+
- Extensions: `.tsx`/`.jsx` for JSX components, `.ts`/`.js` for pure logic,
|
|
65
|
+
per `tooling.language`.
|
|
66
|
+
|
|
67
|
+
## 4. Path alias `@/*`
|
|
68
|
+
|
|
69
|
+
`@/*` → `<root>/src/*` (guaranteed by `tsconfig` + Vite/Next config).
|
|
70
|
+
Feature-based: shared imports via `@/shared/...`.
|
|
71
|
+
Type-based: `@/components/...`, `@/hooks/...`, `@/services/...`.
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
import { Button } from "@/shared/components/ui/button";
|
|
75
|
+
import { useBilling } from "@/features/billing";
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## 5. `harness.commands` execution
|
|
79
|
+
|
|
80
|
+
`lumen harness` runs each entry in order; `required: true` (default) fails
|
|
81
|
+
the run on error, `required: false` warns and continues.
|
|
82
|
+
|
|
83
|
+
```json
|
|
84
|
+
{ "name": "lint", "command": "oxlint .", "required": true }
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Defaults: `lint (oxlint .)`, `format (oxfmt --check .)`, `types (tsc -b)`,
|
|
88
|
+
`test (vitest run)`, `build (npm run build)`.
|
|
89
|
+
|
|
90
|
+
## 6. `architecture.validation` modes
|
|
91
|
+
|
|
92
|
+
| Mode | Behavior |
|
|
93
|
+
|---|---|
|
|
94
|
+
| `strict` | Enforce barrels, encapsulation, path rules; fail on violation. |
|
|
95
|
+
| `relaxed` | Warn on violation, still generate. |
|
|
96
|
+
| `none` | Skip architecture checks. |
|
|
97
|
+
|
|
98
|
+
Note: `architecture.preset` is canonical; legacy `type` is accepted as an
|
|
99
|
+
alias (`parseManifest` normalizes both). Valid presets: React →
|
|
100
|
+
`feature-based|type-based|none`; Next → `feature-based|hybrid|none`.
|
|
101
|
+
|
|
102
|
+
## 7. Common errors — reject, don't patch around
|
|
103
|
+
|
|
104
|
+
- **v1 rejection:** flat config (`css`, string `framework`/`architecture`) →
|
|
105
|
+
exit 1 + migration pointer. Never partially generate.
|
|
106
|
+
- **`shadcn` → `tailwind`:** `ui.kit: "shadcn"` requires
|
|
107
|
+
`styling.engine: "tailwind"` (v4 CSS-first, no `tailwind.config.js`).
|
|
108
|
+
- **`bundler`/`adapter` Next-only:** `framework.bundler` (`turbopack|webpack`)
|
|
109
|
+
and `adapter` (`node|vercel|cloudflare|static`) are prohibited on `react`.
|
|
110
|
+
`react` variant MUST be `vite`; `next` MUST be `app-router|pages-router`.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# manifest-v2 pointer
|
|
2
|
+
|
|
3
|
+
Canonical spec lives in `docs/` — do not duplicate it here.
|
|
4
|
+
|
|
5
|
+
- Contract: `docs/contracts/manifest-v2-contract.md`
|
|
6
|
+
- Shape / v1→v2 diff: `docs/manifest-v2.md`
|
|
7
|
+
- Zod source of truth: `src/manifest/schema.js`
|
|
8
|
+
- Path resolver: `src/manifest/paths.js`
|
|
9
|
+
- Valid fixtures: `schema/fixtures/v2/valid/`
|