@mx-space/cli 0.13.1 → 0.13.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.
Files changed (63) hide show
  1. package/README.md +60 -1
  2. package/ROADMAP.md +11 -8
  3. package/dist/{Lexical.dev-By5dOKBN.mjs → Lexical.dev-DTxuYHmG.mjs} +2267 -431
  4. package/dist/{Lexical.node-fXM8Jp7p.mjs → Lexical.node-BlCLnfA6.mjs} +47 -10
  5. package/dist/Lexical.prod-CeB9UQuo.mjs +6816 -0
  6. package/dist/{LexicalClipboard.dev--HxGoSkO.mjs → LexicalClipboard.dev-CdFkLR_D.mjs} +131 -39
  7. package/dist/{LexicalClipboard.node-C3mRbrmW.mjs → LexicalClipboard.node-ktUajxsv.mjs} +2 -2
  8. package/dist/LexicalClipboard.prod-DliyLofW.mjs +429 -0
  9. package/dist/{LexicalCodeCore.dev-DjSrd4A4.mjs → LexicalCodeCore.dev-CL9tHWJX.mjs} +81 -67
  10. package/dist/LexicalCodeCore.prod-BoMSJc29.mjs +651 -0
  11. package/dist/LexicalDragon.dev-CqW7Aq5H.mjs +186 -0
  12. package/dist/{LexicalDragon.node-BVhw4C7s.mjs → LexicalDragon.node-DLXctJyy.mjs} +3 -2
  13. package/dist/LexicalDragon.prod-DHI3T6n5.mjs +121 -0
  14. package/dist/{LexicalExtension.dev-BPNyvGqe.mjs → LexicalExtension.dev-BP-18zns.mjs} +352 -38
  15. package/dist/{LexicalExtension.node-BVlcrgOx.mjs → LexicalExtension.node-BWH6xbzG.mjs} +9 -4
  16. package/dist/{LexicalExtension.prod-DFKbiNt-.mjs → LexicalExtension.prod-Cs6OgrDn.mjs} +479 -330
  17. package/dist/{LexicalHeadless.dev-B-cj7Pr5.mjs → LexicalHeadless.dev-DJp__UcP.mjs} +2 -2
  18. package/dist/{LexicalHeadless.prod-Byp1vNzT.mjs → LexicalHeadless.prod-o0v9cIu5.mjs} +2 -2
  19. package/dist/{LexicalHtml.dev-prBAwszN.mjs → LexicalHtml.dev-DoymwFpG.mjs} +327 -269
  20. package/dist/{LexicalHtml.node-BvNF96jZ.mjs → LexicalHtml.node-CVkbWtUA.mjs} +6 -4
  21. package/dist/{LexicalHtml.prod-Sz3CW1ht.mjs → LexicalHtml.prod-C2b3z99k.mjs} +355 -353
  22. package/dist/{LexicalLink.dev-NySTYhVR.mjs → LexicalLink.dev-7cgLOLIe.mjs} +70 -59
  23. package/dist/{LexicalLink.prod-BuCM8gts.mjs → LexicalLink.prod-DWFgoXHR.mjs} +211 -212
  24. package/dist/{LexicalList.dev-DIMOvSFD.mjs → LexicalList.dev-Ci2iOxFx.mjs} +246 -198
  25. package/dist/LexicalList.prod-D0xX5d3G.mjs +944 -0
  26. package/dist/{LexicalMarkdown.dev-C7aylvCG.mjs → LexicalMarkdown.dev-C0ZYCyuR.mjs} +130 -38
  27. package/dist/LexicalMarkdown.prod-0M-Nc-rh.mjs +932 -0
  28. package/dist/{LexicalRichText.dev-DfICq6lU.mjs → LexicalRichText.dev-Cnr1kDym.mjs} +151 -122
  29. package/dist/{LexicalRichText.node-Bg9jND3Q.mjs → LexicalRichText.node-BUJZAiap.mjs} +8 -11
  30. package/dist/LexicalRichText.prod-BfbMQ9uM.mjs +538 -0
  31. package/dist/{LexicalSelection.dev-DGjj12wW.mjs → LexicalSelection.dev-C4L7l8OB.mjs} +10 -9
  32. package/dist/{LexicalSelection.node-BU5L4193.mjs → LexicalSelection.node-CLKroUMQ.mjs} +4 -4
  33. package/dist/{LexicalSelection.prod-D-PwRbyK.mjs → LexicalSelection.prod-DzFqpTlw.mjs} +144 -146
  34. package/dist/{LexicalTable.dev-ChP7cugd.mjs → LexicalTable.dev-Cc9-zqKa.mjs} +186 -121
  35. package/dist/LexicalTable.prod-BgO4nCxy.mjs +2336 -0
  36. package/dist/{LexicalUtils.dev-BiFU3789.mjs → LexicalUtils.dev-BRgK0L6G.mjs} +375 -35
  37. package/dist/{LexicalUtils.node-j3Llm7Y3.mjs → LexicalUtils.node-BVAwOkL4.mjs} +24 -12
  38. package/dist/LexicalUtils.prod-C1gtvVDP.mjs +504 -0
  39. package/dist/bin/mxs.mjs +1 -1
  40. package/dist/{esm-DFrz5rIo.mjs → esm-BNu4sUWV.mjs} +220 -185
  41. package/dist/esm-jbwcVZth.mjs +2 -0
  42. package/dist/index.d.mts +46 -17
  43. package/dist/index.mjs +1 -1
  44. package/dist/{mxs-DXpzbUf4.mjs → mxs-zPvjkoNC.mjs} +8235 -6041
  45. package/dist/vendor/litexml/cli.mjs +24150 -0
  46. package/dist/vendor/litexml/litexml-html-preview-client.css +8862 -0
  47. package/dist/vendor/litexml/litexml-html-preview-client.js +163816 -0
  48. package/dist/vendor/litexml/style.css +96 -0
  49. package/package.json +21 -22
  50. package/skills/commands-ai.md +115 -0
  51. package/skills/commands-preview.md +3 -3
  52. package/skills/overview.md +1 -0
  53. package/dist/Lexical.prod-BlCvXPGa.mjs +0 -6088
  54. package/dist/LexicalClipboard.prod-DNJzFMcT.mjs +0 -371
  55. package/dist/LexicalCodeCore.prod-DTDShkR3.mjs +0 -642
  56. package/dist/LexicalDragon.dev-DwprRH0z.mjs +0 -88
  57. package/dist/LexicalDragon.prod-nh4J-8vn.mjs +0 -59
  58. package/dist/LexicalList.prod-MVqfA6Vo.mjs +0 -925
  59. package/dist/LexicalMarkdown.prod-CfQSM406.mjs +0 -868
  60. package/dist/LexicalRichText.prod-GsFzCK-o.mjs +0 -550
  61. package/dist/LexicalTable.prod-Bpr9YRXp.mjs +0 -2311
  62. package/dist/LexicalUtils.prod-DCvrA78p.mjs +0 -373
  63. package/dist/esm-DXO9Afik.mjs +0 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mx-space/cli",
3
- "version": "0.13.1",
3
+ "version": "0.13.3",
4
4
  "description": "Command line interface for mx-space (mx-core) — auth, content, configuration",
5
5
  "keywords": [
6
6
  "mx-space",
@@ -47,34 +47,33 @@
47
47
  "publishConfig": {
48
48
  "access": "public"
49
49
  },
50
- "dependencies": {
51
- "@clack/prompts": "^1.5.1",
50
+ "devDependencies": {
51
+ "@clack/prompts": "^1.6.0",
52
52
  "@effect/cli": "0.75.2",
53
- "@effect/platform": "0.96.1",
53
+ "@effect/platform": "0.96.2",
54
54
  "@effect/platform-node": "0.107.0",
55
- "@haklex/rich-headless": "0.27.0",
56
- "@haklex/rich-litexml": "0.27.0",
57
- "@haklex/rich-litexml-cli": "0.27.0",
58
- "@lexical/headless": "^0.45.0",
59
- "better-auth": "^1.6.16",
60
- "effect": "3.21.3",
61
- "fast-xml-parser": "5.8.0",
55
+ "@effect/vitest": "0.29.0",
56
+ "@haklex/rich-compose": "0.29.2",
57
+ "@haklex/rich-headless": "0.29.1",
58
+ "@haklex/rich-litexml": "0.29.0",
59
+ "@haklex/rich-litexml-cli": "0.29.3",
60
+ "@lexical/headless": "^0.46.0",
61
+ "@types/node": "26.0.1",
62
+ "@types/semver": "7.7.1",
63
+ "better-auth": "^1.6.23",
64
+ "effect": "3.21.4",
65
+ "fast-xml-parser": "5.9.3",
62
66
  "get-east-asian-width": "^1.6.0",
63
- "lexical": "^0.45.0",
67
+ "lexical": "^0.46.0",
64
68
  "minisearch": "^7.2.0",
65
69
  "open": "^11.0.0",
66
- "semver": "7.8.4",
67
- "@mx-space/api-client": "5.3.1",
68
- "@mx-space/editor": "0.1.0"
69
- },
70
- "devDependencies": {
71
- "@effect/vitest": "0.29.0",
72
- "@types/node": "25.9.3",
73
- "@types/semver": "7.7.1",
74
- "tsdown": "0.22.2",
70
+ "semver": "7.8.5",
71
+ "tsdown": "0.22.3",
75
72
  "tsx": "^4.22.4",
76
73
  "typescript": "6.0.3",
77
- "vitest": "4.1.8"
74
+ "vitest": "4.1.9",
75
+ "@mx-space/editor": "0.2.0",
76
+ "@mx-space/api-client": "5.4.0"
78
77
  },
79
78
  "scripts": {
80
79
  "package": "rm -rf dist && tsdown",
@@ -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.
@@ -7,7 +7,7 @@ order: 41
7
7
 
8
8
  # Preview command
9
9
 
10
- `mxs preview` renders a LiteXML fragment or `<mxpost>` / `<mxnote>` envelope to HTML and (by default) opens it in the system browser. It is a thin wrapper around the `@haklex/rich-litexml-cli` `litexml --format html` pipeline, so the output matches what the editor would render once published.
10
+ `mxs preview` renders a LiteXML fragment or `<mxpost>` / `<mxnote>` envelope to HTML and (by default) opens it in the system browser. It uses the LiteXML preview renderer vendored into the published CLI bundle, so the output matches what the editor would render once published without requiring runtime package dependencies.
11
11
 
12
12
  | Command | Behavior |
13
13
  | ---------------------------------------- | --------------------------------------------------------------------------- |
@@ -56,7 +56,7 @@ mxs preview ./post.xml --print > preview.html
56
56
 
57
57
  | Symptom | Likely cause |
58
58
  | -------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
59
- | `cannot resolve @haklex/rich-litexml-cli binary` | Installed dep is broken; reinstall `@mx-space/cli` or run `pnpm install`. |
60
- | `Cannot resolve @haklex/rich-compose asset "style.css"` | Outdated `@haklex/rich-compose` (< 0.15.2). Upgrade or reinstall. |
59
+ | `cannot resolve LiteXML preview renderer` | Published package is incomplete; reinstall `@mx-space/cli` or rebuild the CLI package. |
60
+ | `Cannot resolve @haklex/rich-compose asset "style.css"` | Vendored preview assets are missing; reinstall `@mx-space/cli` or rebuild the CLI package. |
61
61
  | `expected root <mxpost>` / `expected root <mxnote>` | Input begins with the wrong envelope root, or the envelope is malformed. Check the root tag. |
62
62
  | Browser does not open | `--open` shells out to the system `open`/`xdg-open`/`start`. Use `--save` or `--print` instead. |
@@ -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` |