@meltemi/diagrams-cli 1.11.12 → 1.11.13

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/cli.d.ts CHANGED
@@ -7,7 +7,7 @@ export declare const CLI_NAME = "meltemi-diagrams";
7
7
  export declare const CLI_ALIAS = "mdg";
8
8
  /** Extension of `.meltemi` sources (decision 0002). */
9
9
  export declare const MELTEMI_EXTENSION = ".meltemi";
10
- export declare const CLI_VERSION = "1.11.12";
10
+ export declare const CLI_VERSION = "1.11.13";
11
11
  export declare const EXIT_OK = 0;
12
12
  export declare const EXIT_FINDINGS = 1;
13
13
  export declare const EXIT_USAGE = 2;
package/dist/cli.js CHANGED
@@ -30,7 +30,7 @@ export const CLI_NAME = "meltemi-diagrams";
30
30
  export const CLI_ALIAS = "mdg";
31
31
  /** Extension of `.meltemi` sources (decision 0002). */
32
32
  export const MELTEMI_EXTENSION = ".meltemi";
33
- export const CLI_VERSION = "1.11.12";
33
+ export const CLI_VERSION = "1.11.13";
34
34
  export const EXIT_OK = 0;
35
35
  export const EXIT_FINDINGS = 1;
36
36
  export const EXIT_USAGE = 2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meltemi/diagrams-cli",
3
- "version": "1.11.12",
3
+ "version": "1.11.13",
4
4
  "description": "Command line interface (meltemi-diagrams, alias mdg) for .meltemi projects.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -33,31 +33,31 @@
33
33
  "templates"
34
34
  ],
35
35
  "dependencies": {
36
- "@meltemi/diagrams-assist": "1.11.12",
37
- "@meltemi/diagrams-capture": "1.11.12",
38
- "@meltemi/diagrams-catalog": "1.11.12",
39
- "@meltemi/diagrams-edit": "1.11.12",
40
- "@meltemi/diagrams-editor": "1.11.12",
41
- "@meltemi/diagrams-assets": "1.11.12",
42
- "@meltemi/diagrams-fonts": "1.11.12",
43
- "@meltemi/diagrams-i18n": "1.11.12",
44
- "@meltemi/diagrams-import": "1.11.12",
45
- "@meltemi/diagrams-language": "1.11.12",
46
- "@meltemi/diagrams-layout-elk": "1.11.12",
47
- "@meltemi/diagrams-model": "1.11.12",
48
- "@meltemi/diagrams-project": "1.11.12",
49
- "@meltemi/diagrams-motion": "1.11.12",
50
- "@meltemi/diagrams-layout": "1.11.12",
51
- "@meltemi/diagrams-player": "1.11.12",
52
- "@meltemi/diagrams-render": "1.11.12"
36
+ "@meltemi/diagrams-assets": "1.11.13",
37
+ "@meltemi/diagrams-assist": "1.11.13",
38
+ "@meltemi/diagrams-capture": "1.11.13",
39
+ "@meltemi/diagrams-catalog": "1.11.13",
40
+ "@meltemi/diagrams-edit": "1.11.13",
41
+ "@meltemi/diagrams-editor": "1.11.13",
42
+ "@meltemi/diagrams-fonts": "1.11.13",
43
+ "@meltemi/diagrams-import": "1.11.13",
44
+ "@meltemi/diagrams-i18n": "1.11.13",
45
+ "@meltemi/diagrams-layout": "1.11.13",
46
+ "@meltemi/diagrams-language": "1.11.13",
47
+ "@meltemi/diagrams-layout-elk": "1.11.13",
48
+ "@meltemi/diagrams-model": "1.11.13",
49
+ "@meltemi/diagrams-player": "1.11.13",
50
+ "@meltemi/diagrams-motion": "1.11.13",
51
+ "@meltemi/diagrams-project": "1.11.13",
52
+ "@meltemi/diagrams-render": "1.11.13"
53
53
  },
54
54
  "publishConfig": {
55
55
  "access": "public"
56
56
  },
57
57
  "meltemiRelease": {
58
58
  "repository": "askenaz-dev/meltemi-diagrams",
59
- "sha": "80ccdb9ad445a502ed54193eb97cb26aaed0a374",
60
- "tag": "v1.11.12"
59
+ "sha": "dec86922755b8fc171d2979170bd389baae6702e",
60
+ "tag": "v1.11.13"
61
61
  },
62
62
  "scripts": {
63
63
  "build": "tsc -p tsconfig.build.json",
@@ -3,7 +3,7 @@ name: meltemi-diagrams
3
3
  description: Use when asked to draw, document or convert a system or software architecture, sketch a whiteboard or kanban board, turn a diagram or a screenshot into code, or change a `.meltemi` file. Creates, edits, converts and exports Meltemi diagrams as code (`.meltemi` files) - flow sheets with groups, plain containers, data stores, decisions, notes, tags and boxes in 24 shapes with icons, laid out by ELK, assisted or by hand, with ports, constraints, styles and themes; free compositions (slides with boxes, text, icons, images, layers and links to flow views, and whiteboards with pen strokes, stickies and kanban lists); sequence diagrams (participants, calls, replies, activations, notes, alt/opt/loop/par fragments, scenarios); C4 models with context, container and component views; motion effects and stories that walk through a diagram scene by scene; SVG, PNG, PDF and HTML-player exports with export profiles. Imports Mermaid and PlantUML instead of retyping them, and turns draw.io, HTML or SVG pictures into sheets.
4
4
  license: MIT
5
5
  metadata:
6
- version: 1.11.12
6
+ version: 1.11.13
7
7
  ---
8
8
 
9
9
  # Meltemi Diagrams
@@ -19,7 +19,9 @@ Before you start: `pnpm mdg --version` says which version of the command line is
19
19
  sheets go under `diagrams/`, or where the project keeps them (the `sources` of its
20
20
  `project.json`). Cloud commands run only when the person asks
21
21
  ([reference/cloud.md](reference/cloud.md)), and a token (`mdg_…`) is never printed, read, copied
22
- or committed.
22
+ or committed. Connected to the hosted service's MCP endpoint instead (tools such as `write_files`
23
+ and `preview` act on the person's projects), follow [reference/mcp.md](reference/mcp.md): the same
24
+ steps, through the tools.
23
25
 
24
26
  1. Collect the pieces from the request or the source material: elements (boxes, data stores,
25
27
  decisions), bands (groups), arrows with their labels, annotations (notes, tags), what is
@@ -223,6 +225,8 @@ fontWeight 600 }`, also in classes and rules (`rule note { font "Caveat" }`); ic
223
225
  their diagnostics and frame exports.
224
226
  - [reference/cloud.md](reference/cloud.md): sharing a project in the optional cloud service, only
225
227
  when the person asks, and where its token lives.
228
+ - [reference/mcp.md](reference/mcp.md): the MCP endpoint's tools on the person's projects, how to
229
+ connect, and the workflow of read, write with `ifRevision`, validate, preview and `open_url`.
226
230
  - [examples/platform.meltemi](examples/platform.meltemi): a complete sheet using every construct.
227
231
  - [examples/slide.meltemi](examples/slide.meltemi): a flow view and a free slide linked to it.
228
232
  - [examples/sequence.meltemi](examples/sequence.meltemi): a payment sequence with a group, an
@@ -0,0 +1,93 @@
1
+ # The MCP endpoint (projects in the person's account)
2
+
3
+ When the person connects you to `https://diagrams.meltemi.dev/mcp`, its tools act on the Meltemi
4
+ Diagrams projects of their account in the hosted service: you create projects, write `.meltemi`
5
+ files, look at the drawings and share the result, without a folder or the command line. The
6
+ language is the same as everywhere else in this skill; only where the files live changes.
7
+
8
+ ## Connecting
9
+
10
+ The person connects once; never connect for them without being asked.
11
+
12
+ - Codex with OAuth (the person signs in and approves the scopes in the browser):
13
+ `codex mcp add meltemi --url https://diagrams.meltemi.dev/mcp`, then `codex mcp login meltemi`.
14
+ - With an API token instead, made by the person in the app's **API tokens** dialog and kept in
15
+ `MELTEMI_TOKEN`: in `~/.codex/config.toml`, a `[mcp_servers.meltemi]` table with
16
+ `url = "https://diagrams.meltemi.dev/mcp"` and `bearer_token_env_var = "MELTEMI_TOKEN"`.
17
+
18
+ Never ask for, print, read, copy or write the token (`mdg_…`); it stays in the environment. The
19
+ scopes are `projects:read`, `projects:write`, `sharing`, `live` and `publish`: a refusal
20
+ `scope.insufficient` names the one the connection lacks, and the person grants it, not you. A scope
21
+ never adds a role: in a project shared with the account, an editor writes but only the owner shares,
22
+ runs live sessions and publishes (`access.denied`).
23
+
24
+ ## The tools
25
+
26
+ - The account: `whoami` (the account, its scopes, usage and limits).
27
+ - Projects: `list_projects`, `create_project` (empty, from a template `flow`, `c4`, `sequence`,
28
+ `free` or `purchase`, or from files), `get_project` (its revision, its file paths and its address),
29
+ `rename_project`.
30
+ - Files: `read_files` (the texts and the images' hashes, at a revision), `write_files` (texts by
31
+ path, `null` deletes; images and fonts by the hash `upload_image` answered), `validate` (the
32
+ diagnostics `meltemi-diagrams validate` prints), `upload_image` (PNG, JPEG, GIF, WebP, SVG or a
33
+ font, base64, at most 10 MiB).
34
+ - Versions: `list_versions`, `create_version` (a label of at most 80 characters),
35
+ `restore_version`.
36
+ - The app: `open_url` (the address that opens the project in the browser).
37
+ - Pictures: `preview` (a diagram, or a story's frame, drawn on the server with the command line's
38
+ engine).
39
+ - Sharing: `get_sharing`, `set_link_access` (`private`, `view` or `edit`), `invite`,
40
+ `list_invitations`, `revoke_invitation`, `set_member_role`, `remove_member`.
41
+ - Live sessions: `get_live`, `start_live`, `end_live`.
42
+ - Publishing: `list_publications`, `publish`, `unpublish`.
43
+
44
+ Every result carries its JSON; a refusal is an error result `{ code, message, … }` with a stable
45
+ code. Ids are never guessed: take a project's id from `list_projects` or `create_project`.
46
+
47
+ ## The workflow
48
+
49
+ 1. Read before you write: `get_project` or `read_files` gives the `revision`. A person may be editing
50
+ the same project in the browser, and what they changed is in this read.
51
+ 2. Write with `write_files` and `ifRevision` set to that revision, one logical change per call, with
52
+ an `idempotencyKey` of your own for the change (1 to 64 visible ASCII characters, such as
53
+ `checkout-add-retry-1`): when a call times out, send the same call with the same key, and it is
54
+ applied once. `create_project` takes a key too.
55
+ 3. Every `.meltemi` file you write is compiled with the project first. `diagram.invalid` means
56
+ nothing was written: fix every error its `diagnostics` list (the codes are in
57
+ [language.md](language.md)) and write again. Warnings come back with a successful write.
58
+ 4. `revision.mismatch` means the project changed since your read (its `revision` is the current
59
+ one): read again, keep the person's change, apply yours on top and write with the new revision.
60
+ Never write the old text back over theirs.
61
+ 5. `validate` the project, then `preview` what you changed: a PNG 1280 pixels wide by default
62
+ (`width` from 16 to 2048), or `format: "svg"` for the SVG as text. The report beside the picture
63
+ gives the revision drawn, the size, the elements and relations, the warnings
64
+ (`layout.text-overflow`, `layout.overlap`, …) and the fonts the server estimated. Look at the
65
+ picture when you can, read the report always, and fix what it shows as you would after an
66
+ export.
67
+ 6. Give the person `open_url`'s address. An open page shows every write at once, without a reload.
68
+
69
+ A preview that fails (`request.invalid`, `rate.limited`) never undoes a write that succeeded: say
70
+ what was saved, at which revision, and ask for the picture again. Thirty previews and three hundred
71
+ calls a minute per account are allowed; `rate.limited` gives `retryAfter` in seconds.
72
+
73
+ ## Sharing, live sessions and publishing: only when asked
74
+
75
+ These change who can see the project, so run them only on the person's explicit request, and say
76
+ exactly what happened.
77
+
78
+ - `set_link_access` answers the project's link: `view` lets anybody with it read, `edit` lets a
79
+ signed-in person edit. Saying so is part of the answer.
80
+ - `invite` makes an invitation and answers its link and `emailSent: false`. No email is sent: never
81
+ say one was. Tell the person that the invitation exists, for whom and with which role, and give
82
+ them its link only if they ask for it, to pass on themselves.
83
+ - `start_live` starts a session of 24 hours; anybody with its link joins without an account, editing
84
+ unless `guestsEdit` is false. Give its term (`until`); give the link only when asked.
85
+ `end_live` ends it.
86
+ - `publish` makes the project's catalog a public page at the account's handle and the `slug` you
87
+ give, and answers only once that address has served it; `unpublish` removes one slug and leaves
88
+ the others. `handle.required` means the person chooses a handle in the app first.
89
+ `publish.unverified` means the page was published but its address did not answer yet: try the
90
+ address again in a moment before saying it is live.
91
+
92
+ Never print, in your answer or a file, a token, or an invitation's or a live session's link that
93
+ the person did not ask for.