flowbase-cli 0.1.12__py3-none-any.whl

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,281 @@
1
+ Metadata-Version: 2.4
2
+ Name: flowbase-cli
3
+ Version: 0.1.12
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, approval flows, dashboards, business records, roles, and configuration versions across the three FlowBase environments.
13
+
14
+ FlowBase is a low-code platform. Start with `flowbase guide` (offline): discover apps and objects, read fields, then configure and verify. Use `flowbase guide --format json` for structured guidance.
15
+
16
+ ## 1. Install and connect
17
+
18
+ ```bash
19
+ python -m pip install ./packages/flowbase-cli
20
+ ```
21
+
22
+ Connect to an environment by its site Base URL and a FlowBase API key:
23
+
24
+ ```bash
25
+ export FLOWBASE_HOST=https://flowbase-test-a.deepflowagent.com
26
+ export FLOWBASE_API_KEY=fbk_xxx
27
+ ```
28
+
29
+ | Setting | Source |
30
+ | --- | --- |
31
+ | Host | `--host` > `FLOWBASE_HOST` > `http://flowbase.localhost:5001` |
32
+ | API key | `--api-key` > `FLOWBASE_API_KEY` |
33
+
34
+ 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.
35
+
36
+ ## 2. Environments
37
+
38
+ FlowBase has three environments, selected only by the Host — never by a query, body, or extra header:
39
+
40
+ | Environment | Host |
41
+ | --- | --- |
42
+ | Production | `https://flowbase.deepflowagent.com` |
43
+ | Test A | `https://flowbase-test-a.deepflowagent.com` |
44
+ | Test B | `https://flowbase-test-b.deepflowagent.com` |
45
+
46
+ Most commands run on every Host; `roles` is production-only and `changes commit/release` is test-only.
47
+
48
+ ## 3. Mental model
49
+
50
+ ### 3.1 Metadata vs records
51
+
52
+ - **Metadata** (`metadata` scope): apps, objects, fields, views, pages, workflows, approvals, dashboards, roles, versions.
53
+ - **Business records** (`records` scope): rows inside an object.
54
+
55
+ 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.
56
+
57
+ ### 3.2 Draft → commit → release
58
+
59
+ ```text
60
+ metadata write commands → draft in the current environment
61
+ changes commit → snapshot draft into a new version (test env)
62
+ changes release → publish the current test version to production
63
+ changes direct-release → production hotfix: preflight + confirmation, then publish drafts
64
+ ```
65
+
66
+ Most update commands accept an optional `baseRevision` to guard against concurrent edits; the server returns `409` if the draft moved since your last read.
67
+
68
+ ### 3.3 Scope and confirmation
69
+
70
+ 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`.
71
+
72
+ ## 4. Command groups
73
+
74
+ ```text
75
+ flowbase
76
+ ├── docs list | show | example | operations Offline endpoint catalog
77
+ ├── guide Offline product and task guide (--format markdown|json)
78
+ ├── organization employees | departments
79
+ ├── apps list | get | create | update | set-enabled | delete
80
+ │ add-objects | remove-object | set-group | reorder-objects
81
+ │ add-dashboards | remove-dashboard | set-dashboard-group | reorder-members
82
+ ├── groups create | reorder | update | delete App groups (under an app)
83
+ ├── objects list | get | create | update | delete | restore
84
+ │ cli-edit-policy get | update
85
+ ├── fields create | update | delete | restore Fields under an object
86
+ ├── views list | create | update | reorder | set-enabled | delete
87
+ ├── workflows list | get | create | update | reorder | set-enabled | delete | executions
88
+ ├── approvals list | get | create | update | reorder | set-enabled | delete
89
+ ├── pages list | options | get | create | update | set-default | clear-default | delete | restore | evaluate
90
+ ├── dashboards list | get | create | update | copy | delete | run
91
+ ├── changes commit | release | direct-release
92
+ ├── versions list | show | releases Read-only history
93
+ ├── environments restart Destructive test-env reset
94
+ ├── records list | get | create | update | delete | upload-attachment | download-attachment
95
+ └── roles list | options | get | create | update | delete (production only)
96
+ ```
97
+
98
+ Global flags: `--host`, `--api-key`, `--pretty`/`--no-pretty`, `--raw`. They may appear **before or after** the subcommand (`flowbase apps list --no-pretty` is valid).
99
+
100
+ ## 5. Discovering request bodies
101
+
102
+ JSON writes accept `--json` or `--json-file`. The CLI is self-describing:
103
+
104
+ ```bash
105
+ flowbase docs list # endpoints + hasRequestBody/requiresConfirmation flags
106
+ flowbase docs show dashboards.update # metadata + representative request body
107
+ flowbase docs example dashboards.update --output dashboard.json
108
+ flowbase dashboards update dsh_xxx --json-file dashboard.json
109
+ ```
110
+
111
+ `flowbase docs example <key>` prints a representative body template for that endpoint so you can edit it instead of writing from scratch.
112
+
113
+ ### Closed-domain catalogs
114
+
115
+ Complex bodies reference closed sets that are not guessable from examples. Query them offline:
116
+
117
+ ```bash
118
+ flowbase docs catalogs # list available catalogs
119
+ flowbase docs catalogs authoring # required fields, draftRevision sources, common mistakes
120
+ flowbase docs catalogs field-types # types, constraints, filter operators, record values, create examples
121
+ flowbase docs catalogs view-filters # view filter operators and value shapes (not page-rules)
122
+ flowbase docs catalogs record-values # how to write records.values by field type
123
+ flowbase docs catalogs workflow-nodes # node types with in/out edge rules
124
+ flowbase docs catalogs permissions # function permission points + data scopes
125
+ flowbase docs catalogs dashboard-filters # filter types + date-range presets
126
+ flowbase docs catalogs page-components # Page component shapes, placement, fields, and enums
127
+ flowbase docs catalogs page-rules # Page condition operators and action shapes
128
+ flowbase docs catalogs id-prefixes # resource ID prefix meanings
129
+ flowbase docs catalogs icons # icon guidance + examples
130
+ ```
131
+
132
+ Read `authoring` before composing any write. It lists the mistakes that most often make generated commands fail: missing `description`/`type`, select options without `id`+`lifecycle`, `defaultValue: null` (omit the key instead), boolean view filters using `eq`, `records.list` being a column projection, `pages.list.pages` being a page count, and `objects.get` not returning `draftRevision`.
133
+
134
+ ### The read → modify → write loop
135
+
136
+ Most `update` commands replace a **full snapshot** and accept an optional `baseRevision` for optimistic locking. Check the relevant offline catalog for its exact update envelope and read-only response fields. The safe pattern is:
137
+
138
+ ```bash
139
+ flowbase dashboards get dsh_xxx > current.json # authoritative snapshot
140
+ # edit current.json: change fields, keep filters/components, use draftRevision as baseRevision
141
+ flowbase dashboards update dsh_xxx --json-file current.json
142
+ ```
143
+
144
+ Do not compose update bodies from scratch when an existing resource exists. Start from `get`, then convert its read projection to the update envelope documented by the relevant catalog.
145
+
146
+ ## 6. Recipes
147
+
148
+ ### 6.1 Create an object with a field and a record
149
+
150
+ ```bash
151
+ flowbase docs catalogs authoring
152
+ flowbase docs catalogs field-types
153
+ flowbase objects create --json '{"label":"Customer","key":"customer","description":"Customer records","icon":"IconUsers"}'
154
+ flowbase fields create obj_xxx --json '{"label":"Name","key":"name","description":"Customer name","type":"text.singleLine","typeVersion":"v1","permission":"required","constraints":{"maxLength":120}}'
155
+ flowbase records create obj_xxx --json '{"values":{"name":"Acme Corp"}}'
156
+ flowbase objects cli-edit-policy get obj_xxx
157
+ flowbase objects cli-edit-policy update obj_xxx --json '{"baseRevision":4,"policies":{"fld_xxx":"user_approval"}}' --yes
158
+ ```
159
+
160
+ `records create` returns `{recordId}`; use it with `records get`.
161
+
162
+ 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`.
163
+
164
+ ### 6.2 Edit and publish configuration on a test environment
165
+
166
+ ```bash
167
+ export FLOWBASE_HOST=https://flowbase-test-a.deepflowagent.com
168
+
169
+ flowbase dashboards create --label "Sales board" --key sales_board
170
+ flowbase docs example dashboards.update --output dashboard.json # fill filters/components
171
+ flowbase dashboards update dsh_xxx --json-file dashboard.json
172
+ flowbase apps add-dashboards app_xxx dsh_xxx
173
+ flowbase apps reorder-members app_xxx --json '{"items":[{"type":"object","id":"obj_xxx"},{"type":"dashboard","id":"dsh_xxx"}]}'
174
+ flowbase changes commit --message "Add sales dashboard" --yes
175
+ flowbase changes release --message "Ship sales dashboard" --yes
176
+ ```
177
+
178
+ Dashboard component code runs server-side in a sandbox and returns ECharts config / metric / table / markdown. Components and filters are validated on save; use `flowbase dashboards get <id>` to discover component IDs, then `flowbase dashboards run <dashboard_id> <component_id>` to inspect `ok/output/error/logs` in a read-only draft preview (requires metadata:read and records:read). Visual chart rendering still requires the web UI.
179
+
180
+ ### 6.3 Production hotfix
181
+
182
+ ```bash
183
+ export FLOWBASE_HOST=https://flowbase.deepflowagent.com
184
+ flowbase changes direct-release --message "Fix customer field" --yes
185
+ ```
186
+
187
+ `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.
188
+
189
+ On production, `records.*` sees **released** metadata only. Creating records on a brand-new object before `direct-release` returns `404 内容不存在或已被删除`. Finish metadata, release, then seed.
190
+
191
+ ### 6.4 Workflows, approvals, and pages
192
+
193
+ 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`.
194
+
195
+ Workflow conditions use `fieldId` for current-object fields and add `relationFieldId` for a one-hop related field. Field-value references use `valueRef` plus optional `valueRefRelationFieldId`. An `updateRelated` node selects the target record with its required `relationFieldId`; its assignment `fieldId` values belong to that related object. Use `workflows list` to retrieve the current object fields and the available `relations` with target fields.
196
+
197
+ Approval flow graphs are separate metadata: exactly one `trigger`, at least one `approval` node, both `approvedEnd` and `rejectedEnd`, and dual outcome edges from each approval node. Employee task decisions are not available via API key / CLI. See `docs catalogs approval-nodes`.
198
+
199
+ ```bash
200
+ flowbase docs catalogs workflow-nodes
201
+ flowbase workflows create obj_xxx --json '{"label":"Set owner","enabled":true,"trigger":{"event":"create","match":"all","conditions":[]},"nodes":[],"edges":[]}'
202
+ flowbase workflows update obj_xxx wfl_xxx --json-file workflow.json
203
+ flowbase workflows executions obj_xxx wfl_xxx --result failure
204
+
205
+ flowbase docs catalogs approval-nodes
206
+ flowbase docs example approvals.create --output approval.json
207
+ flowbase approvals create obj_xxx --json-file approval.json
208
+ flowbase approvals set-enabled obj_xxx apr_xxx --base-revision 4 --enabled --yes
209
+
210
+ flowbase docs catalogs page-components # all component shapes and placement rules
211
+ flowbase docs catalogs page-rules # conditions, operators, and actions
212
+ flowbase pages options # objects, fields, and lookup constraints
213
+ flowbase docs example pages.create --output page.json # create-page layout template
214
+ flowbase pages create --json-file page.json
215
+ flowbase pages set-default pag_xxx --base-revision 4 --yes
216
+
217
+ # Detail pages support detailSummary, stageBar, tabs, relatedSummary,
218
+ # attachmentCard, noticeBlock, relatedList, and approval components.
219
+ # A placed field uses sourcePath=[] for the Page object, or 1-2
220
+ # {relationFieldId,targetObjectId} hops for a related object field.
221
+ # Component visibility uses a page-rules setComponentVisibility action
222
+ # targeting the stable cmp_ ID returned by pages get.
223
+ # Save and read back a newly added component before adding a rule for it.
224
+ flowbase pages get pag_xxx > page-read.json
225
+ # Build page.json as {baseRevision: page-read.draftRevision, page: page-read.page},
226
+ # then remove the read-only Page keys listed by page-components.
227
+ # Or start from the complete offline example:
228
+ flowbase docs example pages.update --output page.json
229
+ flowbase pages update pag_xxx --json-file page.json
230
+ ```
231
+
232
+ ### 6.5 Records and attachments
233
+
234
+ `records.list` is a **column projection** of the current view (often only the title field). Use `records.get` for the full `values` object. `values` keys are field keys; select/lookup values are option/record IDs.
235
+
236
+ ```bash
237
+ flowbase records list obj_xxx --page 1
238
+ flowbase records get obj_xxx rec_xxx
239
+ flowbase docs catalogs record-values
240
+ flowbase records create obj_xxx --json '{"values":{"name":"Ada","status":"opt_xxx","class":"rec_xxx"}}'
241
+ flowbase records upload-attachment obj_xxx fld_xxx ./contract.pdf
242
+ flowbase records update obj_xxx rec_xxx --json '{"values":{"attachments":["att_xxx"]}}'
243
+ flowbase records download-attachment obj_xxx rec_xxx att_xxx --output ./contract.pdf
244
+ ```
245
+
246
+ ### 6.6 Roles (production only)
247
+
248
+ ```bash
249
+ export FLOWBASE_HOST=https://flowbase.deepflowagent.com
250
+ flowbase docs catalogs permissions # function points + data scopes
251
+ flowbase roles options # apps and objects available for grants
252
+ flowbase roles create --json-file role.json
253
+ flowbase roles update rol_xxx --json-file role.json
254
+ ```
255
+
256
+ ## 7. Output and errors
257
+
258
+ - Success: JSON on stdout, exit code `0`. Use `--no-pretty` for compact JSON or `--raw` for the raw body.
259
+ - Failures (missing key, invalid JSON, HTTP 4xx/5xx, network errors, cancelled confirmation) go to stderr with a clear message and exit code `1`.
260
+ - `flowbase --help` lists every command; `flowbase <group> --help` and `flowbase <group> <action> --help` show flags and, for JSON commands, an inline body example.
261
+
262
+ ### Error matrix
263
+
264
+ | Scenario | HTTP / CLI behavior |
265
+ | --- | --- |
266
+ | Missing or invalid API key | 401; stderr tells you to set `FLOWBASE_API_KEY` or `--api-key` |
267
+ | Environment not enabled | 403; request is rejected before business logic |
268
+ | Missing draft revision / concurrent edit | 409; re-read with `get` and retry with the new `baseRevision` |
269
+ | Invalid request field or business rule | 400 / 422; `detail` explains the reason |
270
+ | Resource not found | 404 |
271
+ | Destructive command without `--yes` in automation | CLI refuses before any network call |
272
+
273
+ ## 8. Verification and cleanup
274
+
275
+ - `flowbase organization employees --query Ada --page 1`: discover real approval references; follow the returned `pages`. `organization departments` returns the full department tree.
276
+ - `flowbase records list obj_xxx --view-id viw_xxx`: query a specific active view. Invalid IDs return an error instead of silently selecting another view.
277
+ - `flowbase pages evaluate pag_xxx --json '{"values":{"done":true}}'`: evaluate draft rules on editor-style values. Returns rule overrides keyed by field/component IDs; does not render a page, validate record values, execute buttons, or write records.
278
+ - `flowbase pages clear-default pag_xxx --base-revision 4 --yes`: remove only this page's default assignment, including on a deleted object, then use `pages delete` with the newly returned revision.
279
+ - `docs catalogs page-buttons`, `workflow-branches`, `approval-rules`, and `dashboard-runtime` describe complex configuration and runtime limits.
280
+
281
+ Transport requests time out after 60 seconds. A lost write response has an unknown outcome: read the resource and current revision before retrying. The CLI never automatically retries writes.
@@ -0,0 +1,9 @@
1
+ flowbase_cli/__init__.py,sha256=e4KIz7k_3kja21MuC3NjQjskgBHOQgMNENP5NBJnJds,52
2
+ flowbase_cli/endpoints.py,sha256=W4bKCPuzrbZuBzivesCy87n-i5X4PafelaPr6KtHGBQ,79887
3
+ flowbase_cli/guide.py,sha256=zv6RgcGkmpAexR7NwBDwZFqubTqStSjNN57j2tcLR8Y,3949
4
+ flowbase_cli/main.py,sha256=Dwq6ngVshfMjufyggAmZVdnu6uT2t6rnbOu9K0pTG1k,63362
5
+ flowbase_cli-0.1.12.dist-info/METADATA,sha256=NGgaUomf6FmJ0xrdmqh7yCpF0pWFkI6FN13S8PX9FiY,16412
6
+ flowbase_cli-0.1.12.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
7
+ flowbase_cli-0.1.12.dist-info/entry_points.txt,sha256=kb3ZwOcvIIJ-2W3yyWgn7luZVbPsj57YusOyoIOv2YA,58
8
+ flowbase_cli-0.1.12.dist-info/top_level.txt,sha256=As7iuQHHfVT5d2WJ0cCN22Mmp0gTiOcoPpM0OC3XJxQ,13
9
+ flowbase_cli-0.1.12.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ flowbase = flowbase_cli.main:entrypoint
@@ -0,0 +1 @@
1
+ flowbase_cli