@akanjs/cli 2.3.9-rc.0 → 2.3.9-rc.1
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/incrementalBuilder.proc.js +855 -14
- package/index.js +3760 -1485
- package/package.json +2 -2
- package/templates/appSample/common/formatters.ts +1 -1
- package/templates/appSample/common/validators.ts +1 -1
- package/templates/appSample/lib/_noti/noti.dictionary.ts +1 -1
- package/templates/appSample/lib/_noti/noti.service.ts +1 -1
- package/templates/appSample/lib/_noti/noti.signal.ts +1 -1
- package/templates/appSample/lib/_noti/noti.store.ts +1 -1
- package/templates/appSample/lib/task/task.abstract.ts +1 -1
- package/templates/appSample/lib/task/task.constant.ts +1 -1
- package/templates/appSample/lib/task/task.dictionary.ts +1 -1
- package/templates/appSample/lib/task/task.document.ts +3 -3
- package/templates/appSample/lib/task/task.service.ts +2 -2
- package/templates/appSample/lib/task/task.signal.spec.ts +70 -0
- package/templates/appSample/lib/task/task.signal.test.ts +20 -0
- package/templates/appSample/lib/task/task.signal.ts +2 -2
- package/templates/appSample/lib/task/task.store.ts +2 -2
- package/templates/appSample/srvkit/AuthGuard.ts +1 -1
- package/templates/appSample/srvkit/SessionInternalArg.ts +1 -1
- package/templates/appSample/ui/GlobalLoading.tsx +1 -1
- package/templates/appSample/ui/QuantityControl.tsx +1 -1
- package/templates/appSample/webkit/useDebounce.ts +1 -1
- package/templates/lib/useClient.ts +1 -4
- package/templates/module/__Model__.Unit.tsx +1 -4
- package/templates/workspaceRoot/.cursor/rules/{akan-scan-conventions.mdc.template → akan-sync-conventions.mdc.template} +3 -3
- package/templates/workspaceRoot/.cursor/rules/akan.mdc.template +5 -0
- package/templates/workspaceRoot/AGENTS.md.template +77 -58
- package/templates/workspaceRoot/docs/AI-DEVELOPMENT.md.template +51 -0
- package/templates/workspaceRoot/docs/GENERATED.md.template +54 -0
- package/templates/workspaceRoot/package.json.template +9 -0
- package/templates/workspaceRoot/Untitled +0 -1
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# AI Development Guide
|
|
2
|
+
|
|
3
|
+
This workspace is an Akan.js project. Keep business intent in source files and let `akan sync` regenerate the
|
|
4
|
+
repeated surfaces.
|
|
5
|
+
|
|
6
|
+
## Domain Module Shape
|
|
7
|
+
|
|
8
|
+
- `apps/<app>/lib/<model>` is for database-backed domain modules.
|
|
9
|
+
- `apps/<app>/lib/_<service>` is for service modules without their own database document.
|
|
10
|
+
- `apps/<app>/lib/__scalar/<scalar>` is for reusable embedded value shapes.
|
|
11
|
+
- Put model behavior in the local module before creating a parallel architecture.
|
|
12
|
+
|
|
13
|
+
## Data Flow
|
|
14
|
+
|
|
15
|
+
Follow this order for domain changes:
|
|
16
|
+
|
|
17
|
+
1. `constant` defines fields, enums, and model layers.
|
|
18
|
+
2. `document` defines queries, filters, and document state transitions.
|
|
19
|
+
3. `service` owns business workflows and orchestration.
|
|
20
|
+
4. `signal` exposes typed endpoints, slices, and internal jobs.
|
|
21
|
+
5. `store` owns reusable client workflow state and actions.
|
|
22
|
+
6. UI files render forms, lists, details, and actions.
|
|
23
|
+
|
|
24
|
+
## When To Run Sync
|
|
25
|
+
|
|
26
|
+
Run this after adding, deleting, or renaming module, UI, webkit, srvkit, or common files:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
akan sync <%= appName %>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Sync regenerates barrels such as `cnst.ts`, `db.ts`, `srv.ts`, `sig.ts`, `st.ts`, `useClient.ts`, `useServer.ts`,
|
|
33
|
+
and module `index.ts` files. Without sync, imports can point at stale generated files.
|
|
34
|
+
|
|
35
|
+
## Generated Files
|
|
36
|
+
|
|
37
|
+
Do not hand-edit generated Akan files. Edit source files in the owning module and run sync or build instead.
|
|
38
|
+
See `docs/GENERATED.md` for the generated file list.
|
|
39
|
+
|
|
40
|
+
## Server And Client Boundary
|
|
41
|
+
|
|
42
|
+
- Keep server-only APIs such as `fs`, `Bun`, secrets, database adaptors, and server env access out of client code.
|
|
43
|
+
- Client surfaces include `ui/`, `webkit/`, `*.Template.tsx`, `*.Zone.tsx`, and `*.Util.tsx` files that use
|
|
44
|
+
`"use client"`.
|
|
45
|
+
- Server-oriented surfaces include pages, `*.Unit.tsx`, `*.View.tsx`, `lib/`, `srvkit/`, and server entrypoints.
|
|
46
|
+
- Treat `AKAN_PUBLIC_*` values as public.
|
|
47
|
+
|
|
48
|
+
## Abstract Documents
|
|
49
|
+
|
|
50
|
+
Update `*.abstract.md` when business invariants, workflows, user-visible behavior, cross-module relationships, or
|
|
51
|
+
agent guidance changes. Do not update it for purely mechanical formatting or regenerated file changes.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Generated Akan Files
|
|
2
|
+
|
|
3
|
+
These files are generated by `akan sync`, `akan start`, or `akan build`. Do not edit them by hand because the next
|
|
4
|
+
sync or build can overwrite local changes.
|
|
5
|
+
|
|
6
|
+
## App Entrypoints
|
|
7
|
+
|
|
8
|
+
| File | Purpose |
|
|
9
|
+
| --- | --- |
|
|
10
|
+
| `apps/*/client.ts` | App-wide client entrypoint for generated fetch, store, and client runtime exports. |
|
|
11
|
+
| `apps/*/server.ts` | App-wide server entrypoint for generated server, service, signal, database, and dictionary exports. |
|
|
12
|
+
|
|
13
|
+
## App Library Barrels
|
|
14
|
+
|
|
15
|
+
| File | Purpose |
|
|
16
|
+
| --- | --- |
|
|
17
|
+
| `apps/*/lib/cnst.ts` | Re-exports constants and model shapes from module `*.constant.ts` files. |
|
|
18
|
+
| `apps/*/lib/db.ts` | Re-exports database models from module `*.document.ts` files. |
|
|
19
|
+
| `apps/*/lib/dict.ts` | Re-exports dictionaries from module `*.dictionary.ts` files. |
|
|
20
|
+
| `apps/*/lib/option.ts` | Re-exports generated option helpers. |
|
|
21
|
+
| `apps/*/lib/srv.ts` | Re-exports services from module `*.service.ts` files. |
|
|
22
|
+
| `apps/*/lib/sig.ts` | Re-exports endpoints, slices, and internals from module `*.signal.ts` files. |
|
|
23
|
+
| `apps/*/lib/st.ts` | Re-exports stores from module `*.store.ts` files. |
|
|
24
|
+
| `apps/*/lib/useClient.ts` | Client-safe generated imports for fetch, message, signal, and store usage. |
|
|
25
|
+
| `apps/*/lib/useServer.ts` | Server-safe generated imports for service, database, signal, and dictionary usage. |
|
|
26
|
+
| `apps/*/lib/**/index.ts` | Per-module generated barrel files. |
|
|
27
|
+
|
|
28
|
+
## Shared Surface Barrels
|
|
29
|
+
|
|
30
|
+
| File | Purpose |
|
|
31
|
+
| --- | --- |
|
|
32
|
+
| `*/ui/index.ts` | Re-exports UI component files. |
|
|
33
|
+
| `*/webkit/index.ts` | Re-exports webkit/browser helper files. |
|
|
34
|
+
| `*/srvkit/index.ts` | Re-exports server-kit helper files. |
|
|
35
|
+
| `*/common/index.ts` | Re-exports common helper files. |
|
|
36
|
+
|
|
37
|
+
## How To Change Generated Output
|
|
38
|
+
|
|
39
|
+
1. Prefer `akan mcp --mode plan` to find an allowlisted workflow before editing files directly.
|
|
40
|
+
2. If a workflow or repair tool exists, use `akan mcp --mode apply` for `apply_workflow`, `run_validation`, or
|
|
41
|
+
`repair_generated`.
|
|
42
|
+
3. Edit the source file that owns the behavior, such as `task.constant.ts`, `task.document.ts`, `task.service.ts`,
|
|
43
|
+
`task.signal.ts`, or `task.store.ts`.
|
|
44
|
+
4. Run:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
akan sync <%= appName %>
|
|
48
|
+
# or: akan repair generated --app <%= appName %>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
5. Re-run the smallest relevant check, usually `akan test <%= appName %>`, `akan lint <%= appName %>`,
|
|
52
|
+
`akan doctor --strict`, or `akan build <%= appName %>`.
|
|
53
|
+
|
|
54
|
+
If a generated file looks wrong, fix the source convention or sync input rather than patching the generated file.
|
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
"name": "<%= repoName %>",
|
|
3
3
|
"description": "<%= repoName %> workspace",
|
|
4
4
|
"version": "0.0.1",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"sync": "akan sync",
|
|
7
|
+
"dev": "akan start",
|
|
8
|
+
"lint": "akan lint",
|
|
9
|
+
"typecheck": "akan typecheck",
|
|
10
|
+
"test": "akan test",
|
|
11
|
+
"setup:agent": "akan agent install all",
|
|
12
|
+
"build": "akan build"
|
|
13
|
+
},
|
|
5
14
|
"dependencies": {},
|
|
6
15
|
"devDependencies": {},
|
|
7
16
|
"patchedDependencies": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
android?: "auto" | "edge-to-edge" | "none";
|