@fui-org/fui-cli 1.0.5 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -116
- package/dist/fui.js +206 -186
- package/package.json +5 -6
- package/skills/fui/SKILL.md +64 -39
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fui-org/fui-cli",
|
|
3
|
-
"version": "1.0
|
|
4
|
-
"description": "Token-lean CLI for the FUI low-code platform, successor to Fui MCP",
|
|
3
|
+
"version": "1.2.0",
|
|
4
|
+
"description": "Token-lean CLI for the FUI low-code platform (Node.js), successor to Fui MCP",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
7
7
|
"bun",
|
|
@@ -23,9 +23,8 @@
|
|
|
23
23
|
"access": "public"
|
|
24
24
|
},
|
|
25
25
|
"scripts": {
|
|
26
|
-
"fui": "bun
|
|
27
|
-
"build": "bun build src/
|
|
28
|
-
"build:bin": "bun build --compile --minify src/cli.ts --outfile dist/fui",
|
|
26
|
+
"fui": "bun run build && node dist/fui.js",
|
|
27
|
+
"build": "bun build src/bin.ts --target node --minify --outfile dist/fui.js",
|
|
29
28
|
"prepack": "bun run build",
|
|
30
29
|
"test": "bun test",
|
|
31
30
|
"lint": "oxlint",
|
|
@@ -52,6 +51,6 @@
|
|
|
52
51
|
}
|
|
53
52
|
},
|
|
54
53
|
"engines": {
|
|
55
|
-
"
|
|
54
|
+
"node": ">=22"
|
|
56
55
|
}
|
|
57
56
|
}
|
package/skills/fui/SKILL.md
CHANGED
|
@@ -1,13 +1,27 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: fui
|
|
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.
|
|
3
|
+
description: Use the `fui` CLI for all FUI (low-code platform) work — projects, modules (get, validate, simulate, preview, publish), components, imports, project users, rights, DB connections, SQL, schema, stored procedures (tAPI spAPI_*), framework library, workspace files, publish ledger and history. Run it in the shell.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# fui CLI
|
|
7
7
|
|
|
8
|
-
`fui` is the
|
|
8
|
+
`fui` is the command-line tool for the FUI low-code platform. Run it with your shell tool.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
## Before you start
|
|
11
|
+
|
|
12
|
+
- FUI has its own conventions (module.json action engine, tAPI SP naming, `f-*` components). They differ from standard Vue/Vuetify/REST, so never rely on training-data assumptions.
|
|
13
|
+
- Before creating, editing, reviewing or deploying any module, component or stored procedure: run `fui skill get`, pick the reference files for your task from `references/INDEX.md`, and load them with `fui skill ref references/<file>.md ...`. The same files are in the `fui-skill` skill.
|
|
14
|
+
- Strict mode (`FUI_STRICT=1`) blocks publishing and deploys until the skill was read this session (`fui skill get`, `fui skill ref` or `fui skill loaded`) and while module.json has validation errors.
|
|
15
|
+
- First use on a machine: `fui config set api-base <url>` and `printf %s "$TOKEN" | fui config set api-token -` (ask the user for both). `fui config` shows what is set.
|
|
16
|
+
|
|
17
|
+
## Working rules
|
|
18
|
+
|
|
19
|
+
- **Build order:** UI first with fake data in `data[]` plus a visual check, then design and deploy the SP contract, then replace the fake data with real API bindings (IN/OUT/CALLBACK).
|
|
20
|
+
- **Check cheapest first:** `module validate` (fix every error) → `module outline` → `module simulate` → `component preview` → `module simulate --render`. Read every screenshot you get and fix what you see in the same turn.
|
|
21
|
+
- **Never call a real API/SP/DML "to test".** Verifying an SP means reading its body (`fui sp verify`). Data edits the user asks for still run, gated by `--confirm-write`.
|
|
22
|
+
- **Create and edit are separate commands** (`new` / `update`); nothing upserts. Editing needs the record id.
|
|
23
|
+
- **Publishing is per file:** edit the local file, then push it. Pushing module.json does not carry script.js along (`module publish json` / `script` / `css` / `html`, `component new` / `update`, `import upload`, `project publish-config`).
|
|
24
|
+
- **Local files are a snapshot;** other people publish to the same project. `module get`, `project sync`, `schema pull` and `sp get` overwrite every file in their scope without asking. Whatever they replace is copied to `<workspace>/_history/` first (`fui file history <path>`, `fui file restore <path>`).
|
|
11
25
|
|
|
12
26
|
## Output contract
|
|
13
27
|
|
|
@@ -31,42 +45,9 @@ Domain rules (module.json, controls, tAPI conventions) live in the `fui-skill` s
|
|
|
31
45
|
- With no `--db`: the only connection, else one inferred from the object name (`sp` commands), else the default.
|
|
32
46
|
- Writes never use the default when a project has several connections.
|
|
33
47
|
- `fui file where` prints what resolved and why.
|
|
34
|
-
- `fui config` shows the workspace and API settings with their sources
|
|
48
|
+
- `fui config` shows the workspace and API settings with their sources: flag, env (`FUI_WORKDIR`, `FUI_API_BASE`, `FUI_API_TOKEN`), `fui config set`, then a Fui MCP entry in `~/.claude.json` if one exists.
|
|
35
49
|
- A global install updates itself in the background, at most once an hour. A line starting `# fui updated` means a new version is running; the skills for Claude Code, Codex and Antigravity refresh on their own. `fui --version` prints the version.
|
|
36
50
|
|
|
37
|
-
## Fui MCP tool → fui command
|
|
38
|
-
|
|
39
|
-
Implemented (same guards, same files, same requests as Fui MCP 1.4.0):
|
|
40
|
-
|
|
41
|
-
| MCP tool | fui |
|
|
42
|
-
| --------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
|
|
43
|
-
| session_set / session_read / session_clear / session_resolve | `use <target>` / `use` / `use --clear` / `resolve <target>` |
|
|
44
|
-
| project_list / project_sync | `project list` / `project sync` |
|
|
45
|
-
| project_new / project_update / project_publish_config | `project new --data {…}` / `project update --data {id:…}` / `project publish-config` |
|
|
46
|
-
| project_user_search / list / new / update / delete | `user search <text>` / `user list` / `user add <UserID> --right N` / `user set …` / `user remove <UserID>` |
|
|
47
|
-
| module_list / new / update / delete | `module list` / `module new <id> --name N` / `module update [--new-id] [--framework] …` / `module delete -p P -m M` |
|
|
48
|
-
| module_get / module_get_ui / module_get_html | `module get [<target>]` / `module get-ui` / `module get-html` |
|
|
49
|
-
| module_validate / module_preview | `module validate` / `module preview` |
|
|
50
|
-
| module_outline / module_simulate | `module outline` / `module simulate [--scenario [...]] [--mocks {...}] [--user {...}] [--url-params {...}]` |
|
|
51
|
-
| module_simulate renderUI / component_preview | `module simulate --render [--device mobile] [--vue-data {...}]` / `component preview <uc-name> [--cases [...]] [--device desktop,mobile]` |
|
|
52
|
-
| error_log_read / error_log_clear | `log read [--tool T] [--limit N\|0] [--summary]` / `log clear` |
|
|
53
|
-
| module_publish_html / json / script / css | `module publish html --approval <token>` / `module publish json` / `… script` / `… css` |
|
|
54
|
-
| component_list / get / new / update / delete | `component list` / `component get <name>` / `component new <name>` / `component update <name>` / `component delete <name>` |
|
|
55
|
-
| 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>` |
|
|
56
|
-
| db_config_read / db_connect | `db list` / `db add <alias> --token - --api-domain host` |
|
|
57
|
-
| db_connect_by_name / db_alias_list / db_alias_new | `db add-by-name <alias>` / `db alias list [--search s]` / `db alias new <alias> …` |
|
|
58
|
-
| db_user_token_set / db_token_rebuild | `db user-token [--from p/alias]` / `db token-rebuild --uid U --pwd-env VAR` |
|
|
59
|
-
| right_system_* / right_function_* | `right system list\|new <0-9>\|update <0-9>\|delete <0-9>` / `right function list\|new --code N\|update <id>\|delete <id>` |
|
|
60
|
-
| db_schema_get / db_schema_read | `schema pull [--prune-local-only]` / `schema [--type T] [--search text]` |
|
|
61
|
-
| db_sp_list / db_sp_get / db_sp_save | `sp list` / `sp get <name> [--print]` / `sp save <name> -f file` |
|
|
62
|
-
| db_sp_deploy / db_sp_help | `sp deploy <name>` / `sp help <name\|Fn> [--full]` |
|
|
63
|
-
| db_sp_verify / db_sp_delete / db_sp_rename | `sp verify <name\|Fn> [--params {…}] [--check-grant]` / `sp delete <name> --type Procedure\|Function` / `sp rename <old> <new>` |
|
|
64
|
-
| db_sql_execute / db_sql_execute_nonquery | `query "<sql>"` / `exec "<sql>"` (+ `--confirm-write`) |
|
|
65
|
-
| skill_get / skill_reference_get / skill_sync | `skill get` / `skill ref <path...>` / `skill sync` |
|
|
66
|
-
| design_list / design_read | `design list` / `design read <brand>` |
|
|
67
|
-
|
|
68
|
-
Every Fui MCP 1.4.0 tool has a fui command (the SSE-only `workspace_*` and `*_stage` tools are out of scope).
|
|
69
|
-
|
|
70
51
|
## Modules
|
|
71
52
|
|
|
72
53
|
1. `fui module get /project/module` (also a live URL or display name).
|
|
@@ -77,7 +58,7 @@ Every Fui MCP 1.4.0 tool has a fui command (the SSE-only `workspace_*` and `*_st
|
|
|
77
58
|
- `fui module outline`: the layout tree (grid widths, bindings, actions, dialogs) to confirm the structure is what you meant.
|
|
78
59
|
- `fui module simulate --scenario '[{"click":"Save"},{"assert":"vueData.list.length > 0"}]'`: runs the module in a simulated runtime; exit 1 when an assert fails. `--mocks` wins over live data. An unmocked static API may call the real tAPI when its local `.sql` body reads as read-only (max 8 calls, cached in `_testdata/`). For an existing SP take mocks from `fui sp verify`, never invent them. Keep scenario and mocks in files (`--scenario-file`, `--mocks-file`); `fui module simulate --last` reruns the module's last input (render mode, viewport, files) and re-reads those files. When the scenario changes a lot, pass it inline with `--last --scenario '[...]'`: one command, one step. Add `--brief` (remembered by `--last`) to print only failures, warnings, asserts, stats and screenshot paths.
|
|
79
60
|
- `fui component preview <uc-name> --cases '[{"name":"empty","props":{"items":[]}}]'`: one local `.vue` alone in a real browser; do it before wiring a component in and before publishing a project-scope one.
|
|
80
|
-
- `fui module simulate --render [--device mobile]`: the real page in headless Chromium, last and only for problems that need pixels. Project-level assets come from the server, so publish project files first. It prints screenshot paths: open and read them, then fix what you see. Needs Playwright once: `bun add -g playwright && bunx playwright install chromium
|
|
61
|
+
- `fui module simulate --render [--device mobile]`: the real page in headless Chromium, last and only for problems that need pixels. Project-level assets come from the server, so publish project files first. It prints screenshot paths: open and read them, then fix what you see. Needs Playwright once, installed with the same package manager as fui: `npm install -g playwright && npx playwright install chromium` (or `bun add -g playwright && bunx playwright install chromium`).
|
|
81
62
|
4. Publish:
|
|
82
63
|
- **Whole module, including header/body:** `fui module preview` → show the changes to the user → after approval `fui module publish html --approval <token>`.
|
|
83
64
|
- The token breaks if any payload file changes after the preview.
|
|
@@ -89,6 +70,16 @@ Every Fui MCP 1.4.0 tool has a fui command (the SSE-only `workspace_*` and `*_st
|
|
|
89
70
|
|
|
90
71
|
Ask the user before `module delete`, `component delete`, `import delete` and `user remove`.
|
|
91
72
|
|
|
73
|
+
## Components
|
|
74
|
+
|
|
75
|
+
- A component is one `uc-<name>.vue` file (Vue 2 options API). FUI takes the name from the file name and registers every `uc-*.vue` globally, so leave out `name:` and `components: {}` in `export default`.
|
|
76
|
+
- Use Vuetify components where they fit and validate props.
|
|
77
|
+
- Check it alone with `fui component preview <uc-name> --cases [...]` before wiring it into a module, then `fui component new|update <name>`.
|
|
78
|
+
|
|
79
|
+
## Framework library
|
|
80
|
+
|
|
81
|
+
`fui library` lists the FUI framework sources on fui.vn (`component`, `component-table`, `default-function`, `fast-project`, `default-style`). `fui library default-function --path` caches one for a day and prints its path, so you can `grep` it instead of reading it whole.
|
|
82
|
+
|
|
92
83
|
## Data
|
|
93
84
|
|
|
94
85
|
```bash
|
|
@@ -166,7 +157,7 @@ fui query "SELECT TOP 5 ID, Name FROM tblX" --json | jq -r '.[].Name'
|
|
|
166
157
|
|
|
167
158
|
```bash
|
|
168
159
|
printf %s "$TOKEN" | fui db add docs -p lhu-docs --token - --api-domain tapi.lhu.edu.vn --user-token-env UT
|
|
169
|
-
fui db add local -p demo --conn-env
|
|
160
|
+
fui db add local -p demo --conn-env SQLITE_URL # sqlite:// connects directly (MSSQL goes through tAPI)
|
|
170
161
|
fui db default lhu-docs/docs
|
|
171
162
|
fui db test --db lhu-docs/docs
|
|
172
163
|
fui token decode --db lhu-docs/docs # never shows the password
|
|
@@ -190,3 +181,37 @@ Secrets are accepted only from stdin (`-`) or `--*-env VAR`. Never echo or paste
|
|
|
190
181
|
- Every new procedure needs `GRANT EXECUTE ... TO [public]`. `sp deploy` does it; raw `exec` only reports it.
|
|
191
182
|
|
|
192
183
|
`fui --help` lists commands. `fui <command> --help` shows usage for one command.
|
|
184
|
+
|
|
185
|
+
## Coming from Fui MCP
|
|
186
|
+
|
|
187
|
+
`fui` shares the workspace, connection files, publish ledger, `_history` and error log with Fui MCP, so the two can run side by side. Each Fui MCP 1.4.0 tool maps to a command with the same guards, files and requests:
|
|
188
|
+
|
|
189
|
+
| MCP tool | fui |
|
|
190
|
+
| ----------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
|
|
191
|
+
| session_set / session_read / session_clear / session_resolve | `use <target>` / `use` / `use --clear` / `resolve <target>` |
|
|
192
|
+
| project_list / project_sync | `project list` / `project sync` |
|
|
193
|
+
| project_new / project_update / project_publish_config | `project new --data {…}` / `project update --data {id:…}` / `project publish-config` |
|
|
194
|
+
| project_user_search / list / new / update / delete | `user search <text>` / `user list` / `user add <UserID> --right N` / `user set …` / `user remove <UserID>` |
|
|
195
|
+
| module_list / new / update / delete | `module list` / `module new <id> --name N` / `module update [--new-id] [--framework] …` / `module delete -p P -m M` |
|
|
196
|
+
| module_get / module_get_ui / module_get_html | `module get [<target>]` / `module get-ui` / `module get-html` |
|
|
197
|
+
| module_validate / module_preview | `module validate` / `module preview` |
|
|
198
|
+
| module_outline / module_simulate | `module outline` / `module simulate [--scenario [...]] [--mocks {...}] [--user {...}] [--url-params {...}]` |
|
|
199
|
+
| module_simulate renderUI / component_preview | `module simulate --render [--device mobile] [--vue-data {...}]` / `component preview <uc-name> [--cases [...]] [--device desktop,mobile]` |
|
|
200
|
+
| error_log_read / error_log_clear | `log read [--tool T] [--limit N\|0] [--summary]` / `log clear` |
|
|
201
|
+
| module_publish_html / json / script / css | `module publish html --approval <token>` / `module publish json` / `… script` / `… css` |
|
|
202
|
+
| component_list / get / new / update / delete | `component list` / `component get <name>` / `component new <name>` / `component update <name>` / `component delete <name>` |
|
|
203
|
+
| 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>` |
|
|
204
|
+
| db_config_read / db_connect | `db list` / `db add <alias> --token - --api-domain host` |
|
|
205
|
+
| db_connect_by_name / db_alias_list / db_alias_new | `db add-by-name <alias>` / `db alias list [--search s]` / `db alias new <alias> …` |
|
|
206
|
+
| db_user_token_set / db_token_rebuild | `db user-token [--from p/alias]` / `db token-rebuild --uid U --pwd-env VAR` |
|
|
207
|
+
| right_system_* / right_function_* | `right system list\|new <0-9>\|update <0-9>\|delete <0-9>` / `right function list\|new --code N\|update <id>\|delete <id>` |
|
|
208
|
+
| db_schema_get / db_schema_read | `schema pull [--prune-local-only]` / `schema [--type T] [--search text]` |
|
|
209
|
+
| db_sp_list / db_sp_get / db_sp_save | `sp list` / `sp get <name> [--print]` / `sp save <name> -f file` |
|
|
210
|
+
| db_sp_deploy / db_sp_help | `sp deploy <name>` / `sp help <name\|Fn> [--full]` |
|
|
211
|
+
| db_sp_verify / db_sp_delete / db_sp_rename | `sp verify <name\|Fn> [--params {…}] [--check-grant]` / `sp delete <name> --type Procedure\|Function` / `sp rename <old> <new>` |
|
|
212
|
+
| db_sql_execute / db_sql_execute_nonquery | `query "<sql>"` / `exec "<sql>"` (+ `--confirm-write`) |
|
|
213
|
+
| skill_get / skill_reference_get / skill_sync | `skill get` / `skill ref <path...>` / `skill sync` |
|
|
214
|
+
| design_list / design_read | `design list` / `design read <brand>` |
|
|
215
|
+
| resources lowcode://library/v2/\* / prompt generate-vue-component | `library <name>` / the Components section above |
|
|
216
|
+
|
|
217
|
+
Every Fui MCP 1.4.0 tool has a fui command (the SSE-only `workspace_*` and `*_stage` tools are out of scope).
|