@akanjs/cli 3.3.0-rc.12 → 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 (91) 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/conventions/rules/config.md +5 -0
  20. package/guidelines/conventions/rules/page.md +3 -0
  21. package/guidelines/errorCodes/errorCodes.instruction.md +4 -0
  22. package/guidelines/pageRule/pageRule.instruction.md +19 -0
  23. package/guidelines/runtimeRule/runtimeRule.instruction.md +109 -6
  24. package/incrementalBuilder.proc.js +8 -8
  25. package/{index-3mj5trqc.js → index-0bzrcv91.js} +1 -1
  26. package/{index-q63nbpv7.js → index-0zkxsdsg.js} +3 -3
  27. package/{index-wxqp1amd.js → index-1c52g4st.js} +11 -9
  28. package/{index-vnk1qwgr.js → index-22h6vq3f.js} +4 -4
  29. package/index-35p43f33.js +16 -0
  30. package/{index-fagjtk6m.js → index-3q7ectss.js} +2 -2
  31. package/{index-se7n78fh.js → index-54g085ty.js} +1 -1
  32. package/{index-rt7q20sj.js → index-5sa1tr7w.js} +1 -1
  33. package/{index-h8w1n11r.js → index-6a3rmwxx.js} +4 -4
  34. package/{index-yey1envc.js → index-741xbhes.js} +1 -1
  35. package/{index-9a9t77hz.js → index-77627y32.js} +2 -2
  36. package/{index-4r8dgm4x.js → index-8javbznc.js} +3 -3
  37. package/{index-hxg6ctk2.js → index-a2a3nh57.js} +3 -3
  38. package/{index-j2wq064m.js → index-aezpcphy.js} +121 -15
  39. package/{index-3r1crbct.js → index-ay4vkwr8.js} +1 -1
  40. package/{index-t23dgyaf.js → index-b4m7bjbx.js} +7 -7
  41. package/{index-rdcgz02t.js → index-bma8tmgb.js} +4 -4
  42. package/{index-3zkhg65e.js → index-c4g8egm2.js} +40 -13
  43. package/{index-9gjcbp2g.js → index-c8kj74zz.js} +1 -1
  44. package/{index-fjqapyex.js → index-es2wkn41.js} +40 -5
  45. package/{index-pyjkbg8e.js → index-extg77rx.js} +2 -2
  46. package/{index-nmdmkjt2.js → index-fey1dd49.js} +4 -4
  47. package/{index-c669pbyb.js → index-fjzeak0t.js} +68 -37
  48. package/{index-f4jydw2x.js → index-gdgbgn82.js} +1 -1
  49. package/{index-4yvtqcme.js → index-gyyscjzx.js} +16 -4
  50. package/{index-qecrqpt6.js → index-hxcefw29.js} +1 -1
  51. package/{index-a4gcdffy.js → index-k380ww64.js} +3 -3
  52. package/index-kqxs1d7z.js +377 -0
  53. package/{index-nnmw56fz.js → index-mv3ke0fc.js} +5 -5
  54. package/{index-m303nhv6.js → index-mvdmb73w.js} +6 -6
  55. package/{index-cbm9gzgx.js → index-pa53zktp.js} +5 -5
  56. package/{index-3a3vy2xy.js → index-psvxwemh.js} +8 -8
  57. package/{index-ckcc9ab3.js → index-r24mj2pw.js} +8 -8
  58. package/{index-8bta5pnr.js → index-serpfvat.js} +2 -2
  59. package/{index-kbnvyhy4.js → index-shjjjdte.js} +3 -3
  60. package/{index-pr9nypg7.js → index-sjmk7wp7.js} +2 -2
  61. package/{index-wkwe91sn.js → index-th7qbjfz.js} +11 -11
  62. package/{index-5ahe641t.js → index-vgd07z61.js} +8 -8
  63. package/{index-crd99zqs.js → index-wzvvqkcy.js} +1 -1
  64. package/{index-v16gj2as.js → index-ys1sjp6m.js} +90 -51
  65. package/{index-22bwg8hy.js → index-zc43cyg8.js} +1 -1
  66. package/index.js +27 -27
  67. package/{libExecutor-n8hpm8s7.js → libExecutor-mqxnn0h6.js} +2 -2
  68. package/{library.command-8abb26pg.js → library.command-4kefxh8z.js} +7 -7
  69. package/{localRegistry.command-sa211m1z.js → localRegistry.command-phgrhkks.js} +18 -17
  70. package/{module.command-z3cwjf0p.js → module.command-8476gwze.js} +9 -9
  71. package/{package.command-akynhtee.js → package.command-ygxm5pp9.js} +8 -8
  72. package/package.json +2 -2
  73. package/{page.command-3fpdavk9.js → page.command-f7fwkj8y.js} +7 -7
  74. package/{pipeline.command-ca95n8rd.js → pipeline.command-9htjbrdm.js} +6 -6
  75. package/{pkgExecutor-a73q41vx.js → pkgExecutor-6a91xng5.js} +2 -2
  76. package/{primitive.command-xwe9ggnf.js → primitive.command-0k0h0cm0.js} +10 -10
  77. package/{projectTypecheck-7g542ymk.js → projectTypecheck-7kakbacs.js} +1 -1
  78. package/{quality.command-7wz7y8z1.js → quality.command-frsfdfc5.js} +9 -8
  79. package/{repair.command-dej1qtfq.js → repair.command-yag3bpq2.js} +9 -9
  80. package/{scalar.command-z9qfxnvm.js → scalar.command-qtyrywvt.js} +8 -8
  81. package/skills/akan-runtime/SKILL.md +20 -0
  82. package/{subspace.command-9wekm4gn.js → subspace.command-kr53abzt.js} +10 -10
  83. package/{tunnel.command-cxc4h3j8.js → tunnel.command-pswe6nye.js} +9 -9
  84. package/{typeChecker-7jt6abrs.js → typeChecker-epg7ebfy.js} +2 -1
  85. package/typecheck.proc.js +2 -1
  86. package/{verify.command-j0w9dr5c.js → verify.command-ghhhzgrw.js} +15 -14
  87. package/{workflow.command-yt4sz04b.js → workflow.command-fpwqth4w.js} +14 -14
  88. package/{workspace.command-8mp4mcp2.js → workspace.command-6bbmtn3w.js} +33 -31
  89. package/TunnelShare-0p4dy89e.js +0 -16
  90. package/cloud.script-0dsyd10v.js +0 -30
  91. package/context.runner-yyp7a112.js +0 -32
package/.build-stamp CHANGED
@@ -1,2 +1,2 @@
1
- fe2b1ec6e46be41a3fcddc26ae1d606607135418af33f89dec14b82ce61a6fc9
2
- 94aaa09f-82a1-4735-9985-542e6b279b8b
1
+ 0938aba0e9bb3a2e1fd03d5d47510151b733d483380b0021295501513ad5d132
2
+ c84421e5-0bf1-45e1-b5eb-01715a808be1
@@ -1,8 +1,8 @@
1
1
  // @bun
2
2
  import {
3
3
  CodeAgent2
4
- } from "./index-a4gcdffy.js";
5
- import"./index-22bwg8hy.js";
4
+ } from "./index-k380ww64.js";
5
+ import"./index-zc43cyg8.js";
6
6
  import"./index-rwgqba9p.js";
7
7
  import"./index-xv3pvdw4.js";
8
8
  import"./index-zyjztrvc.js";
@@ -4,7 +4,7 @@ import {
4
4
  McpTokenStore,
5
5
  McpSignIn,
6
6
  AkanCodeCompaction2
7
- } from "./index-22bwg8hy.js";
7
+ } from "./index-zc43cyg8.js";
8
8
  import"./index-zyjztrvc.js";
9
9
  import"./index-xv3pvdw4.js";
10
10
  import {
@@ -0,0 +1,16 @@
1
+ // @bun
2
+ import {
3
+ TunnelShare2
4
+ } from "./index-hxcefw29.js";
5
+ import"./index-extg77rx.js";
6
+ import"./index-es2wkn41.js";
7
+ import"./index-m9jj544v.js";
8
+ import"./index-77627y32.js";
9
+ import"./index-741xbhes.js";
10
+ import"./index-wzvvqkcy.js";
11
+ import"./index-ys1sjp6m.js";
12
+ import"./index-j4yvgfhr.js";
13
+ import"./index-zyjztrvc.js";
14
+ export {
15
+ TunnelShare2 as TunnelShare
16
+ };
@@ -2,36 +2,37 @@
2
2
  import {
3
3
  Workspace,
4
4
  command
5
- } from "./index-nnmw56fz.js";
5
+ } from "./index-mv3ke0fc.js";
6
6
  import"./index-j4yvgfhr.js";
7
- import"./index-v16gj2as.js";
7
+ import"./index-ys1sjp6m.js";
8
8
  import"./index-zyjztrvc.js";
9
- import"./index-9a9t77hz.js";
10
- import"./index-yey1envc.js";
11
- import"./index-crd99zqs.js";
12
- import"./index-q63nbpv7.js";
9
+ import"./index-77627y32.js";
10
+ import"./index-741xbhes.js";
11
+ import"./index-wzvvqkcy.js";
12
+ import"./index-0zkxsdsg.js";
13
13
  import"./index-trffs83s.js";
14
- import"./index-h8w1n11r.js";
14
+ import"./index-6a3rmwxx.js";
15
15
  import"./index-1p81ecbz.js";
16
16
  import"./index-xv3pvdw4.js";
17
17
  import"./index-j3fqs8rc.js";
18
- import"./index-wkwe91sn.js";
19
- import"./index-8bta5pnr.js";
20
- import"./index-fjqapyex.js";
21
- import"./index-f4jydw2x.js";
18
+ import"./index-th7qbjfz.js";
19
+ import"./index-serpfvat.js";
20
+ import"./index-es2wkn41.js";
21
+ import"./index-gdgbgn82.js";
22
22
  import"./index-m9jj544v.js";
23
- import"./index-j2wq064m.js";
24
- import"./index-se7n78fh.js";
23
+ import"./index-aezpcphy.js";
24
+ import"./index-54g085ty.js";
25
25
  import"./index-62md4dwy.js";
26
+ import"./index-35p43f33.js";
26
27
  import"./index-zyb0ebm4.js";
27
28
  import"./index-jf4vk1s0.js";
28
29
  import"./index-t4d0ckde.js";
29
- import"./index-wxqp1amd.js";
30
+ import"./index-1c52g4st.js";
30
31
  import {
31
32
  AgentScript
32
- } from "./index-ckcc9ab3.js";
33
- import"./index-rt7q20sj.js";
34
- import"./index-3r1crbct.js";
33
+ } from "./index-r24mj2pw.js";
34
+ import"./index-5sa1tr7w.js";
35
+ import"./index-ay4vkwr8.js";
35
36
 
36
37
  // pkgs/@akanjs/cli/agent/agent.command.ts
37
38
  class AgentCommand extends command("agent", [AgentScript], ({ public: target }) => ({
package/akanCode.js CHANGED
@@ -34,7 +34,7 @@ import {
34
34
  CodeMailbox2,
35
35
  CodeSessionFork2,
36
36
  CodeAgent2
37
- } from "./index-a4gcdffy.js";
37
+ } from "./index-k380ww64.js";
38
38
  import {
39
39
  akanCodeDefaultModel2,
40
40
  akanCodeModel2,
@@ -45,7 +45,7 @@ import {
45
45
  import {
46
46
  SubagentPool2,
47
47
  AkanCodeCompaction2
48
- } from "./index-22bwg8hy.js";
48
+ } from "./index-zc43cyg8.js";
49
49
  import {
50
50
  CodeAgentRpcHost2
51
51
  } from "./index-sxbsrndq.js";
@@ -1,9 +1,9 @@
1
1
  // @bun
2
2
  import {
3
3
  AppExecutor2
4
- } from "./index-9a9t77hz.js";
5
- import"./index-yey1envc.js";
6
- import"./index-v16gj2as.js";
4
+ } from "./index-77627y32.js";
5
+ import"./index-741xbhes.js";
6
+ import"./index-ys1sjp6m.js";
7
7
  import"./index-j4yvgfhr.js";
8
8
  import"./index-zyjztrvc.js";
9
9
  export {
@@ -1,12 +1,12 @@
1
1
  // @bun
2
2
  import"./index-zyjztrvc.js";
3
- import"./index-v16gj2as.js";
3
+ import"./index-ys1sjp6m.js";
4
4
  import {
5
5
  CliError
6
6
  } from "./index-j4yvgfhr.js";
7
7
  import {
8
8
  RouteJsBudget
9
- } from "./index-8bta5pnr.js";
9
+ } from "./index-serpfvat.js";
10
10
  import {
11
11
  App,
12
12
  Apps,
@@ -15,19 +15,22 @@ import {
15
15
  Exec,
16
16
  Workspace,
17
17
  command
18
- } from "./index-nnmw56fz.js";
19
- import"./index-9a9t77hz.js";
20
- import"./index-yey1envc.js";
21
- import"./index-crd99zqs.js";
22
- import"./index-fjqapyex.js";
23
- import"./index-f4jydw2x.js";
18
+ } from "./index-mv3ke0fc.js";
19
+ import"./index-77627y32.js";
20
+ import"./index-741xbhes.js";
21
+ import"./index-wzvvqkcy.js";
22
+ import {
23
+ SecretEnvFile
24
+ } from "./index-kqxs1d7z.js";
25
+ import"./index-es2wkn41.js";
26
+ import"./index-gdgbgn82.js";
24
27
  import"./index-m9jj544v.js";
25
- import"./index-4r8dgm4x.js";
26
- import"./index-wkwe91sn.js";
28
+ import"./index-8javbznc.js";
29
+ import"./index-th7qbjfz.js";
27
30
  import"./index-rwgqba9p.js";
28
31
  import {
29
32
  ApplicationScript
30
- } from "./index-3zkhg65e.js";
33
+ } from "./index-c4g8egm2.js";
31
34
  import {
32
35
  writeOption,
33
36
  nativeTargetOption,
@@ -35,9 +38,9 @@ import {
35
38
  allowLocalOption,
36
39
  publicEnvOption
37
40
  } from "./index-mdjc93e1.js";
38
- import"./index-rt7q20sj.js";
41
+ import"./index-5sa1tr7w.js";
39
42
  import"./index-9bv479q5.js";
40
- import"./index-3r1crbct.js";
43
+ import"./index-ay4vkwr8.js";
41
44
 
42
45
  // pkgs/@akanjs/cli/application/application.command.ts
43
46
  import { MigrationCommand } from "akanjs/server/migration/migrationCommand";
@@ -213,14 +216,41 @@ var buildAndTestTargets = ({ public: target }) => ({
213
216
  enum: devEnvs,
214
217
  desc: "environment the server runs in (default: AKAN_PUBLIC_ENV of the shell, else of the workspace .env)",
215
218
  nullable: true
216
- }).option("checkBudget", Boolean, { desc: checkBudgetDesc, default: false }).option("updateBudget", Boolean, { desc: "write akan.budget.json, never raising an entry", default: false }).option("raiseBudget", Boolean, { desc: "rewrite akan.budget.json at each route's measured JS", default: false }).exec(async function(app, write, fast, quiet, profile, env, checkBudget, updateBudget, raiseBudget) {
219
+ }).option("checkBudget", Boolean, { desc: checkBudgetDesc, default: false }).option("updateBudget", Boolean, { desc: "write akan.budget.json, never raising an entry", default: false }).option("raiseBudget", Boolean, { desc: "rewrite akan.budget.json at each route's measured JS", default: false }).option("inlineSecrets", Boolean, {
220
+ desc: "keep the server env's secret values in the build, as before 3.4.0, for a deployment that does not set them yet (3.5.0 removes this)",
221
+ default: false
222
+ }).exec(async function(app, write, fast, quiet, profile, env, checkBudget, updateBudget, raiseBudget, inlineSecrets) {
217
223
  await this.applicationScript.build(app, {
218
224
  write,
219
225
  fast,
220
226
  quiet,
221
227
  profile: profile ?? undefined,
222
228
  env: env ?? undefined,
223
- budget: RouteJsBudget.modeOf({ checkBudget, updateBudget, raiseBudget })
229
+ budget: RouteJsBudget.modeOf({ checkBudget, updateBudget, raiseBudget }),
230
+ inlineSecrets
231
+ });
232
+ }),
233
+ secretEnv: target({
234
+ desc: "List the environment variables a build of the app reads its server env secrets from, or write them to a file for its deployment",
235
+ readOnly: ({ out }) => !out
236
+ }).with(App).option("env", String, {
237
+ enum: devEnvs,
238
+ desc: "environment whose server env is read (default: AKAN_PUBLIC_ENV of the shell, else of the workspace .env)",
239
+ nullable: true
240
+ }).option("out", String, {
241
+ desc: "write the values from the env file to this path, for this user alone to read; without it only names print",
242
+ nullable: true
243
+ }).option("format", String, {
244
+ enum: SecretEnvFile.formats,
245
+ desc: "--out as a Kubernetes Secret manifest (k8s) or as NAME=value lines (dotenv)",
246
+ default: "k8s"
247
+ }).option("name", String, { desc: "metadata.name of the k8s Secret (default: <app>-env)", nullable: true }).option("force", Boolean, { flag: "F", desc: "replace the --out file when it exists", default: false }).exec(async function(app, env, out, format, name, force) {
248
+ await this.applicationScript.secretEnv(app, {
249
+ env: env ?? undefined,
250
+ out: out ?? undefined,
251
+ format,
252
+ name: name ?? undefined,
253
+ force
224
254
  });
225
255
  }),
226
256
  typecheck: target({
@@ -4,36 +4,45 @@ import {
4
4
  Spinner,
5
5
  parseEnvFile,
6
6
  WorkspaceExecutor,
7
+ ServerEnvEvaluationError,
7
8
  ServerEnvProfile
8
- } from "./index-v16gj2as.js";
9
+ } from "./index-ys1sjp6m.js";
9
10
  import"./index-zyjztrvc.js";
10
11
  import"./index-j4yvgfhr.js";
11
- import"./index-9a9t77hz.js";
12
- import"./index-yey1envc.js";
13
- import"./index-crd99zqs.js";
12
+ import"./index-77627y32.js";
13
+ import"./index-741xbhes.js";
14
+ import"./index-wzvvqkcy.js";
14
15
  import {
15
16
  NARROWABLE_VENDOR_SPECIFIERS
16
- } from "./index-4yvtqcme.js";
17
+ } from "./index-gyyscjzx.js";
17
18
  import {
18
19
  FontPruner,
19
20
  precompressArtifacts,
20
21
  RouteJsBudget
21
- } from "./index-8bta5pnr.js";
22
- import"./index-3mj5trqc.js";
22
+ } from "./index-serpfvat.js";
23
+ import"./index-0bzrcv91.js";
23
24
  import {
24
25
  AllRoutesBuilder,
25
26
  SsrBaseArtifactBuilder,
26
27
  VendorImportScanner
27
- } from "./index-nmdmkjt2.js";
28
+ } from "./index-fey1dd49.js";
28
29
  import {
29
30
  CsrArtifactBuilder2
30
- } from "./index-pr9nypg7.js";
31
+ } from "./index-sjmk7wp7.js";
31
32
  import"./index-62md4dwy.js";
33
+ import {
34
+ ServerBundleSecrets
35
+ } from "./index-es2wkn41.js";
36
+ import {
37
+ SecretEnvDeclaration,
38
+ SecretEnvFile
39
+ } from "./index-kqxs1d7z.js";
32
40
 
33
41
  // pkgs/@akanjs/devkit/app/applicationBuildRunner.ts
34
42
  import path3 from "path";
35
43
  import { toError } from "akanjs/common";
36
44
  import { BUILD_ENV_FILE } from "akanjs/server/lifecycle/buildEnv";
45
+ import { SecretEnv } from "akanjs/server/lifecycle/secretEnv";
37
46
 
38
47
  // pkgs/@akanjs/devkit/akanConfig/productionLockfile.ts
39
48
  import { mkdtemp, rm } from "fs/promises";
@@ -78,7 +87,8 @@ var createServerEnvPlugin = ({
78
87
  environment,
79
88
  environments,
80
89
  profile,
81
- onLibEnv
90
+ onLibEnv,
91
+ secrets
82
92
  }) => {
83
93
  const others = [...new Set(environments)].filter((name) => name !== environment);
84
94
  const dirs = new Set([path2.resolve(envDir), existsSync(envDir) ? realpathSync.native(envDir) : envDir]);
@@ -114,6 +124,8 @@ var createServerEnvPlugin = ({
114
124
  `)
115
125
  };
116
126
  });
127
+ if (secrets && !profile)
128
+ build.onLoad({ filter: ServerEnvProfile.envModulePattern }, (args) => SecretEnvDeclaration.source(args.path, secrets));
117
129
  if (profile)
118
130
  build.onLoad({ filter: ServerEnvProfile.envFilePattern }, async (args) => {
119
131
  const name = path2.basename(args.path, ".ts").slice("env.server.".length);
@@ -160,6 +172,8 @@ class ApplicationBuildRunner {
160
172
  #reporter;
161
173
  #environment;
162
174
  #profile;
175
+ #secretEnv;
176
+ #secrets = { variables: [], unmoved: [], moved: [] };
163
177
  #budget;
164
178
  #modulesByRoute;
165
179
  #spinner;
@@ -171,6 +185,7 @@ class ApplicationBuildRunner {
171
185
  reporter,
172
186
  environment,
173
187
  profile,
188
+ secretEnv,
174
189
  budget = "report"
175
190
  } = {}) {
176
191
  this.#app = app;
@@ -179,6 +194,7 @@ class ApplicationBuildRunner {
179
194
  this.#reporter = reporter;
180
195
  this.#environment = environment;
181
196
  this.#profile = profile;
197
+ this.#secretEnv = profile ? undefined : secretEnv;
182
198
  this.#budget = budget;
183
199
  }
184
200
  get #envDir() {
@@ -210,6 +226,8 @@ class ApplicationBuildRunner {
210
226
  this.#pinImageEnv(baseDevEnv, environment);
211
227
  if (this.#profile)
212
228
  await ServerEnvProfile.assertShippable({ envDir: this.#envDir, environment, profile: this.#profile });
229
+ if (this.#secretEnv)
230
+ await this.#declareSecrets(environment);
213
231
  await this.#runPhase("prepare", "Preparing output directory", () => this.#app.prepareCommand("build"));
214
232
  if (!this.#fast)
215
233
  await this.#runPhase("typecheck", "Typechecking", () => this.typecheck());
@@ -224,9 +242,44 @@ class ApplicationBuildRunner {
224
242
  await this.#runPhase("assets", "Trimming unread static assets", async () => assets.pruneFonts ? await new FontPruner(this.#app, assets).prune() : null, (result) => result ? `${result.removed.length} font file(s) dropped, ${ApplicationBuildRunner.formatBytes(result.freedBytes)} freed; ${result.kept.length} kept` : "disabled by akan.config.ts assets.pruneFonts");
225
243
  await this.#runPhase("compress", "Compressing static assets", () => precompressArtifacts(this.#app), (result) => result.files > 0 ? `${result.files} files, ${ApplicationBuildRunner.formatBytes(result.inputBytes)} -> gzip ${ApplicationBuildRunner.formatBytes(result.outputBytes)} / br ${ApplicationBuildRunner.formatBytes(result.brotliBytes)}` : "no files");
226
244
  const routeJs = await this.#runBudgetPhase(environment);
245
+ await this.assertSecretsLeftOut();
227
246
  await this.#runPhase("metadata", "Writing production metadata", () => this.buildAppMeta());
247
+ this.#reportSecretEnv(environment);
228
248
  return this.#resultOf(environment, routeJs);
229
249
  }
250
+ async#declareSecrets(environment) {
251
+ try {
252
+ this.#secrets = await SecretEnvDeclaration.of(this.#envDir, environment);
253
+ } catch (error) {
254
+ if (!(error instanceof ServerEnvEvaluationError))
255
+ throw error;
256
+ if (this.#secretEnv === "read")
257
+ throw new Error(`${error.message}
258
+ A build leaves the secret values of the server env out of what it writes, and names the variables the server reads them from by loading the env file: with no variable of this shell first, then with them. Make the file load at that line, by setting the variable it reads there in this shell or giving it a fallback, and build again. \`akan build --inline-secrets\` builds with the env files as written until akanjs 3.5.0 removes it.`);
259
+ this.#app.logger.warn(`--inline-secrets: ${error.message}. The secret values of the server env could not be listed, so this build holds the env files as written: the server reads no secret from a variable of its process env, and names none at boot.`);
260
+ this.#secretEnv = undefined;
261
+ }
262
+ if (this.#secretEnv === "read" && this.#secrets.unmoved.length)
263
+ throw new Error(SecretEnvFile.unmovedStop(this.#app.name, environment, path3.relative(this.#app.workspace.workspaceRoot, path3.join(this.#envDir, "env.server.ts")).replaceAll("\\", "/"), this.#secrets.unmoved));
264
+ }
265
+ async assertSecretsLeftOut() {
266
+ if (this.#secretEnv !== "read" || !this.#secrets.moved.length)
267
+ return;
268
+ const { workspaceRoot } = this.#app.workspace;
269
+ const note = await new ServerBundleSecrets(workspaceRoot, this.#app.cwdPath).assertImageClean(this.#app.dist.cwdPath, this.#secrets.moved);
270
+ if (note)
271
+ this.#app.logger.warn(note);
272
+ }
273
+ #reportSecretEnv(environment) {
274
+ const { variables } = this.#secrets;
275
+ const { logger, name } = this.#app;
276
+ const names = variables.map((variable) => variable.name).join(", ");
277
+ const count = `${variables.length} secret value${variables.length === 1 ? "" : "s"}`;
278
+ if (variables.length && this.#secretEnv === "inline")
279
+ logger.warn(`--inline-secrets keeps ${count} of the server env in this build, where whoever can read the image reads them: ${names}. A variable the deployment sets still wins over the built-in value. akanjs 3.5.0 removes the flag: set them where the server is deployed and build without it.`);
280
+ else if (variables.length)
281
+ logger.info(`The server reads ${count} from its process env when it starts, not from this build: ${names}. Set them where it is deployed; \`akan secret-env ${name} --env ${environment}\` lists them and writes them from the env file.`);
282
+ }
230
283
  #runBudgetPhase(environment) {
231
284
  return this.#runPhase("budget", "Measuring route JS", () => this.#measureRouteJs(environment), (result) => result?.summary ?? (this.#budget === "off" ? "off for this build" : "no server pages"));
232
285
  }
@@ -281,10 +334,11 @@ class ApplicationBuildRunner {
281
334
  const environment = this.#environment ?? akanConfig.baseDevEnv.env;
282
335
  const packageJson = akanConfig.getProductionPackageJson();
283
336
  const lockfile = await this.#pruneLockfile(packageJson);
284
- const dockerfile = akanConfig.dockerfileFor(environment, { lockfile: lockfile !== null });
337
+ const env = { ...akanConfig.getProductionEnv(environment), ...this.#secretEnvList() };
338
+ const dockerfile = akanConfig.dockerfileFor(environment, { lockfile: lockfile !== null, env });
285
339
  await Promise.all([
286
340
  this.#app.dist.writeJson("package.json", packageJson),
287
- this.#app.dist.writeJson(BUILD_ENV_FILE, akanConfig.getProductionEnv(environment)),
341
+ this.#app.dist.writeJson(BUILD_ENV_FILE, env),
288
342
  ...lockfile !== null ? [this.#app.dist.writeFile(`${this.#app.dist.cwdPath}/${ProductionLockfile.fileName}`, lockfile)] : [],
289
343
  this.#app.dist.writeFile(`${this.#app.dist.cwdPath}/Dockerfile`, dockerfile),
290
344
  this.#app.dist.writeJson("akan.build.json", {
@@ -294,6 +348,14 @@ class ApplicationBuildRunner {
294
348
  })
295
349
  ]);
296
350
  }
351
+ #secretEnvList() {
352
+ if (!this.#secrets.variables.length)
353
+ return {};
354
+ return {
355
+ [SecretEnv.listKey]: SecretEnv.format(this.#secrets.variables),
356
+ ...this.#secretEnv === "inline" ? { [SecretEnv.fallbackKey]: "image" } : {}
357
+ };
358
+ }
297
359
  async#pruneLockfile(packageJson) {
298
360
  try {
299
361
  return await ProductionLockfile.prune(this.#app.workspace.workspaceRoot, packageJson);
@@ -325,6 +387,7 @@ class ApplicationBuildRunner {
325
387
  environment: this.#environment ?? baseEnv,
326
388
  environments: ["local", "testing", ...branches],
327
389
  profile: this.#profile,
390
+ secrets: this.#secretEnv,
328
391
  onLibEnv: (file, { profileFile, stripped }) => {
329
392
  if (profileFile || !stripped.length || this.#warnedLibEnvs.has(file))
330
393
  return;
@@ -2,37 +2,37 @@
2
2
  import"./index-zyjztrvc.js";
3
3
  import {
4
4
  WorkspaceExecutor
5
- } from "./index-v16gj2as.js";
5
+ } from "./index-ys1sjp6m.js";
6
6
  import"./index-j4yvgfhr.js";
7
7
  import {
8
8
  FontOptimizer,
9
9
  ApplicationBuildReporter
10
- } from "./index-8bta5pnr.js";
10
+ } from "./index-serpfvat.js";
11
11
  import {
12
12
  resolveSsrPageEntriesForApp,
13
13
  AppExecutor2
14
- } from "./index-9a9t77hz.js";
14
+ } from "./index-77627y32.js";
15
15
  import {
16
16
  computeRouteSeedIndex,
17
17
  saveRouteSeedIndex,
18
18
  CsrDevBundler,
19
19
  SsrDevBundler
20
- } from "./index-4yvtqcme.js";
21
- import"./index-yey1envc.js";
22
- import"./index-crd99zqs.js";
20
+ } from "./index-gyyscjzx.js";
21
+ import"./index-741xbhes.js";
22
+ import"./index-wzvvqkcy.js";
23
23
  import {
24
24
  ServerGraphFile,
25
25
  PagesBundleBuilder
26
- } from "./index-3mj5trqc.js";
26
+ } from "./index-0bzrcv91.js";
27
27
  import {
28
28
  CssCompiler,
29
29
  SsrBaseArtifactBuilder
30
- } from "./index-nmdmkjt2.js";
30
+ } from "./index-fey1dd49.js";
31
31
  import {
32
32
  CsrArtifactBuilder2
33
- } from "./index-pr9nypg7.js";
33
+ } from "./index-sjmk7wp7.js";
34
34
  import"./index-62md4dwy.js";
35
- import"./index-3r1crbct.js";
35
+ import"./index-ay4vkwr8.js";
36
36
 
37
37
  // pkgs/@akanjs/devkit/incrementalBuilder/buildBatch.proc.ts
38
38
  import path from "path";
@@ -3,34 +3,35 @@ import {
3
3
  App,
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";
13
- import"./index-pyjkbg8e.js";
10
+ import"./index-77627y32.js";
11
+ import"./index-741xbhes.js";
12
+ import"./index-wzvvqkcy.js";
13
+ import"./index-extg77rx.js";
14
14
  import {
15
15
  PlatformTestRun
16
- } from "./index-cbm9gzgx.js";
17
- import"./index-fjqapyex.js";
18
- import"./index-f4jydw2x.js";
16
+ } from "./index-pa53zktp.js";
17
+ import"./index-es2wkn41.js";
18
+ import"./index-gdgbgn82.js";
19
19
  import"./index-m9jj544v.js";
20
20
  import {
21
21
  npmRegistryFromEnv,
22
22
  warnIgnoredNpmRegistry
23
23
  } from "./index-jf4vk1s0.js";
24
- import"./index-8bta5pnr.js";
25
- import"./index-4r8dgm4x.js";
26
- import"./index-wkwe91sn.js";
24
+ import"./index-serpfvat.js";
25
+ import"./index-kqxs1d7z.js";
26
+ import"./index-8javbznc.js";
27
+ import"./index-th7qbjfz.js";
27
28
  import"./index-rwgqba9p.js";
28
- import"./index-3zkhg65e.js";
29
- import"./index-se7n78fh.js";
30
- import"./index-hxg6ctk2.js";
29
+ import"./index-c4g8egm2.js";
30
+ import"./index-54g085ty.js";
31
+ import"./index-a2a3nh57.js";
31
32
  import {
32
33
  CloudScript2
33
- } from "./index-t23dgyaf.js";
34
+ } from "./index-b4m7bjbx.js";
34
35
  import {
35
36
  writeOption,
36
37
  oneNativeTargetOption,
@@ -41,9 +42,9 @@ import {
41
42
  hostOption,
42
43
  subspaceOption
43
44
  } from "./index-mdjc93e1.js";
44
- import"./index-rt7q20sj.js";
45
+ import"./index-5sa1tr7w.js";
45
46
  import"./index-9bv479q5.js";
46
- import"./index-3r1crbct.js";
47
+ import"./index-ay4vkwr8.js";
47
48
 
48
49
  // pkgs/@akanjs/cli/cloud/cloud.command.ts
49
50
  var localRegistryUrl = () => npmRegistryFromEnv() ?? "http://127.0.0.1:4873";
@@ -0,0 +1,31 @@
1
+ // @bun
2
+ import {
3
+ CloudScript2
4
+ } from "./index-b4m7bjbx.js";
5
+ import"./index-pa53zktp.js";
6
+ import"./index-a2a3nh57.js";
7
+ import"./index-c4g8egm2.js";
8
+ import"./index-8javbznc.js";
9
+ import"./index-extg77rx.js";
10
+ import"./index-jf4vk1s0.js";
11
+ import"./index-54g085ty.js";
12
+ import"./index-th7qbjfz.js";
13
+ import"./index-5sa1tr7w.js";
14
+ import"./index-gdgbgn82.js";
15
+ import"./index-es2wkn41.js";
16
+ import"./index-m9jj544v.js";
17
+ import"./index-kqxs1d7z.js";
18
+ import"./index-mv3ke0fc.js";
19
+ import"./index-9bv479q5.js";
20
+ import"./index-rwgqba9p.js";
21
+ import"./index-serpfvat.js";
22
+ import"./index-ay4vkwr8.js";
23
+ import"./index-77627y32.js";
24
+ import"./index-741xbhes.js";
25
+ import"./index-wzvvqkcy.js";
26
+ import"./index-ys1sjp6m.js";
27
+ import"./index-j4yvgfhr.js";
28
+ import"./index-zyjztrvc.js";
29
+ export {
30
+ CloudScript2 as CloudScript
31
+ };
@@ -4,13 +4,13 @@ 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
- 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
  AkanCodeEnv,
16
16
  akanCodePaths2
@@ -20,7 +20,7 @@ import {
20
20
  CodeAgentStreamPrinter2,
21
21
  WorkspaceTrust
22
22
  } from "./index-7ssr7wq4.js";
23
- import"./index-3r1crbct.js";
23
+ import"./index-ay4vkwr8.js";
24
24
 
25
25
  // pkgs/@akanjs/cli/code/code.runner.ts
26
26
  import { randomBytes } from "crypto";
@@ -82,7 +82,7 @@ class CodeRunner extends runner("code") {
82
82
  async serve(options, listen) {
83
83
  await import("./consoleToStderr-h5bryj94.js");
84
84
  const [{ CodeAgent }, { CodeAgentRpcHost }, { CodeAgentRpcListener }] = await Promise.all([
85
- import("./CodeAgent-cqbf9gsv.js"),
85
+ import("./CodeAgent-zkr3s3xy.js"),
86
86
  import("./CodeAgentRpcHost-pwps2d67.js"),
87
87
  import("./CodeAgentRpcListener-tcwrdvst.js")
88
88
  ]);
@@ -116,8 +116,8 @@ class CodeRunner extends runner("code") {
116
116
  }
117
117
  async tui(options, seed) {
118
118
  const [{ CodeAgent }, { CodeTui }] = await Promise.all([
119
- import("./CodeAgent-cqbf9gsv.js"),
120
- import("./CodeTui-ehdr4hgw.js")
119
+ import("./CodeAgent-zkr3s3xy.js"),
120
+ import("./CodeTui-1qvrzfmy.js")
121
121
  ]);
122
122
  const start = await CodeRunner.#start(options, { hostAttached: false, interactive: true, ask: true });
123
123
  const agentOptions = start.agent;
@@ -153,7 +153,7 @@ class CodeRunner extends runner("code") {
153
153
  }
154
154
  }
155
155
  async run(prompt, options) {
156
- const { CodeAgent } = await import("./CodeAgent-cqbf9gsv.js");
156
+ const { CodeAgent } = await import("./CodeAgent-zkr3s3xy.js");
157
157
  const ask = !!process.stdin.isTTY && !!process.stderr.isTTY;
158
158
  const start = await CodeRunner.#start(options, { hostAttached: false, interactive: false, ask });
159
159
  for (const warning of start.warnings)
@@ -1 +1 @@
1
- {"byCommand":{"create-workspace":"workspace","generate-agent-rules":"workspace","lint":"workspace","lint-all":"workspace","machine-keygen":"workspace","sync-all":"workspace","init":"workspace","agent":"agent","code":"code","create-application":"application","remove-application":"application","plan-slice":"application","sync":"application","script":"application","migrate":"application","create-migration":"application","preview":"application","studio":"application","console":"application","logs":"application","build":"application","b":"application","typecheck":"application","t":"application","test":"application","build-ios":"application","bi":"application","build-android":"application","ba":"application","build-desktop":"application","bd":"application","start":"application","s":"application","start-ios":"application","si":"application","start-android":"application","sa":"application","start-desktop":"application","sd":"application","release-ios":"application","release-android":"application","pack-update":"application","update-keygen":"application","publish-update":"application","dbup":"application","db-export":"application","db-import":"application","dbdown":"application","create-library":"library","remove-library":"library","sync-library":"library","library-status":"library","install-library":"library","start-registry":"localRegistry","reset-registry":"localRegistry","smoke-registry":"localRegistry","version":"package","create-package":"package","remove-package":"package","sync-package":"package","build-package":"package","verify-dist-package":"package","verify-akan-publish-packages":"package","sync-architecture":"package","create-module":"module","remove-module":"module","create-service":"module","create-view":"module","create-unit":"module","create-template":"module","create-crud-page":"page","context":"context","doctor":"context","mcp-install":"context","mcp":"context","mcp-call":"context","login":"cloud","logout":"cloud","deploy-akan":"cloud","test-platforms":"cloud","update":"cloud","push-update":"cloud","register-binary":"cloud","upload-secret":"cloud","list-secrets":"cloud","remove-secret":"cloud","download-env":"cloud","upload-env":"cloud","subspace":"subspace","guideline":"guideline","create-scalar":"scalar","remove-scalar":"scalar","create-ui":"primitive","add-field":"primitive","add-enum-field":"primitive","quality":"quality","verify":"verify","repair":"repair","workflow":"workflow","pipeline":"pipeline","tunnel":"tunnel"}}
1
+ {"byCommand":{"create-workspace":"workspace","generate-agent-rules":"workspace","lint":"workspace","lint-all":"workspace","machine-keygen":"workspace","sync-all":"workspace","init":"workspace","agent":"agent","code":"code","create-application":"application","remove-application":"application","plan-slice":"application","sync":"application","script":"application","migrate":"application","create-migration":"application","preview":"application","studio":"application","console":"application","logs":"application","build":"application","b":"application","secret-env":"application","typecheck":"application","t":"application","test":"application","build-ios":"application","bi":"application","build-android":"application","ba":"application","build-desktop":"application","bd":"application","start":"application","s":"application","start-ios":"application","si":"application","start-android":"application","sa":"application","start-desktop":"application","sd":"application","release-ios":"application","release-android":"application","pack-update":"application","update-keygen":"application","publish-update":"application","dbup":"application","db-export":"application","db-import":"application","dbdown":"application","create-library":"library","remove-library":"library","sync-library":"library","library-status":"library","install-library":"library","start-registry":"localRegistry","reset-registry":"localRegistry","smoke-registry":"localRegistry","version":"package","create-package":"package","remove-package":"package","sync-package":"package","build-package":"package","verify-dist-package":"package","verify-akan-publish-packages":"package","sync-architecture":"package","create-module":"module","remove-module":"module","create-service":"module","create-view":"module","create-unit":"module","create-template":"module","create-crud-page":"page","context":"context","doctor":"context","mcp-install":"context","mcp":"context","mcp-call":"context","login":"cloud","logout":"cloud","deploy-akan":"cloud","test-platforms":"cloud","update":"cloud","push-update":"cloud","register-binary":"cloud","upload-secret":"cloud","list-secrets":"cloud","remove-secret":"cloud","download-env":"cloud","upload-env":"cloud","subspace":"subspace","guideline":"guideline","create-scalar":"scalar","remove-scalar":"scalar","create-ui":"primitive","add-field":"primitive","add-enum-field":"primitive","quality":"quality","verify":"verify","repair":"repair","workflow":"workflow","pipeline":"pipeline","tunnel":"tunnel"}}