@nexus-framework/cli 0.1.1 → 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 (60) hide show
  1. package/README.md +69 -417
  2. package/dist/cli.js +14 -0
  3. package/dist/cli.js.map +1 -1
  4. package/dist/commands/init.d.ts.map +1 -1
  5. package/dist/commands/init.js +5 -4
  6. package/dist/commands/init.js.map +1 -1
  7. package/dist/commands/repair.d.ts +20 -0
  8. package/dist/commands/repair.d.ts.map +1 -0
  9. package/dist/commands/repair.js +85 -0
  10. package/dist/commands/repair.js.map +1 -0
  11. package/dist/commands/upgrade.d.ts +21 -0
  12. package/dist/commands/upgrade.d.ts.map +1 -0
  13. package/dist/commands/upgrade.js +95 -0
  14. package/dist/commands/upgrade.js.map +1 -0
  15. package/dist/generators/ai-config.d.ts +15 -8
  16. package/dist/generators/ai-config.d.ts.map +1 -1
  17. package/dist/generators/ai-config.js +209 -131
  18. package/dist/generators/ai-config.js.map +1 -1
  19. package/dist/generators/config.d.ts.map +1 -1
  20. package/dist/generators/config.js +127 -19
  21. package/dist/generators/config.js.map +1 -1
  22. package/dist/generators/docs.d.ts.map +1 -1
  23. package/dist/generators/docs.js +379 -159
  24. package/dist/generators/docs.js.map +1 -1
  25. package/dist/generators/index.d.ts +44 -0
  26. package/dist/generators/index.d.ts.map +1 -1
  27. package/dist/generators/index.js +148 -3
  28. package/dist/generators/index.js.map +1 -1
  29. package/dist/generators/landing-page.d.ts.map +1 -1
  30. package/dist/generators/landing-page.js +310 -76
  31. package/dist/generators/landing-page.js.map +1 -1
  32. package/dist/generators/structure.d.ts.map +1 -1
  33. package/dist/generators/structure.js +161 -17
  34. package/dist/generators/structure.js.map +1 -1
  35. package/dist/generators/tests.js +1 -1
  36. package/dist/prompts/index.d.ts +3 -0
  37. package/dist/prompts/index.d.ts.map +1 -1
  38. package/dist/prompts/index.js +12 -8
  39. package/dist/prompts/index.js.map +1 -1
  40. package/dist/types/config.d.ts +3 -0
  41. package/dist/types/config.d.ts.map +1 -1
  42. package/dist/utils/file-system.d.ts +9 -1
  43. package/dist/utils/file-system.d.ts.map +1 -1
  44. package/dist/utils/file-system.js +24 -1
  45. package/dist/utils/file-system.js.map +1 -1
  46. package/dist/utils/index.d.ts +2 -2
  47. package/dist/utils/index.d.ts.map +1 -1
  48. package/dist/utils/index.js +2 -2
  49. package/dist/utils/index.js.map +1 -1
  50. package/dist/utils/logger.d.ts +2 -2
  51. package/dist/utils/logger.d.ts.map +1 -1
  52. package/dist/utils/logger.js +6 -3
  53. package/dist/utils/logger.js.map +1 -1
  54. package/dist/utils/validator.d.ts +20 -3
  55. package/dist/utils/validator.d.ts.map +1 -1
  56. package/dist/utils/validator.js +48 -15
  57. package/dist/utils/validator.js.map +1 -1
  58. package/dist/version.d.ts +1 -1
  59. package/dist/version.js +1 -1
  60. package/package.json +1 -1
package/README.md CHANGED
@@ -8,10 +8,9 @@
8
8
 
9
9
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.x-3178C6?style=for-the-badge&logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
10
10
  [![Node.js](https://img.shields.io/badge/Node.js-20+-339933?style=for-the-badge&logo=node.js&logoColor=white)](https://nodejs.org/)
11
- [![Vitest](https://img.shields.io/badge/Vitest-73%2F73_Passing-green?style=for-the-badge&logo=vitest&logoColor=white)](https://vitest.dev/)
11
+ [![Vitest](https://img.shields.io/badge/Vitest-105_Passing-green?style=for-the-badge&logo=vitest&logoColor=white)](https://vitest.dev/)
12
12
  [![License](https://img.shields.io/badge/License-Apache_2.0-blue?style=for-the-badge)](LICENSE)
13
13
  [![PRs Welcome](https://img.shields.io/badge/PRs-Welcome-brightgreen?style=for-the-badge)](https://github.com/GDA-Africa/nexus-cli/pulls)
14
- [![Status](https://img.shields.io/badge/Status-In_Development-yellow?style=for-the-badge)]()
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. **NEXUS CLI** is the foundational developer tool in GDA's ecosystem — a free, open-source scaffolding engine that generates intelligent project structures where AI and humans collaborate seamlessly from day one.
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 CLI?
29
+ ## 🎯 Why NEXUS?
31
30
 
32
- Every new project starts with the same painful ritual: hours of boilerplate, fragmented configs, and zero documentation. NEXUS eliminates all of that.
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
- | 🕐 Starting a project takes hours of setup and configuration guesswork | **2-minute interactive setup** with strategy-first questions and smart defaults |
37
- | 🤖 AI coding tools (Cursor, Copilot) struggle with project-wide context | **AI-optimized documentation system** — 8 structured files AI agents can parse and execute |
38
- | 🧩 Every project structure is different, making team consistency impossible | **Standardized, production-ready scaffolding** based on proven architectural patterns |
39
- | 🧪 Tests and documentation are always afterthoughts | **Test infrastructure and docs generated from day one** — not bolted on later |
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 structured markdown files AI agents understand
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 from the start
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
- - ⚡ **Multi-Framework Support** — Next.js, React+Vite, SvelteKit, Nuxt, Astro
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 generated automatically
66
- - 🌐 **Cross-Platform** — Works on macOS, Windows (WSL), and Linux
67
- - 📦 **Strategy Patterns** — PWA, Offline-First, i18n, Theming, White Label, Real-time
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
- ### Prerequisites
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
- git clone https://github.com/GDA-Africa/nexus-cli.git
212
- cd nexus-cli
213
- yarn install
76
+ npm install -g @nexus-framework/cli
214
77
  ```
215
78
 
216
- ### 2. Build
79
+ ### Create a Project
217
80
 
218
81
  ```bash
219
- yarn build
82
+ nexus init my-app
220
83
  ```
221
84
 
222
- ### 3. Run the CLI
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
- You'll be guided through an interactive setup:
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
- 🔮 NEXUS CLI v0.1.0
232
- AI-Native Project Scaffolding
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
- ### 4. Verify
105
+ ### Run It
258
106
 
259
107
  ```bash
260
- cd my-awesome-app
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
- ## 🏗️ Adopt an Existing Project
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
- ```bash
272
- # Navigate to your existing project
273
- cd my-existing-app
117
+ Every generated project includes:
274
118
 
275
- # Add NEXUS docs & AI config
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
- | `nexus init [project-name]` | Initialize a new NEXUS project with interactive setup |
329
- | `nexus adopt [path]` | Add NEXUS docs & AI config to an existing project |
330
- | `nexus init --adopt` | Shorthand alias for `nexus adopt` |
331
- | `nexus --version` | Display the CLI version |
332
- | `nexus --help` | Display available commands and options |
333
-
334
- ### NexusConfig Interface
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
- ## 🔐 Security
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
- ### Installing Globally (End Users)
133
+ Already have a project? Add the NEXUS documentation system and AI config without touching your source code.
402
134
 
403
135
  ```bash
404
- npm install -g @nexus-framework/cli
405
- nexus init my-project
136
+ cd my-existing-app
137
+ nexus adopt
406
138
  ```
407
139
 
408
- ### Environment Variables
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
- | Variable | Description | Default |
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
- ## 🔌 Integration Guide
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
- | # | File | Purpose |
148
+ | Framework | Version | Notes |
444
149
  |---|---|---|
445
- | 1 | `.nexus/docs/01_vision.md` | Product requirements, user stories, success metrics |
446
- | 2 | `.nexus/docs/02_architecture.md` | System design, tech stack decisions, data flow |
447
- | 3 | `.nexus/docs/03_data_contracts.md` | Database schemas, validation rules, relationships |
448
- | 4 | `.nexus/docs/04_api_contracts.md` | Endpoints, request/response interfaces, status codes |
449
- | 5 | `.nexus/docs/05_business_logic.md` | Rules, algorithms, state machines, decision flows |
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] Project vision and product requirements defined
461
- - [x] Technical architecture and implementation plan documented
462
- - [x] Documentation system designed (8-file structure)
463
- - [x] Core CLI infrastructure (Commander.js + @inquirer/prompts)
464
- - [x] Interactive prompt system (project type, data strategy, patterns, framework, features)
465
- - [x] Generator engine (structure, docs, config, tests, CI/CD, landing page, ai-config)
466
- - [x] Utility layer (logger, validator, package-manager, git, file-system)
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
- - [ ] Framework-specific templates (Next.js 15, React+Vite, SvelteKit)
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
- NEXUS CLI is open source and we welcome contributions from the community!
505
-
506
- ### Getting Started
177
+ We welcome contributions! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
507
178
 
508
179
  ```bash
509
- # Fork and clone
510
- git clone https://github.com/<your-username>/nexus-cli.git
511
- cd nexus-cli
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">
package/dist/cli.js CHANGED
@@ -6,6 +6,8 @@
6
6
  import { Command } from 'commander';
7
7
  import { adoptCommand } from './commands/adopt.js';
8
8
  import { initCommand } from './commands/init.js';
9
+ import { repairCommand } from './commands/repair.js';
10
+ import { upgradeCommand } from './commands/upgrade.js';
9
11
  import { version } from './version.js';
10
12
  const program = new Command();
11
13
  program
@@ -25,6 +27,18 @@ program
25
27
  .action(async (targetPath) => {
26
28
  await adoptCommand(targetPath);
27
29
  });
30
+ program
31
+ .command('upgrade [path]')
32
+ .description('Upgrade NEXUS ecosystem to latest templates (preserves project knowledge)')
33
+ .action(async (targetPath) => {
34
+ await upgradeCommand(targetPath);
35
+ });
36
+ program
37
+ .command('repair [path]')
38
+ .description('Repair missing or corrupted .nexus/ files (preserves everything valid)')
39
+ .action(async (targetPath) => {
40
+ await repairCommand(targetPath);
41
+ });
28
42
  // Default to help if no command is given
29
43
  program.parse();
30
44
  //# sourceMappingURL=cli.js.map
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,OAAO,CAAC;KACb,WAAW,CAAC,8DAA8D,CAAC;KAC3E,OAAO,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;AAErC,OAAO;KACJ,OAAO,CAAC,qBAAqB,CAAC;KAC9B,WAAW,CAAC,uDAAuD,CAAC;KACpE,MAAM,CAAC,SAAS,EAAE,qEAAqE,CAAC;KACxF,MAAM,CAAC,KAAK,EAAE,WAA+B,EAAE,OAA4B,EAAE,EAAE;IAC9E,MAAM,WAAW,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,KAAK,EAAE,CAAC,CAAC;AACpE,CAAC,CAAC,CAAC;AAEL,OAAO;KACJ,OAAO,CAAC,cAAc,CAAC;KACvB,WAAW,CAAC,oEAAoE,CAAC;KACjF,MAAM,CAAC,KAAK,EAAE,UAA8B,EAAE,EAAE;IAC/C,MAAM,YAAY,CAAC,UAAU,CAAC,CAAC;AACjC,CAAC,CAAC,CAAC;AAEL,yCAAyC;AACzC,OAAO,CAAC,KAAK,EAAE,CAAC"}
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,OAAO,CAAC;KACb,WAAW,CAAC,8DAA8D,CAAC;KAC3E,OAAO,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;AAErC,OAAO;KACJ,OAAO,CAAC,qBAAqB,CAAC;KAC9B,WAAW,CAAC,uDAAuD,CAAC;KACpE,MAAM,CAAC,SAAS,EAAE,qEAAqE,CAAC;KACxF,MAAM,CAAC,KAAK,EAAE,WAA+B,EAAE,OAA4B,EAAE,EAAE;IAC9E,MAAM,WAAW,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,KAAK,EAAE,CAAC,CAAC;AACpE,CAAC,CAAC,CAAC;AAEL,OAAO;KACJ,OAAO,CAAC,cAAc,CAAC;KACvB,WAAW,CAAC,oEAAoE,CAAC;KACjF,MAAM,CAAC,KAAK,EAAE,UAA8B,EAAE,EAAE;IAC/C,MAAM,YAAY,CAAC,UAAU,CAAC,CAAC;AACjC,CAAC,CAAC,CAAC;AAEL,OAAO;KACJ,OAAO,CAAC,gBAAgB,CAAC;KACzB,WAAW,CAAC,2EAA2E,CAAC;KACxF,MAAM,CAAC,KAAK,EAAE,UAA8B,EAAE,EAAE;IAC/C,MAAM,cAAc,CAAC,UAAU,CAAC,CAAC;AACnC,CAAC,CAAC,CAAC;AAEL,OAAO;KACJ,OAAO,CAAC,eAAe,CAAC;KACxB,WAAW,CAAC,wEAAwE,CAAC;KACrF,MAAM,CAAC,KAAK,EAAE,UAA8B,EAAE,EAAE;IAC/C,MAAM,aAAa,CAAC,UAAU,CAAC,CAAC;AAClC,CAAC,CAAC,CAAC;AAEL,yCAAyC;AACzC,OAAO,CAAC,KAAK,EAAE,CAAC"}
@@ -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,CA0Df"}
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"}