claudekit-cli 3.35.0-dev.25 → 3.35.0-dev.26

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/index.js +80 -9
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -53918,7 +53918,7 @@ var package_default;
53918
53918
  var init_package = __esm(() => {
53919
53919
  package_default = {
53920
53920
  name: "claudekit-cli",
53921
- version: "3.35.0-dev.25",
53921
+ version: "3.35.0-dev.26",
53922
53922
  description: "CLI tool for bootstrapping and updating ClaudeKit projects",
53923
53923
  type: "module",
53924
53924
  repository: {
@@ -53943,8 +53943,8 @@ var init_package = __esm(() => {
53943
53943
  "ui:build": "cd src/ui && bun install --silent && bun run build",
53944
53944
  "ui:dev": "cd src/ui && bun run dev",
53945
53945
  build: "bun build src/index.ts --outdir dist --target node --external @octokit/rest",
53946
- compile: "bun build src/index.ts --compile --outfile ck",
53947
- "compile:binary": "bun build src/index.ts --compile --outfile bin/ck",
53946
+ compile: "bun run ui:build && bun run scripts/compile-binary.ts",
53947
+ "compile:binary": "bun run ui:build && bun run scripts/compile-binary.ts --outfile bin/ck && cp bin/ck /usr/local/bin/ck && echo '✅ Installed globally: /usr/local/bin/ck'",
53948
53948
  "compile:binaries": "node scripts/build-all-binaries.js",
53949
53949
  "check-version-sync": "node scripts/check-binary-version-sync.js",
53950
53950
  "build:platform-binaries": "bun run scripts/build-platform-binaries.js",
@@ -56191,8 +56191,65 @@ var init_routes = __esm(() => {
56191
56191
 
56192
56192
  // src/domains/web-server/static-server.ts
56193
56193
  import { existsSync as existsSync33 } from "node:fs";
56194
- import { dirname as dirname12, join as join41 } from "node:path";
56194
+ import { dirname as dirname12, extname as extname3, join as join41 } from "node:path";
56195
56195
  import { fileURLToPath as fileURLToPath2 } from "node:url";
56196
+ function tryServeFromEmbedded(app) {
56197
+ if (typeof globalThis.Bun === "undefined" || !globalThis.Bun.embeddedFiles?.length) {
56198
+ return false;
56199
+ }
56200
+ let prefix = "";
56201
+ for (const blob of globalThis.Bun.embeddedFiles) {
56202
+ const name = blob.name;
56203
+ if (name === "index.html" || name.endsWith("/index.html")) {
56204
+ prefix = name.replace("index.html", "");
56205
+ break;
56206
+ }
56207
+ }
56208
+ const fileMap = new Map;
56209
+ let indexBlob = null;
56210
+ for (const blob of globalThis.Bun.embeddedFiles) {
56211
+ const rawName = blob.name;
56212
+ const name = prefix && rawName.startsWith(prefix) ? rawName.slice(prefix.length) : rawName;
56213
+ fileMap.set(name, blob);
56214
+ if (name === "index.html") {
56215
+ indexBlob = blob;
56216
+ }
56217
+ }
56218
+ if (!indexBlob) {
56219
+ logger.debug("Embedded files found but no index.html — skipping embedded serving");
56220
+ return false;
56221
+ }
56222
+ logger.debug(`Serving UI from ${fileMap.size} embedded files`);
56223
+ app.use(async (req, res, next) => {
56224
+ if (req.path.startsWith("/api/") || req.path === "/ws" || req.path.startsWith("/ws/")) {
56225
+ return next();
56226
+ }
56227
+ const reqPath = req.path.replace(/^\//, "");
56228
+ if (reqPath.includes("..") || reqPath.includes("\x00")) {
56229
+ return next();
56230
+ }
56231
+ const blob = fileMap.get(reqPath);
56232
+ if (blob) {
56233
+ const ext = extname3(reqPath);
56234
+ const contentType = blob.type || MIME_FALLBACK[ext] || "application/octet-stream";
56235
+ res.setHeader("Content-Type", contentType);
56236
+ const cacheControl = ext === ".html" ? "no-cache" : "public, max-age=31536000, immutable";
56237
+ res.setHeader("Cache-Control", cacheControl);
56238
+ res.send(Buffer.from(await blob.arrayBuffer()));
56239
+ return;
56240
+ }
56241
+ const hasExt = req.path.match(/\.(js|css|ico|png|jpg|svg|woff2?)$/);
56242
+ if (!hasExt && indexBlob) {
56243
+ const contentType = indexBlob.type || "text/html";
56244
+ res.setHeader("Content-Type", contentType);
56245
+ res.setHeader("Cache-Control", "no-cache");
56246
+ res.send(Buffer.from(await indexBlob.arrayBuffer()));
56247
+ return;
56248
+ }
56249
+ return next();
56250
+ });
56251
+ return true;
56252
+ }
56196
56253
  function resolveUiDistPath() {
56197
56254
  const candidates = [
56198
56255
  join41(__dirname3, "ui"),
@@ -56207,6 +56264,9 @@ function resolveUiDistPath() {
56207
56264
  return candidates[0];
56208
56265
  }
56209
56266
  function serveStatic(app) {
56267
+ if (tryServeFromEmbedded(app)) {
56268
+ return;
56269
+ }
56210
56270
  const uiDistPath = resolveUiDistPath();
56211
56271
  if (!existsSync33(uiDistPath)) {
56212
56272
  logger.warning(`UI dist not found at ${uiDistPath}. Run 'bun run ui:build' first.`);
@@ -56244,11 +56304,22 @@ function serveStatic(app) {
56244
56304
  });
56245
56305
  logger.debug(`Serving static files from ${uiDistPath}`);
56246
56306
  }
56247
- var import_express, __dirname3;
56307
+ var import_express, __dirname3, MIME_FALLBACK;
56248
56308
  var init_static_server = __esm(() => {
56249
56309
  init_logger();
56250
56310
  import_express = __toESM(require_express2(), 1);
56251
56311
  __dirname3 = dirname12(fileURLToPath2(import.meta.url));
56312
+ MIME_FALLBACK = {
56313
+ ".html": "text/html",
56314
+ ".js": "application/javascript",
56315
+ ".css": "text/css",
56316
+ ".json": "application/json",
56317
+ ".svg": "image/svg+xml",
56318
+ ".png": "image/png",
56319
+ ".ico": "image/x-icon",
56320
+ ".woff2": "font/woff2",
56321
+ ".woff": "font/woff"
56322
+ };
56252
56323
  });
56253
56324
 
56254
56325
  // node_modules/ws/lib/constants.js
@@ -88019,7 +88090,7 @@ import { join as join99 } from "node:path";
88019
88090
  init_logger();
88020
88091
  import { readFile as readFile46, readdir as readdir30, writeFile as writeFile27 } from "node:fs/promises";
88021
88092
  import { platform as platform12 } from "node:os";
88022
- import { extname as extname4, join as join98 } from "node:path";
88093
+ import { extname as extname5, join as join98 } from "node:path";
88023
88094
  var IS_WINDOWS2 = platform12() === "win32";
88024
88095
  function getOpenCodeGlobalPath() {
88025
88096
  return "$HOME/.config/opencode/";
@@ -88070,7 +88141,7 @@ function transformOpenCodeContent(content) {
88070
88141
  return { transformed, changes };
88071
88142
  }
88072
88143
  function shouldTransformFile2(filename) {
88073
- const ext2 = extname4(filename).toLowerCase();
88144
+ const ext2 = extname5(filename).toLowerCase();
88074
88145
  return TRANSFORMABLE_EXTENSIONS2.has(ext2);
88075
88146
  }
88076
88147
  async function transformPathsForGlobalOpenCode(directory, options2 = {}) {
@@ -89631,7 +89702,7 @@ async function transformFolderPaths(extractDir, folders, options2 = {}) {
89631
89702
  init_logger();
89632
89703
  import { readFile as readFile50, readdir as readdir33, writeFile as writeFile31 } from "node:fs/promises";
89633
89704
  import { platform as platform13 } from "node:os";
89634
- import { extname as extname5, join as join106 } from "node:path";
89705
+ import { extname as extname6, join as join106 } from "node:path";
89635
89706
  var IS_WINDOWS3 = platform13() === "win32";
89636
89707
  var HOME_PREFIX = IS_WINDOWS3 ? "%USERPROFILE%" : "$HOME";
89637
89708
  function getHomeDirPrefix() {
@@ -89729,7 +89800,7 @@ function transformContent(content) {
89729
89800
  return { transformed, changes };
89730
89801
  }
89731
89802
  function shouldTransformFile3(filename) {
89732
- const ext2 = extname5(filename).toLowerCase();
89803
+ const ext2 = extname6(filename).toLowerCase();
89733
89804
  const basename11 = filename.split("/").pop() || filename;
89734
89805
  return TRANSFORMABLE_EXTENSIONS3.has(ext2) || ALWAYS_TRANSFORM_FILES.has(basename11);
89735
89806
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claudekit-cli",
3
- "version": "3.35.0-dev.25",
3
+ "version": "3.35.0-dev.26",
4
4
  "description": "CLI tool for bootstrapping and updating ClaudeKit projects",
5
5
  "type": "module",
6
6
  "repository": {
@@ -25,8 +25,8 @@
25
25
  "ui:build": "cd src/ui && bun install --silent && bun run build",
26
26
  "ui:dev": "cd src/ui && bun run dev",
27
27
  "build": "bun build src/index.ts --outdir dist --target node --external @octokit/rest",
28
- "compile": "bun build src/index.ts --compile --outfile ck",
29
- "compile:binary": "bun build src/index.ts --compile --outfile bin/ck",
28
+ "compile": "bun run ui:build && bun run scripts/compile-binary.ts",
29
+ "compile:binary": "bun run ui:build && bun run scripts/compile-binary.ts --outfile bin/ck && cp bin/ck /usr/local/bin/ck && echo '✅ Installed globally: /usr/local/bin/ck'",
30
30
  "compile:binaries": "node scripts/build-all-binaries.js",
31
31
  "check-version-sync": "node scripts/check-binary-version-sync.js",
32
32
  "build:platform-binaries": "bun run scripts/build-platform-binaries.js",