@akanjs/cli 3.1.1-rc.9 → 3.1.2-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.build-stamp +1 -1
- package/CodeAgent-dyc45f5w.js +11 -0
- package/{CodeAgentRpcHost-9g27hmer.js → CodeAgentRpcHost-6dzfkvsc.js} +1 -1
- package/CodeAgentRpcListener-tcwrdvst.js +182 -0
- package/{CodeTui-z5vkm9ea.js → CodeTui-q55b2zrn.js} +25 -8
- package/TunnelShare-hdq9h1hr.js +14 -0
- package/agent.command-20zaqe60.js +49 -0
- package/akanCode.js +13 -8
- package/{application.command-wthg8nn9.js → application.command-nd0fshsk.js} +45 -12
- package/{applicationBuildRunner-t2r84sz6.js → applicationBuildRunner-s13x3zqb.js} +14 -10
- package/buildBatch.proc.js +7 -7
- package/{cloud.command-sz11hpre.js → cloud.command-8kbddsz9.js} +28 -19
- package/cloud.script-hgvvajm3.js +27 -0
- package/code.command-625bg8s8.js +345 -0
- package/commandManifest.json +1 -1
- package/{context.command-15j9b7c0.js → context.command-p6haqjay.js} +20 -18
- package/context.runner-rsnqnk9j.js +27 -0
- package/{dependencyScanner-3afj2vt1.js → dependencyScanner-78sq8m4q.js} +2 -2
- package/{devTui-q7k7bakd.js → devTui-evr3b35y.js} +1 -1
- package/{fileSys-wzzrntkw.js → fileSys-zpvt5gtf.js} +1 -1
- package/{guideline.command-snh85ctf.js → guideline.command-195g0h9a.js} +4 -4
- package/guidelines/agentRule/agentRule.instruction.md +22 -8
- package/guidelines/conventions/core.md +106 -0
- package/guidelines/conventions/rules/app.md +83 -0
- package/guidelines/conventions/rules/auth.md +46 -0
- package/guidelines/conventions/rules/config.md +60 -0
- package/guidelines/conventions/rules/constant.md +24 -0
- package/guidelines/conventions/rules/gates.md +32 -0
- package/guidelines/conventions/rules/layer.md +25 -0
- package/guidelines/conventions/rules/migration.md +27 -0
- package/guidelines/conventions/rules/module.md +90 -0
- package/guidelines/conventions/rules/page.md +56 -0
- package/guidelines/conventions/rules/sensitive.md +16 -0
- package/guidelines/conventions/rules/server.md +91 -0
- package/guidelines/conventions/rules/ssr.md +47 -0
- package/guidelines/conventions/rules/style.md +43 -0
- package/guidelines/conventions/rules/test.md +34 -0
- package/guidelines/conventions/rules/ts.md +95 -0
- package/guidelines/conventions/rules/tsx.md +76 -0
- package/guidelines/mcpRule/mcpRule.instruction.md +1 -1
- package/guidelines/pageRule/pageRule.instruction.md +8 -7
- package/guidelines/queryRule/queryRule.instruction.md +4 -0
- package/guidelines/runtimeRule/runtimeRule.instruction.md +35 -25
- package/guidelines/ssrRule/ssrRule.instruction.md +11 -10
- package/guidelines/transportRule/transportRule.instruction.md +5 -4
- package/guidelines/workspaceRecipes/workspaceRecipes.instruction.md +4 -4
- package/incrementalBuilder.proc.js +7 -7
- package/{index-301pdbzz.js → index-00a7j05x.js} +7 -7
- package/{index-js6geqjn.js → index-0j1t1h2b.js} +3 -1
- package/{index-6txx6a9p.js → index-1h2jc0x3.js} +154 -88
- package/{index-55j120r8.js → index-1qsd8ft1.js} +65 -145
- package/{index-9th4gszy.js → index-2mwjshz5.js} +233 -1271
- package/index-2nxk8wgs.js +266 -0
- package/{index-j9vyj3dj.js → index-2phm56a1.js} +49 -8
- package/index-35j83zkd.js +61 -0
- package/index-4am4dvmf.js +29 -0
- package/index-75y7bcz4.js +28 -0
- package/index-7apsdr5g.js +487 -0
- package/{index-42j4a8zq.js → index-84h43kg6.js} +8 -6
- package/index-9bv479q5.js +1 -0
- package/{index-3wypz6xj.js → index-9zy8479y.js} +11 -5
- package/{index-a5dhqkdr.js → index-a1vb3x7t.js} +273 -259
- package/{index-52w0fvh8.js → index-bns3wcpc.js} +15 -0
- package/index-cjmjvg4r.js +3622 -0
- package/{index-pcwzkdqb.js → index-defp4gmb.js} +1 -1
- package/index-ewbmfarf.js +1606 -0
- package/index-fbewhg4g.js +590 -0
- package/index-fhw7yq2d.js +653 -0
- package/{index-wcej7g4z.js → index-g500c5j9.js} +271 -105
- package/{index-74tjjsnc.js → index-g841cap9.js} +33 -37
- package/{index-2azahjaw.js → index-gr9thy79.js} +5 -5
- package/{index-4pf8g7ff.js → index-h7hehkw6.js} +3 -0
- package/{index-xjf5j657.js → index-hm0tn7qv.js} +1001 -91
- package/index-j6eeh5d7.js +138 -0
- package/{index-31es1yev.js → index-j7hwy56s.js} +108 -7
- package/{index-skk9zc1x.js → index-jc2zbwra.js} +2 -2
- package/{index-905qdgqp.js → index-khk05tsf.js} +1 -1
- package/{index-5nd1wtkv.js → index-p6x5b7hr.js} +1 -1
- package/{index-tvehn2sp.js → index-qd7xn2bk.js} +1 -1
- package/{index-a58emady.js → index-qw6814m4.js} +55 -17
- package/index-raz588b3.js +445 -0
- package/{index-at7bz0xq.js → index-s4nvxpzm.js} +2 -0
- package/{index-bt438yxm.js → index-sp0qsr7a.js} +116 -13
- package/{index-xb8809yb.js → index-sveq36gh.js} +40 -43
- package/{index-hmt54t45.js → index-t1t9wq9a.js} +4 -4
- package/index-t78230d7.js +191 -0
- package/index-tenw3mah.js +225 -0
- package/{index-qfp55x1y.js → index-tgqameyb.js} +4 -4
- package/{index-espk51ah.js → index-tp56652m.js} +6 -6
- package/index-w15mg3km.js +389 -0
- package/{index-dy0jx9ay.js → index-wwe9rsrx.js} +14 -0
- package/{index-2xcc2ax5.js → index-y4kcmbt2.js} +2 -2
- package/index-yf9wc28h.js +52 -0
- package/{index-0fz95kxe.js → index-zbrwnmf1.js} +9 -7
- package/{index-40brg4px.js → index-zttm13c3.js} +5 -5
- package/index.js +24 -23
- package/{library.command-gycrwhf1.js → library.command-63hgt9te.js} +4 -4
- package/{localRegistry.command-jtd8gaes.js → localRegistry.command-g3f8k25t.js} +46 -22
- package/{module.command-v6hgs1bc.js → module.command-r4sa2khp.js} +7 -6
- package/{package.command-shzpcfph.js → package.command-96eheyvd.js} +5 -5
- package/package.json +2 -2
- package/{page.command-ptxn5kqk.js → page.command-gs6d841d.js} +4 -4
- package/{pipeline.command-zz31pgax.js → pipeline.command-wdfvdbfj.js} +3 -3
- package/{primitive.command-a1vse91z.js → primitive.command-dfsv4mpe.js} +8 -7
- package/{projectTypecheck-2ztky9cf.js → projectTypecheck-kqj1t6hb.js} +1 -1
- package/{prompter-76k56b37.js → prompter-qrwx1p17.js} +2 -2
- package/quality.command-webzxee2.js +78 -0
- package/{repair.command-cvazbz99.js → repair.command-3r3j1xre.js} +7 -6
- package/{routeSourceValidator-6jd0q6r6.js → routeSourceValidator-4h947v7c.js} +13 -3
- package/{scalar.command-0acvyp26.js → scalar.command-e8y47j6d.js} +6 -5
- package/skills/akan-agent/SKILL.md +43 -0
- package/skills/akan-code/SKILL.md +38 -11
- package/skills/akan-debug/SKILL.md +41 -6
- package/skills/akan-deps/SKILL.md +1 -2
- package/skills/akan-err/SKILL.md +2 -1
- package/skills/akan-mcp/SKILL.md +40 -0
- package/skills/akan-page/SKILL.md +44 -0
- package/skills/akan-query/SKILL.md +39 -0
- package/skills/akan-runtime/SKILL.md +43 -0
- package/skills/akan-scaffold/SKILL.md +16 -6
- package/skills/akan-transport/SKILL.md +40 -0
- package/skills/akan-validate/SKILL.md +13 -11
- package/{subspace.command-822qx2bx.js → subspace.command-a1sf9n5a.js} +12 -10
- package/templates/__scalar/__model__/__model__.constant.ts +3 -5
- package/templates/__scalar/__model__/__model__.dictionary.ts +6 -5
- package/templates/__scalar/__model__/__model__.document.ts +3 -3
- package/templates/app/akan.config.ts +2 -3
- package/templates/app/env/env.client.ts +2 -4
- package/templates/app/env/env.client.type.ts +2 -3
- package/templates/app/env/env.server.ts +2 -3
- package/templates/app/lib/___appName__/__appName__.dictionary.ts +1 -2
- package/templates/app/lib/___appName__/__appName__.service.ts +3 -3
- package/templates/app/lib/___appName__/__appName__.signal.ts +5 -5
- package/templates/app/lib/___appName__/__appName__.store.ts +4 -6
- package/templates/app/lib/option.ts +2 -3
- package/templates/app/main.ts +2 -4
- package/templates/app/page/_index.tsx +3 -3
- package/templates/app/page/_layout.tsx +13 -10
- package/templates/appSample/lib/__scalar/workHistory/workHistory.constant.ts +1 -5
- package/templates/appSample/lib/__scalar/workHistory/workHistory.dictionary.ts +1 -1
- package/templates/appSample/lib/_noti/noti.signal.ts +1 -1
- package/templates/appSample/lib/task/Task.Template.tsx +2 -1
- package/templates/appSample/lib/task/Task.Unit.tsx +3 -2
- package/templates/appSample/lib/task/Task.Util.tsx +16 -4
- package/templates/appSample/lib/task/task.constant.ts +1 -5
- package/templates/appSample/lib/task/task.dictionary.ts +2 -8
- package/templates/appSample/lib/task/task.document.ts +1 -1
- package/templates/appSample/lib/task/task.signal.ts +14 -9
- package/templates/appSample/page/task/_index.tsx +2 -1
- package/templates/appSample/page/task/new.tsx +2 -1
- package/templates/appSample/srvkit/guards.ts +11 -0
- package/templates/appSample/ui/QuantityControl.tsx +5 -9
- package/templates/biomeForm.ts +144 -0
- package/templates/crudPages/[__model__Id]/edit/page.tsx +3 -3
- package/templates/crudPages/[__model__Id]/page.tsx +5 -5
- package/templates/crudPages/new/page.tsx +4 -3
- package/templates/crudPages/page.tsx +3 -3
- package/templates/crudSinglePage/page.tsx +9 -5
- package/templates/libRoot/akan.config.ts +2 -3
- package/templates/libRoot/lib/___libName__/__libName__.dictionary.ts +1 -2
- package/templates/libRoot/lib/___libName__/__libName__.service.ts +5 -4
- package/templates/libRoot/lib/___libName__/__libName__.signal.ts +6 -5
- package/templates/libRoot/lib/___libName__/__libName__.store.ts +5 -6
- package/templates/libRoot/lib/option.ts +1 -2
- package/templates/module/__Model__.Template.tsx +11 -10
- package/templates/module/__Model__.Unit.tsx +18 -5
- package/templates/module/__Model__.Util.tsx +9 -7
- package/templates/module/__Model__.View.tsx +9 -6
- package/templates/module/__Model__.Zone.tsx +25 -17
- package/templates/module/__model__.constant.ts +8 -9
- package/templates/module/__model__.dictionary.ts +16 -17
- package/templates/module/__model__.document.ts +6 -8
- package/templates/module/__model__.service.ts +3 -3
- package/templates/module/__model__.signal.ts +11 -10
- package/templates/module/__model__.store.ts +3 -5
- package/templates/service/__model__.dictionary.ts +5 -6
- package/templates/service/__model__.service.ts +3 -3
- package/templates/service/__model__.signal.ts +5 -4
- package/templates/service/__model__.store.ts +3 -5
- package/templates/workspaceRoot/.gitignore.template +4 -0
- package/templates/workspaceRoot/.vscode/settings.json.template +21 -21
- package/templates/workspaceRoot/AGENTS.md.template +4 -10
- package/{tunnel.command-ycmja19q.js → tunnel.command-dcb0wg93.js} +25 -13
- package/{typeChecker-px49mezc.js → typeChecker-j2jdnqsr.js} +1 -1
- package/typecheck.proc.js +6 -1
- package/verify.command-yyepccbh.js +93 -0
- package/{workflow.command-abb1d5xy.js → workflow.command-z5pg9ay0.js} +49 -14
- package/workspace.command-d7x5jttw.js +290 -0
- package/CodeAgent-8d5qs787.js +0 -9
- package/CodeAgentRpcListener-7p7z5dd7.js +0 -97
- package/TunnelShare-qkm8zp03.js +0 -14
- package/agent.command-ydftceda.js +0 -25
- package/cloud.script-nqevg5qw.js +0 -24
- package/code.command-9h3yrzhe.js +0 -167
- package/context.runner-8gg030b0.js +0 -25
- package/guidelines/conventions/conventions.instruction.md +0 -617
- package/guidelines/workspaceOnboarding/workspaceOnboarding.instruction.md +0 -291
- package/index-2mwc0g0d.js +0 -49
- package/index-4vgbysa0.js +0 -279
- package/index-7md2g9vw.js +0 -6
- package/index-b70zct19.js +0 -856
- package/index-c6eggbee.js +0 -123
- package/index-zzvvc845.js +0 -74
- package/quality.command-ah8qcakd.js +0 -1478
- package/templates/workspaceRoot/docs/AI-DEVELOPMENT.md.template +0 -69
- package/templates/workspaceRoot/docs/GENERATED.md.template +0 -55
- package/workspace.command-qm7cw29v.js +0 -521
|
@@ -46,5 +46,4 @@ the package client path — `import { cnst, fetch, st, usePage } from "@apps/<ap
|
|
|
46
46
|
|
|
47
47
|
## Validate
|
|
48
48
|
|
|
49
|
-
`
|
|
50
|
-
generated barrels and reports false errors.
|
|
49
|
+
`akan verify`. Raw `tsc` misses the generated barrels and reports false errors.
|
package/skills/akan-err/SKILL.md
CHANGED
|
@@ -28,7 +28,8 @@ import path at all**, so keep throwing code out of them entirely rather than rea
|
|
|
28
28
|
|
|
29
29
|
Best-effort code returns a sentinel (`null`, `undefined`, `{}`) instead of throwing. `try/catch` is rare and
|
|
30
30
|
always converts an exception into a decision: a guard catches, warns, and returns `false`; an adapter
|
|
31
|
-
catches, logs, and returns `null`. A store action never catches — let the framework toast the `Err
|
|
31
|
+
catches, logs, and returns `null`. A store action never catches — let the framework toast the `Err`, or list it in
|
|
32
|
+
the store's `static silent` when no screen waits on it and its caller handles the rejection.
|
|
32
33
|
Client-side validation failure is `msg.error("<key>")` plus an early return, never a throw.
|
|
33
34
|
|
|
34
35
|
**A failure another process reported travels as itself.** A server-to-server `fetch.<endpoint>(…, { origin })`
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: akan-mcp
|
|
3
|
+
description: "Expose an app to MCP clients: what /mcp publishes from guards, mcp: false curation, option.setMcp settings, OAuth, refusals, page prompts and MCP Apps, and the exposure test."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Akan MCP
|
|
7
|
+
|
|
8
|
+
Every app serves its signals as an MCP server on `POST /mcp`, mounted by default. **Exposure follows the guards**:
|
|
9
|
+
an endpoint with a real guard is published, one with none is refused, and so is a mutation guarded only by
|
|
10
|
+
`Public`. There is no per-endpoint opt-in.
|
|
11
|
+
|
|
12
|
+
## Curation is not authorization
|
|
13
|
+
|
|
14
|
+
- `mcp: false` on an endpoint, or a `slice()` `mcp` map mirroring `guards`, keeps a perfectly guarded step (a UI
|
|
15
|
+
state-machine step a model would only call by mistake) off the shelf. It is an opt-out; everything else still
|
|
16
|
+
publishes.
|
|
17
|
+
- `guards: [Every, Person]` reserves an act for a person; `.with(AgentCall)` narrows what an agent's call may do.
|
|
18
|
+
- A guard's `static scope` decides whether a listing can hide the entry: `"account"` guards are evaluated per
|
|
19
|
+
caller, `"resource"` guards stay visible and stop the call.
|
|
20
|
+
|
|
21
|
+
## Settings
|
|
22
|
+
|
|
23
|
+
- `option.setMcp({ … })` in the app's `lib/option.ts`, never `main.ts`; `AKAN_MCP=false` takes the surface off.
|
|
24
|
+
- `JWT_SECRET` is required outside `local`.
|
|
25
|
+
- Every published entry needs a `.desc()`; model-facing text is English.
|
|
26
|
+
- Never make a refusal message more helpful.
|
|
27
|
+
|
|
28
|
+
## Pages for the host
|
|
29
|
+
|
|
30
|
+
- `page().prompt(name, description)` briefs a screen as an MCP prompt.
|
|
31
|
+
- `page().app(name, description, load)` publishes one component a host draws in the chat, as a read-only tool
|
|
32
|
+
whose `load` may only query.
|
|
33
|
+
|
|
34
|
+
## Verify
|
|
35
|
+
|
|
36
|
+
- One exposure test per app in `srvkit/mcpExposure.signal.test.ts`: list the tools with a user token, pin the names
|
|
37
|
+
with `toEqual`, and assert the curated and admin-only ones are absent. A guard change fails it first.
|
|
38
|
+
- Then `akan verify <app>` and the boot log.
|
|
39
|
+
|
|
40
|
+
Full detail: `get_guideline` with `mcpRule`, or `transportRule` for guards and rate limits.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: akan-page
|
|
3
|
+
description: "Add or change a route under page/: the one page()/layout() chain, typed params and search, guards, heads, loading and errors, overrides, and lib pages."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Akan pages
|
|
7
|
+
|
|
8
|
+
A route file exports one chain and nothing else. Every setting is a stage of it.
|
|
9
|
+
|
|
10
|
+
```tsx
|
|
11
|
+
export default page()
|
|
12
|
+
.param("orgId", ID)
|
|
13
|
+
.guard(() => signedIn())
|
|
14
|
+
.render(({ orgId }) => {
|
|
15
|
+
const { l } = usePage();
|
|
16
|
+
const { taskInitInOrg } = fetch.initTaskInOrg(orgId);
|
|
17
|
+
return <Task.Zone.Card init={taskInitInOrg} prefix={`/org/${orgId}`} />;
|
|
18
|
+
});
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Steps
|
|
22
|
+
|
|
23
|
+
1. Place the file: `<route>.tsx` or `<dir>/_index.tsx` serves the path, `_layout.tsx` nests a layout (`layout()`;
|
|
24
|
+
the root one is `rootLayout()`), `[id]` is a dynamic segment, `(group)` groups without a segment. `page/` holds
|
|
25
|
+
route modules only — no helpers, no `.ts` files.
|
|
26
|
+
2. Name every `[x]` segment with `.param("x", Type)` and read a query key only with `.search("k", Type)`. Values
|
|
27
|
+
arrive typed; `lang` reaches every stage and is never declared.
|
|
28
|
+
3. Gate with `.guard(() => signedIn())` on the `_layout.tsx` (a real redirect before anything renders), and repeat
|
|
29
|
+
a stricter guard on a page that needs more. The endpoint guards are still the real gate.
|
|
30
|
+
4. In `.render()`: `usePage()`, then fetch, then return. Hand `fetch.init*` / `view*` / `edit*` fields to sections
|
|
31
|
+
unawaited; await only what the shell reads, in one `Promise.all`.
|
|
32
|
+
5. `.head()` takes JSX (or a function returning it), never a metadata object. A canonical link comes only from the
|
|
33
|
+
page's own head.
|
|
34
|
+
6. Re-skin an `akanjs/ui` component for a subtree with `_overrides.tsx`:
|
|
35
|
+
`export default override({ Slot: AppComponent })`, no logic.
|
|
36
|
+
|
|
37
|
+
## Never
|
|
38
|
+
|
|
39
|
+
- A `fetch.<mutation>()` while rendering — it throws `base.error.mutationInRender`, because opening a link would
|
|
40
|
+
perform it. Send writes from a user action.
|
|
41
|
+
- `useState`, `useEffect`, comments, a named export beside the chain, or the legacy `export default async function`.
|
|
42
|
+
- Editing a lib page through its link in `page/(libs)/` — edit the lib's own `page/` source.
|
|
43
|
+
|
|
44
|
+
Full detail: `get_guideline` with `pageRule`, or `ssrRule` for what may render on the server.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: akan-query
|
|
3
|
+
description: "Write filters, slices and list loading: query descriptors, init paging and loadMoreOf, soft removal and hookless writes, q.search text search, and the cascade direction."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Akan queries and slices
|
|
7
|
+
|
|
8
|
+
## Filters and slices
|
|
9
|
+
|
|
10
|
+
- A filter in `<model>.document.ts` declares its args; a slice in `<model>.signal.ts` serves it to stores. A slice
|
|
11
|
+
`exec` returns a `query<Filter>(…)` descriptor — never a `list<Filter>` array — and you cannot chain sort or
|
|
12
|
+
limit on it.
|
|
13
|
+
- Page through the store: `initX(…, { sort, page, limit })`, then `st.do.loadMoreOf<Model>()` while
|
|
14
|
+
`hasMoreOf<Model>`. Never compare `count > page * limit`.
|
|
15
|
+
- Never ask for more than 500 rows: the server serves at most 500 per request and drops the rest silently.
|
|
16
|
+
A figure over the whole set belongs in an insight or an endpoint.
|
|
17
|
+
- The root slice takes a filter name and its args, never a raw query, and its `root:` guard is always `Admin`.
|
|
18
|
+
- No value is `q.empty`, never `q.missing`.
|
|
19
|
+
- A projection is bare on the facade (`pickById(id, { secret: true })`) and under `select` on a filter accessor —
|
|
20
|
+
the only way to read a `field.secret` value.
|
|
21
|
+
|
|
22
|
+
## Writes and removal
|
|
23
|
+
|
|
24
|
+
- Removal is soft: reads see live rows unless `{ withRemoved: true }`. The one hard delete is `purge<Filter>` /
|
|
25
|
+
`purgeMany`, for data past retention.
|
|
26
|
+
- A filter's `remove*` / `update*`, `updateById` and `removeById` run no hooks and no cascade. A model with a
|
|
27
|
+
cascade or `_postRemove` removes through `remove<Model>(id)`.
|
|
28
|
+
- Load a set once (`load<Model>Many`, one filter query) and create one with `create<Model>Many(rows)` instead of one
|
|
29
|
+
call per item in a loop — lint fails a per-item service call an endpoint reaches. `create<Model>Many` runs every
|
|
30
|
+
row's `_preCreate` before writing any, so a check there does not see the batch's own rows.
|
|
31
|
+
|
|
32
|
+
## Search and cascade
|
|
33
|
+
|
|
34
|
+
- `q.search(text, { prefix: true })` sits in a filter at an AND position, over fields with the `text` role. Blank
|
|
35
|
+
input matches nothing — never a passthrough. A search slice only over data safe to enumerate.
|
|
36
|
+
- `cascade` names a direction, and the wrong one loses data: `removeRef` on the owner's relation, `removeWith` on
|
|
37
|
+
the child's reference to its owner.
|
|
38
|
+
|
|
39
|
+
Full detail: `get_guideline` with `queryRule`, and `workspaceRecipes` for a worked slice.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: akan-runtime
|
|
3
|
+
description: "Configure how an app runs: web surfaces, route prefixes, gateway vs solo, akan start and logs, the Docker image, native and desktop apps, database modes, ops, assets and the build pipeline."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Akan runtime
|
|
7
|
+
|
|
8
|
+
Runtime and build settings are declared in `akan.config.ts` and narrowed — never widened — by an env at boot.
|
|
9
|
+
Domain code reaches none of them.
|
|
10
|
+
|
|
11
|
+
## Where each setting lives
|
|
12
|
+
|
|
13
|
+
| Want | Setting |
|
|
14
|
+
| --- | --- |
|
|
15
|
+
| API only, or no CSR bundle for native apps | `web: false`, `web: { csr: false }` |
|
|
16
|
+
| Move the API or websocket mount | `new AkanApp({ prefix, websocketPrefix })` in `main.ts`, mirrored in `api: { … }`; read with `getApiPrefix()` / `getWsPrefix()` |
|
|
17
|
+
| The production image | `docker: string \| { image, preRuns, postRuns, command }` |
|
|
18
|
+
| iOS, Android, desktop | the `native` section; `desktop: { server: true }` carries the server |
|
|
19
|
+
| SQLite, several databases, a cluster | `database: { modes: [...] }`, picked by `AKAN_DATABASE_MODE` |
|
|
20
|
+
| URLs without `/<locale>/`: one language, or paths fixed from outside (OAuth callback, QR code, mail link) | `i18n: { localePrefix: "as-needed" }` — the default locale's pages and `<Link>` hrefs drop the prefix, other locales keep it |
|
|
21
|
+
|
|
22
|
+
- `main.ts` imports `AkanApp` from `akanjs/server/akanApp`, never the barrel.
|
|
23
|
+
- Never write `/api` or `/ws` literally, and never pass a prefix as a prop.
|
|
24
|
+
- The generated image installs only `ca-certificates` and `tzdata`; add the rest in `preRuns`.
|
|
25
|
+
- An app running in two database modes avoids `q.raw`.
|
|
26
|
+
|
|
27
|
+
## Running and logs
|
|
28
|
+
|
|
29
|
+
- `akan start <app>` (`a,b` or `all` for several) runs the dev server; `akan build <app>` checks the production
|
|
30
|
+
build. A supervised session writes `local/apps/<app>/runtime/dev.log` — hand over that path, not a paste of the
|
|
31
|
+
live view. Tail with `akan logs <app>`.
|
|
32
|
+
- Run a build without Docker with `cd dist/apps/<app> && bun main.js`: it boots with the env the Dockerfile sets,
|
|
33
|
+
read from `akan.env.json` beside it, and a variable you set yourself (`PORT=3000`) wins.
|
|
34
|
+
- Give every log sink a floor (`Logger.addSink(sink, { minLevel })`) and never log once per delivered record.
|
|
35
|
+
|
|
36
|
+
## Native and desktop
|
|
37
|
+
|
|
38
|
+
- `akan start-desktop <app>`, `akan start-ios <app>`, `akan start-android <app>` load pages from a running
|
|
39
|
+
`akan start`; a desktop app carrying its server starts it itself.
|
|
40
|
+
- A desktop app's carried server listens on a loopback port any local program can call — guard it like a network
|
|
41
|
+
server. Read runtime files from `AKAN_APP_DIR`, and keep a user's secret with `NativeSecret`, never in a file.
|
|
42
|
+
|
|
43
|
+
Full detail: `get_guideline` with `runtimeRule`.
|
|
@@ -43,8 +43,8 @@ Each result names the next call in `next.tool`. Follow it; do not improvise.
|
|
|
43
43
|
and each workflow's inputs.)
|
|
44
44
|
2. `apply_workflow({ planPath })` — writes the scaffold and syncs the generated barrels. Returns
|
|
45
45
|
`validationTarget`.
|
|
46
|
-
3. `run_validation({ runIdOrPlan: <validationTarget> })`, or
|
|
47
|
-
|
|
46
|
+
3. `run_validation({ runIdOrPlan: <validationTarget> })`, or run `akan verify` (`akan_verify` in akan code);
|
|
47
|
+
both are the whole chain in one process.
|
|
48
48
|
4. **Read each scaffolded file before editing it.** They are a few lines each and they extend base classes
|
|
49
49
|
that already generated the CRUD surface. Read the `akan-store` skill before touching a store or adding
|
|
50
50
|
signal endpoints, or you will redeclare `create<Model>` and hit an "already exists" typecheck error.
|
|
@@ -60,9 +60,19 @@ Each result names the next call in `next.tool`. Follow it; do not improvise.
|
|
|
60
60
|
- Hand-writing files is the fallback, used only when no workflow matches, or when apply reports
|
|
61
61
|
unsupported / no-op / failed diagnostics telling you to act manually. Say which case applied.
|
|
62
62
|
- Never hand-edit a generated file to "finish" a scaffold — use `repair_generated` or `akan sync <app>`.
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
|
|
64
|
+
## No workflow tools? The CLI is the same chain
|
|
65
|
+
|
|
66
|
+
The tools come from `akan mcp` (`--mode plan` reads, `--mode apply` writes). When they are not connected, each
|
|
67
|
+
has a command that prints the same report:
|
|
68
|
+
|
|
69
|
+
| tool | command |
|
|
70
|
+
| --- | --- |
|
|
71
|
+
| `list_workflows` / `explain_workflow` | `akan workflow list` / `akan workflow explain <name>` |
|
|
72
|
+
| `plan_workflow` | `akan workflow plan create-module --app <app> --module comment --format json --out <path>` |
|
|
73
|
+
| `apply_workflow` | `akan workflow apply <path> --format json` (`--dry-run` previews) |
|
|
74
|
+
| `run_validation` | `akan verify <app>` |
|
|
75
|
+
| `repair_generated` / `repair_imports` / `repair_module_shape` | `akan repair generated\|imports\|module-shape --app <app>` |
|
|
66
76
|
|
|
67
77
|
## Worked example — "an intro page, two detail pages, and a comment zone with a database"
|
|
68
78
|
|
|
@@ -73,4 +83,4 @@ Each result names the next call in `next.tool`. Follow it; do not improvise.
|
|
|
73
83
|
leave the store body empty unless you need extra state.
|
|
74
84
|
4. Write the pages and the comment UI against the generated actions — `st.do.createComment`,
|
|
75
85
|
`st.do.initCommentInPublic`, `st.use.commentListInPublic`.
|
|
76
|
-
5. `
|
|
86
|
+
5. `akan verify` until it prints `verify ok`.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: akan-transport
|
|
3
|
+
description: "Guard and tune endpoints on the wire: writing a Can<Verb><Model> guard, deadlines, cache, idempotency, rate limits, server-to-server calls, body types, bytes and HTTP verbs."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Akan transport
|
|
7
|
+
|
|
8
|
+
## Guards
|
|
9
|
+
|
|
10
|
+
- Every custom `query` / `mutation` / `pubsub` / `message` names its own `guards: [...]`; every `slice()` takes an
|
|
11
|
+
explicit guard map with `root: Admin`. `Public` belongs on a slice `get:`, and on a mutation only for an act that
|
|
12
|
+
must work signed out (sign-up, sign-in, token refresh, an OAuth route), which also declares a `rateLimit`.
|
|
13
|
+
- A resource guard is a `Can<Verb><Model>` class in the model library's `srvkit/guards.ts` that fails closed:
|
|
14
|
+
no resource named, or a load that throws, is `false` (after a `logger.warn`). Admin bypass goes first.
|
|
15
|
+
- Every guard declares `static scope`: `"account"` reads only the caller (`SignedIn`, `Admin`, roles), and
|
|
16
|
+
`"resource"` needs the call's arguments (every `Can<Verb><Model>`). Keep `static name = "User";` with a comment.
|
|
17
|
+
- Guards read `context.get<T>("account")`, serve HTTP and websocket alike, and stay side-effect free. The acting
|
|
18
|
+
user comes from `.with(Self)` / `.with(CurrentUserId)` / `.with(Me)`, the address from `.with(Ip)` — never a
|
|
19
|
+
client-supplied id. The service re-checks ownership: two independent gates.
|
|
20
|
+
|
|
21
|
+
## Endpoint options
|
|
22
|
+
|
|
23
|
+
- `{ timeout: <ms> }` is the deadline on both ends; undeclared, the client quits at 30 s and the handler is not
|
|
24
|
+
cancelled.
|
|
25
|
+
- `{ cache }` only on a `query` with no internal argument, capped at one day; `invalidate(endpoint, args?)` drops
|
|
26
|
+
it early through a plugged `EndpointCacheControl`.
|
|
27
|
+
- `{ rateLimit: { calls, windowMs?, by? } }` per endpoint, `option.setRateLimit` per app, `plug(RateLimit)` for a
|
|
28
|
+
business key.
|
|
29
|
+
- A mutation repeated under one `Idempotency-Key` header runs once and replays its first answer.
|
|
30
|
+
- `{ method: "PATCH" | "PUT" | "DELETE" }` moves a mutation off `POST` — only when a foreign protocol forces it.
|
|
31
|
+
- `errors: { 409: ["ticket.error.locked"] }` names the errors an endpoint throws on purpose.
|
|
32
|
+
|
|
33
|
+
## Bodies and other servers
|
|
34
|
+
|
|
35
|
+
- `.body()` / `.param()` take scalars, model refs or `enumOf(...)`; `Int` / `Float`, never `Number`; bytes are
|
|
36
|
+
`Binary`, never `Any`; `Upload` only in a `fileUpload: true` mutation.
|
|
37
|
+
- Server to server, `fetch.clone({ origin })` opens no socket without `connect: true`, retries through `retry`,
|
|
38
|
+
and rethrows a remote `Err` as it is — never wrap or re-key it.
|
|
39
|
+
|
|
40
|
+
Full detail: `get_guideline` with `transportRule`, or `mcpRule` for what a guard's scope does to an MCP listing.
|
|
@@ -7,17 +7,19 @@ description: "Run the akan check loop after editing and fix each failure class t
|
|
|
7
7
|
|
|
8
8
|
## One call does the whole chain
|
|
9
9
|
|
|
10
|
-
`
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
- `akan
|
|
19
|
-
- `akan
|
|
20
|
-
- `akan build
|
|
10
|
+
`akan verify` (the `akan_verify` tool in akan code) syncs, lints with fixes, typechecks, fast-builds each
|
|
11
|
+
changed app, and runs the SSR check for a `.tsx` change — over everything the working tree has changed, in one
|
|
12
|
+
process. It prints one line when it passes and one line per problem when it fails. **Run it after editing,
|
|
13
|
+
before you say you are done.** In akan code it also runs itself at the end of a turn that changed source.
|
|
14
|
+
|
|
15
|
+
Never run `akan lint`, `akan typecheck` and `akan build` in turn: that is the same work three times over, at
|
|
16
|
+
three times the output. Narrow the one command instead:
|
|
17
|
+
|
|
18
|
+
- `akan verify <app-or-lib-or-pkg>` — that target whole, changed or not.
|
|
19
|
+
- `akan verify --lint-only` — the quick pass between edits.
|
|
20
|
+
- `akan verify --no-build` — leave the app build out.
|
|
21
|
+
- `akan verify --max 0` — every line, when the report ends in `+N more`.
|
|
22
|
+
- `fixed N files` in the header means lint rewrote them on disk: re-read before editing them again.
|
|
21
23
|
|
|
22
24
|
Raw `tsc` misses the generated barrels and reports false errors. Do not reach for it.
|
|
23
25
|
|
|
@@ -5,29 +5,29 @@ import {
|
|
|
5
5
|
runner,
|
|
6
6
|
script,
|
|
7
7
|
command
|
|
8
|
-
} from "./index-
|
|
8
|
+
} from "./index-9zy8479y.js";
|
|
9
9
|
import {
|
|
10
10
|
FileSys2
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-bns3wcpc.js";
|
|
12
12
|
import {
|
|
13
13
|
LibSource,
|
|
14
14
|
Executor,
|
|
15
15
|
WorkspaceExecutor,
|
|
16
16
|
AppExecutor
|
|
17
|
-
} from "./index-
|
|
17
|
+
} from "./index-g500c5j9.js";
|
|
18
18
|
import {
|
|
19
19
|
GlobalConfig
|
|
20
|
-
} from "./index-
|
|
20
|
+
} from "./index-gr9thy79.js";
|
|
21
21
|
import"./index-m9jj544v.js";
|
|
22
|
-
import"./index-
|
|
23
|
-
import"./index-
|
|
24
|
-
import"./index-
|
|
22
|
+
import"./index-sp0qsr7a.js";
|
|
23
|
+
import"./index-zbrwnmf1.js";
|
|
24
|
+
import"./index-sveq36gh.js";
|
|
25
25
|
import {
|
|
26
26
|
SubspaceConfig
|
|
27
|
-
} from "./index-
|
|
27
|
+
} from "./index-h7hehkw6.js";
|
|
28
28
|
import {
|
|
29
29
|
SlicePlanner
|
|
30
|
-
} from "./index-
|
|
30
|
+
} from "./index-defp4gmb.js";
|
|
31
31
|
|
|
32
32
|
// pkgs/@akanjs/devkit/subspace.ts
|
|
33
33
|
import { mkdir as mkdir2 } from "fs/promises";
|
|
@@ -64,6 +64,8 @@ class SubspaceClone {
|
|
|
64
64
|
constructor(workspace, declaration) {
|
|
65
65
|
this.#workspace = workspace;
|
|
66
66
|
this.#declaration = declaration;
|
|
67
|
+
if (!SubspaceConfig.namePattern.test(declaration.name))
|
|
68
|
+
throw new Error(`Subspace name "${declaration.name}" cannot name a folder under .akan/subspace.`);
|
|
67
69
|
this.#clonePath = path.join(workspace.workspaceRoot, ".akan/subspace", declaration.name);
|
|
68
70
|
this.#clone = new Executor(`subspace-${declaration.name}`, this.#clonePath);
|
|
69
71
|
}
|
|
@@ -816,7 +818,7 @@ class SubspaceRunner extends runner("subspace") {
|
|
|
816
818
|
if (!asked)
|
|
817
819
|
return { name: subspace.name, workspaceId, host, apps, libs: [], outcome: "cancelled", files: [] };
|
|
818
820
|
const { libs } = await subspace.slice();
|
|
819
|
-
const { CloudScript } = await import("./cloud.script-
|
|
821
|
+
const { CloudScript } = await import("./cloud.script-hgvvajm3.js");
|
|
820
822
|
const { files } = await CommandContainer.get(CloudScript).uploadEnv(workspace, {
|
|
821
823
|
host,
|
|
822
824
|
workspaceId,
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import type { AppInfo, LibInfo } from "akanjs";
|
|
2
|
+
import { BiomeForm } from "../../biomeForm";
|
|
2
3
|
|
|
3
4
|
interface Dict {
|
|
4
5
|
model: string;
|
|
5
6
|
Model: string;
|
|
6
7
|
}
|
|
7
8
|
export default function getContent(scanInfo: AppInfo | LibInfo | null, dict: Dict) {
|
|
8
|
-
return `
|
|
9
|
-
import { via } from "akanjs/constant";
|
|
9
|
+
return `import { via } from "akanjs/constant";
|
|
10
10
|
|
|
11
|
-
export class ${dict.Model} extends via(
|
|
12
|
-
field: field(String),
|
|
13
|
-
})) {}
|
|
11
|
+
${BiomeForm.callArgs("", `export class ${dict.Model} extends via`, ["(field) => ({\n field: field(String),\n})"], " {}")}
|
|
14
12
|
`;
|
|
15
13
|
}
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import type { AppInfo, LibInfo } from "akanjs";
|
|
2
|
+
import { BiomeForm } from "../../biomeForm";
|
|
2
3
|
|
|
3
4
|
interface Dict {
|
|
4
5
|
model: string;
|
|
5
6
|
Model: string;
|
|
6
7
|
}
|
|
7
8
|
export default function getContent(scanInfo: AppInfo | LibInfo | null, dict: Dict) {
|
|
8
|
-
|
|
9
|
-
import { scalarDictionary } from "akanjs/dictionary";
|
|
9
|
+
const { Model, model } = dict;
|
|
10
|
+
return `import { scalarDictionary } from "akanjs/dictionary";
|
|
10
11
|
|
|
11
|
-
import type { ${
|
|
12
|
+
import type { ${Model} } from "./${model}.constant";
|
|
12
13
|
|
|
13
14
|
export const dictionary = scalarDictionary(["en", "ko"])
|
|
14
|
-
|
|
15
|
-
.model<${
|
|
15
|
+
${BiomeForm.dictionaryOf([Model, Model], [`${Model} description`, `${Model} 설명`])}
|
|
16
|
+
.model<${Model}>((t) => ({
|
|
16
17
|
field: t(["Field", "필드"]).desc(["Field Description", "필드 설명"]),
|
|
17
18
|
}));
|
|
18
19
|
`;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import type { AppInfo, LibInfo } from "akanjs";
|
|
2
|
+
import { BiomeForm } from "../../biomeForm";
|
|
2
3
|
|
|
3
4
|
interface Dict {
|
|
4
5
|
model: string;
|
|
5
6
|
Model: string;
|
|
6
7
|
}
|
|
7
8
|
export default function getContent(scanInfo: AppInfo | LibInfo | null, dict: Dict) {
|
|
8
|
-
return `
|
|
9
|
-
import { by } from "akanjs/document";
|
|
9
|
+
return `import { by } from "akanjs/document";
|
|
10
10
|
|
|
11
11
|
import * as cnst from "./${dict.model}.constant";
|
|
12
12
|
|
|
13
|
-
export class ${dict.Model} extends by
|
|
13
|
+
${BiomeForm.callArgs("", `export class ${dict.Model} extends by`, [`cnst.${dict.Model}`], " {}")}
|
|
14
14
|
`;
|
|
15
15
|
}
|
|
@@ -4,11 +4,10 @@ interface Dict {
|
|
|
4
4
|
appName: string;
|
|
5
5
|
}
|
|
6
6
|
export default function getContent(scanInfo: AppInfo | LibInfo | null, dict: Dict) {
|
|
7
|
-
return `
|
|
8
|
-
import type { AppConfig } from "akanjs";
|
|
7
|
+
return `import type { AppConfig } from "akanjs";
|
|
9
8
|
|
|
10
9
|
const config: AppConfig = {};
|
|
11
10
|
|
|
12
11
|
export default config;
|
|
13
|
-
|
|
12
|
+
`;
|
|
14
13
|
}
|
|
@@ -4,8 +4,7 @@ interface Dict {
|
|
|
4
4
|
[key: string]: string;
|
|
5
5
|
}
|
|
6
6
|
export default function getContent(scanInfo: AppInfo | LibInfo | null, dict: Dict = {}) {
|
|
7
|
-
return `
|
|
8
|
-
import { env as debug } from "./env.client.debug";
|
|
7
|
+
return `import { env as debug } from "./env.client.debug";
|
|
9
8
|
import { env as develop } from "./env.client.develop";
|
|
10
9
|
import { env as local } from "./env.client.local";
|
|
11
10
|
import { env as main } from "./env.client.main";
|
|
@@ -16,6 +15,5 @@ const currentEnv = process.env.AKAN_PUBLIC_ENV ?? "local";
|
|
|
16
15
|
if (!(currentEnv in envConfigs)) throw new Error(\`Unknown environment: \${currentEnv}\`);
|
|
17
16
|
|
|
18
17
|
export const env = envConfigs[currentEnv as keyof typeof envConfigs];
|
|
19
|
-
|
|
20
|
-
`;
|
|
18
|
+
`;
|
|
21
19
|
}
|
|
@@ -4,8 +4,7 @@ interface Dict {
|
|
|
4
4
|
[key: string]: string;
|
|
5
5
|
}
|
|
6
6
|
export default function getContent(scanInfo: AppInfo | LibInfo | null, dict: Dict = {}) {
|
|
7
|
-
return
|
|
8
|
-
// Replace with the public env keys this app reads, e.g. { google?: { mapKey: string } }.
|
|
7
|
+
return `// Replace with the public env keys this app reads, e.g. { google?: { mapKey: string } }.
|
|
9
8
|
export type AppClientEnv = Record<never, never>;
|
|
10
|
-
|
|
9
|
+
`;
|
|
11
10
|
}
|
|
@@ -4,8 +4,7 @@ interface Dict {
|
|
|
4
4
|
[key: string]: string;
|
|
5
5
|
}
|
|
6
6
|
export default function getContent(scanInfo: AppInfo | LibInfo | null, dict: Dict = {}) {
|
|
7
|
-
return `
|
|
8
|
-
import { env as debug } from "./env.server.debug";
|
|
7
|
+
return `import { env as debug } from "./env.server.debug";
|
|
9
8
|
import { env as develop } from "./env.server.develop";
|
|
10
9
|
import { env as local } from "./env.server.local";
|
|
11
10
|
import { env as main } from "./env.server.main";
|
|
@@ -16,5 +15,5 @@ const currentEnv = process.env.AKAN_PUBLIC_ENV ?? "local";
|
|
|
16
15
|
if (!(currentEnv in envConfigs)) throw new Error(\`Unknown environment: \${currentEnv}\`);
|
|
17
16
|
|
|
18
17
|
export const env = envConfigs[currentEnv as keyof typeof envConfigs];
|
|
19
|
-
|
|
18
|
+
`;
|
|
20
19
|
}
|
|
@@ -5,8 +5,7 @@ interface Dict {
|
|
|
5
5
|
AppName: string;
|
|
6
6
|
}
|
|
7
7
|
export default function getContent(scanInfo: AppInfo | LibInfo | null, dict: Dict) {
|
|
8
|
-
return `
|
|
9
|
-
import { serviceDictionary } from "akanjs/dictionary";
|
|
8
|
+
return `import { serviceDictionary } from "akanjs/dictionary";
|
|
10
9
|
|
|
11
10
|
import type { ${dict.AppName}Endpoint } from "./${dict.appName}.signal";
|
|
12
11
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { AppInfo, LibInfo } from "akanjs";
|
|
2
|
+
import { BiomeForm } from "../../../biomeForm";
|
|
2
3
|
|
|
3
4
|
interface Dict {
|
|
4
5
|
appName: string;
|
|
5
6
|
AppName: string;
|
|
6
7
|
}
|
|
7
8
|
export default function getContent(scanInfo: AppInfo | LibInfo | null, dict: Dict) {
|
|
8
|
-
return `
|
|
9
|
-
import { serve } from "akanjs/service";
|
|
9
|
+
return `import { serve } from "akanjs/service";
|
|
10
10
|
|
|
11
|
-
export class ${dict.AppName}Service extends serve
|
|
11
|
+
${BiomeForm.callArgs("", `export class ${dict.AppName}Service extends serve`, [`"${dict.appName}" as const`, '{ serverMode: "batch" }', "() => ({})"], " {}")}
|
|
12
12
|
`;
|
|
13
13
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import type { AppInfo, LibInfo } from "akanjs";
|
|
2
|
+
import { BiomeForm } from "../../../biomeForm";
|
|
2
3
|
|
|
3
4
|
interface Dict {
|
|
4
5
|
appName: string;
|
|
5
6
|
AppName: string;
|
|
6
7
|
}
|
|
7
8
|
export default function getContent(scanInfo: AppInfo | LibInfo | null, dict: Dict) {
|
|
8
|
-
return `
|
|
9
|
-
import { endpoint, internal } from "akanjs/signal";
|
|
9
|
+
return `import { endpoint, internal } from "akanjs/signal";
|
|
10
10
|
|
|
11
11
|
import * as srv from "../srv";
|
|
12
12
|
|
|
13
|
-
export class ${dict.AppName}Internal extends internal
|
|
13
|
+
${BiomeForm.callArgs("", `export class ${dict.AppName}Internal extends internal`, [`srv.${dict.appName}`, "() => ({})"], " {}")}
|
|
14
14
|
|
|
15
|
-
export class ${dict.AppName}Endpoint extends endpoint
|
|
16
|
-
|
|
15
|
+
${BiomeForm.callArgs("", `export class ${dict.AppName}Endpoint extends endpoint`, [`srv.${dict.appName}`, "() => ({})"], " {}")}
|
|
16
|
+
`;
|
|
17
17
|
}
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import type { AppInfo, LibInfo } from "akanjs";
|
|
2
|
+
import { BiomeForm } from "../../../biomeForm";
|
|
2
3
|
|
|
3
4
|
interface Dict {
|
|
4
5
|
appName: string;
|
|
5
6
|
AppName: string;
|
|
6
7
|
}
|
|
7
8
|
export default function getContent(scanInfo: AppInfo | LibInfo | null, dict: Dict) {
|
|
8
|
-
return `
|
|
9
|
-
import { store } from "akanjs/store";
|
|
9
|
+
return `import { store } from "akanjs/store";
|
|
10
10
|
|
|
11
|
-
export class ${dict.AppName}Store extends store
|
|
12
|
-
// state
|
|
13
|
-
})) {
|
|
11
|
+
${BiomeForm.callArgs("", `export class ${dict.AppName}Store extends store`, [`"${dict.appName}" as const`, "() => ({\n // state\n})"], " {")}
|
|
14
12
|
// action
|
|
15
13
|
}
|
|
16
|
-
|
|
14
|
+
`;
|
|
17
15
|
}
|
|
@@ -4,8 +4,7 @@ interface Dict {
|
|
|
4
4
|
[key: string]: string;
|
|
5
5
|
}
|
|
6
6
|
export default function getContent(scanInfo: AppInfo | LibInfo | null, dict: Dict = {}) {
|
|
7
|
-
return `
|
|
8
|
-
import { AkanOption } from "akanjs/server";
|
|
7
|
+
return `import { AkanOption } from "akanjs/server";
|
|
9
8
|
|
|
10
9
|
import type { LibOptions } from "./srv";
|
|
11
10
|
|
|
@@ -14,5 +13,5 @@ export type ModulesOptions = LibOptions & {
|
|
|
14
13
|
};
|
|
15
14
|
|
|
16
15
|
export const option = new AkanOption<ModulesOptions>();
|
|
17
|
-
|
|
16
|
+
`;
|
|
18
17
|
}
|
package/templates/app/main.ts
CHANGED
|
@@ -4,8 +4,7 @@ interface Dict {
|
|
|
4
4
|
appName: string;
|
|
5
5
|
}
|
|
6
6
|
export default function getContent(scanInfo: AppInfo | LibInfo | null, dict: Dict) {
|
|
7
|
-
return
|
|
8
|
-
// Not the \`akanjs/server\` barrel: it re-exports AkanServer, whose graph the gateway never runs. Through the
|
|
7
|
+
return `// Not the \`akanjs/server\` barrel: it re-exports AkanServer, whose graph the gateway never runs. Through the
|
|
9
8
|
// barrel this process evaluates 35MB of SSR renderer and DB driver to spawn children and relay bytes.
|
|
10
9
|
import { AkanApp } from "akanjs/server/akanApp";
|
|
11
10
|
|
|
@@ -13,6 +12,5 @@ const run = async () => {
|
|
|
13
12
|
await new AkanApp().start();
|
|
14
13
|
};
|
|
15
14
|
void run();
|
|
16
|
-
|
|
17
|
-
`;
|
|
15
|
+
`;
|
|
18
16
|
}
|
|
@@ -35,8 +35,7 @@ export default function getContent(scanInfo: AppInfo | LibInfo | null, dict: Dic
|
|
|
35
35
|
: "";
|
|
36
36
|
return {
|
|
37
37
|
filename: "_index.tsx",
|
|
38
|
-
content: `
|
|
39
|
-
import { jellyButtonRecipe } from "@apps/${dict.appName}/ui";
|
|
38
|
+
content: `import { jellyButtonRecipe } from "@apps/${dict.appName}/ui";
|
|
40
39
|
import { getEnv } from "akanjs/base";
|
|
41
40
|
import { cn, page, usePage } from "akanjs/client";
|
|
42
41
|
import { Image, Link, System } from "akanjs/ui";
|
|
@@ -293,6 +292,7 @@ export default page().render(() => {
|
|
|
293
292
|
</div>
|
|
294
293
|
</main>
|
|
295
294
|
);
|
|
296
|
-
})
|
|
295
|
+
});
|
|
296
|
+
`,
|
|
297
297
|
};
|
|
298
298
|
}
|