@kody-ade/kody-engine 0.4.178 → 0.4.180

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
@@ -1309,7 +1309,7 @@ var init_loadPriorArt = __esm({
1309
1309
  // package.json
1310
1310
  var package_default = {
1311
1311
  name: "@kody-ade/kody-engine",
1312
- version: "0.4.178",
1312
+ version: "0.4.180",
1313
1313
  description: "kody \u2014 autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative executable profiles.",
1314
1314
  license: "MIT",
1315
1315
  type: "module",
@@ -12599,13 +12599,22 @@ var runPreviewBuild = async (ctx, _profile, _args) => {
12599
12599
  );
12600
12600
  }
12601
12601
  const consumerDockerfile = path36.join(ctx.cwd, "Dockerfile.preview");
12602
+ const { stat } = await import("fs/promises");
12603
+ let hasConsumerDockerfile = false;
12602
12604
  try {
12603
- await copyFile(bundledDockerfilePath(buildMode), consumerDockerfile);
12604
- console.log(`[preview-build] using bundled Dockerfile.preview.${buildMode}`);
12605
- } catch (err) {
12606
- console.warn(
12607
- `[preview-build] failed to drop bundled Dockerfile: ${err instanceof Error ? err.message : err}`
12605
+ await stat(consumerDockerfile);
12606
+ hasConsumerDockerfile = true;
12607
+ } catch {
12608
+ hasConsumerDockerfile = false;
12609
+ }
12610
+ if (!hasConsumerDockerfile) {
12611
+ const bundled = bundledDockerfilePath(buildMode);
12612
+ await copyFile(bundled, consumerDockerfile);
12613
+ console.log(
12614
+ `[preview-build] using bundled Dockerfile.preview.${buildMode} (from ${bundled})`
12608
12615
  );
12616
+ } else {
12617
+ console.log("[preview-build] using repo Dockerfile.preview");
12609
12618
  }
12610
12619
  let baseImage = null;
12611
12620
  if (ghcrOwner) {
@@ -12634,27 +12643,39 @@ var runPreviewBuild = async (ctx, _profile, _args) => {
12634
12643
  await flyCreateApp(appName, orgSlug, flyToken);
12635
12644
  }
12636
12645
  await flyAllocateSharedIps(appName, flyToken);
12646
+ const nscToken = doc.secrets?.NSC_TOKEN?.value?.trim();
12647
+ if (!nscToken) {
12648
+ ctx.output.exitCode = 99;
12649
+ ctx.output.reason = "runPreviewBuild: vault has no NSC_TOKEN \u2014 add it via the dashboard's /secrets page";
12650
+ return;
12651
+ }
12652
+ process.env.NSC_TOKEN = nscToken;
12653
+ await runCmd(
12654
+ "bash",
12655
+ [
12656
+ "-c",
12657
+ "command -v nsc >/dev/null 2>&1 || curl -fsSL https://get.namespace.so/install.sh | sh"
12658
+ ],
12659
+ { cwd: ctx.cwd }
12660
+ );
12661
+ await runCmd("nsc", ["docker", "buildx", "setup"], { cwd: ctx.cwd });
12637
12662
  await runCmd(
12638
12663
  "docker",
12639
12664
  ["login", "registry.fly.io", "-u", "x", "--password-stdin"],
12640
12665
  { input: flyToken, cwd: ctx.cwd }
12641
12666
  );
12642
12667
  const buildArgs = [
12668
+ "buildx",
12643
12669
  "build",
12644
12670
  "-f",
12645
12671
  "Dockerfile.preview",
12646
12672
  "-t",
12647
- `registry.fly.io/${appName}:${tag}`
12673
+ `registry.fly.io/${appName}:${tag}`,
12674
+ "--push"
12648
12675
  ];
12649
12676
  if (baseImage) buildArgs.push("--build-arg", `BASE_IMAGE=${baseImage}`);
12650
12677
  buildArgs.push(".");
12651
- await runCmd("docker", buildArgs, {
12652
- cwd: ctx.cwd,
12653
- env: { DOCKER_BUILDKIT: "1" }
12654
- });
12655
- await runCmd("docker", ["push", `registry.fly.io/${appName}:${tag}`], {
12656
- cwd: ctx.cwd
12657
- });
12678
+ await runCmd("docker", buildArgs, { cwd: ctx.cwd });
12658
12679
  const stale = await flyListMachines(appName, flyToken);
12659
12680
  for (const m of stale) {
12660
12681
  await flyDestroyMachine(appName, m.id, flyToken).catch(() => void 0);
@@ -0,0 +1,43 @@
1
+ # syntax=docker/dockerfile:1.7
2
+ #
3
+ # Bundled default Dockerfile.preview — DEV-MODE variant.
4
+ #
5
+ # Previews run `next dev`, NOT `next build` + `next start`. This skips
6
+ # the 5–10 min webpack production compile entirely. Trade-offs:
7
+ # - First request to each route lags 2–5s (compile-on-demand)
8
+ # - Subsequent requests are fast
9
+ # - Memory hungry at runtime (webpack alive)
10
+ # For PR previews this is the right trade — reviewers click a handful
11
+ # of pages, never need prod optimizations. Production stays on Vercel.
12
+ #
13
+ # When BASE_IMAGE is set, deps are inherited from the per-repo base
14
+ # image; the install layer just verifies the lockfile.
15
+
16
+ ARG BASE_IMAGE=node:22-alpine
17
+
18
+ FROM ${BASE_IMAGE}
19
+ WORKDIR /app
20
+
21
+ RUN corepack enable 2>/dev/null || true
22
+
23
+ COPY package.json pnpm-lock.yaml* package-lock.json* yarn.lock* ./
24
+ RUN --mount=type=cache,id=kp-pnpm-store,target=/root/.local/share/pnpm/store \
25
+ --mount=type=cache,id=kp-npm-cache,target=/root/.npm \
26
+ if [ -f pnpm-lock.yaml ]; then pnpm install --frozen-lockfile --ignore-scripts; \
27
+ elif [ -f package-lock.json ]; then npm ci --ignore-scripts; \
28
+ elif [ -f yarn.lock ]; then yarn install --frozen-lockfile --ignore-scripts; \
29
+ else npm install --ignore-scripts; fi
30
+
31
+ # Overwrite source files with the PR's version. node_modules and any
32
+ # prior .next directory from the base image are preserved as warm
33
+ # caches for the dev server's first compile.
34
+ COPY . ./
35
+ RUN mkdir -p public
36
+
37
+ ENV NEXT_TELEMETRY_DISABLED=1
38
+ ENV NODE_ENV=development
39
+ ENV PORT=8080
40
+ ENV HOSTNAME=0.0.0.0
41
+
42
+ EXPOSE 8080
43
+ CMD ["sh", "-c", "if [ -f pnpm-lock.yaml ]; then pnpm exec next dev -H 0.0.0.0 -p 8080; else npx next dev -H 0.0.0.0 -p 8080; fi"]
@@ -0,0 +1,40 @@
1
+ # syntax=docker/dockerfile:1.7
2
+ #
3
+ # Bundled default Dockerfile.preview — PROD-MODE variant.
4
+ #
5
+ # Runs `next build` + `next start` — same shape as Vercel. Slower
6
+ # first build (~5–10 min webpack) but instant per-page response.
7
+ # Pick this mode for repos where reviewers test production-only
8
+ # behaviour (SSG, static optimization, edge runtime parity).
9
+
10
+ ARG BASE_IMAGE=node:22-alpine
11
+
12
+ FROM ${BASE_IMAGE}
13
+ WORKDIR /app
14
+
15
+ RUN corepack enable 2>/dev/null || true
16
+
17
+ COPY package.json pnpm-lock.yaml* package-lock.json* yarn.lock* ./
18
+ RUN --mount=type=cache,id=kp-pnpm-store,target=/root/.local/share/pnpm/store \
19
+ --mount=type=cache,id=kp-npm-cache,target=/root/.npm \
20
+ if [ -f pnpm-lock.yaml ]; then pnpm install --frozen-lockfile --ignore-scripts; \
21
+ elif [ -f package-lock.json ]; then npm ci --ignore-scripts; \
22
+ elif [ -f yarn.lock ]; then yarn install --frozen-lockfile --ignore-scripts; \
23
+ else npm install --ignore-scripts; fi
24
+
25
+ COPY . ./
26
+ RUN mkdir -p public
27
+
28
+ ENV NEXT_TELEMETRY_DISABLED=1
29
+ ENV NODE_ENV=production
30
+ ENV PORT=8080
31
+ ENV HOSTNAME=0.0.0.0
32
+ ENV NODE_OPTIONS="--max-old-space-size=7168"
33
+
34
+ RUN --mount=type=cache,id=kp-next-cache,target=/app/.next/cache \
35
+ if [ -f pnpm-lock.yaml ]; then pnpm exec next build; \
36
+ else npx next build; \
37
+ fi
38
+
39
+ EXPOSE 8080
40
+ CMD ["sh", "-c", "if [ -f pnpm-lock.yaml ]; then pnpm exec next start -H 0.0.0.0 -p 8080; else npx next start -H 0.0.0.0 -p 8080; fi"]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.4.178",
3
+ "version": "0.4.180",
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",