ai-native-core 0.2.5 → 0.2.6
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/bin/ai-native.js +0 -0
- package/package.json +1 -1
- package/src/commands/init.js +31 -1
package/bin/ai-native.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
package/src/commands/init.js
CHANGED
|
@@ -25,7 +25,8 @@ function run(args) {
|
|
|
25
25
|
process.exit(1);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
const answers = inferFromStacks(stacks);
|
|
29
|
+
doInit(stacks, isForce, answers);
|
|
29
30
|
} else {
|
|
30
31
|
interactiveInit(isForce);
|
|
31
32
|
}
|
|
@@ -128,4 +129,33 @@ function doInit(stacks, isForce, answers = {}) {
|
|
|
128
129
|
console.log(' 3. ai-native accept');
|
|
129
130
|
}
|
|
130
131
|
|
|
132
|
+
function inferFromStacks(stacks) {
|
|
133
|
+
const answers = { pm: 'pnpm' };
|
|
134
|
+
const frontendStacks = ['react-spa', 'nextjs', 'vue'];
|
|
135
|
+
const backendStacks = ['backend-java', 'backend-go', 'backend-python'];
|
|
136
|
+
const hasFrontend = stacks.some(s => frontendStacks.includes(s));
|
|
137
|
+
const hasBackend = stacks.some(s => backendStacks.includes(s));
|
|
138
|
+
|
|
139
|
+
if (hasFrontend && hasBackend) answers.type = 'fullstack';
|
|
140
|
+
else if (hasBackend) answers.type = 'backend';
|
|
141
|
+
else answers.type = 'frontend';
|
|
142
|
+
|
|
143
|
+
if (hasBackend) {
|
|
144
|
+
const lang = stacks.find(s => s.startsWith('backend-')).replace('backend-', '');
|
|
145
|
+
answers.test = { java: 'junit', go: 'go-test', python: 'pytest' }[lang] || 'junit';
|
|
146
|
+
} else {
|
|
147
|
+
answers.test = 'vitest';
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (hasFrontend) {
|
|
151
|
+
answers.css = 'tailwind-v4';
|
|
152
|
+
answers.ui = 'shadcn';
|
|
153
|
+
answers.ts = 'yes';
|
|
154
|
+
} else {
|
|
155
|
+
answers.ts = 'no';
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return answers;
|
|
159
|
+
}
|
|
160
|
+
|
|
131
161
|
module.exports = { run };
|