hd-garden 0.13.3 → 0.14.2

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 (218) hide show
  1. package/.agents/skills/garden-compose/SKILL.md +24 -0
  2. package/.agents/skills/garden-compose/references/colors.md +11 -0
  3. package/.agents/skills/garden-compose/references/composition-patterns.md +162 -0
  4. package/.agents/skills/garden-compose/references/examples.md +55 -0
  5. package/.agents/skills/garden-compose/references/frames.md +7 -0
  6. package/.agents/skills/garden-compose/references/layout-recipes.md +84 -0
  7. package/.agents/skills/garden-compose/references/rendering-model.md +120 -0
  8. package/.agents/skills/garden-compose/references/static-play.md +19 -0
  9. package/.agents/skills/garden-compose/references/visual-selection.md +38 -0
  10. package/.agents/skills/garden-compose/references/workflow.md +27 -0
  11. package/.agents/skills/garden-compose/scripts/_cli.mjs +12 -0
  12. package/.agents/skills/garden-compose/scripts/apply.mjs +2 -0
  13. package/.agents/skills/garden-compose/scripts/check.mjs +2 -0
  14. package/.agents/skills/garden-compose/scripts/prompt.mjs +2 -0
  15. package/.agents/skills/garden-compose/scripts/scan.mjs +2 -0
  16. package/.agents/skills/garden-post-review/SKILL.md +5 -16
  17. package/Makefile +12 -3
  18. package/README.en.md +10 -5
  19. package/README.md +10 -5
  20. package/app/admin/preview/[...path]/page.tsx +4 -16
  21. package/app/api/admin/ui/blocks/route.ts +1 -1
  22. package/app/components/AdminUiPanels.tsx +6 -3
  23. package/app/components/GardenContentGuide.tsx +7 -8
  24. package/app/components/MarkdownArticle.tsx +2 -0
  25. package/app/components/UiStudio.tsx +29 -32
  26. package/app/components/garden/AuthorRich.tsx +5 -0
  27. package/app/components/garden/ComposePreview.tsx +9 -0
  28. package/app/components/garden/GardenBlock.tsx +12 -10
  29. package/app/components/garden/GardenFile.tsx +1 -1
  30. package/app/components/garden/blocks.tsx +9 -197
  31. package/app/components/garden/file-icons.tsx +1 -1
  32. package/app/components/garden/patterns.tsx +7 -65
  33. package/app/lib/rehype-garden-blocks.mjs +30 -0
  34. package/app/lib/remark-garden.mjs +0 -4
  35. package/app/lib/ui-model.ts +8 -9
  36. package/app/styles/a2.css +17 -1
  37. package/bin/garden.mjs +34 -35
  38. package/docs/handbook/ai-writing.md +19 -22
  39. package/docs/handbook/components/compose.md +16 -7
  40. package/docs/handbook/components/image.md +1 -1
  41. package/docs/handbook/components/link-card.md +2 -2
  42. package/docs/handbook/components.md +5 -213
  43. package/docs/handbook/deploy.md +11 -0
  44. package/docs/handbook/en/ai-writing.md +17 -20
  45. package/docs/handbook/en/components/compose.md +15 -6
  46. package/docs/handbook/en/components/image.md +1 -1
  47. package/docs/handbook/en/components/link-card.md +2 -2
  48. package/docs/handbook/en/components.md +7 -215
  49. package/docs/handbook/en/deploy.md +11 -0
  50. package/docs/handbook/en/index.md +29 -53
  51. package/docs/handbook/en/reference/compose.md +77 -148
  52. package/docs/handbook/en/reference.md +6 -22
  53. package/docs/handbook/en/start.md +1 -1
  54. package/docs/handbook/en/workflow.md +21 -17
  55. package/docs/handbook/en/writing.md +3 -3
  56. package/docs/handbook/index.md +26 -47
  57. package/docs/handbook/reference/compose.md +79 -148
  58. package/docs/handbook/reference.md +6 -22
  59. package/docs/handbook/start.md +1 -1
  60. package/docs/handbook/workflow.md +21 -17
  61. package/docs/handbook/writing.md +3 -3
  62. package/editors/dist/typora/main.js +324 -330
  63. package/editors/dist/typora/style.css +4299 -11
  64. package/editors/dist/vscode/garden-ui-0.14.2.vsix +0 -0
  65. package/eslint.config.mjs +3 -0
  66. package/package.json +5 -3
  67. package/public/images/compose-resources/resource-015b41eb0f32.svg +1 -0
  68. package/public/images/compose-resources/resource-ecee6b47f015.svg +1 -0
  69. package/public/images/compose-resources/resource-fd51121b5e8c.svg +1 -0
  70. package/scripts/build-content.mjs +40 -131
  71. package/scripts/build-ui-preview.mjs +7 -5
  72. package/scripts/check-post.mjs +10 -106
  73. package/scripts/check-site.mjs +80 -0
  74. package/scripts/compose-style-reference.mjs +22 -0
  75. package/scripts/editor-preview-css.mjs +14 -0
  76. package/scripts/file-preview.mjs +1 -1
  77. package/scripts/file-sizes.mjs +7 -7
  78. package/scripts/generated-cache.mjs +36 -0
  79. package/scripts/handbook-facts.mjs +10 -3
  80. package/scripts/image-sizes.mjs +6 -12
  81. package/scripts/link-assets.mjs +35 -10
  82. package/scripts/managed-skills.mjs +56 -0
  83. package/scripts/pack-editors.mjs +12 -1
  84. package/scripts/prepare-pages-output.mjs +1 -1
  85. package/scripts/site-guide.mjs +19 -0
  86. package/scripts/sync-editor-version.mjs +28 -0
  87. package/scripts/ui-cli.mjs +26 -33
  88. package/templates/garden-blocks.md +4 -180
  89. package/templates/garden-snippets.plist +2 -183
  90. package/templates/site/AGENTS.en.md +89 -0
  91. package/templates/site/AGENTS.md +72 -0
  92. package/templates/site/Makefile +12 -3
  93. package/templates/site/Makefile.en +12 -3
  94. package/templates/site/README.en.md +6 -1
  95. package/templates/site/README.md +6 -1
  96. package/templates/skills-en/garden-compose/SKILL.md +24 -0
  97. package/templates/skills-en/garden-post-review/SKILL.md +5 -16
  98. package/templates/workflows/pages.en.yml +11 -0
  99. package/templates/workflows/pages.yml +11 -0
  100. package/ui/compose/compose.css +54 -14
  101. package/ui/compose/contracts.mjs +16 -0
  102. package/ui/compose/dil.mjs +109 -48
  103. package/ui/compose/distribution.mjs +7 -0
  104. package/ui/compose/features.mjs +90 -0
  105. package/ui/compose/icons.mjs +8 -0
  106. package/ui/compose/index.mjs +2 -0
  107. package/ui/compose/inspect.mjs +11 -0
  108. package/ui/compose/markup.mjs +80 -23
  109. package/ui/compose/preview.mjs +13 -0
  110. package/ui/compose/prompt-catalog.mjs +15 -3
  111. package/ui/compose/render.mjs +46 -11
  112. package/ui/compose/scenes.mjs +10 -0
  113. package/ui/core/apply.mjs +12 -45
  114. package/ui/core/catalog.mjs +22 -32
  115. package/ui/core/cli-locale.mjs +8 -18
  116. package/ui/core/color.mjs +34 -0
  117. package/ui/core/compile.mjs +1 -8
  118. package/ui/core/demos.mjs +138 -108
  119. package/ui/core/fence.mjs +14 -70
  120. package/ui/core/fix-prompt.mjs +1 -3
  121. package/ui/core/garden-fence.mjs +3 -63
  122. package/ui/core/index.mjs +3 -5
  123. package/ui/core/parse.mjs +22 -8
  124. package/ui/core/scan.mjs +31 -43
  125. package/ui/core/starters.mjs +3 -3
  126. package/ui/core/static.mjs +36 -6
  127. package/ui/core/transform.mjs +64 -149
  128. package/ui/core/validate.mjs +20 -9
  129. package/ui/garden/article-content.mjs +98 -0
  130. package/ui/garden/catalog.mjs +21 -427
  131. package/ui/garden/check.mjs +18 -60
  132. package/ui/garden/file-block.mjs +1 -1
  133. package/ui/garden/file-paths.mjs +8 -6
  134. package/ui/garden/parse.mjs +19 -182
  135. package/ui/garden/relations.mjs +1 -1
  136. package/ui/garden/snippets.mjs +12 -153
  137. package/ui/garden/source-icon.mjs +17 -9
  138. package/ui/garden/word-count.mjs +16 -85
  139. package/ui/index.mjs +1 -5
  140. package/ui/preview/dist/garden-ui.css +4300 -11
  141. package/ui/preview/dist/garden-ui.esm.js +446 -418
  142. package/ui/preview/dist/garden-ui.iife.js +446 -418
  143. package/ui/preview/index.tsx +31 -98
  144. package/ui/preview/site-config.ts +4 -0
  145. package/ui/prompt/build.mjs +1 -4
  146. package/ui/prompt/recipes/code-walkthrough.md +17 -12
  147. package/ui/prompt/recipes/compare.md +14 -10
  148. package/ui/prompt/recipes/compose.md +3 -3
  149. package/ui/prompt/recipes/converter.md +17 -14
  150. package/ui/prompt/recipes/data-chart.md +9 -8
  151. package/ui/prompt/recipes/inspect-grid.md +9 -8
  152. package/ui/prompt/recipes/param-bench.md +17 -12
  153. package/ui/prompt/recipes/plan.md +4 -3
  154. package/ui/prompt/recipes/stepper.md +18 -16
  155. package/ui/prompt/recipes/trace.md +20 -18
  156. package/ui/prompt/rules.md +26 -133
  157. package/ui/prompt/studio.md +3 -18
  158. package/ui/react/CatalogPage.tsx +19 -21
  159. package/ui/react/recipes.ts +3 -3
  160. package/ui/react/runtime.tsx +23 -2
  161. package/ui/react/ui.css +17 -11
  162. package/vite.config.ts +16 -3
  163. package/.agents/skills/garden-interactive-chart/SKILL.md +0 -84
  164. package/.agents/skills/garden-interactive-chart/references/shell.html +0 -49
  165. package/.agents/skills/garden-interactive-chart/references/style.md +0 -61
  166. package/.agents/skills/garden-ui/SKILL.md +0 -125
  167. package/app/components/UiBlock.tsx +0 -23
  168. package/app/components/WidgetChart.tsx +0 -224
  169. package/app/lib/generated-content.ts +0 -385
  170. package/docs/handbook/components/card.md +0 -67
  171. package/docs/handbook/components/chart.md +0 -38
  172. package/docs/handbook/components/choice.md +0 -42
  173. package/docs/handbook/components/compare.md +0 -53
  174. package/docs/handbook/components/file.md +0 -29
  175. package/docs/handbook/components/html.md +0 -49
  176. package/docs/handbook/components/interactive.md +0 -48
  177. package/docs/handbook/components/list.md +0 -65
  178. package/docs/handbook/components/relations.md +0 -95
  179. package/docs/handbook/components/stat.md +0 -39
  180. package/docs/handbook/components/timeline.md +0 -37
  181. package/docs/handbook/en/components/card.md +0 -67
  182. package/docs/handbook/en/components/chart.md +0 -38
  183. package/docs/handbook/en/components/choice.md +0 -42
  184. package/docs/handbook/en/components/compare.md +0 -53
  185. package/docs/handbook/en/components/file.md +0 -29
  186. package/docs/handbook/en/components/html.md +0 -49
  187. package/docs/handbook/en/components/interactive.md +0 -44
  188. package/docs/handbook/en/components/list.md +0 -65
  189. package/docs/handbook/en/components/relations.md +0 -95
  190. package/docs/handbook/en/components/stat.md +0 -39
  191. package/docs/handbook/en/components/timeline.md +0 -37
  192. package/docs/handbook/en/reference/card.md +0 -85
  193. package/docs/handbook/en/reference/chart.md +0 -68
  194. package/docs/handbook/en/reference/choice.md +0 -69
  195. package/docs/handbook/en/reference/compare.md +0 -59
  196. package/docs/handbook/en/reference/file.md +0 -50
  197. package/docs/handbook/en/reference/html.md +0 -62
  198. package/docs/handbook/en/reference/interactive.md +0 -71
  199. package/docs/handbook/en/reference/list.md +0 -72
  200. package/docs/handbook/en/reference/relations.md +0 -113
  201. package/docs/handbook/en/reference/stat.md +0 -60
  202. package/docs/handbook/en/reference/timeline.md +0 -56
  203. package/docs/handbook/reference/card.md +0 -85
  204. package/docs/handbook/reference/chart.md +0 -68
  205. package/docs/handbook/reference/choice.md +0 -69
  206. package/docs/handbook/reference/compare.md +0 -59
  207. package/docs/handbook/reference/file.md +0 -50
  208. package/docs/handbook/reference/html.md +0 -62
  209. package/docs/handbook/reference/interactive.md +0 -71
  210. package/docs/handbook/reference/list.md +0 -72
  211. package/docs/handbook/reference/relations.md +0 -113
  212. package/docs/handbook/reference/stat.md +0 -60
  213. package/docs/handbook/reference/timeline.md +0 -56
  214. package/editors/dist/vscode/garden-ui-0.1.1.vsix +0 -0
  215. package/templates/skills-en/garden-interactive-chart/SKILL.md +0 -84
  216. package/templates/skills-en/garden-interactive-chart/references/shell.html +0 -49
  217. package/templates/skills-en/garden-interactive-chart/references/style.md +0 -61
  218. package/templates/skills-en/garden-ui/SKILL.md +0 -125
@@ -9,28 +9,27 @@ order: 2
9
9
  在 Garden 里写图表、指标或交互组件不用记标签语法。你在正文写一句自然语言想法,Agent 按站点里的 skill 把它编译成组件,提交时再由同一套命令检查。
10
10
 
11
11
  > [!IMPORTANT] 人和 Agent 用同一套工具
12
- > Agent 找块用 `npx garden ui scan`,写回用 `npx garden ui apply`,自查用 `npx garden ui check`;作者提交时 pre-commit 钩子运行的也是 `npx garden ui check`。检查失败时打印的提示词,就是发给 Agent 的下一步指令。
12
+ > Agent 找块用 `npx garden ui scan`,写回用 `npx garden ui apply`,自查用 `npx garden ui check`;作者提交时 pre-commit 钩子运行的也是 `npx garden ui check`。检查失败时给出的技能调用短指令,就是发给 Agent 的下一步。
13
13
 
14
14
  ## 1. 写一句想法
15
15
 
16
- 在想放组件的位置写一个不带名字的 `garden` 围栏,只写想让读者做什么、看到什么,不用写组件名:
16
+ 在想放组件的位置写一个 `garden compose` 围栏,只写想让读者做什么、看到什么,不用写组件名:
17
17
 
18
18
  ````markdown
19
- ```garden
19
+ ```garden compose
20
20
  让读者拖动每天写的字数和每周写几天,看写完一篇 8000 字的长文要几周。
21
21
  ```
22
22
  ````
23
23
 
24
- 草稿(`draft: true`)里可以保留未编译的想法;非草稿文章里还有未编译的想法时,`npx garden ui check` 和 `npx garden check` 都会报 `garden-idea` 错误。Agent 会根据内容把想法编译成 `garden compose`、`card`、`stat`、`compare` 等内置组件,或者在一段话就能说清时直接写回普通段落。
24
+ 未编译的想法使用同一个 `garden compose` 入口。`npx garden ui check` 和 `npx garden check` 对草稿与已发布稿件都检查并报告 `compose-uncompiled`。Agent 在 Compose 内组合正文、资源、图形和交互;如果一段普通文字更清楚,也可以直接写回段落。
25
25
 
26
- ## 2. 随包安装的三个 skill
26
+ ## 2. 随包安装的两个 skill
27
27
 
28
- 三个 skill 存放在站点根目录的 `.agents/skills/` 下。`npx hd-garden init` 建站时会自动安装,首次运行 `npx garden sync` 或 `npx garden dev` 时会补齐缺失的 skill,运行 `npx garden skill` 可手动重装。
28
+ 两个 skill 存放在站点根目录的 `.agents/skills/` 下。`npx hd-garden init` 建站时会自动安装,首次运行 `npx garden sync` 或 `npx garden dev` 时会递归更新引擎管理的 skill(本地修改先备份到 `.garden/skill-backups/`),运行 `npx garden skill` 可手动重装。
29
29
 
30
30
  | Skill 名称 | 触发话术示例 | 执行操作 |
31
31
  | :--- | :--- | :--- |
32
- | `garden-ui` | 「编译这篇:content/posts/writing-pace.md」「重编译 writing-pace」或直接粘贴修复提示词 | 扫描 `uncompiled`、`stale`、`error` 状态的块,按规则生成组件并用 `npx garden ui apply` 写回;说「这篇哪里适合交互」则进入只读建议模式,最多挑出 5 处可直接粘贴的想法草稿 |
33
- | `garden-interactive-chart` | 组件目录表达不了的画布动画或模拟 | 在文章同名目录下编写独立 `.html` 文件,正文中只用 `garden html` 围栏嵌入 |
32
+ | `garden-compose` | 「编译这篇:content/posts/writing-pace.md」「重编译 writing-pace」或直接粘贴修复提示词 | 扫描 `uncompiled`、`error` 状态的块,按规则生成组件并用 `npx garden ui apply` 写回;说「这篇哪里适合交互」则进入只读建议模式,最多挑出 5 处可直接粘贴的想法草稿 |
34
33
  | `garden-post-review` | 「审稿:content/posts/writing-pace.md」 | 先修 `npx garden check` 报出的结构错误,再按图表规范修交互块,最后通读全文只给修改建议而不改稿 |
35
34
 
36
35
  ## 3. `garden ui` 子命令与整篇检查
@@ -49,19 +48,17 @@ order: 2
49
48
 
50
49
  ## 4. 提交前检查与修复提示词
51
50
 
52
- 首次运行 `npx garden sync` 或 `npx garden dev` 时,Garden 会在 `.git/hooks/pre-commit` 写入 `exec npx --no-install garden ui check --staged --quiet`(若已有其他钩子则不覆盖,只提示需添加的命令)。`--staged` 直接通过 `git show :<路径>` 读取暂存区内容,失败时输出文件行号、诊断码和一段修复提示词:
51
+ 首次运行 `npx garden sync` 或 `npx garden dev` 时,Garden 会在 `.git/hooks/pre-commit` 写入 `exec npx --no-install garden ui check --staged --quiet`(若已有其他钩子则不覆盖,只提示需添加的命令)。`--staged` 直接通过 `git show :<路径>` 读取暂存区内容,失败时输出文件行号、诊断码和调用项目技能的短指令:
53
52
 
54
53
  ```console
55
- content/posts/writing-pace.md:9 - garden-idea 还有没编译的想法
54
+ content/posts/writing-pace.md:9 - compose-uncompiled 还有没编译的 compose 想法
56
55
 
57
- ──────────────────────── 发给 AI 的修复提示词 ────────────────────────
58
- 请处理下面 Garden 博文里列出的块:没编译的想法要编译,有错误的交互块要修好。
59
- ……
56
+ 请调用 garden-compose skill(.agents/skills/garden-compose/SKILL.md),修复以上错误块后重新校验。
60
57
  ```
61
58
 
62
- - 提示词同时写入 `.garden/ui-fix-prompt.md`,系统有 `pbcopy`、`wl-copy`、`xclip`、`xsel` 或 `clip` 时自动复制到剪贴板;传入 `--no-copy` 或设置 `GARDEN_UI_NO_COPY=1` 可关闭自动复制。
63
- - 需要把提示词发给无法读取本地仓库的网页端聊天窗口时,运行 `npx garden ui check <稿件.md> --standalone`,提示词末尾会附上完整的 `npx garden ui prompt` 组件规则(单次最多附 10 个问题块的原文)。
64
- - 交互块里写错标签名(如把 `<Slider>` 写成 `<Slidr>`)也会报 `ui-component` 并指到具体行号;确实要先带病提交时可用 `git commit --no-verify`。
59
+ - 默认只给出文件、行号、错误码和调用项目 `garden-compose` skill 的短指令。不写提示词文件、不复制剪贴板、不调用模型;已有提示词文件保持不变。
60
+ - 只有确需独立导出时,显式运行 `npx garden ui check <稿件.md> --out .garden/export.md --standalone`。`--standalone` 仅为导出文件附加完整规则,单独使用不会创建文件。
61
+ - 交互块里写错标签名(如把 `<Slider>` 写成 `<Slidr>`)也会报 `ui-component` 并指到具体行号。
65
62
  - 需要重装钩子时运行 `npx garden hooks`(加 `--force` 覆盖已有钩子);不想自动安装钩子时设置 `GARDEN_SKIP_HOOKS=1`。
66
63
 
67
64
  ## 5. 用一句话生成代码对比
@@ -75,12 +72,12 @@ pages:
75
72
  title: "用 Markdown 写丨推送之后网站自己更新"
76
73
  ```
77
74
 
78
- ```garden
75
+ ```garden compose
79
76
  和上一版比:标题原来用句号和换行分两行,现在改成用「丨」分行。
80
77
  ```
81
78
  ````
82
79
 
83
- Agent 按 `garden-ui` skill 会把这个想法块替换成一段紧挨着完整代码的 `diff` 围栏。页面渲染时会把完整代码和 `diff` 合成一个带「代码 / 对比上一版」切换按钮的代码框,手写 `diff` 的规则见 [写文章与随想](/garden/writing)。
80
+ Agent 按 `garden-compose` skill 会把这个想法块替换成一段紧挨着完整代码的 `diff` 围栏。页面渲染时会把完整代码和 `diff` 合成一个带「代码 / 对比上一版」切换按钮的代码框,手写 `diff` 的规则见 [写文章与随想](/garden/writing)。
84
81
 
85
82
  ## 6. 在编辑器里插入、预览,再交给 skill 编译
86
83
 
@@ -95,16 +92,16 @@ npx garden editors install --typora
95
92
 
96
93
  装好之后,一篇组件通常是这四步:
97
94
 
98
- 1. **插入想法。** 在要放组件的位置运行「插入 Garden 块」(VS Code / Cursor 的快捷键是 macOS `Cmd+Alt+I`,Windows / Linux `Ctrl+Alt+I`)。Typora 里输入 `/` 后选 `/garden`,下一层列表每一项有一张小预览图;命令的快捷键在 Windows / Linux 是 `Ctrl+Alt+I`,macOS 需要在「设置 → 快捷键」里自己录。插入的是给 `garden-ui` skill 编译的想法围栏,例如选「资源卡」得到:
95
+ 1. **插入想法。** 在要放组件的位置运行「插入 Garden 块」(VS Code / Cursor 的快捷键是 macOS `Cmd+Alt+I`,Windows / Linux `Ctrl+Alt+I`)。Typora 里输入 `/` 后选 `/garden`,下一层列表每一项有一张小预览图;命令的快捷键在 Windows / Linux 是 `Ctrl+Alt+I`,macOS 需要在「设置 → 快捷键」里自己录。插入的是给 `garden-compose` skill 编译的想法围栏,例如选「资源卡」得到:
99
96
 
100
97
  ````markdown
101
- ```garden
98
+ ```garden compose
102
99
  做成资源卡。一篇论文、一个仓库或一本书,读者需要标题、链接和一句说明。请写上链接、标题、一句说明。
103
100
  ```
104
101
  ````
105
102
  2. **预览。** 打开 Markdown 预览,或在 Typora 里把光标移出围栏。`intent` 显示成想法卡片;skill 写回 `ui` 之后,预览画成和博客一样的组件。错误会标在源码上(VS Code / Cursor 的「问题」面板和 CodeLens)。
106
103
  3. **看清单。** 命令「查看组件清单」,或在终端运行 `npx garden ui catalog` 打开 `.garden/ui-catalog.html`。清单里的「用它开始」把配方插进当前稿件,适合已经知道要用哪一种组件的时候。
107
- 4. **编译。** 「复制编译提示词」。中文站点得到 `编译这篇:<相对路径>`,英文站点得到 `Compile this post: <相对路径>`。把这句话发给 `garden-ui` skill。Agent 用 `npx garden ui scan` 定位,用 `npx garden ui prompt` 读规则,用 `npx garden ui apply` 写回。插件不调用模型。
104
+ 4. **编译。** 「复制编译提示词」。中文站点得到 `编译这篇:<相对路径>`,英文站点得到 `Compile this post: <相对路径>`。把这句话发给 `garden-compose` skill。Agent 用 `npx garden ui scan` 定位,用 `npx garden ui prompt` 读规则,用 `npx garden ui apply` 写回。插件不调用模型。
108
105
 
109
106
  **Typora 的前提。** 先安装 [typora-community-plugin](https://github.com/typora-community-plugin/typora-community-plugin/blob/main/docs/en-us/user-guide/1a-installation.md)。`npx garden editors install --typora` 把插件复制到 `~/.typora/community-plugins/plugins/hedon954.garden-intelligent-ui/`(macOS 同时写到 `~/Library/Application Support/abnerworks.Typora/plugins/plugins/hedon954.garden-intelligent-ui/`),然后在「设置 → 已安装插件」里勾选 Garden Intelligent UI。升级 Typora 会覆盖社区框架,需要重装框架后再勾选。没找到 `code` 或 `cursor` 时,用扩展视图的 Install from VSIX 选择 `.garden/editors/vscode/` 里的文件。安装细节见 [语法检查与快捷输入](/garden/workflow)。
110
107
 
@@ -113,7 +110,7 @@ npx garden editors install --typora
113
110
  不借助 AI 手写组件时,可以直接使用包内自带的模板与代码片段:
114
111
 
115
112
  - `make new` 创建的草稿底部自带一段 `<!-- 组件速查 ... -->` 注释,包含想法块和各个组件的示例,写完可直接删掉。
116
- - `templates/garden-blocks.md` 汇总了想法块与各个组件的适用场景(`when` / `whenNot`)和可复制示例;macOS 与 Typora / Alfred 用户可导入 `templates/garden-snippets.plist`,输入 `;gidea`(或 `;garden想法`)、`;gcard`、`;gstat`、`;gcompare`、`;gtimeline`、`;gchart`、`;gcompose`、`;ghtml`、`;ginteractive`、`;gfile`、`;grel`、`;glist`、`;gchoice` 即可展开对应围栏。`;gcompose` 展开的是带一句白话的 `garden compose`。
113
+ - `templates/garden-blocks.md` 提供统一 Compose 入口的示例;macOS 与 Typora / Alfred 用户可导入 `templates/garden-snippets.plist`,输入 `;gcompose` 展开带一句白话的 Compose 围栏。
117
114
  - 编辑器插件的用法见上一节。`npx garden ui catalog` 在本地生成 `.garden/ui-catalog.html` 离线组件画廊。
118
115
 
119
116
  ## 8. 可选的独立管理后台
@@ -1,17 +1,19 @@
1
1
  ---
2
- title: 说明图(compose)
3
- navTitle: 说明图
4
- description: 在文章里写几句白话,让 AI 拼出静态说明图。
2
+ title: 内容、布局与交互(compose)
3
+ navTitle: Compose
4
+ description: 在同一个作者入口组合文章内容、布局、资源与交互。
5
5
  section: components
6
6
  order: 36
7
7
  badge: compose
8
8
  ---
9
9
 
10
- 写文章想画一张结构图时,输入 `/garden` 选「compose(想法)」。文章里会插入一个 `garden compose` 围栏。你在里面用白话写清结构,再对 AI 说「编译这篇」,AI 就会把这句话留在 `<intent>` 里,并用 Markdown 叶子和组件标签拼出静态说明图。
10
+ `garden compose` 是唯一的 Garden 作者入口。在围栏内组合 Markdown、安全 HTML 内容岛、布局、资源、文件、关系图、选择卡与 Play 交互。具体能力、内容边界和默认样式见[组件参考](/garden/reference/compose),完整可用属性以 `npx garden ui schema` 为准。
11
+
12
+ 需要 AI 生成结构图时,输入 `/garden` 选「compose(想法)」。文章里会插入一个 `garden compose` 围栏。你在里面用白话写清结构,再对 AI 说「编译这篇」,AI 就会把这句话留在 `<intent>` 里,并用 Markdown 叶子和组件标签拼出静态说明图。
11
13
 
12
14
  ## 怎么写
13
15
 
14
- 围栏里只写你想让读者看见的结构,不要写样式。
16
+ 先说明读者应当看见的关系和层级,再选择布局与必要样式。也可以直接写组件;不要把通用 HTML/CSS 当成所有组件的属性契约。
15
17
 
16
18
  把四件事写清楚:
17
19
 
@@ -20,7 +22,7 @@ badge: compose
20
22
  - **谁连谁**:谁先到谁、从一处散开,还是几处收到一起。没有先后顺序,就直接写「这几块没有先后」。
21
23
  - **哪块是重点**:直接点名,比如「中间那列是重点」「下面一行才是重点」。
22
24
 
23
- 不要写颜色、圆角、灰胶囊、字重、间距、阴影、要不要撑满。外观由组件默认样式决定,写了反而乱。
25
+ 先说明视觉关系与重点,再使用受支持的属性表达必要样式。默认样式不保证复刻参考图,必须检查真实排版。
24
26
 
25
27
  **完整标签与属性**见 [组件参考 · compose](/garden/reference/compose);**全部图标名**见 [compose 图标](/garden/reference/compose-icons)。
26
28
 
@@ -120,7 +122,7 @@ Role 在中间,把用户和权限接起来。Role 是重点。
120
122
  - `{#if …}{:else}{/if}`、`{#each … as item, i}{/each}` 控制流
121
123
  - 小写控件:`<slider>`、`<choice>`、`<button>`、`<pie>` / `<chart>`、`<stat>`
122
124
 
123
- 旧的 `garden interactive` 与 PascalCase 仅作兼容。完整映射见仓库 `docs/compose-dil.md`。
125
+ 作者标签使用小写目录;`@body` 声明状态,不写内部组件 IR。完整语法见仓库 `docs/compose-dil.md`。
124
126
 
125
127
  ```garden compose #compose-play-demo
126
128
  caption: 拧一下席位,看月费。
@@ -202,3 +204,10 @@ intent: |
202
204
  <stat label="预测最佳时间" value={best} />
203
205
  ```
204
206
 
207
+
208
+ ## 自定义文字与背景颜色
209
+
210
+ `color` 设置文字颜色(子内容继承,可在子级覆盖);`backgroundColor` 设置当前容器背景(不继承)。支持 CSS 命名色、`transparent`、`currentColor`、#RGB/#RGBA/#RRGGBB/#RRGGBBAA、rgb()/rgba()/hsl()/hsla()(含 alpha);不接受 url()、var()、calc()、任意 CSS 声明或 style。未指定时保留原 tone / 主题配色。背景可用透明度,不改变字体家族。
211
+
212
+ 静态:box/card、row/stack/columns/grid/grid-item、pill/band、group/field/header/footer/figure、title/text/caption/label/prose/badge、kpi/stat、list、table/tr/th/td/thead/tbody。Play:stack/columns/card/caption/badge/stat/table;两项颜色必须写字面量。静态的 `background` 仍是已有语义 token。图表的 palette/tone API 不变,不能把 color 当系列颜色。显式颜色不会自动切换深色主题,作者需检查对比度。
213
+
@@ -9,7 +9,7 @@ order: 45
9
9
  图片单独成段时会包进图框,并在下方显示图注。
10
10
 
11
11
  - **什么时候用**:这张图属于文章,读者需要看到图下说明。
12
- - **什么时候不用**:只是装饰时,把 `alt` 写成以 `image`、`截图` 或 `img` 开头的占位词,这样不会出现图注。要按部分点开说明时用[说明图](/garden/components/compose);要提供下载时用[文件下载与预览](/garden/components/file)。
12
+ - **什么时候不用**:只是装饰时,把 `alt` 写成以 `image`、`截图` 或 `img` 开头的占位词,这样不会出现图注。要按部分点开说明时用[说明图](/garden/components/compose);要提供下载时用[文件下载与预览](/garden/components/compose)。
13
13
 
14
14
  长文 `content/posts/my-post.md` 的配图放在同名目录 `content/posts/my-post/`。正文用 Markdown 图片语法引用,地址写成 `./my-post/diagram.svg`,方括号里的 `alt` 写成图注。
15
15
 
@@ -9,7 +9,7 @@ order: 43
9
9
  单独占一段的网址,或链接末尾紧跟 `{card}`,会渲染成链接卡片(同站与外站同一套逻辑)。正文里带标题的普通链接不会变成卡片,例如 [Typora](https://typora.io/):外站只在文字前加站点 Favicon,右上角标 `↗`,图标与第一个字留在同一行;同站标题链接仍在站内跳转。
10
10
 
11
11
  - **什么时候用**:希望读者点开之前先看到网站名、标题和简介。
12
- - **什么时候不用**:句子里只要标出出处时用[来源胶囊](/garden/components/source);要自己写几条要点时用[知识卡片](/garden/components/card)。
12
+ - **什么时候不用**:句子里只要标出出处时用[来源胶囊](/garden/components/source);要自己写几条要点时用[知识卡片](/garden/components/compose)。
13
13
 
14
14
  ## 单独一行的网址
15
15
 
@@ -43,7 +43,7 @@ https://spec.commonmark.org/
43
43
 
44
44
  `{card}` 写在代码里会原样显示,例如 `[文字](https://example.com){card}`。标记和 `)` 之间有空格时也不会变成卡片。同站与外站的跳链共用同一套卡片路径。
45
45
 
46
- 构建时读取正文里的 `{card}` 链接,以及单独成段的网址,把对方页面的标题、简介和封面记入 `link-assets.json`(同站与外站同一套抓取;HTML meta refresh 会跟着跳到目标页再读 OG)。抓取失败就沿用上次的结果,构建不会因此中断。只刷新这些信息时运行 `npx garden links`。离线构建时把 `GARDEN_OFFLINE` 设为 `1` 会跳过拉取。
46
+ 构建时读取正文里的 `{card}` 链接,以及单独成段的网址,把对方页面的标题、简介和封面记入 `.garden/link-assets.json`(同站与外站同一套抓取;HTML meta refresh 会跟着跳到目标页再读 OG)。抓取失败就沿用上次的结果,构建不会因此中断。只刷新这些信息时运行 `npx garden links`。离线构建时把 `GARDEN_OFFLINE` 设为 `1` 会跳过拉取。
47
47
 
48
48
  随想 Front Matter 里的 `type: link` 用你写的 `title`、`description` 和 `image`,字段见[写文章与随想](/garden/writing)。
49
49
 
@@ -1,221 +1,13 @@
1
1
  ---
2
2
  title: 组件总览
3
3
  navTitle: 组件总览
4
- description: garden 围栏的效果预览,以及链接卡片、来源胶囊和本地图片。
4
+ description: 组件总览
5
5
  section: components
6
6
  order: 30
7
7
  ---
8
8
 
9
- ## [知识卡片 · card](/garden/components/card)
9
+ 文章布局、富文本、语义场景与交互说明统一使用一个 `garden compose` 围栏。在入口内部选择并组合组件;普通 Markdown 已能表达清楚时不用增加组件。
10
10
 
11
- ```garden card
12
- title: SQLite WAL 写入模式
13
- url: https://www.sqlite.org/wal.html
14
- meta: 文档说明 · sqlite.org
15
- description: 把修改先顺序追加到预写日志,读操作继续访问原数据库页,减少读写互斥等待。
16
- points:
17
- - 写入只追加到 `-wal` 文件末尾,不需要在事务提交时原地覆盖数据页。
18
- - 读事务记录当前末尾偏移量即可看到一致快照,不会阻塞并发写入。
19
- ```
20
-
21
- ## [数字指标 · stat](/garden/components/stat)
22
-
23
- ```garden stat
24
- items:
25
- - label: 正文列宽
26
- value: "740"
27
- unit: px
28
- caption: 默认阅读列宽度
29
- - label: 宽图上限
30
- value: "1040"
31
- unit: px
32
- caption: 左右各最多外扩 150px
33
- - label: 宽表上限
34
- value: "1340"
35
- unit: px
36
- caption: 左右各最多外扩 300px
37
- ```
38
-
39
- ## [并排对比 · compare](/garden/components/compare)
40
-
41
- ```garden compare
42
- items:
43
- - title: 写一句话说明改了什么
44
- text: 想法块紧跟在完整代码下面,AI 把它换成 diff,页面合成「代码 / 对比上一版」。
45
- - title: 手写 diff
46
- text: 完整代码下面紧跟一段 diff。
47
- ```
48
-
49
- ## [时间线 · timeline](/garden/components/timeline)
50
-
51
- ```garden timeline
52
- items:
53
- - date: 步骤 1
54
- title: 同步内容与静态资源
55
- text: 校验 Front Matter、复制图片附件并生成搜索索引与 RSS。
56
- - date: 步骤 2
57
- title: 构建静态站点产物
58
- text: 把全部路由预渲染到静态目录。
59
- ```
60
-
61
- ## [条形图表 · chart](/garden/components/chart)
62
-
63
- ```garden chart
64
- title: 三种版面区域的宽度上限
65
- xLabel: 版面区域
66
- yLabel: 最大宽度
67
- unit: px
68
- data:
69
- - x: 普通正文列
70
- y: 740
71
- - x: 宽幅配图区
72
- y: 1040
73
- - x: 多列宽表格
74
- y: 1340
75
- ```
76
-
77
- ## [说明图 · compose](/garden/components/compose)
78
-
79
- ```garden compose
80
- <intent>
81
- 上面一行是交付顺序:理解需求、设计方案、开发上线。下面一行才是要强调的决策循环:提出假设、低成本验证、迭代或放弃。上面是背景,下面是重点。
82
- </intent>
83
- <row align="center">
84
- <title align="center">理解需求</title>
85
- <arrow dir="right"/>
86
- <title align="center">设计方案</title>
87
- <arrow dir="right"/>
88
- <title align="center">开发上线</title>
89
- </row>
90
- <divider/>
91
- <row align="center">
92
- <pill tone="muted">提出假设</pill>
93
- <arrow dir="right"/>
94
- <pill tone="muted">低成本验证</pill>
95
- <arrow dir="right"/>
96
- <pill tone="muted">迭代或放弃</pill>
97
- </row>
98
- ```
99
-
100
- ## [嵌入网页片段 · html](/garden/components/html)
101
-
102
- ```garden html
103
- title: 字符长度小工具
104
- code: |
105
- <!doctype html>
106
- <html lang="zh-CN">
107
- <head>
108
- <meta charset="utf-8" />
109
- <style>
110
- body { margin: 0; padding: 16px 18px; font: 14px/1.6 system-ui, sans-serif; color: #1b1a18; background: #faf9f5; }
111
- input { width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1px solid #d5d1c8; border-radius: 6px; font: inherit; background: #fff; color: #1b1a18; }
112
- .meta { margin-top: 10px; color: #6e6b64; font-variant-numeric: tabular-nums; }
113
- strong { color: #1b1a18; }
114
- </style>
115
- </head>
116
- <body>
117
- <input id="txt" value="把文章放在自己的 Git 仓库里,推送后自动构建。" aria-label="输入示例文本" />
118
- <div class="meta">当前字符数:<strong id="count">23</strong> 字</div>
119
- <script>
120
- const input = document.getElementById("txt");
121
- const count = document.getElementById("count");
122
- input.addEventListener("input", () => { count.textContent = String(input.value.length); });
123
- </script>
124
- </body>
125
- </html>
126
- ```
127
-
128
- ## [可调公式与参数 · interactive](/garden/components/interactive)
129
-
130
- ```garden compose #overview-reading
131
- caption: 示例:按字数和阅读速度估算阅读时间。
132
- ---
133
- <State words={6000} speed={400} />
134
- <Let minutes={round(words / speed)} />
135
-
136
- <Slider bind="words" label="正文字数" min={1000} max={20000} step={500} unit="字" />
137
- <Slider bind="speed" label="阅读速度" min={200} max={800} step={50} unit="字/分钟" />
138
-
139
- <Stat label="预计阅读时间" value={minutes} unit="分钟" />
140
- ```
141
-
142
- ## [文件下载与预览 · file](/garden/components/file)
143
-
144
- ```garden file
145
- src: ./components/file/checklist.md
146
- title: 发布前检查清单
147
- note: 可点击「预览」在当前页展开阅读,或直接下载原文件
148
- ```
149
-
150
- ## [关系图 · relations](/garden/components/relations)
151
-
152
- ```garden relations
153
- items:
154
- - title: 选书
155
- text: 定下这个月读什么
156
- - title: 共读
157
- text: 每周读完约定的章节
158
- - title: 讨论
159
- text: 见面聊各自的看法
160
- - title: 复盘
161
- text: 记下下次要改的地方
162
- links:
163
- - from: 1
164
- to: 2
165
- - from: 2
166
- to: 3
167
- - from: 3
168
- to: 4
169
- - from: 4
170
- to: 1
171
- - from: 3
172
- to: 1
173
- style: dashed
174
- label: 影响选书
175
- ```
176
-
177
- ## [图标列表 · list](/garden/components/list)
178
-
179
- ```garden list
180
- items:
181
- - icon: search
182
- text: 搜索这个月的书名
183
- - icon: eye
184
- text: 看了 3 篇书评
185
- - icon: heart
186
- text: 收藏了活动页面
187
- - icon: chat
188
- text: 在群里问能不能只听不说
189
- ```
190
-
191
- ## [选择卡 · choice](/garden/components/choice)
192
-
193
- ```garden choice
194
- title: 下个月在哪里见面?
195
- items:
196
- - icon: idea
197
- value: ¥40 / 人
198
- text: 街角咖啡馆,含一杯饮料
199
- label: 更看重氛围
200
- reply: 选了咖啡馆。我们会提前订好靠窗的长桌。
201
- - icon: book
202
- value: 免费
203
- text: 社区图书馆活动室,需提前预约
204
- label: 更看重安静
205
- reply: 选了图书馆。我们会在月初提交预约。
206
- none:
207
- label: 都不合适 / 说不清
208
- reply: 没关系,我们会在群里再列几个场地。
209
- ```
210
-
211
- ## [链接卡片 · {card}](/garden/components/link-card)
212
-
213
- [KaTeX 支持的函数](https://katex.org/docs/supported.html){card}
214
-
215
- ## [来源胶囊 · {source}](/garden/components/source)
216
-
217
- 引自维基百科 [wikipedia.org](https://en.wikipedia.org/wiki/Book_discussion_club){source}
218
-
219
- ## [本地图片](/garden/components/image)
220
-
221
- ![正文列、宽图区与宽表区](./assets/reading-layout.svg)
11
+ - [Compose](/garden/components/compose)
12
+ - [Compose reference](/garden/reference/compose)
13
+ - [Icons](/garden/reference/compose-icons)
@@ -38,6 +38,17 @@ jobs:
38
38
  steps:
39
39
  - uses: actions/checkout@v7
40
40
 
41
+ - name: Restore generated Garden caches
42
+ uses: actions/cache@v4
43
+ with:
44
+ path: |
45
+ .garden/image-sizes.json
46
+ .garden/link-assets.json
47
+ public/link-assets
48
+ key: ${{ runner.os }}-garden-generated-v1-${{ github.ref_name }}-${{ github.run_id }}
49
+ restore-keys: |
50
+ ${{ runner.os }}-garden-generated-v1-${{ github.ref_name }}-
51
+
41
52
  - uses: actions/setup-node@v7
42
53
  with:
43
54
  node-version: 22
@@ -13,24 +13,23 @@ You do not need to memorize component tags to add charts, metrics, or interactiv
13
13
 
14
14
  ## 1. Write a One-sentence Idea
15
15
 
16
- Place an unnamed `garden` fence where the component belongs and state what the reader should do and see, without naming a component:
16
+ Place a `garden compose` fence where the component belongs and state what the reader should do and see, without naming a component:
17
17
 
18
18
  ````markdown
19
- ```garden
19
+ ```garden compose
20
20
  Let the reader drag daily word count and writing days per week to see how many weeks an 8,000-word article takes.
21
21
  ```
22
22
  ````
23
23
 
24
- Draft posts (`draft: true`) may keep uncompiled idea fences; in non-draft posts, both `npx garden ui check` and `npx garden check` report a `garden-idea` error. Depending on the content, the Agent compiles the idea into a built-in component (`garden compose`, `card`, `stat`, `compare`, and others) or replaces it with plain prose when a paragraph is clearer.
24
+ Uncompiled requests use the same `garden compose` entry. Both `npx garden ui check` and `npx garden check` report `compose-uncompiled`, including in drafts. The Agent composes prose, resources, graphics and interactions inside Compose, or replaces the request with plain prose when that is clearer.
25
25
 
26
- ## 2. Three Bundled Skills
26
+ ## 2. Two Bundled Skills
27
27
 
28
- Three skills live in `.agents/skills/` at the root of the site repository. `npx hd-garden init` installs them when creating a site, the first `npx garden sync` or `npx garden dev` fills in any missing skill files, and `npx garden skill` reinstalls them on demand.
28
+ Two skills live in `.agents/skills/` at the root of the site repository. `npx hd-garden init` installs them when creating a site, the first `npx garden sync` or `npx garden dev` recursively updates managed skill files, backing up local edits under `.garden/skill-backups/`, and `npx garden skill` reinstalls them on demand.
29
29
 
30
30
  | Skill Name | Example Trigger Prompt | What It Does |
31
31
  | :--- | :--- | :--- |
32
- | `garden-ui` | "Compile this post: content/posts/writing-pace.md", "Recompile writing-pace", or pasting a fix prompt | Scans `uncompiled`, `stale`, and `error` blocks, generates components, and writes them back via `npx garden ui apply`; asking where interactive blocks fit runs read-only suggestion mode and returns up to 5 ready-to-paste idea fences |
33
- | `garden-interactive-chart` | Canvas animations or simulations beyond the built-in component catalog | Writes a standalone `.html` file inside the post's sidecar directory and embeds it in the post with a `garden html` fence |
32
+ | `garden-compose` | "Compile this post: content/posts/writing-pace.md", "Recompile writing-pace", or pasting a fix prompt | Scans `uncompiled` and `error` blocks, generates components, and writes them back via `npx garden ui apply`; asking where interactive blocks fit runs read-only suggestion mode and returns up to 5 ready-to-paste idea fences |
34
33
  | `garden-post-review` | "Review post: content/posts/writing-pace.md" | Fixes structural errors reported by `npx garden check`, repairs interactive blocks against the chart rules, and reads the full post to offer editorial suggestions without rewriting prose |
35
34
 
36
35
  ## 3. `garden ui` Subcommands and Post Checks
@@ -49,19 +48,17 @@ Authors and Agents run the same `garden ui` subcommands; when an idea fence has
49
48
 
50
49
  ## 4. Pre-commit Hook and Fix Prompts
51
50
 
52
- On the first `npx garden sync` or `npx garden dev` run, Garden writes `exec npx --no-install garden ui check --staged --quiet` to `.git/hooks/pre-commit` (if a custom hook already exists, it leaves the file untouched and prints the line to add). `--staged` reads staged content directly via `git show :<path>` and, on failure, prints the line numbers, diagnostic codes, and a fix prompt:
51
+ On the first `npx garden sync` or `npx garden dev` run, Garden writes `exec npx --no-install garden ui check --staged --quiet` to `.git/hooks/pre-commit` (if a custom hook already exists, it leaves the file untouched and prints the line to add). `--staged` reads staged content directly via `git show :<path>` and, on failure, prints line numbers, diagnostic codes, and a short instruction to load the project skill:
53
52
 
54
53
  ```console
55
- content/posts/writing-pace.md:9 - garden-idea uncompiled idea remaining
54
+ content/posts/writing-pace.md:9 - compose-uncompiled uncompiled compose idea remaining
56
55
 
57
- ──────────────────────── Fix prompt for AI ────────────────────────
58
- Handle the Garden post blocks listed below: compile uncompiled ideas, and fix interactive blocks that have errors.
59
- ……
56
+ Use garden-compose skill (.agents/skills/garden-compose/SKILL.md), fix the failing blocks, then recheck.
60
57
  ```
61
58
 
62
- - The prompt is written to `.garden/ui-fix-prompt.md` and copied to the clipboard when `pbcopy`, `wl-copy`, `xclip`, `xsel`, or `clip` is available; pass `--no-copy` or set `GARDEN_UI_NO_COPY=1` to disable clipboard copying.
63
- - When pasting into a web chat that cannot read your local repository, run `npx garden ui check <post.md> --standalone` to append the full `npx garden ui prompt` rules to the prompt (including source fences for up to 10 failing blocks).
64
- - A misspelled tag inside an interactive block (such as `<Slidr>` instead of `<Slider>`) reports `ui-component` with its exact line number; to commit anyway, run `git commit --no-verify`.
59
+ - Defaults show file/line/error diagnostics and a short instruction to load the project `garden-compose` skill. No file is written, no clipboard access occurs, and no model is called. Existing prompt files are untouched.
60
+ - Only when a self-contained export is required, run `npx garden ui check <post.md> --out .garden/export.md --standalone`. `--standalone` enriches that explicit export; alone it does not create a file.
61
+ - A misspelled tag inside an interactive block (such as `<Slidr>` instead of `<Slider>`) reports `ui-component` with its exact line number.
65
62
  - Run `npx garden hooks` to reinstall the hook (pass `--force` to overwrite an existing hook), or set `GARDEN_SKIP_HOOKS=1` to skip automatic hook installation.
66
63
 
67
64
  ## 5. Generate a Code Diff from One Sentence
@@ -75,12 +72,12 @@ pages:
75
72
  title: "Write in Markdown | Push to Update the Site"
76
73
  ```
77
74
 
78
- ```garden
75
+ ```garden compose
79
76
  Compared with the previous version: split the title into two lines with " | " instead of a period and newline.
80
77
  ```
81
78
  ````
82
79
 
83
- Following the `garden-ui` skill, the Agent replaces that idea fence with a `diff` fence right below the code block. The page merges the adjacent code and `diff` fences into a single code frame with a toggle between the full code and the diff; see [Writing Posts & Thoughts](/garden/en/writing) for the hand-written `diff` format.
80
+ Following the `garden-compose` skill, the Agent replaces that idea fence with a `diff` fence right below the code block. The page merges the adjacent code and `diff` fences into a single code frame with a toggle between the full code and the diff; see [Writing Posts & Thoughts](/garden/en/writing) for the hand-written `diff` format.
84
81
 
85
82
  ## 6. Insert, Preview, and Compile from the Editor
86
83
 
@@ -95,10 +92,10 @@ npx garden editors install --typora
95
92
 
96
93
  A component then takes four steps:
97
94
 
98
- 1. **Insert an idea.** Where the component should go, run the Garden insert command (`Cmd+Alt+I` on macOS, `Ctrl+Alt+I` on Windows and Linux in VS Code / Cursor). In Typora, type `/` and choose `/garden` to open a picker with a small preview image on each row; the command shortcut is `Ctrl+Alt+I` on Windows and Linux, and macOS needs a shortcut recorded under Settings, Keyboard Shortcuts. The insertion is a plain `garden` fence whose body tells the `garden-ui` skill which component to compile and which facts to include.
95
+ 1. **Insert an idea.** Where the component should go, run the Garden insert command (`Cmd+Alt+I` on macOS, `Ctrl+Alt+I` on Windows and Linux in VS Code / Cursor). In Typora, type `/` and choose `/garden` to open a picker with a small preview image on each row; the command shortcut is `Ctrl+Alt+I` on Windows and Linux, and macOS needs a shortcut recorded under Settings, Keyboard Shortcuts. The insertion is a plain `garden` fence whose body tells the `garden-compose` skill which component to compile and which facts to include.
99
96
  2. **Preview.** Open the Markdown preview, or in Typora move the cursor out of the fence. An `intent` block shows as an idea card. After the skill writes a `ui` block, the preview matches the blog. VS Code / Cursor also report errors in Problems and in the CodeLens above the block.
100
97
  3. **Open the catalog.** Use the catalog command, or run `npx garden ui catalog` and open `.garden/ui-catalog.html`. Starting from a recipe inserts it at the cursor when you already know which component you want.
101
- 4. **Compile.** Copy the compile prompt. On an English site the clipboard text is `Compile this post:` plus the post path. Paste it to the `garden-ui` skill. The Agent locates the block with `npx garden ui scan`, reads the rules with `npx garden ui prompt`, and writes it back with `npx garden ui apply`. The plugin does not call a model.
98
+ 4. **Compile.** Copy the compile prompt. On an English site the clipboard text is `Compile this post:` plus the post path. Paste it to the `garden-compose` skill. The Agent locates the block with `npx garden ui scan`, reads the rules with `npx garden ui prompt`, and writes it back with `npx garden ui apply`. The plugin does not call a model.
102
99
 
103
100
  **Typora prerequisite.** Install [typora-community-plugin](https://github.com/typora-community-plugin/typora-community-plugin/blob/main/docs/en-us/user-guide/1a-installation.md) first. `npx garden editors install --typora` copies the plugin to `~/.typora/community-plugins/plugins/hedon954.garden-intelligent-ui/`. On macOS it also copies to `~/Library/Application Support/abnerworks.Typora/plugins/plugins/hedon954.garden-intelligent-ui/`. Enable Garden Intelligent UI under Settings, Installed plugins. A Typora upgrade overwrites the community framework; reinstall the framework, then enable the plugin again. If `code` or `cursor` is not on `PATH`, use Install from VSIX in the Extensions view and select the file under `.garden/editors/vscode/`. Install details are in [Checks & Shortcuts](/garden/en/workflow).
104
101
 
@@ -107,7 +104,7 @@ A component then takes four steps:
107
104
  When writing components by hand without AI, you can use the templates and snippets shipped in the package:
108
105
 
109
106
  - Every draft created by `make new` includes an HTML comment at the bottom with copy-ready examples for idea fences and the built-in components; delete the comment whenever you are done.
110
- - `templates/garden-blocks.md` lists `when` / `whenNot` guidance and copyable templates for every block; macOS, Typora, and Alfred users can import `templates/garden-snippets.plist` to expand `;gidea`, `;gcard`, `;gstat`, `;gcompare`, `;gtimeline`, `;gchart`, `;gcompose`, `;ghtml`, `;ginteractive`, `;gfile`, `;grel`, `;glist`, and `;gchoice`. `;gcompose` expands to a `garden compose` fence with one sentence.
107
+ - `templates/garden-blocks.md` supplies examples for the single Compose entry. macOS, Typora and Alfred users can import `templates/garden-snippets.plist` and expand `;gcompose` to a Compose fence containing one author sentence.
111
108
  - Editor plugin usage is in the previous section. `npx garden ui catalog` writes an offline component catalog at `.garden/ui-catalog.html`.
112
109
 
113
110
  ## 8. Optional Standalone Admin
@@ -1,17 +1,19 @@
1
1
  ---
2
- title: Diagrams (compose)
3
- navTitle: Diagrams
4
- description: Write a short plain-language structure; AI compiles it into a static diagram.
2
+ title: Content, layout, and interactions (compose)
3
+ navTitle: Compose
4
+ description: Combine article content, layout, resources, and interactions through one author entry.
5
5
  section: components
6
6
  order: 36
7
7
  badge: compose
8
8
  ---
9
9
 
10
- To draw a structure diagram in a post, type `/garden` and pick **compose (idea)**. That inserts a `garden compose` fence. Write the structure in plain language, then ask the AI to compile the post. It keeps your words in `<intent>` and builds the diagram from Markdown leaves plus catalog tags.
10
+ `garden compose` is the single Garden author entry. Inside it, combine Markdown, safe HTML content islands, layout, resources, files, relations, selectable cards, and Play interactions. See the [component reference](/garden/en/reference/compose) for capabilities, content boundaries, and contextual defaults; `npx garden ui schema` is authoritative for supported fields.
11
+
12
+ To ask AI for a structure diagram, type `/garden` and pick **compose (idea)**. That inserts a `garden compose` fence. Write the structure in plain language, then ask the AI to compile the post. It keeps your words in `<intent>` and builds the diagram from Markdown leaves plus catalog tags.
11
13
 
12
14
  ## How to write
13
15
 
14
- Describe the structure readers should see. Do not prescribe styles.
16
+ Describe the relationships and hierarchy readers should see before choosing layout and necessary styles. You can also write components directly; do not assume every component accepts arbitrary HTML/CSS properties.
15
17
 
16
18
  Cover four things:
17
19
 
@@ -20,7 +22,7 @@ Cover four things:
20
22
  - **What connects to what**: who reaches whom, fans out, or joins. If there is no order, say so.
21
23
  - **Which block is the focus**: name it (“the middle column”, “the lower row”).
22
24
 
23
- Do not specify colors, radii, pill chrome, weight, gaps, shadows, or full-bleed. Defaults own appearance.
25
+ Describe the visual relationships and desired emphasis. Defaults are a starting point, not a substitute for checking alignment and hierarchy. Explicit styling must use supported controls.
24
26
 
25
27
  **Every tag and shared token**: [compose reference](/garden/en/reference/compose). **Every icon name**: [compose icons](/garden/en/reference/compose-icons).
26
28
 
@@ -189,3 +191,10 @@ intent: |
189
191
  <stat label="Predicted best time" value={best} />
190
192
  ```
191
193
 
194
+
195
+ ## Custom text and background colors
196
+
197
+ `color` controls text (inherited; children may override). `backgroundColor` paints only the current surface (not inherited). Both accept literal CSS named colors, transparent/currentColor, 3/4/6/8-digit hex, rgb/rgba/hsl/hsla with optional alpha. URLs, var(), calc(), declarations and arbitrary style are rejected by the same SSR/browser validator. Defaults preserve tone and theme; no font-family change. Explicit colors are not automatically dark-mode adapted: check contrast.
198
+
199
+ Static primitives: box/card, row/stack/columns/grid/grid-item, pill/band, group/field/header/footer/figure, title/text/caption/label/prose/badge, kpi/stat, list, table/tr/th/td/thead/tbody. Play: stack/columns/card/caption/badge/stat/table. Colors must be literals. Existing static `background` semantic tokens and chart palette/series-tone APIs are unchanged; these props do not set chart series colors.
200
+
@@ -9,7 +9,7 @@ order: 45
9
9
  An image that is its own paragraph is wrapped in a figure, with a caption underneath.
10
10
 
11
11
  - **When to use**: The figure belongs in the article, and the reader should see a caption under it.
12
- - **When to skip**: For a decorative image, start the alt text with `image` or `img` so there is no caption. Use an [explanation diagram](/garden/en/components/compose) when each step needs its own note, or [file download](/garden/en/components/file) when the reader should download the file.
12
+ - **When to skip**: For a decorative image, start the alt text with `image` or `img` so there is no caption. Use an [explanation diagram](/garden/en/components/compose) when each step needs its own note, or [file download](/garden/en/components/compose) when the reader should download the file.
13
13
 
14
14
  For a post at `content/posts/my-post.md`, put images in `content/posts/my-post/`. Reference them with Markdown image syntax, with the address `./my-post/diagram.svg` and the caption in the alt text.
15
15
 
@@ -9,7 +9,7 @@ order: 43
9
9
  A URL on its own paragraph, or a link followed immediately by `{card}`, renders as a link card (same-site and external share one path). An ordinary titled link in prose stays a link, such as [Typora](https://typora.io/): an external one shows the site favicon before the text and a `↗` at the upper right; a titled same-site link still navigates in place.
10
10
 
11
11
  - **When to use**: The reader should see the site name, title, and summary before opening the page.
12
- - **When to skip**: Use a [source chip](/garden/en/components/source) to cite a site inside a sentence, or a [reference card](/garden/en/components/card) when you are writing the takeaways yourself.
12
+ - **When to skip**: Use a [source chip](/garden/en/components/source) to cite a site inside a sentence, or a [reference card](/garden/en/components/compose) when you are writing the takeaways yourself.
13
13
 
14
14
  ## A URL on its own line
15
15
 
@@ -43,7 +43,7 @@ When the paragraph is only the marked link, that line becomes the card:
43
43
 
44
44
  `{card}` inside code stays as written, for example `[text](https://example.com){card}`. A space between `)` and the marker also leaves an ordinary link. Same-site and external jump links share one card path.
45
45
 
46
- At build time, Garden reads `{card}` links and URLs that stand alone as a paragraph, and stores the page title, summary, and image in `link-assets.json` (same-site and external share one fetch path; HTML meta refresh is followed to the target before reading OG). A failed fetch keeps the previous record, and the build continues. Run `npx garden links` to refresh just these records. Set `GARDEN_OFFLINE` to `1` to skip the fetch during an offline build.
46
+ At build time, Garden reads `{card}` links and URLs that stand alone as a paragraph, and stores the page title, summary, and image in `.garden/link-assets.json` (same-site and external share one fetch path; HTML meta refresh is followed to the target before reading OG). A failed fetch keeps the previous record, and the build continues. Run `npx garden links` to refresh just these records. Set `GARDEN_OFFLINE` to `1` to skip the fetch during an offline build.
47
47
 
48
48
  A thought can also carry an external link in Front Matter with `type: link`, using the `title`, `description`, and `image` you write. Those fields are in [Writing Posts & Thoughts](/garden/en/writing).
49
49