@xyz-credit/agent-cli 1.3.0 → 1.3.2
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/package.json +1 -1
- package/src/commands/auth.js +1 -1
- package/src/commands/setup.js +58 -14
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyz-credit/agent-cli",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "CLI for onboarding AI agents to xyz.credit — Device Flow Auth, MCP Bridge, Service Marketplace, Daemonization & Cloud Export",
|
|
5
5
|
"bin": {
|
|
6
6
|
"xyz-agent": "./bin/xyz-agent.js"
|
package/src/commands/auth.js
CHANGED
|
@@ -43,7 +43,7 @@ async function authCommand() {
|
|
|
43
43
|
type: 'input',
|
|
44
44
|
name: 'platformUrl',
|
|
45
45
|
message: 'Platform URL:',
|
|
46
|
-
default: config.get('platformUrl') || 'https://
|
|
46
|
+
default: config.get('platformUrl') || 'https://thread-debug.preview.emergentagent.com',
|
|
47
47
|
validate: (v) => v.startsWith('http') ? true : 'Must be a valid URL',
|
|
48
48
|
}]);
|
|
49
49
|
|
package/src/commands/setup.js
CHANGED
|
@@ -99,14 +99,50 @@ async function setupCommand() {
|
|
|
99
99
|
if (isAuthenticated()) {
|
|
100
100
|
const creds = getCredentials();
|
|
101
101
|
console.log(chalk.yellow(` Existing agent found: ${creds.agentName} (${creds.agentId.slice(0, 12)}...)`));
|
|
102
|
-
const {
|
|
103
|
-
type: '
|
|
104
|
-
message: '
|
|
102
|
+
const { action } = await inquirer.prompt([{
|
|
103
|
+
type: 'list', name: 'action',
|
|
104
|
+
message: 'What would you like to do?',
|
|
105
|
+
choices: [
|
|
106
|
+
{ name: 'Start agent with existing configuration', value: 'start' },
|
|
107
|
+
{ name: 'Reconfigure from scratch (keep agent)', value: 'reconfigure' },
|
|
108
|
+
{ name: 'Remove existing agent & create new one', value: 'remove' },
|
|
109
|
+
{ name: 'Exit', value: 'exit' },
|
|
110
|
+
],
|
|
105
111
|
}]);
|
|
106
|
-
|
|
112
|
+
|
|
113
|
+
if (action === 'start') {
|
|
107
114
|
console.log(chalk.green(' Using existing configuration.\n'));
|
|
115
|
+
console.log(chalk.dim(' Launching agent...\n'));
|
|
116
|
+
const { startCommand } = require('./start');
|
|
117
|
+
await startCommand({});
|
|
108
118
|
return;
|
|
109
119
|
}
|
|
120
|
+
|
|
121
|
+
if (action === 'remove') {
|
|
122
|
+
const { confirmRemove } = await inquirer.prompt([{
|
|
123
|
+
type: 'confirm', name: 'confirmRemove',
|
|
124
|
+
message: chalk.red('This will delete your local agent credentials. Are you sure?'),
|
|
125
|
+
default: false,
|
|
126
|
+
}]);
|
|
127
|
+
if (!confirmRemove) {
|
|
128
|
+
console.log(chalk.yellow(' Cancelled. Keeping existing agent.\n'));
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
// Clear stored credentials
|
|
132
|
+
config.delete('agentId');
|
|
133
|
+
config.delete('agentName');
|
|
134
|
+
config.delete('apiKey');
|
|
135
|
+
config.delete('agentId');
|
|
136
|
+
console.log(chalk.green(' Agent credentials removed. Starting fresh setup...\n'));
|
|
137
|
+
// Fall through to full setup below
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (action === 'exit') {
|
|
141
|
+
console.log(chalk.dim(' Goodbye.\n'));
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// 'reconfigure' and 'remove' both fall through to the full setup wizard
|
|
110
146
|
}
|
|
111
147
|
|
|
112
148
|
// ── Step 1: Platform URL ──
|
|
@@ -114,7 +150,7 @@ async function setupCommand() {
|
|
|
114
150
|
const { platformUrl } = await inquirer.prompt([{
|
|
115
151
|
type: 'input', name: 'platformUrl',
|
|
116
152
|
message: 'Platform URL:',
|
|
117
|
-
default: config.get('platformUrl') || 'https://
|
|
153
|
+
default: config.get('platformUrl') || 'https://thread-debug.preview.emergentagent.com',
|
|
118
154
|
validate: (v) => v.startsWith('http') ? true : 'Must start with http(s)://',
|
|
119
155
|
}]);
|
|
120
156
|
|
|
@@ -264,23 +300,31 @@ async function setupCommand() {
|
|
|
264
300
|
// ── Auto boot-up ──
|
|
265
301
|
console.log('');
|
|
266
302
|
console.log(boxen(
|
|
267
|
-
chalk.green.bold('
|
|
303
|
+
chalk.green.bold(' Configuration Complete!\n\n') +
|
|
268
304
|
chalk.white(` Platform: ${chalk.cyan(platformUrl)}\n`) +
|
|
269
305
|
chalk.white(` LLM: ${chalk.cyan(llmProvider)} ${llmValidated ? chalk.green('(validated)') : chalk.yellow('(unverified)')}\n`) +
|
|
270
|
-
chalk.white(` MCP: ${mcpUrl ? chalk.cyan(mcpUrl) : chalk.dim('Not configured')}
|
|
271
|
-
chalk.dim(' Next steps:\n') +
|
|
272
|
-
chalk.white(` 1. ${chalk.cyan('xyz-agent auth')} Authenticate your agent\n`) +
|
|
273
|
-
chalk.white(` 2. ${chalk.cyan('xyz-agent connect')} Bridge your MCP tools\n`) +
|
|
274
|
-
chalk.white(` 3. ${chalk.cyan('xyz-agent register-service')} Publish to marketplace\n`) +
|
|
275
|
-
chalk.white(` 4. ${chalk.cyan('xyz-agent start')} Start the agent with dashboard`),
|
|
306
|
+
chalk.white(` MCP: ${mcpUrl ? chalk.cyan(mcpUrl) : chalk.dim('Not configured')}`),
|
|
276
307
|
{ padding: 1, margin: 1, borderColor: 'green', borderStyle: 'round', title: 'Ready', titleAlignment: 'center' }
|
|
277
308
|
));
|
|
278
309
|
|
|
279
|
-
// If already authenticated,
|
|
310
|
+
// If already authenticated, go straight to start
|
|
311
|
+
if (isAuthenticated()) {
|
|
312
|
+
console.log(chalk.green('\n Agent already authenticated. Launching...\n'));
|
|
313
|
+
const { startCommand } = require('./start');
|
|
314
|
+
await startCommand({});
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
// Not authenticated — proceed to auth flow automatically
|
|
319
|
+
console.log(chalk.bold.cyan('\n Proceeding to agent authentication...\n'));
|
|
320
|
+
const { authCommand } = require('./auth');
|
|
321
|
+
await authCommand();
|
|
322
|
+
|
|
323
|
+
// After auth, if now authenticated, start the agent
|
|
280
324
|
if (isAuthenticated()) {
|
|
281
325
|
const { autoStart } = await inquirer.prompt([{
|
|
282
326
|
type: 'confirm', name: 'autoStart',
|
|
283
|
-
message: '
|
|
327
|
+
message: 'Authentication complete. Start the agent now?',
|
|
284
328
|
default: true,
|
|
285
329
|
}]);
|
|
286
330
|
if (autoStart) {
|