@fui-org/fui-cli 2.1.4 → 2.2.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.
Files changed (214) hide show
  1. package/README.md +16 -7
  2. package/dist/fui-xg17j3f9.js +396 -0
  3. package/dist/fui.js +1 -1
  4. package/package.json +1 -1
  5. package/skills/fui/SKILL.md +152 -39
  6. package/skills/{fui-skill → fui}/assets/projectdefaultstyle.css +489 -489
  7. package/skills/{fui-skill → fui}/examples/component.vue +162 -162
  8. package/skills/{fui-skill → fui}/references/INDEX.md +4 -5
  9. package/skills/{fui-skill → fui}/references/advanced-techniques.md +170 -168
  10. package/skills/{fui-skill → fui}/references/component-design.md +2 -2
  11. package/skills/{fui-skill → fui}/references/component-quickref.md +78 -78
  12. package/skills/{fui-skill → fui}/references/component-table.md +287 -287
  13. package/skills/{fui-skill → fui}/references/components-dialog.md +191 -191
  14. package/skills/{fui-skill → fui}/references/components-display.md +141 -141
  15. package/skills/{fui-skill → fui}/references/components-echart.md +316 -316
  16. package/skills/{fui-skill → fui}/references/components-input.md +335 -335
  17. package/skills/{fui-skill → fui}/references/controls-patterns.md +2 -2
  18. package/skills/{fui-skill → fui}/references/controls-styling-vocabulary.md +173 -173
  19. package/skills/{fui-skill → fui}/references/db-workflow.md +9 -9
  20. package/skills/{fui-skill → fui}/references/default-function.md +456 -456
  21. package/skills/{fui-skill → fui}/references/design-modes.md +57 -57
  22. package/skills/{fui-skill → fui}/references/echart-templates.md +489 -489
  23. package/skills/{fui-skill → fui}/references/fastproject.md +99 -99
  24. package/skills/{fui-skill → fui}/references/fullstack-workflow.md +314 -313
  25. package/skills/{fui-skill → fui}/references/module-data-patterns.md +117 -117
  26. package/skills/{fui-skill → fui}/references/module-json-anatomy.md +132 -132
  27. package/skills/{fui-skill → fui}/references/module-structure.md +144 -144
  28. package/skills/{fui-skill → fui}/references/new-session.md +3 -20
  29. package/skills/{fui-skill → fui}/references/pdfmake.md +60 -60
  30. package/skills/{fui-skill → fui}/references/permission-system.md +1 -1
  31. package/skills/{fui-skill → fui}/references/platform-architecture.md +269 -269
  32. package/skills/{fui-skill → fui}/references/project-config.md +303 -303
  33. package/skills/{fui-skill → fui}/references/project-provisioning.md +4 -4
  34. package/skills/{fui-skill → fui}/references/script-map.md +262 -262
  35. package/skills/{fui-skill → fui}/references/sql-clr-functions.md +225 -225
  36. package/skills/{fui-skill → fui}/references/system-design.md +3 -3
  37. package/skills/{fui-skill → fui}/references/tapi-permission-patterns.md +156 -156
  38. package/skills/{fui-skill → fui}/references/tapi-reference.md +474 -474
  39. package/skills/fui/references/tools-registry.md +214 -0
  40. package/skills/{fui-skill → fui}/references/ui-crosswindow-patterns.md +321 -321
  41. package/skills/{fui-skill → fui}/references/ui-dialog-patterns.md +255 -255
  42. package/skills/{fui-skill → fui}/references/ui-layout-patterns.md +176 -176
  43. package/skills/{fui-skill → fui}/references/ui-patterns.md +303 -303
  44. package/skills/{fui-skill → fui}/references/ui-screenshot-review.md +95 -95
  45. package/skills/{fui-skill → fui}/references/ui-table-cell-patterns.md +318 -318
  46. package/skills/{fui-skill → fui}/references/verification.md +18 -18
  47. package/skills/{fui-skill → fui}/references/watcher-patterns.md +163 -163
  48. package/skills/{fui-skill → fui}/references/websocket-realtime.md +271 -271
  49. package/skills/{fui-skill → fui}/scripts/component-3.0.js +2715 -2715
  50. package/skills/{fui-skill → fui}/scripts/component.js +3147 -3147
  51. package/skills/{fui-skill → fui}/scripts/componentTable-3.0.js +1038 -1038
  52. package/skills/{fui-skill → fui}/scripts/componentTable.js +891 -891
  53. package/skills/{fui-skill → fui}/scripts/defaultfunction-3.0.js +866 -866
  54. package/skills/{fui-skill → fui}/scripts/defaultfunction.js +1051 -1051
  55. package/skills/{fui-skill → fui}/scripts/fastproject-3.0.js +870 -870
  56. package/skills/{fui-skill → fui}/scripts/fastproject.js +828 -828
  57. package/dist/fui-h4z7zhk2.js +0 -381
  58. package/skills/fui-skill/SKILL.md +0 -139
  59. package/skills/fui-skill/references/tools-registry.md +0 -84
  60. /package/skills/{fui-skill → fui}/assets/projectdefaultstyle-3.0.css +0 -0
  61. /package/skills/{fui-skill → fui}/design-md/airbnb/DESIGN.md +0 -0
  62. /package/skills/{fui-skill → fui}/design-md/airbnb/README.md +0 -0
  63. /package/skills/{fui-skill → fui}/design-md/airtable/DESIGN.md +0 -0
  64. /package/skills/{fui-skill → fui}/design-md/airtable/README.md +0 -0
  65. /package/skills/{fui-skill → fui}/design-md/apple/DESIGN.md +0 -0
  66. /package/skills/{fui-skill → fui}/design-md/apple/README.md +0 -0
  67. /package/skills/{fui-skill → fui}/design-md/asu/DESIGN.md +0 -0
  68. /package/skills/{fui-skill → fui}/design-md/asu/README.md +0 -0
  69. /package/skills/{fui-skill → fui}/design-md/binance/DESIGN.md +0 -0
  70. /package/skills/{fui-skill → fui}/design-md/binance/README.md +0 -0
  71. /package/skills/{fui-skill → fui}/design-md/bmw/DESIGN.md +0 -0
  72. /package/skills/{fui-skill → fui}/design-md/bmw/README.md +0 -0
  73. /package/skills/{fui-skill → fui}/design-md/bmw-m/DESIGN.md +0 -0
  74. /package/skills/{fui-skill → fui}/design-md/bmw-m/README.md +0 -0
  75. /package/skills/{fui-skill → fui}/design-md/bugatti/DESIGN.md +0 -0
  76. /package/skills/{fui-skill → fui}/design-md/bugatti/README.md +0 -0
  77. /package/skills/{fui-skill → fui}/design-md/cal/DESIGN.md +0 -0
  78. /package/skills/{fui-skill → fui}/design-md/cal/README.md +0 -0
  79. /package/skills/{fui-skill → fui}/design-md/claude/DESIGN.md +0 -0
  80. /package/skills/{fui-skill → fui}/design-md/claude/README.md +0 -0
  81. /package/skills/{fui-skill → fui}/design-md/clay/DESIGN.md +0 -0
  82. /package/skills/{fui-skill → fui}/design-md/clay/README.md +0 -0
  83. /package/skills/{fui-skill → fui}/design-md/clickhouse/DESIGN.md +0 -0
  84. /package/skills/{fui-skill → fui}/design-md/clickhouse/README.md +0 -0
  85. /package/skills/{fui-skill → fui}/design-md/cohere/DESIGN.md +0 -0
  86. /package/skills/{fui-skill → fui}/design-md/cohere/README.md +0 -0
  87. /package/skills/{fui-skill → fui}/design-md/coinbase/DESIGN.md +0 -0
  88. /package/skills/{fui-skill → fui}/design-md/coinbase/README.md +0 -0
  89. /package/skills/{fui-skill → fui}/design-md/composio/DESIGN.md +0 -0
  90. /package/skills/{fui-skill → fui}/design-md/composio/README.md +0 -0
  91. /package/skills/{fui-skill → fui}/design-md/cursor/DESIGN.md +0 -0
  92. /package/skills/{fui-skill → fui}/design-md/cursor/README.md +0 -0
  93. /package/skills/{fui-skill → fui}/design-md/elevenlabs/DESIGN.md +0 -0
  94. /package/skills/{fui-skill → fui}/design-md/elevenlabs/README.md +0 -0
  95. /package/skills/{fui-skill → fui}/design-md/expo/DESIGN.md +0 -0
  96. /package/skills/{fui-skill → fui}/design-md/expo/README.md +0 -0
  97. /package/skills/{fui-skill → fui}/design-md/ferrari/DESIGN.md +0 -0
  98. /package/skills/{fui-skill → fui}/design-md/ferrari/README.md +0 -0
  99. /package/skills/{fui-skill → fui}/design-md/figma/DESIGN.md +0 -0
  100. /package/skills/{fui-skill → fui}/design-md/figma/README.md +0 -0
  101. /package/skills/{fui-skill → fui}/design-md/framer/DESIGN.md +0 -0
  102. /package/skills/{fui-skill → fui}/design-md/framer/README.md +0 -0
  103. /package/skills/{fui-skill → fui}/design-md/fui/DESIGN.md +0 -0
  104. /package/skills/{fui-skill → fui}/design-md/hashicorp/DESIGN.md +0 -0
  105. /package/skills/{fui-skill → fui}/design-md/hashicorp/README.md +0 -0
  106. /package/skills/{fui-skill → fui}/design-md/ibm/DESIGN.md +0 -0
  107. /package/skills/{fui-skill → fui}/design-md/ibm/README.md +0 -0
  108. /package/skills/{fui-skill → fui}/design-md/intercom/DESIGN.md +0 -0
  109. /package/skills/{fui-skill → fui}/design-md/intercom/README.md +0 -0
  110. /package/skills/{fui-skill → fui}/design-md/kraken/DESIGN.md +0 -0
  111. /package/skills/{fui-skill → fui}/design-md/kraken/README.md +0 -0
  112. /package/skills/{fui-skill → fui}/design-md/lamborghini/DESIGN.md +0 -0
  113. /package/skills/{fui-skill → fui}/design-md/lamborghini/README.md +0 -0
  114. /package/skills/{fui-skill → fui}/design-md/linear.app/DESIGN.md +0 -0
  115. /package/skills/{fui-skill → fui}/design-md/linear.app/README.md +0 -0
  116. /package/skills/{fui-skill → fui}/design-md/lovable/DESIGN.md +0 -0
  117. /package/skills/{fui-skill → fui}/design-md/lovable/README.md +0 -0
  118. /package/skills/{fui-skill → fui}/design-md/mastercard/DESIGN.md +0 -0
  119. /package/skills/{fui-skill → fui}/design-md/mastercard/README.md +0 -0
  120. /package/skills/{fui-skill → fui}/design-md/meta/DESIGN.md +0 -0
  121. /package/skills/{fui-skill → fui}/design-md/meta/README.md +0 -0
  122. /package/skills/{fui-skill → fui}/design-md/minimax/DESIGN.md +0 -0
  123. /package/skills/{fui-skill → fui}/design-md/minimax/README.md +0 -0
  124. /package/skills/{fui-skill → fui}/design-md/mintlify/DESIGN.md +0 -0
  125. /package/skills/{fui-skill → fui}/design-md/mintlify/README.md +0 -0
  126. /package/skills/{fui-skill → fui}/design-md/miro/DESIGN.md +0 -0
  127. /package/skills/{fui-skill → fui}/design-md/miro/README.md +0 -0
  128. /package/skills/{fui-skill → fui}/design-md/mistral.ai/DESIGN.md +0 -0
  129. /package/skills/{fui-skill → fui}/design-md/mistral.ai/README.md +0 -0
  130. /package/skills/{fui-skill → fui}/design-md/mongodb/DESIGN.md +0 -0
  131. /package/skills/{fui-skill → fui}/design-md/mongodb/README.md +0 -0
  132. /package/skills/{fui-skill → fui}/design-md/nike/DESIGN.md +0 -0
  133. /package/skills/{fui-skill → fui}/design-md/nike/README.md +0 -0
  134. /package/skills/{fui-skill → fui}/design-md/notion/DESIGN.md +0 -0
  135. /package/skills/{fui-skill → fui}/design-md/notion/README.md +0 -0
  136. /package/skills/{fui-skill → fui}/design-md/nvidia/DESIGN.md +0 -0
  137. /package/skills/{fui-skill → fui}/design-md/nvidia/README.md +0 -0
  138. /package/skills/{fui-skill → fui}/design-md/ollama/DESIGN.md +0 -0
  139. /package/skills/{fui-skill → fui}/design-md/ollama/README.md +0 -0
  140. /package/skills/{fui-skill → fui}/design-md/opencode.ai/DESIGN.md +0 -0
  141. /package/skills/{fui-skill → fui}/design-md/opencode.ai/README.md +0 -0
  142. /package/skills/{fui-skill → fui}/design-md/pinterest/DESIGN.md +0 -0
  143. /package/skills/{fui-skill → fui}/design-md/pinterest/README.md +0 -0
  144. /package/skills/{fui-skill → fui}/design-md/playstation/DESIGN.md +0 -0
  145. /package/skills/{fui-skill → fui}/design-md/playstation/README.md +0 -0
  146. /package/skills/{fui-skill → fui}/design-md/posthog/DESIGN.md +0 -0
  147. /package/skills/{fui-skill → fui}/design-md/posthog/README.md +0 -0
  148. /package/skills/{fui-skill → fui}/design-md/raycast/DESIGN.md +0 -0
  149. /package/skills/{fui-skill → fui}/design-md/raycast/README.md +0 -0
  150. /package/skills/{fui-skill → fui}/design-md/renault/DESIGN.md +0 -0
  151. /package/skills/{fui-skill → fui}/design-md/renault/README.md +0 -0
  152. /package/skills/{fui-skill → fui}/design-md/replicate/DESIGN.md +0 -0
  153. /package/skills/{fui-skill → fui}/design-md/replicate/README.md +0 -0
  154. /package/skills/{fui-skill → fui}/design-md/resend/DESIGN.md +0 -0
  155. /package/skills/{fui-skill → fui}/design-md/resend/README.md +0 -0
  156. /package/skills/{fui-skill → fui}/design-md/revolut/DESIGN.md +0 -0
  157. /package/skills/{fui-skill → fui}/design-md/revolut/README.md +0 -0
  158. /package/skills/{fui-skill → fui}/design-md/runwayml/DESIGN.md +0 -0
  159. /package/skills/{fui-skill → fui}/design-md/runwayml/README.md +0 -0
  160. /package/skills/{fui-skill → fui}/design-md/sanity/DESIGN.md +0 -0
  161. /package/skills/{fui-skill → fui}/design-md/sanity/README.md +0 -0
  162. /package/skills/{fui-skill → fui}/design-md/sentry/DESIGN.md +0 -0
  163. /package/skills/{fui-skill → fui}/design-md/sentry/README.md +0 -0
  164. /package/skills/{fui-skill → fui}/design-md/shopify/DESIGN.md +0 -0
  165. /package/skills/{fui-skill → fui}/design-md/shopify/README.md +0 -0
  166. /package/skills/{fui-skill → fui}/design-md/slack/DESIGN.md +0 -0
  167. /package/skills/{fui-skill → fui}/design-md/spacex/DESIGN.md +0 -0
  168. /package/skills/{fui-skill → fui}/design-md/spacex/README.md +0 -0
  169. /package/skills/{fui-skill → fui}/design-md/spotify/DESIGN.md +0 -0
  170. /package/skills/{fui-skill → fui}/design-md/spotify/README.md +0 -0
  171. /package/skills/{fui-skill → fui}/design-md/starbucks/DESIGN.md +0 -0
  172. /package/skills/{fui-skill → fui}/design-md/starbucks/README.md +0 -0
  173. /package/skills/{fui-skill → fui}/design-md/stripe/DESIGN.md +0 -0
  174. /package/skills/{fui-skill → fui}/design-md/stripe/README.md +0 -0
  175. /package/skills/{fui-skill → fui}/design-md/supabase/DESIGN.md +0 -0
  176. /package/skills/{fui-skill → fui}/design-md/supabase/README.md +0 -0
  177. /package/skills/{fui-skill → fui}/design-md/superhuman/DESIGN.md +0 -0
  178. /package/skills/{fui-skill → fui}/design-md/superhuman/README.md +0 -0
  179. /package/skills/{fui-skill → fui}/design-md/tesla/DESIGN.md +0 -0
  180. /package/skills/{fui-skill → fui}/design-md/tesla/README.md +0 -0
  181. /package/skills/{fui-skill → fui}/design-md/theverge/DESIGN.md +0 -0
  182. /package/skills/{fui-skill → fui}/design-md/theverge/README.md +0 -0
  183. /package/skills/{fui-skill → fui}/design-md/together.ai/DESIGN.md +0 -0
  184. /package/skills/{fui-skill → fui}/design-md/together.ai/README.md +0 -0
  185. /package/skills/{fui-skill → fui}/design-md/uber/DESIGN.md +0 -0
  186. /package/skills/{fui-skill → fui}/design-md/uber/README.md +0 -0
  187. /package/skills/{fui-skill → fui}/design-md/vercel/DESIGN.md +0 -0
  188. /package/skills/{fui-skill → fui}/design-md/vercel/README.md +0 -0
  189. /package/skills/{fui-skill → fui}/design-md/vodafone/DESIGN.md +0 -0
  190. /package/skills/{fui-skill → fui}/design-md/vodafone/README.md +0 -0
  191. /package/skills/{fui-skill → fui}/design-md/voltagent/DESIGN.md +0 -0
  192. /package/skills/{fui-skill → fui}/design-md/voltagent/README.md +0 -0
  193. /package/skills/{fui-skill → fui}/design-md/warp/DESIGN.md +0 -0
  194. /package/skills/{fui-skill → fui}/design-md/warp/README.md +0 -0
  195. /package/skills/{fui-skill → fui}/design-md/webflow/DESIGN.md +0 -0
  196. /package/skills/{fui-skill → fui}/design-md/webflow/README.md +0 -0
  197. /package/skills/{fui-skill → fui}/design-md/wired/DESIGN.md +0 -0
  198. /package/skills/{fui-skill → fui}/design-md/wired/README.md +0 -0
  199. /package/skills/{fui-skill → fui}/design-md/wise/DESIGN.md +0 -0
  200. /package/skills/{fui-skill → fui}/design-md/wise/README.md +0 -0
  201. /package/skills/{fui-skill → fui}/design-md/x.ai/DESIGN.md +0 -0
  202. /package/skills/{fui-skill → fui}/design-md/x.ai/README.md +0 -0
  203. /package/skills/{fui-skill → fui}/design-md/zapier/DESIGN.md +0 -0
  204. /package/skills/{fui-skill → fui}/design-md/zapier/README.md +0 -0
  205. /package/skills/{fui-skill → fui}/examples/f-table-patterns.json +0 -0
  206. /package/skills/{fui-skill → fui}/examples/module-patterns.json +0 -0
  207. /package/skills/{fui-skill → fui}/examples/project-patterns.json +0 -0
  208. /package/skills/{fui-skill → fui}/references/coding-standards.md +0 -0
  209. /package/skills/{fui-skill → fui}/references/db-table-design.md +0 -0
  210. /package/skills/{fui-skill → fui}/references/fsheet.md +0 -0
  211. /package/skills/{fui-skill → fui}/references/tapi-file-api.md +0 -0
  212. /package/skills/{fui-skill → fui}/references/ui-templates.md +0 -0
  213. /package/skills/{fui-skill → fui}/scripts/fechart.js +0 -0
  214. /package/skills/{fui-skill → fui}/scripts/fsheet.js +0 -0
@@ -0,0 +1,214 @@
1
+ # fui commands — safety registry
2
+
3
+ > Owns: **risk class of every command, "which command for which file" publish rules, what users say → command, DB guards enforced in code, the error-log loop**. DB/SP procedure: [db-workflow.md](db-workflow.md); definition of done: [verification.md](verification.md). Flags: `fui <command> --help` (`fui <group> --help` lists a group, e.g. `fui right --help`).
4
+
5
+ Two axes per command:
6
+
7
+ - `R` reads only (touches no byte on disk) / `M` writes the server **or the local workspace**. A command that "only fetches" still **overwrites local files**, which is how unpublished edits get lost; the old copy goes to `_history/` first.
8
+ - ✅ Safe: run freely · ⚠️ Scoped mutation: run when it completes the user's requested module work, otherwise summarize and wait · 🔴 Destructive: full summary, then an explicit yes.
9
+
10
+ **Default:** judge authorization from the user's requested outcome, not only from the command. A request to create, design, fix or update a module authorizes the module's required create/publish/deploy commands after verification. Ask separately for mutations outside that scope, destructive operations and real-data writes. **Per call:** judge the actual input; the same command can be safe or not.
11
+
12
+ If the developer said **do not upload**, **local only**, **draft**, **preview first**, or equivalent, no server-changing module command is authorized until they explicitly approve it later. This instruction overrides the normal completion rule.
13
+
14
+ **Strict mode (`FUI_STRICT=1`)**, for runs nobody reviews step by step: `module publish json|html|script|css`, `component new|update`, `project publish-config` and `sp deploy` are **blocked** until the skill was loaded this session (`fui skill get` / `fui skill ref`), and validator **errors block** publishing module.json. Without it both are warnings.
15
+
16
+ ## Sync before reading
17
+
18
+ Every file fetched from the server (`module.json`, `header.html`, `body.html`, `script.js`, `_moduleInfo.json`, `uc-*.vue`, `project.json`, `_db/{connectionName}/*.sql`…) is a copy from the last checkout; someone may have changed the server since.
19
+
20
+ **Older than 48 hours → refresh before reading or editing**, so you never review a stale copy or publish over newer work. `module validate`, `outline`, `simulate`, `preview`, `schema` and `sp verify` print `warning: ... last synced N days ago ... run: <command>`: run that command first.
21
+
22
+ Each refresh rewrites **every** file in its scope, never one file:
23
+
24
+ | Files | Refreshed by |
25
+ | --------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------- |
26
+ | `module.json`, `header.html`, `body.html`, `script.js`, `_moduleInfo.json`, module-scope `uc-*.vue`, import contents (both scopes) | `fui module get` |
27
+ | project-scope `uc-*.vue` (`{projectId}/components/`) | `fui component get`, or `fui project sync` for all |
28
+ | `project.json`, `_projectInfo.json`, `_modules.json`, `imports/*` (contents too) | `fui project sync` |
29
+ | `_db/{connectionName}/schema.json` and all its `*.sql`, **one connection per call** | `fui schema pull` |
30
+ | one SP | `fui sp get` |
31
+
32
+ **It always overwrites and never asks.** What protects local edits is `{workspace}/_history/`: each file about to be overwritten or deleted is copied there first, same path shape, timestamp in the name:
33
+
34
+ ```
35
+ _history/{projectId}/modules/{moduleId}/module_20260801_143022.json
36
+ _history/{projectId}/_db/{connectionName}/spAPI_X_20260801_143022.sql
37
+ _history/{projectId}/components/uc-abc_20260801_143022_deleted.vue ← deleted, not overwritten
38
+ ```
39
+
40
+ `archived N local file(s) that differed from the server` is a notice, not a question. Bring a copy back with `fui file restore <path>` (`fui file history <path>` lists versions), then publish or deploy as usual. `_history` is never cleaned up automatically.
41
+
42
+ ## What users say → command
43
+
44
+ Users name commands loosely, often in Vietnamese.
45
+
46
+ | User says | Command |
47
+ | ------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------- |
48
+ | "which module is active" / "đang làm module gì" | `fui use` |
49
+ | "switch module" / "chọn module", a pasted module URL or `/project/module` route, or just a module name | `fui use <target>` |
50
+ | "list projects" / "danh sách project" | `fui project list` |
51
+ | "new project from scratch" / "tạo dự án mới", "tạo DB + project FUI mới" | [project-provisioning.md](project-provisioning.md), 6 steps; do not start with `fui project new` |
52
+ | "new database", "register an alias" / "đăng ký alias", "thêm DB vào tAPI" | `fui db alias new` |
53
+ | "let someone edit this project" / "cấp quyền admin project", "thêm người vào project" | `fui user search` → `fui user add` |
54
+ | "who can edit this project" / "ai được sửa project này" | `fui user list` |
55
+ | "update project.json", "edit the project menu" / "sửa menu project" | edit `{projectId}/project.json`, then `fui project publish-config` |
56
+ | "connect the DB but I only know the alias" / "không có dbToken" | `fui db alias list` → `fui db add-by-name` |
57
+ | "sync / refresh the project" / "đồng bộ project", "lấy project.json" | `fui project sync` |
58
+ | "get / pull / clone / refresh the module" / "lấy module về", "pull mới nhất" | `fui module get` |
59
+ | "new module" / "tạo module mới" | `fui module new` |
60
+ | "rename the module", "change its ID / framework" / "đổi tên module" | `fui module update` |
61
+ | "delete the module" / "xóa module" | `fui module delete` |
62
+ | "preview", "diff before upload" / "xem trước", "kiểm tra trước khi up" | `fui module preview` |
63
+ | "validate" / "kiểm tra module.json" | `fui module validate` |
64
+ | "review the layout", "outline" / "review giao diện", "xem layout" | `fui module outline` |
65
+ | "simulate", "test the flow" / "mô phỏng", "chạy thử action" | `fui module simulate` |
66
+ | "render the UI", "screenshot", "check on mobile" / "render giao diện", "xem trên mobile" | `fui module simulate --render` |
67
+ | "push module.json" / "cập nhật module.json" | `fui module publish json` |
68
+ | "push header / body / html" / "up header", "up body", "đẩy lên" | `fui module preview` → `fui module publish html` |
69
+ | "push script" / "up script", "cập nhật script" | `fui module publish script` |
70
+ | "push style / CSS" / "up style", "cập nhật CSS module" | `fui module publish css` |
71
+ | "test the component alone" / "thử component", "component trên mobile" | `fui component preview` |
72
+ | "new component" / "tạo component" | `fui component new` |
73
+ | "push the component" / "up component", "sửa component" | `fui component update` |
74
+ | "sync components" / "sync component" | `fui component list` |
75
+ | "list / sync import files" / "danh sách import file" | `fui import list` |
76
+ | "new SP", "deploy the SP" / "tạo SP mới", "cập nhật SP" | `fui sp save` → `fui sp deploy` |
77
+ | "add a function right" / "thêm quyền chức năng", "tạo FunctionRight" | `fui right function new` |
78
+ | "save the user token" / "lưu user token", "token để gọi API" | `fui db user-token` |
79
+ | "DB password changed" / "đổi password DB", "rebuild dbToken" | `fui db token-rebuild` |
80
+ | "which DBs does this project use" / "project này đang nối những DB nào" | `fui db list` |
81
+ | "connect one more database" / "nối thêm một database nữa" | `fui db add` again with the new apiName |
82
+ | **"sync the db", "refresh schema"** / **"đồng bộ db", "cập nhật schema", "làm mới schema"** | `fui schema pull`, **never `fui project sync`**. No connection yet → ask for the connection details; do not run something else instead |
83
+ | "list designs" / "có style nào" · "use style X" / "dùng style X" | `fui design list` · `fui design read <brand>` |
84
+
85
+ ## Commands
86
+
87
+ ### Session, project, users
88
+
89
+ | Command | R/M | Risk | Notes |
90
+ | ----------------------------------------- | --- | ---- | ----- |
91
+ | `use`, `resolve`, `file where` | R | ✅ | read the target and how it resolved |
92
+ | `use <target>`, `use --clear` | M | ✅ | session target only; no data changes |
93
+ | `project list` | R | ✅ | |
94
+ | `project sync` | M | ✅ | refreshes every project-level file and import content; removes local `.vue`/import files that were tracked and are gone on the server (unpublished new ones are kept) |
95
+ | `project new` | M | ⚠️ | needs `SystemRight >= 3` on `fp`; the server reads **6 fields only** (`ProjectID`, `ProjectName`, `GroupName`, `Framework`, `pDomain`, `Router`). `title`/`login`/`apiDomain`/`menu` are ignored silently: runtime config goes through `project publish-config`. Full procedure: [project-provisioning.md](project-provisioning.md) |
96
+ | `project update` | M | ⚠️ | edits an existing project; `projectData.id` is required (without it the server would create) |
97
+ | `project publish-config` | M | ⚠️ | pushes the local **file** `{projectId}/project.json`; edit the file first. A JSON syntax error is a hard stop (pushing `{}` would wipe menu and settings). Skips when unchanged |
98
+ | `user search`, `user list` | R | ✅ | `user search` is the only source of the exact `UserID`: show its rows and let the user pick. `user list` = who may edit the project in the FUI IDE (`UserRight` 1/2/3), **not** the `acc` `SystemRight` ([permission-system.md](permission-system.md)) |
99
+ | `user add`, `user set` | M | ⚠️ | `add` only for a user with no right, `set` only for one who has it; each hard-errors in the other case. Levels: 1 view · 2 develop · 3 admin |
100
+ | `user remove` | M | 🔴 | revokes the right; summarize and wait for a yes |
101
+
102
+ ### Modules
103
+
104
+ | Command | R/M | Risk | Notes |
105
+ | ------------------------------------------------------- | --- | ---- | ----- |
106
+ | `module list` | R | ✅ | also refreshes the local module cache (`_modules.json`) |
107
+ | `module get` | M | ✅ | rewrites the whole module locally and sets the target; differing local files go to `_history/`; `.vue`/import files the server dropped are removed (`_deleted` copy kept) |
108
+ | `module get-ui`, `module get-html` | M | ✅ | overwrite local `module.json` / `body.html` when the module is checked out. Not read-only |
109
+ | `module new` | M | ⚠️ | creates an **empty** module on the server; confirm id and name first, then `fui module get`. An id already in `_modules.json` is a hard error |
110
+ | `module update` | M | ⚠️ | metadata of an existing module. Changing `ModuleID` changes its URL (old links break) and renames the local folder: warn the user |
111
+ | `module delete` | M | 🔴 | **permanent on the server, no history there**; archives the local folder and clears a matching session target |
112
+ | `module validate`, `module outline`, `module preview` | R | ✅ | `validate` does **not** read `script.js`: an `EXE`/`FUN` calling an unwritten function only shows in `--render` as `... is not defined` ([advanced-techniques.md](advanced-techniques.md) §2). `[design]` warnings must be fixed unless the user asked for that style |
113
+ | `module simulate`, `module check`, `component preview` | R | ✅ | write only `_preview/`, `_componentPreview/` and `_testdata/`; an unmocked read-only API may be called for real ([verification.md](verification.md)) |
114
+ | `module publish json` | M | ⚠️ | **only** module.json; no preview needed |
115
+ | `module publish script`, `module publish css` | M | ⚠️ | an **empty** file clears it on the server; a missing file is refused |
116
+ | `module publish html` | M | ⚠️ | header/body/title **and** module.json; needs the token from `module preview`, which covers the whole payload (any file edited after the preview voids it). Also pushes non-empty `script.js`/`style.css`, and **reconciles `components/*.vue` with the server: a server component with no local file is DELETED** (the preview lists it as `deleted component <name>`) |
117
+
118
+ ### Components
119
+
120
+ | Command | R/M | Risk | Notes |
121
+ | ------------------- | --- | ---- | ----- |
122
+ | `component get` | M | ✅ | prints the source and overwrites the local `.vue` (old copy to `_history/`) |
123
+ | `component list` | M | ✅ | refreshes `_components.json`; removes tracked `.vue` files the server dropped |
124
+ | `component preview` | R | ✅ | one local `.vue` alone in a real browser; works before it is pushed ([component-design.md](component-design.md)) |
125
+ | `component new` | M | ⚠️ | first push. Refreshes `_components.json` from the server **first**; a name that exists is a hard error (a blind insert makes two records with one name) |
126
+ | `component update` | M | ⚠️ | later pushes; hard-errors when the component is not on the server, never creates. Sends `<style scoped>` as `ComCSS` |
127
+ | `component delete` | M | 🔴 | **permanent on the server**; archives the local `.vue` |
128
+
129
+ Scope, for every component command:
130
+
131
+ | Given | Scope |
132
+ | -------------------------------------------------- | --------------------------------- |
133
+ | `-p P -m M` | module `M` |
134
+ | `-p P` only | project (global, loaded everywhere) |
135
+ | nothing, inside a module folder or a module target | that module |
136
+ | nothing, inside a project folder only | project (global) |
137
+
138
+ ### Imports
139
+
140
+ | Command | R/M | Risk | Notes |
141
+ | ----------------------------- | --- | ---- | ----- |
142
+ | `import list` | R | ✅ | with `-p` it also syncs local `_imports.json` (metadata only) and removes orphaned content files |
143
+ | `import get` | R | ✅ | prints one file and writes it to every local `imports/` that declares it |
144
+ | `import new`, `import update` | M | ⚠️ | sort below the scope floor is raised: project ≥ 20, module ≥ 50 (framework uses ~1–10). `update` edits metadata, not the source |
145
+ | `import upload` | M | ⚠️ | overwrites the source on the server and the local copies |
146
+ | `import delete` | M | 🔴 | **permanent**; cleans the local copies |
147
+
148
+ ### Database and rights
149
+
150
+ | Command | R/M | Risk | Notes |
151
+ | ------------------------------------------ | --- | ---- | ----- |
152
+ | `db list`, `db test`, `token decode` | R | ✅ | never print secrets |
153
+ | `db alias list` | R | ✅ | databases your token may manage on `acc`; run it when an alias is unknown or `db add-by-name` finds nothing |
154
+ | `db add`, `db add-by-name` | M | ✅ | test, save, fetch the schema. `add-by-name` borrows a SQL login from a connection on the same `apiDomain`; "not found" means the alias does not exist **or** you may not manage it |
155
+ | `db user-token`, `db default`, `db migrate` | M | ✅ | local only |
156
+ | `db token-rebuild` | M | ⚠️ | overwrites the stored token; `--db` is required when the project has several connections |
157
+ | `db alias new` | M | ⚠️ | registers an existing database as a tAPI alias on `acc`; the login must be the **application** account (execute-only), never a `db_owner` dev login. Ask the user first |
158
+ | `schema`, `sp list`, `sp path`, `sp help`, `sp verify` | R | ✅ | `schema` reads one connection: a "missing" table usually means the wrong connection. `sp list` covers every connection unless `--db`. `sp help` also clears the tAPI cache for that function |
159
+ | `schema pull` | M | ✅ | rewrites `_db/{connectionName}/` of **one** connection, bodies included. Files of procedures dropped on the server are archived. Files in neither schema are only **listed** (maybe an undeployed draft): read that note and ask before `--prune-local-only` |
160
+ | `sp get` | M | ✅ | overwrites `_db/{connectionName}/{name}.sql` (old copy to `_history/`). Not read-only |
161
+ | `sp save` | M | ⚠️ | local only. There is no "create SP" command: a new SP is `sp save` → `sp deploy`; with several connections name `--db` on the first save |
162
+ | `sp rename` | M | ⚠️ | renames on the server and the local file; summarize first |
163
+ | `query` | R/M | ⚠️ | reads and, on the user's request, writes real data. Default cap 200 rows; `TOP 20` to look at structure; no `varbinary(max)`/large `nvarchar(max)` columns |
164
+ | `exec` | R/M | 🔴 | DDL/DML. A `CREATE`/`ALTER PROCEDURE` here gets **no auto-grant and no cache clear**; the output names the command to run next |
165
+ | `sp deploy` | M | ⚠️ | authorized when the SP is part of the requested module work; saves the live definition to `_history/`, fixes CREATE/ALTER, grants and clears the tAPI cache |
166
+ | `sp delete` | M | 🔴 | permanent; always requires explicit approval for the exact SP |
167
+ | `right system list`, `right function list` | R | ✅ | read `acc` and refresh `{projectId}/_db/rights.json`; **until they ran once, validate/simulate/render cannot check right codes** |
168
+ | `right system new/update`, `right function new/update` | M | ⚠️ | create and edit are separate; `update` needs the id from `list` |
169
+ | `right system delete`, `right function delete` | M | 🔴 | `function delete` also removes every user assignment of that code |
170
+
171
+ Guarding with a right code that is not defined fails silently: `rightTest()` is always false, the control vanishes with no JS error, and **the preview still shows it** ([permission-system.md](permission-system.md)).
172
+
173
+ ### Skill, workspace files, maintenance
174
+
175
+ | Command | R/M | Risk | Notes |
176
+ | --------------------------------------------------------------- | --- | ---- | ----- |
177
+ | `skill get`, `skill ref`, `design list`, `design read`, `library` | R | ✅ | `skill get` prints SKILL.md + the router; Tier A files come from `skill ref` |
178
+ | `remote module`, `remote project`, `remote diff` | R | ✅ | server copy, no local writes |
179
+ | `file status`, `file history`, `file ledger` | R | ✅ | `file ledger --mark` only records a file as published; it pushes nothing |
180
+ | `file restore` | M | ✅ | local only; the current file is archived first |
181
+ | `file push` | M | ⚠️ | routes each path to its publisher above; the same rules apply |
182
+ | `log read` | R | ✅ | failures grouped by command and error signature, most frequent first |
183
+ | `log clear` | M | ✅ | after the patterns were folded into the skill |
184
+
185
+ **Error-log loop.** Every failed command is appended to `{workspace}/_logs/tool-errors.jsonl`, except a block that only waits for `--confirm-write`. A group that keeps repeating in `fui log read` is a gap in these references: fix the reference, then `fui log clear`. The `guards that blocked by design` list at the end (DROP TABLE, data-losing ALTER TABLE, DELETE/UPDATE without WHERE) is not a gap.
186
+
187
+ ## Publish: which command for which file
188
+
189
+ - Before publishing module.json: `fui module validate`, fix every error, then `fui module outline` (row widths, dialogs nobody opens, actions nobody calls). For complex runtime logic (action chains, watch cascades, dialog flows) also `fui module simulate` the main flow with asserts.
190
+ - Only `module.json` → `fui module publish json` (no preview needed).
191
+ - `header.html` / `body.html` / title (with or without module.json) → `fui module preview`, review the diff yourself, then `fui module publish html --approval <token>`. It pushes module.json too. A separate approval turn is unnecessary when this publish completes the requested module work; stop if the developer previously asked not to upload or to review first.
192
+ - `script.js` (also to clear it) → `fui module publish script`. `module publish json` does not push it.
193
+ - `style.css` (also to clear it) → `fui module publish css`.
194
+ - `uc-*.vue` → `fui component new <name>` the first time, `fui component update <name>` after. A **project-scope** component must be previewed and pushed **before** rendering a module that uses it: `--render` hard-blocks when the local file differs from the server.
195
+ - Several files changed → one command per file, in turn. `fui file push <path...>` routes each path to its publisher.
196
+
197
+ **Backstop, not a substitute.** Each module keeps a local ledger of content hashes from the last publish/sync. Forgot a file → `module validate` and the publish commands print `unpublished local files: ...`, and `fui file status` lists each with its command. It never blocks a publish. The same ledger skips duplicates: `module publish json|script|css` and `component update` print `skip <file> unchanged since the last publish/sync` and make no request. `module publish html` always pushes.
198
+
199
+ ## Database rules (enforced in code)
200
+
201
+ - `query` / `exec`: say what the SQL does and what data it touches, and wait for the user. Writes (INSERT, UPDATE…SET, DELETE, MERGE, TRUNCATE, `SELECT … INTO` a real table, a write inside `EXEC('…')` or `sp_executesql`, `DROP PROCEDURE`/`FUNCTION`/`VIEW`, ALTER COLUMN) exit 3 until `--confirm-write`, added only after the user approved that exact write. It is a confirmation gate, not an obstacle to work around.
202
+ - Table DDL is judged by data loss, **per statement**: free `ALTER TABLE … ADD` and `DROP CONSTRAINT` · `--confirm-write` for `ALTER COLUMN` (narrowing numeric or date precision loses data silently) · always blocked `DROP TABLE`, `DROP DATABASE`, `DROP COLUMN`, `SWITCH`, `xp_cmdshell` and any action fui cannot parse. A blocked statement wins over a confirmable one. `DELETE`/`UPDATE` without `WHERE` is blocked too, in `query` and `exec` (a `MERGE` is scoped by its `ON`). A `--` or a quote inside a `[name]` or `"name"` does not hide the statements after it. Show blocked SQL for the user to run by hand; no flag unlocks it.
203
+ - Never call a live API SP or run sub-queries "to test" it: read its body (`fui sp get`) and reason, or `fui sp verify <name|Fn>`. `sp verify` calls no endpoint; its only network reads are metadata (`OBJECT_DEFINITION` when no local `.sql`, permissions with `--check-grant`). An unreadable body is a hard error: it never guesses from the name.
204
+ - `--mocks` for an SP that **exists** must be the snippet `fui sp verify` prints, never a guessed shape. On `🚨 UNVERIFIED MOCK SHAPE` stop, run `fui sp verify`, copy the snippet. Invented data is right only for an SP that does not exist yet.
205
+ - `fui sp deploy` asks the server whether the object exists, so `CREATE PROCEDURE` for an existing SP is fine: do not edit the file to `ALTER` and redeploy. tAPI parameters with a default value are hard-blocked.
206
+ - After an `ALTER PROCEDURE` through `exec`, run `fui sp help <name>` once to clear the tAPI cache, or tAPI keeps serving the old signature.
207
+ - Never write `GRANT` into the `.sql` file: tAPI sends one batch without `GO`, so it would become part of the procedure body. `sp deploy` grants new procedures and re-checks; on `lacks EXECUTE` run the printed command, **do not redeploy**.
208
+ - A project can use several databases. `fui db add` stores each in `{projectId}/_db/_connections.json` under a `connectionName` (its `_db/` folder); `apiName` is a separate field, only the route alias, and may repeat across zones. `--db` takes a connectionName (a unique apiName also works); when ambiguous, commands print a menu: pick a line, never guess. Project unclear → ask the user.
209
+ - Secrets only via stdin (`-`) or `--*-env VAR`; never print `_db/_connections.json`.
210
+
211
+ ## Concurrency
212
+
213
+ - Read-only commands can run in parallel.
214
+ - Never in parallel: any 🔴 command, `module publish html` with anything else, two `sp deploy`.