@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 CHANGED
@@ -1,179 +1,108 @@
1
1
  # fui
2
2
 
3
- A token-lean CLI for the FUI low-code platform, built with Bun. It is the successor to the Fui MCP server (`@fui-org/fui-mcp`).
4
-
5
- v1 covers the database workflow:
6
-
7
- - connections
8
- - SQL
9
- - schema
10
- - stored procedures
11
-
12
- It shares the Fui MCP workspace, so existing connections work immediately.
13
-
14
- Design: [docs/specs/2026-09-28-fui-cli-v1-design.md](docs/specs/2026-09-28-fui-cli-v1-design.md)
3
+ A command-line tool for the FUI low-code platform: projects, modules, components, imports, users, rights, database connections, SQL, schema and stored procedures. It works with AI agents (Claude Code, Codex, Antigravity) and replaces the Fui MCP server.
15
4
 
16
5
  ## Install
17
6
 
18
- ### 1. Install Bun
19
-
20
- `fui` runs on [Bun](https://bun.com) 1.4 or later. Skip this step if `bun --version` already prints 1.4 or later.
7
+ ### 1. Install fui
21
8
 
22
- macOS and Linux:
9
+ Needs [Node.js](https://nodejs.org) 22 or later (`node --version`).
23
10
 
24
11
  ```bash
25
- curl -fsSL https://bun.sh/install | bash
26
- ```
27
-
28
- On macOS you can use Homebrew instead:
29
-
30
- ```bash
31
- brew install oven-sh/bun/bun
32
- ```
33
-
34
- Windows (PowerShell):
35
-
36
- ```powershell
37
- powershell -c "irm bun.sh/install.ps1 | iex"
38
- ```
39
-
40
- Open a new terminal so `PATH` picks up Bun, then check it:
41
-
42
- ```bash
43
- bun --version
12
+ npm install -g @fui-org/fui-cli
13
+ fui --version
44
14
  ```
45
15
 
46
- To upgrade an older Bun, run `bun upgrade`.
16
+ ### Or install with Bun
47
17
 
48
- ### 2. Install fui
18
+ If you use [Bun](https://bun.com) as your package manager, install fui with it instead. fui still runs on Node.js.
49
19
 
50
20
  ```bash
51
21
  bun add -g @fui-org/fui-cli
52
- fui --version
53
22
  ```
54
23
 
55
- This puts `fui` on your `PATH`, in `~/.bun/bin` on macOS and Linux and in `%USERPROFILE%\.bun\bin` on Windows. To run it once without installing:
24
+ ### 2. Set up
25
+
26
+ Ask your FUI administrator for the API address and your API token, then:
56
27
 
57
28
  ```bash
58
- bunx --package @fui-org/fui-cli fui --help
29
+ fui config set api-base https://<fui-api-host>
30
+ printf %s "$FUI_TOKEN" | fui config set api-token -
31
+ fui project list
59
32
  ```
60
33
 
61
- A global install updates itself. At most once an hour, a command starts a background check against the npm registry. When a newer release exists, the check runs `bun add -g @fui-org/fui-cli@<latest>`. The command you ran is never delayed, and the next run prints one line saying what changed and refreshes the Claude skills.
34
+ The token is read from stdin, so it never lands in your shell history. `fui config` shows the current settings.
62
35
 
63
- - `fui update` updates now; `fui update --check` only reports.
64
- - Turn it off with `fui config set auto-update off` or `FUI_AUTO_UPDATE=0`.
65
- - A `bun link` checkout or a compiled binary never replaces itself; `fui update` prints the install command instead.
66
-
67
- Remove with `bun remove -g @fui-org/fui-cli`.
68
-
69
- ### From source
36
+ For real-browser checks (`fui module simulate --render`, `fui component preview`), install Playwright once:
70
37
 
71
38
  ```bash
72
- bun install
73
- bun link
39
+ npm install -g playwright && npx playwright install chromium
74
40
  ```
75
41
 
76
- `bun link` points `fui` at `src/cli.ts`, so source edits apply immediately.
77
-
78
- ### Build outputs
42
+ Installed fui with Bun? Install Playwright the same way, so fui finds it: `bun add -g playwright && bunx playwright install chromium`.
79
43
 
80
- - `bun run build` writes `dist/fui.js`, a single minified bundle for Bun. This is the file the npm package ships; `prepack` runs it automatically.
81
- - `bun run build:bin` writes `dist/fui`, a standalone executable that runs without Bun installed.
44
+ ## Updates
82
45
 
83
- ### Release
84
-
85
- npm never accepts the same version twice, so bump before every publish (`patch` for fixes, `minor` for features):
86
-
87
- ```bash
88
- bun test && bun run typecheck && bun run lint && bun run format:check
89
- bun pm version patch --no-git-tag-version
90
- bun publish --otp <code>
91
- ```
92
-
93
- `bun publish` packs `dist/fui.js`, `skills/` and `README.md`, and needs npm access to the `@fui-org` scope and 2FA on the account.
46
+ `fui` updates itself in the background, at most once an hour, and prints one line after an update. `fui update` updates now, and `fui update --check` only reports. Turn it off with `fui config set auto-update off`.
94
47
 
95
48
  ## Use with an AI agent
96
49
 
97
- A global install gives each AI agent on the machine two skills:
98
-
99
- - `fui/SKILL.md` teaches the agent the commands, output format, exit codes and safety rules. `fui skill` prints the same guide.
100
- - `fui-skill/` is the FUI domain skill from Fui MCP 1.4.0, unchanged: module.json, components, tAPI and SP references, design systems.
50
+ `fui` installs two skills for each AI agent it finds, and refreshes them after every update:
101
51
 
102
- | Agent | Found when this folder exists | Skills go to |
103
- | ----------- | ------------------------------------ | ------------------------------ |
104
- | Claude Code | `~/.claude` (or `CLAUDE_CONFIG_DIR`) | `~/.claude/skills` |
105
- | Codex | `~/.codex` (or `CODEX_HOME`) | `~/.agents/skills` |
106
- | Antigravity | `~/.gemini/antigravity` | `~/.gemini/antigravity/skills` |
52
+ - `fui` teaches the agent the commands and safety rules. `fui skill` prints it.
53
+ - `fui-skill` holds the FUI domain rules: module.json, components, tAPI and stored procedures, design systems.
107
54
 
108
- The skills are written on the first `fui` run after install, right after every update, and on the first run after you install another agent. On Windows, `~` is `%USERPROFILE%`. Each install replaces both folders, so keep your own notes elsewhere. Turn it off with `FUI_AUTO_SKILLS=0`.
55
+ | Agent | Skills folder |
56
+ | ----------- | ------------------------------ |
57
+ | Claude Code | `~/.claude/skills` |
58
+ | Codex | `~/.agents/skills` |
59
+ | Antigravity | `~/.gemini/antigravity/skills` |
109
60
 
110
- To install by hand, for an agent not installed yet, or into another folder:
61
+ Installed an agent later? The next `fui` run adds its skills. To install by hand:
111
62
 
112
63
  ```bash
113
- fui skill install [--agent claude,codex,antigravity|all] [--dir <skills-root>]
64
+ fui skill install [--agent claude,codex,antigravity|all]
114
65
  ```
115
66
 
116
67
  ## Quick tour
117
68
 
118
69
  ```bash
70
+ fui --help
71
+ fui module get /my-project/my-module
72
+ fui module validate
119
73
  fui db list
120
- fui query "SELECT TOP 5 * FROM tblX" --db lhu-docs/docs
74
+ fui query "SELECT TOP 5 * FROM tblX" --db my-project/docs
121
75
  fui schema --search student
122
76
  fui sp get spAPI_Student_Select
123
- fui sp deploy spAPI_Student_Select
124
77
  fui file status
125
78
  ```
126
79
 
127
- ## Parity with Fui MCP
128
-
129
- `fui` ports Fui MCP 1.4.0 tool by tool. The spec is [docs/specs/2026-09-28-fui-cli-v2-parity-design.md](docs/specs/2026-09-28-fui-cli-v2-parity-design.md).
130
-
131
- - **Source of truth:** `@fui-org/fui-mcp@1.4.0` is pinned as a dev dependency.
132
- - **Parity tests:** `test/parity/` runs its real tool handlers next to `fui` on twin workspaces. They compare the HTTP requests, the files written and the outcome byte for byte.
133
- - **What stays identical:** guards, confirmations, reading and pulling.
134
- - **What changes:** output is terse, and limits that exist only for the context window can be lifted with flags.
135
-
136
- Commands already ported, and the MCP tools still to come, are listed in the `fui` skill (`fui skill`).
80
+ `fui <command> --help` shows the options of one command.
137
81
 
138
82
  ## Workspace location
139
83
 
140
- `fui` picks the workspace folder in this order:
141
-
142
- 1. `--workdir <dir>`
143
- 2. `FUI_MCP_WORKDIR` env var
144
- 3. `fui config set workdir <dir>`, saved in `~/.config/fui/config.json` (respects `XDG_CONFIG_HOME`)
145
- 4. `FUI_MCP_WORKDIR` of the Fui MCP server in `~/.claude.json` (project scope first, then user scope; respects `CLAUDE_CONFIG_DIR`)
146
- 5. `~/.fui-mcp/workspaces`
84
+ `fui` keeps projects in `~/.fui-mcp/workspaces`, the same folder Fui MCP uses. To use another folder:
147
85
 
148
86
  ```bash
149
- fui config # effective value and where it came from
150
87
  fui config set workdir ~/work/fui
151
- fui config unset workdir
152
88
  ```
153
89
 
154
- ## Connections
155
-
156
- A dbToken is Base64 of a connection string. The engine is detected from the token:
157
-
158
- | Connection string | Engine | Transport |
159
- | --------------------------------------------- | --------------- | ------------------------------------------- |
160
- | `Server=...; Database=...; UID=...; PWD=...;` | MSSQL | tAPI over HTTPS, the same path Fui MCP uses |
161
- | `postgres://...` | Postgres | direct, through `Bun.SQL` |
162
- | `mysql://...`, `mariadb://...` | MySQL / MariaDB | direct, through `Bun.SQL` |
163
- | `sqlite://...`, `file:...` | SQLite | direct, through `Bun.SQL` |
90
+ ## Database connections
164
91
 
165
92
  Secrets are read only from stdin (`-`) or from an env var (`--*-env VAR`):
166
93
 
167
94
  ```bash
168
- printf %s "$TOKEN" | fui db add docs -p lhu-docs --token - --api-domain tapi.lhu.edu.vn
169
- fui db add local -p demo --conn-env PG_URL
95
+ printf %s "$TOKEN" | fui db add docs -p my-project --token - --api-domain tapi.example.edu.vn
96
+ fui db add local -p demo --conn-env SQLITE_URL
97
+ fui db list
170
98
  ```
171
99
 
172
- ## Development
100
+ A connection is an MSSQL string (through tAPI) or a `sqlite://` URL.
101
+
102
+ ## Uninstall
173
103
 
174
104
  ```bash
175
- bun test
176
- bun run typecheck
177
- bun run lint
178
- bun run format:check
105
+ npm uninstall -g @fui-org/fui-cli
179
106
  ```
107
+
108
+ Installed with Bun: `bun remove -g @fui-org/fui-cli`.