@mx-space/cli 0.12.1 → 0.13.0
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 +59 -0
- package/ROADMAP.md +10 -7
- package/dist/bin/mxs.mjs +1 -1
- package/dist/esm-DGvoYR6n.mjs +2 -0
- package/dist/{esm-DFrz5rIo.mjs → esm-lpolVSUJ.mjs} +42 -7
- package/dist/index.d.mts +30 -1
- package/dist/index.mjs +1 -1
- package/dist/{mxs-PcmoYdgj.mjs → mxs-PFV8OJ-M.mjs} +5470 -4574
- package/package.json +1 -1
- package/skills/commands-ai.md +115 -0
- package/skills/overview.md +1 -0
- package/dist/esm-DXO9Afik.mjs +0 -2
package/package.json
CHANGED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
---
|
|
2
|
+
slug: commands-ai
|
|
3
|
+
title: AI commands
|
|
4
|
+
description: mxs ai — manage AI summary / translation / insights artifacts
|
|
5
|
+
order: 45
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# AI commands
|
|
9
|
+
|
|
10
|
+
`mxs ai` manages every AI artifact the core server produces: per-article **summary**, per-article **translation**, per-article **insights**, plus the i18n **translation entries** dictionary used for category / topic / note metadata.
|
|
11
|
+
|
|
12
|
+
Article references (`<id>`) accept a Snowflake id, a post slug, or a numeric note nid. The CLI resolves through post first, then note. Record references (`<recordId>`) are raw Snowflakes — they are NOT resolved.
|
|
13
|
+
|
|
14
|
+
## Generate verbs (async)
|
|
15
|
+
|
|
16
|
+
`summary regen`, `translate run`, `insights refresh` enqueue a task and poll `GET /tasks/:id` until terminal (`succeeded` / `failed` / `cancelled`, or the spec-2 `completed` / `partial_failed` aliases). Progress lines write to stderr. `--no-wait` returns immediately with `status: pending`. If the server reports `created: false`, an in-flight deduplicated task already exists; the CLI joins it instead of erroring. Polling cadence is 1000 ms by default; override with `MXS_AI_POLL_MS=<ms>` for tests.
|
|
17
|
+
|
|
18
|
+
| Command | Purpose |
|
|
19
|
+
| ---------------------------------------------------- | --------------------------------------------------------------- |
|
|
20
|
+
| `mxs ai summary regen <id> [--to <lang>...]` | Regenerate an article's AI summary. |
|
|
21
|
+
| `mxs ai translate run <id> --to <lang>...` | Translate an article into one or more languages (`--to` required, repeatable). |
|
|
22
|
+
| `mxs ai insights refresh <id> [--to <lang>...]` | Refresh AI insights for an article. |
|
|
23
|
+
|
|
24
|
+
Common flags on the three generate verbs:
|
|
25
|
+
|
|
26
|
+
| Flag | Effect |
|
|
27
|
+
| ---------------- | ------------------------------------------------------------------ |
|
|
28
|
+
| `--to <lang>` | Target language code (repeatable). Forwarded as `targetLanguages`. |
|
|
29
|
+
| `--no-wait` | Return after task creation; print `status: pending` and exit 0. |
|
|
30
|
+
|
|
31
|
+
On success the CLI emits an `ai-task` view: `taskId`, `status`, `refId`, `targetLanguages`, `totalTokens`, `totalCost` (cents), `resultIds`.
|
|
32
|
+
|
|
33
|
+
## Summary read / manage
|
|
34
|
+
|
|
35
|
+
| Command | Purpose |
|
|
36
|
+
| ------------------------------------------------------------- | ------------------------------------------------------------- |
|
|
37
|
+
| `mxs ai summary list [--page <n>] [--size <n>] [--grouped]` | List summaries (flat or grouped by article). |
|
|
38
|
+
| `mxs ai summary get <recordId>` | Get one summary by record id. |
|
|
39
|
+
| `mxs ai summary by-article <id> [--lang <l>] [--only-db]` | Show an article's summary; `--only-db` skips auto-generation. |
|
|
40
|
+
| `mxs ai summary edit <recordId>` | Edit the `summary` field via `$EDITOR` (JSON envelope). |
|
|
41
|
+
| `mxs ai summary delete <recordId> [--force]` | Delete a summary record. `--force` required in non-TTY. |
|
|
42
|
+
|
|
43
|
+
## Translation read / manage
|
|
44
|
+
|
|
45
|
+
There is no flat list endpoint for translations server-side. `mxs ai translate list` is always grouped by article.
|
|
46
|
+
|
|
47
|
+
| Command | Purpose |
|
|
48
|
+
| -------------------------------------------------------- | -------------------------------------------------------- |
|
|
49
|
+
| `mxs ai translate list [--page <n>] [--size <n>]` | List translations (grouped by article). |
|
|
50
|
+
| `mxs ai translate get <recordId>` | Get one translation by record id. |
|
|
51
|
+
| `mxs ai translate by-article <id> [--lang <l>]` | Show an article's translations (single lang or all). |
|
|
52
|
+
| `mxs ai translate languages <id>` | List languages an article has been translated into. |
|
|
53
|
+
| `mxs ai translate edit <recordId>` | Edit translation fields via `$EDITOR` (JSON envelope). |
|
|
54
|
+
| `mxs ai translate delete <recordId> [--force]` | Delete a translation record. |
|
|
55
|
+
|
|
56
|
+
Edit envelope keys: `title`, `text`, `subtitle` (nullable), `summary`, `tags`, `content`. Only included keys are PATCHed.
|
|
57
|
+
|
|
58
|
+
## Translation entries (i18n dictionary)
|
|
59
|
+
|
|
60
|
+
The dictionary layer used for category / topic / note metadata translations. `--key-path` accepts ONLY the server-validated set: `category.name`, `topic.name`, `topic.introduce`, `topic.description`, `note.mood`, `note.weather`.
|
|
61
|
+
|
|
62
|
+
| Command | Purpose |
|
|
63
|
+
| ------------------------------------------------------------------------------------------- | ------------------------------------------------------ |
|
|
64
|
+
| `mxs ai translate entries list [--page <n>] [--size <n>] [--key-path <p>] [--lang <l>]` | List entries with optional filters. |
|
|
65
|
+
| `mxs ai translate entries generate [--key-path <p>...] [--to <lang>...]` | Regenerate entries (synchronous on the server). |
|
|
66
|
+
| `mxs ai translate entries edit <recordId>` | Edit `translatedText` via `$EDITOR` (JSON envelope). |
|
|
67
|
+
| `mxs ai translate entries delete <recordId> [--force]` | Delete an entry. |
|
|
68
|
+
|
|
69
|
+
## Insights read / manage
|
|
70
|
+
|
|
71
|
+
| Command | Purpose |
|
|
72
|
+
| ------------------------------------------------------------- | -------------------------------------------------------------- |
|
|
73
|
+
| `mxs ai insights list [--page <n>] [--size <n>] [--grouped]` | List insights (flat or grouped by article). |
|
|
74
|
+
| `mxs ai insights get <recordId>` | Get one insights record by record id. |
|
|
75
|
+
| `mxs ai insights by-article <id> [--lang <l>] [--only-db]` | Show an article's insights; `--only-db` skips auto-generation. |
|
|
76
|
+
| `mxs ai insights edit <recordId>` | Edit the `content` field via `$EDITOR` (JSON envelope). |
|
|
77
|
+
| `mxs ai insights delete <recordId> [--force]` | Delete an insights record. |
|
|
78
|
+
|
|
79
|
+
## Exit codes specific to `ai`
|
|
80
|
+
|
|
81
|
+
| Code | When |
|
|
82
|
+
| ------ | ---------------------------------------------------------------------------------------- |
|
|
83
|
+
| `0` | Task reached `succeeded`/`completed`; or `--no-wait`; or read/edit/delete completed. |
|
|
84
|
+
| `1` | `AiTaskCreateFailed` (no `taskId` in response) or `AiTaskFailed` (terminal `failed`/`cancelled`/`partial_failed`). |
|
|
85
|
+
| `7` | `AiRecordNotFound` (`get`/`edit`/`delete` against a missing record). |
|
|
86
|
+
|
|
87
|
+
Network / auth / validation errors map per the global table — see `safety`.
|
|
88
|
+
|
|
89
|
+
## Examples
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# Regenerate an article's summary and wait for it
|
|
93
|
+
mxs ai summary regen my-post --to en --to ja
|
|
94
|
+
|
|
95
|
+
# Translate to Japanese, fire and forget
|
|
96
|
+
mxs ai translate run my-post --to ja --no-wait
|
|
97
|
+
|
|
98
|
+
# Refresh insights, then read the result
|
|
99
|
+
mxs ai insights refresh my-post
|
|
100
|
+
mxs ai insights by-article my-post --only-db
|
|
101
|
+
|
|
102
|
+
# Inventory
|
|
103
|
+
mxs ai summary list --grouped --output json | jq .
|
|
104
|
+
mxs ai translate languages my-post
|
|
105
|
+
|
|
106
|
+
# Patch a translation record through $EDITOR
|
|
107
|
+
mxs ai translate edit 01HXXX...
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Notes for agents
|
|
111
|
+
|
|
112
|
+
- Always pass `--output json` (or `--json`) for machine-parseable output. The default `readable` mode is for humans.
|
|
113
|
+
- `created: false` is a normal join-existing path, NOT an error. Do not retry on it.
|
|
114
|
+
- The polling loop has no hard timeout. For very long translation runs across many languages, prefer `--no-wait` plus periodic `mxs ai translate by-article` polls.
|
|
115
|
+
- Edit envelopes are typed per resource. Unknown keys are rejected client-side before any PATCH is sent.
|
package/skills/overview.md
CHANGED
|
@@ -25,6 +25,7 @@ The audience is **AI agents**. Pass `--output llm` for raw markdown suitable for
|
|
|
25
25
|
| Categories | `commands-category` |
|
|
26
26
|
| Topics | `commands-topic` |
|
|
27
27
|
| Snippets (server data / functions) | `commands-snippet` |
|
|
28
|
+
| AI summary / translation / insights / entries | `commands-ai` |
|
|
28
29
|
| Server-side options | `commands-config` |
|
|
29
30
|
| Authentication | `commands-auth` |
|
|
30
31
|
| Local profile management | `commands-profile` |
|
package/dist/esm-DXO9Afik.mjs
DELETED