@vemdev/cli 0.1.56 → 0.1.59

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.
@@ -58,7 +58,7 @@ import {
58
58
  validateEnv,
59
59
  validatePasswordStrength,
60
60
  validateWebhookUrl
61
- } from "./chunk-SOAUDPRS.js";
61
+ } from "./chunk-RDM4THSV.js";
62
62
  import {
63
63
  computeCopilotSessionStats,
64
64
  getCopilotSessionsDir,
@@ -147,4 +147,4 @@ export {
147
147
  validatePasswordStrength,
148
148
  validateWebhookUrl
149
149
  };
150
- //# sourceMappingURL=dist-27CAVU4D.js.map
150
+ //# sourceMappingURL=dist-GKJQQVJF.js.map
package/dist/index.js CHANGED
@@ -23,7 +23,7 @@ import {
23
23
  isVemInitialized,
24
24
  listAllAgentSessions,
25
25
  parseVemUpdateBlock
26
- } from "./chunk-SOAUDPRS.js";
26
+ } from "./chunk-RDM4THSV.js";
27
27
  import {
28
28
  readCopilotSessionDetail
29
29
  } from "./chunk-PO3WNPAJ.js";
@@ -45,8 +45,8 @@ import prompts4 from "prompts";
45
45
  // src/runtime/auth.ts
46
46
  import { spawn } from "child_process";
47
47
  import chalk from "chalk";
48
- var API_URL = "https://api.vem.dev";
49
- var WEB_URL = "https://app.vem.dev";
48
+ var API_URL = "http://localhost:3002";
49
+ var WEB_URL = "http://localhost:3000";
50
50
  function getApiUrlCandidates(apiUrl) {
51
51
  const candidates = [apiUrl];
52
52
  try {
@@ -1163,7 +1163,7 @@ var syncParsedTaskUpdatesToRemote = async (configService, update, result, active
1163
1163
  const changelogEntry = Array.isArray(update.changelog_append) ? update.changelog_append.join("\n").trim() || null : update.changelog_append?.trim() ?? null;
1164
1164
  await updateTaskMetaRemote(configService, activeTask, {
1165
1165
  raw_vem_update: JSON.parse(JSON.stringify(update)),
1166
- cli_version: "0.1.56",
1166
+ cli_version: "0.1.58",
1167
1167
  ...changelogEntry ? { changelog_entry: changelogEntry } : {}
1168
1168
  });
1169
1169
  }
@@ -1220,7 +1220,7 @@ var syncParsedTaskUpdatesToRemote = async (configService, update, result, active
1220
1220
  ...patch.subtask_order !== void 0 ? { subtask_order: patch.subtask_order } : {},
1221
1221
  ...patch.due_at !== void 0 ? { due_at: patch.due_at } : {},
1222
1222
  raw_vem_update: JSON.parse(JSON.stringify(update)),
1223
- cli_version: "0.1.56",
1223
+ cli_version: "0.1.58",
1224
1224
  // Task memory fields — stored in task_memory_entries on the API side.
1225
1225
  ...buildRemoteTaskContextPatch(patch, updatedTask) ?? {},
1226
1226
  changelog_entry: changelogReasoning ?? null
@@ -2056,6 +2056,8 @@ Agent exited with code ${exitCode}
2056
2056
  ` (Auto-applying due to ${dynamicAutoExit ? "dynamic signal" : "--auto-exit"})`
2057
2057
  )
2058
2058
  );
2059
+ console.log(chalk7.cyan("\n\u{1F4C4} Full vem_update content:"));
2060
+ console.log(JSON.stringify(parsedAgentUpdate, null, 2));
2059
2061
  }
2060
2062
  try {
2061
2063
  appliedUpdateResult = await applyVemUpdate(parsedAgentUpdate);
@@ -2382,7 +2384,7 @@ function registerAuthCommands(program2) {
2382
2384
  if (receivedKey) {
2383
2385
  await configService.setApiKey(receivedKey);
2384
2386
  try {
2385
- const API_URL2 = "https://api.vem.dev";
2387
+ const API_URL2 = "http://localhost:3002";
2386
2388
  const headers = await buildDeviceHeaders(configService);
2387
2389
  await fetch(`${API_URL2}/verify`, {
2388
2390
  headers: {
@@ -3401,7 +3403,7 @@ function registerMaintenanceCommands(program2) {
3401
3403
  });
3402
3404
  program2.command("diff").description("Show differences between local and cloud state").option("--detailed", "Show detailed content diffs").option("--json", "Output as JSON").action(async (options) => {
3403
3405
  try {
3404
- const { DiffService } = await import("./dist-27CAVU4D.js");
3406
+ const { DiffService } = await import("./dist-GKJQQVJF.js");
3405
3407
  const diffService = new DiffService();
3406
3408
  const result = await diffService.compareWithLastPush();
3407
3409
  if (options.json) {
@@ -3459,7 +3461,7 @@ ${"\u2500".repeat(50)}`));
3459
3461
  });
3460
3462
  program2.command("doctor").description("Run health checks on VEM setup").option("--json", "Output as JSON").action(async (options) => {
3461
3463
  try {
3462
- const { DoctorService } = await import("./dist-27CAVU4D.js");
3464
+ const { DoctorService } = await import("./dist-GKJQQVJF.js");
3463
3465
  const doctorService = new DoctorService();
3464
3466
  const results = await doctorService.runAllChecks();
3465
3467
  if (options.json) {
@@ -4671,6 +4673,20 @@ async function executeClaimedRunInSandbox(input) {
4671
4673
  } catch {
4672
4674
  baseHash = runGit(["rev-parse", baseBranch]);
4673
4675
  }
4676
+ const localBranchExists = (() => {
4677
+ try {
4678
+ runGit(["rev-parse", "--verify", `refs/heads/${baseBranch}`]);
4679
+ return true;
4680
+ } catch {
4681
+ return false;
4682
+ }
4683
+ })();
4684
+ if (!localBranchExists) {
4685
+ try {
4686
+ runGit(["branch", baseBranch, `${remote.name}/${baseBranch}`]);
4687
+ } catch {
4688
+ }
4689
+ }
4674
4690
  if (existsSync(worktreePath)) {
4675
4691
  execFileSync("rm", ["-rf", worktreePath], { stdio: "ignore" });
4676
4692
  }
@@ -4864,6 +4880,7 @@ async function executeClaimedRunInSandbox(input) {
4864
4880
  const msg = err instanceof Error ? err.message : String(err);
4865
4881
  completionError = msg;
4866
4882
  completionStatus = "failed";
4883
+ console.error(chalk13.red(` \u2717 Sandbox run error: ${msg}`));
4867
4884
  if (heartbeatTimer) {
4868
4885
  clearInterval(heartbeatTimer);
4869
4886
  heartbeatTimer = null;
@@ -6575,7 +6592,7 @@ Snapshot Contents:`));
6575
6592
  const update = parseVemUpdateBlock(input);
6576
6593
  const sandboxRunId = process.env.VEM_TASK_RUN_ID;
6577
6594
  const sandboxApiKey = process.env.VEM_API_KEY;
6578
- const sandboxApiUrl = "https://api.vem.dev";
6595
+ const sandboxApiUrl = "http://localhost:3002";
6579
6596
  if (sandboxRunId && sandboxApiKey) {
6580
6597
  const res = await fetch(
6581
6598
  `${sandboxApiUrl}/task-runs/${sandboxRunId}/vem-update-structured`,
@@ -8919,6 +8936,138 @@ No agent sessions attached to ${id} yet.`)
8919
8936
  console.error(chalk18.red(`Failed to mark task ready: ${error.message}`));
8920
8937
  }
8921
8938
  });
8939
+ taskCmd.command("iterate <id>").description(
8940
+ "Start an iterative run on a task that already has a PR \u2014 continues from the existing PR branch"
8941
+ ).option(
8942
+ "-p, --prompt <text>",
8943
+ "Follow-up instructions for the agent"
8944
+ ).option(
8945
+ "--run-id <runId>",
8946
+ "UUID of the specific run to iterate from (defaults to the latest run with a PR)"
8947
+ ).option(
8948
+ "--agent <name>",
8949
+ "Agent to use (copilot, claude, gemini, codex)",
8950
+ "copilot"
8951
+ ).option(
8952
+ "--cloud",
8953
+ "Dispatch as a cloud run (sandbox_job) \u2014 requires Ultra plan"
8954
+ ).action(async (id, options) => {
8955
+ await trackCommandUsage("task iterate");
8956
+ try {
8957
+ const configService = new ConfigService();
8958
+ const apiKey = await tryAuthenticatedKey(configService);
8959
+ if (!apiKey) {
8960
+ console.error(
8961
+ chalk18.red(
8962
+ "\u2717 Not authenticated. Run `vem login` first."
8963
+ )
8964
+ );
8965
+ process.exit(1);
8966
+ }
8967
+ if (!await configService.getProjectId()) {
8968
+ console.error(
8969
+ chalk18.red(
8970
+ "\u2717 This directory is not linked to a VEM project. Run `vem link` first."
8971
+ )
8972
+ );
8973
+ process.exit(1);
8974
+ }
8975
+ const tasks = await taskService.getTasks();
8976
+ const task = tasks.find((t) => t.id === id || t.id === id.toUpperCase());
8977
+ if (!task?.db_id) {
8978
+ console.error(chalk18.red(`\u2717 Task ${id} not found or not synced.`));
8979
+ process.exit(1);
8980
+ }
8981
+ const deviceHeaders = await buildDeviceHeaders(configService);
8982
+ const headers = {
8983
+ Authorization: `Bearer ${apiKey}`,
8984
+ "Content-Type": "application/json",
8985
+ ...deviceHeaders
8986
+ };
8987
+ const runsRes = await fetch(
8988
+ `${API_URL}/tasks/${task.db_id}/runs`,
8989
+ { headers }
8990
+ );
8991
+ if (!runsRes.ok) {
8992
+ const data = await runsRes.json().catch(() => ({}));
8993
+ console.error(
8994
+ chalk18.red(
8995
+ `\u2717 Failed to fetch runs: ${data.error ?? runsRes.statusText}`
8996
+ )
8997
+ );
8998
+ process.exit(1);
8999
+ }
9000
+ const runsData = await runsRes.json();
9001
+ let parentRunId = options.runId ?? null;
9002
+ if (!parentRunId) {
9003
+ const runWithPr = runsData.runs.find(
9004
+ (r) => typeof r.pr_url === "string" && r.pr_url.trim().length > 0
9005
+ );
9006
+ if (!runWithPr) {
9007
+ console.error(
9008
+ chalk18.yellow(
9009
+ `\u2717 No run with a PR found for task ${id}. Create an initial run first.`
9010
+ )
9011
+ );
9012
+ process.exit(1);
9013
+ }
9014
+ parentRunId = runWithPr.id;
9015
+ console.log(
9016
+ chalk18.gray(
9017
+ ` Using run ${runWithPr.id.slice(0, 8)} (PR: ${runWithPr.pr_url}) as base.`
9018
+ )
9019
+ );
9020
+ }
9021
+ const prompt = typeof options.prompt === "string" && options.prompt.trim() ? options.prompt.trim() : void 0;
9022
+ if (!prompt) {
9023
+ const response = await prompts9({
9024
+ type: "text",
9025
+ name: "value",
9026
+ message: "Follow-up instructions for the agent (leave blank to skip):"
9027
+ });
9028
+ if (response.value?.trim()) {
9029
+ options.prompt = response.value.trim();
9030
+ }
9031
+ }
9032
+ const executionBackend = options.cloud ? "sandbox_job" : void 0;
9033
+ const createRes = await fetch(
9034
+ `${API_URL}/tasks/${task.db_id}/runs`,
9035
+ {
9036
+ method: "POST",
9037
+ headers,
9038
+ body: JSON.stringify({
9039
+ parent_run_id: parentRunId,
9040
+ user_prompt: options.prompt ?? void 0,
9041
+ agent_name: options.agent,
9042
+ execution_backend: executionBackend
9043
+ })
9044
+ }
9045
+ );
9046
+ if (!createRes.ok) {
9047
+ const data = await createRes.json().catch(() => ({}));
9048
+ console.error(
9049
+ chalk18.red(
9050
+ `\u2717 Failed to start iterative run: ${data.error ?? createRes.statusText}`
9051
+ )
9052
+ );
9053
+ process.exit(1);
9054
+ }
9055
+ const result = await createRes.json();
9056
+ console.log(
9057
+ chalk18.green(
9058
+ `
9059
+ \u2714 Iterative run queued (ID: ${result.run.id.slice(0, 8)}\u2026)
9060
+ `
9061
+ )
9062
+ );
9063
+ console.log(chalk18.gray(" The agent will continue from the existing PR branch."));
9064
+ console.log(chalk18.gray(" A new PR will be opened with cumulative changes."));
9065
+ } catch (error) {
9066
+ console.error(
9067
+ chalk18.red(`Failed to start iterative run: ${error.message}`)
9068
+ );
9069
+ }
9070
+ });
8922
9071
  }
8923
9072
 
8924
9073
  // src/runtime/monitoring.ts
@@ -8967,13 +9116,13 @@ async function initServerMonitoring(config) {
8967
9116
 
8968
9117
  // src/index.ts
8969
9118
  await initServerMonitoring({
8970
- dsn: "https://ed007f2c213d0aa07c1be256ca51750c@o4510863861612544.ingest.de.sentry.io/4510863921774672",
9119
+ dsn: "",
8971
9120
  environment: process.env.NODE_ENV || "production",
8972
- release: "0.1.56",
9121
+ release: "0.1.58",
8973
9122
  serviceName: "cli"
8974
9123
  });
8975
9124
  var program = new Command();
8976
- program.name("vem").description("vem Project Memory CLI").version("0.1.56").addHelpText(
9125
+ program.name("vem").description("vem Project Memory CLI").version("0.1.58").addHelpText(
8977
9126
  "after",
8978
9127
  `
8979
9128
  ${chalk19.bold("\n\u26A1 Power Workflows:")}