agentv 2.5.6 → 2.5.8

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.
@@ -1047,9 +1047,6 @@ var require_dist = __commonJS({
1047
1047
  }
1048
1048
  });
1049
1049
 
1050
- // src/index.ts
1051
- import { readFileSync as readFileSync4 } from "node:fs";
1052
-
1053
1050
  // ../../node_modules/.bun/chalk@5.6.2/node_modules/chalk/source/vendor/ansi-styles/index.js
1054
1051
  var ANSI_BACKGROUND_OFFSET = 10;
1055
1052
  var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
@@ -2857,6 +2854,52 @@ function oneOf(literals) {
2857
2854
  };
2858
2855
  }
2859
2856
 
2857
+ // package.json
2858
+ var package_default = {
2859
+ name: "agentv",
2860
+ version: "2.5.8",
2861
+ description: "CLI entry point for AgentV",
2862
+ type: "module",
2863
+ repository: {
2864
+ type: "git",
2865
+ url: "https://github.com/EntityProcess/agentv.git"
2866
+ },
2867
+ homepage: "https://github.com/EntityProcess/agentv#readme",
2868
+ bugs: {
2869
+ url: "https://github.com/EntityProcess/agentv/issues"
2870
+ },
2871
+ bin: {
2872
+ agentv: "./dist/cli.js"
2873
+ },
2874
+ files: ["dist", "README.md"],
2875
+ scripts: {
2876
+ dev: "bun --watch src/index.ts",
2877
+ build: "tsup && bun run copy-readme",
2878
+ "copy-readme": `bun -e "import { cpSync } from 'fs'; cpSync('../../README.md', 'README.md')"`,
2879
+ prepublishOnly: "bun run copy-readme",
2880
+ typecheck: "tsc --noEmit",
2881
+ lint: "biome check .",
2882
+ format: "biome format --write .",
2883
+ fix: "biome check --write .",
2884
+ test: "bun test",
2885
+ "test:watch": "bun test --watch"
2886
+ },
2887
+ dependencies: {
2888
+ "@agentv/core": "workspace:*",
2889
+ "@mariozechner/pi-agent": "^0.9.0",
2890
+ "@mariozechner/pi-ai": "^0.37.2",
2891
+ "cmd-ts": "^0.14.3",
2892
+ dotenv: "^16.4.5",
2893
+ "fast-glob": "^3.3.3",
2894
+ json5: "^2.2.3",
2895
+ micromatch: "^4.0.8",
2896
+ yaml: "^2.6.1"
2897
+ },
2898
+ devDependencies: {
2899
+ execa: "^9.3.0"
2900
+ }
2901
+ };
2902
+
2860
2903
  // src/commands/compare/index.ts
2861
2904
  import { readFileSync } from "node:fs";
2862
2905
 
@@ -43038,10 +43081,10 @@ async function execFileWithStdinBun(argv, stdinPayload, options) {
43038
43081
  }
43039
43082
  }
43040
43083
  async function execFileWithStdinNode(argv, stdinPayload, options) {
43041
- const { spawn: spawn6 } = await import("node:child_process");
43084
+ const { spawn: spawn62 } = await import("node:child_process");
43042
43085
  return new Promise((resolve2, reject) => {
43043
43086
  const [cmd, ...args] = argv;
43044
- const child = spawn6(cmd, args, {
43087
+ const child = spawn62(cmd, args, {
43045
43088
  cwd: options.cwd,
43046
43089
  stdio: ["pipe", "pipe", "pipe"],
43047
43090
  // Merge additional env vars with process.env
@@ -43092,10 +43135,10 @@ async function execShellWithStdin(command2, stdinPayload, options = {}) {
43092
43135
  const stderrPath = path272.join(dir, "stderr.txt");
43093
43136
  await writeFile92(stdinPath, stdinPayload, "utf8");
43094
43137
  const wrappedCommand = process.platform === "win32" ? `(${command2}) < ${shellEscapePath(stdinPath)} > ${shellEscapePath(stdoutPath)} 2> ${shellEscapePath(stderrPath)}` : `(${command2}) < ${shellEscapePath(stdinPath)} > ${shellEscapePath(stdoutPath)} 2> ${shellEscapePath(stderrPath)}`;
43095
- const { spawn: spawn6 } = await import("node:child_process");
43138
+ const { spawn: spawn62 } = await import("node:child_process");
43096
43139
  try {
43097
43140
  const exitCode = await new Promise((resolve2, reject) => {
43098
- const child = spawn6(wrappedCommand, {
43141
+ const child = spawn62(wrappedCommand, {
43099
43142
  shell: true,
43100
43143
  cwd: options.cwd,
43101
43144
  stdio: ["ignore", "ignore", "ignore"],
@@ -49095,6 +49138,94 @@ var initCmdTsCommand = command({
49095
49138
  }
49096
49139
  });
49097
49140
 
49141
+ // src/commands/self/index.ts
49142
+ import { spawn as spawn6 } from "node:child_process";
49143
+ function detectPackageManagerFromPath(scriptPath) {
49144
+ if (scriptPath.includes(".bun")) {
49145
+ return "bun";
49146
+ }
49147
+ return "npm";
49148
+ }
49149
+ function detectPackageManager() {
49150
+ return detectPackageManagerFromPath(process.argv[1] ?? "");
49151
+ }
49152
+ function runCommand(cmd, args) {
49153
+ return new Promise((resolve2, reject) => {
49154
+ const child = spawn6(cmd, args, { stdio: ["inherit", "pipe", "inherit"] });
49155
+ let stdout = "";
49156
+ child.stdout?.on("data", (data) => {
49157
+ process.stdout.write(data);
49158
+ stdout += data.toString();
49159
+ });
49160
+ child.on("error", reject);
49161
+ child.on("close", (code) => resolve2({ exitCode: code ?? 1, stdout }));
49162
+ });
49163
+ }
49164
+ var updateCommand = command({
49165
+ name: "update",
49166
+ description: "Update agentv to the latest version",
49167
+ args: {
49168
+ npm: flag({ long: "npm", description: "Force update using npm" }),
49169
+ bun: flag({ long: "bun", description: "Force update using bun" })
49170
+ },
49171
+ handler: async ({ npm, bun }) => {
49172
+ if (npm && bun) {
49173
+ console.error("Error: Cannot specify both --npm and --bun");
49174
+ process.exit(1);
49175
+ }
49176
+ let pm;
49177
+ if (npm) {
49178
+ pm = "npm";
49179
+ } else if (bun) {
49180
+ pm = "bun";
49181
+ } else {
49182
+ pm = detectPackageManager();
49183
+ }
49184
+ const currentVersion = package_default.version;
49185
+ console.log(`Current version: ${currentVersion}`);
49186
+ console.log(`Updating agentv using ${pm}...
49187
+ `);
49188
+ const args = pm === "npm" ? ["install", "-g", "agentv@latest"] : ["add", "-g", "agentv@latest"];
49189
+ try {
49190
+ const result = await runCommand(pm, args);
49191
+ if (result.exitCode !== 0) {
49192
+ console.error("\nUpdate failed.");
49193
+ process.exit(1);
49194
+ }
49195
+ let newVersion;
49196
+ try {
49197
+ const versionResult = await runCommand("agentv", ["--version"]);
49198
+ newVersion = versionResult.stdout.trim();
49199
+ } catch {
49200
+ }
49201
+ if (newVersion) {
49202
+ console.log(`
49203
+ Update complete: ${currentVersion} \u2192 ${newVersion}`);
49204
+ } else {
49205
+ console.log("\nUpdate complete.");
49206
+ }
49207
+ } catch (error40) {
49208
+ if (error40 instanceof Error) {
49209
+ if (error40.message.includes("ENOENT") || error40.message.includes("not found")) {
49210
+ const alternative = pm === "npm" ? "bun" : "npm";
49211
+ console.error(`Error: ${pm} not found. Try using --${alternative} flag.`);
49212
+ } else {
49213
+ console.error(`Error: ${error40.message}`);
49214
+ }
49215
+ process.exit(1);
49216
+ }
49217
+ throw error40;
49218
+ }
49219
+ }
49220
+ });
49221
+ var selfCommand = subcommands({
49222
+ name: "self",
49223
+ description: "Manage the agentv installation",
49224
+ cmds: {
49225
+ update: updateCommand
49226
+ }
49227
+ });
49228
+
49098
49229
  // src/commands/validate/format-output.ts
49099
49230
  var ANSI_RED4 = "\x1B[31m";
49100
49231
  var ANSI_YELLOW9 = "\x1B[33m";
@@ -49300,17 +49431,17 @@ var validateCommand = command({
49300
49431
  });
49301
49432
 
49302
49433
  // src/index.ts
49303
- var packageJson = JSON.parse(readFileSync4(new URL("../package.json", import.meta.url), "utf8"));
49304
49434
  var app = subcommands({
49305
49435
  name: "agentv",
49306
49436
  description: "AgentV CLI",
49307
- version: packageJson.version,
49437
+ version: package_default.version,
49308
49438
  cmds: {
49309
49439
  compare: compareCommand,
49310
49440
  convert: convertCommand,
49311
49441
  eval: evalCommand,
49312
49442
  generate: generateCommand,
49313
49443
  init: initCmdTsCommand,
49444
+ self: selfCommand,
49314
49445
  validate: validateCommand
49315
49446
  }
49316
49447
  });
@@ -49322,4 +49453,4 @@ export {
49322
49453
  app,
49323
49454
  runCli
49324
49455
  };
49325
- //# sourceMappingURL=chunk-APKXUJF3.js.map
49456
+ //# sourceMappingURL=chunk-H7Z5TVCB.js.map