@agentver/cli 0.1.0 → 0.1.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/dist/agentver.js CHANGED
@@ -1,18 +1,21 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // bin/agentver.ts
4
- import { createRequire } from "module";
4
+ import { createRequire as createRequire2 } from "module";
5
+ import { dirname as dirname6, join as join23 } from "path";
6
+ import { fileURLToPath as fileURLToPath2 } from "url";
5
7
  import { Command } from "commander";
8
+ import chalk28 from "chalk";
6
9
  import updateNotifier from "update-notifier";
7
10
 
8
11
  // src/commands/adopt.ts
9
- import { readFileSync as readFileSync4 } from "fs";
12
+ import { readFileSync as readFileSync3 } from "fs";
10
13
  import { homedir } from "os";
11
14
  import { dirname } from "path";
12
15
 
13
16
  // ../agent-definitions/src/agents/definitions.ts
14
17
  var AGENT_DEFINITIONS = [
15
- // --- Existing agents (updated with category + aliases) ---
18
+ // --- Chat and IDE agents ---
16
19
  {
17
20
  id: "claude-code",
18
21
  name: "Claude Code",
@@ -124,7 +127,7 @@ var AGENT_DEFINITIONS = [
124
127
  configDirs: [".aider"],
125
128
  category: "agent-specific"
126
129
  },
127
- // --- New universal agents (projectSkillPath = .agents/skills) ---
130
+ // --- Universal agents ---
128
131
  {
129
132
  id: "amp",
130
133
  name: "Amp",
@@ -170,7 +173,7 @@ var AGENT_DEFINITIONS = [
170
173
  configDirs: [],
171
174
  category: "universal"
172
175
  },
173
- // --- New agent-specific (simple pattern) ---
176
+ // --- Agent-specific (simple pattern) ---
174
177
  {
175
178
  id: "adal",
176
179
  name: "AdaL",
@@ -360,7 +363,7 @@ var AGENT_DEFINITIONS = [
360
363
  configDirs: [".zencoder"],
361
364
  category: "agent-specific"
362
365
  },
363
- // --- New agent-specific (unusual paths) ---
366
+ // --- Agent-specific (unusual paths) ---
364
367
  {
365
368
  id: "antigravity",
366
369
  name: "Antigravity",
@@ -543,7 +546,7 @@ var CONFIG_TRANSLATORS = [
543
546
  `;
544
547
  }
545
548
  },
546
- // New agents with specific config formats
549
+ // Agents with specific config formats
547
550
  {
548
551
  agentId: "cline",
549
552
  filePath: (name) => `.clinerules/${name}.md`,
@@ -770,10 +773,8 @@ function inferDetectedType(fileName) {
770
773
  "guidelines.md",
771
774
  ".aider.conf.yml",
772
775
  "config.yaml",
773
- // New agent config patterns
774
776
  ".clinerules",
775
- ".replit",
776
- "config.yaml"
777
+ ".replit"
777
778
  ];
778
779
  if (agentConfigPatterns.some((p) => lower.endsWith(p))) return "AGENT_CONFIG";
779
780
  return "SKILL";
@@ -839,18 +840,18 @@ function createSpinner(text) {
839
840
 
840
841
  // src/storage/integrity.ts
841
842
  import { createHash } from "crypto";
842
- import { readFileSync } from "fs";
843
843
  function computeSha256FromBuffer(content) {
844
844
  const hash = createHash("sha256").update(content).digest("base64");
845
845
  return `sha256-${hash}`;
846
846
  }
847
847
  function computeSha256FromFiles(files) {
848
- const combined = files.map((f) => f.content).join("");
848
+ const sorted = [...files].sort((a, b) => a.path.localeCompare(b.path));
849
+ const combined = sorted.map((f) => `${f.path}\0${f.content}`).join("\0");
849
850
  return computeSha256FromBuffer(combined);
850
851
  }
851
852
 
852
853
  // src/storage/lockfile.ts
853
- import { existsSync as existsSync2, mkdirSync, readFileSync as readFileSync2, renameSync, writeFileSync } from "fs";
854
+ import { existsSync as existsSync2, mkdirSync, readFileSync, renameSync, writeFileSync } from "fs";
854
855
  import { join as join2 } from "path";
855
856
 
856
857
  // ../shared/dist/cli-output.js
@@ -858,6 +859,12 @@ import { z as z2 } from "zod";
858
859
 
859
860
  // ../shared/dist/schemas.js
860
861
  import { z } from "zod";
862
+
863
+ // ../shared/dist/constants.js
864
+ var PACKAGE_TYPES = ["SKILL", "AGENT_CONFIG", "PLUGIN", "SCRIPT", "PROMPT"];
865
+ var WARNING_NO_LICENCE = "No licence specified. Consider adding an SPDX licence identifier.";
866
+
867
+ // ../shared/dist/schemas.js
861
868
  var AGENT_IDS_FOR_SCHEMA = [
862
869
  "adal",
863
870
  "aider",
@@ -908,7 +915,7 @@ var skillMetadataSchema = z.object({
908
915
  name: z.string().min(1).max(100),
909
916
  description: z.string().max(500).optional(),
910
917
  version: z.string().regex(/^\d+\.\d+\.\d+(-[\w.]+)?$/, "Must be valid semver"),
911
- type: z.enum(["SKILL", "AGENT_CONFIG", "PLUGIN", "SCRIPT", "PROMPT"]),
918
+ type: z.enum(PACKAGE_TYPES),
912
919
  tags: z.array(z.string().max(50)).max(20).default([]),
913
920
  agents: z.array(agentIdEnum).default([])
914
921
  });
@@ -971,7 +978,7 @@ var lockfileV2Schema = z.object({
971
978
  var manifestAnySchema = z.discriminatedUnion("version", [manifestSchema, manifestV2Schema]);
972
979
  var lockfileAnySchema = z.discriminatedUnion("version", [lockfileSchema, lockfileV2Schema]);
973
980
  var packageStructureSchema = z.object({
974
- type: z.enum(["SKILL", "AGENT_CONFIG", "PLUGIN", "SCRIPT", "PROMPT"]),
981
+ type: z.enum(PACKAGE_TYPES),
975
982
  entryFile: z.string(),
976
983
  requiredFiles: z.array(z.string()).default([]),
977
984
  optionalDirs: z.array(z.string()).default([])
@@ -1031,7 +1038,7 @@ var fileManifestSchema = z.object({
1031
1038
  files: z.array(fileManifestEntrySchema),
1032
1039
  totalSize: z.number().int().nonnegative(),
1033
1040
  entryFile: z.string(),
1034
- packageType: z.enum(["SKILL", "AGENT_CONFIG", "PLUGIN", "SCRIPT", "PROMPT"])
1041
+ packageType: z.enum(PACKAGE_TYPES)
1035
1042
  });
1036
1043
  var agentConfigSchema = z.object({
1037
1044
  name: z.string().min(1),
@@ -1048,7 +1055,6 @@ var cliErrorSchema = z2.object({
1048
1055
  message: z2.string()
1049
1056
  });
1050
1057
  var loginResultSchema = z2.object({
1051
- token: z2.string(),
1052
1058
  user: z2.object({
1053
1059
  id: z2.string(),
1054
1060
  email: z2.string(),
@@ -1768,7 +1774,7 @@ function formatWithOptions(inspectOptions, ...args) {
1768
1774
  const first = args[0];
1769
1775
  let a = 0;
1770
1776
  let str = "";
1771
- let join22 = "";
1777
+ let join24 = "";
1772
1778
  if (typeof first === "string") {
1773
1779
  if (args.length === 1) {
1774
1780
  return first;
@@ -1867,7 +1873,7 @@ function formatWithOptions(inspectOptions, ...args) {
1867
1873
  }
1868
1874
  if (lastPos !== 0) {
1869
1875
  a++;
1870
- join22 = " ";
1876
+ join24 = " ";
1871
1877
  if (lastPos < first.length) {
1872
1878
  str += first.slice(lastPos);
1873
1879
  }
@@ -1875,9 +1881,9 @@ function formatWithOptions(inspectOptions, ...args) {
1875
1881
  }
1876
1882
  while (a < args.length) {
1877
1883
  const value = args[a];
1878
- str += join22;
1884
+ str += join24;
1879
1885
  str += typeof value !== "string" ? inspect(value, inspectOptions) : value;
1880
- join22 = " ";
1886
+ join24 = " ";
1881
1887
  a++;
1882
1888
  }
1883
1889
  return str;
@@ -2988,7 +2994,7 @@ function validateSkillMd(content) {
2988
2994
  }
2989
2995
  const specCompliant = isAgentSkillsSpecCompliant(content);
2990
2996
  if (!agentverParsed.data.license) {
2991
- warnings.push("No license specified. Consider adding an SPDX licence identifier.");
2997
+ warnings.push(WARNING_NO_LICENCE);
2992
2998
  }
2993
2999
  if (!body || body.trim().length === 0) {
2994
3000
  warnings.push("SKILL.md body is empty. Add instructions for agents to follow.");
@@ -3085,7 +3091,7 @@ function readLockfile(projectRoot) {
3085
3091
  if (!existsSync2(lockfilePath)) {
3086
3092
  return EMPTY_LOCKFILE;
3087
3093
  }
3088
- const raw = readFileSync2(lockfilePath, "utf-8");
3094
+ const raw = readFileSync(lockfilePath, "utf-8");
3089
3095
  let parsed;
3090
3096
  try {
3091
3097
  parsed = JSON.parse(raw);
@@ -3115,7 +3121,7 @@ function writeLockfile(projectRoot, lockfile) {
3115
3121
  }
3116
3122
 
3117
3123
  // src/storage/manifest.ts
3118
- import { existsSync as existsSync3, mkdirSync as mkdirSync2, readFileSync as readFileSync3, renameSync as renameSync2, writeFileSync as writeFileSync2 } from "fs";
3124
+ import { existsSync as existsSync3, mkdirSync as mkdirSync2, readFileSync as readFileSync2, renameSync as renameSync2, writeFileSync as writeFileSync2 } from "fs";
3119
3125
  import { join as join3 } from "path";
3120
3126
  var MANIFEST_DIR = ".agentver";
3121
3127
  var MANIFEST_FILE = "manifest.json";
@@ -3146,7 +3152,7 @@ function readManifest(projectRoot) {
3146
3152
  if (!existsSync3(manifestPath)) {
3147
3153
  return EMPTY_MANIFEST;
3148
3154
  }
3149
- const raw = readFileSync3(manifestPath, "utf-8");
3155
+ const raw = readFileSync2(manifestPath, "utf-8");
3150
3156
  let parsed;
3151
3157
  try {
3152
3158
  parsed = JSON.parse(raw);
@@ -3197,7 +3203,7 @@ function deduplicateByPath(files) {
3197
3203
  }
3198
3204
  function computeFileIntegrity(filePath) {
3199
3205
  try {
3200
- const content = readFileSync4(filePath, "utf-8");
3206
+ const content = readFileSync3(filePath, "utf-8");
3201
3207
  return computeSha256FromBuffer(content);
3202
3208
  } catch {
3203
3209
  return computeSha256FromBuffer("");
@@ -3347,18 +3353,16 @@ import chalk4 from "chalk";
3347
3353
  // src/git/fetcher.ts
3348
3354
  import { execFile } from "child_process";
3349
3355
  import { randomUUID } from "crypto";
3350
- import { mkdir, readdir, readFile, rm as rm2, stat, writeFile } from "fs/promises";
3356
+ import { mkdir, readdir, readFile, rm, stat, writeFile } from "fs/promises";
3351
3357
  import { tmpdir } from "os";
3352
3358
  import { join as join5 } from "path";
3353
3359
  import { promisify } from "util";
3354
3360
 
3355
3361
  // src/git/cache.ts
3356
- import { existsSync as existsSync4, mkdirSync as mkdirSync3, readdirSync as readdirSync2, readFileSync as readFileSync5, statSync as statSync2, writeFileSync as writeFileSync3 } from "fs";
3357
- import { rm } from "fs/promises";
3362
+ import { existsSync as existsSync4, mkdirSync as mkdirSync3, readdirSync as readdirSync2, readFileSync as readFileSync4, statSync as statSync2, writeFileSync as writeFileSync3 } from "fs";
3358
3363
  import { homedir as homedir2 } from "os";
3359
3364
  import { dirname as dirname2, join as join4 } from "path";
3360
3365
  var logger = createLogger("git:cache");
3361
- var REF_STALE_MS = 5 * 60 * 1e3;
3362
3366
  function getCacheDir() {
3363
3367
  return join4(homedir2(), ".agentver", "cache");
3364
3368
  }
@@ -3412,7 +3416,7 @@ function readCachedFilesSync(dirPath, basePath = "") {
3412
3416
  }
3413
3417
  if (!entry.isFile()) continue;
3414
3418
  try {
3415
- const content = readFileSync5(fullPath, "utf-8");
3419
+ const content = readFileSync4(fullPath, "utf-8");
3416
3420
  const fileStat = statSync2(fullPath);
3417
3421
  files.push({ path: relativePath, content, size: fileStat.size });
3418
3422
  } catch {
@@ -3669,7 +3673,7 @@ async function fetchGitHubArchive(source, commitSha) {
3669
3673
  const readFrom = source.path ? join5(extractDir, source.path) : extractDir;
3670
3674
  return await readFilesFromDirectory(readFrom);
3671
3675
  } finally {
3672
- await rm2(tempDir, { recursive: true, force: true }).catch(() => {
3676
+ await rm(tempDir, { recursive: true, force: true }).catch(() => {
3673
3677
  });
3674
3678
  }
3675
3679
  }
@@ -3702,7 +3706,7 @@ async function fetchGitLabArchive(source, commitSha) {
3702
3706
  const readFrom = source.path ? join5(extractDir, source.path) : extractDir;
3703
3707
  return await readFilesFromDirectory(readFrom);
3704
3708
  } finally {
3705
- await rm2(tempDir, { recursive: true, force: true }).catch(() => {
3709
+ await rm(tempDir, { recursive: true, force: true }).catch(() => {
3706
3710
  });
3707
3711
  }
3708
3712
  }
@@ -3724,7 +3728,7 @@ async function fetchGitArchiveCommand(source, commitSha) {
3724
3728
  const readFrom = source.path ? join5(extractDir, source.path) : extractDir;
3725
3729
  return await readFilesFromDirectory(readFrom);
3726
3730
  } finally {
3727
- await rm2(tempDir, { recursive: true, force: true }).catch(() => {
3731
+ await rm(tempDir, { recursive: true, force: true }).catch(() => {
3728
3732
  });
3729
3733
  }
3730
3734
  }
@@ -3748,7 +3752,7 @@ async function fetchViaSparseCheckout(resolved) {
3748
3752
  const readFrom = source.path ? join5(tempDir, source.path) : tempDir;
3749
3753
  return await readFilesFromDirectory(readFrom);
3750
3754
  } finally {
3751
- await rm2(tempDir, { recursive: true, force: true }).catch(() => {
3755
+ await rm(tempDir, { recursive: true, force: true }).catch(() => {
3752
3756
  });
3753
3757
  }
3754
3758
  }
@@ -3764,7 +3768,7 @@ async function fetchViaClone(resolved) {
3764
3768
  const readFrom = source.path ? join5(tempDir, source.path) : tempDir;
3765
3769
  return await readFilesFromDirectory(readFrom);
3766
3770
  } finally {
3767
- await rm2(tempDir, { recursive: true, force: true }).catch(() => {
3771
+ await rm(tempDir, { recursive: true, force: true }).catch(() => {
3768
3772
  });
3769
3773
  }
3770
3774
  }
@@ -4477,12 +4481,12 @@ function renderScanResult(result, spinner) {
4477
4481
  }
4478
4482
 
4479
4483
  // src/registry/config.ts
4480
- import { existsSync as existsSync6, mkdirSync as mkdirSync5, readFileSync as readFileSync7, writeFileSync as writeFileSync5 } from "fs";
4484
+ import { existsSync as existsSync6, mkdirSync as mkdirSync5, readFileSync as readFileSync6, writeFileSync as writeFileSync5 } from "fs";
4481
4485
  import { homedir as homedir4 } from "os";
4482
4486
  import { join as join7 } from "path";
4483
4487
 
4484
4488
  // src/registry/auth.ts
4485
- import { existsSync as existsSync5, mkdirSync as mkdirSync4, readFileSync as readFileSync6, writeFileSync as writeFileSync4 } from "fs";
4489
+ import { existsSync as existsSync5, mkdirSync as mkdirSync4, readFileSync as readFileSync5, writeFileSync as writeFileSync4 } from "fs";
4486
4490
  import { homedir as homedir3 } from "os";
4487
4491
  import { join as join6 } from "path";
4488
4492
  function getCredentialsPath() {
@@ -4493,7 +4497,7 @@ async function getCredentials() {
4493
4497
  if (!existsSync5(credPath)) {
4494
4498
  return null;
4495
4499
  }
4496
- const raw = readFileSync6(credPath, "utf-8");
4500
+ const raw = readFileSync5(credPath, "utf-8");
4497
4501
  try {
4498
4502
  return JSON.parse(raw);
4499
4503
  } catch {
@@ -4527,7 +4531,7 @@ function readConfig() {
4527
4531
  return {};
4528
4532
  }
4529
4533
  try {
4530
- const raw = readFileSync7(CONFIG_PATH, "utf-8");
4534
+ const raw = readFileSync6(CONFIG_PATH, "utf-8");
4531
4535
  return JSON.parse(raw);
4532
4536
  } catch {
4533
4537
  return {};
@@ -4675,13 +4679,14 @@ import {
4675
4679
  rmSync,
4676
4680
  symlinkSync
4677
4681
  } from "fs";
4682
+ import { homedir as homedir5 } from "os";
4678
4683
  import { dirname as dirname3, join as join8, relative } from "path";
4679
4684
  import chalk3 from "chalk";
4680
4685
  var logger3 = createLogger("canonical");
4681
4686
  var CANONICAL_DIR = ".agents/skills";
4682
4687
  function getCanonicalSkillPath(projectRoot, name, scope) {
4683
4688
  if (scope === "global") {
4684
- const home = process.env.HOME ?? "";
4689
+ const home = homedir5();
4685
4690
  return join8(home, CANONICAL_DIR, name);
4686
4691
  }
4687
4692
  return join8(projectRoot, CANONICAL_DIR, name);
@@ -4695,7 +4700,7 @@ function createAgentSymlinks(projectRoot, name, agents, scope) {
4695
4700
  for (const agentId of agents) {
4696
4701
  const placementPath = getSkillPlacementPath(agentId, name, scope);
4697
4702
  if (!placementPath) continue;
4698
- const agentSkillPath = scope === "global" ? placementPath.replace("~", process.env.HOME ?? "") : join8(projectRoot, placementPath);
4703
+ const agentSkillPath = scope === "global" ? placementPath.replace("~", homedir5()) : join8(projectRoot, placementPath);
4699
4704
  if (existsSync7(agentSkillPath) || isSymlink(agentSkillPath)) {
4700
4705
  rmSync(agentSkillPath, { recursive: true, force: true });
4701
4706
  }
@@ -4718,7 +4723,7 @@ function removeAgentSymlinks(projectRoot, name, agents, scope) {
4718
4723
  for (const agentId of agents) {
4719
4724
  const placementPath = getSkillPlacementPath(agentId, name, scope);
4720
4725
  if (!placementPath) continue;
4721
- const agentSkillPath = scope === "global" ? placementPath.replace("~", process.env.HOME ?? "") : join8(projectRoot, placementPath);
4726
+ const agentSkillPath = scope === "global" ? placementPath.replace("~", homedir5()) : join8(projectRoot, placementPath);
4722
4727
  if (existsSync7(agentSkillPath) || isSymlink(agentSkillPath)) {
4723
4728
  rmSync(agentSkillPath, { recursive: true, force: true });
4724
4729
  }
@@ -4740,7 +4745,7 @@ function resolveReadPath(projectRoot, packageName, agents, scope = "project") {
4740
4745
  for (const agentId of agents) {
4741
4746
  const placementPath = getSkillPlacementPath(agentId, packageName, scope);
4742
4747
  if (!placementPath) continue;
4743
- const fullPath = scope === "global" ? placementPath.replace("~", process.env.HOME ?? "") : join8(projectRoot, placementPath);
4748
+ const fullPath = scope === "global" ? placementPath.replace("~", homedir5()) : join8(projectRoot, placementPath);
4744
4749
  if (existsSync7(fullPath)) {
4745
4750
  if (isSymlink(fullPath)) {
4746
4751
  const target = readlinkSync(fullPath);
@@ -4791,7 +4796,7 @@ function buildSourceFromManifest(pkg2) {
4791
4796
  if (!pkg2 || pkg2.source.type !== "git") {
4792
4797
  return FALLBACK_SOURCE;
4793
4798
  }
4794
- const source = pkg2.source;
4799
+ const { source } = pkg2;
4795
4800
  const parts = source.uri.split("/");
4796
4801
  return {
4797
4802
  host: parts[0] ?? "github.com",
@@ -5150,7 +5155,7 @@ function computeHunks(oldLines, newLines) {
5150
5155
  const lcs = computeLcs(oldLines, newLines);
5151
5156
  const changes = buildChangeList(oldLines, newLines, lcs);
5152
5157
  if (changes.length === 0) return [];
5153
- return groupIntoHunks(changes, oldLines.length, newLines.length);
5158
+ return groupIntoHunks(changes);
5154
5159
  }
5155
5160
  function computeLcs(a, b) {
5156
5161
  const m = a.length;
@@ -5208,7 +5213,7 @@ function buildChangeList(oldLines, newLines, lcs) {
5208
5213
  }
5209
5214
  return changes;
5210
5215
  }
5211
- function groupIntoHunks(changes, _oldTotal, _newTotal) {
5216
+ function groupIntoHunks(changes) {
5212
5217
  const diffIndices = [];
5213
5218
  for (let i = 0; i < changes.length; i++) {
5214
5219
  if (changes[i].type !== "context") {
@@ -5442,7 +5447,7 @@ function registerDiffCommand(program2) {
5442
5447
  }
5443
5448
 
5444
5449
  // src/commands/draft.ts
5445
- import { existsSync as existsSync8, readFileSync as readFileSync8 } from "fs";
5450
+ import { existsSync as existsSync8, readFileSync as readFileSync7 } from "fs";
5446
5451
  import { basename as basename2, join as join10 } from "path";
5447
5452
  import chalk6 from "chalk";
5448
5453
  import ora2 from "ora";
@@ -5503,7 +5508,7 @@ function resolveSkillIdentity() {
5503
5508
  const skillMdPath = join10(cwd, "SKILL.md");
5504
5509
  let skillName = null;
5505
5510
  if (existsSync8(skillMdPath)) {
5506
- const content = readFileSync8(skillMdPath, "utf-8");
5511
+ const content = readFileSync7(skillMdPath, "utf-8");
5507
5512
  const nameMatch = content.match(/^name:\s*(.+)$/m);
5508
5513
  skillName = nameMatch?.[1]?.trim() ?? basename2(cwd);
5509
5514
  }
@@ -6185,7 +6190,8 @@ Created ${fileName} in ./${packageName}/`));
6185
6190
  }
6186
6191
 
6187
6192
  // src/commands/install.ts
6188
- import { existsSync as existsSync10, mkdirSync as mkdirSync8, readFileSync as readFileSync9, writeFileSync as writeFileSync7 } from "fs";
6193
+ import { existsSync as existsSync10, mkdirSync as mkdirSync8, readFileSync as readFileSync8, writeFileSync as writeFileSync7 } from "fs";
6194
+ import { homedir as homedir6 } from "os";
6189
6195
  import { dirname as dirname4, join as join12, relative as relative2, resolve } from "path";
6190
6196
  import chalk8 from "chalk";
6191
6197
  import prompts2 from "prompts";
@@ -6867,14 +6873,14 @@ async function installAgentConfig(name, files, agents, options, spinner) {
6867
6873
  for (const agentId of agents) {
6868
6874
  const configPath = getConfigFilePath(agentId, name);
6869
6875
  if (!configPath) continue;
6870
- const fullConfigPath = options.global ? configPath.replace("~", process.env.HOME ?? "") : join12(projectRoot, configPath);
6876
+ const fullConfigPath = options.global ? configPath.replace("~", homedir6()) : join12(projectRoot, configPath);
6871
6877
  const configDir = join12(fullConfigPath, "..");
6872
6878
  if (!existsSync10(configDir)) {
6873
6879
  mkdirSync8(configDir, { recursive: true });
6874
6880
  }
6875
6881
  let finalContent = configContent;
6876
6882
  if (existsSync10(fullConfigPath)) {
6877
- const existingContent = readFileSync9(fullConfigPath, "utf-8");
6883
+ const existingContent = readFileSync8(fullConfigPath, "utf-8");
6878
6884
  if (isComposedConfig(existingContent)) {
6879
6885
  const existingSections = parseComposedSections(existingContent);
6880
6886
  const alreadyPresent = existingSections.some((s) => s.packageName === name);
@@ -7000,7 +7006,7 @@ Installed packages (${entries.length}):
7000
7006
  }
7001
7007
 
7002
7008
  // src/commands/log.ts
7003
- import { existsSync as existsSync11, readFileSync as readFileSync10 } from "fs";
7009
+ import { existsSync as existsSync11, readFileSync as readFileSync9 } from "fs";
7004
7010
  import { basename as basename3, join as join13 } from "path";
7005
7011
  import chalk10 from "chalk";
7006
7012
  import ora3 from "ora";
@@ -7021,7 +7027,7 @@ function resolveSkillIdentity2(nameArg) {
7021
7027
  const skillMdPath = join13(cwd, "SKILL.md");
7022
7028
  let skillName = null;
7023
7029
  if (existsSync11(skillMdPath)) {
7024
- const content = readFileSync10(skillMdPath, "utf-8");
7030
+ const content = readFileSync9(skillMdPath, "utf-8");
7025
7031
  const nameMatch = content.match(/^name:\s*(.+)$/m);
7026
7032
  skillName = nameMatch?.[1]?.trim() ?? basename3(cwd);
7027
7033
  }
@@ -7359,7 +7365,6 @@ function registerLoginCommand(program2) {
7359
7365
  const target = url ?? getPlatformUrl();
7360
7366
  if (isJSONMode()) {
7361
7367
  outputSuccess({
7362
- token: options.token,
7363
7368
  user: { id: "", email: "", name: "" }
7364
7369
  });
7365
7370
  return;
@@ -7472,7 +7477,7 @@ function registerLogoutCommand(program2) {
7472
7477
  }
7473
7478
 
7474
7479
  // src/commands/publish.ts
7475
- import { existsSync as existsSync12, readFileSync as readFileSync11 } from "fs";
7480
+ import { existsSync as existsSync12, readFileSync as readFileSync10 } from "fs";
7476
7481
  import { basename as basename4, join as join14, resolve as resolve2 } from "path";
7477
7482
  import chalk14 from "chalk";
7478
7483
  import ora4 from "ora";
@@ -7503,7 +7508,7 @@ function parseFrontmatter2(content) {
7503
7508
  function detectNamespace(skillDir) {
7504
7509
  const skillMdPath = join14(skillDir, "SKILL.md");
7505
7510
  if (!existsSync12(skillMdPath)) return null;
7506
- const content = readFileSync11(skillMdPath, "utf-8");
7511
+ const content = readFileSync10(skillMdPath, "utf-8");
7507
7512
  const fm = parseFrontmatter2(content);
7508
7513
  if (!fm) return null;
7509
7514
  const parts = skillDir.split("/");
@@ -7526,7 +7531,7 @@ function registerPublishCommand(program2) {
7526
7531
  }
7527
7532
  const spinner = ora4("Reading skill metadata...").start();
7528
7533
  try {
7529
- const skillMdContent = readFileSync11(join14(skillDir, "SKILL.md"), "utf-8");
7534
+ const skillMdContent = readFileSync10(join14(skillDir, "SKILL.md"), "utf-8");
7530
7535
  const frontmatter = parseFrontmatter2(skillMdContent);
7531
7536
  if (!frontmatter) {
7532
7537
  spinner.fail(
@@ -7769,7 +7774,7 @@ function isSymlinkPath(filePath) {
7769
7774
  }
7770
7775
 
7771
7776
  // src/commands/save.ts
7772
- import { existsSync as existsSync14, readFileSync as readFileSync12 } from "fs";
7777
+ import { existsSync as existsSync14, readFileSync as readFileSync11 } from "fs";
7773
7778
  import { basename as basename5, join as join16, resolve as resolve3 } from "path";
7774
7779
  import chalk16 from "chalk";
7775
7780
  import ora5 from "ora";
@@ -7778,7 +7783,7 @@ function detectSkillName(skillDir) {
7778
7783
  if (!existsSync14(skillMdPath)) {
7779
7784
  return null;
7780
7785
  }
7781
- const content = readFileSync12(skillMdPath, "utf-8");
7786
+ const content = readFileSync11(skillMdPath, "utf-8");
7782
7787
  const nameMatch = content.match(/^name:\s*(.+)$/m);
7783
7788
  return nameMatch?.[1]?.trim() ?? basename5(skillDir);
7784
7789
  }
@@ -7910,19 +7915,19 @@ function registerSaveCommand(program2) {
7910
7915
  }
7911
7916
 
7912
7917
  // src/commands/scan.ts
7913
- import { readFileSync as readFileSync13 } from "fs";
7914
- import { homedir as homedir5 } from "os";
7918
+ import { readFileSync as readFileSync12 } from "fs";
7919
+ import { homedir as homedir7 } from "os";
7915
7920
  import chalk17 from "chalk";
7916
7921
  function registerScanCommand(program2) {
7917
7922
  program2.command("scan [path]").description("Scan directory for agent configs and skills").action(async (path) => {
7918
7923
  const jsonMode = isJSONMode();
7919
7924
  const targetPath = path ?? process.cwd();
7920
7925
  const projectAgents = detectInstalledAgents(targetPath);
7921
- const globalAgents = detectGlobalAgents(homedir5());
7926
+ const globalAgents = detectGlobalAgents(homedir7());
7922
7927
  const seenIds = new Set(projectAgents.map((a) => a.id));
7923
7928
  const agents = [...projectAgents, ...globalAgents.filter((a) => !seenIds.has(a.id))];
7924
7929
  const projectFiles = scanForSkillFiles(targetPath);
7925
- const globalFiles = scanGlobalSkillFiles(homedir5());
7930
+ const globalFiles = scanGlobalSkillFiles(homedir7());
7926
7931
  const seenPaths = new Set(projectFiles.map((f) => f.path));
7927
7932
  const files = [...projectFiles, ...globalFiles.filter((f) => !seenPaths.has(f.path))];
7928
7933
  if (jsonMode) {
@@ -7965,7 +7970,7 @@ function registerScanCommand(program2) {
7965
7970
  for (const file of skillFiles) {
7966
7971
  let content;
7967
7972
  try {
7968
- content = readFileSync13(file.path, "utf-8");
7973
+ content = readFileSync12(file.path, "utf-8");
7969
7974
  } catch {
7970
7975
  console.log(` ${chalk17.red("\u2717")} ${file.name} ${chalk17.dim("Could not read file")}`);
7971
7976
  continue;
@@ -8538,9 +8543,9 @@ function registerSuggestCommand(program2) {
8538
8543
  if (modifiedPackages.length === 0) {
8539
8544
  if (json) {
8540
8545
  outputError("NO_CHANGES", "No modified packages detected.");
8541
- } else {
8542
- console.log(chalk20.dim("No modified packages detected."));
8546
+ process.exit(1);
8543
8547
  }
8548
+ console.log(chalk20.dim("No modified packages detected."));
8544
8549
  return;
8545
8550
  }
8546
8551
  const targetName = modifiedPackages[0];
@@ -8869,9 +8874,11 @@ function registerSyncCommand(program2) {
8869
8874
  clearTimeout(timeoutId);
8870
8875
  if (!response.ok) {
8871
8876
  const errorText = await response.text().catch(() => "Unknown error");
8872
- spinner.fail(`Sync failed (${response.status}): ${errorText}`);
8873
8877
  if (isJSONMode()) {
8878
+ spinner.stop();
8874
8879
  outputError("SYNC_FAILED", `Sync failed (${response.status}): ${errorText}`);
8880
+ } else {
8881
+ spinner.fail(`Sync failed (${response.status}): ${errorText}`);
8875
8882
  }
8876
8883
  process.exit(1);
8877
8884
  }
@@ -8889,14 +8896,18 @@ function registerSyncCommand(program2) {
8889
8896
  );
8890
8897
  } catch (error) {
8891
8898
  if (error instanceof DOMException && error.name === "AbortError") {
8892
- spinner.fail("Sync timed out. The platform may be experiencing issues.");
8893
8899
  if (isJSONMode()) {
8900
+ spinner.stop();
8894
8901
  outputError("TIMEOUT", "Sync timed out. The platform may be experiencing issues.");
8902
+ } else {
8903
+ spinner.fail("Sync timed out. The platform may be experiencing issues.");
8895
8904
  }
8896
8905
  } else {
8897
- spinner.fail(`Sync failed: ${error instanceof Error ? error.message : String(error)}`);
8898
8906
  if (isJSONMode()) {
8907
+ spinner.stop();
8899
8908
  outputError("SYNC_FAILED", error instanceof Error ? error.message : String(error));
8909
+ } else {
8910
+ spinner.fail(`Sync failed: ${error instanceof Error ? error.message : String(error)}`);
8900
8911
  }
8901
8912
  }
8902
8913
  process.exit(1);
@@ -8911,7 +8922,7 @@ import ora7 from "ora";
8911
8922
  import prompts3 from "prompts";
8912
8923
 
8913
8924
  // src/storage/patches.ts
8914
- import { existsSync as existsSync16, mkdirSync as mkdirSync9, readFileSync as readFileSync14, rmSync as rmSync3, writeFileSync as writeFileSync8 } from "fs";
8925
+ import { existsSync as existsSync16, mkdirSync as mkdirSync9, readFileSync as readFileSync13, rmSync as rmSync3, writeFileSync as writeFileSync8 } from "fs";
8915
8926
  import { join as join18 } from "path";
8916
8927
  var PATCHES_DIR = ".agentver/patches";
8917
8928
  var CONTEXT_LINES2 = 3;
@@ -8961,7 +8972,7 @@ function generatePatch(baseFiles, localFiles, packageName) {
8961
8972
  return `${output.join("\n")}
8962
8973
  `;
8963
8974
  }
8964
- function applyPatch(projectRoot, _packageName, _agents, patchContent) {
8975
+ function applyPatch(projectRoot, patchContent) {
8965
8976
  const filePatches = parsePatch(patchContent);
8966
8977
  const conflicts = [];
8967
8978
  for (const filePatch of filePatches) {
@@ -8999,7 +9010,7 @@ function applyFilePatch(projectRoot, filePatch) {
8999
9010
  if (!existsSync16(fullPath)) {
9000
9011
  return false;
9001
9012
  }
9002
- const currentContent = readFileSync14(fullPath, "utf-8");
9013
+ const currentContent = readFileSync13(fullPath, "utf-8");
9003
9014
  const currentLines = currentContent.split("\n");
9004
9015
  let offset = 0;
9005
9016
  for (const hunk of filePatch.hunks) {
@@ -9436,7 +9447,7 @@ async function handlePatchUpdate(update, projectRoot, agents, spinner) {
9436
9447
  const agentId = agents[0];
9437
9448
  const result = await installPackage(sourceUrl, { agent: agentId });
9438
9449
  spinner.text = `Reapplying local patch for ${update.name}...`;
9439
- const applyResult = applyPatch(projectRoot, update.name, agents, patchContent);
9450
+ const applyResult = applyPatch(projectRoot, patchContent);
9440
9451
  if (applyResult.applied) {
9441
9452
  removePatch(projectRoot, update.name);
9442
9453
  spinner.succeed(`${chalk23.green(update.name)}: updated and local patch reapplied successfully`);
@@ -9698,8 +9709,109 @@ Upstream changes available (${updates.length}):
9698
9709
  });
9699
9710
  }
9700
9711
 
9701
- // src/commands/verify.ts
9712
+ // src/commands/upgrade.ts
9713
+ import { execFile as execFile2 } from "child_process";
9714
+ import { createRequire } from "module";
9715
+ import { dirname as dirname5, join as join21 } from "path";
9716
+ import { fileURLToPath } from "url";
9717
+ import { promisify as promisify2 } from "util";
9702
9718
  import chalk24 from "chalk";
9719
+ var execFileAsync2 = promisify2(execFile2);
9720
+ var PACKAGE_NAME = "@agentver/cli";
9721
+ function getCurrentVersion() {
9722
+ const __dirname2 = dirname5(fileURLToPath(import.meta.url));
9723
+ const require3 = createRequire(import.meta.url);
9724
+ const pkg2 = require3(join21(__dirname2, "..", "..", "package.json"));
9725
+ return pkg2.version;
9726
+ }
9727
+ async function getLatestVersion() {
9728
+ const response = await fetch(`https://registry.npmjs.org/${PACKAGE_NAME}/latest`);
9729
+ if (!response.ok) {
9730
+ throw new Error(`Failed to check for updates: ${response.statusText}`);
9731
+ }
9732
+ const data = await response.json();
9733
+ return data.version;
9734
+ }
9735
+ async function detectPackageManager() {
9736
+ const managers = ["bun", "pnpm", "yarn", "npm"];
9737
+ for (const pm of managers) {
9738
+ try {
9739
+ const { stdout } = await execFileAsync2(pm, ["--version"], { timeout: 5e3 });
9740
+ if (stdout.trim()) {
9741
+ const { stdout: listOut } = await execFileAsync2(
9742
+ pm,
9743
+ pm === "npm" ? ["list", "-g", PACKAGE_NAME, "--depth=0"] : ["pm", "ls", "-g"],
9744
+ { timeout: 1e4 }
9745
+ ).catch(() => ({ stdout: "" }));
9746
+ if (listOut.includes("agentver")) {
9747
+ return pm;
9748
+ }
9749
+ }
9750
+ } catch {
9751
+ continue;
9752
+ }
9753
+ }
9754
+ return "npm";
9755
+ }
9756
+ function getInstallArgs(pm) {
9757
+ switch (pm) {
9758
+ case "bun":
9759
+ return ["install", "-g", `${PACKAGE_NAME}@latest`];
9760
+ case "pnpm":
9761
+ return ["add", "-g", `${PACKAGE_NAME}@latest`];
9762
+ case "yarn":
9763
+ return ["global", "add", `${PACKAGE_NAME}@latest`];
9764
+ case "npm":
9765
+ return ["install", "-g", `${PACKAGE_NAME}@latest`];
9766
+ }
9767
+ }
9768
+ function registerUpgradeCommand(program2) {
9769
+ program2.command("upgrade").alias("self-update").description("Upgrade Agentver CLI to the latest version").action(async () => {
9770
+ const json = isJSONMode();
9771
+ const spinner = createSpinner("Checking for updates\u2026");
9772
+ spinner.start();
9773
+ try {
9774
+ const currentVersion = getCurrentVersion();
9775
+ const latestVersion = await getLatestVersion();
9776
+ if (currentVersion === latestVersion) {
9777
+ if (json) {
9778
+ outputSuccess({ current: currentVersion, latest: latestVersion, upToDate: true });
9779
+ } else {
9780
+ spinner.succeed(`Already on the latest version ${chalk24.green(`v${currentVersion}`)}`);
9781
+ }
9782
+ return;
9783
+ }
9784
+ spinner.text = `Upgrading ${chalk24.dim(`v${currentVersion}`)} \u2192 ${chalk24.green(`v${latestVersion}`)}\u2026`;
9785
+ const pm = await detectPackageManager();
9786
+ const args = getInstallArgs(pm);
9787
+ await execFileAsync2(pm, args, { timeout: 6e4 });
9788
+ if (json) {
9789
+ const result = {
9790
+ previous: currentVersion,
9791
+ latest: latestVersion,
9792
+ packageManager: pm
9793
+ };
9794
+ outputSuccess(result);
9795
+ } else {
9796
+ spinner.succeed(
9797
+ `Upgraded ${chalk24.green(`v${currentVersion}`)} \u2192 ${chalk24.green(`v${latestVersion}`)} via ${pm}`
9798
+ );
9799
+ }
9800
+ } catch (error) {
9801
+ const message = error instanceof Error ? error.message : String(error);
9802
+ if (json) {
9803
+ outputError("UPGRADE_FAILED", message);
9804
+ process.exit(1);
9805
+ } else {
9806
+ spinner.fail(`Upgrade failed: ${message}`);
9807
+ process.exit(1);
9808
+ }
9809
+ }
9810
+ });
9811
+ }
9812
+
9813
+ // src/commands/verify.ts
9814
+ import chalk25 from "chalk";
9703
9815
  var FALLBACK_SOURCE2 = {
9704
9816
  host: "github.com",
9705
9817
  owner: "local",
@@ -9711,7 +9823,7 @@ function buildSourceFromManifest2(pkg2) {
9711
9823
  if (!pkg2 || pkg2.source.type !== "git") {
9712
9824
  return FALLBACK_SOURCE2;
9713
9825
  }
9714
- const source = pkg2.source;
9826
+ const { source } = pkg2;
9715
9827
  const parts = source.uri.split("/");
9716
9828
  return {
9717
9829
  host: parts[0] ?? "github.com",
@@ -9744,7 +9856,7 @@ async function runSecurityScan(dirPath, source, strict) {
9744
9856
  } else {
9745
9857
  passed = result.verdict === "PASS" || result.verdict === "WARN";
9746
9858
  }
9747
- const ruleCount = 65;
9859
+ const ruleCount = SCAN_RULES.length;
9748
9860
  return { passed, ruleCount, issueCount, result };
9749
9861
  } catch {
9750
9862
  return { passed: false, ruleCount: 0, issueCount: 0, result: null };
@@ -9766,8 +9878,8 @@ function registerVerifyCommand(program2) {
9766
9878
  outputError("NO_SKILL", "No skill name provided and no packages installed");
9767
9879
  return;
9768
9880
  }
9769
- process.stderr.write(chalk24.red("No skill name provided and no packages installed.\n"));
9770
- process.stderr.write(chalk24.dim("Usage: agentver verify @org/skill-name\n"));
9881
+ process.stderr.write(chalk25.red("No skill name provided and no packages installed.\n"));
9882
+ process.stderr.write(chalk25.dim("Usage: agentver verify @org/skill-name\n"));
9771
9883
  process.exitCode = 1;
9772
9884
  return;
9773
9885
  }
@@ -9782,10 +9894,10 @@ function registerVerifyCommand(program2) {
9782
9894
  return;
9783
9895
  }
9784
9896
  process.stderr.write(
9785
- chalk24.red("Multiple packages installed. Please specify which to verify:\n")
9897
+ chalk25.red("Multiple packages installed. Please specify which to verify:\n")
9786
9898
  );
9787
9899
  for (const pkg2 of packageNames) {
9788
- process.stderr.write(` ${chalk24.cyan(pkg2)}
9900
+ process.stderr.write(` ${chalk25.cyan(pkg2)}
9789
9901
  `);
9790
9902
  }
9791
9903
  process.exitCode = 1;
@@ -9802,7 +9914,7 @@ function registerVerifyCommand(program2) {
9802
9914
  return;
9803
9915
  }
9804
9916
  process.stderr.write(
9805
- chalk24.red(`Invalid skill name "${skillName}". Expected format: @org/skill-name
9917
+ chalk25.red(`Invalid skill name "${skillName}". Expected format: @org/skill-name
9806
9918
  `)
9807
9919
  );
9808
9920
  process.exitCode = 1;
@@ -9810,7 +9922,7 @@ function registerVerifyCommand(program2) {
9810
9922
  }
9811
9923
  if (!jsonMode) {
9812
9924
  process.stderr.write(`
9813
- ${chalk24.bold(`Verifying @${parsed.org}/${parsed.skill}...`)}
9925
+ ${chalk25.bold(`Verifying @${parsed.org}/${parsed.skill}...`)}
9814
9926
 
9815
9927
  `);
9816
9928
  }
@@ -9952,26 +10064,26 @@ ${chalk24.bold(`Verifying @${parsed.org}/${parsed.skill}...`)}
9952
10064
  }
9953
10065
  process.stderr.write("\n");
9954
10066
  if (overallPassed) {
9955
- process.stderr.write(chalk24.green.bold("Skill is verified and safe to use.\n"));
10067
+ process.stderr.write(chalk25.green.bold("Skill is verified and safe to use.\n"));
9956
10068
  } else {
9957
- process.stderr.write(chalk24.red.bold("Skill verification failed.\n"));
10069
+ process.stderr.write(chalk25.red.bold("Skill verification failed.\n"));
9958
10070
  process.exitCode = 1;
9959
10071
  }
9960
10072
  });
9961
10073
  }
9962
10074
 
9963
10075
  // src/commands/version.ts
9964
- import { existsSync as existsSync18, readFileSync as readFileSync15 } from "fs";
9965
- import { basename as basename6, join as join21 } from "path";
9966
- import chalk25 from "chalk";
10076
+ import { existsSync as existsSync18, readFileSync as readFileSync14 } from "fs";
10077
+ import { basename as basename6, join as join22 } from "path";
10078
+ import chalk26 from "chalk";
9967
10079
  import ora8 from "ora";
9968
10080
  var SEMVER_REGEX2 = /^\d+\.\d+\.\d+(-[\w.]+)?$/;
9969
10081
  function resolveSkillIdentity3() {
9970
10082
  const cwd = process.cwd();
9971
- const skillMdPath = join21(cwd, "SKILL.md");
10083
+ const skillMdPath = join22(cwd, "SKILL.md");
9972
10084
  let skillName = null;
9973
10085
  if (existsSync18(skillMdPath)) {
9974
- const content = readFileSync15(skillMdPath, "utf-8");
10086
+ const content = readFileSync14(skillMdPath, "utf-8");
9975
10087
  const nameMatch = content.match(/^name:\s*(.+)$/m);
9976
10088
  skillName = nameMatch?.[1]?.trim() ?? basename6(cwd);
9977
10089
  }
@@ -9999,7 +10111,7 @@ function registerVersionCommand(program2) {
9999
10111
  version.command("create <semver>").description("Create a version tag for the current skill").option("--notes <text>", "Release notes").option("--json", "Output as JSON").action(async (semver, options) => {
10000
10112
  if (!SEMVER_REGEX2.test(semver)) {
10001
10113
  process.stderr.write(
10002
- chalk25.red(`Invalid semver "${semver}". Expected format: 1.0.0 or 1.0.0-beta.1
10114
+ chalk26.red(`Invalid semver "${semver}". Expected format: 1.0.0 or 1.0.0-beta.1
10003
10115
  `)
10004
10116
  );
10005
10117
  process.exit(1);
@@ -10007,7 +10119,7 @@ function registerVersionCommand(program2) {
10007
10119
  const identity = resolveSkillIdentity3();
10008
10120
  if (!identity) {
10009
10121
  process.stderr.write(
10010
- chalk25.red("Could not determine skill identity. Run this from a skill directory.\n")
10122
+ chalk26.red("Could not determine skill identity. Run this from a skill directory.\n")
10011
10123
  );
10012
10124
  process.exit(1);
10013
10125
  }
@@ -10015,7 +10127,7 @@ function registerVersionCommand(program2) {
10015
10127
  const lockEntry = lockfile.packages[identity.name];
10016
10128
  const commitSha = lockEntry?.source.type === "git" ? lockEntry.source.commit : void 0;
10017
10129
  if (!commitSha || commitSha === "unknown") {
10018
- process.stderr.write(chalk25.red("No commit SHA found in lockfile. Save changes first.\n"));
10130
+ process.stderr.write(chalk26.red("No commit SHA found in lockfile. Save changes first.\n"));
10019
10131
  process.exit(1);
10020
10132
  }
10021
10133
  const spinner = ora8(`Creating version ${semver}...`).start();
@@ -10047,7 +10159,7 @@ function registerVersionCommand(program2) {
10047
10159
  );
10048
10160
  } else {
10049
10161
  spinner.succeed(
10050
- `Version ${chalk25.cyan(semver)} created ${chalk25.dim(`(${result.commitSha.slice(0, 7)})`)}`
10162
+ `Version ${chalk26.cyan(semver)} created ${chalk26.dim(`(${result.commitSha.slice(0, 7)})`)}`
10051
10163
  );
10052
10164
  }
10053
10165
  } catch (error) {
@@ -10061,7 +10173,7 @@ function registerVersionCommand(program2) {
10061
10173
  const identity = resolveSkillIdentity3();
10062
10174
  if (!identity) {
10063
10175
  process.stderr.write(
10064
- chalk25.red("Could not determine skill identity. Run this from a skill directory.\n")
10176
+ chalk26.red("Could not determine skill identity. Run this from a skill directory.\n")
10065
10177
  );
10066
10178
  process.exit(1);
10067
10179
  }
@@ -10076,16 +10188,16 @@ function registerVersionCommand(program2) {
10076
10188
  return;
10077
10189
  }
10078
10190
  if (versions.length === 0) {
10079
- process.stdout.write(chalk25.dim("No versions found.\n"));
10191
+ process.stdout.write(chalk26.dim("No versions found.\n"));
10080
10192
  return;
10081
10193
  }
10082
- process.stdout.write(chalk25.bold(`
10194
+ process.stdout.write(chalk26.bold(`
10083
10195
  Versions for @${identity.org}/${identity.name}:
10084
10196
 
10085
10197
  `));
10086
10198
  for (const v of versions) {
10087
10199
  process.stdout.write(
10088
- ` ${chalk25.cyan(v.name)} ${chalk25.dim(`(${v.commitSha.slice(0, 7)})`)} ${chalk25.dim(v.message)}
10200
+ ` ${chalk26.cyan(v.name)} ${chalk26.dim(`(${v.commitSha.slice(0, 7)})`)} ${chalk26.dim(v.message)}
10089
10201
  `
10090
10202
  );
10091
10203
  }
@@ -10100,7 +10212,7 @@ Versions for @${identity.org}/${identity.name}:
10100
10212
  }
10101
10213
 
10102
10214
  // src/commands/whoami.ts
10103
- import chalk26 from "chalk";
10215
+ import chalk27 from "chalk";
10104
10216
  function registerWhoamiCommand(program2) {
10105
10217
  program2.command("whoami").description("Show authentication state").action(async () => {
10106
10218
  const credentials = await getCredentials();
@@ -10109,15 +10221,15 @@ function registerWhoamiCommand(program2) {
10109
10221
  outputSuccess({ authenticated: false });
10110
10222
  return;
10111
10223
  }
10112
- console.log(chalk26.dim("Not authenticated. Run `agentver login` to sign in."));
10224
+ console.log(chalk27.dim("Not authenticated. Run `agentver login` to sign in."));
10113
10225
  return;
10114
10226
  }
10115
10227
  if (!isJSONMode()) {
10116
10228
  if (credentials.apiKey) {
10117
10229
  const prefix = credentials.apiKey.slice(0, 8);
10118
- console.log(`Authenticated via API key: ${chalk26.green(`${prefix}...`)}`);
10230
+ console.log(`Authenticated via API key: ${chalk27.green(`${prefix}...`)}`);
10119
10231
  } else {
10120
- console.log(chalk26.green("Authenticated via OAuth."));
10232
+ console.log(chalk27.green("Authenticated via OAuth."));
10121
10233
  }
10122
10234
  }
10123
10235
  const platformUrl = getPlatformUrl();
@@ -10126,11 +10238,11 @@ function registerWhoamiCommand(program2) {
10126
10238
  outputSuccess({ authenticated: true });
10127
10239
  return;
10128
10240
  }
10129
- console.log(chalk26.dim("Platform: not connected (run `agentver login <url>` to connect)"));
10241
+ console.log(chalk27.dim("Platform: not connected (run `agentver login <url>` to connect)"));
10130
10242
  return;
10131
10243
  }
10132
10244
  if (!isJSONMode()) {
10133
- console.log(`Platform: ${chalk26.cyan(platformUrl)}`);
10245
+ console.log(`Platform: ${chalk27.cyan(platformUrl)}`);
10134
10246
  }
10135
10247
  const me = await platformFetchSilent("/me");
10136
10248
  if (isJSONMode()) {
@@ -10157,9 +10269,13 @@ function registerWhoamiCommand(program2) {
10157
10269
  }
10158
10270
 
10159
10271
  // bin/agentver.ts
10160
- var require2 = createRequire(import.meta.url);
10161
- var pkg = require2("../../package.json");
10162
- updateNotifier({ pkg }).notify();
10272
+ var __dirname = dirname6(fileURLToPath2(import.meta.url));
10273
+ var require2 = createRequire2(import.meta.url);
10274
+ var pkg = require2(join23(__dirname, "..", "package.json"));
10275
+ updateNotifier({ pkg }).notify({
10276
+ message: `Update available: {currentVersion} \u2192 {latestVersion}
10277
+ Run ${chalk28.cyan("agentver upgrade")} to update`
10278
+ });
10163
10279
  var program = new Command();
10164
10280
  program.name("agentver").description("Agent skill registry \u2014 store, version, and distribute AI agent skills").version(pkg.version).option("--json", "Output results as structured JSON");
10165
10281
  registerAdoptCommand(program);
@@ -10182,6 +10298,7 @@ registerSuggestionsCommand(program);
10182
10298
  registerSaveCommand(program);
10183
10299
  registerPublishCommand(program);
10184
10300
  registerDraftCommand(program);
10301
+ registerUpgradeCommand(program);
10185
10302
  registerVerifyCommand(program);
10186
10303
  registerVersionCommand(program);
10187
10304
  registerLogCommand(program);