mdx-artifacts 0.1.2 → 0.2.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.
Files changed (141) hide show
  1. package/README.md +211 -59
  2. package/README.zh-CN.md +299 -42
  3. package/agents/AGENTS.snippet.md +21 -10
  4. package/artifact-docs/examples/commentable-feedback.mdx +76 -70
  5. package/artifact-docs/examples/decision-matrix.mdx +122 -50
  6. package/artifact-docs/examples/layout-composition.mdx +106 -128
  7. package/artifact-docs/examples/streamlit-style-mixed.mdx +100 -85
  8. package/dist/lib/cli/{build.js → commands/build.js} +2 -2
  9. package/dist/lib/cli/{components.js → commands/components.js} +19 -3
  10. package/dist/lib/cli/{dev.js → commands/dev.js} +2 -2
  11. package/dist/lib/cli/commands/interactions.d.ts +2 -0
  12. package/dist/lib/cli/commands/interactions.js +280 -0
  13. package/dist/lib/cli/commands/review.d.ts +1 -0
  14. package/dist/lib/cli/commands/review.js +171 -0
  15. package/dist/lib/cli/commands/scaffold.d.ts +16 -0
  16. package/dist/lib/cli/commands/scaffold.js +440 -0
  17. package/dist/lib/cli/commands/validate.d.ts +18 -0
  18. package/dist/lib/cli/commands/validate.js +311 -0
  19. package/dist/lib/cli/config/config.d.ts +2 -0
  20. package/dist/lib/cli/{config.js → config/config.js} +3 -2
  21. package/dist/lib/cli/{types.d.ts → config/types.d.ts} +2 -1
  22. package/dist/lib/cli/{vite-artifact.d.ts → dev-server/vite-artifact.d.ts} +3 -3
  23. package/dist/lib/cli/{vite-artifact.js → dev-server/vite-artifact.js} +170 -10
  24. package/dist/lib/cli/diagnostics/diagnostics.d.ts +11 -0
  25. package/dist/lib/cli/diagnostics/diagnostics.js +1 -0
  26. package/dist/lib/cli/index.js +39 -18
  27. package/dist/lib/cli/mdx/sortable-list.d.ts +14 -0
  28. package/dist/lib/cli/mdx/sortable-list.js +520 -0
  29. package/dist/lib/cli/resources/resource-policy.d.ts +15 -0
  30. package/dist/lib/cli/resources/resource-policy.js +46 -0
  31. package/dist/lib/cli/resources/safe-path.d.ts +13 -0
  32. package/dist/lib/cli/resources/safe-path.js +55 -0
  33. package/dist/lib/cli/services/interaction-service.d.ts +40 -0
  34. package/dist/lib/cli/services/interaction-service.js +226 -0
  35. package/dist/lib/cli/services/review.d.ts +43 -0
  36. package/dist/lib/cli/{review.js → services/review.js} +34 -172
  37. package/dist/lib/react/{components → composites/comparison-set}/ComparisonSet.d.ts +1 -1
  38. package/dist/lib/react/{components → composites/comparison-set}/ComparisonSet.js +3 -3
  39. package/dist/lib/react/composites/comparison-set/index.d.ts +2 -0
  40. package/dist/lib/react/composites/comparison-set/index.js +1 -0
  41. package/dist/lib/react/composites/content-set/ContentItem.d.ts +37 -0
  42. package/dist/lib/react/composites/content-set/ContentItem.js +49 -0
  43. package/dist/lib/react/composites/content-set/index.d.ts +2 -0
  44. package/dist/lib/react/composites/content-set/index.js +1 -0
  45. package/dist/lib/react/{components → composites/export-panel}/ExportPanel.js +2 -2
  46. package/dist/lib/react/composites/export-panel/index.d.ts +2 -0
  47. package/dist/lib/react/composites/export-panel/index.js +1 -0
  48. package/dist/lib/react/{components → composites/section}/Section.js +1 -1
  49. package/dist/lib/react/composites/section/index.d.ts +2 -0
  50. package/dist/lib/react/composites/section/index.js +1 -0
  51. package/dist/lib/react/index.d.ts +36 -31
  52. package/dist/lib/react/index.js +18 -15
  53. package/dist/lib/react/interactions/artifact-state/index.d.ts +1 -0
  54. package/dist/lib/react/interactions/artifact-state/index.js +1 -0
  55. package/dist/lib/react/{components → interactions/comments}/Comments.d.ts +2 -2
  56. package/dist/lib/react/{components → interactions/comments}/Comments.js +3 -3
  57. package/dist/lib/react/interactions/comments/index.d.ts +1 -0
  58. package/dist/lib/react/interactions/comments/index.js +1 -0
  59. package/dist/lib/react/interactions/sortable-list/SortableList.d.ts +29 -0
  60. package/dist/lib/react/interactions/sortable-list/SortableList.js +282 -0
  61. package/dist/lib/react/interactions/sortable-list/index.d.ts +1 -0
  62. package/dist/lib/react/interactions/sortable-list/index.js +1 -0
  63. package/dist/lib/react/layout/layout-primitives/index.d.ts +2 -0
  64. package/dist/lib/react/layout/layout-primitives/index.js +1 -0
  65. package/dist/lib/react/legacy/LegacyContentComponents.d.ts +65 -0
  66. package/dist/lib/react/legacy/LegacyContentComponents.js +26 -0
  67. package/dist/lib/react/mdx-components.d.ts +5 -0
  68. package/dist/lib/react/mdx-components.js +38 -0
  69. package/dist/lib/react/{components → primitives/annotated-code}/AnnotatedCode.d.ts +1 -1
  70. package/dist/lib/react/{components → primitives/annotated-code}/AnnotatedCode.js +5 -5
  71. package/dist/lib/react/primitives/annotated-code/index.d.ts +2 -0
  72. package/dist/lib/react/primitives/annotated-code/index.js +1 -0
  73. package/dist/lib/react/primitives/callout/Callout.d.ts +11 -0
  74. package/dist/lib/react/{components → primitives/callout}/Callout.js +9 -6
  75. package/dist/lib/react/primitives/callout/index.d.ts +2 -0
  76. package/dist/lib/react/primitives/callout/index.js +1 -0
  77. package/dist/lib/react/primitives/code-block/CodeBlock.d.ts +20 -0
  78. package/dist/lib/react/primitives/code-block/CodeBlock.js +32 -0
  79. package/dist/lib/react/primitives/code-block/index.d.ts +2 -0
  80. package/dist/lib/react/primitives/code-block/index.js +1 -0
  81. package/dist/lib/react/primitives/code-surface/CodeSurface.d.ts +11 -0
  82. package/dist/lib/react/primitives/code-surface/CodeSurface.js +34 -0
  83. package/dist/lib/react/primitives/code-surface/index.d.ts +2 -0
  84. package/dist/lib/react/primitives/code-surface/index.js +1 -0
  85. package/dist/lib/react/primitives/diff-block/DiffBlock.js +25 -0
  86. package/dist/lib/react/primitives/diff-block/index.d.ts +2 -0
  87. package/dist/lib/react/primitives/diff-block/index.js +1 -0
  88. package/dist/lib/react/{components → primitives/inline-text}/InlineText.d.ts +4 -2
  89. package/dist/lib/react/primitives/inline-text/InlineText.js +28 -0
  90. package/dist/lib/react/primitives/inline-text/index.d.ts +2 -0
  91. package/dist/lib/react/primitives/inline-text/index.js +1 -0
  92. package/dist/lib/react/primitives/markdown-body/MarkdownBody.d.ts +9 -0
  93. package/dist/lib/react/primitives/markdown-body/MarkdownBody.js +49 -0
  94. package/dist/lib/react/primitives/markdown-body/index.d.ts +2 -0
  95. package/dist/lib/react/primitives/markdown-body/index.js +1 -0
  96. package/dist/lib/react/primitives/severity-badge/index.d.ts +2 -0
  97. package/dist/lib/react/primitives/severity-badge/index.js +1 -0
  98. package/dist/lib/react/registry.d.ts +10 -0
  99. package/dist/lib/react/registry.js +505 -210
  100. package/dist/lib/react/styles.css +490 -38
  101. package/docs/cli-structure.md +141 -0
  102. package/docs/component-protocol.md +199 -33
  103. package/docs/component-taxonomy.md +40 -4
  104. package/docs/design.md +42 -21
  105. package/docs/design.zh-CN.md +41 -21
  106. package/docs/naming.md +17 -7
  107. package/docs/releasing.md +132 -0
  108. package/docs/testing.md +35 -10
  109. package/package.json +9 -7
  110. package/dist/lib/cli/config.d.ts +0 -2
  111. package/dist/lib/cli/review.d.ts +0 -33
  112. package/dist/lib/cli/scaffold.d.ts +0 -1
  113. package/dist/lib/cli/scaffold.js +0 -56
  114. package/dist/lib/cli/validate.d.ts +0 -6
  115. package/dist/lib/cli/validate.js +0 -79
  116. package/dist/lib/react/components/Callout.d.ts +0 -9
  117. package/dist/lib/react/components/CodeBlock.d.ts +0 -10
  118. package/dist/lib/react/components/CodeBlock.js +0 -28
  119. package/dist/lib/react/components/DecisionMatrix.d.ts +0 -16
  120. package/dist/lib/react/components/DecisionMatrix.js +0 -27
  121. package/dist/lib/react/components/DiffBlock.js +0 -24
  122. package/dist/lib/react/components/InlineText.js +0 -18
  123. package/dist/lib/react/components/MarkdownBody.d.ts +0 -7
  124. package/dist/lib/react/components/MarkdownBody.js +0 -36
  125. package/dist/lib/react/components/OptionGrid.d.ts +0 -13
  126. package/dist/lib/react/components/OptionGrid.js +0 -21
  127. /package/dist/lib/cli/{build.d.ts → commands/build.d.ts} +0 -0
  128. /package/dist/lib/cli/{components.d.ts → commands/components.d.ts} +0 -0
  129. /package/dist/lib/cli/{dev.d.ts → commands/dev.d.ts} +0 -0
  130. /package/dist/lib/cli/{types.js → config/types.js} +0 -0
  131. /package/dist/lib/cli/{artifact-state.d.ts → state/artifact-state.d.ts} +0 -0
  132. /package/dist/lib/cli/{artifact-state.js → state/artifact-state.js} +0 -0
  133. /package/dist/lib/react/{components → composites/export-panel}/ExportPanel.d.ts +0 -0
  134. /package/dist/lib/react/{components → composites/section}/Section.d.ts +0 -0
  135. /package/dist/lib/react/{components → interactions/artifact-state}/ArtifactState.d.ts +0 -0
  136. /package/dist/lib/react/{components → interactions/artifact-state}/ArtifactState.js +0 -0
  137. /package/dist/lib/react/{components → layout/layout-primitives}/Layout.d.ts +0 -0
  138. /package/dist/lib/react/{components → layout/layout-primitives}/Layout.js +0 -0
  139. /package/dist/lib/react/{components → primitives/diff-block}/DiffBlock.d.ts +0 -0
  140. /package/dist/lib/react/{components → primitives/severity-badge}/SeverityBadge.d.ts +0 -0
  141. /package/dist/lib/react/{components → primitives/severity-badge}/SeverityBadge.js +0 -0
package/README.md CHANGED
@@ -4,22 +4,31 @@ Interactive MDX artifacts for agents.
4
4
 
5
5
  MDX Artifacts lets an agent write structured MDX with reusable React components, then compile it into a standalone HTML artifact that can be opened locally in a browser.
6
6
 
7
- The goal is not to make agents generate raw HTML from scratch. The goal is to make agents call stable, high-level components:
7
+ The goal is not to make agents generate raw HTML from scratch or write a React app DSL inside MDX. The goal is to keep the source Markdown-native while using stable, high-level components as semantic islands:
8
8
 
9
9
  ```mdx
10
- import { DecisionMatrix, ExportPanel } from "mdx-artifacts/react";
11
-
12
- <DecisionMatrix
13
- question="Should stage one focus on a Vite single HTML artifact?"
14
- options={[
15
- {
16
- name: "Vite single HTML artifact",
17
- pros: ["Short feedback loop", "Fits one-off tool artifacts"],
18
- cons: ["No docs-site navigation yet"],
19
- verdict: "Recommended for stage one"
20
- }
21
- ]}
22
- />
10
+ import { ContentSet, ExportPanel } from "mdx-artifacts/react";
11
+
12
+ <ContentSet
13
+ id="set.stage-one"
14
+ title="Should stage one focus on a Vite single HTML artifact?"
15
+ columns={3}
16
+ >
17
+ <ContentSet.Item
18
+ id="vite"
19
+ title="Vite single HTML artifact"
20
+ badge="Recommended"
21
+ tone="positive"
22
+ emphasis="primary"
23
+ summary="Validate the shortest Markdown-native source to interactive HTML loop first."
24
+ >
25
+ ### Tradeoffs
26
+
27
+ - Short feedback loop
28
+ - Fits one-off tool artifacts
29
+ - No docs-site navigation yet
30
+ </ContentSet.Item>
31
+ </ContentSet>
23
32
 
24
33
  <ExportPanel
25
34
  title="Export decision"
@@ -30,21 +39,93 @@ import { DecisionMatrix, ExportPanel } from "mdx-artifacts/react";
30
39
 
31
40
  The CLI turns that MDX file into a self-contained HTML file.
32
41
 
42
+ ## Authoring Philosophy
43
+
44
+ MDX Artifacts is a Markdown-native artifact system.
45
+
46
+ Source files should read like documents. Output files should behave like interactive HTML artifacts. Components should mark semantic islands inside the document, not replace the document with a large JSX configuration object.
47
+
48
+ Use this product boundary when making component and authoring decisions:
49
+
50
+ - Prefer native Markdown or MDX children for narrative content, explanations, long descriptions, lists, and reviewable prose.
51
+ - Prefer semantic components for structured workflow regions such as decisions, comparisons, code review, export handoff, and interactive state.
52
+ - Prefer props for stable ids, short labels, enum-like settings, layout controls, machine-readable values, and genuinely structured data.
53
+ - Do not move all semantics into an implicit Markdown parser. Headings, lists, and tables should not secretly become component data unless a component explicitly owns that slot.
54
+ - Do not turn artifact sources into React application code. If an artifact needs arbitrary stateful UI, project-specific CSS, or app-level interaction, use a dedicated web artifact builder or a project local component.
55
+
56
+ This means new component APIs should usually be children-first for human-readable content and props-first for machine-readable configuration.
57
+
58
+ ## When To Use It
59
+
60
+ Use MDX Artifacts when an agent should create a local, reviewable MDX artifact with semantic React components, structured validation, and a standalone HTML output.
61
+
62
+ It is a good fit for:
63
+
64
+ - decision reports, option comparisons, code review handoffs, and implementation plans
65
+ - artifacts that should remain readable as MDX source
66
+ - workflows where agents should query component metadata and validate before build
67
+ - project-local React components that supplement, but do not replace, the MDX document
68
+
69
+ Do not use it for ordinary README files, simple notes, raw HTML pages, full web apps, or artifacts that require arbitrary application state and custom runtime code.
70
+
71
+ ## 0.2.0 Migration Notes
72
+
73
+ `DecisionMatrix` and `OptionGrid` are deprecated compatibility components. Existing MDX can still render, but new artifacts should use `ContentSet` for grouped content cards and `ContentItem` for standalone content cards.
74
+
75
+ This release makes the content authoring model more consistent: readable explanation, rationale, pros, cons, risks, and tradeoffs should live in MDX children instead of object-array props.
76
+
77
+ Use:
78
+
79
+ ```mdx
80
+ <ContentSet id="set.path" title="Choose the implementation path" columns={3}>
81
+ <ContentSet.Item
82
+ id="path-a"
83
+ title="Path A"
84
+ badge="Recommended"
85
+ tone="positive"
86
+ emphasis="primary"
87
+ summary="Best first step."
88
+ >
89
+ ### Tradeoffs
90
+
91
+ - Keeps the MDX source readable
92
+ - Lets long rationale stay in Markdown
93
+ </ContentSet.Item>
94
+ </ContentSet>
95
+ ```
96
+
97
+ Do not use `DecisionMatrix`, `DecisionMatrix.Option`, `OptionGrid`, `OptionGrid.Item`, or `options={[...]}` for new artifacts. The `validate` command warns when deprecated compatibility components or older props such as `question`, `name`, `intent`, `pros`, `cons`, `risks`, `confidence`, `verdict`, or `tradeoffs` are found.
98
+
33
99
  ## Current Scope
34
100
 
35
101
  The first stage focuses on the smallest useful loop:
36
102
 
37
- 1. `artifact-docs/**/*.mdx` is the source format.
38
- 2. `src/react` provides high-level artifact components.
39
- 3. `src/cli` provides `init`, `components`, `validate`, `dev`, `build`, and narrow review-state commands.
40
- 4. `components` exposes component props and examples for agents.
103
+ 1. The configured `docsDir` is the MDX source root. The default is `artifact-docs/`.
104
+ 2. `mdx-artifacts/react` exports high-level artifact components.
105
+ 3. The `mdx-artifacts` CLI provides `init`, `components`, `validate`, `dev`, `build`, and narrow review-state commands.
106
+ 4. `mdx-artifacts components` exposes component props and examples for agents.
41
107
  5. `build` outputs a standalone HTML artifact.
42
108
 
43
109
  Astro is intentionally not part of the core yet. It can become a later adapter for long-lived docs sites.
44
110
 
45
- ## Install
111
+ ## Install From npm
46
112
 
47
- Install in a project that should build local artifacts:
113
+ For npm users, the shortest first run is:
114
+
115
+ ```bash
116
+ npm install --save-dev mdx-artifacts
117
+ npx mdx-artifacts init
118
+ npx mdx-artifacts validate artifact-docs/examples/hello.mdx
119
+ npx mdx-artifacts build artifact-docs/examples/hello.mdx
120
+ ```
121
+
122
+ The final command writes:
123
+
124
+ ```text
125
+ dist/artifacts/examples/hello.html
126
+ ```
127
+
128
+ Install with pnpm in a project that should build local artifacts:
48
129
 
49
130
  ```bash
50
131
  pnpm add -D mdx-artifacts
@@ -59,30 +140,70 @@ pnpm add -Dw mdx-artifacts
59
140
  React and React DOM are peer dependencies. Modern package managers usually install them automatically for this dev-tool workflow. If peer dependency auto-install is disabled in your project, install them explicitly:
60
141
 
61
142
  ```bash
143
+ npm install --save-dev mdx-artifacts react react-dom
62
144
  pnpm add -D mdx-artifacts react react-dom
63
145
  ```
64
146
 
65
147
  Initialize a workspace:
66
148
 
67
149
  ```bash
68
- pnpm exec artifact-kit init
150
+ npx mdx-artifacts init
151
+ pnpm exec mdx-artifacts init
69
152
  ```
70
153
 
71
- This creates:
154
+ Interactive init uses numbered choices. Press Enter to accept defaults:
72
155
 
73
156
  ```text
74
- artifact-kit.config.mjs
75
- artifact-docs/examples/hello.mdx
157
+ Where should MDX artifact source files live?
158
+ 1. ./artifact-docs/ (default)
159
+ 2. Enter a custom directory
160
+ Select an option (1)
161
+
162
+ Use project-local React components?
163
+ Adds a Tailwind source directory; it does not auto-register components.
164
+ 1. No (default)
165
+ 2. Yes, choose a project-local component source directory
166
+ Select an option (1)
167
+ ```
168
+
169
+ For non-interactive setup, pass the project structure explicitly:
170
+
171
+ ```bash
172
+ pnpm exec mdx-artifacts init --yes --docs-dir docs/artifacts --components-dir artifact-components --agent codex
173
+ ```
174
+
175
+ After init, the CLI prints a summary of the selected directories, generated guidance files, and next validation/build commands. The scaffold includes:
176
+
177
+ ```text
178
+ mdx-artifacts.config.mjs
179
+ <docsDir>/examples/hello.mdx
76
180
  agents/AGENTS.snippet.md
77
181
  ```
78
182
 
79
- Build the initialized example:
183
+ `components-dir` is a project-local component source directory. It is added to `tailwindSources` for Tailwind class discovery, but it does not automatically register components or make components available through `mdx-artifacts components`.
184
+
185
+ ### Agent Guidance
186
+
187
+ `mdx-artifacts init --agent <agent>` can install project-local writing guidance for coding agents:
188
+
189
+ ```text
190
+ --agent codex .agents/skills/mdx-artifacts/SKILL.md
191
+ --agent claude-code .claude/skills/mdx-artifacts/SKILL.md
192
+ --agent cursor .cursor/rules/mdx-artifacts.mdc
193
+ --agent all all supported project-local guidance files
194
+ ```
195
+
196
+ The generated guidance tells agents when to use MDX Artifacts, where to place `.mdx` files, how to query component metadata, how to handle local resources, and to run `mdx-artifacts validate` before build. Keep the CLI registry as the source of truth for component props instead of copying long component metadata into agent instructions.
197
+
198
+ Build the initialized example. For the default init choices, the example lives under `artifact-docs/`:
80
199
 
81
200
  ```bash
82
- pnpm exec artifact-kit validate artifact-docs/examples/hello.mdx
83
- pnpm exec artifact-kit build artifact-docs/examples/hello.mdx
201
+ pnpm exec mdx-artifacts validate artifact-docs/examples/hello.mdx
202
+ pnpm exec mdx-artifacts build artifact-docs/examples/hello.mdx
84
203
  ```
85
204
 
205
+ If you initialized with a custom `--docs-dir`, use `<docsDir>/examples/hello.mdx` instead.
206
+
86
207
  Default output:
87
208
 
88
209
  ```text
@@ -94,20 +215,20 @@ dist/artifacts/examples/hello.html
94
215
  Inspect available components:
95
216
 
96
217
  ```bash
97
- pnpm exec artifact-kit components
98
- pnpm exec artifact-kit components ExportPanel
99
- pnpm exec artifact-kit components --json
218
+ pnpm exec mdx-artifacts components
219
+ pnpm exec mdx-artifacts components ExportPanel
220
+ pnpm exec mdx-artifacts components --json
100
221
  ```
101
222
 
102
223
  Build one MDX file:
103
224
 
104
225
  ```bash
105
- pnpm exec artifact-kit build artifact-docs/examples/hello.mdx
226
+ pnpm exec mdx-artifacts build artifact-docs/examples/hello.mdx
106
227
  ```
107
228
 
108
229
  ## Review State
109
230
 
110
- Artifact Kit can keep local review threads beside an MDX file while the dev server is running. Review state is stored in a sibling `.state.json` file:
231
+ MDX Artifacts can keep local review threads beside an MDX file while the dev server is running. Review state is stored in a sibling `.state.json` file:
111
232
 
112
233
  ```text
113
234
  artifact-docs/examples/hello.mdx
@@ -117,7 +238,7 @@ artifact-docs/examples/hello.state.json
117
238
  Use stable anchors in MDX so review threads can survive edits:
118
239
 
119
240
  ```mdx
120
- import { DecisionMatrix, Section } from "mdx-artifacts/react";
241
+ import { ContentSet, Section } from "mdx-artifacts/react";
121
242
 
122
243
  <Section id="section.context">
123
244
 
@@ -127,32 +248,30 @@ Native MDX prose can be reviewed through the section anchor.
127
248
 
128
249
  </Section>
129
250
 
130
- <DecisionMatrix
131
- id="decision.stage-one"
132
- question="Should this artifact use stable anchors?"
133
- options={[
134
- {
135
- id: "yes",
136
- name: "Use stable anchors",
137
- verdict: "Recommended"
138
- }
139
- ]}
140
- />
251
+ <ContentSet
252
+ id="set.stage-one"
253
+ title="Should this artifact use stable anchors?"
254
+ columns={2}
255
+ >
256
+ <ContentSet.Item id="yes" title="Use stable anchors" badge="Recommended" tone="positive" emphasis="primary">
257
+ Stable child anchors keep review threads attached across edits.
258
+ </ContentSet.Item>
259
+ </ContentSet>
141
260
  ```
142
261
 
143
262
  Agents can add a user thread, append an assistant reply, and validate that saved threads still point at anchors in the current MDX:
144
263
 
145
264
  ```bash
146
- pnpm exec artifact-kit review add artifact-docs/examples/hello.mdx \
147
- --anchor decision.stage-one \
265
+ pnpm exec mdx-artifacts review add artifact-docs/examples/hello.mdx \
266
+ --anchor set.stage-one \
148
267
  --body "Clarify this decision."
149
268
 
150
- pnpm exec artifact-kit review reply artifact-docs/examples/hello.mdx \
151
- --thread thr_decision_stage_one \
269
+ pnpm exec mdx-artifacts review reply artifact-docs/examples/hello.mdx \
270
+ --thread thr_set_stage_one \
152
271
  --body "Updated the decision copy." \
153
272
  --status resolved
154
273
 
155
- pnpm exec artifact-kit review validate artifact-docs/examples/hello.mdx
274
+ pnpm exec mdx-artifacts review validate artifact-docs/examples/hello.mdx
156
275
  ```
157
276
 
158
277
  Review commands read and write the sibling `.state.json` file for the source MDX. They do not edit the MDX source. `review validate` checks whether saved review threads still point at anchors that exist in the current MDX.
@@ -167,6 +286,18 @@ missing: 1
167
286
 
168
287
  Resolve missing anchors by restoring the old id, migrating the thread to a new anchor, or marking the thread resolved with an assistant reply that explains the structural change.
169
288
 
289
+ ## Local Resource And Security Model
290
+
291
+ MDX Artifacts is intended for local, reviewable artifacts generated inside a project workspace.
292
+
293
+ - Local resources that go through the resource policy must stay inside the project root.
294
+ - Remote URLs, `~` paths, and project-root escapes are rejected for resources that go through the resource policy.
295
+ - Today, `validate` checks configured `styles` resources; data, artifact, and component-module references can use the same policy as those features become first-class inputs.
296
+ - `tailwindSources` is for Tailwind class discovery and should point only at project-local source files. It is a config convention, not component registration.
297
+ - `componentsDir` is a source location for user-owned React components, not a component registry.
298
+ - Raw React imports are still normal MDX imports, so use project-local components only when a semantic built-in component is not enough.
299
+ - Run `mdx-artifacts validate <file.mdx>` before build to catch supported path, component, and diagnostic issues before producing HTML.
300
+
170
301
  ## Repository Development
171
302
 
172
303
  Install dependencies:
@@ -179,8 +310,8 @@ Validate and build the repository example artifact:
179
310
 
180
311
  ```bash
181
312
  pnpm check
182
- pnpm artifact:validate
183
- pnpm artifact:build
313
+ pnpm mdx-artifacts:validate
314
+ pnpm mdx-artifacts:build
184
315
  ```
185
316
 
186
317
  Develop components in Storybook:
@@ -189,45 +320,64 @@ Develop components in Storybook:
189
320
  pnpm storybook
190
321
  ```
191
322
 
192
- Storybook is only for component development. The artifact workflow is still verified through `artifact-kit validate/build`.
323
+ Storybook is only for component development. The artifact workflow is still verified through `mdx-artifacts validate/build`.
193
324
 
194
325
  Run the test baseline:
195
326
 
196
327
  ```bash
197
328
  pnpm test
198
329
  pnpm typecheck
199
- pnpm artifact:validate
330
+ pnpm mdx-artifacts:validate
331
+ ```
332
+
333
+ Run the lightweight release check before publishing or after package metadata, public docs, examples, or agent guidance changes:
334
+
335
+ ```bash
336
+ pnpm release:check
200
337
  ```
201
338
 
202
- Run the package smoke test before publishing:
339
+ Run the package smoke test before publishing or after package boundary, CLI output, config loading, scaffold, dependency, or build output changes:
203
340
 
204
341
  ```bash
205
342
  pnpm pack:smoke
206
343
  ```
207
344
 
345
+ For a final manual pre-publish check, run:
346
+
347
+ ```bash
348
+ npm pack --dry-run --cache /private/tmp/mdx-artifacts-npm-cache
349
+ ```
350
+
208
351
  ## Style Injection
209
352
 
210
- Artifact Kit injects default styles by default. Users can add brand styles through `artifact-kit.config.mjs`:
353
+ MDX Artifacts injects default styles by default. Users can add brand styles through `mdx-artifacts.config.mjs`:
211
354
 
212
355
  ```js
213
- /** @type {import("mdx-artifacts").ArtifactKitConfig} */
356
+ /** @type {import("mdx-artifacts").MdxArtifactsConfig} */
214
357
  const config = {
215
358
  docsDir: "artifact-docs",
216
359
  outDir: "dist/artifacts",
217
360
  includeDefaultStyles: true,
218
- styles: ["artifact-theme.css"]
361
+ styles: ["artifact-theme.css"],
362
+ tailwindSources: ["artifact-components/**/*.{ts,tsx}"]
219
363
  };
220
364
 
221
365
  export default config;
222
366
  ```
223
367
 
224
- Custom styles are imported after the default styles, so they can override CSS variables or `ak-*` classes. Set `includeDefaultStyles: false` to fully own the styling.
368
+ Custom styles are imported after the default styles, so they can override CSS variables or `ak-*` classes. Set `includeDefaultStyles: false` to disable MDX Artifacts default styles.
369
+
370
+ The CLI automatically registers the current MDX file as a Tailwind source, so Tailwind utility classes inside local MDX components are generated during artifact builds. Use `tailwindSources` for project-local component files that are imported by MDX and also contain Tailwind classes.
225
371
 
226
372
  ## Design Principles
227
373
 
228
374
  - Source files are MDX, not raw HTML.
375
+ - Source should stay Markdown-native; output can be richer, interactive HTML.
376
+ - Components are semantic islands in the document, not the whole authoring model.
229
377
  - Component APIs should be semantic and self-describing.
230
- - Interactive artifacts must provide an export path.
378
+ - Human-readable body content should prefer MDX children or explicit slots over long string props.
379
+ - Props should carry ids, short labels, variants, layout controls, and structured data.
380
+ - Interactive artifacts should provide an export path; `validate` warns when one is missing.
231
381
  - Bulky data should live in adjacent JSON files instead of JSX props.
232
382
  - Core components stay React/TypeScript and should be reusable from Vite, Astro, or artifact builders.
233
383
  - Tailwind is an internal styling build tool; the final artifact still inlines CSS.
@@ -242,5 +392,7 @@ Custom styles are imported after the default styles, so they can override CSS va
242
392
  - [Naming conventions](docs/naming.md)
243
393
  - [Component protocol](docs/component-protocol.md)
244
394
  - [Component taxonomy](docs/component-taxonomy.md)
395
+ - [CLI structure](docs/cli-structure.md)
245
396
  - [Testing](docs/testing.md)
397
+ - [Releasing](docs/releasing.md)
246
398
  - [Chinese README](README.zh-CN.md)