flowbase-cli 0.1.6__tar.gz → 0.1.8__tar.gz

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.
@@ -0,0 +1,227 @@
1
+ Metadata-Version: 2.4
2
+ Name: flowbase-cli
3
+ Version: 0.1.8
4
+ Summary: Command line client for the FlowBase OpenAPI
5
+ Author: DeepFlowAI
6
+ License: Apache-2.0
7
+ Requires-Python: >=3.11
8
+ Description-Content-Type: text/markdown
9
+
10
+ # FlowBase CLI
11
+
12
+ `flowbase` is the official command line client for the FlowBase OpenAPI. It manages apps, objects, fields, views, custom pages, workflows, dashboards, business records, roles, and configuration versions across the three FlowBase environments.
13
+
14
+ ## 1. Install and connect
15
+
16
+ ```bash
17
+ python -m pip install ./packages/flowbase-cli
18
+ ```
19
+
20
+ Connect to an environment by its site Base URL and a FlowBase API key:
21
+
22
+ ```bash
23
+ export FLOWBASE_HOST=https://flowbase-test-a.deepflowagent.com
24
+ export FLOWBASE_API_KEY=fbk_xxx
25
+ ```
26
+
27
+ | Setting | Source |
28
+ | --- | --- |
29
+ | Host | `--host` > `FLOWBASE_HOST` > `http://flowbase.localhost:5001` |
30
+ | API key | `--api-key` > `FLOWBASE_API_KEY` |
31
+
32
+ The CLI appends `/api/openapi/v1` automatically and sends `Authorization: Bearer <key>` plus an `X-FlowBase-Channel: cli` header. It never stores keys on disk and never prints the full key in errors.
33
+
34
+ ## 2. Environments
35
+
36
+ FlowBase has three environments, selected only by the Host — never by a query, body, or extra header:
37
+
38
+ | Environment | Host |
39
+ | --- | --- |
40
+ | Production | `https://flowbase.deepflowagent.com` |
41
+ | Test A | `https://flowbase-test-a.deepflowagent.com` |
42
+ | Test B | `https://flowbase-test-b.deepflowagent.com` |
43
+
44
+ Most commands run on every Host; `roles` is production-only and `changes commit/release` is test-only.
45
+
46
+ ## 3. Mental model
47
+
48
+ ### 3.1 Metadata vs records
49
+
50
+ - **Metadata** (`metadata` scope): apps, objects, fields, views, pages, workflows, dashboards, roles, versions.
51
+ - **Business records** (`records` scope): rows inside an object.
52
+
53
+ Metadata changes are **drafts** against the current environment's configuration repository. They do not affect the running front-end until they are committed and released.
54
+
55
+ ### 3.2 Draft → commit → release
56
+
57
+ ```text
58
+ metadata write commands → draft in the current environment
59
+ changes commit → snapshot draft into a new version (test env)
60
+ changes release → publish the current test version to production
61
+ changes direct-release → production hotfix: preflight + confirmation, then publish drafts
62
+ ```
63
+
64
+ Most update commands accept an optional `baseRevision` to guard against concurrent edits; the server returns `409` if the draft moved since your last read.
65
+
66
+ ### 3.3 Scope and confirmation
67
+
68
+ Each operation is in `metadata:read`, `metadata:write`, `records:read`, or `records:write`. Destructive commands (`delete`, `restore`, `set-enabled`, version operations) ask for confirmation in a terminal; in automation you must pass `--yes`.
69
+
70
+ ## 4. Command groups
71
+
72
+ ```text
73
+ flowbase
74
+ ├── docs list | show | example | operations Offline endpoint catalog
75
+ ├── apps list | get | create | update | set-enabled | delete
76
+ │ add-objects | remove-object | set-group | reorder-objects
77
+ │ add-dashboards | remove-dashboard | set-dashboard-group | reorder-members
78
+ ├── groups create | reorder | update | delete App groups (under an app)
79
+ ├── objects list | get | create | update | delete | restore
80
+ ├── fields create | update | delete | restore Fields under an object
81
+ ├── views list | create | update | reorder | set-enabled | delete
82
+ ├── workflows list | get | create | update | reorder | set-enabled | delete | executions
83
+ ├── pages list | options | get | create | update | set-default | delete | restore
84
+ ├── dashboards list | get | create | update | copy | delete
85
+ ├── changes commit | release | direct-release
86
+ ├── versions list | show | releases Read-only history
87
+ ├── environments restart Destructive test-env reset
88
+ ├── records list | get | create | update | delete | upload-attachment | download-attachment
89
+ └── roles list | options | get | create | update | delete (production only)
90
+ ```
91
+
92
+ Global flags: `--host`, `--api-key`, `--pretty`/`--no-pretty`, `--raw`.
93
+
94
+ ## 5. Discovering request bodies
95
+
96
+ JSON writes accept `--json` or `--json-file`. The CLI is self-describing:
97
+
98
+ ```bash
99
+ flowbase docs list # endpoints + hasRequestBody/requiresConfirmation flags
100
+ flowbase docs show dashboards.update # metadata + representative request body
101
+ flowbase docs example dashboards.update --output dashboard.json
102
+ flowbase dashboards update dsh_xxx --json-file dashboard.json
103
+ ```
104
+
105
+ `flowbase docs example <key>` prints a representative body template for that endpoint so you can edit it instead of writing from scratch.
106
+
107
+ ### Closed-domain catalogs
108
+
109
+ Complex bodies reference closed sets that are not guessable from examples. Query them offline:
110
+
111
+ ```bash
112
+ flowbase docs catalogs # list available catalogs
113
+ flowbase docs catalogs field-types # field type names + allowed constraints
114
+ flowbase docs catalogs workflow-nodes # node types with in/out edge rules
115
+ flowbase docs catalogs permissions # function permission points + data scopes
116
+ flowbase docs catalogs dashboard-filters # filter types + date-range presets
117
+ flowbase docs catalogs page-components # page region component kinds (field / relatedList)
118
+ flowbase docs catalogs id-prefixes # resource ID prefix meanings
119
+ flowbase docs catalogs icons # icon guidance + examples
120
+ ```
121
+
122
+ ### The read → modify → write loop
123
+
124
+ Most `update` commands replace a **full snapshot** and accept an optional `baseRevision` for optimistic locking. The safe pattern is:
125
+
126
+ ```bash
127
+ flowbase dashboards get dsh_xxx > current.json # authoritative snapshot
128
+ # edit current.json: change fields, keep filters/components, use draftRevision as baseRevision
129
+ flowbase dashboards update dsh_xxx --json-file current.json
130
+ ```
131
+
132
+ Do not compose update bodies from scratch when an existing resource exists — `get` returns the server-valid shape, including `baseRevision`.
133
+
134
+ ## 6. Recipes
135
+
136
+ ### 6.1 Create an object with a field and a record
137
+
138
+ ```bash
139
+ flowbase objects create --label Customer --key customer --description "Customer records"
140
+ flowbase fields create obj_xxx --json '{"label":"Name","key":"name","description":"Customer name","type":"text.singleLine","permission":"required"}'
141
+ flowbase records create obj_xxx --json '{"values":{"name":"Acme Corp"}}'
142
+ ```
143
+
144
+ Record `values` keys are **field keys** (`name`), not internal IDs (`fld_...`). IDs are `obj_`/`fld_`/`dsh_`/`wfl_`/`pag_`/`reg_`/`cmp_`-prefixed; see `docs catalogs id-prefixes`.
145
+
146
+ ### 6.2 Edit and publish configuration on a test environment
147
+
148
+ ```bash
149
+ export FLOWBASE_HOST=https://flowbase-test-a.deepflowagent.com
150
+
151
+ flowbase dashboards create --label "Sales board" --key sales_board
152
+ flowbase docs example dashboards.update --output dashboard.json # fill filters/components
153
+ flowbase dashboards update dsh_xxx --json-file dashboard.json
154
+ flowbase apps add-dashboards app_xxx dsh_xxx
155
+ flowbase apps reorder-members app_xxx --json '{"items":[{"type":"object","id":"obj_xxx"},{"type":"dashboard","id":"dsh_xxx"}]}'
156
+ flowbase changes commit --message "Add sales dashboard" --yes
157
+ flowbase changes release --message "Ship sales dashboard" --yes
158
+ ```
159
+
160
+ Dashboard component code runs server-side in a sandbox and returns ECharts config / metric / table / markdown. Components and filters are validated on save; runtime results are only visible in the web UI, not through this CLI.
161
+
162
+ ### 6.3 Production hotfix
163
+
164
+ ```bash
165
+ export FLOWBASE_HOST=https://flowbase.deepflowagent.com
166
+ flowbase changes direct-release --message "Fix customer field" --yes
167
+ ```
168
+
169
+ `direct-release` always runs a server-side preflight, prints the current version, diff summary, checks and risk, and binds a one-time confirmation token. `--yes` accepts that reviewed result; it never skips validation.
170
+
171
+ ### 6.4 Workflows and pages
172
+
173
+ A workflow graph must satisfy structural rules: exactly one `trigger` node, at least one `end` node, a DAG, and valid per-type edges. See `docs catalogs workflow-nodes` before composing `nodes`/`edges`.
174
+
175
+ ```bash
176
+ flowbase docs catalogs workflow-nodes
177
+ flowbase workflows create obj_xxx --json '{"label":"Set owner","enabled":true,"trigger":{"event":"create","match":"all","conditions":[]},"nodes":[],"edges":[]}'
178
+ flowbase workflows update obj_xxx wfl_xxx --json-file workflow.json
179
+ flowbase workflows executions obj_xxx wfl_xxx --result failure
180
+
181
+ flowbase docs catalogs page-components # field + relatedList keys
182
+ flowbase docs example pages.create --output page.json # create-page layout template
183
+ flowbase pages create --json-file page.json
184
+ flowbase pages set-default pag_xxx --base-revision 4 --yes
185
+
186
+ # Detail pages may embed relatedList components (reverse lookup lists).
187
+ flowbase pages get pag_xxx > page.json # prefer get → edit → update
188
+ # or: flowbase docs example pages.update --output page.json
189
+ flowbase pages update pag_xxx --json-file page.json
190
+ ```
191
+
192
+ ### 6.5 Records and attachments
193
+
194
+ ```bash
195
+ flowbase records list obj_xxx --page 1
196
+ flowbase records get obj_xxx rec_xxx
197
+ flowbase records upload-attachment obj_xxx fld_xxx ./contract.pdf
198
+ flowbase records update obj_xxx rec_xxx --json '{"values":{"fld_contract":["att_xxx"]}}'
199
+ flowbase records download-attachment obj_xxx rec_xxx att_xxx --output ./contract.pdf
200
+ ```
201
+
202
+ ### 6.6 Roles (production only)
203
+
204
+ ```bash
205
+ export FLOWBASE_HOST=https://flowbase.deepflowagent.com
206
+ flowbase docs catalogs permissions # function points + data scopes
207
+ flowbase roles options # apps and objects available for grants
208
+ flowbase roles create --json-file role.json
209
+ flowbase roles update rol_xxx --json-file role.json
210
+ ```
211
+
212
+ ## 7. Output and errors
213
+
214
+ - Success: JSON on stdout, exit code `0`. Use `--no-pretty` for compact JSON or `--raw` for the raw body.
215
+ - Failures (missing key, invalid JSON, HTTP 4xx/5xx, network errors, cancelled confirmation) go to stderr with a clear message and exit code `1`.
216
+ - `flowbase --help` lists every command; `flowbase <group> --help` and `flowbase <group> <action> --help` show flags and, for JSON commands, an inline body example.
217
+
218
+ ### Error matrix
219
+
220
+ | Scenario | HTTP / CLI behavior |
221
+ | --- | --- |
222
+ | Missing or invalid API key | 401; stderr tells you to set `FLOWBASE_API_KEY` or `--api-key` |
223
+ | Environment not enabled | 403; request is rejected before business logic |
224
+ | Missing draft revision / concurrent edit | 409; re-read with `get` and retry with the new `baseRevision` |
225
+ | Invalid request field or business rule | 400 / 422; `detail` explains the reason |
226
+ | Resource not found | 404 |
227
+ | Destructive command without `--yes` in automation | CLI refuses before any network call |
@@ -0,0 +1,218 @@
1
+ # FlowBase CLI
2
+
3
+ `flowbase` is the official command line client for the FlowBase OpenAPI. It manages apps, objects, fields, views, custom pages, workflows, dashboards, business records, roles, and configuration versions across the three FlowBase environments.
4
+
5
+ ## 1. Install and connect
6
+
7
+ ```bash
8
+ python -m pip install ./packages/flowbase-cli
9
+ ```
10
+
11
+ Connect to an environment by its site Base URL and a FlowBase API key:
12
+
13
+ ```bash
14
+ export FLOWBASE_HOST=https://flowbase-test-a.deepflowagent.com
15
+ export FLOWBASE_API_KEY=fbk_xxx
16
+ ```
17
+
18
+ | Setting | Source |
19
+ | --- | --- |
20
+ | Host | `--host` > `FLOWBASE_HOST` > `http://flowbase.localhost:5001` |
21
+ | API key | `--api-key` > `FLOWBASE_API_KEY` |
22
+
23
+ The CLI appends `/api/openapi/v1` automatically and sends `Authorization: Bearer <key>` plus an `X-FlowBase-Channel: cli` header. It never stores keys on disk and never prints the full key in errors.
24
+
25
+ ## 2. Environments
26
+
27
+ FlowBase has three environments, selected only by the Host — never by a query, body, or extra header:
28
+
29
+ | Environment | Host |
30
+ | --- | --- |
31
+ | Production | `https://flowbase.deepflowagent.com` |
32
+ | Test A | `https://flowbase-test-a.deepflowagent.com` |
33
+ | Test B | `https://flowbase-test-b.deepflowagent.com` |
34
+
35
+ Most commands run on every Host; `roles` is production-only and `changes commit/release` is test-only.
36
+
37
+ ## 3. Mental model
38
+
39
+ ### 3.1 Metadata vs records
40
+
41
+ - **Metadata** (`metadata` scope): apps, objects, fields, views, pages, workflows, dashboards, roles, versions.
42
+ - **Business records** (`records` scope): rows inside an object.
43
+
44
+ Metadata changes are **drafts** against the current environment's configuration repository. They do not affect the running front-end until they are committed and released.
45
+
46
+ ### 3.2 Draft → commit → release
47
+
48
+ ```text
49
+ metadata write commands → draft in the current environment
50
+ changes commit → snapshot draft into a new version (test env)
51
+ changes release → publish the current test version to production
52
+ changes direct-release → production hotfix: preflight + confirmation, then publish drafts
53
+ ```
54
+
55
+ Most update commands accept an optional `baseRevision` to guard against concurrent edits; the server returns `409` if the draft moved since your last read.
56
+
57
+ ### 3.3 Scope and confirmation
58
+
59
+ Each operation is in `metadata:read`, `metadata:write`, `records:read`, or `records:write`. Destructive commands (`delete`, `restore`, `set-enabled`, version operations) ask for confirmation in a terminal; in automation you must pass `--yes`.
60
+
61
+ ## 4. Command groups
62
+
63
+ ```text
64
+ flowbase
65
+ ├── docs list | show | example | operations Offline endpoint catalog
66
+ ├── apps list | get | create | update | set-enabled | delete
67
+ │ add-objects | remove-object | set-group | reorder-objects
68
+ │ add-dashboards | remove-dashboard | set-dashboard-group | reorder-members
69
+ ├── groups create | reorder | update | delete App groups (under an app)
70
+ ├── objects list | get | create | update | delete | restore
71
+ ├── fields create | update | delete | restore Fields under an object
72
+ ├── views list | create | update | reorder | set-enabled | delete
73
+ ├── workflows list | get | create | update | reorder | set-enabled | delete | executions
74
+ ├── pages list | options | get | create | update | set-default | delete | restore
75
+ ├── dashboards list | get | create | update | copy | delete
76
+ ├── changes commit | release | direct-release
77
+ ├── versions list | show | releases Read-only history
78
+ ├── environments restart Destructive test-env reset
79
+ ├── records list | get | create | update | delete | upload-attachment | download-attachment
80
+ └── roles list | options | get | create | update | delete (production only)
81
+ ```
82
+
83
+ Global flags: `--host`, `--api-key`, `--pretty`/`--no-pretty`, `--raw`.
84
+
85
+ ## 5. Discovering request bodies
86
+
87
+ JSON writes accept `--json` or `--json-file`. The CLI is self-describing:
88
+
89
+ ```bash
90
+ flowbase docs list # endpoints + hasRequestBody/requiresConfirmation flags
91
+ flowbase docs show dashboards.update # metadata + representative request body
92
+ flowbase docs example dashboards.update --output dashboard.json
93
+ flowbase dashboards update dsh_xxx --json-file dashboard.json
94
+ ```
95
+
96
+ `flowbase docs example <key>` prints a representative body template for that endpoint so you can edit it instead of writing from scratch.
97
+
98
+ ### Closed-domain catalogs
99
+
100
+ Complex bodies reference closed sets that are not guessable from examples. Query them offline:
101
+
102
+ ```bash
103
+ flowbase docs catalogs # list available catalogs
104
+ flowbase docs catalogs field-types # field type names + allowed constraints
105
+ flowbase docs catalogs workflow-nodes # node types with in/out edge rules
106
+ flowbase docs catalogs permissions # function permission points + data scopes
107
+ flowbase docs catalogs dashboard-filters # filter types + date-range presets
108
+ flowbase docs catalogs page-components # page region component kinds (field / relatedList)
109
+ flowbase docs catalogs id-prefixes # resource ID prefix meanings
110
+ flowbase docs catalogs icons # icon guidance + examples
111
+ ```
112
+
113
+ ### The read → modify → write loop
114
+
115
+ Most `update` commands replace a **full snapshot** and accept an optional `baseRevision` for optimistic locking. The safe pattern is:
116
+
117
+ ```bash
118
+ flowbase dashboards get dsh_xxx > current.json # authoritative snapshot
119
+ # edit current.json: change fields, keep filters/components, use draftRevision as baseRevision
120
+ flowbase dashboards update dsh_xxx --json-file current.json
121
+ ```
122
+
123
+ Do not compose update bodies from scratch when an existing resource exists — `get` returns the server-valid shape, including `baseRevision`.
124
+
125
+ ## 6. Recipes
126
+
127
+ ### 6.1 Create an object with a field and a record
128
+
129
+ ```bash
130
+ flowbase objects create --label Customer --key customer --description "Customer records"
131
+ flowbase fields create obj_xxx --json '{"label":"Name","key":"name","description":"Customer name","type":"text.singleLine","permission":"required"}'
132
+ flowbase records create obj_xxx --json '{"values":{"name":"Acme Corp"}}'
133
+ ```
134
+
135
+ Record `values` keys are **field keys** (`name`), not internal IDs (`fld_...`). IDs are `obj_`/`fld_`/`dsh_`/`wfl_`/`pag_`/`reg_`/`cmp_`-prefixed; see `docs catalogs id-prefixes`.
136
+
137
+ ### 6.2 Edit and publish configuration on a test environment
138
+
139
+ ```bash
140
+ export FLOWBASE_HOST=https://flowbase-test-a.deepflowagent.com
141
+
142
+ flowbase dashboards create --label "Sales board" --key sales_board
143
+ flowbase docs example dashboards.update --output dashboard.json # fill filters/components
144
+ flowbase dashboards update dsh_xxx --json-file dashboard.json
145
+ flowbase apps add-dashboards app_xxx dsh_xxx
146
+ flowbase apps reorder-members app_xxx --json '{"items":[{"type":"object","id":"obj_xxx"},{"type":"dashboard","id":"dsh_xxx"}]}'
147
+ flowbase changes commit --message "Add sales dashboard" --yes
148
+ flowbase changes release --message "Ship sales dashboard" --yes
149
+ ```
150
+
151
+ Dashboard component code runs server-side in a sandbox and returns ECharts config / metric / table / markdown. Components and filters are validated on save; runtime results are only visible in the web UI, not through this CLI.
152
+
153
+ ### 6.3 Production hotfix
154
+
155
+ ```bash
156
+ export FLOWBASE_HOST=https://flowbase.deepflowagent.com
157
+ flowbase changes direct-release --message "Fix customer field" --yes
158
+ ```
159
+
160
+ `direct-release` always runs a server-side preflight, prints the current version, diff summary, checks and risk, and binds a one-time confirmation token. `--yes` accepts that reviewed result; it never skips validation.
161
+
162
+ ### 6.4 Workflows and pages
163
+
164
+ A workflow graph must satisfy structural rules: exactly one `trigger` node, at least one `end` node, a DAG, and valid per-type edges. See `docs catalogs workflow-nodes` before composing `nodes`/`edges`.
165
+
166
+ ```bash
167
+ flowbase docs catalogs workflow-nodes
168
+ flowbase workflows create obj_xxx --json '{"label":"Set owner","enabled":true,"trigger":{"event":"create","match":"all","conditions":[]},"nodes":[],"edges":[]}'
169
+ flowbase workflows update obj_xxx wfl_xxx --json-file workflow.json
170
+ flowbase workflows executions obj_xxx wfl_xxx --result failure
171
+
172
+ flowbase docs catalogs page-components # field + relatedList keys
173
+ flowbase docs example pages.create --output page.json # create-page layout template
174
+ flowbase pages create --json-file page.json
175
+ flowbase pages set-default pag_xxx --base-revision 4 --yes
176
+
177
+ # Detail pages may embed relatedList components (reverse lookup lists).
178
+ flowbase pages get pag_xxx > page.json # prefer get → edit → update
179
+ # or: flowbase docs example pages.update --output page.json
180
+ flowbase pages update pag_xxx --json-file page.json
181
+ ```
182
+
183
+ ### 6.5 Records and attachments
184
+
185
+ ```bash
186
+ flowbase records list obj_xxx --page 1
187
+ flowbase records get obj_xxx rec_xxx
188
+ flowbase records upload-attachment obj_xxx fld_xxx ./contract.pdf
189
+ flowbase records update obj_xxx rec_xxx --json '{"values":{"fld_contract":["att_xxx"]}}'
190
+ flowbase records download-attachment obj_xxx rec_xxx att_xxx --output ./contract.pdf
191
+ ```
192
+
193
+ ### 6.6 Roles (production only)
194
+
195
+ ```bash
196
+ export FLOWBASE_HOST=https://flowbase.deepflowagent.com
197
+ flowbase docs catalogs permissions # function points + data scopes
198
+ flowbase roles options # apps and objects available for grants
199
+ flowbase roles create --json-file role.json
200
+ flowbase roles update rol_xxx --json-file role.json
201
+ ```
202
+
203
+ ## 7. Output and errors
204
+
205
+ - Success: JSON on stdout, exit code `0`. Use `--no-pretty` for compact JSON or `--raw` for the raw body.
206
+ - Failures (missing key, invalid JSON, HTTP 4xx/5xx, network errors, cancelled confirmation) go to stderr with a clear message and exit code `1`.
207
+ - `flowbase --help` lists every command; `flowbase <group> --help` and `flowbase <group> <action> --help` show flags and, for JSON commands, an inline body example.
208
+
209
+ ### Error matrix
210
+
211
+ | Scenario | HTTP / CLI behavior |
212
+ | --- | --- |
213
+ | Missing or invalid API key | 401; stderr tells you to set `FLOWBASE_API_KEY` or `--api-key` |
214
+ | Environment not enabled | 403; request is rejected before business logic |
215
+ | Missing draft revision / concurrent edit | 409; re-read with `get` and retry with the new `baseRevision` |
216
+ | Invalid request field or business rule | 400 / 422; `detail` explains the reason |
217
+ | Resource not found | 404 |
218
+ | Destructive command without `--yes` in automation | CLI refuses before any network call |
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "flowbase-cli"
7
- version = "0.1.6"
7
+ version = "0.1.8"
8
8
  description = "Command line client for the FlowBase OpenAPI"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -1,3 +1,3 @@
1
1
  """FlowBase OpenAPI CLI."""
2
2
 
3
- __version__ = "0.1.6"
3
+ __version__ = "0.1.8"