@phnx-labs/agents-cli 1.20.4 → 1.20.5
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/CHANGELOG.md +19 -0
- package/README.md +48 -17
- package/dist/commands/cli.js +1 -1
- package/dist/commands/cloud.js +1 -1
- package/dist/commands/commands.js +2 -0
- package/dist/commands/doctor.js +1 -1
- package/dist/commands/exec.js +52 -16
- package/dist/commands/hooks.js +6 -6
- package/dist/commands/inspect.d.ts +26 -0
- package/dist/commands/inspect.js +590 -0
- package/dist/commands/mcp.js +17 -16
- package/dist/commands/models.js +1 -1
- package/dist/commands/packages.js +6 -4
- package/dist/commands/permissions.js +13 -12
- package/dist/commands/plugins.d.ts +13 -0
- package/dist/commands/plugins.js +100 -11
- package/dist/commands/prune.js +3 -2
- package/dist/commands/pull.d.ts +12 -5
- package/dist/commands/pull.js +26 -422
- package/dist/commands/push.d.ts +14 -0
- package/dist/commands/push.js +30 -0
- package/dist/commands/repo.d.ts +1 -1
- package/dist/commands/repo.js +155 -112
- package/dist/commands/resource-view.d.ts +2 -0
- package/dist/commands/resource-view.js +12 -3
- package/dist/commands/routines.js +32 -7
- package/dist/commands/rules.js +1 -1
- package/dist/commands/sessions.js +1 -0
- package/dist/commands/setup.d.ts +3 -3
- package/dist/commands/setup.js +15 -15
- package/dist/commands/skills.js +6 -5
- package/dist/commands/subagents.js +5 -4
- package/dist/commands/sync.d.ts +18 -5
- package/dist/commands/sync.js +251 -65
- package/dist/commands/teams.js +1 -0
- package/dist/commands/tmux.d.ts +25 -0
- package/dist/commands/tmux.js +415 -0
- package/dist/commands/trash.d.ts +2 -2
- package/dist/commands/trash.js +1 -1
- package/dist/commands/versions.js +2 -2
- package/dist/commands/view.js +9 -4
- package/dist/commands/workflows.js +4 -3
- package/dist/commands/worktree.d.ts +4 -5
- package/dist/commands/worktree.js +4 -4
- package/dist/index.js +68 -20
- package/dist/lib/agents.d.ts +19 -10
- package/dist/lib/agents.js +79 -25
- package/dist/lib/auto-pull-worker.d.ts +1 -1
- package/dist/lib/auto-pull-worker.js +2 -2
- package/dist/lib/auto-pull.d.ts +1 -1
- package/dist/lib/auto-pull.js +1 -1
- package/dist/lib/beta.d.ts +1 -1
- package/dist/lib/beta.js +1 -1
- package/dist/lib/capabilities.js +2 -0
- package/dist/lib/commands.d.ts +28 -1
- package/dist/lib/commands.js +125 -20
- package/dist/lib/doctor-diff.js +2 -2
- package/dist/lib/exec.d.ts +14 -0
- package/dist/lib/exec.js +39 -5
- package/dist/lib/fuzzy.d.ts +12 -2
- package/dist/lib/fuzzy.js +29 -4
- package/dist/lib/git.js +8 -1
- package/dist/lib/hooks.d.ts +2 -2
- package/dist/lib/hooks.js +97 -10
- package/dist/lib/mcp.js +32 -2
- package/dist/lib/migrate.d.ts +51 -0
- package/dist/lib/migrate.js +227 -1
- package/dist/lib/models.js +62 -15
- package/dist/lib/permissions.d.ts +36 -2
- package/dist/lib/permissions.js +217 -7
- package/dist/lib/plugin-marketplace.d.ts +98 -40
- package/dist/lib/plugin-marketplace.js +196 -93
- package/dist/lib/plugins.d.ts +21 -4
- package/dist/lib/plugins.js +130 -49
- package/dist/lib/profiles-presets.js +12 -12
- package/dist/lib/project-launch.d.ts +65 -0
- package/dist/lib/project-launch.js +367 -0
- package/dist/lib/pty-client.js +1 -1
- package/dist/lib/pty-server.d.ts +1 -1
- package/dist/lib/pty-server.js +1 -1
- package/dist/lib/refresh.d.ts +26 -0
- package/dist/lib/refresh.js +315 -0
- package/dist/lib/resource-patterns.d.ts +1 -1
- package/dist/lib/resource-patterns.js +1 -1
- package/dist/lib/resources/commands.js +2 -2
- package/dist/lib/resources/hooks.d.ts +1 -1
- package/dist/lib/resources/hooks.js +1 -1
- package/dist/lib/resources/mcp.d.ts +1 -1
- package/dist/lib/resources/mcp.js +5 -6
- package/dist/lib/resources/permissions.js +5 -2
- package/dist/lib/resources/rules.js +3 -2
- package/dist/lib/resources/skills.js +3 -2
- package/dist/lib/resources/types.d.ts +1 -1
- package/dist/lib/resources.js +2 -2
- package/dist/lib/rotate.d.ts +1 -1
- package/dist/lib/rotate.js +1 -1
- package/dist/lib/routines.d.ts +16 -4
- package/dist/lib/routines.js +67 -17
- package/dist/lib/rules/compile.js +22 -10
- package/dist/lib/rules/rules.js +3 -3
- package/dist/lib/runner.js +16 -3
- package/dist/lib/scheduler.js +15 -1
- package/dist/lib/secrets/Agents CLI.app/Contents/CodeResources +0 -0
- package/dist/lib/secrets/Agents CLI.app/Contents/MacOS/Agents CLI +0 -0
- package/dist/lib/secrets/Agents CLI.app/Contents/_CodeSignature/CodeResources +9 -1
- package/dist/lib/secrets/Agents CLI.app/Contents/embedded.provisionprofile +0 -0
- package/dist/lib/secrets/linux.d.ts +44 -9
- package/dist/lib/secrets/linux.js +302 -48
- package/dist/lib/session/db.js +15 -2
- package/dist/lib/session/discover.js +118 -3
- package/dist/lib/session/parse.js +3 -0
- package/dist/lib/session/types.d.ts +1 -1
- package/dist/lib/session/types.js +1 -1
- package/dist/lib/shims.d.ts +10 -9
- package/dist/lib/shims.js +101 -50
- package/dist/lib/skills.d.ts +1 -1
- package/dist/lib/skills.js +10 -9
- package/dist/lib/staleness/detectors/commands.d.ts +3 -0
- package/dist/lib/staleness/detectors/commands.js +46 -0
- package/dist/lib/staleness/detectors/hooks.d.ts +3 -0
- package/dist/lib/staleness/detectors/hooks.js +44 -0
- package/dist/lib/staleness/detectors/mcp.d.ts +3 -0
- package/dist/lib/staleness/detectors/mcp.js +31 -0
- package/dist/lib/staleness/detectors/permissions.d.ts +3 -0
- package/dist/lib/staleness/detectors/permissions.js +201 -0
- package/dist/lib/staleness/detectors/plugins.d.ts +8 -0
- package/dist/lib/staleness/detectors/plugins.js +23 -0
- package/dist/lib/staleness/detectors/rules.d.ts +3 -0
- package/dist/lib/staleness/detectors/rules.js +34 -0
- package/dist/lib/staleness/detectors/skills.d.ts +3 -0
- package/dist/lib/staleness/detectors/skills.js +71 -0
- package/dist/lib/staleness/detectors/subagents.d.ts +3 -0
- package/dist/lib/staleness/detectors/subagents.js +50 -0
- package/dist/lib/staleness/detectors/types.d.ts +22 -0
- package/dist/lib/staleness/detectors/types.js +1 -0
- package/dist/lib/staleness/detectors/workflows.d.ts +3 -0
- package/dist/lib/staleness/detectors/workflows.js +28 -0
- package/dist/lib/staleness/registry.d.ts +26 -0
- package/dist/lib/staleness/registry.js +123 -0
- package/dist/lib/staleness/writers/commands.d.ts +3 -0
- package/dist/lib/staleness/writers/commands.js +111 -0
- package/dist/lib/staleness/writers/hooks.d.ts +3 -0
- package/dist/lib/staleness/writers/hooks.js +47 -0
- package/dist/lib/staleness/writers/kinds.d.ts +10 -0
- package/dist/lib/staleness/writers/kinds.js +15 -0
- package/dist/lib/staleness/writers/lazy-map.d.ts +13 -0
- package/dist/lib/staleness/writers/lazy-map.js +19 -0
- package/dist/lib/staleness/writers/mcp.d.ts +10 -0
- package/dist/lib/staleness/writers/mcp.js +19 -0
- package/dist/lib/staleness/writers/permissions.d.ts +13 -0
- package/dist/lib/staleness/writers/permissions.js +26 -0
- package/dist/lib/staleness/writers/plugins.d.ts +7 -0
- package/dist/lib/staleness/writers/plugins.js +31 -0
- package/dist/lib/staleness/writers/rules.d.ts +7 -0
- package/dist/lib/staleness/writers/rules.js +55 -0
- package/dist/lib/staleness/writers/skills.d.ts +3 -0
- package/dist/lib/staleness/writers/skills.js +81 -0
- package/dist/lib/staleness/writers/sources.d.ts +16 -0
- package/dist/lib/staleness/writers/sources.js +72 -0
- package/dist/lib/staleness/writers/subagents.d.ts +3 -0
- package/dist/lib/staleness/writers/subagents.js +53 -0
- package/dist/lib/staleness/writers/types.d.ts +36 -0
- package/dist/lib/staleness/writers/types.js +1 -0
- package/dist/lib/staleness/writers/workflows.d.ts +7 -0
- package/dist/lib/staleness/writers/workflows.js +31 -0
- package/dist/lib/state.d.ts +34 -11
- package/dist/lib/state.js +58 -13
- package/dist/lib/subagents.d.ts +0 -2
- package/dist/lib/subagents.js +6 -6
- package/dist/lib/teams/agents.js +1 -1
- package/dist/lib/teams/parsers.d.ts +1 -1
- package/dist/lib/tmux/binary.d.ts +67 -0
- package/dist/lib/tmux/binary.js +141 -0
- package/dist/lib/tmux/index.d.ts +8 -0
- package/dist/lib/tmux/index.js +8 -0
- package/dist/lib/tmux/paths.d.ts +17 -0
- package/dist/lib/tmux/paths.js +30 -0
- package/dist/lib/tmux/session.d.ts +122 -0
- package/dist/lib/tmux/session.js +305 -0
- package/dist/lib/types.d.ts +58 -7
- package/dist/lib/types.js +1 -1
- package/dist/lib/usage.js +1 -1
- package/dist/lib/versions.d.ts +4 -4
- package/dist/lib/versions.js +135 -493
- package/dist/lib/workflows.d.ts +2 -4
- package/dist/lib/workflows.js +3 -4
- package/package.json +2 -2
- package/scripts/postinstall.js +16 -63
- package/dist/commands/status.d.ts +0 -9
- package/dist/commands/status.js +0 -25
package/dist/index.js
CHANGED
|
@@ -56,11 +56,12 @@ if (IS_DEV_BUILD) {
|
|
|
56
56
|
}
|
|
57
57
|
// Import command registrations
|
|
58
58
|
import { registerPullCommand } from './commands/pull.js';
|
|
59
|
+
import { registerPushCommand } from './commands/push.js';
|
|
59
60
|
import { registerRepoCommands } from './commands/repo.js';
|
|
60
61
|
import { registerSetupCommand, runSetup } from './commands/setup.js';
|
|
61
|
-
import { registerStatusCommand } from './commands/status.js';
|
|
62
62
|
import { registerFeedbackCommand } from './commands/feedback.js';
|
|
63
63
|
import { registerViewCommand } from './commands/view.js';
|
|
64
|
+
import { registerInspectCommand } from './commands/inspect.js';
|
|
64
65
|
import { registerCommandsCommands } from './commands/commands.js';
|
|
65
66
|
import { registerHooksCommands } from './commands/hooks.js';
|
|
66
67
|
import { registerSkillsCommands } from './commands/skills.js';
|
|
@@ -86,6 +87,7 @@ import { registerSyncCommand } from './commands/sync.js';
|
|
|
86
87
|
import { registerRefreshRulesCommand } from './commands/refresh-rules.js';
|
|
87
88
|
import { registerDriveCommands } from './commands/drive.js';
|
|
88
89
|
import { registerPtyCommands } from './commands/pty.js';
|
|
90
|
+
import { registerTmuxCommands } from './commands/tmux.js';
|
|
89
91
|
import { registerBrowserCommand } from './commands/browser.js';
|
|
90
92
|
import { registerComputerCommand } from './commands/computer.js';
|
|
91
93
|
import { registerProfilesCommands } from './commands/profiles.js';
|
|
@@ -99,7 +101,7 @@ import { applyGlobalHelpConventions } from './lib/help.js';
|
|
|
99
101
|
import { isInteractiveTerminal, isPromptCancelled } from './commands/utils.js';
|
|
100
102
|
import { AGENTS } from './lib/agents.js';
|
|
101
103
|
import { getGlobalDefault, listInstalledVersions } from './lib/versions.js';
|
|
102
|
-
import { addShimsToPath, ensureShimCurrent, ensureVersionedAliasCurrent, getPathShadowingExecutable, getPathSetupInstructions,
|
|
104
|
+
import { addShimsToPath, ensureShimCurrent, ensureVersionedAliasCurrent, getPathShadowingExecutable, getPathSetupInstructions, getShimsDir, isShimsInPath, listAgentsWithInstalledVersions, removeLegacyUserShim, } from './lib/shims.js';
|
|
103
105
|
const program = new Command();
|
|
104
106
|
program
|
|
105
107
|
.name('agents')
|
|
@@ -131,6 +133,7 @@ Agent versions:
|
|
|
131
133
|
prune cleanup [target] Remove orphan resources and older duplicate version installs
|
|
132
134
|
trash Inspect and restore soft-deleted version directories
|
|
133
135
|
view [agent[@version]] List versions, or inspect one in detail
|
|
136
|
+
inspect <agent>[@version] Deep details for one agent+version — paths, capabilities, resources, drill into any kind
|
|
134
137
|
|
|
135
138
|
Agent configuration (synced across versions):
|
|
136
139
|
rules Instructions given to agents (CLAUDE.md, etc.)
|
|
@@ -164,7 +167,7 @@ Diagnostics:
|
|
|
164
167
|
|
|
165
168
|
Config sync:
|
|
166
169
|
drive Sync session history across machines via rsync
|
|
167
|
-
pull Clone or pull the system repo at ~/.agents
|
|
170
|
+
pull Clone or pull the system repo at ~/.agents/.system/
|
|
168
171
|
repo init --path <dir> Scaffold your own editable repo from a template
|
|
169
172
|
repo add <path|gh:user/repo> Merge an extra repo after the system repo
|
|
170
173
|
|
|
@@ -182,7 +185,7 @@ Options:
|
|
|
182
185
|
-V, --version Show version number
|
|
183
186
|
-h, --help Show help
|
|
184
187
|
|
|
185
|
-
System config lives in ~/.agents
|
|
188
|
+
System config lives in ~/.agents/.system/. Run 'agents <command> --help' for details.
|
|
186
189
|
`;
|
|
187
190
|
}
|
|
188
191
|
return originalHelpInformation();
|
|
@@ -409,10 +412,17 @@ async function checkForUpdates() {
|
|
|
409
412
|
}
|
|
410
413
|
}
|
|
411
414
|
}
|
|
412
|
-
async function maybeBootstrapShimIntegration(requestedCommand) {
|
|
415
|
+
async function maybeBootstrapShimIntegration(requestedCommand, helpOrVersionRequested) {
|
|
413
416
|
if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
414
417
|
return;
|
|
415
418
|
}
|
|
419
|
+
// Pure documentation paths must never trigger interactive repair — mirrors
|
|
420
|
+
// the helpOrVersionRequested gate around ensureInitialized below. Covers
|
|
421
|
+
// both bare `agents --version` (requestedCommand === undefined) and
|
|
422
|
+
// `agents <subcommand> --help` (requestedCommand === subcommand name).
|
|
423
|
+
if (helpOrVersionRequested) {
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
416
426
|
if (requestedCommand === 'sync' || requestedCommand === 'refresh-rules') {
|
|
417
427
|
return;
|
|
418
428
|
}
|
|
@@ -447,11 +457,13 @@ async function maybeBootstrapShimIntegration(requestedCommand) {
|
|
|
447
457
|
const shadowed = defaultAgents
|
|
448
458
|
.map((agent) => ({ agent, shadowedBy: getPathShadowingExecutable(agent) }))
|
|
449
459
|
.filter((item) => Boolean(item.shadowedBy));
|
|
450
|
-
// Also check for shell aliases that shadow the shim
|
|
451
|
-
const aliased = defaultAgents.filter((agent) => hasAliasShadowingShim(agent));
|
|
452
|
-
// If shims are in PATH and nothing is binary-shadowing, we're done.
|
|
453
460
|
// Shell aliases that call the same command with extra flags are intentional
|
|
454
|
-
// customization and don't break shim integration
|
|
461
|
+
// customization and don't break shim integration — `addShimsToPath` cannot
|
|
462
|
+
// touch them, so they don't belong in the repair prompt. We previously
|
|
463
|
+
// computed an `aliased` list here and inserted it into `affected`, which
|
|
464
|
+
// contradicted the comment below and surfaced false positives (e.g. an
|
|
465
|
+
// earlier `alias codex=...` cancelled by a later `unalias codex` was
|
|
466
|
+
// reported because the detector did a static rc-file regex).
|
|
455
467
|
if (shadowed.length === 0 && isShimsInPath()) {
|
|
456
468
|
return;
|
|
457
469
|
}
|
|
@@ -468,14 +480,11 @@ async function maybeBootstrapShimIntegration(requestedCommand) {
|
|
|
468
480
|
for (const { agent, shadowedBy } of shadowed) {
|
|
469
481
|
affected.push(`${AGENTS[agent].cliCommand} -> ${shadowedBy}`);
|
|
470
482
|
}
|
|
471
|
-
for (const agent of aliased) {
|
|
472
|
-
if (!shadowed.some((s) => s.agent === agent)) {
|
|
473
|
-
affected.push(`${AGENTS[agent].cliCommand} (alias)`);
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
483
|
if (affected.length === 0) {
|
|
477
|
-
// PATH
|
|
478
|
-
|
|
484
|
+
// Pure PATH-not-loaded case: rc may already have the shim block, but the
|
|
485
|
+
// running shell hasn't sourced it. Don't list agents here — they aren't
|
|
486
|
+
// broken; only the PATH is stale. The prompt + post-message handle it.
|
|
487
|
+
affected.push('PATH entry missing');
|
|
479
488
|
}
|
|
480
489
|
const shouldRepair = await confirm({
|
|
481
490
|
message: `Repair shim integration now? ${affected.join(', ')}`,
|
|
@@ -494,15 +503,38 @@ async function maybeBootstrapShimIntegration(requestedCommand) {
|
|
|
494
503
|
if (!pathResult.success) {
|
|
495
504
|
console.log(chalk.yellow('Could not repair shim PATH setup automatically.'));
|
|
496
505
|
console.log(chalk.gray(pathResult.error || getPathSetupInstructions()));
|
|
506
|
+
// Write the sentinel even on failure — otherwise an unwritable rc file
|
|
507
|
+
// re-prompts every invocation in the same shell. The user opens a new
|
|
508
|
+
// terminal (new PPID) to retry.
|
|
509
|
+
try {
|
|
510
|
+
fs.writeFileSync(sentinelPath, '1');
|
|
511
|
+
}
|
|
512
|
+
catch { /* best-effort */ }
|
|
497
513
|
return;
|
|
498
514
|
}
|
|
515
|
+
// When the rc file already has the canonical shim block, `addShimsToPath`
|
|
516
|
+
// is a no-op — re-emitting produced byte-identical content. In this branch
|
|
517
|
+
// the user clicked "Yes" but nothing changed on disk, AND the underlying
|
|
518
|
+
// cause (a real binary shadow, or a stale shell PATH) is unaffected by
|
|
519
|
+
// this command. Be honest about it and point at the actual action.
|
|
499
520
|
if (pathResult.alreadyPresent) {
|
|
500
|
-
|
|
521
|
+
if (shadowed.length > 0) {
|
|
522
|
+
const targets = shadowed
|
|
523
|
+
.map(({ agent, shadowedBy }) => ` ${AGENTS[agent].cliCommand}: ${shadowedBy}`)
|
|
524
|
+
.join('\n');
|
|
525
|
+
console.log(chalk.yellow('Repair could not change anything — the shim is shadowed by another binary on PATH:'));
|
|
526
|
+
console.log(chalk.gray(targets));
|
|
527
|
+
console.log(chalk.gray(`Fix it by removing or reordering that binary, or making sure ${getShimsDir()} appears earlier in PATH than its parent dir.`));
|
|
528
|
+
}
|
|
529
|
+
else {
|
|
530
|
+
console.log(chalk.yellow(`Shim PATH entry is already in ~/${pathResult.rcFile} — this shell just needs to reload it.`));
|
|
531
|
+
console.log(chalk.gray(`Run: source ~/${pathResult.rcFile} (or open a new terminal)`));
|
|
532
|
+
}
|
|
501
533
|
}
|
|
502
534
|
else {
|
|
503
535
|
console.log(chalk.green(`Repaired shim PATH setup in ~/${pathResult.rcFile}`));
|
|
536
|
+
console.log(chalk.gray(getPathSetupInstructions()));
|
|
504
537
|
}
|
|
505
|
-
console.log(chalk.gray(getPathSetupInstructions()));
|
|
506
538
|
try {
|
|
507
539
|
fs.writeFileSync(sentinelPath, '1');
|
|
508
540
|
}
|
|
@@ -510,7 +542,7 @@ async function maybeBootstrapShimIntegration(requestedCommand) {
|
|
|
510
542
|
}
|
|
511
543
|
// Register all commands
|
|
512
544
|
registerViewCommand(program);
|
|
513
|
-
|
|
545
|
+
registerInspectCommand(program);
|
|
514
546
|
registerFeedbackCommand(program);
|
|
515
547
|
registerCommandsCommands(program);
|
|
516
548
|
registerHooksCommands(program);
|
|
@@ -577,6 +609,7 @@ registerFactoryCommands(program);
|
|
|
577
609
|
registerUsageCommand(program);
|
|
578
610
|
registerAliasCommand(program);
|
|
579
611
|
registerPtyCommands(program);
|
|
612
|
+
registerTmuxCommands(program);
|
|
580
613
|
registerBrowserCommand(program);
|
|
581
614
|
registerComputerCommand(program);
|
|
582
615
|
// Deprecated 'jobs' and 'cron' aliases for 'routines'
|
|
@@ -632,6 +665,7 @@ program
|
|
|
632
665
|
}
|
|
633
666
|
});
|
|
634
667
|
registerPullCommand(program);
|
|
668
|
+
registerPushCommand(program);
|
|
635
669
|
registerRepoCommands(program);
|
|
636
670
|
registerSetupCommand(program);
|
|
637
671
|
applyGlobalHelpConventions(program);
|
|
@@ -742,6 +776,20 @@ const SETUP_EXEMPT_COMMANDS = new Set(['setup', 'help']);
|
|
|
742
776
|
// Help and version output are pure documentation — they must never gate on
|
|
743
777
|
// setup, otherwise `agents <cmd> --help` becomes useless on a fresh box.
|
|
744
778
|
const helpOrVersionRequested = passedArgs.some((arg) => arg === '--help' || arg === '-h' || arg === '--version' || arg === '-V');
|
|
779
|
+
// Fold legacy ~/.agents-system/ into ~/.agents/.system/ BEFORE ensureInitialized
|
|
780
|
+
// runs. ensureInitialized checks for .git inside the new path; if the user is
|
|
781
|
+
// upgrading from a layout where .git lives under the legacy path, the check
|
|
782
|
+
// would fail and exit before the migrator ever runs. Also runs outside the
|
|
783
|
+
// sentinel guard below because the sentinel was set by pre-fold releases and
|
|
784
|
+
// would otherwise skip this step on every existing install. Idempotent —
|
|
785
|
+
// no-ops when legacy is missing or already a symlink.
|
|
786
|
+
if (process.env.AGENTS_SKIP_MIGRATION !== '1') {
|
|
787
|
+
try {
|
|
788
|
+
const { foldLegacySystemRepo } = await import('./lib/migrate.js');
|
|
789
|
+
foldLegacySystemRepo();
|
|
790
|
+
}
|
|
791
|
+
catch { /* must never block CLI startup */ }
|
|
792
|
+
}
|
|
745
793
|
if (!firstRun &&
|
|
746
794
|
requestedCommand &&
|
|
747
795
|
!SETUP_EXEMPT_COMMANDS.has(requestedCommand) &&
|
|
@@ -783,7 +831,7 @@ if (process.env.AGENTS_SKIP_MIGRATION !== '1') {
|
|
|
783
831
|
catch { /* migration must never block CLI startup */ }
|
|
784
832
|
}
|
|
785
833
|
try {
|
|
786
|
-
await maybeBootstrapShimIntegration(requestedCommand);
|
|
834
|
+
await maybeBootstrapShimIntegration(requestedCommand, helpOrVersionRequested);
|
|
787
835
|
await program.parseAsync();
|
|
788
836
|
}
|
|
789
837
|
catch (err) {
|
package/dist/lib/agents.d.ts
CHANGED
|
@@ -23,16 +23,6 @@ export declare const GEMINI_HOOKS_MIN_VERSION = "0.26.0";
|
|
|
23
23
|
export declare const AGENTS: Record<AgentId, AgentConfig>;
|
|
24
24
|
/** All registered agent IDs derived from the AGENTS registry. */
|
|
25
25
|
export declare const ALL_AGENT_IDS: AgentId[];
|
|
26
|
-
/** Agents that support MCP (Model Context Protocol) server integration. */
|
|
27
|
-
export declare const MCP_CAPABLE_AGENTS: AgentId[];
|
|
28
|
-
/** Agents that support skills (SKILL.md + rules/ bundles). */
|
|
29
|
-
export declare const SKILLS_CAPABLE_AGENTS: AgentId[];
|
|
30
|
-
/** Agents that support file-based slash commands. */
|
|
31
|
-
export declare const COMMANDS_CAPABLE_AGENTS: AgentId[];
|
|
32
|
-
/** Agents that support event hooks (pre/post lifecycle callbacks). */
|
|
33
|
-
export declare const HOOKS_CAPABLE_AGENTS: readonly AgentId[];
|
|
34
|
-
/** Agents that support the plugin system. */
|
|
35
|
-
export declare const PLUGINS_CAPABLE_AGENTS: AgentId[];
|
|
36
26
|
/** Get the chalk color function for an agent. Works for any AgentId or SessionAgentId. */
|
|
37
27
|
export declare function colorAgent(agentId: string): (s: string) => string;
|
|
38
28
|
/** Return the agent's display name, colored. */
|
|
@@ -59,6 +49,13 @@ export interface UnmanagedInstall {
|
|
|
59
49
|
configDir: string;
|
|
60
50
|
version: string | null;
|
|
61
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Agents that `agents setup` probes for pre-existing native installations
|
|
54
|
+
* (i.e., a config dir present before agents-cli took over). Add an agent here
|
|
55
|
+
* once its `cliCommand` reports a usable `--version` and its session dir is
|
|
56
|
+
* wired into `getSessionDir`.
|
|
57
|
+
*/
|
|
58
|
+
export declare const UNMANAGED_DETECTION_CANDIDATES: AgentId[];
|
|
62
59
|
/**
|
|
63
60
|
* Detect existing agent installations that are NOT yet managed by agents-cli.
|
|
64
61
|
* Returns agents whose config dir exists as a real directory (not a symlink).
|
|
@@ -68,6 +65,18 @@ export declare function getUnmanagedAgentInstalls(): Promise<UnmanagedInstall[]>
|
|
|
68
65
|
export declare function ensureCommandsDir(agentId: AgentId): void;
|
|
69
66
|
/** Create the agent's skills directory if it does not exist. */
|
|
70
67
|
export declare function ensureSkillsDir(agentId: AgentId): void;
|
|
68
|
+
/**
|
|
69
|
+
* The agent's config-dir name relative to $HOME — e.g. '.claude',
|
|
70
|
+
* '.gemini/antigravity-cli', '.config/amp', '.kimi-code'.
|
|
71
|
+
*
|
|
72
|
+
* This is the path segment to join onto a (version) home root when locating an
|
|
73
|
+
* agent's commands/skills/plugins. Do NOT hardcode `.${agentId}`: it is wrong
|
|
74
|
+
* for every agent whose config dir is nested or lives under ~/.config —
|
|
75
|
+
* antigravity (~/.gemini/antigravity-cli), amp (~/.config/amp),
|
|
76
|
+
* goose (~/.config/goose), kimi (~/.kimi-code). Mirrors the shim `configDirName`
|
|
77
|
+
* derivation in shims.ts.
|
|
78
|
+
*/
|
|
79
|
+
export declare function agentConfigDirName(agentId: AgentId): string;
|
|
71
80
|
/** Account identity and billing information extracted from an agent's auth config. */
|
|
72
81
|
export interface AccountInfo {
|
|
73
82
|
accountKey: string | null;
|
package/dist/lib/agents.js
CHANGED
|
@@ -203,7 +203,7 @@ export const AGENTS = {
|
|
|
203
203
|
format: 'markdown',
|
|
204
204
|
variableSyntax: '$ARGUMENTS',
|
|
205
205
|
supportsHooks: true,
|
|
206
|
-
capabilities: { hooks: true, mcp: true, allowlist: true, skills: true, commands: true, plugins: true, modes: ['plan', 'edit', 'auto', 'skip'], rulesImports: true },
|
|
206
|
+
capabilities: { hooks: true, mcp: true, allowlist: true, skills: true, commands: true, plugins: true, subagents: true, rules: { file: 'CLAUDE.md' }, workflows: true, modes: ['plan', 'edit', 'auto', 'skip'], rulesImports: true },
|
|
207
207
|
},
|
|
208
208
|
// codex hooks: gated to >= 0.116.0 (introduced [features] codex_hooks flag).
|
|
209
209
|
codex: {
|
|
@@ -222,7 +222,7 @@ export const AGENTS = {
|
|
|
222
222
|
format: 'markdown',
|
|
223
223
|
variableSyntax: '$ARGUMENTS',
|
|
224
224
|
supportsHooks: true,
|
|
225
|
-
capabilities: { hooks: { since: '0.116.0' }, mcp: true, allowlist: false, skills: true, commands: { until: '0.117.0' }, plugins: { since: '0.128.0' }, modes: ['plan', 'edit', 'skip'] },
|
|
225
|
+
capabilities: { hooks: { since: '0.116.0' }, mcp: true, allowlist: false, skills: true, commands: { until: '0.117.0' }, plugins: { since: '0.128.0' }, subagents: false, rules: { file: 'AGENTS.md' }, workflows: false, modes: ['plan', 'edit', 'skip'] },
|
|
226
226
|
},
|
|
227
227
|
gemini: {
|
|
228
228
|
id: 'gemini',
|
|
@@ -241,7 +241,7 @@ export const AGENTS = {
|
|
|
241
241
|
supportsHooks: true,
|
|
242
242
|
nativeAgentsSkillsDir: true,
|
|
243
243
|
// gemini hooks: shipped in v0.26.0 (Jan 2026); older binaries silently ignore the `hooks` key.
|
|
244
|
-
capabilities: { hooks: { since: '0.26.0' }, mcp: true, allowlist: false, skills: true, commands: true, plugins: false, modes: ['plan', 'edit', 'skip'], rulesImports: true },
|
|
244
|
+
capabilities: { hooks: { since: '0.26.0' }, mcp: true, allowlist: false, skills: true, commands: true, plugins: false, subagents: false, rules: { file: 'GEMINI.md' }, workflows: false, modes: ['plan', 'edit', 'skip'], rulesImports: true },
|
|
245
245
|
},
|
|
246
246
|
cursor: {
|
|
247
247
|
id: 'cursor',
|
|
@@ -259,7 +259,7 @@ export const AGENTS = {
|
|
|
259
259
|
format: 'markdown',
|
|
260
260
|
variableSyntax: '$ARGUMENTS',
|
|
261
261
|
supportsHooks: false,
|
|
262
|
-
capabilities: { hooks: false, mcp: true, allowlist: false, skills: true, commands: true, plugins: false, modes: ['edit', 'skip'] },
|
|
262
|
+
capabilities: { hooks: false, mcp: true, allowlist: false, skills: true, commands: true, plugins: false, subagents: false, rules: { file: '.cursorrules' }, workflows: false, modes: ['edit', 'skip'] },
|
|
263
263
|
},
|
|
264
264
|
opencode: {
|
|
265
265
|
id: 'opencode',
|
|
@@ -276,7 +276,7 @@ export const AGENTS = {
|
|
|
276
276
|
format: 'markdown',
|
|
277
277
|
variableSyntax: '$ARGUMENTS',
|
|
278
278
|
supportsHooks: false,
|
|
279
|
-
capabilities: { hooks: false, mcp: true, allowlist: false, skills: true, commands: true, plugins: false, modes: ['plan', 'edit'] },
|
|
279
|
+
capabilities: { hooks: false, mcp: true, allowlist: false, skills: true, commands: true, plugins: false, subagents: false, rules: { file: 'AGENTS.md' }, workflows: false, modes: ['plan', 'edit'] },
|
|
280
280
|
},
|
|
281
281
|
openclaw: {
|
|
282
282
|
id: 'openclaw',
|
|
@@ -293,7 +293,7 @@ export const AGENTS = {
|
|
|
293
293
|
format: 'markdown',
|
|
294
294
|
variableSyntax: '{{ARGUMENTS}}',
|
|
295
295
|
supportsHooks: true,
|
|
296
|
-
capabilities: { hooks: true, mcp: true, allowlist: false, skills: true, commands: false, plugins: true, modes: ['plan', 'edit', 'skip'] },
|
|
296
|
+
capabilities: { hooks: true, mcp: true, allowlist: false, skills: true, commands: false, plugins: true, subagents: true, rules: { file: 'workspace/AGENTS.md' }, workflows: false, modes: ['plan', 'edit', 'skip'] },
|
|
297
297
|
},
|
|
298
298
|
copilot: {
|
|
299
299
|
id: 'copilot',
|
|
@@ -310,7 +310,7 @@ export const AGENTS = {
|
|
|
310
310
|
format: 'markdown',
|
|
311
311
|
variableSyntax: '$ARGUMENTS',
|
|
312
312
|
supportsHooks: false,
|
|
313
|
-
capabilities: { hooks: false, mcp: true, allowlist: false, skills: true, commands: true, plugins: false, modes: ['plan', 'edit', 'auto', 'skip'] },
|
|
313
|
+
capabilities: { hooks: false, mcp: true, allowlist: false, skills: true, commands: true, plugins: false, subagents: false, rules: { file: 'AGENTS.md' }, workflows: false, modes: ['plan', 'edit', 'auto', 'skip'] },
|
|
314
314
|
},
|
|
315
315
|
amp: {
|
|
316
316
|
id: 'amp',
|
|
@@ -327,7 +327,7 @@ export const AGENTS = {
|
|
|
327
327
|
format: 'markdown',
|
|
328
328
|
variableSyntax: '$ARGUMENTS',
|
|
329
329
|
supportsHooks: false,
|
|
330
|
-
capabilities: { hooks: false, mcp: true, allowlist: false, skills: true, commands: true, plugins: false, modes: ['plan', 'edit'] },
|
|
330
|
+
capabilities: { hooks: false, mcp: true, allowlist: false, skills: true, commands: true, plugins: false, subagents: false, rules: { file: 'AGENTS.md' }, workflows: false, modes: ['plan', 'edit'] },
|
|
331
331
|
},
|
|
332
332
|
kiro: {
|
|
333
333
|
id: 'kiro',
|
|
@@ -345,7 +345,7 @@ export const AGENTS = {
|
|
|
345
345
|
format: 'markdown',
|
|
346
346
|
variableSyntax: '$ARGUMENTS',
|
|
347
347
|
supportsHooks: false,
|
|
348
|
-
capabilities: { hooks: false, mcp: true, allowlist: false, skills: true, commands: true, plugins: false, modes: ['edit'] },
|
|
348
|
+
capabilities: { hooks: false, mcp: true, allowlist: false, skills: true, commands: true, plugins: false, subagents: false, rules: { file: 'AGENTS.md' }, workflows: false, modes: ['edit'] },
|
|
349
349
|
},
|
|
350
350
|
goose: {
|
|
351
351
|
id: 'goose',
|
|
@@ -363,7 +363,7 @@ export const AGENTS = {
|
|
|
363
363
|
format: 'markdown',
|
|
364
364
|
variableSyntax: '$ARGUMENTS',
|
|
365
365
|
supportsHooks: false,
|
|
366
|
-
capabilities: { hooks: false, mcp: true, allowlist: false, skills: false, commands: false, plugins: false, modes: ['edit'] },
|
|
366
|
+
capabilities: { hooks: false, mcp: true, allowlist: false, skills: false, commands: false, plugins: false, subagents: false, rules: { file: 'AGENTS.md' }, workflows: false, modes: ['edit'] },
|
|
367
367
|
},
|
|
368
368
|
roo: {
|
|
369
369
|
id: 'roo',
|
|
@@ -381,7 +381,7 @@ export const AGENTS = {
|
|
|
381
381
|
format: 'markdown',
|
|
382
382
|
variableSyntax: '$ARGUMENTS',
|
|
383
383
|
supportsHooks: false,
|
|
384
|
-
capabilities: { hooks: false, mcp: true, allowlist: false, skills: true, commands: true, plugins: false, modes: ['plan', 'edit'] },
|
|
384
|
+
capabilities: { hooks: false, mcp: true, allowlist: false, skills: true, commands: true, plugins: false, subagents: false, rules: { file: 'AGENTS.md' }, workflows: false, modes: ['plan', 'edit'] },
|
|
385
385
|
},
|
|
386
386
|
// Google Antigravity CLI (`agy`) — official replacement for Gemini CLI as of IO 2026.
|
|
387
387
|
// configDir nests inside `~/.gemini/` since agy shares the parent dir with the Gemini
|
|
@@ -408,7 +408,7 @@ export const AGENTS = {
|
|
|
408
408
|
format: 'markdown',
|
|
409
409
|
variableSyntax: '{{args}}',
|
|
410
410
|
supportsHooks: true,
|
|
411
|
-
capabilities: { hooks: true, mcp: true, allowlist: true, skills: true, commands: true, plugins: true, modes: ['edit', 'skip'], rulesImports: false },
|
|
411
|
+
capabilities: { hooks: true, mcp: true, allowlist: true, skills: true, commands: true, plugins: true, subagents: false, rules: { file: 'AGENTS.md' }, workflows: false, modes: ['edit', 'skip'], rulesImports: false },
|
|
412
412
|
},
|
|
413
413
|
// xAI Grok Build CLI (`grok`) — early beta, SuperGrok Heavy. Auth via OAuth on
|
|
414
414
|
// first launch, or XAI_API_KEY env var for headless. MCP servers configured inline
|
|
@@ -439,23 +439,51 @@ export const AGENTS = {
|
|
|
439
439
|
skills: true,
|
|
440
440
|
commands: false, // covered by skills
|
|
441
441
|
plugins: true,
|
|
442
|
+
subagents: false,
|
|
443
|
+
rules: { file: 'AGENTS.md' },
|
|
444
|
+
workflows: false,
|
|
442
445
|
modes: ['plan', 'edit', 'skip'],
|
|
443
446
|
rulesImports: true,
|
|
444
447
|
},
|
|
445
448
|
},
|
|
449
|
+
kimi: {
|
|
450
|
+
id: 'kimi',
|
|
451
|
+
name: 'Kimi',
|
|
452
|
+
color: 'magentaBright',
|
|
453
|
+
cliCommand: 'kimi-code',
|
|
454
|
+
npmPackage: '',
|
|
455
|
+
installScript: '',
|
|
456
|
+
configDir: path.join(HOME, '.kimi-code'),
|
|
457
|
+
commandsDir: '',
|
|
458
|
+
commandsSubdir: '',
|
|
459
|
+
skillsDir: path.join(HOME, '.kimi-code', 'skills'),
|
|
460
|
+
hooksDir: path.join(HOME, '.kimi-code', 'hooks'),
|
|
461
|
+
instructionsFile: 'AGENTS.md',
|
|
462
|
+
format: 'markdown',
|
|
463
|
+
variableSyntax: '$ARGUMENTS',
|
|
464
|
+
supportsHooks: true,
|
|
465
|
+
capabilities: {
|
|
466
|
+
hooks: true,
|
|
467
|
+
mcp: true,
|
|
468
|
+
allowlist: false,
|
|
469
|
+
skills: false,
|
|
470
|
+
commands: false,
|
|
471
|
+
plugins: false,
|
|
472
|
+
subagents: false,
|
|
473
|
+
rules: { file: 'AGENTS.md' },
|
|
474
|
+
workflows: false,
|
|
475
|
+
modes: ['plan', 'edit', 'skip'],
|
|
476
|
+
rulesImports: false,
|
|
477
|
+
},
|
|
478
|
+
},
|
|
446
479
|
};
|
|
447
480
|
/** All registered agent IDs derived from the AGENTS registry. */
|
|
448
481
|
export const ALL_AGENT_IDS = Object.keys(AGENTS);
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
export const COMMANDS_CAPABLE_AGENTS = ALL_AGENT_IDS.filter((id) => AGENTS[id].capabilities.commands);
|
|
455
|
-
/** Agents that support event hooks (pre/post lifecycle callbacks). */
|
|
456
|
-
export const HOOKS_CAPABLE_AGENTS = ALL_AGENT_IDS.filter((id) => AGENTS[id].capabilities.hooks !== false);
|
|
457
|
-
/** Agents that support the plugin system. */
|
|
458
|
-
export const PLUGINS_CAPABLE_AGENTS = ALL_AGENT_IDS.filter((id) => AGENTS[id].capabilities.plugins !== false);
|
|
482
|
+
// Capability-filtered agent lists used to live here as `*_CAPABLE_AGENTS`
|
|
483
|
+
// constants. They were a frequent source of silent-skip bugs (e.g. grok
|
|
484
|
+
// rules sync gated on `COMMANDS_CAPABLE_AGENTS`). Use `capableAgents(cap)`
|
|
485
|
+
// from `./capabilities.js` instead — it consults the AgentConfig matrix
|
|
486
|
+
// directly, so a single source of truth drives every gate.
|
|
459
487
|
/** Get the chalk color function for an agent. Works for any AgentId or SessionAgentId. */
|
|
460
488
|
export function colorAgent(agentId) {
|
|
461
489
|
const agent = AGENTS[agentId];
|
|
@@ -610,14 +638,26 @@ export function isConfigured(agentId) {
|
|
|
610
638
|
const agent = AGENTS[agentId];
|
|
611
639
|
return fs.existsSync(agent.configDir);
|
|
612
640
|
}
|
|
641
|
+
/**
|
|
642
|
+
* Agents that `agents setup` probes for pre-existing native installations
|
|
643
|
+
* (i.e., a config dir present before agents-cli took over). Add an agent here
|
|
644
|
+
* once its `cliCommand` reports a usable `--version` and its session dir is
|
|
645
|
+
* wired into `getSessionDir`.
|
|
646
|
+
*/
|
|
647
|
+
export const UNMANAGED_DETECTION_CANDIDATES = [
|
|
648
|
+
'claude',
|
|
649
|
+
'codex',
|
|
650
|
+
'gemini',
|
|
651
|
+
'grok',
|
|
652
|
+
'copilot',
|
|
653
|
+
];
|
|
613
654
|
/**
|
|
614
655
|
* Detect existing agent installations that are NOT yet managed by agents-cli.
|
|
615
656
|
* Returns agents whose config dir exists as a real directory (not a symlink).
|
|
616
657
|
*/
|
|
617
658
|
export async function getUnmanagedAgentInstalls() {
|
|
618
659
|
const unmanaged = [];
|
|
619
|
-
const
|
|
620
|
-
for (const agentId of candidates) {
|
|
660
|
+
for (const agentId of UNMANAGED_DETECTION_CANDIDATES) {
|
|
621
661
|
const agent = AGENTS[agentId];
|
|
622
662
|
try {
|
|
623
663
|
const stat = fs.lstatSync(agent.configDir);
|
|
@@ -646,6 +686,20 @@ export function ensureSkillsDir(agentId) {
|
|
|
646
686
|
fs.mkdirSync(agent.skillsDir, { recursive: true });
|
|
647
687
|
}
|
|
648
688
|
}
|
|
689
|
+
/**
|
|
690
|
+
* The agent's config-dir name relative to $HOME — e.g. '.claude',
|
|
691
|
+
* '.gemini/antigravity-cli', '.config/amp', '.kimi-code'.
|
|
692
|
+
*
|
|
693
|
+
* This is the path segment to join onto a (version) home root when locating an
|
|
694
|
+
* agent's commands/skills/plugins. Do NOT hardcode `.${agentId}`: it is wrong
|
|
695
|
+
* for every agent whose config dir is nested or lives under ~/.config —
|
|
696
|
+
* antigravity (~/.gemini/antigravity-cli), amp (~/.config/amp),
|
|
697
|
+
* goose (~/.config/goose), kimi (~/.kimi-code). Mirrors the shim `configDirName`
|
|
698
|
+
* derivation in shims.ts.
|
|
699
|
+
*/
|
|
700
|
+
export function agentConfigDirName(agentId) {
|
|
701
|
+
return path.relative(os.homedir(), AGENTS[agentId].configDir);
|
|
702
|
+
}
|
|
649
703
|
/** Return the email address associated with the agent's auth config, or null. */
|
|
650
704
|
export async function getAccountEmail(agentId, home) {
|
|
651
705
|
const info = await getAccountInfo(agentId, home);
|
|
@@ -1280,7 +1334,7 @@ export function getMcpConfigPathForHome(agentId, home) {
|
|
|
1280
1334
|
case 'grok':
|
|
1281
1335
|
return path.join(home, '.grok', 'config.toml');
|
|
1282
1336
|
default:
|
|
1283
|
-
return path.join(home,
|
|
1337
|
+
return path.join(home, agentConfigDirName(agentId), 'settings.json');
|
|
1284
1338
|
}
|
|
1285
1339
|
}
|
|
1286
1340
|
/**
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* For the user repo + enabled extras: `git fetch` + write a status marker the foreground
|
|
6
6
|
* CLI surfaces on its next invocation.
|
|
7
7
|
*
|
|
8
|
-
* Per-repo lock files at ~/.agents
|
|
8
|
+
* Per-repo lock files at ~/.agents/.system/.fetch/<alias>.lock prevent concurrent fetches.
|
|
9
9
|
* Lock mtime under 5 min => skip (another invocation already in flight).
|
|
10
10
|
*/
|
|
11
11
|
export {};
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* For the user repo + enabled extras: `git fetch` + write a status marker the foreground
|
|
6
6
|
* CLI surfaces on its next invocation.
|
|
7
7
|
*
|
|
8
|
-
* Per-repo lock files at ~/.agents
|
|
8
|
+
* Per-repo lock files at ~/.agents/.system/.fetch/<alias>.lock prevent concurrent fetches.
|
|
9
9
|
* Lock mtime under 5 min => skip (another invocation already in flight).
|
|
10
10
|
*/
|
|
11
11
|
import * as fs from 'fs';
|
|
@@ -15,7 +15,7 @@ import { getSystemAgentsDir, getUserAgentsDir, getEnabledExtraRepos, getFetchCac
|
|
|
15
15
|
import { lockFilePath, statusFilePath } from './auto-pull.js';
|
|
16
16
|
const LOCK_TTL_MS = 5 * 60 * 1000;
|
|
17
17
|
/**
|
|
18
|
-
* Background auto-pull of ~/.agents
|
|
18
|
+
* Background auto-pull of ~/.agents/.system/ is off by default. When enabled it
|
|
19
19
|
* silently fast-forwards a tracked source tree that the CLI then reads as a
|
|
20
20
|
* source of skills, hooks, install manifests, and commands — anyone with push
|
|
21
21
|
* access to that upstream gets remote code execution on every user the next
|
package/dist/lib/auto-pull.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Background sync for tracked git repos:
|
|
3
|
-
* - System repo (~/.agents
|
|
3
|
+
* - System repo (~/.agents/.system/) is read-only locally — fast-forward auto-pull is safe.
|
|
4
4
|
* - User repo (~/.agents/) and enabled extras may have local commits, so we only
|
|
5
5
|
* `git fetch` and write a status marker. Next CLI invocation surfaces a one-line
|
|
6
6
|
* notice if upstream is ahead. Pulling is left to the user via `agents repo pull`.
|
package/dist/lib/auto-pull.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Background sync for tracked git repos:
|
|
3
|
-
* - System repo (~/.agents
|
|
3
|
+
* - System repo (~/.agents/.system/) is read-only locally — fast-forward auto-pull is safe.
|
|
4
4
|
* - User repo (~/.agents/) and enabled extras may have local commits, so we only
|
|
5
5
|
* `git fetch` and write a status marker. Next CLI invocation surfaces a one-line
|
|
6
6
|
* notice if upstream is ahead. Pulling is left to the user via `agents repo pull`.
|
package/dist/lib/beta.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Preview features live in the git-trackable user repo (~/.agents/agents.yaml)
|
|
5
5
|
* when present, and otherwise fall back to the local system state file
|
|
6
|
-
* (~/.agents
|
|
6
|
+
* (~/.agents/.system/agents.yaml). This keeps opt-ins portable for users with a
|
|
7
7
|
* personal agents repo without mixing them into unrelated version capability
|
|
8
8
|
* checks.
|
|
9
9
|
*/
|
package/dist/lib/beta.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Preview features live in the git-trackable user repo (~/.agents/agents.yaml)
|
|
5
5
|
* when present, and otherwise fall back to the local system state file
|
|
6
|
-
* (~/.agents
|
|
6
|
+
* (~/.agents/.system/agents.yaml). This keeps opt-ins portable for users with a
|
|
7
7
|
* personal agents repo without mixing them into unrelated version capability
|
|
8
8
|
* checks.
|
|
9
9
|
*/
|
package/dist/lib/capabilities.js
CHANGED
|
@@ -46,6 +46,8 @@ export function supports(agent, cap, version) {
|
|
|
46
46
|
return { ok: false, reason: 'unsupported' };
|
|
47
47
|
if (c === true)
|
|
48
48
|
return { ok: true };
|
|
49
|
+
if ('file' in c)
|
|
50
|
+
return { ok: true };
|
|
49
51
|
if (!version)
|
|
50
52
|
return { ok: true };
|
|
51
53
|
if (c.since && compareVersions(version, c.since) < 0) {
|
package/dist/lib/commands.d.ts
CHANGED
|
@@ -13,7 +13,28 @@ export type CommandScope = 'user' | 'project';
|
|
|
13
13
|
export interface CommandMetadata {
|
|
14
14
|
name: string;
|
|
15
15
|
description: string;
|
|
16
|
+
/** When set, sync only to these agents (aliases resolved at parse time). */
|
|
17
|
+
agents?: AgentId[];
|
|
18
|
+
/** Minimum agent CLI version (inclusive) for this command. */
|
|
19
|
+
since?: string;
|
|
20
|
+
/** Exclusive upper bound on agent CLI version for this command. */
|
|
21
|
+
until?: string;
|
|
16
22
|
}
|
|
23
|
+
export type CommandApplyFailReason = 'unsupported' | 'agent_excluded' | 'too_old' | 'too_new';
|
|
24
|
+
export type CommandApplyResult = {
|
|
25
|
+
ok: true;
|
|
26
|
+
} | {
|
|
27
|
+
ok: false;
|
|
28
|
+
reason: CommandApplyFailReason;
|
|
29
|
+
need?: string;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Whether a slash command should sync to the given agent@version. Checks
|
|
33
|
+
* frontmatter `agents` / `since` / `until` after the agent-level commands
|
|
34
|
+
* (or commands-as-skills) capability gate.
|
|
35
|
+
*/
|
|
36
|
+
export declare function commandAppliesTo(agent: AgentId, version: string, metadata: Pick<CommandMetadata, 'agents' | 'since' | 'until'> | null | undefined): CommandApplyResult;
|
|
37
|
+
export declare function explainCommandSkip(agent: AgentId, version: string, commandName: string, result: CommandApplyResult): string;
|
|
17
38
|
/** Result of validating command metadata. */
|
|
18
39
|
export interface ValidationResult {
|
|
19
40
|
valid: boolean;
|
|
@@ -35,6 +56,8 @@ export interface InstalledCommand {
|
|
|
35
56
|
path: string;
|
|
36
57
|
description?: string;
|
|
37
58
|
}
|
|
59
|
+
/** Parse command metadata (name, description, targeting) from YAML frontmatter or TOML headers. */
|
|
60
|
+
export declare function parseCommandMetadata(filePath: string): CommandMetadata | null;
|
|
38
61
|
/** Discover all command markdown files in a repository's commands/ directory. */
|
|
39
62
|
export declare function discoverCommands(repoPath: string): DiscoveredCommand[];
|
|
40
63
|
/** Find the source path for a command in a repository. */
|
|
@@ -59,6 +82,8 @@ export interface VersionCommandDiff {
|
|
|
59
82
|
toAdd: string[];
|
|
60
83
|
toUpdate: string[];
|
|
61
84
|
matched: string[];
|
|
85
|
+
/** Installed but excluded by frontmatter agents/since/until — safe to remove. */
|
|
86
|
+
toRemove: string[];
|
|
62
87
|
orphans: string[];
|
|
63
88
|
}
|
|
64
89
|
/**
|
|
@@ -72,6 +97,8 @@ export declare function diffVersionCommands(agent: AgentId, version: string): Ve
|
|
|
72
97
|
export declare function installCommandToVersion(agent: AgentId, version: string, commandName: string, method?: 'symlink' | 'copy'): {
|
|
73
98
|
success: boolean;
|
|
74
99
|
error?: string;
|
|
100
|
+
skipped?: boolean;
|
|
101
|
+
skipReason?: string;
|
|
75
102
|
};
|
|
76
103
|
/**
|
|
77
104
|
* Remove a single command from a specific version home.
|
|
@@ -112,7 +139,7 @@ export declare function installCommandCentrally(sourcePath: string, commandName:
|
|
|
112
139
|
warnings?: string[];
|
|
113
140
|
};
|
|
114
141
|
/**
|
|
115
|
-
* List commands from user (~/.agents/commands/) and system (~/.agents
|
|
142
|
+
* List commands from user (~/.agents/commands/) and system (~/.agents/.system/commands/) dirs.
|
|
116
143
|
* User dir takes priority; deduplication preserves first occurrence.
|
|
117
144
|
*/
|
|
118
145
|
export declare function listCentralCommands(): string[];
|