@heycys/gallery 0.2.3 → 0.2.4

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 (220) hide show
  1. package/README.md +1 -1
  2. package/THIRD-PARTY-NOTICES.md +1 -1
  3. package/assets/preview/runtime.js +156 -0
  4. package/assets/preview/shell.html +107 -0
  5. package/assets/writing-preferences.md +1 -1
  6. package/browser/editor/components/divider/index.mjs +1 -1
  7. package/browser/editor/page/annotate/card.mjs +6 -0
  8. package/browser/editor/page/annotate/index.mjs +22 -2
  9. package/browser/editor/page/columns/index.mjs +1 -1
  10. package/browser/editor/page/conflicts.mjs +1 -1
  11. package/browser/editor/page/drag/index.mjs +1 -1
  12. package/browser/editor/page/editor.mjs +39 -3
  13. package/browser/editor/page/focus.mjs +104 -0
  14. package/browser/editor/page/handle/index.mjs +14 -2
  15. package/browser/editor/page/links/index.mjs +2 -2
  16. package/browser/editor/page/quiet.mjs +3 -3
  17. package/browser/editor/page/resize/index.mjs +1 -1
  18. package/browser/editor/page/session.mjs +4 -1
  19. package/browser/editor/page/ui.mjs +1 -1
  20. package/browser/shared/annotations.mjs +22 -3
  21. package/browser/shared/block-packs.mjs +13 -4
  22. package/browser/shared/document-look.mjs +14 -0
  23. package/browser/shared/drafts.mjs +1 -1
  24. package/browser/shared/extension-manifest.mjs +40 -12
  25. package/browser/shared/favorite-merge.mjs +17 -0
  26. package/browser/shared/favorites.mjs +77 -0
  27. package/browser/shared/i18n/en.mjs +123 -24
  28. package/browser/shared/outline-ops.mjs +109 -0
  29. package/browser/shared/outline.mjs +6 -0
  30. package/browser/shared/pages.mjs +20 -8
  31. package/browser/shared/paths.mjs +5 -2
  32. package/browser/shared/preference-documents.mjs +137 -0
  33. package/browser/shared/presence.mjs +94 -0
  34. package/browser/shared/preview-server.mjs +8 -5
  35. package/browser/shared/qa-levels.mjs +9 -1
  36. package/browser/shared/session.mjs +4 -0
  37. package/browser/shared/shipped-blocks.mjs +22 -4
  38. package/browser/shared/startup.mjs +101 -0
  39. package/browser/shared/workspace-columns.mjs +1 -1
  40. package/browser/shared/workspace-look.mjs +21 -8
  41. package/browser/shared/workspace-registry.mjs +6 -3
  42. package/browser/shared/workspace.mjs +37 -10
  43. package/browser/shared/writing-preferences.mjs +2 -42
  44. package/dist/chunk-25LYSMAE.mjs +2 -0
  45. package/dist/chunk-2I6ZVC5O.mjs +2 -0
  46. package/dist/{chunk-M4NRDYI5.mjs → chunk-2MYTOOP6.mjs} +1 -1
  47. package/dist/chunk-2VNENLER.mjs +2 -0
  48. package/dist/chunk-3FERXZF5.mjs +4 -0
  49. package/dist/chunk-3M6SBBGU.mjs +2 -0
  50. package/dist/chunk-3VCAAF34.mjs +2 -0
  51. package/dist/{chunk-WD4U6XXT.mjs → chunk-3ZTRLGSA.mjs} +1 -1
  52. package/dist/chunk-4FRA5AUE.mjs +2 -0
  53. package/dist/chunk-4LR2QEC2.mjs +4 -0
  54. package/dist/chunk-56SVJENP.mjs +966 -0
  55. package/dist/chunk-5CQISL2G.mjs +4 -0
  56. package/dist/{chunk-RRKJMHNX.mjs → chunk-5I5ZDDWC.mjs} +5 -5
  57. package/dist/chunk-5IHDLEB4.mjs +10 -0
  58. package/dist/chunk-5LRDMV7O.mjs +2 -0
  59. package/dist/chunk-5MVUYRKG.mjs +5 -0
  60. package/dist/chunk-5TLLIZT7.mjs +2 -0
  61. package/dist/chunk-6ILJWFYW.mjs +4 -0
  62. package/dist/chunk-6N25CJ6Y.mjs +3 -0
  63. package/dist/{chunk-SQ6Y2ZMA.mjs → chunk-7DTINW6U.mjs} +2 -2
  64. package/dist/chunk-7KWAGKIK.mjs +2 -0
  65. package/dist/chunk-7WNUOAFK.mjs +2 -0
  66. package/dist/chunk-7XCRW5RC.mjs +2 -0
  67. package/dist/{chunk-BYNPEUDS.mjs → chunk-7XSDTILF.mjs} +1 -1
  68. package/dist/chunk-ABKYFOVR.mjs +2 -0
  69. package/dist/chunk-AMUF7PUN.mjs +2 -0
  70. package/dist/{chunk-FJLM7YE7.mjs → chunk-B2EIMERT.mjs} +2 -2
  71. package/dist/{chunk-QNECWMGR.mjs → chunk-B45IAAU6.mjs} +1 -1
  72. package/dist/chunk-B6RAGF4R.mjs +2 -0
  73. package/dist/chunk-BSJKFE7I.mjs +4 -0
  74. package/dist/chunk-C72EEVLK.mjs +2 -0
  75. package/dist/chunk-CRAUKZ23.mjs +4 -0
  76. package/dist/chunk-F4CT35KL.mjs +2 -0
  77. package/dist/chunk-F63BNJLG.mjs +2 -0
  78. package/dist/chunk-FBKUPS44.mjs +2 -0
  79. package/dist/chunk-FL52ZL5Z.mjs +15 -0
  80. package/dist/chunk-FOZCU4VW.mjs +2 -0
  81. package/dist/chunk-G5HV7BC3.mjs +2 -0
  82. package/dist/{chunk-ERLAIBOA.mjs → chunk-GB5SOYQJ.mjs} +2 -2
  83. package/dist/chunk-GN3SG3IF.mjs +2 -0
  84. package/dist/{chunk-6QWQXHAV.mjs → chunk-HFTBVEZK.mjs} +1 -1
  85. package/dist/chunk-IOW5HLRK.mjs +2 -0
  86. package/dist/chunk-IQ3GJNTI.mjs +6 -0
  87. package/dist/chunk-K6SPFBUJ.mjs +2 -0
  88. package/dist/chunk-K7Y7SPTS.mjs +2 -0
  89. package/dist/chunk-L2IJCEUH.mjs +2 -0
  90. package/dist/{chunk-GPIWQ4X4.mjs → chunk-L3VT6LM4.mjs} +1 -1
  91. package/dist/chunk-L4WLQYFC.mjs +5 -0
  92. package/dist/{chunk-NLDF35P5.mjs → chunk-LAMCAGK6.mjs} +1 -1
  93. package/dist/chunk-LHGKPMTI.mjs +2 -0
  94. package/dist/chunk-LJZIYVNA.mjs +3 -0
  95. package/dist/chunk-LSVCTLS2.mjs +2 -0
  96. package/dist/chunk-LZY74XTP.mjs +2 -0
  97. package/dist/chunk-MC4LRSVH.mjs +2 -0
  98. package/dist/chunk-MCEXN4G5.mjs +2 -0
  99. package/dist/chunk-MTLAOCFF.mjs +181 -0
  100. package/dist/chunk-MZ66LN3B.mjs +2 -0
  101. package/dist/chunk-N5QWJRRI.mjs +2 -0
  102. package/dist/chunk-NF4MMOUB.mjs +2 -0
  103. package/dist/chunk-NHJYAJ73.mjs +3 -0
  104. package/dist/chunk-NRSD7SVY.mjs +2 -0
  105. package/dist/chunk-NT23I4XW.mjs +2 -0
  106. package/dist/chunk-NUALABIS.mjs +3 -0
  107. package/dist/chunk-NW6LAU22.mjs +2 -0
  108. package/dist/chunk-NWWHDGKF.mjs +5 -0
  109. package/dist/chunk-OFRCVMSJ.mjs +2 -0
  110. package/dist/chunk-OKVQQ3CX.mjs +4 -0
  111. package/dist/chunk-OM24O4KR.mjs +8 -0
  112. package/dist/{chunk-4B2TB5K2.mjs → chunk-PBMOC7KA.mjs} +2 -2
  113. package/dist/chunk-PVTCP43W.mjs +2 -0
  114. package/dist/chunk-Q62HZAJS.mjs +2 -0
  115. package/dist/chunk-QBJWIR3Q.mjs +2 -0
  116. package/dist/chunk-QDSEZX7Z.mjs +6 -0
  117. package/dist/chunk-QR4V4A2Z.mjs +15 -0
  118. package/dist/{chunk-QVGOPHOF.mjs → chunk-QRLVVZ3R.mjs} +1 -1
  119. package/dist/chunk-QW3QG67J.mjs +2 -0
  120. package/dist/chunk-R2T2EVWY.mjs +8 -0
  121. package/dist/{chunk-JJNHKGTD.mjs → chunk-R5RERE6G.mjs} +1 -1
  122. package/dist/chunk-RFHEWT3Y.mjs +5 -0
  123. package/dist/chunk-RS2Z2JQP.mjs +2 -0
  124. package/dist/chunk-S6YEC4GE.mjs +16 -0
  125. package/dist/chunk-SHZLMGGW.mjs +2 -0
  126. package/dist/chunk-TALJQM2O.mjs +2 -0
  127. package/dist/chunk-TLNJWEFY.mjs +22 -0
  128. package/dist/{chunk-ZLS2FRS6.mjs → chunk-TQZU7D7C.mjs} +1 -1
  129. package/dist/chunk-UTKNWYBA.mjs +2 -0
  130. package/dist/chunk-V3TM3TEN.mjs +2 -0
  131. package/dist/chunk-V3XROSP5.mjs +7 -0
  132. package/dist/{chunk-6QBHU4DF.mjs → chunk-V5JTW2LH.mjs} +1 -1
  133. package/dist/chunk-VAXLSISW.mjs +4 -0
  134. package/dist/chunk-VBHI3RG6.mjs +2 -0
  135. package/dist/{chunk-CRDG6EF2.mjs → chunk-VKZJRGDR.mjs} +1 -1
  136. package/dist/chunk-VZXZM7NS.mjs +2 -0
  137. package/dist/chunk-WDS6HEPE.mjs +2 -0
  138. package/dist/chunk-WHGANNEY.mjs +13 -0
  139. package/dist/chunk-WMJWC4QY.mjs +56 -0
  140. package/dist/{chunk-UTMAY3WK.mjs → chunk-WWONJJQS.mjs} +1 -1
  141. package/dist/chunk-X4WNLFIK.mjs +2 -0
  142. package/dist/chunk-XNNCQROX.mjs +11 -0
  143. package/dist/chunk-XRYECF23.mjs +170 -0
  144. package/dist/{chunk-225ALKYI.mjs → chunk-Z4NEXXFK.mjs} +1 -1
  145. package/dist/{chunk-PKVK6WFC.mjs → chunk-ZFVF2YPV.mjs} +2 -2
  146. package/dist/chunk-ZM2IX3R2.mjs +2 -0
  147. package/dist/chunk-ZNGGDUZI.mjs +2 -0
  148. package/dist/chunk-ZOEJQOKT.mjs +2 -0
  149. package/dist/cli.mjs +1 -1
  150. package/dist/server.mjs +1 -1
  151. package/dist/update-fetch.mjs +1 -1
  152. package/dist/worker.mjs +1 -1
  153. package/package.json +1 -1
  154. package/release.json +3 -3
  155. package/skill/SKILL.md +54 -148
  156. package/skill/references/building-blocks.md +4 -4
  157. package/skill/references/charts-and-figures.md +73 -0
  158. package/skill/references/extensions.md +47 -4
  159. package/skill/references/pages-and-data.md +22 -3
  160. package/skill/references/preference-files.md +7 -0
  161. package/skill/references/previews.md +17 -0
  162. package/skill/references/writing-html.md +21 -82
  163. package/web/assets/index-B4uUluLM.js +15 -0
  164. package/web/assets/index-C3vHT8sH.css +1 -0
  165. package/web/index.html +2 -2
  166. package/dist/chunk-2HS7ZBPU.mjs +0 -2
  167. package/dist/chunk-3F57LEN5.mjs +0 -2
  168. package/dist/chunk-4OZWXZE5.mjs +0 -5
  169. package/dist/chunk-5GK7HS62.mjs +0 -2
  170. package/dist/chunk-6GV3CBB2.mjs +0 -2
  171. package/dist/chunk-6NLXUKAY.mjs +0 -4
  172. package/dist/chunk-6XD6U3QA.mjs +0 -5
  173. package/dist/chunk-6Y3HYOBM.mjs +0 -2
  174. package/dist/chunk-7EFHNQ5B.mjs +0 -3
  175. package/dist/chunk-7M2BQQGZ.mjs +0 -2
  176. package/dist/chunk-7UZUQQ7Q.mjs +0 -554
  177. package/dist/chunk-ALZ6ZENZ.mjs +0 -3
  178. package/dist/chunk-BX5AKINW.mjs +0 -15
  179. package/dist/chunk-DR73Y2UJ.mjs +0 -3
  180. package/dist/chunk-EURLTOTZ.mjs +0 -4
  181. package/dist/chunk-F4ZA6JRZ.mjs +0 -3
  182. package/dist/chunk-FNCCVGKX.mjs +0 -2
  183. package/dist/chunk-FOJ3K5Z3.mjs +0 -6
  184. package/dist/chunk-FQ72LZHB.mjs +0 -2
  185. package/dist/chunk-G7N7YFVD.mjs +0 -2
  186. package/dist/chunk-GIRXJBGC.mjs +0 -2
  187. package/dist/chunk-GKOBB6DH.mjs +0 -2
  188. package/dist/chunk-GMJD7ID3.mjs +0 -2
  189. package/dist/chunk-GQJMVSSN.mjs +0 -2
  190. package/dist/chunk-HX4DLE3J.mjs +0 -10
  191. package/dist/chunk-IS7N3N6Q.mjs +0 -168
  192. package/dist/chunk-JEUK3ZO7.mjs +0 -2
  193. package/dist/chunk-JPG2LBQM.mjs +0 -11
  194. package/dist/chunk-JYK5WJPM.mjs +0 -2
  195. package/dist/chunk-KLQP46Y3.mjs +0 -4
  196. package/dist/chunk-L55NOXBE.mjs +0 -4
  197. package/dist/chunk-LCB6MARS.mjs +0 -5
  198. package/dist/chunk-LJLVCU6W.mjs +0 -16
  199. package/dist/chunk-LMUZQK5O.mjs +0 -2
  200. package/dist/chunk-NMF3IPYA.mjs +0 -13
  201. package/dist/chunk-ONKC4BCC.mjs +0 -2
  202. package/dist/chunk-OU6ZZVBX.mjs +0 -5
  203. package/dist/chunk-PUOQ65NC.mjs +0 -2
  204. package/dist/chunk-QJAVCTY7.mjs +0 -2
  205. package/dist/chunk-QP7BOHE4.mjs +0 -2
  206. package/dist/chunk-S3SX3COT.mjs +0 -20
  207. package/dist/chunk-SQ3FQCCN.mjs +0 -8
  208. package/dist/chunk-T4Y2ZSVX.mjs +0 -4
  209. package/dist/chunk-TANZRINB.mjs +0 -2
  210. package/dist/chunk-UGWMMEJ5.mjs +0 -15
  211. package/dist/chunk-UTF7GBQU.mjs +0 -4
  212. package/dist/chunk-V4ZHRALW.mjs +0 -170
  213. package/dist/chunk-XBNFXWAW.mjs +0 -6
  214. package/dist/chunk-XZV72SQ4.mjs +0 -2
  215. package/dist/chunk-YFJB534W.mjs +0 -2
  216. package/dist/chunk-Z6OKLRHC.mjs +0 -2
  217. package/dist/chunk-ZMHUDYLV.mjs +0 -2
  218. package/web/assets/index-D8P8uhDW.js +0 -15
  219. package/web/assets/index-FLb9jCfl.css +0 -1
  220. /package/dist/{chunk-PAREWQGB.mjs → chunk-NOGQX56R.mjs} +0 -0
@@ -0,0 +1,966 @@
1
+ import { createRequire as __galleryRequire } from "node:module"; import { fileURLToPath as __galleryPath } from "node:url"; const require = __galleryRequire(import.meta.url); const __filename = __galleryPath(import.meta.url); const __dirname = __galleryPath(new URL(".", import.meta.url));
2
+ var c=e=>e.map((t,s)=>s===0?`Usage: ${t}`:` ${t}`).join(`
3
+ `),h=({intro:e,subs:t})=>[c(t.flatMap(s=>s.usage)),e,...t.map(s=>s.text)].join(`
4
+ `);function w({command:e,intro:t,subs:s}){let a=Math.max(...s.map(n=>n.name.length));return[`Usage: gallery ${e} <command> [options]`,t,"",`Commands (gallery help ${e} <command> prints one in full: its usage lines, what it does and prints, its exit codes):`,...s.map(n=>` ${n.name.padEnd(a)} ${n.summary}`)].join(`
5
+ `)}var p=({command:e},t)=>`${c(t.usage)}
6
+ ${t.text}
7
+ gallery help ${e} says what a ${e} is and lists the other commands.`,l={command:"block",intro:`A custom block (\u81EA\u5B9A\u4E49\u5757) is a block to use again, kept in the workspace: components/<scope>/<name>/
8
+ (its files keep the word component: component.json, data-doc-component). An id is <scope>/<name>, or a
9
+ <name> alone in the scope local (but for show and check, a <name> that is none of local's and is one of
10
+ Gallery's own is Gallery's, as for add: gallery block show heatmap shows gallery/heatmap); a document
11
+ uses one by an element naming it. The scopes gallery and gallery-soft are Gallery's own blocks' (its two packs:
12
+ Gallery \u98CE\u683C and \u67D4\u5149\u98CE\u683C). gallery component \u2026 is another name for gallery block \u2026, and says the same.`,subs:[{name:"new",summary:"start a block (--script --flow --data --page, or --recipe <name> from one of Gallery's own)",usage:["gallery block new <id> ([--script] [--flow] [--data] [--page] | --recipe <name>)"],text:`new starts a block: component.json, template.html, example.html, writing.md and style.css, and with
13
+ --script a kit.js; with --flow a slot, body, in place of its paragraph, where a document writes blocks
14
+ of its own; with --data a block that keeps what a reader enters in a part of JSON (items, a list of
15
+ lines, written on one line as context.editJSON writes it): a kit.js that reads it with context.readJSON
16
+ and writes it with context.editJSON, from a field (DocKit.input) and a button hidden where nothing is
17
+ written (an export), an example() that adds a line and works on template.html's empty instance as it
18
+ does on example.html's (--script is implied; --data and --flow do not go together); with --page a
19
+ custom page's card (places ["page"], a card of two sizes the user may resize, its text parts edited as
20
+ none, which a page shows as written; --page and --flow do not go together), combined with --data a
21
+ card that keeps data; with --recipe <name> (alone: none of --script --flow --data --page goes with it, the
22
+ recipe being a block already made: todos, weather and the other blocks of Gallery's for a custom page
23
+ are cards for one already, places ["page"]) the files of Gallery's own block of that name, every word
24
+ that named it naming the new id, its version 0.1.0, and a line naming what is still the recipe's:
25
+ preview.svg, writing.md and example.html. Each passes check, and try on its field, as it stands, and
26
+ says what to write next.
27
+ Exits 1 when the id is taken; 2 for an id of the scope of Gallery's own packs or of a pack installed, a
28
+ recipe Gallery has none of, or options that do not go together.`},{name:"add",summary:"put one of Gallery's own blocks into the workspace as it ships",usage:["gallery block add <name>"],text:`add puts one of Gallery's own blocks in the workspace as it ships (a <name> alone is Gallery \u98CE\u683C's,
29
+ gallery-soft/<name> \u67D4\u5149\u98CE\u683C's), components/gallery/<name>/, no check
30
+ or try needed, and records its version and what its files hold in .gallery/blocks.json; run again with a
31
+ newer Gallery, it updates a copy that is as it was added, and never one changed since.
32
+ Exits 1 when the copy there was changed since it was added (or put there by another hand), said with
33
+ what to do: --recipe for a block of your own, or delete the folder and add it again.`},{name:"list",summary:"what the workspace has now, by where a block may stand (--json for a script)",usage:["gallery block list [--json]"],text:`list says what the workspace has now, in two groups by where a block may stand (its manifest's places):
34
+ \u6587\u6863\u91CC\u53EF\u7528, in documents, and \u81EA\u5B9A\u4E49\u9875\u53EF\u7528, on custom pages, each with its version, what it uses (needs)
35
+ and whether the user's switch keeps it out of the document's menus, which is still a block to write;
36
+ then those not to use now and why: disabled, one that does not load, a manifest one level too shallow;
37
+ then Gallery's own blocks not added yet, or added as an older version, each with its gallery block add
38
+ line; and last the built-in blocks the user took out of the document's menus.
39
+ --json prints one JSON object instead, 2-space indented, and nothing else: { "workspace": its absolute
40
+ path, "blocks": [every block of the workspace, those that do not run too: { "id", "pack" (its scope),
41
+ "name" and "description" ({ "zh", "en" }; null where its manifest does not read), "version", "state"
42
+ ("normal", "hidden", "disabled" or "broken"), "reason" ({ "zh", "en" }: why a broken one does not load,
43
+ else null), "places" (["document"], ["page"] or both; null where unread), "needs" (its manifest's; null
44
+ where unread), "template" (whether a menu can put it in), "menu" (the switch \u5728\u6587\u6863\u83DC\u5355\u91CC\u663E\u793A), "unlisted"
45
+ (the master switch off: no menu or library offers it), "disabled" (\u505C\u7528), "net": { "hosts" (the websites
46
+ its needs name), "allowed" (those the user allowed), "on" (\u5141\u8BB8\u8054\u7F51 is on: every host allowed) } }],
47
+ "available": [Gallery's own blocks the workspace has not added, or has as an older version: { "id",
48
+ "add" (what gallery block add takes), "title" ({ "zh", "en" }), "version", "places", "added", "workspaceVersion",
49
+ "changed" }], "builtin": [the built-in blocks of the document's menus, what gallery block menu takes
50
+ besides a custom block's id: { "id", "name" ({ "zh", "en" }), "hidden", "hideable" }] }. The fields
51
+ are only ever added.`},{name:"show",summary:"how to write one block: its parts, where it may stand, writing.md and the example",usage:["gallery block show <id>"],text:`show says how to write one: its parts, where it may stand, its writing.md and its example. Of one of
52
+ Gallery's own the workspace has not added (gallery/<name>) it prints what Gallery ships of it the same
53
+ way, and ends with the gallery block add <name> line that puts it in.
54
+ Exits 1 when there is no such block or it does not load.`},{name:"check",summary:"what is wrong with a block, in its files and in a browser (--documents: its instances too)",usage:["gallery block check <id> [--documents]"],text:`check says what is wrong with one, each problem ("FAIL") at its place in the block's files, each note
55
+ never a failure, in five sections: 1 the manifest, with template.html there, text parts that hold
56
+ words and marks alone, and a note on a Chinese name no word of its words spells whole in pinyin, a
57
+ syllable a character, by how many syllables a word reads as; 2 kit.js: what a browser refuses, what
58
+ an export refuses, what it registers, a type check against sdk/; 3 style.css: every selector in the
59
+ instance, what an export cannot hold, and a note on one that goes down into a slot; 4 template.html
60
+ and example.html, each read as a document's page by what gallery check runs, and template.html as what
61
+ a menu can put in; 5
62
+ both in a temporary document, exported and opened as gallery qa opens one, in Chrome or Edge under the export's
63
+ policy: what the console and the policy say, a dialog or a window it opens, mount then dehydrate then
64
+ mount and copies put back giving the same DOM (a drawing neither the manifest's runtime nor dehydrate
65
+ names piles up, and what piles up outside the instance is named too), a slot the component writes in
66
+ or moves, a text part the component redraws, a data part a mount changes, a write with no gesture
67
+ once the page takes edits, the way back to the file (a way back line: what the component's example wrote, each part with how many of its
68
+ lines the write took out and put in, and that the server took it; a note on a write that lays a part
69
+ out anew (not where it is context.editJSON's own layout: a part on several lines closing to one line as
70
+ its list empties, an entry in it opening to lines as it comes to hold an object; a part on one line
71
+ stays on one), a FAIL at kit.js on an example() that changes nothing on template.html's empty instance, and a
72
+ note on a list a card is dropped on that listens for dragover and not for dragenter), a note on a
73
+ control of an instance with a data part that is still shown and enabled where nothing is written (the
74
+ export's look: context.canEdit() false), a page wider than the window, and the pictures, in <workspace>/.gallery/qa/components/<id>/, its absolute
75
+ path printed, emptied each run: overview-light.png and overview-dark.png, the three widths of a theme
76
+ side by side, then each at 360, 736 and 1024px wide, light and dark, and edit-1024-light.png and
77
+ edit-360-light.png, as the editing page draws it, said when they are the export's. Section 5 waits
78
+ until what it needs passes; a page that stops answering or loads itself again ends it, and is said;
79
+ with no browser, one that does not start or goes while it looks, or a folder it cannot write, it says
80
+ so and the rest stands. A block the user turned off is checked as any, with a note saying so. A note in
81
+ section 1 says a preview.svg that is, byte for byte, one of Gallery's own blocks' (a block made with
82
+ --recipe keeps its recipe's picture). Last, before the verdict, a \u4E0B\u4E00\u6B65 line lists every
83
+ picture of the run, none looked at for you, as gallery page check's does (gallery qa lists them as \u8981\u770B\u7684\u56FE).
84
+ --documents adds a section for each document of the workspace that holds instances of it, those in
85
+ another's slot too: each run as the example is, in a temporary document of their own, exported and
86
+ opened under the export's policy, each problem at its line of the document's file (board/doc.html:15),
87
+ the pictures in documents/<slug>/ of the block's folder. It writes no document.
88
+ GALLERY_BROWSER=<executable> picks the browser.
89
+ Exits 1 when anything fails, 3 when nothing did and no browser ran it (UNVERIFIED), else 0.
90
+ Exits 2 for an id no block can have.`},{name:"try",summary:"make a reader's gestures on an instance in a document, and say what they wrote",usage:["gallery block try <slug> [<instance id>] --press <selector> [--then <key>] [--keep]","gallery block try <slug> [<instance id>] --drag <selector> --to <selector> [--then <key>] [--keep]","gallery block try <slug> [<instance id>] --key <selector> <key> [--then <key>] [--keep]","gallery block try <slug> [<instance id>] --type <selector> <words> [--replace] [--then <key>] [--keep]","gallery block try <slug> [<instance id>] --select <selector> <value> [--then <key>] [--keep]","gallery block try <slug> [<instance id>] --steps <file> [--keep]"],text:`try makes what a reader does on an instance in a document, with the pointer and the keys, and says
91
+ what it wrote. It makes it on a scratch copy of the document (<workspace>/.gallery/try/try-<8 hex>/,
92
+ gone at the end, whatever came of it): doc.html is not written, and no page of the user's shows the trial;
93
+ --keep makes it on the document itself and leaves what it wrote. It starts the shared Gallery server (or
94
+ uses the one running), as gallery open does, and opens the copy's page alone, editable, in Chrome or
95
+ Edge, headless, in a profile of its own, and waits until the server has told the page of the writes
96
+ made before it (a custom block changed), which load it again. Each selector is the first element of the
97
+ instance it finds: --press, a press at its middle; --drag \u2026 --to, pressed there, moved in steps to the
98
+ middle of another and released a moment after the move that comes onto it; --key, the key (Enter,
99
+ Space, ArrowRight, a letter, Shift+Tab, Control+a) with the focus on it, as Tab gives it; --type, the
100
+ words typed in a field or an editable element, pressed first and the caret at its end (unless the focus
101
+ is in it already), ASCII key by key and the rest through an input method, composed then committed (the
102
+ Gesture line says what the field held, and that the words went after it, or, with the focus in it
103
+ already, in at the caret where a step before left it; --replace selects all it holds first, so that
104
+ they take its place, as { "type": [".name", "\u65B0\u540D\u5B57"], "replace": true } in a step);
105
+ --select, an option of a <select>, by its value or its words, chosen as a reader picks one. --then
106
+ <key> presses a key after it where the focus is (--then Enter, for a field that writes on Enter).
107
+ --steps <file> makes several, one after another in one page: a JSON list of steps, each one gesture as
108
+ the options name them, without their --: [{ "press": ".add" }, { "key": [".name", "Control+a"] },
109
+ { "type": [".name", "\u591A\u559D\u6C34"], "then": "Enter" }, { "select": [".unit", "\u676F"] }, { "drag": ".card",
110
+ "to": ".column:nth-child(3)" }], 20 at most. <slug> names the document, as its link or a whole address
111
+ does too (gallery help says how), and the instance is named by its data-block-id, or by its block's
112
+ id where the document holds one of it; with one instance in the document, not at all. An instance in
113
+ another's slot is one of them, said with where it stands. Once <html>'s data-ge-save says saved again
114
+ after each, it prints a Gesture line (Step N with --steps), what it did to which element, and a Wrote
115
+ line: each part of the instance with how many of its lines it took out and put in, then those lines
116
+ (- and +), and that nothing outside the instance changed, data-block-id aside, which a save gives
117
+ (what did is someone else's, which stays); with --steps, Wrote: nothing of a step that wrote nothing.
118
+ Then it undoes as a reader does, the focus taken off a field of the instance first (a field that
119
+ writes as it loses the focus writes then), and Ctrl+Z pressed once for each write the page took, the
120
+ last first (each context.edit is an undo step of its own: a step that wrote twice takes two), and an
121
+ Undone line says the copy came back as it was before each step that wrote; --keep presses none (a Kept
122
+ line). Then it opens what the steps wrote in a fresh page (a second copy, or doc.html with --keep),
123
+ where the instance is to mount, write nothing as it opens (its file the same once it has come to edit)
124
+ and show the words and the fields' values it showed after them of what they wrote (a Read back line);
125
+ what it shows otherwise that is none of what the steps wrote (a filter or a tab chosen, an editor left
126
+ open, words typed and not committed: what the page showed and never wrote) is a note. Last, a picture of
127
+ the instance after the steps, <workspace>/.gallery/qa/<slug>/try/after.png, its absolute path
128
+ printed, emptied each run: open it, as the line says; a \u4E0B\u4E00\u6B65 line then lists the pictures of the
129
+ run (after.png, and fresh.png when it was taken), none looked at for you. A trial cut off (the page offline, a load of its
130
+ own, the browser gone) says what the file held of it.
131
+ Exits 1 when no step wrote anything (what came of the last said: no context.edit, one the page
132
+ refused, an HTML5 drag dropped nowhere, a selector that finds nothing as the component failed, a
133
+ field typed in that writes on a key or as it loses the focus), when a Ctrl+Z did not take a step's
134
+ write back, when the fresh page shows it in its fallback, writes as it opens or shows what the steps
135
+ wrote otherwise than the page did after them (fresh.png pictures it), or when the component failed; 2
136
+ for a mistake in the command line: a selector that finds nothing shown in the instance, an instance the
137
+ document has not among them, a drag that ends on what it drags, an option a <select> has not, a steps
138
+ file that does not read (one found at a step after others were made is said after what those wrote,
139
+ which with --keep stays in doc.html); 3 when the trial was not seen through (UNVERIFIED: no server or browser ran
140
+ it, a page that loaded itself again; with --keep a card waiting for the reader, someone else's write
141
+ meanwhile, which stays), the line saying what the file held.`},{name:"key",summary:"keep, show or take away the key for a site a block reaches",usage:["gallery block key [<host> [<key>]] [--remove]"],text:`key keeps the workspace's key for a site its blocks reach, by its host (a block's needs' host:
142
+ api.example.com), in <workspace>/.gallery/keys.json, never gallery.json: where a block's address on that
143
+ host names {key} (its path or its query: \u2026/latest?apikey={key}), Gallery's server writes the key in as it
144
+ fetches for the block (context.fetch); no page, cache or export ever holds it. With a host and no key
145
+ it says whether one is kept; with --remove it takes it away; with nothing, the hosts that have one and
146
+ those the workspace's blocks name with none. A key is never printed.
147
+ Exits 2 for a host no block's needs can name, or a key that is empty or more than one line.`},{name:"pack",summary:"block packs (\u81EA\u5B9A\u4E49\u5757\u5305): install, list, remove, switch on or off",usage:["gallery block pack install <folder|zip>","gallery block pack list [--json]","gallery block pack remove <pack>","gallery block pack on|off <pack>"],text:`pack: a block pack (\u81EA\u5B9A\u4E49\u5757\u5305) is a scope of blocks, components/<pack>/, with its pack.json (id, name,
148
+ description, version, author, homepage, icon), to share as its folder or a zip of it. pack install copies
149
+ one in (a folder, or a zip with the pack's folder or what it holds at its top), each block's manifest
150
+ last, and records its version and what its files hold in .gallery/blocks.json; installed again (a newer
151
+ version), a block as it was installed is replaced and one changed since is kept, said with what to do.
152
+ Refused, exit 1, with why: no pack.json at its top or one that does not read, a block folder whose
153
+ component.json does not name it <pack>/<name>, a file that points out of it, more than 2000 files or 64
154
+ MB, the id of one of Gallery's own packs, or one the workspace has a folder of that no install put
155
+ there. pack list says the workspace's packs: Gallery's own (installed as a workspace first starts:
156
+ Gallery \u98CE\u683C on, \u67D4\u5149\u98CE\u683C off), those installed and the scopes of its own blocks, each with its version,
157
+ whether its switch in \u8BBE\u7F6E \u203A \u7EC4\u4EF6\u5217\u8868 is on (off: no menu or library offers its blocks; what is written of
158
+ them shows as ever), how many blocks and who made it. pack remove takes out a pack installed, its
159
+ folder and records (exit 1 for one of Gallery's own, which its switch turns off, or a scope no install
160
+ put there).
161
+ pack list --json prints one JSON object instead, 2-space indented, and nothing else: { "workspace": its
162
+ absolute path, "packs": [{ "id", "name" ({ "zh", "en" }), "kind" ("default", "official", "installed" or
163
+ "own"), "version", "enabled" (its switch), "blocks" (how many), "author", "description", "homepage",
164
+ "icon", "problem" ({ "zh", "en" }: why its pack.json does not read, else null), "changed" (the blocks
165
+ changed since they were installed), "newer" }] } in the order pack list says them; the fields are only
166
+ ever added.
167
+ pack on and pack off turn a pack's switch on or off, the switch of its card in \u8BBE\u7F6E \u203A \u7EC4\u4EF6\u5217\u8868
168
+ (gallery.json's components.packs): off, no menu or library offers its blocks ("/" and \u6DFB\u52A0\u81EA\u5B9A\u4E49\u5757),
169
+ and what is written of them shows as ever; on offers them again. <pack> is its id (gallery block pack
170
+ list says each: gallery for Gallery \u98CE\u683C, gallery-soft for \u67D4\u5149\u98CE\u683C, local for the default pack). One of
171
+ Gallery's own the workspace has not got yet (no server has started in it, gallery init has not run) is
172
+ installed first, as they install it; the user turns the packs on and off, so do it when they ask. It is
173
+ written through the workspace's running server when there is one (the open pages follow at once), else
174
+ here, and says whether it changed anything (a pack on already is not an error).
175
+ Exits 1 when the workspace has no such pack (or gallery.json cannot be read or written); 2 for a pack id
176
+ that is none.`},{name:"menu",summary:"show a block in the document's menus or take it out (\u8BBE\u7F6E \u203A \u7EC4\u4EF6\u5217\u8868 \u203A \u5728\u6587\u6863\u83DC\u5355\u91CC\u663E\u793A)",usage:["gallery block menu on|off <block>"],text:`menu on and menu off turn the block's switch \u5728\u6587\u6863\u83DC\u5355\u91CC\u663E\u793A of \u8BBE\u7F6E \u203A \u7EC4\u4EF6\u5217\u8868 on or off: off, "/", \u5728\u4E0B\u65B9\u65B0\u5EFA
177
+ and the handle's grid no longer offer it, and what is written of it in documents still runs and exports as
178
+ ever (the switch is about the menus alone, a document still writes the block); on offers it again. <block>
179
+ is a custom block's id (a <name> alone is local's, else Gallery's own: as show takes it) or the name of a
180
+ built-in block (callout, quote, table\u2026: gallery block list --json lists them as "builtin", with the ones that
181
+ cannot be taken out). A block that stands on custom pages alone (its places hold page, not document) is out
182
+ of the document's menus until menu on. A built-in block that must stay in the menus (text, headings,
183
+ lists\u2026) is refused. It is written through the workspace's running server when there is one (the open pages
184
+ follow at once), else here, and says whether it changed anything.
185
+ Exits 1 when there is no such block or the block cannot be hidden (or gallery.json cannot be read or
186
+ written); 2 for a block id that is none, or a missing on or off.`},{name:"net",summary:"let a block reach the websites its needs name, or take that back (only when the user asks)",usage:["gallery block net on|off <block>"],text:`net on lets a custom block reach the websites its manifest's needs name (net:<host>), the switch \u5141\u8BB8\u8054\u7F51 of
187
+ \u8BBE\u7F6E \u203A \u7EC4\u4EF6\u5217\u8868: Gallery fetches for the block, only from those sites, with none of the user's logins, and
188
+ what it gets is shown in Gallery and kept in an export. It goes beyond the workspace, so turn it on only
189
+ when the user asked for it, never to make a block work on your own say. net on prints the websites first
190
+ (all of them are allowed together; one that a later version of the block adds needs a new net on), then
191
+ writes the consent in gallery.json (components.net). net off takes it back at once (the block shows what
192
+ it last had, or asks the reader again). It is written through the workspace's running server when there is
193
+ one (the open pages follow at once), else here, and says whether it changed anything.
194
+ Exits 1 when there is no such block, its needs name no website, or gallery.json cannot be read or written;
195
+ 2 for a block id that is none, or a missing on or off.`}]},d={command:"page",intro:`A custom page (\u81EA\u5B9A\u4E49\u9875) is a page the workbench lists in its sidebar with \u65B0\u5EFA and \u641C\u7D22, kept in the
196
+ workspace: pages/<slug>/, page.html (free HTML: its look, its own scripts, and boards of cards, each card
197
+ one custom block's instance, where it has them) and page.json ({ "title", "icon" }). An Agent writes them
198
+ (the user may make a blank one for an Agent to write); the user orders, renames and trashes them, and an
199
+ Agent does so when the user asks (page set, page move, gallery trash <slug>), not on its own.
200
+ Documents and custom pages share one set of slugs: neither takes the other's, nor pages (the folder).
201
+ The home page (\u9996\u9875) is pages/home, a page as any.`,subs:[{name:"new",summary:"make a page: page.html with one empty board, and page.json",usage:['gallery page new <slug> "<title>"'],text:`new makes one: page.html with its title (in <title>: a page draws no big title) and one empty board (data-board-id="main"), and
202
+ page.json with the title; it goes last in the sidebar's head. The server puts in the scripts and styles
203
+ of the blocks its cards hold. Says where it wrote and what to write next, and with the shared Gallery server
204
+ running ends with the \u4EA4\u7ED9\u7528\u6237 line gallery open has: the page's whole address, to send the user at once
205
+ (without one, gallery page open <slug> --no-browser gives it).
206
+ Exits 1 when the slug is taken (a document's, a page's, the trash's) or kept (exports, components, pages,
207
+ assets, materials\u2026). Before the server's first start in the workspace makes the default home page (with
208
+ its own cards; gallery open --no-browser starts one), gallery page open, add, try and check of home say
209
+ so in place of "no such page".`},{name:"list",summary:"the pages in the sidebar's order, each with its address (--json for a script)",usage:["gallery page list [--json]"],text:`list says the workspace's custom pages in the sidebar's order (the order the user dragged them to, then
210
+ gallery.json's pages.order, then by title): each one's slug, icon and title, its address (\u5730\u5740\uFF1A, the whole address with
211
+ the shared Gallery server running, else /#@<slug>, after the port of a server) and where its page.html is;
212
+ in a workspace with no page whose home page is not made yet, only that the home page waits for the server.
213
+ A page in the trash (gallery trash, the sidebar's \u79FB\u81F3\u56DE\u6536\u533A) is not listed.
214
+ --json prints one JSON object instead, 2-space indented, and nothing else: { "workspace": its absolute
215
+ path, "server": { "port" } of the shared Gallery server (null when none runs), "pages": [{ "slug",
216
+ "title", "icon" (null for none), "defaultCards" (whether page reset-cards works on it), "address" (as
217
+ \u5730\u5740 says it), "file" (the absolute path of its page.html) }] in the sidebar's order, "homeNotMade": whether
218
+ the default home page waits for the server's first start }; the fields are only ever added.`},{name:"open",summary:"start the server if none runs and open the page in the browser",usage:["gallery page open <slug> [--no-browser]"],text:`open starts this workspace's Gallery server (or uses the one running), as gallery open does, and opens
219
+ the default browser at the page in the workbench (--no-browser, or GALLERY_NO_BROWSER=1, opens none).
220
+ Prints the workspace, the server, the page alone (the Agent's own: /pages/<slug>) and last the address
221
+ to give the user (/#@<slug>).
222
+ Exits 1 when there is no such page or no server answers.`},{name:"add",summary:"put a card of a block on a page, its settings written with it (--set)",usage:["gallery page add <slug> <block> [--board <id>] [--x <n> --y <n>] [--w <n>] [--h <n>] [--set <key>=<value>]\u2026"],text:`add puts a card of a custom block on a board of the page (--board, else main, else its first): the
223
+ block's id (local/water) or the name of one of Gallery's own the workspace has (gallery block add puts
224
+ one in), a block whose manifest's places hold page. The card takes the block's default size (its
225
+ card.sizes' first, else card.w and card.h; one with no h 2 high, where the page's own \u6DFB\u52A0\u81EA\u5B9A\u4E49\u5757 makes it
226
+ as high as its content) at the first free spot (the topmost row it fits in, its leftmost column), or the cells --x and
227
+ --y (and --w, --h, held to the block's sizes or its min and max: one that writes a min or a max beside its sizes takes any whole size between them) say, the cards it meets pushed down,
228
+ never one moved up; its data-card-id is the lowest c<n> no card holds, and every card of the page gets
229
+ one it lacks. Written through the workspace's running server when there is one (the queue an open
230
+ page's own gestures go through: the page shows the card at once; a block put in a moment ago is
231
+ waited for until the server takes it, a few seconds at most), else into page.html, which is kept
232
+ first (.gallery/state/pages/<slug>/, the last 20), every other byte of it as it was. Prints the card's
233
+ id and cells, and the cards it pushed. Each --set <key>=<value> writes a setting of the block (its manifest's
234
+ settings: weather's city, countdown's date) into the card's settings part as it is added, in the same
235
+ write, as the card's own grip \u203A \u8BBE\u7F6E\u2026 would, the value held to the setting's type (a number, a date as
236
+ YYYY-MM-DD, a select's one of its options, a switch's true or false): --set city=\u4E0A\u6D77 --set unit=\u2109. The
237
+ words after the first "=" are the value, whatever the shell does to quotes (no JSON to quote). A block that
238
+ has a setting it cannot show anything without (required: weather's city, countdown's date), added with
239
+ none, says so after the card: ask the user for it, or take it from what the workspace says.
240
+ Exits 1 when there is no such page or board, or the block is not in the workspace, is turned off or is a
241
+ document's alone; 2 for a --set of a setting the block has not, or a value its type refuses, nothing written.`},{name:"set",summary:"change a page's title or icon (the sidebar's \u91CD\u547D\u540D)",usage:['gallery page set <slug> [--title "<title>"] [--icon <emoji|icon|none>]'],text:`set changes a custom page's title or icon as the sidebar's \u91CD\u547D\u540D does: its page.json's title (the
242
+ same function the workbench's rename calls) and icon (none takes it away), every other field of page.json
243
+ as it was; at least one of --title and --icon. An icon is an emoji or an icon of the \u56FE\u6807 tab
244
+ (/icons/<name>_<color>.svg, Tabler's /icons/tabler/<name>_<color>.svg, the colors gray, lightgray, brown,
245
+ yellow, orange, green, blue, purple, pink, red), not a picture. page.html is not touched: its own <title> is
246
+ the page's, which an Agent writes. The sidebar shows the change at once (the server watches page.json).
247
+ A title that starts with "-" and a letter is written --title="-Q3 \u56DE\u987E".
248
+ Prints what changed, then the file to re-read (\u91CD\u8BFB\uFF1A).
249
+ Exits 1 when the page is not there or page.json does not read; 2 for a title that is empty or over 200
250
+ characters, or an icon that is none of these.`},{name:"move",summary:"move a page's row in the sidebar's head (--after another page, or --first)",usage:["gallery page move <slug> (--after <page> | --first)"],text:`move puts a custom page's row in the sidebar's head (\u65B0\u5EFA, \u641C\u7D22 and each page, in the order the user
251
+ drags them to) right after another page's row (--after), or before the first page's row (--first; \u65B0\u5EFA
252
+ and \u641C\u7D22 stay where they are). Written through the workspace's running server when there is one (an open
253
+ workbench shows it at once), else here, in the outline file under its lock, every other thing of it as it
254
+ was. Prints the pages in their new order (as list says them). A page that is where it is asked to be
255
+ changes nothing (exit 0).
256
+ Exits 1 when a page named is not there, or --after names the page itself; 2 for none or both of --after
257
+ and --first.`},{name:"card",summary:"change one card of a page: its settings, its place or size, or take it off",usage:["gallery page card <slug> <card id> [--set <key>=<value>]\u2026 [--move <x>,<y>] [--size <w>,<h>]","gallery page card <slug> <card id> --remove"],text:`card changes one card of the page, as the card's own gestures do, through the page service (every gesture
258
+ of the page and page add go through it: the open page shows the change at once; no server running, the same
259
+ code writes page.html here, the file kept first as add keeps it). The card is named by its data-card-id (page
260
+ check lists them; a card with none has the lowest c<n> its page gives it). --set <key>=<value> writes a
261
+ setting of its block into the card's settings part, as page add --set does (each value held to its
262
+ setting's type; the words after the first "=" are the value); --move <x>,<y> puts it at other cells
263
+ (whole numbers, x from 0 and y from 0, on its board), --size <w>,<h> gives it another size (w 1 to 12, h at
264
+ least 1, held to the block's sizes or its min and max; a block that is not resizable refuses): both in one
265
+ write, the cards it then meets pushed down, never one moved up. --remove takes the card off the page
266
+ (alone: nothing goes with it): its data goes with it (page.html as it was is kept in
267
+ .gallery/state/pages/<slug>/, the last 20 versions), and gallery page add puts a new card of its block
268
+ in. With --move or --size and --set together the place is written first, then the settings. A card another writer changed between the read and the write is read again (three tries).
269
+ Prints the card's cells, the settings now and the file to re-read (\u91CD\u8BFB\uFF1A).
270
+ Exits 1 when the page, the card or its block is not there, or the service refuses (the card is not
271
+ resizable, page.html would grow past 1,000,000 bytes); 2 for a --set of a setting the block has not or a
272
+ value its type refuses (nothing written), cells that are not whole numbers, none of the options, or
273
+ --remove with another.`},{name:"reset-cards",summary:"put back the default cards a page misses (the page's menu \u6062\u590D\u9ED8\u8BA4\u5361\u7247)",usage:["gallery page reset-cards <slug>"],text:`reset-cards does for a page what its menu's \u6062\u590D\u9ED8\u8BA4\u5361\u7247 does, through the page service (restore-defaults): of
274
+ the default blocks the page has (its page.json says "defaultCards": true, as the default home page's does;
275
+ Gallery's today, weather, countdown, habit, stats, todos, heatmap, recent, note and static) it puts a card of
276
+ each that no card of the page holds, at the first free spot by its default size, Gallery's own block put into
277
+ the workspace first; every other card and byte as it was, nothing pushed. Prints the cards it put back
278
+ (id, block, cells) and the default blocks it could not (turned off, not there), or that the page holds
279
+ them all. Written through the workspace's running server when there is one (the open page shows them at
280
+ once), else here.
281
+ Exits 1 when the page is not there or has no default cards.`},{name:"try",summary:"make a reader's gestures on one card, and say what they wrote",usage:["gallery page try <slug> <card id> --press <selector> [--then <key>] [--keep]","gallery page try <slug> <card id> --drag <selector> --to <selector> [--keep]","gallery page try <slug> <card id> --key <selector> <key> [--keep]","gallery page try <slug> <card id> --type <selector> <words> [--replace] [--then <key>] [--keep]","gallery page try <slug> <card id> --select <selector> <value> [--then <key>] [--keep]","gallery page try <slug> <card id> --steps <file> [--keep]"],text:`try makes what a reader does on one card of the page, named by its data-card-id, and says what it wrote:
282
+ gallery block try's gestures (--press, --drag \u2026 --to, --key, --type, --select, --then) and steps
283
+ (--steps <file>), made in the page with the pointer and the keys on the card's instance, each selector
284
+ the first element of the instance it finds (gallery block --help says each). It makes them on a scratch
285
+ copy of the page (<workspace>/.gallery/try/try-<8 hex>/, gone at the end, whatever came of it):
286
+ page.html is not written, and no page of the user's shows the trial; --keep makes them on the page itself
287
+ and leaves what they wrote. It starts the shared Gallery server (or uses the one running) and opens the
288
+ copy's page alone (/pages/<slug>), editable, in Chrome or Edge, headless, in a profile of its own. A
289
+ write is what the page's board sends the page service, as the user's gestures go: once each is
290
+ answered, a Gesture line (Step N with --steps) and a Wrote line say each data part of the card's
291
+ instance (its settings among them) with the lines it took out and put in, those lines under it (- and
292
+ +), and that nothing else in page.html changed (card ids aside, which the page service gives the cards
293
+ that have none). Only the card's data parts may change: a write anywhere else (the card's place, its
294
+ own markup, another card, the page's own HTML) is a problem, said with what it changed. Then the page's
295
+ own undo, Ctrl+Z pressed once for each write it took, the last first, the focus taken off a field of the
296
+ card first (an Undone line: the copy as it was, card ids aside); --keep presses none (a Kept line). Then
297
+ a fresh page of what the steps wrote (a second copy, or page.html with --keep), where the card is to
298
+ mount, write nothing as it opens and show what it showed after them of what they wrote (a Read back
299
+ line). Last, a picture of the card's instance after the steps, <workspace>/.gallery/qa/<slug>/try/after.png,
300
+ its absolute path printed: open it, and the \u4E0B\u4E00\u6B65 line lists it. --replace goes with --type, as
301
+ gallery block try's does.
302
+ Exits as gallery block try does: 0 the steps wrote, the undo took it back (or --keep kept it) and a fresh
303
+ page read it back; 1 a problem of the block's (gestures that wrote nothing, a write outside the card's
304
+ data parts, an undo that left part of a write, a fresh page that shows it otherwise or writes as it
305
+ opens), or no such page, a card holding no instance, a block that does not load, is turned off or is a
306
+ document's alone; 2 a mistake in the command line (a card the page has not, a selector that finds
307
+ nothing in the instance, a steps file that does not read); 3 when the trial was not seen through
308
+ (UNVERIFIED: no server or browser, a page that loaded itself again).`},{name:"check",summary:"what is wrong with a page, what changed in it, and its pictures",usage:["gallery page check <slug>"],text:`check says what is wrong with the page, each problem a FAIL line with its line in page.html, and what
309
+ changed in it. Its structure (a page's own scripts, frames and stylesheets are none of its problems):
310
+ where it has boards or cards, its boards in <main class="gallery-page">, each board's data-board-id and each
311
+ card's data-card-id there, of lowercase letters, digits and hyphens, and once in the page, each card a
312
+ board's child holding one instance, its data-x, data-y, data-w and data-h whole numbers on the board
313
+ (0 <= x, 1 <= w <= 12, x + w <= 12, 0 <= y, 1 <= h <= 24) and sharing a cell with no other card of its
314
+ board, its block in the workspace, loading, not turned off and with page in its places; and each file of
315
+ the page's own named (assets/<file>: the folder pages/<slug>/assets/, which the server serves at
316
+ /pages/<slug>/assets/<file>) there, and no frame's but a picture's (the server serves a page's own
317
+ pictures by their type, its stylesheets and scripts as such, and any other file as bytes for saving: a
318
+ frame of a file there downloads it, while a link, a font, a video or audio uses the bytes), a picture,
319
+ stylesheet or script written relative any other way being one nothing serves. Then the cards with their ids and cells, and the changes since the page as
320
+ the last check that found nothing saw it (or, before any, since the version the page service kept before
321
+ its last write): cards added, removed, moved (to another board too), resized, their data parts changed
322
+ (with the lines), a card's own markup, the page's own HTML; each change the page wrote since, a gesture
323
+ of the user's there (not gallery page add's), ends "(the user's, on the page)": leave it as it is. Then
324
+ the page itself, a scratch copy of it on the shared Gallery server (started
325
+ or used, as gallery page open does), in Chrome or Edge at 1280, 1920 and 600px wide (a narrow board: fewer
326
+ columns of the same 64px cells), light and dark: a card whose content does not fit it, a card drawn out of its board, the page
327
+ wider than the window, a block that failed, a picture that does not load, what the console says; each
328
+ look pictured whole, <workspace>/.gallery/qa/<slug>/check/<width>-<theme>.png (emptied each run), the
329
+ pictures listed and then, on a line of their own, those not opened yet: open them.
330
+ Exits 1 when anything is wrong (or there is no such page); 3 when nothing is and the page could not be
331
+ looked at (UNVERIFIED: no server or browser), its structure checked all the same; else 0, the page then
332
+ what the next check tells its changes against.`}]};var y=["init","new","import","open","serve","stop","sandbox","preview","preferences","startup","check","export","qa","list","workspaces","move","set","link","extension","block","page","skill","trash","duplicate","copy","favorite","column","notes","status","history","revert","doctor","emoji"],g={component:"block"},u=`The workspace (the folder of your documents) is --workspace <dir>, else GALLERY_WORKSPACE, else the
333
+ nearest folder up from here holding gallery.json (gallery init makes one), else ~/Documents/Gallery (on Windows
334
+ the Documents folder Explorer shows, OneDrive's when OneDrive backs it up): the default workspace, the
335
+ sidebar's \u9ED8\u8BA4\u6587\u6863 (GALLERY_DEFAULT_WORKSPACE names another folder in its place).`,o=`A document is named by its slug, by its link (\u5468\u62A5-k3xv9q2a, what gallery list shows after /#) or by a
336
+ whole address, as a user hands one over (http://127.0.0.1:8080/#\u5468\u62A5-k3xv9q2a, a block's id after a / or not): the
337
+ words in a link are a label, and a title changed since leaves the address good.`,r={preview:`Usage: gallery preview <page.html> [--out <file>] [--open] [--shots <dir>] [--only <names>]
338
+ gallery preview new <name>
339
+ Build a standalone interactive HTML preview with current Gallery styles, theme and width controls.
340
+ Local scripts/styles are embedded. --shots uses the same Chrome/Edge tooling as gallery qa.
341
+ It executes trusted page code only in its isolated browser profile; it edits no Gallery documents.
342
+ See references/previews.md for configuration and screenshots.`,preferences:`Usage: gallery preferences list [--json] [--all]
343
+ gallery preferences on|off <name>
344
+ With no arguments, list is the default. List enabled global writing preference files in their configured order. Read the files relevant to
345
+ this writing task by title and scope. --all also shows disabled files (for managing preferences).
346
+ The default is the existing <home>/preferences.md only; additional files live in <home>/preferences/.
347
+ Names may be the displayed title or relative path. Only change files, order or enabled state when
348
+ asked by the user. Files are never moved when disabled.`,sandbox:`Usage: gallery sandbox [start] [--name <name>] [--extension <dir>]... [--from <workspace>] [--demo] [--open] [--keep]
349
+ gallery sandbox list
350
+ gallery sandbox env <name>
351
+ gallery sandbox stop <name>
352
+ Start an isolated Gallery in the foreground on a free loopback port and print its URL and folder.
353
+ --open opens the URL. Ctrl+C or sandbox stop closes the service and removes its temporary files.
354
+ --keep leaves the files for inspection. --demo makes sample documents. --from copies a workspace's
355
+ documents and content settings, leaving out links to other workspaces, Gallery's network keys and runtime state.
356
+ Each --extension copies and enables a trusted source directory. Changes reinstall the copy and keep
357
+ its current enable setting. Legacy workbench scripts need a refresh. Installed extension backends
358
+ run with your OS permissions. Use sandbox env in a separate shell to point Gallery CLI at the sandbox.
359
+ Sandbox start chooses its own workspace. Use --from to try a copy of another workspace.`,startup:`Usage: gallery startup [status|enable|disable|run]
360
+ Show or change this user's login startup setting (JSON). Windows and macOS installed packages
361
+ enable it on the first service start by default. enable/disable also update the operating system;
362
+ the choice persists across upgrades. run is the silent login launcher: reuse the shared service
363
+ and saved port, never open a browser. gallery stop stops it until the next login or gallery open.
364
+ Source checkouts, npx caches and GALLERY_NO_AUTOSTART=1 never register login items.
365
+ Exits 1 if the system cannot apply the setting; 2 for an unknown action.`,init:`Usage: gallery init [<dir>] [--from <old reports dir>] [--name "<name>"]
366
+ Makes a workspace: <dir> (else the workspace found as every command finds it) with its gallery.json
367
+ only (never over a gallery.json that is there); the home workspace also gets its application folders. Prints \u5DE5\u4F5C\u533A\uFF1A<abs>\uFF08\u65B0\u5EFA or \u5DF2\u6709\uFF09.
368
+ --name writes the workspace's name in its gallery.json (the project's: what the sidebar and gallery
369
+ workspaces call it; else its folder's), said as \u540D\u5B57\uFF1A<name>; gallery workspaces --name changes it.
370
+ The workspace goes on this machine's registry, as every command's does (gallery workspaces).
371
+ --from copies the documents of an older Gallery (its reports/ folder: one folder a document, each
372
+ holding report.html or doc.html) into the workspace: every document whose slug is free here (the
373
+ others listed as skipped), its preferences.md when the workspace has none, the sidebar's order, the
374
+ \u5199\u4F5C\u504F\u597D page, the custom emoji and the documents' recent versions. The old folder is only read:
375
+ nothing there is changed, moved or deleted.
376
+ Only the default workspace gets its home page (\u9996\u9875, pages/home/: Gallery's today and note cards),
377
+ as a server's first start gives it, said in a line; once made, nothing makes it again.
378
+ Exits 1 when the workspace cannot be written or --from names no folder; 2 for a name that is empty,
379
+ over 80 characters or more than one line.`,new:`Usage: gallery new <slug> "<title>" ["<description>"] [--under <document> | --column "<column>"] [--after <document> | --first] [--no-preview] [--no-browser]
380
+ A new document in <workspace>/<slug>/ from the starter: its doc.html, holding the starter's section
381
+ to replace, and doc.json, with the title and the description (\u65B0\u6587\u6863 when none is given). Where it goes
382
+ in the sidebar's tree: under --under's document, last (first with --first), or right after --after's
383
+ (at that one's level); --column "<column>" puts it last (first with --first) at the top of that
384
+ sidebar column (gallery column new makes one; a column of this workspace's, not another workspace's or
385
+ an extension's); neither, at the top level of the own column, last. A document is named there by its
386
+ slug, link or address (gallery help says how), and must be there, not in the trash; the \u5199\u4F5C\u504F\u597D page
387
+ holds none.
388
+ Then says where it went (Placed it \u2026), where it wrote (the workspace), where the user's writing preferences are (\u5199\u4F5C\u504F\u597D,
389
+ <home>/preferences.md, to read first: made from Gallery's default when there are none yet) and
390
+ the next steps (\u4E0B\u4E00\u6B65\uFF1A, the first: send the user the address now; \u63D0\u793A\uFF1A the hand-in), and last starts the one Gallery
391
+ server (or uses the one running: it runs on after this command), opens the default browser at the
392
+ document and prints the address to give the user, as gallery open does. In a workspace other than the
393
+ default one, the document also joins the default workspace's sidebar (when there is one), in its
394
+ workspace's column: a line says where, \u9ED8\u8BA4\u5DE5\u4F5C\u533A\uFF08\u2026\uFF09\u7684\u4FA7\u8FB9\u680F\uFF1A\u5DF2\u52A0\u8FDB\u2026; it is a display only, the file stays in
395
+ its own workspace. --no-preview (or
396
+ GALLERY_NO_PREVIEW=1) leaves the server alone; --no-browser (or GALLERY_NO_BROWSER=1) opens no
397
+ browser. Editing needs Chrome or Edge.
398
+ A title or a description that starts with "-" and a letter would be read as an option: put "--"
399
+ before the arguments (gallery new q3-review -- "-Q3 \u56DE\u987E").
400
+ Exits 1 when the document exists, or the slug is the workspace's own (exports, the \u5199\u4F5C\u504F\u597D page's) or
401
+ a document's in the trash, or a document --under or --after names is not there (nothing made), or
402
+ the new one could not be placed (made, at the top level); 2 for a document named that is in the trash.`,import:`Usage: gallery import <file> [<slug> ["<title>"]] [--no-preview] [--no-browser]
403
+ New documents made of a file, as the workbench's \u5BFC\u5165 makes them: Markdown (.md .markdown .mdx .txt
404
+ .text), HTML (.html .htm .xhtml, a Gallery export too), a table (.csv .tsv), Word (.docx), PDF (.pdf,
405
+ its text), EPUB (.epub) or a .zip of them (a Notion export: one document a page, nested as there).
406
+ The first document's title is the argument's, else the file's (front matter, first heading, name);
407
+ its slug the argument's, else made of the title's Latin words (lowercase kebab-case, a number added
408
+ when it is taken, as gallery new would refuse it). The pictures a Markdown file links to by relative addresses are copied into
409
+ <slug>/assets/. Then says what it made, what it could not bring as the file has it (by line), the
410
+ text the preview leaves read-only, the workspace, \u5199\u4F5C\u504F\u597D, the next steps (the first: send the user
411
+ the address now), and last, as gallery new does, the browser opened at the first document and the
412
+ server's address to give the user (--no-preview, or GALLERY_NO_PREVIEW=1, leaves the server alone;
413
+ --no-browser, or GALLERY_NO_BROWSER=1, opens no browser).
414
+ Put "--" before a title that starts with "-" and a letter.
415
+ Exits 1 when the file is not there, cannot be read, or gallery new would refuse the slug; 2 for a
416
+ kind it does not take.`,open:`Usage: gallery open [<slug>] [--no-browser] [--present] [--settings extensions]
417
+ Starts this workspace's Gallery server (or uses the one running: it runs on after this command, its
418
+ log in <data>/logs/server.log), waits until it answers, and opens the default browser
419
+ at the workbench, or at the document <slug>, at its block when an address names one (--no-browser,
420
+ or GALLERY_NO_BROWSER=1, opens none).
421
+ --settings extensions opens the extension list in Settings.
422
+ --present (with a document) opens the document in the workbench's \u6F14\u793A\u89C6\u56FE (full-screen show, no editor): the address
423
+ to give the user is the workbench's with ?present before the #; the workbench shows the document that way once it has
424
+ opened it, and takes ?present off the address (a browser goes full screen only on the reader's own click, so the show
425
+ fills the window instead). The Agent's own page and the other lines are the same.
426
+ ${o}
427
+ Prints the workspace, a line on the server only when there is news (it started now, an older one
428
+ was replaced, or it is on another port than the last command found it on: an address given before
429
+ no longer works), the document's page alone (the Agent's own, with a slug) and last
430
+ the address to give the user. With a slug in a workspace other than the default one, a line before
431
+ them says the document joined the default workspace's sidebar (as gallery new's does). Editing needs Chrome or Edge: open the address there.
432
+ With a slug and no qa baseline yet, it first keeps one of the document as it is now, so that the
433
+ first gallery qa after the changes pictures what changed.
434
+ Exits 1 when there is no such document, no server answers, or the shared Gallery server takes the
435
+ request and gives no answer (a second server is never started beside it); 2 for --present without a document or
436
+ with --settings.`,serve:`Usage: gallery serve [--port <n>]
437
+ Runs the shared Gallery server in the foreground until Ctrl+C (gallery open runs one in the
438
+ background instead). Prints the address once it answers. --port picks the port (else the last one
439
+ this Gallery data directory used, else the first free one from 8080).
440
+ Exits 1 when this shared server runs already (its address said) or the port is taken.`,stop:`Usage: gallery stop
441
+ Stops this workspace's Gallery server, the one gallery open or gallery new started: it finishes the
442
+ saves in its queue first. A server npm run dev runs (Gallery's own development) is stopped where it runs.
443
+ Exits 0 when it stopped or none runs, 1 when it could not be stopped.`,check:`Usage: gallery check [<slug>...] [--allow-failures]
444
+ Checks each named document (none named: every document of the workspace) on its own.
445
+ ${o}
446
+ Reads it as its preview shows it (natural HTML made the kit's in memory) and writes nothing: what the export will
447
+ write as the kit's markup is printed by line, and the blocks it will give an id (each at its line
448
+ when they are ten at most); first, once, what the preview wrote as the kit's markup when the reader
449
+ edited the document, and the \u6279\u6CE8 it deleted because their words are gone. Problems to act on first
450
+ ("fix") come before the others ("note").
451
+ It also holds a document to what must stay whole in it, each failure saying how to mend it: a
452
+ data-block-id that is not an id Gallery made (eight lowercase letters and digits, a letter first: only
453
+ Gallery makes one, so take the attribute off and let gallery export give the block one), an id moved
454
+ off a list item onto the paragraph in it (put it back on the <li>), and a folder of the workspace whose
455
+ doc.json says "instructions": true (that marks the \u5199\u4F5C\u504F\u597D page, which hides the folder from Gallery:
456
+ take it out; naming such a folder, or naming none, checks it). A doc.json title or icon that is not the
457
+ page's is noted with the command that changes both together (gallery set <slug> --title/--icon).
458
+ Exits 1 when a document fails, unless --allow-failures.`,export:`Usage: gallery export <slug>... [--allow-failures]
459
+ gallery export --all [--allow-failures]
460
+ gallery export <slug>... --format pdf|markdown|html [--paper A4|A3|Letter|Legal|Tabloid] [--scale <percent>]
461
+ [--no-files] [--subpages [--folders]] [--out <folder>]
462
+ Hands each named document in: its doc.html (report.html in an older document) written as its
463
+ preview shows it, natural HTML as the kit's markup and every block given an id (through the
464
+ shared Gallery server while one runs); then checks it and writes one standalone offline file per
465
+ passing document, <workspace>/exports/<slug>.html. A document the quick checks fail is not handed in.
466
+ ${o}
467
+ It says first, once, what the preview wrote when the reader edited a document and the \u6279\u6CE8 it deleted;
468
+ then the failures ("FAIL <slug>: N problems"), the exports made, the notes to act on first ("fix")
469
+ and the others ("note"), what the hand-in wrote by line, the files to re-read before editing them (\u91CD\u8BFB\uFF1A),
470
+ and last, for each document exported, \u4EA4\u7ED9\u7528\u6237\uFF08\u79BB\u7EBF\u6587\u4EF6\uFF09\uFF1A and the export's absolute path.
471
+ Exits 1 when a document fails, unless --allow-failures.
472
+ --format makes the file the workbench's \u5BFC\u51FA dialog makes, by the same function, with the dialog's options:
473
+ --format pdf|markdown|html the page as a PDF (Chrome or Edge prints it), as Notion-style Markdown, or as the
474
+ offline file (--format html alone, with its files, is the export above)
475
+ --paper, --scale a PDF's paper (A4, the default, A3, Letter, Legal, Tabloid) and scale, a percentage
476
+ above 10 and below 200 (100, the default); for --format pdf only
477
+ --no-files the document's pictures and files left out (the dialog's \u6587\u4EF6\u548C\u56FE\u7247\u9664\u5916; their links stay)
478
+ --subpages [--folders] the documents under it in the sidebar's tree too, each its own file (\u5305\u542B\u5B50\u9875\u9762), each page's
479
+ subpages in a folder named as it with --folders (\u4E3A\u5B50\u9875\u9762\u521B\u5EFA\u6587\u4EF6\u5939; else all at the top)
480
+ --out <folder> the folder to write in (made when it is not there) instead of <workspace>/exports/
481
+ With --format the file is written as the workbench's \u5BFC\u51FA writes it, whatever the checks find: each document (and,
482
+ with --subpages, each under it) is handed in and checked first, and what fails is said after the failures as
483
+ \u95EE\u9898\uFF1A<slug> \u6CA1\u901A\u8FC7\u68C0\u67E5\u2026 with its lines, exit 0 (mend it, gallery check says it again, and export again); only an
484
+ export that cannot be made fails (exit 1). One file is written as it is, named by the slug:
485
+ <slug>.md, <slug>.pdf, <slug>.html; a Markdown page that links pictures or files, a chart's picture, or subpages make
486
+ <slug>.zip, as the dialog downloads one: its pages named by their titles, the pictures and files in assets/ beside
487
+ them. An html file without its files (--no-files) is <slug>-no-files.html, never the offline file's name. A PDF needs
488
+ Chrome or Edge (GALLERY_BROWSER names one). Without --format, --no-files, --subpages, --folders and --out imply
489
+ --format html.
490
+ Prints, after the failures and notes, each file made ("Exported <absolute path> (<bytes> bytes)", a zip's files
491
+ listed), the hand-in's lines, and last \u4EA4\u7ED9\u7528\u6237\uFF08PDF\uFF09\uFF1A, \uFF08Markdown\uFF09\uFF1A, \uFF08Markdown \u538B\u7F29\u5305\uFF09\uFF1A, \uFF08\u79BB\u7EBF\u6587\u4EF6\uFF09\uFF1A or
492
+ \uFF08\u79BB\u7EBF\u6587\u4EF6\uFF0C\u4E0D\u542B\u6587\u4EF6\u548C\u56FE\u7247\uFF09\uFF1A with the file's absolute path, for each document.
493
+ Exits 1 when a document fails, unless --allow-failures; 2 for options that do not go together (--paper without
494
+ --format pdf, --folders without --subpages) or a value it does not take.`,qa:`Usage: gallery qa <slug>... [--tiles] [--blocks <id,\u2026>] [--no-export]
495
+ gallery qa --all [--tiles] [--no-export]
496
+ Looks at each named document's export (<workspace>/exports/<slug>.html; one with none yet, or one not
497
+ made from its doc.html and its custom blocks as they are now, is exported first, as gallery
498
+ export does, unless --no-export) as a reader's browser shows it: Chrome or Edge, headless, at 1024, 736 and 360px wide
499
+ and in a laptop's 1024\xD7768 window, every disclosure open, each Sheet and detail card shown in turn.
500
+ ${o}
501
+ Each finding is said with its place in the document's file (doc.html:<line>, report.html:<line> in
502
+ an older document): fail (errors, broken pictures, charts that drew nothing, the page wider than the
503
+ window\u2026), warn (columns or rows out of sight, overlapping text\u2026), info, unverified (no browser, a
504
+ wait that ran out\u2026). It takes every picture it needs in this one run, and leaves no second run to
505
+ make: the flagged elements; every block changed or moved since the last look (a moved one with the
506
+ edges of the blocks around it; a block held by one of them that its picture did not show at a width,
507
+ pictured on its own there); the cards not changed yet not pictured before (all of them the first time,
508
+ and when nothing changed: the twelve a run pictures at most, changed blocks among them; the rest need no
509
+ look, and stay for a later run); --tiles: the page in tiles; --blocks <id,\u2026> (one document only; the ids
510
+ split at commas or spaces, and one the document has not refused before anything is looked at): the
511
+ blocks named. Each run's pictures go to a folder of their own,
512
+ <workspace>/.gallery/qa/<slug>/<the run's time>/ (2026-11-11_14-02-33; flagged/, changed/, cards/,
513
+ blocks/, tiles/ in it), and qa keeps the last 5 runs of each document and takes the earlier ones away as a
514
+ run ends, so nothing needs remembering of what is emptied. First, once, as gallery check says them, what the
515
+ preview wrote when the reader edited the document and the \u6279\u6CE8 it deleted. Then the findings, each look's
516
+ counts, and (a --blocks run) the changed blocks and cards it did not picture, which a plain run does. The
517
+ pictures are named once, last before the verdict, in ONE list: \u8981\u770B\u7684\u56FE\uFF08N \u5F20\uFF09 with each picture to open
518
+ numbered, in the order to open them (the flagged elements first, then the blocks changed, the cards, the
519
+ tiles), by its whole path with its looks in braces and what it is; then \u4E0D\u7528\u770B\uFF1A, what needs no look (the
520
+ cards past the twelve, INFO notes, blocks hidden from readers); then the verdict, and last, on a line of its
521
+ own, the export's absolute path after \u4EA4\u7ED9\u7528\u6237\uFF08\u79BB\u7EBF\u6587\u4EF6\uFF09\uFF1A. Open every picture listed, fix the FAILs, run it
522
+ again, and in the handoff say which you opened.
523
+ GALLERY_BROWSER=<executable> picks the browser. A browser that does not start is tried once more
524
+ with a fresh profile.
525
+ Exit codes: 0 nothing failed (a warning never fails); 1 something failed (or the export it ran first did);
526
+ 2 an export is missing or stale with --no-export, or --blocks names an id the document has not; 3 nothing
527
+ could be looked at at all (UNVERIFIED <why>: no Chrome or Edge, or one that did not start); 4 the pages
528
+ were looked at and some places could not be verified (an UNVERIFIED line among the findings names each: a
529
+ wait that ran out, a picture not taken).`,list:`Usage: gallery list [<words>...] [--json]
530
+ gallery list --tree [<document>] [--json]
531
+ gallery list [<words>...] --all [--json]
532
+ The workspace's documents, for an Agent to find the one the user means: each one's slug and title,
533
+ its description, where it is in the sidebar's tree when it is under another (\u4F4D\u7F6E\uFF1Athe documents above
534
+ it, from the top), its address (\u5730\u5740\uFF1A/#<link>, after the port of the shared Gallery server), when its file
535
+ was last written and where that file is, the one edited last first.
536
+ With words, only those whose title, description or slug holds any of them (case alike, Chinese found
537
+ inside words), the best first, then those whose text holds them, each with its first place there
538
+ (\u6B63\u6587\uFF1A\u2026); with a document's link or whole address, that document, or that it is in the trash.
539
+ When exactly one document is found by those words, the last line is the address to give the user (\u4EA4\u7ED9\u7528\u6237\uFF08\u2026\uFF09\uFF1A
540
+ and the workbench's whole address, while a server runs; else a \u63D0\u793A line saying none runs and how to start it).
541
+ --tree lists them as the sidebar shows them, in its order, each under the one it is under, indented
542
+ two spaces a level: a line each, its slug, its title (its emoji before it), its description and its
543
+ last edit. --tree <document>: that document and the documents under it, after its \u4F4D\u7F6E line.
544
+ The sidebar's web links (gallery link) are listed too, each with \u7F51\u9875\u94FE\u63A5\uFF1Aits address: after the
545
+ documents (with words, those whose name, address or slug holds one), and in their place in --tree.
546
+ With columns besides the own one (the sidebar's \u680F: each other registered workspace has one, with its
547
+ documents; \u9ED8\u8BA4\u6587\u6863 is the default workspace's), --tree lists them column by column, each under its name
548
+ (one removed from the sidebar is left out), and \u4F4D\u7F6E starts with the column's (\u4F4D\u7F6E\uFF1A\u56E2\u961F\u680F \u203A \u2026) for an
549
+ entry outside the own column; a document outside its own column says that column (\u300C\u9ED8\u8BA4\u6587\u6863\u300D\u7684\u6587\u6863).
550
+ ${o}
551
+ First, the workspace and where \u5199\u4F5C\u504F\u597D is (made from Gallery's default when there is none yet).
552
+ --all searches every workspace of this machine (gallery workspaces lists them, the current one
553
+ always among them) by the title, description and slug of each document (not its text), the best
554
+ first (no words: all, the one edited last first), each after the line \u5DE5\u4F5C\u533A\uFF1A<path> of its
555
+ workspace, which --workspace takes to work on it there; it only reads: nothing is written in any of
556
+ them, and \u5199\u4F5C\u504F\u597D is not made. A workspace no longer there is named at the end, not searched.
557
+ --json prints one object instead (an Agent reads it, not the text; fields are only ever added to):
558
+ { "workspace": path, "documents": [{ "slug", "title", "icon" (or null), "description", "link" (the
559
+ words and page id of its address), "address" (/#<link>), "path" (its doc.html), "parent" (the slug
560
+ it is under, or null), "column" (its sidebar column's name), "columnId", "favorite" (true when the
561
+ sidebar's \u6536\u85CF holds it), "look" (the font and layout of its own: doc.json's look, { "font": "serif" },
562
+ none left out when it follows the workspace), "edited" (ISO time), "hit" (with words: the first place
563
+ its text holds them) }], "links": [{ "slug", "title", "url", "icon", "parent", "column", "columnId",
564
+ "favorite" }] }. --tree: the same in the sidebar's order, each with its "depth", and "drafts" (the
565
+ other workspaces' documents the sidebar holds: "entry", "title", "workspace", "path", "missing",
566
+ "parent", "column", "favorite", "depth"). --all: each document with its "workspace" and the
567
+ "workspaces" searched. The trash is never in it (gallery trash list --json).
568
+ Exits 1 when --tree names a document that is not there, 2 one in the trash.`,workspaces:`Usage: gallery workspaces [--json]
569
+ gallery workspaces --scan [<folder>]
570
+ gallery workspaces --name "<name>"
571
+ gallery workspaces --forget <path>
572
+ gallery workspaces --show <path or id> [--doc <slug>] [--register]
573
+ gallery workspaces --hide <path or id> [--doc <slug>]
574
+ The workspaces of this machine: every workspace a gallery command or a Gallery server has worked in
575
+ is registered in a file of the user's (GALLERY_DATA_DIR,
576
+ else %LOCALAPPDATA%\\gallery\\workspaces.json on Windows, ~/Library/Application Support/gallery on macOS,
577
+ $XDG_STATE_HOME/gallery or ~/.local/state/gallery elsewhere). Lists them, the current one first (*),
578
+ then the one edited last first: each one's name (its gallery.json's, else its folder's; the folder
579
+ above it, or its own path, after the name when two are called alike), its id (ws- and six hex
580
+ digits), its path (\u8DEF\u5F84\uFF1A), how many documents it has and when one was last edited (\u6587\u6863\uFF1A), and its
581
+ one shared service address printed above the list (\u670D\u52A1\uFF1A); one whose folder or gallery.json is gone is marked \u4E0D\u5728\u4E86
582
+ and stays registered (a drive may come back).
583
+ --scan registers the workspaces in <folder> and below it, 6 levels down at most (not in node_modules,
584
+ .git, a dot folder or the recycle bin): the Documents folder when none is named. --name names the
585
+ current workspace (gallery.json's name, the workspace made first when it is not there). --forget
586
+ takes a workspace off the registry, named by its path or its id; nothing on disk changes (a command
587
+ run in it registers it again). Nothing else is written, and no file of a workspace is ever removed.
588
+ gallery list <words> --all searches the documents of every one.
589
+ --json prints the list as one object (fields only ever added to): { "current": path, "service": { "port",
590
+ "pid", "address" } or null, "workspaces": [{ "id", "name", "path", "current", "default", "named" (it has a
591
+ name of its own), "exists", "documents" (count), "lastEdited" (ISO time or null) }] }.
592
+ --show is the sidebar's \u6DFB\u52A0\u5176\u4ED6 Gallery \u9879\u76EE\u2026: the workspace named by its folder or its id, whole, as a
593
+ column of the sidebar (its folder is registered now when it is a workspace not yet on the registry;
594
+ a folder that holds Gallery documents but is no workspace is made one only with --register); with --doc
595
+ <slug> that one document of it (and those under it). --hide is \u4ECE\u4FA7\u8FB9\u680F\u79FB\u9664: the workspace's column hidden
596
+ (its workspace, files and registry untouched: what --forget is not), or with --doc <slug> that one
597
+ document taken out of the tree (\u4ECE\u6587\u6863\u6811\u79FB\u9664; the document is not touched). Both are written as the
598
+ sidebar's menu writes them, through the running server when there is one. This Gallery's sidebar lists
599
+ every registered workspace and does not read those hidden marks: --hide then says so (\u63D0\u793A\uFF1A), exits 1
600
+ and names --forget as the way to take a workspace off every sidebar.
601
+ Exits 1 when --scan names no folder, --forget no registered workspace, --show or --hide a workspace or
602
+ document that is not there, or the name cannot be written; 2 for a name that is empty, over 80
603
+ characters or more than one line, and for two of --scan, --name, --forget, --show and --hide at once.`,move:`Usage: gallery move <document> (--under <document> | --top | --column "<column>") [--after <document> | --first]
604
+ Moves a document in the sidebar's tree, with the documents under it: under --under's document, to the
605
+ top level (--top), the top level of a sidebar column (--column "<column>", a column of this workspace's),
606
+ or where it is now (none of them); right after --after's document (one at that level, whose level it is
607
+ when none of them says one), first (--first), else last. Written
608
+ through the workspace's running server when there is one (an open workbench shows it at once), else
609
+ here. Nothing in the documents' files changes: links between documents go by their folders, which
610
+ stay where they are.
611
+ ${o}
612
+ Prints where it went and where it was, then its place (\u4F4D\u7F6E\uFF1A\u2026, as gallery list says it).
613
+ Exits 0 when it moved or is there already; 1 when a document named is not there or is the \u5199\u4F5C\u504F\u597D page
614
+ (listed apart: it moves nowhere and holds none), when the place is under itself or a document under
615
+ it, or --after names one at another level, or --column names no column of this workspace's; 2 for a
616
+ document in the trash.`,set:`Usage: gallery set <document> [--title "<title>"] [--icon <icon>|none] [--description "<text>"]
617
+ [--font sans|serif|mixed] [--size small|default|large] [--spacing compact|default|loose]
618
+ [--width narrow|default|wide] [--full on|off] [--all]
619
+ Changes a document's title, page icon, description or look as the workbench's \u91CD\u547D\u540D, the page's icon
620
+ picker and its \u5B57\u4F53\u4E0E\u5E03\u5C40 menu do: the title in doc.html (the h1 of its header, and <title> where that holds the h1's words,
621
+ else the whole of it) and in doc.json; the icon in the header (div.doc-icon before the h1: made,
622
+ changed, or taken away with none) and in doc.json; the description in doc.json. An icon is an emoji,
623
+ an icon of the \u56FE\u6807 tab (/icons/<name>_<color>.svg, Tabler's /icons/tabler/<name>_<color>.svg, the
624
+ colors gray, lightgray, brown, yellow, orange, green, blue, purple, pink, red), a picture of the
625
+ document's folder (assets/<file>) or the name of a custom emoji of the workspace (\u81EA\u5B9A\u4E49\u8868\u60C5, gallery emoji
626
+ list; :name: too), whose image is copied into the document's assets/ as the icon picker copies it.
627
+ doc.html is written as an Agent writes it, the rest of it as it
628
+ is: the page open in the browser shows it, and the workbench's sidebar the new title and icon.
629
+ A title that starts with "-" and a letter is written --title="-Q3 \u56DE\u987E".
630
+ --font (\u7B49\u7EBF\u4F53 sans, \u886C\u7EBF\u4F53 serif, \u6DF7\u5408\u4F53 mixed: the title and headings serif), --size (\u5B57\u4F53\u5927\u5C0F), --spacing (\u6B63\u6587\u95F4\u8DDD),
631
+ --width (\u6B63\u6587\u5BBD\u5EA6) and --full on|off (\u5168\u5BBD: the page at the full width of its area) set the look the document
632
+ shows, in the look of its doc.json, as the \u5B57\u4F53\u4E0E\u5E03\u5C40 menu does, and the page open in the browser changes at
633
+ once (the command goes through the shared Gallery server while one runs). Only the choices named are written: the
634
+ document's other choices of its own stay, and a choice that is the default (--font sans) is a choice all the same,
635
+ kept in doc.json against the user's default look. --all (\u5E94\u7528\u5230\u5168\u90E8\u6587\u6863) makes the look the document shows (these
636
+ choices included; alone it applies the look it has now) the default look of every document, kept with the
637
+ user's settings, no document's file: the documents with choices of their own keep them.
638
+ ${o}
639
+ Prints what changed, then the files to re-read before editing them (\u91CD\u8BFB\uFF1A; doc.json when the look changed).
640
+ Exits 1 when the document is not there or is the \u5199\u4F5C\u504F\u597D page, its page has no h1.doc-title, its
641
+ doc.json does not read, or the picture is not in its folder; 2 for an icon that is none of these or a look value
642
+ that is not one of the choices.`,link:`Usage: gallery link add <url> "<name>" [--column "<column>"] [--under <entry>] [--after <entry> | --first] [--icon <emoji>]
643
+ gallery link set <link> [--url <url>] [--title "<name>"] [--icon <icon>|none]
644
+ gallery link remove <link>
645
+ A web link of the sidebar: a page of the web (http or https) the workbench shows beside the sidebar,
646
+ in a frame (a site that refuses frames is offered \u5728\u6D4F\u89C8\u5668\u4E2D\u6253\u5F00), in the tree with the documents. It is
647
+ a folder <workspace>/<slug>/link.json (no document: nothing checks, exports or searches it), its slug
648
+ made of the name's Latin words, else the site's name. A link is named by its slug or its link (what the
649
+ workbench's address holds after #).
650
+ add puts it first in the own column (the workspace's own documents'; as the sidebar's \u6DFB\u52A0\u5728\u7EBF\u7F51\u9875\u2026
651
+ puts one first in its column); --column first in the column of that name (as the sidebar calls it, or
652
+ one the user named), --under last under an entry (a document or a link), --after right after one.
653
+ Prints where it went (\u4F4D\u7F6E\uFF1A\u2026, as gallery list says it). The site's own icon (its page's <link rel=icon>,
654
+ else /favicon.ico; 16 KB at most) is fetched once and kept in link.json, shown when no --icon is given.
655
+ An address of this workspace's own server (its host and port) is refused: link the document instead.
656
+ set changes its address, its name or its icon (an emoji or an icon of the \u56FE\u6807 tab; none takes it away).
657
+ remove moves it to the trash, which the workbench's \u8BBE\u7F6E \u203A \u56DE\u6536\u533A restores it from, where it was.
658
+ Each is written through the workspace's running server when there is one (an open workbench shows it
659
+ at once), else here.
660
+ Exits 1 when a link, a column or an entry named is not there or the server refuses it; 2 for an
661
+ address that is not http or https, an empty name, or two places at once.`,extension:`Usage: gallery extension new <id> "<name>" [--ui] [--server]
662
+ gallery extension list [--json]
663
+ gallery extension check <id> [--shot <file>] [--press <button>]
664
+ gallery extension install <folder | .zip> [--enable]
665
+ gallery extension enable <id>
666
+ gallery extension disable <id>
667
+ gallery extension remove <id>
668
+ Extensions live in <home>/extensions/<id>/ and are shared across workspaces.
669
+ A sidebar.json supplies a column of links. An extension.json declares workbench script/style,
670
+ backend server.command, icon and Agent instructions. Either or both may be present.
671
+ new without flags creates sidebar.json. --ui and/or --server create a program template,
672
+ version 0.1.0, AGENT.md, activate/dispose UI and/or a Node HTTP backend with GET /health; with both,
673
+ the UI's button asks the backend's GET /hello through Gallery's proxy and toasts the answer.
674
+ Edit the files, run check, then enable. check validates the manifest and every declared file,
675
+ starts an isolated sandbox copy (even if disabled), waits for the backend to listen and checks UI
676
+ errors and slot buttons in Chrome/Edge. --shot writes a screenshot. --press clicks the slot button with
677
+ that label (or text) and prints each request it makes to the backend's api/ with its status and answer,
678
+ the toasts shown and errors thrown; a failed request, an error toast or a throw fails the check.
679
+ Failures include backend exit code and the last 20 log lines, paths and script addresses given as the
680
+ extension's own files. A sidebar-only check prints its tree and notes as before.
681
+ check never enables the original extension or writes its workspace. It runs the extension's code
682
+ with the user's OS permissions, as sandbox does. Check only extensions you trust.
683
+ Install replaces extension files, preserving the enabled setting unless --enable is passed.
684
+ list prints capabilities and AGENT.md paths; --json includes backend and workbenchError status.
685
+ Changed files reload activate/dispose UI and restart a running backend; legacy scripts need a page refresh.
686
+ Exits 0 on success, 1 when validation/runtime fails, 2 for invalid arguments.
687
+ See references/extensions.md for the public UI API, manifest and sidebar.json format.`,block:h(l),page:h(d),trash:`Usage: gallery trash <entry>...
688
+ gallery trash list [--json]
689
+ gallery trash restore <item>...
690
+ gallery trash empty [<item>...]
691
+ Deletion goes through the trash: never rm a document's folder (that leaves the sidebar's tree and the
692
+ history holding it). Moves entries of the sidebar to the trash as the workbench's \u79FB\u81F3\u56DE\u6536\u533A does (its
693
+ trash command, written through the workspace's running server when there is one, so that an open
694
+ workbench shows it at once, else here): a document with its files, a custom page (gallery page list) or
695
+ a web link, each named by its slug, its link or whole address, or its whole title when only one has
696
+ it. A document keeps its place in what the trash records; the documents under it move up to where it
697
+ was, none goes with it (as in the sidebar). Prints each one with its trash id and where it was, and
698
+ that gallery trash restore puts it back.
699
+ list: what the trash holds, the one moved last first: each item's id, kind, slug, title and where it
700
+ was. --json prints one object: { "workspace": path, "items": [{ "id", "kind" ("document", "page" or
701
+ "link"), "slug", "title", "trashed" (ISO time), "at" (ms), "parent" (the document it was under, or
702
+ null), "column" (its column's name, or null), "place" (words), "workspace" (whose trash holds it) }] }.
703
+ A custom page lives in the default workspace, so its trash is that workspace's.
704
+ restore puts items back where they were (named by id, slug or whole title): under the same document,
705
+ else at the top level of the column, else at the top level; under the next free slug when theirs was
706
+ taken meanwhile. Prints the place (\u4F4D\u7F6E\uFF1A\u2026, as gallery list says it).
707
+ empty deletes items of the trash for good, all of it with none named: the one command of Gallery that
708
+ deletes anything and cannot be undone. Use it only when the user explicitly asks for it.
709
+ A document of another workspace (an entry ~ws-\u2026/<slug>) is trashed in its own workspace: --workspace.
710
+ Exits 1 when an entry or item named is not there, is the \u5199\u4F5C\u504F\u597D page or is another workspace's (nothing
711
+ is moved when one of them is wrong); 2 for a name that is no slug, link or address, and for a document
712
+ named that is in the trash already.`,duplicate:`Usage: gallery duplicate <document> [<new slug>] [--title "<title>"] [--no-preview] [--no-browser]
713
+ A copy of a document, as the document menu's \u521B\u5EFA\u526F\u672C makes one (its duplicate command, through the
714
+ workspace's running server when there is one, else here): the whole folder, assets included, under a
715
+ new slug (doc-<a new page id>, or <new slug>), with a new page id and none of the original's
716
+ annotations, history or review of the Agent's changes, titled the original's with \uFF08\u526F\u672C\uFF09 after it (or
717
+ --title's words as they are), right after the original in the sidebar's tree. Never copy the folder
718
+ yourself: that copies its block ids, annotations and history too.
719
+ ${o}
720
+ Prints where the copy is (\u4F4D\u7F6E\uFF1A\u2026) and its file, then ends as gallery new does: the next step (\u4E0B\u4E00\u6B65\uFF1A
721
+ send the user the address now), the one Gallery server found or started (--no-preview leaves it alone),
722
+ the default browser opened there (--no-browser opens none), and last the address to give the user
723
+ (\u4EA4\u7ED9\u7528\u6237\u2026\uFF1A).
724
+ Exits 1 when the document is not there, is a web link or the \u5199\u4F5C\u504F\u597D page, or the new slug is taken
725
+ (nothing is copied); 2 for a slug that is not lowercase kebab-case or is a name the workspace keeps, an
726
+ empty title, and a document in the trash.`,copy:`Usage: gallery copy <document> --to <workspace> [--under <document>]
727
+ Copies a document, with the documents under it, to another workspace, as the sidebar's drag into
728
+ another workspace's column does once it is confirmed (\u590D\u5236\u5230\u53E6\u4E00\u4E2A\u5DE5\u4F5C\u533A\uFF1F): new documents there (new
729
+ slugs and page ids, their files, assets and metadata), the originals and their history staying where
730
+ they are. <workspace> is a registered workspace's ws- id or its folder (gallery workspaces lists
731
+ them; a folder that is a workspace is registered now). The copy goes last at the top level of that
732
+ workspace, or last under --under's document there (a slug or link of that workspace). Made by the
733
+ receiving workspace's own copy-from command, through the machine's running server when there is one,
734
+ else here.
735
+ ${o}
736
+ Prints what was copied and where, the copy's file and, as the next step (\u4E0B\u4E00\u6B65\uFF1A), how to work on the
737
+ copy: every command takes --workspace <its folder>.
738
+ Exits 1 when the document is not there, is a web link or the \u5199\u4F5C\u504F\u597D page, is in that workspace
739
+ already, or --to names no workspace or --under no document there (nothing is copied); 2 for a document
740
+ in the trash.`,favorite:`Usage: gallery favorite <entry> [--off]
741
+ Puts an entry of the sidebar (a document or a web link, named by its slug, link or whole address, or
742
+ its whole title when only one has it) in its \u6536\u85CF section, or takes it out with --off, as the entry's
743
+ menu does. The list is kept in the outline file (.gallery/outline.json, beside the tree), by the
744
+ workspace's own favorite command (through the running server when there is one), and the workbench's
745
+ browsers show it besides the favorites each keeps itself; gallery list --json says "favorite" for
746
+ each entry. Says what changed, or that nothing needed to.
747
+ Exits 1 when the entry is not there or is a custom page (which has no \u6536\u85CF); 2 for a document in the
748
+ trash.`,column:`Usage: gallery column new "<column>"
749
+ gallery column rename "<column>" "<new name>"
750
+ gallery column remove "<column>"
751
+ The sidebar's columns (\u680F), made, renamed and removed as the column's menu (\u65B0\u5EFA\u680F, \u91CD\u547D\u540D, \u4ECE\u4FA7\u8FB9\u680F\u79FB\u9664) does,
752
+ written through the workspace's running server when there is one (an open workbench shows it at once),
753
+ else here. A column is named by its name as the sidebar shows it (case alike) or its id (gallery list
754
+ --tree shows them). new makes one last in the sidebar (nothing when a column of that name is there
755
+ already). rename changes a column's name. remove deletes a column the user made, the entries in it with
756
+ those under them going last to the workspace's own column, no file deleted; a workspace's column is
757
+ hidden instead (gallery workspaces --hide); the own column (\u9ED8\u8BA4\u6587\u6863 in the default workspace) and an
758
+ extension's column are never removed. gallery new and gallery move take --column "<column>" to put a
759
+ document in one. Prints what changed and the columns now.
760
+ Exits 1 when a column is not there, is the own column or an extension's, or the outline cannot be
761
+ written; 2 for an empty name.`,notes:`Usage: gallery notes <document> [--json]
762
+ gallery notes done <document> <id>... [--undo] [--json]
763
+ gallery notes remove <document> <id>... | --done | --all [--json]
764
+ The reader's \u6279\u6CE8 (annotations) of a document: suggestions for you, each about words of the document or
765
+ blocks of it, kept in <document>/annotations.json (never edit that file: these commands are the way).
766
+ A document is named by its slug, its link or its address, as for every command of documents.
767
+ gallery notes <document> lists them in page order: each one's id, the blocks it is about (their
768
+ data-block-id; "whole" when it is the blocks themselves), where it is (the headings above it), the words
769
+ it is about (quote), the suggestion (text), and whether it is done. Act on the suggestion in the file by the
770
+ block ids, then mark it: that is how the reader sees what you have dealt with.
771
+ gallery notes done <document> <id>... marks them as acted on: on the page their cards go grey, and the
772
+ reader can delete all the done ones at once (the menu of the \u6279\u6CE8 button: \u5220\u9664\u5DF2\u5904\u7406). \u590D\u5236\u6279\u6CE8 leaves them
773
+ out. --undo takes the mark off. A suggestion the reader rewrites afterwards is a new one: no longer done.
774
+ gallery notes remove deletes: the ids named, every one marked done (--done), or all of the document's
775
+ (--all, as \u5168\u90E8\u5220\u9664 does). Only when the reader asks you to; marking done is the default way to finish
776
+ with one. A removal can be taken back: with the page open the reader sees \u5DF2\u5220\u9664 N \u6761\u6279\u6CE8 with \u64A4\u9500 (a few
777
+ seconds); with no page open it cannot be undone, so say what you removed.
778
+ Each is written through the workspace's running server when there is one (an open page shows it at once:
779
+ the edit service's route, in the queue the page's saves go through), else here, by the same code, on the
780
+ file as it is (nothing is checked against the document, so nothing is deleted or reordered by it).
781
+ Every id named must exist, else nothing changes. --json prints one object, then adds fields, never
782
+ changes them: for the list { "document": <slug>, "title", "file": <the document's path>, "notes": [ { "id",
783
+ "text", "quote", "blocks": [data-block-id...], "whole": <the blocks themselves>, "where": [<headings>],
784
+ "done", "created", "updated" } ] }; for done { "document", "done": [ids] } (or "undone"); for remove
785
+ { "document", "removed": [ { "id", "text", "quote", "done" } ] }.
786
+ Exits 1 when the document or an id is not there or the server refuses; 2 for a command line that is
787
+ wrong (no ids, two ways to remove at once).`,status:`Usage: gallery status [--json]
788
+ What the reader has open in the browser, from the running server: every document and custom page open in
789
+ a tab of the workbench, the one used last first. Use it when the reader says "this document", "this
790
+ paragraph", "here" without naming it: the first one is that, at the selection (else at the caret). It
791
+ only asks: it starts no server and makes no workspace. With none running it says so (exit 0).
792
+ For each: its slug and title, its file (the one to edit), whether the tab is shown and the window has the
793
+ focus, how long ago the reader last did something there, where saving stands (\u5DF2\u4FDD\u5B58, \u6709\u4FEE\u6539\u8FD8\u6CA1\u4FDD\u5B58, \u6709\u51B2\u7A81,
794
+ or \u6CA1\u8FDE\u4E0A\u670D\u52A1), how many \u6279\u6CE8 it has, the caret's block (its data-block-id, null for a block the file has
795
+ no id for yet, and its words) or the words and blocks selected (200 characters at most), as the file
796
+ names them. \u95EE\u9898\uFF1A lines name an open document that is not saved (changes waiting, or a conflict): ask the
797
+ reader to settle it on the page first, then change the file, or he gets a conflict card for your write.
798
+ The tabs report to the server every 20 seconds and when something changes; a tab that closed is gone at
799
+ once, one that stopped reporting after 90 seconds. Everything stays in the server's memory, on this
800
+ computer (the selected words need the server's token to read).
801
+ --json prints one object, then adds fields, never changes them: { "running": false, "open": [] } when no
802
+ server runs, else { "running": true, "port", "open": [ { "tab", "kind": "document" | "page", "slug",
803
+ "title", "file", "workspace", "visible", "focused", "idle": <seconds>, "save": "saved" | "pending" |
804
+ "conflict" | "offline", "conflicts": <number>, "notes": <number of \u6279\u6CE8>, "caret": { "block", "text" } |
805
+ null, "selection": { "kind": "text" | "blocks", "blocks": [data-block-id...], "text", "truncated",
806
+ "length" } | null } ], "last": <the first of open, or null> }. A page of another workspace has
807
+ "~ws-<id>/<slug>" for its slug (its "file" is where it is).
808
+ Exits 0; 1 when the server does not answer.`,history:`Usage: gallery history <document> [--json]
809
+ gallery history <document> --restore <version> [--json]
810
+ A document's recent versions, as the workbench's \u5386\u53F2\u7248\u672C lists them (the document's \xB7\xB7\xB7 menu): Gallery
811
+ keeps the file as it was before and after each of its own writes (the user's edits on the page, a
812
+ revert, a restore, an export's block ids, a rename) and as each write of anyone else's left it (the
813
+ Agent's Write or Edit, a write while no server ran, which the next server keeps as it starts), the last
814
+ 30 of them and the last of each hour before those, 80 at most, in <workspace>/.gallery/state/history/.
815
+ Lists them, the newest first: its version (the first 8 characters, what --restore takes), when it was
816
+ kept (local time), who made it (\u7528\u6237: the user's edit on the page, \u64A4\u56DE, \u6062\u590D in the workbench; Agent: a
817
+ write of the file, a command of an Agent's, a page opened with ?agent; \u672A\u77E5: the first one kept, and one
818
+ kept before Gallery said who), what made it, and what it changed of the one before it: how many blocks
819
+ it added, changed and deleted, and the first of those blocks with their kind, data-block-id and first
820
+ words. The one the file holds now says \uFF08\u73B0\u5728\u7684\u6837\u5B50\uFF09.
821
+ --restore writes that version as the file (a version is named by those 8 characters, 6 at least, or its
822
+ whole id or version), through the workspace's running server when there is one (its queue: an open page
823
+ shows it at once; a page with edits not saved yet keeps them), else here: what the file was is kept as a
824
+ version first, so a restore is taken back by restoring that one (said on the \u63D0\u793A line); doc.json's
825
+ title and icon follow the page's. The restore is the Agent's write: the page marks what it changed as
826
+ the Agent's changes, for the user to keep or revert (gallery revert takes it back too). Prints the
827
+ blocks it took back of the file (\u53BB\u6389\u4E86 what the version has not, \u6539\u56DE\u4E86, \u653E\u56DE\u4E86 what the file had not),
828
+ then the files to re-read (\u91CD\u8BFB\uFF1A\u2026).
829
+ ${o}
830
+ --json: one object. The list: { "document": { "slug", "title", "file" }, "current" (the file's version
831
+ now), "versions": [ { "id", "version" (16 hex), "short", "time" (ISO), "by" ("user", "agent" or null),
832
+ "kind" ("commit", "write", "revert", "undo", "restore", "hand-in", "rename", or null), "from" (a restore's:
833
+ the id restored), "current" (true for the newest, when the file holds it), "counts" ({ "added",
834
+ "changed", "removed" }, null for the first), "blocks" ([{ "change" ("added", "changed", "removed"),
835
+ "kind", "name", "tag", "id" (data-block-id; null for none and for one deleted), "text", "title" }], 8 at
836
+ most), "more" (how many blocks besides) } ] }, the newest first. With --restore: { "document",
837
+ "restored" (the id restored), "same" (the file said it already: nothing written), "kept" (the id of the
838
+ version that holds what the file was), "id" (the version it made), "counts", "blocks" } (40 blocks at most).
839
+ Exits 1 when the document is not there, no version has that name or several do (the \u95EE\u9898 line names
840
+ them), or the file kept changing (an Agent writing it: nothing written); 2 for a mistake in the command line.`,revert:`Usage: gallery revert <document>
841
+ Takes back the Agent's changes since the user last kept (\u786E\u8BA4) or reverted them, as the page's
842
+ \u300C\u64A4\u56DE\u300D does (the bar at the page's bottom): the document as the user had it before the Agent's first
843
+ write since, with the user's own edits saved meanwhile kept in it; doc.json's title and icon follow the
844
+ page's. Through the workspace's running server when there is one (its queue: an open page shows it at
845
+ once; a page with edits not saved yet keeps them), else here by the same code, on the same state. What
846
+ the file was is kept as a version first: gallery history <document> --restore <version> brings it back
847
+ (the \u63D0\u793A line says which); the page's own \u64A4\u9500 stays the page's, for the tab that reverted there. A
848
+ document whose first writing lasts (the Agent writing it from nothing, which the page marks nothing of:
849
+ until gallery open of it, the user's first edit, or 30 minutes with no write) has that writing taken back
850
+ the same way: the file restored to the newest version that is no write of the Agent's.
851
+ ${o}
852
+ Prints what it took back (how many writes, how many blocks), a line each block (\u53BB\u6389\u4E86\u52A0\u7684 what the
853
+ Agent added, \u6539\u56DE\u4E86 what it changed, \u653E\u56DE\u4E86\u5220\u7684 what it deleted, with its kind, data-block-id and first
854
+ words), then the files to re-read (\u91CD\u8BFB\uFF1A\u2026).
855
+ Exits 1 when there is nothing to take back (\u95EE\u9898 and \u4E0B\u4E00\u6B65 lines say so: the user kept or reverted the
856
+ Agent's changes, or no Agent wrote the document since; gallery history is the way to an older version
857
+ then), when the document is not there, or the file kept changing (an Agent writing it: nothing written);
858
+ 2 for a mistake in the command line.`,doctor:`Usage: gallery doctor [--json]
859
+ Is this machine ready for Gallery: one line each, and the one thing to do first. Run it when a command is
860
+ not found or prints \u9700\u8981\u5904\u7406\uFF1A\u2026, and do what its last line says.
861
+ Looks at: Node (22.13 or newer); this Gallery, and whether npm has a newer one (read from the small cache
862
+ gallery --version keeps, never waited for: a stale cache starts the background check, and the next run
863
+ knows); the Gallery skills installed where gallery skill install writes them (Claude Code's and Codex's
864
+ homes, and this folder's .claude/ and .codex/), older or newer than this gallery; whether the workspace
865
+ can be written (when it is not made yet, the folder it would be made in; another program's gallery.json
866
+ is a problem); a Chrome or Edge to look at pages with (GALLERY_BROWSER=<executable> picks one).
867
+ Each line starts \u597D (nothing to do), \u95EE\u9898 (something to do) or \u63D0\u793A (worth knowing, nothing to do). The last
868
+ line is \u4E0B\u4E00\u6B65\uFF1A, the one thing to do first, by this order: Node, the workspace, the skill, a newer Gallery
869
+ (ask the user first: it changes their machine), the browser; when nothing is a \u95EE\u9898 it says \u4E00\u5207\u6B63\u5E38\u3002
870
+ It makes no workspace and changes nothing (it writes a file into the workspace's folder to know that it can,
871
+ and takes it away).
872
+ --json: one object { "ok": whether nothing is a problem, "version", "workspace", "checks": [{ "id": "node",
873
+ "gallery", "skill", "workspace" or "browser"; "status": "ok", "problem" or "note"; "text"; and its own
874
+ fields: node and gallery "version" (gallery also "latest": the newest npm is known to have, or null), node
875
+ "required"; skill "installed": [{ "folder", "project", "version", "older" }]; workspace "path", "exists",
876
+ "writable"; browser "path" (null when none) }], "next": the one thing to do, or null }. Fields are only
877
+ ever added.
878
+ The other commands say \u9700\u8981\u5904\u7406\uFF1A\u2026 (\u8FD0\u884C gallery doctor) as their last line when a skill installed is older
879
+ than this gallery or npm has a newer one (as the cache knows it; stdout, or stderr when the command failed;
880
+ never with --json, help, --version or doctor; nothing with GALLERY_NO_UPDATE_CHECK, CI or NO_UPDATE_NOTIFIER).
881
+ Exits 0 when nothing is a problem, 1 else.`,emoji:`Usage: gallery emoji add <name> <image>
882
+ gallery emoji list [--json]
883
+ The workspace's custom emoji (\u81EA\u5B9A\u4E49\u8868\u60C5: the page icon picker's "+"; kept in <workspace>/.gallery/emoji-library/).
884
+ add puts an image in the library under <name>, as the workbench's picker does: lower-case letters, digits, - and _
885
+ (under 50 characters; white space becomes -, :name: is read as name), a name neither the library nor a standard
886
+ emoji has. The image is a PNG, JPEG, GIF, WebP, AVIF, SVG or ICO file of 2 MB at most, a path on this computer
887
+ or an http(s) address the image is downloaded from. Prints the library's file and, \u4E0B\u4E00\u6B65\uFF1A, how to use it:
888
+ gallery set <document> --icon <name> copies the image into the document's assets/ and makes it the page's icon.
889
+ list prints the emoji (name and file); --json prints one object, { "workspace": <absolute path>, "emojis": [ { "name",
890
+ "id", "file" (in the library folder), "path" (absolute), "created" (ISO time) } ] }; the fields are only ever added to.
891
+ Exits 1 when the image is not there, is not an image or is over 2 MB, the address gives none, or the name is
892
+ taken; 2 for a name it does not take.`,skill:`Usage: gallery skill install [--agent claude|codex] [--project] [--dir <path>]
893
+ Writes the Gallery skill that matches this gallery command (what an Agent reads to write documents
894
+ with it: SKILL.md, references/, sdk/) where the Agent reads skills:
895
+ Claude Code ~/.claude/skills/gallery (CLAUDE_CONFIG_DIR/skills/gallery when that is set)
896
+ Codex ~/.codex/skills/gallery (CODEX_HOME/skills/gallery when that is set)
897
+ for each of them whose folder is there (neither: Claude Code's), or the one --agent names. --project
898
+ writes it into this folder's .claude/skills/gallery (.codex/skills/gallery for Codex) instead, for
899
+ this project alone; --dir <path> writes it into <path> itself, the skill's own folder, for any other agent.
900
+ A Gallery skill there is replaced (nothing done when it holds the same files). An older Gallery's
901
+ skill (the whole tools: package.json and src/, or reports/, its SKILL.md named gallery or
902
+ html-report-studio), there or anywhere in that skills folder, has its documents copied into the
903
+ workspace first, as gallery init --from copies them, and its exports into <workspace>/exports/ where
904
+ the name is free; then it is moved to <workspace>/.gallery/old-skill-<date>/ (never deleted), so that
905
+ the Agent sees one Gallery skill. Says what it did and where; then open a new Agent session.
906
+ Exits 1, changing nothing, when a target holds something else or an older skill's preview server
907
+ still runs (stop it first); 1 too when an older skill cannot be moved (its documents are copied).`};r.component=r.block;var m={block:l,page:d};function b(e,t=void 0){let s=g[e]??e,a=m[s];if(!a)return{text:r[s]};if(t===void 0)return{text:w(a)};let n=a.subs.find(i=>i.name===t);return n?{text:p(a,n)}:{unknown:a.subs.map(i=>i.name)}}function v(e,t){let s=m[g[e]??e]?.subs.find(a=>a.name===t);return s?s.usage.map((a,n)=>n===0?`Usage: ${a}`:` ${a}`).join(`
908
+ `):null}var x=r.block.split(`
909
+ `).filter(e=>/^(?:Usage:)?\s*gallery block try /.test(e)).map((e,t)=>t===0?`Usage: ${e.trimStart()}`:e).join(`
910
+ `),E=r.block.split(`
911
+ `).filter(e=>/^(?:Usage:)?\s*gallery block pack /.test(e)).map((e,t)=>t===0?`Usage: ${e.trimStart()}`:e).join(`
912
+ `),j=r.page.split(`
913
+ `).filter(e=>/^(?:Usage:)?\s*gallery page try /.test(e)).map((e,t)=>t===0?`Usage: ${e.trimStart()}`:e).join(`
914
+ `),A=`Usage: gallery <command> [options] [--workspace <dir>]
915
+ Gallery: documents written as HTML, edited in the browser, exported as one offline file.
916
+
917
+ gallery init [<dir>] [--from <old reports dir>] make a workspace (copy an older Gallery's documents)
918
+ gallery new <slug> "<title>" [--under|--column] a new document; starts the server, opens the browser
919
+ gallery import <file> [<slug> ["<title>"]] documents made of a file (Markdown, HTML, Word, PDF\u2026)
920
+ gallery open [<slug>] [--no-browser] [--present] start or reuse the server and open the browser
921
+ gallery serve [--port <n>] run the server in the foreground
922
+ gallery stop stop the shared Gallery server
923
+ gallery sandbox [start|list|env|stop] test in an isolated Gallery instance
924
+ gallery preview <page.html> [--open] [--shots <dir>] build an interactive UI preview
925
+ gallery preferences list|on|off discover or manage writing preferences
926
+ gallery check [<slug>...] check documents (none named: all)
927
+ gallery export <slug>... [--format pdf|markdown] write <workspace>/exports/<slug>.html (.pdf, .md)
928
+ gallery qa <slug>... [--blocks a,b] [--tiles] look at exports in Chrome or Edge; lists the pictures to open
929
+ gallery list [<words>...] | --tree [<slug>] [--json] the documents, those the words name, or the tree
930
+ gallery list <words>... --all search the documents of every workspace of this machine
931
+ gallery workspaces [--json|--show|--hide|--name|--forget] this machine's workspaces; show or hide one in the sidebar
932
+ gallery move <slug> --under <slug> | --top | --column "<c>" move a document (and those under it) in the tree
933
+ gallery set <slug> --title|--icon|--description|--font\u2026 a document's title, icon, description or \u5B57\u4F53\u4E0E\u5E03\u5C40
934
+ gallery link add <url> "<name>" | set | remove a web link in the sidebar, shown beside it
935
+ gallery trash <entry>... | list | restore | empty the trash: move to it, list it, put back, delete for good
936
+ gallery duplicate <slug> [<new slug>] [--title] a copy of a document, after it, titled \uFF08\u526F\u672C\uFF09
937
+ gallery copy <slug> --to <workspace> [--under] copy a document (with those under it) to another workspace
938
+ gallery favorite <entry> [--off] put an entry in the sidebar's \u6536\u85CF, or take it out
939
+ gallery column new|rename|remove "<column>" the sidebar's columns (\u680F)
940
+ gallery notes <slug> [done|remove <id>...|--done|--all] a document's annotations (\u6279\u6CE8): list, mark done, remove
941
+ gallery status [--json] what the browser has open and selected, and what is unsaved
942
+ gallery history <slug> [--json] [--restore <version>] a document's earlier versions; restore one
943
+ gallery revert <slug> take back the Agent's changes since the user last confirmed
944
+ gallery doctor [--json] check Node, Gallery, the skill, the workspace and the browser
945
+ gallery emoji add <name> <image> | list the workspace's own emoji (\u81EA\u5B9A\u4E49\u8868\u60C5)
946
+ gallery extension list | check <id> the sidebar columns extensions provide, as shown
947
+ gallery block new|add|list|show|check [<id>] make, add, list, read and check custom blocks
948
+ gallery block try <slug> --press <selector> a reader's gestures on an instance, and what they wrote
949
+ gallery block pack|menu|net on|off <name> \u8BBE\u7F6E \u203A \u7EC4\u4EF6\u5217\u8868's switches: a pack, a block in the menus, a block online
950
+ gallery page new|list|open|set|move [<slug>] make, list, open, rename and order custom pages (boards of cards)
951
+ gallery page add <slug> <block> [--x --y --w --h] [--set k=v] put a card of a block on a page, its id given
952
+ gallery page try <slug> <card id> --press <sel> a reader's gestures on a card, and what they wrote
953
+ gallery page check <slug> what is wrong with a page, what changed, its pictures
954
+ gallery page card|reset-cards <slug> [<card id>] change, move, resize or remove a card; the home page's default cards
955
+ gallery skill install [--agent claude|codex] write the Agent's skill for this version
956
+ gallery help [<command> [<subcommand>]] this, a command's usage, or one subcommand's
957
+ gallery startup status|enable|disable background service at login (Windows/macOS)
958
+ gallery --version the version, then what is newer than it
959
+
960
+ ${o}
961
+ ${u}
962
+ gallery --version prints the version first, then a line for each installed Gallery skill older than this
963
+ gallery (\u6280\u80FD\uFF1A\u2026, with the gallery skill install that updates it) and one when npm has a newer Gallery
964
+ (\u65B0\u7248\u672C\uFF1A\u2026), which a cache knows: checked in the background once a day, never waited for;
965
+ GALLERY_NO_UPDATE_CHECK=1 (or CI, NO_UPDATE_NOTIFIER) turns that check off. No other command says them.
966
+ Editing in the browser and gallery qa need Chrome or Edge. Node 22.13 or newer.`;export{y as a,g as b,r as c,b as d,v as e,x as f,E as g,j as h,A as i};