Skip to content

Commit c76a6e5

Browse files
committed
chore: restructure storybook-sync skill and add .agents/skills layout
Move skill from .claude/skills/storybook-sync-checker to .agents/skills/storybook-sync with a symlink at .claude/skills, matching the rstest repo convention. Refactor SKILL.md: move priority criteria before workflow, flesh out direct analysis steps, parameterize example commands, add issue creation step.
1 parent a08b055 commit c76a6e5

File tree

4 files changed

+59
-118
lines changed

4 files changed

+59
-118
lines changed

.claude/skills/storybook-sync-checker/SKILL.md renamed to .agents/skills/storybook-sync/SKILL.md

Lines changed: 58 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
name: storybook-sync-checker
2+
name: storybook-sync
33
internal: true
44
description: Check and analyze upstream Storybook repository changes that may need to be synced to storybook-rsbuild. Use this skill whenever the user wants to check for upstream Storybook changes, review what's new in the official Storybook repo, identify changes needing sync, or compare storybook-rsbuild against the upstream. Activate for phrases like "check upstream", "sync check", "storybook changes", "need to sync", "what changed upstream", or any mention of tracking changes from storybookjs/storybook. Even casual mentions like "anything new in storybook?" should trigger this skill.
55
---
@@ -26,63 +26,86 @@ Analyze recent changes in the official `storybookjs/storybook` repository and id
2626

2727
Both webpack5 and vite upstream variants are monitored because this repo borrows patterns from both.
2828

29-
## Important: Upstream Commit History is Noisy
29+
## Upstream Commit History is Noisy
3030

31-
The Storybook repo uses a **non-linear branching model** with frequent merge commits and automated version bumps. The bundled script already handles the most common noise:
31+
The Storybook repo uses a non-linear branching model with frequent merge commits and automated version bumps. The bundled script filters the most common noise automatically (version bump commits via `--invert-grep`, merge commits via `--no-merges`). Some noise may still slip through — NX upgrades, CI config, non-standard version bumps, reverts that cancel out.
3232

33-
- **Version bump commits** (`Bump version from "X" to "Y" [skip ci]`) are filtered out automatically. These touch every package.json but contain no meaningful code changes.
34-
- **Merge commits** are excluded via `--no-merges`. Only the actual code-change commits from feature branches are shown.
33+
**Always judge from the actual diff.** Storybook does not consistently follow conventional commits, so commit messages are unreliable for triage decisions.
3534

36-
However, some noise may still slip through:
37-
- Internal build/tooling changes (NX upgrades, CI config) that touch monitored paths
38-
- Commits that only change `package.json` version fields without the standard "Bump version" prefix
39-
- Reverts that cancel out earlier changes
35+
## Sync Priority Criteria
36+
37+
**High** — sync soon:
38+
- Bug fixes in logic that was adapted into storybook-rsbuild
39+
- Security patches
40+
- API / type / interface changes (options, preset signatures, exports)
41+
- Breaking changes or deprecations
42+
43+
**Medium** — review and decide:
44+
- New features that could benefit storybook-rsbuild users
45+
- Significant refactoring of adapted code patterns
46+
- Performance improvements in shared logic
47+
48+
**Low** — nice to know:
49+
- Minor code quality improvements
50+
- Added error handling or edge-case guards
51+
- Test changes that reveal expected behavioral contracts
4052

41-
**Critical**: Do not rely on commit messages or file lists for triage decisions. Storybook does not consistently follow conventional commits — subjects like "Build: ...", "Fix ...", "Upgrade ...", or freeform descriptions are common. The actual diff is the only reliable source of truth for judging whether a change needs to be synced. Always read the diff.
53+
**Skip**:
54+
- Webpack/Vite internal plumbing with no Rsbuild parallel (e.g. webpack plugin hooks, Vite-specific HMR wiring, Vite module graph internals)
55+
- Documentation-only changes
56+
- CI/tooling changes internal to the Storybook repo
57+
- Changes to `storybook/internal/*` APIs (these arrive via the `storybook` npm dependency, not by manual sync)
58+
- Pure test file additions with no behavioral insight
59+
- Build system changes (NX, workspace config, import rewriting) that are specific to the Storybook monorepo structure
4260

4361
## Workflow
4462

4563
### 1. Preparation
4664

47-
Generate the report filename first (anchored to system clock):
65+
Generate the report filename (anchored to system clock):
4866
```bash
4967
REPORT_NAME=$(bash <skill-dir>/scripts/fetch_upstream.sh --report-name)
5068
```
5169

5270
Determine the commit range from the user's request:
53-
- **Relative days**: "past 20 days", "last 30 days"
54-
- **Absolute date range**: "since 2025-12-01", "Dec 1 to Dec 20"
55-
- **Version tags**: "between v8.4.0 and v8.5.0", "since v8.4.0"
56-
- If unspecified, default to the last 30 days.
71+
- **Relative days**: "past 20 days", "last 30 days" → use `--days N`
72+
- **Absolute date range**: "since 2025-12-01", "Dec 1 to Dec 20" → use `--since` / `--until`
73+
- **Version tags**: "between v8.4.0 and v8.5.0" → use `--from` / `--to`
74+
- If unspecified, default to `--days 30`.
5775

5876
**Important**: For relative date ranges, always use `--days N`. The script reads the system clock to compute exact dates, avoiding date miscalculation.
5977

60-
### 2. Get commit summary and plan analysis
78+
### 2. Get commit summary and decide strategy
6179

62-
Fetch the commit list with diff line counts (lightweight — no full diffs):
80+
Fetch the commit list with diff line counts:
6381

6482
```bash
65-
bash <skill-dir>/scripts/fetch_upstream.sh --summary --days 30
83+
bash <skill-dir>/scripts/fetch_upstream.sh --summary --days <N>
6684
```
6785

6886
Output: `HASH|DATE|AUTHOR|SUBJECT|LINES_ADDED+LINES_DELETED` (one per line, oldest first).
6987

70-
Based on the commit count, decide the analysis strategy:
71-
72-
- **8 or fewer commits**: Analyze directly using `--diff-all` (no subagents needed, proceed to step 3a).
73-
- **More than 8 commits**: Use subagents for parallel analysis (proceed to step 3b).
88+
Based on the commit count:
89+
- **≤ 8 commits** → step 3a (direct analysis)
90+
- **> 8 commits** → step 3b (subagent analysis)
7491

75-
### 3a. Direct analysis (small range)
92+
### 3a. Direct analysis (≤ 8 commits)
7693

7794
```bash
78-
bash <skill-dir>/scripts/fetch_upstream.sh --diff-all --days 30
95+
bash <skill-dir>/scripts/fetch_upstream.sh --diff-all --days <N>
7996
```
8097

81-
Read through each commit's diff, compare with local code, and classify. Then go to step 4.
98+
For each commit in the output:
99+
1. **Read the diff** — this is the ground truth. Never skip a commit based on its message or file list alone.
100+
2. **Read the corresponding local source file** using the package mapping table above.
101+
3. **Classify** using the sync priority criteria above.
102+
4. **Check for revert chains** — if a commit and its revert both appear, check if the net effect is zero. If so, classify both as skip.
103+
104+
Then proceed to step 4.
82105

83-
### 3b. Batched analysis with subagents (large range)
106+
### 3b. Subagent analysis (> 8 commits)
84107

85-
**Plan batches** using the summary output:
108+
**Plan batches** using the `--summary` output:
86109

87110
1. Sum the total lines changed across all commits.
88111
2. Target 3–5 subagents. Calculate: `target_lines_per_batch = total_lines / batch_count`.
@@ -142,8 +165,6 @@ KEY_FILES: <comma-separated list of relevant changed files>
142165

143166
Save to `$REPORT_NAME` in the project root.
144167

145-
**Report template:**
146-
147168
```markdown
148169
# Storybook Upstream Sync Report
149170

@@ -182,28 +203,14 @@ Save to `$REPORT_NAME` in the project root.
182203

183204
Commits within each priority section should be in chronological order (oldest first).
184205

185-
## Sync Priority Criteria
206+
### 5. Offer to create an issue
186207

187-
**High** — sync soon:
188-
- Bug fixes in logic that was adapted into storybook-rsbuild
189-
- Security patches
190-
- API / type / interface changes (options, preset signatures, exports)
191-
- Breaking changes or deprecations
208+
After writing the report, ask the user if they want to publish it as a GitHub issue in this repository. If yes, create the issue using `gh`:
192209

193-
**Medium** — review and decide:
194-
- New features that could benefit storybook-rsbuild users
195-
- Significant refactoring of adapted code patterns
196-
- Performance improvements in shared logic
197-
198-
**Low** — nice to know:
199-
- Minor code quality improvements
200-
- Added error handling or edge-case guards
201-
- Test changes that reveal expected behavioral contracts
210+
```bash
211+
gh issue create --title "<TITLE>" --body-file "$REPORT_NAME"
212+
```
202213

203-
**Skip**:
204-
- Webpack/Vite internal plumbing with no Rsbuild parallel (e.g. webpack plugin hooks, Vite-specific HMR wiring, Vite module graph internals)
205-
- Documentation-only changes
206-
- CI/tooling changes internal to the Storybook repo
207-
- Changes to `storybook/internal/*` APIs (these arrive via the `storybook` npm dependency, not by manual sync)
208-
- Pure test file additions with no behavioral insight
209-
- Build system changes (NX, workspace config, import rewriting) that are specific to the Storybook monorepo structure
214+
**Title format**: `Storybook Sync: <range>` — where `<range>` matches the range used in the report. Examples:
215+
- Date range: `Storybook Sync: 2026-03-12 – 2026-04-11`
216+
- Version range: `Storybook Sync: v8.4.0 – v8.5.0`

.claude/skills/storybook-sync-checker/scripts/fetch_upstream.sh renamed to .agents/skills/storybook-sync/scripts/fetch_upstream.sh

File renamed without changes.

.claude/skills

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../.agents/skills

.github/workflows/storybook-frameworks-sync.yml

Lines changed: 0 additions & 67 deletions
This file was deleted.

0 commit comments

Comments
 (0)