legionai 1.0.0-beta.8 → 1.0.0-beta.9
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/auth/claude-cli.d.ts +68 -0
- package/dist/auth/claude-cli.d.ts.map +1 -0
- package/dist/auth/claude-cli.js +283 -0
- package/dist/auth/claude-cli.js.map +1 -0
- package/dist/commands/wizard.d.ts.map +1 -1
- package/dist/commands/wizard.js +103 -85
- package/dist/commands/wizard.js.map +1 -1
- package/dist/legion.mjs +471 -291
- package/dist/wizard/claude-code-integration.d.ts +20 -0
- package/dist/wizard/claude-code-integration.d.ts.map +1 -0
- package/dist/wizard/claude-code-integration.js +374 -0
- package/dist/wizard/claude-code-integration.js.map +1 -0
- package/dist/wizard/index.d.ts +2 -0
- package/dist/wizard/index.d.ts.map +1 -1
- package/dist/wizard/index.js +2 -0
- package/dist/wizard/index.js.map +1 -1
- package/dist/wizard/llm-phases.d.ts +77 -0
- package/dist/wizard/llm-phases.d.ts.map +1 -0
- package/dist/wizard/llm-phases.js +922 -0
- package/dist/wizard/llm-phases.js.map +1 -0
- package/dist/wizard/strategic-phase.d.ts +7 -3
- package/dist/wizard/strategic-phase.d.ts.map +1 -1
- package/dist/wizard/strategic-phase.js +500 -174
- package/dist/wizard/strategic-phase.js.map +1 -1
- package/package.json +1 -1
- package/dist/legion.cjs +0 -1180
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export interface ClaudeCLIAuth {
|
|
2
|
+
isLoggedIn: boolean;
|
|
3
|
+
email?: string;
|
|
4
|
+
tier?: 'Solo' | 'Pro' | 'Team' | 'Enterprise';
|
|
5
|
+
cliVersion?: string;
|
|
6
|
+
cliAvailable?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface Context7Status {
|
|
9
|
+
isInstalled: boolean;
|
|
10
|
+
isConfigured: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Check if Claude CLI is installed and user is logged in
|
|
14
|
+
*/
|
|
15
|
+
export declare function detectClaudeCLI(): ClaudeCLIAuth;
|
|
16
|
+
/**
|
|
17
|
+
* Check if Claude CLI command is available for execution
|
|
18
|
+
*/
|
|
19
|
+
export declare function isClaudeCLIAvailable(): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Get Claude CLI version
|
|
22
|
+
*/
|
|
23
|
+
export declare function getClaudeCLIVersion(): string | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Execute a prompt using Claude CLI and return the response
|
|
26
|
+
* Uses `claude -p "prompt" --print` for non-interactive execution
|
|
27
|
+
*/
|
|
28
|
+
export declare function executeWithClaudeCLI(prompt: string, options?: {
|
|
29
|
+
maxTokens?: number;
|
|
30
|
+
systemPrompt?: string;
|
|
31
|
+
workingDir?: string;
|
|
32
|
+
}): Promise<string>;
|
|
33
|
+
/**
|
|
34
|
+
* Check if we can use Claude CLI for LLM inference
|
|
35
|
+
*
|
|
36
|
+
* Note: Claude CLI handles auth interactively if needed.
|
|
37
|
+
* If the CLI is available and responds to --version, we can use it.
|
|
38
|
+
* The CLI will prompt for login if the user isn't authenticated.
|
|
39
|
+
*/
|
|
40
|
+
export declare function canUseClaudeCLI(): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Display Claude CLI auth status
|
|
43
|
+
*/
|
|
44
|
+
export declare function displayClaudeCLIStatus(auth: ClaudeCLIAuth): void;
|
|
45
|
+
/**
|
|
46
|
+
* Check if Context7 MCP server is installed
|
|
47
|
+
*/
|
|
48
|
+
export declare function detectContext7(): Context7Status;
|
|
49
|
+
/**
|
|
50
|
+
* Display Context7 status and recommendation
|
|
51
|
+
*/
|
|
52
|
+
export declare function displayContext7Status(status: Context7Status): void;
|
|
53
|
+
/**
|
|
54
|
+
* Get Context7 MCP server configuration
|
|
55
|
+
*/
|
|
56
|
+
export declare function getContext7MCPConfig(): Record<string, unknown>;
|
|
57
|
+
/**
|
|
58
|
+
* Run full auth check and display status
|
|
59
|
+
*/
|
|
60
|
+
export declare function runAuthCheck(): Promise<{
|
|
61
|
+
claudeCLI: ClaudeCLIAuth;
|
|
62
|
+
context7: Context7Status;
|
|
63
|
+
}>;
|
|
64
|
+
/**
|
|
65
|
+
* Show auth prompt if not logged in
|
|
66
|
+
*/
|
|
67
|
+
export declare function showAuthPrompt(): void;
|
|
68
|
+
//# sourceMappingURL=claude-cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-cli.d.ts","sourceRoot":"","sources":["../../src/auth/claude-cli.ts"],"names":[],"mappings":"AAoBA,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,YAAY,CAAC;IAC9C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,OAAO,CAAC;CACvB;AAMD;;GAEG;AACH,wBAAgB,eAAe,IAAI,aAAa,CA+C/C;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CAY9C;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,GAAG,SAAS,CAYxD;AAED;;;GAGG;AACH,wBAAsB,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE;IAClE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CAyCvB;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,IAAI,OAAO,CAGzC;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI,CA0ChE;AAMD;;GAEG;AACH,wBAAgB,cAAc,IAAI,cAAc,CA+B/C;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,CAQlE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAQ9D;AAMD;;GAEG;AACH,wBAAsB,YAAY,IAAI,OAAO,CAAC;IAC5C,SAAS,EAAE,aAAa,CAAC;IACzB,QAAQ,EAAE,cAAc,CAAC;CAC1B,CAAC,CAWD;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,IAAI,CAmBrC"}
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
// ============================================
|
|
2
|
+
// LegionAI Claude CLI Detection
|
|
3
|
+
// ============================================
|
|
4
|
+
//
|
|
5
|
+
// Detects if user is logged into Claude CLI and
|
|
6
|
+
// uses that authentication for native integration.
|
|
7
|
+
//
|
|
8
|
+
import { existsSync, readFileSync } from 'fs';
|
|
9
|
+
import { join } from 'path';
|
|
10
|
+
import { homedir } from 'os';
|
|
11
|
+
import { execSync, spawn } from 'child_process';
|
|
12
|
+
import chalk from 'chalk';
|
|
13
|
+
import boxen from 'boxen';
|
|
14
|
+
import { COLORS } from '../ui/theme.js';
|
|
15
|
+
// ============================================
|
|
16
|
+
// Claude CLI Detection
|
|
17
|
+
// ============================================
|
|
18
|
+
/**
|
|
19
|
+
* Check if Claude CLI is installed and user is logged in
|
|
20
|
+
*/
|
|
21
|
+
export function detectClaudeCLI() {
|
|
22
|
+
const homeDir = homedir();
|
|
23
|
+
// Possible Claude CLI config locations
|
|
24
|
+
const configPaths = [
|
|
25
|
+
join(homeDir, '.claude', 'config.json'),
|
|
26
|
+
join(homeDir, '.config', 'claude', 'config.json'),
|
|
27
|
+
join(homeDir, '.claude.json'),
|
|
28
|
+
];
|
|
29
|
+
for (const configPath of configPaths) {
|
|
30
|
+
if (existsSync(configPath)) {
|
|
31
|
+
try {
|
|
32
|
+
const config = JSON.parse(readFileSync(configPath, 'utf-8'));
|
|
33
|
+
// Check for auth tokens or user info
|
|
34
|
+
if (config.auth || config.user || config.email || config.apiKey) {
|
|
35
|
+
return {
|
|
36
|
+
isLoggedIn: true,
|
|
37
|
+
email: config.email || config.user?.email,
|
|
38
|
+
tier: config.tier || config.plan || 'Solo',
|
|
39
|
+
cliVersion: config.version,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
// Config exists but couldn't parse
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
// Check for Claude environment variables
|
|
49
|
+
if (process.env.CLAUDE_API_KEY || process.env.ANTHROPIC_API_KEY) {
|
|
50
|
+
return {
|
|
51
|
+
isLoggedIn: true,
|
|
52
|
+
tier: 'Solo',
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
// Check if running inside Claude Code
|
|
56
|
+
if (process.env.CLAUDE_CODE || process.env.ANTHROPIC_SESSION) {
|
|
57
|
+
return {
|
|
58
|
+
isLoggedIn: true,
|
|
59
|
+
tier: 'Solo',
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
return { isLoggedIn: false };
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Check if Claude CLI command is available for execution
|
|
66
|
+
*/
|
|
67
|
+
export function isClaudeCLIAvailable() {
|
|
68
|
+
try {
|
|
69
|
+
// Try to get Claude CLI version
|
|
70
|
+
const result = execSync('claude --version 2>/dev/null || claude -V 2>/dev/null', {
|
|
71
|
+
encoding: 'utf-8',
|
|
72
|
+
timeout: 5000,
|
|
73
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
74
|
+
});
|
|
75
|
+
return result.includes('claude') || result.includes('Claude') || /\d+\.\d+/.test(result);
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Get Claude CLI version
|
|
83
|
+
*/
|
|
84
|
+
export function getClaudeCLIVersion() {
|
|
85
|
+
try {
|
|
86
|
+
const result = execSync('claude --version 2>/dev/null || claude -V 2>/dev/null', {
|
|
87
|
+
encoding: 'utf-8',
|
|
88
|
+
timeout: 5000,
|
|
89
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
90
|
+
});
|
|
91
|
+
const match = result.match(/v?(\d+\.\d+\.\d+)/);
|
|
92
|
+
return match ? match[1] : undefined;
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
return undefined;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Execute a prompt using Claude CLI and return the response
|
|
100
|
+
* Uses `claude -p "prompt" --print` for non-interactive execution
|
|
101
|
+
*/
|
|
102
|
+
export async function executeWithClaudeCLI(prompt, options = {}) {
|
|
103
|
+
return new Promise((resolve, reject) => {
|
|
104
|
+
const args = ['-p', prompt, '--print'];
|
|
105
|
+
if (options.systemPrompt) {
|
|
106
|
+
args.push('--system', options.systemPrompt);
|
|
107
|
+
}
|
|
108
|
+
if (options.maxTokens) {
|
|
109
|
+
args.push('--max-tokens', String(options.maxTokens));
|
|
110
|
+
}
|
|
111
|
+
const child = spawn('claude', args, {
|
|
112
|
+
cwd: options.workingDir || process.cwd(),
|
|
113
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
114
|
+
timeout: 120000, // 2 minute timeout
|
|
115
|
+
});
|
|
116
|
+
let stdout = '';
|
|
117
|
+
let stderr = '';
|
|
118
|
+
child.stdout.on('data', (data) => {
|
|
119
|
+
stdout += data.toString();
|
|
120
|
+
});
|
|
121
|
+
child.stderr.on('data', (data) => {
|
|
122
|
+
stderr += data.toString();
|
|
123
|
+
});
|
|
124
|
+
child.on('close', (code) => {
|
|
125
|
+
if (code === 0) {
|
|
126
|
+
resolve(stdout.trim());
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
reject(new Error(`Claude CLI exited with code ${code}: ${stderr}`));
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
child.on('error', (err) => {
|
|
133
|
+
reject(new Error(`Failed to execute Claude CLI: ${err.message}`));
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Check if we can use Claude CLI for LLM inference
|
|
139
|
+
*
|
|
140
|
+
* Note: Claude CLI handles auth interactively if needed.
|
|
141
|
+
* If the CLI is available and responds to --version, we can use it.
|
|
142
|
+
* The CLI will prompt for login if the user isn't authenticated.
|
|
143
|
+
*/
|
|
144
|
+
export function canUseClaudeCLI() {
|
|
145
|
+
// If CLI is available, we can use it (it handles auth interactively)
|
|
146
|
+
return isClaudeCLIAvailable();
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Display Claude CLI auth status
|
|
150
|
+
*/
|
|
151
|
+
export function displayClaudeCLIStatus(auth) {
|
|
152
|
+
const cliAvailable = isClaudeCLIAvailable();
|
|
153
|
+
const cliVersion = getClaudeCLIVersion();
|
|
154
|
+
if (cliAvailable) {
|
|
155
|
+
// CLI is available - show version and any auth info we have
|
|
156
|
+
const versionStr = cliVersion ? `v${cliVersion}` : '';
|
|
157
|
+
const authInfo = auth.email
|
|
158
|
+
? `Logged in as ${chalk.hex(COLORS.primary.gold)(auth.email)}`
|
|
159
|
+
: '';
|
|
160
|
+
const tierInfo = auth.tier
|
|
161
|
+
? chalk.hex(COLORS.primary.orange)(auth.tier)
|
|
162
|
+
: '';
|
|
163
|
+
const parts = [
|
|
164
|
+
chalk.hex(COLORS.status.success)('✓ ') + chalk.white(`Claude CLI ${versionStr} detected`),
|
|
165
|
+
];
|
|
166
|
+
if (authInfo) {
|
|
167
|
+
parts.push(authInfo);
|
|
168
|
+
}
|
|
169
|
+
if (tierInfo) {
|
|
170
|
+
parts.push(tierInfo);
|
|
171
|
+
}
|
|
172
|
+
console.log(parts.join(' • '));
|
|
173
|
+
console.log(chalk.hex(COLORS.text.muted)(' Ready for AI-powered analysis'));
|
|
174
|
+
}
|
|
175
|
+
else if (auth.isLoggedIn) {
|
|
176
|
+
// No CLI but have auth (e.g., running inside Claude Code environment)
|
|
177
|
+
const authLine = auth.email
|
|
178
|
+
? `Logged in as ${chalk.hex(COLORS.primary.gold)(auth.email)}`
|
|
179
|
+
: 'Claude authentication detected';
|
|
180
|
+
const tierLine = auth.tier
|
|
181
|
+
? ` • ${chalk.hex(COLORS.primary.orange)(auth.tier)}`
|
|
182
|
+
: '';
|
|
183
|
+
console.log(chalk.hex(COLORS.text.secondary)(`${authLine}${tierLine}`));
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
console.log(chalk.hex(COLORS.status.warning)('Claude CLI not detected'));
|
|
187
|
+
console.log(chalk.hex(COLORS.text.muted)('For best experience, install Claude Code: https://claude.ai/code'));
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
// ============================================
|
|
191
|
+
// Context7 MCP Detection
|
|
192
|
+
// ============================================
|
|
193
|
+
/**
|
|
194
|
+
* Check if Context7 MCP server is installed
|
|
195
|
+
*/
|
|
196
|
+
export function detectContext7() {
|
|
197
|
+
const homeDir = homedir();
|
|
198
|
+
// Check MCP config locations
|
|
199
|
+
const mcpConfigPaths = [
|
|
200
|
+
join(homeDir, '.claude', 'mcp.json'),
|
|
201
|
+
join(homeDir, '.config', 'claude', 'mcp.json'),
|
|
202
|
+
join(process.cwd(), '.claude', 'mcp.json'),
|
|
203
|
+
];
|
|
204
|
+
for (const configPath of mcpConfigPaths) {
|
|
205
|
+
if (existsSync(configPath)) {
|
|
206
|
+
try {
|
|
207
|
+
const config = JSON.parse(readFileSync(configPath, 'utf-8'));
|
|
208
|
+
// Check if context7 is in the servers list
|
|
209
|
+
if (config.servers && (config.servers.context7 || config.servers['context-7'])) {
|
|
210
|
+
return { isInstalled: true, isConfigured: true };
|
|
211
|
+
}
|
|
212
|
+
// Check mcpServers format
|
|
213
|
+
if (config.mcpServers && (config.mcpServers.context7 || config.mcpServers['context-7'])) {
|
|
214
|
+
return { isInstalled: true, isConfigured: true };
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
catch {
|
|
218
|
+
// Config exists but couldn't parse
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return { isInstalled: false, isConfigured: false };
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Display Context7 status and recommendation
|
|
226
|
+
*/
|
|
227
|
+
export function displayContext7Status(status) {
|
|
228
|
+
if (status.isConfigured) {
|
|
229
|
+
console.log(chalk.hex(COLORS.status.success)('✓ ') + chalk.hex(COLORS.text.primary)('Context7 MCP detected'));
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
console.log(chalk.hex(COLORS.status.warning)('⚠ ') + chalk.hex(COLORS.text.secondary)('Context7 MCP not detected.'));
|
|
233
|
+
console.log(chalk.hex(COLORS.text.muted)(' For better documentation lookups, install it: ') +
|
|
234
|
+
chalk.hex(COLORS.primary.orange)('https://context7.com/'));
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Get Context7 MCP server configuration
|
|
239
|
+
*/
|
|
240
|
+
export function getContext7MCPConfig() {
|
|
241
|
+
return {
|
|
242
|
+
context7: {
|
|
243
|
+
command: 'npx',
|
|
244
|
+
args: ['-y', '@context7/mcp-server'],
|
|
245
|
+
description: 'Context7 - Better documentation lookups for Claude Code',
|
|
246
|
+
},
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
// ============================================
|
|
250
|
+
// Combined Auth Check
|
|
251
|
+
// ============================================
|
|
252
|
+
/**
|
|
253
|
+
* Run full auth check and display status
|
|
254
|
+
*/
|
|
255
|
+
export async function runAuthCheck() {
|
|
256
|
+
const claudeCLI = detectClaudeCLI();
|
|
257
|
+
const context7 = detectContext7();
|
|
258
|
+
console.log('');
|
|
259
|
+
displayClaudeCLIStatus(claudeCLI);
|
|
260
|
+
console.log('');
|
|
261
|
+
displayContext7Status(context7);
|
|
262
|
+
console.log('');
|
|
263
|
+
return { claudeCLI, context7 };
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Show auth prompt if not logged in
|
|
267
|
+
*/
|
|
268
|
+
export function showAuthPrompt() {
|
|
269
|
+
console.log('');
|
|
270
|
+
console.log(boxen(chalk.hex(COLORS.primary.gold).bold('🔐 Authentication\n\n') +
|
|
271
|
+
chalk.white('LegionAI works best with Claude Code.\n\n') +
|
|
272
|
+
chalk.hex(COLORS.text.muted)('To get started:\n') +
|
|
273
|
+
chalk.hex(COLORS.primary.orange)('1. Install Claude Code: ') + chalk.white('https://claude.ai/code\n') +
|
|
274
|
+
chalk.hex(COLORS.primary.orange)('2. Log in with your Anthropic account\n') +
|
|
275
|
+
chalk.hex(COLORS.primary.orange)('3. Run ') + chalk.white('legion wizard') + chalk.hex(COLORS.primary.orange)(' again\n\n') +
|
|
276
|
+
chalk.hex(COLORS.text.muted)('Or set ANTHROPIC_API_KEY for API access.'), {
|
|
277
|
+
padding: 1,
|
|
278
|
+
borderStyle: 'round',
|
|
279
|
+
borderColor: '#FF6B00',
|
|
280
|
+
}));
|
|
281
|
+
console.log('');
|
|
282
|
+
}
|
|
283
|
+
//# sourceMappingURL=claude-cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-cli.js","sourceRoot":"","sources":["../../src/auth/claude-cli.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,gCAAgC;AAChC,+CAA+C;AAC/C,EAAE;AACF,gDAAgD;AAChD,mDAAmD;AACnD,EAAE;AAEF,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAA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EAAE,CAAC;QACV,WAAW,EAAE,OAAO;QACpB,WAAW,EAAE,SAAS;KACvB,CACF,CACF,CAAC;IACF,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAClB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wizard.d.ts","sourceRoot":"","sources":["../../src/commands/wizard.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"wizard.d.ts","sourceRoot":"","sources":["../../src/commands/wizard.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAiEpC,eAAO,MAAM,aAAa,SAuJtB,CAAC;AAML,iBAAe,cAAc,CAC3B,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GAC7C,OAAO,CAAC,IAAI,CAAC,CA8Ff;AAwJD,iBAAe,wBAAwB,CACrC,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,IAAI,CAAC,CAwNf;AAsSD,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAE,CAAC"}
|
package/dist/commands/wizard.js
CHANGED
|
@@ -8,14 +8,17 @@ import boxen from 'boxen';
|
|
|
8
8
|
import inquirer from 'inquirer';
|
|
9
9
|
import { mkdir, writeFile } from 'fs/promises';
|
|
10
10
|
import { join, basename } from 'path';
|
|
11
|
-
import { runWizardQuestions, runAgentSetupWithProgress, setupMCPWithProgress, runPostSetup, runExistingProjectAnalysis, askIfExistingOrNew,
|
|
11
|
+
import { runWizardQuestions, runAgentSetupWithProgress, setupMCPWithProgress, runPostSetup, runExistingProjectAnalysis, askIfExistingOrNew,
|
|
12
12
|
// Premium animations
|
|
13
|
-
displayAnimatedBanner, animatePhaseHeader, animateReconnaissancePhase, animateLegionAssemblyPhase,
|
|
13
|
+
displayAnimatedBanner, animatePhaseHeader, animateReconnaissancePhase, animateLegionAssemblyPhase, animateActionPlan, animateWizardComplete, animateLegionDeployed, createFireSpinner, } from '../wizard/index.js';
|
|
14
14
|
import { initializeProject, isInitialized, } from '../config/store.js';
|
|
15
15
|
import { checkLicense, activateLicense } from '../auth/license.js';
|
|
16
|
+
import { detectClaudeCLI, detectContext7, displayClaudeCLIStatus, displayContext7Status } from '../auth/claude-cli.js';
|
|
16
17
|
import { createNativeLegion } from '@legionai/core';
|
|
17
18
|
import { ARCHETYPE_INFO } from '@legionai/shared';
|
|
18
19
|
import { COLORS } from '../ui/theme.js';
|
|
20
|
+
import { runPhase3ProjectFoundation, runPhase4StrategicAnalysis, runPhase5AgentDeployment, runPhase6MCPIntegration, runPhase7BattlePlan, displayPostSetupMenu, generateDocumentation, ALL_AGENTS, } from '../wizard/llm-phases.js';
|
|
21
|
+
import { canUseClaudeCLI } from '../auth/claude-cli.js';
|
|
19
22
|
// ============================================
|
|
20
23
|
// Wizard Command
|
|
21
24
|
// ============================================
|
|
@@ -105,6 +108,17 @@ export const wizardCommand = new Command('wizard')
|
|
|
105
108
|
}
|
|
106
109
|
const projectPath = options.path;
|
|
107
110
|
const name = projectName || basename(projectPath);
|
|
111
|
+
// Check Claude CLI authentication and Context7
|
|
112
|
+
console.log('');
|
|
113
|
+
const claudeAuth = detectClaudeCLI();
|
|
114
|
+
displayClaudeCLIStatus(claudeAuth);
|
|
115
|
+
const context7 = detectContext7();
|
|
116
|
+
displayContext7Status(context7);
|
|
117
|
+
if (!context7.isConfigured) {
|
|
118
|
+
console.log('');
|
|
119
|
+
console.log(chalk.hex(COLORS.text.muted)('Press Enter to continue without Context7'));
|
|
120
|
+
}
|
|
121
|
+
console.log('');
|
|
108
122
|
try {
|
|
109
123
|
// Determine flow type
|
|
110
124
|
let flowType = 'new';
|
|
@@ -330,34 +344,41 @@ function hashString(str) {
|
|
|
330
344
|
return Math.abs(hash).toString(16);
|
|
331
345
|
}
|
|
332
346
|
// ============================================
|
|
333
|
-
// Existing Project Wizard Flow
|
|
347
|
+
// Existing Project Wizard Flow (LLM-Driven)
|
|
334
348
|
// ============================================
|
|
335
349
|
async function runExistingProjectWizard(projectName, projectPath) {
|
|
336
350
|
console.log('');
|
|
337
351
|
// Display animated banner
|
|
338
352
|
await displayAnimatedBanner();
|
|
353
|
+
// Check if Claude CLI is available for LLM-driven setup
|
|
354
|
+
const llmAvailable = canUseClaudeCLI();
|
|
339
355
|
console.log(boxen(chalk.hex(COLORS.primary.orange).bold('🔧 Existing Project Mode\n\n') +
|
|
340
356
|
chalk.hex(COLORS.text.muted)("Let's understand your codebase and figure out how\n" +
|
|
341
|
-
"your Legion can help you move forward.")
|
|
357
|
+
"your Legion can help you move forward.") + '\n\n' +
|
|
358
|
+
(llmAvailable
|
|
359
|
+
? chalk.hex(COLORS.status.success)('✓ LLM-Powered Analysis Active')
|
|
360
|
+
: chalk.hex(COLORS.status.warning)('⚠ Basic Analysis Mode (install Claude CLI for AI-powered setup)')), {
|
|
342
361
|
padding: 1,
|
|
343
362
|
borderStyle: 'double',
|
|
344
363
|
borderColor: COLORS.primary.orange,
|
|
345
364
|
}));
|
|
346
|
-
// Phase 1: Reconnaissance
|
|
365
|
+
// Phase 1 & 2: Reconnaissance & User Context
|
|
347
366
|
await animateReconnaissancePhase(projectName);
|
|
348
367
|
const situationReport = await runExistingProjectAnalysis(projectPath);
|
|
349
|
-
// Phase 2: Legion Assembly -
|
|
368
|
+
// Phase 2: Legion Assembly - Ask about agents
|
|
350
369
|
await animateLegionAssemblyPhase();
|
|
351
|
-
const {
|
|
370
|
+
const { deployAllAgents } = await inquirer.prompt([
|
|
352
371
|
{
|
|
353
372
|
type: 'confirm',
|
|
354
|
-
name: '
|
|
355
|
-
message:
|
|
373
|
+
name: 'deployAllAgents',
|
|
374
|
+
message: 'Deploy all 9 Legion agents for comprehensive analysis?',
|
|
356
375
|
default: true,
|
|
357
376
|
},
|
|
358
377
|
]);
|
|
359
|
-
let agents =
|
|
360
|
-
|
|
378
|
+
let agents = deployAllAgents
|
|
379
|
+
? ALL_AGENTS
|
|
380
|
+
: situationReport.recommendedAgents;
|
|
381
|
+
if (!deployAllAgents) {
|
|
361
382
|
const { selectedAgents } = await inquirer.prompt([
|
|
362
383
|
{
|
|
363
384
|
type: 'checkbox',
|
|
@@ -365,111 +386,108 @@ async function runExistingProjectWizard(projectName, projectPath) {
|
|
|
365
386
|
message: 'Select agents to deploy:',
|
|
366
387
|
choices: [
|
|
367
388
|
{ name: '👑 Imperator (Commander)', value: 'imperator', checked: true, disabled: 'Required' },
|
|
368
|
-
{ name: '📐 Architect (Designer)', value: 'architect', checked:
|
|
369
|
-
{ name: '⚔️ Legionnaire (Builder)', value: 'legionnaire', checked:
|
|
370
|
-
{ name: '🛡️ Praetorian (Guardian)', value: 'praetorian', checked:
|
|
371
|
-
{ name: '📢 Herald (Content)', value: 'herald', checked:
|
|
389
|
+
{ name: '📐 Architect (Designer)', value: 'architect', checked: true },
|
|
390
|
+
{ name: '⚔️ Legionnaire (Builder)', value: 'legionnaire', checked: true },
|
|
391
|
+
{ name: '🛡️ Praetorian (Guardian)', value: 'praetorian', checked: true },
|
|
392
|
+
{ name: '📢 Herald (Content)', value: 'herald', checked: true },
|
|
393
|
+
{ name: '📋 Tribune (Product)', value: 'tribune', checked: true },
|
|
394
|
+
{ name: '💼 Centurion (Sales)', value: 'centurion', checked: false },
|
|
395
|
+
{ name: '💰 Quaestor (Finance)', value: 'quaestor', checked: false },
|
|
396
|
+
{ name: '🔭 Explorator (Research)', value: 'explorator', checked: true },
|
|
372
397
|
],
|
|
373
398
|
},
|
|
374
399
|
]);
|
|
375
400
|
agents = ['imperator', ...selectedAgents.filter((a) => a !== 'imperator')];
|
|
376
401
|
}
|
|
377
|
-
//
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
//
|
|
397
|
-
|
|
398
|
-
const
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
}
|
|
406
|
-
catch (error) {
|
|
407
|
-
structureSpinner.fail('Failed to set up Legion');
|
|
408
|
-
throw error;
|
|
409
|
-
}
|
|
410
|
-
// Phase 4: Strategic Analysis - Animated
|
|
411
|
-
// Each agent analyzes the project from their specialty perspective
|
|
412
|
-
await animateStrategicAnalysisPhase();
|
|
413
|
-
const strategicPlan = await runStrategicPhase(projectPath, agents, situationReport.userContext.goals, situationReport.userContext.primaryGoal);
|
|
414
|
-
// Save the strategic plan
|
|
415
|
-
await writeFile(join(projectPath, '.legion', 'briefs', 'strategic-plan.json'), JSON.stringify(strategicPlan, null, 2));
|
|
416
|
-
// Phase 5: Agent Deployment - Animated
|
|
417
|
-
await animateAgentDeploymentPhase();
|
|
418
|
-
const agentResults = await runAgentSetupWithProgress(projectPath, answers);
|
|
419
|
-
// Phase 6: Connecting Systems - Animated
|
|
420
|
-
await animateConnectingSystemsPhase();
|
|
421
|
-
const mcpConfig = await setupMCPWithProgress(projectPath, answers);
|
|
422
|
-
// Phase 7: Battle Plan - Animated
|
|
423
|
-
await animateBattlePlanPhase();
|
|
424
|
-
await displayActionPlanAnimated(situationReport);
|
|
402
|
+
// ============================================
|
|
403
|
+
// PHASE 3: Project Foundation (LLM-Driven)
|
|
404
|
+
// ============================================
|
|
405
|
+
const projectAnalysis = await runPhase3ProjectFoundation(projectPath, projectName, situationReport.userContext.primaryGoal, situationReport.userContext.goals, { fast: false });
|
|
406
|
+
// Save situation report
|
|
407
|
+
await writeFile(join(projectPath, '.legion', 'briefs', 'situation-report.json'), JSON.stringify(situationReport, null, 2));
|
|
408
|
+
// ============================================
|
|
409
|
+
// PHASE 4: Strategic Multi-Agent Analysis (LLM-Driven)
|
|
410
|
+
// ============================================
|
|
411
|
+
const agentAnalysisResults = await runPhase4StrategicAnalysis(projectPath, projectAnalysis, situationReport.userContext.primaryGoal, situationReport.userContext.goals, { fast: false });
|
|
412
|
+
// ============================================
|
|
413
|
+
// PHASE 5: Agent Deployment & Skill Creation (LLM-Driven)
|
|
414
|
+
// ============================================
|
|
415
|
+
await runPhase5AgentDeployment(projectPath, projectAnalysis, agentAnalysisResults, { fast: false });
|
|
416
|
+
// ============================================
|
|
417
|
+
// PHASE 6: MCP Integration (LLM-Driven)
|
|
418
|
+
// ============================================
|
|
419
|
+
const mcpConfiguration = await runPhase6MCPIntegration(projectPath, projectAnalysis, { fast: false });
|
|
420
|
+
// ============================================
|
|
421
|
+
// PHASE 7: Battle Plan (LLM-Driven)
|
|
422
|
+
// ============================================
|
|
423
|
+
const battlePlan = await runPhase7BattlePlan(projectPath, projectAnalysis, agentAnalysisResults, situationReport.userContext.primaryGoal, { fast: false });
|
|
424
|
+
// Generate documentation
|
|
425
|
+
await generateDocumentation(projectPath, projectAnalysis, { fast: false });
|
|
426
|
+
// ============================================
|
|
427
|
+
// Post-Setup: How would you like to proceed?
|
|
428
|
+
// ============================================
|
|
429
|
+
displayPostSetupMenu(projectName, battlePlan);
|
|
425
430
|
// Ask how to proceed
|
|
426
431
|
const { nextAction } = await inquirer.prompt([
|
|
427
432
|
{
|
|
428
433
|
type: 'list',
|
|
429
434
|
name: 'nextAction',
|
|
430
|
-
message: chalk.hex(COLORS.primary.gold)('
|
|
435
|
+
message: chalk.hex(COLORS.primary.gold)('Select an option:'),
|
|
431
436
|
choices: [
|
|
432
437
|
{
|
|
433
|
-
name: `${chalk.hex(COLORS.primary.
|
|
434
|
-
value: '
|
|
438
|
+
name: `${chalk.hex(COLORS.primary.gold)('[1]')} Open Legion Command (Electron App)`,
|
|
439
|
+
value: 'electron',
|
|
435
440
|
},
|
|
436
441
|
{
|
|
437
|
-
name: `${chalk.hex(COLORS.primary.
|
|
438
|
-
value: '
|
|
442
|
+
name: `${chalk.hex(COLORS.primary.gold)('[2]')} Start working on Priority #1${battlePlan.prioritizedBacklog[0] ? `: ${battlePlan.prioritizedBacklog[0].title}` : ''}`,
|
|
443
|
+
value: 'priority1',
|
|
439
444
|
},
|
|
440
445
|
{
|
|
441
|
-
name: `${chalk.hex(COLORS.primary.gold)('
|
|
442
|
-
value: '
|
|
446
|
+
name: `${chalk.hex(COLORS.primary.gold)('[3]')} Quick win first${battlePlan.prioritizedBacklog.find(t => t.effort === 'quick-win') ? `: ${battlePlan.prioritizedBacklog.find(t => t.effort === 'quick-win')?.title}` : ''}`,
|
|
447
|
+
value: 'quickwin',
|
|
443
448
|
},
|
|
444
449
|
{
|
|
445
|
-
name: `${chalk.hex(COLORS.
|
|
446
|
-
value: '
|
|
450
|
+
name: `${chalk.hex(COLORS.primary.gold)('[4]')} Create custom skills`,
|
|
451
|
+
value: 'skills',
|
|
452
|
+
},
|
|
453
|
+
{
|
|
454
|
+
name: `${chalk.hex(COLORS.text.muted)('[5]')} Exit and explore on my own`,
|
|
455
|
+
value: 'exit',
|
|
447
456
|
},
|
|
448
457
|
],
|
|
449
458
|
},
|
|
450
459
|
]);
|
|
451
460
|
console.log('');
|
|
452
461
|
switch (nextAction) {
|
|
453
|
-
case '
|
|
454
|
-
|
|
455
|
-
|
|
462
|
+
case 'electron':
|
|
463
|
+
console.log(chalk.hex(COLORS.primary.gold)('Launching Legion Command...'));
|
|
464
|
+
console.log(chalk.hex(COLORS.text.muted)('Note: Electron UI is under development.'));
|
|
465
|
+
console.log(chalk.hex(COLORS.text.muted)('Run: cd packages/ui && npm run dev'));
|
|
466
|
+
break;
|
|
467
|
+
case 'priority1':
|
|
468
|
+
case 'quickwin':
|
|
469
|
+
// Start interactive session to work on the task
|
|
456
470
|
await startInteractiveSession(projectName, projectPath, agents);
|
|
457
471
|
break;
|
|
458
|
-
case '
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
console.log(
|
|
465
|
-
}
|
|
466
|
-
|
|
472
|
+
case 'skills':
|
|
473
|
+
console.log(chalk.hex(COLORS.primary.gold)('\nCustom Skills Available:'));
|
|
474
|
+
console.log(chalk.hex(COLORS.text.muted)('Check .claude/skills/ for all generated skills.'));
|
|
475
|
+
console.log('');
|
|
476
|
+
const allSkills = agentAnalysisResults.flatMap(r => r.customSkills);
|
|
477
|
+
allSkills.slice(0, 10).forEach((skill, i) => {
|
|
478
|
+
console.log(` ${i + 1}. ${chalk.hex(COLORS.primary.orange)(skill.trigger)} - ${skill.description}`);
|
|
479
|
+
});
|
|
480
|
+
console.log('');
|
|
467
481
|
await startInteractiveSession(projectName, projectPath, agents);
|
|
468
482
|
break;
|
|
469
|
-
case '
|
|
483
|
+
case 'exit':
|
|
470
484
|
await animateWizardComplete(projectName);
|
|
471
485
|
console.log(boxen(chalk.hex(COLORS.status.success).bold('✓ Legion Ready!\n\n') +
|
|
472
486
|
chalk.hex(COLORS.text.primary)('Your Legion is configured and waiting.\n\n') +
|
|
487
|
+
chalk.hex(COLORS.text.muted)('Generated files:\n') +
|
|
488
|
+
chalk.hex(COLORS.primary.orange)(' .legion/ ') + chalk.hex(COLORS.text.muted)('Strategy, docs, audits\n') +
|
|
489
|
+
chalk.hex(COLORS.primary.orange)(' .claude/agents/ ') + chalk.hex(COLORS.text.muted)('Agent definitions\n') +
|
|
490
|
+
chalk.hex(COLORS.primary.orange)(' .claude/skills/ ') + chalk.hex(COLORS.text.muted)('Custom project skills\n\n') +
|
|
473
491
|
chalk.hex(COLORS.text.muted)('When you\'re ready, run:\n') +
|
|
474
492
|
chalk.hex(COLORS.primary.orange)(' legion deploy'), {
|
|
475
493
|
padding: 1,
|