@akanjs/cli 3.1.2-rc.4 → 3.2.0-rc.0

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 (118) hide show
  1. package/.build-stamp +1 -1
  2. package/{CodeAgent-z34p8m91.js → CodeAgent-h6g8dg3a.js} +2 -2
  3. package/{CodeTui-nvd9fk3g.js → CodeTui-n9gacepn.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 +2 -2
  9. package/{application.command-1nr0bqq1.js → application.command-yb8v177e.js} +35 -21
  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-et06ja22.js} +35 -18
  13. package/cloud.script-s6rbrwer.js +30 -0
  14. package/{code.command-asq7xrr6.js → code.command-7m67c7zc.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/{guideline.command-43gfjsjv.js → guideline.command-gnv3e8p8.js} +2 -2
  19. package/guidelines/akanApi/akanApi.instruction.md +317 -0
  20. package/guidelines/conventions/rules/app.md +5 -5
  21. package/guidelines/conventions/rules/config.md +1 -1
  22. package/guidelines/conventions/rules/gates.md +10 -5
  23. package/incrementalBuilder.proc.js +69 -39
  24. package/{index-0tkj05cz.js → index-0fb3cpbt.js} +3 -3
  25. package/{index-6t7fkx73.js → index-1q1cjn8s.js} +21 -11
  26. package/{index-90q0w90q.js → index-3wjbhj2n.js} +1 -1
  27. package/{index-6zgt7zmx.js → index-48d5qsj3.js} +4 -4
  28. package/{index-z47rw9ez.js → index-5w9my9qe.js} +8 -8
  29. package/{index-qwe079ww.js → index-6wpaq392.js} +61 -15
  30. package/{index-kc871vpc.js → index-7xdpww43.js} +69 -12
  31. package/index-7y5yghjg.js +2969 -0
  32. package/{index-38patcx6.js → index-8g7tdsk4.js} +249 -696
  33. package/{index-kdswbvys.js → index-8pb9yvp8.js} +63 -21
  34. package/{index-hmj94es2.js → index-8ts9774g.js} +4 -4
  35. package/{index-r0q2ka2b.js → index-93ewzmp6.js} +43 -14
  36. package/{index-y0y0pnx8.js → index-9tbgb4d8.js} +1 -1
  37. package/index-abgh0jve.js +126 -0
  38. package/{index-t0hk1kxq.js → index-aj3ehkcx.js} +1 -1
  39. package/{index-demt944k.js → index-d4n1wmrz.js} +37 -4
  40. package/{index-sra1a5f8.js → index-drz9e84d.js} +22 -8
  41. package/{index-gfh90r3t.js → index-e3vmjtph.js} +2 -2
  42. package/{index-k64mhwbw.js → index-eajbmk10.js} +2 -1
  43. package/{index-g0yds382.js → index-ed6ea0qp.js} +1 -1
  44. package/{index-ap6ac70m.js → index-fjr4d6yd.js} +444 -368
  45. package/index-hqrkqxx2.js +176 -0
  46. package/{index-jzpeny42.js → index-jdamtr7e.js} +3 -3
  47. package/{index-ampz4vgv.js → index-kpdv34rq.js} +4 -4
  48. package/{index-kc6ffq0s.js → index-ktb3wcqz.js} +73 -34
  49. package/{index-dcm66hss.js → index-mmym5xmb.js} +4 -2
  50. package/{index-8d9r465x.js → index-mqntfzv5.js} +2 -2
  51. package/{index-4am4dvmf.js → index-ny2k80mv.js} +15 -3
  52. package/index-p6hjwt2d.js +1668 -0
  53. package/{index-53h0053j.js → index-rc5fvqj2.js} +12 -14
  54. package/{index-r8t5sq7z.js → index-ryrm5z2c.js} +66 -19
  55. package/{index-jzz6ye8x.js → index-s2grpzef.js} +40 -8
  56. package/{index-38by07nw.js → index-sr5da35e.js} +32 -9
  57. package/{index-qev8p5wp.js → index-sy481q2x.js} +1 -1
  58. package/{index-ck64kxrn.js → index-thckcabc.js} +2 -2
  59. package/{index-wymcdsas.js → index-vkzfk7qt.js} +25 -23
  60. package/{index-vkpqe29t.js → index-w639tvkd.js} +24 -125
  61. package/index-ygdbn9jn.js +122 -0
  62. package/{index-w60zxxye.js → index-zpv14wpy.js} +3 -3
  63. package/{index-2yan1ajk.js → index-zxsygkda.js} +18 -9
  64. package/index.js +24 -23
  65. package/{library.command-zh29tjdd.js → library.command-1gp5qe3r.js} +3 -3
  66. package/{localRegistry.command-k9pn9ahj.js → localRegistry.command-v3g21rex.js} +25 -16
  67. package/{module.command-dgpqs9fz.js → module.command-4xz9he6h.js} +6 -6
  68. package/{package.command-1je4hsca.js → package.command-s7qpnn1g.js} +12 -3
  69. package/package.json +2 -2
  70. package/{page.command-cgsasanh.js → page.command-fan34c49.js} +3 -3
  71. package/{pipeline.command-tb46sa8v.js → pipeline.command-ph4fnn9w.js} +2 -2
  72. package/{primitive.command-bzsy23x5.js → primitive.command-3fqh8emf.js} +7 -7
  73. package/{projectTypecheck-h8rgaczy.js → projectTypecheck-vkb40hjc.js} +1 -1
  74. package/{quality.command-120m9h6v.js → quality.command-ecj6exsh.js} +15 -10
  75. package/{repair.command-6m4wd0qv.js → repair.command-fe9jw719.js} +6 -6
  76. package/{scalar.command-3dn5hsc6.js → scalar.command-cnvfhk0n.js} +5 -5
  77. package/skills/akan-debug/SKILL.md +2 -1
  78. package/skills/akan-page/SKILL.md +16 -7
  79. package/skills/akan-service/SKILL.md +48 -19
  80. package/{subspace.command-s8nyfqbn.js → subspace.command-yxtt3v3e.js} +8 -8
  81. package/templates/app/lib/___appName__/__appName__.abstract.md.template +6 -0
  82. package/templates/app/page/_index.tsx +4 -284
  83. package/templates/app/page/_layout.tsx +1 -26
  84. package/templates/app/page/styles.css.template +58 -318
  85. package/templates/appSample/page/_index.tsx +281 -0
  86. package/templates/appSample/page/_layout.tsx +55 -0
  87. package/templates/appSample/page/styles.css.template +327 -0
  88. package/templates/libRoot/lib/___libName__/__libName__.abstract.md.template +6 -0
  89. package/templates/workspaceRoot/package.json.template +1 -12
  90. package/{tunnel.command-8mwrqkr3.js → tunnel.command-ggj38mqf.js} +7 -7
  91. package/{verify.command-2pspfy7k.js → verify.command-w9ttxkdz.js} +16 -14
  92. package/{workflow.command-7sy5vnsj.js → workflow.command-ss8devj0.js} +12 -12
  93. package/{workspace.command-x518tdv4.js → workspace.command-rw1p0xeq.js} +50 -38
  94. package/TunnelShare-jwbb50kz.js +0 -14
  95. package/cloud.script-8kr7qgfa.js +0 -27
  96. package/context.runner-p6m5cxk3.js +0 -28
  97. package/index-d894868w.js +0 -842
  98. package/index-re2kfscb.js +0 -1363
  99. /package/templates/{app → appSample}/page/_overrides.tsx +0 -0
  100. /package/templates/{app → appSample}/public/fonts/Pretendard-Black.woff2 +0 -0
  101. /package/templates/{app → appSample}/public/fonts/Pretendard-Bold.woff2 +0 -0
  102. /package/templates/{app → appSample}/public/fonts/Pretendard-ExtraBold.woff2 +0 -0
  103. /package/templates/{app → appSample}/public/fonts/Pretendard-ExtraLight.woff2 +0 -0
  104. /package/templates/{app → appSample}/public/fonts/Pretendard-Light.woff2 +0 -0
  105. /package/templates/{app → appSample}/public/fonts/Pretendard-Medium.woff2 +0 -0
  106. /package/templates/{app → appSample}/public/fonts/Pretendard-Regular.woff2 +0 -0
  107. /package/templates/{app → appSample}/public/fonts/Pretendard-SemiBold.woff2 +0 -0
  108. /package/templates/{app → appSample}/public/fonts/Pretendard-Thin.woff2 +0 -0
  109. /package/templates/{app → appSample}/public/jelly/cloud.webp +0 -0
  110. /package/templates/{app → appSample}/public/jelly/comet.webp +0 -0
  111. /package/templates/{app → appSample}/public/jelly/moon.webp +0 -0
  112. /package/templates/{app → appSample}/public/jelly/planet.webp +0 -0
  113. /package/templates/{app → appSample}/public/jelly/rocket.webp +0 -0
  114. /package/templates/{app → appSample}/public/jelly/star.webp +0 -0
  115. /package/templates/{app → appSample}/public/jelly/sugar.webp +0 -0
  116. /package/templates/{app → appSample}/public/logo.png +0 -0
  117. /package/templates/{app → appSample}/ui/Recipe/index.ts +0 -0
  118. /package/templates/{app → appSample}/ui/Recipe/jellyButton.ts +0 -0
@@ -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-s6rbrwer.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`.
@@ -1,295 +1,15 @@
1
1
  import type { AppInfo, LibInfo } from "akanjs";
2
2
 
3
- interface Dict {
4
- appName: string;
5
- }
6
- interface Options {
7
- libs?: string[];
8
- sample?: boolean;
9
- }
10
- export default function getContent(scanInfo: AppInfo | LibInfo | null, dict: Dict, options: Options = {}) {
11
- const sampleButton = options.sample
12
- ? `
13
- <Link className={jellyButtonRecipe({ variant: "default", size: "lg" })} href="/task">
14
- {l.trans({ en: "Open the Sample", ko: "샘플 열어 보기" })}
15
- </Link>`
16
- : `
17
- <Link
18
- className={jellyButtonRecipe({ variant: "default", size: "lg" })}
19
- href="https://akanjs.com/docs/intro/practice"
20
- target="_blank"
21
- >
22
- {l.trans({ en: "Learn By Building", ko: "만들면서 배우기" })}
23
- </Link>`;
24
- const sampleStep = options.sample
25
- ? `
26
- {
27
- title: l.trans({ en: "Read the sample module", ko: "샘플 모듈을 읽어 보세요" }),
28
- body: l.trans({
29
- en: "The task module walks one feature end to end — the model, its guarded API, the store and the pages.",
30
- ko: "task 모듈이 모델부터 가드가 걸린 API, 스토어, 페이지까지 기능 하나를 처음부터 끝까지 보여 줍니다.",
31
- }),
32
- code: "lib/task",
33
- href: "/task",
34
- },`
35
- : "";
3
+ export default function getContent(scanInfo: AppInfo | LibInfo | null, dict: { appName: string }) {
36
4
  return {
37
5
  filename: "_index.tsx",
38
- content: `import { jellyButtonRecipe } from "@apps/${dict.appName}/ui";
39
- import { getEnv } from "akanjs/base";
40
- import { cn, page, usePage } from "akanjs/client";
41
- import { Image, Link, System } from "akanjs/ui";
42
-
43
- const friendFloat = {
44
- planet: "[--float-delay:-0.4s] [--float-duration:6.2s]",
45
- rocket: "[--float-delay:-2.2s] [--float-duration:5.2s] [--float-tilt:7deg]",
46
- moon: "[--float-delay:-3.6s] [--float-duration:7s] [--float-tilt:-5deg]",
47
- cloud: "[--float-delay:-1.4s] [--float-duration:8s] [--float-rise:0.6rem]",
48
- comet: "[--float-delay:-4.8s] [--float-duration:4.6s] [--float-tilt:9deg]",
49
- } as const;
50
-
51
- const numeralTiles = [
52
- "tint-planet text-white",
53
- "tint-rocket text-black/70",
54
- "tint-moon text-black/70",
55
- "tint-comet text-white",
56
- ] as const;
6
+ content: `import { page, usePage } from "akanjs/client";
57
7
 
58
8
  export default page().render(() => {
59
- const appName = getEnv().appName;
60
9
  const { l } = usePage();
61
- const friends = [
62
- { name: "planet", role: l.trans({ en: "Web", ko: "웹" }) },
63
- { name: "rocket", role: l.trans({ en: "App", ko: "앱" }) },
64
- { name: "moon", role: l.trans({ en: "Server · DB", ko: "서버 · DB" }) },
65
- { name: "cloud", role: l.trans({ en: "Infra", ko: "인프라" }) },
66
- { name: "comet", role: l.trans({ en: "Agent", ko: "에이전트" }) },
67
- ] as const;
68
- const chapters = [
69
- {
70
- numeral: "1",
71
- title: l.trans({ en: "The line you write.", ko: "당신이 쓰는 한 줄." }),
72
- body: l.trans({
73
- en: "A field is one declaration — a name and a type. The database, API, screens and agent tools all come from it.",
74
- ko: "필드는 이름과 타입, 선언 한 줄입니다. DB, API, 화면, 에이전트 도구가 모두 이 한 줄에서 나옵니다.",
75
- }),
76
- },
77
- {
78
- numeral: "×8",
79
- title: l.trans({ en: "Through every layer.", ko: "모든 레이어를 관통하고," }),
80
- body: l.trans({
81
- en: "Schema, query, service, API, fetch, client type, state and UI change together. Nothing to chase, nothing to miss.",
82
- ko: "스키마, 쿼리, 서비스, API, fetch, 클라이언트 타입, 상태, UI가 함께 바뀝니다. 따라 고칠 곳도 빠뜨릴 곳도 없습니다.",
83
- }),
84
- },
85
- {
86
- numeral: "×6",
87
- title: l.trans({ en: "Onto every platform.", ko: "모든 플랫폼에 닿고," }),
88
- body: l.trans({
89
- en: "The same code ships as SEO-ready web, iOS and Android apps, and macOS, Windows and Linux desktop apps.",
90
- ko: "같은 코드가 SEO 웹, iOS·Android 앱, macOS·Windows·Linux 데스크톱 앱으로 배포됩니다.",
91
- }),
92
- },
93
- {
94
- numeral: "×2",
95
- title: l.trans({ en: "For people and agents alike.", ko: "사람과 에이전트 모두에게." }),
96
- body: l.trans({
97
- en: "Guarded endpoints become MCP tools and on-screen controls become in-page agent tools, behind the same guards people pass.",
98
- ko: "가드를 거친 엔드포인트는 MCP 도구가, 화면의 컨트롤은 인페이지 에이전트 도구가 됩니다. 사람과 같은 가드를 거쳐서요.",
99
- }),
100
- },
101
- ];
102
- const steps = [
103
- {
104
- title: l.trans({ en: "Make this page yours", ko: "이 페이지를 바꿔 보세요" }),
105
- body: l.trans({
106
- en: "This welcome screen is an ordinary page. Replace it with the first screen of your product.",
107
- ko: "이 환영 화면은 평범한 페이지입니다. 제품의 첫 화면으로 바꿔 보세요.",
108
- }),
109
- code: "page/_index.tsx",
110
- },
111
- {
112
- title: l.trans({ en: "Restyle the theme", ko: "테마를 바꿔 보세요" }),
113
- body: l.trans({
114
- en: "Swap the palette tokens, and every surface and button follows.",
115
- ko: "팔레트 토큰을 바꾸면 모든 표면과 버튼이 따라옵니다.",
116
- }),
117
- code: "page/styles.css",
118
- },
119
- {
120
- title: l.trans({ en: "Add a feature", ko: "기능을 추가해 보세요" }),
121
- body: l.trans({
122
- en: "One command scaffolds a domain module — model, service, API, store and UI.",
123
- ko: "명령 하나로 도메인 모듈(모델, 서비스, API, 스토어, UI)을 만듭니다.",
124
- }),
125
- code: "akan create-module <name>",
126
- },${sampleStep}
127
- {
128
- title: l.trans({ en: "Connect an agent", ko: "에이전트를 연결해 보세요" }),
129
- body: l.trans({
130
- en: "Every guarded endpoint is already published as an MCP tool.",
131
- ko: "가드가 걸린 엔드포인트는 이미 MCP 도구로 공개되어 있습니다.",
132
- }),
133
- code: "POST /mcp",
134
- href: "https://akanjs.com/docs/arch/agentic",
135
- },
136
- ];
137
10
  return (
138
- <main className="relative min-h-screen overflow-x-clip break-keep text-foreground">
139
- <div className="mx-auto flex min-h-screen w-full max-w-6xl flex-col px-6 py-6 lg:px-8">
140
- <nav className="flex items-center justify-between gap-4">
141
- <div className="flex items-center gap-3">
142
- <Image
143
- alt={l.trans({ en: "Logo", ko: "로고" })}
144
- className="jelly-breathe size-10"
145
- height={80}
146
- priority
147
- src="/logo.png"
148
- width={80}
149
- />
150
- <div className="leading-tight">
151
- <p className="font-black text-lg tracking-tight">{appName}</p>
152
- <p className="text-foreground/50 text-xs">
153
- {l.trans({ en: "Built with Akan.js", ko: "Akan.js로 만든 앱" })}
154
- </p>
155
- </div>
156
- </div>
157
- <div className="flex items-center gap-2">
158
- <System.ThemeToggle themes={["light", "dark"]} />
159
- <System.SelectLanguage languages={["en", "ko"]} />
160
- <Link
161
- className={jellyButtonRecipe({ variant: "default", size: "sm" }, "max-sm:hidden")}
162
- href="https://akanjs.com"
163
- target="_blank"
164
- >
165
- {l.trans({ en: "Official Site", ko: "공식 사이트" })} ↗
166
- </Link>
167
- </div>
168
- </nav>
169
-
170
- <section className="grid min-h-[calc(100svh-5rem)] items-center gap-6 py-12 lg:grid-cols-[0.8fr_1.2fr] lg:gap-10">
171
- <div className="intro-rise group relative mx-auto aspect-square w-48 sm:w-64 lg:w-full lg:max-w-md">
172
- <div className="absolute inset-x-[16%] bottom-[3%] h-[7%] rounded-full bg-black/25 blur-xl dark:bg-black/60" />
173
- <div className="jelly-breathe group-hover:jelly-wobble size-full">
174
- <Image
175
- alt=""
176
- className="pointer-events-none size-full select-none object-contain"
177
- draggable={false}
178
- height={640}
179
- priority
180
- src="/jelly/star.webp"
181
- width={640}
182
- />
183
- </div>
184
- </div>
185
-
186
- <div className="flex flex-col items-center text-center lg:items-start lg:text-left">
187
- <p className="intro-rise jelly-glass inline-flex items-center gap-2 rounded-full px-4 py-1.5 font-bold text-foreground/75 text-sm [--intro-delay:40ms]">
188
- <span className="size-2 rounded-full bg-success ring-4 ring-success/20" />
189
- {l.trans({ en: "Your app is running", ko: "앱이 실행 중입니다" })}
190
- </p>
191
- <h1 className="intro-rise wrap-anywhere mt-6 max-w-full font-black text-[clamp(3.5rem,12vw,8.5rem)] leading-[0.85] tracking-[-0.06em] [--intro-delay:80ms]">
192
- {appName}
193
- </h1>
194
- <p className="intro-rise mt-6 max-w-xl font-bold text-foreground/60 text-lg leading-8 [--intro-delay:160ms]">
195
- {l.trans({
196
- en: "Built on Akan.js — the TypeScript framework, agents included.",
197
- ko: "에이전트까지 들어 있는 TypeScript 프레임워크, Akan.js로 만들었습니다.",
198
- })}
199
- </p>
200
- <ul className="intro-rise mt-8 flex items-end gap-2 [--intro-delay:240ms] sm:gap-4">
201
- {friends.map((friend) => (
202
- <li className="group flex flex-col items-center gap-2" key={friend.name}>
203
- <span className={cn("jelly-float block", friendFloat[friend.name])}>
204
- <span className="group-hover:jelly-wobble block">
205
- <Image
206
- alt=""
207
- className="pointer-events-none size-14 select-none sm:size-18"
208
- draggable={false}
209
- height={200}
210
- src={\`/jelly/\${friend.name}.webp\`}
211
- width={200}
212
- />
213
- </span>
214
- </span>
215
- <span className="whitespace-nowrap rounded-full bg-foreground/6 px-2.5 py-0.5 font-bold text-[11px] text-foreground/60">
216
- {friend.role}
217
- </span>
218
- </li>
219
- ))}
220
- </ul>
221
- <div className="intro-rise mt-10 flex flex-wrap justify-center gap-3 [--intro-delay:320ms] lg:justify-start">
222
- <Link
223
- className={jellyButtonRecipe({ size: "lg" })}
224
- href="https://akanjs.com/docs/intro/quickstart"
225
- target="_blank"
226
- >
227
- {l.trans({ en: "Read Quick Start", ko: "빠른 시작 읽기" })}
228
- </Link>${sampleButton}
229
- </div>
230
- </div>
231
- </section>
232
-
233
- <section className="py-12">
234
- <p className="font-bold text-primary text-sm">{l.trans({ en: "How it works", ko: "작동 방식" })}</p>
235
- <h2 className="mt-2 font-black text-3xl sm:text-4xl">
236
- {l.trans({ en: "One line reaches the whole product.", ko: "한 줄이 제품 전체에 닿습니다." })}
237
- </h2>
238
- <div className="mt-8 grid gap-4 md:grid-cols-2 xl:grid-cols-4">
239
- {chapters.map((chapter, idx) => (
240
- <article className="jelly-glass rounded-box p-6" key={chapter.numeral}>
241
- <span
242
- className={cn(
243
- "jelly flex size-12 items-center justify-center rounded-2xl font-black text-xl",
244
- numeralTiles[idx],
245
- )}
246
- >
247
- {chapter.numeral}
248
- </span>
249
- <h3 className="mt-5 font-bold text-lg">{chapter.title}</h3>
250
- <p className="mt-2 text-foreground/60 text-sm leading-6">{chapter.body}</p>
251
- </article>
252
- ))}
253
- </div>
254
- </section>
255
-
256
- <section className="py-12">
257
- <p className="font-bold text-primary text-sm">{l.trans({ en: "Next steps", ko: "다음 단계" })}</p>
258
- <h2 className="mt-2 font-black text-3xl sm:text-4xl">
259
- {l.trans({ en: "Start here.", ko: "여기서 시작하세요." })}
260
- </h2>
261
- <ol className="jelly-glass mt-8 divide-y divide-foreground/8 rounded-box">
262
- {steps.map((step, idx) => (
263
- <li className="flex items-start gap-4 p-5 sm:p-6" key={step.code}>
264
- <span className="jelly tint-primary flex size-9 shrink-0 items-center justify-center rounded-full font-black text-primary-foreground text-sm">
265
- {idx + 1}
266
- </span>
267
- <div className="min-w-0 flex-1">
268
- <h3 className="font-bold">{step.title}</h3>
269
- <p className="mt-1 text-foreground/60 text-sm leading-6">{step.body}</p>
270
- <code className="mt-2 inline-block rounded-full bg-foreground/6 px-3 py-1 font-mono text-foreground/75 text-xs">
271
- {step.code}
272
- </code>
273
- </div>
274
- {step.href ? (
275
- <Link
276
- aria-label={step.title}
277
- className={jellyButtonRecipe({ variant: "ghost", size: "icon" }, "shrink-0 self-center")}
278
- href={step.href}
279
- target={step.href.startsWith("http") ? "_blank" : undefined}
280
- >
281
- →
282
- </Link>
283
- ) : null}
284
- </li>
285
- ))}
286
- </ol>
287
- </section>
288
-
289
- <footer className="py-10 text-center text-foreground/45 text-sm">
290
- {l.trans({ en: "Made with Akan.js · Powered by Bun", ko: "Akan.js로 만들고 Bun으로 구동합니다" })}
291
- </footer>
292
- </div>
11
+ <main className="flex min-h-screen items-center justify-center p-6">
12
+ <h1 className="font-bold text-3xl">{l.trans({ en: "Hello, Akan.js", ko: "안녕하세요, Akan.js" })}</h1>
293
13
  </main>
294
14
  );
295
15
  });