@nexus-framework/cli 0.1.1
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/LICENSE +201 -0
- package/README.md +545 -0
- package/bin/nexus.js +3 -0
- package/dist/cli.d.ts +7 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +30 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/adopt.d.ts +25 -0
- package/dist/commands/adopt.d.ts.map +1 -0
- package/dist/commands/adopt.js +73 -0
- package/dist/commands/adopt.js.map +1 -0
- package/dist/commands/init.d.ts +24 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +102 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/generators/ai-config.d.ts +26 -0
- package/dist/generators/ai-config.d.ts.map +1 -0
- package/dist/generators/ai-config.js +305 -0
- package/dist/generators/ai-config.js.map +1 -0
- package/dist/generators/ci-cd.d.ts +12 -0
- package/dist/generators/ci-cd.d.ts.map +1 -0
- package/dist/generators/ci-cd.js +60 -0
- package/dist/generators/ci-cd.js.map +1 -0
- package/dist/generators/config.d.ts +12 -0
- package/dist/generators/config.d.ts.map +1 -0
- package/dist/generators/config.js +92 -0
- package/dist/generators/config.js.map +1 -0
- package/dist/generators/docs.d.ts +19 -0
- package/dist/generators/docs.d.ts.map +1 -0
- package/dist/generators/docs.js +431 -0
- package/dist/generators/docs.js.map +1 -0
- package/dist/generators/index.d.ts +24 -0
- package/dist/generators/index.d.ts.map +1 -0
- package/dist/generators/index.js +154 -0
- package/dist/generators/index.js.map +1 -0
- package/dist/generators/landing-page.d.ts +13 -0
- package/dist/generators/landing-page.d.ts.map +1 -0
- package/dist/generators/landing-page.js +448 -0
- package/dist/generators/landing-page.js.map +1 -0
- package/dist/generators/structure.d.ts +24 -0
- package/dist/generators/structure.d.ts.map +1 -0
- package/dist/generators/structure.js +174 -0
- package/dist/generators/structure.js.map +1 -0
- package/dist/generators/tests.d.ts +12 -0
- package/dist/generators/tests.d.ts.map +1 -0
- package/dist/generators/tests.js +97 -0
- package/dist/generators/tests.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts/data-strategy.d.ts +8 -0
- package/dist/prompts/data-strategy.d.ts.map +1 -0
- package/dist/prompts/data-strategy.js +34 -0
- package/dist/prompts/data-strategy.js.map +1 -0
- package/dist/prompts/features.d.ts +14 -0
- package/dist/prompts/features.d.ts.map +1 -0
- package/dist/prompts/features.js +46 -0
- package/dist/prompts/features.js.map +1 -0
- package/dist/prompts/frameworks.d.ts +9 -0
- package/dist/prompts/frameworks.d.ts.map +1 -0
- package/dist/prompts/frameworks.js +44 -0
- package/dist/prompts/frameworks.js.map +1 -0
- package/dist/prompts/index.d.ts +13 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +67 -0
- package/dist/prompts/index.js.map +1 -0
- package/dist/prompts/patterns.d.ts +8 -0
- package/dist/prompts/patterns.d.ts.map +1 -0
- package/dist/prompts/patterns.js +44 -0
- package/dist/prompts/patterns.js.map +1 -0
- package/dist/prompts/project-type.d.ts +8 -0
- package/dist/prompts/project-type.d.ts.map +1 -0
- package/dist/prompts/project-type.js +29 -0
- package/dist/prompts/project-type.js.map +1 -0
- package/dist/types/config.d.ts +50 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +7 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/prompts.d.ts +39 -0
- package/dist/types/prompts.d.ts.map +1 -0
- package/dist/types/prompts.js +7 -0
- package/dist/types/prompts.js.map +1 -0
- package/dist/types/templates.d.ts +38 -0
- package/dist/types/templates.d.ts.map +1 -0
- package/dist/types/templates.js +7 -0
- package/dist/types/templates.js.map +1 -0
- package/dist/utils/file-system.d.ts +27 -0
- package/dist/utils/file-system.d.ts.map +1 -0
- package/dist/utils/file-system.js +53 -0
- package/dist/utils/file-system.js.map +1 -0
- package/dist/utils/git.d.ts +14 -0
- package/dist/utils/git.d.ts.map +1 -0
- package/dist/utils/git.js +40 -0
- package/dist/utils/git.js.map +1 -0
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +7 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/logger.d.ts +38 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +106 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/package-manager.d.ts +16 -0
- package/dist/utils/package-manager.d.ts.map +1 -0
- package/dist/utils/package-manager.js +51 -0
- package/dist/utils/package-manager.js.map +1 -0
- package/dist/utils/project-detector.d.ts +55 -0
- package/dist/utils/project-detector.d.ts.map +1 -0
- package/dist/utils/project-detector.js +125 -0
- package/dist/utils/project-detector.js.map +1 -0
- package/dist/utils/validator.d.ts +25 -0
- package/dist/utils/validator.d.ts.map +1 -0
- package/dist/utils/validator.js +59 -0
- package/dist/utils/validator.js.map +1 -0
- package/dist/version.d.ts +7 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +7 -0
- package/dist/version.js.map +1 -0
- package/package.json +90 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NEXUS CLI - Config Generator
|
|
3
|
+
*
|
|
4
|
+
* Generates configuration files (tsconfig, eslint, prettier, etc.) for the new project.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Generate all configuration files for a project.
|
|
8
|
+
*/
|
|
9
|
+
export function generateConfigs(config) {
|
|
10
|
+
const files = [];
|
|
11
|
+
files.push(generateTsConfig(config));
|
|
12
|
+
files.push(generateEslintConfig());
|
|
13
|
+
files.push(generatePrettierConfig());
|
|
14
|
+
files.push(generateEditorConfig());
|
|
15
|
+
return files;
|
|
16
|
+
}
|
|
17
|
+
function generateTsConfig(_config) {
|
|
18
|
+
const tsconfig = {
|
|
19
|
+
compilerOptions: {
|
|
20
|
+
target: 'ES2022',
|
|
21
|
+
module: 'NodeNext',
|
|
22
|
+
moduleResolution: 'NodeNext',
|
|
23
|
+
lib: ['ES2022', 'DOM', 'DOM.Iterable'],
|
|
24
|
+
strict: true,
|
|
25
|
+
esModuleInterop: true,
|
|
26
|
+
skipLibCheck: true,
|
|
27
|
+
forceConsistentCasingInFileNames: true,
|
|
28
|
+
resolveJsonModule: true,
|
|
29
|
+
isolatedModules: true,
|
|
30
|
+
noEmit: true,
|
|
31
|
+
jsx: 'preserve',
|
|
32
|
+
incremental: true,
|
|
33
|
+
},
|
|
34
|
+
include: ['src/**/*.ts', 'src/**/*.tsx'],
|
|
35
|
+
exclude: ['node_modules', 'dist'],
|
|
36
|
+
};
|
|
37
|
+
return {
|
|
38
|
+
path: 'tsconfig.json',
|
|
39
|
+
content: JSON.stringify(tsconfig, null, 2) + '\n',
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function generateEslintConfig() {
|
|
43
|
+
const content = `/** @type {import('eslint').Linter.Config} */
|
|
44
|
+
module.exports = {
|
|
45
|
+
root: true,
|
|
46
|
+
env: { browser: true, node: true, es2022: true },
|
|
47
|
+
extends: [
|
|
48
|
+
'eslint:recommended',
|
|
49
|
+
'plugin:@typescript-eslint/recommended',
|
|
50
|
+
'prettier',
|
|
51
|
+
],
|
|
52
|
+
parser: '@typescript-eslint/parser',
|
|
53
|
+
plugins: ['@typescript-eslint'],
|
|
54
|
+
rules: {
|
|
55
|
+
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
`;
|
|
59
|
+
return { path: '.eslintrc.cjs', content };
|
|
60
|
+
}
|
|
61
|
+
function generatePrettierConfig() {
|
|
62
|
+
const config = {
|
|
63
|
+
semi: true,
|
|
64
|
+
trailingComma: 'all',
|
|
65
|
+
singleQuote: true,
|
|
66
|
+
printWidth: 100,
|
|
67
|
+
tabWidth: 2,
|
|
68
|
+
};
|
|
69
|
+
return {
|
|
70
|
+
path: '.prettierrc',
|
|
71
|
+
content: JSON.stringify(config, null, 2) + '\n',
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function generateEditorConfig() {
|
|
75
|
+
return {
|
|
76
|
+
path: '.editorconfig',
|
|
77
|
+
content: `root = true
|
|
78
|
+
|
|
79
|
+
[*]
|
|
80
|
+
indent_style = space
|
|
81
|
+
indent_size = 2
|
|
82
|
+
end_of_line = lf
|
|
83
|
+
charset = utf-8
|
|
84
|
+
trim_trailing_whitespace = true
|
|
85
|
+
insert_final_newline = true
|
|
86
|
+
|
|
87
|
+
[*.md]
|
|
88
|
+
trim_trailing_whitespace = false
|
|
89
|
+
`,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/generators/config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,MAAmB;IACjD,MAAM,KAAK,GAAoB,EAAE,CAAC;IAElC,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC;IACrC,KAAK,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC;IACnC,KAAK,CAAC,IAAI,CAAC,sBAAsB,EAAE,CAAC,CAAC;IACrC,KAAK,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC;IAEnC,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,gBAAgB,CAAC,OAAoB;IAC5C,MAAM,QAAQ,GAAG;QACf,eAAe,EAAE;YACf,MAAM,EAAE,QAAQ;YAChB,MAAM,EAAE,UAAU;YAClB,gBAAgB,EAAE,UAAU;YAC5B,GAAG,EAAE,CAAC,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ation system plus the .nexus index and manifest.
|
|
5
|
+
*
|
|
6
|
+
* Each document includes YAML frontmatter with a `status` field:
|
|
7
|
+
* - `template` — doc is in its default/scaffolded state (has TODO placeholders)
|
|
8
|
+
* - `populated` — doc has been filled in (by a human or AI agent)
|
|
9
|
+
*
|
|
10
|
+
* AI agents are instructed (via .nexus/ai/instructions.md) to check this
|
|
11
|
+
* status and auto-populate template docs from codebase analysis.
|
|
12
|
+
*/
|
|
13
|
+
import type { NexusConfig } from '../types/config.js';
|
|
14
|
+
import type { GeneratedFile } from '../types/templates.js';
|
|
15
|
+
/**
|
|
16
|
+
* Generate all NEXUS documentation files for a new project.
|
|
17
|
+
*/
|
|
18
|
+
export declare function generateDocs(config: NexusConfig): GeneratedFile[];
|
|
19
|
+
//# sourceMappingURL=docs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/generators/docs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAiB,MAAM,oBAAoB,CAAC;AACrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AA2B3D;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,WAAW,GAAG,aAAa,EAAE,CAejE"}
|
|
@@ -0,0 +1,431 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NEXUS CLI - Documentation Generator
|
|
3
|
+
*
|
|
4
|
+
* Generates the 8-file NEXUS documentation system plus the .nexus index and manifest.
|
|
5
|
+
*
|
|
6
|
+
* Each document includes YAML frontmatter with a `status` field:
|
|
7
|
+
* - `template` — doc is in its default/scaffolded state (has TODO placeholders)
|
|
8
|
+
* - `populated` — doc has been filled in (by a human or AI agent)
|
|
9
|
+
*
|
|
10
|
+
* AI agents are instructed (via .nexus/ai/instructions.md) to check this
|
|
11
|
+
* status and auto-populate template docs from codebase analysis.
|
|
12
|
+
*/
|
|
13
|
+
import { version } from '../version.js';
|
|
14
|
+
/* ──────────────────────────────────────────────────────────────
|
|
15
|
+
* Frontmatter helper
|
|
16
|
+
* ────────────────────────────────────────────────────────────── */
|
|
17
|
+
/**
|
|
18
|
+
* Generate YAML frontmatter block for a NEXUS doc.
|
|
19
|
+
*
|
|
20
|
+
* @param docId - e.g. "01_vision", "02_architecture"
|
|
21
|
+
* @param title - human-readable title
|
|
22
|
+
*/
|
|
23
|
+
function frontmatter(docId, title) {
|
|
24
|
+
const now = new Date().toISOString().split('T')[0];
|
|
25
|
+
return `---
|
|
26
|
+
nexus_doc: true
|
|
27
|
+
id: "${docId}"
|
|
28
|
+
title: "${title}"
|
|
29
|
+
status: template
|
|
30
|
+
confidence: low
|
|
31
|
+
last_updated: "${now}"
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
`;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Generate all NEXUS documentation files for a new project.
|
|
38
|
+
*/
|
|
39
|
+
export function generateDocs(config) {
|
|
40
|
+
const files = [];
|
|
41
|
+
files.push(generateVision(config));
|
|
42
|
+
files.push(generateArchitecture(config));
|
|
43
|
+
files.push(generateDataContracts(config));
|
|
44
|
+
files.push(generateApiContracts(config));
|
|
45
|
+
files.push(generateBusinessLogic(config));
|
|
46
|
+
files.push(generateTestStrategy(config));
|
|
47
|
+
files.push(generateImplementation(config));
|
|
48
|
+
files.push(generateDeployment(config));
|
|
49
|
+
files.push(generateNexusIndex(config));
|
|
50
|
+
files.push(generateNexusManifest(config));
|
|
51
|
+
return files;
|
|
52
|
+
}
|
|
53
|
+
function generateVision(config) {
|
|
54
|
+
return {
|
|
55
|
+
path: '.nexus/docs/01_vision.md',
|
|
56
|
+
content: `${frontmatter('01_vision', 'Product Vision & Requirements')}# Product Vision & Requirements
|
|
57
|
+
|
|
58
|
+
**Project:** ${config.projectName}
|
|
59
|
+
**Created:** ${new Date().toISOString().split('T')[0]}
|
|
60
|
+
**Status:** 🟡 In Development
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## 🎯 Product Vision
|
|
65
|
+
|
|
66
|
+
<!-- Describe what you're building and why. Be specific about the problem you're solving. -->
|
|
67
|
+
|
|
68
|
+
TODO: Write your product vision here.
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## 👥 Target Users
|
|
73
|
+
|
|
74
|
+
<!-- Who are your users? What are their pain points? Create 2-3 personas. -->
|
|
75
|
+
|
|
76
|
+
TODO: Define your user personas.
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## ✨ Core Features (MVP)
|
|
81
|
+
|
|
82
|
+
<!-- List your must-have features with acceptance criteria. -->
|
|
83
|
+
|
|
84
|
+
### Feature 1: [Feature Name]
|
|
85
|
+
**User Story:** As a [user], I want to [action] so that [benefit].
|
|
86
|
+
|
|
87
|
+
**Acceptance Criteria:**
|
|
88
|
+
- [ ] Criteria 1
|
|
89
|
+
- [ ] Criteria 2
|
|
90
|
+
- [ ] Criteria 3
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## 🚫 Out of Scope (V1)
|
|
95
|
+
|
|
96
|
+
<!-- What are you explicitly NOT building? This is just as important. -->
|
|
97
|
+
|
|
98
|
+
- ❌ Item 1
|
|
99
|
+
- ❌ Item 2
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## 📊 Success Metrics
|
|
104
|
+
|
|
105
|
+
<!-- How will you know if this project is successful? -->
|
|
106
|
+
|
|
107
|
+
| Metric | Target | Timeframe |
|
|
108
|
+
|--------|--------|-----------|
|
|
109
|
+
| TODO | TODO | TODO |
|
|
110
|
+
`,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function generateArchitecture(config) {
|
|
114
|
+
return {
|
|
115
|
+
path: '.nexus/docs/02_architecture.md',
|
|
116
|
+
content: `${frontmatter('02_architecture', 'System Architecture')}# System Architecture
|
|
117
|
+
|
|
118
|
+
**Project:** ${config.projectName}
|
|
119
|
+
**Framework:** ${config.frontendFramework}
|
|
120
|
+
**Data Strategy:** ${config.dataStrategy}
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## 🏗️ Architecture Overview
|
|
125
|
+
|
|
126
|
+
<!-- High-level diagram of your system. ASCII art or link to a diagram tool. -->
|
|
127
|
+
|
|
128
|
+
\`\`\`
|
|
129
|
+
TODO: Draw your architecture diagram here.
|
|
130
|
+
\`\`\`
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## 🛠️ Tech Stack
|
|
135
|
+
|
|
136
|
+
| Component | Technology | Rationale |
|
|
137
|
+
|-----------|-----------|-----------|
|
|
138
|
+
| Frontend | ${config.frontendFramework} | Selected during project setup |
|
|
139
|
+
| Data | ${config.dataStrategy} | ${config.dataStrategy} strategy |
|
|
140
|
+
| Testing | ${config.testFramework} | Selected during project setup |
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## 📁 Directory Structure
|
|
145
|
+
|
|
146
|
+
<!-- Document your folder conventions and where things go. -->
|
|
147
|
+
|
|
148
|
+
TODO: Document your project's directory conventions.
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## 🔄 Data Flow
|
|
153
|
+
|
|
154
|
+
<!-- How does data move through your system? -->
|
|
155
|
+
|
|
156
|
+
TODO: Describe your data flow.
|
|
157
|
+
`,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
function generateDataContracts(config) {
|
|
161
|
+
return {
|
|
162
|
+
path: '.nexus/docs/03_data_contracts.md',
|
|
163
|
+
content: `${frontmatter('03_data_contracts', 'Data Contracts')}# Data Contracts
|
|
164
|
+
|
|
165
|
+
**Project:** ${config.projectName}
|
|
166
|
+
**Data Strategy:** ${config.dataStrategy}
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## 📊 Database Schema
|
|
171
|
+
|
|
172
|
+
<!-- Define your data models, tables, relationships. -->
|
|
173
|
+
|
|
174
|
+
TODO: Define your data models.
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## ✅ Validation Rules
|
|
179
|
+
|
|
180
|
+
<!-- What validation rules apply to your data? -->
|
|
181
|
+
|
|
182
|
+
TODO: Document validation rules.
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## 🔗 Relationships
|
|
187
|
+
|
|
188
|
+
<!-- How do your data models relate to each other? -->
|
|
189
|
+
|
|
190
|
+
TODO: Document data relationships.
|
|
191
|
+
`,
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
function generateApiContracts(config) {
|
|
195
|
+
return {
|
|
196
|
+
path: '.nexus/docs/04_api_contracts.md',
|
|
197
|
+
content: `${frontmatter('04_api_contracts', 'API Contracts')}# API Contracts
|
|
198
|
+
|
|
199
|
+
**Project:** ${config.projectName}
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## 🔌 Endpoints
|
|
204
|
+
|
|
205
|
+
<!-- Define your API endpoints with request/response shapes. -->
|
|
206
|
+
|
|
207
|
+
### \`GET /api/example\`
|
|
208
|
+
|
|
209
|
+
**Description:** TODO
|
|
210
|
+
|
|
211
|
+
**Response:**
|
|
212
|
+
\`\`\`json
|
|
213
|
+
{
|
|
214
|
+
"data": []
|
|
215
|
+
}
|
|
216
|
+
\`\`\`
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## 📋 Status Codes
|
|
221
|
+
|
|
222
|
+
| Code | Meaning |
|
|
223
|
+
|------|---------|
|
|
224
|
+
| 200 | Success |
|
|
225
|
+
| 400 | Bad Request |
|
|
226
|
+
| 401 | Unauthorized |
|
|
227
|
+
| 404 | Not Found |
|
|
228
|
+
| 500 | Internal Server Error |
|
|
229
|
+
`,
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
function generateBusinessLogic(config) {
|
|
233
|
+
return {
|
|
234
|
+
path: '.nexus/docs/05_business_logic.md',
|
|
235
|
+
content: `${frontmatter('05_business_logic', 'Business Logic')}# Business Logic
|
|
236
|
+
|
|
237
|
+
**Project:** ${config.projectName}
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
## 📐 Business Rules
|
|
242
|
+
|
|
243
|
+
<!-- Document the core rules and logic of your application. -->
|
|
244
|
+
|
|
245
|
+
TODO: Define your business rules.
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
## 🔄 State Machines
|
|
250
|
+
|
|
251
|
+
<!-- If your app has complex state, document it here. -->
|
|
252
|
+
|
|
253
|
+
TODO: Document state machines and flows.
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
## 🧮 Algorithms
|
|
258
|
+
|
|
259
|
+
<!-- Any non-trivial algorithms or calculations. -->
|
|
260
|
+
|
|
261
|
+
TODO: Document algorithms.
|
|
262
|
+
`,
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
function generateTestStrategy(config) {
|
|
266
|
+
return {
|
|
267
|
+
path: '.nexus/docs/06_test_strategy.md',
|
|
268
|
+
content: `${frontmatter('06_test_strategy', 'Test Strategy')}# Test Strategy
|
|
269
|
+
|
|
270
|
+
**Project:** ${config.projectName}
|
|
271
|
+
**Framework:** ${config.testFramework}
|
|
272
|
+
|
|
273
|
+
---
|
|
274
|
+
|
|
275
|
+
## 🧪 Testing Philosophy
|
|
276
|
+
|
|
277
|
+
<!-- What's your approach to testing? What's the coverage target? -->
|
|
278
|
+
|
|
279
|
+
**Coverage Target:** 80%+
|
|
280
|
+
|
|
281
|
+
---
|
|
282
|
+
|
|
283
|
+
## 📋 Test Types
|
|
284
|
+
|
|
285
|
+
| Type | Tool | Coverage |
|
|
286
|
+
|------|------|----------|
|
|
287
|
+
| Unit | ${config.testFramework} | Core logic, utilities, validators |
|
|
288
|
+
| Integration | ${config.testFramework} | API routes, data flows |
|
|
289
|
+
| E2E | Playwright | Critical user journeys |
|
|
290
|
+
|
|
291
|
+
---
|
|
292
|
+
|
|
293
|
+
## 🏃 Running Tests
|
|
294
|
+
|
|
295
|
+
\`\`\`bash
|
|
296
|
+
npm test # Run all tests
|
|
297
|
+
npm run test:watch # Watch mode
|
|
298
|
+
npm run test:coverage # With coverage report
|
|
299
|
+
\`\`\`
|
|
300
|
+
`,
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
function generateImplementation(config) {
|
|
304
|
+
return {
|
|
305
|
+
path: '.nexus/docs/07_implementation.md',
|
|
306
|
+
content: `${frontmatter('07_implementation', 'Implementation Plan')}# Implementation Plan
|
|
307
|
+
|
|
308
|
+
**Project:** ${config.projectName}
|
|
309
|
+
|
|
310
|
+
---
|
|
311
|
+
|
|
312
|
+
## 🔨 Build Order
|
|
313
|
+
|
|
314
|
+
<!-- What order should features be built in? -->
|
|
315
|
+
|
|
316
|
+
### Phase 1: Foundation
|
|
317
|
+
- [ ] Project setup ✅ (done by NEXUS CLI)
|
|
318
|
+
- [ ] Core data models
|
|
319
|
+
- [ ] Basic UI layout
|
|
320
|
+
|
|
321
|
+
### Phase 2: Core Features
|
|
322
|
+
- [ ] Feature 1
|
|
323
|
+
- [ ] Feature 2
|
|
324
|
+
- [ ] Feature 3
|
|
325
|
+
|
|
326
|
+
### Phase 3: Polish
|
|
327
|
+
- [ ] Error handling
|
|
328
|
+
- [ ] Loading states
|
|
329
|
+
- [ ] Responsive design
|
|
330
|
+
|
|
331
|
+
---
|
|
332
|
+
|
|
333
|
+
## 📁 File-by-File Plan
|
|
334
|
+
|
|
335
|
+
<!-- For AI agents: list each file that needs to be created and what it should contain. -->
|
|
336
|
+
|
|
337
|
+
TODO: Create a file-by-file implementation plan.
|
|
338
|
+
`,
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
function generateDeployment(config) {
|
|
342
|
+
return {
|
|
343
|
+
path: '.nexus/docs/08_deployment.md',
|
|
344
|
+
content: `${frontmatter('08_deployment', 'Deployment')}# Deployment
|
|
345
|
+
|
|
346
|
+
**Project:** ${config.projectName}
|
|
347
|
+
|
|
348
|
+
---
|
|
349
|
+
|
|
350
|
+
## 🚀 Deployment Strategy
|
|
351
|
+
|
|
352
|
+
<!-- Where and how will this be deployed? -->
|
|
353
|
+
|
|
354
|
+
TODO: Define your deployment strategy.
|
|
355
|
+
|
|
356
|
+
---
|
|
357
|
+
|
|
358
|
+
## 🔧 Environment Variables
|
|
359
|
+
|
|
360
|
+
| Variable | Description | Required | Default |
|
|
361
|
+
|----------|-------------|----------|---------|
|
|
362
|
+
| \`NODE_ENV\` | Environment | Yes | \`development\` |
|
|
363
|
+
|
|
364
|
+
---
|
|
365
|
+
|
|
366
|
+
## 📦 CI/CD
|
|
367
|
+
|
|
368
|
+
A GitHub Actions workflow has been generated at \`.github/workflows/ci.yml\`.
|
|
369
|
+
|
|
370
|
+
It runs on every push and PR to \`main\`:
|
|
371
|
+
1. ✅ Lint
|
|
372
|
+
2. ✅ Type check
|
|
373
|
+
3. ✅ Tests
|
|
374
|
+
4. ✅ Build
|
|
375
|
+
`,
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
function generateNexusIndex(config) {
|
|
379
|
+
return {
|
|
380
|
+
path: '.nexus/index.md',
|
|
381
|
+
content: `# NEXUS Project Index
|
|
382
|
+
|
|
383
|
+
**Project:** ${config.projectName}
|
|
384
|
+
**Generated:** ${new Date().toISOString().split('T')[0]}
|
|
385
|
+
**CLI Version:** ${version}
|
|
386
|
+
|
|
387
|
+
---
|
|
388
|
+
|
|
389
|
+
## 📚 Document Map
|
|
390
|
+
|
|
391
|
+
| Doc | Path | Purpose |
|
|
392
|
+
|-----|------|---------|
|
|
393
|
+
| Vision | \`.nexus/docs/01_vision.md\` | Product requirements & user stories |
|
|
394
|
+
| Architecture | \`.nexus/docs/02_architecture.md\` | System design & tech stack |
|
|
395
|
+
| Data Contracts | \`.nexus/docs/03_data_contracts.md\` | Database schemas & validation |
|
|
396
|
+
| API Contracts | \`.nexus/docs/04_api_contracts.md\` | Endpoints & interfaces |
|
|
397
|
+
| Business Logic | \`.nexus/docs/05_business_logic.md\` | Rules, algorithms & flows |
|
|
398
|
+
| Test Strategy | \`.nexus/docs/06_test_strategy.md\` | Testing philosophy & coverage |
|
|
399
|
+
| Implementation | \`.nexus/docs/07_implementation.md\` | Build order & file structure |
|
|
400
|
+
| Deployment | \`.nexus/docs/08_deployment.md\` | Infrastructure & CI/CD |
|
|
401
|
+
|
|
402
|
+
---
|
|
403
|
+
|
|
404
|
+
## 🤖 AI Agent Instructions
|
|
405
|
+
|
|
406
|
+
If you are an AI reading this project:
|
|
407
|
+
|
|
408
|
+
1. **Start with** \`.nexus/docs/01_vision.md\` to understand what this project does
|
|
409
|
+
2. **Read** \`.nexus/docs/02_architecture.md\` to understand the tech decisions
|
|
410
|
+
3. **Reference** \`.nexus/docs/03_data_contracts.md\` and \`.nexus/docs/04_api_contracts.md\` for exact schemas
|
|
411
|
+
4. **Follow** \`.nexus/docs/07_implementation.md\` for build order
|
|
412
|
+
5. **Run tests** after every change using the commands in \`.nexus/docs/06_test_strategy.md\`
|
|
413
|
+
`,
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
function generateNexusManifest(config) {
|
|
417
|
+
const manifest = {
|
|
418
|
+
version: '1.0.0',
|
|
419
|
+
generatedAt: new Date().toISOString(),
|
|
420
|
+
config,
|
|
421
|
+
cli: {
|
|
422
|
+
version,
|
|
423
|
+
name: '@nexus-framework/cli',
|
|
424
|
+
},
|
|
425
|
+
};
|
|
426
|
+
return {
|
|
427
|
+
path: '.nexus/manifest.json',
|
|
428
|
+
content: JSON.stringify(manifest, null, 2) + '\n',
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
//# sourceMappingURL=docs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs.js","sourceRoot":"","sources":["../../src/generators/docs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;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AI,EAAE,CAAC,WAAW,EAAE;QACrC,MAAM;QACN,GAAG,EAAE;YACH,OAAO;YACP,IAAI,EAAE,sBAAsB;SAC7B;KACF,CAAC;IAEF,OAAO;QACL,IAAI,EAAE,sBAAsB;QAC5B,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI;KAClD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NEXUS CLI - Generator Orchestrator
|
|
3
|
+
*
|
|
4
|
+
* Coordinates all generators to produce a complete project.
|
|
5
|
+
* Also provides `adoptProject()` for adding .nexus/ to existing projects.
|
|
6
|
+
*/
|
|
7
|
+
import type { NexusConfig } from '../types/config.js';
|
|
8
|
+
import type { ProjectInfo } from '../utils/project-detector.js';
|
|
9
|
+
/**
|
|
10
|
+
* Run all generators and write the project to disk.
|
|
11
|
+
*/
|
|
12
|
+
export declare function generateProject(config: NexusConfig): Promise<void>;
|
|
13
|
+
/**
|
|
14
|
+
* Add NEXUS documentation and AI config to an existing project.
|
|
15
|
+
*
|
|
16
|
+
* This generates only:
|
|
17
|
+
* - .nexus/docs/ (8 documentation files + index + manifest)
|
|
18
|
+
* - .nexus/ai/ (AI agent instructions)
|
|
19
|
+
* - Root AI pointer files (.cursorrules, AGENTS.md, etc.)
|
|
20
|
+
*
|
|
21
|
+
* It does NOT scaffold source code, configs, tests, or landing pages.
|
|
22
|
+
*/
|
|
23
|
+
export declare function adoptProject(targetDir: string, projectInfo: ProjectInfo): Promise<void>;
|
|
24
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/generators/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAehE;;GAEG;AACH,wBAAsB,eAAe,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAwDxE;AAMD;;;;;;;;;GASG;AACH,wBAAsB,YAAY,CAChC,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,WAAW,GACvB,OAAO,CAAC,IAAI,CAAC,CA4Bf"}
|