@akanjs/cli 3.1.2-rc.4 → 3.2.0-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 (120) hide show
  1. package/.build-stamp +1 -1
  2. package/{CodeAgent-z34p8m91.js → CodeAgent-vmd9k4ak.js} +3 -3
  3. package/{CodeTui-nvd9fk3g.js → CodeTui-zka44v52.js} +1 -1
  4. package/README.ko.md +9 -0
  5. package/README.md +9 -0
  6. package/TunnelShare-k3ja4w9x.js +14 -0
  7. package/{agent.command-962mp3kg.js → agent.command-2f657613.js} +19 -17
  8. package/akanCode.js +6 -6
  9. package/{application.command-1nr0bqq1.js → application.command-q6skd3am.js} +36 -22
  10. package/{applicationBuildRunner-xy7hnfzq.js → applicationBuildRunner-sctcmkyx.js} +55 -16
  11. package/buildBatch.proc.js +7 -7
  12. package/{cloud.command-cj7b3m6y.js → cloud.command-7642pks6.js} +36 -19
  13. package/cloud.script-1sfseznn.js +30 -0
  14. package/{code.command-asq7xrr6.js → code.command-7s4ndq2k.js} +6 -6
  15. package/commandManifest.json +1 -1
  16. package/{context.command-fw4g2pw1.js → context.command-569z0rqf.js} +20 -19
  17. package/context.runner-ms8v1rxy.js +29 -0
  18. package/{devTui-evr3b35y.js → devTui-w38ch13a.js} +1 -1
  19. package/{guideline.command-43gfjsjv.js → guideline.command-gnv3e8p8.js} +2 -2
  20. package/guidelines/akanApi/akanApi.instruction.md +317 -0
  21. package/guidelines/conventions/rules/app.md +5 -5
  22. package/guidelines/conventions/rules/config.md +1 -1
  23. package/guidelines/conventions/rules/gates.md +10 -5
  24. package/incrementalBuilder.proc.js +69 -39
  25. package/{index-0tkj05cz.js → index-0fb3cpbt.js} +3 -3
  26. package/{index-6t7fkx73.js → index-1q1cjn8s.js} +21 -11
  27. package/{index-tenw3mah.js → index-23860fej.js} +16 -6
  28. package/{index-6zgt7zmx.js → index-48d5qsj3.js} +4 -4
  29. package/{index-z47rw9ez.js → index-5w9my9qe.js} +8 -8
  30. package/{index-qwe079ww.js → index-6wpaq392.js} +61 -15
  31. package/{index-kc871vpc.js → index-7xdpww43.js} +69 -12
  32. package/index-7y5yghjg.js +2969 -0
  33. package/{index-38patcx6.js → index-8g7tdsk4.js} +249 -696
  34. package/{index-90q0w90q.js → index-8kczhnmv.js} +1 -1
  35. package/{index-kdswbvys.js → index-8pb9yvp8.js} +63 -21
  36. package/{index-hmj94es2.js → index-8ts9774g.js} +4 -4
  37. package/{index-r0q2ka2b.js → index-93ewzmp6.js} +43 -14
  38. package/{index-y0y0pnx8.js → index-9tbgb4d8.js} +1 -1
  39. package/{index-jzpeny42.js → index-a8a9ede9.js} +7 -7
  40. package/index-abgh0jve.js +126 -0
  41. package/{index-t0hk1kxq.js → index-aj3ehkcx.js} +1 -1
  42. package/{index-demt944k.js → index-d4n1wmrz.js} +37 -4
  43. package/{index-sra1a5f8.js → index-drz9e84d.js} +22 -8
  44. package/{index-gfh90r3t.js → index-e3vmjtph.js} +2 -2
  45. package/{index-k64mhwbw.js → index-eajbmk10.js} +2 -1
  46. package/{index-g0yds382.js → index-ed6ea0qp.js} +1 -1
  47. package/{index-ap6ac70m.js → index-fjr4d6yd.js} +444 -368
  48. package/index-hqrkqxx2.js +176 -0
  49. package/{index-ampz4vgv.js → index-kpdv34rq.js} +4 -4
  50. package/{index-kc6ffq0s.js → index-ktb3wcqz.js} +73 -34
  51. package/{index-dcm66hss.js → index-mmym5xmb.js} +4 -2
  52. package/{index-8d9r465x.js → index-mqntfzv5.js} +2 -2
  53. package/{index-4am4dvmf.js → index-ny2k80mv.js} +15 -3
  54. package/index-p6hjwt2d.js +1668 -0
  55. package/{index-53h0053j.js → index-rc5fvqj2.js} +12 -14
  56. package/{index-jzz6ye8x.js → index-s2grpzef.js} +40 -8
  57. package/{index-38by07nw.js → index-sr5da35e.js} +32 -9
  58. package/{index-qev8p5wp.js → index-sy481q2x.js} +1 -1
  59. package/{index-ck64kxrn.js → index-thckcabc.js} +2 -2
  60. package/{index-2yan1ajk.js → index-v4p1zye8.js} +18 -9
  61. package/{index-wymcdsas.js → index-vkzfk7qt.js} +25 -23
  62. package/{index-r8t5sq7z.js → index-vr68mxj5.js} +68 -21
  63. package/{index-vkpqe29t.js → index-w639tvkd.js} +24 -125
  64. package/index-ygdbn9jn.js +122 -0
  65. package/{index-w60zxxye.js → index-zpv14wpy.js} +3 -3
  66. package/index.js +24 -23
  67. package/{library.command-zh29tjdd.js → library.command-1gp5qe3r.js} +3 -3
  68. package/{localRegistry.command-k9pn9ahj.js → localRegistry.command-x7jptkd3.js} +26 -17
  69. package/{module.command-dgpqs9fz.js → module.command-4xz9he6h.js} +6 -6
  70. package/{package.command-1je4hsca.js → package.command-s7qpnn1g.js} +12 -3
  71. package/package.json +2 -2
  72. package/{page.command-cgsasanh.js → page.command-fan34c49.js} +3 -3
  73. package/{pipeline.command-tb46sa8v.js → pipeline.command-ph4fnn9w.js} +2 -2
  74. package/{primitive.command-bzsy23x5.js → primitive.command-3fqh8emf.js} +7 -7
  75. package/{projectTypecheck-h8rgaczy.js → projectTypecheck-vkb40hjc.js} +1 -1
  76. package/{quality.command-120m9h6v.js → quality.command-ecj6exsh.js} +15 -10
  77. package/{repair.command-6m4wd0qv.js → repair.command-fe9jw719.js} +6 -6
  78. package/{scalar.command-3dn5hsc6.js → scalar.command-cnvfhk0n.js} +5 -5
  79. package/skills/akan-debug/SKILL.md +2 -1
  80. package/skills/akan-page/SKILL.md +16 -7
  81. package/skills/akan-service/SKILL.md +48 -19
  82. package/{subspace.command-s8nyfqbn.js → subspace.command-qw5ddd6y.js} +8 -8
  83. package/templates/app/lib/___appName__/__appName__.abstract.md.template +6 -0
  84. package/templates/app/page/_index.tsx +4 -284
  85. package/templates/app/page/_layout.tsx +1 -26
  86. package/templates/app/page/styles.css.template +58 -318
  87. package/templates/appSample/page/_index.tsx +281 -0
  88. package/templates/appSample/page/_layout.tsx +55 -0
  89. package/templates/appSample/page/styles.css.template +327 -0
  90. package/templates/libRoot/lib/___libName__/__libName__.abstract.md.template +6 -0
  91. package/templates/workspaceRoot/package.json.template +1 -12
  92. package/{tunnel.command-8mwrqkr3.js → tunnel.command-ggj38mqf.js} +7 -7
  93. package/{verify.command-2pspfy7k.js → verify.command-w9ttxkdz.js} +16 -14
  94. package/{workflow.command-7sy5vnsj.js → workflow.command-ss8devj0.js} +12 -12
  95. package/{workspace.command-x518tdv4.js → workspace.command-6z2rh8ze.js} +51 -39
  96. package/TunnelShare-jwbb50kz.js +0 -14
  97. package/cloud.script-8kr7qgfa.js +0 -27
  98. package/context.runner-p6m5cxk3.js +0 -28
  99. package/index-d894868w.js +0 -842
  100. package/index-re2kfscb.js +0 -1363
  101. /package/templates/{app → appSample}/page/_overrides.tsx +0 -0
  102. /package/templates/{app → appSample}/public/fonts/Pretendard-Black.woff2 +0 -0
  103. /package/templates/{app → appSample}/public/fonts/Pretendard-Bold.woff2 +0 -0
  104. /package/templates/{app → appSample}/public/fonts/Pretendard-ExtraBold.woff2 +0 -0
  105. /package/templates/{app → appSample}/public/fonts/Pretendard-ExtraLight.woff2 +0 -0
  106. /package/templates/{app → appSample}/public/fonts/Pretendard-Light.woff2 +0 -0
  107. /package/templates/{app → appSample}/public/fonts/Pretendard-Medium.woff2 +0 -0
  108. /package/templates/{app → appSample}/public/fonts/Pretendard-Regular.woff2 +0 -0
  109. /package/templates/{app → appSample}/public/fonts/Pretendard-SemiBold.woff2 +0 -0
  110. /package/templates/{app → appSample}/public/fonts/Pretendard-Thin.woff2 +0 -0
  111. /package/templates/{app → appSample}/public/jelly/cloud.webp +0 -0
  112. /package/templates/{app → appSample}/public/jelly/comet.webp +0 -0
  113. /package/templates/{app → appSample}/public/jelly/moon.webp +0 -0
  114. /package/templates/{app → appSample}/public/jelly/planet.webp +0 -0
  115. /package/templates/{app → appSample}/public/jelly/rocket.webp +0 -0
  116. /package/templates/{app → appSample}/public/jelly/star.webp +0 -0
  117. /package/templates/{app → appSample}/public/jelly/sugar.webp +0 -0
  118. /package/templates/{app → appSample}/public/logo.png +0 -0
  119. /package/templates/{app → appSample}/ui/Recipe/index.ts +0 -0
  120. /package/templates/{app → appSample}/ui/Recipe/jellyButton.ts +0 -0
@@ -4,37 +4,41 @@ import {
4
4
  runner,
5
5
  script,
6
6
  command
7
- } from "./index-r0q2ka2b.js";
7
+ } from "./index-93ewzmp6.js";
8
8
  import"./index-bns3wcpc.js";
9
9
  import {
10
+ parseEnvFile,
10
11
  PkgExecutor
11
- } from "./index-38by07nw.js";
12
+ } from "./index-sr5da35e.js";
12
13
  import {
13
14
  npmRegistryFromEnv,
14
15
  warnIgnoredNpmRegistry,
15
16
  getNpmRegistryUrl
16
- } from "./index-4am4dvmf.js";
17
- import"./index-d894868w.js";
18
- import"./index-w60zxxye.js";
19
- import"./index-g0yds382.js";
17
+ } from "./index-ny2k80mv.js";
18
+ import"./index-p6hjwt2d.js";
19
+ import"./index-zpv14wpy.js";
20
+ import"./index-ed6ea0qp.js";
20
21
  import"./index-m9jj544v.js";
21
- import"./index-6t7fkx73.js";
22
- import"./index-dcm66hss.js";
23
- import"./index-8d9r465x.js";
24
- import"./index-kc6ffq0s.js";
22
+ import"./index-1q1cjn8s.js";
23
+ import"./index-mmym5xmb.js";
24
+ import"./index-mqntfzv5.js";
25
+ import"./index-ktb3wcqz.js";
26
+ import"./index-23860fej.js";
25
27
  import {
26
28
  ApplicationScript
27
- } from "./index-r8t5sq7z.js";
28
- import"./index-tenw3mah.js";
29
- import"./index-sra1a5f8.js";
29
+ } from "./index-vr68mxj5.js";
30
+ import"./index-drz9e84d.js";
30
31
  import {
31
32
  CloudRunner
32
- } from "./index-qwe079ww.js";
33
+ } from "./index-6wpaq392.js";
33
34
  import"./index-qd7xn2bk.js";
35
+ import"./index-7y5yghjg.js";
36
+ import"./index-abgh0jve.js";
37
+ import"./index-hqrkqxx2.js";
34
38
  import {
35
39
  PackageScript
36
- } from "./index-demt944k.js";
37
- import"./index-qev8p5wp.js";
40
+ } from "./index-d4n1wmrz.js";
41
+ import"./index-sy481q2x.js";
38
42
  import"./index-9bv479q5.js";
39
43
 
40
44
  // pkgs/@akanjs/cli/localRegistry/localRegistry.runner.ts
@@ -104,7 +108,12 @@ class LocalRegistryRunner extends runner("localRegistry") {
104
108
  const registry = this.getRegistryUrl(registryUrl);
105
109
  const smokeRoot = path.join(workspace.workspaceRoot, ".akan/e2e");
106
110
  await rm(path.join(smokeRoot, smokeRepoName), { recursive: true, force: true });
107
- const env = { ...process.env, AKAN_NPM_REGISTRY: registry, NPM_CONFIG_REGISTRY: registry };
111
+ const repoDotenv = parseEnvFile(path.join(workspace.workspaceRoot, ".env"));
112
+ const env = {
113
+ ...Object.fromEntries(Object.entries(process.env).filter(([key]) => !(key in repoDotenv))),
114
+ AKAN_NPM_REGISTRY: registry,
115
+ NPM_CONFIG_REGISTRY: registry
116
+ };
108
117
  await workspace.spawn(process.execPath, [
109
118
  "dist/pkgs/create-akan-workspace/index.js",
110
119
  smokeRepoName,
@@ -3,17 +3,17 @@ import {
3
3
  Sys,
4
4
  Module,
5
5
  command
6
- } from "./index-r0q2ka2b.js";
6
+ } from "./index-93ewzmp6.js";
7
7
  import"./index-bns3wcpc.js";
8
- import"./index-38by07nw.js";
8
+ import"./index-sr5da35e.js";
9
9
  import {
10
10
  renderPrimitiveReport
11
- } from "./index-kdswbvys.js";
12
- import"./index-re2kfscb.js";
13
- import"./index-t0hk1kxq.js";
11
+ } from "./index-8pb9yvp8.js";
12
+ import"./index-7y5yghjg.js";
13
+ import"./index-aj3ehkcx.js";
14
14
  import {
15
15
  ModuleScript
16
- } from "./index-hmj94es2.js";
16
+ } from "./index-8ts9774g.js";
17
17
 
18
18
  // pkgs/@akanjs/cli/module/module.command.ts
19
19
  import { Logger, lowerlize } from "akanjs/common";
@@ -3,13 +3,16 @@ import {
3
3
  Pkg,
4
4
  Workspace,
5
5
  command
6
- } from "./index-r0q2ka2b.js";
6
+ } from "./index-93ewzmp6.js";
7
7
  import"./index-bns3wcpc.js";
8
- import"./index-38by07nw.js";
8
+ import"./index-sr5da35e.js";
9
9
  import"./index-qd7xn2bk.js";
10
+ import"./index-7y5yghjg.js";
11
+ import"./index-abgh0jve.js";
12
+ import"./index-hqrkqxx2.js";
10
13
  import {
11
14
  PackageScript
12
- } from "./index-demt944k.js";
15
+ } from "./index-d4n1wmrz.js";
13
16
 
14
17
  // pkgs/@akanjs/cli/package/package.command.ts
15
18
  class PackageCommand extends command("package", [PackageScript], ({ public: target }) => ({
@@ -33,6 +36,12 @@ class PackageCommand extends command("package", [PackageScript], ({ public: targ
33
36
  }),
34
37
  verifyAkanPublishPackages: target({ devOnly: true, desc: "Verify all Akan publish dist packages" }).with(Workspace).exec(async function(workspace) {
35
38
  await this.packageScript.verifyAkanPublishPackages(workspace);
39
+ }),
40
+ syncArchitecture: target({
41
+ devOnly: true,
42
+ desc: "Regenerate the generated part of pkgs/akanjs/ARCHITECTURE.md from the framework source"
43
+ }).with(Workspace).exec(async function(workspace) {
44
+ await this.packageScript.syncArchitecture(workspace);
36
45
  })
37
46
  })) {
38
47
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akanjs/cli",
3
- "version": "3.1.2-rc.4",
3
+ "version": "3.2.0-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.2-rc.4",
42
+ "akanjs": "3.2.0-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-r0q2ka2b.js";
6
+ } from "./index-93ewzmp6.js";
7
7
  import"./index-bns3wcpc.js";
8
- import"./index-38by07nw.js";
8
+ import"./index-sr5da35e.js";
9
9
  import {
10
10
  PageScript
11
- } from "./index-t0hk1kxq.js";
11
+ } from "./index-aj3ehkcx.js";
12
12
 
13
13
  // pkgs/@akanjs/cli/page/page.command.ts
14
14
  class PageCommand extends command("page", [PageScript], ({ public: target }) => ({
@@ -4,7 +4,7 @@ import {
4
4
  runner,
5
5
  script,
6
6
  command
7
- } from "./index-r0q2ka2b.js";
7
+ } from "./index-93ewzmp6.js";
8
8
  import {
9
9
  FileSys2
10
10
  } from "./index-bns3wcpc.js";
@@ -12,7 +12,7 @@ import {
12
12
  AkanAppConfig,
13
13
  AkanWorkspaceConfig,
14
14
  AppExecutor
15
- } from "./index-38by07nw.js";
15
+ } from "./index-sr5da35e.js";
16
16
  import {
17
17
  resolveMobileTargets
18
18
  } from "./index-m9jj544v.js";
@@ -2,18 +2,18 @@
2
2
  import {
3
3
  Workspace,
4
4
  command
5
- } from "./index-r0q2ka2b.js";
5
+ } from "./index-93ewzmp6.js";
6
6
  import"./index-bns3wcpc.js";
7
- import"./index-38by07nw.js";
7
+ import"./index-sr5da35e.js";
8
8
  import {
9
9
  renderPrimitiveReport
10
- } from "./index-kdswbvys.js";
11
- import"./index-re2kfscb.js";
12
- import"./index-t0hk1kxq.js";
13
- import"./index-hmj94es2.js";
10
+ } from "./index-8pb9yvp8.js";
11
+ import"./index-7y5yghjg.js";
12
+ import"./index-aj3ehkcx.js";
13
+ import"./index-8ts9774g.js";
14
14
  import {
15
15
  PrimitiveScript
16
- } from "./index-6zgt7zmx.js";
16
+ } from "./index-48d5qsj3.js";
17
17
 
18
18
  // pkgs/@akanjs/cli/primitive/primitive.command.ts
19
19
  import { Logger } from "akanjs/common";
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  ProjectTypecheck2
4
- } from "./index-38by07nw.js";
4
+ } from "./index-sr5da35e.js";
5
5
  export {
6
6
  ProjectTypecheck2 as ProjectTypecheck
7
7
  };
@@ -3,24 +3,28 @@ import {
3
3
  Workspace,
4
4
  script,
5
5
  command
6
- } from "./index-r0q2ka2b.js";
6
+ } from "./index-93ewzmp6.js";
7
7
  import"./index-bns3wcpc.js";
8
8
  import {
9
9
  AppExecutor,
10
- LibExecutor
11
- } from "./index-38by07nw.js";
10
+ LibExecutor,
11
+ PkgExecutor
12
+ } from "./index-sr5da35e.js";
13
+ import {
14
+ MaintainabilityBaseline
15
+ } from "./index-hqrkqxx2.js";
12
16
  import {
13
- MaintainabilityBaseline,
14
17
  WorkspaceRunner,
15
18
  AkanQualityScanner,
16
19
  formatQualityScanResult,
17
20
  formatSsrScanResult
18
- } from "./index-ap6ac70m.js";
19
- import"./index-re2kfscb.js";
21
+ } from "./index-fjr4d6yd.js";
22
+ import"./index-7y5yghjg.js";
20
23
  import"./index-62md4dwy.js";
24
+ import"./index-ygdbn9jn.js";
21
25
  import"./index-hj6w4ka1.js";
22
- import"./index-4am4dvmf.js";
23
- import"./index-k64mhwbw.js";
26
+ import"./index-ny2k80mv.js";
27
+ import"./index-eajbmk10.js";
24
28
 
25
29
  // pkgs/@akanjs/cli/quality/quality.script.ts
26
30
  import { Logger } from "akanjs/common";
@@ -39,10 +43,11 @@ class QualityScript extends script("quality", [WorkspaceRunner]) {
39
43
  Logger.rawLog(format === "json" ? JSON.stringify(result, null, 2) : formatSsrScanResult(result));
40
44
  }
41
45
  async baseline(workspace, { force = false } = {}) {
42
- const [appNames, libNames] = await workspace.getExecs();
46
+ const [appNames, libNames, pkgNames] = await workspace.getExecs();
43
47
  const execs = [
44
48
  ...appNames.map((appName) => AppExecutor.from(workspace, appName)),
45
- ...libNames.map((libName) => LibExecutor.from(workspace, libName))
49
+ ...libNames.map((libName) => LibExecutor.from(workspace, libName)),
50
+ ...pkgNames.map((pkgName) => PkgExecutor.from(workspace, pkgName))
46
51
  ];
47
52
  const { fileName } = MaintainabilityBaseline;
48
53
  for (const exec of execs) {
@@ -3,16 +3,16 @@ import {
3
3
  Workspace,
4
4
  script,
5
5
  command
6
- } from "./index-r0q2ka2b.js";
6
+ } from "./index-93ewzmp6.js";
7
7
  import"./index-bns3wcpc.js";
8
- import"./index-38by07nw.js";
8
+ import"./index-sr5da35e.js";
9
9
  import"./index-hj6w4ka1.js";
10
- import"./index-kdswbvys.js";
11
- import"./index-re2kfscb.js";
12
- import"./index-ck64kxrn.js";
10
+ import"./index-8pb9yvp8.js";
11
+ import"./index-7y5yghjg.js";
12
+ import"./index-thckcabc.js";
13
13
  import {
14
14
  RepairRunner
15
- } from "./index-0tkj05cz.js";
15
+ } from "./index-0fb3cpbt.js";
16
16
 
17
17
  // pkgs/@akanjs/cli/repair/repair.script.ts
18
18
  import { Logger } from "akanjs/common";
@@ -2,16 +2,16 @@
2
2
  import {
3
3
  Sys,
4
4
  command
5
- } from "./index-r0q2ka2b.js";
5
+ } from "./index-93ewzmp6.js";
6
6
  import"./index-bns3wcpc.js";
7
- import"./index-38by07nw.js";
7
+ import"./index-sr5da35e.js";
8
8
  import {
9
9
  renderPrimitiveReport
10
- } from "./index-kdswbvys.js";
11
- import"./index-re2kfscb.js";
10
+ } from "./index-8pb9yvp8.js";
11
+ import"./index-7y5yghjg.js";
12
12
  import {
13
13
  ScalarScript
14
- } from "./index-gfh90r3t.js";
14
+ } from "./index-e3vmjtph.js";
15
15
 
16
16
  // pkgs/@akanjs/cli/scalar/scalar.command.ts
17
17
  import { Logger, lowerlize } from "akanjs/common";
@@ -15,7 +15,8 @@ the server errors logged meanwhile, console errors and warnings, and layout smel
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
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
+ one, unless the app sets `localePrefix: "as-needed"` and `--csr` is off. A `/_akan` route such as Studio
19
+ (`/_akan/studio?view=runtime`), a signal route or a file opens as written.
19
20
  `--changed` adds the pages your uncommitted page and layout edits reach. A dynamic route needs a concrete
20
21
  path (`/memo/1`); `akan context --app <app>` lists every route with its params and search names.
21
22
  - The viewport is a 390x844 phone; `--desktop` is 1280x800. `--csr` loads each page in the CSR boot the native
@@ -8,6 +8,11 @@ description: "Add or change a route under page/: the one page()/layout() chain,
8
8
  A route file exports one chain and nothing else. Every setting is a stage of it.
9
9
 
10
10
  ```tsx
11
+ import { fetch, Task, usePage } from "@apps/<app>/client";
12
+ import { signedIn } from "@libs/shared/webkit";
13
+ import { ID } from "akanjs/base";
14
+ import { page } from "akanjs/client";
15
+
11
16
  export default page()
12
17
  .param("orgId", ID)
13
18
  .guard(() => signedIn())
@@ -26,7 +31,8 @@ export default page()
26
31
  2. Name every `[x]` segment with `.param("x", Type)` and read a query key only with `.search("k", Type)`. Values
27
32
  arrive typed; `lang` reaches every stage and is never declared.
28
33
  3. Gate with `.guard(() => signedIn())` on the `_layout.tsx` (a real redirect before anything renders), and repeat
29
- a stricter guard on a page that needs more. The endpoint guards are still the real gate.
34
+ a stricter guard on a page that needs more. The endpoint guards are still the real gate. `signedIn` comes from
35
+ `@libs/shared/webkit`, and a new workspace has that lib only with `create-workspace --libs true`.
30
36
  4. In `.render()`: `usePage()`, then fetch, then return. Hand `fetch.init*` / `view*` / `edit*` fields to sections
31
37
  unawaited; await only what the shell reads, in one `Promise.all`.
32
38
  5. `.head()` takes JSX (or a function returning it), never a metadata object. A canonical link comes only from the
@@ -37,19 +43,21 @@ export default page()
37
43
  ## API at a glance
38
44
 
39
45
  `page`, `layout` and `router` come from `akanjs/client`, `Link` from `akanjs/ui`, `usePageLocation` from
40
- `akanjs/webkit`. A stage receives the declared params and search keys plus `lang`.
46
+ `akanjs/webkit`, and `fetch`, `usePage` and the model namespaces from `@apps/<app>/client`. A stage receives the
47
+ declared params and search keys plus `lang`.
41
48
 
42
- - Data-driven title: `.head(async ({ name }) => <title>{(await fetch.pokemon(name))?.label}</title>)`.
43
- - Async page: `.render(async ({ name }) => { const pokemon = await fetch.pokemon(name); if (!pokemon) router.notFound(); … })`;
49
+ - Data-driven title: `.head(async ({ id }) => <title>{((await fetch.book(id)) as Book | null)?.title}</title>)`,
50
+ where `Book` is the `common/` interface for the query's `Any` return (`akan-service`).
51
+ - Async page: `.render(async ({ id }) => { const book = (await fetch.book(id)) as Book | null; if (!book) return router.notFound(); … })`;
44
52
  the same query in `.head()` and `.render()` is one request.
45
53
  - `router.notFound()` from `.guard()`, `.head()` or `.render()` answers 404 with the nearest layout's `.notFound()`
46
54
  above it (an unmatched URL: the deepest layout covering it), else the built-in 404.
47
55
  - A layout's own 404 and error views: `.notFound(({ pathname }) => …)` and `.error(({ error }) => …)` on `layout()`
48
56
  or `rootLayout()`.
49
- - `<Link href="/pokemon/deoxys">`: write the path without the locale; Link adds it, or leaves it off for the default
57
+ - `<Link href="/books/OL45804W">`: write the path without the locale; Link adds it, or leaves it off for the default
50
58
  locale under `i18n.localePrefix: "as-needed"`. `activeClassName` marks the current one.
51
59
  - From a handler: `router.push(href)` / `router.replace(href)`; in a server stage, `router.redirect(href)`.
52
- - A client filter kept in the URL without reloading the page: ``router.replace(`/pokemon?q=${q}`, { shallow: true,
60
+ - A client filter kept in the URL without reloading the page: ``router.replace(`/books?q=${q}`, { shallow: true,
53
61
  scrollToTop: false })`` in a `"use client"` component, read back with `usePageLocation().searchParams`. Shallow
54
62
  holds only while the path stays the same; a server `.search()` sees the value at the next full navigation.
55
63
 
@@ -60,4 +68,5 @@ export default page()
60
68
  - `useState`, `useEffect`, comments, a named export beside the chain, or the legacy `export default async function`.
61
69
  - Editing a lib page through its link in `page/(libs)/` — edit the lib's own `page/` source.
62
70
 
63
- Full detail: `get_guideline` with `pageRule`, or `ssrRule` for what may render on the server.
71
+ Full detail: `get_guideline` with `pageRule`, or `ssrRule` for what may render on the server; every stage's
72
+ signature, the router's methods, Link's props and every import path: `akanApi`.
@@ -20,6 +20,10 @@ dictionary is a `serviceDictionary`.
20
20
  explicitly `void`-ed.
21
21
  - Return `null` / `false` for "not allowed" or "not found" and let the signal decide whether that is an
22
22
  error.
23
+ - `serve(name, { serverMode: "batch" }, …)` mounts the module, endpoints included, only in a `batch` or `all`
24
+ process; a `federation` replica, the one serving requests in a split deployment, skips it. The app's own
25
+ `lib/_<app>/` service is scaffolded with it for cron and queue work. Leave it off a service a page calls, as
26
+ `akan create-service` does.
23
27
 
24
28
  ## Reaching other things
25
29
 
@@ -33,11 +37,13 @@ self-registers, so do **not** add it to `lib/option.ts`.
33
37
 
34
38
  ## Recipe: pages backed by an external HTTP API
35
39
 
36
- `akan create-service pokeapi <app>` scaffolds `lib/_pokeapi/`; the adapter beside it is yours.
40
+ `akan create-service openlibrary <app>` scaffolds `lib/_openlibrary/`; the adapter beside it is yours.
37
41
 
38
42
  ```ts
39
- // srvkit/pokeApi.ts — read at boot, so the built server takes API_BASE_URL from the host that runs it
40
- export class PokeApi extends adapt("pokeApi" as const, ({ env }) => ({
43
+ // srvkit/bookApi.ts — read at boot, so the built server takes API_BASE_URL from the host that runs it
44
+ import { adapt } from "akanjs/service";
45
+
46
+ export class BookApi extends adapt("bookApi" as const, ({ env }) => ({
41
47
  baseUrl: env(() => process.env.API_BASE_URL ?? "http://localhost:9000"),
42
48
  })) {
43
49
  async get<T>(path: string): Promise<T | null> {
@@ -52,30 +58,53 @@ export class PokeApi extends adapt("pokeApi" as const, ({ env }) => ({
52
58
  }
53
59
  }
54
60
 
55
- // lib/_pokeapi/pokeapi.service.ts — shape the upstream JSON here, not in the page
56
- export class PokeapiService extends serve("pokeapi" as const, ({ plug }) => ({ pokeApi: plug(PokeApi) })) {
57
- async getPokemon(name: string) {
58
- const pokemon = await this.pokeApi.get<ApiPokemon>(`pokemon/${name}`);
59
- return pokemon && { id: pokemon.id, name: pokemon.name };
61
+ // lib/_openlibrary/openlibrary.service.ts — shape the upstream JSON here, not in the page
62
+ import { BookApi } from "@apps/<app>/srvkit";
63
+ import { serve } from "akanjs/service";
64
+
65
+ interface ApiWork {
66
+ key: string;
67
+ title: string;
68
+ }
69
+
70
+ export class OpenlibraryService extends serve("openlibrary" as const, ({ plug }) => ({ bookApi: plug(BookApi) })) {
71
+ async getBook(id: string) {
72
+ const work = await this.bookApi.get<ApiWork>(`works/${id}.json`);
73
+ return work && { id, title: work.title };
60
74
  }
61
75
  }
62
76
 
63
- // lib/_pokeapi/pokeapi.signal.ts — Any answers plain JSON; nullable lets it answer null for "not found"
64
- export class PokeapiEndpoint extends endpoint(srv.pokeapi, ({ query }) => ({
65
- pokemon: query(Any, { guards: [Public], nullable: true })
66
- .param("name", String)
67
- .exec(async function (name) {
68
- return await this.pokeapiService.getPokemon(name);
77
+ // lib/_openlibrary/openlibrary.signal.ts — Any answers plain JSON; nullable lets it answer null for "not found"
78
+ import { Any } from "akanjs/base";
79
+ import { endpoint, internal, Public } from "akanjs/signal";
80
+
81
+ import * as srv from "../srv";
82
+
83
+ export class OpenlibraryInternal extends internal(srv.openlibrary, () => ({})) {}
84
+
85
+ export class OpenlibraryEndpoint extends endpoint(srv.openlibrary, ({ query }) => ({
86
+ book: query(Any, { guards: [Public], nullable: true })
87
+ .param("id", String)
88
+ .exec(async function (id) {
89
+ return await this.openlibraryService.getBook(id);
69
90
  }),
70
91
  })) {}
71
92
 
72
- // lib/_pokeapi/pokeapi.dictionary.ts — typecheck asks a label for every endpoint
73
- .endpoint<PokeapiEndpoint>((fn) => ({ pokemon: fn(["Pokémon", "포켓몬"]) }))
93
+ // lib/_openlibrary/openlibrary.dictionary.ts — typecheck asks a label for every endpoint
94
+ import { serviceDictionary } from "akanjs/dictionary";
95
+
96
+ import type { OpenlibraryEndpoint } from "../sig";
97
+
98
+ export const dictionary = serviceDictionary(["en", "ko"])
99
+ .endpoint<OpenlibraryEndpoint>((fn) => ({ book: fn(["Book", "책"]) }))
100
+ .error({})
101
+ .translate({});
74
102
  ```
75
103
 
76
- The page calls it as `await fetch.pokemon(name)` (`fetch` from `@apps/<app>/client`) and answers
77
- `router.notFound()` on `null`. An `Any` return reaches the page as `unknown`: type it with an interface in
104
+ The page calls it as `await fetch.book(id)` (`fetch` from `@apps/<app>/client`) and ends with
105
+ `return router.notFound()` on `null`. An `Any` return reaches the page as `unknown`: type it with an interface in
78
106
  `common/`, or return a scalar (`akan create-scalar`) for a typed wire shape. A query that answers `null` without
79
107
  `nullable: true` fails the render, naming the endpoint.
80
108
 
81
- Full detail: `get_guideline` with `modelService`.
109
+ Full detail: `get_guideline` with `modelService`; every import path and the exact signatures of serve, adapt,
110
+ endpoint and serviceDictionary: `akanApi`.
@@ -5,7 +5,7 @@ import {
5
5
  runner,
6
6
  script,
7
7
  command
8
- } from "./index-r0q2ka2b.js";
8
+ } from "./index-93ewzmp6.js";
9
9
  import {
10
10
  FileSys2
11
11
  } from "./index-bns3wcpc.js";
@@ -14,20 +14,20 @@ import {
14
14
  Executor,
15
15
  WorkspaceExecutor,
16
16
  AppExecutor
17
- } from "./index-38by07nw.js";
17
+ } from "./index-sr5da35e.js";
18
18
  import {
19
19
  GlobalConfig
20
- } from "./index-sra1a5f8.js";
20
+ } from "./index-drz9e84d.js";
21
21
  import"./index-m9jj544v.js";
22
- import"./index-w60zxxye.js";
23
- import"./index-6t7fkx73.js";
24
- import"./index-dcm66hss.js";
22
+ import"./index-zpv14wpy.js";
23
+ import"./index-1q1cjn8s.js";
24
+ import"./index-mmym5xmb.js";
25
25
  import {
26
26
  SubspaceConfig
27
27
  } from "./index-h7hehkw6.js";
28
28
  import {
29
29
  SlicePlanner
30
- } from "./index-qev8p5wp.js";
30
+ } from "./index-sy481q2x.js";
31
31
 
32
32
  // pkgs/@akanjs/devkit/subspace.ts
33
33
  import { mkdir as mkdir2 } from "fs/promises";
@@ -818,7 +818,7 @@ class SubspaceRunner extends runner("subspace") {
818
818
  if (!asked)
819
819
  return { name: subspace.name, workspaceId, host, apps, libs: [], outcome: "cancelled", files: [] };
820
820
  const { libs } = await subspace.slice();
821
- const { CloudScript } = await import("./cloud.script-8kr7qgfa.js");
821
+ const { CloudScript } = await import("./cloud.script-1sfseznn.js");
822
822
  const { files } = await CommandContainer.get(CloudScript).uploadEnv(workspace, {
823
823
  host,
824
824
  workspaceId,
@@ -0,0 +1,6 @@
1
+ # <%= appName %> Service Abstract
2
+ The app's own service module. It owns no endpoint, job or state yet.
3
+
4
+ ## Rules
5
+ - `serverMode: "batch"` mounts it only in a `batch` or `all` process, so it suits cron and queue work; an endpoint a
6
+ page calls belongs in a module from `akan create-service`.