records-cli 0.0.1 → 0.0.3
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/dist/client.d.ts +1 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +26 -2
- package/dist/client.js.map +1 -1
- package/package.json +1 -1
- package/skill/SKILL.md +3 -2
- package/skill/references/REFERENCE.md +18 -18
package/dist/client.d.ts
CHANGED
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,eAAO,MAAM,cAAc,mCAAmC,CAAA;AAE9D,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED,qBAAa,QAAS,SAAQ,KAAK;IAG/B,QAAQ,CAAC,MAAM,EAAE,MAAM;IACvB,QAAQ,CAAC,IAAI,EAAE,OAAO;gBAFtB,OAAO,EAAE,MAAM,EACN,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO;CAKzB;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,eAAO,MAAM,cAAc,mCAAmC,CAAA;AAE9D,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED,qBAAa,QAAS,SAAQ,KAAK;IAG/B,QAAQ,CAAC,MAAM,EAAE,MAAM;IACvB,QAAQ,CAAC,IAAI,EAAE,OAAO;gBAFtB,OAAO,EAAE,MAAM,EACN,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO;CAKzB;AAyBD,wBAAgB,YAAY,CAAC,IAAI,EAAE,aAAa;cAGvB,CAAC,QAChB,MAAM,SACN,WAAW,GAAG;QAAE,IAAI,CAAC,EAAE,OAAO,CAAA;KAAE,KACrC,OAAO,CAAC,CAAC,CAAC;;EAgCd"}
|
package/dist/client.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Fixed production origin — not configurable. */
|
|
2
|
-
export const RECORDS_ORIGIN = "https://records
|
|
2
|
+
export const RECORDS_ORIGIN = "https://api-records.tolkee.dev";
|
|
3
3
|
export class ApiError extends Error {
|
|
4
4
|
status;
|
|
5
5
|
body;
|
|
@@ -13,6 +13,27 @@ export class ApiError extends Error {
|
|
|
13
13
|
function normalizeBaseUrl(url) {
|
|
14
14
|
return url.replace(/\/+$/, "");
|
|
15
15
|
}
|
|
16
|
+
/** Best-effort message from JSON error bodies (including nested Vercel-style `{ error: { message } }`). */
|
|
17
|
+
function formatHttpErrorPayload(parsed, fallback) {
|
|
18
|
+
if (parsed === null || typeof parsed !== "object") {
|
|
19
|
+
return fallback;
|
|
20
|
+
}
|
|
21
|
+
const o = parsed;
|
|
22
|
+
const err = o.error;
|
|
23
|
+
if (typeof err === "string")
|
|
24
|
+
return err;
|
|
25
|
+
if (err !== null && typeof err === "object" && "message" in err) {
|
|
26
|
+
const m = err.message;
|
|
27
|
+
if (typeof m === "string")
|
|
28
|
+
return m;
|
|
29
|
+
}
|
|
30
|
+
try {
|
|
31
|
+
return JSON.stringify(parsed);
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return fallback;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
16
37
|
export function createClient(opts) {
|
|
17
38
|
const base = normalizeBaseUrl(opts.baseUrl);
|
|
18
39
|
async function request(path, init = {}) {
|
|
@@ -40,7 +61,10 @@ export function createClient(opts) {
|
|
|
40
61
|
parsed = null;
|
|
41
62
|
}
|
|
42
63
|
if (!res.ok) {
|
|
43
|
-
|
|
64
|
+
const detail = typeof parsed === "object" && parsed !== null
|
|
65
|
+
? formatHttpErrorPayload(parsed, text || res.statusText)
|
|
66
|
+
: text || res.statusText;
|
|
67
|
+
throw new ApiError(`HTTP ${res.status}: ${detail}`, res.status, parsed);
|
|
44
68
|
}
|
|
45
69
|
return parsed;
|
|
46
70
|
}
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,MAAM,CAAC,MAAM,cAAc,GAAG,gCAAgC,CAAA;AAO9D,MAAM,OAAO,QAAS,SAAQ,KAAK;IAGtB;IACA;IAHX,YACE,OAAe,EACN,MAAc,EACd,IAAa;QAEtB,KAAK,CAAC,OAAO,CAAC,CAAA;QAHL,WAAM,GAAN,MAAM,CAAQ;QACd,SAAI,GAAJ,IAAI,CAAS;QAGtB,IAAI,CAAC,IAAI,GAAG,UAAU,CAAA;IACxB,CAAC;CACF;AAED,SAAS,gBAAgB,CAAC,GAAW;IACnC,OAAO,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;AAChC,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,IAAmB;IAC9C,MAAM,IAAI,GAAG,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAE3C,KAAK,UAAU,OAAO,CACpB,IAAY,EACZ,OAAyC,EAAE;QAE3C,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QACzC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;YAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAA;QACrE,IAAI,IAAI,CAAC,KAAK;YAAE,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,UAAU,IAAI,CAAC,KAAK,EAAE,CAAC,CAAA;QACpE,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YAC5B,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,kBAAkB,CAAC,CA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ILL.md
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
---
|
|
2
2
|
|
|
3
3
|
## name: records-cli
|
|
4
|
+
|
|
4
5
|
description: How to record new knowledge for the user via the Records CLI—create groups and records so ideas from the chat become stored documents. Use when the user asks to save, remember, or record something from the conversation, or when you should persist an explanation (lesson, reference, how-to) for later.
|
|
5
|
-
compatibility: Requires the `records-cli` npm package (or a local build). Uses HTTPS against `https://records
|
|
6
|
+
compatibility: Requires the `records-cli` npm package (or a local build). Uses HTTPS against `https://api-records.tolkee.dev` only. Commands that change data need a token; ask the user if you do not have one.
|
|
6
7
|
metadata:
|
|
7
8
|
cli-package: records-cli
|
|
8
9
|
spec-version: "1.0"
|
|
@@ -12,7 +13,7 @@ metadata:
|
|
|
12
13
|
## Install and environment
|
|
13
14
|
|
|
14
15
|
- **Package:** `records-cli` — install with `npm install -g records-cli` or run ad hoc with `npx records-cli`.
|
|
15
|
-
- **Server:** always `https://records
|
|
16
|
+
- **Server:** always `https://api-records.tolkee.dev` (not configurable).
|
|
16
17
|
- **Token:** For commands that mutate or list protected data, pass `-t <token>` or set `RECORDS_TOKEN` to the user’s plaintext key.
|
|
17
18
|
- **If you do not already have a key**, ask the user before running protected commands. Do not guess or fabricate a key. Once they share it, use it only for CLI invocations and avoid repeating the full secret in replies when unnecessary.
|
|
18
19
|
- If the user has no key yet, they may create one through their usual Records setup, or—where the server allows it—via the bootstrap flow described in the reference (creating the first key when none exist).
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
| `-p, --pretty` | — | Pretty-print JSON on stdout |
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
All requests use `**https://records
|
|
12
|
+
All requests use `**https://api-records.tolkee.dev`** as the origin (fixed).
|
|
13
13
|
|
|
14
14
|
Successful responses are JSON on **stdout** (usually `{ "data": … }`). Failures print JSON with `error` (and `status` / `body` when available) on **stdout**; the process exits non-zero.
|
|
15
15
|
|
|
@@ -83,13 +83,13 @@ Links to a record by path `**groupSlug/recordSlug`** (the slugs returned by the
|
|
|
83
83
|
### `groups`
|
|
84
84
|
|
|
85
85
|
|
|
86
|
-
| Command
|
|
87
|
-
|
|
|
88
|
-
| `records-cli groups list [--with-records]`
|
|
89
|
-
| `records-cli groups get (--id
|
|
90
|
-
| `records-cli groups create --title <title>`
|
|
91
|
-
| `records-cli groups patch <id> --title <title>`
|
|
92
|
-
| `records-cli groups delete <id>`
|
|
86
|
+
| Command | Auth | Notes |
|
|
87
|
+
| ----------------------------------------------- | --------- | -------------------------------------------------------------------------- |
|
|
88
|
+
| `records-cli groups list [--with-records]` | No | With `--with-records`: each group may include `"records": RecordSummary[]` |
|
|
89
|
+
| `records-cli groups get (--id | --slug )` | No |
|
|
90
|
+
| `records-cli groups create --title <title>` | Bearer | 201 `{ "data": GroupRow }` |
|
|
91
|
+
| `records-cli groups patch <id> --title <title>` | Bearer | 200 `{ "data": GroupRow }` |
|
|
92
|
+
| `records-cli groups delete <id>` | Bearer | Success: empty body |
|
|
93
93
|
|
|
94
94
|
|
|
95
95
|
**Group row:** `{ "id", "title", "slug" }`
|
|
@@ -106,11 +106,11 @@ Slugs are generated from titles (unique per scope).
|
|
|
106
106
|
### `group-records` (nested under a group slug)
|
|
107
107
|
|
|
108
108
|
|
|
109
|
-
| Command
|
|
110
|
-
|
|
|
111
|
-
| `records-cli group-records list <groupSlug>`
|
|
112
|
-
| `records-cli group-records get <groupSlug> <recordSlug>`
|
|
113
|
-
| `records-cli group-records create
|
|
109
|
+
| Command | Auth | Notes |
|
|
110
|
+
| --------------------------------------------------------- | -------------------- | --------------------------------- |
|
|
111
|
+
| `records-cli group-records list <groupSlug>` | No | 200 `{ "data": RecordSummary[] }` |
|
|
112
|
+
| `records-cli group-records get <groupSlug> <recordSlug>` | No | 200 `{ "data": RecordRow }` |
|
|
113
|
+
| `records-cli group-records create --title --content <path | -> [--description ]` | Bearer |
|
|
114
114
|
|
|
115
115
|
|
|
116
116
|
**Create body:** `title` (required), `content` (required), optional `description`.
|
|
@@ -120,11 +120,11 @@ Slugs are generated from titles (unique per scope).
|
|
|
120
120
|
### `records` (by numeric id)
|
|
121
121
|
|
|
122
122
|
|
|
123
|
-
| Command
|
|
124
|
-
|
|
|
125
|
-
| `records-cli records get <id>`
|
|
126
|
-
| `records-cli records patch
|
|
127
|
-
| `records-cli records delete <id>`
|
|
123
|
+
| Command | Auth | Notes |
|
|
124
|
+
| ----------------------------------------------------- | ------------------------------------------ | --------------------------- |
|
|
125
|
+
| `records-cli records get <id>` | No | 200 `{ "data": RecordRow }` |
|
|
126
|
+
| `records-cli records patch [--title] [--content <path | ->] [--description] [--clear-description]` | Bearer |
|
|
127
|
+
| `records-cli records delete <id>` | Bearer | Success: empty body |
|
|
128
128
|
|
|
129
129
|
|
|
130
130
|
**Record row:** `{ "id", "title", "description", "slug", "groupId", "content" }`
|