@hive-org/cli 0.0.5 → 0.0.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/dist/index.js +8 -1
- package/dist/list/ListApp.js +1 -46
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@ import { render } from 'ink';
|
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { CreateApp } from './create/CreateApp.js';
|
|
6
6
|
import { ListApp } from './list/ListApp.js';
|
|
7
|
+
import { StartApp } from './start/StartApp.js';
|
|
7
8
|
import { showWelcome } from './create/welcome.js';
|
|
8
9
|
const require = createRequire(import.meta.url);
|
|
9
10
|
const pkg = require('../package.json');
|
|
@@ -12,13 +13,15 @@ const HELP_TEXT = `@hive-org/cli v${pkg.version}
|
|
|
12
13
|
Usage:
|
|
13
14
|
npx @hive-org/cli@latest create [agent-name] Scaffold a new Hive agent
|
|
14
15
|
npx @hive-org/cli@latest list List existing agents
|
|
16
|
+
npx @hive-org/cli@latest start Start all agents
|
|
15
17
|
npx @hive-org/cli@latest --help Show this help message
|
|
16
18
|
npx @hive-org/cli@latest --version Print version
|
|
17
19
|
|
|
18
20
|
Examples:
|
|
19
21
|
npx @hive-org/cli@latest create alpha Creates ~/.hive/agents/alpha/
|
|
20
22
|
npx @hive-org/cli@latest create Interactive setup
|
|
21
|
-
npx @hive-org/cli@latest list Show all agents
|
|
23
|
+
npx @hive-org/cli@latest list Show all agents
|
|
24
|
+
npx @hive-org/cli@latest start Launch all agents as child processes`;
|
|
22
25
|
const command = process.argv[2];
|
|
23
26
|
const arg = process.argv[3];
|
|
24
27
|
if (command === '--version' || command === '-v') {
|
|
@@ -33,6 +36,10 @@ if (command === 'list') {
|
|
|
33
36
|
const { waitUntilExit } = render(React.createElement(ListApp));
|
|
34
37
|
await waitUntilExit();
|
|
35
38
|
}
|
|
39
|
+
else if (command === 'start') {
|
|
40
|
+
const { waitUntilExit } = render(React.createElement(StartApp));
|
|
41
|
+
await waitUntilExit();
|
|
42
|
+
}
|
|
36
43
|
else if (command === 'create') {
|
|
37
44
|
const projectName = arg;
|
|
38
45
|
await showWelcome();
|
package/dist/list/ListApp.js
CHANGED
|
@@ -1,53 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useEffect } from 'react';
|
|
3
3
|
import { Box, Text, useApp } from 'ink';
|
|
4
|
-
import fs from 'fs-extra';
|
|
5
|
-
import path from 'path';
|
|
6
|
-
import os from 'os';
|
|
7
4
|
import { colors, symbols, border } from '../theme.js';
|
|
8
|
-
|
|
9
|
-
const agentsDir = path.join(os.homedir(), '.hive', 'agents');
|
|
10
|
-
const exists = await fs.pathExists(agentsDir);
|
|
11
|
-
if (!exists) {
|
|
12
|
-
return [];
|
|
13
|
-
}
|
|
14
|
-
const entries = await fs.readdir(agentsDir, { withFileTypes: true });
|
|
15
|
-
const agents = [];
|
|
16
|
-
for (const entry of entries) {
|
|
17
|
-
if (!entry.isDirectory()) {
|
|
18
|
-
continue;
|
|
19
|
-
}
|
|
20
|
-
const soulPath = path.join(agentsDir, entry.name, 'SOUL.md');
|
|
21
|
-
const soulExists = await fs.pathExists(soulPath);
|
|
22
|
-
if (!soulExists) {
|
|
23
|
-
continue;
|
|
24
|
-
}
|
|
25
|
-
let provider = 'unknown';
|
|
26
|
-
const envPath = path.join(agentsDir, entry.name, '.env');
|
|
27
|
-
const envExists = await fs.pathExists(envPath);
|
|
28
|
-
if (envExists) {
|
|
29
|
-
const envContent = await fs.readFile(envPath, 'utf-8');
|
|
30
|
-
if (envContent.includes('OPENAI_API_KEY')) {
|
|
31
|
-
provider = 'OpenAI';
|
|
32
|
-
}
|
|
33
|
-
else if (envContent.includes('ANTHROPIC_API_KEY')) {
|
|
34
|
-
provider = 'Anthropic';
|
|
35
|
-
}
|
|
36
|
-
else if (envContent.includes('GOOGLE_GENERATIVE_AI_API_KEY')) {
|
|
37
|
-
provider = 'Google';
|
|
38
|
-
}
|
|
39
|
-
else if (envContent.includes('XAI_API_KEY')) {
|
|
40
|
-
provider = 'xAI';
|
|
41
|
-
}
|
|
42
|
-
else if (envContent.includes('OPENROUTER_API_KEY')) {
|
|
43
|
-
provider = 'OpenRouter';
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
const stat = await fs.stat(soulPath);
|
|
47
|
-
agents.push({ name: entry.name, provider, created: stat.birthtime });
|
|
48
|
-
}
|
|
49
|
-
return agents;
|
|
50
|
-
}
|
|
5
|
+
import { scanAgents } from '../agents.js';
|
|
51
6
|
function formatDate(date) {
|
|
52
7
|
const formatted = date.toLocaleDateString('en-US', {
|
|
53
8
|
year: 'numeric',
|