@swarmify/agents-cli 1.5.21 → 1.5.23

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/dist/index.js CHANGED
@@ -18,8 +18,8 @@ function isPromptCancelled(err) {
18
18
  }
19
19
  import { AGENTS, ALL_AGENT_IDS, MCP_CAPABLE_AGENTS, SKILLS_CAPABLE_AGENTS, HOOKS_CAPABLE_AGENTS, getAllCliStates, getCliVersion, isMcpRegistered, registerMcp, unregisterMcp, listInstalledMcpsWithScope, promoteMcpToUser, } from './lib/agents.js';
20
20
  import { readManifest, writeManifest, createDefaultManifest, MANIFEST_FILENAME, } from './lib/manifest.js';
21
- import { readState, getRepoLocalPath, getScope, setScope, removeScope, getScopesByPriority, getScopePriority, } from './lib/state.js';
22
- import { SCOPE_PRIORITIES, DEFAULT_SYSTEM_REPO } from './lib/types.js';
21
+ import { readMeta, getRepoLocalPath, getRepo, setRepo, removeRepo, getReposByPriority, getRepoPriority, } from './lib/state.js';
22
+ import { REPO_PRIORITIES, DEFAULT_SYSTEM_REPO } from './lib/types.js';
23
23
  import { cloneRepo, parseSource, getGitHubUsername, getRemoteUrl, setRemoteUrl, checkGitHubRepoExists, commitAndPush, hasUncommittedChanges, } from './lib/git.js';
24
24
  import { discoverCommands, resolveCommandSource, installCommand, uninstallCommand, listInstalledCommandsWithScope, promoteCommandToUser, commandExists, commandContentMatches, } from './lib/commands.js';
25
25
  import { discoverHooksFromRepo, installHooks, listInstalledHooksWithScope, promoteHookToUser, removeHook, hookExists, hookContentMatches, getSourceHookEntry, } from './lib/hooks.js';
@@ -31,48 +31,47 @@ import { parseAgentSpec, installVersion, removeVersion, removeAllVersions, listI
31
31
  import { createShim, removeShim, shimExists, isShimsInPath, getPathSetupInstructions, getShimsDir, } from './lib/shims.js';
32
32
  const program = new Command();
33
33
  /**
34
- * Ensure at least one scope is configured.
35
- * If not, automatically initialize the system scope from DEFAULT_SYSTEM_REPO.
36
- * Returns the highest priority scope's source.
34
+ * Ensure at least one repo is configured.
35
+ * If not, automatically initialize the system repo from DEFAULT_SYSTEM_REPO.
36
+ * Returns the highest priority repo's source.
37
37
  */
38
- async function ensureSource(scopeName) {
39
- const meta = readState();
40
- // If specific scope requested, check if it exists
41
- if (scopeName) {
42
- const scope = meta.scopes[scopeName];
43
- if (scope?.source) {
44
- return scope.source;
45
- }
46
- throw new Error(`Scope '${scopeName}' not configured. Run: agents repo add <source> --scope ${scopeName}`);
47
- }
48
- // Check if any scope is configured
49
- const scopes = getScopesByPriority();
50
- if (scopes.length > 0) {
51
- // Return highest priority scope's source
52
- return scopes[scopes.length - 1].config.source;
53
- }
54
- // No scopes configured - initialize system scope
55
- console.log(chalk.gray(`No repo configured. Initializing system scope from ${DEFAULT_SYSTEM_REPO}...`));
38
+ async function ensureSource(repoName) {
39
+ const meta = readMeta();
40
+ // If specific repo requested, check if it exists
41
+ if (repoName) {
42
+ const repo = meta.repos[repoName];
43
+ if (repo?.source) {
44
+ return repo.source;
45
+ }
46
+ throw new Error(`Repo '${repoName}' not configured. Run: agents repo add <source> --name ${repoName}`);
47
+ }
48
+ // Check if any repo is configured
49
+ const repos = getReposByPriority();
50
+ if (repos.length > 0) {
51
+ return repos[repos.length - 1].config.source;
52
+ }
53
+ // No repos configured - initialize system repo
54
+ console.log(chalk.gray(`No repo configured. Initializing from ${DEFAULT_SYSTEM_REPO}...`));
56
55
  const parsed = parseSource(DEFAULT_SYSTEM_REPO);
57
56
  const { commit } = await cloneRepo(DEFAULT_SYSTEM_REPO);
58
- setScope('system', {
57
+ setRepo('system', {
59
58
  source: DEFAULT_SYSTEM_REPO,
60
59
  branch: parsed.ref || 'main',
61
60
  commit,
62
61
  lastSync: new Date().toISOString(),
63
- priority: SCOPE_PRIORITIES.system,
62
+ priority: REPO_PRIORITIES.system,
64
63
  readonly: true,
65
64
  });
66
65
  return DEFAULT_SYSTEM_REPO;
67
66
  }
68
67
  /**
69
- * Get repo local path for a scope.
68
+ * Get local path for a named repo.
70
69
  */
71
- function getScopeLocalPath(scopeName) {
72
- const scope = getScope(scopeName);
73
- if (!scope)
70
+ function getRepoPath(repoName) {
71
+ const repo = getRepo(repoName);
72
+ if (!repo)
74
73
  return null;
75
- return getRepoLocalPath(scope.source);
74
+ return getRepoLocalPath(repo.source);
76
75
  }
77
76
  program
78
77
  .name('agents')
@@ -104,7 +103,6 @@ Agents
104
103
  remove <agent>[@version] Remove agent CLI
105
104
  use <agent>@<version> Set default version
106
105
  list List installed versions
107
- upgrade [agent] Upgrade to latest
108
106
 
109
107
  Resources
110
108
  instructions Manage CLAUDE.md, GEMINI.md, etc.
@@ -177,7 +175,7 @@ async function checkForUpdates() {
177
175
  // Run update check before command runs
178
176
  program.hook('preAction', async () => {
179
177
  const args = process.argv.slice(2);
180
- const skipCommands = ['upgrade', '--version', '-V', '--help', '-h'];
178
+ const skipCommands = ['--version', '-V', '--help', '-h'];
181
179
  if (args.length === 0 || skipCommands.includes(args[0])) {
182
180
  return;
183
181
  }
@@ -237,7 +235,7 @@ program
237
235
  agent: AGENTS[agentId],
238
236
  instructions: listInstalledInstructionsWithScope(agentId, cwd),
239
237
  }));
240
- const scopes = filterAgentId ? [] : getScopesByPriority();
238
+ const scopes = filterAgentId ? [] : getReposByPriority();
241
239
  spinner.stop();
242
240
  // Helper to format MCP with version
243
241
  const formatMcp = (m, color) => {
@@ -395,39 +393,39 @@ program
395
393
  }
396
394
  }
397
395
  }
398
- const scopeName = options.scope;
399
- const meta = readState();
400
- const existingScope = meta.scopes[scopeName];
396
+ const repoName = options.scope;
397
+ const meta = readMeta();
398
+ const existingRepo = meta.repos[repoName];
401
399
  // Try: 1) provided source, 2) existing scope source, 3) fall back to system scope
402
- targetSource = targetSource || existingScope?.source;
403
- let effectiveScope = scopeName;
404
- if (!targetSource && scopeName === 'user') {
405
- const systemScope = meta.scopes['system'];
400
+ targetSource = targetSource || existingRepo?.source;
401
+ let effectiveRepo = repoName;
402
+ if (!targetSource && repoName === 'user') {
403
+ const systemScope = meta.repos['system'];
406
404
  if (systemScope?.source) {
407
405
  targetSource = systemScope.source;
408
- effectiveScope = 'system';
406
+ effectiveRepo = 'system';
409
407
  console.log(chalk.gray(`No user scope configured, using system scope: ${targetSource}\n`));
410
408
  }
411
409
  }
412
410
  if (!targetSource) {
413
- if (scopeName === 'user' && Object.keys(meta.scopes).length === 0) {
411
+ if (repoName === 'user' && Object.keys(meta.repos).length === 0) {
414
412
  console.log(chalk.gray(`First run detected. Initializing from ${DEFAULT_SYSTEM_REPO}...\n`));
415
413
  targetSource = DEFAULT_SYSTEM_REPO;
416
- effectiveScope = 'system';
414
+ effectiveRepo = 'system';
417
415
  }
418
416
  else {
419
- console.log(chalk.red(`No source specified for scope '${scopeName}'.`));
420
- const scopeHint = scopeName === 'user' ? '' : ` --scope ${scopeName}`;
417
+ console.log(chalk.red(`No source specified for scope '${repoName}'.`));
418
+ const scopeHint = repoName === 'user' ? '' : ` --scope ${repoName}`;
421
419
  console.log(chalk.gray(` Usage: agents pull <source>${scopeHint}`));
422
420
  console.log(chalk.gray(' Example: agents pull gh:username/.agents'));
423
421
  process.exit(1);
424
422
  }
425
423
  }
426
- const targetScopeConfig = meta.scopes[effectiveScope];
427
- const isReadonly = targetScopeConfig?.readonly || effectiveScope === 'system';
428
- const isUserScope = effectiveScope === 'user';
424
+ const targetRepoConfig = meta.repos[effectiveRepo];
425
+ const isReadonly = targetRepoConfig?.readonly || effectiveRepo === 'system';
426
+ const isUserScope = effectiveRepo === 'user';
429
427
  const parsed = parseSource(targetSource);
430
- const spinner = ora(`Syncing from ${effectiveScope} scope...`).start();
428
+ const spinner = ora(`Syncing from ${effectiveRepo} scope...`).start();
431
429
  try {
432
430
  const { localPath, commit, isNew } = await cloneRepo(targetSource);
433
431
  spinner.succeed(isNew ? 'Repository cloned' : 'Repository updated');
@@ -1034,18 +1032,17 @@ program
1034
1032
  }
1035
1033
  }
1036
1034
  // Sync CLI versions (user scope only)
1037
- if (isUserScope && !options.skipClis && manifest?.clis) {
1035
+ if (isUserScope && !options.skipClis && manifest?.agents) {
1038
1036
  const cliSpinner = ora('Checking CLI versions...').start();
1039
1037
  const cliUpdates = [];
1040
- for (const [agentIdStr, cliConfig] of Object.entries(manifest.clis)) {
1038
+ for (const [agentIdStr, targetVersion] of Object.entries(manifest.agents)) {
1041
1039
  const agentId = agentIdStr;
1042
1040
  if (agentFilter && agentId !== agentFilter)
1043
1041
  continue;
1044
1042
  const agent = AGENTS[agentId];
1045
- if (!agent || !cliConfig.package)
1043
+ if (!agent || !targetVersion)
1046
1044
  continue;
1047
1045
  const currentVersion = await getCliVersion(agentId);
1048
- const targetVersion = cliConfig.version;
1049
1046
  if (currentVersion === targetVersion)
1050
1047
  continue;
1051
1048
  if (targetVersion === 'latest' && currentVersion)
@@ -1054,7 +1051,7 @@ program
1054
1051
  }
1055
1052
  if (cliUpdates.length > 0) {
1056
1053
  cliSpinner.info('CLI version differences detected');
1057
- console.log(chalk.gray(' Run `agents cli upgrade` to update CLIs'));
1054
+ console.log(chalk.gray(' Run `agents add <agent>@latest` to update'));
1058
1055
  for (const update of cliUpdates) {
1059
1056
  console.log(chalk.gray(` ${update}`));
1060
1057
  }
@@ -1065,8 +1062,8 @@ program
1065
1062
  }
1066
1063
  // Update scope config
1067
1064
  if (!isReadonly) {
1068
- const priority = getScopePriority(effectiveScope);
1069
- setScope(effectiveScope, {
1065
+ const priority = getRepoPriority(effectiveRepo);
1066
+ setRepo(effectiveRepo, {
1070
1067
  source: targetSource,
1071
1068
  branch: parsed.ref || 'main',
1072
1069
  commit,
@@ -1075,7 +1072,7 @@ program
1075
1072
  readonly: false,
1076
1073
  });
1077
1074
  }
1078
- console.log(chalk.green(`\nSync complete from ${effectiveScope} scope`));
1075
+ console.log(chalk.green(`\nSync complete from ${effectiveRepo} scope`));
1079
1076
  }
1080
1077
  catch (err) {
1081
1078
  if (isPromptCancelled(err)) {
@@ -1098,15 +1095,15 @@ program
1098
1095
  .option('-m, --message <msg>', 'Commit message', 'Update agent configuration')
1099
1096
  .action(async (options) => {
1100
1097
  try {
1101
- const scopeName = options.scope;
1102
- const scope = getScope(scopeName);
1098
+ const repoName = options.scope;
1099
+ const scope = getRepo(repoName);
1103
1100
  if (!scope) {
1104
- console.log(chalk.red(`Scope '${scopeName}' not configured.`));
1101
+ console.log(chalk.red(`Scope '${repoName}' not configured.`));
1105
1102
  console.log(chalk.gray(' Run: agents pull'));
1106
1103
  process.exit(1);
1107
1104
  }
1108
1105
  if (scope.readonly) {
1109
- console.log(chalk.red(`Scope '${scopeName}' is readonly. Cannot push.`));
1106
+ console.log(chalk.red(`Scope '${repoName}' is readonly. Cannot push.`));
1110
1107
  process.exit(1);
1111
1108
  }
1112
1109
  const localPath = getRepoLocalPath(scope.source);
@@ -1118,11 +1115,8 @@ program
1118
1115
  const agent = AGENTS[agentId];
1119
1116
  const cli = cliStates[agentId];
1120
1117
  if (cli?.installed && cli.version) {
1121
- manifest.clis = manifest.clis || {};
1122
- manifest.clis[agentId] = {
1123
- package: agent.npmPackage,
1124
- version: cli.version,
1125
- };
1118
+ manifest.agents = manifest.agents || {};
1119
+ manifest.agents[agentId] = cli.version;
1126
1120
  console.log(` ${chalk.green('+')} ${agent.name} @ ${cli.version}`);
1127
1121
  exported++;
1128
1122
  }
@@ -1854,8 +1848,8 @@ instructionsCmd
1854
1848
  .description('Diff installed instructions against repo')
1855
1849
  .action(async (agentArg) => {
1856
1850
  const cwd = process.cwd();
1857
- const meta = readState();
1858
- const scopes = getScopesByPriority();
1851
+ const meta = readMeta();
1852
+ const scopes = getReposByPriority();
1859
1853
  if (scopes.length === 0) {
1860
1854
  console.log(chalk.yellow('No repo configured. Run: agents repo add <source>'));
1861
1855
  return;
@@ -1864,7 +1858,7 @@ instructionsCmd
1864
1858
  ? [resolveAgentName(agentArg)].filter(Boolean)
1865
1859
  : ALL_AGENT_IDS;
1866
1860
  const diff = await import('diff');
1867
- for (const { name: scopeName, config } of scopes) {
1861
+ for (const { name: repoName, config } of scopes) {
1868
1862
  const localPath = getRepoLocalPath(config.source);
1869
1863
  const repoInstructions = discoverInstructionsFromRepo(localPath);
1870
1864
  for (const agentId of agents) {
@@ -2208,11 +2202,8 @@ program
2208
2202
  const manifest = fs.existsSync(projectManifestPath)
2209
2203
  ? readManifest(process.cwd()) || createDefaultManifest()
2210
2204
  : createDefaultManifest();
2211
- manifest.clis = manifest.clis || {};
2212
- manifest.clis[agent] = {
2213
- package: agentConfig.npmPackage,
2214
- version: version === 'latest' ? (await getInstalledVersionForAgent(agent, version)) : version,
2215
- };
2205
+ manifest.agents = manifest.agents || {};
2206
+ manifest.agents[agent] = version === 'latest' ? (await getInstalledVersionForAgent(agent, version)) : version;
2216
2207
  writeManifest(process.cwd(), manifest);
2217
2208
  console.log(chalk.green(` Pinned ${agentConfig.name}@${version} in .agents/agents.yaml`));
2218
2209
  }
@@ -2275,8 +2266,8 @@ program
2275
2266
  const projectManifestPath = path.join(process.cwd(), '.agents', 'agents.yaml');
2276
2267
  if (fs.existsSync(projectManifestPath)) {
2277
2268
  const manifest = readManifest(process.cwd());
2278
- if (manifest?.clis?.[agent]) {
2279
- delete manifest.clis[agent];
2269
+ if (manifest?.agents?.[agent]) {
2270
+ delete manifest.agents[agent];
2280
2271
  writeManifest(process.cwd(), manifest);
2281
2272
  console.log(chalk.gray(` Removed from .agents/agents.yaml`));
2282
2273
  }
@@ -2297,17 +2288,27 @@ program
2297
2288
  }
2298
2289
  const { agent, version } = parsed;
2299
2290
  const agentConfig = AGENTS[agent];
2291
+ let selectedVersion = version;
2300
2292
  if (!spec.includes('@') || version === 'latest') {
2301
- console.log(chalk.red('Please specify a version: agents use <agent>@<version>'));
2293
+ // Interactive version picker
2302
2294
  const versions = listInstalledVersions(agent);
2303
- if (versions.length > 0) {
2304
- console.log(chalk.gray(`Installed versions: ${versions.join(', ')}`));
2295
+ if (versions.length === 0) {
2296
+ console.log(chalk.red(`No versions of ${agentConfig.name} installed`));
2297
+ console.log(chalk.gray(`Run: agents add ${agent}@latest`));
2298
+ return;
2305
2299
  }
2306
- return;
2300
+ const globalDefault = getGlobalDefault(agent);
2301
+ selectedVersion = await select({
2302
+ message: `Select ${agentConfig.name} version:`,
2303
+ choices: versions.map((v) => ({
2304
+ name: v === globalDefault ? `${v} (current default)` : v,
2305
+ value: v,
2306
+ })),
2307
+ });
2307
2308
  }
2308
- if (!isVersionInstalled(agent, version)) {
2309
- console.log(chalk.red(`${agentConfig.name}@${version} not installed`));
2310
- console.log(chalk.gray(`Run: agents add ${agent}@${version}`));
2309
+ if (!isVersionInstalled(agent, selectedVersion)) {
2310
+ console.log(chalk.red(`${agentConfig.name}@${selectedVersion} not installed`));
2311
+ console.log(chalk.gray(`Run: agents add ${agent}@${selectedVersion}`));
2311
2312
  return;
2312
2313
  }
2313
2314
  if (options.project) {
@@ -2320,25 +2321,24 @@ program
2320
2321
  const manifest = fs.existsSync(projectManifestPath)
2321
2322
  ? readManifest(process.cwd()) || createDefaultManifest()
2322
2323
  : createDefaultManifest();
2323
- manifest.clis = manifest.clis || {};
2324
- manifest.clis[agent] = {
2325
- package: agentConfig.npmPackage,
2326
- version,
2327
- };
2324
+ manifest.agents = manifest.agents || {};
2325
+ manifest.agents[agent] = selectedVersion;
2328
2326
  writeManifest(process.cwd(), manifest);
2329
- console.log(chalk.green(`Set ${agentConfig.name}@${version} for this project`));
2327
+ console.log(chalk.green(`Set ${agentConfig.name}@${selectedVersion} for this project`));
2330
2328
  }
2331
2329
  else {
2332
2330
  // Set global default
2333
- setGlobalDefault(agent, version);
2334
- console.log(chalk.green(`Set ${agentConfig.name}@${version} as global default`));
2331
+ setGlobalDefault(agent, selectedVersion);
2332
+ console.log(chalk.green(`Set ${agentConfig.name}@${selectedVersion} as global default`));
2335
2333
  }
2336
2334
  });
2337
2335
  program
2338
2336
  .command('list [agent]')
2339
2337
  .description('List installed agent CLI versions')
2340
2338
  .action(async (agentArg) => {
2339
+ const spinner = ora('Checking installed agents...').start();
2341
2340
  const cliStates = await getAllCliStates();
2341
+ spinner.stop();
2342
2342
  // Resolve agent filter
2343
2343
  let filterAgentId;
2344
2344
  if (agentArg) {
@@ -2431,53 +2431,12 @@ function getProjectVersionFromCwd(agent) {
2431
2431
  }
2432
2432
  try {
2433
2433
  const manifest = readManifest(process.cwd());
2434
- return manifest?.clis?.[agent]?.version || null;
2434
+ return manifest?.agents?.[agent] || null;
2435
2435
  }
2436
2436
  catch {
2437
2437
  return null;
2438
2438
  }
2439
2439
  }
2440
- program
2441
- .command('upgrade [agent]')
2442
- .description('Upgrade agent CLI versions')
2443
- .option('-p, --project', 'Upgrade to version in project manifest')
2444
- .action(async (agent, options) => {
2445
- const agentsToUpgrade = agent
2446
- ? [agent.toLowerCase()]
2447
- : ALL_AGENT_IDS.filter((id) => listInstalledVersions(id).length > 0);
2448
- if (agentsToUpgrade.length === 0) {
2449
- console.log(chalk.yellow('No agent CLIs installed. Run: agents add <agent>@<version>'));
2450
- return;
2451
- }
2452
- for (const agentId of agentsToUpgrade) {
2453
- const agentConfig = AGENTS[agentId];
2454
- if (!agentConfig) {
2455
- console.log(chalk.red(`Unknown agent: ${agentId}`));
2456
- continue;
2457
- }
2458
- // Determine target version
2459
- let targetVersion = 'latest';
2460
- if (options.project) {
2461
- const projectVersion = getProjectVersionFromCwd(agentId);
2462
- if (projectVersion) {
2463
- targetVersion = projectVersion;
2464
- }
2465
- }
2466
- const spinner = ora(`Upgrading ${agentConfig.name} to ${targetVersion}...`).start();
2467
- const result = await installVersion(agentId, targetVersion, (msg) => {
2468
- spinner.text = msg;
2469
- });
2470
- if (result.success) {
2471
- spinner.succeed(`Upgraded ${agentConfig.name} to ${result.installedVersion}`);
2472
- // Update global default to new version
2473
- setGlobalDefault(agentId, result.installedVersion);
2474
- }
2475
- else {
2476
- spinner.fail(`Failed to upgrade ${agentConfig.name}`);
2477
- console.error(chalk.gray(result.error || 'Unknown error'));
2478
- }
2479
- }
2480
- });
2481
2440
  // =============================================================================
2482
2441
  // REPO COMMANDS
2483
2442
  // =============================================================================
@@ -2488,7 +2447,7 @@ repoCmd
2488
2447
  .command('list')
2489
2448
  .description('List configured scopes')
2490
2449
  .action(() => {
2491
- const scopes = getScopesByPriority();
2450
+ const scopes = getReposByPriority();
2492
2451
  if (scopes.length === 0) {
2493
2452
  console.log(chalk.yellow('No scopes configured.'));
2494
2453
  console.log(chalk.gray(' Run: agents repo add <source>'));
@@ -2514,11 +2473,11 @@ repoCmd
2514
2473
  .option('-s, --scope <scope>', 'Target scope', 'user')
2515
2474
  .option('-y, --yes', 'Skip confirmation prompts')
2516
2475
  .action(async (source, options) => {
2517
- const scopeName = options.scope;
2518
- const existingScope = getScope(scopeName);
2519
- if (existingScope && !options.yes) {
2476
+ const repoName = options.scope;
2477
+ const existingRepo = getRepo(repoName);
2478
+ if (existingRepo && !options.yes) {
2520
2479
  const shouldOverwrite = await confirm({
2521
- message: `Scope '${scopeName}' already exists (${existingScope.source}). Overwrite?`,
2480
+ message: `Scope '${repoName}' already exists (${existingRepo.source}). Overwrite?`,
2522
2481
  default: false,
2523
2482
  });
2524
2483
  if (!shouldOverwrite) {
@@ -2526,26 +2485,26 @@ repoCmd
2526
2485
  return;
2527
2486
  }
2528
2487
  }
2529
- if (existingScope?.readonly && !options.yes) {
2530
- console.log(chalk.red(`Scope '${scopeName}' is readonly. Cannot overwrite.`));
2488
+ if (existingRepo?.readonly && !options.yes) {
2489
+ console.log(chalk.red(`Scope '${repoName}' is readonly. Cannot overwrite.`));
2531
2490
  return;
2532
2491
  }
2533
2492
  const parsed = parseSource(source);
2534
- const spinner = ora(`Cloning repository for ${scopeName} scope...`).start();
2493
+ const spinner = ora(`Cloning repository for ${repoName} scope...`).start();
2535
2494
  try {
2536
2495
  const { commit, isNew } = await cloneRepo(source);
2537
2496
  spinner.succeed(isNew ? 'Repository cloned' : 'Repository updated');
2538
- const priority = getScopePriority(scopeName);
2539
- setScope(scopeName, {
2497
+ const priority = getRepoPriority(repoName);
2498
+ setRepo(repoName, {
2540
2499
  source,
2541
2500
  branch: parsed.ref || 'main',
2542
2501
  commit,
2543
2502
  lastSync: new Date().toISOString(),
2544
2503
  priority,
2545
- readonly: scopeName === 'system',
2504
+ readonly: repoName === 'system',
2546
2505
  });
2547
- console.log(chalk.green(`\nAdded scope '${scopeName}' with priority ${priority}`));
2548
- const scopeHint = scopeName === 'user' ? '' : ` --scope ${scopeName}`;
2506
+ console.log(chalk.green(`\nAdded scope '${repoName}' with priority ${priority}`));
2507
+ const scopeHint = repoName === 'user' ? '' : ` --scope ${repoName}`;
2549
2508
  console.log(chalk.gray(` Run: agents pull${scopeHint} to sync commands`));
2550
2509
  }
2551
2510
  catch (err) {
@@ -2558,19 +2517,19 @@ repoCmd
2558
2517
  .command('remove <scope>')
2559
2518
  .description('Remove a scope')
2560
2519
  .option('-y, --yes', 'Skip confirmation prompts')
2561
- .action(async (scopeName, options) => {
2562
- const existingScope = getScope(scopeName);
2563
- if (!existingScope) {
2564
- console.log(chalk.yellow(`Scope '${scopeName}' not found.`));
2520
+ .action(async (repoName, options) => {
2521
+ const existingRepo = getRepo(repoName);
2522
+ if (!existingRepo) {
2523
+ console.log(chalk.yellow(`Scope '${repoName}' not found.`));
2565
2524
  return;
2566
2525
  }
2567
- if (existingScope.readonly) {
2568
- console.log(chalk.red(`Scope '${scopeName}' is readonly. Cannot remove.`));
2526
+ if (existingRepo.readonly) {
2527
+ console.log(chalk.red(`Scope '${repoName}' is readonly. Cannot remove.`));
2569
2528
  return;
2570
2529
  }
2571
2530
  if (!options.yes) {
2572
2531
  const shouldRemove = await confirm({
2573
- message: `Remove scope '${scopeName}' (${existingScope.source})?`,
2532
+ message: `Remove scope '${repoName}' (${existingRepo.source})?`,
2574
2533
  default: false,
2575
2534
  });
2576
2535
  if (!shouldRemove) {
@@ -2578,12 +2537,12 @@ repoCmd
2578
2537
  return;
2579
2538
  }
2580
2539
  }
2581
- const removed = removeScope(scopeName);
2540
+ const removed = removeRepo(repoName);
2582
2541
  if (removed) {
2583
- console.log(chalk.green(`Removed scope '${scopeName}'`));
2542
+ console.log(chalk.green(`Removed scope '${repoName}'`));
2584
2543
  }
2585
2544
  else {
2586
- console.log(chalk.yellow(`Failed to remove scope '${scopeName}'`));
2545
+ console.log(chalk.yellow(`Failed to remove scope '${repoName}'`));
2587
2546
  }
2588
2547
  });
2589
2548
  // =============================================================================