@jsondb-cloud/cli 1.0.12 → 1.0.14

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 ADDED
@@ -0,0 +1,164 @@
1
+ # @jsondb-cloud/cli
2
+
3
+ The official CLI tool for [jsondb.cloud](https://jsondb.cloud) — a hosted JSON document database.
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@jsondb-cloud/cli)](https://www.npmjs.com/package/@jsondb-cloud/cli)
6
+ [![npm downloads](https://img.shields.io/npm/dm/@jsondb-cloud/cli)](https://www.npmjs.com/package/@jsondb-cloud/cli)
7
+ [![CI](https://github.com/JsonDBCloud/cli/actions/workflows/ci.yml/badge.svg)](https://github.com/JsonDBCloud/cli/actions)
8
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5-blue)](https://www.typescriptlang.org/)
9
+ [![Node.js](https://img.shields.io/badge/node-%3E%3D18-brightgreen)](https://nodejs.org)
10
+ [![Bundle size](https://img.shields.io/bundlephobia/min/@jsondb-cloud/cli)](https://bundlephobia.com/package/@jsondb-cloud/cli)
11
+ [![GitHub stars](https://img.shields.io/github/stars/JsonDBCloud/cli)](https://github.com/JsonDBCloud/cli)
12
+ [![Last commit](https://img.shields.io/github/last-commit/JsonDBCloud/cli)](https://github.com/JsonDBCloud/cli)
13
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
14
+
15
+ ## Install
16
+
17
+ ### npm
18
+
19
+ ```bash
20
+ npm install -g @jsondb-cloud/cli
21
+ ```
22
+
23
+ ### Homebrew
24
+
25
+ ```bash
26
+ brew install jsondbcloud/tap/jsondb
27
+ ```
28
+
29
+ ### Standalone binaries
30
+
31
+ Download prebuilt binaries from [GitHub Releases](https://github.com/JsonDBCloud/cli/releases).
32
+
33
+ Available platforms: macOS (arm64, x64), Linux (x64, arm64).
34
+
35
+ ## Quick Start
36
+
37
+ ```bash
38
+ # Authenticate
39
+ jsondb login
40
+
41
+ # List collections
42
+ jsondb collections
43
+
44
+ # Push local data
45
+ jsondb push ./data/users.json --to users
46
+
47
+ # Get a document
48
+ jsondb get users/usr_abc123
49
+
50
+ # Pull collection to file
51
+ jsondb pull users --out users.json
52
+ ```
53
+
54
+ ## Configuration
55
+
56
+ ### Auth
57
+
58
+ `jsondb login` prompts for your API key interactively. Keys start with `jdb_sk_`.
59
+
60
+ Credentials are stored at `~/.config/jsondb/credentials.json`.
61
+
62
+ ### Environment variables
63
+
64
+ | Variable | Description |
65
+ |----------|-------------|
66
+ | `JSONDB_API_KEY` | API key (overrides stored credentials) |
67
+ | `JSONDB_PROJECT` | Default project namespace |
68
+ | `JSONDB_BASE_URL` | API base URL (for self-hosted or staging) |
69
+
70
+ ### Global flags
71
+
72
+ | Flag | Description |
73
+ |------|-------------|
74
+ | `--api-key <key>` | API key for this request |
75
+ | `--project <ns>` | Project namespace |
76
+ | `--base-url <url>` | API base URL |
77
+ | `--format <fmt>` | Output format: `json`, `raw`, `ndjson`, `table` |
78
+
79
+ ## Commands
80
+
81
+ ### Auth
82
+
83
+ | Command | Description |
84
+ |---------|-------------|
85
+ | `login` | Authenticate with your API key |
86
+ | `logout` | Remove stored credentials |
87
+ | `whoami` | Show the current authenticated user |
88
+
89
+ ### Documents
90
+
91
+ | Command | Description |
92
+ |---------|-------------|
93
+ | `get <path>` | Retrieve a document by path |
94
+ | `create <collection>` | Create a new document in a collection |
95
+ | `update <path>` | Replace a document at the given path |
96
+ | `patch <path>` | Partially update a document |
97
+ | `delete <path>` | Delete a document |
98
+
99
+ ### Collections
100
+
101
+ | Command | Description |
102
+ |---------|-------------|
103
+ | `collections` | List all collections |
104
+ | `documents <collection>` | List documents in a collection |
105
+
106
+ ### Import/Export
107
+
108
+ | Command | Description |
109
+ |---------|-------------|
110
+ | `push <file> --to <collection>` | Import a local JSON file into a collection |
111
+ | `pull <collection>` | Export a collection to a local file |
112
+
113
+ ### Schema
114
+
115
+ | Command | Description |
116
+ |---------|-------------|
117
+ | `schema get <collection>` | Retrieve the schema for a collection |
118
+ | `schema set <collection>` | Set or update a collection schema |
119
+ | `schema remove <collection>` | Remove the schema from a collection |
120
+
121
+ ### Versions
122
+
123
+ | Command | Description |
124
+ |---------|-------------|
125
+ | `versions list <collection> <id>` | List version history for a document |
126
+ | `versions get <collection> <id> <version>` | Retrieve a specific version |
127
+ | `versions diff <collection> <id>` | Show diff between versions |
128
+ | `versions restore <collection> <id> <version>` | Restore a document to a previous version |
129
+
130
+ ### Webhooks
131
+
132
+ | Command | Description |
133
+ |---------|-------------|
134
+ | `webhooks list <collection>` | List webhooks for a collection |
135
+ | `webhooks create <collection>` | Create a new webhook |
136
+ | `webhooks get <collection> <id>` | Get webhook details |
137
+ | `webhooks update <collection> <id>` | Update a webhook |
138
+ | `webhooks delete <collection> <id>` | Delete a webhook |
139
+ | `webhooks test <collection> <id>` | Send a test event to a webhook |
140
+
141
+ ### Utilities
142
+
143
+ | Command | Description |
144
+ |---------|-------------|
145
+ | `validate <collection>` | Validate documents against the collection schema |
146
+ | `count <collection>` | Count documents in a collection |
147
+ | `bulk <collection>` | Perform bulk operations on a collection |
148
+
149
+ ## Documentation
150
+
151
+ Full documentation at [jsondb.cloud/docs](https://jsondb.cloud/docs).
152
+
153
+ ## Related Packages
154
+
155
+ | Package | Description |
156
+ |---------|-------------|
157
+ | [@jsondb-cloud/client](https://github.com/JsonDBCloud/node) | JavaScript/TypeScript SDK |
158
+ | [@jsondb-cloud/mcp](https://github.com/JsonDBCloud/mcp) | MCP server for AI agents |
159
+ | [@jsondb-cloud/cli](https://github.com/JsonDBCloud/cli) | CLI tool |
160
+ | [jsondb-cloud](https://github.com/JsonDBCloud/python) (PyPI) | Python SDK |
161
+
162
+ ## License
163
+
164
+ MIT
@@ -28,7 +28,7 @@ async function listKeysCommand(client) {
28
28
  (0, output_1.printTable)(headers, rows);
29
29
  }
30
30
  async function createKeyCommand(client, options) {
31
- const res = await client.rawGet("/api/keys"); // POST via the dashboard API
31
+ await client.rawGet("/api/keys"); // POST via the dashboard API
32
32
  // Actually we need to post to create. Use a different approach
33
33
  const body = {
34
34
  name: options.name || "CLI-generated key",
@@ -61,7 +61,7 @@ async function pullCommand(collection, client, options) {
61
61
  if (options.out) {
62
62
  fs.writeFileSync(options.out, content, "utf-8");
63
63
  // Count documents
64
- let count = 0;
64
+ let count;
65
65
  if (format === "json") {
66
66
  try {
67
67
  count = JSON.parse(content).length;
package/dist/index.js CHANGED
@@ -19,7 +19,7 @@ program
19
19
  .description("The jsondb.cloud CLI — manage your JSON database from the terminal")
20
20
  .version("1.0.0")
21
21
  .option("--api-key <key>", "Use a specific API key")
22
- .option("--project <ns>", "Target project (default: \"default\")")
22
+ .option("--project <ns>", 'Target project (default: "default")')
23
23
  .option("--base-url <url>", "API base URL")
24
24
  .option("--format <fmt>", "Output format: json, raw, ndjson, table");
25
25
  function getClient() {
@@ -149,14 +149,14 @@ keys
149
149
  .option("--name <name>", "Key name")
150
150
  .option("--scope <scope>", "Scope: read-only, read-write", "read-write")
151
151
  .option("--project <ns>", "Target project")
152
- .action(async (opts) => {
152
+ .action(async (_opts) => {
153
153
  (0, output_1.error)("Key creation requires dashboard authentication. Use the web dashboard at https://jsondb.cloud/dashboard/api-keys");
154
154
  process.exit(1);
155
155
  });
156
156
  keys
157
157
  .command("revoke <id>")
158
158
  .description("Revoke an API key")
159
- .action(async (id) => {
159
+ .action(async (_id) => {
160
160
  (0, output_1.error)("Key revocation requires dashboard authentication. Use the web dashboard at https://jsondb.cloud/dashboard/api-keys");
161
161
  process.exit(1);
162
162
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsondb-cloud/cli",
3
- "version": "1.0.12",
3
+ "version": "1.0.14",
4
4
  "description": "CLI tool for jsondb.cloud — push, pull, manage your JSON database from the terminal",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -15,14 +15,24 @@
15
15
  "scripts": {
16
16
  "build": "tsc",
17
17
  "dev": "tsc --watch",
18
- "typecheck": "tsc --noEmit"
18
+ "typecheck": "tsc --noEmit",
19
+ "lint": "eslint src/",
20
+ "lint:fix": "eslint src/ --fix",
21
+ "format": "prettier --write 'src/**/*.ts'",
22
+ "format:check": "prettier --check 'src/**/*.ts'",
23
+ "test": "vitest run"
19
24
  },
20
25
  "dependencies": {
21
26
  "commander": "^13.0.0"
22
27
  },
23
28
  "devDependencies": {
29
+ "@eslint/js": "^10.0.1",
30
+ "@types/node": "^20.0.0",
31
+ "eslint": "^10.0.2",
32
+ "prettier": "^3.8.1",
24
33
  "typescript": "^5.4.0",
25
- "@types/node": "^20.0.0"
34
+ "typescript-eslint": "^8.56.1",
35
+ "vitest": "^4.0.18"
26
36
  },
27
37
  "keywords": [
28
38
  "jsondb",