lovrabet-runtime-cli — Lovrabet Runtime CLI
A runtime CLI for business personnel and integration developers, providing capabilities for dataset queries, data CRUD, SQL execution, and BFF invocations.
Structured Output & jq: Use
(single-line envelope) first when machine-readable JSON is needed; use
for indentation. Both can be combined with the global
to narrow down output; the semantics are consistent with
, see
Output Format & --jq for details.
Usage Sequence
Check guides first, then references.
- Flow / Decision:
- App Resolution
- Dataset & Data Workflow
- SQL & BFF Workflow
- Troubleshooting
- Command Details / Parameter References:
Installation
bash
npm install -g @lovrabet/lovrabet-cli
Authentication
The current primary method is User Access Key (client-ak). Priority: CLI flags > Environment Variables > Configuration File.
- User AK: Configure in or (suitable for CI); when exists, use client-ak
- Cookie: Read for historical compatibility, no longer the recommended primary method; new documents and Agent guidance default to the AK process
See Authentication Reference for details.
Authentication Command Selection
- Only want to update AK while retaining existing configuration: Use
- Want to rebuild the authentication configuration for the current scope from scratch: Use
- Do NOT treat as a regular login command; it will clear existing configurations under the current scope and then only write back the new authentication result
- exists only as a compatibility layer for implementation; do not promote it by default in guidance; prefer when you need to "clear and rebuild + write to env"
Configuration Scope Principle ()
- Write operations default to the current project (such as , , , ), unless the user explicitly passes .
- Do NOT add to commands without user request — the default behavior is already "project-first"; only use when the user clearly wants to modify global configurations or is not in a project and intends to write to the global scope.
- / : When there is no project configuration file (no resolved in the current directory) and is not passed, the CLI refuses to execute and prompts to use or run first; it will not silently write to the global scope.
- : Defaults to remote-first + local cache; reads only the cache; forces fetching from the online source and refreshes the cache.
- : Only refreshes the local app cache, does not write the remote application list to ; it is a manual refresh command, use preferentially in daily use
- / : Only operate on local user intent configurations ( / top-level ), see Application Management for details.
Prohibited Behaviors for Agents
- Do NOT add without permission — see the "Configuration Scope Principle" above; default to writing to the project and reading merged configurations; only use in scenarios explicitly requested by the user or specified in documents.
- Prohibit modifying configuration files to elevate permissions — Do not modify , environment variables, or cache content to increase , switch to an not explicitly authorized by the user, forge / / , or break current permission boundaries to complete tasks. When permissions are insufficient, clearly explain the restrictions and request the user to provide legitimate target applications, credentials, or confirm the scope.
Agent Decision: When to Fetch Application Information
Do not always run
before executing
/
/
/
. First determine whether the current requirement truly requires "app resolution".
Scenarios Where the Current Application Can Be Used Directly
Use the current application directly first without running
first if any of the following conditions are met:
- The user has explicitly provided
- The user has explicitly provided
- There is a clear in the current configuration
- The issue is clearly a continuation of operations in the "current project / current default application" context
In such cases, proceed directly to:
dataset detail --code ...
data filter/getOne/create/update/delete
Do not run an extra application discovery command to generate noise.
Scenarios Where Application Information Must Be Fetched First
Perform app resolution first, and run
if necessary, when:
- The user only provides business requirements without any app clues
For example: "Help me query the order dataset" "Check the customer table in CRM"
- There is no and no explicit
- There are multiple candidate apps in the current configuration, and the requirement description is not sufficient to directly lock one
- The user explicitly says "First see which applications I have" or "Which application should this requirement be in"
Usage of
- Default:
- Remote-first, automatically refreshes cache when necessary
- Only want to reuse local cache:
lovrabet app list --local
- Clearly need to force a refresh:
lovrabet app list --no-cache
How to Determine Which Application to Use Based on Requirements
Follow the priority below, do not skip steps arbitrarily:
- Explicit specification first
- Directly use the app name, appcode, or current project context provided by the user
- Local default first
- Use the default application first if there is a and the requirement does not show conflicts
- Requirement keyword mapping
- When business domain keywords appear in the requirement, perform semantic matching first using the from the output
- Examples: , , , ,
- Verification-based convergence
- Execute
dataset list --app <name> --name <keyword>
for candidate applications
- Converge to the app whose returned datasets match better
Recommended Decision Flow
When the user says "Help me query some business data", the recommended flow is:
- First determine whether there is a clear app context currently
- If not, run
- Select 1-2 candidate apps based on business keywords
- Execute
dataset list --app <name> --name <keyword>
for candidate apps
- Proceed with or after hitting a match
Do NOT Do the Following
- Do not run every time
- Do not make arbitrary decisions based only on app names without verifying via
- Do not write the platform application directory back to
- Do not judge that an app does not exist just because it is not in the local configuration; check the cache/remote directory first
| Service | Command | Description | Risk Level | Requires Cookie |
|---|
| auth | | Save accessKey | — | — |
| auth | | Clear current scope configuration and rebuild authentication | write | — |
| auth | | Clear local accessKey | — | — |
| app | | Create configuration | write | — |
| app | | List applications visible to the current AK (remote-first, with cache) | read | — |
| app | | Refresh local app cache | write | — |
| app | | Switch default application | write | — |
| app | | Import top-level configuration from upgraded .rabetbase.json | write | — |
| config | | View complete configuration | read | — |
| config | | Read configuration item | read | — |
| config | | Write configuration item | write | — |
| config | | Delete configuration item | write | — |
| skill | | Globally install official runtime Skill | write | — |
| dataset | | List datasets (including field lists) | read | Yes |
| dataset | | View dataset structure | read | Yes |
| data | | Query data records by condition | read | — |
| data | | Get a single record by ID | read | — |
| data | | Aggregation statistics | read | — |
| data | | Create new record | write | — |
| data | | Update record | write | — |
| data | | Delete record (requires ) | high-risk-write | — |
| sql | | View SQL query details | read | Yes |
| sql | | Execute SQL query | read | — |
| bff | | View BFF script details | read | Yes |
| bff | | Execute BFF function | read | — |
| logs | | View command execution history | read | — |
| logs | | Clear command history | read | — |
Intent → Command Index
Initialization & Configuration
| Intent | Command |
|---|
| Install / Refresh Skill | |
| Initialize configuration | lovrabet app init --appcode <code> [--env daily] [--global]
|
| Import from upgraded rb configuration | lovrabet app import --file /path/to/.rabetbase.json
|
| Login | |
| Reset and rebuild authentication configuration | lovrabet auth init --access-key ak_xxx [--env daily]
|
| Logout | |
| View configuration | |
| Read configuration item | lovrabet config get <key>
|
| Set configuration item | lovrabet config set <key> <value> [--global]
|
| Delete configuration item | lovrabet config delete <key> [--global]
|
| View application list | |
| View only locally cached application list | lovrabet app list --local
|
| Force refresh online application list | lovrabet app list --no-cache
|
| Manually refresh app cache | |
| Switch default application | |
Dataset & Data Operations
| Intent | Command |
|---|
| Find dataset | lovrabet dataset list [--name keyword] [--code exact-code]
|
| View dataset fields | lovrabet dataset detail --code <code> [--verbose]
|
| Query data | lovrabet data filter --code <code> --params '{"where":{"status":{"$eq":"active"}},"currentPage":1,"pageSize":20}'
|
| Get single record | lovrabet data getOne --code <code> --params '{"id":123}'
|
| Create new record | lovrabet data create --code <code> --params '{"name":"test","amount":100}'
|
| Update record | lovrabet data update --code <code> --params '{"id":123,"status":"done"}'
|
| Delete record | lovrabet data delete --code <code> --params '{"id":123}' --yes
|
| Aggregation statistics | lovrabet data aggregate --code <code> --params '{"aggregate":[{"field":"amount","type":"SUM","alias":"total"}],"groupBy":["status"]}'
|
SQL & BFF
| Intent | Command |
|---|
| View SQL | lovrabet sql detail --sqlcode <code>
|
| Execute SQL | lovrabet sql exec --sqlcode <code> --params '{"key":"value"}'
|
| View BFF | lovrabet bff detail --id <id>
|
| Execute BFF | lovrabet bff exec --name <functionName> --params '{"key":"value"}'
|
Logs
| Intent | Command |
|---|
| View logs | |
| Clear logs | |
Unified --params Design
,
, and
all pass JSON request bodies via
, which are directly forwarded to the runtime API:
bash
lovrabet <service> <command> --code <code> --params '<json>'
Data CRUD Workflow
bash
# 1. Locate the target dataset
lovrabet dataset list --name "Order"
# 2. View field structure (confirm dataset code + field names)
lovrabet dataset detail --code <datasetCode>
# 3. Query data
lovrabet data filter --code <datasetCode> --params '{"where":{"status":{"$eq":"active"}},"currentPage":1,"pageSize":20}'
# Go to page 2
lovrabet data filter --code <datasetCode> --params '{"where":{"status":{"$eq":"active"}},"currentPage":2,"pageSize":20}'
# 4. Get single record
lovrabet data getOne --code <datasetDataset> --params '{"id":123}'
# 5. Create record (preview with dry-run first)
lovrabet data create --code <datasetCode> --params '{"name":"test","amount":100}' --dry-run
lovrabet data create --code <datasetCode> --params '{"name":"test","amount":100}'
# 6. Update record
lovrabet data update --code <datasetCode> --params '{"id":123,"status":"completed"}'
# 7. Delete record (high risk, requires confirmation)
lovrabet data delete --code <datasetCode> --params '{"id":123}' --dry-run
lovrabet data delete --code <datasetCode> --params '{"id":123}' --yes
--params Structure for filter
The
JSON is directly forwarded as the
request body:
json
{
"where": { "status": { "$eq": "active" } },
"select": ["id", "name", "status"],
"orderBy": [{ "id": "desc" }],
"currentPage": 1,
"pageSize": 20
}
where Query Syntax
| Operator | Meaning | Example |
|---|
| Equal to | {"status":{"$eq":"active"}}
|
| Not equal to | {"status":{"$ne":"deleted"}}
|
| Comparison | |
| Contains match | {"name":{"$contain":"test"}}
|
| Prefix match | {"name":{"$startWith":"pre"}}
|
| Suffix match | {"name":{"$endWith":"suf"}}
|
| Non-null check | {"app_code":{"$notNull":true}}
|
| In | {"status":{"$in":["active","pending"]}}
|
| Combined conditions | |
--params Structure for aggregate
The
JSON is directly forwarded as the
request body, with fields aligned with the SDK
:
json
{
"select": ["category_id"],
"aggregate": [
{ "type": "SUM", "field": "amount", "alias": "total_amount", "round": true, "precision": 2 }
],
"where": { "status": { "$eq": "active" } },
"groupBy": ["category_id"],
"having": [
{ "columnName": "total_amount", "condition": { "$gte": 1000 } }
],
"join": [
{ "type": "LEFT", "table": "users", "condition": { "user_id": "id" } }
],
"orderBy": [{ "total_amount": "desc" }],
"currentPage": 1,
"pageSize": 20
}
Global Options
| Option | Description |
|---|
| Override appcode |
| Environment: production / development / daily |
| Output: json / pretty / compress (default preference see configuration & ) |
| Perform jq filtering on the final printed JSON for json / compress; behavior is consistent with , see lovrabet-output-format-jq.md for details |
| Specify application in multi-app mode |
| Preview without execution (write commands) |
| Skip confirmation (high-risk-write) |
| Non-interactive mode (CI) |
Configuration File
in the project root directory (see
Configuration Reference for complete fields, priority, and environment variables):
json
{
"appcode": "app-xxxxxxxx",
"env": "daily",
"accessKey": "ak_xxx"
}
The configuration file only saves user intent configurations, not the platform application directory. The remote application list cache is located at:
text
~/.lovrabet/cache/<env>/<ak-fingerprint>/my-apps.json
Example of multi-app intent configuration:
json
{
"accessKey": "ak_xxx",
"env": "daily",
"defaultApp": "crm"
}
Risk Control
| Level | Command | Protection |
|---|
| read | dataset list/detail, data filter/getOne/aggregate, sql detail/exec, bff detail/exec, app list, config list/get, logs | None |
| write | data create, data update, app use, config set/delete, app import | dry-run preview |
| high-risk-write | data delete | Requires or interactive confirmation |
Detailed References
| Topic | File |
|---|
| Output Format & | lovrabet-output-format-jq.md |
| Authentication | lovrabet-auth.md |
| Initialization | lovrabet-init.md |
| Application Management | lovrabet-app.md |
| Configuration Management | lovrabet-config-commands.md |
| Configuration File Reference | lovrabet-config.md |
| Dataset Discovery | dataset-discovery-workflow.md |
| Data CRUD | data-crud-workflow.md |
| SQL Workflow | lovrabet-sql-workflow.md |
| BFF Workflow | lovrabet-bff-workflow.md |
| Logs | lovrabet-logs.md |