@fui-org/fui-cli 1.3.2 β†’ 2.0.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 (111) hide show
  1. package/README.md +19 -3
  2. package/dist/fui-bmg5pnmq.js +379 -0
  3. package/dist/fui.js +1 -1
  4. package/package.json +3 -6
  5. package/skills/fui/SKILL.md +9 -41
  6. package/skills/fui-skill/SKILL.md +95 -225
  7. package/skills/fui-skill/assets/projectdefaultstyle-3.0.css +555 -0
  8. package/skills/fui-skill/assets/projectdefaultstyle.css +207 -235
  9. package/skills/fui-skill/references/INDEX.md +105 -137
  10. package/skills/fui-skill/references/advanced-techniques.md +76 -68
  11. package/skills/fui-skill/references/coding-standards.md +56 -56
  12. package/skills/fui-skill/references/component-design.md +166 -173
  13. package/skills/fui-skill/references/component-quickref.md +61 -60
  14. package/skills/fui-skill/references/component-table.md +128 -117
  15. package/skills/fui-skill/references/components-dialog.md +55 -56
  16. package/skills/fui-skill/references/components-display.md +24 -30
  17. package/skills/fui-skill/references/components-echart.md +186 -261
  18. package/skills/fui-skill/references/components-input.md +72 -96
  19. package/skills/fui-skill/references/controls-patterns.md +196 -342
  20. package/skills/fui-skill/references/controls-styling-vocabulary.md +130 -97
  21. package/skills/fui-skill/references/db-table-design.md +24 -28
  22. package/skills/fui-skill/references/db-workflow.md +191 -390
  23. package/skills/fui-skill/references/default-function.md +169 -128
  24. package/skills/fui-skill/references/design-modes.md +35 -63
  25. package/skills/fui-skill/references/echart-templates.md +204 -196
  26. package/skills/fui-skill/references/fastproject.md +62 -60
  27. package/skills/fui-skill/references/fsheet.md +109 -124
  28. package/skills/fui-skill/references/fullstack-workflow.md +90 -128
  29. package/skills/fui-skill/references/module-data-patterns.md +31 -40
  30. package/skills/fui-skill/references/module-json-anatomy.md +47 -52
  31. package/skills/fui-skill/references/module-structure.md +80 -196
  32. package/skills/fui-skill/references/new-session.md +49 -51
  33. package/skills/fui-skill/references/pdfmake.md +17 -17
  34. package/skills/fui-skill/references/permission-system.md +89 -108
  35. package/skills/fui-skill/references/platform-architecture.md +128 -153
  36. package/skills/fui-skill/references/project-config.md +102 -134
  37. package/skills/fui-skill/references/project-provisioning.md +139 -244
  38. package/skills/fui-skill/references/script-map.md +208 -242
  39. package/skills/fui-skill/references/sql-clr-functions.md +98 -97
  40. package/skills/fui-skill/references/system-design.md +63 -88
  41. package/skills/fui-skill/references/tapi-file-api.md +46 -52
  42. package/skills/fui-skill/references/tapi-permission-patterns.md +51 -53
  43. package/skills/fui-skill/references/tapi-reference.md +132 -207
  44. package/skills/fui-skill/references/tools-registry.md +84 -460
  45. package/skills/fui-skill/references/ui-crosswindow-patterns.md +79 -75
  46. package/skills/fui-skill/references/ui-dialog-patterns.md +98 -72
  47. package/skills/fui-skill/references/ui-layout-patterns.md +26 -26
  48. package/skills/fui-skill/references/ui-patterns.md +71 -83
  49. package/skills/fui-skill/references/ui-screenshot-review.md +63 -62
  50. package/skills/fui-skill/references/ui-table-cell-patterns.md +61 -59
  51. package/skills/fui-skill/references/ui-templates.md +16 -23
  52. package/skills/fui-skill/references/verification.md +236 -246
  53. package/skills/fui-skill/references/watcher-patterns.md +30 -63
  54. package/skills/fui-skill/references/websocket-realtime.md +83 -66
  55. package/skills/fui-skill/scripts/component-3.0.js +298 -131
  56. package/skills/fui-skill/scripts/component.js +277 -271
  57. package/skills/fui-skill/scripts/componentTable-3.0.js +182 -53
  58. package/skills/fui-skill/scripts/componentTable.js +171 -49
  59. package/skills/fui-skill/scripts/defaultfunction-3.0.js +88 -3
  60. package/skills/fui-skill/scripts/defaultfunction.js +88 -3
  61. package/skills/fui-skill/scripts/fsheet.js +38 -0
  62. package/dist/fui-y8an39cn.js +0 -420
  63. package/skills/fui-skill/README.md +0 -112
  64. package/skills/fui-skill/metadata.json +0 -75
  65. package/skills/fui-skill-cli/SKILL.md +0 -139
  66. package/skills/fui-skill-cli/references/INDEX.md +0 -110
  67. package/skills/fui-skill-cli/references/advanced-techniques.md +0 -168
  68. package/skills/fui-skill-cli/references/coding-standards.md +0 -112
  69. package/skills/fui-skill-cli/references/component-design.md +0 -448
  70. package/skills/fui-skill-cli/references/component-quickref.md +0 -78
  71. package/skills/fui-skill-cli/references/component-table.md +0 -248
  72. package/skills/fui-skill-cli/references/components-dialog.md +0 -191
  73. package/skills/fui-skill-cli/references/components-display.md +0 -141
  74. package/skills/fui-skill-cli/references/components-echart.md +0 -316
  75. package/skills/fui-skill-cli/references/components-input.md +0 -335
  76. package/skills/fui-skill-cli/references/controls-patterns.md +0 -701
  77. package/skills/fui-skill-cli/references/controls-styling-vocabulary.md +0 -137
  78. package/skills/fui-skill-cli/references/db-table-design.md +0 -73
  79. package/skills/fui-skill-cli/references/db-workflow.md +0 -288
  80. package/skills/fui-skill-cli/references/default-function.md +0 -425
  81. package/skills/fui-skill-cli/references/design-modes.md +0 -57
  82. package/skills/fui-skill-cli/references/echart-templates.md +0 -489
  83. package/skills/fui-skill-cli/references/fastproject.md +0 -99
  84. package/skills/fui-skill-cli/references/fsheet.md +0 -203
  85. package/skills/fui-skill-cli/references/fullstack-workflow.md +0 -313
  86. package/skills/fui-skill-cli/references/module-data-patterns.md +0 -117
  87. package/skills/fui-skill-cli/references/module-json-anatomy.md +0 -132
  88. package/skills/fui-skill-cli/references/module-structure.md +0 -141
  89. package/skills/fui-skill-cli/references/new-session.md +0 -85
  90. package/skills/fui-skill-cli/references/pdfmake.md +0 -60
  91. package/skills/fui-skill-cli/references/permission-system.md +0 -150
  92. package/skills/fui-skill-cli/references/platform-architecture.md +0 -269
  93. package/skills/fui-skill-cli/references/project-config.md +0 -303
  94. package/skills/fui-skill-cli/references/project-provisioning.md +0 -278
  95. package/skills/fui-skill-cli/references/script-map.md +0 -262
  96. package/skills/fui-skill-cli/references/sql-clr-functions.md +0 -225
  97. package/skills/fui-skill-cli/references/system-design.md +0 -89
  98. package/skills/fui-skill-cli/references/tapi-file-api.md +0 -185
  99. package/skills/fui-skill-cli/references/tapi-permission-patterns.md +0 -156
  100. package/skills/fui-skill-cli/references/tapi-reference.md +0 -474
  101. package/skills/fui-skill-cli/references/tools-registry.md +0 -84
  102. package/skills/fui-skill-cli/references/ui-crosswindow-patterns.md +0 -321
  103. package/skills/fui-skill-cli/references/ui-dialog-patterns.md +0 -255
  104. package/skills/fui-skill-cli/references/ui-layout-patterns.md +0 -176
  105. package/skills/fui-skill-cli/references/ui-patterns.md +0 -303
  106. package/skills/fui-skill-cli/references/ui-screenshot-review.md +0 -95
  107. package/skills/fui-skill-cli/references/ui-table-cell-patterns.md +0 -318
  108. package/skills/fui-skill-cli/references/ui-templates.md +0 -22
  109. package/skills/fui-skill-cli/references/verification.md +0 -236
  110. package/skills/fui-skill-cli/references/watcher-patterns.md +0 -163
  111. package/skills/fui-skill-cli/references/websocket-realtime.md +0 -271
@@ -1,132 +0,0 @@
1
- # module.json Anatomy β€” data Β· watch Β· controls Β· set
2
-
3
- > Owns: **the 4 `module.json` blocks (data/watch/controls/set) β€” roles, interaction, structure checklist**. Action/control syntax: [controls-patterns.md](controls-patterns.md).
4
-
5
- `module.json` describes one FUI page with exactly **4 top-level blocks**. Runtime internals: [platform-architecture.md](platform-architecture.md). Battle-tested UI patterns (high priority): [ui-patterns.md](ui-patterns.md).
6
-
7
- ```json
8
- {
9
- "data": [/* state + action */],
10
- "watch": {/* observer β†’ action */},
11
- "controls": [/* layout UI: container > rows > cols */],
12
- "set": {/* override config trang (tùy chọn) */}
13
- }
14
- ```
15
-
16
- Runtime order: `runAction(data)` β†’ `buildModuleUI(controls)` β†’ attach `watch` β†’ merge `set` into page config. All state lives in `vueData`.
17
-
18
- ---
19
-
20
- ## 1. `data` β€” state init + action definitions
21
-
22
- An **array**, processed top to bottom on page load. Three element kinds:
23
-
24
- | Object kind | Recognized by | Effect |
25
- | ------------ | ------------------------------------------------ | ----------------------------------- |
26
- | State init | No action key (`API`/`CALL`/`IF`...) | Creates reactive var in `vueData` |
27
- | Named action | Key = function name, value = action object | Reusable action (invoke via `CALL`) |
28
- | Auto-startup | Standalone `{ "API": ... }` or `{ "CALL": ... }` | **Runs immediately** on load |
29
-
30
- ```json
31
- "data": [
32
- { "dsUser": [], "sGroup": null, "dlUserInfo": false },
33
- {
34
- "getUser": { "API": "SM_Users_SelectByDepGroup", "IN": { "GroupID": "sGroup" }, "OUT": "dsUser" }
35
- },
36
- { "CALL": "getUser" }
37
- ]
38
- ```
39
-
40
- Named actions are callable from `watch`, `controls` or other actions; trailing auto-startup = initial page data.
41
-
42
- Details: `data[]` declaration + value resolution (string/var/backtick/`{{ }}`/deep key, auto-run, named action, `v_old`) β†’ **[module-data-patterns.md](module-data-patterns.md)**; action engine β†’ [controls-patterns.md](controls-patterns.md); real-world data layout β†’ [ui-patterns.md](ui-patterns.md) Β§1–2.
43
-
44
- ---
45
-
46
- ## 2. `watch` β€” state change β†’ run action
47
-
48
- An **object** `{ "varName": action }`; action runs when the var changes.
49
-
50
- ```json
51
- "watch": {
52
- "sGroup": { "CALL": "getUser" },
53
- "sDepartment": { "CALL": "getUser" },
54
- "sModuleID": [ { "CALL": "getSysRight" }, { "CALL": "getFunctionRight" } ]
55
- }
56
- ```
57
-
58
- - **Cascading filter**: one watch per filter dropdown β†’ table reloads on change.
59
- - Multiple actions for one var β†’ use an **array**.
60
- - **`deep-watch`**: tracks nested changes inside object/array (runtime supports the `deep-watch` key).
61
-
62
- Details: [watcher-patterns.md](watcher-patterns.md) (v_old, deep-watch, cascading), [ui-patterns.md](ui-patterns.md) Β§3.
63
-
64
- ---
65
-
66
- ## 3. `controls` β€” UI layout (mandatory grid container > rows > cols)
67
-
68
- An **array** of containers. Runtime builds `container (v-container)` β†’ `rows (v-layout)` β†’ `cols` β†’ each item is a **Control Object**.
69
-
70
- ```json
71
- "controls": [
72
- {
73
- "prop": "fluid grid-list-md",
74
- "rows": [
75
- { "prop": "row", "cols": [ /* Control Objects */ ] }
76
- ]
77
- }
78
- ]
79
- ```
80
-
81
- Control Object keys:
82
-
83
- | Key | Role |
84
- | ----------- | -------------------------------------------------------------------------------------------------------------------------------------- |
85
- | `el` | Tag/component: `div`, `v-*` (Vuetify), `f-*`/`t-*` (FUI), `uc-*` (custom) |
86
- | `attr` | Attributes/directives (`class`, `style`, `v-model`, `v-on:click`) β€” **use `v-on:click`, NOT `@click`** |
87
- | `w` | Column width: `1–12` (grid) or `>= 25` (px, **requires `col: { "class": "shrink" }`**). Never 13–24. Required for every item in `cols` |
88
- | `col` | Wrapping grid column config (`class`, `style`, `v-if`) |
89
- | `innerHTML` | Content: string (supports `{{ }}`) or array of nested Control Objects |
90
-
91
- Mandatory: always start with the grid wrapper; nest via `innerHTML` (array), never `children`; put dialogs in a container with `prop: "hidden-container"`.
92
-
93
- Details: structure & grid β†’ [controls-patterns.md](controls-patterns.md) Β§6; **allowed class/prop/style (don't invent styles)** β†’ [controls-styling-vocabulary.md](controls-styling-vocabulary.md); picking components β†’ [component-quickref.md](component-quickref.md); layout/table/dialog patterns β†’ [ui-patterns.md](ui-patterns.md), [ui-table-cell-patterns.md](ui-table-cell-patterns.md), [ui-dialog-patterns.md](ui-dialog-patterns.md), [ui-layout-patterns.md](ui-layout-patterns.md).
94
-
95
- ---
96
-
97
- ## 4. `set` β€” per-page config override (optional)
98
-
99
- An **object** overriding project config for this page. Runtime merges `project.json` then `set` (module wins) β€” see [platform-architecture.md](platform-architecture.md) Β§2.1.
100
-
101
- ```json
102
- "set": {
103
- "title": "QuαΊ£n lΓ½ sinh viΓͺn",
104
- "menu": false
105
- }
106
- ```
107
-
108
- Declare only fields differing from the project. Common: `title`, `menu: false` (hide header β€” sub-window/landing), `menuLeft` (own sidebar), `apiDomain` (different backend for this page). Normal pages **need no `set`**.
109
-
110
- Full property list: [project-config.md](project-config.md).
111
-
112
- ---
113
-
114
- ## How the 4 blocks interact
115
-
116
- ```
117
- URL ?param ──► vueData[param] (inject trΖ°α»›c khi data chαΊ‘y)
118
- data[] ──► tαΊ‘o state + action, auto-startup fetch
119
- controls ──► bind hai chiều vΓ o state (v-model), gọi action (:action / v-on)
120
- watch ──► state Δ‘α»•i β†’ chαΊ‘y action β†’ cαΊ­p nhαΊ­t state khΓ‘c β†’ UI re-render
121
- set ──► quyαΊΏt Δ‘α»‹nh khung trang (title/menu/apiDomain) bao quanh controls
122
- ```
123
-
124
- Typical loop: user acts on `controls` β†’ state changes β†’ `watch` fires β†’ `API` action in `data` β†’ `OUT` updates state β†’ `controls` re-render.
125
-
126
- ## Checklist
127
-
128
- 1. `data[]`: state first β†’ named actions β†’ `{ "CALL": ... }` auto-startup last
129
- 2. `watch`: every filter/dropdown has a watch β†’ reload
130
- 3. `controls`: start with grid wrapper; `w` on every item; dialogs in `hidden-container`; `v-on:click` not `@click`
131
- 4. `set`: only when the page differs from project defaults
132
- 5. Reference state as `vueData.` in controls/attr; valid JSON (no trailing commas)
@@ -1,141 +0,0 @@
1
- # Module Structure
2
-
3
- > Owns: project/module tree, per-file duties, `_moduleInfo.json`/`mTitle`, `HTMLOnly`, default meta tags. `uc-*.vue` rules: [component-design.md](component-design.md); `module.json` content: [controls-patterns.md](controls-patterns.md). _(Tier A β€” loaded with `fui skill get`.)_
4
-
5
- Use when creating, refactoring or reviewing a module. With workspace access it is the real folder layout; in chat, use it to organize the response without assuming files exist.
6
-
7
- ## Local Structure
8
-
9
- ### Project-level
10
-
11
- ```text
12
- {projectId}/
13
- |-- _projectInfo.json # Project metadata (ProjectID, ProjectName, Framework, etc.)
14
- |-- project.json # Full project config (data/watch/controls/set at project scope)
15
- |-- imports/ # Project-scope import files
16
- | `-- _imports.json # Declared project-level JS/CSS imports
17
- |-- components/ # Project-scope Vue components
18
- | |-- _components.json # Component registry
19
- | `-- uc-*.vue # Project-level custom components
20
- |-- modules/ # All modules in this project
21
- | |-- _modules.json # Module list metadata
22
- | `-- {moduleId}/ # One folder per module (see module-level below)
23
- `-- skills/ # FUI skill files (auto-copied on checkout)
24
- ```
25
-
26
- ### Module-level (`modules/{moduleId}/`)
27
-
28
- ```text
29
- {moduleId}/
30
- |-- _moduleInfo.json # Required: module metadata + mTitle (page title) + HTMLOnly
31
- |-- module.json # Required: data/watch/controls/set (unused when HTMLOnly=true)
32
- |-- script.js # Recommended: helper logic for FUN/EXE/chart/transform
33
- |-- style.css # Optional: module-wide CSS (published via fui module publish css)
34
- |-- header.html # Full <head> content: <link>, <style>, <script> tags
35
- |-- body.html # HTMLOnly=false: supplementary body HTML
36
- | # HTMLOnly=true: entire page content (custom HTML/Vue app)
37
- |-- imports/ # Module-scope import files
38
- | `-- _imports.json # Declared module-level JS/CSS imports
39
- `-- components/ # Optional: custom Vue components
40
- |-- _components.json # Required when using custom components
41
- `-- uc-*.vue # Custom components (prefix uc-)
42
- ```
43
-
44
- Required: `_moduleInfo.json`, `module.json`. Recommended: `script.js`, `imports/_imports.json`. Optional: `header.html`, `body.html`, `style.css`, `components/`.
45
-
46
- ## Chat Without Workspace
47
-
48
- - Present the tree as canonical layout, not actual disk state; return each file in its own labeled code block.
49
- - Ask the user to paste `_moduleInfo.json`, `module.json`, `script.js` or components when a review/patch depends on them. Scope advice to provided files; never invent unseen ones.
50
-
51
- ## File Duties
52
-
53
- **module.json** β€” all runtime config in `data`, `watch`, `controls`, `set`; `controls` inside grid wrapper (`container > rows > cols`); business actions in `data`, triggered by `CALL`. Patterns: [`examples/module-patterns.json`](../examples/module-patterns.json); f-table props/header types: [`examples/f-table-patterns.json`](../examples/f-table-patterns.json).
54
-
55
- **script.js** β€” complex transforms, chart builders, debounce, parsing; expose functions for `FUN`/`EXE` and template helpers. Prefer a reusable function over large inline `EXE`.
56
-
57
- **style.css** β€” module-wide CSS not tied to one component. Publish with `fui module publish css`; an empty file is not auto-cleared by `fui module publish html`. Component-local CSS goes in the component's `<style scoped>`.
58
-
59
- **\_moduleInfo.json** β€” keep `ProjectID`, `ModuleID`, `ModuleName`, `Framework` accurate. `mTitle` is the page title (edit it here; sent as `title` by `fui module publish html`). Read `HTMLOnly` before structuring anything.
60
-
61
- **header.html** β€” inner `<head>` content only (`<link>`, `<style>`, `<script>`, `<meta>`); no wrapper, no `<title>` (use `mTitle`). `HTMLOnly=false`: usually CSS only; server injects framework and project scripts. `HTMLOnly=true`: bring your own runtime β€” read [HTMLOnly=true: no library is embedded](#htmlonlytrue-no-library-is-embedded) first. These meta tags are on every page β€” never repeat them:
62
-
63
- ```html
64
- <meta charset="UTF-8" />
65
- <meta
66
- name="viewport"
67
- content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, viewport-fit=cover"
68
- />
69
- ```
70
-
71
- - No pinch-zoom β†’ fonts/buttons must be readable and tappable at natural size on mobile.
72
- - Vuetify breakpoints follow real device CSS pixels.
73
- - `viewport-fit=cover` β†’ fullscreen/`HTMLOnly` layouts touching top/bottom need `env(safe-area-inset-*)` padding (iOS notch/home indicator).
74
-
75
- **body.html** β€” inner `<body>` content only. `HTMLOnly=false`: supplementary HTML beside the Vue runtime, usually empty. `HTMLOnly=true`: the whole page (plain HTML or own Vue app with own `<div id="app">`/`<v-app>`); FUI's default mount point is hidden. Server and publish command strip `<head>`/`<body>` wrappers.
76
-
77
- **imports/\_imports.json** β€” module-scope JS/CSS imports; entry `{ name, type, contentType, fileID, scope, sort }`. `sort` = load order: new imports use **>= 40** (40, 50, 60…); 1–39 is reserved for system/framework. Project-scope imports live in `{projectId}/imports/_imports.json`.
78
-
79
- **components/\_components.json** β€” registers `uc-*`. Before publish an entry may hold only `comName`; `comID` is server-managed after publish/sync. Never invent `comID`.
80
-
81
- **components/uc-\*.vue** β€” `uc-` prefix, kebab-case. Hold component UI complexity here, not in `module.json`. Contract: props in, emits out, slots to extend. No page-specific API/route logic unless the coupling is intentional and unavoidable. `scoped` does not really scope: prefix every selector with a unique class matching the component name ([component-design.md](component-design.md)). No backtick template strings in `<template>`.
82
-
83
- **\_projectInfo.json** β€” written on checkout (`ProjectID`, `ProjectName`, `GroupName`, `Framework`, `pDomain`, `fetchedAt`). Read-only.
84
-
85
- **project.json** β€” one `data` object of project defaults (`apiDomain`, `login`, `userInfo`, `menu`, `menuLeft`, `menuStyle`, `menuComponent`, `domainSetting`, …). Runtime merges it with `module.json` `set`; module wins, so declare only differences. Fields, menu items, `right` rules: [project-config.md](project-config.md).
86
-
87
- ## Naming
88
-
89
- - Module folder: project's module ID convention.
90
- - Use a component in `module.json` via `el: "uc-..."`, props in `attr` with kebab-case names.
91
-
92
- ## HTMLOnly Mode
93
-
94
- Boolean in `_moduleInfo.json`. **Check it first.**
95
-
96
- - **false (default)**: runtime reads `module.json` and bootstraps Vue; `uc-*.vue` and `script.js` helpers fully supported.
97
- - **true**: `module.json` ignored β€” keep it `data:[], watch:{}, controls:[], set:{}`; FUI `controls`/`data`/`watch` have no effect. `body.html` is the entire page. Use for standalone tools, custom editors, pages needing their own runtime or a non-grid layout.
98
- - **Full-height**: if the menu shows (not `set.menu: false`) it takes a fixed 48px β€” subtract 48px more from any root `height: 100vh` / `calc(100vh - Npx)`. See [project-config.md](project-config.md) Β§menu.
99
-
100
- #### HTMLOnly=true: no library is embedded
101
-
102
- Most common mistake; it shows **no error while writing**, only a blank page after deploy. The server emits just three things:
103
-
104
- 1. this module's imports (`{moduleId}/imports/_imports.json`),
105
- 2. module-level StyleCSS (`style.css` + `<style>` of module-level `uc-*.vue`),
106
- 3. the `moduledata` bundle (`$moduleUI` + `script.js` + module-level components).
107
-
108
- Not embedded, even if the project declares them:
109
-
110
- | Missing | Symptom |
111
- | ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------ |
112
- | Framework V2/V3 β€” `vue.global.min.js`, `vuetify*.js/css`, `fastproject*.js`, `component*.js`, `defaultfunction*.js` | `Vue is not defined`, `<v-btn>` not rendered, no `f-*`/`t-*` |
113
- | jQuery, lodash (`_`), `moment`/`dayjs`, `numeral`, `jquery-confirm` | `$ is not defined`, `_ is not defined` |
114
- | Roboto, Material Design Icons (`mdi-*`) | wrong font, icons as empty boxes |
115
- | `projectdata` bundle β€” `$projectData`, `$projectGroupSetting`, project-level components | `apiDomain`/`menu`/`login` undefined; project `uc-*` unknown |
116
- | Project-level StyleCSS, `projectdefaultstyle.css` | shared project classes gone (incl. `.shrink`) |
117
- | `<div id="fastProjectAPP">` | no mount point β€” build your own root in `body.html` |
118
-
119
- **Declare every needed library in each HTMLOnly module**; project-level declarations do not help. Either:
120
-
121
- - `fui import new` into the module's `imports/_imports.json` with `--sort` >= 40 (see `fui import new --help`) β€” preferred: visible in `fui import list` and the `fui module simulate --render` report; or
122
- - raw `<link>`/`<script>` in `header.html` β€” flexible, but no command lists them.
123
-
124
- **[script-map.md](script-map.md) does not apply here**: its "already bundled, no duplicate CDN" list is for `HTMLOnly=false` only. In HTMLOnly the CDN is required, not a duplicate.
125
-
126
- `fui module simulate --render` renders HTMLOnly modules exactly like production (no framework, projectdata or `#fastProjectAPP`) and warns so; a missing library breaks the screenshot like the real page.
127
-
128
- ## Patterns
129
-
130
- - **A β€” simple**: `_moduleInfo.json`, `module.json`, `script.js`, `imports/_imports.json`; no `components/` unless needed.
131
- - **B β€” dashboard/report (recommended)**: `module.json` filters + action orchestration; `script.js` conversion/chart utils; `components/uc-*.vue` chart/table presentation; `header.html` module/component CSS. Keeps large `module.json` maintainable.
132
- - **C β€” HTMLOnly page**: `_moduleInfo.json` (`HTMLOnly: true`), empty `module.json` skeleton, `header.html` all CSS + JS libraries, `body.html` whole page (plain HTML or self-contained Vue app); `components/`/`script.js` only if needed.
133
-
134
- ## Review Checklist
135
-
136
- 1. `HTMLOnly` checked first (decides which files matter).
137
- 2. false: valid `data/watch/controls/set`? true: `module.json` empty, all content in `body.html`?
138
- 3. Heavy logic in `script.js`, not oversized `EXE`?
139
- 4. Custom UI in `components/uc-*.vue`, registered in `_components.json`?
140
- 5. Imports in `imports/_imports.json`?
141
- 6. `header.html`/`body.html` inner content only (no `<head>`/`<body>`)?
@@ -1,85 +0,0 @@
1
- # Open a New Claude Code CLI Session
2
-
3
- > Owns: **opening another Claude Code CLI session in its own terminal window + resolving its workspace folder**. Talking to running sessions: Β§5. New project setup: [project-provisioning.md](project-provisioning.md).
4
-
5
- User says **"new session" / "phiΓͺn mα»›i" / "cα»­a sα»• mα»›i" / "mở thΓͺm mα»™t session"** β†’ open a new terminal window running Claude Code in the workspace folder.
6
-
7
- **Do not ask or confirm.** Local, overwrites nothing; a wrong window is just closed.
8
-
9
- ---
10
-
11
- ## 1. Folder β€” RESOLVE DYNAMICALLY, never hard-code
12
-
13
- Workspace root differs per machine; **never hard-code an absolute path.** Sources, by priority:
14
-
15
- 1. **User names it** ("open a new session in project X") β†’ use exactly that.
16
- 2. **The `Workspace root:` line** just printed by fui commands (`fui module get`, `fui skill sync`, `fui project sync`…). Most reliable: the workspace actually in use.
17
- 3. **Env var `FUI_MCP_WORKDIR`** β€” `$env:FUI_MCP_WORKDIR` (PowerShell) / `$FUI_MCP_WORKDIR` (bash). Unset β†’ default `~/.fui-mcp/workspaces`.
18
-
19
- None yields a folder β†’ **ask the user**, don't guess.
20
-
21
- Session for **one project** β†’ `{workspaceRoot}/{projectId}`; general work β†’ `{workspaceRoot}` itself.
22
-
23
- ---
24
-
25
- ## 2. Command per OS
26
-
27
- **Windows (PowerShell)** β€” most common:
28
-
29
- ```powershell
30
- powershell -Command "Start-Process powershell -ArgumentList '-NoExit', '-Command', 'cd ''<THƯ-MỀC>''; claude --rc'"
31
- ```
32
-
33
- **macOS:**
34
-
35
- ```bash
36
- osascript -e 'tell app "Terminal" to do script "cd \"<THƯ-MỀC>\" && claude --rc"'
37
- ```
38
-
39
- **Linux** (swap `gnome-terminal` for the terminal in use):
40
-
41
- ```bash
42
- gnome-terminal -- bash -c 'cd "<THƯ-MỀC>" && claude --rc; exec bash'
43
- ```
44
-
45
- Team default is **`claude --rc`**. If the user gives other flags (`-c`, `-r`, `--resume <id>`…) or an opening prompt, substitute them.
46
-
47
- ---
48
-
49
- ## 3. Verify before reporting success
50
-
51
- The open command **returns immediately** β€” "finished" does NOT mean the session opened. Check once more:
52
-
53
- ```powershell
54
- Get-Process powershell -ErrorAction SilentlyContinue | Sort-Object StartTime -Descending |
55
- Select-Object -First 3 Id, StartTime, MainWindowTitle | Format-Table -AutoSize
56
- ```
57
-
58
- ```bash
59
- ps -eo pid,lstart,args | grep -i "[c]laude" | tail -3
60
- ```
61
-
62
- Report **PID + folder**. No new process β‡’ say it failed; **never report success** (the user would hunt for a nonexistent window).
63
-
64
- ---
65
-
66
- ## 4. Rules
67
-
68
- **The user's flags are right; do NOT verify them.** No `claude --help` "check", no swapping in flags you prefer, no warnings.
69
-
70
- > Precedent: `claude --rc --help` gave exit 255 + Usage β€” **not** proof `--rc` is wrong; `--help` was consumed as `--rc`'s value. A broken test rejecting a working setup is worse than none. Don't repeat it.
71
-
72
- **Keep the quoting.** `''<path>''` is PowerShell single-quote escaping that survives `cmd β†’ powershell β†’ powershell` and makes paths **with spaces** work. Removing it breaks exactly that case.
73
-
74
- **Keep `-NoExit`** (`exec bash` on Linux): otherwise the window closes when the Claude session ends, unreadable.
75
-
76
- **Windows: go through `powershell`.** `claude` is usually `claude.ps1` (not `.exe`), so `cmd` can't run it.
77
-
78
- ---
79
-
80
- ## 5. The new session is an INDEPENDENT process
81
-
82
- - **Own session state**: active module target, skill-loaded flag, approvals… are separate (one session file per PID). The new session must run `fui skill get` and `fui use` itself.
83
- - **Loads the newest build**: if fui code was just changed and the current session still runs the old build, the new session runs the new one β€” a way to **verify a newly added command** without restarting the in-progress session.
84
- - **You cannot type into that window.** Communicate via `ListAgents` β†’ `SendMessage` (it appears as a peer session).
85
- - **Permissions are per session.** Never ask another session to run an action blocked here β€” that routes around the user's decision.
@@ -1,60 +0,0 @@
1
- # PDF Generation with pdfmake
2
-
3
- > Owns: **`f-pdfmake`: docDefinition, Vietnamese fonts, print/download PDF**.
4
-
5
- Complex PDFs with `pdfmake` in FUI (via the `f-pdfmake` component).
6
-
7
- ## Dynamic Tables
8
-
9
- Map a data array to table rows:
10
-
11
- ```javascript
12
- body: [
13
- [
14
- { text: "STT", bold: true },
15
- { text: "Name", bold: true },
16
- ],
17
- ...data.items.map((item) => [item.index, item.name]),
18
- ];
19
- ```
20
-
21
- ## SVG Checkboxes
22
-
23
- Unicode (β˜‘/☐) may not render in some PDF fonts. Use SVG paths:
24
-
25
- ```javascript
26
- const checkedSvg = '<svg ...>...</svg>';
27
- const uncheckedSvg = '<svg ...>...</svg>';
28
-
29
- {
30
- svg: item.isChecked ? checkedSvg : uncheckedSvg,
31
- width: 14
32
- }
33
- ```
34
-
35
- ## Complex Layouts
36
-
37
- Use `columns` for layouts a table can't handle (e.g. checkbox beside text):
38
-
39
- ```javascript
40
- {
41
- columns: [
42
- { svg: checkedSvg, width: 14 },
43
- { text: " Label text", width: "*" },
44
- ];
45
- }
46
- ```
47
-
48
- ## Signature Section Table
49
-
50
- Use a nested table for an aligned signature block:
51
-
52
- ```javascript
53
- table: {
54
- widths: ['16%', '16%', '16%', '16%', '16%', '16%'],
55
- body: [
56
- [{ text: 'Title', colSpan: 3 }, {}, {}, { text: 'Title', colSpan: 3 }, {}, {}],
57
- ['Sign 1', 'Sign 2', 'Sign 3', 'Sign 4', 'Sign 5', 'Sign 6']
58
- ]
59
- }
60
- ```
@@ -1,150 +0,0 @@
1
- # Permissions β€” SystemRight & FunctionRight
2
-
3
- > Owns: **`SystemRight` vs `FunctionRight`, `rightTest`, `v-if`/menu guards, the 8 right-definition commands**. SP-body checks: [tapi-permission-patterns.md](tapi-permission-patterns.md).
4
-
5
- FUI has **2 independent right types; neither replaces the other**. Mixing them up is a common bug in `v-if`, menu `right`, and SP checks.
6
-
7
- ## User asks about "permissions"/"rights" β€” mandatory
8
-
9
- Never answer from guesses or previously read code/schema; fetch **live**:
10
-
11
- 1. `fui right system list` + `fui right function list` β†’ **current** definitions (never infer from variable names/old comments).
12
- 2. `fui schema --search <kw>` (`right`/`quyen`/`role`/`permission`/`phanquyen`) β†’ does the project have its **own permission tables**? These differ from `acc.tblSysRight`/`acc.tblFunction` (shared DEFINITION catalog, not per-user assignment). Many projects add assignment tables per module/screen/CRUD op β€” check before concluding "only SystemRight/FunctionRight".
13
- 3. Combine both sources before answering or designing permission logic.
14
-
15
- ## πŸ”΄ A right code must EXIST before guarding with it
16
-
17
- `"v-if": "vueData.user.FunctionRight.includes('42')"` or `"right": {"FunctionRight": ["42"]}` **does not create** 42. Not in the project's `tblFunction` β†’ no user can hold it β†’ `rightTest()` (`_.intersection`) always `false` β†’ **button/menu vanishes, no JS error, no `[Vue warn]`**; only users report "button missing".
18
-
19
- Why it survives verification:
20
-
21
- 1. **Preview lies.** `fui module simulate` and `--render` **grant the preview user exactly the codes scanned from the module** (so menus don't vanish wrongly) β€” invented codes still render. Both check the cache and print `🚨 FunctionRight CHΖ―A ĐƯỒC ĐỊNH NGHΔ¨A…`; **read that line, not just the image**.
22
- 2. **SP can't help.** `@sys_FunctionRight` holds only codes **actually granted**; a missing code never matches.
23
- 3. **Never infer codes from names/old comments.** Only truth: `fui right function list` / `fui right system list`.
24
-
25
- | When | Do |
26
- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
27
- | Start permission work on a project | `fui right function list` + `fui right system list` β€” also writes cache `{projectId}/_db/rights.json` **keyed by `apiName`**, the only thing no-live-call commands can check against. Multi-alias β†’ **run per alias**; never check one alias's entries against another |
28
- | Module/menu needs a missing right | `fui right function new` (or `fui right system new`) **first**, then guard β€” never "create later" |
29
- | After editing a guarded module.json | `fui module validate` β€” codes missing from cache β†’ **warning** with a ready-to-copy `fui right function new` command |
30
-
31
- `fui module validate` reads local files only: **no `fui right * list` run yet β†’ no cache, and it says it cannot check** instead of silently passing. `SystemRight 9` (Project Admin) is a platform constant β€” always valid, never warned.
32
-
33
- ## The 2 types
34
-
35
- | | `SystemRight` | `FunctionRight` |
36
- | ------------------ | ------------------------------------------------------------------ | -------------------------------------------------------- |
37
- | **Nature** | User's **rank** in a project | **Per-function** permission |
38
- | **Type** | One integer `0–9` | Code array (string[]) |
39
- | **Answers** | "Who are you?" (Users, Managers, Administrators, Project Admin...) | "What may you do?" (view report, order, pay...) |
40
- | **Defined in** | `tblSysRight` β€” project-set `Note` (rank name) per level | `tblFunction` β€” `FunctionCode` (number) + `FunctionName` |
41
- | **Assigned** | Exactly 1 level per project | 0..N codes, independent of rank |
42
- | **Client runtime** | `vueData.user.SystemRight` (number) | `vueData.user.FunctionRight` (string array) |
43
- | **SP-side** | `@sys_SystemRight` | `@sys_FunctionRight` (string like `[10][20]`) |
44
-
45
- `SystemRight` β‰ˆ fixed job title (Staff = 1, Manager = 5, Project Admin = 9). `FunctionRight` β‰ˆ per-person checklist regardless of title (Staff may get "Payment"; a Manager may lack "Delete data").
46
-
47
- - Show/hide a whole UI area by rank (admin area) β†’ `SystemRight`
48
- - Toggle a specific button/flow ("Approve", "Export report") regardless of rank β†’ `FunctionRight`
49
- - Many screens use **both** (AND) β€” see the `right` example in `project-config.md`.
50
-
51
- ## Storage β€” central permission DB (alias `acc`)
52
-
53
- Shared by all FUI projects:
54
-
55
- - **`tblModules`** β€” one row per project, keyed by `APIName` (= project apiName/alias)
56
- - **`tblSysRight`** β€” `SystemRight` levels (0–9) of **one project** + `Note`; `9` always **Project Admin**
57
- - **`tblFunction`** β€” `FunctionRight` definitions (`FunctionCode` + `FunctionName`) of **one project** β€” catalog of assignable functions, not per-user assignment
58
-
59
- > **Assigning** levels/codes to users is a separate admin operation, outside the 8 commands below (they manage **definitions** only).
60
-
61
- ### ⚠️ Not `UserRight` β€” right to EDIT a project in the FUI IDE
62
-
63
- `UserRight` in `tblA_UserProject` is a **second**, similarly named system: right to **edit the project in the FUI IDE**.
64
-
65
- | | `SystemRight` / `FunctionRight` | `UserRight` |
66
- | ------------ | --------------------------------------------- | --------------------------------------------------------------------------- |
67
- | Scope | **Whole app** β€” one level per user | **Per project** |
68
- | Stored in | `acc.tblSysRight` / `acc.tblFunction` | `tblA_UserProject` (FUI platform DB, not `acc`) |
69
- | Runtime read | `vueData.user.SystemRight` / `.FunctionRight` | none β€” FUI IDE only |
70
- | Commands | 8 `fui right …` below | 5 `fui user …` β†’ [project-provisioning.md](project-provisioning.md) Β§Step 6 |
71
-
72
- The FUI IDE _is itself a FUI app_ (project `fp`), so `SystemRight` **on `fp`** is the developer's IDE right. Both axes **AND** (from real SP bodies):
73
-
74
- | IDE operation | Condition |
75
- | ----------------------------------------------------- | ------------------------------------------ |
76
- | Create project (`fui project new`) | `SystemRight >= 3` on `fp` |
77
- | Edit project metadata (`fui project update`) | `SystemRight >= 2` **and** `UserRight > 2` |
78
- | Publish `project.json` (`fui project publish-config`) | `SystemRight >= 2` **and** `UserRight > 2` |
79
- | Create/edit/publish modules (`fui module …`) | `SystemRight >= 2` **and** `UserRight > 1` |
80
-
81
- `UserRight = 3` with `SystemRight = 1` edits nothing, and vice versa. Granting on the wrong axis β†’ "granted but no effect".
82
-
83
- ## Client runtime
84
-
85
- After declaring `userInfo` ([platform-architecture.md](platform-architecture.md)), FUI fetches and sets:
86
-
87
- ```js
88
- vueData.user.SystemRight; // sα»‘, vd: 5
89
- vueData.user.FunctionRight; // mαΊ£ng chuα»—i, vd: ["10", "20"]
90
- ```
91
-
92
- **`v-if`:**
93
-
94
- ```json
95
- { "col": { "v-if": "vueData.user.SystemRight >= 5" } }
96
- { "col": { "v-if": "vueData.user.FunctionRight.includes('10')" } }
97
- ```
98
-
99
- **Menu `right`** ([project-config.md](project-config.md)):
100
-
101
- ```json
102
- "right": { "SystemRight": [1, 2, 5, 9], "FunctionRight": ["10", "20"] }
103
- ```
104
-
105
- - `SystemRight`: `user.SystemRight` must be **in** the array
106
- - `FunctionRight`: `user.FunctionRight` must **share β‰₯1 code** with the array
107
- - Both keys β†’ **AND**
108
-
109
- **`rightTest`** (menu/JS logic):
110
-
111
- ```js
112
- rightTest({ SystemRight: [5, 9], FunctionRight: ["10"] });
113
- ```
114
-
115
- ## SP-side
116
-
117
- tAPI injects `@sys_SystemRight` and `@sys_FunctionRight` into every SP; the client never sends them. **5 SP-body patterns** (access block, 2-tier module admin, `FunctionRight`...): [tapi-permission-patterns.md](tapi-permission-patterns.md).
118
-
119
- ## 8 commands β€” project right definitions
120
-
121
- Operate on `acc` (APIs `SM_SystemRight_Select/Update`, `SM_FunctionRight_Select/Update`) with the dev's **userToken** (granted on `acc`) from the current project's `_db/_connections.json` β€” no extra connection setup. Multi-DB project: token comes from the **connection matching the target `apiName`** (else the default); missing `userToken` there β†’ command fails even if other connections have one. `fui db list` shows which have tokens.
122
-
123
- Create / edit / delete are **three separate commands**: delete is πŸ”΄ irreversible and is never a boolean flag on a normal op. Flags: `fui right system --help`, `fui right function --help`.
124
-
125
- | Command | Role | Main inputs | Safety |
126
- | --------------------------- | ------------------------------------------- | --------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
127
- | `fui right system list` | List `SystemRight` definitions (0–9 + Note) | `apiName?`, `projectId?` | Read-only |
128
- | `fui right system new` | Define a level that **doesn't exist yet** | `sysRight` (0–9), `note?` (≀50 chars, ignored if `sysRight=9`), `apiName?`, `projectId?` | User-chosen key (no auto ID) β†’ checks `SM_SystemRight_Select` first; existing level = **hard error** pointing to `fui right system update` |
129
- | `fui right system update` | **Only edit** an existing level | `sysRight` (**required**, from `list`), `note?`, `apiName?`, `projectId?` | ⚠️ Overwrites the note |
130
- | `fui right system delete` | Delete a level definition | `sysRight` (**required**), `apiName?`, `projectId?` | πŸ”΄ **Server blocks** while any user holds that level |
131
- | `fui right function list` | List `FunctionRight` (FunctionID/Code/Name) | `apiName?`, `projectId?` | Read-only β€” only source of real `functionId` |
132
- | `fui right function new` | Create a `FunctionRight` | `functionCode` (number, unique per project), `functionName?` (≀100 chars), `apiName?`, `projectId?` | Sends `FunctionID: 0` (SP INSERT); server rejects duplicate `functionCode` |
133
- | `fui right function update` | **Only edit** an existing one | `functionId` (**required**, from `list`), `functionCode`, `functionName?`, `apiName?`, `projectId?` | ⚠️ No `?? 0` fallback β€” missing `functionId` errors, never silently creates |
134
- | `fui right function delete` | Delete 1 `FunctionRight` | `functionId` (**required**), `apiName?`, `projectId?` | πŸ”΄ Deletes the function **AND all user assignments** of that code β€” unrecoverable |
135
-
136
- **Rules:**
137
-
138
- 1. Before any `delete` β€” state the consequences and wait for user confirmation.
139
- 2. Create with `new`; edit **requires** the identifier (`functionId` / `sysRight`) from `list` β€” nothing upserts silently.
140
- 3. `apiName`/`projectId` default to the session's active project β€” pass `apiName` for **another** project, or when the project has **several connections** and the right belongs to a non-default alias.
141
- 4. Server checks the caller: Select needs `SystemRight >= 2` on `acc`; Update needs higher, or admin (`9`) of the target project.
142
-
143
- **Platform API** (reference; use the commands):
144
-
145
- ```
146
- POST {apiDomain}/acc/SM_SystemRight_Select { ModuleID | APIName }
147
- POST {apiDomain}/acc/SM_SystemRight_Update { ModuleID | APIName, SysRight, Note, Delete }
148
- POST {apiDomain}/acc/SM_FunctionRight_Select { ModuleID | APIName }
149
- POST {apiDomain}/acc/SM_FunctionRight_Update { FunctionID, ModuleID | APIName, FunctionCode, FunctionName, Delete }
150
- ```