@agentver/cli 0.1.0 → 0.1.1

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
@@ -2,17 +2,19 @@
2
2
 
3
3
  // bin/agentver.ts
4
4
  import { createRequire } from "module";
5
+ import { dirname as dirname5, join as join22 } from "path";
6
+ import { fileURLToPath } from "url";
5
7
  import { Command } from "commander";
6
8
  import updateNotifier from "update-notifier";
7
9
 
8
10
  // src/commands/adopt.ts
9
- import { readFileSync as readFileSync4 } from "fs";
11
+ import { readFileSync as readFileSync3 } from "fs";
10
12
  import { homedir } from "os";
11
13
  import { dirname } from "path";
12
14
 
13
15
  // ../agent-definitions/src/agents/definitions.ts
14
16
  var AGENT_DEFINITIONS = [
15
- // --- Existing agents (updated with category + aliases) ---
17
+ // --- Chat and IDE agents ---
16
18
  {
17
19
  id: "claude-code",
18
20
  name: "Claude Code",
@@ -124,7 +126,7 @@ var AGENT_DEFINITIONS = [
124
126
  configDirs: [".aider"],
125
127
  category: "agent-specific"
126
128
  },
127
- // --- New universal agents (projectSkillPath = .agents/skills) ---
129
+ // --- Universal agents ---
128
130
  {
129
131
  id: "amp",
130
132
  name: "Amp",
@@ -170,7 +172,7 @@ var AGENT_DEFINITIONS = [
170
172
  configDirs: [],
171
173
  category: "universal"
172
174
  },
173
- // --- New agent-specific (simple pattern) ---
175
+ // --- Agent-specific (simple pattern) ---
174
176
  {
175
177
  id: "adal",
176
178
  name: "AdaL",
@@ -360,7 +362,7 @@ var AGENT_DEFINITIONS = [
360
362
  configDirs: [".zencoder"],
361
363
  category: "agent-specific"
362
364
  },
363
- // --- New agent-specific (unusual paths) ---
365
+ // --- Agent-specific (unusual paths) ---
364
366
  {
365
367
  id: "antigravity",
366
368
  name: "Antigravity",
@@ -543,7 +545,7 @@ var CONFIG_TRANSLATORS = [
543
545
  `;
544
546
  }
545
547
  },
546
- // New agents with specific config formats
548
+ // Agents with specific config formats
547
549
  {
548
550
  agentId: "cline",
549
551
  filePath: (name) => `.clinerules/${name}.md`,
@@ -770,10 +772,8 @@ function inferDetectedType(fileName) {
770
772
  "guidelines.md",
771
773
  ".aider.conf.yml",
772
774
  "config.yaml",
773
- // New agent config patterns
774
775
  ".clinerules",
775
- ".replit",
776
- "config.yaml"
776
+ ".replit"
777
777
  ];
778
778
  if (agentConfigPatterns.some((p) => lower.endsWith(p))) return "AGENT_CONFIG";
779
779
  return "SKILL";
@@ -839,18 +839,18 @@ function createSpinner(text) {
839
839
 
840
840
  // src/storage/integrity.ts
841
841
  import { createHash } from "crypto";
842
- import { readFileSync } from "fs";
843
842
  function computeSha256FromBuffer(content) {
844
843
  const hash = createHash("sha256").update(content).digest("base64");
845
844
  return `sha256-${hash}`;
846
845
  }
847
846
  function computeSha256FromFiles(files) {
848
- const combined = files.map((f) => f.content).join("");
847
+ const sorted = [...files].sort((a, b) => a.path.localeCompare(b.path));
848
+ const combined = sorted.map((f) => `${f.path}\0${f.content}`).join("\0");
849
849
  return computeSha256FromBuffer(combined);
850
850
  }
851
851
 
852
852
  // src/storage/lockfile.ts
853
- import { existsSync as existsSync2, mkdirSync, readFileSync as readFileSync2, renameSync, writeFileSync } from "fs";
853
+ import { existsSync as existsSync2, mkdirSync, readFileSync, renameSync, writeFileSync } from "fs";
854
854
  import { join as join2 } from "path";
855
855
 
856
856
  // ../shared/dist/cli-output.js
@@ -858,6 +858,12 @@ import { z as z2 } from "zod";
858
858
 
859
859
  // ../shared/dist/schemas.js
860
860
  import { z } from "zod";
861
+
862
+ // ../shared/dist/constants.js
863
+ var PACKAGE_TYPES = ["SKILL", "AGENT_CONFIG", "PLUGIN", "SCRIPT", "PROMPT"];
864
+ var WARNING_NO_LICENCE = "No licence specified. Consider adding an SPDX licence identifier.";
865
+
866
+ // ../shared/dist/schemas.js
861
867
  var AGENT_IDS_FOR_SCHEMA = [
862
868
  "adal",
863
869
  "aider",
@@ -908,7 +914,7 @@ var skillMetadataSchema = z.object({
908
914
  name: z.string().min(1).max(100),
909
915
  description: z.string().max(500).optional(),
910
916
  version: z.string().regex(/^\d+\.\d+\.\d+(-[\w.]+)?$/, "Must be valid semver"),
911
- type: z.enum(["SKILL", "AGENT_CONFIG", "PLUGIN", "SCRIPT", "PROMPT"]),
917
+ type: z.enum(PACKAGE_TYPES),
912
918
  tags: z.array(z.string().max(50)).max(20).default([]),
913
919
  agents: z.array(agentIdEnum).default([])
914
920
  });
@@ -971,7 +977,7 @@ var lockfileV2Schema = z.object({
971
977
  var manifestAnySchema = z.discriminatedUnion("version", [manifestSchema, manifestV2Schema]);
972
978
  var lockfileAnySchema = z.discriminatedUnion("version", [lockfileSchema, lockfileV2Schema]);
973
979
  var packageStructureSchema = z.object({
974
- type: z.enum(["SKILL", "AGENT_CONFIG", "PLUGIN", "SCRIPT", "PROMPT"]),
980
+ type: z.enum(PACKAGE_TYPES),
975
981
  entryFile: z.string(),
976
982
  requiredFiles: z.array(z.string()).default([]),
977
983
  optionalDirs: z.array(z.string()).default([])
@@ -1031,7 +1037,7 @@ var fileManifestSchema = z.object({
1031
1037
  files: z.array(fileManifestEntrySchema),
1032
1038
  totalSize: z.number().int().nonnegative(),
1033
1039
  entryFile: z.string(),
1034
- packageType: z.enum(["SKILL", "AGENT_CONFIG", "PLUGIN", "SCRIPT", "PROMPT"])
1040
+ packageType: z.enum(PACKAGE_TYPES)
1035
1041
  });
1036
1042
  var agentConfigSchema = z.object({
1037
1043
  name: z.string().min(1),
@@ -1048,7 +1054,6 @@ var cliErrorSchema = z2.object({
1048
1054
  message: z2.string()
1049
1055
  });
1050
1056
  var loginResultSchema = z2.object({
1051
- token: z2.string(),
1052
1057
  user: z2.object({
1053
1058
  id: z2.string(),
1054
1059
  email: z2.string(),
@@ -1768,7 +1773,7 @@ function formatWithOptions(inspectOptions, ...args) {
1768
1773
  const first = args[0];
1769
1774
  let a = 0;
1770
1775
  let str = "";
1771
- let join22 = "";
1776
+ let join23 = "";
1772
1777
  if (typeof first === "string") {
1773
1778
  if (args.length === 1) {
1774
1779
  return first;
@@ -1867,7 +1872,7 @@ function formatWithOptions(inspectOptions, ...args) {
1867
1872
  }
1868
1873
  if (lastPos !== 0) {
1869
1874
  a++;
1870
- join22 = " ";
1875
+ join23 = " ";
1871
1876
  if (lastPos < first.length) {
1872
1877
  str += first.slice(lastPos);
1873
1878
  }
@@ -1875,9 +1880,9 @@ function formatWithOptions(inspectOptions, ...args) {
1875
1880
  }
1876
1881
  while (a < args.length) {
1877
1882
  const value = args[a];
1878
- str += join22;
1883
+ str += join23;
1879
1884
  str += typeof value !== "string" ? inspect(value, inspectOptions) : value;
1880
- join22 = " ";
1885
+ join23 = " ";
1881
1886
  a++;
1882
1887
  }
1883
1888
  return str;
@@ -2988,7 +2993,7 @@ function validateSkillMd(content) {
2988
2993
  }
2989
2994
  const specCompliant = isAgentSkillsSpecCompliant(content);
2990
2995
  if (!agentverParsed.data.license) {
2991
- warnings.push("No license specified. Consider adding an SPDX licence identifier.");
2996
+ warnings.push(WARNING_NO_LICENCE);
2992
2997
  }
2993
2998
  if (!body || body.trim().length === 0) {
2994
2999
  warnings.push("SKILL.md body is empty. Add instructions for agents to follow.");
@@ -3085,7 +3090,7 @@ function readLockfile(projectRoot) {
3085
3090
  if (!existsSync2(lockfilePath)) {
3086
3091
  return EMPTY_LOCKFILE;
3087
3092
  }
3088
- const raw = readFileSync2(lockfilePath, "utf-8");
3093
+ const raw = readFileSync(lockfilePath, "utf-8");
3089
3094
  let parsed;
3090
3095
  try {
3091
3096
  parsed = JSON.parse(raw);
@@ -3115,7 +3120,7 @@ function writeLockfile(projectRoot, lockfile) {
3115
3120
  }
3116
3121
 
3117
3122
  // src/storage/manifest.ts
3118
- import { existsSync as existsSync3, mkdirSync as mkdirSync2, readFileSync as readFileSync3, renameSync as renameSync2, writeFileSync as writeFileSync2 } from "fs";
3123
+ import { existsSync as existsSync3, mkdirSync as mkdirSync2, readFileSync as readFileSync2, renameSync as renameSync2, writeFileSync as writeFileSync2 } from "fs";
3119
3124
  import { join as join3 } from "path";
3120
3125
  var MANIFEST_DIR = ".agentver";
3121
3126
  var MANIFEST_FILE = "manifest.json";
@@ -3146,7 +3151,7 @@ function readManifest(projectRoot) {
3146
3151
  if (!existsSync3(manifestPath)) {
3147
3152
  return EMPTY_MANIFEST;
3148
3153
  }
3149
- const raw = readFileSync3(manifestPath, "utf-8");
3154
+ const raw = readFileSync2(manifestPath, "utf-8");
3150
3155
  let parsed;
3151
3156
  try {
3152
3157
  parsed = JSON.parse(raw);
@@ -3197,7 +3202,7 @@ function deduplicateByPath(files) {
3197
3202
  }
3198
3203
  function computeFileIntegrity(filePath) {
3199
3204
  try {
3200
- const content = readFileSync4(filePath, "utf-8");
3205
+ const content = readFileSync3(filePath, "utf-8");
3201
3206
  return computeSha256FromBuffer(content);
3202
3207
  } catch {
3203
3208
  return computeSha256FromBuffer("");
@@ -3347,18 +3352,16 @@ import chalk4 from "chalk";
3347
3352
  // src/git/fetcher.ts
3348
3353
  import { execFile } from "child_process";
3349
3354
  import { randomUUID } from "crypto";
3350
- import { mkdir, readdir, readFile, rm as rm2, stat, writeFile } from "fs/promises";
3355
+ import { mkdir, readdir, readFile, rm, stat, writeFile } from "fs/promises";
3351
3356
  import { tmpdir } from "os";
3352
3357
  import { join as join5 } from "path";
3353
3358
  import { promisify } from "util";
3354
3359
 
3355
3360
  // 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";
3361
+ import { existsSync as existsSync4, mkdirSync as mkdirSync3, readdirSync as readdirSync2, readFileSync as readFileSync4, statSync as statSync2, writeFileSync as writeFileSync3 } from "fs";
3358
3362
  import { homedir as homedir2 } from "os";
3359
3363
  import { dirname as dirname2, join as join4 } from "path";
3360
3364
  var logger = createLogger("git:cache");
3361
- var REF_STALE_MS = 5 * 60 * 1e3;
3362
3365
  function getCacheDir() {
3363
3366
  return join4(homedir2(), ".agentver", "cache");
3364
3367
  }
@@ -3412,7 +3415,7 @@ function readCachedFilesSync(dirPath, basePath = "") {
3412
3415
  }
3413
3416
  if (!entry.isFile()) continue;
3414
3417
  try {
3415
- const content = readFileSync5(fullPath, "utf-8");
3418
+ const content = readFileSync4(fullPath, "utf-8");
3416
3419
  const fileStat = statSync2(fullPath);
3417
3420
  files.push({ path: relativePath, content, size: fileStat.size });
3418
3421
  } catch {
@@ -3669,7 +3672,7 @@ async function fetchGitHubArchive(source, commitSha) {
3669
3672
  const readFrom = source.path ? join5(extractDir, source.path) : extractDir;
3670
3673
  return await readFilesFromDirectory(readFrom);
3671
3674
  } finally {
3672
- await rm2(tempDir, { recursive: true, force: true }).catch(() => {
3675
+ await rm(tempDir, { recursive: true, force: true }).catch(() => {
3673
3676
  });
3674
3677
  }
3675
3678
  }
@@ -3702,7 +3705,7 @@ async function fetchGitLabArchive(source, commitSha) {
3702
3705
  const readFrom = source.path ? join5(extractDir, source.path) : extractDir;
3703
3706
  return await readFilesFromDirectory(readFrom);
3704
3707
  } finally {
3705
- await rm2(tempDir, { recursive: true, force: true }).catch(() => {
3708
+ await rm(tempDir, { recursive: true, force: true }).catch(() => {
3706
3709
  });
3707
3710
  }
3708
3711
  }
@@ -3724,7 +3727,7 @@ async function fetchGitArchiveCommand(source, commitSha) {
3724
3727
  const readFrom = source.path ? join5(extractDir, source.path) : extractDir;
3725
3728
  return await readFilesFromDirectory(readFrom);
3726
3729
  } finally {
3727
- await rm2(tempDir, { recursive: true, force: true }).catch(() => {
3730
+ await rm(tempDir, { recursive: true, force: true }).catch(() => {
3728
3731
  });
3729
3732
  }
3730
3733
  }
@@ -3748,7 +3751,7 @@ async function fetchViaSparseCheckout(resolved) {
3748
3751
  const readFrom = source.path ? join5(tempDir, source.path) : tempDir;
3749
3752
  return await readFilesFromDirectory(readFrom);
3750
3753
  } finally {
3751
- await rm2(tempDir, { recursive: true, force: true }).catch(() => {
3754
+ await rm(tempDir, { recursive: true, force: true }).catch(() => {
3752
3755
  });
3753
3756
  }
3754
3757
  }
@@ -3764,7 +3767,7 @@ async function fetchViaClone(resolved) {
3764
3767
  const readFrom = source.path ? join5(tempDir, source.path) : tempDir;
3765
3768
  return await readFilesFromDirectory(readFrom);
3766
3769
  } finally {
3767
- await rm2(tempDir, { recursive: true, force: true }).catch(() => {
3770
+ await rm(tempDir, { recursive: true, force: true }).catch(() => {
3768
3771
  });
3769
3772
  }
3770
3773
  }
@@ -4477,12 +4480,12 @@ function renderScanResult(result, spinner) {
4477
4480
  }
4478
4481
 
4479
4482
  // src/registry/config.ts
4480
- import { existsSync as existsSync6, mkdirSync as mkdirSync5, readFileSync as readFileSync7, writeFileSync as writeFileSync5 } from "fs";
4483
+ import { existsSync as existsSync6, mkdirSync as mkdirSync5, readFileSync as readFileSync6, writeFileSync as writeFileSync5 } from "fs";
4481
4484
  import { homedir as homedir4 } from "os";
4482
4485
  import { join as join7 } from "path";
4483
4486
 
4484
4487
  // src/registry/auth.ts
4485
- import { existsSync as existsSync5, mkdirSync as mkdirSync4, readFileSync as readFileSync6, writeFileSync as writeFileSync4 } from "fs";
4488
+ import { existsSync as existsSync5, mkdirSync as mkdirSync4, readFileSync as readFileSync5, writeFileSync as writeFileSync4 } from "fs";
4486
4489
  import { homedir as homedir3 } from "os";
4487
4490
  import { join as join6 } from "path";
4488
4491
  function getCredentialsPath() {
@@ -4493,7 +4496,7 @@ async function getCredentials() {
4493
4496
  if (!existsSync5(credPath)) {
4494
4497
  return null;
4495
4498
  }
4496
- const raw = readFileSync6(credPath, "utf-8");
4499
+ const raw = readFileSync5(credPath, "utf-8");
4497
4500
  try {
4498
4501
  return JSON.parse(raw);
4499
4502
  } catch {
@@ -4527,7 +4530,7 @@ function readConfig() {
4527
4530
  return {};
4528
4531
  }
4529
4532
  try {
4530
- const raw = readFileSync7(CONFIG_PATH, "utf-8");
4533
+ const raw = readFileSync6(CONFIG_PATH, "utf-8");
4531
4534
  return JSON.parse(raw);
4532
4535
  } catch {
4533
4536
  return {};
@@ -4675,13 +4678,14 @@ import {
4675
4678
  rmSync,
4676
4679
  symlinkSync
4677
4680
  } from "fs";
4681
+ import { homedir as homedir5 } from "os";
4678
4682
  import { dirname as dirname3, join as join8, relative } from "path";
4679
4683
  import chalk3 from "chalk";
4680
4684
  var logger3 = createLogger("canonical");
4681
4685
  var CANONICAL_DIR = ".agents/skills";
4682
4686
  function getCanonicalSkillPath(projectRoot, name, scope) {
4683
4687
  if (scope === "global") {
4684
- const home = process.env.HOME ?? "";
4688
+ const home = homedir5();
4685
4689
  return join8(home, CANONICAL_DIR, name);
4686
4690
  }
4687
4691
  return join8(projectRoot, CANONICAL_DIR, name);
@@ -4695,7 +4699,7 @@ function createAgentSymlinks(projectRoot, name, agents, scope) {
4695
4699
  for (const agentId of agents) {
4696
4700
  const placementPath = getSkillPlacementPath(agentId, name, scope);
4697
4701
  if (!placementPath) continue;
4698
- const agentSkillPath = scope === "global" ? placementPath.replace("~", process.env.HOME ?? "") : join8(projectRoot, placementPath);
4702
+ const agentSkillPath = scope === "global" ? placementPath.replace("~", homedir5()) : join8(projectRoot, placementPath);
4699
4703
  if (existsSync7(agentSkillPath) || isSymlink(agentSkillPath)) {
4700
4704
  rmSync(agentSkillPath, { recursive: true, force: true });
4701
4705
  }
@@ -4718,7 +4722,7 @@ function removeAgentSymlinks(projectRoot, name, agents, scope) {
4718
4722
  for (const agentId of agents) {
4719
4723
  const placementPath = getSkillPlacementPath(agentId, name, scope);
4720
4724
  if (!placementPath) continue;
4721
- const agentSkillPath = scope === "global" ? placementPath.replace("~", process.env.HOME ?? "") : join8(projectRoot, placementPath);
4725
+ const agentSkillPath = scope === "global" ? placementPath.replace("~", homedir5()) : join8(projectRoot, placementPath);
4722
4726
  if (existsSync7(agentSkillPath) || isSymlink(agentSkillPath)) {
4723
4727
  rmSync(agentSkillPath, { recursive: true, force: true });
4724
4728
  }
@@ -4740,7 +4744,7 @@ function resolveReadPath(projectRoot, packageName, agents, scope = "project") {
4740
4744
  for (const agentId of agents) {
4741
4745
  const placementPath = getSkillPlacementPath(agentId, packageName, scope);
4742
4746
  if (!placementPath) continue;
4743
- const fullPath = scope === "global" ? placementPath.replace("~", process.env.HOME ?? "") : join8(projectRoot, placementPath);
4747
+ const fullPath = scope === "global" ? placementPath.replace("~", homedir5()) : join8(projectRoot, placementPath);
4744
4748
  if (existsSync7(fullPath)) {
4745
4749
  if (isSymlink(fullPath)) {
4746
4750
  const target = readlinkSync(fullPath);
@@ -4791,7 +4795,7 @@ function buildSourceFromManifest(pkg2) {
4791
4795
  if (!pkg2 || pkg2.source.type !== "git") {
4792
4796
  return FALLBACK_SOURCE;
4793
4797
  }
4794
- const source = pkg2.source;
4798
+ const { source } = pkg2;
4795
4799
  const parts = source.uri.split("/");
4796
4800
  return {
4797
4801
  host: parts[0] ?? "github.com",
@@ -5150,7 +5154,7 @@ function computeHunks(oldLines, newLines) {
5150
5154
  const lcs = computeLcs(oldLines, newLines);
5151
5155
  const changes = buildChangeList(oldLines, newLines, lcs);
5152
5156
  if (changes.length === 0) return [];
5153
- return groupIntoHunks(changes, oldLines.length, newLines.length);
5157
+ return groupIntoHunks(changes);
5154
5158
  }
5155
5159
  function computeLcs(a, b) {
5156
5160
  const m = a.length;
@@ -5208,7 +5212,7 @@ function buildChangeList(oldLines, newLines, lcs) {
5208
5212
  }
5209
5213
  return changes;
5210
5214
  }
5211
- function groupIntoHunks(changes, _oldTotal, _newTotal) {
5215
+ function groupIntoHunks(changes) {
5212
5216
  const diffIndices = [];
5213
5217
  for (let i = 0; i < changes.length; i++) {
5214
5218
  if (changes[i].type !== "context") {
@@ -5442,7 +5446,7 @@ function registerDiffCommand(program2) {
5442
5446
  }
5443
5447
 
5444
5448
  // src/commands/draft.ts
5445
- import { existsSync as existsSync8, readFileSync as readFileSync8 } from "fs";
5449
+ import { existsSync as existsSync8, readFileSync as readFileSync7 } from "fs";
5446
5450
  import { basename as basename2, join as join10 } from "path";
5447
5451
  import chalk6 from "chalk";
5448
5452
  import ora2 from "ora";
@@ -5503,7 +5507,7 @@ function resolveSkillIdentity() {
5503
5507
  const skillMdPath = join10(cwd, "SKILL.md");
5504
5508
  let skillName = null;
5505
5509
  if (existsSync8(skillMdPath)) {
5506
- const content = readFileSync8(skillMdPath, "utf-8");
5510
+ const content = readFileSync7(skillMdPath, "utf-8");
5507
5511
  const nameMatch = content.match(/^name:\s*(.+)$/m);
5508
5512
  skillName = nameMatch?.[1]?.trim() ?? basename2(cwd);
5509
5513
  }
@@ -6185,7 +6189,8 @@ Created ${fileName} in ./${packageName}/`));
6185
6189
  }
6186
6190
 
6187
6191
  // src/commands/install.ts
6188
- import { existsSync as existsSync10, mkdirSync as mkdirSync8, readFileSync as readFileSync9, writeFileSync as writeFileSync7 } from "fs";
6192
+ import { existsSync as existsSync10, mkdirSync as mkdirSync8, readFileSync as readFileSync8, writeFileSync as writeFileSync7 } from "fs";
6193
+ import { homedir as homedir6 } from "os";
6189
6194
  import { dirname as dirname4, join as join12, relative as relative2, resolve } from "path";
6190
6195
  import chalk8 from "chalk";
6191
6196
  import prompts2 from "prompts";
@@ -6867,14 +6872,14 @@ async function installAgentConfig(name, files, agents, options, spinner) {
6867
6872
  for (const agentId of agents) {
6868
6873
  const configPath = getConfigFilePath(agentId, name);
6869
6874
  if (!configPath) continue;
6870
- const fullConfigPath = options.global ? configPath.replace("~", process.env.HOME ?? "") : join12(projectRoot, configPath);
6875
+ const fullConfigPath = options.global ? configPath.replace("~", homedir6()) : join12(projectRoot, configPath);
6871
6876
  const configDir = join12(fullConfigPath, "..");
6872
6877
  if (!existsSync10(configDir)) {
6873
6878
  mkdirSync8(configDir, { recursive: true });
6874
6879
  }
6875
6880
  let finalContent = configContent;
6876
6881
  if (existsSync10(fullConfigPath)) {
6877
- const existingContent = readFileSync9(fullConfigPath, "utf-8");
6882
+ const existingContent = readFileSync8(fullConfigPath, "utf-8");
6878
6883
  if (isComposedConfig(existingContent)) {
6879
6884
  const existingSections = parseComposedSections(existingContent);
6880
6885
  const alreadyPresent = existingSections.some((s) => s.packageName === name);
@@ -7000,7 +7005,7 @@ Installed packages (${entries.length}):
7000
7005
  }
7001
7006
 
7002
7007
  // src/commands/log.ts
7003
- import { existsSync as existsSync11, readFileSync as readFileSync10 } from "fs";
7008
+ import { existsSync as existsSync11, readFileSync as readFileSync9 } from "fs";
7004
7009
  import { basename as basename3, join as join13 } from "path";
7005
7010
  import chalk10 from "chalk";
7006
7011
  import ora3 from "ora";
@@ -7021,7 +7026,7 @@ function resolveSkillIdentity2(nameArg) {
7021
7026
  const skillMdPath = join13(cwd, "SKILL.md");
7022
7027
  let skillName = null;
7023
7028
  if (existsSync11(skillMdPath)) {
7024
- const content = readFileSync10(skillMdPath, "utf-8");
7029
+ const content = readFileSync9(skillMdPath, "utf-8");
7025
7030
  const nameMatch = content.match(/^name:\s*(.+)$/m);
7026
7031
  skillName = nameMatch?.[1]?.trim() ?? basename3(cwd);
7027
7032
  }
@@ -7359,7 +7364,6 @@ function registerLoginCommand(program2) {
7359
7364
  const target = url ?? getPlatformUrl();
7360
7365
  if (isJSONMode()) {
7361
7366
  outputSuccess({
7362
- token: options.token,
7363
7367
  user: { id: "", email: "", name: "" }
7364
7368
  });
7365
7369
  return;
@@ -7472,7 +7476,7 @@ function registerLogoutCommand(program2) {
7472
7476
  }
7473
7477
 
7474
7478
  // src/commands/publish.ts
7475
- import { existsSync as existsSync12, readFileSync as readFileSync11 } from "fs";
7479
+ import { existsSync as existsSync12, readFileSync as readFileSync10 } from "fs";
7476
7480
  import { basename as basename4, join as join14, resolve as resolve2 } from "path";
7477
7481
  import chalk14 from "chalk";
7478
7482
  import ora4 from "ora";
@@ -7503,7 +7507,7 @@ function parseFrontmatter2(content) {
7503
7507
  function detectNamespace(skillDir) {
7504
7508
  const skillMdPath = join14(skillDir, "SKILL.md");
7505
7509
  if (!existsSync12(skillMdPath)) return null;
7506
- const content = readFileSync11(skillMdPath, "utf-8");
7510
+ const content = readFileSync10(skillMdPath, "utf-8");
7507
7511
  const fm = parseFrontmatter2(content);
7508
7512
  if (!fm) return null;
7509
7513
  const parts = skillDir.split("/");
@@ -7526,7 +7530,7 @@ function registerPublishCommand(program2) {
7526
7530
  }
7527
7531
  const spinner = ora4("Reading skill metadata...").start();
7528
7532
  try {
7529
- const skillMdContent = readFileSync11(join14(skillDir, "SKILL.md"), "utf-8");
7533
+ const skillMdContent = readFileSync10(join14(skillDir, "SKILL.md"), "utf-8");
7530
7534
  const frontmatter = parseFrontmatter2(skillMdContent);
7531
7535
  if (!frontmatter) {
7532
7536
  spinner.fail(
@@ -7769,7 +7773,7 @@ function isSymlinkPath(filePath) {
7769
7773
  }
7770
7774
 
7771
7775
  // src/commands/save.ts
7772
- import { existsSync as existsSync14, readFileSync as readFileSync12 } from "fs";
7776
+ import { existsSync as existsSync14, readFileSync as readFileSync11 } from "fs";
7773
7777
  import { basename as basename5, join as join16, resolve as resolve3 } from "path";
7774
7778
  import chalk16 from "chalk";
7775
7779
  import ora5 from "ora";
@@ -7778,7 +7782,7 @@ function detectSkillName(skillDir) {
7778
7782
  if (!existsSync14(skillMdPath)) {
7779
7783
  return null;
7780
7784
  }
7781
- const content = readFileSync12(skillMdPath, "utf-8");
7785
+ const content = readFileSync11(skillMdPath, "utf-8");
7782
7786
  const nameMatch = content.match(/^name:\s*(.+)$/m);
7783
7787
  return nameMatch?.[1]?.trim() ?? basename5(skillDir);
7784
7788
  }
@@ -7910,19 +7914,19 @@ function registerSaveCommand(program2) {
7910
7914
  }
7911
7915
 
7912
7916
  // src/commands/scan.ts
7913
- import { readFileSync as readFileSync13 } from "fs";
7914
- import { homedir as homedir5 } from "os";
7917
+ import { readFileSync as readFileSync12 } from "fs";
7918
+ import { homedir as homedir7 } from "os";
7915
7919
  import chalk17 from "chalk";
7916
7920
  function registerScanCommand(program2) {
7917
7921
  program2.command("scan [path]").description("Scan directory for agent configs and skills").action(async (path) => {
7918
7922
  const jsonMode = isJSONMode();
7919
7923
  const targetPath = path ?? process.cwd();
7920
7924
  const projectAgents = detectInstalledAgents(targetPath);
7921
- const globalAgents = detectGlobalAgents(homedir5());
7925
+ const globalAgents = detectGlobalAgents(homedir7());
7922
7926
  const seenIds = new Set(projectAgents.map((a) => a.id));
7923
7927
  const agents = [...projectAgents, ...globalAgents.filter((a) => !seenIds.has(a.id))];
7924
7928
  const projectFiles = scanForSkillFiles(targetPath);
7925
- const globalFiles = scanGlobalSkillFiles(homedir5());
7929
+ const globalFiles = scanGlobalSkillFiles(homedir7());
7926
7930
  const seenPaths = new Set(projectFiles.map((f) => f.path));
7927
7931
  const files = [...projectFiles, ...globalFiles.filter((f) => !seenPaths.has(f.path))];
7928
7932
  if (jsonMode) {
@@ -7965,7 +7969,7 @@ function registerScanCommand(program2) {
7965
7969
  for (const file of skillFiles) {
7966
7970
  let content;
7967
7971
  try {
7968
- content = readFileSync13(file.path, "utf-8");
7972
+ content = readFileSync12(file.path, "utf-8");
7969
7973
  } catch {
7970
7974
  console.log(` ${chalk17.red("\u2717")} ${file.name} ${chalk17.dim("Could not read file")}`);
7971
7975
  continue;
@@ -8538,9 +8542,9 @@ function registerSuggestCommand(program2) {
8538
8542
  if (modifiedPackages.length === 0) {
8539
8543
  if (json) {
8540
8544
  outputError("NO_CHANGES", "No modified packages detected.");
8541
- } else {
8542
- console.log(chalk20.dim("No modified packages detected."));
8545
+ process.exit(1);
8543
8546
  }
8547
+ console.log(chalk20.dim("No modified packages detected."));
8544
8548
  return;
8545
8549
  }
8546
8550
  const targetName = modifiedPackages[0];
@@ -8869,9 +8873,11 @@ function registerSyncCommand(program2) {
8869
8873
  clearTimeout(timeoutId);
8870
8874
  if (!response.ok) {
8871
8875
  const errorText = await response.text().catch(() => "Unknown error");
8872
- spinner.fail(`Sync failed (${response.status}): ${errorText}`);
8873
8876
  if (isJSONMode()) {
8877
+ spinner.stop();
8874
8878
  outputError("SYNC_FAILED", `Sync failed (${response.status}): ${errorText}`);
8879
+ } else {
8880
+ spinner.fail(`Sync failed (${response.status}): ${errorText}`);
8875
8881
  }
8876
8882
  process.exit(1);
8877
8883
  }
@@ -8889,14 +8895,18 @@ function registerSyncCommand(program2) {
8889
8895
  );
8890
8896
  } catch (error) {
8891
8897
  if (error instanceof DOMException && error.name === "AbortError") {
8892
- spinner.fail("Sync timed out. The platform may be experiencing issues.");
8893
8898
  if (isJSONMode()) {
8899
+ spinner.stop();
8894
8900
  outputError("TIMEOUT", "Sync timed out. The platform may be experiencing issues.");
8901
+ } else {
8902
+ spinner.fail("Sync timed out. The platform may be experiencing issues.");
8895
8903
  }
8896
8904
  } else {
8897
- spinner.fail(`Sync failed: ${error instanceof Error ? error.message : String(error)}`);
8898
8905
  if (isJSONMode()) {
8906
+ spinner.stop();
8899
8907
  outputError("SYNC_FAILED", error instanceof Error ? error.message : String(error));
8908
+ } else {
8909
+ spinner.fail(`Sync failed: ${error instanceof Error ? error.message : String(error)}`);
8900
8910
  }
8901
8911
  }
8902
8912
  process.exit(1);
@@ -8911,7 +8921,7 @@ import ora7 from "ora";
8911
8921
  import prompts3 from "prompts";
8912
8922
 
8913
8923
  // src/storage/patches.ts
8914
- import { existsSync as existsSync16, mkdirSync as mkdirSync9, readFileSync as readFileSync14, rmSync as rmSync3, writeFileSync as writeFileSync8 } from "fs";
8924
+ import { existsSync as existsSync16, mkdirSync as mkdirSync9, readFileSync as readFileSync13, rmSync as rmSync3, writeFileSync as writeFileSync8 } from "fs";
8915
8925
  import { join as join18 } from "path";
8916
8926
  var PATCHES_DIR = ".agentver/patches";
8917
8927
  var CONTEXT_LINES2 = 3;
@@ -8961,7 +8971,7 @@ function generatePatch(baseFiles, localFiles, packageName) {
8961
8971
  return `${output.join("\n")}
8962
8972
  `;
8963
8973
  }
8964
- function applyPatch(projectRoot, _packageName, _agents, patchContent) {
8974
+ function applyPatch(projectRoot, patchContent) {
8965
8975
  const filePatches = parsePatch(patchContent);
8966
8976
  const conflicts = [];
8967
8977
  for (const filePatch of filePatches) {
@@ -8999,7 +9009,7 @@ function applyFilePatch(projectRoot, filePatch) {
8999
9009
  if (!existsSync16(fullPath)) {
9000
9010
  return false;
9001
9011
  }
9002
- const currentContent = readFileSync14(fullPath, "utf-8");
9012
+ const currentContent = readFileSync13(fullPath, "utf-8");
9003
9013
  const currentLines = currentContent.split("\n");
9004
9014
  let offset = 0;
9005
9015
  for (const hunk of filePatch.hunks) {
@@ -9436,7 +9446,7 @@ async function handlePatchUpdate(update, projectRoot, agents, spinner) {
9436
9446
  const agentId = agents[0];
9437
9447
  const result = await installPackage(sourceUrl, { agent: agentId });
9438
9448
  spinner.text = `Reapplying local patch for ${update.name}...`;
9439
- const applyResult = applyPatch(projectRoot, update.name, agents, patchContent);
9449
+ const applyResult = applyPatch(projectRoot, patchContent);
9440
9450
  if (applyResult.applied) {
9441
9451
  removePatch(projectRoot, update.name);
9442
9452
  spinner.succeed(`${chalk23.green(update.name)}: updated and local patch reapplied successfully`);
@@ -9711,7 +9721,7 @@ function buildSourceFromManifest2(pkg2) {
9711
9721
  if (!pkg2 || pkg2.source.type !== "git") {
9712
9722
  return FALLBACK_SOURCE2;
9713
9723
  }
9714
- const source = pkg2.source;
9724
+ const { source } = pkg2;
9715
9725
  const parts = source.uri.split("/");
9716
9726
  return {
9717
9727
  host: parts[0] ?? "github.com",
@@ -9744,7 +9754,7 @@ async function runSecurityScan(dirPath, source, strict) {
9744
9754
  } else {
9745
9755
  passed = result.verdict === "PASS" || result.verdict === "WARN";
9746
9756
  }
9747
- const ruleCount = 65;
9757
+ const ruleCount = SCAN_RULES.length;
9748
9758
  return { passed, ruleCount, issueCount, result };
9749
9759
  } catch {
9750
9760
  return { passed: false, ruleCount: 0, issueCount: 0, result: null };
@@ -9961,7 +9971,7 @@ ${chalk24.bold(`Verifying @${parsed.org}/${parsed.skill}...`)}
9961
9971
  }
9962
9972
 
9963
9973
  // src/commands/version.ts
9964
- import { existsSync as existsSync18, readFileSync as readFileSync15 } from "fs";
9974
+ import { existsSync as existsSync18, readFileSync as readFileSync14 } from "fs";
9965
9975
  import { basename as basename6, join as join21 } from "path";
9966
9976
  import chalk25 from "chalk";
9967
9977
  import ora8 from "ora";
@@ -9971,7 +9981,7 @@ function resolveSkillIdentity3() {
9971
9981
  const skillMdPath = join21(cwd, "SKILL.md");
9972
9982
  let skillName = null;
9973
9983
  if (existsSync18(skillMdPath)) {
9974
- const content = readFileSync15(skillMdPath, "utf-8");
9984
+ const content = readFileSync14(skillMdPath, "utf-8");
9975
9985
  const nameMatch = content.match(/^name:\s*(.+)$/m);
9976
9986
  skillName = nameMatch?.[1]?.trim() ?? basename6(cwd);
9977
9987
  }
@@ -10157,8 +10167,9 @@ function registerWhoamiCommand(program2) {
10157
10167
  }
10158
10168
 
10159
10169
  // bin/agentver.ts
10170
+ var __dirname = dirname5(fileURLToPath(import.meta.url));
10160
10171
  var require2 = createRequire(import.meta.url);
10161
- var pkg = require2("../../package.json");
10172
+ var pkg = require2(join22(__dirname, "..", "package.json"));
10162
10173
  updateNotifier({ pkg }).notify();
10163
10174
  var program = new Command();
10164
10175
  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");