@kodycodes/cli 1.26.3 → 1.27.1

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 (169) hide show
  1. package/README.md +175 -167
  2. package/dist/add-mcp-install.d.ts +1 -1
  3. package/dist/api-token.d.ts +1 -1
  4. package/dist/{auth-4FW6GCLG.js → auth-6ZE6QQXA.js} +13 -8
  5. package/dist/auth-bootstrap.d.ts +1 -1
  6. package/dist/auth.d.ts +27 -3
  7. package/dist/bin.js +18 -18
  8. package/dist/capability-proxy.d.ts +1 -1
  9. package/dist/{chunk-64XN367G.js → chunk-2EQJQJA3.js} +66 -44
  10. package/dist/chunk-2EQJQJA3.js.map +6 -0
  11. package/dist/{chunk-D55XPY3T.js → chunk-2IHISXHN.js} +58 -27
  12. package/dist/chunk-2IHISXHN.js.map +6 -0
  13. package/dist/{chunk-SMURF26I.js → chunk-2XPH7L2P.js} +1 -1
  14. package/dist/chunk-2XPH7L2P.js.map +6 -0
  15. package/dist/{chunk-RM34N3KI.js → chunk-3H72XY5R.js} +16 -6
  16. package/dist/chunk-3H72XY5R.js.map +6 -0
  17. package/dist/{chunk-G4YN6XP5.js → chunk-4GIFJVGT.js} +1 -1
  18. package/dist/chunk-4GIFJVGT.js.map +6 -0
  19. package/dist/{chunk-R4IUV5P5.js → chunk-5JIRHJQP.js} +397 -45
  20. package/dist/chunk-5JIRHJQP.js.map +6 -0
  21. package/dist/{chunk-TIL35OWA.js → chunk-5YQBD7PN.js} +238 -146
  22. package/dist/chunk-5YQBD7PN.js.map +6 -0
  23. package/dist/chunk-5ZBJAP6G.js +2005 -0
  24. package/dist/chunk-5ZBJAP6G.js.map +6 -0
  25. package/dist/{chunk-6XQP5SWX.js → chunk-6ZYUGXVW.js} +1 -1
  26. package/dist/chunk-6ZYUGXVW.js.map +6 -0
  27. package/dist/{chunk-OVGXPRSY.js → chunk-7PRJ36I5.js} +4 -1
  28. package/dist/{chunk-OVGXPRSY.js.map → chunk-7PRJ36I5.js.map} +1 -1
  29. package/dist/{chunk-IHP6PV6X.js → chunk-BTL3PJ2H.js} +1 -12
  30. package/dist/chunk-BTL3PJ2H.js.map +6 -0
  31. package/dist/{chunk-VQS5YSCI.js → chunk-CPS7HW4T.js} +8 -6
  32. package/dist/{chunk-VQS5YSCI.js.map → chunk-CPS7HW4T.js.map} +1 -1
  33. package/dist/{chunk-BISUL7CE.js → chunk-DW5UTJ6T.js} +14 -5
  34. package/dist/chunk-DW5UTJ6T.js.map +6 -0
  35. package/dist/{target-3QHY7JT4.js → chunk-EJXEVGWF.js} +8 -6
  36. package/dist/chunk-EJXEVGWF.js.map +6 -0
  37. package/dist/{chunk-SXHULGL4.js → chunk-JOMBXQOS.js} +18 -9
  38. package/dist/chunk-JOMBXQOS.js.map +6 -0
  39. package/dist/{chunk-EOCV74B2.js → chunk-OZDWOZLV.js} +41 -25
  40. package/dist/chunk-OZDWOZLV.js.map +6 -0
  41. package/dist/{chunk-75RZUXQL.js → chunk-SLNAWWQK.js} +4 -2
  42. package/dist/{chunk-75RZUXQL.js.map → chunk-SLNAWWQK.js.map} +1 -1
  43. package/dist/{chunk-XDCOWU5R.js → chunk-SPEP3DUT.js} +64 -14
  44. package/dist/chunk-SPEP3DUT.js.map +6 -0
  45. package/dist/{chunk-64IM6G4Z.js → chunk-TUUFQYWP.js} +13 -6
  46. package/dist/chunk-TUUFQYWP.js.map +6 -0
  47. package/dist/{chunk-QHBCP4OB.js → chunk-UW6AWLXX.js} +6 -7
  48. package/dist/chunk-W2SAFAT4.js +1563 -0
  49. package/dist/chunk-W2SAFAT4.js.map +6 -0
  50. package/dist/{chunk-XOPPGRUP.js → chunk-WMROAVLX.js} +14 -6
  51. package/dist/chunk-WMROAVLX.js.map +6 -0
  52. package/dist/{chunk-BPGY4IE7.js → chunk-XV6D6HSG.js} +1 -1
  53. package/dist/chunk-XV6D6HSG.js.map +6 -0
  54. package/dist/{chunk-PDWCKWQF.js → chunk-YDWTXEKQ.js} +26 -10
  55. package/dist/chunk-YDWTXEKQ.js.map +6 -0
  56. package/dist/{chunk-JWEFKKAD.js → chunk-ZILB2HWE.js} +1 -1
  57. package/dist/chunk-ZILB2HWE.js.map +6 -0
  58. package/dist/cli.js +19 -19
  59. package/dist/defaults.d.ts +1 -1
  60. package/dist/detect-running-hosts.d.ts +1 -1
  61. package/dist/dev/dev-assets.d.ts +1 -1
  62. package/dist/dev/dev-registry.d.ts +1 -1
  63. package/dist/dev/error-page.d.ts +1 -1
  64. package/dist/dev/live-reload.d.ts +2 -2
  65. package/dist/{dev-command-3LX234N6.js → dev-command-TZ2EB4J3.js} +236 -111
  66. package/dist/dev-command-TZ2EB4J3.js.map +6 -0
  67. package/dist/dev-command.d.ts +1 -1
  68. package/dist/discover-login-identity.d.ts +6 -7
  69. package/dist/discover-org.d.ts +2 -3
  70. package/dist/generated/openapi-routes.d.ts +6 -0
  71. package/dist/{git-credential-FUE3JE3T.js → git-credential-INB2UV4C.js} +32 -25
  72. package/dist/git-credential-INB2UV4C.js.map +6 -0
  73. package/dist/{install-ZML2TCDG.js → install-ONEJRYZ3.js} +147 -113
  74. package/dist/install-ONEJRYZ3.js.map +6 -0
  75. package/dist/install.d.ts +1 -1
  76. package/dist/{local-execute-SZV6XN4T.js → local-execute-YCXHVAVM.js} +81 -54
  77. package/dist/local-execute-YCXHVAVM.js.map +6 -0
  78. package/dist/local-execute-auth.d.ts +2 -2
  79. package/dist/local-execute.d.ts +1 -1
  80. package/dist/local-gateway-fetch-forward.d.ts +2 -2
  81. package/dist/local-package-run-WZVZAHK3.js +23 -0
  82. package/dist/local-package-run.d.ts +2 -2
  83. package/dist/mock/ensure-msw.d.ts +9 -1
  84. package/dist/mock/load-package-mocks.d.ts +1 -2
  85. package/dist/mock/mock-fetch-gateway.d.ts +4 -5
  86. package/dist/mock/mock-supported.d.ts +1 -1
  87. package/dist/{mock-dep-resolve-TVABDNR7.js → mock-dep-resolve-B5ZH4U3H.js} +14 -6
  88. package/dist/mock-dep-resolve-B5ZH4U3H.js.map +6 -0
  89. package/dist/{mock-fetch-gateway-B5TFGGQS.js → mock-fetch-gateway-FWVNTLP2.js} +7 -6
  90. package/dist/{mock-local-deps-5SZT3PWT.js → mock-local-deps-2VVNJLFF.js} +20 -17
  91. package/dist/mock-local-deps-2VVNJLFF.js.map +6 -0
  92. package/dist/mock-local-deps.d.ts +1 -1
  93. package/dist/{mock-server-SV2IKC4I.js → mock-server-6BWDQQBE.js} +8 -7
  94. package/dist/oauth-browser.d.ts +42 -0
  95. package/dist/oauth-provider.d.ts +14 -19
  96. package/dist/{open-api-client-DVVMLY7P.js → open-api-client-SR4B7265.js} +11 -10
  97. package/dist/open-api-client.d.ts +2 -1
  98. package/dist/{org-X7B5BI4R.js → org-535LB4PD.js} +8 -6
  99. package/dist/org-535LB4PD.js.map +6 -0
  100. package/dist/org-resolve.d.ts +2 -0
  101. package/dist/package-app-dev.d.ts +2 -2
  102. package/dist/{package-manifest-QH2RU64C.js → package-manifest-DFF6XCPV.js} +5 -4
  103. package/dist/{remote-execute-QMQDVHOY.js → remote-execute-JN6DRFEU.js} +49 -30
  104. package/dist/remote-execute-JN6DRFEU.js.map +6 -0
  105. package/dist/remote-execute.d.ts +3 -3
  106. package/dist/{setup-git-5KCUBYPB.js → setup-git-MHK563LB.js} +11 -12
  107. package/dist/setup-git.d.ts +1 -1
  108. package/dist/{skill-ENPATRIW.js → skill-D74XVI6T.js} +26 -8
  109. package/dist/skill-D74XVI6T.js.map +6 -0
  110. package/dist/{store-WTMRH527.js → store-27J4CQZ2.js} +4 -4
  111. package/dist/{structured-error-C65GQ53Z.js → structured-error-5MLWXYR3.js} +4 -3
  112. package/dist/structured-error.d.ts +1 -1
  113. package/dist/target-33ATHDUF.js +17 -0
  114. package/package.json +6 -5
  115. package/skills/kody/SKILL.md +53 -50
  116. package/dist/chunk-4D6ORNXY.js +0 -24404
  117. package/dist/chunk-4D6ORNXY.js.map +0 -6
  118. package/dist/chunk-64IM6G4Z.js.map +0 -6
  119. package/dist/chunk-64XN367G.js.map +0 -6
  120. package/dist/chunk-6XQP5SWX.js.map +0 -6
  121. package/dist/chunk-BISUL7CE.js.map +0 -6
  122. package/dist/chunk-BPGY4IE7.js.map +0 -6
  123. package/dist/chunk-D55XPY3T.js.map +0 -6
  124. package/dist/chunk-EOCV74B2.js.map +0 -6
  125. package/dist/chunk-FBVNFWR6.js +0 -437
  126. package/dist/chunk-FBVNFWR6.js.map +0 -6
  127. package/dist/chunk-G4YN6XP5.js.map +0 -6
  128. package/dist/chunk-G6LJWROP.js +0 -18
  129. package/dist/chunk-G6LJWROP.js.map +0 -6
  130. package/dist/chunk-IHP6PV6X.js.map +0 -6
  131. package/dist/chunk-JWEFKKAD.js.map +0 -6
  132. package/dist/chunk-LWNB26KO.js +0 -147
  133. package/dist/chunk-LWNB26KO.js.map +0 -6
  134. package/dist/chunk-PDWCKWQF.js.map +0 -6
  135. package/dist/chunk-R4IUV5P5.js.map +0 -6
  136. package/dist/chunk-RM34N3KI.js.map +0 -6
  137. package/dist/chunk-RTWUNV76.js +0 -309
  138. package/dist/chunk-RTWUNV76.js.map +0 -6
  139. package/dist/chunk-SMURF26I.js.map +0 -6
  140. package/dist/chunk-SXHULGL4.js.map +0 -6
  141. package/dist/chunk-TIL35OWA.js.map +0 -6
  142. package/dist/chunk-XDCOWU5R.js.map +0 -6
  143. package/dist/chunk-XOPPGRUP.js.map +0 -6
  144. package/dist/dev-command-3LX234N6.js.map +0 -6
  145. package/dist/git-credential-FUE3JE3T.js.map +0 -6
  146. package/dist/install-ZML2TCDG.js.map +0 -6
  147. package/dist/local-execute-SZV6XN4T.js.map +0 -6
  148. package/dist/local-package-run-2TMCAZZ2.js +0 -23
  149. package/dist/mcp-G2AWTIXR.js +0 -21
  150. package/dist/mcp.d.ts +0 -34
  151. package/dist/mock-dep-resolve-TVABDNR7.js.map +0 -6
  152. package/dist/mock-local-deps-5SZT3PWT.js.map +0 -6
  153. package/dist/org-X7B5BI4R.js.map +0 -6
  154. package/dist/remote-execute-QMQDVHOY.js.map +0 -6
  155. package/dist/skill-ENPATRIW.js.map +0 -6
  156. package/dist/target-3QHY7JT4.js.map +0 -6
  157. package/dist/webapi-NTVP4BO3.js +0 -2482
  158. package/dist/webapi-NTVP4BO3.js.map +0 -6
  159. /package/dist/{auth-4FW6GCLG.js.map → auth-6ZE6QQXA.js.map} +0 -0
  160. /package/dist/{chunk-QHBCP4OB.js.map → chunk-UW6AWLXX.js.map} +0 -0
  161. /package/dist/{local-package-run-2TMCAZZ2.js.map → local-package-run-WZVZAHK3.js.map} +0 -0
  162. /package/dist/{mcp-G2AWTIXR.js.map → mock-fetch-gateway-FWVNTLP2.js.map} +0 -0
  163. /package/dist/{mock-fetch-gateway-B5TFGGQS.js.map → mock-server-6BWDQQBE.js.map} +0 -0
  164. /package/dist/{mock-server-SV2IKC4I.js.map → open-api-client-SR4B7265.js.map} +0 -0
  165. /package/dist/{open-api-client-DVVMLY7P.js.map → package-manifest-DFF6XCPV.js.map} +0 -0
  166. /package/dist/{package-manifest-QH2RU64C.js.map → setup-git-MHK563LB.js.map} +0 -0
  167. /package/dist/{setup-git-5KCUBYPB.js.map → store-27J4CQZ2.js.map} +0 -0
  168. /package/dist/{store-WTMRH527.js.map → structured-error-5MLWXYR3.js.map} +0 -0
  169. /package/dist/{structured-error-C65GQ53Z.js.map → target-33ATHDUF.js.map} +0 -0
@@ -1,4 +1,12 @@
1
1
  import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
2
+ import {
3
+ ensureMockTarget
4
+ } from "./chunk-SPEP3DUT.js";
5
+ import {
6
+ loadPackageManifest,
7
+ resolveExportModulePath,
8
+ resolvePackagePath
9
+ } from "./chunk-TUUFQYWP.js";
2
10
  import {
3
11
  appLogMarker,
4
12
  buildLocalPackageContext,
@@ -7,12 +15,17 @@ import {
7
15
  devErrorHeader,
8
16
  devRequestIdHeader,
9
17
  runLocalPackageModule
10
- } from "./chunk-64XN367G.js";
18
+ } from "./chunk-2EQJQJA3.js";
11
19
  import {
12
20
  forwardLocalGatewayFetchStream,
13
21
  installMockFetchShimModules,
14
22
  startLocalRuntimeBridge
15
- } from "./chunk-SXHULGL4.js";
23
+ } from "./chunk-JOMBXQOS.js";
24
+ import {
25
+ packageMocksRelativePath,
26
+ resolveMockFetchGateway,
27
+ tryHandleMockGatewayFetchCall
28
+ } from "./chunk-WMROAVLX.js";
16
29
  import {
17
30
  BundleError,
18
31
  bundleLocalUserModule,
@@ -29,45 +42,31 @@ import {
29
42
  runSecretEnvVar,
30
43
  runSecretHeader,
31
44
  writePackageModuleFiles
32
- } from "./chunk-D55XPY3T.js";
33
- import {
34
- ensureMockTarget
35
- } from "./chunk-XDCOWU5R.js";
36
- import {
37
- packageMocksRelativePath,
38
- resolveMockFetchGateway,
39
- tryHandleMockGatewayFetchCall
40
- } from "./chunk-XOPPGRUP.js";
41
- import {
42
- loadPackageManifest,
43
- resolveExportModulePath,
44
- resolvePackagePath
45
- } from "./chunk-64IM6G4Z.js";
45
+ } from "./chunk-2IHISXHN.js";
46
46
  import {
47
47
  StructuredCliError
48
- } from "./chunk-BPGY4IE7.js";
48
+ } from "./chunk-XV6D6HSG.js";
49
+ import {
50
+ redact
51
+ } from "./chunk-CASGRYOF.js";
49
52
  import {
50
53
  formatToolResult
51
54
  } from "./chunk-46IJPEID.js";
52
- import {
53
- assertTokenSafeApiUrl,
54
- callCapabilityProxy
55
- } from "./chunk-R4IUV5P5.js";
56
55
  import {
57
56
  ensureWorkerdBinary,
58
57
  userCacheDir
59
- } from "./chunk-BISUL7CE.js";
60
- import "./chunk-G4YN6XP5.js";
58
+ } from "./chunk-DW5UTJ6T.js";
61
59
  import {
62
- redact
63
- } from "./chunk-CASGRYOF.js";
64
- import "./chunk-G6LJWROP.js";
65
- import "./chunk-RTWUNV76.js";
66
- import "./chunk-RM34N3KI.js";
60
+ assertTokenSafeApiUrl,
61
+ callCapabilityProxy
62
+ } from "./chunk-5JIRHJQP.js";
63
+ import "./chunk-4GIFJVGT.js";
64
+ import "./chunk-EJXEVGWF.js";
65
+ import "./chunk-3H72XY5R.js";
67
66
  import {
68
67
  apiTokenEnvVar
69
- } from "./chunk-IHP6PV6X.js";
70
- import "./chunk-QHBCP4OB.js";
68
+ } from "./chunk-BTL3PJ2H.js";
69
+ import "./chunk-UW6AWLXX.js";
71
70
 
72
71
  // src/dev-command.ts
73
72
  import { access, mkdir as mkdir3, readFile as readFile4, rm as rm4, writeFile as writeFile4 } from "node:fs/promises";
@@ -205,7 +204,10 @@ function readBundle(result, workingDir, entryPath) {
205
204
  const js = outputs.find((file) => file.path.endsWith(".js"));
206
205
  const map = outputs.find((file) => file.path.endsWith(".js.map"));
207
206
  if (!js) {
208
- throw new BundleError(`Could not bundle ${entryPath}: esbuild produced no output.`, []);
207
+ throw new BundleError(
208
+ `Could not bundle ${entryPath}: esbuild produced no output.`,
209
+ []
210
+ );
209
211
  }
210
212
  return {
211
213
  code: js.text.replace(/\n\/\/# sourceMappingURL=\S+\s*$/, "\n"),
@@ -302,11 +304,16 @@ async function serveDevAsset(input) {
302
304
  return;
303
305
  }
304
306
  if (input.relativePath === devVersionAssetName) {
305
- send(req, res, "application/json; charset=utf-8", JSON.stringify({
306
- clientModuleUrl: input.clientModuleUrl,
307
- assetBasePath: `${input.appBasePath}/_assets`,
308
- publishedCommit: null
309
- }));
307
+ send(
308
+ req,
309
+ res,
310
+ "application/json; charset=utf-8",
311
+ JSON.stringify({
312
+ clientModuleUrl: input.clientModuleUrl,
313
+ assetBasePath: `${input.appBasePath}/_assets`,
314
+ publishedCommit: null
315
+ })
316
+ );
310
317
  return;
311
318
  }
312
319
  if (input.client && input.relativePath === input.client.name) {
@@ -324,7 +331,13 @@ async function serveDevAsset(input) {
324
331
  return;
325
332
  }
326
333
  const contentType = inferDevAssetContentType(file);
327
- send(req, res, contentType, body, contentType.startsWith("text/javascript") ? { "service-worker-allowed": `${input.appBasePath}/` } : {});
334
+ send(
335
+ req,
336
+ res,
337
+ contentType,
338
+ body,
339
+ contentType.startsWith("text/javascript") ? { "service-worker-allowed": `${input.appBasePath}/` } : {}
340
+ );
328
341
  }
329
342
  async function readAssetFile(file) {
330
343
  try {
@@ -388,7 +401,13 @@ function inferDevAssetContentType(path) {
388
401
  }
389
402
 
390
403
  // src/dev/dev-events.ts
391
- var logLevels = /* @__PURE__ */ new Set(["log", "info", "warn", "error", "debug"]);
404
+ var logLevels = /* @__PURE__ */ new Set([
405
+ "log",
406
+ "info",
407
+ "warn",
408
+ "error",
409
+ "debug"
410
+ ]);
392
411
  function parseWorkerdStdoutLine(line) {
393
412
  if (line.startsWith(appLogMarker)) {
394
413
  try {
@@ -404,7 +423,13 @@ function parseWorkerdStdoutLine(line) {
404
423
  } catch {
405
424
  }
406
425
  }
407
- return { type: "log", source: "app", level: "log", message: line, request: null };
426
+ return {
427
+ type: "log",
428
+ source: "app",
429
+ level: "log",
430
+ message: line,
431
+ request: null
432
+ };
408
433
  }
409
434
  function readRequestTag(value) {
410
435
  if (!value || typeof value !== "object") return null;
@@ -417,7 +442,9 @@ function readRequestTag(value) {
417
442
  };
418
443
  }
419
444
  function runtimeErrorFix(message) {
420
- const dynamicRequire = /Dynamic require of "([^"]+)" is not supported/.exec(message);
445
+ const dynamicRequire = /Dynamic require of "([^"]+)" is not supported/.exec(
446
+ message
447
+ );
421
448
  if (dynamicRequire) {
422
449
  return `A CommonJS dependency calls require("${dynamicRequire[1]}"), which an ESM Worker cannot run (hosted apps fail the same way). It likely resolved to its Node build: import the package\u2019s Workers/edge entry (an exports subpath or condition like \`edge\`, \`worker\`, or \`workerd\`) or an ESM build instead.`;
423
450
  }
@@ -568,10 +595,14 @@ async function startProcessReaper(input) {
568
595
  );
569
596
  let reaper;
570
597
  try {
571
- reaper = spawn("/bin/sh", ["-c", reaperScript, "kody-dev-reaper", input.workDir], {
572
- stdio: ["pipe", "ignore", "ignore"],
573
- detached: true
574
- });
598
+ reaper = spawn(
599
+ "/bin/sh",
600
+ ["-c", reaperScript, "kody-dev-reaper", input.workDir],
601
+ {
602
+ stdio: ["pipe", "ignore", "ignore"],
603
+ detached: true
604
+ }
605
+ );
575
606
  reaper.on("error", () => {
576
607
  reaper = void 0;
577
608
  });
@@ -606,7 +637,9 @@ async function sweepStaleDevDirs(input = {}) {
606
637
  const killed = [];
607
638
  let entries;
608
639
  try {
609
- entries = (await readdir(tmp)).filter((name) => name.startsWith(devWorkDirPrefix));
640
+ entries = (await readdir(tmp)).filter(
641
+ (name) => name.startsWith(devWorkDirPrefix)
642
+ );
610
643
  } catch {
611
644
  return { removed, killed };
612
645
  }
@@ -653,7 +686,9 @@ function isOrphaned(item, byPid, isAlive) {
653
686
  }
654
687
  async function readOwnerPid(dir) {
655
688
  try {
656
- const parsed = JSON.parse(await readFile2(join3(dir, ownerFileName), "utf8"));
689
+ const parsed = JSON.parse(
690
+ await readFile2(join3(dir, ownerFileName), "utf8")
691
+ );
657
692
  return typeof parsed.pid === "number" ? parsed.pid : null;
658
693
  } catch {
659
694
  return null;
@@ -709,7 +744,8 @@ async function findRunningDevServer(input) {
709
744
  );
710
745
  if (!response.ok) return null;
711
746
  const status = await response.json();
712
- if (status.package?.root !== input.root || status.target !== input.target) return null;
747
+ if (status.package?.root !== input.root || status.target !== input.target)
748
+ return null;
713
749
  return { registration, status };
714
750
  } catch {
715
751
  return null;
@@ -717,7 +753,9 @@ async function findRunningDevServer(input) {
717
753
  }
718
754
  async function readRegistration(path) {
719
755
  try {
720
- const parsed = JSON.parse(await readFile3(path, "utf8"));
756
+ const parsed = JSON.parse(
757
+ await readFile3(path, "utf8")
758
+ );
721
759
  if (typeof parsed.pid !== "number" || typeof parsed.origin !== "string" || typeof parsed.root !== "string" || parsed.target !== "mock" && parsed.target !== "prod") {
722
760
  return null;
723
761
  }
@@ -2478,7 +2516,10 @@ function createDevWatcher(input) {
2478
2516
  polling = false;
2479
2517
  }
2480
2518
  };
2481
- const timer = setInterval(() => void poll(), input.pollIntervalMs ?? defaultPollIntervalMs);
2519
+ const timer = setInterval(
2520
+ () => void poll(),
2521
+ input.pollIntervalMs ?? defaultPollIntervalMs
2522
+ );
2482
2523
  timer.unref();
2483
2524
  return {
2484
2525
  ready,
@@ -2540,7 +2581,9 @@ function shouldIgnoreWatchPath(relativePath, ignorePrefixes = []) {
2540
2581
  if (!relativePath || relativePath === ".") return false;
2541
2582
  if (relativePath.startsWith("..")) return true;
2542
2583
  const segments = relativePath.split(sep2);
2543
- if (segments.some((segment) => segment === "node_modules" || segment.startsWith("."))) {
2584
+ if (segments.some(
2585
+ (segment) => segment === "node_modules" || segment.startsWith(".")
2586
+ )) {
2544
2587
  return true;
2545
2588
  }
2546
2589
  if (relativePath.endsWith(".map")) return true;
@@ -2564,15 +2607,23 @@ function sendDevError(req, res, status, view, options = {}) {
2564
2607
  "x-kody-dev-error": view.kind
2565
2608
  };
2566
2609
  if (wantsHtml(req)) {
2567
- res.writeHead(status, { ...headers, "content-type": "text/html; charset=utf-8" });
2610
+ res.writeHead(status, {
2611
+ ...headers,
2612
+ "content-type": "text/html; charset=utf-8"
2613
+ });
2568
2614
  res.end(renderDevErrorPage(view) + (options.htmlTail ?? ""));
2569
2615
  return;
2570
2616
  }
2571
- res.writeHead(status, { ...headers, "content-type": "text/plain; charset=utf-8" });
2572
- res.end(`kody dev ${view.kind} error${view.request ? ` (${view.request})` : ""}
2617
+ res.writeHead(status, {
2618
+ ...headers,
2619
+ "content-type": "text/plain; charset=utf-8"
2620
+ });
2621
+ res.end(
2622
+ `kody dev ${view.kind} error${view.request ? ` (${view.request})` : ""}
2573
2623
 
2574
2624
  ${view.detail}
2575
- `);
2625
+ `
2626
+ );
2576
2627
  }
2577
2628
  function renderDevErrorPage(view) {
2578
2629
  const label = view.kind === "build" ? "Build error" : "Runtime error";
@@ -2661,7 +2712,8 @@ function injectLiveReloadScript(html) {
2661
2712
  function shouldInjectLiveReload(input) {
2662
2713
  if (input.method === "HEAD") return false;
2663
2714
  if (!/\btext\/html\b/i.test(input.accept ?? "")) return false;
2664
- if (input.status === 204 || input.status === 304 || input.status < 200) return false;
2715
+ if (input.status === 204 || input.status === 304 || input.status < 200)
2716
+ return false;
2665
2717
  const contentType = String(input.headers["content-type"] ?? "");
2666
2718
  if (!/^\s*text\/html\b/i.test(contentType)) return false;
2667
2719
  const encoding = String(input.headers["content-encoding"] ?? "identity").trim().toLowerCase();
@@ -2791,21 +2843,20 @@ async function runPrebuild(input) {
2791
2843
  else input.signal.addEventListener("abort", killChild, { once: true });
2792
2844
  }
2793
2845
  try {
2794
- const result = await new Promise(
2795
- (resolve8, reject) => {
2796
- child.once("error", reject);
2797
- child.once("close", (code, signal) => resolve8({ code, signal }));
2798
- }
2799
- );
2846
+ const result = await new Promise((resolve8, reject) => {
2847
+ child.once("error", reject);
2848
+ child.once("close", (code, signal) => resolve8({ code, signal }));
2849
+ });
2800
2850
  if (input.signal?.aborted) {
2801
2851
  throw new PrebuildError("kody.dev.prebuild aborted");
2802
2852
  }
2803
2853
  if (result.code === 0) return;
2804
2854
  const how = result.signal ? `signal ${result.signal}` : `exit ${result.code}`;
2805
2855
  throw new PrebuildError(
2806
- [`kody.dev.prebuild failed (${how}): ${input.command}`, ...tail.map((line) => ` ${line}`)].join(
2807
- "\n"
2808
- )
2856
+ [
2857
+ `kody.dev.prebuild failed (${how}): ${input.command}`,
2858
+ ...tail.map((line) => ` ${line}`)
2859
+ ].join("\n")
2809
2860
  );
2810
2861
  } finally {
2811
2862
  input.signal?.removeEventListener("abort", killChild);
@@ -2829,7 +2880,7 @@ function forEachLine(stream, onLine) {
2829
2880
  });
2830
2881
  }
2831
2882
 
2832
- // node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
2883
+ // ../../node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
2833
2884
  var comma = ",".charCodeAt(0);
2834
2885
  var semicolon = ";".charCodeAt(0);
2835
2886
  var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
@@ -2840,7 +2891,7 @@ for (let i = 0; i < chars.length; i++) {
2840
2891
  intToChar[i] = c;
2841
2892
  charToInt[c] = i;
2842
2893
  }
2843
- function decodeInteger(reader) {
2894
+ function decodeInteger(reader, relative5) {
2844
2895
  let value = 0;
2845
2896
  let shift = 0;
2846
2897
  let integer = 0;
@@ -2850,10 +2901,12 @@ function decodeInteger(reader) {
2850
2901
  value |= (integer & 31) << shift;
2851
2902
  shift += 5;
2852
2903
  } while (integer & 32);
2853
- return value;
2854
- }
2855
- function decodeSign(num) {
2856
- return num & 1 ? -2147483648 | -(num >>> 1) : num >>> 1;
2904
+ const shouldNegate = value & 1;
2905
+ value >>>= 1;
2906
+ if (shouldNegate) {
2907
+ value = -2147483648 | -value;
2908
+ }
2909
+ return relative5 + value;
2857
2910
  }
2858
2911
  function hasMoreVlq(reader, max) {
2859
2912
  if (reader.pos >= max) return false;
@@ -2894,15 +2947,15 @@ function decode(mappings) {
2894
2947
  genColumn = 0;
2895
2948
  while (reader.pos < semi) {
2896
2949
  let seg;
2897
- genColumn += decodeSign(decodeInteger(reader));
2950
+ genColumn = decodeInteger(reader, genColumn);
2898
2951
  if (genColumn < lastCol) sorted = false;
2899
2952
  lastCol = genColumn;
2900
2953
  if (hasMoreVlq(reader, semi)) {
2901
- sourcesIndex += decodeSign(decodeInteger(reader));
2902
- sourceLine += decodeSign(decodeInteger(reader));
2903
- sourceColumn += decodeSign(decodeInteger(reader));
2954
+ sourcesIndex = decodeInteger(reader, sourcesIndex);
2955
+ sourceLine = decodeInteger(reader, sourceLine);
2956
+ sourceColumn = decodeInteger(reader, sourceColumn);
2904
2957
  if (hasMoreVlq(reader, semi)) {
2905
- namesIndex += decodeSign(decodeInteger(reader));
2958
+ namesIndex = decodeInteger(reader, namesIndex);
2906
2959
  seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex];
2907
2960
  } else {
2908
2961
  seg = [genColumn, sourcesIndex, sourceLine, sourceColumn];
@@ -2926,7 +2979,7 @@ function sortComparator(a, b) {
2926
2979
  return a[0] - b[0];
2927
2980
  }
2928
2981
 
2929
- // node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs
2982
+ // ../../node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs
2930
2983
  var schemeRegex = /^[\w+.-]+:\/\//;
2931
2984
  var urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/;
2932
2985
  var fileRegex = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;
@@ -3337,11 +3390,15 @@ import { spawn as spawn3 } from "node:child_process";
3337
3390
  import { createInterface } from "node:readline";
3338
3391
  var workerdStartTimeoutMs = 3e4;
3339
3392
  async function startWorkerd(input) {
3340
- const child = spawn3(input.workerdPath, ["serve", input.configPath, "--control-fd=3"], {
3341
- cwd: input.cwd,
3342
- env: input.env,
3343
- stdio: ["ignore", "pipe", "pipe", "pipe"]
3344
- });
3393
+ const child = spawn3(
3394
+ input.workerdPath,
3395
+ ["serve", input.configPath, "--control-fd=3"],
3396
+ {
3397
+ cwd: input.cwd,
3398
+ env: input.env,
3399
+ stdio: ["ignore", "pipe", "pipe", "pipe"]
3400
+ }
3401
+ );
3345
3402
  if (child.pid !== void 0) input.onSpawn?.(child.pid);
3346
3403
  let startupStderr = "";
3347
3404
  let listening = false;
@@ -3352,7 +3409,10 @@ async function startWorkerd(input) {
3352
3409
  input.onStderrLine(line);
3353
3410
  });
3354
3411
  const exited = new Promise((resolve8) => {
3355
- child.once("exit", (code, signal) => resolve8(`workerd exit ${signal ?? code}`));
3412
+ child.once(
3413
+ "exit",
3414
+ (code, signal) => resolve8(`workerd exit ${signal ?? code}`)
3415
+ );
3356
3416
  child.once("error", (error) => resolve8(`workerd error: ${error.message}`));
3357
3417
  });
3358
3418
  const port = await waitForListen(child, exited, () => {
@@ -3368,7 +3428,10 @@ ${trimmed}` : "";
3368
3428
  kill: async () => {
3369
3429
  if (child.exitCode !== null || child.signalCode !== null) return;
3370
3430
  child.kill("SIGKILL");
3371
- await Promise.race([exited, new Promise((resolve8) => setTimeout(resolve8, 1e3))]);
3431
+ await Promise.race([
3432
+ exited,
3433
+ new Promise((resolve8) => setTimeout(resolve8, 1e3))
3434
+ ]);
3372
3435
  }
3373
3436
  };
3374
3437
  }
@@ -3394,7 +3457,9 @@ function waitForListen(child, exited, stderr) {
3394
3457
  settle(() => {
3395
3458
  child.kill("SIGKILL");
3396
3459
  reject(
3397
- new Error(`workerd did not start within ${workerdStartTimeoutMs / 1e3}s.${stderr()}`)
3460
+ new Error(
3461
+ `workerd did not start within ${workerdStartTimeoutMs / 1e3}s.${stderr()}`
3462
+ )
3398
3463
  );
3399
3464
  });
3400
3465
  }, workerdStartTimeoutMs);
@@ -3408,7 +3473,9 @@ function waitForListen(child, exited, stderr) {
3408
3473
  }
3409
3474
  });
3410
3475
  void exited.then((detail) => {
3411
- settle(() => reject(new Error(`workerd failed to start (${detail})${stderr()}`)));
3476
+ settle(
3477
+ () => reject(new Error(`workerd failed to start (${detail})${stderr()}`))
3478
+ );
3412
3479
  });
3413
3480
  });
3414
3481
  }
@@ -3592,7 +3659,10 @@ async function startPackageAppDev(options) {
3592
3659
  let prebuildSettledAt = 0;
3593
3660
  let ignoreWatcherUntil = 0;
3594
3661
  let prebuildAbort;
3595
- const workerdEnv = { ...process.env, [runSecretEnvVar]: runSecret };
3662
+ const workerdEnv = {
3663
+ ...process.env,
3664
+ [runSecretEnvVar]: runSecret
3665
+ };
3596
3666
  delete workerdEnv[apiTokenEnvVar];
3597
3667
  function requestBuild(paths) {
3598
3668
  if (closed) return Promise.resolve();
@@ -3615,8 +3685,13 @@ async function startPackageAppDev(options) {
3615
3685
  }
3616
3686
  async function buildOnce(files) {
3617
3687
  const started2 = performance.now();
3618
- emit({ type: "rebuild_start", files: files.map((file) => relative4(root, file) || file) });
3619
- const assetsChanged = assetsDir !== null && files.some((file) => file === assetsDir || file.startsWith(`${assetsDir}${sep3}`));
3688
+ emit({
3689
+ type: "rebuild_start",
3690
+ files: files.map((file) => relative4(root, file) || file)
3691
+ });
3692
+ const assetsChanged = assetsDir !== null && files.some(
3693
+ (file) => file === assetsDir || file.startsWith(`${assetsDir}${sep3}`)
3694
+ );
3620
3695
  try {
3621
3696
  if (prebuild) {
3622
3697
  await runPrebuildStep(prebuild);
@@ -3626,7 +3701,11 @@ async function startPackageAppDev(options) {
3626
3701
  clientBundler ? clientBundler.build() : Promise.resolve(null)
3627
3702
  ]);
3628
3703
  const midBuildEdits = await watcher?.track(
3629
- [...bundle.inputs, ...client2?.inputs ?? [], options.manifest.packageJsonPath],
3704
+ [
3705
+ ...bundle.inputs,
3706
+ ...client2?.inputs ?? [],
3707
+ options.manifest.packageJsonPath
3708
+ ],
3630
3709
  { ignoreChanges: files }
3631
3710
  ) ?? [];
3632
3711
  if (midBuildEdits.length > 0) {
@@ -3642,7 +3721,10 @@ async function startPackageAppDev(options) {
3642
3721
  restarted: false
3643
3722
  });
3644
3723
  if (assetsChanged || prebuild) {
3645
- liveReloadHub.broadcast({ event: "reload", data: { buildId: active.id } });
3724
+ liveReloadHub.broadcast({
3725
+ event: "reload",
3726
+ data: { buildId: active.id }
3727
+ });
3646
3728
  }
3647
3729
  return;
3648
3730
  }
@@ -3657,8 +3739,16 @@ async function startPackageAppDev(options) {
3657
3739
  if (previous) retireGeneration(previous);
3658
3740
  lastRuntimeError = null;
3659
3741
  lastRebuild = { ms: elapsed(started2), at: (/* @__PURE__ */ new Date()).toISOString() };
3660
- emit({ type: "rebuild_ok", ms: lastRebuild.ms, buildId: generation.id, restarted: true });
3661
- liveReloadHub.broadcast({ event: "reload", data: { buildId: generation.id } });
3742
+ emit({
3743
+ type: "rebuild_ok",
3744
+ ms: lastRebuild.ms,
3745
+ buildId: generation.id,
3746
+ restarted: true
3747
+ });
3748
+ liveReloadHub.broadcast({
3749
+ event: "reload",
3750
+ data: { buildId: generation.id }
3751
+ });
3662
3752
  } catch (error) {
3663
3753
  buildFailure = toBuildFailure(error);
3664
3754
  buildFailureAt = (/* @__PURE__ */ new Date()).toISOString();
@@ -3672,7 +3762,10 @@ async function startPackageAppDev(options) {
3672
3762
  col: first?.col ?? null,
3673
3763
  diagnostics: buildFailure.diagnostics
3674
3764
  });
3675
- liveReloadHub.broadcast({ event: "build_error", data: buildErrorView(buildFailure) });
3765
+ liveReloadHub.broadcast({
3766
+ event: "build_error",
3767
+ data: buildErrorView(buildFailure)
3768
+ });
3676
3769
  }
3677
3770
  }
3678
3771
  let clearWatcherPending = null;
@@ -3813,7 +3906,9 @@ async function startPackageAppDev(options) {
3813
3906
  await Promise.race([
3814
3907
  pending.catch(() => {
3815
3908
  }),
3816
- new Promise((resolve8) => setTimeout(resolve8, rebuildGateMs).unref())
3909
+ new Promise(
3910
+ (resolve8) => setTimeout(resolve8, rebuildGateMs).unref()
3911
+ )
3817
3912
  ]);
3818
3913
  }
3819
3914
  function status() {
@@ -3845,7 +3940,10 @@ async function startPackageAppDev(options) {
3845
3940
  };
3846
3941
  }
3847
3942
  function handleDevRoute(req, res) {
3848
- const pathname = stripMount(new URL(req.url ?? "/", hostedUrl).pathname, appBasePath);
3943
+ const pathname = stripMount(
3944
+ new URL(req.url ?? "/", hostedUrl).pathname,
3945
+ appBasePath
3946
+ );
3849
3947
  if (pathname === devStatusPath) {
3850
3948
  res.writeHead(200, {
3851
3949
  "content-type": "application/json; charset=utf-8",
@@ -3899,7 +3997,9 @@ async function startPackageAppDev(options) {
3899
3997
  const generation = active;
3900
3998
  if (!generation) {
3901
3999
  res.writeHead(503, { "content-type": "text/plain; charset=utf-8" });
3902
- res.end(closed ? "kody dev is shutting down.\n" : "kody dev is still starting.\n");
4000
+ res.end(
4001
+ closed ? "kody dev is shutting down.\n" : "kody dev is still starting.\n"
4002
+ );
3903
4003
  return;
3904
4004
  }
3905
4005
  generation.inflight += 1;
@@ -4098,7 +4198,9 @@ fix: ${fix}` : mapped,
4098
4198
  });
4099
4199
  await bundler.dispose();
4100
4200
  await clientBundler?.dispose();
4101
- await Promise.all([...generations].map((generation) => stopGeneration(generation)));
4201
+ await Promise.all(
4202
+ [...generations].map((generation) => stopGeneration(generation))
4203
+ );
4102
4204
  reaper.close();
4103
4205
  await bridge.close();
4104
4206
  liveReloadHub.close();
@@ -4121,7 +4223,8 @@ fix: ${fix}` : mapped,
4121
4223
  await close();
4122
4224
  throw new Error(message);
4123
4225
  }
4124
- if (active) options.onStatus?.(`App ready at ${hostedUrl}${appBasePath || "/"}`);
4226
+ if (active)
4227
+ options.onStatus?.(`App ready at ${hostedUrl}${appBasePath || "/"}`);
4125
4228
  const fetchPath = async (path, init2 = {}) => {
4126
4229
  const url = new URL(joinUrlPath(appBasePath, path), hostedUrl);
4127
4230
  const response = await fetch(url, {
@@ -4284,7 +4387,10 @@ async function resolveDevAuth(input) {
4284
4387
  async function runDevServe(input) {
4285
4388
  const manifest = await loadPackageManifest(input.cwd);
4286
4389
  if (input.port === void 0) {
4287
- const running = await findRunningDevServer({ root: manifest.root, target: input.target });
4390
+ const running = await findRunningDevServer({
4391
+ root: manifest.root,
4392
+ target: input.target
4393
+ });
4288
4394
  if (running) {
4289
4395
  const { registration } = running;
4290
4396
  throw new StructuredCliError({
@@ -4337,7 +4443,11 @@ async function runDevServe(input) {
4337
4443
  });
4338
4444
  } catch (error) {
4339
4445
  if (registered) {
4340
- await removeDevRegistration(manifest.root, process.pid, input.target).catch(() => {
4446
+ await removeDevRegistration(
4447
+ manifest.root,
4448
+ process.pid,
4449
+ input.target
4450
+ ).catch(() => {
4341
4451
  });
4342
4452
  }
4343
4453
  await input.auth.closeMock?.();
@@ -4345,9 +4455,12 @@ async function runDevServe(input) {
4345
4455
  }
4346
4456
  const shutdown = async () => {
4347
4457
  await server.close();
4348
- await removeDevRegistration(manifest.root, process.pid, input.target).catch(() => {
4349
- });
4350
- if (input.readyFile) await removeOwnedReadyFile(input.readyFile, process.pid);
4458
+ await removeDevRegistration(manifest.root, process.pid, input.target).catch(
4459
+ () => {
4460
+ }
4461
+ );
4462
+ if (input.readyFile)
4463
+ await removeOwnedReadyFile(input.readyFile, process.pid);
4351
4464
  await input.auth.closeMock?.();
4352
4465
  };
4353
4466
  try {
@@ -4426,8 +4539,10 @@ async function tryAttachedDevFetch(input) {
4426
4539
  `${registration.basePath}${rest === "/" && registration.basePath ? "" : rest}` || "/",
4427
4540
  registration.origin
4428
4541
  );
4429
- input.io.stderr(`Attached to running kody dev (pid ${registration.pid}) at ${registration.origin}
4430
- `);
4542
+ input.io.stderr(
4543
+ `Attached to running kody dev (pid ${registration.pid}) at ${registration.origin}
4544
+ `
4545
+ );
4431
4546
  const response = await fetch(url, {
4432
4547
  method: input.method ?? "GET",
4433
4548
  headers: input.body ? { "content-type": "application/json" } : void 0,
@@ -4561,7 +4676,10 @@ async function runDevWebhook(input) {
4561
4676
  target: input.target
4562
4677
  });
4563
4678
  }
4564
- const rawBody = await readFile4(resolve7(input.cwd ?? process.cwd(), input.bodyPath), "utf8");
4679
+ const rawBody = await readFile4(
4680
+ resolve7(input.cwd ?? process.cwd(), input.bodyPath),
4681
+ "utf8"
4682
+ );
4565
4683
  let jsonBody = null;
4566
4684
  try {
4567
4685
  jsonBody = JSON.parse(rawBody);
@@ -4629,7 +4747,10 @@ async function runDevEmit(input) {
4629
4747
  target: input.target
4630
4748
  });
4631
4749
  }
4632
- const rawBody = await readFile4(resolve7(input.cwd ?? process.cwd(), input.bodyPath), "utf8");
4750
+ const rawBody = await readFile4(
4751
+ resolve7(input.cwd ?? process.cwd(), input.bodyPath),
4752
+ "utf8"
4753
+ );
4633
4754
  let envelope;
4634
4755
  try {
4635
4756
  const parsed = JSON.parse(rawBody);
@@ -4642,7 +4763,9 @@ async function runDevEmit(input) {
4642
4763
  code: "package_manifest_invalid",
4643
4764
  message: `Could not parse event body ${input.bodyPath} as a JSON object.`,
4644
4765
  fix: "Pass --body event.json with the platform delivery envelope fields.",
4645
- details: { cause: error instanceof Error ? error.message : String(error) },
4766
+ details: {
4767
+ cause: error instanceof Error ? error.message : String(error)
4768
+ },
4646
4769
  target: input.target
4647
4770
  });
4648
4771
  }
@@ -4689,7 +4812,9 @@ async function runDevCheck(input) {
4689
4812
  try {
4690
4813
  const bundled = await bundleLocalUserModule(modulePath);
4691
4814
  push(label, true, label.startsWith("app.entry") ? modulePath : void 0);
4692
- credentialSignals.push(...await detectCredentialedFetchInSource(bundled, label));
4815
+ credentialSignals.push(
4816
+ ...await detectCredentialedFetchInSource(bundled, label)
4817
+ );
4693
4818
  } catch (error) {
4694
4819
  push(label, false, error instanceof Error ? error.message : String(error));
4695
4820
  }
@@ -4822,7 +4947,7 @@ async function printDevDryRun(input) {
4822
4947
  surface: input.surface,
4823
4948
  modulePath: input.modulePath,
4824
4949
  params: input.params ?? null,
4825
- ...input.extra ?? {},
4950
+ ...input.extra,
4826
4951
  note: input.target === "prod" ? "No module run and no prod side effects. Drop --dry-run to invoke once against prod CapabilityProxy." : "No module run. Drop --dry-run to invoke against the selected target."
4827
4952
  };
4828
4953
  if (input.json) {
@@ -4897,4 +5022,4 @@ export {
4897
5022
  chokidar/esm/index.js:
4898
5023
  (*! chokidar - MIT License (c) 2012 Paul Miller (paulmillr.com) *)
4899
5024
  */
4900
- //# sourceMappingURL=dev-command-3LX234N6.js.map
5025
+ //# sourceMappingURL=dev-command-TZ2EB4J3.js.map