@akanjs/cli 3.3.0-rc.11 → 3.3.0-rc.13

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 (101) hide show
  1. package/.build-stamp +2 -2
  2. package/{CodeAgent-cqbf9gsv.js → CodeAgent-zkr3s3xy.js} +2 -2
  3. package/{CodeTui-ehdr4hgw.js → CodeTui-1qvrzfmy.js} +1 -1
  4. package/TunnelShare-8j95ta3w.js +16 -0
  5. package/{agent.command-x55ncdjm.js → agent.command-dejgb8vz.js} +18 -17
  6. package/akanCode.js +2 -2
  7. package/{appExecutor-1ctzymwa.js → appExecutor-nj95a6en.js} +3 -3
  8. package/{application.command-xpntxnh8.js → application.command-3tnq1587.js} +45 -15
  9. package/{applicationBuildRunner-19c76791.js → applicationBuildRunner-cbjy05yg.js} +75 -12
  10. package/buildBatch.proc.js +10 -10
  11. package/{cloud.command-p3ybjes7.js → cloud.command-qae6et2e.js} +19 -18
  12. package/cloud.script-34xmprty.js +31 -0
  13. package/{code.command-m6skj1kj.js → code.command-xrh506zf.js} +10 -10
  14. package/commandManifest.json +1 -1
  15. package/{context.command-3c3nv0d6.js → context.command-fxyzkwg5.js} +18 -18
  16. package/context.runner-bz1jwxkk.js +32 -0
  17. package/{csrArtifactBuilder-mdh9ykn2.js → csrArtifactBuilder-rqg85wbg.js} +2 -2
  18. package/{guideline.command-725fq5p0.js → guideline.command-7dgscqjq.js} +6 -6
  19. package/guidelines/akanApi/akanApi.instruction.md +10 -0
  20. package/guidelines/conventions/rules/config.md +5 -0
  21. package/guidelines/conventions/rules/page.md +4 -3
  22. package/guidelines/conventions/rules/server.md +21 -81
  23. package/guidelines/conventions/rules/ssr.md +4 -25
  24. package/guidelines/conventions/rules/style.md +9 -32
  25. package/guidelines/cssRule/cssRule.instruction.md +11 -4
  26. package/guidelines/errorCodes/errorCodes.instruction.md +4 -0
  27. package/guidelines/pageRule/pageRule.instruction.md +19 -0
  28. package/guidelines/recipeRule/recipeRule.instruction.md +3 -3
  29. package/guidelines/runtimeRule/runtimeRule.instruction.md +109 -6
  30. package/guidelines/ssrRule/ssrRule.instruction.md +3 -0
  31. package/guidelines/transportRule/transportRule.instruction.md +4 -0
  32. package/incrementalBuilder.proc.js +8 -8
  33. package/{index-3mj5trqc.js → index-0bzrcv91.js} +1 -1
  34. package/{index-q63nbpv7.js → index-0zkxsdsg.js} +3 -3
  35. package/{index-wxqp1amd.js → index-1c52g4st.js} +11 -9
  36. package/{index-vnk1qwgr.js → index-22h6vq3f.js} +4 -4
  37. package/index-35p43f33.js +16 -0
  38. package/{index-fagjtk6m.js → index-3q7ectss.js} +2 -2
  39. package/{index-se7n78fh.js → index-54g085ty.js} +1 -1
  40. package/{index-rt7q20sj.js → index-5sa1tr7w.js} +1 -1
  41. package/{index-h8w1n11r.js → index-6a3rmwxx.js} +4 -4
  42. package/{index-yey1envc.js → index-741xbhes.js} +1 -1
  43. package/{index-9a9t77hz.js → index-77627y32.js} +2 -2
  44. package/{index-4r8dgm4x.js → index-8javbznc.js} +3 -3
  45. package/{index-hxg6ctk2.js → index-a2a3nh57.js} +3 -3
  46. package/{index-j2wq064m.js → index-aezpcphy.js} +121 -15
  47. package/{index-3r1crbct.js → index-ay4vkwr8.js} +1 -1
  48. package/{index-t23dgyaf.js → index-b4m7bjbx.js} +7 -7
  49. package/{index-rdcgz02t.js → index-bma8tmgb.js} +4 -4
  50. package/{index-3zkhg65e.js → index-c4g8egm2.js} +40 -13
  51. package/{index-9gjcbp2g.js → index-c8kj74zz.js} +1 -1
  52. package/{index-fjqapyex.js → index-es2wkn41.js} +40 -5
  53. package/{index-pyjkbg8e.js → index-extg77rx.js} +2 -2
  54. package/{index-nmdmkjt2.js → index-fey1dd49.js} +4 -4
  55. package/{index-c669pbyb.js → index-fjzeak0t.js} +68 -37
  56. package/{index-f4jydw2x.js → index-gdgbgn82.js} +1 -1
  57. package/{index-4yvtqcme.js → index-gyyscjzx.js} +16 -4
  58. package/{index-qecrqpt6.js → index-hxcefw29.js} +1 -1
  59. package/{index-a4gcdffy.js → index-k380ww64.js} +3 -3
  60. package/index-kqxs1d7z.js +377 -0
  61. package/{index-nnmw56fz.js → index-mv3ke0fc.js} +5 -5
  62. package/{index-m303nhv6.js → index-mvdmb73w.js} +6 -6
  63. package/{index-cbm9gzgx.js → index-pa53zktp.js} +5 -5
  64. package/{index-3a3vy2xy.js → index-psvxwemh.js} +8 -8
  65. package/{index-ckcc9ab3.js → index-r24mj2pw.js} +8 -8
  66. package/{index-8bta5pnr.js → index-serpfvat.js} +2 -2
  67. package/{index-kbnvyhy4.js → index-shjjjdte.js} +3 -3
  68. package/{index-pr9nypg7.js → index-sjmk7wp7.js} +2 -2
  69. package/{index-wkwe91sn.js → index-th7qbjfz.js} +11 -11
  70. package/{index-5ahe641t.js → index-vgd07z61.js} +8 -8
  71. package/{index-crd99zqs.js → index-wzvvqkcy.js} +1 -1
  72. package/{index-v16gj2as.js → index-ys1sjp6m.js} +90 -51
  73. package/{index-22bwg8hy.js → index-zc43cyg8.js} +1 -1
  74. package/index.js +27 -27
  75. package/{libExecutor-n8hpm8s7.js → libExecutor-mqxnn0h6.js} +2 -2
  76. package/{library.command-8abb26pg.js → library.command-4kefxh8z.js} +7 -7
  77. package/{localRegistry.command-sa211m1z.js → localRegistry.command-phgrhkks.js} +18 -17
  78. package/{module.command-z3cwjf0p.js → module.command-8476gwze.js} +9 -9
  79. package/{package.command-akynhtee.js → package.command-ygxm5pp9.js} +8 -8
  80. package/package.json +2 -2
  81. package/{page.command-3fpdavk9.js → page.command-f7fwkj8y.js} +7 -7
  82. package/{pipeline.command-ca95n8rd.js → pipeline.command-9htjbrdm.js} +6 -6
  83. package/{pkgExecutor-a73q41vx.js → pkgExecutor-6a91xng5.js} +2 -2
  84. package/{primitive.command-xwe9ggnf.js → primitive.command-0k0h0cm0.js} +10 -10
  85. package/{projectTypecheck-7g542ymk.js → projectTypecheck-7kakbacs.js} +1 -1
  86. package/{quality.command-7wz7y8z1.js → quality.command-frsfdfc5.js} +9 -8
  87. package/{repair.command-dej1qtfq.js → repair.command-yag3bpq2.js} +9 -9
  88. package/{scalar.command-z9qfxnvm.js → scalar.command-qtyrywvt.js} +8 -8
  89. package/skills/akan-err/SKILL.md +11 -2
  90. package/skills/akan-page/SKILL.md +4 -14
  91. package/skills/akan-runtime/SKILL.md +20 -0
  92. package/{subspace.command-9wekm4gn.js → subspace.command-kr53abzt.js} +10 -10
  93. package/{tunnel.command-cxc4h3j8.js → tunnel.command-pswe6nye.js} +9 -9
  94. package/{typeChecker-7jt6abrs.js → typeChecker-epg7ebfy.js} +2 -1
  95. package/typecheck.proc.js +2 -1
  96. package/{verify.command-j0w9dr5c.js → verify.command-ghhhzgrw.js} +15 -14
  97. package/{workflow.command-yt4sz04b.js → workflow.command-fpwqth4w.js} +14 -14
  98. package/{workspace.command-8mp4mcp2.js → workspace.command-6bbmtn3w.js} +33 -31
  99. package/TunnelShare-0p4dy89e.js +0 -16
  100. package/cloud.script-0dsyd10v.js +0 -30
  101. package/context.runner-yyp7a112.js +0 -32
@@ -4,7 +4,7 @@ import {
4
4
  SysExecutor,
5
5
  AppInfo,
6
6
  WorkspaceExecutor
7
- } from "./index-v16gj2as.js";
7
+ } from "./index-ys1sjp6m.js";
8
8
  import {
9
9
  FileSys2
10
10
  } from "./index-zyjztrvc.js";
@@ -13,13 +13,13 @@ import {
13
13
  } from "./index-j4yvgfhr.js";
14
14
  import {
15
15
  AppExecutor2
16
- } from "./index-9a9t77hz.js";
16
+ } from "./index-77627y32.js";
17
17
  import {
18
18
  LibExecutor2
19
- } from "./index-yey1envc.js";
19
+ } from "./index-741xbhes.js";
20
20
  import {
21
21
  PkgExecutor2
22
- } from "./index-crd99zqs.js";
22
+ } from "./index-wzvvqkcy.js";
23
23
  import {
24
24
  UNAVAILABLE_REDIS_HOST,
25
25
  redisTunnelPolicy,
@@ -55,27 +55,27 @@ import {
55
55
  filesChangedSince,
56
56
  HmrWatcher,
57
57
  WatchRootResolver
58
- } from "./index-8bta5pnr.js";
58
+ } from "./index-serpfvat.js";
59
59
  import {
60
60
  runner,
61
61
  assertPromptable
62
- } from "./index-nnmw56fz.js";
62
+ } from "./index-mv3ke0fc.js";
63
63
  import {
64
64
  UpdatePackFolder,
65
65
  UpdateUploader,
66
66
  NativePublicEnv,
67
67
  NativeApp
68
- } from "./index-fjqapyex.js";
68
+ } from "./index-es2wkn41.js";
69
69
  import {
70
70
  DesktopServerStage
71
- } from "./index-f4jydw2x.js";
71
+ } from "./index-gdgbgn82.js";
72
72
  import {
73
73
  resolveMobileTargets,
74
74
  resolveAppId
75
75
  } from "./index-m9jj544v.js";
76
76
  import {
77
77
  SlicePlanner
78
- } from "./index-rt7q20sj.js";
78
+ } from "./index-5sa1tr7w.js";
79
79
  import {
80
80
  openBrowser
81
81
  } from "./index-9dp031by.js";
@@ -2491,7 +2491,7 @@ var reportsNoTestFile = (exec) => {
2491
2491
  };
2492
2492
 
2493
2493
  // pkgs/@akanjs/cli/application/application.runner.ts
2494
- var loadBuildRunner = async () => (await import("./applicationBuildRunner-19c76791.js")).ApplicationBuildRunner;
2494
+ var loadBuildRunner = async () => (await import("./applicationBuildRunner-cbjy05yg.js")).ApplicationBuildRunner;
2495
2495
  var loadPrompts = async () => await import("@inquirer/prompts");
2496
2496
 
2497
2497
  class ApplicationRunner extends runner("application") {
@@ -2692,7 +2692,7 @@ if (loaded) process.exitCode = await loaded.migrations.command(loaded.server, ar
2692
2692
  await new (await loadBuildRunner())(app).typecheck(options);
2693
2693
  }
2694
2694
  async typecheckLibrary(lib, options = {}) {
2695
- const { ProjectTypecheck } = await import("./projectTypecheck-7g542ymk.js");
2695
+ const { ProjectTypecheck } = await import("./projectTypecheck-7kakbacs.js");
2696
2696
  const root = lib.workspace.workspaceRoot;
2697
2697
  await new ProjectTypecheck(lib.cwdPath, root, { ...process.env, AKAN_WORKSPACE_ROOT: root }).run([
2698
2698
  "../../server.ts",
@@ -1,17 +1,17 @@
1
1
  // @bun
2
2
  import {
3
3
  runner
4
- } from "./index-nnmw56fz.js";
4
+ } from "./index-mv3ke0fc.js";
5
5
  import {
6
6
  AppExecutor2
7
- } from "./index-9a9t77hz.js";
7
+ } from "./index-77627y32.js";
8
8
  import {
9
9
  jsonText,
10
10
  workflowStatus,
11
11
  createWorkflowBaselineSummary,
12
12
  buildAkanModuleContextIndex,
13
13
  toolingRolloutGate
14
- } from "./index-q63nbpv7.js";
14
+ } from "./index-0zkxsdsg.js";
15
15
  import {
16
16
  buildResourceList,
17
17
  codexMcpConfigPath,
@@ -21,16 +21,16 @@ import {
21
21
  upsertCodexMcpServerBlock,
22
22
  renderDoctorText,
23
23
  AkanContextAnalyzer
24
- } from "./index-h8w1n11r.js";
24
+ } from "./index-6a3rmwxx.js";
25
25
  import {
26
26
  Prompter2
27
27
  } from "./index-j3fqs8rc.js";
28
28
  import {
29
29
  NativeApp
30
- } from "./index-fjqapyex.js";
30
+ } from "./index-es2wkn41.js";
31
31
  import {
32
32
  isPlaceholderAppId
33
- } from "./index-f4jydw2x.js";
33
+ } from "./index-gdgbgn82.js";
34
34
  import {
35
35
  getMobileTargets,
36
36
  appIdsOf
@@ -40,10 +40,10 @@ import {
40
40
  } from "./index-xs9a3ddt.js";
41
41
  import {
42
42
  RepairRunner
43
- } from "./index-kbnvyhy4.js";
43
+ } from "./index-shjjjdte.js";
44
44
  import {
45
45
  WorkflowRunner
46
- } from "./index-3a3vy2xy.js";
46
+ } from "./index-psvxwemh.js";
47
47
 
48
48
  // pkgs/@akanjs/devkit/context/akanMcpContract.ts
49
49
  import { lstatSync, realpathSync } from "fs";
@@ -4,7 +4,7 @@ import {
4
4
  Executor,
5
5
  PkgInfo,
6
6
  WorkspaceExecutor
7
- } from "./index-v16gj2as.js";
7
+ } from "./index-ys1sjp6m.js";
8
8
 
9
9
  // pkgs/@akanjs/devkit/executors/pkgExecutor.ts
10
10
  import path from "path";
@@ -216,7 +216,7 @@ var rootEntryHintOf = (type, name) => type === "app" && retiredAppRootEntries.ha
216
216
  var isScannedRootEntry = (type, name) => !name.startsWith(".") || rootAllowedDirs[type].has(name);
217
217
 
218
218
  // pkgs/@akanjs/devkit/workspace/scanInfo.ts
219
- var loadLibExecutor = () => import("./libExecutor-n8hpm8s7.js");
219
+ var loadLibExecutor = () => import("./libExecutor-mqxnn0h6.js");
220
220
  var serviceFileTypes = [
221
221
  "dictionary",
222
222
  "service",
@@ -623,9 +623,9 @@ class WorkspaceInfo {
623
623
  return existingWorkspaceInfo;
624
624
  const [appNames, libNames, pkgNames] = await Promise.all([exec.getApps(), exec.getLibs(), exec.getPkgs()]);
625
625
  const [appModule, libModule, pkgModule] = await Promise.all([
626
- import("./appExecutor-1ctzymwa.js"),
626
+ import("./appExecutor-nj95a6en.js"),
627
627
  loadLibExecutor(),
628
- import("./pkgExecutor-a73q41vx.js")
628
+ import("./pkgExecutor-6a91xng5.js")
629
629
  ]);
630
630
  const [appInfos, libInfos, pkgInfos] = await Promise.all([
631
631
  Promise.all(appNames.map(async (appName) => await appModule.AppExecutor.from(exec, appName).scan())),
@@ -1648,7 +1648,7 @@ class Executor {
1648
1648
  }
1649
1649
  }
1650
1650
  async getTypeChecker() {
1651
- const { TypeChecker } = await import("./typeChecker-7jt6abrs.js");
1651
+ const { TypeChecker } = await import("./typeChecker-epg7ebfy.js");
1652
1652
  this.typeChecker ??= new TypeChecker(this);
1653
1653
  return this.typeChecker;
1654
1654
  }
@@ -2355,12 +2355,9 @@ class SysExecutor extends Executor {
2355
2355
  // pkgs/@akanjs/devkit/executors/workspaceExecutor.ts
2356
2356
  var parseEnvValue = (value) => {
2357
2357
  const [, quote, inner] = value.match(/^(["'`])((?:\\.|(?!\1)[^\\])*)\1/) ?? [];
2358
- if (!quote)
2359
- return value.replace(/#.*/, "").trim();
2360
- if (quote !== '"')
2361
- return inner;
2362
- return inner.replace(/\\(.)/g, (pair, char) => char === "n" ? `
2358
+ const text = !quote ? value.replace(/#.*/, "").trim() : quote !== '"' ? inner : inner.replace(/\\(.)/g, (pair, char) => char === "n" ? `
2363
2359
  ` : char === "r" ? "\r" : pair);
2360
+ return text.replaceAll("\\$", "$");
2364
2361
  };
2365
2362
  var parseEnvFile = (envPath) => {
2366
2363
  const env = {};
@@ -2585,9 +2582,22 @@ import { existsSync as existsSync4, realpathSync } from "fs";
2585
2582
  import path12 from "path";
2586
2583
  import { Logger as Logger3, toError as toError2 } from "akanjs/common";
2587
2584
 
2585
+ // pkgs/@akanjs/devkit/transforms/serverEnvEvaluationError.ts
2586
+ class ServerEnvEvaluationError extends Error {
2587
+ reason;
2588
+ constructor(reason, message) {
2589
+ super(message);
2590
+ this.reason = reason;
2591
+ this.name = "ServerEnvEvaluationError";
2592
+ }
2593
+ }
2594
+
2595
+ // pkgs/@akanjs/devkit/transforms/serverEnvProfile.ts
2588
2596
  class ServerEnvProfile {
2589
2597
  static namePattern = /^[a-z][a-zA-Z0-9-]*$/;
2590
2598
  static envFilePattern = /[\\/]env[\\/]env\.server\.[A-Za-z0-9-]+\.ts$/;
2599
+ static envModulePattern = /[\\/]env[\\/]env\.server(?:\.[A-Za-z0-9-]+)?\.ts$/;
2600
+ static evaluationTimeoutMs = 60000;
2591
2601
  static fileName(environment, profile) {
2592
2602
  return `env.server.${environment}.${profile}.ts`;
2593
2603
  }
@@ -2610,7 +2620,7 @@ class ServerEnvProfile {
2610
2620
  const url = ServerEnvProfile.#url(value);
2611
2621
  return !!url && ServerEnvProfile.#carriesCredential(url);
2612
2622
  }
2613
- static #isSecret(value, underSecret) {
2623
+ static isSecret(value, underSecret) {
2614
2624
  return underSecret && !!value.trim() || ServerEnvProfile.#isCredentialUrl(value);
2615
2625
  }
2616
2626
  static #fold(value, fold, at = "", underSecret = false) {
@@ -2628,7 +2638,7 @@ class ServerEnvProfile {
2628
2638
  }
2629
2639
  static strip(value) {
2630
2640
  return ServerEnvProfile.#fold(value, {
2631
- text: (text, at, underSecret) => ServerEnvProfile.#isSecret(text, underSecret) ? { value: undefined, stripped: [at] } : { value: text, stripped: [] },
2641
+ text: (text, at, underSecret) => ServerEnvProfile.isSecret(text, underSecret) ? { value: undefined, stripped: [at] } : { value: text, stripped: [] },
2632
2642
  other: (other) => ({ value: other, stripped: [] }),
2633
2643
  node: (node, children) => {
2634
2644
  const stripped = children.flatMap(([, result]) => result.stripped);
@@ -2659,17 +2669,30 @@ class ServerEnvProfile {
2659
2669
  return ServerEnvProfile.#carriesCredential(url) || [...url.pathname.split("/"), ...url.searchParams.values()].some((part) => ServerEnvProfile.distinctive(part));
2660
2670
  return value.length >= 16 && !/^https?:\/\//.test(value) && !/^[a-z]+(?:[._-][a-z]+)*$/.test(value);
2661
2671
  }
2662
- static secretPaths(value) {
2663
- return ServerEnvProfile.#fold(value, ServerEnvProfile.#collect((text, at, underSecret) => ServerEnvProfile.#isSecret(text, underSecret) ? [at] : []));
2672
+ static secretPaths(value, underSecret = false) {
2673
+ return ServerEnvProfile.#fold(value, ServerEnvProfile.#collect((text, at, held) => ServerEnvProfile.isSecret(text, held) ? [at] : []), "", underSecret);
2664
2674
  }
2665
- static async evaluate(file, cwd, load) {
2666
- return (await ServerEnvProfile.#evaluated(file, cwd, load)).value;
2675
+ static movedTexts(value, underSecret) {
2676
+ const texts = ServerEnvProfile.#fold(value, ServerEnvProfile.#collect((text, _at, held) => ServerEnvProfile.isSecret(text, held) ? [text, ServerEnvProfile.#url(text)?.password ?? ""] : []), "", underSecret);
2677
+ return [...new Set(texts)].filter((text) => text !== "");
2667
2678
  }
2668
- static async#evaluated(file, cwd, load) {
2669
- const pattern = (regex, flags = "") => `new RegExp(${JSON.stringify(regex.source)}, "${flags}")`;
2670
- const literal = /(["'`])((?:\\[\s\S]|(?!\1)[^\\])*)\1/;
2679
+ static async evaluate(file, cwd, load, evaluation) {
2680
+ return (await ServerEnvProfile.#evaluated(file, cwd, load, evaluation)).value;
2681
+ }
2682
+ static async evaluateReads(file, cwd, load, evaluation) {
2683
+ return await ServerEnvProfile.#evaluated(file, cwd, load, evaluation, true);
2684
+ }
2685
+ static async#evaluated(file, cwd, load, {
2686
+ environment,
2687
+ loads = ServerEnvProfile.envFilePattern,
2688
+ timeoutMs = ServerEnvProfile.evaluationTimeoutMs,
2689
+ variables
2690
+ } = {}, notesReads = false) {
2671
2691
  const frame = /^\s*at (?:[^(]*\()?(.+):(\d+):(\d+)\)?\s*$/;
2672
2692
  const script = [
2693
+ 'process.on("disconnect", () => process.exit(1));',
2694
+ "setTimeout(() => process.exit(1), Number(process.env.AKAN_PROFILE_ENV_DEADLINE)).unref();",
2695
+ "const finish = (message, code) => process.send(message, undefined, undefined, () => process.exit(code));",
2673
2696
  "const waiting = new Map();",
2674
2697
  'process.on("message", ({ load, error, loader, contents }) => {',
2675
2698
  " const reply = waiting.get(load);",
@@ -2688,23 +2711,25 @@ class ServerEnvProfile {
2688
2711
  " }));",
2689
2712
  " },",
2690
2713
  " });",
2691
- `const literal = ${pattern(literal, "g")};`,
2692
- `const interpolation = ${pattern(/\$\{[^}]*\}/)};`,
2693
- `const frameOf = ${pattern(frame)};`,
2694
- `const evaluating = ${pattern(/\s*\(evaluating '[\s\S]*'\)\s*$/)};`,
2695
- "const literalsOf = async (file) =>",
2696
- ' [...(await Bun.file(file).text().catch(() => "")).matchAll(literal)].flatMap((match) => match[2].split(interpolation));',
2697
- "const describe = async (error) => {",
2714
+ "const reads = new Set();",
2715
+ 'const note = (key) => typeof key === "string" && reads.add(key);',
2716
+ "const noting = { get: (target, key, receiver) => (note(key), Reflect.get(target, key, receiver)), has: (target, key) => (note(key), Reflect.has(target, key)) };",
2717
+ "if (process.env.AKAN_PROFILE_ENV_READS) {",
2718
+ " Object.setPrototypeOf(process.env, new Proxy(Object.prototype, noting));",
2719
+ " process.env = new Proxy(process.env, noting);",
2720
+ "}",
2721
+ `const frameOf = new RegExp(${JSON.stringify(frame.source)});`,
2722
+ 'const { existsSync } = require("node:fs");',
2723
+ "const describe = (error) => {",
2698
2724
  " const first = Array.isArray(error?.errors) && error.errors.length ? error.errors[0] : error;",
2699
- ' const frame = String(first?.stack ?? "").split("\\n").map((line) => frameOf.exec(line)).find(Boolean);',
2700
- " const at = first?.position?.file ? [first.position.file, first.position.line, first.position.column] : frame ? frame.slice(1, 4) : [];",
2701
- " const files = [process.env.AKAN_PROFILE_ENV_FILE, at[0]].filter(Boolean);",
2702
- " const literals = (await Promise.all(files.map(literalsOf))).flat().filter((part) => part.length >= 4);",
2703
- ' let message = String(first?.message ?? first).replace(evaluating, "");',
2704
- " for (const part of literals.sort((a, b) => b.length - a.length))",
2705
- ' message = message.split(part).join("[redacted]");',
2706
- ' const name = typeof first?.name === "string" && /^[A-Za-z]+$/.test(first.name) ? first.name : "Error";',
2707
- ' return name + ": " + message.slice(0, 200) + (at.length ? " (at " + at.join(":") + ")" : "");',
2725
+ ' const stack = String(first?.stack ?? "");',
2726
+ ' const message = String(first?.message ?? "");',
2727
+ " const frames = message && stack.includes(message) ? stack.slice(stack.indexOf(message) + message.length) : stack;",
2728
+ ' const frame = frames.split("\\n").map((line) => frameOf.exec(line)).find((found) => found && existsSync(found[1]));',
2729
+ " const at = first?.position?.file ? [first.position.file, first.position.line] : frame ? frame.slice(1, 3) : [];",
2730
+ ' const named = first === null || first === undefined ? "" : String(Object.getPrototypeOf(first)?.constructor?.name ?? "");',
2731
+ ' const name = first instanceof Error && /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(named) ? named : "Error";',
2732
+ ' return name + (at.length ? " at " + at.join(":") : ", which gave no location");',
2708
2733
  "};",
2709
2734
  "try {",
2710
2735
  " const { env } = await import(process.env.AKAN_PROFILE_ENV_FILE);",
@@ -2718,10 +2743,9 @@ class ServerEnvProfile {
2718
2743
  " };",
2719
2744
  ' walk(env, "");',
2720
2745
  ' const plain = (_, value) => (typeof value === "function" || typeof value === "symbol" ? undefined : typeof value === "bigint" ? String(value) : value);',
2721
- ' process.send({ env: JSON.stringify(env ?? null, plain) ?? "null", lossy }, undefined, undefined, () => process.disconnect());',
2746
+ ' finish({ env: JSON.stringify(env ?? null, plain) ?? "null", lossy, reads: [...reads] }, 0);',
2722
2747
  "} catch (error) {",
2723
- " process.exitCode = 1;",
2724
- " process.send({ failure: await describe(error) }, undefined, undefined, () => process.disconnect());",
2748
+ " finish({ failure: describe(error) }, 1);",
2725
2749
  "}"
2726
2750
  ].join(`
2727
2751
  `);
@@ -2733,8 +2757,12 @@ class ServerEnvProfile {
2733
2757
  env: {
2734
2758
  PATH: process.env.PATH ?? "",
2735
2759
  HOME: process.env.HOME ?? "",
2760
+ ...variables,
2736
2761
  AKAN_PROFILE_ENV_FILE: file,
2737
- ...load ? { AKAN_PROFILE_ENV_LOAD: ServerEnvProfile.envFilePattern.source } : {}
2762
+ AKAN_PROFILE_ENV_DEADLINE: String(timeoutMs + 5000),
2763
+ ...load ? { AKAN_PROFILE_ENV_LOAD: loads.source } : {},
2764
+ ...notesReads ? { AKAN_PROFILE_ENV_READS: "1" } : {},
2765
+ ...environment ? { AKAN_PUBLIC_ENV: environment } : {}
2738
2766
  },
2739
2767
  stdout: "ignore",
2740
2768
  stderr: "ignore",
@@ -2759,13 +2787,24 @@ class ServerEnvProfile {
2759
2787
  });
2760
2788
  }
2761
2789
  });
2762
- const exitCode = await child.exited;
2763
- if (exitCode !== 0 || !sent) {
2764
- if (loadError)
2765
- throw loadError;
2766
- throw new Error(`${path12.basename(file)} could not be evaluated to check it for secrets: ${failure ?? `its process exited with code ${exitCode} and sent nothing`}`);
2767
- }
2768
- return { value: JSON.parse(sent.env), lossy: sent.lossy };
2790
+ let timedOut = false;
2791
+ const kill = () => child.kill("SIGKILL");
2792
+ const timer = setTimeout(() => {
2793
+ timedOut = true;
2794
+ kill();
2795
+ }, timeoutMs);
2796
+ process.on("exit", kill);
2797
+ const exitCode = await child.exited.finally(() => {
2798
+ clearTimeout(timer);
2799
+ process.off("exit", kill);
2800
+ });
2801
+ if (sent && !timedOut && exitCode === 0)
2802
+ return { value: JSON.parse(sent.env), lossy: sent.lossy, reads: sent.reads };
2803
+ if (loadError)
2804
+ throw loadError;
2805
+ if (timedOut)
2806
+ throw new ServerEnvEvaluationError("timedOut", `${file} was not evaluated within ${timeoutMs / 1000}s, so its process was stopped: the file, or one it imports, waits on something as it loads that does not end (a server it starts, a connection it opens, a loop).`);
2807
+ throw new ServerEnvEvaluationError(failure ? "threw" : "exited", `${path12.basename(file)} could not be evaluated to check it for secrets: ${failure ?? `its process exited with code ${exitCode} and sent nothing`}`);
2769
2808
  }
2770
2809
  static async sourceInPlaceOf(profileFile, replacedFile, profile) {
2771
2810
  const contents = await Bun.file(profileFile).text();
@@ -3352,10 +3391,10 @@ class AkanAppConfig {
3352
3391
  `RUN if [ "$AKAN_ALLOW_LOCAL_IMAGE" != "1" ]; then echo "This build ran with AKAN_PUBLIC_ENV=local, so the server runs without endpoint rate limits and on local defaults for Redis and the database mode. Build for the environment it deploys to with akan build --env, or pass --build-arg AKAN_ALLOW_LOCAL_IMAGE=1." >&2; exit 1; fi`
3353
3392
  ].join(`
3354
3393
  `);
3355
- dockerfileFor(environment, { lockfile = true } = {}) {
3356
- return this.#makeDockerfile(environment, lockfile);
3394
+ dockerfileFor(environment, options = {}) {
3395
+ return this.#makeDockerfile(environment, options.lockfile ?? true, options.env);
3357
3396
  }
3358
- #makeDockerfile(environment, lockfile = true) {
3397
+ #makeDockerfile(environment, lockfile = true, env = this.getProductionEnv(environment)) {
3359
3398
  if (typeof this.docker === "string")
3360
3399
  return this.docker;
3361
3400
  const { image, preRuns, postRuns, command } = this.docker;
@@ -3363,7 +3402,7 @@ class AkanAppConfig {
3363
3402
  const postRunScripts = this.#getDockerRunScripts(postRuns);
3364
3403
  const imageScript = this.#getDockerImageScript(image, DEFAULT_DOCKER_IMAGE);
3365
3404
  const isLocal = (environment ?? this.baseDevEnv.env) === "local";
3366
- const envLines = Object.entries(this.getProductionEnv(environment)).map(([key, value]) => `ENV ${key}=${value}`);
3405
+ const envLines = Object.entries(env).map(([key, value]) => `ENV ${key}=${value}`);
3367
3406
  return `${imageScript}${isLocal ? `
3368
3407
  ${AkanAppConfig.localImageGuard}` : ""}
3369
3408
  RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends ca-certificates tzdata && rm -rf /var/lib/apt/lists/*
@@ -3408,7 +3447,7 @@ CMD [${command.map((c) => `"${c}"`).join(",")}]`;
3408
3447
  return new AkanAppConfig(app, libs, rootPackageJson, config, baseDevEnv, plugins ?? [], libContributions);
3409
3448
  }
3410
3449
  static async#collectLibContributions(app, libs, bustImportCache) {
3411
- const { LibExecutor } = await import("./libExecutor-n8hpm8s7.js");
3450
+ const { LibExecutor } = await import("./libExecutor-mqxnn0h6.js");
3412
3451
  const libConfigs = await Promise.all(libs.map(async (libName) => AkanLibConfig.from(LibExecutor.from(app, libName), { bustImportCache }).catch((error) => {
3413
3452
  if (error instanceof LibConfigRefusal)
3414
3453
  throw error;
@@ -3628,4 +3667,4 @@ class AkanWorkspaceConfig {
3628
3667
  return `${url.origin}${url.pathname.replace(/\/+$/, "")}`;
3629
3668
  }
3630
3669
  }
3631
- export { binPlatforms, barrelFacetDirs, rootAllowedFiles, rootAllowedDirs, isAllowedLibFacetRootFile, libFacetRootHintOf, facetIndexShadowOf, rootEntryHintOf, isScannedRootEntry, parseBiomeReport, Linter, ProjectTypecheck2, JsonFormatter, Spinner, CommandExecutionError, execEmoji, Executor, AGENT_BLOCK_START, AGENT_BLOCK_END, stampBlockVersion, extractBlockVersion, readDevkitVersion, upsertAgentBlock, extractAgentBlock, renderRecipeEntries, collectScopeRecipeSources, renderScopeAgentBlock, CLAUDE_COMMENT_RULE, CodegenLock, LibSource, formatLibStatuses, SysExecutor, AppInfo, PkgInfo, parseEnvFile, WorkspaceExecutor, ServerEnvProfile, AkanAppConfig, AkanLibConfig, increaseBuildNum, decreaseBuildNum, AkanWorkspaceConfig };
3670
+ export { binPlatforms, barrelFacetDirs, rootAllowedFiles, rootAllowedDirs, isAllowedLibFacetRootFile, libFacetRootHintOf, facetIndexShadowOf, rootEntryHintOf, isScannedRootEntry, parseBiomeReport, Linter, ProjectTypecheck2, JsonFormatter, Spinner, CommandExecutionError, execEmoji, Executor, AGENT_BLOCK_START, AGENT_BLOCK_END, stampBlockVersion, extractBlockVersion, readDevkitVersion, upsertAgentBlock, extractAgentBlock, renderRecipeEntries, collectScopeRecipeSources, renderScopeAgentBlock, CLAUDE_COMMENT_RULE, CodegenLock, LibSource, formatLibStatuses, SysExecutor, AppInfo, PkgInfo, parseEnvFile, WorkspaceExecutor, ServerEnvEvaluationError, ServerEnvProfile, AkanAppConfig, AkanLibConfig, increaseBuildNum, decreaseBuildNum, AkanWorkspaceConfig };
@@ -157,7 +157,7 @@ class SubagentPool2 {
157
157
  }
158
158
  }
159
159
  async#run(id, kind, prompt, signal) {
160
- const { CodeAgent } = await import("./CodeAgent-cqbf9gsv.js");
160
+ const { CodeAgent } = await import("./CodeAgent-zkr3s3xy.js");
161
161
  const budget = this.#options.parent.tools.subagent;
162
162
  const child = SubagentPool2.childOf(this.#options.parent, kind);
163
163
  const model = this.#options.model?.();
package/index.js CHANGED
@@ -4,14 +4,14 @@ import {
4
4
  getTargetMetas,
5
5
  getTargetCommandNames,
6
6
  runCommands
7
- } from "./index-nnmw56fz.js";
7
+ } from "./index-mv3ke0fc.js";
8
8
  import"./index-j4yvgfhr.js";
9
- import"./index-v16gj2as.js";
9
+ import"./index-ys1sjp6m.js";
10
10
  import"./index-zyjztrvc.js";
11
- import"./index-9a9t77hz.js";
12
- import"./index-yey1envc.js";
13
- import"./index-crd99zqs.js";
14
- import"./index-3r1crbct.js";
11
+ import"./index-77627y32.js";
12
+ import"./index-741xbhes.js";
13
+ import"./index-wzvvqkcy.js";
14
+ import"./index-ay4vkwr8.js";
15
15
 
16
16
  // pkgs/@akanjs/cli/bunVersionGuard.ts
17
17
  class BunVersionGuard {
@@ -27,27 +27,27 @@ import path from "path";
27
27
 
28
28
  // pkgs/@akanjs/cli/commandModules.ts
29
29
  var commandModules = {
30
- workspace: async () => (await import("./workspace.command-8mp4mcp2.js")).WorkspaceCommand,
31
- agent: async () => (await import("./agent.command-x55ncdjm.js")).AgentCommand,
32
- code: async () => (await import("./code.command-m6skj1kj.js")).CodeCommand,
33
- application: async () => (await import("./application.command-xpntxnh8.js")).ApplicationCommand,
34
- library: async () => (await import("./library.command-8abb26pg.js")).LibraryCommand,
35
- localRegistry: async () => (await import("./localRegistry.command-sa211m1z.js")).LocalRegistryCommand,
36
- package: async () => (await import("./package.command-akynhtee.js")).PackageCommand,
37
- module: async () => (await import("./module.command-z3cwjf0p.js")).ModuleCommand,
38
- page: async () => (await import("./page.command-3fpdavk9.js")).PageCommand,
39
- context: async () => (await import("./context.command-3c3nv0d6.js")).ContextCommand,
40
- cloud: async () => (await import("./cloud.command-p3ybjes7.js")).CloudCommand,
41
- subspace: async () => (await import("./subspace.command-9wekm4gn.js")).SubspaceCommand,
42
- guideline: async () => (await import("./guideline.command-725fq5p0.js")).GuidelineCommand,
43
- scalar: async () => (await import("./scalar.command-z9qfxnvm.js")).ScalarCommand,
44
- primitive: async () => (await import("./primitive.command-xwe9ggnf.js")).PrimitiveCommand,
45
- quality: async () => (await import("./quality.command-7wz7y8z1.js")).QualityCommand,
46
- verify: async () => (await import("./verify.command-j0w9dr5c.js")).VerifyCommand,
47
- repair: async () => (await import("./repair.command-dej1qtfq.js")).RepairCommand,
48
- workflow: async () => (await import("./workflow.command-yt4sz04b.js")).WorkflowCommand,
49
- pipeline: async () => (await import("./pipeline.command-ca95n8rd.js")).PipelineCommand,
50
- tunnel: async () => (await import("./tunnel.command-cxc4h3j8.js")).TunnelCommand
30
+ workspace: async () => (await import("./workspace.command-6bbmtn3w.js")).WorkspaceCommand,
31
+ agent: async () => (await import("./agent.command-dejgb8vz.js")).AgentCommand,
32
+ code: async () => (await import("./code.command-xrh506zf.js")).CodeCommand,
33
+ application: async () => (await import("./application.command-3tnq1587.js")).ApplicationCommand,
34
+ library: async () => (await import("./library.command-4kefxh8z.js")).LibraryCommand,
35
+ localRegistry: async () => (await import("./localRegistry.command-phgrhkks.js")).LocalRegistryCommand,
36
+ package: async () => (await import("./package.command-ygxm5pp9.js")).PackageCommand,
37
+ module: async () => (await import("./module.command-8476gwze.js")).ModuleCommand,
38
+ page: async () => (await import("./page.command-f7fwkj8y.js")).PageCommand,
39
+ context: async () => (await import("./context.command-fxyzkwg5.js")).ContextCommand,
40
+ cloud: async () => (await import("./cloud.command-qae6et2e.js")).CloudCommand,
41
+ subspace: async () => (await import("./subspace.command-kr53abzt.js")).SubspaceCommand,
42
+ guideline: async () => (await import("./guideline.command-7dgscqjq.js")).GuidelineCommand,
43
+ scalar: async () => (await import("./scalar.command-qtyrywvt.js")).ScalarCommand,
44
+ primitive: async () => (await import("./primitive.command-0k0h0cm0.js")).PrimitiveCommand,
45
+ quality: async () => (await import("./quality.command-frsfdfc5.js")).QualityCommand,
46
+ verify: async () => (await import("./verify.command-ghhhzgrw.js")).VerifyCommand,
47
+ repair: async () => (await import("./repair.command-yag3bpq2.js")).RepairCommand,
48
+ workflow: async () => (await import("./workflow.command-fpwqth4w.js")).WorkflowCommand,
49
+ pipeline: async () => (await import("./pipeline.command-9htjbrdm.js")).PipelineCommand,
50
+ tunnel: async () => (await import("./tunnel.command-pswe6nye.js")).TunnelCommand
51
51
  };
52
52
  var commandModuleIds = Object.keys(commandModules);
53
53
 
@@ -1,8 +1,8 @@
1
1
  // @bun
2
2
  import {
3
3
  LibExecutor2
4
- } from "./index-yey1envc.js";
5
- import"./index-v16gj2as.js";
4
+ } from "./index-741xbhes.js";
5
+ import"./index-ys1sjp6m.js";
6
6
  import"./index-j4yvgfhr.js";
7
7
  import"./index-zyjztrvc.js";
8
8
  export {
@@ -3,17 +3,17 @@ import {
3
3
  Lib,
4
4
  Workspace,
5
5
  command
6
- } from "./index-nnmw56fz.js";
6
+ } from "./index-mv3ke0fc.js";
7
7
  import"./index-j4yvgfhr.js";
8
- import"./index-v16gj2as.js";
8
+ import"./index-ys1sjp6m.js";
9
9
  import"./index-zyjztrvc.js";
10
- import"./index-9a9t77hz.js";
11
- import"./index-yey1envc.js";
12
- import"./index-crd99zqs.js";
10
+ import"./index-77627y32.js";
11
+ import"./index-741xbhes.js";
12
+ import"./index-wzvvqkcy.js";
13
13
  import {
14
14
  LibraryScript
15
- } from "./index-4r8dgm4x.js";
16
- import"./index-3r1crbct.js";
15
+ } from "./index-8javbznc.js";
16
+ import"./index-ay4vkwr8.js";
17
17
 
18
18
  // pkgs/@akanjs/cli/library/library.command.ts
19
19
  class LibraryCommand extends command("library", [LibraryScript], ({ public: target }) => ({
@@ -4,43 +4,44 @@ import {
4
4
  runner,
5
5
  script,
6
6
  command
7
- } from "./index-nnmw56fz.js";
7
+ } from "./index-mv3ke0fc.js";
8
8
  import"./index-j4yvgfhr.js";
9
9
  import {
10
10
  parseEnvFile
11
- } from "./index-v16gj2as.js";
11
+ } from "./index-ys1sjp6m.js";
12
12
  import"./index-zyjztrvc.js";
13
- import"./index-9a9t77hz.js";
14
- import"./index-yey1envc.js";
13
+ import"./index-77627y32.js";
14
+ import"./index-741xbhes.js";
15
15
  import {
16
16
  PkgExecutor2
17
- } from "./index-crd99zqs.js";
17
+ } from "./index-wzvvqkcy.js";
18
18
  import {
19
19
  npmRegistryFromEnv,
20
20
  warnIgnoredNpmRegistry,
21
21
  getNpmRegistryUrl
22
22
  } from "./index-jf4vk1s0.js";
23
- import"./index-8bta5pnr.js";
24
- import"./index-fjqapyex.js";
25
- import"./index-f4jydw2x.js";
23
+ import"./index-serpfvat.js";
24
+ import"./index-es2wkn41.js";
25
+ import"./index-gdgbgn82.js";
26
26
  import"./index-m9jj544v.js";
27
- import"./index-4r8dgm4x.js";
28
- import"./index-wkwe91sn.js";
27
+ import"./index-kqxs1d7z.js";
28
+ import"./index-8javbznc.js";
29
+ import"./index-th7qbjfz.js";
29
30
  import"./index-rwgqba9p.js";
30
31
  import {
31
32
  ApplicationScript
32
- } from "./index-3zkhg65e.js";
33
- import"./index-pyjkbg8e.js";
33
+ } from "./index-c4g8egm2.js";
34
+ import"./index-extg77rx.js";
34
35
  import {
35
36
  CloudRunner
36
- } from "./index-cbm9gzgx.js";
37
- import"./index-se7n78fh.js";
37
+ } from "./index-pa53zktp.js";
38
+ import"./index-54g085ty.js";
38
39
  import {
39
40
  PackageScript
40
- } from "./index-hxg6ctk2.js";
41
- import"./index-rt7q20sj.js";
41
+ } from "./index-a2a3nh57.js";
42
+ import"./index-5sa1tr7w.js";
42
43
  import"./index-9bv479q5.js";
43
- import"./index-3r1crbct.js";
44
+ import"./index-ay4vkwr8.js";
44
45
 
45
46
  // pkgs/@akanjs/cli/localRegistry/localRegistry.runner.ts
46
47
  import { mkdir, rm } from "fs/promises";
@@ -4,22 +4,22 @@ import {
4
4
  Module,
5
5
  ModuleOrService,
6
6
  command
7
- } from "./index-nnmw56fz.js";
7
+ } from "./index-mv3ke0fc.js";
8
8
  import"./index-j4yvgfhr.js";
9
- import"./index-v16gj2as.js";
9
+ import"./index-ys1sjp6m.js";
10
10
  import"./index-zyjztrvc.js";
11
- import"./index-9a9t77hz.js";
12
- import"./index-yey1envc.js";
13
- import"./index-crd99zqs.js";
11
+ import"./index-77627y32.js";
12
+ import"./index-741xbhes.js";
13
+ import"./index-wzvvqkcy.js";
14
14
  import {
15
15
  renderPrimitiveReport
16
- } from "./index-q63nbpv7.js";
16
+ } from "./index-0zkxsdsg.js";
17
17
  import"./index-trffs83s.js";
18
- import"./index-9gjcbp2g.js";
18
+ import"./index-c8kj74zz.js";
19
19
  import {
20
20
  ModuleScript
21
- } from "./index-rdcgz02t.js";
22
- import"./index-3r1crbct.js";
21
+ } from "./index-bma8tmgb.js";
22
+ import"./index-ay4vkwr8.js";
23
23
 
24
24
  // pkgs/@akanjs/cli/module/module.command.ts
25
25
  import { Logger, lowerlize } from "akanjs/common";