@phnx-labs/agents-cli 1.20.86 → 1.20.88

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 (82) hide show
  1. package/CHANGELOG.md +172 -0
  2. package/README.md +3 -3
  3. package/dist/bin/agents +0 -0
  4. package/dist/commands/doctor.d.ts +0 -19
  5. package/dist/commands/doctor.js +219 -305
  6. package/dist/commands/exec.js +7 -19
  7. package/dist/commands/inspect.js +3 -5
  8. package/dist/commands/routines.js +2 -2
  9. package/dist/commands/sessions-browser.d.ts +18 -0
  10. package/dist/commands/sessions-browser.js +126 -24
  11. package/dist/commands/sessions-picker.d.ts +21 -8
  12. package/dist/commands/sessions-picker.js +83 -7
  13. package/dist/commands/sessions.d.ts +19 -0
  14. package/dist/commands/sessions.js +148 -18
  15. package/dist/commands/ssh.js +62 -4
  16. package/dist/commands/teams-picker.d.ts +2 -0
  17. package/dist/commands/teams-picker.js +2 -1
  18. package/dist/commands/teams.d.ts +4 -1
  19. package/dist/commands/teams.js +106 -70
  20. package/dist/commands/usage.d.ts +3 -2
  21. package/dist/commands/usage.js +2 -9
  22. package/dist/commands/view.js +14 -3
  23. package/dist/index.js +31 -1
  24. package/dist/lib/agents.d.ts +31 -1
  25. package/dist/lib/agents.js +55 -0
  26. package/dist/lib/claude-account-token.d.ts +12 -0
  27. package/dist/lib/claude-account-token.js +63 -0
  28. package/dist/lib/command-skills.d.ts +10 -0
  29. package/dist/lib/command-skills.js +14 -0
  30. package/dist/lib/commands.js +19 -1
  31. package/dist/lib/daemon.js +17 -2
  32. package/dist/lib/devices/doctor-findings.d.ts +167 -0
  33. package/dist/lib/devices/doctor-findings.js +893 -0
  34. package/dist/lib/devices/fleet-divergence.d.ts +22 -0
  35. package/dist/lib/devices/fleet-divergence.js +34 -10
  36. package/dist/lib/devices/fleet-inventory.d.ts +17 -6
  37. package/dist/lib/devices/fleet-inventory.js +56 -8
  38. package/dist/lib/devices/registry.d.ts +25 -0
  39. package/dist/lib/devices/registry.js +82 -1
  40. package/dist/lib/events.d.ts +8 -1
  41. package/dist/lib/events.js +13 -0
  42. package/dist/lib/exec.d.ts +14 -3
  43. package/dist/lib/exec.js +51 -9
  44. package/dist/lib/format.d.ts +7 -0
  45. package/dist/lib/format.js +11 -0
  46. package/dist/lib/menubar/MenubarHelper.app/Contents/MacOS/MenubarHelper +0 -0
  47. package/dist/lib/project-resources.js +34 -20
  48. package/dist/lib/runner.d.ts +14 -1
  49. package/dist/lib/runner.js +37 -8
  50. package/dist/lib/sandbox.d.ts +2 -0
  51. package/dist/lib/sandbox.js +38 -0
  52. package/dist/lib/secrets/Agents CLI.app/Contents/CodeResources +0 -0
  53. package/dist/lib/secrets/Agents CLI.app/Contents/MacOS/Agents CLI +0 -0
  54. package/dist/lib/secrets/rc-hygiene.d.ts +0 -6
  55. package/dist/lib/secrets/rc-hygiene.js +0 -24
  56. package/dist/lib/session/active.d.ts +6 -6
  57. package/dist/lib/session/active.js +6 -6
  58. package/dist/lib/session/db.d.ts +21 -0
  59. package/dist/lib/session/db.js +45 -4
  60. package/dist/lib/session/discover.d.ts +5 -0
  61. package/dist/lib/session/discover.js +137 -1
  62. package/dist/lib/session/parse.d.ts +2 -0
  63. package/dist/lib/session/parse.js +76 -37
  64. package/dist/lib/session/remote-list.d.ts +7 -0
  65. package/dist/lib/session/remote-list.js +8 -4
  66. package/dist/lib/session/state.js +69 -2
  67. package/dist/lib/session/sync/agents.js +0 -0
  68. package/dist/lib/session/team-filter.d.ts +22 -3
  69. package/dist/lib/session/team-filter.js +106 -17
  70. package/dist/lib/session/types.d.ts +9 -1
  71. package/dist/lib/session/types.js +1 -1
  72. package/dist/lib/signin-badge.d.ts +17 -0
  73. package/dist/lib/signin-badge.js +19 -0
  74. package/dist/lib/staleness/detectors/commands.js +14 -5
  75. package/dist/lib/staleness/types.d.ts +2 -0
  76. package/dist/lib/staleness/writers/commands.js +13 -7
  77. package/dist/lib/state.d.ts +2 -0
  78. package/dist/lib/state.js +2 -0
  79. package/dist/lib/usage.d.ts +72 -1
  80. package/dist/lib/usage.js +22 -87
  81. package/dist/lib/versions.js +30 -13
  82. package/package.json +1 -1
@@ -43,7 +43,7 @@ import { discoverPlugins, marketplaceSpecForName } from './plugins.js';
43
43
  import { loadManifest, saveManifest, buildManifest as buildSyncManifest, isStale } from './staleness/index.js';
44
44
  import { emit } from './events.js';
45
45
  import { safeJoin } from './paths.js';
46
- import { readSkillSourceCommandMarker, shouldInstallCommandAsSkill } from './command-skills.js';
46
+ import { readSkillSourceCommandMarker, shouldAlsoInstallCommandAsSkill, shouldInstallCommandAsSkill, } from './command-skills.js';
47
47
  import { getWriter, getDetector } from './staleness/registry.js';
48
48
  import { syncMemoryToVersionHome } from './memory.js';
49
49
  import { listPluginSkillNames, resolveCommandSource, resolveSkillSource } from './staleness/writers/sources.js';
@@ -2555,21 +2555,30 @@ export function syncResourcesToVersion(agent, version, selection, options = {})
2555
2555
  };
2556
2556
  const trustedCommandNames = (names) => names.filter((name) => resolveCommandSource(name) !== null);
2557
2557
  // Sync commands — dispatch through WRITERS.commands. The writer dispatches
2558
- // between native (file copy / TOML conversion) and commands-as-skills
2559
- // (grok, Codex >= 0.117.0) based on `shouldInstallCommandAsSkill`. The
2560
- // previous COMMANDS_CAPABLE_AGENTS gate excluded grok even though it
2561
- // takes the commands-as-skills path — silently dropping every command.
2558
+ // between native (file copy / TOML conversion), commands-as-skills, and the
2559
+ // registry-driven dual-write path based on the command-skill predicates. The
2560
+ // previous COMMANDS_CAPABLE_AGENTS gate excluded skills-only targets such as
2561
+ // Kimi, silently dropping every converted command.
2562
2562
  const commandsWriter = getWriter('commands', agent);
2563
2563
  const commandsToSync = selection
2564
2564
  ? trustedCommandNames(resolveSelection(selection.commands, available.commands))
2565
2565
  : trustedCommandNames(available.commands); // No selection = sync all trusted commands, excluding project-only commands
2566
2566
  const commandsAsSkills = shouldInstallCommandAsSkill(agent, version);
2567
+ const commandsAlsoAsSkills = shouldAlsoInstallCommandAsSkill(agent, version);
2568
+ const commandsInstallAsSkills = commandsAsSkills || commandsAlsoAsSkills;
2569
+ let writtenCommands = [];
2567
2570
  if (commandsToSync.length > 0 && commandsWriter) {
2568
- const commandsTarget = path.join(agentDir, agentConfig.commandsSubdir);
2571
+ // Agents that replace native command files with skills (codex >= 0.117.0,
2572
+ // kimi) must have their legacy command dir removed, or files written by an
2573
+ // older version linger forever: the orphan sweep below is gated off for
2574
+ // them, and `agents prune` only sees their skills. Gated on
2575
+ // `commandsAsSkills`, never `commandsAlsoAsSkills` -- a dual-write agent's
2576
+ // native dir is a live product surface (Cursor IDE) and must not be wiped.
2569
2577
  if (commandsAsSkills && agentConfig.commandsSubdir) {
2570
- removePath(commandsTarget);
2578
+ removePath(path.join(agentDir, agentConfig.commandsSubdir));
2571
2579
  }
2572
2580
  const r = commandsWriter.write({ version, versionHome, selection: commandsToSync, cwd });
2581
+ writtenCommands = r.synced;
2573
2582
  result.commands = r.synced.length > 0;
2574
2583
  }
2575
2584
  // Orphan-sweep stale top-level command files from previous syncs under a
@@ -2584,13 +2593,19 @@ export function syncResourcesToVersion(agent, version, selection, options = {})
2584
2593
  if (fs.existsSync(commandsTargetSweep)) {
2585
2594
  const ext = agentConfig.format === 'toml' ? '.toml' : '.md';
2586
2595
  const trustedCommands = new Set(commandsToSync);
2596
+ // A dual-write target's native directory also belongs to another product
2597
+ // surface (Cursor IDE). Delete only names the command writer recorded as
2598
+ // successfully emitted during the preceding full sync.
2599
+ const previouslyManagedCommands = commandsAlsoAsSkills
2600
+ ? new Set(loadManifest(agent, version)?.writtenCommands ?? [])
2601
+ : null;
2587
2602
  for (const entry of fs.readdirSync(commandsTargetSweep, { withFileTypes: true })) {
2588
2603
  if (!entry.isFile() || entry.name.startsWith('.'))
2589
2604
  continue;
2590
2605
  if (!entry.name.endsWith(ext))
2591
2606
  continue;
2592
2607
  const name = entry.name.slice(0, -ext.length);
2593
- if (!trustedCommands.has(name)) {
2608
+ if (!trustedCommands.has(name) && (!previouslyManagedCommands || previouslyManagedCommands.has(name))) {
2594
2609
  removePath(safeJoin(commandsTargetSweep, entry.name));
2595
2610
  }
2596
2611
  }
@@ -2612,7 +2627,7 @@ export function syncResourcesToVersion(agent, version, selection, options = {})
2612
2627
  let skillsToSync = userPassedSelection
2613
2628
  ? selectedSkillsToSync
2614
2629
  : Array.from(new Set([...selectedSkillsToSync, ...pluginSkillsToSync]));
2615
- if (commandsAsSkills && commandsToSync.length > 0 && skillsToSync.length > 0) {
2630
+ if (commandsInstallAsSkills && commandsToSync.length > 0 && skillsToSync.length > 0) {
2616
2631
  const commandNames = new Set(commandsToSync);
2617
2632
  const skillRoots = [
2618
2633
  path.join(getUserAgentsDir(), 'skills'),
@@ -2639,13 +2654,13 @@ export function syncResourcesToVersion(agent, version, selection, options = {})
2639
2654
  // dot-dirs to keep plugin-managed subtrees (.plugins/, .promptcuts) intact.
2640
2655
  const skillsTargetSweep = path.join(agentDir, 'skills');
2641
2656
  if (!userPassedSelection && fs.existsSync(skillsTargetSweep) && !fs.lstatSync(skillsTargetSweep).isSymbolicLink()) {
2642
- // Trust real skills AND command-skills: when commandsAsSkills, the
2657
+ // Trust real skills AND command-skills: when commandsInstallAsSkills, the
2643
2658
  // commands writer (above) materialized each command as a skill dir under
2644
2659
  // skills/. Those names are not in skillsToSync, so without this they'd be
2645
2660
  // swept as orphans — silently deleting every converted command (e.g.
2646
- // /recap on kimi/grok).
2661
+ // /recap on Kimi or newer Codex releases).
2647
2662
  const trustedSkills = new Set(skillsToSync);
2648
- if (commandsAsSkills)
2663
+ if (commandsInstallAsSkills)
2649
2664
  for (const cmd of commandsToSync)
2650
2665
  trustedSkills.add(cmd);
2651
2666
  for (const entry of fs.readdirSync(skillsTargetSweep, { withFileTypes: true })) {
@@ -2866,7 +2881,9 @@ export function syncResourcesToVersion(agent, version, selection, options = {})
2866
2881
  // one-off override, so the resulting state matches what the manifest
2867
2882
  // records as the synced set.
2868
2883
  if (!userPassedSelection) {
2869
- saveManifest(agent, version, buildSyncManifest(agent, version, cwd));
2884
+ const manifest = buildSyncManifest(agent, version, cwd);
2885
+ manifest.writtenCommands = writtenCommands;
2886
+ saveManifest(agent, version, manifest);
2870
2887
  }
2871
2888
  return result;
2872
2889
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phnx-labs/agents-cli",
3
- "version": "1.20.86",
3
+ "version": "1.20.88",
4
4
  "description": "One CLI for all your AI coding agents - versions, config, cloud dispatch, sessions, and teams (now with first-class Grok Build CLI support)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",