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

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 +3 -1
  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 +74 -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 +10 -1
  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
package/README.ko.md CHANGED
@@ -82,6 +82,29 @@ akan repair generated
82
82
  실행합니다. 에이전트는 워크플로를 거쳐 코드를 고치므로 워크스페이스 규칙을 우회하지 않고 따릅니다. `akan code`는
83
83
  같은 규칙, 워크플로, 스킬 위에서 일하는 터미널 에이전트입니다.
84
84
 
85
+ ## 종료 코드
86
+
87
+ | 종료 코드 | `code` | 뜻 |
88
+ | --- | --- | --- |
89
+ | 0 | | 끝남 |
90
+ | 1 | `failed`, 또는 에러 자체의 코드 | 명령이 실패함 |
91
+ | 2 | `usage`, `unknownTarget` | 명령줄이나 그것이 가리키는 대상을 고쳐야 함: 모르는 플래그나 명령, 선택지 밖의 값, 물어볼 터미널이 없는 인자, 워크스페이스에 없는 앱·라이브러리·패키지·모듈 |
92
+ | 2 | `refused` | 거절됨: 새 스토어 빌드가 필요한 팩(`akan pack-update --against`, `akan push-update`, `akan register-binary`), Akan Cloud 프로젝트가 거절한 릴리스 |
93
+ | 3 | `checkFailed` | 검사가 돌았고 문제를 찾음: `akan verify`, `akan typecheck`와 `akan build`의 타입 검사, `akan preview`, `akan agent install --check` |
94
+ | 130 | `interrupted` | 중단됨, Ctrl+C로 닫은 프롬프트 포함 |
95
+
96
+ 일부 명령은 한 계열의 코드를 고정합니다. `akan pack-update`, `akan push-update`, `akan register-binary`는 usage나
97
+ unknown-target 실패에 1로 끝나므로, 이 명령의 2는 늘 스토어 빌드나 거절만 뜻합니다. `akan agent`도 같은 실패에
98
+ 1로 끝납니다. Claude Code가 훅의 종료 코드 2를 차단으로 읽기 때문에, `akan agent hook`은 2로 끝나지 않습니다.
99
+ `akan doctor --strict`, `akan workflow`, `akan subspace`는 보고서가 실패나 거절을 말할 때 1로 끝납니다.
100
+
101
+ `--json`이나 `--format json`을 주면 stdout에는 JSON만 나옵니다. 실패하면 마지막 줄이
102
+ `{"ok":false,"error":"<메시지>","code":"<코드>"}`이고, 메시지는 stderr로 갑니다. NDJSON 스트림(`akan code --json`,
103
+ `akan logs --json`)도 그 줄로 끝납니다. `akan verify`처럼 자체 JSON 보고서가 실패를 말하는 명령은 이 줄을
104
+ 덧붙이지 않습니다. 고유 코드를 쓰는 명령이 둘 있습니다. `akan pipeline`은 오류가 있는 계획이면 1, 계획을 세우지
105
+ 못하면 2로 끝나고, `akan migrate`는 자체 JSON 줄로 답하며 `usage`, `invalidParam`, `notFound` 코드면 2,
106
+ `verifyFailed`면 3으로 끝납니다.
107
+
85
108
  ## Akan Cloud
86
109
 
87
110
  ```bash
@@ -110,7 +133,9 @@ Akan 프레임워크 패키지는 `dist/pkgs/*`에서만 배포합니다. `verif
110
133
 
111
134
  릴리스 후보(rc)는 CI가 배포합니다. `rc` 브랜치에 push될 때마다 CI 전체를 돌린 뒤, 대기 중인 changeset이
112
135
  릴리스할 버전의 다음 `<version>-rc.N`을 npm provenance와 함께 배포하고 그 커밋에 `v<version>-rc.N` 태그를 붙입니다.
113
- 정식 릴리스는 지금처럼 수동입니다: `bun run changeset:version` 후 `akan deploy-akan --registry npm`.
136
+ 정식 릴리스는 지금처럼 수동입니다: `bun run changeset:version`, 커밋해서 `main`에 push, 그다음
137
+ `akan deploy-akan --registry npm`. npm 배포가 끝나면 `deploy-akan`이 그 커밋으로 에디터 확장 릴리스를 CI에
138
+ 요청합니다. 커밋이 아직 `main`에 없으면 push한 뒤 돌릴 `gh workflow run` 명령을 알려 줍니다.
114
139
  `npm-publish` environment는 `rc`만 허용하므로 `rc`에 push할 수 있는 사람은 rc를 배포할 수 있습니다. 저장소 규칙에서
115
140
  `rc` push 권한을 제한하세요.
116
141
 
package/README.md CHANGED
@@ -81,6 +81,29 @@ plans workflows in `plan` mode, and in `apply` mode — the mode `mcp-install` r
81
81
  validation and the repair tools. An agent changes code through the workflows, so it follows the workspace's rules
82
82
  instead of routing around them. `akan code` is a terminal agent built on the same rules, workflows and skills.
83
83
 
84
+ ## Exit Codes
85
+
86
+ | Exit | `code` | Meaning |
87
+ | --- | --- | --- |
88
+ | 0 | | done |
89
+ | 1 | `failed`, or the error's own code | the command broke |
90
+ | 2 | `usage`, `unknownTarget` | fix the command line or what it names: an unknown flag or command, a value outside the choices, an argument with no terminal to ask it on, an app, lib, package or module the workspace does not have |
91
+ | 2 | `refused` | the answer is no: a pack that needs a new store build (`akan pack-update --against`, `akan push-update`, `akan register-binary`), a release the Akan Cloud project rejected |
92
+ | 3 | `checkFailed` | a check ran and found problems: `akan verify`, `akan typecheck` and the typecheck of `akan build`, `akan preview`, `akan agent install --check` |
93
+ | 130 | `interrupted` | interrupted, a prompt closed with Ctrl+C included |
94
+
95
+ Some commands pin a family. `akan pack-update`, `akan push-update` and `akan register-binary` exit 1 for a usage
96
+ or unknown-target failure, so their 2 only ever means a store build or a refusal. `akan agent` exits 1 for one
97
+ too, since Claude Code reads a hook's exit 2 as a block, and `akan agent hook` never exits 2. `akan doctor
98
+ --strict`, `akan workflow` and `akan subspace` exit 1 when their report says it failed or was refused.
99
+
100
+ With `--json` or `--format json`, stdout holds only JSON: a failure ends it with one line,
101
+ `{"ok":false,"error":"<message>","code":"<code>"}`, and the message goes to stderr. An NDJSON stream
102
+ (`akan code --json`, `akan logs --json`) ends with that line too. A command whose own JSON report says it failed,
103
+ as `akan verify`'s does, adds no line. Two commands keep codes of their own: `akan pipeline` exits 1 for a plan
104
+ with errors and 2 when it could not plan, and `akan migrate` answers its own JSON line, exiting 2 for a `usage`,
105
+ `invalidParam` or `notFound` code and 3 for `verifyFailed`.
106
+
84
107
  ## Akan Cloud
85
108
 
86
109
  ```bash
@@ -109,7 +132,9 @@ artifact is built last and is not overwritten by the root `akan` bootstrap scrip
109
132
 
110
133
  Release candidates publish from CI: each push to the `rc` branch runs the CI suite, then publishes the next
111
134
  `<version>-rc.N` of the version the pending changesets will release, with npm provenance, and tags that commit
112
- `v<version>-rc.N`. Stable releases stay manual: `bun run changeset:version`, then `akan deploy-akan --registry npm`.
135
+ `v<version>-rc.N`. Stable releases stay manual: `bun run changeset:version`, commit and push it to `main`, then
136
+ `akan deploy-akan --registry npm`. Once npm has the packages, `deploy-akan` asks CI to release the editor extension
137
+ from that commit; if the commit is not on `main` yet, it prints the `gh workflow run` command to run after pushing.
113
138
  The `npm-publish` environment admits only `rc`, so whoever can push to `rc` can publish an rc: restrict pushes to
114
139
  `rc` in the repository's rules.
115
140
 
@@ -0,0 +1,18 @@
1
+ // @bun
2
+ import {
3
+ TunnelShare2
4
+ } from "./index-hp2c7xc2.js";
5
+ import"./index-5h888r6j.js";
6
+ import"./index-w23tf30e.js";
7
+ import"./index-m9jj544v.js";
8
+ import"./index-9zswcze5.js";
9
+ import"./index-jx2jcw1r.js";
10
+ import"./index-ze48c0vd.js";
11
+ import"./index-na8r4a27.js";
12
+ import"./index-dss3ds74.js";
13
+ import"./index-qssq2d41.js";
14
+ import"./index-j4yvgfhr.js";
15
+ import"./index-by2tvsq6.js";
16
+ export {
17
+ TunnelShare2 as TunnelShare
18
+ };
@@ -0,0 +1,56 @@
1
+ // @bun
2
+ import {
3
+ Workspace,
4
+ command
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";
12
+ import"./index-a41vv4cy.js";
13
+ import"./index-7ehdht84.js";
14
+ import"./index-nmxszh6x.js";
15
+ import"./index-1p81ecbz.js";
16
+ import"./index-p5zh7pmc.js";
17
+ import"./index-knpm8sdm.js";
18
+ import"./index-h1w4wqgd.js";
19
+ import"./index-7v7tvgt7.js";
20
+ import"./index-w23tf30e.js";
21
+ import"./index-pt0agdck.js";
22
+ import"./index-m9jj544v.js";
23
+ import"./index-jx2jcw1r.js";
24
+ import"./index-9zswcze5.js";
25
+ import"./index-2d9nm03s.js";
26
+ import"./index-1pjwsh2g.js";
27
+ import"./index-62md4dwy.js";
28
+ import"./index-zyb0ebm4.js";
29
+ import"./index-ffa52fwf.js";
30
+ import"./index-t4d0ckde.js";
31
+ import"./index-zttyg7tg.js";
32
+ import {
33
+ AgentScript
34
+ } from "./index-mpp4aas6.js";
35
+ import"./index-g7jgd4xs.js";
36
+ import"./index-vjbne22r.js";
37
+
38
+ // pkgs/@akanjs/cli/agent/agent.command.ts
39
+ class AgentCommand extends command("agent", [AgentScript], ({ public: target }) => ({
40
+ agent: target({ desc: "Install Akan agent rules for editors and coding agents", stdio: true, usageExitCode: 1 }).arg("action", String, { desc: "install, or hook (run by Claude Code hooks)" }).arg("target", String, {
41
+ desc: "install: cursor, agents-md, claude, rules, skills, hooks, or all; hook: pre-edit, post-edit, stop",
42
+ nullable: true
43
+ }).option("force", Boolean, {
44
+ desc: "overwrite existing pointer files and generated files you took over",
45
+ default: false
46
+ }).option("check", Boolean, {
47
+ desc: "write nothing; exit 3 when install would create, change or remove a file",
48
+ default: false
49
+ }).with(Workspace).exec(async function(action, targetName, force, check, workspace) {
50
+ await this.agentScript.agent(workspace, action, targetName, { force, check });
51
+ })
52
+ })) {
53
+ }
54
+ export {
55
+ AgentCommand
56
+ };
package/akanCode.js CHANGED
@@ -2,11 +2,11 @@
2
2
  import {
3
3
  PreviewChrome2,
4
4
  PreviewView2
5
- } from "./index-23860fej.js";
6
- import"./index-bns3wcpc.js";
5
+ } from "./index-rwgqba9p.js";
6
+ import"./index-by2tvsq6.js";
7
7
  import {
8
8
  akanCodePaths2
9
- } from "./index-35j83zkd.js";
9
+ } from "./index-p5zh7pmc.js";
10
10
  import {
11
11
  AkanEditScope2,
12
12
  DevLogFeedback2,
@@ -34,31 +34,31 @@ import {
34
34
  CodeMailbox2,
35
35
  CodeSessionFork2,
36
36
  CodeAgent2
37
- } from "./index-0fj9ra3q.js";
37
+ } from "./index-2k6mve6a.js";
38
38
  import {
39
39
  akanCodeDefaultModel2,
40
40
  akanCodeModel2,
41
41
  akanCodeModelSupportsImages2,
42
42
  akanCodeModelWarnings2,
43
43
  CodeAgentStreamPrinter2
44
- } from "./index-w15mg3km.js";
44
+ } from "./index-0dm25wvf.js";
45
45
  import {
46
46
  SubagentPool2,
47
47
  AkanCodeCompaction2
48
- } from "./index-abfbf01s.js";
48
+ } from "./index-gwsesvqc.js";
49
49
  import {
50
50
  CodeAgentRpcHost2
51
51
  } from "./index-s4nvxpzm.js";
52
52
  import {
53
- CodeTuiLines2,
54
- CodeTuiAgents2,
55
- CodeTuiClipboard2,
56
53
  CodeTuiCommands2,
54
+ CodeTuiLines2,
57
55
  CodeTuiEditor2,
58
- CodeTuiFiles2,
56
+ CodeTuiAgents2,
59
57
  CodeTuiMarkdown2,
60
- CodeTuiParts2
61
- } from "./index-2mrn1mrg.js";
58
+ CodeTuiParts2,
59
+ CodeTuiClipboard2,
60
+ CodeTuiFiles2
61
+ } from "./index-9f3reh2y.js";
62
62
  import"./index-9bv479q5.js";
63
63
  export {
64
64
  AkanCli2 as AkanCli,
@@ -0,0 +1,11 @@
1
+ // @bun
2
+ import {
3
+ AppExecutor2
4
+ } from "./index-ze48c0vd.js";
5
+ import"./index-na8r4a27.js";
6
+ import"./index-qssq2d41.js";
7
+ import"./index-j4yvgfhr.js";
8
+ import"./index-by2tvsq6.js";
9
+ export {
10
+ AppExecutor2 as AppExecutor
11
+ };
@@ -1,4 +1,7 @@
1
1
  // @bun
2
+ import {
3
+ RouteJsBudget
4
+ } from "./index-7v7tvgt7.js";
2
5
  import {
3
6
  App,
4
7
  Apps,
@@ -7,21 +10,26 @@ import {
7
10
  Exec,
8
11
  Workspace,
9
12
  command
10
- } from "./index-386canwe.js";
11
- import"./index-bns3wcpc.js";
12
- import"./index-wfmpxke3.js";
13
- import"./index-y725zb1a.js";
14
- import"./index-djc5nxpy.js";
15
- import"./index-20wvskt8.js";
13
+ } from "./index-9rv2zt48.js";
14
+ import {
15
+ CliError
16
+ } from "./index-j4yvgfhr.js";
17
+ import"./index-qssq2d41.js";
18
+ import"./index-by2tvsq6.js";
19
+ import"./index-ze48c0vd.js";
20
+ import"./index-na8r4a27.js";
21
+ import"./index-dss3ds74.js";
22
+ import"./index-w23tf30e.js";
23
+ import"./index-pt0agdck.js";
16
24
  import"./index-m9jj544v.js";
17
- import"./index-84c2pgak.js";
18
- import"./index-wr9magsr.js";
19
- import"./index-xa0289eg.js";
20
- import"./index-kcpk2d20.js";
21
- import"./index-23860fej.js";
25
+ import"./index-jx2jcw1r.js";
26
+ import"./index-9zswcze5.js";
27
+ import"./index-6zb17wcm.js";
28
+ import"./index-h1w4wqgd.js";
29
+ import"./index-rwgqba9p.js";
22
30
  import {
23
31
  ApplicationScript
24
- } from "./index-8nbx607g.js";
32
+ } from "./index-0hj82f9w.js";
25
33
  import {
26
34
  writeOption,
27
35
  nativeTargetOption,
@@ -29,12 +37,20 @@ import {
29
37
  allowLocalOption,
30
38
  publicEnvOption
31
39
  } from "./index-mdjc93e1.js";
32
- import"./index-8jpc5fqv.js";
40
+ import"./index-g7jgd4xs.js";
33
41
  import"./index-9bv479q5.js";
42
+ import"./index-vjbne22r.js";
34
43
 
35
44
  // pkgs/@akanjs/cli/application/application.command.ts
36
45
  import { MigrationCommand } from "akanjs/server/migration/migrationCommand";
37
46
  import { MigrationError } from "akanjs/server/migration/migrationError";
47
+ var packUpdateDesc = "Pack an unsigned over-the-air update of the mobile web bundle for a signer; records it in <out>/pack.json. Exits 2 when --against needs a new store build, 1 on any other failure";
48
+ var migrationFailureOf = (error, usage) => {
49
+ const message = MigrationError.messageOf(error);
50
+ if (usage || CliError.is(error, "usage"))
51
+ return new MigrationError("usage", message);
52
+ return CliError.is(error, "unknownTarget") ? new MigrationError("notFound", message) : error;
53
+ };
38
54
  var deviceOption = {
39
55
  desc: "simulator, emulator or device to run on: its id or name (e.g. 'iPhone 17' or 'Pixel_10')",
40
56
  default: ""
@@ -42,6 +58,7 @@ var deviceOption = {
42
58
  var teamOption = { flag: "T", desc: "Apple team id the signing is narrowed to", default: "" };
43
59
  var signDesc = "sign with the identity AKAN_NATIVE_MACOS_* / AKAN_NATIVE_WINDOWS_* names (without it the env signs nothing)";
44
60
  var notarizeDesc = "macOS: upload the signed app to Apple's notary service (takes --sign)";
61
+ var checkBudgetDesc = "fail on a route over its akan.budget.json entry or with none, or a missing or unreadable file";
45
62
  var devEnvs = ["local", "debug", "develop", "main"];
46
63
  var buildEnvOption = { enum: devEnvs, desc: "backend environment", default: "debug" };
47
64
  var startEnvOption = {
@@ -50,8 +67,7 @@ var startEnvOption = {
50
67
  default: "local"
51
68
  };
52
69
  var listOf = (value) => (value ?? "").split(",").map((entry) => entry.trim()).filter(Boolean);
53
-
54
- class ApplicationCommand extends command("application", [ApplicationScript], ({ public: target }) => ({
70
+ var workspaceTargets = ({ public: target }) => ({
55
71
  createApplication: target({ desc: "Create a new application in the workspace" }).arg("appName", String, { desc: "name of application" }).option("start", Boolean, { desc: "start application", default: false }).with(Workspace).exec(async function(appName, start, workspace) {
56
72
  await this.applicationScript.createApplication(appName.toLowerCase().replace(/ /g, "-"), workspace, { start });
57
73
  }),
@@ -66,7 +82,9 @@ class ApplicationCommand extends command("application", [ApplicationScript], ({
66
82
  }),
67
83
  script: target({ desc: "Run a custom script in the application" }).with(App).arg("filename", String, { desc: "name of script", nullable: true }).exec(async function(app, filename) {
68
84
  await this.applicationScript.script(app, filename);
69
- }),
85
+ })
86
+ });
87
+ var migrationTargets = ({ public: target }) => ({
70
88
  migrate: target({
71
89
  desc: "List, plan, apply, verify or roll back the app's data migrations in script/migration",
72
90
  stdio: true,
@@ -74,8 +92,7 @@ class ApplicationCommand extends command("application", [ApplicationScript], ({
74
92
  onFailure: async (error, { usage, given }) => {
75
93
  if (given.json !== true)
76
94
  return;
77
- const failure = usage ? new MigrationError("usage", MigrationError.messageOf(error)) : error;
78
- await MigrationCommand.print(MigrationCommand.failure(null, failure), true);
95
+ await MigrationCommand.print(MigrationCommand.failure(null, migrationFailureOf(error, usage)), true);
79
96
  }
80
97
  }).with(App).arg("action", String, { desc: "list, plan, apply, verify or rollback", default: "list" }).arg("target", String, { desc: "migration id; for rollback, an apply's run id too", nullable: true }).option("param", String, { desc: "a param the migration declares, as name=value", multiple: true }).option("expect", String, { desc: "the plan hash an apply must still match", nullable: true }).option("items", Number, { desc: "how many planned decisions to print", nullable: true }).option("actor", String, { desc: "who runs it, as the ledger records", nullable: true }).option("json", Boolean, { desc: "print the result as one JSON line", default: false }).exec(async function(app, action, target, param, expect, items, actor, json) {
81
98
  await this.applicationScript.migrate(app, [
@@ -90,12 +107,14 @@ class ApplicationCommand extends command("application", [ApplicationScript], ({
90
107
  }),
91
108
  createMigration: target({ desc: "Create a data migration in the app's script/migration" }).arg("migrationName", String, { desc: "what it does, in camelCase", example: "bizLicenseOwnership" }).with(App).exec(async function(migrationName, app) {
92
109
  await this.applicationScript.createMigration(app, migrationName);
93
- }),
110
+ })
111
+ });
112
+ var inspectTargets = ({ public: target }) => ({
94
113
  preview: target({
95
114
  desc: "Open pages of the app's dev server in a headless browser and print what broke, starting a server if none runs",
96
115
  stdio: true
97
116
  }).with(App).arg("paths", String, {
98
- desc: "page paths, comma-separated; the default locale is added when missing, but not to /_akan routes such as Studio or to files (default: /)",
117
+ desc: "page paths, comma-separated; the default locale is added when missing, except to a path the server answers outside a locale (/_akan, the API prefix, /__csr, /__rsc, /.well-known, /openapi.json, /mcp, the server's own files, public/ files), which opens as written; a full URL opens its path on the dev server (default: /)",
99
118
  example: "/board,/board/new",
100
119
  nullable: true
101
120
  }).option("changed", Boolean, {
@@ -178,7 +197,9 @@ class ApplicationCommand extends command("application", [ApplicationScript], ({
178
197
  follow,
179
198
  runtimeDir
180
199
  });
181
- }),
200
+ })
201
+ });
202
+ var buildAndTestTargets = ({ public: target }) => ({
182
203
  build: target({ short: true, desc: "Build the application for production (frontend + backend)" }).with(App).option("write", Boolean, writeOption).option("fast", Boolean, { desc: "fast build", default: false }).option("quiet", Boolean, { desc: "hide build progress output", default: false }).option("profile", String, {
183
204
  desc: "server env profile: bundle env/env.server.<env>.<profile>.ts in place of the environment's own file",
184
205
  nullable: true
@@ -186,17 +207,14 @@ class ApplicationCommand extends command("application", [ApplicationScript], ({
186
207
  enum: devEnvs,
187
208
  desc: "environment the server runs in (default: AKAN_PUBLIC_ENV of the shell, else of the workspace .env)",
188
209
  nullable: true
189
- }).option("updateBudget", Boolean, {
190
- desc: "write akan.budget.json: add each new route's JS and lower an entry a route now fits under, never raise one",
191
- default: false
192
- }).exec(async function(app, write, fast, quiet, profile, env, updateBudget) {
210
+ }).option("checkBudget", Boolean, { desc: checkBudgetDesc, default: false }).option("updateBudget", Boolean, { desc: "write akan.budget.json, never raising an entry", default: false }).option("raiseBudget", Boolean, { desc: "rewrite akan.budget.json at each route's measured JS", default: false }).exec(async function(app, write, fast, quiet, profile, env, checkBudget, updateBudget, raiseBudget) {
193
211
  await this.applicationScript.build(app, {
194
212
  write,
195
213
  fast,
196
214
  quiet,
197
215
  profile: profile ?? undefined,
198
216
  env: env ?? undefined,
199
- updateBudget
217
+ budget: RouteJsBudget.modeOf({ checkBudget, updateBudget, raiseBudget })
200
218
  });
201
219
  }),
202
220
  typecheck: target({ short: true, desc: "Typecheck an app or a library, its tests and specs included" }).with(SysOrOnlyApp).option("write", Boolean, writeOption).option("clean", Boolean, { desc: "clear typecheck cache before running", default: false }).option("incremental", Boolean, { desc: "reuse TypeScript incremental cache", default: true }).option("tests", Boolean, { desc: "check its *.test.ts / *.spec.ts too, which nothing imports", default: true }).exec(async function(sys, write, clean, incremental, tests) {
@@ -208,7 +226,9 @@ class ApplicationCommand extends command("application", [ApplicationScript], ({
208
226
  nullable: true
209
227
  }).option("write", Boolean, writeOption).option("coverage", Boolean, { desc: "measure coverage; lcov goes under local/coverage/<target>", default: false }).exec(async function(exec, files, write, coverage) {
210
228
  await this.applicationScript.test(exec, { write, files: listOf(files), coverage });
211
- }),
229
+ })
230
+ });
231
+ var nativeBuildTargets = ({ public: target }) => ({
212
232
  buildIos: target({ short: true, desc: "Build the iOS app on the native runtime" }).with(App).option("target", String, nativeTargetOption).option("env", String, buildEnvOption).option("debug", Boolean, { desc: "debug build instead of release", default: false }).option("write", Boolean, writeOption).exec(async function(app, target, env, debug, write) {
213
233
  await this.applicationScript.buildIos(app, { target, env, profile: debug ? "debug" : "release", write });
214
234
  }),
@@ -233,7 +253,9 @@ class ApplicationCommand extends command("application", [ApplicationScript], ({
233
253
  ...notarize ? { notarize } : {},
234
254
  ...arch ? { arch } : {}
235
255
  });
236
- }),
256
+ })
257
+ });
258
+ var startTargets = ({ public: target }) => ({
237
259
  start: target({ short: true, desc: "Start development server(s) (frontend SSR + backend)" }).with(Apps).option("plain", Boolean, { desc: "print prefixed lines instead of the full-screen view", default: false }).option("kill", Boolean, { flag: "k", desc: "free the dev ports first, whoever is holding them", default: false }).option("concurrency", Number, {
238
260
  desc: "apps to boot at a time (default: what this machine's memory and cores allow)",
239
261
  nullable: true
@@ -272,7 +294,9 @@ class ApplicationCommand extends command("application", [ApplicationScript], ({
272
294
  operation: release ? "release" : "local",
273
295
  write
274
296
  });
275
- }),
297
+ })
298
+ });
299
+ var releaseTargets = ({ public: target }) => ({
276
300
  releaseIos: target({ desc: "Build and sign the iOS app for the App Store (.ipa)" }).with(App).option("target", String, nativeTargetOption).option("env", String, releaseEnvOption).option("team", String, teamOption).option("adHoc", Boolean, { desc: "sign with an ad-hoc profile instead of app-store", default: false }).option("write", Boolean, writeOption).option("allowLocalRelease", Boolean, allowLocalOption("release")).option("publicEnv", String, publicEnvOption("the release")).exec(async function(app, target, env, team, adHoc, write, allowLocalRelease, publicEnv) {
277
301
  await this.applicationScript.releaseIos(app, {
278
302
  target,
@@ -292,10 +316,10 @@ class ApplicationCommand extends command("application", [ApplicationScript], ({
292
316
  allowLocalRelease,
293
317
  publicEnv: publicEnv ?? undefined
294
318
  });
295
- }),
296
- packUpdate: target({
297
- desc: "Pack an unsigned over-the-air update of the mobile web bundle for a signer; records it in <out>/pack.json. Exits 2 when --against needs a new store build, 1 on any other failure"
298
- }).with(App).option("platform", String, { enum: ["ios", "android"], desc: "the app it updates" }).option("target", String, nativeTargetOption).option("env", String, releaseEnvOption).option("out", String, {
319
+ })
320
+ });
321
+ var updateTargets = ({ public: target }) => ({
322
+ packUpdate: target({ desc: packUpdateDesc, usageExitCode: 1 }).with(App).option("platform", String, { enum: ["ios", "android"], desc: "the app it updates" }).option("target", String, nativeTargetOption).option("env", String, releaseEnvOption).option("out", String, {
299
323
  desc: "output folder (default: dist/native/<app>/<target>/updates/<platform>)",
300
324
  nullable: true
301
325
  }).option("against", String, {
@@ -358,7 +382,9 @@ class ApplicationCommand extends command("application", [ApplicationScript], ({
358
382
  write,
359
383
  allowLocalRelease
360
384
  });
361
- }),
385
+ })
386
+ });
387
+ var databaseTargets = ({ public: target }) => ({
362
388
  dbup: target({ desc: "Start local database services for a database mode" }).with(Workspace).option("mode", String, {
363
389
  desc: "database mode; left out, every mode the workspace's apps declare",
364
390
  enum: ["single", "multiple", "cluster"],
@@ -375,6 +401,18 @@ class ApplicationCommand extends command("application", [ApplicationScript], ({
375
401
  dbdown: target({ desc: "Stop local database services" }).with(Workspace).exec(async function(workspace) {
376
402
  await this.applicationScript.dbdown(workspace);
377
403
  })
404
+ });
405
+
406
+ class ApplicationCommand extends command("application", [ApplicationScript], (context) => ({
407
+ ...workspaceTargets(context),
408
+ ...migrationTargets(context),
409
+ ...inspectTargets(context),
410
+ ...buildAndTestTargets(context),
411
+ ...nativeBuildTargets(context),
412
+ ...startTargets(context),
413
+ ...releaseTargets(context),
414
+ ...updateTargets(context),
415
+ ...databaseTargets(context)
378
416
  })) {
379
417
  }
380
418
  export {
@@ -1,32 +1,36 @@
1
1
  // @bun
2
2
  import {
3
- ServerEnvProfile,
4
- Spinner,
5
3
  ProjectTypecheck2,
4
+ Spinner,
6
5
  parseEnvFile,
7
- WorkspaceExecutor
8
- } from "./index-wfmpxke3.js";
9
- import"./index-bns3wcpc.js";
6
+ WorkspaceExecutor,
7
+ ServerEnvProfile
8
+ } from "./index-qssq2d41.js";
9
+ import"./index-by2tvsq6.js";
10
+ import"./index-j4yvgfhr.js";
11
+ import"./index-ze48c0vd.js";
12
+ import"./index-na8r4a27.js";
13
+ import"./index-dss3ds74.js";
10
14
  import {
11
15
  NARROWABLE_VENDOR_SPECIFIERS
12
- } from "./index-vbhx60x5.js";
16
+ } from "./index-xwe7y0gf.js";
13
17
  import {
14
18
  FontPruner,
15
19
  RouteJsBudget
16
- } from "./index-y725zb1a.js";
17
- import"./index-84c2pgak.js";
20
+ } from "./index-7v7tvgt7.js";
21
+ import"./index-jx2jcw1r.js";
18
22
  import {
19
23
  AllRoutesBuilder,
20
24
  precompressArtifacts,
21
25
  SsrBaseArtifactBuilder,
22
26
  VendorImportScanner
23
- } from "./index-bdmgqzb5.js";
27
+ } from "./index-bket1068.js";
24
28
  import {
25
29
  CsrArtifactBuilder
26
- } from "./index-wr9magsr.js";
30
+ } from "./index-9zswcze5.js";
27
31
  import"./index-62md4dwy.js";
28
32
 
29
- // pkgs/@akanjs/devkit/applicationBuildRunner.ts
33
+ // pkgs/@akanjs/devkit/app/applicationBuildRunner.ts
30
34
  import path3 from "path";
31
35
  import { toError } from "akanjs/common";
32
36
  import { BUILD_ENV_FILE } from "akanjs/server/lifecycle/buildEnv";
@@ -123,7 +127,7 @@ var createServerEnvPlugin = ({
123
127
  };
124
128
  };
125
129
 
126
- // pkgs/@akanjs/devkit/applicationBuildRunner.ts
130
+ // pkgs/@akanjs/devkit/app/applicationBuildRunner.ts
127
131
  var BUILD_PHASE_EMOJIS = {
128
132
  prepare: "\uD83E\uDDF9",
129
133
  typecheck: "\uD83D\uDD0E",
@@ -393,7 +397,7 @@ void run().catch((error) => {
393
397
  const { baseDevEnv, branches } = await this.#app.getConfig();
394
398
  const routes = new AllRoutesBuilder(this.#app, "build");
395
399
  const allRoutes = await routes.build();
396
- const vendorExports = await VendorImportScanner.exportsUsedIn(path3.join(this.#app.dist.cwdPath, ".akan/artifact/client"), NARROWABLE_VENDOR_SPECIFIERS);
400
+ const vendorExports = await VendorImportScanner.exportsUsedIn(path3.join(this.#app.dist.cwdPath, ".akan/artifact/client"), NARROWABLE_VENDOR_SPECIFIERS, Object.values(allRoutes.manifest.clientManifest).map(({ id }) => id));
397
401
  const base = await new SsrBaseArtifactBuilder(this.#app, "build", {
398
402
  serverEnv: this.#serverEnvPlugin(baseDevEnv.env, branches),
399
403
  vendorExports
@@ -408,6 +412,7 @@ void run().catch((error) => {
408
412
  const budgetPath = path3.join(this.#app.cwdPath, RouteJsBudget.fileName);
409
413
  const { summary: status, warnings } = await RouteJsBudget.check(sizes, {
410
414
  mode: this.#budget,
415
+ app: this.#app.name,
411
416
  budgetPath,
412
417
  source: path3.relative(this.#app.workspace.workspaceRoot, budgetPath),
413
418
  environment
@@ -2,31 +2,37 @@
2
2
  import {
3
3
  FontOptimizer,
4
4
  ApplicationBuildReporter
5
- } from "./index-y725zb1a.js";
5
+ } from "./index-7v7tvgt7.js";
6
6
  import {
7
7
  resolveSsrPageEntriesForApp,
8
- WorkspaceExecutor,
9
- AppExecutor
10
- } from "./index-wfmpxke3.js";
8
+ AppExecutor2
9
+ } from "./index-ze48c0vd.js";
11
10
  import {
12
11
  computeRouteSeedIndex,
13
12
  saveRouteSeedIndex,
14
13
  CsrDevBundler,
15
14
  SsrDevBundler
16
- } from "./index-vbhx60x5.js";
17
- import"./index-bns3wcpc.js";
15
+ } from "./index-xwe7y0gf.js";
16
+ import {
17
+ WorkspaceExecutor
18
+ } from "./index-qssq2d41.js";
19
+ import"./index-by2tvsq6.js";
20
+ import"./index-j4yvgfhr.js";
21
+ import"./index-na8r4a27.js";
22
+ import"./index-dss3ds74.js";
18
23
  import {
19
24
  ServerGraphFile,
20
25
  PagesBundleBuilder
21
- } from "./index-84c2pgak.js";
26
+ } from "./index-jx2jcw1r.js";
22
27
  import {
23
28
  CssCompiler,
24
29
  SsrBaseArtifactBuilder
25
- } from "./index-bdmgqzb5.js";
30
+ } from "./index-bket1068.js";
26
31
  import {
27
32
  CsrArtifactBuilder
28
- } from "./index-wr9magsr.js";
33
+ } from "./index-9zswcze5.js";
29
34
  import"./index-62md4dwy.js";
35
+ import"./index-vjbne22r.js";
30
36
 
31
37
  // pkgs/@akanjs/devkit/incrementalBuilder/buildBatch.proc.ts
32
38
  import path from "path";
@@ -272,6 +278,15 @@ ${cssText}`).toString(36);
272
278
  return previous.files.some((fontFile) => path.resolve(fontFile) === normalized);
273
279
  });
274
280
  }
281
+ static #report(result) {
282
+ if (!process.send)
283
+ return Promise.resolve();
284
+ return new Promise((resolve) => {
285
+ process.once("disconnect", () => resolve());
286
+ process.send?.({ type: "build-batch-result", data: result });
287
+ setTimeout(() => process.disconnect?.(), 5000).unref();
288
+ });
289
+ }
275
290
  static async main() {
276
291
  const raw = process.argv[2];
277
292
  if (!raw)
@@ -285,14 +300,14 @@ ${cssText}`).toString(36);
285
300
  workspaceRoot: request.workspaceRoot,
286
301
  repoName: request.repoName
287
302
  });
288
- const app = AppExecutor.from(workspace, request.appName);
303
+ const app = AppExecutor2.from(workspace, request.appName);
289
304
  if (request.pageKeys)
290
305
  app.setPageKeys(request.pageKeys);
291
306
  const orphaned = () => process.exit(1);
292
307
  process.on("disconnect", orphaned);
293
308
  const result = await new BuildBatch(request, app).run();
294
- process.send?.({ type: "build-batch-result", data: result });
295
309
  process.off("disconnect", orphaned);
310
+ await BuildBatch.#report(result);
296
311
  }
297
312
  }
298
313
  await BuildBatch.main().catch((err) => {