@orchagent/cli 0.2.18 → 0.2.19

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.
@@ -23,14 +23,30 @@ async function promptConfirm(message) {
23
23
  const answer = await promptText(`${message} (y/N): `);
24
24
  return answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes';
25
25
  }
26
+ function parseAgentArg(value) {
27
+ const atIndex = value.lastIndexOf('@');
28
+ if (atIndex === -1 || atIndex === 0) {
29
+ return { name: value, version: 'latest' };
30
+ }
31
+ return {
32
+ name: value.slice(0, atIndex),
33
+ version: value.slice(atIndex + 1) || 'latest',
34
+ };
35
+ }
26
36
  function registerDeleteCommand(program) {
27
37
  program
28
- .command('delete <agent-name>')
38
+ .command('delete <agent>')
29
39
  .description('Delete an agent')
30
- .option('--version <version>', 'Specific version to delete (default: latest)')
31
40
  .option('-y, --yes', 'Skip confirmation prompt')
32
41
  .option('--dry-run', 'Show what would be deleted without making changes')
33
- .action(async (agentName, options) => {
42
+ .addHelpText('after', `
43
+ Examples:
44
+ orch delete my-agent # Delete latest version
45
+ orch delete my-agent@v1 # Delete specific version
46
+ orch delete my-agent --dry-run # Preview deletion
47
+ `)
48
+ .action(async (agent, options) => {
49
+ const { name: agentName, version } = parseAgentArg(agent);
34
50
  const config = await (0, config_1.getResolvedConfig)();
35
51
  if (!config.apiKey) {
36
52
  throw new errors_1.CliError('Not logged in. Run `orch login` first.');
@@ -43,21 +59,21 @@ function registerDeleteCommand(program) {
43
59
  throw new errors_1.CliError(`Agent '${agentName}' not found`);
44
60
  }
45
61
  // Select version
46
- let agent;
47
- if (options.version) {
48
- agent = matching.find(a => a.version === options.version);
49
- if (!agent) {
50
- throw new errors_1.CliError(`Version '${options.version}' not found for agent '${agentName}'`);
62
+ let selectedAgent;
63
+ if (version !== 'latest') {
64
+ selectedAgent = matching.find(a => a.version === version);
65
+ if (!selectedAgent) {
66
+ throw new errors_1.CliError(`Version '${version}' not found for agent '${agentName}'`);
51
67
  }
52
68
  }
53
69
  else {
54
70
  // Get latest version
55
- agent = matching.sort((a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime())[0];
71
+ selectedAgent = matching.sort((a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime())[0];
56
72
  }
57
73
  // Check if confirmation is required
58
- const deleteCheck = await (0, api_1.checkAgentDelete)(config, agent.id);
74
+ const deleteCheck = await (0, api_1.checkAgentDelete)(config, selectedAgent.id);
59
75
  // Show agent info
60
- process.stdout.write(`\n${chalk_1.default.bold('Agent:')} ${agent.name}@${agent.version}\n`);
76
+ process.stdout.write(`\n${chalk_1.default.bold('Agent:')} ${selectedAgent.name}@${selectedAgent.version}\n`);
61
77
  if (deleteCheck.stars_count > 0 || deleteCheck.fork_count > 0) {
62
78
  process.stdout.write(`${chalk_1.default.bold('Stars:')} ${deleteCheck.stars_count} ${chalk_1.default.bold('Forks:')} ${deleteCheck.fork_count}\n`);
63
79
  }
@@ -65,7 +81,7 @@ function registerDeleteCommand(program) {
65
81
  // Handle dry-run
66
82
  if (options.dryRun) {
67
83
  process.stdout.write('\nDRY RUN - No changes will be made\n\n');
68
- process.stdout.write(`Would delete: ${agent.name}@${agent.version}\n`);
84
+ process.stdout.write(`Would delete: ${selectedAgent.name}@${selectedAgent.version}\n`);
69
85
  if (deleteCheck.stars_count > 0 || deleteCheck.fork_count > 0) {
70
86
  process.stdout.write(chalk_1.default.yellow('Warning: This agent has stars or forks\n'));
71
87
  }
@@ -77,14 +93,14 @@ function registerDeleteCommand(program) {
77
93
  if (!options.yes) {
78
94
  if (deleteCheck.requires_confirmation) {
79
95
  process.stdout.write(chalk_1.default.yellow('Warning: This agent has stars or forks. Type the agent name to confirm deletion.\n\n'));
80
- const confirmName = await promptText(`Type "${agent.name}" to confirm deletion: `);
81
- if (confirmName !== agent.name) {
96
+ const confirmName = await promptText(`Type "${selectedAgent.name}" to confirm deletion: `);
97
+ if (confirmName !== selectedAgent.name) {
82
98
  process.stdout.write(chalk_1.default.red('\nDeletion cancelled. Name did not match.\n'));
83
99
  process.exit(1);
84
100
  }
85
101
  }
86
102
  else {
87
- const confirmed = await promptConfirm(`Delete ${agent.name}@${agent.version}?`);
103
+ const confirmed = await promptConfirm(`Delete ${selectedAgent.name}@${selectedAgent.version}?`);
88
104
  if (!confirmed) {
89
105
  process.stdout.write(chalk_1.default.gray('Deletion cancelled.\n'));
90
106
  process.exit(0);
@@ -93,10 +109,10 @@ function registerDeleteCommand(program) {
93
109
  }
94
110
  // Perform deletion
95
111
  process.stdout.write('Deleting agent...\n');
96
- const confirmationName = deleteCheck.requires_confirmation ? agent.name : undefined;
97
- await (0, api_1.deleteAgent)(config, agent.id, confirmationName);
98
- await (0, analytics_1.track)('cli_delete', { agent_name: agent.name, version: agent.version });
99
- process.stdout.write(`✓ Deleted ${agent.name}@${agent.version}\n`);
112
+ const confirmationName = deleteCheck.requires_confirmation ? selectedAgent.name : undefined;
113
+ await (0, api_1.deleteAgent)(config, selectedAgent.id, confirmationName);
114
+ await (0, analytics_1.track)('cli_delete', { agent_name: selectedAgent.name, version: selectedAgent.version });
115
+ process.stdout.write(`✓ Deleted ${selectedAgent.name}@${selectedAgent.version}\n`);
100
116
  process.stdout.write(chalk_1.default.gray('\nData will be retained for 30 days before permanent deletion.\n'));
101
117
  });
102
118
  }
@@ -135,6 +135,25 @@ function registerPublishCommand(program) {
135
135
  if (!manifest.name) {
136
136
  throw new errors_1.CliError('orchagent.json must have name');
137
137
  }
138
+ // Check for misplaced manifest fields at top level (common user error)
139
+ const manifestFields = ['manifest_version', 'dependencies', 'max_hops', 'timeout_ms', 'per_call_downstream_cap'];
140
+ const misplacedFields = manifestFields.filter(f => f in manifest && !manifest.manifest);
141
+ if (misplacedFields.length > 0) {
142
+ throw new errors_1.CliError(`Found manifest fields (${misplacedFields.join(', ')}) at top level of orchagent.json.\n` +
143
+ `These must be nested under a "manifest" key. Example:\n\n` +
144
+ ` {\n` +
145
+ ` "name": "${manifest.name}",\n` +
146
+ ` "type": "${manifest.type || 'code'}",\n` +
147
+ ` "manifest": {\n` +
148
+ ` "manifest_version": 1,\n` +
149
+ ` "dependencies": [...],\n` +
150
+ ` "max_hops": 2,\n` +
151
+ ` "timeout_ms": 60000,\n` +
152
+ ` "per_call_downstream_cap": 50\n` +
153
+ ` }\n` +
154
+ ` }\n\n` +
155
+ `See docs/manifest.md for details.`);
156
+ }
138
157
  // Read prompt (for prompt-based agents and skills)
139
158
  let prompt;
140
159
  if (manifest.type === 'prompt' || manifest.type === 'skill') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orchagent/cli",
3
- "version": "0.2.18",
3
+ "version": "0.2.19",
4
4
  "description": "Command-line interface for the OrchAgent AI agent marketplace",
5
5
  "license": "MIT",
6
6
  "author": "OrchAgent <hello@orchagent.io>",