multi-agents-cli 1.0.3 → 1.0.5
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/init.js +106 -14
- package/package.json +1 -1
package/init.js
CHANGED
|
@@ -55,9 +55,16 @@ if (isGlobalCLI) {
|
|
|
55
55
|
|
|
56
56
|
// Initialize git
|
|
57
57
|
try {
|
|
58
|
-
execSync('git init', { cwd: targetDir, stdio: 'pipe' });
|
|
58
|
+
execSync('git init -b main', { cwd: targetDir, stdio: 'pipe' });
|
|
59
59
|
execSync('git commit --allow-empty -m "init: project created"', { cwd: targetDir, stdio: 'pipe' });
|
|
60
|
-
} catch {
|
|
60
|
+
} catch {
|
|
61
|
+
// Fallback for older git versions that don't support -b flag
|
|
62
|
+
try {
|
|
63
|
+
execSync('git init', { cwd: targetDir, stdio: 'pipe' });
|
|
64
|
+
execSync('git checkout -b main', { cwd: targetDir, stdio: 'pipe' });
|
|
65
|
+
execSync('git commit --allow-empty -m "init: project created"', { cwd: targetDir, stdio: 'pipe' });
|
|
66
|
+
} catch { /* continue */ }
|
|
67
|
+
}
|
|
61
68
|
}
|
|
62
69
|
|
|
63
70
|
// ── Lock check ────────────────────────────────────────────────────────────────
|
|
@@ -73,6 +80,24 @@ if (!fs.existsSync(RUNTIME_DIR)) {
|
|
|
73
80
|
|
|
74
81
|
// ── Decision tree ─────────────────────────────────────────────────────────────
|
|
75
82
|
|
|
83
|
+
const FRAMEWORK_CONVENTIONS = {
|
|
84
|
+
client: {
|
|
85
|
+
'Next.js': { root: 'client', typesDir: 'client/src/types', importAlias: '@/types' },
|
|
86
|
+
'Angular': { root: 'client', typesDir: 'client/src/app/core/types', importAlias: null },
|
|
87
|
+
'Nuxt': { root: 'client', typesDir: 'client/types', importAlias: '~/types' },
|
|
88
|
+
'SvelteKit': { root: 'client', typesDir: 'client/src/lib/types', importAlias: '$lib/types' },
|
|
89
|
+
'Vite+React': { root: 'client', typesDir: 'client/src/types', importAlias: null },
|
|
90
|
+
'Remix': { root: 'client', typesDir: 'client/app/types', importAlias: null },
|
|
91
|
+
},
|
|
92
|
+
backend: {
|
|
93
|
+
'Express': { root: 'backend', typesDir: 'backend/src/types', routesDir: 'backend/src/routes' },
|
|
94
|
+
'NestJS': { root: 'backend', dtoDir: 'backend/src/dto', entitiesDir:'backend/src/entities' },
|
|
95
|
+
'Fastify': { root: 'backend', typesDir: 'backend/src/types', routesDir: 'backend/src/routes' },
|
|
96
|
+
'FastAPI': { root: 'backend', schemasDir: 'backend/app/schemas', modelsDir: 'backend/app/models' },
|
|
97
|
+
'Django': { root: 'backend', schemasDir: 'backend/api/serializers', modelsDir: 'backend/api/models' },
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
|
|
76
101
|
const CLIENT_FRAMEWORKS = [
|
|
77
102
|
{ label: 'Next.js', value: 'Next.js', language: 'TypeScript', integratedBackend: true },
|
|
78
103
|
{ label: 'Angular', value: 'Angular', language: 'TypeScript', integratedBackend: false },
|
|
@@ -87,6 +112,7 @@ const BACKEND_FRAMEWORKS = [
|
|
|
87
112
|
{ label: 'Express', value: 'Express', language: 'TypeScript' },
|
|
88
113
|
{ label: 'Fastify', value: 'Fastify', language: 'TypeScript' },
|
|
89
114
|
{ label: 'Django', value: 'Django', language: 'Python' },
|
|
115
|
+
{ label: 'FastAPI', value: 'FastAPI', language: 'Python' },
|
|
90
116
|
{ label: 'Laravel', value: 'Laravel', language: 'PHP' },
|
|
91
117
|
{ label: 'Rails', value: 'Rails', language: 'Ruby' },
|
|
92
118
|
];
|
|
@@ -122,6 +148,7 @@ const ORM_OPTIONS = {
|
|
|
122
148
|
'Express': ['Prisma', 'TypeORM', 'Drizzle', 'Sequelize'],
|
|
123
149
|
'Fastify': ['Prisma', 'TypeORM', 'Drizzle'],
|
|
124
150
|
'Django': ['Django ORM (built-in)', 'SQLAlchemy'],
|
|
151
|
+
'FastAPI': ['SQLAlchemy', 'Tortoise ORM', 'Beanie (MongoDB)'],
|
|
125
152
|
'Laravel': ['Eloquent (built-in)'],
|
|
126
153
|
'Rails': ['Active Record (built-in)'],
|
|
127
154
|
};
|
|
@@ -131,6 +158,7 @@ const AUTH_OPTIONS = {
|
|
|
131
158
|
'Express': ['Passport.js', 'JWT-only', 'OAuth2'],
|
|
132
159
|
'Fastify': ['fastify-jwt', 'Passport.js', 'OAuth2'],
|
|
133
160
|
'Django': ['Django Auth (built-in)', 'DRF TokenAuth', 'OAuth2'],
|
|
161
|
+
'FastAPI': ['JWT-only', 'OAuth2', 'FastAPI-Users'],
|
|
134
162
|
'Laravel': ['Laravel Sanctum', 'Laravel Passport', 'JWT'],
|
|
135
163
|
'Rails': ['Devise', 'JWT', 'OAuth2'],
|
|
136
164
|
};
|
|
@@ -153,18 +181,31 @@ const IDE_CANDIDATES = [
|
|
|
153
181
|
{
|
|
154
182
|
cmd: 'webstorm',
|
|
155
183
|
name: 'WebStorm',
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
184
|
+
mac: { app: 'WebStorm', toolboxApp: 'WebStorm', args: [] },
|
|
185
|
+
win: { paths: [
|
|
186
|
+
'{LOCALAPPDATA}\\JetBrains\\Toolbox\\scripts\\webstorm.cmd',
|
|
187
|
+
'{LOCALAPPDATA}\\Programs\\WebStorm\\bin\\webstorm64.exe',
|
|
188
|
+
], args: [] },
|
|
189
|
+
linux: { paths: [
|
|
190
|
+
`${os.homedir()}/.local/bin/webstorm`,
|
|
191
|
+
'/opt/webstorm/bin/webstorm.sh',
|
|
192
|
+
'/snap/webstorm/current/bin/webstorm.sh',
|
|
193
|
+
], args: [] },
|
|
160
194
|
},
|
|
161
195
|
{
|
|
162
196
|
cmd: 'idea',
|
|
163
197
|
name: 'IntelliJ IDEA',
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
198
|
+
mac: { app: 'IntelliJ IDEA', toolboxApp: 'IntelliJ IDEA', args: [] },
|
|
199
|
+
win: { paths: [
|
|
200
|
+
'{LOCALAPPDATA}\\JetBrains\\Toolbox\\scripts\\idea.cmd',
|
|
201
|
+
'{LOCALAPPDATA}\\Programs\\IntelliJ IDEA Community Edition\\bin\\idea64.exe',
|
|
202
|
+
'{ProgramFiles}\\JetBrains\\IntelliJ IDEA\\bin\\idea64.exe',
|
|
203
|
+
], args: [] },
|
|
204
|
+
linux: { paths: [
|
|
205
|
+
`${os.homedir()}/.local/bin/idea`,
|
|
206
|
+
'/opt/idea/bin/idea.sh',
|
|
207
|
+
'/snap/intellij-idea-community/current/bin/idea.sh',
|
|
208
|
+
], args: [] },
|
|
168
209
|
},
|
|
169
210
|
{
|
|
170
211
|
cmd: 'zed',
|
|
@@ -201,10 +242,11 @@ const buildIDEOptions = () => {
|
|
|
201
242
|
let strategy = 'cli';
|
|
202
243
|
|
|
203
244
|
if (platform === 'darwin' && ide.mac) {
|
|
204
|
-
// Mac — check .app bundle in /Applications
|
|
205
|
-
const system
|
|
206
|
-
const user
|
|
207
|
-
|
|
245
|
+
// Mac — check .app bundle in /Applications, ~/Applications, and JetBrains Toolbox
|
|
246
|
+
const system = `/Applications/${ide.mac.app}.app`;
|
|
247
|
+
const user = path.join(os.homedir(), 'Applications', `${ide.mac.app}.app`);
|
|
248
|
+
const toolbox = path.join(os.homedir(), 'Applications', 'JetBrains Toolbox', `${ide.mac.app}.app`);
|
|
249
|
+
detected = fs.existsSync(system) || fs.existsSync(user) || fs.existsSync(toolbox);
|
|
208
250
|
if (detected) strategy = 'mac-app';
|
|
209
251
|
|
|
210
252
|
} else if (platform === 'win32' && ide.win) {
|
|
@@ -900,6 +942,33 @@ If a dependency is not met:
|
|
|
900
942
|
fs.writeFileSync(path.join(ROOT, 'BUILD_STATE.md'), buildState, 'utf8');
|
|
901
943
|
console.log(` ${green('✓')} BUILD_STATE.md generated`);
|
|
902
944
|
|
|
945
|
+
// ── Generate user project package.json ───────────────────────────────────────
|
|
946
|
+
|
|
947
|
+
const userPackage = {
|
|
948
|
+
name: projectName.toLowerCase().replace(/\s+/g, '-'),
|
|
949
|
+
version: '1.0.0',
|
|
950
|
+
private: true,
|
|
951
|
+
dependencies: {
|
|
952
|
+
prompts: '^2.4.2',
|
|
953
|
+
},
|
|
954
|
+
scripts: {
|
|
955
|
+
launch: 'cd "$(git rev-parse --git-common-dir)/.." && node .workflow/launch.js',
|
|
956
|
+
complete: 'cd "$(git rev-parse --git-common-dir)/.." && node .workflow/complete.js',
|
|
957
|
+
},
|
|
958
|
+
};
|
|
959
|
+
fs.writeFileSync(path.join(ROOT, 'package.json'), JSON.stringify(userPackage, null, 2), 'utf8');
|
|
960
|
+
console.log(` ${green('✓')} package.json generated`);
|
|
961
|
+
|
|
962
|
+
// ── Install dependencies ──────────────────────────────────────────────────────
|
|
963
|
+
|
|
964
|
+
try {
|
|
965
|
+
console.log(dim(' Installing dependencies...'));
|
|
966
|
+
execSync('npm install', { cwd: ROOT, stdio: 'pipe' });
|
|
967
|
+
console.log(` ${green('✓')} Dependencies installed`);
|
|
968
|
+
} catch {
|
|
969
|
+
console.log(yellow(' ⚠ npm install failed — run npm install manually before launching'));
|
|
970
|
+
}
|
|
971
|
+
|
|
903
972
|
// ── Tracking ──────────────────────────────────────────────────────────────────
|
|
904
973
|
|
|
905
974
|
const trackingPath = path.join(RUNTIME_DIR, '.tracking.json');
|
|
@@ -911,6 +980,29 @@ If a dependency is not met:
|
|
|
911
980
|
console.log(dim(' ℹ .tracking.json already exists — preserved'));
|
|
912
981
|
}
|
|
913
982
|
|
|
983
|
+
// ── Generate .paths.json ──────────────────────────────────────────────────────
|
|
984
|
+
|
|
985
|
+
const pathsMap = {};
|
|
986
|
+
const clientConventions = FRAMEWORK_CONVENTIONS.client[clientFw?.value] || {};
|
|
987
|
+
const backendConventions = FRAMEWORK_CONVENTIONS.backend[backendFwObj?.value] || {};
|
|
988
|
+
|
|
989
|
+
if (Object.keys(clientConventions).length) {
|
|
990
|
+
pathsMap.client = {};
|
|
991
|
+
Object.entries(clientConventions).forEach(([key, value]) => {
|
|
992
|
+
pathsMap.client[key] = { expected: value, current: null, status: 'pending' };
|
|
993
|
+
});
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
if (Object.keys(backendConventions).length) {
|
|
997
|
+
pathsMap.backend = {};
|
|
998
|
+
Object.entries(backendConventions).forEach(([key, value]) => {
|
|
999
|
+
pathsMap.backend[key] = { expected: value, current: null, status: 'pending' };
|
|
1000
|
+
});
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
fs.writeFileSync(path.join(RUNTIME_DIR, '.paths.json'), JSON.stringify(pathsMap, null, 2), 'utf8');
|
|
1004
|
+
console.log(` ${green('✓')} .paths.json generated`);
|
|
1005
|
+
|
|
914
1006
|
// ── Lock ─────────────────────────────────────────────────────────────────────
|
|
915
1007
|
|
|
916
1008
|
fs.writeFileSync(LOCK_FILE, new Date().toISOString());
|
package/package.json
CHANGED