@openape/apes 1.28.7 → 1.28.9

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/cli.js CHANGED
@@ -2892,9 +2892,22 @@ Worktree: ${worktree}`,
2892
2892
  const agentRisk = await deps.riskAssessor({ paths: changedFiles, diff });
2893
2893
  const decision = decideMerge(changedFiles, policy, agentRisk);
2894
2894
  log(`[coding] decision=${decision.classification} (${decision.reason})`);
2895
- await shell(`git -C '${worktree}' commit -m ${shqMsg(input.issue)} && git -C '${worktree}' push -u origin '${branch}'`);
2895
+ const authorEmail = process.env.GIT_AUTHOR_EMAIL || "coding-agent@openape.ai";
2896
+ const authorName = process.env.GIT_AUTHOR_NAME || "OpenApe Coding Agent";
2897
+ const ident = `-c user.email='${authorEmail.replace(/'/g, "")}' -c user.name='${authorName.replace(/'/g, "")}'`;
2898
+ const commitRes = await shell(`git -C '${worktree}' ${ident} commit -m ${shqMsg(input.issue)}`);
2899
+ if (commitRes.exit_code !== 0) {
2900
+ return { branch, worktree, runStatus: "ok", changedFiles, decision, outcome: "run-failed", prRef: branch, reason: `commit failed: ${(commitRes.stderr || commitRes.stdout).slice(0, 300)}` };
2901
+ }
2902
+ const pushRes = await shell(buildPushCommand(input.forge, input.repo, worktree, branch));
2903
+ if (pushRes.exit_code !== 0) {
2904
+ return { branch, worktree, runStatus: "ok", changedFiles, decision, outcome: "run-failed", prRef: branch, reason: `push failed: ${(pushRes.stderr || pushRes.stdout).slice(0, 300)}` };
2905
+ }
2896
2906
  const prCmd = buildPrCreate({ forge: input.forge, title: prTitle(input.issue), body: prBody(input.issue), head: branch });
2897
2907
  const prRes = await shell(`cd '${worktree}' && ${prCmd}`);
2908
+ if (prRes.exit_code !== 0) {
2909
+ return { branch, worktree, runStatus: "ok", changedFiles, decision, outcome: "run-failed", prRef: branch, reason: `pr create failed: ${(prRes.stderr || prRes.stdout).slice(0, 300)}` };
2910
+ }
2898
2911
  const prRef = prRes.stdout.match(/\/pull\/(\d+)|!(\d+)|\bpr\/(\d+)/i)?.slice(1).find(Boolean) ?? branch;
2899
2912
  if (decision.needsHuman) {
2900
2913
  return { branch, worktree, runStatus: "ok", changedFiles, decision, outcome: "awaiting-human", prRef, reason: decision.reason };
@@ -2918,6 +2931,14 @@ Automated by the OpenApe coding agent.`;
2918
2931
  function shqMsg(issue) {
2919
2932
  return `'${prTitle(issue).replace(/'/g, "'\\''")}'`;
2920
2933
  }
2934
+ function buildPushCommand(forge, repo, worktree, branch) {
2935
+ const base = `GIT_TERMINAL_PROMPT=0 git -C '${worktree}'`;
2936
+ if (forge === "github") {
2937
+ const slug = repo.replace(/^[a-z]+:\/\/[^/]+\//i, "").replace(/\.git$/, "").replace(/['"\s]/g, "");
2938
+ return `${base} push "https://x-access-token:\${GH_TOKEN}@github.com/${slug}.git" '${branch}'`;
2939
+ }
2940
+ return `${base} push -u origin '${branch}'`;
2941
+ }
2921
2942
 
2922
2943
  // src/lib/coding/llm-review.ts
2923
2944
  var DIFF_CAP2 = 48 * 1024;
@@ -3092,9 +3113,10 @@ function readLitellmConfig(model) {
3092
3113
  for (const k of ["LITELLM_API_KEY", "LITELLM_MASTER_KEY", "LITELLM_BASE_URL"]) {
3093
3114
  if (process2.env[k]) env[k] = process2.env[k];
3094
3115
  }
3095
- const apiKey = env.LITELLM_API_KEY || env.LITELLM_MASTER_KEY;
3096
3116
  const apiBase = (env.LITELLM_BASE_URL || "http://127.0.0.1:4000/v1").replace(/\/$/, "");
3097
- if (!apiKey) throw new CliError2("No LITELLM_API_KEY / LITELLM_MASTER_KEY in ~/litellm/.env or env.");
3117
+ const isLoopback = /^https?:\/\/(?:127\.0\.0\.1|localhost|\[::1\])(?::\d+)?(?:\/|$)/.test(apiBase);
3118
+ const apiKey = env.LITELLM_API_KEY || env.LITELLM_MASTER_KEY || (isLoopback ? "sk-loopback-noauth" : "");
3119
+ if (!apiKey) throw new CliError2("No LITELLM_API_KEY / LITELLM_MASTER_KEY for non-loopback LITELLM_BASE_URL.");
3098
3120
  return { apiBase, apiKey, model: model || process2.env.APE_CHAT_BRIDGE_MODEL || "claude-haiku-4-5" };
3099
3121
  }
3100
3122
  function readPersona(file) {
@@ -6738,7 +6760,7 @@ var mcpCommand = defineCommand52({
6738
6760
  if (transport !== "stdio" && transport !== "sse") {
6739
6761
  throw new Error('Transport must be "stdio" or "sse"');
6740
6762
  }
6741
- const { startMcpServer } = await import("./server-2QBEBPOV.js");
6763
+ const { startMcpServer } = await import("./server-TEPOASFL.js");
6742
6764
  await startMcpServer(transport, port);
6743
6765
  }
6744
6766
  });
@@ -7376,7 +7398,7 @@ async function bestEffortGrantCount(idp) {
7376
7398
  }
7377
7399
  }
7378
7400
  async function runHealth(args) {
7379
- const version = true ? "1.28.7" : "0.0.0";
7401
+ const version = true ? "1.28.9" : "0.0.0";
7380
7402
  const auth = loadAuth();
7381
7403
  if (!auth) {
7382
7404
  throw new CliError("Not logged in. Run `apes login` first.", 1);
@@ -7649,10 +7671,10 @@ if (shellRewrite) {
7649
7671
  if (shellRewrite.action === "rewrite") {
7650
7672
  process.argv = shellRewrite.argv;
7651
7673
  } else if (shellRewrite.action === "version") {
7652
- console.log(`ape-shell ${"1.28.7"} (OpenApe DDISA shell wrapper)`);
7674
+ console.log(`ape-shell ${"1.28.9"} (OpenApe DDISA shell wrapper)`);
7653
7675
  process.exit(0);
7654
7676
  } else if (shellRewrite.action === "help") {
7655
- console.log(`ape-shell ${"1.28.7"} \u2014 OpenApe DDISA shell wrapper`);
7677
+ console.log(`ape-shell ${"1.28.9"} \u2014 OpenApe DDISA shell wrapper`);
7656
7678
  console.log("");
7657
7679
  console.log("Usage:");
7658
7680
  console.log(" ape-shell Start interactive grant-mediated REPL");
@@ -7710,7 +7732,7 @@ var configCommand = defineCommand64({
7710
7732
  var main = defineCommand64({
7711
7733
  meta: {
7712
7734
  name: "apes",
7713
- version: "1.28.7",
7735
+ version: "1.28.9",
7714
7736
  description: "Unified CLI for OpenApe"
7715
7737
  },
7716
7738
  subCommands: {
@@ -7768,7 +7790,7 @@ async function maybeRefreshAuth() {
7768
7790
  }
7769
7791
  }
7770
7792
  await maybeRefreshAuth();
7771
- await maybeWarnStaleVersion("1.28.7").catch(() => {
7793
+ await maybeWarnStaleVersion("1.28.9").catch(() => {
7772
7794
  });
7773
7795
  runMain(main).catch((err) => {
7774
7796
  if (err instanceof CliExit) {