Skip to content

Commit 6dae88d

Browse files
authored
docs(skill): correct the shape spellings and the motion-path claim (#193)
Two lines in SKILL.md made the generator write scenarios the schema rejects. `ShapeType` is externally tagged, but the skill described the parameterised variants as "star (with points, default 5)", which reads as a sibling field. `"shape": "star"` fails with `invalid type: unit variant, expected struct variant`; the correct spelling is `{"star": {"points": 6}}`. Show the literal JSON for all eight variants instead of prose. The skill also still stated that motion-path does not exist and that there is no path-following mechanism. That stopped being true with #177. Point at rules/motion-path.md and spell out the trap the old note should now be preventing: `motion-path` in `style` is dropped, `motion_path` in `animation` is the effect. A test pins the eight documented spellings and keeps a bare `star` rejected, so the wording cannot drift back.
1 parent 1276989 commit 6dae88d

4 files changed

Lines changed: 46 additions & 2 deletions

File tree

.claude/skills/rustmotion/SKILL.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,14 @@ Animates each character or word independently with staggered timing. Use `char_*
919919
| --------------- | ------------------ | ----------- |
920920
| `border-radius` | f32 | `null` |
921921

922-
**Shape types:** `rect`, `circle`, `rounded_rect`, `ellipse`, `triangle`, `star` (with `points`, default 5), `polygon` (with `sides`, default 6), `path` (with `data` SVG path string)
922+
**Shape types.** `ShapeType` is externally tagged: the plain variants are strings, the parameterised ones are single-key objects. Writing `"shape": "star"` fails with `invalid type: unit variant, expected struct variant`.
923+
924+
```json
925+
"shape": "rect" // also: circle, rounded_rect, ellipse, triangle
926+
"shape": { "star": { "points": 6 } } // default 5
927+
"shape": { "polygon": { "sides": 6 } } // default 6
928+
"shape": { "path": { "data": "M0 0 L10 10" } }
929+
```
923930

924931
**Gradient fill (root field):**
925932
```json
@@ -2350,7 +2357,9 @@ New style fields available on all components:
23502357
| ----------------- | ------ | ------- | -------------------------------------------------------- |
23512358
| `gradient-border` | object | `null` | `{ "colors": ["#f00", "#00f"], "width": 2, "angle": 0 }` — gradient-colored border ring, border-radius aware, painted instead of `border` when both are set |
23522359

2353-
`stagger` and `timeline` are **root fields** (siblings of `style`), not style fields — see [rules/component-field-placement.md](rules/component-field-placement.md). `motion-path` does not exist in the current schema (leftover from the pre-CSS `LayerStyle` model) — there is no motion-path-following mechanism today.
2360+
`stagger` and `timeline` are **root fields** (siblings of `style`), not style fields — see [rules/component-field-placement.md](rules/component-field-placement.md).
2361+
2362+
There is no `motion-path` *style* property — that name is a leftover from the pre-CSS `LayerStyle` model and was removed. To move a component along a path, use the **`motion_path` animation effect** (snake_case), which takes SVG path data and can orient the component along the tangent — see [rules/motion-path.md](rules/motion-path.md). The two spellings are one character apart and mean different things: `motion-path` in `style` is dropped, `motion_path` in `animation` works.
23542363

23552364
**Deprecated (accepted but never rendered — the validator warns):**
23562365

crates/rustmotion/src/tests.rs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,41 @@ mod component_smoke {
163163
const COMPONENT_ALIASES: &[(&str, &str)] =
164164
&[("container", "div"), ("progress_bar", "progress")];
165165

166+
/// The exact `shape` spellings SKILL.md documents must parse.
167+
///
168+
/// `ShapeType` is externally tagged, and the skill used to describe the
169+
/// parameterised variants as `star` "(with `points`)", which reads as a
170+
/// sibling field and fails with `invalid type: unit variant, expected
171+
/// struct variant`. The generator writes what the skill says, so a wrong
172+
/// line there is not a documentation nit — it is a stream of invalid
173+
/// scenarios. Pin the spellings.
174+
#[test]
175+
fn skill_documented_shape_spellings_parse() {
176+
use rustmotion_core::schema::ShapeType;
177+
178+
for spelling in [
179+
r#""rect""#,
180+
r#""circle""#,
181+
r#""rounded_rect""#,
182+
r#""ellipse""#,
183+
r#""triangle""#,
184+
r#"{ "star": { "points": 6 } }"#,
185+
r#"{ "polygon": { "sides": 6 } }"#,
186+
r#"{ "path": { "data": "M0 0 L10 10" } }"#,
187+
] {
188+
serde_json::from_str::<ShapeType>(spelling).unwrap_or_else(|e| {
189+
panic!("SKILL.md documents `{spelling}`, which does not parse: {e}")
190+
});
191+
}
192+
193+
// …and the shape the skill used to imply must still be rejected, so a
194+
// future edit cannot quietly reintroduce it.
195+
assert!(
196+
serde_json::from_str::<ShapeType>(r#""star""#).is_err(),
197+
"a bare `star` must stay an error: it is what the old wording produced"
198+
);
199+
}
200+
166201
#[test]
167202
fn all_components_serde_round_trip() {
168203
// deserialize → serialize → deserialize → serialize: the canonical

examples/cloud-iam.mp4

3.04 MB
Binary file not shown.

examples/effect-ts.mp4

3.4 MB
Binary file not shown.

0 commit comments

Comments
 (0)