@akanjs/cli 3.1.0-rc.1 → 3.1.0-rc.10

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 (98) hide show
  1. package/.build-stamp +1 -1
  2. package/{CodeAgent-kyprmy06.js → CodeAgent-rkjyxgec.js} +2 -2
  3. package/{CodeTui-21mtze3j.js → CodeTui-h7pyj6xa.js} +1 -1
  4. package/TunnelShare-661cxz5e.js +14 -0
  5. package/{agent.command-f3gsc1gd.js → agent.command-3qxf4xcj.js} +5 -5
  6. package/akanCode.js +2 -2
  7. package/{application.command-5s780vnz.js → application.command-m1kcd7jf.js} +54 -42
  8. package/{applicationBuildRunner-1yaqsrdq.js → applicationBuildRunner-dj0xkrep.js} +26 -33
  9. package/buildBatch.proc.js +24 -15
  10. package/{cloud.command-yj6xb2a7.js → cloud.command-9cp1t0f5.js} +60 -67
  11. package/cloud.script-dgstqt1m.js +24 -0
  12. package/{code.command-3wkn4ja5.js → code.command-0ad6gw2a.js} +6 -6
  13. package/{context.command-9jjn3gcw.js → context.command-0qx447mb.js} +17 -13
  14. package/context.runner-1vsjztjg.js +25 -0
  15. package/{dependencyScanner-06z2dmrr.js → dependencyScanner-3afj2vt1.js} +1 -1
  16. package/{guideline.command-dtczrqpf.js → guideline.command-cv5bmrx2.js} +2 -2
  17. package/guidelines/agentRule/agentRule.instruction.md +3 -3
  18. package/guidelines/conventions/conventions.instruction.md +457 -1071
  19. package/guidelines/cssRule/cssRule.instruction.md +28 -7
  20. package/guidelines/fieldRule/fieldRule.instruction.md +62 -0
  21. package/guidelines/framework/framework.instruction.md +4 -7
  22. package/guidelines/mcpRule/mcpRule.instruction.md +43 -20
  23. package/guidelines/modelConstant/modelConstant.instruction.md +2 -1
  24. package/guidelines/modelStore/modelStore.instruction.md +9 -0
  25. package/guidelines/pageRule/pageRule.instruction.md +80 -0
  26. package/guidelines/queryRule/queryRule.instruction.md +44 -11
  27. package/guidelines/runtimeRule/runtimeRule.instruction.md +113 -17
  28. package/guidelines/ssrRule/ssrRule.instruction.md +13 -0
  29. package/guidelines/transportRule/transportRule.instruction.md +135 -13
  30. package/guidelines/workspaceOnboarding/workspaceOnboarding.instruction.md +4 -4
  31. package/guidelines/workspaceRecipes/workspaceRecipes.instruction.md +68 -7
  32. package/incrementalBuilder.proc.js +10 -7
  33. package/index-192ha4xh.js +1173 -0
  34. package/{index-c76k723e.js → index-1p98exm2.js} +2 -2
  35. package/{index-rwq3ekqc.js → index-1xj2t7cb.js} +7 -7
  36. package/{index-rtct7d43.js → index-20bxxyvn.js} +80 -80
  37. package/{index-qt22xstj.js → index-35hc95h5.js} +5 -3
  38. package/{index-8r4d7cmt.js → index-4mhy6qme.js} +4 -4
  39. package/{index-ww9bhp67.js → index-4pf8g7ff.js} +1 -1
  40. package/{index-2mx692qq.js → index-5edzv8fn.js} +5 -5
  41. package/{index-k9rrten6.js → index-5nd1wtkv.js} +92 -94
  42. package/index-62md4dwy.js +260 -0
  43. package/index-665zp9rs.js +271 -0
  44. package/{index-2etcv0sc.js → index-86jt2a0e.js} +1 -1
  45. package/{index-krq7btbt.js → index-8fp3b47h.js} +419 -418
  46. package/{index-c2yrsxdh.js → index-9z426msb.js} +109 -328
  47. package/{index-ctanya41.js → index-awbdfcf2.js} +4 -4
  48. package/{index-3hx1z96c.js → index-bqbf654f.js} +1 -1
  49. package/{index-rc5rwyps.js → index-bspm21y1.js} +71 -60
  50. package/index-cpb3nvma.js +667 -0
  51. package/{index-jx4bzvwg.js → index-d47ypebv.js} +97 -55
  52. package/{index-ae5pwhgs.js → index-d72hfmdm.js} +15 -13
  53. package/{index-e0cvze1s.js → index-fmzcs8v6.js} +4 -4
  54. package/{index-8ggztp8k.js → index-fyq1z6kt.js} +68 -201
  55. package/{index-1w2qaee2.js → index-g1mbppa9.js} +331 -259
  56. package/{index-gnyf1fqy.js → index-j237xtew.js} +6 -6
  57. package/{index-fm46xrf1.js → index-j4mkhz93.js} +3 -3
  58. package/{index-6jjtnhkw.js → index-jw1zm273.js} +74 -34
  59. package/{index-q958tqqg.js → index-m9jj544v.js} +1 -1
  60. package/index-mdjc93e1.js +33 -0
  61. package/{index-c1x0be5j.js → index-pydbnfez.js} +2 -2
  62. package/{index-56d2g8ms.js → index-qwa5k1j8.js} +1 -1
  63. package/{index-v29746vb.js → index-tamvyvj3.js} +3 -3
  64. package/{index-05g3jayg.js → index-trpasv9q.js} +260 -259
  65. package/{index-2ahj896a.js → index-tvehn2sp.js} +1 -1
  66. package/{index-55mynnqs.js → index-va06nr10.js} +1434 -1173
  67. package/index-vk0pa0mn.js +240 -0
  68. package/{index-aprt7pkz.js → index-w44cy4vs.js} +2271 -3369
  69. package/index.js +22 -22
  70. package/{library.command-gaga5bmq.js → library.command-erp2f56n.js} +3 -3
  71. package/{localRegistry.command-vsreyy42.js → localRegistry.command-y176p558.js} +15 -11
  72. package/{module.command-7vpf6db4.js → module.command-gs2r615e.js} +5 -5
  73. package/{package.command-twmvvf69.js → package.command-j10r76ax.js} +4 -4
  74. package/package.json +21 -21
  75. package/{page.command-5asq7fdf.js → page.command-4h4a8pnh.js} +3 -3
  76. package/{pipeline.command-d0v38572.js → pipeline.command-a2nrk26m.js} +221 -220
  77. package/{primitive.command-dyrs2fm8.js → primitive.command-w6t0asqz.js} +6 -6
  78. package/{projectTypecheck-cvtkrzp2.js → projectTypecheck-f534enqj.js} +1 -1
  79. package/{quality.command-6emsqpbg.js → quality.command-77x7vbbx.js} +4 -4
  80. package/{repair.command-8t6aegv5.js → repair.command-y6sstev7.js} +5 -5
  81. package/{scalar.command-bnggy1x7.js → scalar.command-20b8cy0k.js} +4 -4
  82. package/{subspace.command-md2teygq.js → subspace.command-5c7yasd7.js} +424 -364
  83. package/templates/appSample/lib/task/Task.Util.tsx +7 -7
  84. package/templates/appSample/lib/task/Task.Zone.tsx +1 -1
  85. package/templates/appSample/ui/QuantityControl.tsx +2 -2
  86. package/templates/crudSinglePage/page.tsx +1 -1
  87. package/templates/lib/cnst.ts +0 -1
  88. package/templates/workspaceRoot/.gitignore.template +23 -52
  89. package/templates/workspaceRoot/biome.json.template +1 -1
  90. package/{tunnel.command-jx3tdm2d.js → tunnel.command-2kw8vt9g.js} +8 -4
  91. package/{workflow.command-jx0wag5r.js → workflow.command-2djwmpqf.js} +10 -10
  92. package/{workspace.command-yxd7rr7g.js → workspace.command-6qfgq4b4.js} +38 -34
  93. package/TunnelShare-q4jq08qg.js +0 -9
  94. package/cloud.script-h6pvcpa2.js +0 -20
  95. package/context.runner-atcrzz5b.js +0 -21
  96. package/index-6w0rbr9d.js +0 -68
  97. package/index-n68jx79w.js +0 -120
  98. package/index-pgj2rt78.js +0 -404
package/.build-stamp CHANGED
@@ -1 +1 @@
1
- ee31653f86d9a17de2cf6fbfbfb3f585db1d135b4d2fa1dceaa1e6faee5fa437
1
+ 498a1d8c7962b08013b78dad8bec3014db50cb86cf07357e09ebf340e0f7bc87
@@ -1,8 +1,8 @@
1
1
  // @bun
2
2
  import {
3
3
  CodeAgent2
4
- } from "./index-krq7btbt.js";
5
- import"./index-rtct7d43.js";
4
+ } from "./index-8fp3b47h.js";
5
+ import"./index-20bxxyvn.js";
6
6
  import"./index-7md2g9vw.js";
7
7
  export {
8
8
  CodeAgent2 as CodeAgent
@@ -4,7 +4,7 @@ import {
4
4
  McpServerConfig,
5
5
  McpTokenStore,
6
6
  McpSignIn
7
- } from "./index-rtct7d43.js";
7
+ } from "./index-20bxxyvn.js";
8
8
  import {
9
9
  CodeTuiLines2,
10
10
  CodeTuiAgents2,
@@ -0,0 +1,14 @@
1
+ // @bun
2
+ import {
3
+ TunnelShare2
4
+ } from "./index-qwa5k1j8.js";
5
+ import"./index-cpb3nvma.js";
6
+ import"./index-g1mbppa9.js";
7
+ import"./index-m9jj544v.js";
8
+ import"./index-665zp9rs.js";
9
+ import"./index-192ha4xh.js";
10
+ import"./index-va06nr10.js";
11
+ import"./index-52w0fvh8.js";
12
+ export {
13
+ TunnelShare2 as TunnelShare
14
+ };
@@ -2,16 +2,16 @@
2
2
  import {
3
3
  Workspace,
4
4
  command
5
- } from "./index-6jjtnhkw.js";
5
+ } from "./index-jw1zm273.js";
6
6
  import"./index-52w0fvh8.js";
7
- import"./index-55mynnqs.js";
7
+ import"./index-va06nr10.js";
8
8
  import"./index-hj6w4ka1.js";
9
- import"./index-05g3jayg.js";
10
- import"./index-2mx692qq.js";
9
+ import"./index-trpasv9q.js";
10
+ import"./index-5edzv8fn.js";
11
11
  import"./index-zzvvc845.js";
12
12
  import {
13
13
  AgentScript
14
- } from "./index-v29746vb.js";
14
+ } from "./index-tamvyvj3.js";
15
15
 
16
16
  // pkgs/@akanjs/cli/agent/agent.command.ts
17
17
  class AgentCommand extends command("agent", [AgentScript], ({ public: target }) => ({
package/akanCode.js CHANGED
@@ -28,7 +28,7 @@ import {
28
28
  CodeMailbox2,
29
29
  CodeSessionFork2,
30
30
  CodeAgent2
31
- } from "./index-krq7btbt.js";
31
+ } from "./index-8fp3b47h.js";
32
32
  import {
33
33
  akanCodeDefaultModel2,
34
34
  akanCodeModel2,
@@ -39,7 +39,7 @@ import {
39
39
  import {
40
40
  SubagentPool2,
41
41
  akanCodePaths2
42
- } from "./index-rtct7d43.js";
42
+ } from "./index-20bxxyvn.js";
43
43
  import"./index-7md2g9vw.js";
44
44
  import {
45
45
  CodeAgentRpcHost2
@@ -3,30 +3,34 @@ import {
3
3
  App,
4
4
  Apps,
5
5
  Sys,
6
+ SysOrOnlyApp,
6
7
  Exec,
7
8
  Workspace,
8
9
  command
9
- } from "./index-6jjtnhkw.js";
10
+ } from "./index-jw1zm273.js";
10
11
  import"./index-52w0fvh8.js";
11
- import"./index-55mynnqs.js";
12
- import"./index-1w2qaee2.js";
13
- import"./index-k9rrten6.js";
14
- import"./index-c1x0be5j.js";
12
+ import"./index-va06nr10.js";
13
+ import"./index-5nd1wtkv.js";
14
+ import"./index-vk0pa0mn.js";
15
+ import"./index-m9jj544v.js";
16
+ import"./index-g1mbppa9.js";
17
+ import"./index-192ha4xh.js";
18
+ import"./index-pydbnfez.js";
15
19
  import {
16
20
  ApplicationScript
17
- } from "./index-jx4bzvwg.js";
21
+ } from "./index-d47ypebv.js";
18
22
  import"./index-7md2g9vw.js";
19
- import"./index-qt22xstj.js";
20
23
  import {
21
- getMobileTargetChoices
22
- } from "./index-q958tqqg.js";
24
+ writeOption,
25
+ nativeTargetOption,
26
+ releaseEnvOption,
27
+ allowLocalOption,
28
+ publicEnvOption
29
+ } from "./index-mdjc93e1.js";
30
+ import"./index-35hc95h5.js";
31
+ import"./index-665zp9rs.js";
23
32
 
24
33
  // pkgs/@akanjs/cli/application/application.command.ts
25
- var mobileTargetOption = {
26
- desc: "native target name (a key of native.targets) or all",
27
- ask: "Select native target",
28
- enum: async ({ app }) => await getMobileTargetChoices(app)
29
- };
30
34
  var deviceOption = {
31
35
  desc: "simulator, emulator or device to run on: its id or name (e.g. 'iPhone 17' or 'Pixel_10')",
32
36
  default: ""
@@ -41,11 +45,6 @@ var startEnvOption = {
41
45
  desc: "backend environment of a --release build; a dev build follows `akan start`, which keeps its own",
42
46
  default: "local"
43
47
  };
44
- var releaseEnvOption = {
45
- enum: ["debug", "develop", "main", "local"],
46
- desc: "backend environment",
47
- default: "main"
48
- };
49
48
 
50
49
  class ApplicationCommand extends command("application", [ApplicationScript], ({ public: target }) => ({
51
50
  createApplication: target({ desc: "Create a new application in the workspace" }).arg("appName", String, { desc: "name of application" }).option("start", Boolean, { desc: "start application", default: false }).with(Workspace).exec(async function(appName, start, workspace) {
@@ -96,32 +95,32 @@ class ApplicationCommand extends command("application", [ApplicationScript], ({
96
95
  runtimeDir
97
96
  });
98
97
  }),
99
- build: target({ short: true, desc: "Build the application for production (frontend + backend)" }).with(App).option("write", Boolean, { desc: "write code generation", default: true }).option("fast", Boolean, { desc: "fast build", default: false }).option("quiet", Boolean, { desc: "hide build progress output", default: false }).option("profile", String, {
98
+ build: target({ short: true, desc: "Build the application for production (frontend + backend)" }).with(App).option("write", Boolean, writeOption).option("fast", Boolean, { desc: "fast build", default: false }).option("quiet", Boolean, { desc: "hide build progress output", default: false }).option("profile", String, {
100
99
  desc: "server env profile: bundle env/env.server.<env>.<profile>.ts in place of the environment's own file",
101
100
  nullable: true
102
101
  }).exec(async function(app, write, fast, quiet, profile) {
103
102
  await this.applicationScript.build(app, { write, fast, quiet, profile: profile ?? undefined });
104
103
  }),
105
- typecheck: target({ short: true, desc: "Typecheck an app or a library, its tests and specs included" }).with(Exec).option("write", Boolean, { desc: "write code generation", default: true }).option("clean", Boolean, { desc: "clear typecheck cache before running", default: false }).option("incremental", Boolean, { desc: "reuse TypeScript incremental cache", default: true }).option("tests", Boolean, { desc: "check its *.test.ts / *.spec.ts too, which nothing imports", default: true }).exec(async function(exec, write, clean, incremental, tests) {
106
- await this.applicationScript.typecheck(exec, { write, clean, incremental, tests });
104
+ typecheck: target({ short: true, desc: "Typecheck an app or a library, its tests and specs included" }).with(SysOrOnlyApp).option("write", Boolean, writeOption).option("clean", Boolean, { desc: "clear typecheck cache before running", default: false }).option("incremental", Boolean, { desc: "reuse TypeScript incremental cache", default: true }).option("tests", Boolean, { desc: "check its *.test.ts / *.spec.ts too, which nothing imports", default: true }).exec(async function(sys, write, clean, incremental, tests) {
105
+ await this.applicationScript.typecheck(sys, { write, clean, incremental, tests });
107
106
  }),
108
- test: target({ desc: "Prepare and test an app, library, or package" }).with(Exec).option("write", Boolean, { desc: "write code generation", default: true }).exec(async function(exec, write) {
107
+ test: target({ desc: "Prepare and test an app, library, or package" }).with(Exec).option("write", Boolean, writeOption).exec(async function(exec, write) {
109
108
  await this.applicationScript.test(exec, { write });
110
109
  }),
111
- buildIos: target({ short: true, desc: "Build the iOS app on the native runtime" }).with(App).option("target", String, mobileTargetOption).option("env", String, buildEnvOption).option("debug", Boolean, { desc: "debug build instead of release", default: false }).option("write", Boolean, { desc: "write code generation", default: true }).exec(async function(app, target, env, debug, write) {
110
+ buildIos: target({ short: true, desc: "Build the iOS app on the native runtime" }).with(App).option("target", String, nativeTargetOption).option("env", String, buildEnvOption).option("debug", Boolean, { desc: "debug build instead of release", default: false }).option("write", Boolean, writeOption).exec(async function(app, target, env, debug, write) {
112
111
  await this.applicationScript.buildIos(app, { target, env, profile: debug ? "debug" : "release", write });
113
112
  }),
114
- buildAndroid: target({ short: true, desc: "Build the Android app (apk) on the native runtime" }).with(App).option("target", String, mobileTargetOption).option("env", String, buildEnvOption).option("debug", Boolean, { desc: "debug build instead of release", default: false }).option("write", Boolean, { desc: "write code generation", default: true }).exec(async function(app, target, env, debug, write) {
113
+ buildAndroid: target({ short: true, desc: "Build the Android app (apk) on the native runtime" }).with(App).option("target", String, nativeTargetOption).option("env", String, buildEnvOption).option("debug", Boolean, { desc: "debug build instead of release", default: false }).option("write", Boolean, writeOption).exec(async function(app, target, env, debug, write) {
115
114
  await this.applicationScript.buildAndroid(app, { target, env, profile: debug ? "debug" : "release", write });
116
115
  }),
117
- buildDesktop: target({ short: true, desc: "Build the desktop app for this computer (macOS, Windows or Linux)" }).with(App).option("target", String, mobileTargetOption).option("env", String, buildEnvOption).option("debug", Boolean, { desc: "debug build instead of release", default: false }).option("installer", Boolean, {
116
+ buildDesktop: target({ short: true, desc: "Build the desktop app for this computer (macOS, Windows or Linux)" }).with(App).option("target", String, nativeTargetOption).option("env", String, buildEnvOption).option("debug", Boolean, { desc: "debug build instead of release", default: false }).option("installer", Boolean, {
118
117
  desc: "also what a person downloads: a Windows setup program (NSIS, /S for silent), a macOS dmg, a Linux AppImage",
119
118
  default: false
120
119
  }).option("arch", String, {
121
120
  desc: "the CPU the app runs on, arm64 or x64 of this OS (default this computer's); a macOS app is arm64 only",
122
121
  enum: ["arm64", "x64"],
123
122
  nullable: true
124
- }).option("sign", Boolean, { desc: signDesc, default: false }).option("notarize", Boolean, { desc: notarizeDesc, default: false }).option("write", Boolean, { desc: "write code generation", default: true }).exec(async function(app, target, env, debug, installer, arch, sign, notarize, write) {
123
+ }).option("sign", Boolean, { desc: signDesc, default: false }).option("notarize", Boolean, { desc: notarizeDesc, default: false }).option("write", Boolean, writeOption).exec(async function(app, target, env, debug, installer, arch, sign, notarize, write) {
125
124
  await this.applicationScript.buildDesktop(app, {
126
125
  target,
127
126
  env,
@@ -136,10 +135,10 @@ class ApplicationCommand extends command("application", [ApplicationScript], ({
136
135
  start: target({ short: true, desc: "Start development server(s) (frontend SSR + backend)" }).with(Apps).option("plain", Boolean, { desc: "print prefixed lines instead of the full-screen view", default: false }).option("kill", Boolean, { flag: "k", desc: "free the dev ports first, whoever is holding them", default: false }).option("concurrency", Number, {
137
136
  desc: "apps to boot at a time (default: what this machine's memory and cores allow)",
138
137
  nullable: true
139
- }).option("dbup", Boolean, { desc: "start the local database first", default: true }).option("open", Boolean, { desc: "open web browser?", default: false }).option("share", Boolean, { desc: "also share each app on a public URL through an akan tunnel", default: false }).option("write", Boolean, { desc: "write code generation", default: true }).exec(async function(apps, plain, kill, concurrency, dbup, open, share, write) {
138
+ }).option("dbup", Boolean, { desc: "start the local database first", default: true }).option("open", Boolean, { desc: "open web browser?", default: false }).option("share", Boolean, { desc: "also share each app on a public URL through an akan tunnel", default: false }).option("write", Boolean, writeOption).exec(async function(apps, plain, kill, concurrency, dbup, open, share, write) {
140
139
  await this.applicationScript.start(apps, { plain, kill, concurrency, dbup, open, share, write });
141
140
  }),
142
- startIos: target({ short: true, desc: "Run the iOS app in a simulator or on an iPhone, following `akan start`" }).with(App).option("target", String, mobileTargetOption).option("env", String, startEnvOption).option("release", Boolean, { desc: "run a release build of its own bundle instead", default: false }).option("device", String, deviceOption).option("team", String, teamOption).option("write", Boolean, { desc: "write code generation", default: true }).exec(async function(app, target, env, release, device, team, write) {
141
+ startIos: target({ short: true, desc: "Run the iOS app in a simulator or on an iPhone, following `akan start`" }).with(App).option("target", String, nativeTargetOption).option("env", String, startEnvOption).option("release", Boolean, { desc: "run a release build of its own bundle instead", default: false }).option("device", String, deviceOption).option("team", String, teamOption).option("write", Boolean, writeOption).exec(async function(app, target, env, release, device, team, write) {
143
142
  await this.applicationScript.startIos(app, {
144
143
  target,
145
144
  env,
@@ -152,7 +151,7 @@ class ApplicationCommand extends command("application", [ApplicationScript], ({
152
151
  startAndroid: target({
153
152
  short: true,
154
153
  desc: "Run the Android app in an emulator or on a device, following `akan start`"
155
- }).with(App).option("target", String, mobileTargetOption).option("env", String, startEnvOption).option("release", Boolean, { desc: "run a release build of its own bundle instead", default: false }).option("device", String, deviceOption).option("write", Boolean, { desc: "write code generation", default: true }).exec(async function(app, target, env, release, device, write) {
154
+ }).with(App).option("target", String, nativeTargetOption).option("env", String, startEnvOption).option("release", Boolean, { desc: "run a release build of its own bundle instead", default: false }).option("device", String, deviceOption).option("write", Boolean, writeOption).exec(async function(app, target, env, release, device, write) {
156
155
  await this.applicationScript.startAndroid(app, {
157
156
  target,
158
157
  env,
@@ -164,7 +163,7 @@ class ApplicationCommand extends command("application", [ApplicationScript], ({
164
163
  startDesktop: target({
165
164
  short: true,
166
165
  desc: "Run the desktop app on this computer (macOS, Windows or Linux), following `akan start`"
167
- }).with(App).option("target", String, mobileTargetOption).option("env", String, startEnvOption).option("release", Boolean, { desc: "run a release build of its own bundle instead", default: false }).option("write", Boolean, { desc: "write code generation", default: true }).exec(async function(app, target, env, release, write) {
166
+ }).with(App).option("target", String, nativeTargetOption).option("env", String, startEnvOption).option("release", Boolean, { desc: "run a release build of its own bundle instead", default: false }).option("write", Boolean, writeOption).exec(async function(app, target, env, release, write) {
168
167
  await this.applicationScript.startDesktop(app, {
169
168
  target,
170
169
  env,
@@ -172,54 +171,57 @@ class ApplicationCommand extends command("application", [ApplicationScript], ({
172
171
  write
173
172
  });
174
173
  }),
175
- releaseIos: target({ desc: "Build and sign the iOS app for the App Store (.ipa)" }).with(App).option("target", String, mobileTargetOption).option("env", String, releaseEnvOption).option("team", String, teamOption).option("adHoc", Boolean, { desc: "sign with an ad-hoc profile instead of app-store", default: false }).option("write", Boolean, { desc: "write code generation", default: true }).option("allowLocalRelease", Boolean, { flag: "l", desc: "allow release with --env local", default: false }).exec(async function(app, target, env, team, adHoc, write, allowLocalRelease) {
174
+ releaseIos: target({ desc: "Build and sign the iOS app for the App Store (.ipa)" }).with(App).option("target", String, nativeTargetOption).option("env", String, releaseEnvOption).option("team", String, teamOption).option("adHoc", Boolean, { desc: "sign with an ad-hoc profile instead of app-store", default: false }).option("write", Boolean, writeOption).option("allowLocalRelease", Boolean, allowLocalOption("release")).option("publicEnv", String, publicEnvOption("the release")).exec(async function(app, target, env, team, adHoc, write, allowLocalRelease, publicEnv) {
176
175
  await this.applicationScript.releaseIos(app, {
177
176
  target,
178
177
  env,
179
178
  teamId: team || undefined,
180
179
  adHoc,
181
180
  write,
182
- allowLocalRelease
181
+ allowLocalRelease,
182
+ publicEnv: publicEnv ?? undefined
183
183
  });
184
184
  }),
185
- releaseAndroid: target({ desc: "Build and sign the Android app for the Play Store (aab, or apk)" }).with(App).option("assembleType", String, { enum: ["aab", "apk"], default: "aab" }).option("target", String, mobileTargetOption).option("env", String, releaseEnvOption).option("write", Boolean, { desc: "write code generation", default: true }).option("allowLocalRelease", Boolean, { flag: "l", desc: "allow release with --env local", default: false }).exec(async function(app, assembleType, target, env, write, allowLocalRelease) {
185
+ releaseAndroid: target({ desc: "Build and sign the Android app for the Play Store (aab, or apk)" }).with(App).option("assembleType", String, { enum: ["aab", "apk"], default: "aab" }).option("target", String, nativeTargetOption).option("env", String, releaseEnvOption).option("write", Boolean, writeOption).option("allowLocalRelease", Boolean, allowLocalOption("release")).option("publicEnv", String, publicEnvOption("the release")).exec(async function(app, assembleType, target, env, write, allowLocalRelease, publicEnv) {
186
186
  await this.applicationScript.releaseAndroid(app, assembleType, {
187
187
  target,
188
188
  env,
189
189
  write,
190
- allowLocalRelease
190
+ allowLocalRelease,
191
+ publicEnv: publicEnv ?? undefined
191
192
  });
192
193
  }),
193
194
  packUpdate: target({
194
- desc: "Pack an unsigned over-the-air update of the mobile web bundle for a signer; records it in <out>/pack.json, exits 2 when --against needs a new store build"
195
- }).with(App).option("platform", String, { enum: ["ios", "android"], desc: "the app it updates" }).option("target", String, mobileTargetOption).option("env", String, releaseEnvOption).option("out", String, {
195
+ desc: "Pack an unsigned over-the-air update of the mobile web bundle for a signer; records it in <out>/pack.json. Exits 2 when --against needs a new store build, 1 on any other failure"
196
+ }).with(App).option("platform", String, { enum: ["ios", "android"], desc: "the app it updates" }).option("target", String, nativeTargetOption).option("env", String, releaseEnvOption).option("out", String, {
196
197
  desc: "output folder (default: dist/native/<app>/<target>/updates/<platform>)",
197
198
  nullable: true
198
199
  }).option("against", String, {
199
200
  desc: "bundle.json of the store build it must run in; fails when it needs a new one",
200
201
  nullable: true
201
- }).option("write", Boolean, { desc: "write code generation", default: true }).option("allowLocalRelease", Boolean, { flag: "l", desc: "allow packing with --env local", default: false }).exec(async function(app, platform, target, env, out, against, write, allowLocalRelease) {
202
+ }).option("write", Boolean, writeOption).option("allowLocalRelease", Boolean, allowLocalOption("packing")).option("publicEnv", String, publicEnvOption("the update (default: what --against recorded)")).exec(async function(app, platform, target, env, out, against, write, allowLocalRelease, publicEnv) {
202
203
  await this.applicationScript.packUpdate(app, platform, {
203
204
  target,
204
205
  env,
205
206
  out: out ?? undefined,
206
207
  against: against ?? undefined,
207
208
  write,
208
- allowLocalRelease
209
+ allowLocalRelease,
210
+ publicEnv: publicEnv ?? undefined
209
211
  });
210
212
  }),
211
213
  updateKeygen: target({ desc: "Make (once) the key an app's update releases are signed with; print its public key" }).with(App).option("platform", String, {
212
214
  enum: ["desktop", "android", "ios"],
213
215
  default: "desktop",
214
216
  desc: "the platform whose app id the key signs for (an appId may differ per platform)"
215
- }).option("target", String, mobileTargetOption).exec(async function(app, platform, target) {
217
+ }).option("target", String, nativeTargetOption).exec(async function(app, platform, target) {
216
218
  await this.applicationScript.updateKeygen(app, platform, { target });
217
219
  }),
218
220
  publishUpdate: target({ desc: "Build and sign an update release installed apps take (desktop, android or ios)" }).with(App).option("platform", String, {
219
221
  enum: ["desktop", "android", "ios"],
220
222
  default: "desktop",
221
223
  desc: "desktop is this computer's OS and CPU; android and ios publish the web bundle"
222
- }).option("target", String, mobileTargetOption).option("env", String, releaseEnvOption).option("channel", String, {
224
+ }).option("target", String, nativeTargetOption).option("env", String, releaseEnvOption).option("channel", String, {
223
225
  desc: "the manifest to publish to (default: the target's updates.channel, else --env)",
224
226
  nullable: true
225
227
  }).option("upload", String, {
@@ -232,7 +234,15 @@ class ApplicationCommand extends command("application", [ApplicationScript], ({
232
234
  }).option("sign", Boolean, {
233
235
  desc: `${signDesc}; a signed app takes only a release signed the same way`,
234
236
  default: false
235
- }).option("notarize", Boolean, { desc: notarizeDesc, default: false }).option("write", Boolean, { desc: "write code generation", default: true }).option("allowLocalRelease", Boolean, { flag: "l", desc: "allow release with --env local", default: false }).exec(async function(app, platform, target, env, channel, upload, arch, sign, notarize, write, allowLocalRelease) {
237
+ }).option("notarize", Boolean, { desc: notarizeDesc, default: false }).option("revoke", String, {
238
+ desc: "android, ios: keyIds of updates.publicKeys this release starts revoking, comma-separated (update-keygen prints a key's); it is signed with a key listed after them",
239
+ nullable: true
240
+ }).option("resetSequence", Boolean, {
241
+ flag: "R",
242
+ desc: "android, ios: with --revoke, phones compare the release with their own bundle instead of the running one",
243
+ default: false
244
+ }).option("write", Boolean, writeOption).option("allowLocalRelease", Boolean, allowLocalOption("release")).exec(async function(app, platform, target, env, channel, upload, arch, sign, notarize, revoke, resetSequence, write, allowLocalRelease) {
245
+ const revoked = revoke?.split(",").map((keyId) => keyId.trim()).filter(Boolean);
236
246
  await this.applicationScript.publishUpdate(app, platform, {
237
247
  target,
238
248
  env,
@@ -241,6 +251,8 @@ class ApplicationCommand extends command("application", [ApplicationScript], ({
241
251
  ...channel ? { channel } : {},
242
252
  ...upload ? { upload } : {},
243
253
  ...arch ? { arch } : {},
254
+ ...revoked?.length ? { revoke: revoked } : {},
255
+ ...resetSequence ? { resetSequence } : {},
244
256
  write,
245
257
  allowLocalRelease
246
258
  });
@@ -1,21 +1,23 @@
1
1
  // @bun
2
2
  import {
3
3
  ServerEnvProfile,
4
- Spinner
5
- } from "./index-55mynnqs.js";
6
- import"./index-aprt7pkz.js";
4
+ Spinner,
5
+ ProjectTypecheck2,
6
+ WorkspaceExecutor
7
+ } from "./index-va06nr10.js";
8
+ import"./index-52w0fvh8.js";
9
+ import"./index-w44cy4vs.js";
10
+ import"./index-192ha4xh.js";
7
11
  import {
8
12
  AllRoutesBuilder,
9
- CsrArtifactBuilder,
10
13
  FontPruner,
11
14
  precompressArtifacts,
12
15
  SsrBaseArtifactBuilder
13
- } from "./index-c2yrsxdh.js";
14
- import"./index-52w0fvh8.js";
15
- import"./index-n68jx79w.js";
16
+ } from "./index-9z426msb.js";
17
+ import"./index-62md4dwy.js";
16
18
  import {
17
- ProjectTypecheck2
18
- } from "./index-6w0rbr9d.js";
19
+ CsrArtifactBuilder
20
+ } from "./index-665zp9rs.js";
19
21
 
20
22
  // pkgs/@akanjs/devkit/applicationBuildRunner.ts
21
23
  import path2 from "path";
@@ -38,22 +40,9 @@ var createServerEnvPlugin = ({
38
40
  const own = new RegExp(`${folder}${escapeRegExp(environment)}\\.ts$`);
39
41
  const libEnvs = new Map;
40
42
  const libEnv = async (file) => {
41
- const profileFile = ServerEnvProfile.profileFileOf(file, profile ?? "");
42
- const libRoot = path.dirname(path.dirname(file));
43
- if (await Bun.file(profileFile).exists()) {
44
- const secrets = ServerEnvProfile.secretPaths(await ServerEnvProfile.evaluate(profileFile, libRoot));
45
- if (secrets.length)
46
- throw new Error(`${profileFile} holds secret-named values, which the "${profile}" bundle carries to every computer it runs on: ${secrets.join(", ")}.`);
47
- onLibEnv?.(file, { profileFile: true, stripped: [] });
48
- return { loader: "ts", contents: await Bun.file(profileFile).text() };
49
- }
50
- const { exports } = new Bun.Transpiler({ loader: "ts" }).scan(await Bun.file(file).text());
51
- if (exports.some((name) => name !== "env"))
52
- throw new Error(`${file} exports ${exports.join(", ")}: a "${profile}" build carries only a lib env's \`env\`, so give the lib ${path.basename(profileFile)}.`);
53
- const { value, stripped } = ServerEnvProfile.strip(await ServerEnvProfile.evaluate(file, libRoot));
54
- onLibEnv?.(file, { profileFile: false, stripped });
55
- return { loader: "js", contents: `export const env = ${JSON.stringify(value ?? {})};
56
- ` };
43
+ const { loader, contents, profileFile, stripped } = await ServerEnvProfile.libEnvSource(file, profile ?? "");
44
+ onLibEnv?.(file, { profileFile, stripped });
45
+ return { loader, contents };
57
46
  };
58
47
  return {
59
48
  name: "akan-server-env",
@@ -61,7 +50,7 @@ var createServerEnvPlugin = ({
61
50
  if (profile)
62
51
  build.onLoad({ filter: own }, async (args) => ({
63
52
  loader: "ts",
64
- contents: await Bun.file(path.join(path.dirname(args.path), `env.server.${environment}.${profile}.ts`)).text()
53
+ contents: await ServerEnvProfile.sourceInPlaceOf(path.join(path.dirname(args.path), ServerEnvProfile.fileName(environment, profile)), args.path, profile)
65
54
  }));
66
55
  if (others.length)
67
56
  build.onLoad({ filter }, async (args) => {
@@ -79,7 +68,7 @@ var createServerEnvPlugin = ({
79
68
  };
80
69
  });
81
70
  if (profile)
82
- build.onLoad({ filter: /[\\/]env[\\/]env\.server\.[A-Za-z0-9-]+\.ts$/ }, async (args) => {
71
+ build.onLoad({ filter: ServerEnvProfile.envFilePattern }, async (args) => {
83
72
  const name = path.basename(args.path, ".ts").slice("env.server.".length);
84
73
  if (dirs.has(path.dirname(args.path)) || name === "type" || name === "example")
85
74
  return { loader: "ts", contents: await Bun.file(args.path).text() };
@@ -138,12 +127,11 @@ class ApplicationBuildRunner {
138
127
  async build({ spinner = false } = {}) {
139
128
  this.#spinner = spinner;
140
129
  const { web, assets, baseDevEnv } = await this.#app.getConfig();
130
+ const environment = this.#environment ?? baseDevEnv.env;
131
+ WorkspaceExecutor.assertDeployableEnv(baseDevEnv, environment, "akan build");
132
+ process.env.AKAN_PUBLIC_ENV = environment;
141
133
  if (this.#profile)
142
- await ServerEnvProfile.assertShippable({
143
- envDir: this.#envDir,
144
- environment: this.#environment ?? baseDevEnv.env,
145
- profile: this.#profile
146
- });
134
+ await ServerEnvProfile.assertShippable({ envDir: this.#envDir, environment, profile: this.#profile });
147
135
  await this.#runPhase("prepare", "Preparing output directory", () => this.#app.prepareCommand("build"));
148
136
  if (!this.#fast)
149
137
  await this.#runPhase("typecheck", "Typechecking", () => this.typecheck());
@@ -329,9 +317,14 @@ void run().catch((error) => {
329
317
  return { base, allRoutes };
330
318
  }
331
319
  async#buildOrThrow(label, config) {
332
- const result = await Bun.build(config);
320
+ const metafileDir = process.env.AKAN_BUILD_METAFILE ? path2.join(this.#app.workspace.workspaceRoot, "local", "build-meta", path2.basename(this.#app.cwdPath)) : null;
321
+ const result = await Bun.build(metafileDir ? { ...config, metafile: true } : config);
333
322
  if (!result.success)
334
323
  throw new AggregateError(result.logs, `[${label}] Bun.build failed`);
324
+ if (metafileDir && result.metafile) {
325
+ const entry = path2.parse(String(config.entrypoints[0] ?? label)).name;
326
+ await Bun.write(path2.join(metafileDir, `${entry}.json`), JSON.stringify(result.metafile));
327
+ }
335
328
  return result;
336
329
  }
337
330
  #createExternalSpecifiersPlugin(externalLibs) {
@@ -1,28 +1,32 @@
1
1
  // @bun
2
2
  import {
3
3
  ApplicationBuildReporter
4
- } from "./index-k9rrten6.js";
4
+ } from "./index-5nd1wtkv.js";
5
5
  import {
6
6
  resolveSsrPageEntriesForApp,
7
7
  WorkspaceExecutor,
8
8
  AppExecutor
9
- } from "./index-55mynnqs.js";
9
+ } from "./index-va06nr10.js";
10
10
  import {
11
11
  computeRouteSeedIndex,
12
12
  saveRouteSeedIndex,
13
- ServerGraphFile,
14
- PagesBundleBuilder,
15
13
  CsrDevBundler,
16
14
  SsrDevBundler
17
- } from "./index-aprt7pkz.js";
15
+ } from "./index-w44cy4vs.js";
18
16
  import"./index-52w0fvh8.js";
19
17
  import {
20
- CsrArtifactBuilder,
18
+ ServerGraphFile,
19
+ PagesBundleBuilder
20
+ } from "./index-192ha4xh.js";
21
+ import {
21
22
  CssCompiler,
22
23
  FontOptimizer,
23
24
  SsrBaseArtifactBuilder
24
- } from "./index-c2yrsxdh.js";
25
- import"./index-n68jx79w.js";
25
+ } from "./index-9z426msb.js";
26
+ import"./index-62md4dwy.js";
27
+ import {
28
+ CsrArtifactBuilder
29
+ } from "./index-665zp9rs.js";
26
30
 
27
31
  // pkgs/@akanjs/devkit/incrementalBuilder/buildBatch.proc.ts
28
32
  import path from "path";
@@ -40,17 +44,21 @@ class BuildBatch {
40
44
  this.#result = { generation: request.generation, errors: {} };
41
45
  }
42
46
  async run() {
43
- if (this.#request.needs.includes("base"))
47
+ const { needs } = this.#request;
48
+ const cssFirst = needs.includes("css") && needs.includes("csr") && resolveDevCsrMode() === "artifact";
49
+ if (needs.includes("base"))
44
50
  await this.#buildBase();
45
- if (this.#request.needs.includes("csr"))
51
+ if (cssFirst)
52
+ await this.#buildCss();
53
+ if (needs.includes("csr"))
46
54
  await this.#buildCsr();
47
- if (this.#request.needs.includes("shell"))
55
+ if (needs.includes("shell"))
48
56
  await this.#buildShell();
49
- if (this.#request.needs.includes("ssr"))
57
+ if (needs.includes("ssr"))
50
58
  await this.#buildSsrRegistry();
51
- if (this.#request.needs.includes("css"))
59
+ if (needs.includes("css") && !cssFirst)
52
60
  await this.#buildCss();
53
- if (this.#request.needs.includes("pages"))
61
+ if (needs.includes("pages"))
54
62
  await this.#buildPages();
55
63
  return this.#result;
56
64
  }
@@ -115,7 +123,8 @@ class BuildBatch {
115
123
  }
116
124
  }
117
125
  async#rebuildCsrArtifact(started) {
118
- await new CsrArtifactBuilder(this.#app, "start", "en", { cssAssets: this.#request.cssAssets }).build();
126
+ const cssAssets = this.#result.cssAssets ?? this.#request.cssAssets;
127
+ await new CsrArtifactBuilder(this.#app, "start", "en", { cssAssets }).build();
119
128
  this.#logger.verbose(`csr-rebundle ok (${Date.now() - started}ms)`);
120
129
  if (this.#request.changedFiles.length === 0)
121
130
  return;