@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 @@
|
|
|
1
|
+
{"version":3,"file":"structure.d.ts","sourceRoot":"","sources":["../../src/generators/structure.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE/E;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,WAAW,GAAG,kBAAkB,EAAE,CAmE7E;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,WAAW,GAAG,aAAa,CAwCtE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,aAAa,CAqCjD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,aAAa,CA0CjE"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NEXUS CLI - Structure Generator
|
|
3
|
+
*
|
|
4
|
+
* Generates the folder structure and base files for a new project.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Generate the base directory structure for any project type.
|
|
8
|
+
*/
|
|
9
|
+
export function generateDirectories(config) {
|
|
10
|
+
const dirs = [
|
|
11
|
+
{ path: 'src' },
|
|
12
|
+
{ path: 'public' },
|
|
13
|
+
{ path: '.nexus' },
|
|
14
|
+
{ path: '.nexus/docs' },
|
|
15
|
+
{ path: '.nexus/ai' },
|
|
16
|
+
];
|
|
17
|
+
// Test directories
|
|
18
|
+
if (config.testFramework !== 'none') {
|
|
19
|
+
dirs.push({ path: 'tests' }, { path: 'tests/unit' }, { path: 'tests/integration' }, { path: 'tests/e2e' }, { path: 'tests/utils' });
|
|
20
|
+
}
|
|
21
|
+
// CI/CD
|
|
22
|
+
dirs.push({ path: '.github' }, { path: '.github/workflows' });
|
|
23
|
+
// Framework-specific
|
|
24
|
+
switch (config.frontendFramework) {
|
|
25
|
+
case 'nextjs':
|
|
26
|
+
dirs.push({ path: 'src/app' }, { path: 'src/components' }, { path: 'src/lib' });
|
|
27
|
+
break;
|
|
28
|
+
case 'react-vite':
|
|
29
|
+
dirs.push({ path: 'src/components' }, { path: 'src/pages' }, { path: 'src/hooks' }, { path: 'src/lib' });
|
|
30
|
+
break;
|
|
31
|
+
case 'sveltekit':
|
|
32
|
+
dirs.push({ path: 'src/routes' }, { path: 'src/lib' }, { path: 'src/lib/components' }, { path: 'src/styles' });
|
|
33
|
+
break;
|
|
34
|
+
case 'nuxt':
|
|
35
|
+
dirs.push({ path: 'src/lib' }, { path: 'src/components' }, { path: 'pages' }, { path: 'assets' }, { path: 'assets/css' });
|
|
36
|
+
break;
|
|
37
|
+
case 'astro':
|
|
38
|
+
dirs.push({ path: 'src/pages' }, { path: 'src/layouts' }, { path: 'src/components' }, { path: 'src/styles' });
|
|
39
|
+
break;
|
|
40
|
+
default:
|
|
41
|
+
dirs.push({ path: 'src/lib' }, { path: 'src/components' });
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
return dirs;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Generate the project's package.json content.
|
|
48
|
+
*/
|
|
49
|
+
export function generatePackageJson(config) {
|
|
50
|
+
const pkg = {
|
|
51
|
+
name: config.projectName,
|
|
52
|
+
version: '0.1.0',
|
|
53
|
+
private: true,
|
|
54
|
+
type: 'module',
|
|
55
|
+
scripts: {
|
|
56
|
+
dev: 'echo "TODO: configure dev script"',
|
|
57
|
+
build: 'echo "TODO: configure build script"',
|
|
58
|
+
start: 'echo "TODO: configure start script"',
|
|
59
|
+
lint: 'eslint . --ext .ts,.tsx',
|
|
60
|
+
format: 'prettier --write .',
|
|
61
|
+
'type-check': 'tsc --noEmit',
|
|
62
|
+
},
|
|
63
|
+
dependencies: {},
|
|
64
|
+
devDependencies: {
|
|
65
|
+
typescript: '^5.7.0',
|
|
66
|
+
'@types/node': '^22.0.0',
|
|
67
|
+
eslint: '^8.57.0',
|
|
68
|
+
prettier: '^3.4.0',
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
// Add test scripts
|
|
72
|
+
if (config.testFramework === 'vitest') {
|
|
73
|
+
pkg.scripts.test = 'vitest run';
|
|
74
|
+
pkg.scripts['test:watch'] = 'vitest';
|
|
75
|
+
pkg.scripts['test:coverage'] = 'vitest run --coverage';
|
|
76
|
+
pkg.devDependencies.vitest = '^3.0.0';
|
|
77
|
+
}
|
|
78
|
+
else if (config.testFramework === 'jest') {
|
|
79
|
+
pkg.scripts.test = 'jest';
|
|
80
|
+
pkg.devDependencies.jest = '^29.0.0';
|
|
81
|
+
pkg.devDependencies['ts-jest'] = '^29.0.0';
|
|
82
|
+
pkg.devDependencies['@types/jest'] = '^29.0.0';
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
path: 'package.json',
|
|
86
|
+
content: JSON.stringify(pkg, null, 2) + '\n',
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Generate .gitignore file.
|
|
91
|
+
*/
|
|
92
|
+
export function generateGitignore() {
|
|
93
|
+
const content = `# Dependencies
|
|
94
|
+
node_modules/
|
|
95
|
+
|
|
96
|
+
# Build output
|
|
97
|
+
dist/
|
|
98
|
+
.next/
|
|
99
|
+
.svelte-kit/
|
|
100
|
+
.nuxt/
|
|
101
|
+
.output/
|
|
102
|
+
build/
|
|
103
|
+
|
|
104
|
+
# Environment
|
|
105
|
+
.env
|
|
106
|
+
.env.local
|
|
107
|
+
.env.*.local
|
|
108
|
+
|
|
109
|
+
# IDE
|
|
110
|
+
.vscode/settings.json
|
|
111
|
+
.idea/
|
|
112
|
+
*.swp
|
|
113
|
+
*.swo
|
|
114
|
+
|
|
115
|
+
# OS
|
|
116
|
+
.DS_Store
|
|
117
|
+
Thumbs.db
|
|
118
|
+
|
|
119
|
+
# Coverage
|
|
120
|
+
coverage/
|
|
121
|
+
|
|
122
|
+
# Debug
|
|
123
|
+
npm-debug.log*
|
|
124
|
+
yarn-debug.log*
|
|
125
|
+
yarn-error.log*
|
|
126
|
+
`;
|
|
127
|
+
return { path: '.gitignore', content };
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Generate a basic README for the created project.
|
|
131
|
+
*/
|
|
132
|
+
export function generateReadme(config) {
|
|
133
|
+
const content = `# ${config.projectName}
|
|
134
|
+
|
|
135
|
+
> Generated with [NEXUS CLI](https://github.com/GDA-Africa/nexus-cli) 🔮
|
|
136
|
+
|
|
137
|
+
## Getting Started
|
|
138
|
+
|
|
139
|
+
\`\`\`bash
|
|
140
|
+
npm install
|
|
141
|
+
npm run dev
|
|
142
|
+
\`\`\`
|
|
143
|
+
|
|
144
|
+
## Documentation
|
|
145
|
+
|
|
146
|
+
This project uses the **NEXUS Documentation System** — 8 structured markdown files designed for both humans and AI coding tools.
|
|
147
|
+
|
|
148
|
+
| Doc | Purpose |
|
|
149
|
+
|-----|---------|
|
|
150
|
+
| \`.nexus/docs/01_vision.md\` | Product requirements & user stories |
|
|
151
|
+
| \`.nexus/docs/02_architecture.md\` | System design & tech stack |
|
|
152
|
+
| \`.nexus/docs/03_data_contracts.md\` | Database schemas & validation |
|
|
153
|
+
| \`.nexus/docs/04_api_contracts.md\` | Endpoints & interfaces |
|
|
154
|
+
| \`.nexus/docs/05_business_logic.md\` | Rules, algorithms & flows |
|
|
155
|
+
| \`.nexus/docs/06_test_strategy.md\` | Testing philosophy & coverage |
|
|
156
|
+
| \`.nexus/docs/07_implementation.md\` | Build order & file structure |
|
|
157
|
+
| \`.nexus/docs/08_deployment.md\` | Infrastructure & CI/CD |
|
|
158
|
+
|
|
159
|
+
**Start here:** Open \`.nexus/docs/01_vision.md\` and describe what you're building.
|
|
160
|
+
|
|
161
|
+
## Project Info
|
|
162
|
+
|
|
163
|
+
- **Type:** ${config.projectType}
|
|
164
|
+
- **Framework:** ${config.frontendFramework}
|
|
165
|
+
- **Data Strategy:** ${config.dataStrategy}
|
|
166
|
+
- **Testing:** ${config.testFramework}
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
*Built with ❤️ using NEXUS CLI by [GDA Africa](https://github.com/GDA-Africa)*
|
|
171
|
+
`;
|
|
172
|
+
return { path: 'README.md', content };
|
|
173
|
+
}
|
|
174
|
+
//# sourceMappingURL=structure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"structure.js","sourceRoot":"","sources":["../../src/generators/structure.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAmB;IACrD,MAAM,IAAI,GAAyB;QAC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ACxC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NEXUS CLI - Test Generator
|
|
3
|
+
*
|
|
4
|
+
* Generates test infrastructure for the new project.
|
|
5
|
+
*/
|
|
6
|
+
import type { NexusConfig } from '../types/config.js';
|
|
7
|
+
import type { GeneratedFile } from '../types/templates.js';
|
|
8
|
+
/**
|
|
9
|
+
* Generate test configuration and example tests.
|
|
10
|
+
*/
|
|
11
|
+
export declare function generateTests(config: NexusConfig): GeneratedFile[];
|
|
12
|
+
//# sourceMappingURL=tests.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tests.d.ts","sourceRoot":"","sources":["../../src/generators/tests.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3D;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,WAAW,GAAG,aAAa,EAAE,CAalE"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NEXUS CLI - Test Generator
|
|
3
|
+
*
|
|
4
|
+
* Generates test infrastructure for the new project.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Generate test configuration and example tests.
|
|
8
|
+
*/
|
|
9
|
+
export function generateTests(config) {
|
|
10
|
+
if (config.testFramework === 'none')
|
|
11
|
+
return [];
|
|
12
|
+
const files = [];
|
|
13
|
+
if (config.testFramework === 'vitest') {
|
|
14
|
+
files.push(generateVitestConfig());
|
|
15
|
+
files.push(generateExampleVitestTest(config));
|
|
16
|
+
files.push(generateTestSetup());
|
|
17
|
+
files.push(generateTestHelpers());
|
|
18
|
+
}
|
|
19
|
+
return files;
|
|
20
|
+
}
|
|
21
|
+
function generateVitestConfig() {
|
|
22
|
+
return {
|
|
23
|
+
path: 'vitest.config.ts',
|
|
24
|
+
content: `import { defineConfig } from 'vitest/config';
|
|
25
|
+
|
|
26
|
+
export default defineConfig({
|
|
27
|
+
test: {
|
|
28
|
+
globals: true,
|
|
29
|
+
environment: 'node',
|
|
30
|
+
include: ['tests/**/*.test.ts'],
|
|
31
|
+
coverage: {
|
|
32
|
+
provider: 'v8',
|
|
33
|
+
reporter: ['text', 'lcov'],
|
|
34
|
+
include: ['src/**/*.ts'],
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
`,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function generateExampleVitestTest(config) {
|
|
42
|
+
return {
|
|
43
|
+
path: 'tests/unit/example.test.ts',
|
|
44
|
+
content: `import { describe, it, expect } from 'vitest';
|
|
45
|
+
|
|
46
|
+
describe('${config.projectName}', () => {
|
|
47
|
+
it('should pass a basic sanity check', () => {
|
|
48
|
+
expect(true).toBe(true);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('should perform basic arithmetic', () => {
|
|
52
|
+
expect(1 + 1).toBe(2);
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
`,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function generateTestSetup() {
|
|
59
|
+
return {
|
|
60
|
+
path: 'tests/setup.ts',
|
|
61
|
+
content: `/**
|
|
62
|
+
* Global test setup
|
|
63
|
+
*
|
|
64
|
+
* This file runs before all tests. Add global mocks, polyfills, or setup here.
|
|
65
|
+
*/
|
|
66
|
+
|
|
67
|
+
// Example: extend expect with custom matchers
|
|
68
|
+
// import '@testing-library/jest-dom';
|
|
69
|
+
`,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function generateTestHelpers() {
|
|
73
|
+
return {
|
|
74
|
+
path: 'tests/utils/test-helpers.ts',
|
|
75
|
+
content: `/**
|
|
76
|
+
* Shared test utilities and helpers.
|
|
77
|
+
*
|
|
78
|
+
* Add reusable test factories, mock builders, and assertion helpers here.
|
|
79
|
+
*/
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Create a delay (useful for async testing).
|
|
83
|
+
*/
|
|
84
|
+
export function delay(ms: number): Promise<void> {
|
|
85
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Generate a random string for test data.
|
|
90
|
+
*/
|
|
91
|
+
export function randomString(length = 8): string {
|
|
92
|
+
return Math.random().toString(36).substring(2, 2 + length);
|
|
93
|
+
}
|
|
94
|
+
`,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=tests.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tests.js","sourceRoot":"","sources":["../../src/generators/tests.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,MAAmB;IAC/C,IAAI,MAAM,CAAC,aAAa,KAAK,MAAM;QAAE,OAAO,EAAE,CAAC;IAE/C,MAAM,KAAK,GAAoB,EAAE,CAAC;IAElC,IAAI,MAAM,CAAC,aAAa,KAAK,QAAQ,EAAE,CAAC;QACtC,KAAK,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC;QACnC,KAAK,CAAC,IAAI,CAAC,yBAAyB,CAAC,MAAM,CAAC,CAAC,CAAC;QAC9C,KAAK,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC,CAAC;QAChC,KAAK,CAAC,IAAI,CAAC,mBAAmB,EAAE,CAAC,CAAC;IACpC,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,oBAAoB;IAC3B,OAAO;QACL,IAAI,EAAE,kBAAkB;QACxB,OAAO,EAAE;;;;;;;;;;;;;;CAcZ;KACE,CAAC;AACJ,CAAC;AAED,SAAS,yBAAyB,CAAC,MAAmB;IACpD,OAAO;QACL,IAAI,EAAE,4BAA4B;QAClC,OAAO,EAAE;;YAED,MAAM,CAAC,WAAW;;;;;;;;;CAS7B;KACE,CAAC;AACJ,CAAC;AAED,SAAS,iBAAiB;IACxB,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,OAAO,EAAE;;;;;;;;CAQZ;KACE,CAAC;AACJ,CAAC;AAED,SAAS,mBAAmB;IAC1B,OAAO;QACL,IAAI,EAAE,6BAA6B;QACnC,OAAO,EAAE;;;;;;;;;;;;;;;;;;;CAmBZ;KACE,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NEXUS CLI - Main Export
|
|
3
|
+
*
|
|
4
|
+
* Public API for programmatic usage of NEXUS CLI.
|
|
5
|
+
*/
|
|
6
|
+
export { adoptCommand } from './commands/adopt.js';
|
|
7
|
+
export { initCommand } from './commands/init.js';
|
|
8
|
+
export { runPrompts } from './prompts/index.js';
|
|
9
|
+
export { generateProject, adoptProject } from './generators/index.js';
|
|
10
|
+
export { version } from './version.js';
|
|
11
|
+
export type { NexusConfig, NexusManifest, PartialNexusConfig, } from './types/config.js';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,YAAY,EACV,WAAW,EACX,aAAa,EACb,kBAAkB,GACnB,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NEXUS CLI - Main Export
|
|
3
|
+
*
|
|
4
|
+
* Public API for programmatic usage of NEXUS CLI.
|
|
5
|
+
*/
|
|
6
|
+
export { adoptCommand } from './commands/adopt.js';
|
|
7
|
+
export { initCommand } from './commands/init.js';
|
|
8
|
+
export { runPrompts } from './prompts/index.js';
|
|
9
|
+
export { generateProject, adoptProject } from './generators/index.js';
|
|
10
|
+
export { version } from './version.js';
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NEXUS CLI - Data Strategy Prompt
|
|
3
|
+
*
|
|
4
|
+
* Asks the user about their data handling approach.
|
|
5
|
+
*/
|
|
6
|
+
import type { DataStrategy } from '../types/config.js';
|
|
7
|
+
export declare function promptDataStrategy(): Promise<DataStrategy>;
|
|
8
|
+
//# sourceMappingURL=data-strategy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-strategy.d.ts","sourceRoot":"","sources":["../../src/prompts/data-strategy.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,YAAY,CAAC,CA0BhE"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NEXUS CLI - Data Strategy Prompt
|
|
3
|
+
*
|
|
4
|
+
* Asks the user about their data handling approach.
|
|
5
|
+
*/
|
|
6
|
+
import { select } from '@inquirer/prompts';
|
|
7
|
+
export async function promptDataStrategy() {
|
|
8
|
+
return select({
|
|
9
|
+
message: 'How will your app handle data?',
|
|
10
|
+
choices: [
|
|
11
|
+
{
|
|
12
|
+
value: 'cloud-first',
|
|
13
|
+
name: '☁️ Cloud First',
|
|
14
|
+
description: 'Data lives on the server. Classic SaaS pattern — simple and proven.',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
value: 'local-first',
|
|
18
|
+
name: '💾 Local First',
|
|
19
|
+
description: 'Data lives on device, syncs to cloud. Offline-capable, fast UX.',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
value: 'local-only',
|
|
23
|
+
name: '📱 Local Only',
|
|
24
|
+
description: 'All data stays on the device. No server needed. Privacy-first.',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
value: 'hybrid',
|
|
28
|
+
name: '🔄 Hybrid',
|
|
29
|
+
description: 'Mix of local and cloud. Some data cached, some server-only.',
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=data-strategy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-strategy.js","sourceRoot":"","sources":["../../src/prompts/data-strategy.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAI3C,MAAM,CAAC,KAAK,UAAU,kBAAkB;IACtC,OAAO,MAAM,CAAe;QAC1B,OAAO,EAAE,gCAAgC;QACzC,OAAO,EAAE;YACP;gBACE,KAAK,EAAE,aAAa;gBACpB,IAAI,EAAE,iBAAiB;gBACvB,WAAW,EAAE,qEAAqE;aACnF;YACD;gBACE,KAAK,EAAE,aAAa;gBACpB,IAAI,EAAE,gBAAgB;gBACtB,WAAW,EAAE,iEAAiE;aAC/E;YACD;gBACE,KAAK,EAAE,YAAY;gBACnB,IAAI,EAAE,eAAe;gBACrB,WAAW,EAAE,gEAAgE;aAC9E;YACD;gBACE,KAAK,EAAE,QAAQ;gBACf,IAAI,EAAE,WAAW;gBACjB,WAAW,EAAE,6DAA6D;aAC3E;SACF;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NEXUS CLI - Features / Extras Prompt
|
|
3
|
+
*
|
|
4
|
+
* Asks about testing, package manager, git, and dependency installation.
|
|
5
|
+
*/
|
|
6
|
+
import type { TestFramework, PackageManager } from '../types/config.js';
|
|
7
|
+
export interface FeaturesResult {
|
|
8
|
+
testFramework: TestFramework;
|
|
9
|
+
packageManager: PackageManager;
|
|
10
|
+
git: boolean;
|
|
11
|
+
installDeps: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare function promptFeatures(): Promise<FeaturesResult>;
|
|
14
|
+
//# sourceMappingURL=features.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features.d.ts","sourceRoot":"","sources":["../../src/prompts/features.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAExE,MAAM,WAAW,cAAc;IAC7B,aAAa,EAAE,aAAa,CAAC;IAC7B,cAAc,EAAE,cAAc,CAAC;IAC/B,GAAG,EAAE,OAAO,CAAC;IACb,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,wBAAsB,cAAc,IAAI,OAAO,CAAC,cAAc,CAAC,CA0C9D"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NEXUS CLI - Features / Extras Prompt
|
|
3
|
+
*
|
|
4
|
+
* Asks about testing, package manager, git, and dependency installation.
|
|
5
|
+
*/
|
|
6
|
+
import { select, confirm } from '@inquirer/prompts';
|
|
7
|
+
export async function promptFeatures() {
|
|
8
|
+
const testFramework = await select({
|
|
9
|
+
message: 'Testing framework?',
|
|
10
|
+
choices: [
|
|
11
|
+
{
|
|
12
|
+
value: 'vitest',
|
|
13
|
+
name: '⚡ Vitest',
|
|
14
|
+
description: 'Fast, Vite-native. Recommended for modern projects.',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
value: 'jest',
|
|
18
|
+
name: '🃏 Jest',
|
|
19
|
+
description: 'Battle-tested. Largest ecosystem.',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
value: 'none',
|
|
23
|
+
name: '⏭️ Skip for now',
|
|
24
|
+
description: 'No test framework (you can add one later).',
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
});
|
|
28
|
+
const packageManager = await select({
|
|
29
|
+
message: 'Package manager?',
|
|
30
|
+
choices: [
|
|
31
|
+
{ value: 'npm', name: '📦 npm' },
|
|
32
|
+
{ value: 'yarn', name: '🧶 yarn' },
|
|
33
|
+
{ value: 'pnpm', name: '⚡ pnpm' },
|
|
34
|
+
],
|
|
35
|
+
});
|
|
36
|
+
const git = await confirm({
|
|
37
|
+
message: 'Initialize a git repository?',
|
|
38
|
+
default: true,
|
|
39
|
+
});
|
|
40
|
+
const installDeps = await confirm({
|
|
41
|
+
message: 'Install dependencies now?',
|
|
42
|
+
default: true,
|
|
43
|
+
});
|
|
44
|
+
return { testFramework, packageManager, git, installDeps };
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=features.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features.js","sourceRoot":"","sources":["../../src/prompts/features.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAWpD,MAAM,CAAC,KAAK,UAAU,cAAc;IAClC,MAAM,aAAa,GAAG,MAAM,MAAM,CAAgB;QAChD,OAAO,EAAE,oBAAoB;QAC7B,OAAO,EAAE;YACP;gBACE,KAAK,EAAE,QAAQ;gBACf,IAAI,EAAE,UAAU;gBAChB,WAAW,EAAE,qDAAqD;aACnE;YACD;gBACE,KAAK,EAAE,MAAM;gBACb,IAAI,EAAE,SAAS;gBACf,WAAW,EAAE,mCAAmC;aACjD;YACD;gBACE,KAAK,EAAE,MAAM;gBACb,IAAI,EAAE,kBAAkB;gBACxB,WAAW,EAAE,4CAA4C;aAC1D;SACF;KACF,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG,MAAM,MAAM,CAAiB;QAClD,OAAO,EAAE,kBAAkB;QAC3B,OAAO,EAAE;YACP,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE;YAChC,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE;YAClC,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE;SAClC;KACF,CAAC,CAAC;IAEH,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC;QACxB,OAAO,EAAE,8BAA8B;QACvC,OAAO,EAAE,IAAI;KACd,CAAC,CAAC;IAEH,MAAM,WAAW,GAAG,MAAM,OAAO,CAAC;QAChC,OAAO,EAAE,2BAA2B;QACpC,OAAO,EAAE,IAAI;KACd,CAAC,CAAC;IAEH,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,GAAG,EAAE,WAAW,EAAE,CAAC;AAC7D,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NEXUS CLI - Framework Prompt
|
|
3
|
+
*
|
|
4
|
+
* Asks the user which frontend framework to use.
|
|
5
|
+
* Options are filtered based on project type.
|
|
6
|
+
*/
|
|
7
|
+
import type { FrontendFramework, ProjectType } from '../types/config.js';
|
|
8
|
+
export declare function promptFramework(projectType: ProjectType): Promise<FrontendFramework>;
|
|
9
|
+
//# sourceMappingURL=frameworks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frameworks.d.ts","sourceRoot":"","sources":["../../src/prompts/frameworks.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,iBAAiB,EAAG,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAE1E,wBAAsB,eAAe,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAoC1F"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NEXUS CLI - Framework Prompt
|
|
3
|
+
*
|
|
4
|
+
* Asks the user which frontend framework to use.
|
|
5
|
+
* Options are filtered based on project type.
|
|
6
|
+
*/
|
|
7
|
+
import { select } from '@inquirer/prompts';
|
|
8
|
+
export async function promptFramework(projectType) {
|
|
9
|
+
if (projectType === 'api') {
|
|
10
|
+
// API projects don't need a frontend framework — we return a sentinel
|
|
11
|
+
return 'nextjs'; // will be ignored; backend prompt handles this
|
|
12
|
+
}
|
|
13
|
+
return select({
|
|
14
|
+
message: 'Which frontend framework?',
|
|
15
|
+
choices: [
|
|
16
|
+
{
|
|
17
|
+
value: 'nextjs',
|
|
18
|
+
name: '▲ Next.js 15 (App Router)',
|
|
19
|
+
description: 'React meta-framework with SSR, Server Actions, and API routes built in.',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
value: 'react-vite',
|
|
23
|
+
name: '⚡ React + Vite',
|
|
24
|
+
description: 'Lightweight SPA. Lightning-fast dev server. Pair with a separate API.',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
value: 'sveltekit',
|
|
28
|
+
name: '🔥 SvelteKit',
|
|
29
|
+
description: 'Svelte meta-framework with SSR, filesystem routing, and adapters.',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
value: 'nuxt',
|
|
33
|
+
name: '💚 Nuxt 3',
|
|
34
|
+
description: 'Vue 3 meta-framework with auto-imports and Nitro server engine.',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
value: 'astro',
|
|
38
|
+
name: '🚀 Astro',
|
|
39
|
+
description: 'Content-focused framework. Ships zero JS by default. Island architecture.',
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=frameworks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frameworks.js","sourceRoot":"","sources":["../../src/prompts/frameworks.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAI3C,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,WAAwB;IAC5D,IAAI,WAAW,KAAK,KAAK,EAAE,CAAC;QAC1B,sEAAsE;QACtE,OAAO,QAAQ,CAAC,CAAC,+CAA+C;IAClE,CAAC;IAED,OAAO,MAAM,CAAoB;QAC/B,OAAO,EAAE,2BAA2B;QACpC,OAAO,EAAE;YACP;gBACE,KAAK,EAAE,QAAQ;gBACf,IAAI,EAAE,2BAA2B;gBACjC,WAAW,EAAE,yEAAyE;aACvF;YACD;gBACE,KAAK,EAAE,YAAY;gBACnB,IAAI,EAAE,gBAAgB;gBACtB,WAAW,EAAE,uEAAuE;aACrF;YACD;gBACE,KAAK,EAAE,WAAW;gBAClB,IAAI,EAAE,cAAc;gBACpB,WAAW,EAAE,mEAAmE;aACjF;YACD;gBACE,KAAK,EAAE,MAAM;gBACb,IAAI,EAAE,WAAW;gBACjB,WAAW,EAAE,iEAAiE;aAC/E;YACD;gBACE,KAAK,EAAE,OAAO;gBACd,IAAI,EAAE,UAAU;gBAChB,WAAW,EAAE,2EAA2E;aACzF;SACF;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NEXUS CLI - Prompt Orchestrator
|
|
3
|
+
*
|
|
4
|
+
* Runs all prompts in order and assembles the final NexusConfig.
|
|
5
|
+
*/
|
|
6
|
+
import type { NexusConfig } from '../types/config.js';
|
|
7
|
+
/**
|
|
8
|
+
* Run the full interactive prompt flow and return a complete NexusConfig.
|
|
9
|
+
*
|
|
10
|
+
* @param initialName - Optional project name passed via CLI argument
|
|
11
|
+
*/
|
|
12
|
+
export declare function runPrompts(initialName?: string): Promise<NexusConfig>;
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAUtD;;;;GAIG;AACH,wBAAsB,UAAU,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAsD3E"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NEXUS CLI - Prompt Orchestrator
|
|
3
|
+
*
|
|
4
|
+
* Runs all prompts in order and assembles the final NexusConfig.
|
|
5
|
+
*/
|
|
6
|
+
import { input } from '@inquirer/prompts';
|
|
7
|
+
import { detectPackageManager } from '../utils/package-manager.js';
|
|
8
|
+
import { validateProjectName, sanitizeProjectName } from '../utils/validator.js';
|
|
9
|
+
import { promptDataStrategy } from './data-strategy.js';
|
|
10
|
+
import { promptFeatures } from './features.js';
|
|
11
|
+
import { promptFramework } from './frameworks.js';
|
|
12
|
+
import { promptPatterns } from './patterns.js';
|
|
13
|
+
import { promptProjectType } from './project-type.js';
|
|
14
|
+
/**
|
|
15
|
+
* Run the full interactive prompt flow and return a complete NexusConfig.
|
|
16
|
+
*
|
|
17
|
+
* @param initialName - Optional project name passed via CLI argument
|
|
18
|
+
*/
|
|
19
|
+
export async function runPrompts(initialName) {
|
|
20
|
+
// 1. Project name
|
|
21
|
+
let projectName;
|
|
22
|
+
if (!initialName) {
|
|
23
|
+
projectName = await input({
|
|
24
|
+
message: 'Project name:',
|
|
25
|
+
default: 'my-nexus-app',
|
|
26
|
+
validate: (val) => {
|
|
27
|
+
const result = validateProjectName(val);
|
|
28
|
+
return result.valid ? true : (result.message ?? 'Invalid name');
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
// Validate the provided name
|
|
34
|
+
const validation = validateProjectName(initialName);
|
|
35
|
+
if (!validation.valid) {
|
|
36
|
+
throw new Error(validation.message ?? 'Invalid project name.');
|
|
37
|
+
}
|
|
38
|
+
projectName = initialName;
|
|
39
|
+
}
|
|
40
|
+
projectName = sanitizeProjectName(projectName);
|
|
41
|
+
// 2. Project type
|
|
42
|
+
const projectType = await promptProjectType();
|
|
43
|
+
// 3. Data strategy
|
|
44
|
+
const dataStrategy = await promptDataStrategy();
|
|
45
|
+
// 4. Application patterns
|
|
46
|
+
const appPatterns = await promptPatterns();
|
|
47
|
+
// 5. Framework
|
|
48
|
+
const frontendFramework = await promptFramework(projectType);
|
|
49
|
+
// 6. Features & extras
|
|
50
|
+
const { testFramework, packageManager, git, installDeps } = await promptFeatures();
|
|
51
|
+
// Assemble config
|
|
52
|
+
const config = {
|
|
53
|
+
projectName,
|
|
54
|
+
projectType,
|
|
55
|
+
dataStrategy,
|
|
56
|
+
appPatterns,
|
|
57
|
+
frontendFramework,
|
|
58
|
+
backendStrategy: projectType === 'api' ? 'separate' : 'integrated',
|
|
59
|
+
backendFramework: projectType === 'api' ? 'express' : 'none',
|
|
60
|
+
testFramework,
|
|
61
|
+
packageManager: packageManager ?? detectPackageManager(),
|
|
62
|
+
git,
|
|
63
|
+
installDeps,
|
|
64
|
+
};
|
|
65
|
+
return config;
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,EAAE,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G,MAAM,iBAAiB,EAAE,CAAC;IAE9C,mBAAmB;IACnB,MAAM,YAAY,GAAG,MAAM,kBAAkB,EAAE,CAAC;IAEhD,0BAA0B;IAC1B,MAAM,WAAW,GAAG,MAAM,cAAc,EAAE,CAAC;IAE3C,eAAe;IACf,MAAM,iBAAiB,GAAG,MAAM,eAAe,CAAC,WAAW,CAAC,CAAC;IAE7D,uBAAuB;IACvB,MAAM,EAAE,aAAa,EAAE,cAAc,EAAE,GAAG,EAAE,WAAW,EAAE,GAAG,MAAM,cAAc,EAAE,CAAC;IAEnF,kBAAkB;IAClB,MAAM,MAAM,GAAgB;QAC1B,WAAW;QACX,WAAW;QACX,YAAY;QACZ,WAAW;QACX,iBAAiB;QACjB,eAAe,EAAE,WAAW,KAAK,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY;QAClE,gBAAgB,EAAE,WAAW,KAAK,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM;QAC5D,aAAa;QACb,cAAc,EAAE,cAAc,IAAI,oBAAoB,EAAE;QACxD,GAAG;QACH,WAAW;KACZ,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NEXUS CLI - Application Patterns Prompt
|
|
3
|
+
*
|
|
4
|
+
* Asks the user which application patterns to include.
|
|
5
|
+
*/
|
|
6
|
+
import type { AppPattern } from '../types/config.js';
|
|
7
|
+
export declare function promptPatterns(): Promise<AppPattern[]>;
|
|
8
|
+
//# sourceMappingURL=patterns.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patterns.d.ts","sourceRoot":"","sources":["../../src/prompts/patterns.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,wBAAsB,cAAc,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC,CAoC5D"}
|