@akanjs/cli 3.2.0-rc.2 → 3.2.0-rc.21

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 (132) hide show
  1. package/.build-stamp +2 -1
  2. package/CodeAgent-faqv7t4g.js +11 -0
  3. package/{CodeTui-zyc7zaq6.js → CodeTui-vqck9tet.js} +822 -666
  4. package/README.ko.md +26 -1
  5. package/README.md +26 -1
  6. package/TunnelShare-bwe3ddv7.js +18 -0
  7. package/agent.command-p75jvgrd.js +56 -0
  8. package/akanCode.js +12 -12
  9. package/appExecutor-020cyesq.js +11 -0
  10. package/{application.command-vb278qnq.js → application.command-ta2knqxm.js} +72 -34
  11. package/{applicationBuildRunner-bqbyeg84.js → applicationBuildRunner-gkh82j2b.js} +18 -13
  12. package/buildBatch.proc.js +26 -11
  13. package/{cloud.command-ca777ee2.js → cloud.command-v3jhfvm5.js} +31 -28
  14. package/cloud.script-be9s1432.js +35 -0
  15. package/{code.command-j08txqcd.js → code.command-mh7dh1st.js} +14 -9
  16. package/{context.command-2fa6egp9.js → context.command-1ycfjkdd.js} +28 -23
  17. package/context.runner-333jkz86.js +34 -0
  18. package/{dependencyScanner-78sq8m4q.js → dependencyScanner-ge10gb52.js} +2 -2
  19. package/{devTui-w38ch13a.js → devTui-rf374y2w.js} +1 -1
  20. package/{fileSys-zpvt5gtf.js → fileSys-q22646yc.js} +1 -1
  21. package/{guideline.command-w6yqpdec.js → guideline.command-w1grfwh7.js} +9 -4
  22. package/guidelines/agentRule/agentRule.instruction.md +17 -5
  23. package/guidelines/akanApi/akanApi.instruction.md +5 -3
  24. package/guidelines/conventions/core.md +23 -5
  25. package/guidelines/conventions/rules/app.md +4 -1
  26. package/guidelines/conventions/rules/page.md +5 -0
  27. package/guidelines/errorCodes/errorCodes.instruction.md +158 -0
  28. package/guidelines/fieldRule/fieldRule.instruction.md +2 -1
  29. package/guidelines/mcpRule/mcpRule.instruction.md +86 -2
  30. package/guidelines/pageRule/pageRule.instruction.md +11 -1
  31. package/guidelines/runtimeRule/runtimeRule.instruction.md +7 -2
  32. package/guidelines/transportRule/transportRule.instruction.md +8 -1
  33. package/incrementalBuilder.proc.js +574 -410
  34. package/{index-c5ymqb05.js → index-013n6z7m.js} +12 -12
  35. package/{index-w15mg3km.js → index-0dm25wvf.js} +1 -1
  36. package/{index-8nbx607g.js → index-0hj82f9w.js} +136 -48
  37. package/{index-ebwkh7bt.js → index-1c0mjc2b.js} +25 -7
  38. package/{index-6h775rv3.js → index-1jk52ffq.js} +53 -12
  39. package/{index-hj6w4ka1.js → index-1p81ecbz.js} +1 -1
  40. package/{index-ygrdw6jw.js → index-1pjwsh2g.js} +65 -8
  41. package/{index-cbcwxp5v.js → index-22g3jq43.js} +9 -7
  42. package/{index-466z5931.js → index-2d9nm03s.js} +580 -364
  43. package/{index-0fj9ra3q.js → index-2k6mve6a.js} +18 -11
  44. package/{index-qd7xn2bk.js → index-2ny1e95c.js} +2 -2
  45. package/{index-j7p0jgaq.js → index-52w4jb87.js} +6 -6
  46. package/{index-e22zedc2.js → index-5h888r6j.js} +3 -3
  47. package/{index-7kmbqp0b.js → index-6pxmcaq8.js} +1 -1
  48. package/{index-xa0289eg.js → index-6zb17wcm.js} +16 -9
  49. package/{index-qgazn58x.js → index-7a07tdap.js} +50 -38
  50. package/{index-m5sg5spm.js → index-7ehdht84.js} +565 -187
  51. package/{index-y725zb1a.js → index-7v7tvgt7.js} +196 -168
  52. package/{index-pq5rjkch.js → index-88s746ns.js} +7 -2
  53. package/{index-r0a604h4.js → index-99kjwyma.js} +1 -1
  54. package/{index-2mrn1mrg.js → index-9f3reh2y.js} +1 -1
  55. package/{index-386canwe.js → index-9rv2zt48.js} +186 -121
  56. package/{index-wr9magsr.js → index-9zswcze5.js} +3 -3
  57. package/{index-xq97me1h.js → index-a41vv4cy.js} +811 -697
  58. package/{index-yf9wc28h.js → index-bejy9zyc.js} +1 -1
  59. package/{index-bdmgqzb5.js → index-bket1068.js} +58 -29
  60. package/{index-bns3wcpc.js → index-by2tvsq6.js} +1 -1
  61. package/{index-1cb9apzn.js → index-czf94w8c.js} +2 -2
  62. package/{index-65b6ms4c.js → index-d3178asw.js} +15 -11
  63. package/index-dss3ds74.js +127 -0
  64. package/{index-annxfpgz.js → index-eyfty8kk.js} +9 -9
  65. package/{index-ny2k80mv.js → index-ffa52fwf.js} +1 -1
  66. package/{index-8jpc5fqv.js → index-g7jgd4xs.js} +2 -2
  67. package/{index-abfbf01s.js → index-gwsesvqc.js} +2 -2
  68. package/{index-kcpk2d20.js → index-h1w4wqgd.js} +1474 -1139
  69. package/{index-j1hjb477.js → index-hp2c7xc2.js} +1 -1
  70. package/index-j4yvgfhr.js +70 -0
  71. package/{index-84c2pgak.js → index-jx2jcw1r.js} +89 -78
  72. package/{index-j6eeh5d7.js → index-knpm8sdm.js} +5 -5
  73. package/{index-2gees180.js → index-mpp4aas6.js} +62 -33
  74. package/index-na8r4a27.js +30 -0
  75. package/{index-0mqga3h9.js → index-nmxszh6x.js} +525 -440
  76. package/{index-35j83zkd.js → index-p5zh7pmc.js} +2 -2
  77. package/{index-20wvskt8.js → index-pt0agdck.js} +1 -1
  78. package/{index-htxck0pn.js → index-q444k260.js} +15 -10
  79. package/{index-wfmpxke3.js → index-qssq2d41.js} +2775 -3677
  80. package/{index-23860fej.js → index-rwgqba9p.js} +24 -9
  81. package/{index-v50xjbbe.js → index-t4d0ckde.js} +1 -1
  82. package/index-va90m8nd.js +25 -0
  83. package/index-vjbne22r.js +80 -0
  84. package/{index-djc5nxpy.js → index-w23tf30e.js} +6 -6
  85. package/{index-mvwvxgtd.js → index-wa01phm9.js} +289 -210
  86. package/{index-h7hehkw6.js → index-xczjdng6.js} +3 -1
  87. package/{index-vbhx60x5.js → index-xwe7y0gf.js} +2140 -2165
  88. package/index-ze48c0vd.js +788 -0
  89. package/{index-dk4g0x0d.js → index-zttyg7tg.js} +27 -16
  90. package/{index-ygdbn9jn.js → index-zyb0ebm4.js} +1 -1
  91. package/index.js +29 -24
  92. package/libExecutor-tq994592.js +10 -0
  93. package/{library.command-8d03a0pq.js → library.command-x219mhcx.js} +9 -4
  94. package/{localRegistry.command-vyv5k6t0.js → localRegistry.command-4p17wa9t.js} +30 -24
  95. package/{module.command-vy3kg965.js → module.command-tjthnvvr.js} +17 -8
  96. package/{package.command-qjh13rs9.js → package.command-c6df2hxx.js} +13 -8
  97. package/package.json +2 -2
  98. package/{page.command-t0nx1jat.js → page.command-gf06paq2.js} +9 -4
  99. package/{pipeline.command-2yjeas7m.js → pipeline.command-y07dgj9b.js} +14 -8
  100. package/pkgExecutor-stde3yc3.js +10 -0
  101. package/{primitive.command-8vm49279.js → primitive.command-0enfygxn.js} +13 -8
  102. package/{projectTypecheck-s9hhe5sa.js → projectTypecheck-mk8wefvd.js} +2 -1
  103. package/{prompter-qrwx1p17.js → prompter-qyggfhqd.js} +2 -2
  104. package/{quality.command-v76fev72.js → quality.command-dkbdztad.js} +23 -16
  105. package/{recipeScanner-4b69ybe0.js → recipeScanner-rrx69awy.js} +1 -1
  106. package/{repair.command-fp4m3w03.js → repair.command-g5vd95ax.js} +13 -8
  107. package/{routeSourceValidator-4h947v7c.js → routeSourceValidator-8n6j1vn7.js} +4 -2
  108. package/{scalar.command-hxe6try8.js → scalar.command-7909pg0d.js} +11 -6
  109. package/skills/akan-debug/SKILL.md +10 -3
  110. package/skills/akan-err/SKILL.md +7 -0
  111. package/skills/akan-mcp/SKILL.md +13 -2
  112. package/skills/akan-scaffold/SKILL.md +2 -2
  113. package/skills/akan-transport/SKILL.md +2 -0
  114. package/skills/akan-validate/SKILL.md +1 -0
  115. package/{subspace.command-q42n1844.js → subspace.command-at4jt1fb.js} +29 -23
  116. package/templates/biomeForm.ts +1 -1
  117. package/templates/env/_env.server.type.ts +1 -1
  118. package/templates/facetIndex/index.ts +2 -37
  119. package/templates/lib/sig.ts +0 -4
  120. package/templates/lib/useClient.ts +1 -1
  121. package/templates/workspaceRoot/AGENTS.md.template +2 -1
  122. package/{tunnel.command-22g11n0x.js → tunnel.command-91h92dwr.js} +17 -12
  123. package/{typeChecker-s640r6c0.js → typeChecker-bfrd1n9n.js} +1 -1
  124. package/typecheck.proc.js +6 -3
  125. package/{verify.command-rx43bha1.js → verify.command-pzky05ts.js} +26 -20
  126. package/{workflow.command-yg0d8mmq.js → workflow.command-mqqe4n12.js} +37 -19
  127. package/{workspace.command-fcfztvn5.js → workspace.command-y4rznvhx.js} +64 -53
  128. package/CodeAgent-6cpjtj25.js +0 -11
  129. package/TunnelShare-zkfkrw8w.js +0 -14
  130. package/agent.command-kf1g3nh4.js +0 -51
  131. package/cloud.script-agpxzq6j.js +0 -30
  132. package/context.runner-ftv8373t.js +0 -29
@@ -2,16 +2,21 @@
2
2
  import {
3
3
  Sys,
4
4
  command
5
- } from "./index-386canwe.js";
6
- import"./index-bns3wcpc.js";
7
- import"./index-wfmpxke3.js";
5
+ } from "./index-9rv2zt48.js";
6
+ import"./index-j4yvgfhr.js";
7
+ import"./index-qssq2d41.js";
8
+ import"./index-by2tvsq6.js";
9
+ import"./index-ze48c0vd.js";
10
+ import"./index-na8r4a27.js";
11
+ import"./index-dss3ds74.js";
8
12
  import {
9
13
  renderPrimitiveReport
10
- } from "./index-xq97me1h.js";
11
- import"./index-m5sg5spm.js";
14
+ } from "./index-a41vv4cy.js";
15
+ import"./index-7ehdht84.js";
12
16
  import {
13
17
  ScalarScript
14
- } from "./index-pq5rjkch.js";
18
+ } from "./index-88s746ns.js";
19
+ import"./index-vjbne22r.js";
15
20
 
16
21
  // pkgs/@akanjs/cli/scalar/scalar.command.ts
17
22
  import { Logger, lowerlize } from "akanjs/common";
@@ -9,14 +9,21 @@ description: "Check and debug a running Akan app: akan preview for what a page s
9
9
 
10
10
  `akan preview <app> [paths]` opens pages of the app's dev server in a headless browser and prints, per page,
11
11
  the HTTP status, the title, a slice of the visible text, the uncaught errors and rejections the page reported,
12
- the server errors logged meanwhile, console errors and warnings, and layout smells. It exits 1 when a page failed.
12
+ the server errors logged meanwhile, console errors and warnings, and layout smells. It exits 3 when a page failed.
13
13
 
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
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. A `/_akan` route such as Studio
19
- (`/_akan/studio?view=runtime`), a signal route or a file opens as written.
18
+ one, unless the app sets `localePrefix: "as-needed"` and `--csr` is off. What the server answers outside a
19
+ locale opens as written, with no locale and no CSR boot query: a `/_akan` route such as Studio
20
+ (`/_akan/studio?view=runtime`), a route under the API prefix, `/__csr`, `/__rsc`, `/.well-known`,
21
+ `/openapi.json`, `/mcp`, `/favicon.ico`, `/robots.txt`, `/sitemap.xml`, `manifest.webmanifest` and a file in
22
+ the app's `public/`; `--csr` prints a note naming them. `/mcp` answers only `POST`, so preview cannot check it
23
+ (it fails with 405); the `akan-mcp` exposure test does. A full URL (`http://localhost:<port>/oauth/token`)
24
+ opens its path and query the same way, always on the app's dev server, with a note when it names another
25
+ server: use it for an endpoint mounted outside the API prefix. A page `--changed` finds opens as a page even at
26
+ a server route's path, under the same locale rule, and `/en` and `/en/` open once.
20
27
  `--changed` adds the pages your uncommitted page and layout edits reach. A dynamic route needs a concrete
21
28
  path (`/memo/1`); `akan context --app <app>` lists every route with its params and search names.
22
29
  - The viewport is a 390x844 phone; `--desktop` is 1280x800. `--csr` loads each page in the CSR boot the native
@@ -15,6 +15,8 @@ This is the common failure. Import `Err` from the source matching the **runtime
15
15
  - server code: `import { Err } from "../dict"`
16
16
  - UI: `from "@libs/<lib>/client"` or `from "@apps/<app>/client"`
17
17
 
18
+ Never `from "akanjs/common"` (`no-import-common-err.grit`): that `Err` takes any string, so a mistyped key compiles.
19
+
18
20
  ## Where the rule does not apply
19
21
 
20
22
  The lint rule exempts tests, `*.constant.ts`, `common/**`, and `env/**`. The last two have **no legal `Err`
@@ -38,3 +40,8 @@ discards what the endpoint chose to say, and a bare `Error` is generalized to "I
38
40
  way out.
39
41
 
40
42
  Korean `.error()` messages end in `다.`.
43
+
44
+ **The framework's own failures carry a code.** A `NoDocumentError`, an `Exception` status class or another
45
+ `AkanError` names its kind in `code`; branch on that with `AkanError.is(error, "<code>")`, never on its message.
46
+
47
+ Every code, its status and whether the caller's JSON carries it: `get_guideline` with `errorCodes`.
@@ -13,7 +13,7 @@ an endpoint with a real guard is published, one with none is refused, and so is
13
13
 
14
14
  - `mcp: false` on an endpoint, or a `slice()` `mcp` map mirroring `guards`, keeps a perfectly guarded step (a UI
15
15
  state-machine step a model would only call by mistake) off the shelf. It is an opt-out; everything else still
16
- publishes.
16
+ publishes. `mcp: "agent"` keeps an entry off `/mcp` but listed to `AgentToolsRole` and `agentService.loop`.
17
17
  - `guards: [Every, Person]` reserves an act for a person; `.with(AgentCall)` narrows what an agent's call may do.
18
18
  - A guard's `static scope` decides whether a listing can hide the entry: `"account"` guards are evaluated per
19
19
  caller, `"resource"` guards stay visible and stop the call.
@@ -23,7 +23,8 @@ an endpoint with a real guard is published, one with none is refused, and so is
23
23
  - `option.setMcp({ … })` in the app's `lib/option.ts`, never `main.ts`; `AKAN_MCP=false` takes the surface off.
24
24
  - `JWT_SECRET` is required outside `local`.
25
25
  - Every published entry needs a `.desc()`; model-facing text is English.
26
- - Never make a refusal message more helpful.
26
+ - Never make a refusal message more helpful. A client branches on the code a failure carries
27
+ (`_meta["akanjs/failure"]`, or a JSON-RPC error's `data.code`), never on its text.
27
28
 
28
29
  ## Pages for the host
29
30
 
@@ -31,6 +32,16 @@ an endpoint with a real guard is published, one with none is refused, and so is
31
32
  - `page().app(name, description, load)` publishes one component a host draws in the chat, as a read-only tool
32
33
  whose `load` may only query.
33
34
 
35
+ ## Calling it from the server
36
+
37
+ - `plug(AgentToolsRole)` gives a service `listAs(account, { allow })` / `callAs(account, call)`: the same catalogue
38
+ and refusals in-process plus the `mcp: "agent"` entries, batch servers included. Pass only an account the server resolved, never client input.
39
+ - `this.agentService.loop({ account | principal, allow, messages, approve, untrusted, onMessage, meta, budget })`
40
+ runs a model over those tools until it answers; `option.setAgentAccountResolver` resolves a stored `principal`
41
+ before every round. Each round is metered as its own turn with `turn.loop` and `turn.meta`. `toolkits` holds named
42
+ groups of `allow` back until the model calls `openToolkit`; `clientTools` (from `AgentClientTools` on an open page)
43
+ parks a call as `awaiting { client: true }` for the page to run.
44
+
34
45
  ## Verify
35
46
 
36
47
  - One exposure test per app in `srvkit/mcpExposure.signal.test.ts`: list the tools with a user token, pin the names
@@ -16,7 +16,7 @@ Everything else is pages, sections, and props.
16
16
  - A page or section whose content you can write as static JSX or props is not an entity. "A self-intro page
17
17
  with two detail pages" is pages only — no `profile` module.
18
18
  - Never invent a supporting entity (profile, category, tag, author, like) to round out a design. If one looks
19
- genuinely necessary, say so in your reply and let the user decide.
19
+ genuinely necessary, build the request without it and say in your reply why it may be needed; the user decides.
20
20
  - "… plus a comment zone that saves to a database" is exactly one new module: `comment`.
21
21
  - Check what exists first (`list_modules`) and extend it when it already fits — `add-field` / `add-slice` /
22
22
  `create-ui` beat a whole new module.
@@ -44,7 +44,7 @@ an apply that failed, names none: do what the diagnostic says, then plan again.
44
44
  Returns `planPath` and `next.tool=apply_workflow`. (`list_workflows` / `explain_workflow` give the names
45
45
  and each workflow's inputs.)
46
46
  2. `apply_workflow({ planPath })` — writes the scaffold and syncs the generated barrels. Returns
47
- `validationTarget`.
47
+ `validationTarget`. With `dryRun: true` it writes nothing and names this apply next.
48
48
  3. `run_validation({ runIdOrPlan: <validationTarget> })`, or run `akan verify` (`akan_verify` in akan code);
49
49
  both are the whole chain in one process.
50
50
  4. **Read each scaffolded file before editing it.** They are a few lines each and they extend base classes
@@ -27,6 +27,8 @@ description: "Guard and tune endpoints on the wire: writing a Can<Verb><Model> g
27
27
  - `{ rateLimit: { calls, windowMs?, by? } }` per endpoint, `option.setRateLimit` per app, `plug(RateLimit)` for a
28
28
  business key.
29
29
  - A mutation repeated under one `Idempotency-Key` header runs once and replays its first answer.
30
+ - A browser send that changes nothing read back (typing status, a cursor move) passes `{ keepsReads: true }`, so it
31
+ neither ends in-flight query sharing nor drops prefetched pages.
30
32
  - `{ method: "PATCH" | "PUT" | "DELETE" }` moves a mutation off `POST` — only when a foreign protocol forces it.
31
33
  - `errors: { 409: ["ticket.error.locked"] }` names the errors an endpoint throws on purpose.
32
34
 
@@ -20,6 +20,7 @@ three times the output. Narrow the one command instead:
20
20
  - `akan verify --no-build` — leave the app build out.
21
21
  - `akan verify --max 0` — every line, when the report ends in `+N more`.
22
22
  - `fixed N files` in the header means lint rewrote them on disk: re-read before editing them again.
23
+ - It exits 3 when it found problems, 2 for a target the workspace does not have, 1 when the run itself broke.
23
24
 
24
25
  Raw `tsc` misses the generated barrels and reports false errors. Do not reach for it.
25
26
 
@@ -5,36 +5,42 @@ import {
5
5
  runner,
6
6
  script,
7
7
  command
8
- } from "./index-386canwe.js";
8
+ } from "./index-9rv2zt48.js";
9
+ import"./index-j4yvgfhr.js";
10
+ import {
11
+ Executor,
12
+ LibSource,
13
+ WorkspaceExecutor
14
+ } from "./index-qssq2d41.js";
9
15
  import {
10
16
  FileSys2
11
- } from "./index-bns3wcpc.js";
17
+ } from "./index-by2tvsq6.js";
12
18
  import {
13
- LibSource,
14
- Executor,
15
- WorkspaceExecutor,
16
- AppExecutor
17
- } from "./index-wfmpxke3.js";
19
+ AppExecutor2
20
+ } from "./index-ze48c0vd.js";
21
+ import"./index-na8r4a27.js";
22
+ import"./index-dss3ds74.js";
18
23
  import {
19
24
  GlobalConfig
20
- } from "./index-e22zedc2.js";
25
+ } from "./index-5h888r6j.js";
21
26
  import"./index-m9jj544v.js";
22
- import"./index-djc5nxpy.js";
23
- import"./index-84c2pgak.js";
24
- import"./index-wr9magsr.js";
27
+ import"./index-w23tf30e.js";
28
+ import"./index-jx2jcw1r.js";
29
+ import"./index-9zswcze5.js";
25
30
  import {
26
31
  SubspaceConfig
27
- } from "./index-h7hehkw6.js";
32
+ } from "./index-xczjdng6.js";
28
33
  import {
29
34
  SlicePlanner
30
- } from "./index-8jpc5fqv.js";
35
+ } from "./index-g7jgd4xs.js";
36
+ import"./index-vjbne22r.js";
31
37
 
32
- // pkgs/@akanjs/devkit/subspace.ts
38
+ // pkgs/@akanjs/devkit/subspace/subspace.ts
33
39
  import { mkdir as mkdir2 } from "fs/promises";
34
40
  import path2 from "path";
35
41
  import { toError as toError2 } from "akanjs/common";
36
42
 
37
- // pkgs/@akanjs/devkit/subspaceClone.ts
43
+ // pkgs/@akanjs/devkit/subspace/subspaceClone.ts
38
44
  import { mkdir, readdir, rename, rm } from "fs/promises";
39
45
  import path from "path";
40
46
  import { toError } from "akanjs/common";
@@ -73,9 +79,9 @@ class SubspaceClone {
73
79
  if (!await FileSys2.dirExists(path.join(this.#clonePath, ".git"))) {
74
80
  await rm(this.#clonePath, { recursive: true, force: true });
75
81
  await mkdir(path.dirname(this.#clonePath), { recursive: true });
76
- await this.#workspace.spawn("git", ["clone", "--quiet", this.#declaration.repo, this.#clonePath]);
82
+ await this.#workspace.spawn("git", ["clone", "--quiet", "--", this.#declaration.repo, this.#clonePath]);
77
83
  }
78
- await this.#clone.spawn("git", ["fetch", "--quiet", "origin", branch]);
84
+ await this.#clone.spawn("git", ["fetch", "--quiet", "--", "origin", branch]);
79
85
  await this.#clone.spawn("git", ["checkout", "--quiet", "-f", "-B", branch, `origin/${branch}`]);
80
86
  await this.#clone.spawn("git", ["clean", "-qfd"]);
81
87
  }
@@ -124,7 +130,7 @@ class SubspaceClone {
124
130
  await this.#clone.spawn("git", ["add", "-A"]);
125
131
  const message = `${SubspaceClone.syncSubjectPrefix}${this.#workspace.repoName}@${sha}`;
126
132
  await this.#clone.spawn("git", ["commit", "--quiet", "-m", message]);
127
- await this.#clone.spawn("git", ["push", "--quiet", "origin", branch]);
133
+ await this.#clone.spawn("git", ["push", "--quiet", "--", "origin", branch]);
128
134
  return (await this.#clone.spawn("git", ["rev-parse", "--short", "HEAD"])).trim();
129
135
  }
130
136
  async#writeAnchorFile(branch, sha) {
@@ -329,7 +335,7 @@ class SubspaceClone {
329
335
  }
330
336
  }
331
337
 
332
- // pkgs/@akanjs/devkit/subspace.ts
338
+ // pkgs/@akanjs/devkit/subspace/subspace.ts
333
339
  class Subspace {
334
340
  static retiredConfigFile = "akan.subspace.ts";
335
341
  static #retiredConfigRefusal = `${Subspace.retiredConfigFile} is no longer read: move it under \`subspace\` in akan.config.ts and delete it`;
@@ -371,7 +377,7 @@ class Subspace {
371
377
  else
372
378
  await this.#git(["remote", "add", this.#remote, this.#declaration.repo]);
373
379
  try {
374
- await this.#git(["fetch", "--quiet", this.#remote, branch]);
380
+ await this.#git(["fetch", "--quiet", "--", this.#remote, branch]);
375
381
  return true;
376
382
  } catch {
377
383
  return false;
@@ -391,7 +397,7 @@ class Subspace {
391
397
  return { commit, incoming };
392
398
  }
393
399
  async slice() {
394
- const plans = await Promise.all(this.#declaration.apps.map(async (appName) => await new SlicePlanner(AppExecutor.from(this.#workspace, appName)).plan()));
400
+ const plans = await Promise.all(this.#declaration.apps.map(async (appName) => await new SlicePlanner(AppExecutor2.from(this.#workspace, appName)).plan()));
395
401
  const libs = [...new Set(plans.flatMap((plan) => plan.libs))].sort();
396
402
  const paths = [...this.#declaration.apps.map((app) => `apps/${app}`), ...libs.map((lib) => `libs/${lib}`)];
397
403
  return { plans, libs, paths };
@@ -584,7 +590,7 @@ class Subspace {
584
590
  }
585
591
  }
586
592
 
587
- // pkgs/@akanjs/devkit/subspaceReport.ts
593
+ // pkgs/@akanjs/devkit/subspace/subspaceReport.ts
588
594
  class SubspaceReport {
589
595
  static statuses(statuses) {
590
596
  const sections = [
@@ -818,7 +824,7 @@ class SubspaceRunner extends runner("subspace") {
818
824
  if (!asked)
819
825
  return { name: subspace.name, workspaceId, host, apps, libs: [], outcome: "cancelled", files: [] };
820
826
  const { libs } = await subspace.slice();
821
- const { CloudScript } = await import("./cloud.script-agpxzq6j.js");
827
+ const { CloudScript } = await import("./cloud.script-be9s1432.js");
822
828
  const { files } = await CommandContainer.get(CloudScript).uploadEnv(workspace, {
823
829
  host,
824
830
  workspaceId,
@@ -1,4 +1,4 @@
1
- import { compareExportNames } from "./facetIndex";
1
+ import { compareExportNames } from "akanjs/common";
2
2
 
3
3
  export interface JsxElement {
4
4
  tag: string;
@@ -1,5 +1,5 @@
1
1
  import type { AppInfo, LibInfo } from "akanjs";
2
- import { compareExportNames } from "../facetIndex";
2
+ import { compareExportNames } from "akanjs/common";
3
3
 
4
4
  export default function getContent(scanInfo: AppInfo | LibInfo | null, dict: { [key: string]: string } = {}) {
5
5
  if (!scanInfo) return null;
@@ -1,5 +1,6 @@
1
1
  import type { SysExecutor } from "@akanjs/devkit/executors";
2
2
  import type { AppInfo, LibInfo } from "akanjs";
3
+ import { facetBarrelOf } from "akanjs/common";
3
4
 
4
5
  interface Dict {
5
6
  [key: string]: string;
@@ -10,47 +11,11 @@ interface Options {
10
11
  facet?: string;
11
12
  }
12
13
 
13
- const sourceFilePattern = /\.(ts|tsx)$/;
14
- const excludedFilePattern = /(^index\.tsx?$|\.d\.ts$|\.(test|spec)\.(ts|tsx)$|\.css$|\.scss$|\.sass$)/;
15
- // `ui` exports PascalCase names only; `common`/`srvkit`/`webkit` export camelCase names only. Names with
16
- // dots, underscores, or hyphens (e.g. `foo.helper`, `Globe_Dynamic`, `kebab-case`) match neither and are skipped.
17
- const pascalCasePattern = /^[A-Z][A-Za-z0-9]*$/;
18
- const camelCasePattern = /^[a-z][A-Za-z0-9]*$/;
19
- const nameCasePatternForFacet = (facet: string) => (facet === "ui" ? pascalCasePattern : camelCasePattern);
20
- //? Biome's organizeImports order, or `akan lint` reorders the barrel: A < a < B < b, a digit before a letter, and a
21
- //? run of digits compared by its length first. DevGeneratedIndexSync sorts the same way; the env template imports it.
22
- const letterRankOf = (char: string) => char.toLowerCase().charCodeAt(0) * 2 + (char === char.toLowerCase() ? 1 : 0);
23
- const digitRunAt = (name: string, idx: number) => /^\d+/.exec(name.slice(idx))?.[0] ?? "";
24
- export const compareExportNames = (a: string, b: string) => {
25
- for (let idx = 0; idx < a.length && idx < b.length; ) {
26
- const [runA, runB] = [digitRunAt(a, idx), digitRunAt(b, idx)];
27
- if (runA && runB && runA !== runB) return runA.length - runB.length || (runA < runB ? -1 : 1);
28
- if (runA && runB) idx += runA.length;
29
- else if (runA || runB) return runA ? -1 : 1;
30
- else if (a.charAt(idx) !== b.charAt(idx)) return letterRankOf(a.charAt(idx)) - letterRankOf(b.charAt(idx));
31
- else idx++;
32
- }
33
- return a.length - b.length;
34
- };
35
-
36
14
  export default async function getContent(scanInfo: AppInfo | LibInfo | null, dict: Dict = {}, options: Options = {}) {
37
15
  const { exec, facet } = options;
38
16
  if (!exec || !facet || !(await exec.exists(facet))) return null;
39
17
 
40
- const nameCasePattern = nameCasePatternForFacet(facet);
41
18
  const { files, dirs } = await exec.getFilesAndDirs(facet);
42
- const exportNames = [
43
- ...files
44
- .filter((filename) => sourceFilePattern.test(filename) && !excludedFilePattern.test(filename))
45
- .map((filename) => filename.replace(sourceFilePattern, "")),
46
- ...dirs.filter((dirname) => !dirname.startsWith(".")),
47
- ]
48
- .filter((name) => nameCasePattern.test(name))
49
- .sort(compareExportNames);
50
-
51
- //? Not null: a null result writes nothing, so a barrel still exporting a deleted file would outlive the file.
52
- const content = exportNames.length
53
- ? `${exportNames.map((name) => `export * from "./${name}";`).join("\n")}\n`
54
- : "export {};\n";
19
+ const content = facetBarrelOf(facet, files, dirs);
55
20
  return { filename: "index.ts", content };
56
21
  }
@@ -19,7 +19,6 @@ export default function getContent(scanInfo: AppInfo | LibInfo | null, dict: { [
19
19
  return `
20
20
  import { FetchClient, type FetchClientType } from "akanjs/fetch";
21
21
  import { SignalRegistry, serverSignal${libs.length === 0 ? ", fetch as base" : ""} } from "akanjs/signal";
22
- import { Err } from "./dict";
23
22
  ${libs.map((lib) => `import { fetch as ${lib} } from "@libs/${lib}/lib/sig";`).join("\n")}
24
23
 
25
24
  ${databaseModules.map((module) => `import * as ${module}Sig from "./${module}/${module}.signal";`).join("\n")}
@@ -37,9 +36,6 @@ ${serviceModules.map((module) => `export const ${module} = SignalRegistry.regist
37
36
  export const fetchSignals = [${signalNames.join(", ")}] as const;
38
37
  export type Fetch = FetchClientType<typeof fetchSignals>;
39
38
  export const fetch = FetchClient.from(...fetchSignals) as unknown as Fetch;
40
- // A failure restored from another process is this scope's own Err, so a server hop that rethrows one keeps its
41
- // dictionary key and data instead of answering the original caller with Internal Server Error.
42
- fetch.setErrorConstructor(Err);
43
39
 
44
40
  export const getSerializedSignal = () => fetch.ownSerializedSignal
45
41
  `;
@@ -18,7 +18,7 @@ ${
18
18
  const dictionary = {};`
19
19
  }
20
20
  const pageProto = makePageProto<typeof dict>(dictionary);
21
- const fetchProto = FetchClient.build<typeof signal>(cnst, getSerializedSignal(), { Err: pageProto.Err });
21
+ const fetchProto = FetchClient.build<typeof signal>(cnst, getSerializedSignal());
22
22
  export const runtime = registerClientRuntime({ ...pageProto, ...fetchProto }, { scope: ${JSON.stringify(scanInfo?.type ?? "lib")} });
23
23
 
24
24
  export const { msg, Err, usePage, sig, fetch } = runtime;
@@ -7,7 +7,8 @@ the framework generate the repeated surfaces.
7
7
 
8
8
  If you hit an Akan.js bug, or a fix that one framework change would solve more easily than app-level workarounds,
9
9
  draft a GitHub issue for <https://github.com/akan-team/akanjs/issues> (version, repro, expected vs actual) and ask
10
- the user before filing it. Keep any interim workaround small and marked `// TODO: <issue url>`.
10
+ the user before filing it, since an issue is public. Meanwhile finish the task with a small interim workaround marked
11
+ `// TODO: <issue url>`.
11
12
 
12
13
  ## Generated Context
13
14
 
@@ -4,25 +4,30 @@ import {
4
4
  runner,
5
5
  script,
6
6
  command
7
- } from "./index-386canwe.js";
8
- import"./index-bns3wcpc.js";
7
+ } from "./index-9rv2zt48.js";
8
+ import"./index-j4yvgfhr.js";
9
+ import"./index-qssq2d41.js";
10
+ import"./index-by2tvsq6.js";
9
11
  import {
10
- AppExecutor
11
- } from "./index-wfmpxke3.js";
12
+ AppExecutor2
13
+ } from "./index-ze48c0vd.js";
14
+ import"./index-na8r4a27.js";
15
+ import"./index-dss3ds74.js";
12
16
  import {
13
17
  GlobalConfig,
14
18
  CloudApi
15
- } from "./index-e22zedc2.js";
19
+ } from "./index-5h888r6j.js";
16
20
  import"./index-m9jj544v.js";
17
- import"./index-djc5nxpy.js";
18
- import"./index-84c2pgak.js";
19
- import"./index-wr9magsr.js";
21
+ import"./index-w23tf30e.js";
22
+ import"./index-jx2jcw1r.js";
23
+ import"./index-9zswcze5.js";
20
24
  import {
21
25
  TunnelShare2
22
- } from "./index-j1hjb477.js";
26
+ } from "./index-hp2c7xc2.js";
23
27
  import {
24
28
  writeClipboard
25
29
  } from "./index-p6pbz9n5.js";
30
+ import"./index-vjbne22r.js";
26
31
 
27
32
  // pkgs/@akanjs/cli/tunnel/tunnel.script.ts
28
33
  import { select } from "@inquirer/prompts";
@@ -95,11 +100,11 @@ class TunnelScript extends script("tunnel", [TunnelRunner]) {
95
100
  if (name && !appNames.includes(name))
96
101
  throw new Error(`Unknown app: ${name}. Available: ${appNames.join(", ")}`);
97
102
  if (name)
98
- return AppExecutor.from(workspace, name);
103
+ return AppExecutor2.from(workspace, name);
99
104
  const only = appNames.length === 1 ? appNames[0] : null;
100
105
  if (only)
101
- return AppExecutor.from(workspace, only);
102
- return AppExecutor.from(workspace, await select({ message: "Select the app to share", choices: appNames }));
106
+ return AppExecutor2.from(workspace, only);
107
+ return AppExecutor2.from(workspace, await select({ message: "Select the app to share", choices: appNames }));
103
108
  }
104
109
  async share(name, { workspace, host, port, ttl, devRoutes }) {
105
110
  const app = await TunnelScript.resolveApp(workspace, name);
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  TypeChecker2
4
- } from "./index-r0a604h4.js";
4
+ } from "./index-99kjwyma.js";
5
5
  export {
6
6
  TypeChecker2 as TypeChecker
7
7
  };
package/typecheck.proc.js CHANGED
@@ -1,7 +1,10 @@
1
1
  // @bun
2
2
  import {
3
3
  TypeChecker2
4
- } from "./index-r0a604h4.js";
4
+ } from "./index-99kjwyma.js";
5
+ import {
6
+ TypecheckFailure
7
+ } from "./index-j4yvgfhr.js";
5
8
 
6
9
  // pkgs/@akanjs/devkit/typecheck/typecheck.proc.ts
7
10
  import { Logger } from "akanjs/common";
@@ -29,11 +32,11 @@ try {
29
32
  if (process.env.AKAN_TYPECHECK_FORMAT === "json") {
30
33
  const root = process.env.AKAN_TYPECHECK_ROOT ?? process.cwd();
31
34
  process.stdout.write(JSON.stringify(TypeChecker2.toRecords(result.errors, root)));
32
- process.exit(result.errors.length > 0 ? 1 : 0);
35
+ process.exit(result.errors.length > 0 ? TypecheckFailure.workerExitCode : 0);
33
36
  }
34
37
  if (result.errors.length > 0) {
35
38
  console.error(result.message);
36
- process.exit(1);
39
+ process.exit(TypecheckFailure.workerExitCode);
37
40
  }
38
41
  } catch (error) {
39
42
  console.error(error instanceof Error ? error.message : String(error));
@@ -2,37 +2,43 @@
2
2
  import {
3
3
  Workspace,
4
4
  script,
5
- ExitCodeError,
6
5
  markCliErrorPrinted,
7
6
  command
8
- } from "./index-386canwe.js";
9
- import"./index-bns3wcpc.js";
10
- import"./index-wfmpxke3.js";
7
+ } from "./index-9rv2zt48.js";
8
+ import {
9
+ CliError
10
+ } from "./index-j4yvgfhr.js";
11
+ import"./index-qssq2d41.js";
12
+ import"./index-by2tvsq6.js";
13
+ import"./index-ze48c0vd.js";
14
+ import"./index-na8r4a27.js";
15
+ import"./index-dss3ds74.js";
11
16
  import {
12
17
  ApplicationRunner,
13
18
  VerifyScope
14
- } from "./index-kcpk2d20.js";
15
- import"./index-y725zb1a.js";
16
- import"./index-djc5nxpy.js";
17
- import"./index-20wvskt8.js";
19
+ } from "./index-h1w4wqgd.js";
20
+ import"./index-7v7tvgt7.js";
21
+ import"./index-w23tf30e.js";
22
+ import"./index-pt0agdck.js";
18
23
  import"./index-m9jj544v.js";
19
- import"./index-84c2pgak.js";
20
- import"./index-wr9magsr.js";
24
+ import"./index-jx2jcw1r.js";
25
+ import"./index-9zswcze5.js";
26
+ import"./index-1p81ecbz.js";
21
27
  import"./index-62md4dwy.js";
28
+ import"./index-zyb0ebm4.js";
22
29
  import {
23
30
  WorkspaceRunner
24
- } from "./index-466z5931.js";
25
- import"./index-ygdbn9jn.js";
26
- import"./index-ygrdw6jw.js";
27
- import"./index-m5sg5spm.js";
28
- import"./index-hj6w4ka1.js";
29
- import"./index-ny2k80mv.js";
30
- import"./index-v50xjbbe.js";
31
+ } from "./index-2d9nm03s.js";
32
+ import"./index-1pjwsh2g.js";
33
+ import"./index-7ehdht84.js";
34
+ import"./index-ffa52fwf.js";
35
+ import"./index-t4d0ckde.js";
31
36
  import {
32
37
  VerifyPipeline,
33
38
  VerifyReport
34
- } from "./index-dk4g0x0d.js";
35
- import"./index-8jpc5fqv.js";
39
+ } from "./index-zttyg7tg.js";
40
+ import"./index-g7jgd4xs.js";
41
+ import"./index-vjbne22r.js";
36
42
 
37
43
  // pkgs/@akanjs/cli/verify/verify.script.ts
38
44
  import path from "path";
@@ -51,7 +57,7 @@ class VerifyScript extends script("verify", [WorkspaceRunner, ApplicationRunner]
51
57
  Logger.rawLog(options.format === "json" ? VerifyReport.json(result) : VerifyReport.text(result, { max: options.max }));
52
58
  if (result.ok)
53
59
  return;
54
- const failure = new ExitCodeError("verify failed", 1);
60
+ const failure = new CliError("checkFailed", "verify failed");
55
61
  markCliErrorPrinted(failure);
56
62
  throw failure;
57
63
  }