@akanjs/cli 3.0.0-alpha.0 → 3.0.0-alpha.2

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 (54) hide show
  1. package/.build-stamp +1 -1
  2. package/{abstractCompactor-rk6twzvj.js → abstractCompactor-e5yq60qz.js} +2 -2
  3. package/{agent.command-jfz8yfwy.js → agent.command-yv00p0s0.js} +7 -7
  4. package/{application.command-3smsv7mq.js → application.command-0qsczf4k.js} +5 -5
  5. package/{applicationBuildRunner-aq7mb3z6.js → applicationBuildRunner-ct2pxyvw.js} +1 -1
  6. package/{applicationReleasePackager-yrrhbkv3.js → applicationReleasePackager-gg8ccbeh.js} +1 -1
  7. package/buildBatch.proc.js +2 -2
  8. package/{capacitorApp-q3mpmkkz.js → capacitorApp-4r9sm3qg.js} +3 -3
  9. package/{cloud.command-rk4e9vrt.js → cloud.command-dxfv18sa.js} +9 -9
  10. package/{context.command-ygzyb0xb.js → context.command-8d9e3k6b.js} +15 -15
  11. package/{guideline.command-1m1ctar3.js → guideline.command-3jbkxzh6.js} +5 -5
  12. package/guidelines/ssrRule/ssrRule.generate.json +31 -0
  13. package/guidelines/ssrRule/ssrRule.instruction.md +108 -0
  14. package/incrementalBuilder.proc.js +2 -2
  15. package/{index-3pgtw35d.js → index-0cj2zxbm.js} +1 -1
  16. package/{index-h0bngh79.js → index-1pvex4az.js} +11 -11
  17. package/{index-csqk9z5j.js → index-2q1f5j9k.js} +3 -3
  18. package/{index-cn24dcqn.js → index-7c6k4yvg.js} +2 -2
  19. package/{index-jk9q6pse.js → index-8hsbnyes.js} +1 -1
  20. package/{index-4yp06pn1.js → index-a00jg8x8.js} +2 -2
  21. package/{index-hjzr8ja1.js → index-bbkek1bp.js} +1 -1
  22. package/{index-r4w8cry5.js → index-bekddz9q.js} +4 -4
  23. package/{index-ev6rjw9n.js → index-e16gnn26.js} +35 -12
  24. package/{index-fmgbwsr5.js → index-ec09pws3.js} +4 -4
  25. package/{index-n0z3f2xg.js → index-ej426mcr.js} +4 -4
  26. package/{index-jtm86byd.js → index-hgna5rjy.js} +1 -1
  27. package/{index-e3qskyt2.js → index-k95xkh4p.js} +2 -2
  28. package/{index-b978vs2e.js → index-mr5s7mqd.js} +3 -3
  29. package/{index-6pz1j0zj.js → index-mxvakhsm.js} +6 -2
  30. package/{index-f4gqk0dd.js → index-nm6wghb6.js} +6 -6
  31. package/{index-4zgs8g1w.js → index-rzwcpcc3.js} +1 -1
  32. package/{index-sggm9qkv.js → index-t3723f99.js} +1 -1
  33. package/{index-xwgm94zr.js → index-tdbas9r0.js} +1 -1
  34. package/{index-vhv3xnjz.js → index-yzmhasdb.js} +6 -6
  35. package/{index-ktprgc5g.js → index-zasydjxd.js} +4 -4
  36. package/index.js +19 -19
  37. package/{library.command-pwfx8dx2.js → library.command-ebdj1vnm.js} +4 -4
  38. package/{localRegistry.command-bxhqmd1d.js → localRegistry.command-gb178ne8.js} +8 -8
  39. package/{module.command-0t3ewata.js → module.command-9c1bnsx4.js} +8 -8
  40. package/{package.command-7hmkxvpa.js → package.command-t93p4jkj.js} +4 -4
  41. package/package.json +2 -2
  42. package/{page.command-st6r4s0q.js → page.command-k3k0meh2.js} +4 -4
  43. package/{primitive.command-1qkxpzsn.js → primitive.command-de6nktdt.js} +9 -9
  44. package/{quality.command-hy5vt1bh.js → quality.command-z5kth2wa.js} +451 -48
  45. package/{repair.command-nakkq2zp.js → repair.command-ehf2g112.js} +6 -6
  46. package/{scalar.command-fjq272gs.js → scalar.command-7a2jtv33.js} +7 -7
  47. package/templates/lib/db.ts +3 -1
  48. package/templates/workspaceRoot/.cursor/rules/client-server-boundaries.mdc.template +1 -0
  49. package/templates/workspaceRoot/.cursor/rules/ssr-first.mdc.template +59 -0
  50. package/templates/workspaceRoot/AGENTS.md.template +142 -14
  51. package/{workflow.command-jswbgk90.js → workflow.command-e0tt0vk2.js} +12 -12
  52. package/{workspace.command-p9r9nckg.js → workspace.command-fpda0evj.js} +21 -21
  53. package/templates/libRoot/base/baseLogic.ts +0 -14
  54. package/templates/libRoot/base/index.ts +0 -8
package/.build-stamp CHANGED
@@ -1 +1 @@
1
- ce7835b9c7e649ebc830a1ac94fa9db80a2c2aaec64459445780b8dc7bd627a0
1
+ 5ce0c5971a50c46a41ba69a3a1125bb984dfbb8bc836bb7a817970eca45b7c59
@@ -1,11 +1,11 @@
1
1
  // @bun
2
2
  import {
3
3
  AiSession
4
- } from "./index-3pgtw35d.js";
4
+ } from "./index-0cj2zxbm.js";
5
5
  import {
6
6
  AbstractDoc
7
7
  } from "./index-0wae5ebk.js";
8
- import"./index-6pz1j0zj.js";
8
+ import"./index-mxvakhsm.js";
9
9
  import"./index-67546d0j.js";
10
10
  import"./index-r24hmh0q.js";
11
11
 
@@ -1,16 +1,16 @@
1
1
  // @bun
2
2
  import {
3
3
  AgentScript
4
- } from "./index-n0z3f2xg.js";
5
- import"./index-4yp06pn1.js";
6
- import"./index-4zgs8g1w.js";
7
- import"./index-xwgm94zr.js";
4
+ } from "./index-ej426mcr.js";
5
+ import"./index-a00jg8x8.js";
6
+ import"./index-rzwcpcc3.js";
7
+ import"./index-tdbas9r0.js";
8
8
  import {
9
9
  Workspace,
10
10
  command
11
- } from "./index-jk9q6pse.js";
12
- import"./index-jtm86byd.js";
13
- import"./index-6pz1j0zj.js";
11
+ } from "./index-8hsbnyes.js";
12
+ import"./index-hgna5rjy.js";
13
+ import"./index-mxvakhsm.js";
14
14
  import"./index-xys926f2.js";
15
15
  import"./index-67546d0j.js";
16
16
  import"./index-r24hmh0q.js";
@@ -4,22 +4,22 @@ import {
4
4
  } from "./index-0wae5ebk.js";
5
5
  import {
6
6
  ApplicationScript
7
- } from "./index-ev6rjw9n.js";
7
+ } from "./index-e16gnn26.js";
8
8
  import {
9
9
  getMobileTargetChoices
10
10
  } from "./index-76rn3g2c.js";
11
- import"./index-cn24dcqn.js";
11
+ import"./index-7c6k4yvg.js";
12
12
  import {
13
13
  App,
14
14
  Exec,
15
15
  Sys,
16
16
  Workspace,
17
17
  command
18
- } from "./index-jk9q6pse.js";
18
+ } from "./index-8hsbnyes.js";
19
19
  import"./index-fgc8r6dj.js";
20
20
  import"./index-bjpxzr6s.js";
21
- import"./index-jtm86byd.js";
22
- import"./index-6pz1j0zj.js";
21
+ import"./index-hgna5rjy.js";
22
+ import"./index-mxvakhsm.js";
23
23
  import"./index-67546d0j.js";
24
24
  import"./index-r24hmh0q.js";
25
25
 
@@ -10,7 +10,7 @@ import"./index-rh16j3c7.js";
10
10
  import"./index-bjpxzr6s.js";
11
11
  import {
12
12
  Spinner
13
- } from "./index-6pz1j0zj.js";
13
+ } from "./index-mxvakhsm.js";
14
14
  import"./index-r24hmh0q.js";
15
15
 
16
16
  // pkgs/@akanjs/devkit/applicationBuildRunner.ts
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  Spinner
4
- } from "./index-6pz1j0zj.js";
4
+ } from "./index-mxvakhsm.js";
5
5
  import {
6
6
  FileSys
7
7
  } from "./index-67546d0j.js";
@@ -12,8 +12,8 @@ import"./index-bjpxzr6s.js";
12
12
  import {
13
13
  AppExecutor,
14
14
  WorkspaceExecutor
15
- } from "./index-jtm86byd.js";
16
- import"./index-6pz1j0zj.js";
15
+ } from "./index-hgna5rjy.js";
16
+ import"./index-mxvakhsm.js";
17
17
  import"./index-67546d0j.js";
18
18
  import"./index-r24hmh0q.js";
19
19
 
@@ -24,10 +24,10 @@ import {
24
24
  selectLocalDevHost,
25
25
  sortIosRunTargets,
26
26
  writeRootCapacitorConfig
27
- } from "./index-sggm9qkv.js";
27
+ } from "./index-t3723f99.js";
28
28
  import"./index-76rn3g2c.js";
29
- import"./index-jtm86byd.js";
30
- import"./index-6pz1j0zj.js";
29
+ import"./index-hgna5rjy.js";
30
+ import"./index-mxvakhsm.js";
31
31
  import"./index-67546d0j.js";
32
32
  import"./index-r24hmh0q.js";
33
33
  export {
@@ -1,23 +1,23 @@
1
1
  // @bun
2
2
  import {
3
3
  CloudScript
4
- } from "./index-f4gqk0dd.js";
5
- import"./index-ktprgc5g.js";
6
- import"./index-e3qskyt2.js";
4
+ } from "./index-nm6wghb6.js";
5
+ import"./index-zasydjxd.js";
6
+ import"./index-k95xkh4p.js";
7
7
  import {
8
8
  GlobalConfig
9
- } from "./index-3pgtw35d.js";
10
- import"./index-ev6rjw9n.js";
9
+ } from "./index-0cj2zxbm.js";
10
+ import"./index-e16gnn26.js";
11
11
  import"./index-76rn3g2c.js";
12
- import"./index-cn24dcqn.js";
12
+ import"./index-7c6k4yvg.js";
13
13
  import {
14
14
  Workspace,
15
15
  command
16
- } from "./index-jk9q6pse.js";
16
+ } from "./index-8hsbnyes.js";
17
17
  import"./index-fgc8r6dj.js";
18
18
  import"./index-bjpxzr6s.js";
19
- import"./index-jtm86byd.js";
20
- import"./index-6pz1j0zj.js";
19
+ import"./index-hgna5rjy.js";
20
+ import"./index-mxvakhsm.js";
21
21
  import"./index-46tjzh6s.js";
22
22
  import"./index-67546d0j.js";
23
23
  import"./index-r24hmh0q.js";
@@ -1,26 +1,26 @@
1
1
  // @bun
2
2
  import {
3
3
  ContextScript
4
- } from "./index-h0bngh79.js";
5
- import"./index-b978vs2e.js";
6
- import"./index-csqk9z5j.js";
7
- import"./index-r4w8cry5.js";
8
- import"./index-vhv3xnjz.js";
9
- import"./index-hjzr8ja1.js";
10
- import"./index-fmgbwsr5.js";
4
+ } from "./index-1pvex4az.js";
5
+ import"./index-mr5s7mqd.js";
6
+ import"./index-2q1f5j9k.js";
7
+ import"./index-bekddz9q.js";
8
+ import"./index-yzmhasdb.js";
9
+ import"./index-bbkek1bp.js";
10
+ import"./index-ec09pws3.js";
11
11
  import"./index-ss469dec.js";
12
- import"./index-sggm9qkv.js";
13
- import"./index-3pgtw35d.js";
14
- import"./index-4yp06pn1.js";
15
- import"./index-4zgs8g1w.js";
16
- import"./index-xwgm94zr.js";
12
+ import"./index-t3723f99.js";
13
+ import"./index-0cj2zxbm.js";
14
+ import"./index-a00jg8x8.js";
15
+ import"./index-rzwcpcc3.js";
16
+ import"./index-tdbas9r0.js";
17
17
  import"./index-76rn3g2c.js";
18
18
  import {
19
19
  Workspace,
20
20
  command
21
- } from "./index-jk9q6pse.js";
22
- import"./index-jtm86byd.js";
23
- import"./index-6pz1j0zj.js";
21
+ } from "./index-8hsbnyes.js";
22
+ import"./index-hgna5rjy.js";
23
+ import"./index-mxvakhsm.js";
24
24
  import"./index-xys926f2.js";
25
25
  import"./index-67546d0j.js";
26
26
  import"./index-r24hmh0q.js";
@@ -1,20 +1,20 @@
1
1
  // @bun
2
2
  import {
3
3
  AiSession
4
- } from "./index-3pgtw35d.js";
4
+ } from "./index-0cj2zxbm.js";
5
5
  import {
6
6
  Prompter
7
- } from "./index-xwgm94zr.js";
7
+ } from "./index-tdbas9r0.js";
8
8
  import {
9
9
  Workspace,
10
10
  command,
11
11
  runner,
12
12
  script
13
- } from "./index-jk9q6pse.js";
13
+ } from "./index-8hsbnyes.js";
14
14
  import {
15
15
  getDirname
16
- } from "./index-jtm86byd.js";
17
- import"./index-6pz1j0zj.js";
16
+ } from "./index-hgna5rjy.js";
17
+ import"./index-mxvakhsm.js";
18
18
  import {
19
19
  FileSys
20
20
  } from "./index-67546d0j.js";
@@ -0,0 +1,31 @@
1
+ {
2
+ "title": "SSR Rule",
3
+ "description": "Akan SSR-first rendering rules — keep JSX on the server and justify every client boundary",
4
+ "group": "core",
5
+ "codegenPriority": 3,
6
+ "deprecated": false,
7
+ "scans": [
8
+ {
9
+ "type": "example",
10
+ "description": "Client boundary shells that render server children untouched",
11
+ "path": "{apps,libs}/*/ui/**/*.tsx",
12
+ "sample": 4
13
+ },
14
+ {
15
+ "type": "example",
16
+ "description": "Module UI split across client Zone/Template/Util and server Unit/View",
17
+ "path": "{apps,libs}/*/lib/*/*.tsx",
18
+ "sample": 4
19
+ }
20
+ ],
21
+ "update": {
22
+ "filePath": "./ssrRule.instruction.md",
23
+ "contents": ["purpose", "when a client boundary is earned", "quality rules", "implementation playbook"],
24
+ "rules": [
25
+ "Use current Akan APIs only",
26
+ "Keep output parseable for codegen",
27
+ "Name the akan.ssr.* rule ids the quality scanner emits",
28
+ "Ground every pattern in a file that exists in the workspace"
29
+ ]
30
+ }
31
+ }
@@ -0,0 +1,108 @@
1
+ # Akan SSR Rule Guideline
2
+
3
+ ## Purpose
4
+ Use this when writing or reviewing any `.tsx` file. Akan is SSR-first: an element rendered on the server ships as
5
+ HTML and costs nothing to hydrate, while an element behind `"use client"` ships twice — as markup and as bundled JS
6
+ that re-runs in the browser. The boundary question is never "may this file be client", it is **how little ends up
7
+ on the client side**.
8
+
9
+ ## When A Client Boundary Is Earned
10
+ - A component earns `"use client"` only by using a client-only capability: a React hook, a JSX event handler, the
11
+ store (`st.use.*` / `st.do.*`), a browser global (`window`, `document`, `navigator`, `localStorage`, …), or a
12
+ client-only third-party package.
13
+ - Rendering markup, mapping over data, reading a route param, and calling `l()` are server work. `usePage()` and
14
+ `getSelf()` are legal in server components and never force a boundary.
15
+ - In domain UI the file role fixes the directive: `Template`, `Zone`, and `Util` are client; `Unit` and `View` are
16
+ server. That decides *where* the boundary sits, not how much markup sits behind it — a `Zone` that hoards markup
17
+ is still an SSR regression.
18
+ - Measure with `akan quality ssr` (`--format json` for tooling). It reports the server render share per app and
19
+ lib as server-rendered JSX elements over total. Treat **50% server share as the floor** and a falling share as a
20
+ regression to justify or revert.
21
+
22
+ ## Quality Rules
23
+ - `akan.ssr.unnecessary-use-client` — the directive is present but nothing in the file needs it. Delete it. If the
24
+ file exists only to wrap one client child, drop the wrapper and use the child directly.
25
+ - `akan.ssr.client-static-component` — a component inside a client file renders real markup with zero client-only
26
+ capability. Move it to a server file: a `<Model>.Unit.tsx` / `<Model>.View.tsx` for a module, or a `ui/` file with
27
+ no directive.
28
+ - `akan.ssr.client-static-markup` — a large subtree wraps one or two interactive touches. Keep the interactive
29
+ element in the client component and hoist the static subtree into a server component received as `children`.
30
+ - `akan.ssr.client-mount-load` — a `useEffect(…, [])` loads server data. Fetch it in the route and pass the
31
+ init/view object down.
32
+ - `akan.ssr.module-missing-server-view` — a module renders only from `Template`/`Zone`/`Util` and declares no
33
+ `Unit`/`View`. Add them and have the `Zone` delegate.
34
+ - `akan.ssr.template-client-state` — a `Template` holds form state in `useState`. Bind to the store instead:
35
+ `value={xForm.field}` with `onChange={st.do.setFieldOnX}`.
36
+
37
+ A third-party client package and the `ui/<Folder>/index_.tsx` + `lazy()` boundary both justify the directive and are
38
+ not flagged. Interaction-driven `fetch.*` inside an `onClick` is not flagged either — only mount-time loads are,
39
+ because those are the ones the server could have performed.
40
+
41
+ ## Implementation Playbook
42
+
43
+ **① Wrap the interaction, not the UI.** The smallest useful client component adds one behaviour and renders
44
+ `children` untouched, so the markup inside never reaches the bundle.
45
+
46
+ ```tsx
47
+ "use client";
48
+ export const ClickWrapper = ({ children, onPick }: ClickWrapperProps) => <div onClick={onPick}>{children}</div>;
49
+ ```
50
+
51
+ `libs/shared/ui/Only/User.tsx` is the same shape: it reads auth state on the client and returns `{children}`.
52
+
53
+ **② Split compound components so panels stay on the server.** A tab, accordion, or disclosure needs client state
54
+ only for *which* part is visible, never for what the parts contain. `Tab` / `Tab.Menus` / `Tab.Menu` / `Tab.Panel`
55
+ in `akanjs/ui` is the reference: only the provider and menu hold state, and `<Tab.Panel>` renders its children
56
+ as-is, so a server `Unit`/`View` passed in stays server-rendered.
57
+
58
+ ```tsx
59
+ <Tab defaultMenu="detail">
60
+ <Tab.Menus>
61
+ <Tab.Menu menu="detail">{l("post.detail")}</Tab.Menu>
62
+ <Tab.Menu menu="history">{l("post.history")}</Tab.Menu>
63
+ </Tab.Menus>
64
+ <Tab.Panel menu="detail">
65
+ <Post.View.General post={post} />
66
+ </Tab.Panel>
67
+ </Tab>
68
+ ```
69
+
70
+ Never collapse this into one client file with a mode `useState` and every panel body inlined.
71
+
72
+ **③ Sync state instead of fetching it.** A server component cannot hold state, so render the initial data on the
73
+ server and hand it across as a serializable object. The route calls `fetch.initXInY(...)` / `fetch.viewX(...)` and
74
+ passes the result into a `Zone`; `Load.Units` / `Load.View` hydrate the store from it. A `useEffect(…, [])` that
75
+ fetches on mount renders an empty shell, hydrates, then round-trips for data the server already had.
76
+
77
+ **④ Push the boundary down to the leaf that needs it.** A store-reading `Zone` should hold zero markup and delegate
78
+ to a server `View` — `User.Zone.Self` is one line, `st.use.self()` into `<User.View.General user={self} />`, so the
79
+ whole detail surface renders server-side wherever a route uses the `View` directly.
80
+
81
+ **⑤ Hand the promise across, not the awaited value.** `ClientInit` / `ClientView` are `PromiseOrObject<T>`, so a
82
+ route may pass an unawaited `fetch.initX(...)` and `Load.*` resolves it behind a skeleton. `await` blocks the shell
83
+ for data the page needs immediately; the promise streams the rest. Independent fetches still go through one
84
+ `Promise.all`.
85
+
86
+ **⑥ Use named `ReactNode` slots, not just `children`.** `Layout.Navbar` accepts `title`, `back`, `left`, `right`,
87
+ and `children`, so a client shell composes server-rendered content in five places instead of absorbing it.
88
+
89
+ **⑦ Let the server do the derived work.** Display and predicate logic belongs on `Light<Model>` (`isNew()`,
90
+ `canWrite(user?)`, `formatTimes()`), and enum→class lookups belong in a module-scope `as const` map. Both sides call
91
+ the same method, so a client component that exists only to compute a label is markup in the wrong place.
92
+
93
+ **⑧ Gate auth on the server.** `getSelf({ unauthorize: "/signin" })` in `_layout.tsx` redirects before any HTML is
94
+ sent. A client-side check costs a hydration round-trip and flashes the wrong UI first.
95
+
96
+ **⑨ Prefer CSS over client state for pure visibility.** A `data-*` attribute plus `group-data-[…]` variants (see
97
+ `libs/util/ui/Grid/*`) or `<details>`/`<summary>` keeps both branches server-rendered. Reach for `useState` when the
98
+ state is real, not when a Tailwind variant would do.
99
+
100
+ **⑩ Keep the heavy island out of the first load.** A large client-only widget goes behind the
101
+ `ui/<Folder>/index_.tsx` + `lazy()` pair so the server renders the page around it.
102
+
103
+ ## Review Checklist
104
+ - Does every `"use client"` in the diff name a capability that requires it?
105
+ - Does each client component hold only interaction, with markup delegated to `children`, a slot prop, or a
106
+ `Unit`/`View`?
107
+ - Is initial data fetched in the route and passed as `init`/`view`, with no mount-only load effect?
108
+ - Did `akan quality ssr` hold or improve the server share for every touched app and lib?
@@ -16,8 +16,8 @@ import {
16
16
  import {
17
17
  AppExecutor,
18
18
  WorkspaceExecutor
19
- } from "./index-jtm86byd.js";
20
- import"./index-6pz1j0zj.js";
19
+ } from "./index-hgna5rjy.js";
20
+ import"./index-mxvakhsm.js";
21
21
  import"./index-67546d0j.js";
22
22
  import"./index-r24hmh0q.js";
23
23
 
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  Spinner
4
- } from "./index-6pz1j0zj.js";
4
+ } from "./index-mxvakhsm.js";
5
5
  import {
6
6
  FileSys
7
7
  } from "./index-67546d0j.js";
@@ -1,22 +1,22 @@
1
1
  // @bun
2
2
  import {
3
3
  RepairRunner
4
- } from "./index-b978vs2e.js";
4
+ } from "./index-mr5s7mqd.js";
5
5
  import {
6
6
  WorkflowRunner
7
- } from "./index-csqk9z5j.js";
7
+ } from "./index-2q1f5j9k.js";
8
8
  import {
9
9
  PrimitiveScript
10
- } from "./index-r4w8cry5.js";
10
+ } from "./index-bekddz9q.js";
11
11
  import {
12
12
  ModuleScript
13
- } from "./index-vhv3xnjz.js";
13
+ } from "./index-yzmhasdb.js";
14
14
  import {
15
15
  ScalarScript
16
- } from "./index-fmgbwsr5.js";
16
+ } from "./index-ec09pws3.js";
17
17
  import {
18
18
  isPlaceholderAppId
19
- } from "./index-sggm9qkv.js";
19
+ } from "./index-t3723f99.js";
20
20
  import {
21
21
  AkanContextAnalyzer,
22
22
  akanMcpInstallConfigPaths,
@@ -27,17 +27,17 @@ import {
27
27
  renderDoctorText,
28
28
  resourceList,
29
29
  upsertCodexMcpServerBlock
30
- } from "./index-4yp06pn1.js";
30
+ } from "./index-a00jg8x8.js";
31
31
  import {
32
32
  buildAkanModuleContextIndex,
33
33
  createWorkflowBaselineSummary,
34
34
  createWorkflowStepRegistry,
35
35
  jsonText,
36
36
  toolingRolloutGate
37
- } from "./index-4zgs8g1w.js";
37
+ } from "./index-rzwcpcc3.js";
38
38
  import {
39
39
  Prompter
40
- } from "./index-xwgm94zr.js";
40
+ } from "./index-tdbas9r0.js";
41
41
  import {
42
42
  getMobileTargets
43
43
  } from "./index-76rn3g2c.js";
@@ -45,10 +45,10 @@ import {
45
45
  CommandContainer,
46
46
  runner,
47
47
  script
48
- } from "./index-jk9q6pse.js";
48
+ } from "./index-8hsbnyes.js";
49
49
  import {
50
50
  AppExecutor
51
- } from "./index-jtm86byd.js";
51
+ } from "./index-hgna5rjy.js";
52
52
 
53
53
  // pkgs/@akanjs/cli/context/context.script.ts
54
54
  import { Logger } from "akanjs/common";
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  AkanContextAnalyzer
4
- } from "./index-4yp06pn1.js";
4
+ } from "./index-a00jg8x8.js";
5
5
  import {
6
6
  WorkflowExecutor,
7
7
  compactWorkflowInputs,
@@ -23,10 +23,10 @@ import {
23
23
  workflowCommandsForPlan,
24
24
  workflowPlanApproval,
25
25
  writeWorkflowRunArtifact
26
- } from "./index-4zgs8g1w.js";
26
+ } from "./index-rzwcpcc3.js";
27
27
  import {
28
28
  runner
29
- } from "./index-jk9q6pse.js";
29
+ } from "./index-8hsbnyes.js";
30
30
 
31
31
  // pkgs/@akanjs/cli/workflow/workflow.runner.ts
32
32
  import { mkdir, readFile, writeFile } from "fs/promises";
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  runner,
4
4
  script
5
- } from "./index-jk9q6pse.js";
5
+ } from "./index-8hsbnyes.js";
6
6
  import {
7
7
  LibExecutor
8
- } from "./index-jtm86byd.js";
8
+ } from "./index-hgna5rjy.js";
9
9
 
10
10
  // pkgs/@akanjs/cli/semver.ts
11
11
  function parseVersion(version) {
@@ -7,7 +7,7 @@ import {
7
7
  PkgExecutor,
8
8
  WorkspaceExecutor,
9
9
  getDirname
10
- } from "./index-jtm86byd.js";
10
+ } from "./index-hgna5rjy.js";
11
11
  import {
12
12
  FileSys
13
13
  } from "./index-67546d0j.js";
@@ -2,11 +2,11 @@
2
2
  import {
3
3
  workflowRunArtifactPath,
4
4
  workflowSyncDir
5
- } from "./index-4zgs8g1w.js";
5
+ } from "./index-rzwcpcc3.js";
6
6
  import {
7
7
  AppExecutor,
8
8
  LibExecutor
9
- } from "./index-jtm86byd.js";
9
+ } from "./index-hgna5rjy.js";
10
10
  import {
11
11
  collectRecipeSources,
12
12
  findInlineRecipeDuplicates,
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  runner,
4
4
  script
5
- } from "./index-jk9q6pse.js";
5
+ } from "./index-8hsbnyes.js";
6
6
 
7
7
  // pkgs/@akanjs/cli/page/page.runner.ts
8
8
  class PageRunner extends runner("page") {
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  ModuleScript
4
- } from "./index-vhv3xnjz.js";
4
+ } from "./index-yzmhasdb.js";
5
5
  import {
6
6
  addFieldUiPolicyForType,
7
7
  coerceFieldDefault,
@@ -34,15 +34,15 @@ import {
34
34
  sourceFile,
35
35
  validationCommandsForTarget,
36
36
  viaBuilderParameterName
37
- } from "./index-4zgs8g1w.js";
37
+ } from "./index-rzwcpcc3.js";
38
38
  import {
39
39
  script
40
- } from "./index-jk9q6pse.js";
40
+ } from "./index-8hsbnyes.js";
41
41
  import {
42
42
  AppExecutor,
43
43
  LibExecutor,
44
44
  ModuleExecutor
45
- } from "./index-jtm86byd.js";
45
+ } from "./index-hgna5rjy.js";
46
46
 
47
47
  // pkgs/@akanjs/cli/primitive/primitive.script.ts
48
48
  import { capitalize } from "akanjs/common";
@@ -4,11 +4,11 @@ import {
4
4
  } from "./index-76rn3g2c.js";
5
5
  import {
6
6
  LibraryScript
7
- } from "./index-cn24dcqn.js";
7
+ } from "./index-7c6k4yvg.js";
8
8
  import {
9
9
  runner,
10
10
  script
11
- } from "./index-jk9q6pse.js";
11
+ } from "./index-8hsbnyes.js";
12
12
  import {
13
13
  HmrWatcher,
14
14
  WatchRootResolver
@@ -18,7 +18,7 @@ import {
18
18
  LibExecutor,
19
19
  PkgExecutor,
20
20
  WorkspaceExecutor
21
- } from "./index-jtm86byd.js";
21
+ } from "./index-hgna5rjy.js";
22
22
  import {
23
23
  __require
24
24
  } from "./index-r24hmh0q.js";
@@ -1898,10 +1898,10 @@ function openBrowser(url) {
1898
1898
  }
1899
1899
 
1900
1900
  // pkgs/@akanjs/cli/application/application.runner.ts
1901
- var loadBuildRunner = async () => (await import("./applicationBuildRunner-aq7mb3z6.js")).ApplicationBuildRunner;
1902
- var loadReleasePackager = async () => (await import("./applicationReleasePackager-yrrhbkv3.js")).ApplicationReleasePackager;
1903
- var loadCapacitorApp = async () => (await import("./capacitorApp-q3mpmkkz.js")).CapacitorApp;
1904
- var loadAbstractCompactor = async () => (await import("./abstractCompactor-rk6twzvj.js")).AbstractCompactor;
1901
+ var loadBuildRunner = async () => (await import("./applicationBuildRunner-ct2pxyvw.js")).ApplicationBuildRunner;
1902
+ var loadReleasePackager = async () => (await import("./applicationReleasePackager-gg8ccbeh.js")).ApplicationReleasePackager;
1903
+ var loadCapacitorApp = async () => (await import("./capacitorApp-4r9sm3qg.js")).CapacitorApp;
1904
+ var loadAbstractCompactor = async () => (await import("./abstractCompactor-e5yq60qz.js")).AbstractCompactor;
1905
1905
  var loadPrompts = async () => await import("@inquirer/prompts");
1906
1906
 
1907
1907
  class ApplicationRunner extends runner("application") {
@@ -2241,6 +2241,7 @@ ${detail}`
2241
2241
 
2242
2242
  // pkgs/@akanjs/cli/application/application.script.ts
2243
2243
  class ApplicationScript extends script("application", [ApplicationRunner, LibraryScript]) {
2244
+ static dbShutdownTimeoutMs = 20000;
2244
2245
  async confirmDatabaseModeDependencyInstall(databaseMode, installSpecs) {
2245
2246
  return await confirm({
2246
2247
  message: [
@@ -2418,10 +2419,7 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
2418
2419
  if (app.getEnv() === "local" && dbup && databaseMode !== "single") {
2419
2420
  const wasDbAlreadyUp = await this.dbup(app.workspace, databaseMode);
2420
2421
  if (!wasDbAlreadyUp)
2421
- process.on("SIGINT", async () => {
2422
- await this.dbdown(app.workspace);
2423
- process.exit(0);
2424
- });
2422
+ this.#stopDatabaseOnInterrupt(app.workspace);
2425
2423
  }
2426
2424
  const spinner = app.spinning("Preparing backend...");
2427
2425
  const akanAppHost = await this.applicationRunner.start(app, {
@@ -2518,9 +2516,34 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
2518
2516
  }
2519
2517
  async dbdown(workspace) {
2520
2518
  const spinner = workspace.spinning("Stopping local database...");
2521
- await this.applicationRunner.dbdown(workspace);
2519
+ try {
2520
+ await this.applicationRunner.dbdown(workspace);
2521
+ } catch (error) {
2522
+ spinner.fail("Local database failed to stop");
2523
+ throw error;
2524
+ }
2522
2525
  spinner.succeed("Local database (/local/docker-compose.yaml) is down");
2523
2526
  }
2527
+ #stopDatabaseOnInterrupt(workspace) {
2528
+ let stopping = false;
2529
+ process.on("SIGINT", () => {
2530
+ if (stopping) {
2531
+ Logger5.rawLog("Abandoning the local database teardown; containers are left running.", undefined, "warn");
2532
+ process.exit(130);
2533
+ }
2534
+ stopping = true;
2535
+ this.#stopDatabase(workspace).finally(() => process.exit(0));
2536
+ });
2537
+ }
2538
+ async#stopDatabase(workspace) {
2539
+ const timeout = new Promise((resolve) => setTimeout(() => resolve("timeout"), ApplicationScript.dbShutdownTimeoutMs));
2540
+ const result = await Promise.race([this.dbdown(workspace).catch(() => {
2541
+ return;
2542
+ }), timeout]);
2543
+ if (result !== "timeout")
2544
+ return;
2545
+ Logger5.rawLog(`Local database did not stop within ${ApplicationScript.dbShutdownTimeoutMs}ms; run \`akan dbdown\` once Docker responds.`, undefined, "warn");
2546
+ }
2524
2547
  async testSys(sys) {
2525
2548
  if (sys.type === "app")
2526
2549
  await this.testApplication(sys);