@kody-ade/kody-engine 0.3.81 → 0.3.83

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/bin/kody.js CHANGED
@@ -3,7 +3,7 @@
3
3
  // package.json
4
4
  var package_default = {
5
5
  name: "@kody-ade/kody-engine",
6
- version: "0.3.81",
6
+ version: "0.3.83",
7
7
  description: "kody \u2014 autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative executable profiles.",
8
8
  license: "MIT",
9
9
  type: "module",
@@ -820,14 +820,58 @@ function commitTurn(cwd, sessionId, verbose) {
820
820
  const paths = [sessionRel, eventsRel].filter((p) => fs5.existsSync(path5.join(cwd, p)));
821
821
  if (paths.length === 0) return;
822
822
  const stdio = verbose ? "inherit" : "pipe";
823
+ const exec = (args) => execFileSync2("git", args, { cwd, stdio });
823
824
  try {
824
- execFileSync2("git", ["add", "-f", ...paths], { cwd, stdio });
825
- execFileSync2("git", ["commit", "--quiet", "-m", `chat: interactive turn for ${sessionId}`], { cwd, stdio });
826
- execFileSync2("git", ["push", "--quiet", "origin", "HEAD"], { cwd, stdio });
825
+ exec(["add", "-f", ...paths]);
826
+ exec(["commit", "--quiet", "-m", `chat: interactive turn for ${sessionId}`]);
827
827
  } catch (err) {
828
828
  const msg = err instanceof Error ? err.message : String(err);
829
- process.stderr.write(`[kody:chat:interactive] commit/push skipped: ${msg}
829
+ process.stderr.write(`[kody:chat:interactive] commit failed: ${msg}
830
830
  `);
831
+ return;
832
+ }
833
+ for (let attempt = 1; attempt <= 3; attempt++) {
834
+ try {
835
+ exec(["push", "--quiet", "origin", "HEAD"]);
836
+ return;
837
+ } catch (err) {
838
+ const msg = err instanceof Error ? err.message : String(err);
839
+ const isNonFf = /non-fast-forward|fetch first|rejected/i.test(msg);
840
+ if (!isNonFf || attempt === 3) {
841
+ process.stderr.write(`[kody:chat:interactive] push failed (attempt ${attempt}): ${msg}
842
+ `);
843
+ return;
844
+ }
845
+ process.stderr.write(`[kody:chat:interactive] push rejected (attempt ${attempt}); fetch+rebase+retry
846
+ `);
847
+ try {
848
+ exec(["fetch", "--quiet", "origin"]);
849
+ const branch = currentBranch2(cwd);
850
+ if (branch) {
851
+ exec(["rebase", "--quiet", `origin/${branch}`]);
852
+ } else {
853
+ process.stderr.write(`[kody:chat:interactive] cannot rebase: no current branch
854
+ `);
855
+ return;
856
+ }
857
+ } catch (rebaseErr) {
858
+ const rmsg = rebaseErr instanceof Error ? rebaseErr.message : String(rebaseErr);
859
+ process.stderr.write(`[kody:chat:interactive] rebase failed: ${rmsg}
860
+ `);
861
+ return;
862
+ }
863
+ }
864
+ }
865
+ }
866
+ function currentBranch2(cwd) {
867
+ try {
868
+ const out = execFileSync2("git", ["symbolic-ref", "--short", "HEAD"], {
869
+ cwd,
870
+ stdio: ["ignore", "pipe", "ignore"]
871
+ });
872
+ return out.toString("utf-8").trim() || null;
873
+ } catch {
874
+ return null;
831
875
  }
832
876
  }
833
877
  async function emitExit(opts, reason, turnsCompleted) {
@@ -54,12 +54,10 @@
54
54
  { "script": "verifyReproFails" },
55
55
  { "script": "abortUnfinishedGitOps" },
56
56
  { "script": "commitAndPush" },
57
- { "script": "ensurePr" },
58
57
  { "script": "postIssueComment" },
59
58
  { "script": "persistArtifacts" },
60
59
  { "script": "writeRunSummary" },
61
60
  { "script": "saveTaskState" },
62
- { "script": "mirrorStateToPr" },
63
61
  { "script": "advanceFlow" }
64
62
  ]
65
63
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.3.81",
3
+ "version": "0.3.83",
4
4
  "description": "kody — autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative executable profiles.",
5
5
  "license": "MIT",
6
6
  "type": "module",