@nexus-framework/cli 0.1.1 → 0.1.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 +69 -417
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +5 -4
- package/dist/commands/init.js.map +1 -1
- package/dist/generators/ai-config.d.ts +15 -8
- package/dist/generators/ai-config.d.ts.map +1 -1
- package/dist/generators/ai-config.js +165 -106
- package/dist/generators/ai-config.js.map +1 -1
- package/dist/generators/config.d.ts.map +1 -1
- package/dist/generators/config.js +127 -19
- package/dist/generators/config.js.map +1 -1
- package/dist/generators/docs.js +9 -9
- package/dist/generators/index.js +5 -3
- package/dist/generators/index.js.map +1 -1
- package/dist/generators/landing-page.d.ts.map +1 -1
- package/dist/generators/landing-page.js +310 -76
- package/dist/generators/landing-page.js.map +1 -1
- package/dist/generators/structure.d.ts.map +1 -1
- package/dist/generators/structure.js +161 -17
- package/dist/generators/structure.js.map +1 -1
- package/dist/generators/tests.js +1 -1
- package/dist/prompts/index.d.ts +3 -0
- package/dist/prompts/index.d.ts.map +1 -1
- package/dist/prompts/index.js +12 -8
- package/dist/prompts/index.js.map +1 -1
- package/dist/types/config.d.ts +3 -0
- package/dist/types/config.d.ts.map +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/logger.d.ts +2 -2
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +6 -3
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/validator.d.ts +20 -3
- package/dist/utils/validator.d.ts.map +1 -1
- package/dist/utils/validator.js +48 -15
- package/dist/utils/validator.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,10 +8,9 @@
|
|
|
8
8
|
|
|
9
9
|
[](https://www.typescriptlang.org/)
|
|
10
10
|
[](https://nodejs.org/)
|
|
11
|
-
[](https://vitest.dev/)
|
|
12
12
|
[](LICENSE)
|
|
13
13
|
[](https://github.com/GDA-Africa/nexus-cli/pulls)
|
|
14
|
-
[]()
|
|
15
14
|
|
|
16
15
|
---
|
|
17
16
|
|
|
@@ -23,22 +22,20 @@
|
|
|
23
22
|
|
|
24
23
|
## 🌍 About GDA Africa
|
|
25
24
|
|
|
26
|
-
**GDA (Glenhalton Digital Agency)** is building the digital infrastructure for Africa's next generation of products and services.
|
|
25
|
+
**GDA (Glenhalton Digital Agency)** is building the digital infrastructure for Africa's next generation of products and services. NEXUS CLI is GDA's open-source developer tool — a scaffolding engine that generates intelligent project structures where AI and humans collaborate from day one.
|
|
27
26
|
|
|
28
27
|
---
|
|
29
28
|
|
|
30
|
-
## 🎯 Why NEXUS
|
|
29
|
+
## 🎯 Why NEXUS?
|
|
31
30
|
|
|
32
|
-
Every new project starts with the same
|
|
31
|
+
Every new project starts with the same ritual: hours of boilerplate, fragmented configs, and zero documentation. NEXUS eliminates all of that.
|
|
33
32
|
|
|
34
33
|
| Problem | NEXUS Solution |
|
|
35
34
|
|---|---|
|
|
36
|
-
| 🕐
|
|
37
|
-
| 🤖 AI
|
|
38
|
-
|
|
|
39
|
-
|
|
|
40
|
-
| 📚 Onboarding new developers takes weeks, knowledge silos form | **Self-documenting projects** where the codebase explains itself to humans and AI alike |
|
|
41
|
-
| 🔄 No established conventions exist for AI-native development | **The first framework built for the AI era** — bridging requirements and code generation |
|
|
35
|
+
| 🕐 Hours of setup and config guesswork to start a project | **2-minute interactive setup** with strategy-first questions and smart defaults |
|
|
36
|
+
| 🤖 AI tools (Cursor, Copilot) have no project-wide context | **8 structured doc files** AI agents can parse, execute, and auto-populate |
|
|
37
|
+
| 🧪 Tests and docs are always afterthoughts | **Generated from day one** — test infrastructure, CI/CD, and documentation included |
|
|
38
|
+
| 🔄 No conventions exist for AI-native development | **The first framework built for the AI era** — bridging requirements and code generation |
|
|
42
39
|
|
|
43
40
|
---
|
|
44
41
|
|
|
@@ -51,20 +48,19 @@ Every new project starts with the same painful ritual: hours of boilerplate, fra
|
|
|
51
48
|
### Core Capabilities
|
|
52
49
|
- 🧠 **Strategy-First Setup** — Asks about your goals, not just tech preferences
|
|
53
50
|
- 📐 **Complete Scaffolding** — Production-ready structure, not hello world
|
|
54
|
-
- 📚 **NEXUS Doc System** — 8
|
|
51
|
+
- 📚 **NEXUS Doc System** — 8 AI-optimized markdown files per project
|
|
55
52
|
- 🎯 **Smart Defaults** — Best practices baked in based on your choices
|
|
56
|
-
- 🧪 **Test Infrastructure** — Vitest config, example tests, and helpers
|
|
57
|
-
- 🏗️ **Adopt Existing Projects** — Add NEXUS docs & AI config to any project with `--adopt`
|
|
53
|
+
- 🧪 **Test Infrastructure** — Vitest config, example tests, and helpers included
|
|
58
54
|
|
|
59
55
|
</td>
|
|
60
56
|
<td width="50%">
|
|
61
57
|
|
|
62
58
|
### Production Ready
|
|
63
|
-
- ⚡ **
|
|
59
|
+
- ⚡ **5 Frameworks** — Next.js, React+Vite, SvelteKit, Nuxt, Astro
|
|
64
60
|
- 🔧 **Full Toolchain** — TypeScript, ESLint, Prettier pre-configured
|
|
65
|
-
- 🚀 **CI/CD Templates** — GitHub Actions workflows
|
|
66
|
-
-
|
|
67
|
-
- 📦 **Strategy Patterns** — PWA, Offline-First, i18n, Theming,
|
|
61
|
+
- 🚀 **CI/CD Templates** — GitHub Actions workflows out of the box
|
|
62
|
+
- 🏗️ **Adopt Existing Projects** — Add NEXUS to any codebase with `nexus adopt`
|
|
63
|
+
- 📦 **Strategy Patterns** — PWA, Offline-First, i18n, Theming, Real-time
|
|
68
64
|
|
|
69
65
|
</td>
|
|
70
66
|
</tr>
|
|
@@ -72,464 +68,120 @@ Every new project starts with the same painful ritual: hours of boilerplate, fra
|
|
|
72
68
|
|
|
73
69
|
---
|
|
74
70
|
|
|
75
|
-
## 🏗️ Architecture
|
|
76
|
-
|
|
77
|
-
```
|
|
78
|
-
┌──────────────────────────────────────────────────────────────┐
|
|
79
|
-
│ NEXUS CLI │
|
|
80
|
-
│ nexus init <project-name> │
|
|
81
|
-
└──────────────────────┬───────────────────────────────────────┘
|
|
82
|
-
│
|
|
83
|
-
▼
|
|
84
|
-
┌──────────────────────────────────────────────────────────────┐
|
|
85
|
-
│ INTERACTIVE PROMPTS │
|
|
86
|
-
│ ┌─────────────┐ ┌──────────────┐ ┌────────────────────┐ │
|
|
87
|
-
│ │ Project Type │ │Data Strategy │ │ Application Pattern│ │
|
|
88
|
-
│ │ Web/API/Mono │ │Local/Cloud/ │ │ PWA/Offline/i18n/ │ │
|
|
89
|
-
│ │ │ │Hybrid │ │ Theming │ │
|
|
90
|
-
│ └──────┬──────┘ └──────┬───────┘ └─────────┬──────────┘ │
|
|
91
|
-
│ │ ┌──────────┐│┌───────────┐ │ │
|
|
92
|
-
│ │ │ Framework ││ Features & │ │ │
|
|
93
|
-
│ │ │ Selection ││ Extras │ │ │
|
|
94
|
-
│ │ └─────┬────┘│└─────┬─────┘ │ │
|
|
95
|
-
│ └──────────┼─────┼──────┼────────────┘ │
|
|
96
|
-
└────────────────────┼─────┼──────┼────────────────────────────┘
|
|
97
|
-
│ │ │ NexusConfig
|
|
98
|
-
▼ ▼ ▼
|
|
99
|
-
┌──────────────────────────────────────────────────────────────┐
|
|
100
|
-
│ GENERATOR ENGINE │
|
|
101
|
-
│ ┌───────────┐ ┌───────────┐ ┌──────────┐ ┌─────────────┐ │
|
|
102
|
-
│ │ Structure │ │ Docs │ │ Config │ │ Tests │ │
|
|
103
|
-
│ │ Generator │ │ Generator │ │Generator │ │ Generator │ │
|
|
104
|
-
│ └─────┬─────┘ └─────┬─────┘ └────┬─────┘ └──────┬──────┘ │
|
|
105
|
-
│ │ ┌─────────┘ │ │ │
|
|
106
|
-
│ │ │ ┌─────────────────┘ │ │
|
|
107
|
-
│ │ │ │ ┌────────────────────────────┘ │
|
|
108
|
-
│ ▼ ▼ ▼ ▼ │
|
|
109
|
-
│ ┌──────────────────────────┐ │
|
|
110
|
-
│ │ CI/CD Generator │ │
|
|
111
|
-
│ └──────────────────────────┘ │
|
|
112
|
-
└──────────────────────┬───────────────────────────────────────┘
|
|
113
|
-
│ Write to disk
|
|
114
|
-
▼
|
|
115
|
-
┌──────────────────────────────────────────────────────────────┐
|
|
116
|
-
│ YOUR NEW PROJECT ✨ │
|
|
117
|
-
│ │
|
|
118
|
-
│ 📁 src/ Source code with smart boilerplate │
|
|
119
|
-
│ � .nexus/ Docs, AI config, manifest — one folder │
|
|
120
|
-
│ 🧪 tests/ Unit, integration, and E2E scaffolding │
|
|
121
|
-
│ ⚙️ configs TS, ESLint, Prettier, CI/CD │
|
|
122
|
-
│ 📦 package.json Dependencies installed & ready │
|
|
123
|
-
│ │
|
|
124
|
-
│ → npm run dev Your app is running. │
|
|
125
|
-
└──────────────────────────────────────────────────────────────┘
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
---
|
|
129
|
-
|
|
130
|
-
## 📁 Project Structure
|
|
131
|
-
|
|
132
|
-
```
|
|
133
|
-
@nexus-framework/cli/
|
|
134
|
-
├── bin/
|
|
135
|
-
│ └── nexus.js # Executable entry point (shebang)
|
|
136
|
-
├── src/
|
|
137
|
-
│ ├── cli.ts # CLI entry point — Commander.js setup
|
|
138
|
-
│ ├── index.ts # Public API exports for programmatic usage
|
|
139
|
-
│ ├── version.ts # Single source of truth for CLI version
|
|
140
|
-
│ ├── commands/
|
|
141
|
-
│ │ ├── init.ts # `nexus init` — main scaffolding command
|
|
142
|
-
│ │ └── adopt.ts # `nexus adopt` — add NEXUS to existing projects
|
|
143
|
-
│ ├── prompts/
|
|
144
|
-
│ │ ├── index.ts # Prompt orchestrator — assembles NexusConfig
|
|
145
|
-
│ │ ├── project-type.ts # Web / API / Monorepo selection
|
|
146
|
-
│ │ ├── data-strategy.ts # Local Only / Local First / Cloud / Hybrid
|
|
147
|
-
│ │ ├── patterns.ts # PWA, Offline-First, i18n, Theming, Real-time
|
|
148
|
-
│ │ ├── frameworks.ts # Next.js, React+Vite, SvelteKit, Nuxt, Astro
|
|
149
|
-
│ │ └── features.ts # Testing, package manager, git, install prefs
|
|
150
|
-
│ ├── generators/
|
|
151
|
-
│ │ ├── index.ts # Generator orchestrator — runs all generators
|
|
152
|
-
│ │ ├── structure.ts # Folder structure, package.json, README, .gitignore
|
|
153
|
-
│ │ ├── docs.ts # 8 NEXUS doc files → .nexus/docs/ + index + manifest
|
|
154
|
-
│ │ ├── config.ts # tsconfig, ESLint, Prettier, EditorConfig
|
|
155
|
-
│ │ ├── tests.ts # Vitest config, example tests, test helpers
|
|
156
|
-
│ │ ├── ci-cd.ts # GitHub Actions CI workflow
|
|
157
|
-
│ │ ├── landing-page.ts # Framework-specific homepage + SVG logo/favicon
|
|
158
|
-
│ │ └── ai-config.ts # AI agent instructions → .nexus/ai/ + root pointers
|
|
159
|
-
│ ├── types/
|
|
160
|
-
│ │ ├── index.ts # Re-exports for convenience
|
|
161
|
-
│ │ ├── config.ts # NexusConfig, NexusManifest, union types
|
|
162
|
-
│ │ ├── prompts.ts # Prompt answer interfaces
|
|
163
|
-
│ │ └── templates.ts # GeneratedFile, GeneratorResult, TemplateContext
|
|
164
|
-
│ └── utils/
|
|
165
|
-
│ ├── index.ts # Re-exports for convenience
|
|
166
|
-
│ ├── logger.ts # Chalk-powered branded terminal output
|
|
167
|
-
│ ├── validator.ts # Project name validation and sanitization
|
|
168
|
-
│ ├── package-manager.ts # npm / yarn / pnpm detection
|
|
169
|
-
│ ├── git.ts # Git init and initial commit helpers
|
|
170
|
-
│ ├── file-system.ts # fs-extra wrappers and Mustache rendering
|
|
171
|
-
│ └── project-detector.ts # Detect existing projects for --adopt mode
|
|
172
|
-
├── tests/
|
|
173
|
-
│ └── unit/
|
|
174
|
-
│ ├── validator.test.ts # 15 tests — name validation, sanitization
|
|
175
|
-
│ ├── generators.test.ts # 30 tests — structure, package.json, gitignore, landing pages, ai-config
|
|
176
|
-
│ └── adopt.test.ts # 28 tests — project detection, frontmatter, AI onboarding
|
|
177
|
-
├── .nexus/
|
|
178
|
-
│ ├── docs/
|
|
179
|
-
│ │ ├── index.md # Project brain — status, module map, priorities
|
|
180
|
-
│ │ ├── 01_vision.md # Product vision and requirements
|
|
181
|
-
│ │ └── 07_implementation.md # Technical architecture and build plan
|
|
182
|
-
│ └── ai/
|
|
183
|
-
│ └── instructions.md # AI agent master instructions (single source of truth)
|
|
184
|
-
├── package.json # Dependencies, scripts, and npm metadata
|
|
185
|
-
├── tsconfig.json # TypeScript strict mode, ESM (NodeNext)
|
|
186
|
-
├── vitest.config.ts # Test runner with coverage thresholds
|
|
187
|
-
├── .eslintrc.cjs # ESLint + TypeScript + Prettier config
|
|
188
|
-
├── .prettierrc # Code formatting rules
|
|
189
|
-
├── .gitignore # Node, dist, IDE, OS ignores
|
|
190
|
-
├── .cursorrules # AI pointer → .nexus/ai/instructions.md (Cursor)
|
|
191
|
-
├── .windsurfrules # AI pointer → .nexus/ai/instructions.md (Windsurf)
|
|
192
|
-
├── .clinerules # AI pointer → .nexus/ai/instructions.md (Cline)
|
|
193
|
-
├── AGENTS.md # AI pointer → .nexus/ai/instructions.md (Claude/Codex)
|
|
194
|
-
├── LICENSE # Apache 2.0
|
|
195
|
-
├── README_GUIDELINES.md # GDA README standards reference
|
|
196
|
-
└── README.md # You are here
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
---
|
|
200
|
-
|
|
201
71
|
## 🚀 Quick Start
|
|
202
72
|
|
|
203
|
-
###
|
|
204
|
-
- **Node.js** 20+ (LTS recommended)
|
|
205
|
-
- **npm** 9+, **yarn** 1.x+, or **pnpm** 8+
|
|
206
|
-
- **Git** 2.x+
|
|
207
|
-
|
|
208
|
-
### 1. Clone & Setup
|
|
73
|
+
### Install
|
|
209
74
|
|
|
210
75
|
```bash
|
|
211
|
-
|
|
212
|
-
cd nexus-cli
|
|
213
|
-
yarn install
|
|
76
|
+
npm install -g @nexus-framework/cli
|
|
214
77
|
```
|
|
215
78
|
|
|
216
|
-
###
|
|
79
|
+
### Create a Project
|
|
217
80
|
|
|
218
81
|
```bash
|
|
219
|
-
|
|
82
|
+
nexus init my-app
|
|
220
83
|
```
|
|
221
84
|
|
|
222
|
-
|
|
85
|
+
You'll be guided through an interactive setup:
|
|
223
86
|
|
|
224
|
-
```bash
|
|
225
|
-
node bin/nexus.js init my-awesome-app
|
|
226
87
|
```
|
|
88
|
+
🔮 NEXUS CLI v0.1.2 — AI-Native Project Scaffolding
|
|
227
89
|
|
|
228
|
-
|
|
90
|
+
? What are you building? › Web Application
|
|
91
|
+
? How will your app handle data? › Cloud First
|
|
92
|
+
? Which application patterns? › PWA, Theming
|
|
93
|
+
? Which frontend framework? › Next.js 15 (App Router)
|
|
94
|
+
? Testing framework? › Vitest
|
|
95
|
+
? Package manager? › npm
|
|
96
|
+
? Initialize a git repository? › Yes
|
|
97
|
+
? Install dependencies now? › Yes
|
|
229
98
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
? What are you building? › Web Application
|
|
236
|
-
? How will your app handle data? › Cloud First
|
|
237
|
-
? Which application patterns do you need? › PWA, Theming
|
|
238
|
-
? Which frontend framework? › Next.js 15 (App Router)
|
|
239
|
-
? Testing framework? › Vitest
|
|
240
|
-
? Package manager? › npm
|
|
241
|
-
? Initialize a git repository? › Yes
|
|
242
|
-
? Install dependencies now? › Yes
|
|
243
|
-
|
|
244
|
-
▸ NEXUS Creating "my-awesome-app" with nextjs...
|
|
245
|
-
|
|
246
|
-
✔ Project structure generated.
|
|
247
|
-
✔ Dependencies installed.
|
|
248
|
-
✔ Git repository initialized.
|
|
249
|
-
|
|
250
|
-
✅ Project created successfully!
|
|
251
|
-
|
|
252
|
-
Next steps:
|
|
253
|
-
cd my-awesome-app
|
|
254
|
-
npm run dev
|
|
99
|
+
✔ Project created successfully!
|
|
100
|
+
|
|
101
|
+
cd my-app
|
|
102
|
+
npm run dev
|
|
255
103
|
```
|
|
256
104
|
|
|
257
|
-
###
|
|
105
|
+
### Run It
|
|
258
106
|
|
|
259
107
|
```bash
|
|
260
|
-
cd my-
|
|
108
|
+
cd my-app
|
|
261
109
|
npm run dev
|
|
262
110
|
# → Your app is running at http://localhost:3000
|
|
263
111
|
```
|
|
264
112
|
|
|
265
113
|
---
|
|
266
114
|
|
|
267
|
-
##
|
|
268
|
-
|
|
269
|
-
Already have a project? NEXUS can add its documentation system and AI configuration to any existing codebase without modifying your source code.
|
|
115
|
+
## 📦 What You Get
|
|
270
116
|
|
|
271
|
-
|
|
272
|
-
# Navigate to your existing project
|
|
273
|
-
cd my-existing-app
|
|
117
|
+
Every generated project includes:
|
|
274
118
|
|
|
275
|
-
|
|
276
|
-
nexus adopt
|
|
277
|
-
|
|
278
|
-
# Or target a specific directory
|
|
279
|
-
nexus adopt ./path/to/project
|
|
280
|
-
```
|
|
281
|
-
|
|
282
|
-
> **Tip:** `nexus init --adopt` also works as a shorthand — both reach the same code path. If you run `nexus init` in a directory that already has a project, NEXUS will detect it and suggest `nexus adopt` instead.
|
|
283
|
-
|
|
284
|
-
### What `nexus adopt` does
|
|
285
|
-
|
|
286
|
-
| Generated | What It Contains |
|
|
287
|
-
|---|---|
|
|
288
|
-
| `.nexus/docs/` | 8 structured documentation files with `status: template` frontmatter |
|
|
289
|
-
| `.nexus/ai/` | AI agent instructions (single source of truth) |
|
|
290
|
-
| `.cursorrules`, `.windsurfrules`, `.clinerules` | AI tool pointers |
|
|
291
|
-
| `AGENTS.md` | Claude / Codex pointer |
|
|
292
|
-
| `.github/copilot-instructions.md` | GitHub Copilot config |
|
|
293
|
-
|
|
294
|
-
### What `nexus adopt` does NOT do
|
|
295
|
-
|
|
296
|
-
- ❌ Does **not** modify any of your existing source code
|
|
297
|
-
- ❌ Does **not** create `package.json`, `tsconfig.json`, or any config files
|
|
298
|
-
- ❌ Does **not** install dependencies or initialize git
|
|
299
|
-
|
|
300
|
-
### Auto-Population by AI Agents
|
|
301
|
-
|
|
302
|
-
After adopting, open your AI coding tool (Copilot, Cursor, Windsurf, etc.) and start working as usual. The AI agent will:
|
|
303
|
-
|
|
304
|
-
1. **Detect** that NEXUS docs have `status: template` in their frontmatter
|
|
305
|
-
2. **Scan your codebase** to auto-populate architecture, data contracts, API routes, test strategy, and deployment info
|
|
306
|
-
3. **Ask you questions** for things it can't infer from code (product vision, business rules, success metrics)
|
|
307
|
-
4. **Update the frontmatter** to `status: populated` as each doc is filled in
|
|
308
|
-
|
|
309
|
-
Once all docs are populated, the onboarding flow completes and the agent works normally with full project context.
|
|
310
|
-
|
|
311
|
-
---
|
|
312
|
-
|
|
313
|
-
## 📡 API Reference
|
|
314
|
-
|
|
315
|
-
NEXUS CLI exposes a programmatic API for advanced usage and tooling integration.
|
|
316
|
-
|
|
317
|
-
```typescript
|
|
318
|
-
import { runPrompts, generateProject } from '@nexus-framework/cli';
|
|
319
|
-
|
|
320
|
-
const config = await runPrompts('my-app');
|
|
321
|
-
await generateProject(config);
|
|
322
|
-
```
|
|
323
|
-
|
|
324
|
-
### CLI Commands
|
|
325
|
-
|
|
326
|
-
| Command | Description |
|
|
119
|
+
| Output | What's Inside |
|
|
327
120
|
|---|---|
|
|
328
|
-
| `
|
|
329
|
-
|
|
|
330
|
-
|
|
|
331
|
-
| `
|
|
332
|
-
| `
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
| Field | Type | Required | Description |
|
|
337
|
-
|---|---|---|---|
|
|
338
|
-
| `projectName` | `string` | ✅ | Name of the project (valid npm package name) |
|
|
339
|
-
| `projectType` | `'web' \| 'api' \| 'monorepo'` | ✅ | Type of project |
|
|
340
|
-
| `dataStrategy` | `'local-only' \| 'local-first' \| 'cloud-first' \| 'hybrid'` | ✅ | Data handling approach |
|
|
341
|
-
| `appPatterns` | `AppPattern[]` | ✅ | Selected application patterns |
|
|
342
|
-
| `frontendFramework` | `'nextjs' \| 'react-vite' \| 'sveltekit' \| 'nuxt' \| 'astro'` | ✅ | Frontend framework |
|
|
343
|
-
| `testFramework` | `'vitest' \| 'jest' \| 'none'` | ✅ | Test framework choice |
|
|
344
|
-
| `packageManager` | `'npm' \| 'yarn' \| 'pnpm'` | ✅ | Package manager to use |
|
|
345
|
-
| `git` | `boolean` | ✅ | Whether to initialize git |
|
|
346
|
-
| `installDeps` | `boolean` | ✅ | Whether to install dependencies |
|
|
121
|
+
| `src/` | Framework-specific source code and landing page |
|
|
122
|
+
| `.nexus/docs/` | 8 AI-optimized documentation files (vision, architecture, API contracts, test strategy, etc.) |
|
|
123
|
+
| `.nexus/ai/` | AI agent instructions — Copilot, Cursor, Windsurf, Cline all auto-detect these |
|
|
124
|
+
| `tests/` | Vitest config, example tests, and test helpers |
|
|
125
|
+
| `package.json` | Real dependencies, real scripts — `npm run dev` works immediately |
|
|
126
|
+
| CI/CD | GitHub Actions workflow for lint, test, and build |
|
|
127
|
+
| Config | TypeScript, ESLint, Prettier, EditorConfig — all pre-configured |
|
|
347
128
|
|
|
348
129
|
---
|
|
349
130
|
|
|
350
|
-
##
|
|
351
|
-
|
|
352
|
-
| Layer | Implementation |
|
|
353
|
-
|---|---|
|
|
354
|
-
| **Input Validation** | All project names sanitized via `validate-npm-package-name` and custom validators |
|
|
355
|
-
| **Dependency Auditing** | Generated projects include `npm audit` in CI/CD pipelines |
|
|
356
|
-
| **Secret Management** | `.env` files auto-added to `.gitignore`; environment variable validation on startup |
|
|
357
|
-
| **Code Quality** | ESLint + TypeScript strict mode enabled by default in generated projects |
|
|
358
|
-
| **Supply Chain** | Lockfile pinning and minimal dependency surface in generated projects |
|
|
359
|
-
|
|
360
|
-
---
|
|
361
|
-
|
|
362
|
-
## 🧪 Testing
|
|
363
|
-
|
|
364
|
-
NEXUS CLI follows a **test-driven development** philosophy. Every generator and validator is tested.
|
|
365
|
-
|
|
366
|
-
```bash
|
|
367
|
-
# Run all tests
|
|
368
|
-
yarn test
|
|
369
|
-
|
|
370
|
-
# Run with coverage
|
|
371
|
-
yarn test:coverage
|
|
372
|
-
|
|
373
|
-
# Run a specific suite
|
|
374
|
-
npx vitest tests/unit/validator.test.ts
|
|
375
|
-
```
|
|
376
|
-
|
|
377
|
-
### Test Coverage
|
|
378
|
-
|
|
379
|
-
| Suite | Tests | Covers |
|
|
380
|
-
|---|---|---|
|
|
381
|
-
| `tests/unit/validator.test.ts` | 15 | Project name validation, sanitization, empty input handling |
|
|
382
|
-
| `tests/unit/generators.test.ts` | 30 | Directory generation, package.json, .gitignore, README, landing pages, ai-config |
|
|
383
|
-
| `tests/unit/adopt.test.ts` | 28 | Project detection, frontmatter status, AI onboarding protocol |
|
|
384
|
-
|
|
385
|
-
**Current status:** 73/73 tests passing ✅
|
|
386
|
-
|
|
387
|
-
**Coverage Target:** 80%+ across all suites.
|
|
388
|
-
|
|
389
|
-
---
|
|
390
|
-
|
|
391
|
-
## 🚢 Deployment
|
|
392
|
-
|
|
393
|
-
### Publishing to npm
|
|
394
|
-
|
|
395
|
-
```bash
|
|
396
|
-
yarn build
|
|
397
|
-
npm version patch
|
|
398
|
-
npm publish --access public
|
|
399
|
-
```
|
|
131
|
+
## 🏗️ Adopt an Existing Project
|
|
400
132
|
|
|
401
|
-
|
|
133
|
+
Already have a project? Add the NEXUS documentation system and AI config without touching your source code.
|
|
402
134
|
|
|
403
135
|
```bash
|
|
404
|
-
|
|
405
|
-
nexus
|
|
136
|
+
cd my-existing-app
|
|
137
|
+
nexus adopt
|
|
406
138
|
```
|
|
407
139
|
|
|
408
|
-
|
|
140
|
+
This adds `.nexus/docs/`, `.nexus/ai/`, and AI tool config files. It does **not** modify your source code, configs, or dependencies.
|
|
409
141
|
|
|
410
|
-
|
|
411
|
-
|---|---|---|
|
|
412
|
-
| `NEXUS_PACKAGE_MANAGER` | Override package manager detection | Auto-detect |
|
|
413
|
-
| `NEXUS_SKIP_INSTALL` | Skip automatic dependency install after generation | `false` |
|
|
142
|
+
After adopting, your AI coding tool will auto-detect the NEXUS docs, scan your codebase to populate them, and ask you about anything it can't infer — giving the AI full project context from that point forward.
|
|
414
143
|
|
|
415
144
|
---
|
|
416
145
|
|
|
417
|
-
##
|
|
418
|
-
|
|
419
|
-
### Using NEXUS with AI Coding Tools
|
|
420
|
-
|
|
421
|
-
NEXUS-generated projects are designed to work seamlessly with AI-powered editors:
|
|
422
|
-
|
|
423
|
-
**Cursor / Copilot / Windsurf:**
|
|
424
|
-
```
|
|
425
|
-
1. Open the generated project
|
|
426
|
-
2. AI tools auto-detect .nexus/ai/instructions.md and root pointer files
|
|
427
|
-
3. Ask your AI to implement features referencing the doc contracts
|
|
428
|
-
4. The AI now has full project context from day one
|
|
429
|
-
```
|
|
430
|
-
|
|
431
|
-
**Example AI prompt with a NEXUS project:**
|
|
432
|
-
```
|
|
433
|
-
Read .nexus/docs/01_vision.md and .nexus/docs/04_api_contracts.md.
|
|
434
|
-
Implement the user registration endpoint as specified
|
|
435
|
-
in the API contract, following the architecture in
|
|
436
|
-
.nexus/docs/02_architecture.md.
|
|
437
|
-
```
|
|
438
|
-
|
|
439
|
-
### NEXUS Documentation System
|
|
440
|
-
|
|
441
|
-
Every generated project includes **8 AI-optimized documentation files** under `.nexus/docs/`:
|
|
146
|
+
## 📖 Supported Frameworks
|
|
442
147
|
|
|
443
|
-
|
|
|
148
|
+
| Framework | Version | Notes |
|
|
444
149
|
|---|---|---|
|
|
445
|
-
|
|
|
446
|
-
|
|
|
447
|
-
|
|
|
448
|
-
|
|
|
449
|
-
|
|
|
450
|
-
| 6 | `.nexus/docs/06_test_strategy.md` | Coverage targets, test types, testing philosophy |
|
|
451
|
-
| 7 | `.nexus/docs/07_implementation.md` | Build order, file-by-file implementation plan |
|
|
452
|
-
| 8 | `.nexus/docs/08_deployment.md` | Infrastructure, CI/CD, environment configuration |
|
|
453
|
-
|
|
454
|
-
Plus `.nexus/index.md` dashboard, `.nexus/manifest.json` for machine navigation, and `.nexus/ai/instructions.md` for AI agent context.
|
|
150
|
+
| **Next.js** | 15 (App Router) | React Server Components, Turbopack |
|
|
151
|
+
| **React + Vite** | React 19 + Vite 6 | SWC, fast HMR |
|
|
152
|
+
| **SvelteKit** | 2.x | Svelte 5, file-based routing |
|
|
153
|
+
| **Nuxt** | 3.x | Vue 3, auto-imports |
|
|
154
|
+
| **Astro** | 5.x | Content-first, island architecture |
|
|
455
155
|
|
|
456
156
|
---
|
|
457
157
|
|
|
458
158
|
## 🗺️ Roadmap
|
|
459
159
|
|
|
460
|
-
- [x]
|
|
461
|
-
- [x]
|
|
462
|
-
- [x]
|
|
463
|
-
- [x]
|
|
464
|
-
- [x]
|
|
465
|
-
- [x]
|
|
466
|
-
- [x]
|
|
467
|
-
- [x] Type system (NexusConfig, NexusManifest, prompt and template types)
|
|
468
|
-
- [x] Unit tests (45/45 passing — validators and generators)
|
|
469
|
-
- [x] ESLint + Prettier configured and passing
|
|
470
|
-
- [x] Centralized `.nexus/` folder (docs, AI config, manifest — one folder to opt in/out)
|
|
160
|
+
- [x] Core CLI with `nexus init` and `nexus adopt`
|
|
161
|
+
- [x] Interactive prompt system (project type, data strategy, patterns, frameworks)
|
|
162
|
+
- [x] Generator engine (structure, docs, config, tests, CI/CD, landing page, AI config)
|
|
163
|
+
- [x] AI-native documentation system (8 structured files + onboarding protocol)
|
|
164
|
+
- [x] 5 frontend frameworks supported
|
|
165
|
+
- [x] 105 unit tests passing
|
|
166
|
+
- [x] Published to npm as `@nexus-framework/cli`
|
|
471
167
|
- [ ] End-to-end testing of full `nexus init` flow
|
|
472
|
-
- [ ]
|
|
473
|
-
- [ ] Strategy pattern generators (PWA, Offline-First, i18n, Theming)
|
|
474
|
-
- [ ] Polish — progress indicators, error recovery, ASCII branding
|
|
475
|
-
- [ ] Cross-platform testing (macOS, Windows WSL, Linux)
|
|
476
|
-
- [ ] Publish to npm as `@nexus-framework/cli`
|
|
168
|
+
- [ ] Strategy pattern generators (PWA service workers, i18n setup, theming engine)
|
|
477
169
|
- [ ] `nexus add <feature>` — add capabilities to existing projects
|
|
478
170
|
- [ ] `nexus validate` — check projects against NEXUS standards
|
|
479
171
|
- [ ] Community templates and plugin system
|
|
480
172
|
|
|
481
173
|
---
|
|
482
174
|
|
|
483
|
-
## 🛠️ Tech Stack
|
|
484
|
-
|
|
485
|
-
| Component | Technology |
|
|
486
|
-
|---|---|
|
|
487
|
-
| **Runtime** | Node.js 20+ (LTS) |
|
|
488
|
-
| **Language** | TypeScript 5.7 (strict mode, ESM) |
|
|
489
|
-
| **CLI Framework** | Commander.js 12.x |
|
|
490
|
-
| **Interactive Prompts** | @inquirer/prompts 7.x |
|
|
491
|
-
| **Terminal Styling** | Chalk 5.x, Ora 8.x, Figlet 1.x |
|
|
492
|
-
| **Template Engine** | Mustache 4.x |
|
|
493
|
-
| **File System** | fs-extra 11.x |
|
|
494
|
-
| **Shell Execution** | execa 9.x |
|
|
495
|
-
| **Testing** | Vitest 3.x |
|
|
496
|
-
| **Code Quality** | ESLint 8.x, Prettier 3.x |
|
|
497
|
-
| **Package Distribution** | npm (public registry) |
|
|
498
|
-
| **License** | Apache 2.0 |
|
|
499
|
-
|
|
500
|
-
---
|
|
501
|
-
|
|
502
175
|
## 🤝 Contributing
|
|
503
176
|
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
### Getting Started
|
|
177
|
+
We welcome contributions! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
507
178
|
|
|
508
179
|
```bash
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
yarn install
|
|
513
|
-
|
|
514
|
-
# Create a branch
|
|
515
|
-
git checkout -b feature/your-feature-name
|
|
516
|
-
|
|
517
|
-
# Make changes, lint, and test
|
|
518
|
-
yarn lint
|
|
519
|
-
yarn test
|
|
520
|
-
|
|
521
|
-
# Submit a PR
|
|
522
|
-
git push origin feature/your-feature-name
|
|
180
|
+
git clone https://github.com/GDA-Africa/nexus-cli.git
|
|
181
|
+
cd nexus-cli && yarn install
|
|
182
|
+
yarn lint && yarn test
|
|
523
183
|
```
|
|
524
184
|
|
|
525
|
-
### Contribution Guidelines
|
|
526
|
-
|
|
527
|
-
- **Write tests** for every new feature or bug fix
|
|
528
|
-
- **Follow the code style** — ESLint and Prettier are pre-configured
|
|
529
|
-
- **Update documentation** if your change affects the public API or CLI behavior
|
|
530
|
-
- **One feature per PR** — keep pull requests focused and reviewable
|
|
531
|
-
- **Use conventional commits** — `feat:`, `fix:`, `docs:`, `chore:`
|
|
532
|
-
|
|
533
185
|
---
|
|
534
186
|
|
|
535
187
|
<div align="center">
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAaH,iCAAiC;AACjC,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;;GAKG;AACH,wBAAsB,WAAW,CAC/B,WAAW,CAAC,EAAE,MAAM,EACpB,OAAO,GAAE,WAAgB,GACxB,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAaH,iCAAiC;AACjC,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;;GAKG;AACH,wBAAsB,WAAW,CAC/B,WAAW,CAAC,EAAE,MAAM,EACpB,OAAO,GAAE,WAAgB,GACxB,OAAO,CAAC,IAAI,CAAC,CA2Df"}
|
package/dist/commands/init.js
CHANGED
|
@@ -15,7 +15,7 @@ import { generateProject } from '../generators/index.js';
|
|
|
15
15
|
import { runPrompts } from '../prompts/index.js';
|
|
16
16
|
import { logger } from '../utils/logger.js';
|
|
17
17
|
import { isExistingProject } from '../utils/project-detector.js';
|
|
18
|
-
import { validateProjectName } from '../utils/validator.js';
|
|
18
|
+
import { validateProjectName, toSlug } from '../utils/validator.js';
|
|
19
19
|
import { version } from '../version.js';
|
|
20
20
|
import { adoptCommand } from './adopt.js';
|
|
21
21
|
/**
|
|
@@ -40,9 +40,10 @@ export async function initCommand(projectName, options = {}) {
|
|
|
40
40
|
process.exit(1);
|
|
41
41
|
}
|
|
42
42
|
// Check if the target directory is an existing project
|
|
43
|
-
const
|
|
43
|
+
const slug = toSlug(projectName);
|
|
44
|
+
const targetDir = path.resolve(process.cwd(), slug);
|
|
44
45
|
if (isExistingProject(targetDir)) {
|
|
45
|
-
showAdoptSuggestion(
|
|
46
|
+
showAdoptSuggestion(slug);
|
|
46
47
|
process.exit(1);
|
|
47
48
|
}
|
|
48
49
|
}
|
|
@@ -55,7 +56,7 @@ export async function initCommand(projectName, options = {}) {
|
|
|
55
56
|
// Run interactive prompts
|
|
56
57
|
const config = await runPrompts(projectName);
|
|
57
58
|
logger.newline();
|
|
58
|
-
logger.nexus(`Creating "${config.
|
|
59
|
+
logger.nexus(`Creating "${config.displayName}" with ${config.frontendFramework}...`);
|
|
59
60
|
logger.newline();
|
|
60
61
|
// Generate the project
|
|
61
62
|
await generateProject(config);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,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