@drhomet/mithaq 0.0.0-stage → 0.2.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/LICENSE +22 -0
- package/LICENSES/openstatus-time-picker.txt +21 -0
- package/LICENSES/payload.txt +22 -0
- package/LICENSES/ponytail.txt +21 -0
- package/README.md +160 -2
- package/dist/asas/actor.d.ts +96 -0
- package/dist/asas/actor.js +114 -0
- package/dist/asas/build.d.ts +239 -0
- package/dist/asas/build.js +834 -0
- package/dist/asas/cli/mithaq.d.ts +2 -0
- package/dist/asas/cli/mithaq.js +177 -0
- package/dist/asas/cli/upgrade.d.ts +33 -0
- package/dist/asas/cli/upgrade.js +256 -0
- package/dist/asas/http/fetch.d.ts +41 -0
- package/dist/asas/http/fetch.js +178 -0
- package/dist/asas/http/orpc.d.ts +45 -0
- package/dist/asas/http/orpc.js +153 -0
- package/dist/asas/runner/bulk.d.ts +20 -0
- package/dist/asas/runner/bulk.js +196 -0
- package/dist/asas/runner/errors.d.ts +63 -0
- package/dist/asas/runner/errors.js +75 -0
- package/dist/asas/runner/read.d.ts +72 -0
- package/dist/asas/runner/read.js +601 -0
- package/dist/asas/runner/runtime.d.ts +21 -0
- package/dist/asas/runner/runtime.js +8 -0
- package/dist/asas/runner/steps.d.ts +418 -0
- package/dist/asas/runner/steps.js +277 -0
- package/dist/asas/runner/store.d.ts +4 -0
- package/dist/asas/runner/store.js +21 -0
- package/dist/asas/runner/tenant.d.ts +54 -0
- package/dist/asas/runner/tenant.js +275 -0
- package/dist/asas/runner/write.d.ts +606 -0
- package/dist/asas/runner/write.js +1019 -0
- package/dist/auth/better-auth/access.d.ts +29 -0
- package/dist/auth/better-auth/access.js +103 -0
- package/dist/auth/better-auth/generate.d.ts +31 -0
- package/dist/auth/better-auth/generate.js +328 -0
- package/dist/auth/better-auth/index.d.ts +94 -0
- package/dist/auth/better-auth/index.js +81 -0
- package/dist/auth/better-auth/tenant.d.ts +26 -0
- package/dist/auth/better-auth/tenant.js +34 -0
- package/dist/auth/local/index.d.ts +285 -0
- package/dist/auth/local/index.js +738 -0
- package/dist/base/decimal.d.ts +9 -0
- package/dist/base/decimal.js +16 -0
- package/dist/base/fields.d.ts +124 -0
- package/dist/base/fields.js +52 -0
- package/dist/base/index.d.ts +47 -0
- package/dist/base/index.js +5 -0
- package/dist/base/json-schema.d.ts +7 -0
- package/dist/base/json-schema.js +35 -0
- package/dist/base/kinds.d.ts +75 -0
- package/dist/base/kinds.js +123 -0
- package/dist/base/rules.d.ts +73 -0
- package/dist/base/rules.js +81 -0
- package/dist/drizzle/index.d.ts +308 -0
- package/dist/drizzle/index.js +951 -0
- package/dist/drizzle/kinds.d.ts +28 -0
- package/dist/drizzle/kinds.js +43 -0
- package/dist/drizzle/migrate.d.ts +159 -0
- package/dist/drizzle/migrate.js +1328 -0
- package/dist/drizzle/proxy/index.d.ts +1 -0
- package/dist/drizzle/proxy/index.js +1 -0
- package/dist/drizzle/proxy/node-postgres.d.ts +1 -0
- package/dist/drizzle/proxy/node-postgres.js +1 -0
- package/dist/drizzle/proxy/pg-core.d.ts +1 -0
- package/dist/drizzle/proxy/pg-core.js +1 -0
- package/dist/drizzle/rules.d.ts +336 -0
- package/dist/drizzle/rules.js +44 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.js +26 -0
- package/dist/mithaq/define.d.ts +335 -0
- package/dist/mithaq/define.js +57 -0
- package/dist/mithaq/generate-messages.d.ts +38 -0
- package/dist/mithaq/generate-messages.js +235 -0
- package/dist/mithaq/language.d.ts +374 -0
- package/dist/mithaq/language.js +76 -0
- package/dist/mithaq/lock.d.ts +71 -0
- package/dist/mithaq/lock.js +329 -0
- package/dist/mithaq/message-file.d.ts +13 -0
- package/dist/mithaq/message-file.js +29 -0
- package/dist/mithaq/messages.d.ts +55 -0
- package/dist/mithaq/messages.js +111 -0
- package/dist/mithaq/refusal.d.ts +6 -0
- package/dist/mithaq/refusal.js +6 -0
- package/dist/mithaq/resolve.d.ts +10 -0
- package/dist/mithaq/resolve.js +1014 -0
- package/dist/mithaq/rows.d.ts +87 -0
- package/dist/mithaq/rows.js +174 -0
- package/dist/mithaq/rukn.d.ts +72 -0
- package/dist/mithaq/rukn.js +15 -0
- package/dist/mithaq/standard-schema.d.ts +38 -0
- package/dist/mithaq/standard-schema.js +2 -0
- package/dist/mithaq/types.d.ts +386 -0
- package/dist/mithaq/types.js +15 -0
- package/dist/mithaq/user.d.ts +19 -0
- package/dist/mithaq/user.js +16 -0
- package/dist/mithaq/where.d.ts +32 -0
- package/dist/mithaq/where.js +87 -0
- package/dist/rbac/index.d.ts +105 -0
- package/dist/rbac/index.js +182 -0
- package/dist/rbac/steps.d.ts +22 -0
- package/dist/rbac/steps.js +161 -0
- package/dist/rich-text/index.d.ts +28 -0
- package/dist/rich-text/index.js +59 -0
- package/dist/rich-text/rich-text.d.ts +106 -0
- package/dist/rich-text/rich-text.js +249 -0
- package/dist/rich-text/value.d.ts +55 -0
- package/dist/rich-text/value.js +126 -0
- package/dist/screen/client.d.ts +156 -0
- package/dist/screen/client.js +71 -0
- package/dist/screen/generate.d.ts +14 -0
- package/dist/screen/generate.js +268 -0
- package/dist/screen/index.d.ts +496 -0
- package/dist/screen/index.js +663 -0
- package/dist/screen/react.d.ts +97 -0
- package/dist/screen/react.js +58 -0
- package/dist/screen/studio.d.ts +24 -0
- package/dist/screen/studio.js +68 -0
- package/dist/service/index.d.ts +63 -0
- package/dist/service/index.js +15 -0
- package/dist/storage/allowed-type.d.ts +5 -0
- package/dist/storage/allowed-type.js +7 -0
- package/dist/storage/index.d.ts +42 -0
- package/dist/storage/index.js +43 -0
- package/dist/storage/storage.d.ts +386 -0
- package/dist/storage/storage.js +412 -0
- package/dist/targets.d.ts +14 -0
- package/dist/targets.js +16 -0
- package/dist/versions/index.d.ts +37 -0
- package/dist/versions/index.js +8 -0
- package/dist/versions/versions.d.ts +104 -0
- package/dist/versions/versions.js +160 -0
- package/dist/vite.d.ts +7 -0
- package/dist/vite.js +81 -0
- package/dist/zod/index.d.ts +193 -0
- package/dist/zod/index.js +122 -0
- package/dist/zod/kinds.d.ts +36 -0
- package/dist/zod/kinds.js +58 -0
- package/dist/zod/rules.d.ts +117 -0
- package/dist/zod/rules.js +67 -0
- package/docs/packages/mithaq/README.md +962 -0
- package/docs/packages/mithaq/src/asas/cli/README.md +252 -0
- package/docs/packages/mithaq/src/asas/runner/README.md +472 -0
- package/docs/packages/mithaq/src/drizzle/README.md +39 -0
- package/docs/packages/mithaq-admin/README.md +312 -0
- package/docs/templates/asas/README.md +1056 -0
- package/package.json +92 -4
- package/skills/add-field/SKILL.md +27 -0
- package/skills/add-kayan/SKILL.md +26 -0
- package/skills/eject-admin-piece/SKILL.md +28 -0
- package/skills/upgrade-mithaq/SKILL.md +35 -0
package/package.json
CHANGED
|
@@ -1,6 +1,94 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@drhomet/mithaq",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": "./dist/index.js",
|
|
8
|
+
"./generate-auth": "./dist/auth/better-auth/generate.js",
|
|
9
|
+
"./generate-messages": "./dist/mithaq/generate-messages.js",
|
|
10
|
+
"./generate-screens": "./dist/screen/generate.js",
|
|
11
|
+
"./upgrade": "./dist/asas/cli/upgrade.js",
|
|
12
|
+
"./vite": "./dist/vite.js",
|
|
13
|
+
"./admin": "./dist/screen/client.js",
|
|
14
|
+
"./admin/react": "./dist/screen/react.js",
|
|
15
|
+
"./orpc": "./dist/asas/http/orpc.js",
|
|
16
|
+
"./rich-text": "./dist/rich-text/index.js",
|
|
17
|
+
"./targets": "./dist/targets.js",
|
|
18
|
+
"./drizzle": "./dist/drizzle/proxy/index.js",
|
|
19
|
+
"./drizzle/pg-core": "./dist/drizzle/proxy/pg-core.js",
|
|
20
|
+
"./drizzle/node-postgres": "./dist/drizzle/proxy/node-postgres.js"
|
|
21
|
+
},
|
|
22
|
+
"bin": {
|
|
23
|
+
"mithaq": "dist/asas/cli/mithaq.js"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@babel/helper-validator-identifier": "^8.0.4",
|
|
27
|
+
"ajv": "8.20.0",
|
|
28
|
+
"ajv-formats": "3.0.1",
|
|
29
|
+
"drizzle-kit": "1.0.0-rc.4",
|
|
30
|
+
"drizzle-orm": "1.0.0-rc.4",
|
|
31
|
+
"jose": "6.2.12",
|
|
32
|
+
"pg": "^8.16.3",
|
|
33
|
+
"zod": "^4.6.5"
|
|
34
|
+
},
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"@lexical/extension": "0.52.0",
|
|
37
|
+
"@lexical/link": "0.52.0",
|
|
38
|
+
"@lexical/list": "0.52.0",
|
|
39
|
+
"@lexical/rich-text": "0.52.0",
|
|
40
|
+
"@orpc/openapi": "^1.15.1",
|
|
41
|
+
"@orpc/server": "^1.15.1",
|
|
42
|
+
"better-auth": "1.7.4",
|
|
43
|
+
"lexical": "0.52.0",
|
|
44
|
+
"react": "^19.3.0",
|
|
45
|
+
"vite": ">=8"
|
|
46
|
+
},
|
|
47
|
+
"peerDependenciesMeta": {
|
|
48
|
+
"@lexical/extension": {
|
|
49
|
+
"optional": true
|
|
50
|
+
},
|
|
51
|
+
"@lexical/link": {
|
|
52
|
+
"optional": true
|
|
53
|
+
},
|
|
54
|
+
"@lexical/list": {
|
|
55
|
+
"optional": true
|
|
56
|
+
},
|
|
57
|
+
"@lexical/rich-text": {
|
|
58
|
+
"optional": true
|
|
59
|
+
},
|
|
60
|
+
"@orpc/openapi": {
|
|
61
|
+
"optional": true
|
|
62
|
+
},
|
|
63
|
+
"@orpc/server": {
|
|
64
|
+
"optional": true
|
|
65
|
+
},
|
|
66
|
+
"lexical": {
|
|
67
|
+
"optional": true
|
|
68
|
+
},
|
|
69
|
+
"react": {
|
|
70
|
+
"optional": true
|
|
71
|
+
},
|
|
72
|
+
"vite": {
|
|
73
|
+
"optional": true
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
"files": [
|
|
77
|
+
"dist",
|
|
78
|
+
"docs",
|
|
79
|
+
"skills",
|
|
80
|
+
"LICENSES"
|
|
81
|
+
],
|
|
82
|
+
"repository": {
|
|
83
|
+
"type": "git",
|
|
84
|
+
"url": "git+https://github.com/drhomet/mithaq.git",
|
|
85
|
+
"directory": "packages/mithaq"
|
|
86
|
+
},
|
|
87
|
+
"homepage": "https://github.com/drhomet/mithaq#readme",
|
|
88
|
+
"bugs": {
|
|
89
|
+
"url": "https://github.com/drhomet/mithaq/issues"
|
|
90
|
+
},
|
|
91
|
+
"engines": {
|
|
92
|
+
"node": ">=24"
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: add-field
|
|
3
|
+
description: Add, change or remove a field of an existing kayan in this mithaq project and write the migration for it. Use when asked to add a column, change a field's kind or rules, or write a migration.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Add a field and its migration
|
|
7
|
+
|
|
8
|
+
The guide is "A field" under "Add a feature to an existing kayan" in `README.md`, and "Migrations" in `AGENTS.md`. The installed mithaq is `packages/asas/node_modules/mithaq/`, or `node_modules/mithaq/` where the package manager hoists it to the root: every kind and rule is in its `docs/packages/mithaq/README.md`, and `mithaq migrate` in its `docs/packages/mithaq/src/asas/cli/README.md`.
|
|
9
|
+
|
|
10
|
+
1. Edit `fields` in the kayan's file. A kind or rule the language does not hold changes the vocabulary: stop and ask the developer.
|
|
11
|
+
2. A new `required` field on a table with rows needs a literal `defaultValue`, or goes in without `required` and becomes required in a later migration.
|
|
12
|
+
3. Add the field to the pages that should draw it, and to the roles' grants when they list fields one by one (`<kayan>.fields.<field>`).
|
|
13
|
+
4. From `packages/asas/`, with `DATABASE_URL` pointing at a database built from the migrations (never a pushed one; `AGENTS.md` "Migrations" says how to build one):
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
bunx mithaq generate screens # when a page draws it
|
|
17
|
+
bunx mithaq generate messages # then fill every empty translation
|
|
18
|
+
bunx mithaq migrate --name <slug>
|
|
19
|
+
bunx mithaq generate --check
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
5. When `mithaq migrate` stops and asks for an answer in `mithaq.hints.json`, it is a rename or a drop. A drop deletes rows: ask the developer before you answer it.
|
|
23
|
+
6. From the project root, `bunx --package typescript tsc -p .` and the same with `-p` naming each app.
|
|
24
|
+
|
|
25
|
+
Commit the migration folder.
|
|
26
|
+
|
|
27
|
+
In a project made with `--layout single`, read each path as `AGENTS.md` maps it; the installed mithaq is `node_modules/mithaq/`.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: add-kayan
|
|
3
|
+
description: Add a kayan, one data type with its table, operations, access and admin pages, to this mithaq project. Use when asked for a new entity, table, resource or list in the dashboard.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Add a kayan
|
|
7
|
+
|
|
8
|
+
The steps are "Adding a kayan" in `AGENTS.md`, and the guide's worked example is "Add a kayan" in `README.md`. The installed mithaq is `packages/asas/node_modules/mithaq/`, or `node_modules/mithaq/` where the package manager hoists it to the root; its `docs/packages/mithaq/README.md` lists every kind and rule a field can take.
|
|
9
|
+
|
|
10
|
+
1. Ask, unless the request says: does each row belong to one organization (place `organization`, the usual answer) or does every organization share it?
|
|
11
|
+
2. Follow `AGENTS.md` "Adding a kayan", copying `packages/features/tags/`. Use only the kinds and rules the language holds; a new one changes the vocabulary, so stop and ask the developer.
|
|
12
|
+
3. Grant its keys to the roles that use it, as step 4 there says. A kayan no role is granted answers no one.
|
|
13
|
+
4. From `packages/asas/`, with `DATABASE_URL` pointing at a database built from the migrations (never a pushed one; `AGENTS.md` "Migrations" says how to build one):
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
bunx mithaq generate screens # when a screen draws it
|
|
17
|
+
bunx mithaq generate messages # then fill every empty translation
|
|
18
|
+
bunx mithaq migrate --name add_<name>
|
|
19
|
+
bunx mithaq generate --check
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
5. From the project root, `bunx --package typescript tsc -p .` and `bunx --package typescript tsc -p apps/asas-tanstack` (and `apps/asas-backoffice` when the project has it).
|
|
23
|
+
|
|
24
|
+
Commit the migration folder. Never edit a file whose first line reads ``// Written by `mithaq <command>` ``; run the command again.
|
|
25
|
+
|
|
26
|
+
In a project made with `--layout single`, read each path as `AGENTS.md` maps it; the installed mithaq is `node_modules/mithaq/`.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: eject-admin-piece
|
|
3
|
+
description: Change how the admin draws something in this mithaq project, by replacing a control, cell or node in the components map or by ejecting a mithaq-admin piece. Use when asked to restyle or change an admin control, list, form, shell or page piece.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Change an admin piece
|
|
7
|
+
|
|
8
|
+
The installed mithaq is `packages/asas/node_modules/mithaq/`, or `node_modules/mithaq/` where the package manager hoists it to the root. The guide is the admin's, its `docs/packages/mithaq-admin/README.md` ("Add or replace a control", "Replace a node", "Eject a piece"), and `eject` in its `docs/packages/mithaq/src/asas/cli/README.md`.
|
|
9
|
+
|
|
10
|
+
1. Reach for the components map first: a control, a cell or a node is replaced in the app's `src/components.ts` without ejecting anything.
|
|
11
|
+
2. Otherwise eject the piece, in the app that draws it (`apps/asas-tanstack` or `apps/asas-backoffice`):
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
bunx mithaq eject <item> # an unknown name lists every item
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
It writes the piece into `src/components/mithaq/`, drawn in place of the package's, and names any shadcn primitive or npm package to add. Restart the dev server.
|
|
18
|
+
3. Edit the ejected file in place; it is the project's now. Keep its last line, the `// mithaq-admin` marker, which `upgrade --check` reads.
|
|
19
|
+
4. Check, in the app:
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
bunx mithaq upgrade --check # the held files against the installed mithaq-admin
|
|
23
|
+
bunx --package typescript tsc -p .
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
To go back to the package's piece, delete the file, or run `bunx mithaq eject --prune`, which deletes every ejected file nobody edited.
|
|
27
|
+
|
|
28
|
+
In a project made with `--layout single`, read each path as `AGENTS.md` maps it; the installed mithaq is `node_modules/mithaq/`.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: upgrade-mithaq
|
|
3
|
+
description: Upgrade this project to a newer mithaq and mithaq-admin. Use when asked to update or upgrade mithaq, or when the installed version is behind the one a task needs.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Upgrade mithaq
|
|
7
|
+
|
|
8
|
+
Run each command from the project root. The installed mithaq, `$M` below, is `packages/asas/node_modules/mithaq/`, or `node_modules/mithaq/` where the package manager hoists it to the root, as in a project made with `--layout single`; each block finds it first.
|
|
9
|
+
|
|
10
|
+
1. Before you install, save the developer's own edits to the skills this version shipped. Skip this when `$M/skills` does not exist: that version shipped none.
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
M=packages/asas/node_modules/mithaq; [ -d "$M" ] || M=node_modules/mithaq
|
|
14
|
+
ls "$M/skills" > /tmp/mithaq-shipped-skills
|
|
15
|
+
for skill in $(cat /tmp/mithaq-shipped-skills); do diff -ru "$M/skills/$skill" ".claude/skills/$skill"; done > /tmp/mithaq-skill-edits.diff
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
2. Set `mithaq` and `mithaq-admin` to the same new version in every `package.json` that names them (`npm:@drhomet/mithaq@<version>` and `npm:@drhomet/mithaq-admin@<version>`), and install.
|
|
19
|
+
3. Read "Upgrading" in the new version's project guide, `$M/docs/templates/asas/README.md`: it says what a project made before each round changes. Apply every note for the rounds since this project's version, in order. A note that changes the vocabulary or drops data needs the developer's word first.
|
|
20
|
+
4. Replace the shipped skills with the new version's. A skill the old version shipped and the new one does not is deleted; a skill the developer wrote, which no version shipped, is left alone.
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
M=packages/asas/node_modules/mithaq; [ -d "$M" ] || M=node_modules/mithaq
|
|
24
|
+
for skill in $(cat /tmp/mithaq-shipped-skills 2>/dev/null); do rm -rf ".claude/skills/$skill"; done
|
|
25
|
+
mkdir -p .claude/skills && cp -R "$M/skills/." .claude/skills/
|
|
26
|
+
git status --short -- .claude/skills
|
|
27
|
+
git diff -- .claude/skills
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Then put back each of the developer's edits in `/tmp/mithaq-skill-edits.diff` that the new text lost, and ask the developer where an edit no longer fits the new text.
|
|
31
|
+
5. From `packages/asas/`, with `DATABASE_URL` exported, run `bunx mithaq generate --check`. It also checks the lock and the migrations; rerun `generate auth`, `screens` or `messages` as it says.
|
|
32
|
+
6. Run `bunx mithaq upgrade --check` in each folder holding a `components.json`: `packages/mithaq`, `apps/asas-tanstack` and, when the project has it, `apps/asas-backoffice`. Each file it reports as `differs` came from mithaq-admin: diff it against the package's and merge by hand, keeping the project's own edits.
|
|
33
|
+
7. From the project root, `bunx --package typescript tsc -p .` and the same with `-p` naming each app, then build and start each app once.
|
|
34
|
+
|
|
35
|
+
In a project made with `--layout single`, read each path as `AGENTS.md` maps it.
|