@agent-hive/cli 0.3.1 → 0.4.0
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/hive.js +138 -1
- package/package.json +2 -1
- package/skills/claude-code/SKILL.md +1 -1
- package/skills/generic/SKILL.md +1 -1
package/dist/hive.js
CHANGED
|
@@ -78,7 +78,7 @@ function checkSkillVersion() {
|
|
|
78
78
|
program
|
|
79
79
|
.name('hive')
|
|
80
80
|
.description('CLI tools for Hive marketplace operators')
|
|
81
|
-
.version(
|
|
81
|
+
.version(getCliVersion());
|
|
82
82
|
program
|
|
83
83
|
.command('register')
|
|
84
84
|
.description('Register as a new Hive operator (Step 1: sends verification email)')
|
|
@@ -412,6 +412,38 @@ program
|
|
|
412
412
|
process.exit(1);
|
|
413
413
|
}
|
|
414
414
|
});
|
|
415
|
+
program
|
|
416
|
+
.command('unclaim <task-id>')
|
|
417
|
+
.description('Unclaim a task to signal you are no longer working on it')
|
|
418
|
+
.action(async (taskId) => {
|
|
419
|
+
checkSkillVersion();
|
|
420
|
+
const creds = getCredentials();
|
|
421
|
+
if (!creds) {
|
|
422
|
+
console.error(JSON.stringify({ error: 'Not logged in. Run: npx hive login' }));
|
|
423
|
+
process.exit(1);
|
|
424
|
+
}
|
|
425
|
+
const apiUrl = getApiUrl();
|
|
426
|
+
try {
|
|
427
|
+
const res = await fetch(`${apiUrl}/tasks/${taskId}/unclaim`, {
|
|
428
|
+
method: 'POST',
|
|
429
|
+
headers: {
|
|
430
|
+
'X-Hive-Api-Key': creds.api_key,
|
|
431
|
+
'Content-Type': 'application/json',
|
|
432
|
+
},
|
|
433
|
+
});
|
|
434
|
+
if (!res.ok) {
|
|
435
|
+
const data = await res.json();
|
|
436
|
+
console.error(JSON.stringify({ error: data.error || 'Failed to unclaim task', hint: data.hint }));
|
|
437
|
+
process.exit(1);
|
|
438
|
+
}
|
|
439
|
+
const data = await res.json();
|
|
440
|
+
console.log(JSON.stringify(data, null, 2));
|
|
441
|
+
}
|
|
442
|
+
catch (err) {
|
|
443
|
+
console.error(JSON.stringify({ error: 'Failed to unclaim task' }));
|
|
444
|
+
process.exit(1);
|
|
445
|
+
}
|
|
446
|
+
});
|
|
415
447
|
program
|
|
416
448
|
.command('download <task-id>')
|
|
417
449
|
.description('Download all assets for a task to the current directory')
|
|
@@ -834,4 +866,109 @@ stripe
|
|
|
834
866
|
process.exit(1);
|
|
835
867
|
}
|
|
836
868
|
});
|
|
869
|
+
// =============================================================================
|
|
870
|
+
// Agent Commands
|
|
871
|
+
// =============================================================================
|
|
872
|
+
const agent = program
|
|
873
|
+
.command('agent')
|
|
874
|
+
.description('Autonomous agent mode');
|
|
875
|
+
agent
|
|
876
|
+
.command('setup')
|
|
877
|
+
.description('Scaffold workspace and install skills for autonomous operation')
|
|
878
|
+
.option('--workspace <path>', 'Custom workspace directory (default: ~/.hive/workspace/)')
|
|
879
|
+
.action(async (options) => {
|
|
880
|
+
const { setup } = await import('@agent-hive/agent');
|
|
881
|
+
await setup({ workspace: options.workspace });
|
|
882
|
+
});
|
|
883
|
+
agent
|
|
884
|
+
.command('start')
|
|
885
|
+
.description('Start the autonomous agent dispatcher')
|
|
886
|
+
.option('--budget <usd>', 'Max spend per worker run in USD', '2.00')
|
|
887
|
+
.option('--model <model>', 'Model for the worker agent')
|
|
888
|
+
.option('--worker-timeout <ms>', 'Worker timeout in milliseconds', '600000')
|
|
889
|
+
.option('--workspace <path>', 'Override workspace directory')
|
|
890
|
+
.action(async (options) => {
|
|
891
|
+
const { startDispatcher } = await import('@agent-hive/agent');
|
|
892
|
+
await startDispatcher({
|
|
893
|
+
budgetPerRun: parseFloat(options.budget),
|
|
894
|
+
model: options.model,
|
|
895
|
+
workerTimeoutMs: parseInt(options.workerTimeout),
|
|
896
|
+
workspace: options.workspace,
|
|
897
|
+
});
|
|
898
|
+
});
|
|
899
|
+
agent
|
|
900
|
+
.command('status')
|
|
901
|
+
.description('Show workspace info and recent activity')
|
|
902
|
+
.option('--workspace <path>', 'Override workspace directory')
|
|
903
|
+
.action(async (options) => {
|
|
904
|
+
const { readFileSync, existsSync, readdirSync } = await import('fs');
|
|
905
|
+
const { join } = await import('path');
|
|
906
|
+
const { getWorkspaceDir } = await import('@agent-hive/agent');
|
|
907
|
+
const workspaceDir = getWorkspaceDir(options.workspace);
|
|
908
|
+
const logsDir = join(workspaceDir, 'logs');
|
|
909
|
+
console.log('');
|
|
910
|
+
console.log('Hive Agent Status');
|
|
911
|
+
console.log('-----------------');
|
|
912
|
+
console.log('');
|
|
913
|
+
// Workspace
|
|
914
|
+
if (existsSync(workspaceDir)) {
|
|
915
|
+
console.log(` Workspace: ${workspaceDir}`);
|
|
916
|
+
}
|
|
917
|
+
else {
|
|
918
|
+
console.log(' Workspace: Not set up');
|
|
919
|
+
console.log('');
|
|
920
|
+
console.log(' Run: npx hive agent setup');
|
|
921
|
+
return;
|
|
922
|
+
}
|
|
923
|
+
// CLAUDE.md
|
|
924
|
+
const claudeMd = join(workspaceDir, 'CLAUDE.md');
|
|
925
|
+
console.log(` CLAUDE.md: ${existsSync(claudeMd) ? 'present' : 'missing'}`);
|
|
926
|
+
// Skills
|
|
927
|
+
const skillsDir = join(workspaceDir, '.agents', 'skills');
|
|
928
|
+
if (existsSync(skillsDir)) {
|
|
929
|
+
try {
|
|
930
|
+
const skillDirs = readdirSync(skillsDir, { withFileTypes: true })
|
|
931
|
+
.filter(d => d.isDirectory())
|
|
932
|
+
.map(d => d.name);
|
|
933
|
+
console.log(` Skills: ${skillDirs.length > 0 ? skillDirs.join(', ') : 'none'}`);
|
|
934
|
+
}
|
|
935
|
+
catch {
|
|
936
|
+
console.log(' Skills: unable to read');
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
else {
|
|
940
|
+
console.log(' Skills: none installed');
|
|
941
|
+
}
|
|
942
|
+
// Recent logs
|
|
943
|
+
console.log('');
|
|
944
|
+
if (existsSync(logsDir)) {
|
|
945
|
+
const logFiles = readdirSync(logsDir)
|
|
946
|
+
.filter(f => f.endsWith('.jsonl'))
|
|
947
|
+
.sort()
|
|
948
|
+
.reverse();
|
|
949
|
+
if (logFiles.length > 0) {
|
|
950
|
+
console.log(' Recent activity:');
|
|
951
|
+
const latestLog = join(logsDir, logFiles[0]);
|
|
952
|
+
const lines = readFileSync(latestLog, 'utf-8').trim().split('\n');
|
|
953
|
+
const recentLines = lines.slice(-10);
|
|
954
|
+
for (const line of recentLines) {
|
|
955
|
+
try {
|
|
956
|
+
const entry = JSON.parse(line);
|
|
957
|
+
const time = entry.timestamp?.slice(11, 19) || '??:??:??';
|
|
958
|
+
console.log(` ${time} [${entry.event}] ${entry.message}`);
|
|
959
|
+
}
|
|
960
|
+
catch {
|
|
961
|
+
// skip malformed lines
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
else {
|
|
966
|
+
console.log(' No activity logged yet.');
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
else {
|
|
970
|
+
console.log(' No logs directory.');
|
|
971
|
+
}
|
|
972
|
+
console.log('');
|
|
973
|
+
});
|
|
837
974
|
program.parse();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-hive/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "CLI tools for Hive marketplace agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"prepublishOnly": "npm run build"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
+
"@agent-hive/agent": "*",
|
|
16
17
|
"chalk": "^5.3.0",
|
|
17
18
|
"commander": "^11.1.0",
|
|
18
19
|
"open": "^10.0.3"
|