@kody-ade/kody-engine 0.3.62 → 0.3.63

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.62",
6
+ version: "0.3.63",
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",
@@ -5887,6 +5887,62 @@ function tryPostPr3(prNumber, body, cwd) {
5887
5887
  }
5888
5888
  }
5889
5889
 
5890
+ // src/deployments.ts
5891
+ function findPreviewDeploymentUrl(prNumber, cwd) {
5892
+ const sha = getPrHeadSha(prNumber, cwd);
5893
+ if (!sha) return null;
5894
+ const raw = safeGh2(
5895
+ ["api", `repos/{owner}/{repo}/deployments?sha=${sha}&environment=Preview&per_page=10`],
5896
+ cwd
5897
+ );
5898
+ if (!raw) return null;
5899
+ let deployments;
5900
+ try {
5901
+ deployments = JSON.parse(raw);
5902
+ } catch {
5903
+ return null;
5904
+ }
5905
+ if (!Array.isArray(deployments) || deployments.length === 0) return null;
5906
+ for (const d of deployments) {
5907
+ const url = latestSuccessUrl(d.id, cwd);
5908
+ if (url) return url;
5909
+ }
5910
+ return null;
5911
+ }
5912
+ function getPrHeadSha(prNumber, cwd) {
5913
+ const out = safeGh2(["api", `repos/{owner}/{repo}/pulls/${prNumber}`, "--jq", ".head.sha"], cwd);
5914
+ if (!out) return null;
5915
+ const trimmed = out.trim();
5916
+ return trimmed.length > 0 ? trimmed : null;
5917
+ }
5918
+ function latestSuccessUrl(deploymentId, cwd) {
5919
+ const raw = safeGh2(
5920
+ ["api", `repos/{owner}/{repo}/deployments/${deploymentId}/statuses?per_page=10`],
5921
+ cwd
5922
+ );
5923
+ if (!raw) return null;
5924
+ let statuses;
5925
+ try {
5926
+ statuses = JSON.parse(raw);
5927
+ } catch {
5928
+ return null;
5929
+ }
5930
+ if (!Array.isArray(statuses)) return null;
5931
+ for (const s of statuses) {
5932
+ if (s.state === "success" && typeof s.environment_url === "string" && s.environment_url.length > 0) {
5933
+ return s.environment_url;
5934
+ }
5935
+ }
5936
+ return null;
5937
+ }
5938
+ function safeGh2(args, cwd) {
5939
+ try {
5940
+ return gh2(args, { cwd });
5941
+ } catch {
5942
+ return null;
5943
+ }
5944
+ }
5945
+
5890
5946
  // src/scripts/resolvePreviewUrl.ts
5891
5947
  var DEFAULT_PREVIEW_URL = "http://localhost:3000";
5892
5948
  var resolvePreviewUrl = async (ctx) => {
@@ -5902,6 +5958,15 @@ var resolvePreviewUrl = async (ctx) => {
5902
5958
  ctx.data.previewUrlSource = "env";
5903
5959
  return;
5904
5960
  }
5961
+ const prNumber = typeof ctx.args.pr === "number" ? ctx.args.pr : null;
5962
+ if (prNumber !== null) {
5963
+ const fromDeployment = findPreviewDeploymentUrl(prNumber, ctx.cwd);
5964
+ if (fromDeployment) {
5965
+ ctx.data.previewUrl = fromDeployment;
5966
+ ctx.data.previewUrlSource = "deployment";
5967
+ return;
5968
+ }
5969
+ }
5905
5970
  ctx.data.previewUrl = DEFAULT_PREVIEW_URL;
5906
5971
  ctx.data.previewUrlSource = "default";
5907
5972
  };
File without changes
File without changes
File without changes
File without changes
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.3.62",
3
+ "version": "0.3.63",
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",
@@ -12,18 +12,6 @@
12
12
  "templates",
13
13
  "kody.config.schema.json"
14
14
  ],
15
- "scripts": {
16
- "kody": "tsx bin/kody.ts",
17
- "build": "tsup && node scripts/copy-assets.cjs",
18
- "test": "vitest run tests/unit tests/int --no-coverage",
19
- "test:e2e": "vitest run tests/e2e --no-coverage",
20
- "test:all": "vitest run tests --no-coverage",
21
- "typecheck": "tsc --noEmit",
22
- "lint": "biome check",
23
- "lint:fix": "biome check --write",
24
- "format": "biome format --write",
25
- "prepublishOnly": "pnpm build"
26
- },
27
15
  "dependencies": {
28
16
  "@actions/cache": "^6.0.0",
29
17
  "@anthropic-ai/claude-agent-sdk": "0.2.119"
@@ -44,5 +32,16 @@
44
32
  "url": "git+https://github.com/aharonyaircohen/kody-engine.git"
45
33
  },
46
34
  "homepage": "https://github.com/aharonyaircohen/kody-engine",
47
- "bugs": "https://github.com/aharonyaircohen/kody-engine/issues"
48
- }
35
+ "bugs": "https://github.com/aharonyaircohen/kody-engine/issues",
36
+ "scripts": {
37
+ "kody": "tsx bin/kody.ts",
38
+ "build": "tsup && node scripts/copy-assets.cjs",
39
+ "test": "vitest run tests/unit tests/int --no-coverage",
40
+ "test:e2e": "vitest run tests/e2e --no-coverage",
41
+ "test:all": "vitest run tests --no-coverage",
42
+ "typecheck": "tsc --noEmit",
43
+ "lint": "biome check",
44
+ "lint:fix": "biome check --write",
45
+ "format": "biome format --write"
46
+ }
47
+ }