@akanjs/cli 3.1.1 → 3.1.2-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/.build-stamp +1 -1
  2. package/CodeAgent-dyc45f5w.js +11 -0
  3. package/{CodeAgentRpcHost-9g27hmer.js → CodeAgentRpcHost-6dzfkvsc.js} +1 -1
  4. package/CodeAgentRpcListener-tcwrdvst.js +182 -0
  5. package/{CodeTui-h6yz2kvq.js → CodeTui-q55b2zrn.js} +25 -8
  6. package/TunnelShare-hdq9h1hr.js +14 -0
  7. package/{agent.command-3r4jsck8.js → agent.command-20zaqe60.js} +18 -15
  8. package/akanCode.js +8 -7
  9. package/{application.command-g7xv6ad0.js → application.command-nd0fshsk.js} +11 -11
  10. package/{applicationBuildRunner-qvjnhr9j.js → applicationBuildRunner-s13x3zqb.js} +10 -9
  11. package/buildBatch.proc.js +6 -6
  12. package/{cloud.command-6ebygmhw.js → cloud.command-8kbddsz9.js} +25 -18
  13. package/cloud.script-hgvvajm3.js +27 -0
  14. package/code.command-625bg8s8.js +345 -0
  15. package/{context.command-svdh6b2w.js → context.command-p6haqjay.js} +19 -18
  16. package/context.runner-rsnqnk9j.js +27 -0
  17. package/{dependencyScanner-3afj2vt1.js → dependencyScanner-78sq8m4q.js} +2 -2
  18. package/{fileSys-wzzrntkw.js → fileSys-zpvt5gtf.js} +1 -1
  19. package/{guideline.command-qwp3tnjx.js → guideline.command-195g0h9a.js} +4 -4
  20. package/guidelines/agentRule/agentRule.instruction.md +22 -8
  21. package/guidelines/conventions/rules/auth.md +5 -4
  22. package/guidelines/conventions/rules/config.md +5 -1
  23. package/guidelines/conventions/rules/gates.md +2 -1
  24. package/guidelines/conventions/rules/module.md +1 -1
  25. package/guidelines/conventions/rules/server.md +8 -3
  26. package/guidelines/conventions/rules/ssr.md +2 -2
  27. package/guidelines/conventions/rules/tsx.md +2 -1
  28. package/guidelines/pageRule/pageRule.instruction.md +4 -4
  29. package/guidelines/runtimeRule/runtimeRule.instruction.md +35 -25
  30. package/guidelines/ssrRule/ssrRule.instruction.md +11 -10
  31. package/guidelines/transportRule/transportRule.instruction.md +5 -4
  32. package/guidelines/workspaceRecipes/workspaceRecipes.instruction.md +1 -1
  33. package/incrementalBuilder.proc.js +4 -4
  34. package/{index-w4k2ragk.js → index-00a7j05x.js} +7 -7
  35. package/{index-w7q6h97v.js → index-0j1t1h2b.js} +3 -1
  36. package/{index-payhwt51.js → index-1h2jc0x3.js} +141 -67
  37. package/{index-vxmy1p4f.js → index-1qsd8ft1.js} +63 -123
  38. package/{index-s6da8ta9.js → index-2mwjshz5.js} +158 -51
  39. package/index-2nxk8wgs.js +266 -0
  40. package/{index-k5jbcxyh.js → index-2phm56a1.js} +49 -8
  41. package/{index-jje9qzyq.js → index-35j83zkd.js} +37 -3
  42. package/{index-m5n3ka0p.js → index-4am4dvmf.js} +13 -2
  43. package/index-75y7bcz4.js +28 -0
  44. package/{index-b8c289dx.js → index-7apsdr5g.js} +55 -12
  45. package/{index-8559hsz4.js → index-84h43kg6.js} +6 -5
  46. package/{index-eja64h28.js → index-9zy8479y.js} +5 -3
  47. package/{index-96wzdhfh.js → index-a1vb3x7t.js} +209 -36
  48. package/{index-52w0fvh8.js → index-bns3wcpc.js} +15 -0
  49. package/{index-am36s3jh.js → index-cjmjvg4r.js} +157 -117
  50. package/{index-1p0qbq3m.js → index-defp4gmb.js} +1 -1
  51. package/{index-4pdts00b.js → index-ewbmfarf.js} +10 -8
  52. package/{index-9rvcs76p.js → index-fhw7yq2d.js} +10 -10
  53. package/{index-8scw1pjk.js → index-g500c5j9.js} +178 -82
  54. package/{index-qxzrp5xt.js → index-g841cap9.js} +4 -4
  55. package/{index-qkkdhjm6.js → index-gr9thy79.js} +5 -5
  56. package/{index-4pf8g7ff.js → index-h7hehkw6.js} +3 -0
  57. package/{index-4mj92tsh.js → index-hm0tn7qv.js} +73 -68
  58. package/{index-r2wedvqn.js → index-j6eeh5d7.js} +1 -1
  59. package/{index-tgt2fnd6.js → index-j7hwy56s.js} +3 -3
  60. package/{index-rnphv731.js → index-jc2zbwra.js} +2 -2
  61. package/{index-z4b84y6k.js → index-khk05tsf.js} +1 -1
  62. package/{index-tvehn2sp.js → index-qd7xn2bk.js} +1 -1
  63. package/{index-266dewjs.js → index-qw6814m4.js} +53 -15
  64. package/{index-zcf6k8a5.js → index-raz588b3.js} +47 -12
  65. package/{index-at7bz0xq.js → index-s4nvxpzm.js} +2 -0
  66. package/{index-3yz30c07.js → index-sp0qsr7a.js} +114 -12
  67. package/{index-1shvxzt0.js → index-sveq36gh.js} +39 -42
  68. package/{index-r2w2eh93.js → index-t1t9wq9a.js} +4 -4
  69. package/index-t78230d7.js +191 -0
  70. package/{index-r0k3ham2.js → index-tgqameyb.js} +4 -4
  71. package/{index-dd44g6vz.js → index-tp56652m.js} +5 -5
  72. package/index-w15mg3km.js +389 -0
  73. package/{index-xq543a5y.js → index-y4kcmbt2.js} +2 -2
  74. package/index-yf9wc28h.js +52 -0
  75. package/{index-xqgwjz7a.js → index-zbrwnmf1.js} +9 -7
  76. package/{index-xxfy1jp2.js → index-zttm13c3.js} +4 -4
  77. package/index.js +24 -24
  78. package/{library.command-2853y6mk.js → library.command-63hgt9te.js} +4 -4
  79. package/{localRegistry.command-76ds31p4.js → localRegistry.command-g3f8k25t.js} +43 -23
  80. package/{module.command-yfnb0abs.js → module.command-r4sa2khp.js} +7 -6
  81. package/{package.command-d9s86hp9.js → package.command-96eheyvd.js} +5 -5
  82. package/package.json +2 -2
  83. package/{page.command-6a8a8rd1.js → page.command-gs6d841d.js} +4 -4
  84. package/{pipeline.command-rt3rwd2z.js → pipeline.command-wdfvdbfj.js} +3 -3
  85. package/{primitive.command-emcebgrq.js → primitive.command-dfsv4mpe.js} +8 -7
  86. package/{projectTypecheck-51m7eh1f.js → projectTypecheck-kqj1t6hb.js} +1 -1
  87. package/{prompter-hgcta8pb.js → prompter-qrwx1p17.js} +2 -2
  88. package/{quality.command-xtrk0n3x.js → quality.command-webzxee2.js} +6 -4
  89. package/{repair.command-51szxnxx.js → repair.command-3r3j1xre.js} +7 -6
  90. package/{scalar.command-8qv27t82.js → scalar.command-e8y47j6d.js} +6 -5
  91. package/skills/akan-agent/SKILL.md +8 -1
  92. package/skills/akan-code/SKILL.md +37 -11
  93. package/skills/akan-debug/SKILL.md +2 -1
  94. package/skills/akan-err/SKILL.md +2 -1
  95. package/skills/akan-query/SKILL.md +3 -2
  96. package/skills/akan-runtime/SKILL.md +3 -0
  97. package/{subspace.command-pn56pnh8.js → subspace.command-a1sf9n5a.js} +12 -10
  98. package/templates/appSample/lib/task/task.signal.ts +14 -9
  99. package/templates/appSample/srvkit/guards.ts +11 -0
  100. package/templates/service/__model__.dictionary.ts +3 -5
  101. package/templates/workspaceRoot/.gitignore.template +1 -0
  102. package/{tunnel.command-q2h0j2en.js → tunnel.command-dcb0wg93.js} +25 -13
  103. package/{verify.command-z1dsbmrt.js → verify.command-yyepccbh.js} +13 -11
  104. package/{workflow.command-r3y67jeq.js → workflow.command-z5pg9ay0.js} +12 -11
  105. package/{workspace.command-t2f0xsrw.js → workspace.command-d7x5jttw.js} +74 -47
  106. package/CodeAgent-35wnb7w5.js +0 -9
  107. package/CodeAgentRpcListener-7p7z5dd7.js +0 -97
  108. package/TunnelShare-xyjpa7gx.js +0 -14
  109. package/cloud.script-0s1jybd5.js +0 -26
  110. package/code.command-mpkm2emr.js +0 -167
  111. package/context.runner-ch0z3a8g.js +0 -26
  112. package/index-c6eggbee.js +0 -123
  113. package/index-ksfgqq1x.js +0 -49
@@ -4,35 +4,37 @@ import {
4
4
  runner,
5
5
  script,
6
6
  command
7
- } from "./index-eja64h28.js";
8
- import"./index-52w0fvh8.js";
7
+ } from "./index-9zy8479y.js";
8
+ import"./index-bns3wcpc.js";
9
9
  import {
10
10
  PkgExecutor
11
- } from "./index-8scw1pjk.js";
11
+ } from "./index-g500c5j9.js";
12
+ import {
13
+ npmRegistryFromEnv,
14
+ warnIgnoredNpmRegistry,
15
+ getNpmRegistryUrl
16
+ } from "./index-4am4dvmf.js";
12
17
  import"./index-p6x5b7hr.js";
13
- import"./index-3yz30c07.js";
14
- import"./index-w7q6h97v.js";
18
+ import"./index-sp0qsr7a.js";
19
+ import"./index-0j1t1h2b.js";
15
20
  import"./index-m9jj544v.js";
16
- import"./index-1shvxzt0.js";
17
- import"./index-xqgwjz7a.js";
18
- import"./index-xq543a5y.js";
19
- import"./index-s6da8ta9.js";
21
+ import"./index-zbrwnmf1.js";
22
+ import"./index-sveq36gh.js";
23
+ import"./index-y4kcmbt2.js";
24
+ import"./index-2mwjshz5.js";
20
25
  import {
21
26
  ApplicationScript
22
- } from "./index-4pdts00b.js";
27
+ } from "./index-ewbmfarf.js";
23
28
  import"./index-tenw3mah.js";
24
- import"./index-qkkdhjm6.js";
29
+ import"./index-gr9thy79.js";
25
30
  import {
26
31
  CloudRunner
27
- } from "./index-payhwt51.js";
28
- import"./index-tvehn2sp.js";
32
+ } from "./index-1h2jc0x3.js";
33
+ import"./index-qd7xn2bk.js";
29
34
  import {
30
35
  PackageScript
31
- } from "./index-8559hsz4.js";
32
- import {
33
- getNpmRegistryUrl
34
- } from "./index-m5n3ka0p.js";
35
- import"./index-1p0qbq3m.js";
36
+ } from "./index-84h43kg6.js";
37
+ import"./index-defp4gmb.js";
36
38
  import"./index-9bv479q5.js";
37
39
 
38
40
  // pkgs/@akanjs/cli/localRegistry/localRegistry.runner.ts
@@ -43,15 +45,31 @@ var defaultLocalRegistryUrl = "http://127.0.0.1:4873";
43
45
  var containerName = "akan-verdaccio";
44
46
  var smokeRepoName = "akan-local-smoke";
45
47
  var smokeAppName = "demo";
48
+ var ipv4Pattern = /^\d{1,3}(?:\.\d{1,3}){3}$/;
46
49
 
47
50
  class LocalRegistryRunner extends runner("localRegistry") {
48
- getRegistryUrl(registryUrl = process.env.AKAN_NPM_REGISTRY ?? defaultLocalRegistryUrl) {
51
+ getRegistryUrl(registryUrl = npmRegistryFromEnv() ?? defaultLocalRegistryUrl) {
49
52
  return getNpmRegistryUrl(registryUrl);
50
53
  }
54
+ static publishAddressOf(registry) {
55
+ const { hostname, port } = new URL(registry);
56
+ return { host: ipv4Pattern.test(hostname) ? hostname : "127.0.0.1", port: port || "4873" };
57
+ }
58
+ static #listensEverywhere(inspectOutput) {
59
+ try {
60
+ const [container] = JSON.parse(inspectOutput);
61
+ return Object.values(container?.HostConfig?.PortBindings ?? {}).some((bindings) => (bindings ?? []).some(({ HostIp }) => !HostIp || HostIp === "0.0.0.0" || HostIp === "::"));
62
+ } catch {
63
+ return false;
64
+ }
65
+ }
51
66
  async start(workspace, { registryUrl } = {}) {
52
67
  const registry = this.getRegistryUrl(registryUrl);
68
+ const address = LocalRegistryRunner.publishAddressOf(registry);
53
69
  try {
54
- await workspace.spawn("docker", ["inspect", containerName]);
70
+ const inspected = await workspace.spawn("docker", ["inspect", containerName]);
71
+ if (address.host !== "0.0.0.0" && LocalRegistryRunner.#listensEverywhere(inspected))
72
+ Logger.warn(`The running ${containerName} container listens on every network interface; run \`docker rm -f ${containerName}\` and start it again to bind it to ${address.host}.`);
55
73
  Logger.info(`Local registry is already running at ${registry}`);
56
74
  return registry;
57
75
  } catch {}
@@ -65,7 +83,7 @@ class LocalRegistryRunner extends runner("localRegistry") {
65
83
  "--name",
66
84
  containerName,
67
85
  "-p",
68
- "4873:4873",
86
+ `${address.host}:${address.port}:4873`,
69
87
  "-v",
70
88
  `${configPath}:/verdaccio/conf/config.yaml:ro`,
71
89
  "-v",
@@ -149,14 +167,16 @@ class LocalRegistryScript extends script("localRegistry", [
149
167
  class LocalRegistryCommand extends command("local-registry", [LocalRegistryScript], ({ public: target }) => ({
150
168
  startRegistry: target({ devOnly: true, desc: "Start the local Verdaccio npm registry" }).with(Workspace).option("registry", String, {
151
169
  desc: "local npm registry URL",
152
- default: process.env.AKAN_NPM_REGISTRY ?? "http://127.0.0.1:4873"
170
+ default: npmRegistryFromEnv() ?? "http://127.0.0.1:4873"
153
171
  }).exec(async function(workspace, registry) {
172
+ warnIgnoredNpmRegistry();
154
173
  await this.localRegistryScript.start(workspace, { registryUrl: registry });
155
174
  }),
156
175
  resetRegistry: target({ devOnly: true, desc: "Stop and clear the local Verdaccio npm registry" }).with(Workspace).exec(async function(workspace) {
157
176
  await this.localRegistryScript.reset(workspace);
158
177
  }),
159
- smokeRegistry: target({ devOnly: true, desc: "Publish to local registry and build a generated workspace" }).with(Workspace).option("tag", String, { flag: "g", desc: "dist-tag for local registry publish", default: "rc" }).option("test", Boolean, { desc: "run package tests before publishing", default: true }).option("registry", String, { desc: "local npm registry URL", default: process.env.AKAN_NPM_REGISTRY }).exec(async function(workspace, tag, test, registry) {
178
+ smokeRegistry: target({ devOnly: true, desc: "Publish to local registry and build a generated workspace" }).with(Workspace).option("tag", String, { flag: "g", desc: "dist-tag for local registry publish", default: "rc" }).option("test", Boolean, { desc: "run package tests before publishing", default: true }).option("registry", String, { desc: "local npm registry URL", default: npmRegistryFromEnv() }).exec(async function(workspace, tag, test, registry) {
179
+ warnIgnoredNpmRegistry();
160
180
  await this.localRegistryScript.smoke(workspace, { tag, test, registryUrl: registry });
161
181
  })
162
182
  })) {
@@ -3,16 +3,17 @@ import {
3
3
  Sys,
4
4
  Module,
5
5
  command
6
- } from "./index-eja64h28.js";
7
- import"./index-52w0fvh8.js";
8
- import"./index-8scw1pjk.js";
6
+ } from "./index-9zy8479y.js";
7
+ import"./index-bns3wcpc.js";
8
+ import"./index-g500c5j9.js";
9
9
  import {
10
10
  renderPrimitiveReport
11
- } from "./index-4mj92tsh.js";
12
- import"./index-z4b84y6k.js";
11
+ } from "./index-hm0tn7qv.js";
12
+ import"./index-2nxk8wgs.js";
13
+ import"./index-khk05tsf.js";
13
14
  import {
14
15
  ModuleScript
15
- } from "./index-r2w2eh93.js";
16
+ } from "./index-t1t9wq9a.js";
16
17
 
17
18
  // pkgs/@akanjs/cli/module/module.command.ts
18
19
  import { Logger, lowerlize } from "akanjs/common";
@@ -3,13 +3,13 @@ import {
3
3
  Pkg,
4
4
  Workspace,
5
5
  command
6
- } from "./index-eja64h28.js";
7
- import"./index-52w0fvh8.js";
8
- import"./index-8scw1pjk.js";
9
- import"./index-tvehn2sp.js";
6
+ } from "./index-9zy8479y.js";
7
+ import"./index-bns3wcpc.js";
8
+ import"./index-g500c5j9.js";
9
+ import"./index-qd7xn2bk.js";
10
10
  import {
11
11
  PackageScript
12
- } from "./index-8559hsz4.js";
12
+ } from "./index-84h43kg6.js";
13
13
 
14
14
  // pkgs/@akanjs/cli/package/package.command.ts
15
15
  class PackageCommand extends command("package", [PackageScript], ({ public: target }) => ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akanjs/cli",
3
- "version": "3.1.1",
3
+ "version": "3.1.2-rc.1",
4
4
  "sourceType": "module",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -39,7 +39,7 @@
39
39
  "@earendil-works/pi-tui": "1.3.0",
40
40
  "@inquirer/prompts": "^8.7.3",
41
41
  "@tailwindcss/node": "^4.3.3",
42
- "akanjs": "3.1.1",
42
+ "akanjs": "3.1.2-rc.1",
43
43
  "chalk": "^6.0.1",
44
44
  "commander": "^15.0.0",
45
45
  "dayjs": "^1.11.23",
@@ -3,12 +3,12 @@ import {
3
3
  App,
4
4
  Module,
5
5
  command
6
- } from "./index-eja64h28.js";
7
- import"./index-52w0fvh8.js";
8
- import"./index-8scw1pjk.js";
6
+ } from "./index-9zy8479y.js";
7
+ import"./index-bns3wcpc.js";
8
+ import"./index-g500c5j9.js";
9
9
  import {
10
10
  PageScript
11
- } from "./index-z4b84y6k.js";
11
+ } from "./index-khk05tsf.js";
12
12
 
13
13
  // pkgs/@akanjs/cli/page/page.command.ts
14
14
  class PageCommand extends command("page", [PageScript], ({ public: target }) => ({
@@ -4,15 +4,15 @@ import {
4
4
  runner,
5
5
  script,
6
6
  command
7
- } from "./index-eja64h28.js";
7
+ } from "./index-9zy8479y.js";
8
8
  import {
9
9
  FileSys2
10
- } from "./index-52w0fvh8.js";
10
+ } from "./index-bns3wcpc.js";
11
11
  import {
12
12
  AkanAppConfig,
13
13
  AkanWorkspaceConfig,
14
14
  AppExecutor
15
- } from "./index-8scw1pjk.js";
15
+ } from "./index-g500c5j9.js";
16
16
  import {
17
17
  resolveMobileTargets
18
18
  } from "./index-m9jj544v.js";
@@ -2,17 +2,18 @@
2
2
  import {
3
3
  Workspace,
4
4
  command
5
- } from "./index-eja64h28.js";
6
- import"./index-52w0fvh8.js";
7
- import"./index-8scw1pjk.js";
5
+ } from "./index-9zy8479y.js";
6
+ import"./index-bns3wcpc.js";
7
+ import"./index-g500c5j9.js";
8
8
  import {
9
9
  renderPrimitiveReport
10
- } from "./index-4mj92tsh.js";
11
- import"./index-z4b84y6k.js";
12
- import"./index-r2w2eh93.js";
10
+ } from "./index-hm0tn7qv.js";
11
+ import"./index-2nxk8wgs.js";
12
+ import"./index-khk05tsf.js";
13
+ import"./index-t1t9wq9a.js";
13
14
  import {
14
15
  PrimitiveScript
15
- } from "./index-qxzrp5xt.js";
16
+ } from "./index-g841cap9.js";
16
17
 
17
18
  // pkgs/@akanjs/cli/primitive/primitive.command.ts
18
19
  import { Logger } from "akanjs/common";
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  ProjectTypecheck2
4
- } from "./index-8scw1pjk.js";
4
+ } from "./index-g500c5j9.js";
5
5
  export {
6
6
  ProjectTypecheck2 as ProjectTypecheck
7
7
  };
@@ -1,8 +1,8 @@
1
1
  // @bun
2
2
  import {
3
3
  Prompter2
4
- } from "./index-r2wedvqn.js";
5
- import"./index-52w0fvh8.js";
4
+ } from "./index-j6eeh5d7.js";
5
+ import"./index-bns3wcpc.js";
6
6
  export {
7
7
  Prompter2 as Prompter
8
8
  };
@@ -3,21 +3,23 @@ import {
3
3
  Workspace,
4
4
  script,
5
5
  command
6
- } from "./index-eja64h28.js";
7
- import"./index-52w0fvh8.js";
6
+ } from "./index-9zy8479y.js";
7
+ import"./index-bns3wcpc.js";
8
8
  import {
9
9
  AppExecutor,
10
10
  LibExecutor
11
- } from "./index-8scw1pjk.js";
11
+ } from "./index-g500c5j9.js";
12
12
  import {
13
13
  MaintainabilityBaseline,
14
14
  WorkspaceRunner,
15
15
  AkanQualityScanner,
16
16
  formatQualityScanResult,
17
17
  formatSsrScanResult
18
- } from "./index-am36s3jh.js";
18
+ } from "./index-cjmjvg4r.js";
19
+ import"./index-2nxk8wgs.js";
19
20
  import"./index-62md4dwy.js";
20
21
  import"./index-hj6w4ka1.js";
22
+ import"./index-4am4dvmf.js";
21
23
  import"./index-fbewhg4g.js";
22
24
 
23
25
  // pkgs/@akanjs/cli/quality/quality.script.ts
@@ -3,15 +3,16 @@ import {
3
3
  Workspace,
4
4
  script,
5
5
  command
6
- } from "./index-eja64h28.js";
7
- import"./index-52w0fvh8.js";
8
- import"./index-8scw1pjk.js";
6
+ } from "./index-9zy8479y.js";
7
+ import"./index-bns3wcpc.js";
8
+ import"./index-g500c5j9.js";
9
9
  import"./index-hj6w4ka1.js";
10
- import"./index-4mj92tsh.js";
11
- import"./index-tgt2fnd6.js";
10
+ import"./index-hm0tn7qv.js";
11
+ import"./index-2nxk8wgs.js";
12
+ import"./index-j7hwy56s.js";
12
13
  import {
13
14
  RepairRunner
14
- } from "./index-k5jbcxyh.js";
15
+ } from "./index-2phm56a1.js";
15
16
 
16
17
  // pkgs/@akanjs/cli/repair/repair.script.ts
17
18
  import { Logger } from "akanjs/common";
@@ -2,15 +2,16 @@
2
2
  import {
3
3
  Sys,
4
4
  command
5
- } from "./index-eja64h28.js";
6
- import"./index-52w0fvh8.js";
7
- import"./index-8scw1pjk.js";
5
+ } from "./index-9zy8479y.js";
6
+ import"./index-bns3wcpc.js";
7
+ import"./index-g500c5j9.js";
8
8
  import {
9
9
  renderPrimitiveReport
10
- } from "./index-4mj92tsh.js";
10
+ } from "./index-hm0tn7qv.js";
11
+ import"./index-2nxk8wgs.js";
11
12
  import {
12
13
  ScalarScript
13
- } from "./index-rnphv731.js";
14
+ } from "./index-jc2zbwra.js";
14
15
 
15
16
  // pkgs/@akanjs/cli/scalar/scalar.command.ts
16
17
  import { Logger, lowerlize } from "akanjs/common";
@@ -14,7 +14,10 @@ agent nothing, and only the current page's declarations are live.
14
14
  1. Mount `<Agent.Chat />` once, in a layout. It never executes tools: every tool runs in the caller's browser,
15
15
  gated by guards and the approval card.
16
16
  2. It refuses every call until `option.setAgentAccess(<guard>)` in `lib/option.ts` names who may use it
17
- (`SignedIn` for a product with accounts). What a turn may ask is `option.setAgentRequestPolicy`.
17
+ (`SignedIn` for a product with accounts). What a turn may ask is `option.setAgentRequestPolicy`; until one is
18
+ set, a turn past `AgentRelayPolicy.defaultLimits` is refused with 413, and a policy of the app's own keeps them
19
+ with `AgentRelayPolicy.capped(request, limits)`. An error that is not an `Err` reaches the chat as a generic
20
+ failure unless `AKAN_ERROR_DETAIL=1` or a development runtime shows it.
18
21
  3. The LLM is `option.setLlm({ apiKey, model, host })`, never env.
19
22
 
20
23
  ## Publish actions
@@ -22,6 +25,8 @@ agent nothing, and only the current page's declarations are live.
22
25
  - Declare the tool beside the control that already does it, and hand the result to the control:
23
26
  `st.tool("x").desc("…").arg("id", ID).exec((id) => st.do.removeX(id))`. One handler serves the person and the
24
27
  agent; `.desc()` is required and first.
28
+ - A name starting with a write verb (`remove`, `delete`, `create`, `update`, `upsert`, `submit`, `save`, `send`,
29
+ `export`) asks the user first; `{ confirm: false }` opts one tool out, `AgentConfirm.set` the app.
25
30
  - `.card(({ submit, cancel }) => <Form … />)` parks the call in the chat for an answer that is the user's to give.
26
31
  - Store-driven forms publish themselves: `onChange={st.do.setFieldOnX}` by reference emits the `data-akan-action`
27
32
  the agent drives. A pass-through arrow publishes nothing and fails lint.
@@ -30,6 +35,8 @@ agent nothing, and only the current page's declarations are live.
30
35
  ## Reads and guidance
31
36
 
32
37
  - `st.use.x({ agent: false })` hides a key; `hidden`, `secret` and `visual` fields are stripped from every read.
38
+ - Page text is data the model reads, never instructions: after a screen read the next call that changes something
39
+ asks once, and `data-agent-private="<label>"` keeps a region's text out of every read.
33
40
  - A tool value is capped at 20,000 characters.
34
41
  - Route guidance is `<Agent.Guide instructions="…" />`; model-facing text is English.
35
42
 
@@ -9,9 +9,9 @@ This is the tool the user is talking to right now. When they ask how to do somet
9
9
  with their code — answer from here, and quote the exact gesture: the slash command to type, or the file to
10
10
  edit. Do not guess a command; everything this tool offers is listed below.
11
11
 
12
- You cannot type a slash command yourself. They are the host's, not yours — say which one to type. You *can*
13
- edit the files named below, which is the useful half of most of these answers: write the change, then say
14
- which command makes it take effect.
12
+ You cannot type a slash command yourself. They are the host's, not yours — say which one to type. You cannot
13
+ edit `mcp.json`, `.akan/code/extensions/` or anything under `~/.akan/` either: the deny list covers them, so
14
+ quote the `/mcp` command that makes the change instead. The context files and skills named below you can edit.
15
15
 
16
16
  ## MCP servers
17
17
 
@@ -52,8 +52,17 @@ From the prompt:
52
52
 
53
53
  **A server added now is not reachable until the session reloads.** The tool allowlist is fixed when the
54
54
  session is created, so `add`, `remove`, `login` and `logout` all reload by themselves — a session that has
55
- said nothing yet has nothing on disk to reopen, and says so. If you edit `mcp.json` yourself, tell the user to
56
- run `/mcp reload`.
55
+ said nothing yet has nothing on disk to reopen, and says so. After the user edits `mcp.json` by hand, `/mcp
56
+ reload` makes it take effect.
57
+
58
+ **This repo's own servers start only once the user approves them.** At start, `akan code` lists what this
59
+ repo's `.akan/code/mcp.json` would run, and the extensions in `.akan/code/extensions/`, and asks once; a yes is
60
+ remembered in `~/.akan/code/trust.json` until that content changes, and is asked again after. An extensions
61
+ folder past 10,000 files or 64 MiB, or with a link that leads out of it, is asked about at every start. With
62
+ nobody at a terminal they are not started, and `/mcp` shows `not approved`. `--trust-workspace` (`-T`) starts
63
+ them for one run without asking. Servers in `~/.akan/code/mcp.json`, where `/mcp add` writes, need no approval;
64
+ `/mcp add --local` writes this repo's file and keeps the approval it had, so a server added while that file
65
+ waits for approval waits with it.
57
66
 
58
67
  `/mcp remove` on a name both files declare takes this repo's entry and leaves the home file's in force; its
59
68
  notice says so, and running it again removes that one too.
@@ -61,8 +70,9 @@ notice says so, and running it again removes that one too.
61
70
  Sign-in is discovered, not configured: the server's `401` names its resource metadata, that names the
62
71
  authorization server, and most hosted servers register a client on demand — so a url is usually the whole
63
72
  entry. For a provider that issues client ids by hand, add `"oauth": { "clientId": "…", "scope": "…" }`.
64
- Tokens are stored per server in `~/.akan/code/mcpAuth.json` at mode 0600, never in the repo, and refreshed
65
- silently — at connect when one has expired, and mid-session when a server refuses one, after which the call is
73
+ Tokens are stored in `~/.akan/code/mcpAuth.json` at mode 0600, never in the repo, bound to the server's origin
74
+ rather than its name — a server renamed in the file keeps its sign-in, and one moved to another url signs in
75
+ again. They are refreshed silently — at connect when one has expired, and mid-session when a server refuses one, after which the call is
66
76
  retried once. When a refresh cannot fix it, `/mcp` shows `sign-in needed` and that server's tools answer with
67
77
  `/mcp login <name>` until the user signs in; the sign-in reloads the session, which brings the server back.
68
78
 
@@ -89,16 +99,19 @@ Stored under `.akan/code/sessions` — project history, so a second checkout of
89
99
  - A provider is authorized by **`<PROVIDER>_API_KEY`** — `DEEPSEEK_API_KEY`, `ANTHROPIC_API_KEY`. The
90
100
  workspace's own `.env` is read as well as the environment, and a key found there is used for the run and
91
101
  never copied anywhere.
92
- - Credentials and the model catalogue live in `~/.akan/code/` (`auth.json`, `models.json`). **`AKAN_CODE_HOME`
93
- moves the whole directory** — for a container with no home, or a checkout that wants its own.
102
+ - Credentials and the model catalogue live in `~/.akan/code/` (`auth.json`, `models.json`), mode 0700.
103
+ **`AKAN_CODE_HOME` moves the whole directory** — for a container with no home, or a checkout that wants its
104
+ own. It, `AKAN_CODE_CAN_PROMPT`, the `AKAN_CODE_PROXY_*` settings and `AKAN_CODE_RPC_TOKEN_FILE` are read
105
+ from the shell only: one a repo's `.env` names is ignored, with a warning at start.
94
106
 
95
107
  ## What the agent reads, and how to change it
96
108
 
97
109
  - Every `AGENTS.md` / `CLAUDE.md` from the workspace root down to the working directory, `.cursorrules`, and
98
110
  any `.cursor/rules/*.mdc` that applies unconditionally (`alwaysApply: true`, or no frontmatter at all).
99
111
  Edit those to change how this agent behaves in this repo — they are the files the editor beside it reads.
100
- - Skills: drop a `<name>/SKILL.md` into `.akan/code/skills`. Extensions: `.akan/code/extensions`. Neither is
101
- read from a home directory, so a session behaves the same in two checkouts.
112
+ - Skills: drop a `<name>/SKILL.md` into `.akan/code/skills`. Extensions: `.akan/code/extensions`, loaded once
113
+ the user approves them (see MCP servers). Neither is read from a home directory, so a session behaves the
114
+ same in two checkouts.
102
115
 
103
116
  ## Keys
104
117
 
@@ -124,8 +137,21 @@ akan code -i "<prompt>" open the session with the prompt already sent
124
137
  --profile local|pod|review|web what it may do (default local)
125
138
  --model <provider>/<id> --thinking, --json, --rpc, --resume <id>
126
139
  --compact-at <percent> compact once the window is this full (10, 20, … 100)
140
+ --trust-workspace start this repo's MCP servers and extensions without asking
141
+ --no-ask-network never ask before an unlisted host (local profile)
142
+ --rpc-listen unix:<path>|tcp:[host:]<port> serve the RPC wire on a socket instead of stdio
127
143
  ```
128
144
 
145
+ `local` runs as the user: it refuses known secret files and the home credential stores, and asks before it
146
+ fetches a page from a host off a short documentation list or a shell command that reaches the network
147
+ (`curl`, `ssh`, …) — refused outright where nobody can answer, as in a one-shot `akan code "<prompt>"`. It is
148
+ not a sandbox; `pod` in a container is.
149
+
150
+ A `tcp:` listener asks every connection to open with `{"auth":"<token>"}` on its first line; the token is a
151
+ fresh one in `~/.akan/code/rpc/<port>.token`, or the one in the file `AKAN_CODE_RPC_TOKEN_FILE` names.
152
+ `--no-rpc-token` drops it, and only a loopback address is bound unless `--rpc-bind-any` is given. A unix
153
+ socket is created owner-only and asks for no token.
154
+
129
155
  `review` reads and never writes, loads no project context files, and keeps no session on disk. `pod` has
130
156
  nobody in front of it: it cannot ask a question. MCP is off in both.
131
157
 
@@ -14,7 +14,8 @@ the server errors logged meanwhile, console errors and warnings, and layout smel
14
14
  - It uses the dev server that answers for this app and checkout. With none, it starts one for the run and
15
15
  stops it after; `--keep` leaves it up for the next preview. It never starts a second server beside a
16
16
  running one.
17
- - Paths are comma-separated and get the default locale when they lack one: `akan preview <app> /board,/board/new`.
17
+ - Paths are comma-separated (`akan preview <app> /board,/board/new`) and get the default locale when they lack
18
+ one, unless the app sets `localePrefix: "as-needed"` and `--csr` is off.
18
19
  `--changed` adds the pages your uncommitted page and layout edits reach. A dynamic route needs a concrete
19
20
  path (`/memo/1`); `akan context --app <app>` lists every route with its params and search names.
20
21
  - The viewport is a 390x844 phone; `--desktop` is 1280x800. `--csr` loads each page in the CSR boot the native
@@ -28,7 +28,8 @@ import path at all**, so keep throwing code out of them entirely rather than rea
28
28
 
29
29
  Best-effort code returns a sentinel (`null`, `undefined`, `{}`) instead of throwing. `try/catch` is rare and
30
30
  always converts an exception into a decision: a guard catches, warns, and returns `false`; an adapter
31
- catches, logs, and returns `null`. A store action never catches — let the framework toast the `Err`.
31
+ catches, logs, and returns `null`. A store action never catches — let the framework toast the `Err`, or list it in
32
+ the store's `static silent` when no screen waits on it and its caller handles the rejection.
32
33
  Client-side validation failure is `msg.error("<key>")` plus an early return, never a throw.
33
34
 
34
35
  **A failure another process reported travels as itself.** A server-to-server `fetch.<endpoint>(…, { origin })`
@@ -25,8 +25,9 @@ description: "Write filters, slices and list loading: query descriptors, init pa
25
25
  `purgeMany`, for data past retention.
26
26
  - A filter's `remove*` / `update*`, `updateById` and `removeById` run no hooks and no cascade. A model with a
27
27
  cascade or `_postRemove` removes through `remove<Model>(id)`.
28
- - Load a set once (`load<Model>Many`, one filter query) instead of one call per item in a loop — lint fails a
29
- per-item service call an endpoint reaches.
28
+ - Load a set once (`load<Model>Many`, one filter query) and create one with `create<Model>Many(rows)` instead of one
29
+ call per item in a loop — lint fails a per-item service call an endpoint reaches. `create<Model>Many` runs every
30
+ row's `_preCreate` before writing any, so a check there does not see the batch's own rows.
30
31
 
31
32
  ## Search and cascade
32
33
 
@@ -17,6 +17,7 @@ Domain code reaches none of them.
17
17
  | The production image | `docker: string \| { image, preRuns, postRuns, command }` |
18
18
  | iOS, Android, desktop | the `native` section; `desktop: { server: true }` carries the server |
19
19
  | SQLite, several databases, a cluster | `database: { modes: [...] }`, picked by `AKAN_DATABASE_MODE` |
20
+ | URLs without `/<locale>/`: one language, or paths fixed from outside (OAuth callback, QR code, mail link) | `i18n: { localePrefix: "as-needed" }` — the default locale's pages and `<Link>` hrefs drop the prefix, other locales keep it |
20
21
 
21
22
  - `main.ts` imports `AkanApp` from `akanjs/server/akanApp`, never the barrel.
22
23
  - Never write `/api` or `/ws` literally, and never pass a prefix as a prop.
@@ -28,6 +29,8 @@ Domain code reaches none of them.
28
29
  - `akan start <app>` (`a,b` or `all` for several) runs the dev server; `akan build <app>` checks the production
29
30
  build. A supervised session writes `local/apps/<app>/runtime/dev.log` — hand over that path, not a paste of the
30
31
  live view. Tail with `akan logs <app>`.
32
+ - Run a build without Docker with `cd dist/apps/<app> && bun main.js`: it boots with the env the Dockerfile sets,
33
+ read from `akan.env.json` beside it, and a variable you set yourself (`PORT=3000`) wins.
31
34
  - Give every log sink a floor (`Logger.addSink(sink, { minLevel })`) and never log once per delivered record.
32
35
 
33
36
  ## Native and desktop
@@ -5,29 +5,29 @@ import {
5
5
  runner,
6
6
  script,
7
7
  command
8
- } from "./index-eja64h28.js";
8
+ } from "./index-9zy8479y.js";
9
9
  import {
10
10
  FileSys2
11
- } from "./index-52w0fvh8.js";
11
+ } from "./index-bns3wcpc.js";
12
12
  import {
13
13
  LibSource,
14
14
  Executor,
15
15
  WorkspaceExecutor,
16
16
  AppExecutor
17
- } from "./index-8scw1pjk.js";
17
+ } from "./index-g500c5j9.js";
18
18
  import {
19
19
  GlobalConfig
20
- } from "./index-qkkdhjm6.js";
20
+ } from "./index-gr9thy79.js";
21
21
  import"./index-m9jj544v.js";
22
- import"./index-3yz30c07.js";
23
- import"./index-1shvxzt0.js";
24
- import"./index-xqgwjz7a.js";
22
+ import"./index-sp0qsr7a.js";
23
+ import"./index-zbrwnmf1.js";
24
+ import"./index-sveq36gh.js";
25
25
  import {
26
26
  SubspaceConfig
27
- } from "./index-4pf8g7ff.js";
27
+ } from "./index-h7hehkw6.js";
28
28
  import {
29
29
  SlicePlanner
30
- } from "./index-1p0qbq3m.js";
30
+ } from "./index-defp4gmb.js";
31
31
 
32
32
  // pkgs/@akanjs/devkit/subspace.ts
33
33
  import { mkdir as mkdir2 } from "fs/promises";
@@ -64,6 +64,8 @@ class SubspaceClone {
64
64
  constructor(workspace, declaration) {
65
65
  this.#workspace = workspace;
66
66
  this.#declaration = declaration;
67
+ if (!SubspaceConfig.namePattern.test(declaration.name))
68
+ throw new Error(`Subspace name "${declaration.name}" cannot name a folder under .akan/subspace.`);
67
69
  this.#clonePath = path.join(workspace.workspaceRoot, ".akan/subspace", declaration.name);
68
70
  this.#clone = new Executor(`subspace-${declaration.name}`, this.#clonePath);
69
71
  }
@@ -816,7 +818,7 @@ class SubspaceRunner extends runner("subspace") {
816
818
  if (!asked)
817
819
  return { name: subspace.name, workspaceId, host, apps, libs: [], outcome: "cancelled", files: [] };
818
820
  const { libs } = await subspace.slice();
819
- const { CloudScript } = await import("./cloud.script-0s1jybd5.js");
821
+ const { CloudScript } = await import("./cloud.script-hgvvajm3.js");
820
822
  const { files } = await CommandContainer.get(CloudScript).uploadEnv(workspace, {
821
823
  host,
822
824
  workspaceId,
@@ -1,7 +1,8 @@
1
1
  import type { AppInfo, LibInfo } from "akanjs";
2
2
 
3
3
  export default function getContent(scanInfo: AppInfo | LibInfo | null, dict: { appName: string }) {
4
- return `import { endpoint, internal, None, Public, slice } from "akanjs/signal";
4
+ return `import { LocalOrSignedIn } from "@apps/${dict.appName}/srvkit";
5
+ import { endpoint, internal, None, Public, slice } from "akanjs/signal";
5
6
 
6
7
  import * as cnst from "../cnst";
7
8
  import * as srv from "../srv";
@@ -23,25 +24,29 @@ export class TaskInternal extends internal(srv.task, ({ interval }) => ({})) {}
23
24
 
24
25
  // Guards, per key: root = the generated admin API (runs any filter with caller-supplied args), get = reads,
25
26
  // cru = create/update/remove. None here means "nobody until you name a guard".
26
- // The sample lets guests write so it works before the app has sign-in. Once it does, swap Public for SignedIn
27
- // (srvkit/guards.ts) on cru and on the mutations below — a real app never leaves writes Public.
28
- export class TaskSlice extends slice(srv.task, { guards: { root: None, get: Public, cru: Public } }, (init) => ({
29
- inPublic: init({ guards: [Public] }).exec(function () {
30
- return this.taskService.queryAny();
27
+ // Writes take LocalOrSignedIn (srvkit/guards.ts): open while the app runs locally or under test, so the sample works
28
+ // before the app has sign-in, and signed-in only once deployed. Once the app signs users in, swap it for SignedIn.
29
+ export class TaskSlice extends slice(
30
+ srv.task,
31
+ { guards: { root: None, get: Public, cru: LocalOrSignedIn } },
32
+ (init) => ({
33
+ inPublic: init({ guards: [Public] }).exec(function () {
34
+ return this.taskService.queryAny();
35
+ }),
31
36
  }),
32
- })) {}
37
+ ) {}
33
38
 
34
39
  // Every custom endpoint names its own guards array — the slice's map above only covers generated CRUD.
35
40
  // It is also the MCP decision: an endpoint declaring no guard, or a mutation guarded only by Public, is not
36
41
  // published to agents at all.
37
42
  export class TaskEndpoint extends endpoint(srv.task, ({ mutation }) => ({
38
- startTask: mutation(cnst.Task, { guards: [Public] })
43
+ startTask: mutation(cnst.Task, { guards: [LocalOrSignedIn] })
39
44
  .param("taskId", String)
40
45
  .exec(async function (taskId) {
41
46
  return await this.taskService.startTask(taskId);
42
47
  }),
43
48
 
44
- completeTask: mutation(cnst.Task, { guards: [Public] })
49
+ completeTask: mutation(cnst.Task, { guards: [LocalOrSignedIn] })
45
50
  .param("taskId", String)
46
51
  .exec(async function (taskId) {
47
52
  return await this.taskService.completeTask(taskId);