@kody-ade/kody-engine 0.4.70 → 0.4.71

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
@@ -864,7 +864,7 @@ var init_loadPriorArt = __esm({
864
864
  // package.json
865
865
  var package_default = {
866
866
  name: "@kody-ade/kody-engine",
867
- version: "0.4.70",
867
+ version: "0.4.71",
868
868
  description: "kody \u2014 autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative executable profiles.",
869
869
  license: "MIT",
870
870
  type: "module",
@@ -879,6 +879,8 @@ var package_default = {
879
879
  scripts: {
880
880
  kody: "tsx bin/kody.ts",
881
881
  serve: "tsx bin/kody.ts serve",
882
+ "serve:vscode": "tsx bin/kody.ts serve vscode",
883
+ "serve:claude": "tsx bin/kody.ts serve claude",
882
884
  build: "tsup && node scripts/copy-assets.cjs",
883
885
  "check:modularity": "tsx scripts/check-script-modularity.ts",
884
886
  pretest: "pnpm check:modularity",
@@ -3836,6 +3838,11 @@ var commitAndPush2 = async (ctx, profile) => {
3836
3838
  } catch {
3837
3839
  }
3838
3840
  }
3841
+ if (ctx.data.verifyOk === false) {
3842
+ ctx.data.commitResult = { committed: false, pushed: false, skippedReason: "verifyFailed" };
3843
+ ctx.data.hasCommitsAhead = hasCommitsAhead(branch, ctx.config.git.defaultBranch, ctx.cwd);
3844
+ return;
3845
+ }
3839
3846
  const markerMissing = ctx.data.agentMarkerMissing === true;
3840
3847
  if (ctx.data.agentDone === false && !markerMissing) {
3841
3848
  ctx.data.commitResult = { committed: false, pushed: false, skippedReason: "agentDone=false" };
@@ -8954,8 +8961,23 @@ function buildChildEnv(parent, force) {
8954
8961
 
8955
8962
  // src/scripts/serveFlow.ts
8956
8963
  import { spawn as spawn3 } from "child_process";
8964
+ function parseTarget(positional) {
8965
+ if (!Array.isArray(positional) || positional.length === 0) return "none";
8966
+ const first = String(positional[0]).toLowerCase();
8967
+ if (first === "vscode" || first === "code") return "vscode";
8968
+ if (first === "claude") return "claude";
8969
+ throw new Error(`unknown serve subcommand: "${positional[0]}" (expected: vscode, claude, or omit)`);
8970
+ }
8971
+ function buildProxyEnv(url) {
8972
+ return {
8973
+ ...process.env,
8974
+ ANTHROPIC_BASE_URL: url,
8975
+ ANTHROPIC_API_KEY: getAnthropicApiKeyOrDummy()
8976
+ };
8977
+ }
8957
8978
  var serveFlow = async (ctx) => {
8958
8979
  ctx.skipAgent = true;
8980
+ const target = parseTarget(ctx.args._);
8959
8981
  const model = parseProviderModel(ctx.config.agent.model);
8960
8982
  const usesProxy = needsLitellmProxy(model);
8961
8983
  let handle = null;
@@ -8970,19 +8992,45 @@ var serveFlow = async (ctx) => {
8970
8992
  `);
8971
8993
  }
8972
8994
  const url = handle?.url ?? LITELLM_DEFAULT_URL;
8973
- const noEditor = ctx.args.noEditor === true;
8974
- if (!noEditor) {
8975
- const env = { ...process.env };
8976
- if (usesProxy) {
8977
- env.ANTHROPIC_BASE_URL = url;
8978
- env.ANTHROPIC_API_KEY = getAnthropicApiKeyOrDummy();
8995
+ const editorEnv = usesProxy ? buildProxyEnv(url) : { ...process.env };
8996
+ const killProxy = () => {
8997
+ if (handle) {
8998
+ process.stdout.write(`[kody serve] stopping LiteLLM proxy...
8999
+ `);
9000
+ try {
9001
+ handle.kill();
9002
+ } catch {
9003
+ }
8979
9004
  }
9005
+ };
9006
+ if (target === "claude") {
9007
+ process.stdout.write(`[kody serve] launching Claude Code at ${ctx.cwd}
9008
+ `);
9009
+ if (usesProxy) process.stdout.write(` ANTHROPIC_BASE_URL=${url}
9010
+ `);
9011
+ const args = ["--dangerously-skip-permissions", "--model", model.model];
9012
+ const child = spawn3("claude", args, { stdio: "inherit", env: editorEnv, cwd: ctx.cwd });
9013
+ const exitCode = await new Promise((resolve4) => {
9014
+ child.on("exit", (code) => resolve4(code ?? 0));
9015
+ child.on("error", (err) => {
9016
+ process.stderr.write(`[kody serve] failed to launch Claude Code: ${err.message}
9017
+ `);
9018
+ process.stderr.write(` Install: https://docs.anthropic.com/claude/docs/claude-code
9019
+ `);
9020
+ resolve4(1);
9021
+ });
9022
+ });
9023
+ killProxy();
9024
+ ctx.output.exitCode = exitCode;
9025
+ return;
9026
+ }
9027
+ if (target === "vscode") {
8980
9028
  process.stdout.write(`[kody serve] launching VS Code at ${ctx.cwd}
8981
9029
  `);
8982
9030
  if (usesProxy) process.stdout.write(` ANTHROPIC_BASE_URL=${url}
8983
9031
  `);
8984
9032
  try {
8985
- const code = spawn3("code", [ctx.cwd], { stdio: "inherit", env, detached: true });
9033
+ const code = spawn3("code", [ctx.cwd], { stdio: "inherit", env: editorEnv, detached: true });
8986
9034
  code.on("error", (err) => {
8987
9035
  process.stderr.write(`[kody serve] failed to launch VS Code: ${err.message}
8988
9036
  `);
@@ -9000,20 +9048,15 @@ var serveFlow = async (ctx) => {
9000
9048
  `);
9001
9049
  const keepAlive = setInterval(() => {
9002
9050
  }, 6e4);
9003
- const cleanup = (signal, exitCode) => {
9051
+ const shutdown = (signal, exitCode) => {
9004
9052
  clearInterval(keepAlive);
9005
- if (handle) {
9006
- process.stdout.write(`[kody serve] received ${signal}, stopping LiteLLM proxy...
9053
+ process.stdout.write(`[kody serve] received ${signal}
9007
9054
  `);
9008
- try {
9009
- handle.kill();
9010
- } catch {
9011
- }
9012
- }
9055
+ killProxy();
9013
9056
  process.exit(exitCode);
9014
9057
  };
9015
- process.on("SIGINT", () => cleanup("SIGINT", 130));
9016
- process.on("SIGTERM", () => cleanup("SIGTERM", 143));
9058
+ process.on("SIGINT", () => shutdown("SIGINT", 130));
9059
+ process.on("SIGTERM", () => shutdown("SIGTERM", 143));
9017
9060
  await new Promise(() => {
9018
9061
  });
9019
9062
  };
@@ -10235,6 +10278,9 @@ function validateInputs(specs, raw) {
10235
10278
  throw new Error(`unknown arg: --${key}`);
10236
10279
  }
10237
10280
  }
10281
+ if (Array.isArray(raw._)) {
10282
+ out._ = raw._;
10283
+ }
10238
10284
  for (const spec of specs) {
10239
10285
  const v = raw[spec.name];
10240
10286
  if (v === void 0 || v === null) continue;
@@ -1,16 +1,8 @@
1
1
  {
2
2
  "name": "serve",
3
3
  "role": "utility",
4
- "describe": "Start a LiteLLM proxy and launch VS Code with ANTHROPIC_BASE_URL pointed at it. Long-lived — Ctrl+C to stop.",
5
- "inputs": [
6
- {
7
- "name": "noEditor",
8
- "flag": "--no-editor",
9
- "type": "bool",
10
- "required": false,
11
- "describe": "Run the LiteLLM proxy only; do not launch VS Code."
12
- }
13
- ],
4
+ "describe": "Start a LiteLLM proxy and optionally launch an editor pointed at it. Usage: `kody serve` (proxy only), `kody serve vscode`, `kody serve claude`. Long-lived — Ctrl+C to stop.",
5
+ "inputs": [],
14
6
  "claudeCode": {
15
7
  "model": "inherit",
16
8
  "permissionMode": "acceptEdits",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.4.70",
3
+ "version": "0.4.71",
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",
@@ -37,6 +37,8 @@
37
37
  "scripts": {
38
38
  "kody": "tsx bin/kody.ts",
39
39
  "serve": "tsx bin/kody.ts serve",
40
+ "serve:vscode": "tsx bin/kody.ts serve vscode",
41
+ "serve:claude": "tsx bin/kody.ts serve claude",
40
42
  "build": "tsup && node scripts/copy-assets.cjs",
41
43
  "check:modularity": "tsx scripts/check-script-modularity.ts",
42
44
  "pretest": "pnpm check:modularity",