@mx-space/cli 0.11.1 → 0.12.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mx-space/cli",
3
- "version": "0.11.1",
3
+ "version": "0.12.0",
4
4
  "description": "Command line interface for mx-space (mx-core) — auth, content, configuration",
5
5
  "keywords": [
6
6
  "mx-space",
@@ -52,24 +52,24 @@
52
52
  "@effect/cli": "0.75.2",
53
53
  "@effect/platform": "0.96.1",
54
54
  "@effect/platform-node": "0.107.0",
55
- "@haklex/rich-headless": "0.22.1",
56
- "@haklex/rich-litexml": "0.22.1",
57
- "@haklex/rich-litexml-cli": "0.22.1",
55
+ "@haklex/rich-headless": "0.24.0",
56
+ "@haklex/rich-litexml": "0.24.0",
57
+ "@haklex/rich-litexml-cli": "0.24.0",
58
58
  "@lexical/headless": "^0.45.0",
59
- "better-auth": "^1.6.14",
60
- "effect": "3.21.2",
59
+ "better-auth": "^1.6.16",
60
+ "effect": "3.21.3",
61
61
  "fast-xml-parser": "5.8.0",
62
62
  "get-east-asian-width": "^1.6.0",
63
63
  "lexical": "^0.45.0",
64
64
  "minisearch": "^7.2.0",
65
65
  "open": "^11.0.0",
66
- "semver": "7.8.2",
66
+ "semver": "7.8.4",
67
67
  "@mx-space/api-client": "5.3.1",
68
68
  "@mx-space/editor": "0.1.0"
69
69
  },
70
70
  "devDependencies": {
71
71
  "@effect/vitest": "0.29.0",
72
- "@types/node": "25.9.1",
72
+ "@types/node": "25.9.3",
73
73
  "@types/semver": "7.7.1",
74
74
  "tsdown": "0.22.2",
75
75
  "tsx": "^4.22.4",
@@ -2,7 +2,7 @@
2
2
  slug: commands-auth
3
3
  title: Auth commands
4
4
  description: auth login/logout/whoami/status
5
- order: 38
5
+ order: 39
6
6
  ---
7
7
 
8
8
  # Auth commands
@@ -2,7 +2,7 @@
2
2
  slug: commands-config
3
3
  title: Config commands
4
4
  description: server-side options — config list/get/set/edit
5
- order: 37
5
+ order: 38
6
6
  ---
7
7
 
8
8
  # Config commands
@@ -2,7 +2,7 @@
2
2
  slug: commands-preview
3
3
  title: Preview command
4
4
  description: render LiteXML / envelope to HTML and open it in a browser
5
- order: 40
5
+ order: 41
6
6
  ---
7
7
 
8
8
  # Preview command
@@ -2,7 +2,7 @@
2
2
  slug: commands-profile
3
3
  title: Profile commands
4
4
  description: local CLI profiles — profile ls/show/use/mark/rm
5
- order: 39
5
+ order: 40
6
6
  ---
7
7
 
8
8
  # Profile commands
@@ -0,0 +1,73 @@
1
+ ---
2
+ slug: commands-snippet
3
+ title: Snippet commands
4
+ description: snippet list/get/create/update/edit/delete syntax
5
+ order: 37
6
+ ---
7
+
8
+ # Snippet commands
9
+
10
+ | Command | Purpose | Principal flags |
11
+ | ------------------------------------ | ------------------------------------------------------------------------ | ---------------------------------------- |
12
+ | `mxs snippet list` | List snippets (lean, no `raw`). | `--page <n>`, `--size <n>`, `--grouped` |
13
+ | `mxs snippet get <id\|ref/name>` | Read one snippet in full, including `raw`. | global flags |
14
+ | `mxs snippet create` | Create a snippet. `--name` is required. | snippet write flags |
15
+ | `mxs snippet update <id\|ref/name>` | Update fields and/or content; full-body merge onto the existing snippet. | snippet write flags |
16
+ | `mxs snippet edit <id\|ref/name>` | Open the current `raw` in `$EDITOR`; PUT on save when the buffer changed. | global flags |
17
+ | `mxs snippet delete <id\|ref/name>` | Delete a snippet. | `--force`; required in non-TTY contexts |
18
+
19
+ `--grouped` lists snippets grouped by `reference` (`GET /snippets/group`).
20
+
21
+ ## Identifier resolution
22
+
23
+ `<id|ref/name>` accepts:
24
+
25
+ - a Snowflake id (`/^\d{15,}$/`) — passed through unchanged,
26
+ - `<reference>/<name>` — resolved via `GET /snippets/group/:reference` and an exact `name` match,
27
+ - a bare name without `/` — treated as `root/<name>`.
28
+
29
+ No match exits 7 with `resource.not_found`.
30
+
31
+ ## Snippet write flags
32
+
33
+ | Flag | Field | Notes |
34
+ | ---------------------------- | ------------ | --------------------------------------------------------------- |
35
+ | `--name <s>` | `name` | Required on `create`. Must match `/^[\w.-]{1,30}$/`. |
36
+ | `--reference <r>` | `reference` | Defaults to `root` server-side. |
37
+ | `--type <t>` | `type` | `json` (default), `json5`, `function`, `text`, or `yaml`. |
38
+ | `--file <path\|->` | `raw` | Read content from a file; `-` reads stdin. |
39
+ | `--raw <text>` | `raw` | Inline content. |
40
+ | `--private` / `--no-private` | `private` | Tri-state: omit both to leave unchanged on `update`. |
41
+ | `--comment <s>` | `comment` | |
42
+ | `--enable` / `--no-enable` | `enable` | Tri-state, same as `--private`. |
43
+ | `--method <m>` | `method` | `GET`, `POST`, `PUT`, `DELETE`, `PATCH`, or `ALL` (function). |
44
+ | `--metatype <s>` | `metatype` | |
45
+ | `--schema <s>` | `schema` | |
46
+ | `--custom-path <p>` | `customPath` | |
47
+ | `--secret <k=v>` | `secret` | qs string; function snippets only. |
48
+
49
+ ## Raw content sources
50
+
51
+ Mutually exclusive, first match wins: `--file`, then `--raw`.
52
+
53
+ - `create` additionally falls back to piped stdin when stdin is not a TTY. With no source at all it opens `$EDITOR` on an empty buffer when interactive, else exits 5 with `validation.failed`.
54
+ - `update` never reads stdin implicitly — pass `--file -` to read stdin explicitly. Without a content flag, `raw` is left unchanged.
55
+
56
+ ```bash
57
+ mxs snippet create --name theme --reference web --type json --file theme.json
58
+ echo '{"a":1}' | mxs snippet create --name config
59
+ cat new.json | mxs snippet update web/theme --file -
60
+ mxs snippet update web/theme --no-private
61
+ ```
62
+
63
+ ## Full-body PUT
64
+
65
+ `PUT /snippets/:id` validates the complete snippet, so `update` and `edit` first `GET /snippets/:id`, merge the changed fields onto the existing snippet, strip server-managed fields (`id`, timestamps), and PUT the merged body. Missing flags leave fields untouched.
66
+
67
+ ## Editor flow
68
+
69
+ `mxs snippet edit` opens the current `raw` in `$EDITOR` with a file extension derived from `type` (`json` → `.json`, `json5` → `.json5`, `function` → `.js`, `yaml` → `.yaml`, `text` → `.txt`). An unchanged buffer emits `no changes` and makes no write. Only `raw` is editable here; metadata changes go through `update` flags.
70
+
71
+ ## Dry-run support
72
+
73
+ `create`, `update`, `edit`, `delete` all honour the global `--dry-run` flag.
@@ -2,7 +2,7 @@
2
2
  slug: output-modes
3
3
  title: Output modes
4
4
  description: --json / --output (readable, llm, xml, pretty-json) and global flags
5
- order: 41
5
+ order: 42
6
6
  ---
7
7
 
8
8
  # Output modes
@@ -24,6 +24,7 @@ The audience is **AI agents**. Pass `--output llm` for raw markdown suitable for
24
24
  | Comments / moderation | `commands-comment` |
25
25
  | Categories | `commands-category` |
26
26
  | Topics | `commands-topic` |
27
+ | Snippets (server data / functions) | `commands-snippet` |
27
28
  | Server-side options | `commands-config` |
28
29
  | Authentication | `commands-auth` |
29
30
  | Local profile management | `commands-profile` |
@@ -1,2 +0,0 @@
1
- import { E as Schema_exports } from "./esm-eihI6wbY.mjs";
2
- export { Schema_exports as Schema };