sdocs-dev 1.15.0 → 1.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/help-text.js CHANGED
@@ -12,6 +12,8 @@ USAGE
12
12
  sdoc <file> --style Open with style panel
13
13
  sdoc <file> --raw Open raw markdown source
14
14
  sdoc <file> --comment Open in comment mode (review/annotate)
15
+ sdoc <file> 12:"note" 24-28:"note"
16
+ Open a guided document walkthrough
15
17
  sdoc bridge <file> Live editing session: edits autosave to disk,
16
18
  external changes push to the page (see LIVE BRIDGE)
17
19
  sdoc new New blank document (write mode)
@@ -22,6 +24,7 @@ USAGE
22
24
  sdoc charts Chart types, options, and styling guide
23
25
  sdoc diagrams Mermaid diagrams reference (\`\`\`mermaid blocks)
24
26
  sdoc videos YouTube embed reference (\`\`\`video blocks)
27
+ sdoc apps Runnable HTML reference (\`\`\`sdoc-app blocks)
25
28
  sdoc cells Inline spreadsheet reference (\`\`\`cells blocks)
26
29
  sdoc code Syntax highlighting + code-viewer reference
27
30
  sdoc app.rb / server.js / ... Open a source file as a highlighted listing
@@ -35,16 +38,24 @@ USAGE
35
38
  sdoc slides list Built-in slide template registry + slot names
36
39
  sdoc slides icons [query] Lucide icon names available to the \`icon\` shape kind
37
40
  sdoc slides custom-shapes Raw-shape primitives + design principles reference
41
+ sdoc slides verify <file> Validate slide syntax and geometry without a browser
42
+ sdoc slides verify <file> --json Machine-readable validation output for agents
38
43
  sdoc present <file> Open <file> and jump straight into fullscreen slides
39
44
  sdoc library Open the personal markdown library at smalldocs.org/library
40
45
  sdoc library ls List markdown indexed in this project (walks up to .git)
41
46
  sdoc library ls --tags Tag bag (tag - count) for this project
42
47
  sdoc library --help Full library reference - commands, tagging, rescue, autostart
48
+ sdoc cloud login Sign this CLI into SmallDocs Cloud once
49
+ sdoc cloud status --json Check the connected Cloud account
50
+ sdoc cloud ls List Cloud documents
51
+ sdoc cloud search "query" Search Cloud documents
52
+ sdoc cloud create file.md Add a document to Cloud
53
+ sdoc cloud --help Full Cloud command reference
43
54
  sdoc <file> +tag1 +tag2 Inject tags into the file's front matter at open time
44
55
  sdoc defaults Show ~/.sdocs/styles.yaml
45
56
  sdoc defaults --reset Remove default styles
46
- sdoc setup Wire SmallDocs into your coding agents
47
- sdoc refresh Update the SmallDocs section in agent files to the current version
57
+ sdoc setup Install the SmallDocs skill for your coding agents
58
+ sdoc refresh Refresh the SmallDocs skill to the current version
48
59
  sdoc auto-update [on|off] Toggle auto-install of sdoc updates
49
60
  sdoc upgrade Upgrade sdoc to the latest version now
50
61
  sdoc safe Verify the SmallDocs server is running the published code
@@ -72,7 +83,7 @@ OPTIONS
72
83
  --mode <m> Alias for --read / --write / --style / --raw / --comment
73
84
  --short Use the encrypted /s/<id> short-URL form (share
74
85
  subcommand only). See SHORT LINKS below.
75
- --json Machine-readable output (safe subcommand only).
86
+ --json Machine-readable output for safe and Cloud commands.
76
87
  --audit Also print GitHub links to server-side source
77
88
  files (safe subcommand only).
78
89
  --keep-open feedback subcommand: keep the bridge alive across
@@ -86,6 +97,22 @@ OPTIONS
86
97
  ENVIRONMENT
87
98
  SDOCS_URL Fallback base URL if --url is not passed.
88
99
 
100
+ DOCUMENT WALKTHROUGHS
101
+ Add notes after a Markdown filename to guide a reader through the
102
+ rendered document:
103
+
104
+ sdoc report.md 12:"Start with the result" 24-28:"Compare these figures"
105
+
106
+ Each source line or range becomes a highlighted target followed by a
107
+ markdown note with Prev / Next controls. Steps follow command argument
108
+ order, not source order. A prose line highlights its matching rendered
109
+ text. A line inside an ordinary code fence highlights that code line
110
+ and places the note beneath it. A chart, diagram, sheet, slide, form,
111
+ math block, or video is highlighted as one complete rendered element.
112
+
113
+ The annotations ride in the URL and through sdoc share. The source file
114
+ is unchanged.
115
+
89
116
  INTERACTIVE FEEDBACK (sdoc feedback)
90
117
  An agent writes a fenced \`\`\`form block into a markdown file and runs
91
118
  \`sdoc feedback file.md\`. The browser renders real form controls
@@ -146,7 +173,6 @@ LIBRARY (personal, on-machine index)
146
173
  sdoc library Open the search UI.
147
174
  sdoc library ls List indexed files in this project.
148
175
  sdoc library ls --tags Tag bag (tag - count) for this project.
149
- sdoc library rebuild Walk \$HOME and refresh every entry.
150
176
  sdoc library status Show enabled/disabled + entry count.
151
177
  sdoc library autostart Manage the macOS LaunchAgent.
152
178
 
@@ -978,6 +1004,141 @@ SECURITY
978
1004
  `;
979
1005
 
980
1006
 
1007
+ const APPS_HELP = `
1008
+ SmallDocs - Runnable HTML
1009
+ ========================
1010
+ Run a self-contained HTML document inside Markdown using a \`\`\`sdoc-app
1011
+ fenced code block. The component appears inline and can expand to fill the
1012
+ browser window. Use this for interactive models, calculators, simulations,
1013
+ and other agent-authored browser tools.
1014
+
1015
+ BASIC SYNTAX
1016
+ \`\`\`sdoc-app
1017
+ <!doctype html>
1018
+ <html>
1019
+ <head>
1020
+ <meta name="viewport" content="width=device-width, initial-scale=1">
1021
+ <title>Counter</title>
1022
+ </head>
1023
+ <body>
1024
+ <button id="count">Count: 0</button>
1025
+ <script>
1026
+ let value = 0;
1027
+ const button = document.getElementById('count');
1028
+ button.onclick = () => button.textContent = 'Count: ' + (++value);
1029
+ </script>
1030
+ </body>
1031
+ </html>
1032
+ \`\`\`
1033
+
1034
+ AUTHORING
1035
+ - Put one complete HTML document in each block.
1036
+ - Use <title> to name the component in its toolbar and fullscreen view.
1037
+ - CSS, inline JavaScript, canvas, SVG, forms, and browser-native controls work.
1038
+ - Package required data and code in the document when the component should
1039
+ keep working without an external service.
1040
+ - An ordinary \`\`\`html fence remains a highlighted source listing.
1041
+
1042
+ INHERITED DESIGN
1043
+ Bare semantic HTML starts with the SmallDocs document's current typography,
1044
+ text and heading colours, background, accent, border, surface, spacing, and
1045
+ corner radius. Native controls receive the same font and a restrained base
1046
+ treatment. These values update when the document theme or styles change.
1047
+
1048
+ The defaults live in a low-priority CSS layer. Ordinary component CSS wins.
1049
+ Override individual values through these custom properties:
1050
+
1051
+ --sdoc-app-background --sdoc-app-surface
1052
+ --sdoc-app-color --sdoc-app-heading-color
1053
+ --sdoc-app-muted-color --sdoc-app-accent-color
1054
+ --sdoc-app-border-color --sdoc-app-font-family
1055
+ --sdoc-app-heading-font-family --sdoc-app-code-font-family
1056
+ --sdoc-app-font-size --sdoc-app-line-height
1057
+ --sdoc-app-heading-scale
1058
+ --sdoc-app-h1-size --sdoc-app-h2-size
1059
+ --sdoc-app-h3-size --sdoc-app-h1-weight
1060
+ --sdoc-app-h2-weight --sdoc-app-h3-weight
1061
+ --sdoc-app-radius --sdoc-app-block-spacing
1062
+ --sdoc-app-padding --sdoc-app-color-scheme
1063
+
1064
+ Example override:
1065
+
1066
+ :root { --sdoc-app-background: #101827; --sdoc-app-color: #f8fafc; }
1067
+ body { padding: 12px; }
1068
+
1069
+ Do not repeat a body reset, font stack, or page background when the inherited
1070
+ design is appropriate. Add CSS for the component's layout and intentional
1071
+ visual differences. The bundled Inter faces load inside the component.
1072
+ Load other webfonts inside the component when their exact face is required.
1073
+
1074
+ VISUAL DIRECTION
1075
+ Let the tool's purpose determine its layout. Start with semantic HTML and the
1076
+ inherited design, then add treatment where it clarifies hierarchy, grouping,
1077
+ state, or interaction.
1078
+
1079
+ - Try a clear page, list, table, or form before turning every region into a
1080
+ dashboard card. Use a canvas or stage when the interaction is spatial.
1081
+ Whitespace and dividers are often enough to structure repeated rows.
1082
+ For repeated records, try one list with border-bottom separators before
1083
+ wrapping every record in its own card.
1084
+ - Reserve a bordered or raised surface for content that needs to read as a
1085
+ separate group, selection, or interaction. Avoid stacking several levels
1086
+ of rounded containers only to create hierarchy.
1087
+ - Keep a consistent shape language and begin with the inherited radius.
1088
+ Pills suit compact statuses and category choices; ordinary actions and
1089
+ metrics do not need to become pills.
1090
+ - For an ordinary document tool, leave the inherited design tokens unchanged
1091
+ unless the brief calls for a distinct visual direction. Add semantic colour
1092
+ when it carries meaning. Gradients, glows, and shadows should support the
1093
+ subject or interaction rather than decorate empty space.
1094
+ - Accent rails, badges, uppercase eyebrows, and wide letter spacing are
1095
+ conspicuous patterns. Use them when they communicate something specific,
1096
+ not as automatic decoration. A title does not also need an eyebrow unless
1097
+ that label adds context the title does not contain.
1098
+ - Match density to the task. Repeated controls should read as efficient rows;
1099
+ the primary result or working area should receive the strongest emphasis.
1100
+ A few totals can often share one summary line or bar instead of separate
1101
+ metric cards.
1102
+
1103
+ SIZING AND RESPONSIVE LAYOUT
1104
+ The component owns its inline height. SmallDocs measures the complete
1105
+ document and follows that height without imposing a minimum or maximum. The
1106
+ frame width follows the SmallDocs reading column. Fullscreen uses the
1107
+ available browser viewport.
1108
+
1109
+ - Include a viewport meta tag in every component.
1110
+ - Let normal document flow determine height when content can grow.
1111
+ - Use the component's own CSS min-height, height, or aspect-ratio when an
1112
+ interactive canvas or stage needs a deliberate working area.
1113
+ - Avoid fixed page widths. Use fluid widths, grid or flex wrapping, media or
1114
+ container queries, and controls that remain usable at narrow widths.
1115
+ - Resize canvas and other measured graphics from their rendered container.
1116
+ ResizeObserver and the normal window resize event are available.
1117
+ - Check the component inline and fullscreen at both narrow and wide widths.
1118
+
1119
+ A concise inline height keeps the surrounding document easy to navigate.
1120
+ Dense tools can use more space or rely on the expand control. These are
1121
+ authoring choices rather than renderer limits.
1122
+
1123
+ VIEWING
1124
+ Expand opens the same running frame fullscreen, so its current inputs and
1125
+ JavaScript state remain in place. When a document has several components,
1126
+ Previous and Next move between them.
1127
+
1128
+ BROWSER BOUNDARY
1129
+ Component code runs in a sandboxed frame. It cannot read the SmallDocs page,
1130
+ browser storage for smalldocs.org, or account controls. Scripts can use forms,
1131
+ modals, downloads, and popups. Network requests still leave the browser and
1132
+ are subject to the destination's CORS rules, so a document can communicate
1133
+ with services that allow it.
1134
+
1135
+ FAILURE BEHAVIOUR
1136
+ If the runner cannot start or does not respond within 15 seconds, SmallDocs
1137
+ leaves the component source readable in an error panel. Re-rendering or
1138
+ destroying an SDK instance removes its frames and event listeners.
1139
+ `;
1140
+
1141
+
981
1142
  const CELLS_HELP = `
982
1143
  SmallDocs - Cells (sheets)
983
1144
  ======================
@@ -1018,27 +1179,40 @@ WRAPPING
1018
1179
  text - markup never renders.
1019
1180
 
1020
1181
  FORMATTING
1021
- Numbers display with thousands separators and negatives in red by default.
1022
- An optional first line sets per-column formats by column letter:
1182
+ Numbers display with thousands separators and up to two decimal places by
1183
+ default. Negatives are red. One or more leading format: lines can control a
1184
+ sheet, column, row, or individual cell:
1023
1185
 
1024
1186
  \`\`\`cells
1025
- format: A=plain B=$ C=%
1187
+ format: A=plain B=$ C=% C4=%.1
1026
1188
  Year,Revenue,Margin
1027
1189
  2024,12000,0.23
1028
1190
  \`\`\`
1029
1191
 
1030
1192
  Renders 2024 (plain - no comma), $12,000.00, 23%.
1031
1193
 
1032
- Format tokens (keyed by column letter):
1194
+ Targets use familiar sheet addresses:
1195
+ * whole sheet
1196
+ A column A
1197
+ 4 row 4
1198
+ C4 cell C4
1199
+
1200
+ A cell overrides its row, a row overrides its column, and a column overrides
1201
+ the whole sheet. This makes \`format: B=$ B4=%\` a currency column with one
1202
+ percentage cell.
1203
+
1204
+ Format tokens:
1033
1205
  $ / usd currency, e.g. $12,000.00 (also £ / gbp, € / eur)
1034
1206
  % percent - multiplies by 100, e.g. 0.23 -> 23%
1035
- , / number thousands separators (the default)
1207
+ , / number thousands separators
1036
1208
  plain / text no number formatting (good for years, ids, codes)
1037
- .N suffix fixed decimals, e.g. $.0 (no cents), %.1, .2
1209
+ .N suffix fixed decimals, attached directly: $.0, %.1, .2
1210
+
1211
+ Each target accepts one format token. Use C=%.2, not C=%,.2. Unknown or
1212
+ malformed rules are ignored without changing the sheet's data.
1038
1213
 
1039
- Formatting is display only - copy and export always emit the original
1040
- values. This is what makes a cells block more than a CSV: the author
1041
- chooses how each column reads.
1214
+ Formatting changes appearance, not the underlying values. Copy preserves
1215
+ the source values; Excel export preserves both the values and number formats.
1042
1216
 
1043
1217
  FORMULAS
1044
1218
  A cell whose value starts with = is a formula, evaluated in the browser.
@@ -1287,7 +1461,8 @@ EXPORT
1287
1461
  formulas and recalculate when the file opens; the format: directive's
1288
1462
  currency / percent / comma columns carry over as Excel number formats.
1289
1463
  The export uses the document's row order (plus any fullscreen edits),
1290
- never the sorted view, so formula references stay correct.
1464
+ never the sorted view, so formula references stay correct. Sheet, column,
1465
+ row, and cell number formats carry over to Excel.
1291
1466
  `;
1292
1467
 
1293
1468
  const SLIDES_HELP = `
@@ -1299,6 +1474,31 @@ present-mode icon in the slide's top-right corner to enter fullscreen.
1299
1474
  Text inside a slide thumbnail is selectable. Esc to exit, arrows to
1300
1475
  navigate.
1301
1476
 
1477
+ \u2500\u2500 START HERE \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
1478
+ Use \`@extends\` for covers, section breaks, quotations, simple
1479
+ text, and layouts that repeat. Fill named slots and the template
1480
+ handles layout, spacing, and alignment for you:
1481
+
1482
+ ~~~slide
1483
+ @extends title-body
1484
+ #title: What is SmallDocs?
1485
+ #body:
1486
+ - Markdown in, styled docs out
1487
+ - No server, hash-only state
1488
+ ~~~
1489
+
1490
+ Run \`sdoc slides list\` for the template + slot names (cover,
1491
+ title-body, two-column, three-column, exhibit, quote, metric,
1492
+ section, closing).
1493
+
1494
+ Use custom shapes when geometry explains the idea: a process,
1495
+ architecture, hierarchy, comparison, feedback loop, market
1496
+ structure, or causal model. This applies to internal presentations
1497
+ too. An internal audience should be able to see the model instead
1498
+ of reconstructing it from title-and-bullet slides. Mix templates
1499
+ and custom slides in the same deck. Read DESIGN GUIDELINES and
1500
+ \`sdoc slides custom-shapes\` before hand-placing shapes.
1501
+
1302
1502
  \u2500\u2500 COMMANDS \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
1303
1503
  sdoc present <file> Open file directly in fullscreen slide view
1304
1504
  sdoc <file> Open normally (click a slide's present icon)
@@ -1306,9 +1506,11 @@ navigate.
1306
1506
  sdoc slides list List built-in templates + slot names
1307
1507
  sdoc slides icons [query] List the Lucide icons available to the
1308
1508
  \`icon\` shape kind. Optional substring filter.
1309
- sdoc slides custom-shapes Long-tail notes for raw-shape custom slides
1310
- (polygon text, composite patterns, layering).
1311
- Most decks use \`@extends\` and never need this.
1509
+ sdoc slides custom-shapes Shape syntax and design guidance for visual
1510
+ explanations, diagrams, and custom layouts.
1511
+ sdoc slides verify <file> Validate every slide headlessly. Exit 0 when
1512
+ clean, 1 for diagnostics, or 2 for bad usage.
1513
+ sdoc slides verify <file> --json Return the same result as structured JSON.
1312
1514
 
1313
1515
  ── DESIGN GUIDELINES ────────────────────────────────────
1314
1516
  The built-in templates encode a few rules that separate professional
@@ -1316,18 +1518,12 @@ navigate.
1316
1518
  template), keep these in mind - they're the difference between a
1317
1519
  deck that lands and one that doesn't.
1318
1520
 
1319
- Templates for scratch, custom layout for anything seen. The
1320
- built-in templates are the fast path: legible, consistent, and
1321
- well suited to fast information transfer - an internal review, a
1322
- working draft, a deck you will talk over. They are not built for
1323
- an audience that cares about feel, so a deck made only from them
1324
- reads as functional rather than designed. For anything
1325
- external-facing - a client, a conference, a launch, anything with
1326
- your name on it that you will not be in the room to narrate -
1327
- compose the deck from raw shapes instead. If you are not sure which
1328
- setting you are in, ask your user, explaining the trade-off:
1329
- templates are faster and uniform, raw shapes take longer but let
1330
- the deck carry a designed look. See \`sdoc slides custom-shapes\`
1521
+ Match the layout to the information. Templates are the fast path
1522
+ for covers, section breaks, simple text, and repeated structures.
1523
+ Raw shapes are the explanatory path when position, direction,
1524
+ grouping, size, or sequence carries meaning. Audience type does
1525
+ not decide this: internal architecture and process decks often
1526
+ benefit most from a visual model. See \`sdoc slides custom-shapes\`
1331
1527
  for the shape vocabulary and the design principles that go with it.
1332
1528
 
1333
1529
  Margins. Keep all content inside a 1-unit safe area on every side
@@ -1360,9 +1556,13 @@ navigate.
1360
1556
  Caption renders as ~3px in a 240px-wide thumbnail - never put
1361
1557
  load-bearing content in caption role.
1362
1558
 
1363
- Default \`valign=center\`. \`valign=top\` reads right only when the
1364
- body shape is sized to its content. On an oversized body shape
1365
- top-anchoring leaves dead space underneath; centering balances it.
1559
+ Use \`valign=top\` for body copy - bullets, paragraphs, columns.
1560
+ Text has a reading order and a top edge readers expect just under
1561
+ the title, so anchor it there and let it grow down. \`valign=center\`
1562
+ is for a single short block that balances its box or a neighbouring
1563
+ visual (a takeaway beside a chart, a caption, a lead line) - not for
1564
+ a list. If a top-anchored body leaves dead space below, shrink the
1565
+ shape rather than re-centering the text.
1366
1566
 
1367
1567
  Content fills 55-65% of the safe area, no more. Empty space is a
1368
1568
  feature: it's what makes a deck feel confident rather than crowded.
@@ -1380,17 +1580,19 @@ navigate.
1380
1580
  A bulleted paragraph is hiding the fact that you haven't decided
1381
1581
  what you're claiming.
1382
1582
 
1383
- When the deck is internal or you only need it to read clearly,
1384
- \`@extends\` a built-in template instead of composing from raw
1385
- shapes - run \`sdoc slides list\` to see the registry. Reach for
1386
- raw shapes when the deck will be seen by an audience and the
1387
- default beat is not enough; the guidelines above are what keep
1388
- that hand-built deck on the professional side of the line. If a
1389
- custom layout repeats across slides, define it once as your own
1390
- \`@template\` and \`@extends\` it - the consistency of a template
1391
- with a look you designed.
1583
+ Do not default an internal deck to title-and-bullet templates.
1584
+ If the slide explains relationships, stages, or movement, compose
1585
+ those relationships with shapes. If a custom layout repeats across
1586
+ slides, define it once as your own \`@template\` and \`@extends\` it -
1587
+ the consistency of a template with a look you designed.
1392
1588
 
1393
1589
  \u2500\u2500 VERIFYING A DECK (OPTIONAL, BUT IT IS WHAT SEPARATES CLEAN FROM BROKEN) \u2500\u2500
1590
+ Run \`sdoc slides verify <file> --json\` after authoring. It uses the
1591
+ same parser, template resolver, reference resolver, and bounds check
1592
+ as the browser. Fix every reported problem or acknowledge intentional
1593
+ off-canvas decoration on that shape with \`bleed=allow\`, then run it
1594
+ again. The command exits 0 only when the deck is clean.
1595
+
1394
1596
  You are authoring slides you cannot see. You place coordinates and
1395
1597
  trust them, and the renderer does not warn you when a shape covers
1396
1598
  text, when a label wraps to a line you did not intend, when text sits
@@ -1645,7 +1847,8 @@ navigate.
1645
1847
  Everything after \`|\` is standard markdown. Multi-line uses
1646
1848
  indentation under the shape line - continuation lines MUST be
1647
1849
  indented at least 2 spaces, or the parser treats them as fresh
1648
- top-level shape lines (and fails).
1850
+ top-level shape lines (and fails). In short inline labels, \`\\n\`
1851
+ inserts a visible line break; \`\\\\n\` keeps the literal text \`\\n\`.
1649
1852
 
1650
1853
  r 5 20 90 60 align=left |
1651
1854
  ## Heading
@@ -1668,17 +1871,20 @@ navigate.
1668
1871
  - Title shapes (one heading or phrase)
1669
1872
  - Subheaders, section labels
1670
1873
  - Standalone caption text
1874
+ - A single short block balancing a box or a neighbouring visual
1671
1875
 
1672
- Switch to \`align=left\` when the shape holds body copy - paragraphs,
1673
- bullet lists, numbered lists, blockquotes. Left-aligned reads better
1674
- once you have multiple lines. Keep \`valign=center\` (the default) so
1675
- the block floats in the middle of the shape; switch to \`valign=top\`
1676
- only when the shape is sized exactly to the content and you want it
1677
- anchored to the top.
1876
+ Switch to \`align=left valign=top\` when the shape holds body copy -
1877
+ paragraphs, bullet lists, numbered lists, blockquotes. Left-aligned
1878
+ reads better once you have multiple lines, and top-anchoring puts the
1879
+ first line just under the title where the reader looks first.
1880
+ Centering a list in an oversized box floats it toward the middle, so
1881
+ the gap under the title reads as a mistake. If top-anchoring leaves
1882
+ dead space below, shrink the shape - don't re-center the text.
1678
1883
 
1679
1884
  Rule of thumb:
1680
- ONE short phrase \u2192 leave centered
1681
- MULTIPLE lines \u2192 align=left, keep valign=center
1885
+ ONE short phrase / balancing block \u2192 center both axes
1886
+ MULTIPLE lines / bullets / columns \u2192 align=left valign=top
1887
+ Footer / attribution label \u2192 valign=bottom
1682
1888
 
1683
1889
  \u2500\u2500 PULLING FROM DOC STYLES \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
1684
1890
  Slides pick up the host document's styles so a deck feels visually
@@ -1955,7 +2161,8 @@ navigate.
1955
2161
 
1956
2162
  Common errors:
1957
2163
  - "shape extends outside grid WxH" bbox past an edge by >10% of the
1958
- grid (a little bleed is allowed)
2164
+ grid. Add \`bleed=allow\` only when
2165
+ that individual shape is intentional
1959
2166
  - \`unknown id "@name"\` @-ref before the shape is declared
1960
2167
  - \`duplicate id "#name"\` two shapes share an id
1961
2168
  - \`invalid attribute key\` key must start with a letter
@@ -1969,10 +2176,10 @@ navigate.
1969
2176
  const SLIDES_CUSTOM_SHAPES_HELP = `
1970
2177
  SmallDocs — Slides (raw shapes)
1971
2178
  ===========================
1972
- Reference + design notes for slides built from raw shapes rather than
1973
- the stdlib templates. Most decks won't need any of this - if you can
1974
- express the slide via \`@extends\` on a built-in (cover, title-body,
1975
- two-column, exhibit, etc.), do that.
2179
+ Reference + design notes for slides built from raw shapes. Use templates
2180
+ for simple or repeated layouts. Use these shapes when geometry explains
2181
+ a process, architecture, hierarchy, comparison, or causal model, including
2182
+ in internal presentations.
1976
2183
 
1977
2184
  Read DESIGN PRINCIPLES first. The syntax reference below assumes you've
1978
2185
  made the visual choices the principles describe. Without them, raw
@@ -2286,7 +2493,8 @@ rather than as designed.
2286
2493
  All shapes EXCEPT \`l\` and \`a\` can hold markdown after \`|\` - full
2287
2494
  markdown (headings, lists, bold/italic, code, blockquote, tables).
2288
2495
  Non-rectangle shapes use their bounding box as the text area (see
2289
- the TEXT INSIDE NON-RECT SHAPES section).
2496
+ the TEXT INSIDE NON-RECT SHAPES section). In a short inline label,
2497
+ \`\\n\` inserts a visible line break.
2290
2498
 
2291
2499
  No \`fill=\` on a shape -> transparent (slide background shows through).
2292
2500
  Color values accept any CSS colour: hex (#1e40af), named (tomato),
@@ -2465,6 +2673,8 @@ rather than as designed.
2465
2673
  backdrops, ghosted "previous state" shapes,
2466
2674
  overlapping highlights. Out-of-range values
2467
2675
  clamp.
2676
+ bleed=allow Acknowledge intentional off-canvas overflow for
2677
+ this shape. Other shapes are still checked.
2468
2678
 
2469
2679
  Numeric attributes (strokeWidth, radius) are in grid units - pick
2470
2680
  values relative to your grid size, no prescribed defaults. On a
@@ -2715,14 +2925,8 @@ COMMANDS
2715
2925
  bag (tag - count, sorted by
2716
2926
  frequency). Run before tagging
2717
2927
  a new file to stay consistent.
2718
- sdoc library status Print enabled/disabled, entry
2719
- count, last scan time.
2720
-
2721
- Refresh
2722
- sdoc library rebuild Walk \$HOME again from scratch
2723
- and refresh every entry. Use
2724
- after moving files around or
2725
- when an entry seems stale.
2928
+ sdoc library status Print enabled/disabled and the
2929
+ current entry count.
2726
2930
 
2727
2931
  On/off
2728
2932
  sdoc library enable Re-enable indexing-on-open if
@@ -2755,9 +2959,7 @@ COMMANDS
2755
2959
  sdoc library help Same.
2756
2960
 
2757
2961
  WHAT GETS INDEXED
2758
- Every file you open with \`sdoc <file>\` is recorded at open time.
2759
- \`sdoc library rebuild\` additionally walks \$HOME looking for
2760
- markdown that fits these rules:
2962
+ Every file you open with \`sdoc <file>\` is recorded at open time when:
2761
2963
  - extension is .md, .mdx, or .markdown
2762
2964
  - size is at most 1 MB
2763
2965
  - not under a hidden directory (.git, .venv, .cache, ...)
@@ -2931,8 +3133,8 @@ PRIVACY MODEL
2931
3133
 
2932
3134
  COMMON QUESTIONS
2933
3135
  Q: I opened a file but I don't see it in the library.
2934
- A: Check \`sdoc library status\` (is it enabled?), then
2935
- \`sdoc library rebuild\`. If the file is in front matter
3136
+ A: Check \`sdoc library status\` (is it enabled?), then open the file
3137
+ again with \`sdoc <file>\`. If the file is in front matter
2936
3138
  \`sdocs-library: false\`, that's the opt-out. Also check for a
2937
3139
  .sdocsignore in the file's directory or any ancestor.
2938
3140
 
@@ -3035,4 +3237,4 @@ SUPPORTED LANGUAGES
3035
3237
  they appear. An unknown language label renders as plain text.
3036
3238
  `;
3037
3239
 
3038
- module.exports = { HELP, COMMENTS_HELP, SCHEMA, CHARTS_HELP, DIAGRAMS_HELP, VIDEOS_HELP, CELLS_HELP, CODE_HELP, SLIDES_HELP, SLIDES_CUSTOM_SHAPES_HELP, LIBRARY_HELP };
3240
+ module.exports = { HELP, COMMENTS_HELP, SCHEMA, CHARTS_HELP, DIAGRAMS_HELP, VIDEOS_HELP, APPS_HELP, CELLS_HELP, CODE_HELP, SLIDES_HELP, SLIDES_CUSTOM_SHAPES_HELP, LIBRARY_HELP };
package/lib/io.js CHANGED
@@ -9,11 +9,12 @@ const codeLangs = require('./code-langs');
9
9
 
10
10
  const SUBCOMMANDS = new Set([
11
11
  'new', 'share', 'schema', 'defaults', 'help', 'version',
12
- 'charts', 'diagrams', 'videos', 'video', 'cells', 'code', 'comments',
12
+ 'charts', 'diagrams', 'videos', 'video', 'apps', 'app', 'cells', 'code', 'comments',
13
13
  'setup', 'safe', 'auto-update', 'refresh', 'upgrade',
14
14
  'bridge', 'feedback',
15
15
  'slides', 'present',
16
16
  'library',
17
+ 'cloud',
17
18
  'color-analysis',
18
19
  ]);
19
20
 
@@ -55,6 +56,23 @@ function parseArgs(argv) {
55
56
  let yesFlag = false;
56
57
  let dryRunFlag = false;
57
58
  let sheetName = null;
59
+ let projectFlag = null;
60
+ let accountFlag = null;
61
+ let outputPath = null;
62
+ let revisionFlag = null;
63
+ let documentFlag = null;
64
+ let baseRevisionFlag = null;
65
+ let limitFlag = null;
66
+ let noOpenFlag = false;
67
+ let noBindFlag = false;
68
+ let forceFlag = false;
69
+ let everyoneFlag = false;
70
+ let onlyYouFlag = false;
71
+ let sharedWithMeFlag = false;
72
+ let noteText = null;
73
+ const memberFlags = [];
74
+ const documentFlags = [];
75
+ const tagFilters = [];
58
76
  const addTags = [];
59
77
  const annotations = [];
60
78
  // Multi-file code walkthrough: every source-code positional is collected
@@ -115,6 +133,26 @@ function parseArgs(argv) {
115
133
  if (arg === '--yes' || arg === '-y') { yesFlag = true; continue; }
116
134
  if (arg === '--dry-run') { dryRunFlag = true; continue; }
117
135
  if (arg === '--sheet') { sheetName = args[++i]; continue; }
136
+ if (arg === '--project') { projectFlag = args[++i]; continue; }
137
+ if (arg === '--account') { accountFlag = args[++i]; continue; }
138
+ if (arg === '--member') { memberFlags.push(args[++i]); continue; }
139
+ if (arg === '--everyone') { everyoneFlag = true; continue; }
140
+ if (arg === '--only-you') { onlyYouFlag = true; continue; }
141
+ if (arg === '--shared-with-me') { sharedWithMeFlag = true; continue; }
142
+ if (arg === '--note') { noteText = args[++i]; continue; }
143
+ if (arg === '--output' || arg === '-o') { outputPath = args[++i]; continue; }
144
+ if (arg === '--revision') { revisionFlag = args[++i]; continue; }
145
+ if (arg === '--document') {
146
+ documentFlag = args[++i];
147
+ documentFlags.push(documentFlag);
148
+ continue;
149
+ }
150
+ if (arg === '--base-revision') { baseRevisionFlag = args[++i]; continue; }
151
+ if (arg === '--limit') { limitFlag = Number(args[++i]); continue; }
152
+ if (arg === '--tag') { tagFilters.push(args[++i]); continue; }
153
+ if (arg === '--no-open') { noOpenFlag = true; continue; }
154
+ if (arg === '--no-bind') { noBindFlag = true; continue; }
155
+ if (arg === '--force') { forceFlag = true; continue; }
118
156
 
119
157
  if (!subcommand && SUBCOMMANDS.has(arg)) {
120
158
  subcommand = arg;
@@ -165,6 +203,9 @@ function parseArgs(argv) {
165
203
  messageText, connectTimeoutS, idleTimeoutS, reconnectGraceMs,
166
204
  keepOpenFlag, logFile,
167
205
  tagsFlag, helpFlag, yesFlag, dryRunFlag, sheetName,
206
+ projectFlag, accountFlag, outputPath, revisionFlag, documentFlag, baseRevisionFlag,
207
+ limitFlag, noOpenFlag, noBindFlag, forceFlag, tagFilters,
208
+ everyoneFlag, onlyYouFlag, sharedWithMeFlag, noteText, memberFlags, documentFlags,
168
209
  addTags, annotations, files,
169
210
  };
170
211
  }
@@ -236,13 +277,13 @@ function readCodewalkContent(files) {
236
277
  return { body: parts.join('\n'), files: tabs };
237
278
  }
238
279
 
239
- function openBrowser(url) {
280
+ function openBrowser(url, fallback) {
240
281
  try {
241
282
  if (process.platform === 'darwin') execFileSync('open', [url]);
242
283
  else if (process.platform === 'win32') execFileSync('cmd', ['/c', 'start', '', url]);
243
284
  else execFileSync('xdg-open', [url]);
244
285
  } catch {
245
- console.log(`Open in browser: ${url}`);
286
+ (fallback || console.log)(`Open in browser: ${url}`);
246
287
  }
247
288
  }
248
289