@fui-org/fui-cli 0.1.1 → 0.3.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.
Files changed (212) hide show
  1. package/README.md +18 -3
  2. package/dist/fui.js +160 -43
  3. package/package.json +4 -2
  4. package/skills/fui/SKILL.md +131 -66
  5. package/skills/fui-skill/README.md +112 -0
  6. package/skills/fui-skill/SKILL.md +269 -0
  7. package/skills/fui-skill/assets/projectdefaultstyle.css +518 -0
  8. package/skills/fui-skill/design-md/airbnb/DESIGN.md +545 -0
  9. package/skills/fui-skill/design-md/airbnb/README.md +5 -0
  10. package/skills/fui-skill/design-md/airtable/DESIGN.md +554 -0
  11. package/skills/fui-skill/design-md/airtable/README.md +5 -0
  12. package/skills/fui-skill/design-md/apple/DESIGN.md +562 -0
  13. package/skills/fui-skill/design-md/apple/README.md +5 -0
  14. package/skills/fui-skill/design-md/asu/DESIGN.md +179 -0
  15. package/skills/fui-skill/design-md/asu/README.md +107 -0
  16. package/skills/fui-skill/design-md/binance/DESIGN.md +634 -0
  17. package/skills/fui-skill/design-md/binance/README.md +5 -0
  18. package/skills/fui-skill/design-md/bmw/DESIGN.md +544 -0
  19. package/skills/fui-skill/design-md/bmw/README.md +5 -0
  20. package/skills/fui-skill/design-md/bmw-m/DESIGN.md +503 -0
  21. package/skills/fui-skill/design-md/bmw-m/README.md +5 -0
  22. package/skills/fui-skill/design-md/bugatti/DESIGN.md +454 -0
  23. package/skills/fui-skill/design-md/bugatti/README.md +5 -0
  24. package/skills/fui-skill/design-md/cal/DESIGN.md +542 -0
  25. package/skills/fui-skill/design-md/cal/README.md +5 -0
  26. package/skills/fui-skill/design-md/claude/DESIGN.md +589 -0
  27. package/skills/fui-skill/design-md/claude/README.md +5 -0
  28. package/skills/fui-skill/design-md/clay/DESIGN.md +541 -0
  29. package/skills/fui-skill/design-md/clay/README.md +5 -0
  30. package/skills/fui-skill/design-md/clickhouse/DESIGN.md +544 -0
  31. package/skills/fui-skill/design-md/clickhouse/README.md +5 -0
  32. package/skills/fui-skill/design-md/cohere/DESIGN.md +451 -0
  33. package/skills/fui-skill/design-md/cohere/README.md +5 -0
  34. package/skills/fui-skill/design-md/coinbase/DESIGN.md +570 -0
  35. package/skills/fui-skill/design-md/coinbase/README.md +5 -0
  36. package/skills/fui-skill/design-md/composio/DESIGN.md +506 -0
  37. package/skills/fui-skill/design-md/composio/README.md +5 -0
  38. package/skills/fui-skill/design-md/cursor/DESIGN.md +537 -0
  39. package/skills/fui-skill/design-md/cursor/README.md +5 -0
  40. package/skills/fui-skill/design-md/elevenlabs/DESIGN.md +504 -0
  41. package/skills/fui-skill/design-md/elevenlabs/README.md +5 -0
  42. package/skills/fui-skill/design-md/expo/DESIGN.md +526 -0
  43. package/skills/fui-skill/design-md/expo/README.md +5 -0
  44. package/skills/fui-skill/design-md/ferrari/DESIGN.md +531 -0
  45. package/skills/fui-skill/design-md/ferrari/README.md +5 -0
  46. package/skills/fui-skill/design-md/figma/DESIGN.md +578 -0
  47. package/skills/fui-skill/design-md/figma/README.md +5 -0
  48. package/skills/fui-skill/design-md/framer/DESIGN.md +544 -0
  49. package/skills/fui-skill/design-md/framer/README.md +5 -0
  50. package/skills/fui-skill/design-md/fui/DESIGN.md +532 -0
  51. package/skills/fui-skill/design-md/hashicorp/DESIGN.md +575 -0
  52. package/skills/fui-skill/design-md/hashicorp/README.md +5 -0
  53. package/skills/fui-skill/design-md/ibm/DESIGN.md +550 -0
  54. package/skills/fui-skill/design-md/ibm/README.md +5 -0
  55. package/skills/fui-skill/design-md/intercom/DESIGN.md +546 -0
  56. package/skills/fui-skill/design-md/intercom/README.md +5 -0
  57. package/skills/fui-skill/design-md/kraken/DESIGN.md +125 -0
  58. package/skills/fui-skill/design-md/kraken/README.md +5 -0
  59. package/skills/fui-skill/design-md/lamborghini/DESIGN.md +288 -0
  60. package/skills/fui-skill/design-md/lamborghini/README.md +5 -0
  61. package/skills/fui-skill/design-md/linear.app/DESIGN.md +548 -0
  62. package/skills/fui-skill/design-md/linear.app/README.md +5 -0
  63. package/skills/fui-skill/design-md/lovable/DESIGN.md +298 -0
  64. package/skills/fui-skill/design-md/lovable/README.md +5 -0
  65. package/skills/fui-skill/design-md/mastercard/DESIGN.md +365 -0
  66. package/skills/fui-skill/design-md/mastercard/README.md +5 -0
  67. package/skills/fui-skill/design-md/meta/DESIGN.md +683 -0
  68. package/skills/fui-skill/design-md/meta/README.md +5 -0
  69. package/skills/fui-skill/design-md/minimax/DESIGN.md +746 -0
  70. package/skills/fui-skill/design-md/minimax/README.md +5 -0
  71. package/skills/fui-skill/design-md/mintlify/DESIGN.md +852 -0
  72. package/skills/fui-skill/design-md/mintlify/README.md +5 -0
  73. package/skills/fui-skill/design-md/miro/DESIGN.md +825 -0
  74. package/skills/fui-skill/design-md/miro/README.md +5 -0
  75. package/skills/fui-skill/design-md/mistral.ai/DESIGN.md +773 -0
  76. package/skills/fui-skill/design-md/mistral.ai/README.md +5 -0
  77. package/skills/fui-skill/design-md/mongodb/DESIGN.md +767 -0
  78. package/skills/fui-skill/design-md/mongodb/README.md +5 -0
  79. package/skills/fui-skill/design-md/nike/DESIGN.md +575 -0
  80. package/skills/fui-skill/design-md/nike/README.md +5 -0
  81. package/skills/fui-skill/design-md/notion/DESIGN.md +821 -0
  82. package/skills/fui-skill/design-md/notion/README.md +5 -0
  83. package/skills/fui-skill/design-md/nvidia/DESIGN.md +640 -0
  84. package/skills/fui-skill/design-md/nvidia/README.md +5 -0
  85. package/skills/fui-skill/design-md/ollama/DESIGN.md +539 -0
  86. package/skills/fui-skill/design-md/ollama/README.md +5 -0
  87. package/skills/fui-skill/design-md/opencode.ai/DESIGN.md +521 -0
  88. package/skills/fui-skill/design-md/opencode.ai/README.md +5 -0
  89. package/skills/fui-skill/design-md/pinterest/DESIGN.md +597 -0
  90. package/skills/fui-skill/design-md/pinterest/README.md +5 -0
  91. package/skills/fui-skill/design-md/playstation/DESIGN.md +661 -0
  92. package/skills/fui-skill/design-md/playstation/README.md +5 -0
  93. package/skills/fui-skill/design-md/posthog/DESIGN.md +690 -0
  94. package/skills/fui-skill/design-md/posthog/README.md +5 -0
  95. package/skills/fui-skill/design-md/raycast/DESIGN.md +669 -0
  96. package/skills/fui-skill/design-md/raycast/README.md +5 -0
  97. package/skills/fui-skill/design-md/renault/DESIGN.md +589 -0
  98. package/skills/fui-skill/design-md/renault/README.md +5 -0
  99. package/skills/fui-skill/design-md/replicate/DESIGN.md +616 -0
  100. package/skills/fui-skill/design-md/replicate/README.md +5 -0
  101. package/skills/fui-skill/design-md/resend/DESIGN.md +585 -0
  102. package/skills/fui-skill/design-md/resend/README.md +5 -0
  103. package/skills/fui-skill/design-md/revolut/DESIGN.md +636 -0
  104. package/skills/fui-skill/design-md/revolut/README.md +5 -0
  105. package/skills/fui-skill/design-md/runwayml/DESIGN.md +244 -0
  106. package/skills/fui-skill/design-md/runwayml/README.md +5 -0
  107. package/skills/fui-skill/design-md/sanity/DESIGN.md +357 -0
  108. package/skills/fui-skill/design-md/sanity/README.md +5 -0
  109. package/skills/fui-skill/design-md/sentry/DESIGN.md +551 -0
  110. package/skills/fui-skill/design-md/sentry/README.md +5 -0
  111. package/skills/fui-skill/design-md/shopify/DESIGN.md +516 -0
  112. package/skills/fui-skill/design-md/shopify/README.md +5 -0
  113. package/skills/fui-skill/design-md/slack/DESIGN.md +482 -0
  114. package/skills/fui-skill/design-md/spacex/DESIGN.md +363 -0
  115. package/skills/fui-skill/design-md/spacex/README.md +5 -0
  116. package/skills/fui-skill/design-md/spotify/DESIGN.md +246 -0
  117. package/skills/fui-skill/design-md/spotify/README.md +5 -0
  118. package/skills/fui-skill/design-md/starbucks/DESIGN.md +580 -0
  119. package/skills/fui-skill/design-md/starbucks/README.md +5 -0
  120. package/skills/fui-skill/design-md/stripe/DESIGN.md +487 -0
  121. package/skills/fui-skill/design-md/stripe/README.md +5 -0
  122. package/skills/fui-skill/design-md/supabase/DESIGN.md +462 -0
  123. package/skills/fui-skill/design-md/supabase/README.md +5 -0
  124. package/skills/fui-skill/design-md/superhuman/DESIGN.md +448 -0
  125. package/skills/fui-skill/design-md/superhuman/README.md +5 -0
  126. package/skills/fui-skill/design-md/tesla/DESIGN.md +286 -0
  127. package/skills/fui-skill/design-md/tesla/README.md +5 -0
  128. package/skills/fui-skill/design-md/theverge/DESIGN.md +339 -0
  129. package/skills/fui-skill/design-md/theverge/README.md +5 -0
  130. package/skills/fui-skill/design-md/together.ai/DESIGN.md +633 -0
  131. package/skills/fui-skill/design-md/together.ai/README.md +5 -0
  132. package/skills/fui-skill/design-md/uber/DESIGN.md +636 -0
  133. package/skills/fui-skill/design-md/uber/README.md +5 -0
  134. package/skills/fui-skill/design-md/vercel/DESIGN.md +736 -0
  135. package/skills/fui-skill/design-md/vercel/README.md +5 -0
  136. package/skills/fui-skill/design-md/vodafone/DESIGN.md +538 -0
  137. package/skills/fui-skill/design-md/vodafone/README.md +5 -0
  138. package/skills/fui-skill/design-md/voltagent/DESIGN.md +521 -0
  139. package/skills/fui-skill/design-md/voltagent/README.md +5 -0
  140. package/skills/fui-skill/design-md/warp/DESIGN.md +526 -0
  141. package/skills/fui-skill/design-md/warp/README.md +5 -0
  142. package/skills/fui-skill/design-md/webflow/DESIGN.md +588 -0
  143. package/skills/fui-skill/design-md/webflow/README.md +5 -0
  144. package/skills/fui-skill/design-md/wired/DESIGN.md +497 -0
  145. package/skills/fui-skill/design-md/wired/README.md +5 -0
  146. package/skills/fui-skill/design-md/wise/DESIGN.md +544 -0
  147. package/skills/fui-skill/design-md/wise/README.md +5 -0
  148. package/skills/fui-skill/design-md/x.ai/DESIGN.md +465 -0
  149. package/skills/fui-skill/design-md/x.ai/README.md +5 -0
  150. package/skills/fui-skill/design-md/zapier/DESIGN.md +537 -0
  151. package/skills/fui-skill/design-md/zapier/README.md +5 -0
  152. package/skills/fui-skill/examples/component.vue +162 -0
  153. package/skills/fui-skill/examples/f-table-patterns.json +331 -0
  154. package/skills/fui-skill/examples/module-patterns.json +973 -0
  155. package/skills/fui-skill/examples/project-patterns.json +222 -0
  156. package/skills/fui-skill/metadata.json +75 -0
  157. package/skills/fui-skill/references/INDEX.md +144 -0
  158. package/skills/fui-skill/references/advanced-techniques.md +160 -0
  159. package/skills/fui-skill/references/coding-standards.md +112 -0
  160. package/skills/fui-skill/references/component-design.md +455 -0
  161. package/skills/fui-skill/references/component-quickref.md +77 -0
  162. package/skills/fui-skill/references/component-table.md +276 -0
  163. package/skills/fui-skill/references/components-dialog.md +192 -0
  164. package/skills/fui-skill/references/components-display.md +147 -0
  165. package/skills/fui-skill/references/components-echart.md +391 -0
  166. package/skills/fui-skill/references/components-input.md +359 -0
  167. package/skills/fui-skill/references/controls-patterns.md +847 -0
  168. package/skills/fui-skill/references/controls-styling-vocabulary.md +140 -0
  169. package/skills/fui-skill/references/db-table-design.md +77 -0
  170. package/skills/fui-skill/references/db-workflow.md +504 -0
  171. package/skills/fui-skill/references/default-function.md +415 -0
  172. package/skills/fui-skill/references/design-modes.md +85 -0
  173. package/skills/fui-skill/references/echart-templates.md +481 -0
  174. package/skills/fui-skill/references/fastproject.md +97 -0
  175. package/skills/fui-skill/references/fsheet.md +218 -0
  176. package/skills/fui-skill/references/fullstack-workflow.md +351 -0
  177. package/skills/fui-skill/references/module-data-patterns.md +126 -0
  178. package/skills/fui-skill/references/module-json-anatomy.md +137 -0
  179. package/skills/fui-skill/references/module-structure.md +260 -0
  180. package/skills/fui-skill/references/new-session.md +108 -0
  181. package/skills/fui-skill/references/pdfmake.md +60 -0
  182. package/skills/fui-skill/references/permission-system.md +169 -0
  183. package/skills/fui-skill/references/platform-architecture.md +294 -0
  184. package/skills/fui-skill/references/project-config.md +335 -0
  185. package/skills/fui-skill/references/project-provisioning.md +383 -0
  186. package/skills/fui-skill/references/script-map.md +296 -0
  187. package/skills/fui-skill/references/sql-clr-functions.md +224 -0
  188. package/skills/fui-skill/references/system-design.md +116 -0
  189. package/skills/fui-skill/references/tapi-file-api.md +191 -0
  190. package/skills/fui-skill/references/tapi-permission-patterns.md +158 -0
  191. package/skills/fui-skill/references/tapi-reference.md +549 -0
  192. package/skills/fui-skill/references/tools-registry.md +460 -0
  193. package/skills/fui-skill/references/ui-crosswindow-patterns.md +317 -0
  194. package/skills/fui-skill/references/ui-dialog-patterns.md +229 -0
  195. package/skills/fui-skill/references/ui-layout-patterns.md +176 -0
  196. package/skills/fui-skill/references/ui-patterns.md +315 -0
  197. package/skills/fui-skill/references/ui-screenshot-review.md +94 -0
  198. package/skills/fui-skill/references/ui-table-cell-patterns.md +316 -0
  199. package/skills/fui-skill/references/ui-templates.md +29 -0
  200. package/skills/fui-skill/references/verification.md +246 -0
  201. package/skills/fui-skill/references/watcher-patterns.md +196 -0
  202. package/skills/fui-skill/references/websocket-realtime.md +254 -0
  203. package/skills/fui-skill/scripts/component-3.0.js +2549 -0
  204. package/skills/fui-skill/scripts/component.js +3142 -0
  205. package/skills/fui-skill/scripts/componentTable-3.0.js +909 -0
  206. package/skills/fui-skill/scripts/componentTable.js +769 -0
  207. package/skills/fui-skill/scripts/defaultfunction-3.0.js +781 -0
  208. package/skills/fui-skill/scripts/defaultfunction.js +966 -0
  209. package/skills/fui-skill/scripts/fastproject-3.0.js +870 -0
  210. package/skills/fui-skill/scripts/fastproject.js +828 -0
  211. package/skills/fui-skill/scripts/fechart.js +890 -0
  212. package/skills/fui-skill/scripts/fsheet.js +1330 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fui-org/fui-cli",
3
- "version": "0.1.1",
3
+ "version": "0.3.0",
4
4
  "description": "Token-lean CLI for the FUI low-code platform, successor to Fui MCP",
5
5
  "keywords": [
6
6
  "ai",
@@ -31,9 +31,11 @@
31
31
  "lint": "oxlint",
32
32
  "format": "oxfmt",
33
33
  "format:check": "oxfmt --check",
34
- "typecheck": "tsc --noEmit"
34
+ "typecheck": "tsc --noEmit",
35
+ "sync:skill": "bun scripts/sync-skill.ts"
35
36
  },
36
37
  "devDependencies": {
38
+ "@fui-org/fui-mcp": "1.4.0",
37
39
  "@types/bun": "latest",
38
40
  "oxfmt": "^0.70.0",
39
41
  "oxlint": "^1.85.0",
@@ -1,109 +1,174 @@
1
1
  ---
2
2
  name: fui
3
- description: Use the `fui` CLI to work with FUI (low-code platform) databases — list DB connections, run SQL, read schema, fetch/edit/deploy stored procedures (tAPI spAPI_*). Use instead of the Fui MCP db_* tools whenever the `fui` command is available.
3
+ description: Use the `fui` CLI for FUI (low-code platform) work — projects, modules (get, validate, preview, publish), components, imports, project users, DB connections, SQL, schema, stored procedures (tAPI spAPI_*), workspace files, publish ledger and history. Prefer it over Fui MCP tools whenever `fui` covers the tool (see the map below); same guards, a fraction of the tokens.
4
4
  ---
5
5
 
6
6
  # fui CLI
7
7
 
8
- `fui` is the shell replacement for the Fui MCP `db_*` tools. Run it with your shell tool. It shares the Fui MCP workspace, so connections added in either tool work in both. `fui config` shows which workspace folder is in use and why.
8
+ `fui` is the shell replacement for Fui MCP tools. Run it with your shell tool. It uses the same workspace, connection files, publish ledger, `_history` and error log as Fui MCP, so you can mix the two during the transition.
9
9
 
10
- ## Output contract
11
-
12
- - stdout carries data only. Query results are TSV with a header row; `NULL` means SQL null; tab, newline and backslash inside cells are escaped as `\t`, `\n`, `\\`.
13
- - stderr carries `# ...` notes (row counts, truncation) and `error: ...` / `guard: ...` messages.
14
- - Add `--json` for compact single-line JSON instead of TSV.
15
- - Exit codes: `0` ok, `1` runtime error (network/SQL), `2` usage error (read the message; it lists valid choices), `3` blocked by a safety guard.
10
+ Domain rules (module.json, controls, tAPI conventions) live in the `fui-skill` skill. Read its `references/` as needed, then run `fui skill loaded`; strict mode (`FUI_MCP_STRICT=1`) blocks deploys until you do.
16
11
 
17
- ## Pick a connection
18
-
19
- ```bash
20
- fui db list # db, engine, default, apiDomain, database, userToken
21
- ```
22
-
23
- - `--db <alias>` or `--db <project>/<alias>`. `-p <project>` or env `FUI_PROJECT` also selects the project.
24
- - With no `--db`: the only connection, else the project default. `sp` commands infer the connection from the object name.
25
- - Writes (`exec`, write SQL in `query`) never fall back to the default when a project has several connections. Pass `--db`.
26
- - Engines come from the token. `mssql` goes through tAPI over HTTPS. `postgres`, `mysql` and `sqlite` connect directly with Bun.SQL. `schema` and `sp` commands are MSSQL-only.
12
+ ## Output contract
27
13
 
28
- ## Read data
14
+ - stdout is data only: TSV with a header when piped, an aligned table in a terminal, `--json` for one-line JSON, `--no-header` to drop the header.
15
+ - stderr carries `# ...` notes and `error:` / `guard:` lines.
16
+ - Exit codes:
17
+ - `0`: ok, including "skipped: unchanged".
18
+ - `1`: runtime error (network or SQL).
19
+ - `2`: usage error. Read the message; it lists the valid choices.
20
+ - `3`: blocked by a guard, or waiting for `--confirm-write`.
21
+
22
+ ## Targets
23
+
24
+ - **Project and module**, first match wins:
25
+ 1. `-p <project> -m <module>`. Passing only one of them is an error.
26
+ 2. The current directory, if it is inside `<workspace>/<project>/modules/<module>/`.
27
+ 3. The session target.
28
+ - **Session:** one per `FUI_SESSION` (default `default`). Parallel agents should each set their own `FUI_SESSION`.
29
+ - **Connection:**
30
+ - `--db <alias>` or `--db <project>/<alias>`.
31
+ - With no `--db`: the only connection, else one inferred from the object name (`sp` commands), else the default.
32
+ - Writes never use the default when a project has several connections.
33
+ - `fui file where` prints what resolved and why.
34
+ - `fui config` shows the workspace and API settings with their sources. They inherit from the Fui MCP entry in `~/.claude.json`.
35
+
36
+ ## Fui MCP tool → fui command
37
+
38
+ Implemented (same guards, same files, same requests as Fui MCP 1.4.0):
39
+
40
+ | MCP tool | fui |
41
+ | --------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
42
+ | session_set / session_read / session_clear / session_resolve | `use <target>` / `use` / `use --clear` / `resolve <target>` |
43
+ | project_list / project_sync | `project list` / `project sync` |
44
+ | project_new / project_update / project_publish_config | `project new --data {…}` / `project update --data {id:…}` / `project publish-config` |
45
+ | project_user_search / list / new / update / delete | `user search <text>` / `user list` / `user add <UserID> --right N` / `user set …` / `user remove <UserID>` |
46
+ | module_list / new / update / delete | `module list` / `module new <id> --name N` / `module update [--new-id] [--framework] …` / `module delete -p P -m M` |
47
+ | module_get / module_get_ui / module_get_html | `module get [<target>]` / `module get-ui` / `module get-html` |
48
+ | module_validate / module_preview | `module validate` / `module preview` |
49
+ | module_publish_html / json / script / css | `module publish html --approval <token>` / `module publish json` / `… script` / `… css` |
50
+ | component_list / get / new / update / delete | `component list` / `component get <name>` / `component new <name>` / `component update <name>` / `component delete <name>` |
51
+ | file_import_list / get / new / update / upload_content / delete | `import list` / `import get <id>` / `import new …` / `import update <id> …` / `import upload <id> -f file` / `import delete <id>` |
52
+ | db_config_read / db_connect | `db list` / `db add <alias> --token - --api-domain host` |
53
+ | db_schema_get / db_schema_read | `schema pull [--prune-local-only]` / `schema [--type T] [--search text]` |
54
+ | db_sp_list / db_sp_get / db_sp_save | `sp list` / `sp get <name> [--print]` / `sp save <name> -f file` |
55
+ | db_sp_deploy / db_sp_help | `sp deploy <name>` / `sp help <name\|Fn> [--full]` |
56
+ | db_sql_execute / db_sql_execute_nonquery | `query "<sql>"` / `exec "<sql>"` (+ `--confirm-write`) |
57
+ | skill_get / skill_reference_get / skill_sync | `skill get` / `skill ref <path...>` / `skill sync` |
58
+ | design_list / design_read | `design list` / `design read <brand>` |
59
+
60
+ Not in fui yet (use the Fui MCP tool): `right_*`, `db_alias_*`, `db_connect_by_name`, `db_sp_verify`, `db_sp_delete`, `db_sp_rename`, `db_token_rebuild`, `db_user_token_set`, `module_outline`, `module_simulate`, `component_preview`, `error_log_*`.
61
+
62
+ ## Modules
63
+
64
+ 1. `fui module get /project/module` (also a live URL or display name).
65
+ - It archives local files that differ, deletes `.vue` files the server no longer has, and makes the module the session target.
66
+ 2. Edit the files in `<workspace>/<project>/modules/<module>/`. Running `fui` from inside that folder targets it.
67
+ 3. `fui module validate`: fix every error; it only reads local files.
68
+ 4. Publish:
69
+ - **Whole module, including header/body:** `fui module preview` → show the changes to the user → after approval `fui module publish html --approval <token>`.
70
+ - The token breaks if any payload file changes after the preview.
71
+ - **One file:** `fui module publish json|script|css`, `fui component update <name>`, or `fui file push <path...>`, which routes each path to the right publisher.
72
+ - Unchanged files are skipped via the publish ledger.
73
+ 5. `fui file status` lists what is still unpublished.
74
+
75
+ `fui remote module --part ui|html|script|css|load|components|imports` and `fui remote project --part config|modules|…` show the server copy without touching the workspace. `fui remote diff <path...>` compares local files with the server.
76
+
77
+ Ask the user before `module delete`, `component delete`, `import delete` and `user remove`.
78
+
79
+ ## Data
29
80
 
30
81
  ```bash
31
82
  fui query "SELECT TOP 20 * FROM tblStudent WHERE ClassID = 5" --db lhu-docs/docs
32
- fui query -f report.sql --limit 0 # --limit 0 = no row cap (default 200)
83
+ fui query -f report.sql --limit 0 # default cap 200 rows; 0 = all
33
84
  echo "SELECT 1 AS x" | fui query -
34
85
  ```
35
86
 
36
- Narrow with `TOP`/`WHERE` before raising `--limit`. Every row costs tokens.
87
+ Narrow with `TOP`/`WHERE` first. Every row you read costs tokens.
37
88
 
38
89
  ## Structure (MSSQL)
39
90
 
40
91
  ```bash
41
- fui schema --filter student # one compact DDL line per table/view/proc
42
- fui schema --procs --filter spAPI_ # only procedures/functions
43
- fui schema pull # refresh cache + local .sql bodies from server
44
- fui sp list --filter Student # name, kind (API, API File, Procedure, Function, local-only), local
92
+ fui schema --search studentid # compact DDL lines; --search matches the whole line (columns, params)
93
+ fui schema --type API --search Student # Table View API "API File" Procedure Function
94
+ fui schema pull # refresh schema.json + every local .sql body
95
+ fui sp list --search Student # columns: db name kind count local
45
96
  ```
46
97
 
47
- Prefer `fui schema` over querying `sys.*` yourself. The cache pulls automatically the first time.
98
+ - With no cache, `schema` fails and tells you to run `fui schema pull`. It never pulls on its own.
99
+ - A `# warning: ... last synced N days ago` note means pull before trusting the names.
100
+ - `schema pull` archives and deletes local `.sql` files whose objects were dropped on the server.
101
+ - It only lists drafts that exist in neither schema. `--prune-local-only` archives those too, but only once the user confirms they are stale.
48
102
 
49
- ## Change stored procedures (MSSQL)
103
+ ## Stored procedures (MSSQL)
50
104
 
51
- 1. `fui sp get spAPI_Student_Select` saves the live body to `_db/<alias>/<name>.sql` and prints the path.
52
- For a new SP: `fui sp path spAPI_New --db <ref>` prints where to create the file.
53
- 2. Edit that file with your file tools. `CREATE` or `ALTER` both work; deploy fixes the verb.
54
- 3. `fui sp deploy spAPI_Student_Select` does all of this:
55
- - archives the live body to `_history/` as the rollback copy
56
- - runs the file
57
- - grants `EXECUTE` to `[public]` for new procedures and verifies the grant
58
- - clears the tAPI parameter cache for `spAPI_*` names
59
- 4. If the output says the grant failed, do **not** redeploy. Run the printed `fui exec "GRANT ..."` line.
105
+ 1. `fui sp get <name>` saves the live body to `_db/<alias>/<name>.sql`. A differing local copy is archived first.
106
+ - For a new SP: `fui sp path <name> --db <ref>`, or `fui sp save <name> -f file.sql --db <ref>`.
107
+ 2. Edit the file. `CREATE` versus `ALTER` does not matter.
108
+ 3. `fui sp deploy <name>`:
109
+ - saves the live body as a rollback copy
110
+ - fixes the verb
111
+ - grants `EXECUTE` to `[public]` on new procedures and checks it
112
+ - clears the tAPI cache
113
+ 4. If the grant failed, do **not** redeploy. Run the printed `fui exec "GRANT ..."`.
60
114
 
61
- `fui sp help spAPI_X` shows the tAPI parameter list and clears its cache without redeploying.
115
+ ## Writes need the user
62
116
 
63
- ## Write data (needs the user)
117
+ - Writes to real data exit `3` until you add `--confirm-write`. That covers `INSERT`, `UPDATE`, `DELETE`, `MERGE` and `TRUNCATE` in `query` or `exec`, and `ALTER TABLE ... ALTER COLUMN`.
118
+ - Add `--confirm-write` **only after the user approved that exact write in chat.**
119
+ - Always blocked, with no flag to unlock them. Show the SQL to the user to run by hand:
120
+ - `DROP TABLE`
121
+ - `ALTER TABLE ... DROP COLUMN` or `SWITCH`
122
+ - `DELETE`/`UPDATE` without `WHERE` in `exec`
123
+ - Never write or call a live API SP "to test" it. Read its body.
124
+
125
+ ## Workspace files (local, no network)
64
126
 
65
127
  ```bash
66
- fui exec "UPDATE tblX SET Status = 1 WHERE ID = 42" --db lhu-docs/docs --confirm-write
128
+ fui file where # workspace, project, module, dirs, and why
129
+ fui file status [--all] # files changed since the last publish/sync, with the command to push each
130
+ fui file history <path> # archived versions in _history, newest first
131
+ fui file restore <path> [--at YYYYMMDD_HHMMSS] # the current file is archived first
132
+ fui file ledger <path...> [--mark|--forget]
67
133
  ```
68
134
 
69
- - Any `INSERT`/`UPDATE`/`DELETE`/`MERGE`/`TRUNCATE` or `ALTER COLUMN` exits `3` until `--confirm-write` is added.
70
- - Add `--confirm-write` **only after the user approved that exact write in chat**. Never add it on your own to get past the guard.
71
- - These are always blocked, with no flag to unlock them: `DROP TABLE`, `ALTER TABLE ... DROP COLUMN`/`SWITCH`, and `DELETE`/`UPDATE` without `WHERE`. Show the SQL to the user to run by hand.
72
- - Never run a write or call a live API SP "to test" it. Read the SP body instead.
135
+ ## Compose with shell
136
+
137
+ Filter and loop in the shell. Piped output costs no tokens.
73
138
 
74
- ## FUI conventions that matter here
139
+ ```bash
140
+ fui sp list --no-header --type API | cut -f2 # API SP names
141
+ fui sp list --no-header | awk -F'\t' '$5=="yes"{print $2}' # SPs with a local copy
142
+ fui schema --type Procedure | grep -i tblStudent | cut -d' ' -f3 # procedures mentioning a word
143
+ fui sp list --no-header --search Student | cut -f2 | xargs -n1 fui sp get
144
+ fui query "SELECT TOP 5 ID, Name FROM tblX" --json | jq -r '.[].Name'
145
+ ```
75
146
 
76
- - tAPI exposes `spAPI_<Fn>` as `/<alias>/<Fn>`, `spAPI_AUTH_<Fn>` as `/<alias>/auth/<Fn>`, and `spAPIFILE_*` for file endpoints. The alias is the connection name.
77
- - tAPI SP parameters must not have default values (`@x int = 0`). Deploy blocks them with exit `3`.
78
- - Signal errors in SPs with `RAISERROR`. Callers read `Message`.
79
- - Every new procedure needs `GRANT EXECUTE ... TO [public]`. Deploy handles it; raw `fui exec CREATE PROCEDURE` does not.
147
+ - Check exit codes. An exit `3` inside a loop means ask the user; do not retry.
148
+ - Never put `--confirm-write` in a loop or `xargs`.
80
149
 
81
- ## Connections and tokens
150
+ ## Connections and secrets
82
151
 
83
152
  ```bash
84
- printf %s "$TOKEN" | fui db add docs -p lhu-docs --token - --api-domain tapi.lhu.edu.vn
85
- fui db add local -p demo --conn-env PG_URL # postgres://user:pass@host/db
86
- fui db add cache -p demo --conn-env SQLITE_URL # sqlite:///abs/path/app.db
153
+ printf %s "$TOKEN" | fui db add docs -p lhu-docs --token - --api-domain tapi.lhu.edu.vn --user-token-env UT
154
+ fui db add local -p demo --conn-env PG_URL # postgres:// mysql:// sqlite:// connect directly
87
155
  fui db default lhu-docs/docs
88
156
  fui db test --db lhu-docs/docs
89
- fui token decode --db lhu-docs/docs # engine, server, database, user (no password)
90
- fui token encode --server S --database D --uid U --pwd-env PWD # Base64 MSSQL dbToken
157
+ fui token decode --db lhu-docs/docs # never shows the password
91
158
  ```
92
159
 
93
- - A dbToken is Base64 of a connection string.
94
- - Secrets are accepted only from stdin (`-`) or `--*-env VAR`. Never echo, log or paste token values.
95
- - `db add` tests with `SELECT 1` before saving (`--no-test` skips the test). The previous `_connections.json` is archived to `_history/`.
160
+ Secrets are accepted only from stdin (`-`) or `--*-env VAR`. Never echo or paste token values.
96
161
 
97
- ## Workspace location
162
+ - Never `cat`, `jq` or otherwise print `_db/_connections.json`, `_db/config.json` or MCP config files. Use `fui db list`, `fui token decode` or `fui config`; they never print secrets.
163
+ - `fui db list` shows a pre-1.4 `_db/config.json` as `engine=legacy`. Migrate it with `fui db import-legacy -p <project>`.
98
164
 
99
- The workspace is picked in this order: `--workdir` flag, then `FUI_MCP_WORKDIR` env, then `fui config set workdir`, then the Fui MCP workdir in `~/.claude.json`, then `~/.fui-mcp/workspaces`.
100
-
101
- ```bash
102
- fui config # effective workdir and its source
103
- fui config set workdir ~/work/fui # persist a custom location
104
- fui config unset workdir
105
- ```
165
+ ## FUI conventions
106
166
 
107
- ## Help
167
+ - tAPI routes:
168
+ - `spAPI_<Fn>` → `/<alias>/<Fn>`
169
+ - `spAPI_AUTH_<Fn>` → `/<alias>/auth/<Fn>`
170
+ - `spAPIFILE_*` → file endpoints
171
+ - tAPI parameters must not have default values (`@x int = 0`). Deploy blocks them.
172
+ - Every new procedure needs `GRANT EXECUTE ... TO [public]`. `sp deploy` does it; raw `exec` only reports it.
108
173
 
109
174
  `fui --help` lists commands. `fui <command> --help` shows usage for one command.
@@ -0,0 +1,112 @@
1
+ # FUI Skill
2
+
3
+ > Agent Skill hỗ trợ AI phát triển web module theo kiến trúc metadata-driven của FUI — nơi giao diện và logic được định nghĩa hoàn toàn bằng JSON.
4
+
5
+ ## ✨ Tổng quan
6
+
7
+ **FUI Skill** cung cấp cho AI agent các hướng dẫn và công cụ để xây dựng FUI web module, bao gồm:
8
+
9
+ - 📐 **Kiến trúc metadata-driven** — Giao diện và logic định nghĩa trong `module.json`
10
+ - 🧱 **Hệ thống grid bắt buộc** — Cấu trúc container > rows > cols nhất quán
11
+ - ⚡ **Action Protocol** — Gọi API, điều kiện, callback theo cách khai báo
12
+ - 🧩 **Template có sẵn** — Form, CRUD table, dialog, Vue component
13
+ - 🔍 **Đảm bảo chất lượng** — Review code và phân tích edge-case tích hợp
14
+ - 🛠️ **Công cụ module** — Lưu và publish module/component qua script
15
+
16
+ ## 📦 Cài đặt
17
+
18
+ ```bash
19
+ npx skills add fui-labs/fui-skill
20
+ ```
21
+
22
+ ## 📁 Cấu trúc thư mục
23
+
24
+ ```
25
+ fui-skill/
26
+ ├── SKILL.md # VĂN BẢN CHÍNH SÁCH: Session Start Protocol, quy tắc cứng,
27
+ │ # cổng quyết định, chuỗi publish. KHÔNG dạy cách làm.
28
+ ├── metadata.json # Manifest (documentation-only)
29
+ ├── examples/ # Template mẫu (module/f-table/project-patterns.json + component.vue)
30
+ ├── references/ # 44 file tài liệu chi tiết (load theo nhu cầu)
31
+ │ ├── INDEX.md # ROUTER: tình huống/component → file cần load (Tier A)
32
+ │ ├── controls-patterns.md # Value resolution, action engine, layout grid, control object (Tier A)
33
+ │ ├── module-structure.md # Cấu trúc file module/project (Tier A)
34
+ │ ├── design-modes.md # App-mode vs Web-mode, {projectId}/DESIGN.md, giới hạn border-radius
35
+ │ ├── controls-styling-vocabulary.md # Bộ class/prop/style được duyệt
36
+ │ ├── script-map.md # Bản đồ script + thư viện đã bundled (đừng thêm CDN trùng)
37
+ │ ├── ui-patterns.md # UI core (+ ui-table-cell / ui-dialog / ui-crosswindow / ui-layout)
38
+ │ ├── components-echart.md # f-echart (+ echart-templates.md)
39
+ │ ├── tapi-reference.md # tAPI core (+ tapi-permission-patterns / tapi-file-api)
40
+ │ ├── permission-system.md # Phân quyền: SystemRight vs FunctionRight, 4 tool quản lý định nghĩa quyền
41
+ │ ├── db-workflow.md # Kết nối DB/SP (+ db-table-design.md)
42
+ │ ├── system-design.md # Thiết kế app nhiều module
43
+ │ └── ... # component-*, verification, tools-registry, ...
44
+ └── scripts/ # Mã nguồn runtime (component.js, componentTable.js, defaultfunction.js, fastproject.js)
45
+ ```
46
+
47
+ > Bản đồ đầy đủ tình huống → file: xem [references/INDEX.md](references/INDEX.md).
48
+
49
+ **Nguyên tắc biên tập — canonical owner:** mỗi sự thật chỉ được viết đầy đủ ở **đúng một file**; nơi
50
+ khác chỉ để link. Mỗi reference mở đầu bằng một dòng `> File này sở hữu: X. Về Y xem <file>.md.` —
51
+ đọc dòng đó để biết nội dung mới thuộc về đâu, đừng viết lại vào `SKILL.md`.
52
+
53
+ ## 🚀 Bắt đầu nhanh
54
+
55
+ Sau khi cài đặt, agent sẽ tự động sử dụng skill này khi bạn yêu cầu **tạo, chỉnh sửa hoặc review FUI module**.
56
+
57
+ ### Tạo module mới
58
+
59
+ > *"Tạo module `user-management` có bảng dữ liệu và dialog thêm/sửa."*
60
+
61
+ Agent sẽ:
62
+ 1. Tạo thư mục module với `module.json`, `_info.json`, `script.js`
63
+ 2. Áp dụng hệ thống grid layout bắt buộc
64
+ 3. Sử dụng Action Protocol để tích hợp API
65
+ 4. Tuân theo coding standards và best practices
66
+
67
+ ### Các khái niệm chính
68
+
69
+ | Khái niệm | Mô tả |
70
+ |:---|:---|
71
+ | **module.json** | File chính định nghĩa `data`, `watch`, `controls`, và `set` |
72
+ | **Action Protocol** | Khai báo action bằng `API`, `IN`, `OUT`, `CALL`, `IF/THEN/ELSE` |
73
+ | **Grid System** | Cấu trúc bắt buộc `container > rows > cols` cho mọi layout |
74
+ | **Control Object** | Phần tử UI được định nghĩa bởi `el`, `attr`, `w`, `col`, `innerHTML` |
75
+
76
+ ### Ví dụ — Lấy dữ liệu bằng Action
77
+
78
+ ```json
79
+ {
80
+ "fetchUsers": {
81
+ "API": "/api/users",
82
+ "IN": { "GroupID": "vueData.selectedGroup" },
83
+ "OUT": "userList",
84
+ "CALLBACK": { "MESS": "Tải thành công!" }
85
+ }
86
+ }
87
+ ```
88
+
89
+ ## 📚 Tài liệu tham khảo
90
+
91
+ | Tài liệu | Mô tả |
92
+ |:---|:---|
93
+ | [INDEX.md](references/INDEX.md) | **Router** — tình huống/component → file cần load |
94
+ | [controls-patterns.md](references/controls-patterns.md) | Action engine, value resolution, layout grid |
95
+ | [module-structure.md](references/module-structure.md) | Cấu trúc file module/project |
96
+ | [ui-patterns.md](references/ui-patterns.md) | UI core (data/watch/toolbar) + các file ui-* tách theo tình huống |
97
+ | [tapi-reference.md](references/tapi-reference.md) | tAPI SP naming, params, response + permission/file-api |
98
+ | [permission-system.md](references/permission-system.md) | Phân quyền: SystemRight (cấp bậc) vs FunctionRight (theo chức năng), 4 tool quản lý định nghĩa quyền |
99
+ | [system-design.md](references/system-design.md) | Thiết kế app nhiều module từ mô tả |
100
+ | [verification.md](references/verification.md) | Review code & checklist definition-of-done |
101
+
102
+ ## 🤝 Đóng góp
103
+
104
+ Skill này là **tài liệu sống**, liên tục được cập nhật. Sau khi hoàn thành các task phức tạp, agent sẽ hỏi:
105
+
106
+ > *"Có bài học, pattern hoặc chỉnh sửa nào từ task này cần bổ sung vào FUI skill không?"*
107
+
108
+ Phản hồi sẽ được tích hợp bằng cách cập nhật hướng dẫn, thêm tài liệu mới, hoặc loại bỏ thông tin lỗi thời — đảm bảo skill luôn phản ánh best practices mới nhất.
109
+
110
+ ## 📄 Giấy phép
111
+
112
+ MIT