@phnx-labs/agents-cli 1.23.12 → 1.23.14

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.
Files changed (163) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +30 -59
  3. package/dist/cli/command-registry.js +0 -24
  4. package/dist/commands/accounts.js +3 -3
  5. package/dist/commands/daemon.js +5 -147
  6. package/dist/commands/doctor.js +7 -0
  7. package/dist/commands/events-logs.d.ts +2 -0
  8. package/dist/commands/{logs.js → events-logs.js} +28 -127
  9. package/dist/commands/events.js +3 -1
  10. package/dist/commands/exec.d.ts +0 -1
  11. package/dist/commands/exec.js +3 -11
  12. package/dist/commands/feed.d.ts +1 -1
  13. package/dist/commands/feed.js +4 -7
  14. package/dist/commands/mcp.js +1 -1
  15. package/dist/commands/menubar.js +12 -226
  16. package/dist/commands/projects.js +1 -2
  17. package/dist/commands/{trash.d.ts → prune-trash.d.ts} +1 -1
  18. package/dist/commands/{trash.js → prune-trash.js} +8 -8
  19. package/dist/commands/prune.js +3 -1
  20. package/dist/commands/send.js +2 -5
  21. package/dist/commands/sessions.js +1 -1
  22. package/dist/commands/setup.js +1 -1
  23. package/dist/commands/ssh.js +2 -2
  24. package/dist/commands/utils.d.ts +1 -5
  25. package/dist/commands/utils.js +1 -7
  26. package/dist/lib/agent-spec/agents.d.ts +0 -2
  27. package/dist/lib/agent-spec/agents.js +0 -12
  28. package/dist/lib/agent-spec/index.d.ts +0 -4
  29. package/dist/lib/agent-spec/index.js +0 -4
  30. package/dist/lib/commands.d.ts +1 -5
  31. package/dist/lib/commands.js +2 -69
  32. package/dist/lib/comms-render.d.ts +0 -7
  33. package/dist/lib/comms-render.js +0 -41
  34. package/dist/lib/config-keys.d.ts +1 -1
  35. package/dist/lib/config-keys.js +8 -0
  36. package/dist/lib/daemon/daemon.js +1 -6
  37. package/dist/lib/daemon-services.d.ts +1 -1
  38. package/dist/lib/daemon-services.js +0 -5
  39. package/dist/lib/device-config.d.ts +2 -0
  40. package/dist/lib/device-config.js +81 -8
  41. package/dist/lib/devices/doctor-findings.d.ts +6 -1
  42. package/dist/lib/devices/doctor-findings.js +34 -1
  43. package/dist/lib/git.d.ts +1 -0
  44. package/dist/lib/git.js +5 -0
  45. package/dist/lib/hooks/install.d.ts +0 -7
  46. package/dist/lib/hooks/install.js +0 -55
  47. package/dist/lib/hosts/passthrough.js +2 -4
  48. package/dist/lib/hosts/progress.js +2 -2
  49. package/dist/lib/hosts/remote-cmd.js +0 -1
  50. package/dist/lib/installations/migrate.d.ts +1 -0
  51. package/dist/lib/installations/migrate.js +18 -1
  52. package/dist/lib/installations/versions.js +2 -2
  53. package/dist/lib/loop.js +1 -1
  54. package/dist/lib/mailbox-target.d.ts +0 -31
  55. package/dist/lib/mailbox-target.js +0 -37
  56. package/dist/lib/mcp-lookup.d.ts +7 -0
  57. package/dist/lib/mcp-lookup.js +71 -0
  58. package/dist/lib/mcp.d.ts +0 -8
  59. package/dist/lib/mcp.js +0 -47
  60. package/dist/lib/menubar/install-menubar.d.ts +0 -15
  61. package/dist/lib/menubar/install-menubar.js +24 -118
  62. package/dist/lib/menubar/resolve-version.d.ts +9 -10
  63. package/dist/lib/menubar/resolve-version.js +70 -30
  64. package/dist/lib/paths.d.ts +0 -1
  65. package/dist/lib/paths.js +0 -18
  66. package/dist/lib/plugins/skills.d.ts +0 -10
  67. package/dist/lib/plugins/skills.js +2 -165
  68. package/dist/lib/project-pull.js +1 -2
  69. package/dist/lib/resources.d.ts +1 -1
  70. package/dist/lib/routines-project.js +1 -1
  71. package/dist/lib/session/local-tmux-attach.js +2 -2
  72. package/dist/lib/startup/command-registry.js +20 -7
  73. package/dist/lib/teams/agents.js +1 -1
  74. package/dist/lib/triggers/webhook.d.ts +2 -59
  75. package/dist/lib/triggers/webhook.js +2 -422
  76. package/package.json +2 -1
  77. package/dist/commands/funnel.d.ts +0 -2
  78. package/dist/commands/funnel.js +0 -77
  79. package/dist/commands/logs.d.ts +0 -2
  80. package/dist/commands/mailboxes.d.ts +0 -2
  81. package/dist/commands/mailboxes.js +0 -400
  82. package/dist/commands/message.d.ts +0 -2
  83. package/dist/commands/message.js +0 -259
  84. package/dist/commands/packages-materialize.d.ts +0 -6
  85. package/dist/commands/packages-materialize.js +0 -90
  86. package/dist/commands/packages.d.ts +0 -5
  87. package/dist/commands/packages.js +0 -763
  88. package/dist/commands/route.d.ts +0 -2
  89. package/dist/commands/route.js +0 -259
  90. package/dist/commands/testdata/feed-hub.d.ts +0 -1
  91. package/dist/commands/testdata/feed-hub.js +0 -11
  92. package/dist/commands/tmux.d.ts +0 -7
  93. package/dist/commands/tmux.js +0 -529
  94. package/dist/commands/traces.d.ts +0 -2
  95. package/dist/commands/traces.js +0 -204
  96. package/dist/commands/webhook.d.ts +0 -5
  97. package/dist/commands/webhook.js +0 -105
  98. package/dist/lib/agent-spec/materialize.d.ts +0 -3
  99. package/dist/lib/agent-spec/materialize.js +0 -277
  100. package/dist/lib/agent-spec/package-resolve.d.ts +0 -4
  101. package/dist/lib/agent-spec/package-resolve.js +0 -231
  102. package/dist/lib/agent-spec/package-schema.d.ts +0 -3
  103. package/dist/lib/agent-spec/package-schema.js +0 -136
  104. package/dist/lib/agent-spec/package-types.d.ts +0 -94
  105. package/dist/lib/agent-spec/package-types.js +0 -10
  106. package/dist/lib/daemon/testdata/process-view-daemon.d.ts +0 -1
  107. package/dist/lib/daemon/testdata/process-view-daemon.js +0 -12
  108. package/dist/lib/daemon/testdata/process-view-start.d.ts +0 -1
  109. package/dist/lib/daemon/testdata/process-view-start.js +0 -41
  110. package/dist/lib/daemon/webhook-receiver-service.d.ts +0 -8
  111. package/dist/lib/daemon/webhook-receiver-service.js +0 -16
  112. package/dist/lib/daemon-webhooks.d.ts +0 -48
  113. package/dist/lib/daemon-webhooks.js +0 -177
  114. package/dist/lib/funnel.d.ts +0 -6
  115. package/dist/lib/funnel.js +0 -31
  116. package/dist/lib/net-close.d.ts +0 -2
  117. package/dist/lib/net-close.js +0 -20
  118. package/dist/lib/packages/output-home.d.ts +0 -9
  119. package/dist/lib/packages/output-home.js +0 -89
  120. package/dist/lib/registry.d.ts +0 -65
  121. package/dist/lib/registry.js +0 -432
  122. package/dist/lib/routers.d.ts +0 -25
  123. package/dist/lib/routers.js +0 -122
  124. package/dist/lib/run-trace-sync.d.ts +0 -7
  125. package/dist/lib/run-trace-sync.js +0 -35
  126. package/dist/lib/session/testdata/pid-registry-namespace.d.ts +0 -1
  127. package/dist/lib/session/testdata/pid-registry-namespace.js +0 -25
  128. package/dist/lib/session/testdata/process-view-namespace.d.ts +0 -1
  129. package/dist/lib/session/testdata/process-view-namespace.js +0 -56
  130. package/dist/lib/session/testdata/process-view-private.d.ts +0 -1
  131. package/dist/lib/session/testdata/process-view-private.js +0 -11
  132. package/dist/lib/testdata/daemon-health-writer.d.ts +0 -1
  133. package/dist/lib/testdata/daemon-health-writer.js +0 -8
  134. package/dist/lib/testdata/owner-notify-api.d.ts +0 -23
  135. package/dist/lib/testdata/owner-notify-api.js +0 -82
  136. package/dist/lib/testdata/refresh-coordinator-worker.d.ts +0 -1
  137. package/dist/lib/testdata/refresh-coordinator-worker.js +0 -23
  138. package/dist/lib/traces/backend.d.ts +0 -8
  139. package/dist/lib/traces/backend.js +0 -33
  140. package/dist/lib/traces/classify.d.ts +0 -40
  141. package/dist/lib/traces/classify.js +0 -70
  142. package/dist/lib/traces/config.d.ts +0 -2
  143. package/dist/lib/traces/config.js +0 -2
  144. package/dist/lib/traces/insights.d.ts +0 -30
  145. package/dist/lib/traces/insights.js +0 -198
  146. package/dist/lib/traces/phenotype.d.ts +0 -18
  147. package/dist/lib/traces/phenotype.js +0 -335
  148. package/dist/lib/traces/provision.d.ts +0 -16
  149. package/dist/lib/traces/provision.js +0 -25
  150. package/dist/lib/traces/schema2-build.d.ts +0 -28
  151. package/dist/lib/traces/schema2-build.js +0 -496
  152. package/dist/lib/traces/schema2-danger.d.ts +0 -7
  153. package/dist/lib/traces/schema2-danger.js +0 -123
  154. package/dist/lib/traces/schema2.d.ts +0 -139
  155. package/dist/lib/traces/schema2.js +0 -20
  156. package/dist/lib/traces/segments.d.ts +0 -73
  157. package/dist/lib/traces/segments.js +0 -236
  158. package/dist/lib/traces/sync.d.ts +0 -197
  159. package/dist/lib/traces/sync.js +0 -654
  160. package/dist/lib/traces/worker-template.d.ts +0 -1
  161. package/dist/lib/traces/worker-template.js +0 -292
  162. package/dist/lib/triggers/handlers.d.ts +0 -66
  163. package/dist/lib/triggers/handlers.js +0 -383
@@ -1,763 +0,0 @@
1
- import * as fs from 'fs';
2
- import chalk from 'chalk';
3
- import ora from 'ora';
4
- import { AGENTS, getAllCliStates, agentLabel, } from '../lib/agents.js';
5
- import { capableAgents } from '../lib/capabilities.js';
6
- import { DEFAULT_REGISTRIES } from '../lib/types.js';
7
- import { getRegistries, setRegistry, removeRegistry, search as searchRegistries, resolvePackage, validatedNpmSpec, validatedPyPISpec, verifySkillIntegrity, } from '../lib/registry.js';
8
- import { cloneRepo } from '../lib/git.js';
9
- import { discoverCommands, resolveCommandSource, installCommand, installCommandCentrally, } from '../lib/commands.js';
10
- import { discoverSkillsFromRepo, installSkill, installSkillCentrally, } from '../lib/plugins/skills.js';
11
- import { discoverHooksFromRepo, installHooks, installHooksCentrally, } from '../lib/hooks/install.js';
12
- import { discoverWorkflowsFromRepo, installWorkflowCentrally, } from '../lib/workflows.js';
13
- import { discoverSubagentsFromRepo, installSubagentCentrally, } from '../lib/subagents.js';
14
- import { discoverPermissionsFromRepo, installPermissionSet, } from '../lib/permissions.js';
15
- import { listInstalledVersions, resolveConfiguredAgentTargets, syncResourcesToVersion, } from '../lib/installations/versions.js';
16
- import { formatPath, isInteractiveTerminal, isPromptCancelled, parseCommaSeparatedList, requireDestructiveArg, requireInteractiveSelection, resolveInstalledAgentTargetsAutoInstalling, } from './utils.js';
17
- import { itemPicker } from '../lib/picker.js';
18
- import { registerMcpCommandToTargets, discoverMcpConfigsFromRepo, installMcpConfigCentrally, } from '../lib/mcp.js';
19
- import { registerPortablePackageCommands } from './packages-materialize.js';
20
- export function buildMcpPackageCommand(pkg) {
21
- const packageName = pkg.name || pkg.registry_name;
22
- if (pkg.runtime === 'node') {
23
- return { command: 'npx', args: ['-y', validatedNpmSpec(packageName)] };
24
- }
25
- if (pkg.runtime === 'python') {
26
- return { command: 'uvx', args: [validatedPyPISpec(packageName)] };
27
- }
28
- throw new Error(`Unsupported MCP runtime: ${pkg.runtime}. Supported: node, python.`);
29
- }
30
- async function pickRegistryName(type, verb, pred) {
31
- const registries = getRegistries(type);
32
- const entries = Object.entries(registries).filter(([, cfg]) => (pred ? pred(cfg) : true));
33
- if (entries.length === 0) {
34
- console.log(chalk.gray(`No ${type} registries to ${verb}.`));
35
- return null;
36
- }
37
- if (!isInteractiveTerminal()) {
38
- requireInteractiveSelection(`Picking a ${type} registry to ${verb}`, [
39
- `agents registry ${verb} ${type} <name>`,
40
- `agents registry list --type ${type}`,
41
- ]);
42
- }
43
- const nameW = Math.max(8, ...entries.map(([n]) => n.length));
44
- try {
45
- const picked = await itemPicker({
46
- message: `Select a ${type} registry to ${verb}:`,
47
- items: entries,
48
- filter: (q) => {
49
- const t = q.trim().toLowerCase();
50
- if (!t)
51
- return entries;
52
- return entries.filter(([n, cfg]) => `${n} ${cfg.url}`.toLowerCase().includes(t));
53
- },
54
- labelFor: ([n, cfg]) => {
55
- const status = cfg.enabled ? chalk.green('enabled') : chalk.gray('disabled');
56
- const isDefault = DEFAULT_REGISTRIES[type]?.[n] ? chalk.gray(' (default)') : '';
57
- return `${chalk.cyan(n.padEnd(nameW))}${isDefault} ${status} ${chalk.gray(cfg.url)}`;
58
- },
59
- shortIdFor: ([n]) => n,
60
- pageSize: 10,
61
- emptyMessage: 'No registries match.',
62
- enterHint: verb,
63
- });
64
- return picked?.item[0] ?? null;
65
- }
66
- catch (err) {
67
- if (isPromptCancelled(err))
68
- return null;
69
- throw err;
70
- }
71
- }
72
- export function registerPackagesCommands(program) {
73
- registerPortablePackageCommands(program);
74
- const registryCmd = program
75
- .command('registry')
76
- .description('Manage package registries');
77
- registryCmd
78
- .command('list')
79
- .description('List configured registries')
80
- .option('-t, --type <type>', 'Filter by type: mcp or skill')
81
- .action((options) => {
82
- const types = options.type ? [options.type] : ['mcp', 'skill'];
83
- console.log(chalk.bold('Configured Registries\n'));
84
- for (const type of types) {
85
- console.log(chalk.bold(` ${type.toUpperCase()}`));
86
- const registries = getRegistries(type);
87
- const entries = Object.entries(registries);
88
- if (entries.length === 0) {
89
- console.log(chalk.gray(' No registries configured'));
90
- }
91
- else {
92
- for (const [name, config] of entries) {
93
- const status = config.enabled ? chalk.green('enabled') : chalk.gray('disabled');
94
- const isDefault = DEFAULT_REGISTRIES[type]?.[name] ? chalk.gray(' (default)') : '';
95
- console.log(` ${name}${isDefault}: ${status}`);
96
- console.log(chalk.gray(` ${config.url}`));
97
- }
98
- }
99
- console.log();
100
- }
101
- console.log(chalk.gray(" See also: agents plugins marketplaces — plugin marketplaces (managed via 'agents repo')"));
102
- });
103
- registryCmd
104
- .command('add <type> <name> <url>')
105
- .description('Add a registry (type: mcp or skill)')
106
- .option('--api-key <key>', 'API key for authentication')
107
- .action((type, name, url, options) => {
108
- if (type !== 'mcp' && type !== 'skill') {
109
- console.log(chalk.red(`Invalid type '${type}'. Use 'mcp' or 'skill'.`));
110
- process.exit(1);
111
- }
112
- setRegistry(type, name, {
113
- url,
114
- enabled: true,
115
- apiKey: options.apiKey,
116
- });
117
- console.log(chalk.green(`Added ${type} registry '${name}'`));
118
- });
119
- registryCmd
120
- .command('remove <type> [name]')
121
- .description('Remove a registry')
122
- .action((type, nameArg) => {
123
- if (type !== 'mcp' && type !== 'skill') {
124
- console.log(chalk.red(`Invalid type '${type}'. Use 'mcp' or 'skill'.`));
125
- process.exit(1);
126
- }
127
- if (!nameArg) {
128
- const registries = getRegistries(type);
129
- const removable = Object.keys(registries).filter((n) => !DEFAULT_REGISTRIES[type]?.[n]);
130
- requireDestructiveArg({
131
- argName: 'name',
132
- command: `agents registry remove ${type}`,
133
- itemNoun: `${type} registry`,
134
- available: removable,
135
- emptyHint: `No user-added ${type} registries to remove. (Defaults can't be removed — disable them instead.)`,
136
- });
137
- }
138
- const name = nameArg;
139
- if (DEFAULT_REGISTRIES[type]?.[name]) {
140
- console.log(chalk.yellow(`Cannot remove default registry '${name}'. Use 'agents registry disable' instead.`));
141
- process.exit(1);
142
- }
143
- if (removeRegistry(type, name)) {
144
- console.log(chalk.green(`Removed ${type} registry '${name}'`));
145
- }
146
- else {
147
- console.log(chalk.yellow(`Registry '${name}' not found`));
148
- }
149
- });
150
- registryCmd
151
- .command('enable <type> [name]')
152
- .description('Enable a registry')
153
- .action(async (type, nameArg) => {
154
- if (type !== 'mcp' && type !== 'skill') {
155
- console.log(chalk.red(`Invalid type '${type}'. Use 'mcp' or 'skill'.`));
156
- process.exit(1);
157
- }
158
- let name = nameArg;
159
- if (!name) {
160
- const picked = await pickRegistryName(type, 'enable', (cfg) => !cfg.enabled);
161
- if (!picked)
162
- return;
163
- name = picked;
164
- }
165
- const registries = getRegistries(type);
166
- if (!registries[name]) {
167
- console.log(chalk.yellow(`Registry '${name}' not found`));
168
- process.exit(1);
169
- }
170
- setRegistry(type, name, { enabled: true });
171
- console.log(chalk.green(`Enabled ${type} registry '${name}'`));
172
- });
173
- registryCmd
174
- .command('disable <type> [name]')
175
- .description('Disable a registry')
176
- .action((type, nameArg) => {
177
- if (type !== 'mcp' && type !== 'skill') {
178
- console.log(chalk.red(`Invalid type '${type}'. Use 'mcp' or 'skill'.`));
179
- process.exit(1);
180
- }
181
- if (!nameArg) {
182
- const registries = getRegistries(type);
183
- const candidates = Object.entries(registries)
184
- .filter(([, cfg]) => cfg.enabled)
185
- .map(([n]) => n);
186
- requireDestructiveArg({
187
- argName: 'name',
188
- command: `agents registry disable ${type}`,
189
- itemNoun: `${type} registry`,
190
- available: candidates,
191
- emptyHint: `No enabled ${type} registries to disable.`,
192
- });
193
- }
194
- const name = nameArg;
195
- const registries = getRegistries(type);
196
- if (!registries[name]) {
197
- console.log(chalk.yellow(`Registry '${name}' not found`));
198
- process.exit(1);
199
- }
200
- setRegistry(type, name, { enabled: false });
201
- console.log(chalk.green(`Disabled ${type} registry '${name}'`));
202
- });
203
- registryCmd
204
- .command('config <type> [name]')
205
- .description('Configure a registry')
206
- .option('--api-key <key>', 'Set API key')
207
- .option('--url <url>', 'Update URL')
208
- .action(async (type, nameArg, options) => {
209
- if (type !== 'mcp' && type !== 'skill') {
210
- console.log(chalk.red(`Invalid type '${type}'. Use 'mcp' or 'skill'.`));
211
- process.exit(1);
212
- }
213
- let name = nameArg;
214
- if (!name) {
215
- const picked = await pickRegistryName(type, 'configure');
216
- if (!picked)
217
- return;
218
- name = picked;
219
- }
220
- const registries = getRegistries(type);
221
- if (!registries[name]) {
222
- console.log(chalk.yellow(`Registry '${name}' not found`));
223
- process.exit(1);
224
- }
225
- const updates = {};
226
- if (options.apiKey)
227
- updates.apiKey = options.apiKey;
228
- if (options.url)
229
- updates.url = options.url;
230
- if (Object.keys(updates).length === 0) {
231
- console.log(chalk.yellow('No options provided. Use --api-key or --url.'));
232
- process.exit(1);
233
- }
234
- setRegistry(type, name, updates);
235
- console.log(chalk.green(`Updated ${type} registry '${name}'`));
236
- });
237
- program
238
- .command('search <query>')
239
- .description('Find packages (MCP servers, skills) across configured registries')
240
- .option('-t, --type <type>', 'Limit to mcp or skill packages')
241
- .option('-r, --registry <name>', 'Search only this registry')
242
- .option('-l, --limit <n>', 'Max results to show', '20')
243
- .addHelpText('after', `
244
- Search finds MCP servers and skills published to registries. Results show the package name, description, and install command.
245
-
246
- Examples:
247
- # Search for MCP servers related to notion
248
- agents search notion
249
-
250
- # Search only skill packages
251
- agents search testing --type skill
252
-
253
- # Limit results to the first 10
254
- agents search api --limit 10
255
-
256
- # Search a specific registry
257
- agents search postgres --registry smithery
258
-
259
- When to use:
260
- - Finding MCP servers: 'agents search <keyword>' then 'agents install mcp:<name>'
261
- - Discovering skills: 'agents search <domain> --type skill'
262
- - Exploring registries: 'agents search <term> --registry <name>'
263
- `)
264
- .action(async (query, options) => {
265
- const spinner = ora('Searching registries...').start();
266
- try {
267
- const results = await searchRegistries(query, {
268
- type: options.type,
269
- registry: options.registry,
270
- limit: parseInt(options.limit, 10),
271
- });
272
- spinner.stop();
273
- if (results.length === 0) {
274
- console.log(chalk.yellow('\nNo packages found.'));
275
- return;
276
- }
277
- console.log(chalk.bold(`Found ${results.length} packages`));
278
- const mcpResults = results.filter((r) => r.type === 'mcp');
279
- const skillResults = results.filter((r) => r.type === 'skill');
280
- if (mcpResults.length > 0) {
281
- console.log(chalk.bold('\n MCP Servers'));
282
- for (const result of mcpResults) {
283
- const desc = result.description
284
- ? chalk.gray(` - ${result.description.slice(0, 50)}${result.description.length > 50 ? '...' : ''}`)
285
- : '';
286
- console.log(` ${chalk.cyan(result.name)}${desc}`);
287
- console.log(chalk.gray(` Registry: ${result.registry} Install: agents add mcp:${result.name}`));
288
- }
289
- }
290
- if (skillResults.length > 0) {
291
- console.log(chalk.bold('\n Skills'));
292
- for (const result of skillResults) {
293
- const desc = result.description
294
- ? chalk.gray(` - ${result.description.slice(0, 50)}${result.description.length > 50 ? '...' : ''}`)
295
- : '';
296
- console.log(` ${chalk.cyan(result.name)}${desc}`);
297
- console.log(chalk.gray(` Registry: ${result.registry} Install: agents add skill:${result.name}`));
298
- }
299
- }
300
- }
301
- catch (err) {
302
- spinner.fail('Search failed');
303
- console.error(chalk.red(err.message));
304
- process.exit(1);
305
- }
306
- });
307
- program
308
- .command('install <identifier>')
309
- .description('Install a package: mcp:, skill:, plugin:, or GitHub (gh:user/repo) — one install path (Phase 5)')
310
- .option('-a, --agents <list>', 'Targets: claude, codex@0.116.0, or cursor@default')
311
- .option('--types <list>', 'When source is a repo: comma-separated resource types to install (skills,workflows,commands,hooks,permissions,subagents,mcp)')
312
- .option('--names <list>', 'When source is a repo: comma-separated resource names within the selected types')
313
- .option('-y, --yes', 'Auto-install any missing agent versions without prompting')
314
- .option('--allow-exec-surfaces', 'With plugin: allow plugins that ship hooks/mcp/bin (same as agents plugins install)')
315
- .addHelpText('after', `
316
- Install is the unified add path (Phase 5 packaging). Prefix the identifier:
317
-
318
- mcp:<name> MCP server from a registry
319
- skill:<name> skill from a registry (or gh: fallback)
320
- plugin:<spec> plugin — same grammar as agents plugins install (name@url or path)
321
- gh:user/repo clone a DotAgents / multi-resource repo and install selected types
322
-
323
- Examples:
324
- agents install mcp:notion --agents claude
325
- agents install skill:animator --agents claude,codex
326
- agents install plugin:my-plugin@https://github.com/user/my-plugin.git
327
- agents install plugin:~/Projects/rush-toolkit
328
- agents install gh:anthropics/skills --agents codex,claude
329
- agents install gh:phnx-labs/.agents-system --types skills,workflows --agents claude@all
330
-
331
- Specialized verbs still work (agents plugins install, agents skills add) and
332
- delegate to the same underlying installers.
333
- `)
334
- .action(async (identifier, options) => {
335
- const spinner = ora('Resolving package...').start();
336
- try {
337
- const resolved = await resolvePackage(identifier);
338
- if (!resolved) {
339
- spinner.fail('Package not found');
340
- console.log(chalk.gray('\nTip: Use explicit prefix (mcp:, skill:, plugin:, gh:) or check the identifier.'));
341
- process.exit(1);
342
- }
343
- spinner.succeed(`Found ${resolved.type} package`);
344
- if (resolved.type === 'plugin') {
345
- spinner.stop();
346
- const spec = resolved.pluginSpec ?? resolved.source;
347
- console.log(chalk.gray(`Installing plugin from: ${spec}`));
348
- const { installPlugin, getPlugin, inspectPluginCapabilities, pluginCapabilityLabels, parseInstallSpec, checkPluginDependencies, hasPluginExecSurfaces, pluginSupportsAgent, syncPluginToVersion, pluginResourceGroups, } = await import('../lib/plugins/plugins.js');
349
- const { listInstalledVersions, getGlobalDefault, getVersionHomePath, syncResourcesToVersion } = await import('../lib/installations/versions.js');
350
- const { agentLabel } = await import('../lib/agents.js');
351
- let name;
352
- let root;
353
- try {
354
- const result = await installPlugin(spec);
355
- name = result.name;
356
- root = result.root;
357
- }
358
- catch (err) {
359
- console.log(chalk.red(`Install failed: ${err.message}`));
360
- process.exit(1);
361
- }
362
- const plugin = getPlugin(name);
363
- if (!plugin) {
364
- console.log(chalk.red(`Installed but could not load plugin '${name}'`));
365
- process.exit(1);
366
- }
367
- const capabilities = inspectPluginCapabilities(root);
368
- const allowExec = options.allowExecSurfaces === true;
369
- if (hasPluginExecSurfaces(capabilities) && !allowExec) {
370
- const source = parseInstallSpec(spec).source;
371
- console.error(chalk.red('Install refused: plugin ships executable surfaces:'));
372
- for (const label of pluginCapabilityLabels(capabilities)) {
373
- console.error(` ${label}`);
374
- }
375
- console.error(`Re-run with --allow-exec-surfaces if you trust the source: ${source}@HEAD`);
376
- fs.rmSync(root, { recursive: true, force: true });
377
- process.exit(1);
378
- }
379
- const missingDeps = checkPluginDependencies(plugin.manifest);
380
- if (missingDeps.length > 0) {
381
- console.log(chalk.yellow(`Warning: missing dependencies: ${missingDeps.join(', ')}`));
382
- console.log(chalk.gray('Install them with: agents install plugin:<name>@<source>'));
383
- }
384
- console.log();
385
- let synced = 0;
386
- for (const agentId of capableAgents('plugins')) {
387
- if (!pluginSupportsAgent(plugin, agentId))
388
- continue;
389
- const versions = listInstalledVersions(agentId);
390
- if (versions.length === 0)
391
- continue;
392
- const defaultVer = getGlobalDefault(agentId);
393
- const targetVersions = defaultVer ? [defaultVer] : [versions[versions.length - 1]];
394
- for (const version of targetVersions) {
395
- const didSync = allowExec
396
- ? syncPluginToVersion(plugin, agentId, getVersionHomePath(agentId, version), {
397
- allowExecSurfaces: true,
398
- }).success
399
- : syncResourcesToVersion(agentId, version, { plugins: [name] }).plugins.length > 0;
400
- if (didSync) {
401
- console.log(chalk.green(` Synced to ${agentLabel(agentId)}@${version}`));
402
- synced++;
403
- }
404
- }
405
- }
406
- if (synced === 0) {
407
- console.log(chalk.gray(' No supported agent versions installed — run "agents use <agent>@<version>" to sync.'));
408
- }
409
- console.log(chalk.bold(`\nInstalled ${plugin.name} v${plugin.manifest.version} to ${formatPath(root)}`));
410
- const groups = pluginResourceGroups(plugin);
411
- if (groups.length > 0) {
412
- for (const g of groups) {
413
- console.log(chalk.gray(` ${g.label}: ${g.items.slice(0, 8).join(', ')}${g.items.length > 8 ? '…' : ''}`));
414
- }
415
- }
416
- return;
417
- }
418
- if (resolved.type === 'mcp') {
419
- const entry = resolved.mcpEntry;
420
- if (!entry) {
421
- console.log(chalk.red('Failed to get MCP server details'));
422
- process.exit(1);
423
- }
424
- console.log(chalk.bold(`\n${entry.name}`));
425
- if (entry.description) {
426
- console.log(chalk.gray(` ${entry.description}`));
427
- }
428
- if (entry.repository?.url) {
429
- console.log(chalk.gray(` ${entry.repository.url}`));
430
- }
431
- const pkg = entry.packages?.[0];
432
- if (!pkg) {
433
- console.log(chalk.yellow('\nNo installable package found for this server.'));
434
- console.log(chalk.gray('You may need to install it manually.'));
435
- process.exit(1);
436
- }
437
- console.log(chalk.bold('\nPackage:'));
438
- console.log(` Name: ${pkg.name || pkg.registry_name}`);
439
- console.log(` Runtime: ${pkg.runtime || 'unknown'}`);
440
- console.log(` Transport: ${pkg.transport || 'stdio'}`);
441
- if (pkg.packageArguments && pkg.packageArguments.length > 0) {
442
- console.log(chalk.bold('\nRequired arguments:'));
443
- for (const arg of pkg.packageArguments) {
444
- const req = arg.required ? chalk.red('*') : '';
445
- console.log(` ${arg.name}${req}: ${arg.description || ''}`);
446
- }
447
- }
448
- let commandSpec;
449
- try {
450
- commandSpec = buildMcpPackageCommand(pkg);
451
- }
452
- catch (err) {
453
- console.log(chalk.red(err.message));
454
- process.exit(1);
455
- }
456
- const cliStates = await getAllCliStates();
457
- const installedAgents = capableAgents('mcp').filter((id) => cliStates[id]?.installed || listInstalledVersions(id).length > 0);
458
- let targets;
459
- if (options.agents) {
460
- const resolved = await resolveInstalledAgentTargetsAutoInstalling(options.agents, capableAgents('mcp'), { yes: options.yes });
461
- if (!resolved) {
462
- console.log(chalk.gray('Cancelled.'));
463
- return;
464
- }
465
- targets = resolved;
466
- }
467
- else {
468
- targets = resolveConfiguredAgentTargets(installedAgents, undefined, capableAgents('mcp'));
469
- }
470
- if (targets.selectedAgents.length === 0) {
471
- console.log(chalk.yellow('\nNo MCP-capable agents installed.'));
472
- process.exit(1);
473
- }
474
- console.log(chalk.bold('\nInstalling to agents...'));
475
- const results = await registerMcpCommandToTargets(targets, entry.name, commandSpec, 'user');
476
- for (const result of results) {
477
- const label = result.version ? `${agentLabel(result.agentId)}@${result.version}` : agentLabel(result.agentId);
478
- if (result.success) {
479
- console.log(` ${chalk.green('+')} ${label}`);
480
- }
481
- else {
482
- console.log(` ${chalk.red('x')} ${label}: ${result.error}`);
483
- }
484
- }
485
- console.log(chalk.green('\nMCP server installed.'));
486
- }
487
- else if (resolved.type === 'git' || resolved.type === 'skill') {
488
- console.log(chalk.bold(`\nInstalling from ${resolved.source}`));
489
- const { localPath } = await cloneRepo(resolved.source);
490
- if (resolved.type === 'skill' && resolved.skillEntry) {
491
- const check = verifySkillIntegrity(localPath, resolved.skillEntry);
492
- if (!check.ok) {
493
- console.log(chalk.red(`\n${check.error}`));
494
- process.exit(1);
495
- }
496
- if (resolved.skillEntry.sha256) {
497
- console.log(chalk.gray(` Integrity verified (sha256) for ${resolved.skillEntry.name}`));
498
- }
499
- }
500
- const requestedTypes = new Set(parseCommaSeparatedList(options.types));
501
- const includeType = (type) => requestedTypes.size === 0 || requestedTypes.has(type);
502
- const requestedNames = new Set(parseCommaSeparatedList(options.names));
503
- const nameFilter = (items) => {
504
- if (requestedNames.size === 0)
505
- return items;
506
- return items.filter((item) => requestedNames.has(item.name));
507
- };
508
- let commands = includeType('commands') ? discoverCommands(localPath) : [];
509
- let skills = includeType('skills') ? discoverSkillsFromRepo(localPath) : [];
510
- let hooks = includeType('hooks') ? discoverHooksFromRepo(localPath) : [];
511
- let workflows = includeType('workflows') ? discoverWorkflowsFromRepo(localPath) : [];
512
- let subagents = includeType('subagents') ? discoverSubagentsFromRepo(localPath) : [];
513
- let permissions = includeType('permissions') ? discoverPermissionsFromRepo(localPath) : [];
514
- let mcpServers = includeType('mcp') ? discoverMcpConfigsFromRepo(localPath) : [];
515
- if (requestedNames.size > 0) {
516
- const allNames = new Set([
517
- ...commands.map((c) => c.name),
518
- ...skills.map((s) => s.name),
519
- ...hooks,
520
- ...workflows.map((w) => w.name),
521
- ...subagents.map((s) => s.name),
522
- ...permissions.map((p) => p.name),
523
- ...mcpServers.map((s) => s.name),
524
- ]);
525
- const missing = [...requestedNames].filter((n) => !allNames.has(n));
526
- if (missing.length > 0) {
527
- console.log(chalk.red(`\nResource(s) not found in repo: ${missing.join(', ')}`));
528
- console.log(chalk.gray(`Available: ${[...allNames].sort().join(', ')}`));
529
- process.exit(1);
530
- }
531
- commands = nameFilter(commands);
532
- skills = nameFilter(skills);
533
- hooks = hooks.filter((h) => requestedNames.has(h));
534
- workflows = nameFilter(workflows);
535
- subagents = nameFilter(subagents);
536
- permissions = nameFilter(permissions);
537
- mcpServers = nameFilter(mcpServers);
538
- }
539
- const summary = [
540
- { kind: 'commands', count: commands.length },
541
- { kind: 'skills', count: skills.length },
542
- { kind: 'hooks', count: hooks.length },
543
- { kind: 'workflows', count: workflows.length },
544
- { kind: 'subagents', count: subagents.length },
545
- { kind: 'permissions', count: permissions.length },
546
- { kind: 'mcp', count: mcpServers.length },
547
- ].filter((s) => s.count > 0);
548
- if (summary.length === 0) {
549
- console.log(chalk.yellow('No installable content found in repository.'));
550
- if (requestedTypes.size > 0 || requestedNames.size > 0) {
551
- console.log(chalk.gray('Try removing --types/--names to see everything the repo offers.'));
552
- }
553
- process.exit(1);
554
- }
555
- console.log(chalk.bold('\nFound:'));
556
- for (const { kind, count } of summary) {
557
- console.log(` ${count} ${kind}`);
558
- }
559
- const gitCliStates = await getAllCliStates();
560
- const installedAgents = capableAgents('commands').filter((id) => gitCliStates[id]?.installed || listInstalledVersions(id).length > 0);
561
- let targets;
562
- if (options.agents) {
563
- const resolved = await resolveInstalledAgentTargetsAutoInstalling(options.agents, capableAgents('commands'), { yes: options.yes });
564
- if (!resolved) {
565
- console.log(chalk.gray('Cancelled.'));
566
- return;
567
- }
568
- targets = resolved;
569
- }
570
- else {
571
- targets = resolveConfiguredAgentTargets(installedAgents, undefined, capableAgents('commands'));
572
- }
573
- if (targets.selectedAgents.length === 0) {
574
- console.log(chalk.yellow('\nNo agents selected.'));
575
- return;
576
- }
577
- if (commands.length > 0) {
578
- console.log(chalk.bold('\nInstalling commands...'));
579
- let directInstalled = 0;
580
- let syncedVersions = 0;
581
- let failed = 0;
582
- for (const command of commands) {
583
- const sourcePath = resolveCommandSource(localPath, command.name);
584
- if (!sourcePath)
585
- continue;
586
- const centralResult = installCommandCentrally(sourcePath, command.name);
587
- if (!centralResult.success) {
588
- failed++;
589
- continue;
590
- }
591
- for (const agentId of targets.directAgents) {
592
- if (!AGENTS[agentId].capabilities.commands)
593
- continue;
594
- if (!gitCliStates[agentId]?.installed && listInstalledVersions(agentId).length === 0)
595
- continue;
596
- const result = installCommand(sourcePath, agentId, command.name, 'symlink');
597
- if (result.error) {
598
- failed++;
599
- }
600
- else {
601
- directInstalled++;
602
- }
603
- }
604
- }
605
- const commandNames = commands.map((command) => command.name);
606
- for (const [agentId, versions] of targets.versionSelections) {
607
- for (const version of versions) {
608
- const result = syncResourcesToVersion(agentId, version, { commands: commandNames });
609
- if (result.commands) {
610
- syncedVersions++;
611
- }
612
- }
613
- }
614
- console.log(` Installed ${directInstalled} direct command instance(s)`);
615
- console.log(` Synced commands to ${syncedVersions} managed version(s)`);
616
- if (failed > 0) {
617
- console.log(` ${failed} command installation(s) failed`);
618
- }
619
- }
620
- if (skills.length > 0) {
621
- console.log(chalk.bold('\nInstalling skills...'));
622
- const directAgents = targets.directAgents.filter((agentId) => AGENTS[agentId].capabilities.skills && gitCliStates[agentId]?.installed);
623
- let syncedVersions = 0;
624
- for (const skill of skills) {
625
- const centralResult = installSkillCentrally(skill.path, skill.name);
626
- if (!centralResult.success) {
627
- console.log(` ${chalk.red('x')} ${skill.name}: ${centralResult.error}`);
628
- continue;
629
- }
630
- const result = installSkill(skill.path, skill.name, directAgents);
631
- const status = result.success ? chalk.green('+') : chalk.red('x');
632
- const detail = result.success ? skill.name : `${skill.name}: ${result.error}`;
633
- console.log(` ${status} ${detail}`);
634
- }
635
- const skillNames = skills.map((skill) => skill.name);
636
- for (const [agentId, versions] of targets.versionSelections) {
637
- for (const version of versions) {
638
- const result = syncResourcesToVersion(agentId, version, { skills: skillNames });
639
- if (result.skills) {
640
- syncedVersions++;
641
- }
642
- }
643
- }
644
- console.log(` Synced skills to ${syncedVersions} managed version(s)`);
645
- }
646
- if (hooks.length > 0) {
647
- console.log(chalk.bold('\nInstalling hooks...'));
648
- let syncedVersions = 0;
649
- const directHookAgents = targets.directAgents.filter((id) => AGENTS[id].supportsHooks && gitCliStates[id]?.installed);
650
- const centralResult = await installHooksCentrally(localPath);
651
- const result = await installHooks(localPath, directHookAgents, { scope: 'user' });
652
- console.log(` Installed ${result.installed.length} direct hook instance(s)`);
653
- if (centralResult.errors.length > 0) {
654
- console.log(` ${centralResult.errors.length} hook installation(s) failed in central storage`);
655
- }
656
- const hookNames = hooks;
657
- for (const [agentId, versions] of targets.versionSelections) {
658
- for (const version of versions) {
659
- const syncResult = syncResourcesToVersion(agentId, version, { hooks: hookNames });
660
- if (syncResult.hooks) {
661
- syncedVersions++;
662
- }
663
- }
664
- }
665
- console.log(` Synced hooks to ${syncedVersions} managed version(s)`);
666
- }
667
- if (workflows.length > 0) {
668
- console.log(chalk.bold('\nInstalling workflows...'));
669
- let installed = 0;
670
- for (const w of workflows) {
671
- const result = installWorkflowCentrally(w.path, w.name);
672
- if (result.success) {
673
- installed++;
674
- }
675
- else {
676
- console.log(` ${chalk.red('x')} ${w.name}: ${result.error}`);
677
- }
678
- }
679
- const workflowNames = workflows.map((w) => w.name);
680
- let syncedVersions = 0;
681
- for (const [agentId, versions] of targets.versionSelections) {
682
- for (const version of versions) {
683
- const result = syncResourcesToVersion(agentId, version, { workflows: workflowNames });
684
- if (result.workflows.length > 0)
685
- syncedVersions++;
686
- }
687
- }
688
- console.log(` Installed ${installed} workflow(s) to ~/.agents/workflows/`);
689
- console.log(` Synced workflows to ${syncedVersions} managed version(s)`);
690
- }
691
- if (subagents.length > 0) {
692
- console.log(chalk.bold('\nInstalling subagents...'));
693
- let installed = 0;
694
- for (const s of subagents) {
695
- const result = installSubagentCentrally(s.path, s.name);
696
- if (result.success) {
697
- installed++;
698
- }
699
- else {
700
- console.log(` ${chalk.red('x')} ${s.name}: ${result.error}`);
701
- }
702
- }
703
- const subagentNames = subagents.map((s) => s.name);
704
- let syncedVersions = 0;
705
- for (const [agentId, versions] of targets.versionSelections) {
706
- for (const version of versions) {
707
- const result = syncResourcesToVersion(agentId, version, { subagents: subagentNames });
708
- if (result.subagents.length > 0)
709
- syncedVersions++;
710
- }
711
- }
712
- console.log(` Installed ${installed} subagent(s) to ~/.agents/subagents/`);
713
- console.log(` Synced subagents to ${syncedVersions} managed version(s)`);
714
- }
715
- if (permissions.length > 0) {
716
- console.log(chalk.bold('\nInstalling permission sets...'));
717
- let installed = 0;
718
- for (const p of permissions) {
719
- const result = installPermissionSet(p.path, p.name);
720
- if (result.success) {
721
- installed++;
722
- }
723
- else {
724
- console.log(` ${chalk.red('x')} ${p.name}: ${result.error}`);
725
- }
726
- }
727
- console.log(` Installed ${installed} permission set(s) to ~/.agents/permissions/`);
728
- console.log(chalk.gray(' Apply with: agents permissions apply <name> --agents <selector>'));
729
- }
730
- if (mcpServers.length > 0) {
731
- console.log(chalk.bold('\nInstalling MCP server configs...'));
732
- let installed = 0;
733
- for (const s of mcpServers) {
734
- const result = installMcpConfigCentrally(s.path);
735
- if (result.success) {
736
- installed++;
737
- }
738
- else {
739
- console.log(` ${chalk.red('x')} ${s.name}: ${result.error}`);
740
- }
741
- }
742
- const mcpNames = mcpServers.map((s) => s.name);
743
- let syncedVersions = 0;
744
- for (const [agentId, versions] of targets.versionSelections) {
745
- for (const version of versions) {
746
- const result = syncResourcesToVersion(agentId, version, { mcp: mcpNames });
747
- if (result.mcp.length > 0)
748
- syncedVersions++;
749
- }
750
- }
751
- console.log(` Installed ${installed} MCP config(s) to ~/.agents/mcp/`);
752
- console.log(` Synced MCP configs to ${syncedVersions} managed version(s)`);
753
- }
754
- console.log(chalk.green('\nPackage installed.'));
755
- }
756
- }
757
- catch (err) {
758
- spinner.fail('Installation failed');
759
- console.error(chalk.red(err.message));
760
- process.exit(1);
761
- }
762
- });
763
- }