@softr/cli 0.1.4 → 0.1.6-se21219.17
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 +32 -9
- package/dist/cli.mjs +961 -185
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -222,26 +222,49 @@ schema refresh the cache too; the CLI rewrites it at any time, so never edit it.
|
|
|
222
222
|
```
|
|
223
223
|
crm/
|
|
224
224
|
softr-db.jsonc # { "databaseId": "…" }
|
|
225
|
-
.softr-db/schema.json # the cache
|
|
225
|
+
.softr-db/schema.json # the cache of the tables and fields
|
|
226
|
+
.softr-db/views/<tableId>.json # the views of a table, once views list read them
|
|
226
227
|
```
|
|
227
228
|
|
|
228
|
-
| Command
|
|
229
|
-
|
|
|
230
|
-
| `db list`
|
|
231
|
-
| `db get [<database>] [--dir <path>]`
|
|
232
|
-
| `db create <name> [--description <text>] [--workspace <id>] [--dir <path>]`
|
|
233
|
-
| `db update [<databaseId>] [--name <name>] [--description <text>] [--dir <path>]`
|
|
234
|
-
| `db delete [<databaseId>] [--force] [--dir <path>]`
|
|
229
|
+
| Command | What it does |
|
|
230
|
+
| ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
231
|
+
| `db list` | The databases the token reaches, across all workspaces, with their workspace and number of tables. |
|
|
232
|
+
| `db get [<database>] [--dir <path>]` | One database with its tables, by id or exact name. Outside a database directory it creates `./<name-slug>/`; inside one it refreshes the cache, and a different database is an error. |
|
|
233
|
+
| `db create <name> [--description <text>] [--workspace <id>] [--dir <path>]` | Create an empty database and its directory. The workspace defaults to `SOFTR_WORKSPACE_ID`, else to your only or default workspace among those where the token grants `databases.schema:write`. |
|
|
234
|
+
| `db update [<databaseId>] [--name <name>] [--description <text>] [--dir <path>]` | Change the name, the description or both. |
|
|
235
|
+
| `db delete [<databaseId>] [--force] [--dir <path>]` | Delete a database. One that still has tables needs `--force`, which also deletes the tables and all their records. The directory keeps its `softr-db.jsonc`; the cache goes. |
|
|
236
|
+
| `db tables list` / `get <table>` | The tables of the database; one table with its fields (ids, types, primary/required/read-only). |
|
|
237
|
+
| `db tables create <name> [--field <name:TYPE>]... [--primary-field <name>]` | Create a table with at least one `--field`; the first one names a record. |
|
|
238
|
+
| `db tables update <table> [--name] [--description]` / `delete <table> [--force]` | Rename or describe a table; delete it (`--force` when it still has records). |
|
|
239
|
+
| `db fields get <table> <field>` | One field with its options. |
|
|
240
|
+
| `db fields add <table> <name> --type <TYPE> [--options <json>] [--multiple]` | Add a field. The types and their options: [field reference](https://docs.softr.io/softr-api/softr-database-api/table-fields/add-table-field). |
|
|
241
|
+
| `db fields update <table> <field> [--name] [--type] [--options <json>] [--[no-]multiple]` | Change a field; what is not passed stays as it is, `--options` replaces the options as a whole. |
|
|
242
|
+
| `db fields delete <table> <field>` | Delete a field and its values in every record. |
|
|
243
|
+
| `db views list <table>` | The views of a table (the API reads views only). |
|
|
244
|
+
| `db records list <table> [--view <view>] [--limit <n>] [--offset <n>] [--all]` | Records through a view, the table's default view unless `--view`; one page or `--all` in pages of 200. |
|
|
245
|
+
| `db records search <table> [--filter <json>] [--sort <field[:desc]>]...` | Records by a filter ([operators](https://docs.softr.io/softr-api/softr-database-api/records/search-records)); without `--filter`, every record. |
|
|
246
|
+
| `db records get <table> <recordId>` | One record. |
|
|
247
|
+
| `db records create <table> --fields <json>` / `update <table> <recordId> --fields <json>` | Create a record, or change some of its fields. `--fields` is inline JSON, `@<file>` or `-`. |
|
|
248
|
+
| `db records delete <table> <recordId>` | Delete a record. |
|
|
249
|
+
| `db records upload <table> <recordId> <field> <file> [--name <fileName>]` | Add a local file to an attachment field, stored under the local file name unless `--name`. |
|
|
250
|
+
|
|
251
|
+
Tables and fields take an id or an exact name; a name two items share is an error that lists their ids. The table,
|
|
252
|
+
field and view commands take the database from `--database <id>`, else `SOFTR_DATABASE_ID`, else the database
|
|
253
|
+
directory, and keep its cache current; a delete always resolves the name on the server, never from the cache.
|
|
254
|
+
Records are keyed by field name in the output and take field names in `--fields`, filters and `--sort`; the CLI maps
|
|
255
|
+
them to ids, which the API needs. `--field-ids` keys the output by id. Records are never written to disk.
|
|
235
256
|
|
|
236
257
|
## Agent skills
|
|
237
258
|
|
|
238
|
-
|
|
259
|
+
Three skills in the [Agent Skills](https://agentskills.io) format, published in
|
|
239
260
|
[softr-io/softr-io-skills](https://github.com/softr-io/softr-io-skills):
|
|
240
261
|
|
|
241
262
|
- [`softr-cli`](https://github.com/softr-io/softr-io-skills/tree/master/skills/softr-cli): install and update the CLI,
|
|
242
263
|
log in, the root commands and the environment variables. Every other Softr skill builds on it.
|
|
243
264
|
- [`softr-workflows`](https://github.com/softr-io/softr-io-skills/tree/master/skills/softr-workflows): the
|
|
244
265
|
`softr workflows` scope, with the code-file rules in its `references/custom-code.md`.
|
|
266
|
+
- [`softr-db`](https://github.com/softr-io/softr-io-skills/tree/master/skills/softr-db): the `softr db` scope, the
|
|
267
|
+
database directory and the schema commands.
|
|
245
268
|
|
|
246
269
|
Install them as a plugin in Claude Code, which keeps them updated, or with `npx skills add softr-io/softr-io-skills`
|
|
247
270
|
in every other agent. The exact steps are on [docs.softr.io/softr-cli](https://docs.softr.io/softr-cli).
|