subagents-sh 0.1.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/README.md +57 -0
- package/dist/commands/add.d.ts +6 -0
- package/dist/commands/add.d.ts.map +1 -0
- package/dist/commands/add.js +35 -0
- package/dist/commands/add.js.map +1 -0
- package/dist/commands/list.d.ts +7 -0
- package/dist/commands/list.d.ts.map +1 -0
- package/dist/commands/list.js +77 -0
- package/dist/commands/list.js.map +1 -0
- package/dist/commands/remove.d.ts +6 -0
- package/dist/commands/remove.d.ts.map +1 -0
- package/dist/commands/remove.js +25 -0
- package/dist/commands/remove.js.map +1 -0
- package/dist/commands/update.d.ts +7 -0
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/commands/update.js +83 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +125 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +41 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/fetch.d.ts +23 -0
- package/dist/utils/fetch.d.ts.map +1 -0
- package/dist/utils/fetch.js +124 -0
- package/dist/utils/fetch.js.map +1 -0
- package/dist/utils/fetch.test.d.ts +2 -0
- package/dist/utils/fetch.test.d.ts.map +1 -0
- package/dist/utils/fetch.test.js +246 -0
- package/dist/utils/fetch.test.js.map +1 -0
- package/dist/utils/install.d.ts +68 -0
- package/dist/utils/install.d.ts.map +1 -0
- package/dist/utils/install.js +140 -0
- package/dist/utils/install.js.map +1 -0
- package/dist/utils/install.test.d.ts +2 -0
- package/dist/utils/install.test.d.ts.map +1 -0
- package/dist/utils/install.test.js +565 -0
- package/dist/utils/install.test.js.map +1 -0
- package/dist/utils/manifest.d.ts +37 -0
- package/dist/utils/manifest.d.ts.map +1 -0
- package/dist/utils/manifest.js +74 -0
- package/dist/utils/manifest.js.map +1 -0
- package/dist/utils/manifest.test.d.ts +2 -0
- package/dist/utils/manifest.test.d.ts.map +1 -0
- package/dist/utils/manifest.test.js +278 -0
- package/dist/utils/manifest.test.js.map +1 -0
- package/dist/utils/paths.d.ts +49 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +98 -0
- package/dist/utils/paths.js.map +1 -0
- package/dist/utils/paths.test.d.ts +2 -0
- package/dist/utils/paths.test.d.ts.map +1 -0
- package/dist/utils/paths.test.js +255 -0
- package/dist/utils/paths.test.js.map +1 -0
- package/dist/utils/telemetry.d.ts +5 -0
- package/dist/utils/telemetry.d.ts.map +1 -0
- package/dist/utils/telemetry.js +30 -0
- package/dist/utils/telemetry.js.map +1 -0
- package/dist/utils/telemetry.test.d.ts +2 -0
- package/dist/utils/telemetry.test.d.ts.map +1 -0
- package/dist/utils/telemetry.test.js +113 -0
- package/dist/utils/telemetry.test.js.map +1 -0
- package/package.json +57 -0
package/README.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# subagents
|
|
2
|
+
|
|
3
|
+
CLI for discovering and installing Claude Code subagents.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
No installation required! Use directly with npx:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx subagents-sh add owner/repo/agent-name
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Or install globally:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install -g subagents-sh
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Commands
|
|
20
|
+
|
|
21
|
+
### Add a subagent
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npx subagents-sh add owner/repo/agent-name
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Search for subagents
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npx subagents-sh search <query>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### List installed subagents
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npx subagents-sh list
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Remove a subagent
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npx subagents-sh remove <name>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Update all subagents
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npx subagents-sh update
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Learn More
|
|
52
|
+
|
|
53
|
+
Visit [subagents.sh](https://subagents.sh) to browse available subagents.
|
|
54
|
+
|
|
55
|
+
## License
|
|
56
|
+
|
|
57
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../src/commands/add.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,wBAAsB,UAAU,CAC9B,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,IAAI,CAAC,CA0Cf"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as p from '@clack/prompts';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import { installSubagent } from '../utils/install.js';
|
|
4
|
+
export async function addCommand(identifier, options) {
|
|
5
|
+
const s = p.spinner();
|
|
6
|
+
const scope = options.local ? 'local' : 'global';
|
|
7
|
+
const scopeLabel = scope === 'global' ? '~/.claude/agents/' : './.claude/agents/';
|
|
8
|
+
try {
|
|
9
|
+
s.start(`Installing ${chalk.cyan(identifier)} to ${chalk.dim(scopeLabel)}`);
|
|
10
|
+
const result = await installSubagent(identifier, {
|
|
11
|
+
force: options.force,
|
|
12
|
+
scope,
|
|
13
|
+
});
|
|
14
|
+
s.stop(result.isUpdate
|
|
15
|
+
? `Updated ${chalk.green(result.name)}`
|
|
16
|
+
: `Installed ${chalk.green(result.name)}`);
|
|
17
|
+
p.note([
|
|
18
|
+
`${chalk.dim('Location:')} ${result.path}`,
|
|
19
|
+
`${chalk.dim('Scope:')} ${scope}`,
|
|
20
|
+
'',
|
|
21
|
+
`Claude Code will automatically use this subagent`,
|
|
22
|
+
`when relevant to your tasks.`,
|
|
23
|
+
].join('\n'), 'Success');
|
|
24
|
+
}
|
|
25
|
+
catch (err) {
|
|
26
|
+
s.stop('Installation failed');
|
|
27
|
+
const message = err instanceof Error ? err.message : 'Unknown error';
|
|
28
|
+
p.log.error(chalk.red(message));
|
|
29
|
+
if (message.includes('already installed')) {
|
|
30
|
+
p.log.info(`Run with ${chalk.cyan('--force')} to overwrite.`);
|
|
31
|
+
}
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=add.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add.js","sourceRoot":"","sources":["../../src/commands/add.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAQtD,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,UAAkB,EAClB,OAAmB;IAEnB,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC;IACtB,MAAM,KAAK,GAAiB,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC;IAC/D,MAAM,UAAU,GAAG,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,mBAAmB,CAAC;IAElF,IAAI,CAAC;QACH,CAAC,CAAC,KAAK,CAAC,cAAc,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;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["../../src/commands/list.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,WAAW;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAoDD,wBAAsB,WAAW,CAAC,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CA0C1E"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import * as p from '@clack/prompts';
|
|
3
|
+
import { listManifestSubagents } from '../utils/manifest.js';
|
|
4
|
+
import { listSubagentFiles } from '../utils/paths.js';
|
|
5
|
+
function displaySubagents(manifestSubagents, fileSubagents, scopeLabel) {
|
|
6
|
+
// Combine both sources, preferring manifest data
|
|
7
|
+
const manifestNames = new Set(manifestSubagents.map((s) => s.name));
|
|
8
|
+
const orphanFiles = fileSubagents.filter((f) => !manifestNames.has(f));
|
|
9
|
+
if (manifestSubagents.length === 0 && orphanFiles.length === 0) {
|
|
10
|
+
console.log(chalk.dim(` No subagents installed in ${scopeLabel}`));
|
|
11
|
+
console.log();
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
// Show tracked subagents
|
|
15
|
+
for (const subagent of manifestSubagents) {
|
|
16
|
+
const name = chalk.green(subagent.name);
|
|
17
|
+
const source = chalk.dim(`(${subagent.source})`);
|
|
18
|
+
const desc = subagent.description
|
|
19
|
+
? chalk.gray(` - ${subagent.description}`)
|
|
20
|
+
: '';
|
|
21
|
+
console.log(` ${name} ${source}${desc}`);
|
|
22
|
+
if (subagent.tools) {
|
|
23
|
+
// Handle both array and comma-separated string formats
|
|
24
|
+
const toolsList = Array.isArray(subagent.tools)
|
|
25
|
+
? subagent.tools
|
|
26
|
+
: String(subagent.tools).split(',').map((t) => t.trim());
|
|
27
|
+
if (toolsList.length > 0) {
|
|
28
|
+
const tools = toolsList.map((t) => chalk.cyan(t)).join(', ');
|
|
29
|
+
console.log(` ${chalk.dim('Tools:')} ${tools}`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
console.log();
|
|
33
|
+
}
|
|
34
|
+
// Show orphan files (files without manifest entry)
|
|
35
|
+
if (orphanFiles.length > 0) {
|
|
36
|
+
console.log(chalk.dim(' Untracked files:'));
|
|
37
|
+
for (const file of orphanFiles) {
|
|
38
|
+
console.log(` ${chalk.yellow(file)} ${chalk.dim('(not in manifest)')}`);
|
|
39
|
+
}
|
|
40
|
+
console.log();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
export async function listCommand(options = {}) {
|
|
44
|
+
// Determine which scopes to show
|
|
45
|
+
const showGlobal = options.global || options.all || (!options.local);
|
|
46
|
+
const showLocal = options.local || options.all;
|
|
47
|
+
let totalCount = 0;
|
|
48
|
+
if (showGlobal) {
|
|
49
|
+
const globalManifest = listManifestSubagents('global');
|
|
50
|
+
const globalFiles = listSubagentFiles('global');
|
|
51
|
+
const globalManifestNames = new Set(globalManifest.map((s) => s.name));
|
|
52
|
+
const globalOrphans = globalFiles.filter((f) => !globalManifestNames.has(f));
|
|
53
|
+
console.log();
|
|
54
|
+
console.log(chalk.bold('Global agents') + chalk.dim(' (~/.claude/agents/)'));
|
|
55
|
+
console.log();
|
|
56
|
+
displaySubagents(globalManifest, globalFiles, 'global scope');
|
|
57
|
+
totalCount += globalManifest.length + globalOrphans.length;
|
|
58
|
+
}
|
|
59
|
+
if (showLocal) {
|
|
60
|
+
const localManifest = listManifestSubagents('local');
|
|
61
|
+
const localFiles = listSubagentFiles('local');
|
|
62
|
+
const localManifestNames = new Set(localManifest.map((s) => s.name));
|
|
63
|
+
const localOrphans = localFiles.filter((f) => !localManifestNames.has(f));
|
|
64
|
+
console.log();
|
|
65
|
+
console.log(chalk.bold('Local/Project agents') + chalk.dim(' (./.claude/agents/)'));
|
|
66
|
+
console.log();
|
|
67
|
+
displaySubagents(localManifest, localFiles, 'local scope');
|
|
68
|
+
totalCount += localManifest.length + localOrphans.length;
|
|
69
|
+
}
|
|
70
|
+
if (totalCount === 0) {
|
|
71
|
+
p.log.info('No subagents installed.');
|
|
72
|
+
p.log.info(`Run ${chalk.cyan('npx subagents-sh add owner/repo/name')} to install one.`);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
console.log(chalk.dim(`Total: ${totalCount} subagent(s)`));
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../src/commands/list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAwB,MAAM,mBAAmB,CAAC;AAS5E,SAAS,gBAAgB,CACvB,iBAAsC,EACtC,aAAuB,EACvB,UAAkB;IAElB,iDAAiD;IACjD,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IACpE,MAAM,WAAW,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAEvE,IAAI,iBAAiB,CAAC,MAAM,KAAK,CAAC,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC/D,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,+BAA+B,UAAU,EAAE,CAAC,CAAC,CAAC;QACpE,OAAO,CAAC,GAAG,EAAE,CAAC;QACd,OAAO;IACT,CAAC;IAED,yBAAyB;IACzB,KAAK,MAAM,QAAQ,IAAI,iBAAiB,EAAE,CAAC;QACzC,MAAM,IAAI,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+
{"version":3,"file":"remove.d.ts","sourceRoot":"","sources":["../../src/commands/remove.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,wBAAsB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,aAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAoB5F"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import * as p from '@clack/prompts';
|
|
3
|
+
import { uninstallSubagent } from '../utils/install.js';
|
|
4
|
+
export async function removeCommand(name, options = {}) {
|
|
5
|
+
try {
|
|
6
|
+
// Determine scope - if neither specified, auto-detect
|
|
7
|
+
let scope;
|
|
8
|
+
if (options.global) {
|
|
9
|
+
scope = 'global';
|
|
10
|
+
}
|
|
11
|
+
else if (options.local) {
|
|
12
|
+
scope = 'local';
|
|
13
|
+
}
|
|
14
|
+
// If neither flag is set, scope remains undefined and uninstallSubagent will auto-detect
|
|
15
|
+
const result = uninstallSubagent(name, { scope });
|
|
16
|
+
p.log.success(`Removed ${chalk.green(name)} from ${result.scope} scope`);
|
|
17
|
+
p.log.info(chalk.dim(`Deleted: ${result.path}`));
|
|
18
|
+
}
|
|
19
|
+
catch (err) {
|
|
20
|
+
const message = err instanceof Error ? err.message : 'Unknown error';
|
|
21
|
+
p.log.error(chalk.red(message));
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=remove.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove.js","sourceRoot":"","sources":["../../src/commands/remove.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC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AAG,OAAO,CAAC,IAAI,CAAC,CA8F9E"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import * as p from '@clack/prompts';
|
|
3
|
+
import { updateAllSubagents, updateAllScopesSubagents } from '../utils/install.js';
|
|
4
|
+
import { listManifestSubagents } from '../utils/manifest.js';
|
|
5
|
+
export async function updateCommand(options = {}) {
|
|
6
|
+
// Determine which scopes to update
|
|
7
|
+
const updateAll = options.all;
|
|
8
|
+
const updateLocal = options.local && !options.all;
|
|
9
|
+
const updateGlobal = options.global || (!options.local && !options.all);
|
|
10
|
+
if (updateAll) {
|
|
11
|
+
// Update both scopes
|
|
12
|
+
const globalInstalled = listManifestSubagents('global');
|
|
13
|
+
const localInstalled = listManifestSubagents('local');
|
|
14
|
+
const totalCount = globalInstalled.length + localInstalled.length;
|
|
15
|
+
if (totalCount === 0) {
|
|
16
|
+
p.log.info('No subagents installed in any scope.');
|
|
17
|
+
p.log.info(`Run ${chalk.cyan('npx subagents-sh add owner/repo/name')} to install one.`);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
console.log();
|
|
21
|
+
console.log(chalk.bold(`Updating ${totalCount} subagent(s) across all scopes...`));
|
|
22
|
+
console.log();
|
|
23
|
+
const results = await updateAllScopesSubagents((name, scope, status, error) => {
|
|
24
|
+
const scopeLabel = scope === 'global' ? chalk.dim('[global]') : chalk.dim('[local]');
|
|
25
|
+
switch (status) {
|
|
26
|
+
case 'updating':
|
|
27
|
+
console.log(` ${chalk.dim('Updating')} ${name} ${scopeLabel}...`);
|
|
28
|
+
break;
|
|
29
|
+
case 'updated':
|
|
30
|
+
console.log(` ${chalk.green('✓')} ${name} ${scopeLabel}`);
|
|
31
|
+
break;
|
|
32
|
+
case 'error':
|
|
33
|
+
console.log(` ${chalk.red('✗')} ${name} ${scopeLabel}: ${error}`);
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
console.log();
|
|
38
|
+
const totalUpdated = results.global.updated.length + results.local.updated.length;
|
|
39
|
+
const totalErrors = results.global.errors.length + results.local.errors.length;
|
|
40
|
+
if (totalUpdated > 0) {
|
|
41
|
+
p.log.success(`Updated ${totalUpdated} subagent(s)`);
|
|
42
|
+
}
|
|
43
|
+
if (totalErrors > 0) {
|
|
44
|
+
p.log.warning(`Failed to update ${totalErrors} subagent(s)`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
// Update single scope
|
|
49
|
+
const scope = updateLocal ? 'local' : 'global';
|
|
50
|
+
const scopeLabel = scope === 'global' ? '~/.claude/agents/' : './.claude/agents/';
|
|
51
|
+
const installed = listManifestSubagents(scope);
|
|
52
|
+
if (installed.length === 0) {
|
|
53
|
+
p.log.info(`No subagents installed in ${scope} scope.`);
|
|
54
|
+
p.log.info(`Run ${chalk.cyan('npx subagents-sh add owner/repo/name')} to install one.`);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
console.log();
|
|
58
|
+
console.log(chalk.bold(`Updating ${installed.length} subagent(s) in ${scope} scope...`));
|
|
59
|
+
console.log(chalk.dim(` ${scopeLabel}`));
|
|
60
|
+
console.log();
|
|
61
|
+
const { updated, errors } = await updateAllSubagents({ scope }, (name, status, error) => {
|
|
62
|
+
switch (status) {
|
|
63
|
+
case 'updating':
|
|
64
|
+
console.log(` ${chalk.dim('Updating')} ${name}...`);
|
|
65
|
+
break;
|
|
66
|
+
case 'updated':
|
|
67
|
+
console.log(` ${chalk.green('✓')} ${name}`);
|
|
68
|
+
break;
|
|
69
|
+
case 'error':
|
|
70
|
+
console.log(` ${chalk.red('✗')} ${name}: ${error}`);
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
console.log();
|
|
75
|
+
if (updated.length > 0) {
|
|
76
|
+
p.log.success(`Updated ${updated.length} subagent(s)`);
|
|
77
|
+
}
|
|
78
|
+
if (errors.length > 0) {
|
|
79
|
+
p.log.warning(`Failed to update ${errors.length} subagent(s)`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=update.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../src/commands/update.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AACnF,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAS7D,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,UAAyB,EAAE;IAC7D,mCAAmC;IACnC,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC;IAC9B,MAAM,WAAW,GAAG,OAAO,CAAC,KAAK,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC;IAClD,MAAM,YAAY,GAAG,OAAO,CAAC,MAAM,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAExE,IAAI,SAAS,EAAE,CAAC;QACd,qBAAqB;QACrB,MAAM,eAAe,GAAG,qBAAqB,CAAC,QAAQ,CAAC,CAAC;QACxD,MAAM,cAAc,GAAG,qBAAqB,CAAC,OAAO,CAAC,CAAC;QACtD,MAAM,UAAU,GAAG,eAAe,CAAC,MAAM,GAAG,cAAc,CAAC,MAAM,CAAC;QAElE,IAAI,UAAU,KAAK,CAAC,EAAE,CAAC;YACrB,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;YACnD,CAAC,CAAC,GAAG,CAAC,IAAI,CACR,OAAO,KAAK,CAAC,IAAI,CAAC,sCAAsC,CAAC,kBAAkB,CAC5E,CAAC;YACF,OAAO;QACT,CAAC;QAED,OAAO,CAAC,GAAG,EAAE,CAAC;QACd,OAAO,CAA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C,KAAK,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,IAAI,KAAK,CAAC,CAAC;oBACrD,MAAM;gBACR,KAAK,SAAS;oBACZ,OAAO,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;oBAC7C,MAAM;gBACR,KAAK,OAAO;oBACV,OAAO,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC,CAAC;oBACrD,MAAM;YACV,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,OAAO,CAAC,GAAG,EAAE,CAAC;QAEd,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACvB,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,OAAO,CAAC,MAAM,cAAc,CAAC,CAAC;QACzD,CAAC;QAED,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACtB,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,oBAAoB,MAAM,CAAC,MAAM,cAAc,CAAC,CAAC;QACjE,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
import * as p from '@clack/prompts';
|
|
5
|
+
import figlet from 'figlet';
|
|
6
|
+
import { addCommand } from './commands/add.js';
|
|
7
|
+
import { listCommand } from './commands/list.js';
|
|
8
|
+
import { removeCommand } from './commands/remove.js';
|
|
9
|
+
import { updateCommand } from './commands/update.js';
|
|
10
|
+
const VERSION = '0.1.0';
|
|
11
|
+
// ASCII banner using figlet (same ANSI Shadow font as homepage)
|
|
12
|
+
function showBanner() {
|
|
13
|
+
const banner = figlet.textSync('subagents', {
|
|
14
|
+
font: 'ANSI Shadow',
|
|
15
|
+
horizontalLayout: 'default',
|
|
16
|
+
});
|
|
17
|
+
console.log(chalk.cyan(banner));
|
|
18
|
+
console.log(chalk.dim(` CLI for Claude Code subagents • v${VERSION}`));
|
|
19
|
+
console.log(chalk.dim(` https://subagents.sh`));
|
|
20
|
+
console.log();
|
|
21
|
+
}
|
|
22
|
+
const program = new Command();
|
|
23
|
+
program
|
|
24
|
+
.name('subagents-sh')
|
|
25
|
+
.description('CLI for discovering and installing Claude Code subagents')
|
|
26
|
+
.version(VERSION);
|
|
27
|
+
// Add command
|
|
28
|
+
program
|
|
29
|
+
.command('add <identifier>')
|
|
30
|
+
.description('Install a subagent from the registry or GitHub')
|
|
31
|
+
.option('-f, --force', 'Overwrite existing subagent')
|
|
32
|
+
.option('-l, --local', 'Install to project directory (./.claude/agents/)')
|
|
33
|
+
.addHelpText('after', `
|
|
34
|
+
Examples:
|
|
35
|
+
$ npx subagents-sh add anthropics/claude-code/backend-architect
|
|
36
|
+
$ npx subagents-sh add user/repo/agent-name
|
|
37
|
+
$ npx subagents-sh add user/repo/agent-name --local
|
|
38
|
+
|
|
39
|
+
Storage locations:
|
|
40
|
+
Global (default) ~/.claude/agents/ Available in all projects
|
|
41
|
+
Local (--local) ./.claude/agents/ Project-specific, shareable via git
|
|
42
|
+
`)
|
|
43
|
+
.action(async (identifier, options) => {
|
|
44
|
+
p.intro(chalk.bgCyan.black(' subagents '));
|
|
45
|
+
await addCommand(identifier, options);
|
|
46
|
+
p.outro('Done!');
|
|
47
|
+
});
|
|
48
|
+
// List command
|
|
49
|
+
program
|
|
50
|
+
.command('list')
|
|
51
|
+
.alias('ls')
|
|
52
|
+
.description('List installed subagents')
|
|
53
|
+
.option('-g, --global', 'Show only global agents (default)')
|
|
54
|
+
.option('-l, --local', 'Show only project agents')
|
|
55
|
+
.option('-a, --all', 'Show agents from both locations')
|
|
56
|
+
.addHelpText('after', `
|
|
57
|
+
Examples:
|
|
58
|
+
$ npx subagents-sh list # Show global agents (default)
|
|
59
|
+
$ npx subagents-sh list --local # Show project agents only
|
|
60
|
+
$ npx subagents-sh list --all # Show agents from both locations
|
|
61
|
+
`)
|
|
62
|
+
.action(async (options) => {
|
|
63
|
+
await listCommand(options);
|
|
64
|
+
});
|
|
65
|
+
// Remove command
|
|
66
|
+
program
|
|
67
|
+
.command('remove <name>')
|
|
68
|
+
.alias('rm')
|
|
69
|
+
.description('Remove an installed subagent')
|
|
70
|
+
.option('-g, --global', 'Remove from global scope')
|
|
71
|
+
.option('-l, --local', 'Remove from local/project scope')
|
|
72
|
+
.addHelpText('after', `
|
|
73
|
+
Examples:
|
|
74
|
+
$ npx subagents-sh remove agent-name # Auto-detect location
|
|
75
|
+
$ npx subagents-sh remove agent-name --global # Remove from global
|
|
76
|
+
$ npx subagents-sh remove agent-name --local # Remove from project
|
|
77
|
+
`)
|
|
78
|
+
.action(async (name, options) => {
|
|
79
|
+
await removeCommand(name, options);
|
|
80
|
+
});
|
|
81
|
+
// Update command
|
|
82
|
+
program
|
|
83
|
+
.command('update')
|
|
84
|
+
.alias('up')
|
|
85
|
+
.description('Update all installed subagents')
|
|
86
|
+
.option('-g, --global', 'Update global agents only (default)')
|
|
87
|
+
.option('-l, --local', 'Update project agents only')
|
|
88
|
+
.option('-a, --all', 'Update agents in both locations')
|
|
89
|
+
.addHelpText('after', `
|
|
90
|
+
Examples:
|
|
91
|
+
$ npx subagents-sh update # Update global agents (default)
|
|
92
|
+
$ npx subagents-sh update --local # Update project agents only
|
|
93
|
+
$ npx subagents-sh update --all # Update all agents
|
|
94
|
+
`)
|
|
95
|
+
.action(async (options) => {
|
|
96
|
+
p.intro(chalk.bgCyan.black(' subagents '));
|
|
97
|
+
await updateCommand(options);
|
|
98
|
+
p.outro('Done!');
|
|
99
|
+
});
|
|
100
|
+
// Search command (redirects to website)
|
|
101
|
+
program
|
|
102
|
+
.command('search [query]')
|
|
103
|
+
.description('Search for subagents (opens subagents.sh)')
|
|
104
|
+
.action((query) => {
|
|
105
|
+
const url = query
|
|
106
|
+
? `https://subagents.sh?q=${encodeURIComponent(query)}`
|
|
107
|
+
: 'https://subagents.sh';
|
|
108
|
+
console.log();
|
|
109
|
+
console.log(`Search for subagents at: ${chalk.cyan(url)}`);
|
|
110
|
+
console.log();
|
|
111
|
+
});
|
|
112
|
+
// Handle unknown commands
|
|
113
|
+
program.on('command:*', () => {
|
|
114
|
+
console.error(chalk.red(`Unknown command: ${program.args.join(' ')}\n`));
|
|
115
|
+
program.help();
|
|
116
|
+
});
|
|
117
|
+
// Show banner and help if no command provided
|
|
118
|
+
if (!process.argv.slice(2).length) {
|
|
119
|
+
showBanner();
|
|
120
|
+
program.outputHelp();
|
|
121
|
+
process.exit(0);
|
|
122
|
+
}
|
|
123
|
+
// Parse arguments
|
|
124
|
+
program.parse();
|
|
125
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AACpC,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAc,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAe,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAiB,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,aAAa,EAAiB,MAAM,sBAAsB,CAAC;AAEpE,MAAM,OAAO,GAAG,OAAO,CAAC;AAExB,gEAAgE;AAChE,SAAS,UAAU;IACjB,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,W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AW,CAAC,2CAA2C,CAAC;KACxD,MAAM,CAAC,CAAC,KAAc,EAAE,EAAE;IACzB,MAAM,GAAG,GAAG,KAAK;QACf,CAAC,CAAC,0BAA0B,kBAAkB,CAAC,KAAK,CAAC,EAAE;QACvD,CAAC,CAAC,sBAAsB,CAAC;IAE3B,OAAO,CAAC,GAAG,EAAE,CAAC;IACd,OAAO,CAAC,GAAG,CAAC,4BAA4B,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAC3D,OAAO,CAAC,GAAG,EAAE,CAAC;AAChB,CAAC,CAAC,CAAC;AAEL,0BAA0B;AAC1B,OAAO,CAAC,EAAE,CAAC,WAAW,EAAE,GAAG,EAAE;IAC3B,OAAO,CAAC,KAAK,CACX,KAAK,CAAC,GAAG,CAAC,oBAAoB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAC1D,CAAC;IACF,OAAO,CAAC,IAAI,EAAE,CAAC;AACjB,CAAC,CAAC,CAAC;AAEH,8CAA8C;AAC9C,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAClC,UAAU,EAAE,CAAC;IACb,OAAO,CAAC,UAAU,EAAE,CAAC;IACrB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,kBAAkB;AAClB,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export type StorageScope = 'global' | 'local';
|
|
2
|
+
export interface SubagentFrontmatter {
|
|
3
|
+
name: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
tools?: string[];
|
|
6
|
+
[key: string]: unknown;
|
|
7
|
+
}
|
|
8
|
+
export interface ParsedSubagent {
|
|
9
|
+
frontmatter: SubagentFrontmatter;
|
|
10
|
+
content: string;
|
|
11
|
+
raw: string;
|
|
12
|
+
}
|
|
13
|
+
export interface InstalledSubagent {
|
|
14
|
+
name: string;
|
|
15
|
+
path: string;
|
|
16
|
+
source: string;
|
|
17
|
+
description?: string;
|
|
18
|
+
tools?: string[] | string;
|
|
19
|
+
installedAt: string;
|
|
20
|
+
updatedAt: string;
|
|
21
|
+
}
|
|
22
|
+
export interface Manifest {
|
|
23
|
+
version: string;
|
|
24
|
+
subagents: Record<string, InstalledSubagent>;
|
|
25
|
+
}
|
|
26
|
+
export interface FetchResult {
|
|
27
|
+
content: string;
|
|
28
|
+
source: {
|
|
29
|
+
owner: string;
|
|
30
|
+
repo: string;
|
|
31
|
+
name: string;
|
|
32
|
+
branch: string;
|
|
33
|
+
path: string;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export interface TelemetryPayload {
|
|
37
|
+
subagentId: string;
|
|
38
|
+
event: 'download' | 'view' | 'copy';
|
|
39
|
+
metadata?: Record<string, unknown>;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE9C,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,mBAAmB,CAAC;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,QAAQ;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;CAC9C;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE;QACN,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACH;AAED,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,YAAY"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { FetchResult } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Parse a subagent identifier (owner/repo/name or full GitHub URL)
|
|
4
|
+
*/
|
|
5
|
+
export declare function parseIdentifier(identifier: string): {
|
|
6
|
+
owner: string;
|
|
7
|
+
repo: string;
|
|
8
|
+
name: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Fetch subagent content from GitHub
|
|
12
|
+
* Tries multiple paths to find the agent file
|
|
13
|
+
*/
|
|
14
|
+
export declare function fetchFromGitHub(owner: string, repo: string, name: string, branch?: string): Promise<FetchResult>;
|
|
15
|
+
/**
|
|
16
|
+
* Check if a GitHub repo exists and is accessible
|
|
17
|
+
*/
|
|
18
|
+
export declare function checkRepoExists(owner: string, repo: string): Promise<boolean>;
|
|
19
|
+
/**
|
|
20
|
+
* Get the default branch for a repository
|
|
21
|
+
*/
|
|
22
|
+
export declare function getDefaultBranch(owner: string, repo: string): Promise<string>;
|
|
23
|
+
//# sourceMappingURL=fetch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../src/utils/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAQ/C;;GAEG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CA+CA;AAED;;;GAGG;AACH,wBAAsB,eAAe,CACnC,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,MAAM,SAAS,GACd,OAAO,CAAC,WAAW,CAAC,CA+CtB;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CASnF;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAenF"}
|