@myvillage/cli 1.81.0 → 1.82.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myvillage/cli",
3
- "version": "1.81.0",
3
+ "version": "1.82.0",
4
4
  "description": "MyVillageOS CLI for community developers",
5
5
  "type": "module",
6
6
  "bin": {
@@ -88,6 +88,19 @@ export async function agentCreateCommand() {
88
88
  return agentCreateLocalCommand();
89
89
  }
90
90
 
91
+ // Fetch the caller's existing agents to offer as parent choices for the
92
+ // org-chart hierarchy. Failure here is non-fatal — just skip the picker.
93
+ let parentChoices = [];
94
+ try {
95
+ const existing = await listMyAgents();
96
+ const mine = existing.data || existing;
97
+ if (Array.isArray(mine)) {
98
+ parentChoices = mine.map(a => ({ name: `@${a.handle} — ${a.displayName}`, value: a.id }));
99
+ }
100
+ } catch {
101
+ parentChoices = [];
102
+ }
103
+
91
104
  // External agent flow (existing behavior)
92
105
  const answers = await inquirer.prompt([
93
106
  {
@@ -178,6 +191,19 @@ export async function agentCreateCommand() {
178
191
  default: false,
179
192
  when: (a) => a.agentCategory !== 'NETWORK',
180
193
  },
194
+ // Organizational hierarchy + grouping (applies to all categories).
195
+ {
196
+ type: 'input',
197
+ name: 'tags',
198
+ message: 'Tags for grouping (comma-separated, e.g. research, marketing):',
199
+ },
200
+ {
201
+ type: 'list',
202
+ name: 'parentId',
203
+ message: 'Parent agent (for your org chart — organizational only, no control granted):',
204
+ choices: [{ name: 'None (top-level)', value: null }, ...parentChoices],
205
+ when: () => parentChoices.length > 0,
206
+ },
181
207
  {
182
208
  type: 'confirm',
183
209
  name: 'confirm',
@@ -214,6 +240,10 @@ export async function agentCreateCommand() {
214
240
  data.inputRequired = answers.inputRequired || false;
215
241
  }
216
242
 
243
+ // Hierarchy + tags
244
+ data.tags = answers.tags ? answers.tags.split(',').map(t => t.trim()).filter(Boolean) : [];
245
+ if (answers.parentId) data.parentId = answers.parentId;
246
+
217
247
  const result = await apiCreateAgent(data);
218
248
  spinner.succeed('Agent created!');
219
249
 
@@ -277,6 +307,21 @@ export async function agentEditCommand(handle) {
277
307
 
278
308
  spinner.stop();
279
309
 
310
+ // Other agents the caller owns become candidate parents (exclude self to
311
+ // avoid the trivial cycle; deeper cycles are rejected by the backend).
312
+ let parentChoices = [];
313
+ try {
314
+ const existing = await listMyAgents();
315
+ const mine = existing.data || existing;
316
+ if (Array.isArray(mine)) {
317
+ parentChoices = mine
318
+ .filter(a => a.id !== agent.id)
319
+ .map(a => ({ name: `@${a.handle} — ${a.displayName}`, value: a.id }));
320
+ }
321
+ } catch {
322
+ parentChoices = [];
323
+ }
324
+
280
325
  const category = agent.agentCategory || 'NETWORK';
281
326
  const categoryLabel = category === 'NETWORK' ? brand.gold('[NETWORK]')
282
327
  : category === 'WORKFLOW' ? chalk.yellow('[WORKFLOW]')
@@ -358,6 +403,23 @@ export async function agentEditCommand(handle) {
358
403
  );
359
404
  }
360
405
 
406
+ // Organizational hierarchy + grouping (applies to all categories).
407
+ prompts.push({
408
+ type: 'input',
409
+ name: 'tags',
410
+ message: 'Tags for grouping (comma-separated):',
411
+ default: agent.tags?.join(', ') || '',
412
+ });
413
+ if (parentChoices.length > 0) {
414
+ prompts.push({
415
+ type: 'list',
416
+ name: 'parentId',
417
+ message: 'Parent agent (organizational only):',
418
+ choices: [{ name: 'None (top-level)', value: null }, ...parentChoices],
419
+ default: agent.parentId || null,
420
+ });
421
+ }
422
+
361
423
  const answers = await inquirer.prompt(prompts);
362
424
 
363
425
  const saveSpinner = villageSpinner('Saving changes...').start();
@@ -379,6 +441,11 @@ export async function agentEditCommand(handle) {
379
441
  data.inputRequired = answers.inputRequired || false;
380
442
  }
381
443
 
444
+ // Hierarchy + tags. tags is always prompted; parentId only when choices
445
+ // existed (null = detach from current parent, sent explicitly).
446
+ data.tags = answers.tags ? answers.tags.split(',').map(t => t.trim()).filter(Boolean) : [];
447
+ if (answers.parentId !== undefined) data.parentId = answers.parentId;
448
+
382
449
  await apiUpdateAgent(agent.id, data);
383
450
  saveSpinner.succeed(`Agent @${handle} updated!`);
384
451
  } catch (err) {
@@ -338,6 +338,12 @@ export function formatAgentCard(agent) {
338
338
  if (agent.interests?.length) {
339
339
  lines.push(` ${chalk.dim('Interests:')} ${agent.interests.map(t => chalk.cyan(t)).join(', ')}`);
340
340
  }
341
+ if (agent.tags?.length) {
342
+ lines.push(` ${chalk.dim('Tags:')} ${agent.tags.map(t => brand.gold(t)).join(', ')}`);
343
+ }
344
+ if (agent.parentId) {
345
+ lines.push(` ${chalk.dim('Parent:')} ${chalk.dim(agent.parentId)}`);
346
+ }
341
347
 
342
348
  // Workflow fields (WORKFLOW and HYBRID)
343
349
  if (agent.agentCategory && agent.agentCategory !== 'NETWORK') {