@nexus-framework/cli 0.2.0 → 0.2.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/dist/cli.js +5 -3
- package/dist/cli.js.map +1 -1
- package/dist/commands/adopt.d.ts +4 -2
- package/dist/commands/adopt.d.ts.map +1 -1
- package/dist/commands/adopt.js +47 -8
- package/dist/commands/adopt.js.map +1 -1
- package/dist/commands/init.d.ts +1 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +1 -1
- package/dist/commands/init.js.map +1 -1
- package/dist/generators/docs.d.ts +10 -1
- package/dist/generators/docs.d.ts.map +1 -1
- package/dist/generators/docs.js +40 -65
- package/dist/generators/docs.js.map +1 -1
- package/dist/generators/index.d.ts +2 -1
- package/dist/generators/index.d.ts.map +1 -1
- package/dist/generators/index.js +47 -7
- package/dist/generators/index.js.map +1 -1
- package/dist/generators/spring-boot.d.ts +12 -0
- package/dist/generators/spring-boot.d.ts.map +1 -0
- package/dist/generators/spring-boot.js +220 -0
- package/dist/generators/spring-boot.js.map +1 -0
- package/dist/generators/structure.d.ts +1 -0
- package/dist/generators/structure.d.ts.map +1 -1
- package/dist/generators/structure.js +90 -24
- package/dist/generators/structure.js.map +1 -1
- package/dist/prompts/adoption.d.ts +35 -0
- package/dist/prompts/adoption.d.ts.map +1 -0
- package/dist/prompts/adoption.js +153 -0
- package/dist/prompts/adoption.js.map +1 -0
- package/dist/prompts/frameworks.d.ts +5 -1
- package/dist/prompts/frameworks.d.ts.map +1 -1
- package/dist/prompts/frameworks.js +48 -0
- package/dist/prompts/frameworks.js.map +1 -1
- package/dist/prompts/index.d.ts +2 -1
- package/dist/prompts/index.d.ts.map +1 -1
- package/dist/prompts/index.js +15 -7
- package/dist/prompts/index.js.map +1 -1
- package/dist/prompts/project-type.d.ts.map +1 -1
- package/dist/prompts/project-type.js +6 -1
- package/dist/prompts/project-type.js.map +1 -1
- package/dist/types/config.d.ts +6 -2
- package/dist/types/config.d.ts.map +1 -1
- package/dist/utils/file-system.d.ts.map +1 -1
- package/dist/utils/file-system.js +4 -2
- package/dist/utils/file-system.js.map +1 -1
- package/dist/utils/logger.d.ts +2 -2
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +49 -36
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/project-detector.d.ts +20 -4
- package/dist/utils/project-detector.d.ts.map +1 -1
- package/dist/utils/project-detector.js +156 -27
- package/dist/utils/project-detector.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -1
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NEXUS CLI - Spring Boot Project Generator
|
|
3
|
+
*
|
|
4
|
+
* Generates pom.xml, application.properties, and basic Spring Boot structure.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Generate Spring Boot project files (Maven-based)
|
|
8
|
+
*/
|
|
9
|
+
export function generateSpringBootFiles(config) {
|
|
10
|
+
const files = [];
|
|
11
|
+
// Generate pom.xml (Maven build file)
|
|
12
|
+
files.push(generatePomXml(config));
|
|
13
|
+
// Generate application.properties
|
|
14
|
+
files.push(generateApplicationProperties(config));
|
|
15
|
+
// Generate main Application class
|
|
16
|
+
files.push(generateApplicationClass(config));
|
|
17
|
+
// Generate a sample controller
|
|
18
|
+
files.push(generateSampleController(config));
|
|
19
|
+
// Generate application test
|
|
20
|
+
files.push(generateApplicationTest(config));
|
|
21
|
+
return files;
|
|
22
|
+
}
|
|
23
|
+
function generatePomXml(config) {
|
|
24
|
+
const groupId = 'com.example';
|
|
25
|
+
const artifactId = config.projectName;
|
|
26
|
+
return {
|
|
27
|
+
path: 'pom.xml',
|
|
28
|
+
content: `<?xml version="1.0" encoding="UTF-8"?>
|
|
29
|
+
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
30
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
31
|
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
|
|
32
|
+
https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
33
|
+
<modelVersion>4.0.0</modelVersion>
|
|
34
|
+
|
|
35
|
+
<parent>
|
|
36
|
+
<groupId>org.springframework.boot</groupId>
|
|
37
|
+
<artifactId>spring-boot-starter-parent</artifactId>
|
|
38
|
+
<version>3.2.0</version>
|
|
39
|
+
<relativePath/>
|
|
40
|
+
</parent>
|
|
41
|
+
|
|
42
|
+
<groupId>${groupId}</groupId>
|
|
43
|
+
<artifactId>${artifactId}</artifactId>
|
|
44
|
+
<version>0.1.0</version>
|
|
45
|
+
<name>${config.displayName}</name>
|
|
46
|
+
<description>${config.displayName} - Spring Boot API</description>
|
|
47
|
+
|
|
48
|
+
<properties>
|
|
49
|
+
<java.version>21</java.version>
|
|
50
|
+
</properties>
|
|
51
|
+
|
|
52
|
+
<dependencies>
|
|
53
|
+
<!-- Spring Boot Web Starter -->
|
|
54
|
+
<dependency>
|
|
55
|
+
<groupId>org.springframework.boot</groupId>
|
|
56
|
+
<artifactId>spring-boot-starter-web</artifactId>
|
|
57
|
+
</dependency>
|
|
58
|
+
|
|
59
|
+
<!-- Spring Boot DevTools (optional, for hot reload) -->
|
|
60
|
+
<dependency>
|
|
61
|
+
<groupId>org.springframework.boot</groupId>
|
|
62
|
+
<artifactId>spring-boot-devtools</artifactId>
|
|
63
|
+
<scope>runtime</scope>
|
|
64
|
+
<optional>true</optional>
|
|
65
|
+
</dependency>
|
|
66
|
+
|
|
67
|
+
<!-- Spring Boot Actuator (health checks, metrics) -->
|
|
68
|
+
<dependency>
|
|
69
|
+
<groupId>org.springframework.boot</groupId>
|
|
70
|
+
<artifactId>spring-boot-starter-actuator</artifactId>
|
|
71
|
+
</dependency>
|
|
72
|
+
|
|
73
|
+
<!-- Lombok (optional, reduces boilerplate) -->
|
|
74
|
+
<dependency>
|
|
75
|
+
<groupId>org.projectlombok</groupId>
|
|
76
|
+
<artifactId>lombok</artifactId>
|
|
77
|
+
<optional>true</optional>
|
|
78
|
+
</dependency>
|
|
79
|
+
|
|
80
|
+
<!-- Spring Boot Test -->
|
|
81
|
+
<dependency>
|
|
82
|
+
<groupId>org.springframework.boot</groupId>
|
|
83
|
+
<artifactId>spring-boot-starter-test</artifactId>
|
|
84
|
+
<scope>test</scope>
|
|
85
|
+
</dependency>
|
|
86
|
+
</dependencies>
|
|
87
|
+
|
|
88
|
+
<build>
|
|
89
|
+
<plugins>
|
|
90
|
+
<plugin>
|
|
91
|
+
<groupId>org.springframework.boot</groupId>
|
|
92
|
+
<artifactId>spring-boot-maven-plugin</artifactId>
|
|
93
|
+
</plugin>
|
|
94
|
+
</plugins>
|
|
95
|
+
</build>
|
|
96
|
+
</project>
|
|
97
|
+
`,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
function generateApplicationProperties(config) {
|
|
101
|
+
return {
|
|
102
|
+
path: 'src/main/resources/application.properties',
|
|
103
|
+
content: `# ${config.displayName} Configuration
|
|
104
|
+
|
|
105
|
+
# Server Configuration
|
|
106
|
+
server.port=8080
|
|
107
|
+
|
|
108
|
+
# Application Name
|
|
109
|
+
spring.application.name=${config.projectName}
|
|
110
|
+
|
|
111
|
+
# Actuator Configuration
|
|
112
|
+
management.endpoints.web.exposure.include=health,info,metrics
|
|
113
|
+
|
|
114
|
+
# Logging Configuration
|
|
115
|
+
logging.level.root=INFO
|
|
116
|
+
logging.level.com.example=DEBUG
|
|
117
|
+
|
|
118
|
+
# TODO: Add your custom configuration here
|
|
119
|
+
`,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
function generateApplicationClass(config) {
|
|
123
|
+
const className = toPascalCase(config.projectName) + 'Application';
|
|
124
|
+
const packageName = `com.example.${config.projectName.replace(/-/g, '')}`;
|
|
125
|
+
return {
|
|
126
|
+
path: `src/main/java/${packageName.replace(/\./g, '/')}/${className}.java`,
|
|
127
|
+
content: `package ${packageName};
|
|
128
|
+
|
|
129
|
+
import org.springframework.boot.SpringApplication;
|
|
130
|
+
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* ${config.displayName} - Main Application Class
|
|
134
|
+
*
|
|
135
|
+
* This is the entry point for your Spring Boot application.
|
|
136
|
+
*/
|
|
137
|
+
@SpringBootApplication
|
|
138
|
+
public class ${className} {
|
|
139
|
+
|
|
140
|
+
public static void main(String[] args) {
|
|
141
|
+
SpringApplication.run(${className}.class, args);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
`,
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
function generateSampleController(config) {
|
|
148
|
+
const packageName = `com.example.${config.projectName.replace(/-/g, '')}`;
|
|
149
|
+
return {
|
|
150
|
+
path: `src/main/java/${packageName.replace(/\./g, '/')}/controller/HelloController.java`,
|
|
151
|
+
content: `package ${packageName}.controller;
|
|
152
|
+
|
|
153
|
+
import org.springframework.web.bind.annotation.GetMapping;
|
|
154
|
+
import org.springframework.web.bind.annotation.RequestMapping;
|
|
155
|
+
import org.springframework.web.bind.annotation.RestController;
|
|
156
|
+
|
|
157
|
+
import java.util.Map;
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Sample REST controller demonstrating basic endpoint structure.
|
|
161
|
+
*
|
|
162
|
+
* Replace this with your actual API endpoints.
|
|
163
|
+
*/
|
|
164
|
+
@RestController
|
|
165
|
+
@RequestMapping("/api")
|
|
166
|
+
public class HelloController {
|
|
167
|
+
|
|
168
|
+
@GetMapping("/hello")
|
|
169
|
+
public Map<String, String> hello() {
|
|
170
|
+
return Map.of(
|
|
171
|
+
"message", "Hello from ${config.displayName}!",
|
|
172
|
+
"status", "ok"
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
@GetMapping("/health")
|
|
177
|
+
public Map<String, String> health() {
|
|
178
|
+
return Map.of(
|
|
179
|
+
"status", "UP",
|
|
180
|
+
"service", "${config.projectName}"
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
`,
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
function generateApplicationTest(config) {
|
|
188
|
+
const className = toPascalCase(config.projectName) + 'Application';
|
|
189
|
+
const packageName = `com.example.${config.projectName.replace(/-/g, '')}`;
|
|
190
|
+
return {
|
|
191
|
+
path: `src/test/java/${packageName.replace(/\./g, '/')}/${className}Tests.java`,
|
|
192
|
+
content: `package ${packageName};
|
|
193
|
+
|
|
194
|
+
import org.junit.jupiter.api.Test;
|
|
195
|
+
import org.springframework.boot.test.context.SpringBootTest;
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Integration tests for ${config.displayName}
|
|
199
|
+
*/
|
|
200
|
+
@SpringBootTest
|
|
201
|
+
class ${className}Tests {
|
|
202
|
+
|
|
203
|
+
@Test
|
|
204
|
+
void contextLoads() {
|
|
205
|
+
// Verifies that Spring context loads successfully
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
`,
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Convert kebab-case to PascalCase
|
|
213
|
+
*/
|
|
214
|
+
function toPascalCase(str) {
|
|
215
|
+
return str
|
|
216
|
+
.split('-')
|
|
217
|
+
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
|
218
|
+
.join('');
|
|
219
|
+
}
|
|
220
|
+
//# sourceMappingURL=spring-boot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spring-boot.js","sourceRoot":"","sources":["../../src/generators/spring-boot.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH;;GAEG;AACH,MAAM,UAAU,uBAAuB,CAAC,MAAmB;IACzD,MAAM,KAAK,GAAoB,EAAE,CAAC;IAElC,sCAAsC;IACtC,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;IAEnC,kCAAkC;IAClC,KAAK,CAAC,IAAI,CAAC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../types/templates.js';
|
|
|
11
11
|
export declare function generateDirectories(config: NexusConfig): GeneratedDirectory[];
|
|
12
12
|
/**
|
|
13
13
|
* Generate the project's package.json content.
|
|
14
|
+
* For Spring Boot projects, returns empty content (they use pom.xml/build.gradle).
|
|
14
15
|
*/
|
|
15
16
|
export declare function generatePackageJson(config: NexusConfig): GeneratedFile;
|
|
16
17
|
/**
|
|
@@ -1 +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,
|
|
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,CAgG7E;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,WAAW,GAAG,aAAa,CAsDtE;AAsMD;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,aAAa,CAqCjD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,aAAa,CA0CjE"}
|
|
@@ -8,45 +8,66 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export function generateDirectories(config) {
|
|
10
10
|
const dirs = [
|
|
11
|
-
{ path: 'src' },
|
|
12
|
-
{ path: 'public' },
|
|
13
11
|
{ path: '.nexus' },
|
|
14
12
|
{ path: '.nexus/docs' },
|
|
15
13
|
{ path: '.nexus/ai' },
|
|
16
14
|
];
|
|
17
|
-
//
|
|
18
|
-
if (config.
|
|
15
|
+
// Spring Boot projects have a different structure
|
|
16
|
+
if (config.backendFramework === 'spring-boot') {
|
|
17
|
+
const packagePath = `com/example/${config.projectName.replace(/-/g, '')}`;
|
|
18
|
+
dirs.push({ path: 'src' }, { path: 'src/main' }, { path: 'src/main/java' }, { path: `src/main/java/${packagePath}` }, { path: `src/main/java/${packagePath}/controller` }, { path: 'src/main/resources' }, { path: 'src/test' }, { path: 'src/test/java' }, { path: `src/test/java/${packagePath}` });
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
// Node.js-based projects
|
|
22
|
+
dirs.push({ path: 'src' }, { path: 'public' });
|
|
23
|
+
}
|
|
24
|
+
// UI Library specific structure
|
|
25
|
+
if (config.projectType === 'ui-library') {
|
|
26
|
+
dirs.push({ path: 'src/components' }, { path: 'src/lib' }, { path: '.storybook' }, { path: 'stories' });
|
|
27
|
+
}
|
|
28
|
+
// Test directories (skip for Spring Boot as it has its own structure)
|
|
29
|
+
if (config.testFramework !== 'none' && config.backendFramework !== 'spring-boot') {
|
|
19
30
|
dirs.push({ path: 'tests' }, { path: 'tests/unit' }, { path: 'tests/integration' }, { path: 'tests/e2e' }, { path: 'tests/utils' });
|
|
20
31
|
}
|
|
21
32
|
// CI/CD
|
|
22
33
|
dirs.push({ path: '.github' }, { path: '.github/workflows' });
|
|
23
|
-
// Framework-specific
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
34
|
+
// Framework-specific (skip if Spring Boot or UI library)
|
|
35
|
+
if (config.backendFramework !== 'spring-boot' && config.projectType !== 'ui-library') {
|
|
36
|
+
switch (config.frontendFramework) {
|
|
37
|
+
case 'nextjs':
|
|
38
|
+
dirs.push({ path: 'src/app' }, { path: 'src/components' }, { path: 'src/lib' });
|
|
39
|
+
break;
|
|
40
|
+
case 'react-vite':
|
|
41
|
+
dirs.push({ path: 'src/components' }, { path: 'src/pages' }, { path: 'src/hooks' }, { path: 'src/lib' });
|
|
42
|
+
break;
|
|
43
|
+
case 'sveltekit':
|
|
44
|
+
dirs.push({ path: 'src/routes' }, { path: 'src/lib' }, { path: 'src/lib/components' }, { path: 'src/styles' });
|
|
45
|
+
break;
|
|
46
|
+
case 'nuxt':
|
|
47
|
+
dirs.push({ path: 'src/lib' }, { path: 'src/components' }, { path: 'pages' }, { path: 'assets' }, { path: 'assets/css' });
|
|
48
|
+
break;
|
|
49
|
+
case 'astro':
|
|
50
|
+
dirs.push({ path: 'src/pages' }, { path: 'src/layouts' }, { path: 'src/components' }, { path: 'src/styles' });
|
|
51
|
+
break;
|
|
52
|
+
default:
|
|
53
|
+
dirs.push({ path: 'src/lib' }, { path: 'src/components' });
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
43
56
|
}
|
|
44
57
|
return dirs;
|
|
45
58
|
}
|
|
46
59
|
/**
|
|
47
60
|
* Generate the project's package.json content.
|
|
61
|
+
* For Spring Boot projects, returns empty content (they use pom.xml/build.gradle).
|
|
48
62
|
*/
|
|
49
63
|
export function generatePackageJson(config) {
|
|
64
|
+
// Spring Boot projects don't use package.json - return empty
|
|
65
|
+
if (config.backendFramework === 'spring-boot') {
|
|
66
|
+
return {
|
|
67
|
+
path: 'package.json',
|
|
68
|
+
content: '',
|
|
69
|
+
};
|
|
70
|
+
}
|
|
50
71
|
const scripts = getFrameworkScripts(config);
|
|
51
72
|
const { dependencies, devDependencies } = getFrameworkDependencies(config);
|
|
52
73
|
const pkg = {
|
|
@@ -58,6 +79,20 @@ export function generatePackageJson(config) {
|
|
|
58
79
|
dependencies,
|
|
59
80
|
devDependencies,
|
|
60
81
|
};
|
|
82
|
+
// UI Library specific fields
|
|
83
|
+
if (config.projectType === 'ui-library') {
|
|
84
|
+
pkg.main = './dist/index.js';
|
|
85
|
+
pkg.module = './dist/index.mjs';
|
|
86
|
+
pkg.types = './dist/index.d.ts';
|
|
87
|
+
pkg.exports = {
|
|
88
|
+
'.': {
|
|
89
|
+
import: './dist/index.mjs',
|
|
90
|
+
require: './dist/index.js',
|
|
91
|
+
types: './dist/index.d.ts',
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
pkg.files = ['dist'];
|
|
95
|
+
}
|
|
61
96
|
// Add test scripts & dependencies
|
|
62
97
|
if (config.testFramework === 'vitest') {
|
|
63
98
|
pkg.scripts.test = 'vitest run';
|
|
@@ -85,6 +120,16 @@ function getFrameworkScripts(config) {
|
|
|
85
120
|
format: 'prettier --write .',
|
|
86
121
|
'type-check': 'tsc --noEmit',
|
|
87
122
|
};
|
|
123
|
+
// UI Library scripts
|
|
124
|
+
if (config.projectType === 'ui-library') {
|
|
125
|
+
return {
|
|
126
|
+
dev: 'vite',
|
|
127
|
+
build: 'vite build && tsc --emitDeclarationOnly',
|
|
128
|
+
storybook: 'storybook dev -p 6006',
|
|
129
|
+
'build-storybook': 'storybook build',
|
|
130
|
+
...base,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
88
133
|
switch (config.frontendFramework) {
|
|
89
134
|
case 'nextjs':
|
|
90
135
|
return {
|
|
@@ -148,6 +193,27 @@ function getFrameworkDependencies(config) {
|
|
|
148
193
|
eslint: '^8.57.0',
|
|
149
194
|
prettier: '^3.4.0',
|
|
150
195
|
};
|
|
196
|
+
// UI Library dependencies
|
|
197
|
+
if (config.projectType === 'ui-library') {
|
|
198
|
+
return {
|
|
199
|
+
dependencies: {},
|
|
200
|
+
devDependencies: {
|
|
201
|
+
...baseDev,
|
|
202
|
+
react: '^19.0.0',
|
|
203
|
+
'react-dom': '^19.0.0',
|
|
204
|
+
'@types/react': '^19.0.0',
|
|
205
|
+
'@types/react-dom': '^19.0.0',
|
|
206
|
+
vite: '^6.0.0',
|
|
207
|
+
'@vitejs/plugin-react': '^4.3.0',
|
|
208
|
+
storybook: '^8.0.0',
|
|
209
|
+
'@storybook/react': '^8.0.0',
|
|
210
|
+
'@storybook/react-vite': '^8.0.0',
|
|
211
|
+
'@storybook/addon-essentials': '^8.0.0',
|
|
212
|
+
'@storybook/addon-interactions': '^8.0.0',
|
|
213
|
+
'@storybook/test': '^8.0.0',
|
|
214
|
+
},
|
|
215
|
+
};
|
|
216
|
+
}
|
|
151
217
|
switch (config.frontendFramework) {
|
|
152
218
|
case 'nextjs':
|
|
153
219
|
return {
|
|
@@ -1 +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;QACjC,EAAE,IAAI,EAAE,
|
|
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;QACjC,EAAE,IAAI,EAAE,QAAQ,EAAE;QAClB,EAAE,IAAI,EAAE,aAAa,EAAE;QACvB,EAAE,IAAI,EAAE,WAAW,EAAE;KACtB,CAAC;IAEF,kDAAkD;IAClD,IAAI,MAAM,CAAC,gBAAgB,KAAK,aAAa,EAAE,CAAC;QAC9C,MAAM,WAAW,GAAG,eAAe,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC;QAC1E,IAAI,CAAC,IAAI,CACP,EAAE,IAAI,EAAE,KAAK,EAAE,EACf,EAAE,IAAI,EAAE,UAAU,EAAE,EACpB,EA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L,YAAY,EAAE;oBACZ,iBAAiB,EAAE,QAAQ;oBAC3B,kBAAkB,EAAE,QAAQ;oBAC5B,kBAAkB,EAAE,QAAQ;oBAC5B,KAAK,EAAE,SAAS;oBAChB,WAAW,EAAE,SAAS;iBACvB;gBACD,eAAe,EAAE;oBACf,GAAG,OAAO;oBACV,gBAAgB,EAAE,QAAQ;oBAC1B,IAAI,EAAE,QAAQ;oBACd,cAAc,EAAE,SAAS;oBACzB,kBAAkB,EAAE,SAAS;iBAC9B;aACF,CAAC;QACJ,KAAK,OAAO;YACV,OAAO;gBACL,YAAY,EAAE;oBACZ,KAAK,EAAE,QAAQ;iBAChB;gBACD,eAAe,EAAE;oBACf,GAAG,OAAO;iBACX;aACF,CAAC;QACJ;YACE,OAAO;gBACL,YAAY,EAAE,EAAE;gBAChB,eAAe,EAAE,OAAO;aACzB,CAAC;IACN,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB;IAC/B,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCjB,CAAC;IAEA,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC;AACzC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,MAAmB;IAChD,MAAM,OAAO,GAAG,KAAK,MAAM,CAAC,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA8B3B,MAAM,CAAC,WAAW;mBACb,MAAM,CAAC,iBAAiB;uBACpB,MAAM,CAAC,YAAY;iBACzB,MAAM,CAAC,aAAa;;;;;CAKpC,CAAC;IAEA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NEXUS CLI - Adoption Interview Prompt
|
|
3
|
+
*
|
|
4
|
+
* Before adopting an existing project, we interview the user to gather
|
|
5
|
+
* context that will help AI agents populate the template docs more intelligently.
|
|
6
|
+
*
|
|
7
|
+
* This is the "pre-adoption onboarding" — a brief conversation about:
|
|
8
|
+
* - What the project does (for vision doc)
|
|
9
|
+
* - Architecture type (monolith, microservices, serverless, etc.)
|
|
10
|
+
* - Main tech stack (if we couldn't auto-detect it)
|
|
11
|
+
* - Known pain points or areas needing docs
|
|
12
|
+
* - Whether NEXUS should be local-only or team-shared
|
|
13
|
+
*/
|
|
14
|
+
import type { ProjectInfo } from '../utils/project-detector.js';
|
|
15
|
+
/** User answers from the pre-adoption interview */
|
|
16
|
+
export interface AdoptionContext {
|
|
17
|
+
/** One-sentence description of what the project does */
|
|
18
|
+
projectDescription: string;
|
|
19
|
+
/** Architecture pattern */
|
|
20
|
+
architectureType: 'monolith' | 'microservices' | 'serverless' | 'modular-monolith' | 'other';
|
|
21
|
+
/** Main tech stack (if not auto-detected) */
|
|
22
|
+
techStack: string;
|
|
23
|
+
/** Areas that need documentation or are pain points */
|
|
24
|
+
painPoints: string;
|
|
25
|
+
/** Whether .nexus/ should be gitignored (local-only) */
|
|
26
|
+
localOnly: boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Run the pre-adoption interview.
|
|
30
|
+
*
|
|
31
|
+
* @param projectInfo - Detected project information (used for smart defaults)
|
|
32
|
+
* @returns User responses to guide doc generation
|
|
33
|
+
*/
|
|
34
|
+
export declare function promptAdoption(projectInfo: ProjectInfo): Promise<AdoptionContext>;
|
|
35
|
+
//# sourceMappingURL=adoption.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adoption.d.ts","sourceRoot":"","sources":["../../src/prompts/adoption.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAEhE,mDAAmD;AACnD,MAAM,WAAW,eAAe;IAC9B,wDAAwD;IACxD,kBAAkB,EAAE,MAAM,CAAC;IAC3B,2BAA2B;IAC3B,gBAAgB,EAAE,UAAU,GAAG,eAAe,GAAG,YAAY,GAAG,kBAAkB,GAAG,OAAO,CAAC;IAC7F,6CAA6C;IAC7C,SAAS,EAAE,MAAM,CAAC;IAClB,uDAAuD;IACvD,UAAU,EAAE,MAAM,CAAC;IACnB,wDAAwD;IACxD,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,eAAe,CAAC,CAuFvF"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NEXUS CLI - Adoption Interview Prompt
|
|
3
|
+
*
|
|
4
|
+
* Before adopting an existing project, we interview the user to gather
|
|
5
|
+
* context that will help AI agents populate the template docs more intelligently.
|
|
6
|
+
*
|
|
7
|
+
* This is the "pre-adoption onboarding" — a brief conversation about:
|
|
8
|
+
* - What the project does (for vision doc)
|
|
9
|
+
* - Architecture type (monolith, microservices, serverless, etc.)
|
|
10
|
+
* - Main tech stack (if we couldn't auto-detect it)
|
|
11
|
+
* - Known pain points or areas needing docs
|
|
12
|
+
* - Whether NEXUS should be local-only or team-shared
|
|
13
|
+
*/
|
|
14
|
+
import { input, select, confirm } from '@inquirer/prompts';
|
|
15
|
+
/**
|
|
16
|
+
* Run the pre-adoption interview.
|
|
17
|
+
*
|
|
18
|
+
* @param projectInfo - Detected project information (used for smart defaults)
|
|
19
|
+
* @returns User responses to guide doc generation
|
|
20
|
+
*/
|
|
21
|
+
export async function promptAdoption(projectInfo) {
|
|
22
|
+
const displayName = projectInfo.name ?? 'this project';
|
|
23
|
+
console.log('');
|
|
24
|
+
console.log('🔮 Let\'s set up NEXUS for your existing project.');
|
|
25
|
+
console.log(' Answer a few quick questions so AI agents understand your codebase.');
|
|
26
|
+
console.log('');
|
|
27
|
+
// 1. Project description
|
|
28
|
+
const projectDescription = await input({
|
|
29
|
+
message: `What does ${displayName} do? (One sentence for the vision doc)`,
|
|
30
|
+
default: projectInfo.description ?? '',
|
|
31
|
+
validate: (value) => {
|
|
32
|
+
if (value.trim().length < 10) {
|
|
33
|
+
return 'Please provide at least a 10-character description.';
|
|
34
|
+
}
|
|
35
|
+
return true;
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
// 2. Architecture type
|
|
39
|
+
const architectureType = await select({
|
|
40
|
+
message: 'What\'s the architecture pattern?',
|
|
41
|
+
choices: [
|
|
42
|
+
{
|
|
43
|
+
value: 'monolith',
|
|
44
|
+
name: '🏛️ Monolith',
|
|
45
|
+
description: 'Single codebase, all features in one app',
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
value: 'microservices',
|
|
49
|
+
name: '🔗 Microservices',
|
|
50
|
+
description: 'Multiple independent services communicating via APIs',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
value: 'serverless',
|
|
54
|
+
name: '☁️ Serverless',
|
|
55
|
+
description: 'Cloud Functions, Lambda, Vercel Functions, etc.',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
value: 'modular-monolith',
|
|
59
|
+
name: '📦 Modular Monolith',
|
|
60
|
+
description: 'Single deployment, organized into independent modules',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
value: 'other',
|
|
64
|
+
name: '🔧 Other',
|
|
65
|
+
description: 'Something else (explain in pain points)',
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
default: detectArchitectureType(projectInfo),
|
|
69
|
+
});
|
|
70
|
+
// 3. Tech stack (if we couldn't detect a framework)
|
|
71
|
+
let techStack = projectInfo.framework ?? 'unknown';
|
|
72
|
+
if (techStack === 'unknown' || techStack === 'node') {
|
|
73
|
+
techStack = await input({
|
|
74
|
+
message: 'What\'s the main tech stack? (e.g., "Express + MongoDB", "Go + PostgreSQL")',
|
|
75
|
+
default: buildTechStackGuess(projectInfo),
|
|
76
|
+
validate: (value) => {
|
|
77
|
+
if (value.trim().length < 3) {
|
|
78
|
+
return 'Please provide a valid tech stack description.';
|
|
79
|
+
}
|
|
80
|
+
return true;
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
// 4. Pain points
|
|
85
|
+
const painPoints = await input({
|
|
86
|
+
message: 'Any known pain points or areas that need better docs? (optional)',
|
|
87
|
+
default: '',
|
|
88
|
+
});
|
|
89
|
+
// 5. Local-only mode
|
|
90
|
+
const localOnly = await confirm({
|
|
91
|
+
message: 'Keep NEXUS local-only? (adds .nexus/ to .gitignore - won\'t be shared with team)',
|
|
92
|
+
default: false,
|
|
93
|
+
});
|
|
94
|
+
return {
|
|
95
|
+
projectDescription: projectDescription.trim(),
|
|
96
|
+
architectureType,
|
|
97
|
+
techStack,
|
|
98
|
+
painPoints: painPoints.trim(),
|
|
99
|
+
localOnly,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
/* ──────────────────────────────────────────────────────────────
|
|
103
|
+
* Smart Defaults
|
|
104
|
+
* ────────────────────────────────────────────────────────────── */
|
|
105
|
+
/**
|
|
106
|
+
* Guess architecture type based on detected dependencies.
|
|
107
|
+
*/
|
|
108
|
+
function detectArchitectureType(projectInfo) {
|
|
109
|
+
const deps = projectInfo.dependencies.map((d) => d.toLowerCase());
|
|
110
|
+
if (deps.includes('firebase-functions') ||
|
|
111
|
+
deps.includes('@google-cloud/functions-framework') ||
|
|
112
|
+
deps.includes('aws-lambda') ||
|
|
113
|
+
deps.includes('@vercel/node')) {
|
|
114
|
+
return 'serverless';
|
|
115
|
+
}
|
|
116
|
+
if (deps.some((d) => d.includes('microservice') || d.includes('grpc') || d.includes('rabbitmq'))) {
|
|
117
|
+
return 'microservices';
|
|
118
|
+
}
|
|
119
|
+
return 'monolith';
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Build a tech stack guess from detected dependencies.
|
|
123
|
+
*/
|
|
124
|
+
function buildTechStackGuess(projectInfo) {
|
|
125
|
+
const deps = projectInfo.dependencies;
|
|
126
|
+
const parts = [];
|
|
127
|
+
// Backend framework
|
|
128
|
+
if (deps.includes('express'))
|
|
129
|
+
parts.push('Express');
|
|
130
|
+
if (deps.includes('fastify'))
|
|
131
|
+
parts.push('Fastify');
|
|
132
|
+
if (deps.includes('koa'))
|
|
133
|
+
parts.push('Koa');
|
|
134
|
+
if (deps.includes('hapi'))
|
|
135
|
+
parts.push('Hapi');
|
|
136
|
+
if (deps.includes('nestjs'))
|
|
137
|
+
parts.push('NestJS');
|
|
138
|
+
// Database
|
|
139
|
+
if (deps.includes('mongodb') || deps.includes('mongoose'))
|
|
140
|
+
parts.push('MongoDB');
|
|
141
|
+
if (deps.includes('pg') || deps.includes('postgres'))
|
|
142
|
+
parts.push('PostgreSQL');
|
|
143
|
+
if (deps.includes('mysql') || deps.includes('mysql2'))
|
|
144
|
+
parts.push('MySQL');
|
|
145
|
+
if (deps.includes('prisma'))
|
|
146
|
+
parts.push('Prisma');
|
|
147
|
+
// Frontend
|
|
148
|
+
if (projectInfo.framework && projectInfo.framework !== 'node' && projectInfo.framework !== 'unknown') {
|
|
149
|
+
parts.push(projectInfo.framework);
|
|
150
|
+
}
|
|
151
|
+
return parts.length > 0 ? parts.join(' + ') : 'Node.js';
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=adoption.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adoption.js","sourceRoot":"","sources":["../../src/prompts/adoption.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAkB3D;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,WAAwB;IAC3D,MAAM,WAAW,GAAG,WAAW,CAAC,IAAI,IAAI,cAAc,CAAC;IAEvD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CAAC,mDAAmD,CAAC,CAAC;IACjE,OAAO,CAAC,GAAG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,CAAC,CAAC;IAC3E,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAElD,WAAW;IACX,IAAI,WAAW,CAAC,SAAS,IAAI,WAAW,CAAC,SAAS,KAAK,MAAM,IAAI,WAAW,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;QACrG,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;IACpC,CAAC;IAED,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC1D,CAAC"}
|
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
* Asks the user which frontend framework to use.
|
|
5
5
|
* Options are filtered based on project type.
|
|
6
6
|
*/
|
|
7
|
-
import type { FrontendFramework, ProjectType } from '../types/config.js';
|
|
7
|
+
import type { FrontendFramework, ProjectType, BackendFramework } from '../types/config.js';
|
|
8
8
|
export declare function promptFramework(projectType: ProjectType): Promise<FrontendFramework>;
|
|
9
|
+
/**
|
|
10
|
+
* Prompt for backend framework (for API projects)
|
|
11
|
+
*/
|
|
12
|
+
export declare function promptBackendFramework(): Promise<BackendFramework>;
|
|
9
13
|
//# sourceMappingURL=frameworks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frameworks.d.ts","sourceRoot":"","sources":["../../src/prompts/frameworks.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"frameworks.d.ts","sourceRoot":"","sources":["../../src/prompts/frameworks.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3F,wBAAsB,eAAe,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAuD1F;AAED;;GAEG;AACH,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,gBAAgB,CAAC,CA0BxE"}
|