@akanjs/cli 3.0.0-alpha.4 → 3.0.0-alpha.40

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 (108) hide show
  1. package/.build-stamp +1 -1
  2. package/README.ko.md +1 -1
  3. package/README.md +1 -1
  4. package/{abstractCompactor-rk6twzvj.js → abstractCompactor-20e0cwbs.js} +3 -3
  5. package/{agent.command-jfz8yfwy.js → agent.command-e835fjem.js} +9 -8
  6. package/{application.command-mxyqtd6p.js → application.command-sjtbk6tr.js} +7 -6
  7. package/{applicationBuildRunner-cwk52sb7.js → applicationBuildRunner-7gnfz7ww.js} +7 -8
  8. package/{applicationReleasePackager-yrrhbkv3.js → applicationReleasePackager-93nzdfsy.js} +2 -2
  9. package/buildBatch.proc.js +6 -5
  10. package/{capacitorApp-j357ak1g.js → capacitorApp-qv7g3dp2.js} +29 -28
  11. package/{cloud.command-f87dwe52.js → cloud.command-y0e4eyqz.js} +11 -10
  12. package/{context.command-z5bf8bn7.js → context.command-vn87jb08.js} +17 -16
  13. package/{dependencyScanner-f6grrep3.js → dependencyScanner-rbs2407b.js} +1 -1
  14. package/getDirname-ka11hm7e.js +8 -0
  15. package/{guideline.command-1m1ctar3.js → guideline.command-s4hn2bsy.js} +7 -6
  16. package/guidelines/conventions/conventions.generate.json +25 -0
  17. package/guidelines/conventions/conventions.instruction.md +1173 -0
  18. package/guidelines/cssRule/cssRule.instruction.md +7 -0
  19. package/guidelines/framework/framework.instruction.md +1 -0
  20. package/guidelines/ssrRule/ssrRule.generate.json +31 -0
  21. package/guidelines/ssrRule/ssrRule.instruction.md +108 -0
  22. package/guidelines/workspaceOnboarding/workspaceOnboarding.generate.json +24 -0
  23. package/guidelines/workspaceOnboarding/workspaceOnboarding.instruction.md +972 -0
  24. package/incrementalBuilder.proc.js +7 -6
  25. package/{index-1s71fwrq.js → index-0h212yqe.js} +13 -13
  26. package/index-1577bej2.js +7 -0
  27. package/{index-e3qskyt2.js → index-33zce8gt.js} +8 -4
  28. package/{index-csqk9z5j.js → index-3dp7x6rc.js} +3 -3
  29. package/{index-cn24dcqn.js → index-73rnbwgg.js} +15 -7
  30. package/{index-tq1y56tp.js → index-8d2sv6pw.js} +39 -16
  31. package/{index-jtm86byd.js → index-8vkkm7v0.js} +125 -66
  32. package/{index-r4w8cry5.js → index-9jsnb4vw.js} +4 -4
  33. package/{index-ybybkec0.js → index-becx1t0k.js} +6 -6
  34. package/{index-4yp06pn1.js → index-g9e2fhw2.js} +49 -32
  35. package/{index-cap2k2ch.js → index-hg0qvhmx.js} +152 -241
  36. package/{index-xwgm94zr.js → index-j37qq1f2.js} +1 -1
  37. package/{index-n0z3f2xg.js → index-k6fvbcj1.js} +37 -6
  38. package/{index-6pz1j0zj.js → index-mxvakhsm.js} +6 -2
  39. package/{index-vhv3xnjz.js → index-mykmf6wd.js} +8 -8
  40. package/{index-y0k42k04.js → index-mz5jtaq7.js} +1 -1
  41. package/{index-jk9q6pse.js → index-n706txcv.js} +5 -3
  42. package/{index-hjzr8ja1.js → index-qc0tnhs2.js} +1 -1
  43. package/{index-rh16j3c7.js → index-qnv0aqmm.js} +12 -8
  44. package/{index-3pgtw35d.js → index-sh01r3pm.js} +2 -2
  45. package/{index-xj8bks3p.js → index-t71zvmt9.js} +9 -11
  46. package/{index-4zgs8g1w.js → index-tsmjxph2.js} +1 -1
  47. package/{index-fmgbwsr5.js → index-x33gnap3.js} +4 -4
  48. package/{index-b978vs2e.js → index-xyrb7pk5.js} +3 -3
  49. package/index.js +21 -20
  50. package/{library.command-pwfx8dx2.js → library.command-v5cyaw9t.js} +6 -5
  51. package/{localRegistry.command-r4zjx5py.js → localRegistry.command-53t758pt.js} +10 -9
  52. package/{module.command-0t3ewata.js → module.command-pq6w84xg.js} +10 -9
  53. package/{package.command-7hmkxvpa.js → package.command-qkcs60ts.js} +6 -5
  54. package/package.json +3 -4
  55. package/{page.command-st6r4s0q.js → page.command-qj5bfnh9.js} +6 -5
  56. package/{primitive.command-1qkxpzsn.js → primitive.command-bw0nes6x.js} +11 -10
  57. package/{quality.command-hy5vt1bh.js → quality.command-g1s2wt8b.js} +532 -87
  58. package/{recipeScanner-tghkzrrt.js → recipeScanner-zrzev25x.js} +3 -3
  59. package/{repair.command-nakkq2zp.js → repair.command-mzwtejpk.js} +8 -7
  60. package/{routeSourceValidator-cncd92fv.js → routeSourceValidator-7fycdqyv.js} +3 -39
  61. package/{scalar.command-fjq272gs.js → scalar.command-rm6k3c65.js} +9 -8
  62. package/templates/app/env/env.server.debug.ts.template +1 -5
  63. package/templates/app/env/env.server.develop.ts.template +1 -5
  64. package/templates/app/env/env.server.local.ts.template +1 -5
  65. package/templates/app/env/env.server.main.ts.template +1 -5
  66. package/templates/app/page/styles.css.template +3 -3
  67. package/templates/appSample/srvkit/AuthGuard.ts +9 -5
  68. package/templates/appSample/srvkit/SessionInternalArg.ts +4 -3
  69. package/templates/crudPages/[__model__Id]/edit/page.tsx +1 -1
  70. package/templates/crudPages/new/page.tsx +1 -1
  71. package/templates/crudSinglePage/page.tsx +1 -1
  72. package/templates/env/_env.server.type.ts +7 -5
  73. package/templates/lib/db.ts +4 -2
  74. package/templates/lib/dict.ts +1 -1
  75. package/templates/lib/sig.ts +1 -1
  76. package/templates/lib/srv.ts +6 -2
  77. package/templates/lib/useClient.ts +9 -3
  78. package/templates/module/__Model__.Util.tsx +1 -1
  79. package/templates/module/__Model__.Zone.tsx +3 -5
  80. package/templates/workspaceRoot/AGENTS.md.template +0 -831
  81. package/templates/workspaceRoot/CLAUDE.md.template +19 -0
  82. package/templates/workspaceRoot/biome.json.template +4 -217
  83. package/{typeChecker-kravn7ns.js → typeChecker-g6bh0xfv.js} +1 -1
  84. package/typecheck.proc.js +1 -1
  85. package/{workflow.command-jswbgk90.js → workflow.command-g2cgcgxn.js} +16 -15
  86. package/{workspace.command-h9wwcjpt.js → workspace.command-f7jerqb2.js} +70 -52
  87. package/templates/libRoot/base/baseLogic.ts +0 -14
  88. package/templates/libRoot/base/index.ts +0 -8
  89. package/templates/workspaceRoot/.cursor/rules/akan-page-routing.mdc.template +0 -43
  90. package/templates/workspaceRoot/.cursor/rules/akan-sync-conventions.mdc.template +0 -33
  91. package/templates/workspaceRoot/.cursor/rules/application-test-commands.mdc.template +0 -16
  92. package/templates/workspaceRoot/.cursor/rules/change-scope.mdc.template +0 -12
  93. package/templates/workspaceRoot/.cursor/rules/client-server-boundaries.mdc.template +0 -17
  94. package/templates/workspaceRoot/.cursor/rules/coding-comments.mdc.template +0 -25
  95. package/templates/workspaceRoot/.cursor/rules/coding-style.mdc.template +0 -44
  96. package/templates/workspaceRoot/.cursor/rules/domain-module-conventions.mdc.template +0 -17
  97. package/templates/workspaceRoot/.cursor/rules/format-lint.mdc.template +0 -12
  98. package/templates/workspaceRoot/.cursor/rules/lint-enforced-rules.mdc.template +0 -18
  99. package/templates/workspaceRoot/.cursor/rules/module-file-playbook.mdc.template +0 -61
  100. package/templates/workspaceRoot/.cursor/rules/naming-conventions.mdc.template +0 -15
  101. package/templates/workspaceRoot/.cursor/rules/react-component-style.mdc.template +0 -21
  102. package/templates/workspaceRoot/.cursor/rules/repo-overview.mdc.template +0 -17
  103. package/templates/workspaceRoot/.cursor/rules/scalar-modeling.mdc.template +0 -58
  104. package/templates/workspaceRoot/.cursor/rules/secrets-and-env.mdc.template +0 -13
  105. package/templates/workspaceRoot/.cursor/rules/service-signal-conventions.mdc.template +0 -83
  106. package/templates/workspaceRoot/.cursor/rules/srvkit-adapters-and-guards.mdc.template +0 -50
  107. package/templates/workspaceRoot/.cursor/rules/typescript-imports.mdc.template +0 -16
  108. /package/{index-r24hmh0q.js → index-yb2wsc7f.js} +0 -0
@@ -55,6 +55,13 @@ Screen code is invariant — a plain `<Button variant="primary">` never changes.
55
55
  - Switching themes is toggling the `data-theme` attribute. Keep every token defined in both the dark and light blocks.
56
56
  - Radius uses `rounded-box` (cards/modals), `rounded-field` (buttons/inputs), `rounded-selector` (toggles/checkboxes).
57
57
 
58
+ ## Lib-Owned Tokens (`libs/<lib>/ui/tokens.css`)
59
+ - A lib that needs colors of its own — vendor brand colors pinned by someone else's guide (Kakao `#fee500`, Naver `#1ec800`), fixed in-game surfaces — declares them **once** in `libs/<lib>/ui/tokens.css`. Never copy the block into each app's stylesheet.
60
+ - The file is collected automatically: every app whose page graph reaches that lib compiles it, ordered **ahead of** the app's own stylesheets, so the app wins on any variable both declare. There is nothing to import and no sync step to remember; two libs both declaring one variable resolve in lib-name order, so do not rely on that.
61
+ - Declare plain custom properties under `:root`, not a Tailwind `@theme` extension: the color vocabulary is closed per stylesheet, so `bg-kakao` would generate no CSS. Reference them as `bg-[var(--kakao)]` / `text-[var(--kakao-foreground)]`, which `no-arbitrary-color` allows by design (a `var()` reference is not an arbitrary color literal).
62
+ - Theme-following colors still belong to the app: a lib token is for a color that must **not** change with `data-theme`.
63
+ - An `@import` the CSS pipeline cannot resolve fails the build; it is never dropped. A stylesheet under `page/` that no route imports is compiled by nothing and warns at build time.
64
+
58
65
  ## Codegen Rules
59
66
  - Do not hardcode hex or raw-palette colors (`bg-red-500`, `#ff0000`); use semantic tokens.
60
67
  - Do not put inline color literals in `style={{ }}`; use token classes.
@@ -26,6 +26,7 @@ Use this as the compact framework context for AI codegen. It should explain how
26
26
  When a request implies a distinct look and feel, do not stop at colors — customize both the theme and, when needed, the components.
27
27
 
28
28
  - **Theme (`apps/<app>/page/styles.css`).** The app imports Tailwind and `akanjs/ui/styles.css`, then overrides semantic token *values* per theme under `:root, [data-theme="dark"]` and `[data-theme="light"]` (`--background`, `--foreground`, `--primary`, `--muted`, `--border`, … each with a `-foreground` pair for text). The framework maps them to Tailwind color names, so `bg-primary` / `text-foreground` follow the `data-theme` attribute; corner rounding uses `--radius-box` / `--radius-field`. Fetch `get_guideline` with `cssRule` for the full token set before a deep theme pass.
29
+ - **Lib tokens (`libs/<lib>/ui/tokens.css`).** Colors a lib's own components pin — a vendor brand color, a fixed surface — are declared once there as plain `:root` custom properties and compiled into every app that reaches the lib, ahead of the app's stylesheets. Reference them as `bg-[var(--kakao)]`; never copy the block into each app.
29
30
  - **Components (`page/**/_overrides.tsx`).** When a default `akanjs/ui` component (Button, Modal, Table, Input, Select, …) is too restrictive for the design, re-skin it per route instead of forking, wrapping, or fighting it with utility classes. Write a drop-in replacement in `apps/<app>/ui/` typed against the slot contract (`AkanModalComponent`, or `AkanUiOverrides["<Slot>"]`), composing the framework's headless parts, then bind it in a `page/**/_overrides.tsx` manifest with a single `export default override({ Slot: BrandComponent })`. Overrides cascade down the route tree like layouts (closest ancestor wins). Fetch `get_guideline` with `componentRule` and read the `references/ui/customize` docs page for the slot list and patterns.
30
31
 
31
32
  ## Review Checklist
@@ -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?
@@ -0,0 +1,24 @@
1
+ {
2
+ "title": "Workspace Onboarding",
3
+ "description": "Product-workspace orientation — layout, decision matrix, workflow recipes, and query gotchas",
4
+ "group": "core",
5
+ "codegenPriority": 2,
6
+ "deprecated": false,
7
+ "scans": [],
8
+ "update": {
9
+ "filePath": "./workspaceOnboarding.instruction.md",
10
+ "contents": [
11
+ "workspace layout and generated files",
12
+ "agent workflow and common commands",
13
+ "where-do-I-put-this decision matrix",
14
+ "workflow recipes",
15
+ "modeling and query gotchas"
16
+ ],
17
+ "rules": [
18
+ "Use current Akan APIs only",
19
+ "Write for someone building a product on Akan, not for someone changing Akan",
20
+ "Refer to the app as <%= appName %>; the renderer substitutes the workspace's first app",
21
+ "Do not repeat a rule that the conventions guideline already states"
22
+ ]
23
+ }
24
+ }