oneie 1.2.1 ā 1.2.3
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/agent-integration.js +499 -0
- package/bin/cli-animations.js +420 -0
- package/bin/mission-system.js +612 -0
- package/bin/one-installer.js +776 -0
- package/bin/story-system.js +478 -0
- package/bin/task-system.js +717 -0
- package/bin/template-generator.js +661 -0
- package/one/tools/agent-installer.js +575 -0
- package/one/tools/lib/dependency-resolver.js +179 -0
- package/one/tools/lib/template-processor.js +748 -0
- package/one/tools/lib/yaml-utils.js +29 -0
- package/package.json +1 -1
|
@@ -0,0 +1,575 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Agent Installation System
|
|
5
|
+
* Handles copying agents from one/agents/ to .claude/agents/ with proper separation
|
|
6
|
+
* of free (engineering) vs premium (marketing) agents
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { promises as fs } from 'fs';
|
|
10
|
+
import path from 'path';
|
|
11
|
+
import chalk from 'chalk';
|
|
12
|
+
import { LicenseValidator } from './license-validator.js';
|
|
13
|
+
import { BackgroundAgentLoader } from './background-agent-loader.js';
|
|
14
|
+
import AgentCommandGenerator from './generate-agent-commands.js';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Agent Installation Manager
|
|
18
|
+
*/
|
|
19
|
+
export class AgentInstaller {
|
|
20
|
+
constructor(options = {}) {
|
|
21
|
+
this.sourceAgentsPath = options.sourceAgentsPath || 'one/agents';
|
|
22
|
+
this.targetAgentsPath = options.targetAgentsPath || '.claude/agents';
|
|
23
|
+
this.commandsPath = options.commandsPath || '.claude/commands';
|
|
24
|
+
this.licenseValidator = new LicenseValidator();
|
|
25
|
+
this.commandGenerator = new AgentCommandGenerator();
|
|
26
|
+
|
|
27
|
+
this.installationStats = {
|
|
28
|
+
freeAgents: 0,
|
|
29
|
+
premiumAgents: 0,
|
|
30
|
+
commands: 0,
|
|
31
|
+
errors: []
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Main installation method
|
|
37
|
+
* @param {Object} options - Installation options
|
|
38
|
+
*/
|
|
39
|
+
async install(options = {}) {
|
|
40
|
+
console.log(chalk.cyan.bold('\nš¤ ONE Agent Installation System\n'));
|
|
41
|
+
|
|
42
|
+
try {
|
|
43
|
+
// Step 1: Create directory structure
|
|
44
|
+
await this.createDirectoryStructure();
|
|
45
|
+
|
|
46
|
+
// Step 2: Copy agents with selective installation
|
|
47
|
+
await this.copyAgentsSelectively(options);
|
|
48
|
+
|
|
49
|
+
// Step 3: Generate command files
|
|
50
|
+
await this.generateAgentCommands();
|
|
51
|
+
|
|
52
|
+
// Step 4: Create configuration files
|
|
53
|
+
await this.createConfigurationFiles();
|
|
54
|
+
|
|
55
|
+
// Step 5: Show installation summary
|
|
56
|
+
await this.showInstallationSummary();
|
|
57
|
+
|
|
58
|
+
} catch (error) {
|
|
59
|
+
console.error(chalk.red('ā Agent installation failed:'), error.message);
|
|
60
|
+
throw error;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Create the .claude directory structure
|
|
66
|
+
*/
|
|
67
|
+
async createDirectoryStructure() {
|
|
68
|
+
console.log(chalk.blue('šļø Creating Claude Code integration structure...'));
|
|
69
|
+
|
|
70
|
+
const directories = [
|
|
71
|
+
'.claude',
|
|
72
|
+
this.targetAgentsPath,
|
|
73
|
+
this.commandsPath,
|
|
74
|
+
'.claude/hooks',
|
|
75
|
+
'.claude/templates'
|
|
76
|
+
];
|
|
77
|
+
|
|
78
|
+
for (const dir of directories) {
|
|
79
|
+
await fs.mkdir(dir, { recursive: true });
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
console.log(chalk.green('ā
Created .claude directory structure'));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Copy agents with selective installation (core vs premium)
|
|
87
|
+
* @param {Object} options - Installation options
|
|
88
|
+
*/
|
|
89
|
+
async copyAgentsSelectively(options = {}) {
|
|
90
|
+
console.log(chalk.blue('š¦ Installing agents...'));
|
|
91
|
+
|
|
92
|
+
// Check if source agents directory exists
|
|
93
|
+
if (!(await this.directoryExists(this.sourceAgentsPath))) {
|
|
94
|
+
console.log(chalk.yellow(`ā ļø Source agents directory not found: ${this.sourceAgentsPath}`));
|
|
95
|
+
console.log(chalk.gray('Creating empty agent structure for manual agent installation...'));
|
|
96
|
+
|
|
97
|
+
// Create empty structure with sample agents
|
|
98
|
+
await this.createSampleAgents();
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Get list of available agents
|
|
103
|
+
const sourceAgents = await fs.readdir(this.sourceAgentsPath);
|
|
104
|
+
const agentFiles = sourceAgents.filter(file => file.endsWith('.md'));
|
|
105
|
+
|
|
106
|
+
console.log(`š Found ${agentFiles.length} agents to process`);
|
|
107
|
+
|
|
108
|
+
let installed = 0;
|
|
109
|
+
let skipped = 0;
|
|
110
|
+
|
|
111
|
+
for (const agentFile of agentFiles) {
|
|
112
|
+
const agentName = path.basename(agentFile, '.md');
|
|
113
|
+
const sourcePath = path.join(this.sourceAgentsPath, agentFile);
|
|
114
|
+
const targetPath = path.join(this.targetAgentsPath, agentFile);
|
|
115
|
+
|
|
116
|
+
try {
|
|
117
|
+
// Check if agent is premium (marketing agents)
|
|
118
|
+
const isPremium = this.licenseValidator.isPremiumAgent(agentName);
|
|
119
|
+
|
|
120
|
+
// For core-only installation (default npx oneie), skip premium/marketing agents
|
|
121
|
+
if (options.coreOnly && isPremium) {
|
|
122
|
+
console.log(chalk.yellow(`āļø Skipping premium agent: ${agentName} (core-only installation)`));
|
|
123
|
+
skipped++;
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// If includeMarketing is false and we're not in coreOnly mode, we install everything
|
|
128
|
+
// If includeMarketing is true, we install everything (core + marketing)
|
|
129
|
+
|
|
130
|
+
// Copy agent file
|
|
131
|
+
await fs.copyFile(sourcePath, targetPath);
|
|
132
|
+
|
|
133
|
+
// Update statistics
|
|
134
|
+
if (isPremium) {
|
|
135
|
+
this.installationStats.premiumAgents++;
|
|
136
|
+
} else {
|
|
137
|
+
this.installationStats.freeAgents++;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
installed++;
|
|
141
|
+
|
|
142
|
+
const indicator = isPremium ? 'š' : 'š';
|
|
143
|
+
console.log(chalk.cyan(` ${indicator} Installed: ${agentName}`));
|
|
144
|
+
|
|
145
|
+
} catch (error) {
|
|
146
|
+
console.log(chalk.red(`ā Failed to install ${agentName}: ${error.message}`));
|
|
147
|
+
this.installationStats.errors.push(`${agentName}: ${error.message}`);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
console.log(chalk.green(`ā
Installed ${installed} agents (${skipped} skipped)`));
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Create sample agents when source directory doesn't exist
|
|
156
|
+
*/
|
|
157
|
+
async createSampleAgents() {
|
|
158
|
+
console.log(chalk.blue('šÆ Creating sample agents...'));
|
|
159
|
+
|
|
160
|
+
const sampleAgents = [
|
|
161
|
+
{
|
|
162
|
+
name: 'engineering-director',
|
|
163
|
+
title: 'Engineering Director',
|
|
164
|
+
description: 'Strategic engineering leadership and technical coordination specialist',
|
|
165
|
+
team: 'engineering',
|
|
166
|
+
isPremium: false
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
name: 'engineering-architect',
|
|
170
|
+
title: 'Engineering Architect',
|
|
171
|
+
description: 'System design and architecture specialist for scalable solutions',
|
|
172
|
+
team: 'engineering',
|
|
173
|
+
isPremium: false
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
name: 'content-team-manager',
|
|
177
|
+
title: 'Content Team Manager',
|
|
178
|
+
description: 'Content strategy and creation coordination specialist',
|
|
179
|
+
team: 'content',
|
|
180
|
+
isPremium: false
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
name: 'marketing-director',
|
|
184
|
+
title: 'Marketing Director',
|
|
185
|
+
description: 'Strategic marketing leadership and campaign development specialist',
|
|
186
|
+
team: 'marketing',
|
|
187
|
+
isPremium: true
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
name: 'marketing-viral-growth',
|
|
191
|
+
title: 'Marketing Viral Growth',
|
|
192
|
+
description: 'Viral marketing and exponential growth strategy specialist',
|
|
193
|
+
team: 'marketing',
|
|
194
|
+
isPremium: true
|
|
195
|
+
}
|
|
196
|
+
];
|
|
197
|
+
|
|
198
|
+
for (const agent of sampleAgents) {
|
|
199
|
+
const agentContent = this.generateSampleAgentContent(agent);
|
|
200
|
+
const agentPath = path.join(this.targetAgentsPath, `${agent.name}.md`);
|
|
201
|
+
|
|
202
|
+
await fs.writeFile(agentPath, agentContent);
|
|
203
|
+
|
|
204
|
+
if (agent.isPremium) {
|
|
205
|
+
this.installationStats.premiumAgents++;
|
|
206
|
+
} else {
|
|
207
|
+
this.installationStats.freeAgents++;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
const indicator = agent.isPremium ? 'š' : 'š';
|
|
211
|
+
console.log(chalk.cyan(` ${indicator} Created sample: ${agent.name}`));
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Generate sample agent content
|
|
217
|
+
*/
|
|
218
|
+
generateSampleAgentContent(agent) {
|
|
219
|
+
const premiumNote = agent.isPremium ? '\n\n**Note: This is a premium agent requiring a marketing team license.**' : '';
|
|
220
|
+
|
|
221
|
+
return `---
|
|
222
|
+
name: "${agent.title}"
|
|
223
|
+
team: "${agent.team}"
|
|
224
|
+
description: "${agent.description}"
|
|
225
|
+
premium: ${agent.isPremium}
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
# ${agent.title}
|
|
229
|
+
|
|
230
|
+
${agent.description}${premiumNote}
|
|
231
|
+
|
|
232
|
+
## Capabilities
|
|
233
|
+
|
|
234
|
+
This agent specializes in ${agent.team} domain expertise with focus on:
|
|
235
|
+
|
|
236
|
+
- Strategic ${agent.team} guidance
|
|
237
|
+
- Best practices and methodologies
|
|
238
|
+
- Cross-functional coordination
|
|
239
|
+
- Quality assurance and validation
|
|
240
|
+
|
|
241
|
+
## Usage
|
|
242
|
+
|
|
243
|
+
This agent can be accessed via:
|
|
244
|
+
\`\`\`
|
|
245
|
+
one:${agent.name} "Your question or request"
|
|
246
|
+
\`\`\`
|
|
247
|
+
|
|
248
|
+
## Integration
|
|
249
|
+
|
|
250
|
+
- **Team**: ${agent.team.charAt(0).toUpperCase() + agent.team.slice(1)} Team
|
|
251
|
+
- **Access**: ${agent.isPremium ? 'Premium License Required' : 'Free Core Package'}
|
|
252
|
+
- **Coordination**: Works with other ${agent.team} specialists
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
*Generated by ONE Agent Installation System*`;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Generate command files for all installed agents
|
|
261
|
+
*/
|
|
262
|
+
async generateAgentCommands() {
|
|
263
|
+
console.log(chalk.blue('āļø Generating agent command files...'));
|
|
264
|
+
|
|
265
|
+
try {
|
|
266
|
+
const result = await this.commandGenerator.generateAllCommands();
|
|
267
|
+
this.installationStats.commands = result.created + result.updated;
|
|
268
|
+
|
|
269
|
+
console.log(chalk.green(`ā
Generated ${this.installationStats.commands} command files`));
|
|
270
|
+
|
|
271
|
+
} catch (error) {
|
|
272
|
+
console.log(chalk.red(`ā Command generation failed: ${error.message}`));
|
|
273
|
+
this.installationStats.errors.push(`Command generation: ${error.message}`);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Create configuration files for Claude Code integration
|
|
279
|
+
*/
|
|
280
|
+
async createConfigurationFiles() {
|
|
281
|
+
console.log(chalk.blue('š Creating configuration files...'));
|
|
282
|
+
|
|
283
|
+
// Create agent configuration file
|
|
284
|
+
const agentConfig = {
|
|
285
|
+
version: '1.0.0',
|
|
286
|
+
installation: {
|
|
287
|
+
installedAt: new Date().toISOString(),
|
|
288
|
+
agentPath: this.targetAgentsPath,
|
|
289
|
+
commandsPath: this.commandsPath,
|
|
290
|
+
freeAgents: this.installationStats.freeAgents,
|
|
291
|
+
premiumAgents: this.installationStats.premiumAgents
|
|
292
|
+
},
|
|
293
|
+
access: {
|
|
294
|
+
corePackage: {
|
|
295
|
+
description: 'Free engineering and content agents',
|
|
296
|
+
teams: ['engineering', 'content', 'research', 'service'],
|
|
297
|
+
agents: this.installationStats.freeAgents
|
|
298
|
+
},
|
|
299
|
+
premiumPackage: {
|
|
300
|
+
description: 'Marketing and crypto specialist agents',
|
|
301
|
+
price: '$79',
|
|
302
|
+
teams: ['marketing', 'crypto', 'viral', 'growth'],
|
|
303
|
+
agents: this.installationStats.premiumAgents,
|
|
304
|
+
upgradeUrl: 'https://one.ie/upgrade'
|
|
305
|
+
}
|
|
306
|
+
},
|
|
307
|
+
integration: {
|
|
308
|
+
claudeCode: true,
|
|
309
|
+
backgroundExecution: true,
|
|
310
|
+
commandPattern: 'one:agent-name',
|
|
311
|
+
licenseValidation: true
|
|
312
|
+
}
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
await fs.writeFile(
|
|
316
|
+
path.join('.claude', 'agent-config.json'),
|
|
317
|
+
JSON.stringify(agentConfig, null, 2)
|
|
318
|
+
);
|
|
319
|
+
|
|
320
|
+
// Create README for Claude Code integration
|
|
321
|
+
const readmeContent = this.generateClaudeReadme();
|
|
322
|
+
await fs.writeFile(
|
|
323
|
+
path.join('.claude', 'README.md'),
|
|
324
|
+
readmeContent
|
|
325
|
+
);
|
|
326
|
+
|
|
327
|
+
console.log(chalk.green('ā
Created configuration files'));
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* Generate README for Claude Code integration
|
|
332
|
+
*/
|
|
333
|
+
generateClaudeReadme() {
|
|
334
|
+
return `# ONE Framework - Claude Code Integration
|
|
335
|
+
|
|
336
|
+
This directory contains the ONE Framework agent system integrated with Claude Code.
|
|
337
|
+
|
|
338
|
+
## š¤ Agent Access
|
|
339
|
+
|
|
340
|
+
### Free Agents (Core Package)
|
|
341
|
+
- **Engineering Team**: Technical leadership, architecture, development
|
|
342
|
+
- **Content Team**: Content strategy, creation, management
|
|
343
|
+
- **Research Team**: Market analysis, competitive intelligence
|
|
344
|
+
- **Service Team**: Customer success, support coordination
|
|
345
|
+
|
|
346
|
+
### Premium Agents (Marketing Package - $79)
|
|
347
|
+
- **Marketing Team**: Strategic marketing, viral growth, brand identity
|
|
348
|
+
- **Crypto Team**: Cryptocurrency analysis, DeFi strategies, token economics
|
|
349
|
+
- **Growth Team**: Viral mechanics, K-factor optimization, user acquisition
|
|
350
|
+
|
|
351
|
+
## š¬ Usage
|
|
352
|
+
|
|
353
|
+
Access any agent using the \`one:agent-name\` pattern:
|
|
354
|
+
|
|
355
|
+
\`\`\`bash
|
|
356
|
+
# Free agents (always available)
|
|
357
|
+
one:engineering-director "Help me design a scalable architecture"
|
|
358
|
+
one:content-team-manager "Create a content strategy for our launch"
|
|
359
|
+
|
|
360
|
+
# Premium agents (requires license)
|
|
361
|
+
one:marketing-director "Develop a viral marketing campaign"
|
|
362
|
+
one:crypto-market-researcher "Analyze current DeFi trends"
|
|
363
|
+
\`\`\`
|
|
364
|
+
|
|
365
|
+
## š License Management
|
|
366
|
+
|
|
367
|
+
\`\`\`bash
|
|
368
|
+
# Check license status
|
|
369
|
+
one:license --status
|
|
370
|
+
|
|
371
|
+
# Create 7-day trial
|
|
372
|
+
one:license --trial
|
|
373
|
+
|
|
374
|
+
# List all agents with premium status
|
|
375
|
+
one:license --list
|
|
376
|
+
\`\`\`
|
|
377
|
+
|
|
378
|
+
## š Directory Structure
|
|
379
|
+
|
|
380
|
+
- \`agents/\` - All agent files (*.md)
|
|
381
|
+
- \`commands/\` - Generated command files for Claude Code
|
|
382
|
+
- \`hooks/\` - Claude Code integration hooks
|
|
383
|
+
- \`agent-config.json\` - Installation and access configuration
|
|
384
|
+
- \`license.json\` - Premium license (if activated)
|
|
385
|
+
|
|
386
|
+
## š Upgrade to Premium
|
|
387
|
+
|
|
388
|
+
Visit: https://one.ie/upgrade
|
|
389
|
+
|
|
390
|
+
Get instant access to:
|
|
391
|
+
- Complete Marketing Team (18+ specialized agents)
|
|
392
|
+
- Viral Growth Engine with K-factor optimization
|
|
393
|
+
- Crypto & DeFi trading specialists
|
|
394
|
+
- Advanced campaign analytics
|
|
395
|
+
- Priority support and updates
|
|
396
|
+
|
|
397
|
+
---
|
|
398
|
+
|
|
399
|
+
Generated by ONE Agent Installation System
|
|
400
|
+
Installation Date: ${new Date().toISOString()}
|
|
401
|
+
`;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* Show installation summary
|
|
406
|
+
*/
|
|
407
|
+
async showInstallationSummary() {
|
|
408
|
+
console.log(chalk.green.bold('\nš Agent Installation Complete!\n'));
|
|
409
|
+
|
|
410
|
+
console.log(chalk.blue('š Installation Summary:'));
|
|
411
|
+
console.log(` š Free Agents: ${this.installationStats.freeAgents}`);
|
|
412
|
+
console.log(` š Premium Agents: ${this.installationStats.premiumAgents}`);
|
|
413
|
+
console.log(` āļø Command Files: ${this.installationStats.commands}`);
|
|
414
|
+
console.log(` š Directory: ${this.targetAgentsPath}`);
|
|
415
|
+
|
|
416
|
+
if (this.installationStats.errors.length > 0) {
|
|
417
|
+
console.log(chalk.yellow(`\nā ļø Errors encountered (${this.installationStats.errors.length}):`));
|
|
418
|
+
this.installationStats.errors.forEach(error => {
|
|
419
|
+
console.log(chalk.red(` ⢠${error}`));
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
console.log(chalk.cyan('\nš Next Steps:'));
|
|
424
|
+
console.log(' one:engineering-director "Help me with system architecture"');
|
|
425
|
+
console.log(' one:license --status # Check license status');
|
|
426
|
+
console.log(' one:license --trial # Try premium agents (7 days)');
|
|
427
|
+
|
|
428
|
+
console.log(chalk.green('\n⨠Your agents are ready for Claude Code integration!'));
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* Update existing installation
|
|
433
|
+
*/
|
|
434
|
+
async update(options = {}) {
|
|
435
|
+
console.log(chalk.cyan.bold('\nš Updating Agent Installation\n'));
|
|
436
|
+
|
|
437
|
+
// Show current installation status
|
|
438
|
+
if (await this.directoryExists(this.targetAgentsPath)) {
|
|
439
|
+
const currentAgents = await fs.readdir(this.targetAgentsPath);
|
|
440
|
+
console.log(chalk.blue(`š Current installation: ${currentAgents.length} agents`));
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
// Backup existing installation if requested
|
|
444
|
+
if (options.backup) {
|
|
445
|
+
await this.createBackup();
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
// Perform installation update
|
|
449
|
+
await this.install(options);
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* Create backup of existing installation
|
|
454
|
+
*/
|
|
455
|
+
async createBackup() {
|
|
456
|
+
const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
|
|
457
|
+
const backupPath = `.claude/backup-${timestamp}`;
|
|
458
|
+
|
|
459
|
+
console.log(chalk.blue(`š¾ Creating backup: ${backupPath}`));
|
|
460
|
+
|
|
461
|
+
if (await this.directoryExists(this.targetAgentsPath)) {
|
|
462
|
+
await fs.cp(this.targetAgentsPath, path.join(backupPath, 'agents'), { recursive: true });
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
if (await this.directoryExists(this.commandsPath)) {
|
|
466
|
+
await fs.cp(this.commandsPath, path.join(backupPath, 'commands'), { recursive: true });
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
console.log(chalk.green('ā
Backup created'));
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
/**
|
|
473
|
+
* Remove agent installation
|
|
474
|
+
*/
|
|
475
|
+
async uninstall(options = {}) {
|
|
476
|
+
console.log(chalk.cyan.bold('\nšļø Uninstalling Agent System\n'));
|
|
477
|
+
|
|
478
|
+
if (options.backup) {
|
|
479
|
+
await this.createBackup();
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
const directories = [
|
|
483
|
+
this.targetAgentsPath,
|
|
484
|
+
this.commandsPath
|
|
485
|
+
];
|
|
486
|
+
|
|
487
|
+
for (const dir of directories) {
|
|
488
|
+
if (await this.directoryExists(dir)) {
|
|
489
|
+
await fs.rm(dir, { recursive: true });
|
|
490
|
+
console.log(chalk.yellow(`šļø Removed: ${dir}`));
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
// Remove config files
|
|
495
|
+
const configFiles = [
|
|
496
|
+
'.claude/agent-config.json',
|
|
497
|
+
'.claude/README.md',
|
|
498
|
+
'.claude/license.json'
|
|
499
|
+
];
|
|
500
|
+
|
|
501
|
+
for (const file of configFiles) {
|
|
502
|
+
try {
|
|
503
|
+
await fs.unlink(file);
|
|
504
|
+
console.log(chalk.yellow(`šļø Removed: ${file}`));
|
|
505
|
+
} catch (error) {
|
|
506
|
+
// File may not exist
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
console.log(chalk.green('\nā
Agent system uninstalled'));
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
/**
|
|
514
|
+
* Get installation status
|
|
515
|
+
*/
|
|
516
|
+
async getStatus() {
|
|
517
|
+
const status = {
|
|
518
|
+
installed: false,
|
|
519
|
+
agentsPath: this.targetAgentsPath,
|
|
520
|
+
commandsPath: this.commandsPath,
|
|
521
|
+
agents: { free: 0, premium: 0, total: 0 },
|
|
522
|
+
commands: 0,
|
|
523
|
+
license: null
|
|
524
|
+
};
|
|
525
|
+
|
|
526
|
+
// Check if directories exist
|
|
527
|
+
if (await this.directoryExists(this.targetAgentsPath)) {
|
|
528
|
+
status.installed = true;
|
|
529
|
+
|
|
530
|
+
// Count agents
|
|
531
|
+
const agentFiles = await fs.readdir(this.targetAgentsPath);
|
|
532
|
+
const agents = agentFiles.filter(file => file.endsWith('.md'));
|
|
533
|
+
|
|
534
|
+
for (const agentFile of agents) {
|
|
535
|
+
const agentName = path.basename(agentFile, '.md');
|
|
536
|
+
if (this.licenseValidator.isPremiumAgent(agentName)) {
|
|
537
|
+
status.agents.premium++;
|
|
538
|
+
} else {
|
|
539
|
+
status.agents.free++;
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
status.agents.total = agents.length;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
// Count commands
|
|
547
|
+
if (await this.directoryExists(this.commandsPath)) {
|
|
548
|
+
const commandFiles = await fs.readdir(this.commandsPath);
|
|
549
|
+
status.commands = commandFiles.filter(file => file.startsWith('one-') && file.endsWith('.md')).length;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
// Check license status
|
|
553
|
+
try {
|
|
554
|
+
status.license = await this.licenseValidator.getLicenseStatus();
|
|
555
|
+
} catch (error) {
|
|
556
|
+
// License system not available
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
return status;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
/**
|
|
563
|
+
* Helper method to check if directory exists
|
|
564
|
+
*/
|
|
565
|
+
async directoryExists(path) {
|
|
566
|
+
try {
|
|
567
|
+
const stat = await fs.stat(path);
|
|
568
|
+
return stat.isDirectory();
|
|
569
|
+
} catch (error) {
|
|
570
|
+
return false;
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
export default AgentInstaller;
|