@kody-ade/kody-engine 0.4.246 → 0.4.247

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.
Files changed (2) hide show
  1. package/dist/bin/kody.js +40 -2
  2. package/package.json +23 -22
package/dist/bin/kody.js CHANGED
@@ -15,7 +15,7 @@ var init_package = __esm({
15
15
  "package.json"() {
16
16
  package_default = {
17
17
  name: "@kody-ade/kody-engine",
18
- version: "0.4.246",
18
+ version: "0.4.247",
19
19
  description: "kody \u2014 autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative agentAction profiles.",
20
20
  license: "MIT",
21
21
  type: "module",
@@ -146,7 +146,7 @@ var init_claudeBinary = __esm({
146
146
  // src/issue.ts
147
147
  import { execFileSync } from "child_process";
148
148
  function ghToken() {
149
- return process.env.GH_PAT?.trim() || process.env.GH_TOKEN;
149
+ return process.env.GITHUB_TOKEN?.trim() || process.env.KODY_TOKEN?.trim() || process.env.GH_TOKEN?.trim() || process.env.GH_PAT?.trim();
150
150
  }
151
151
  function gh(args, options) {
152
152
  const token = ghToken();
@@ -658,6 +658,14 @@ function parseGoalActivations(raw) {
658
658
  const idPrefix = parseSlug(r.idPrefix, "company.activeGoals.idPrefix");
659
659
  if (idPrefix) entry.idPrefix = idPrefix;
660
660
  }
661
+ if (r.preferredRunTime !== void 0) {
662
+ const preferredRunTime = parsePreferredRunTime(r.preferredRunTime);
663
+ if (!preferredRunTime)
664
+ throw new Error(
665
+ `kody.config.json: company.activeGoals preferredRunTime must be { "time": "HH:MM", "timezone": "Area/Name" }`
666
+ );
667
+ entry.preferredRunTime = preferredRunTime;
668
+ }
661
669
  const facts = recordValue(r.facts);
662
670
  if (r.facts !== void 0 && !facts)
663
671
  throw new Error(`kody.config.json: company.activeGoals facts must be an object`);
@@ -666,6 +674,13 @@ function parseGoalActivations(raw) {
666
674
  }
667
675
  return out;
668
676
  }
677
+ function parsePreferredRunTime(raw) {
678
+ const r = recordValue(raw);
679
+ if (!r) return null;
680
+ if (typeof r.time !== "string" || !/^([01]\d|2[0-3]):[0-5]\d$/.test(r.time.trim())) return null;
681
+ if (typeof r.timezone !== "string" || !r.timezone.trim()) return null;
682
+ return { time: r.time.trim(), timezone: r.timezone.trim() };
683
+ }
669
684
  function parseSlugArray(raw, field) {
670
685
  if (!Array.isArray(raw)) throw new Error(`kody.config.json: ${field} must be an array of strings`);
671
686
  const out = [];
@@ -17435,12 +17450,34 @@ function unpackAllSecrets(env = process.env) {
17435
17450
  }
17436
17451
  return count;
17437
17452
  }
17453
+ function recoverCheckoutToken(env = process.env, cwd = process.cwd()) {
17454
+ if (env.GITHUB_TOKEN?.trim()) return env.GITHUB_TOKEN.trim();
17455
+ let header = "";
17456
+ try {
17457
+ header = execFileSync25("git", ["config", "--local", "--get", "http.https://github.com/.extraheader"], {
17458
+ cwd,
17459
+ encoding: "utf-8",
17460
+ stdio: ["ignore", "pipe", "ignore"]
17461
+ }).trim();
17462
+ } catch {
17463
+ return void 0;
17464
+ }
17465
+ const match = /^AUTHORIZATION:\s+basic\s+(.+)$/i.exec(header);
17466
+ if (!match) return void 0;
17467
+ const decoded = Buffer.from(match[1], "base64").toString("utf-8");
17468
+ const token = decoded.includes(":") ? decoded.slice(decoded.indexOf(":") + 1).trim() : decoded.trim();
17469
+ if (!token) return void 0;
17470
+ env.GITHUB_TOKEN = token;
17471
+ process.stdout.write("\u2192 kody: GITHUB_TOKEN recovered from actions/checkout credentials\n");
17472
+ return token;
17473
+ }
17438
17474
  async function resolveAuthToken(env = process.env) {
17439
17475
  const creds = readAppCreds(env);
17440
17476
  if (creds) {
17441
17477
  try {
17442
17478
  const minted = await mintAppInstallationToken(creds);
17443
17479
  env.GH_TOKEN = minted;
17480
+ recoverCheckoutToken(env);
17444
17481
  process.stdout.write("\u2192 kody: GH_TOKEN minted from GitHub App (KODY_APP_ID/KODY_APP_PRIVATE_KEY)\n");
17445
17482
  return minted;
17446
17483
  } catch (err) {
@@ -17457,6 +17494,7 @@ async function resolveAuthToken(env = process.env) {
17457
17494
  const picked = sources.find(([, v]) => !!v);
17458
17495
  const token = picked?.[1];
17459
17496
  if (token && !env.GH_TOKEN) env.GH_TOKEN = token;
17497
+ recoverCheckoutToken(env);
17460
17498
  if (token) {
17461
17499
  process.stdout.write(`\u2192 kody: GH_TOKEN sourced from env.${picked[0]}
17462
17500
  `);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.4.246",
3
+ "version": "0.4.247",
4
4
  "description": "kody — autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative agentAction profiles.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -12,6 +12,26 @@
12
12
  "templates",
13
13
  "kody.config.schema.json"
14
14
  ],
15
+ "scripts": {
16
+ "kody:run": "tsx bin/kody.ts",
17
+ "serve": "tsx bin/kody.ts serve",
18
+ "serve:vscode": "tsx bin/kody.ts serve vscode",
19
+ "serve:claude": "tsx bin/kody.ts serve claude",
20
+ "build": "tsup && node scripts/copy-assets.cjs",
21
+ "check:modularity": "tsx scripts/check-script-modularity.ts",
22
+ "pretest": "pnpm check:modularity",
23
+ "test": "vitest run tests/unit tests/int --coverage",
24
+ "posttest": "tsx scripts/check-coverage-floor.ts",
25
+ "test:smoke": "vitest run tests/smoke --no-coverage",
26
+ "test:e2e": "vitest run tests/e2e --no-coverage",
27
+ "test:all": "vitest run tests --no-coverage",
28
+ "typecheck": "tsc --noEmit",
29
+ "lint": "biome check",
30
+ "lint:fix": "biome check --write",
31
+ "format": "biome format --write",
32
+ "brain:publish": "docker buildx build --platform linux/amd64 -f runner/Dockerfile.brain -t ghcr.io/${KODY_BRAIN_GHCR_OWNER:-aharonyaircohen}/kody-brain:latest --push runner",
33
+ "prepublishOnly": "pnpm typecheck && vitest run tests/unit tests/int --no-coverage && pnpm build"
34
+ },
15
35
  "dependencies": {
16
36
  "@actions/cache": "^6.0.0",
17
37
  "@anthropic-ai/claude-agent-sdk": "0.2.119",
@@ -35,24 +55,5 @@
35
55
  "url": "git+https://github.com/aharonyaircohen/kody-engine.git"
36
56
  },
37
57
  "homepage": "https://github.com/aharonyaircohen/kody-engine",
38
- "bugs": "https://github.com/aharonyaircohen/kody-engine/issues",
39
- "scripts": {
40
- "kody:run": "tsx bin/kody.ts",
41
- "serve": "tsx bin/kody.ts serve",
42
- "serve:vscode": "tsx bin/kody.ts serve vscode",
43
- "serve:claude": "tsx bin/kody.ts serve claude",
44
- "build": "tsup && node scripts/copy-assets.cjs",
45
- "check:modularity": "tsx scripts/check-script-modularity.ts",
46
- "pretest": "pnpm check:modularity",
47
- "test": "vitest run tests/unit tests/int --coverage",
48
- "posttest": "tsx scripts/check-coverage-floor.ts",
49
- "test:smoke": "vitest run tests/smoke --no-coverage",
50
- "test:e2e": "vitest run tests/e2e --no-coverage",
51
- "test:all": "vitest run tests --no-coverage",
52
- "typecheck": "tsc --noEmit",
53
- "lint": "biome check",
54
- "lint:fix": "biome check --write",
55
- "format": "biome format --write",
56
- "brain:publish": "docker buildx build --platform linux/amd64 -f runner/Dockerfile.brain -t ghcr.io/${KODY_BRAIN_GHCR_OWNER:-aharonyaircohen}/kody-brain:latest --push runner"
57
- }
58
- }
58
+ "bugs": "https://github.com/aharonyaircohen/kody-engine/issues"
59
+ }