diff --git a/.claude/skills/add-sparkle-component/SKILL.md b/.claude/skills/add-sparkle-component/SKILL.md index 98d83b2..23534f0 100644 --- a/.claude/skills/add-sparkle-component/SKILL.md +++ b/.claude/skills/add-sparkle-component/SKILL.md @@ -60,7 +60,7 @@ Before installing components, ensure the project has: 1. **Registry Configuration** - `components.json` with Sparkle Design registry 2. **Sparkle Config** - `sparkle.config.json` (optional but recommended) 3. **Package Manager** - npm, pnpm, yarn, or bun installed -4. **Node.js** - Version 18.0.0 or higher +4. **Node.js** - Version 18.0.0 or higher for consumer projects (sparkle-design itself is developed on 22.14.0; see `.tool-versions`) ### Validate Configuration diff --git a/.claude/skills/change-sparkle-config/SKILL.md b/.claude/skills/change-sparkle-config/SKILL.md index fdefbab..6c15fa9 100644 --- a/.claude/skills/change-sparkle-config/SKILL.md +++ b/.claude/skills/change-sparkle-config/SKILL.md @@ -7,7 +7,7 @@ description: > 書き換えて `sparkle-design-cli generate` まで実行するスキル。選択肢は Theme Settings Figma プラグインが扱える範囲(primary 7 色 / radius 8 段階 / fonts 11 種)に揃えて おり、Figma と CLI の見た目がずれません。**未導入プロジェクトの初期セットアップは - `setup-sparkle-design` を使うこと。** + `setup-sparkle-design`(internal 環境では `install-sparkle-design`)を使うこと。** 「雰囲気を変えたい」「もっとポップに」「ビジネスライクに」「高級感を出したい」 「primary を変えたい」「角丸をもっと丸く」「フォントを変えたい」「テーマを提案して」 で発動。English: "change the vibe", "make it more playful", @@ -21,7 +21,7 @@ user-invocable: true **前提**: -- プロジェクトに既に `sparkle-design` / `sparkle-design-cli` が導入済み(未導入の場合は `setup-sparkle-design` スキルを先に使うよう案内する) +- プロジェクトに既に `sparkle-design` / `sparkle-design-cli` が導入済み(未導入の場合は `setup-sparkle-design` スキル — internal 環境なら `install-sparkle-design` スキル — を先に使うよう案内する) - 書き換え可能な項目は **Sparkle Design Theme Settings Figma プラグインが扱える範囲と同一**(後述の reference 参照) --- @@ -33,7 +33,7 @@ user-invocable: true ### 実行方針 1. **前提チェック** - - カレントディレクトリに `sparkle.config.json` があるか確認。無ければ **未導入状態**。その場合は「**新規導入 + カスタムテーマ**は `setup-sparkle-design` スキルが担当する(setup 実行時に `sparkle.config.json` を編集しておけば同じテーマで導入できる)」と案内し、setup にバトンパスして中断する。 + - カレントディレクトリに `sparkle.config.json` があるか確認。無ければ **未導入状態**。その場合は「**新規導入 + カスタムテーマ**は `setup-sparkle-design` スキル(internal 環境では `install-sparkle-design` スキル)が担当する(setup 実行時に `sparkle.config.json` を編集しておけば同じテーマで導入できる)」と案内し、setup にバトンパスして中断する。 - `package.json` の `dependencies` / `devDependencies` に `sparkle-design` が含まれるか確認(pnpm workspace 等で hoist されているケースに備え、`node_modules` のパスチェックは避ける)。未導入なら setup を案内して中断。 2. **現在値を読み取り(元ファイルをスナップショット保存)** - `sparkle.config.json` の元バイト列をそのままメモリに保持(後の rollback 用)。 diff --git a/.cursor/rules/context.mdc b/.cursor/rules/context.mdc index 4b8944e..64a07c9 100644 --- a/.cursor/rules/context.mdc +++ b/.cursor/rules/context.mdc @@ -77,6 +77,13 @@ pnpm format # Prettier formatting pnpm test # Component tests ``` +### Git Safety Rules +- **Never amend + force-push**: address review feedback and mistakes with new commits +- **No direct push to `main`**: always go through a PR (admin merge required) +- **PR merges use normal merge (`--merge`)**: never squash-merge (squashing loses commits) +- **Update the lockfile whenever `package.json` changes**: CI runs `pnpm install --frozen-lockfile` and will fail otherwise +- **Use the pinned toolchain**: Node.js 22.14.0 / pnpm 10.12.4 (see `.tool-versions`; newer pnpm majors can rewrite the lockfile) + ## AI Assistance Guidelines - Refer to specific instruction files for detailed guidance: - `docs/ai-instructions/testing.md` for testing diff --git a/.cursor/rules/new-component.mdc b/.cursor/rules/new-component.mdc new file mode 100644 index 0000000..a4c74cf --- /dev/null +++ b/.cursor/rules/new-component.mdc @@ -0,0 +1,28 @@ +--- +description: Component creation process for Sparkle Design +globs: ** +alwaysApply: false +--- + +# 新規コンポーネントの作成 + +新規コンポーネントは以下の手順で作成してください。 + +1. ターミナルで`./scripts/setup.sh <コンポーネント名>`を実行します。 + - `<コンポーネント名>`は、作成するコンポーネントの名前に置き換えてください。 + - 例: `./scripts/setup.sh my-new-component` + - このスクリプトは、必要なファイルとディレクトリを自動的に生成し、`src/index.ts` への export 追加も自動で行います。 + - ただし、使えるコンポーネント名は shadcn/ui に存在するもののみになります。 +2. 生成されたディレクトリに移動します。 + - 例: `cd src/components/ui/my-new-component` +3. コンポーネントの説明を入力します。 +4. コンポーネントフォルダの `README.md` を更新します。 + - `item.json` の description を記載する + - `"use client"` の有無に応じて Client Component / Server Component 互換の記述を更新する + - Client Component の場合は個別 import パス(`sparkle-design/`)を記載する + - 実装完了後に `node scripts/generate-readmes.mjs` で再生成することもできます +5. ルートの `README.md` の「コンポーネント公開状況」を最新の状態に更新します。 + +# 生成のルール + +コメントに関するルールは `docs/ai-instructions/comment-style.md` を参照してください。 diff --git a/.github/instructions/ai-context.instructions.md b/.github/instructions/ai-context.instructions.md index 967e331..8032797 100644 --- a/.github/instructions/ai-context.instructions.md +++ b/.github/instructions/ai-context.instructions.md @@ -75,6 +75,13 @@ pnpm format # Prettier formatting pnpm test # Component tests ``` +### Git Safety Rules +- **Never amend + force-push**: address review feedback and mistakes with new commits +- **No direct push to `main`**: always go through a PR (admin merge required) +- **PR merges use normal merge (`--merge`)**: never squash-merge (squashing loses commits) +- **Update the lockfile whenever `package.json` changes**: CI runs `pnpm install --frozen-lockfile` and will fail otherwise +- **Use the pinned toolchain**: Node.js 22.14.0 / pnpm 10.12.4 (see `.tool-versions`; newer pnpm majors can rewrite the lockfile) + ## AI Assistance Guidelines - Refer to specific instruction files for detailed guidance: - `docs/ai-instructions/testing.md` for testing diff --git a/AGENTS.md b/AGENTS.md index 92371cf..4226aec 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -89,6 +89,13 @@ pnpm format # Prettier formatting pnpm test # Component tests ``` +### Git Safety Rules +- **Never amend + force-push**: address review feedback and mistakes with new commits +- **No direct push to `main`**: always go through a PR (admin merge required) +- **PR merges use normal merge (`--merge`)**: never squash-merge (squashing loses commits) +- **Update the lockfile whenever `package.json` changes**: CI runs `pnpm install --frozen-lockfile` and will fail otherwise +- **Use the pinned toolchain**: Node.js 22.14.0 / pnpm 10.12.4 (see `.tool-versions`; newer pnpm majors can rewrite the lockfile) + ## AI Assistance Guidelines - Refer to specific instruction files for detailed guidance: - `docs/ai-instructions/testing.md` for testing diff --git a/docs/ai-instructions/README.md b/docs/ai-instructions/README.md index 06dfff2..e989ce1 100644 --- a/docs/ai-instructions/README.md +++ b/docs/ai-instructions/README.md @@ -23,7 +23,6 @@ docs/ai-instructions/ |--------|-------------|------| | OpenAI Codex | `AGENTS.md` | ルートレベルの指示ファイル | | Claude Code | `CLAUDE.md` | AGENTS.mdへのシンボリックリンク | -| GitHub Copilot | `.github/copilot-instructions.md` | メイン指示ファイル | | GitHub Copilot | `.github/instructions/*.instructions.md` | スコープ付き指示ファイル | | Cursor | `.cursor/rules/*.mdc` | スコープ付きルールファイル | | Cursor | `.cursorrules` | レガシー形式(互換性用) | diff --git a/docs/ai-instructions/context.md b/docs/ai-instructions/context.md index f93e99b..53f6a6b 100644 --- a/docs/ai-instructions/context.md +++ b/docs/ai-instructions/context.md @@ -71,6 +71,13 @@ pnpm format # Prettier formatting pnpm test # Component tests ``` +### Git Safety Rules +- **Never amend + force-push**: address review feedback and mistakes with new commits +- **No direct push to `main`**: always go through a PR (admin merge required) +- **PR merges use normal merge (`--merge`)**: never squash-merge (squashing loses commits) +- **Update the lockfile whenever `package.json` changes**: CI runs `pnpm install --frozen-lockfile` and will fail otherwise +- **Use the pinned toolchain**: Node.js 22.14.0 / pnpm 10.12.4 (see `.tool-versions`; newer pnpm majors can rewrite the lockfile) + ## AI Assistance Guidelines - Refer to specific instruction files for detailed guidance: - `docs/ai-instructions/testing.md` for testing diff --git a/scripts/sync-ai-instructions.sh b/scripts/sync-ai-instructions.sh index ba5c10d..c8d7ddd 100755 --- a/scripts/sync-ai-instructions.sh +++ b/scripts/sync-ai-instructions.sh @@ -148,6 +148,10 @@ if [ -f "$SOURCE_DIR/comment-style.md" ]; then generate_cursor "$SOURCE_DIR/comment-style.md" "comment-style" "Code comment style guidelines" "**/*.tsx,**/*.ts" "false" fi +if [ -f "$SOURCE_DIR/new-component.md" ]; then + generate_cursor "$SOURCE_DIR/new-component.md" "new-component" "Component creation process for Sparkle Design" "**" "false" +fi + # OpenAI Codex / Claude Code用ファイル生成 generate_agents_md