sketchi 0.1.1 → 0.3.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 CHANGED
@@ -15,9 +15,10 @@
15
15
  <a href="https://github.com/shpitdev/sketchi/blob/main/LICENSE"><img alt="MIT license" src="https://img.shields.io/badge/license-MIT-2F855A" /></a>
16
16
  </p>
17
17
 
18
- Sketchi stores canonical diagram documents and deterministic Excalidraw artifacts
19
- under `~/.sketchi/diagrams`. Its manual workflow stays local; generation is one
20
- explicit, credential-free network command.
18
+ Sketchi stores canonical diagram documents and authoritative Excalidraw artifacts
19
+ under `~/.sketchi/diagrams`. Its manual and recovery workflows stay local;
20
+ generation and encrypted snapshot exchange are explicit, credential-free network
21
+ commands.
21
22
 
22
23
  ## Install
23
24
 
@@ -53,9 +54,20 @@ sketchi show release-flow
53
54
 
54
55
  sketchi edit release-flow --json '{"type":"flowchart","spec":{"id":"release-flow","title":"Release approval revised","nodes":[{"id":"start","label":"Change proposed","kind":"start"},{"id":"review","label":"Review complete evidence","kind":"process"},{"id":"end","label":"Release approved","kind":"end"}],"edges":[{"source":"start","target":"review"},{"source":"review","target":"end"}]}}'
55
56
 
57
+ sketchi patch release-flow --json '{"operations":[{"op":"setStyle","selector":{"nodeIds":["review"]},"style":{"fillColor":"#dbeafe","strokeColor":"#2563eb"}}]}'
58
+
56
59
  sketchi list
57
60
  ```
58
61
 
62
+ `patch` reuses Sketchi's semantic selectors and operations (`setStyle`,
63
+ `setDefaultStyle`, `setShape`, `translate`, `replaceText`, and
64
+ `rerouteEdges`) without exposing raw Excalidraw mutation. It is fully offline,
65
+ preserves the prior full revision, retains `document.json` unchanged as
66
+ provenance, makes `scene.json` authoritative, and removes any stale stored PNG.
67
+ Patched records report `authority: "patched"` and
68
+ `documentAuthoritative: false`; restore a canonical revision before using
69
+ `edit` again.
70
+
59
71
  Export the stored editable artifact:
60
72
 
61
73
  ```sh
@@ -90,8 +102,75 @@ sketchi generate --prompt "Map release approval with pass and revise branches"
90
102
  sketchi generate --prompt "Organize launch readiness" --type mindmap --output json
91
103
  ```
92
104
 
93
- It requires no API key, token, account, or login. It is the CLI's only network
94
- boundary.
105
+ It requires no API key, token, account, or login. `generate`, `share`, and
106
+ `pull` are the CLI's three explicit network commands; each makes one HTTPS
107
+ request.
108
+
109
+ ## Share, pull, and restore browser edits
110
+
111
+ Create an immutable encrypted Excalidraw snapshot link from the record's current
112
+ authoritative artifact:
113
+
114
+ ```sh
115
+ sketchi share release-flow
116
+ sketchi share release-flow --open --output json
117
+ ```
118
+
119
+ The URL is a bearer secret: anyone who receives the complete URL can decrypt the
120
+ snapshot. Encryption hides the drawing from the storage service, but the service
121
+ can observe connection metadata, timing, and ciphertext size. Retention is
122
+ uncontrolled and may be indefinite; Sketchi cannot revoke or delete a link.
123
+ `--open` is opt-in, discloses the URL to the local opener and browser history,
124
+ and reports only whether the OS accepted the request—not whether a visible
125
+ window opened.
126
+
127
+ Browser edits do not update an existing link. In Excalidraw choose
128
+ **Save to… → Export to Link**, then pull the newly exported link:
129
+
130
+ ```sh
131
+ sketchi pull release-flow --link 'https://excalidraw.com/#json=ID,KEY'
132
+ printf '%s\n' 'https://excalidraw.com/#json=ID,KEY' | sketchi pull release-flow --link -
133
+ ```
134
+
135
+ The linked drawing has no trusted Sketchi identity and may be unrelated to
136
+ `release-flow`. A successful pull preserves the complete prior record under
137
+ `revisions/`, removes any stale stored PNG, and makes `diagram.excalidraw` the
138
+ sole authoritative artifact. `show` and `list` then report `authority:
139
+ "detached"` and `documentAuthoritative: false`; retained `document.json` and
140
+ `scene.json` are provenance only. Detached `edit` refuses, scene export is
141
+ unavailable, and on-demand PNG renders directly from `diagram.excalidraw` using
142
+ its background without a stale canonical title.
143
+
144
+ Recover any retained full snapshot through the strictly offline CLI:
145
+
146
+ ```sh
147
+ sketchi restore release-flow --revision 1
148
+ ```
149
+
150
+ Restore archives the displaced current state first, does not consume the chosen
151
+ snapshot, and advances revision numbering monotonically. New edit/pull/restore
152
+ history uses full `revisions/000001/` authority snapshots; legacy
153
+ `revisions/000001.json` document revisions remain restorable on canonical
154
+ records.
155
+
156
+ Share/pull v1 supports exactly `rectangle`, `ellipse`, `diamond`, `arrow`,
157
+ `line`, `freedraw`, and `text`. Text must use Excalifont `fontFamily` id `5`.
158
+ Images, non-empty `files`, frames, embeddables, iframes, external resources,
159
+ custom fonts, libraries, and unknown element types are rejected. Compatibility
160
+ is pinned to Excalidraw `e6ae6bf` and excalidraw-store `76de642`; both commands
161
+ use the unofficial `json.excalidraw.com` API without retries.
162
+
163
+ The enforced v1 bounds are a 4 KiB bearer link, 2 MiB encrypted body, 16 MiB
164
+ inflated contents, 10,000 elements, and JSON depth 64. Before any raster
165
+ allocation, Sketchi also limits each element dimension to 8,192 units, each
166
+ canvas dimension to 8,192 units, canvas area to 4,194,304 square units, and the
167
+ final PNG to 16,777,216 pixels. Share enforces its compressed-output budget
168
+ while streaming and reserves framing plus encryption overhead before encryption.
169
+ Pull requires exactly one literal root
170
+ `https://excalidraw.com/#json=ID,KEY` or
171
+ `https://www.excalidraw.com/#json=ID,KEY` URL (or one such URL through stdin);
172
+ userinfo, ports, query strings, alternate spellings, and repeated `--link`
173
+ flags are rejected.
95
174
 
96
175
  ## Shell completions
97
176
 
@@ -133,17 +212,21 @@ source ~/.sketchi/completions/sketchi.fish
133
212
 
134
213
  ## For AI agents
135
214
 
136
- The five deterministic commands—`create`, `show`, `edit`, `list`, and
137
- `export`—are fully offline and require no credentials, account, browser, model,
138
- or MCP server. They never send stored records to a provider. Agents can use
215
+ The seven deterministic commands—`create`, `patch`, `show`, `edit`, `list`,
216
+ `export`, and `restore`—are fully offline and require no credentials, account,
217
+ browser, model, or MCP server. Those seven commands never send stored records
218
+ to a provider.
219
+ Agents can use
139
220
  `--output json`, complete noninteractive input through `--json` or `--file`, and
140
221
  raw artifact output through `export --dest -` without prompts.
141
222
 
142
223
  After exporting PNG to a file, agents can follow the returned hint to display
143
224
  that path as an inline Markdown image for the user.
144
225
 
145
- `generate` is deliberately separate: it uses the public Sketchi API, remains
146
- credential-free, and is the only command that uses the network.
226
+ `generate`, `share`, and `pull` are deliberately separate, explicit network
227
+ commands. They remain credential-free and each makes one HTTPS request. Share
228
+ is randomized by its key and IV; pull depends on remote availability and
229
+ untrusted input, so neither belongs to determinism claims.
147
230
 
148
231
  ## License
149
232
 
@@ -157,7 +240,11 @@ availability details.
157
240
  ```sh
158
241
  sketchi --help
159
242
  sketchi create --help
243
+ sketchi patch --help
160
244
  sketchi generate --help
245
+ sketchi share --help
246
+ sketchi pull --help
247
+ sketchi restore --help
161
248
  ```
162
249
 
163
250
  Source, issue tracking, and architecture documentation live in the
@@ -41,6 +41,31 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
41
41
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
42
42
  SOFTWARE.
43
43
 
44
+ pako 2.0.3
45
+ -----------
46
+
47
+ The MIT License
48
+
49
+ Copyright (C) 2014-2017 by Vitaly Puzrin and Andrei Tuputcyn
50
+
51
+ Permission is hereby granted, free of charge, to any person obtaining a copy
52
+ of this software and associated documentation files (the "Software"), to deal
53
+ in the Software without restriction, including without limitation the rights
54
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
55
+ copies of the Software, and to permit persons to whom the Software is
56
+ furnished to do so, subject to the following conditions:
57
+
58
+ The above copyright notice and this permission notice shall be included in
59
+ all copies or substantial portions of the Software.
60
+
61
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
62
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
63
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
64
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
65
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
66
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
67
+ THE SOFTWARE.
68
+
44
69
  Excalifont
45
70
  -----------
46
71