cmx-sdk 0.2.9 → 0.2.11

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 (43) hide show
  1. package/README.md +37 -1
  2. package/dist/add-studio-YUDYE2OH.js +0 -0
  3. package/dist/chunk-7TDMLYBI.js +0 -0
  4. package/dist/chunk-EDXXR5BE.js +0 -0
  5. package/dist/chunk-FPQYL5GE.js +0 -0
  6. package/dist/chunk-IIQLQIDP.js +0 -0
  7. package/dist/chunk-NZQ6SBFS.js +0 -0
  8. package/dist/{chunk-EZMBZWH7.js → chunk-Y3S3K6M3.js} +73 -28
  9. package/dist/cli.js +215 -3
  10. package/dist/init-FLRQXJX4.js +0 -0
  11. package/dist/{interactive-menu-FYVOQSTL.js → interactive-menu-PYMJB5LY.js} +4 -1
  12. package/dist/studio-HAS6DYLO.js +0 -0
  13. package/dist/{update-sdk-KJZ6VB4M.js → update-sdk-ZXMWQF3I.js} +2 -1
  14. package/dist/update-studio-TWCYSYIS.js +0 -0
  15. package/package.json +14 -16
  16. package/templates/AGENTS.md +0 -173
  17. package/templates/CLAUDE.md +0 -28
  18. package/templates/claude/commands/check.md +0 -64
  19. package/templates/claude/commands/next-action.md +0 -66
  20. package/templates/claude/skills/cmx-cache/SKILL.md +0 -50
  21. package/templates/claude/skills/cmx-cache/references/cache-patterns.md +0 -153
  22. package/templates/claude/skills/cmx-component/SKILL.md +0 -108
  23. package/templates/claude/skills/cmx-component/references/component-schema.md +0 -123
  24. package/templates/claude/skills/cmx-content/SKILL.md +0 -158
  25. package/templates/claude/skills/cmx-content/references/migration-patterns.md +0 -120
  26. package/templates/claude/skills/cmx-content/references/seed-patterns.md +0 -146
  27. package/templates/claude/skills/cmx-dev/SKILL.md +0 -266
  28. package/templates/claude/skills/cmx-dev/references/api-patterns.md +0 -220
  29. package/templates/claude/skills/cmx-dev/references/cli-reference.md +0 -54
  30. package/templates/claude/skills/cmx-form/SKILL.md +0 -103
  31. package/templates/claude/skills/cmx-form/references/form-template.md +0 -152
  32. package/templates/claude/skills/cmx-migrate/SKILL.md +0 -501
  33. package/templates/claude/skills/cmx-migrate/references/analysis-guide.md +0 -127
  34. package/templates/claude/skills/cmx-migrate/references/html-to-mdx.md +0 -99
  35. package/templates/claude/skills/cmx-migrate/references/intermediate-format.md +0 -196
  36. package/templates/claude/skills/cmx-migrate/references/tool-setup.md +0 -150
  37. package/templates/claude/skills/cmx-schema/SKILL.md +0 -159
  38. package/templates/claude/skills/cmx-schema/references/field-types.md +0 -164
  39. package/templates/claude/skills/cmx-schema/references/migration-scenarios.md +0 -44
  40. package/templates/claude/skills/cmx-seo/SKILL.md +0 -54
  41. package/templates/claude/skills/cmx-seo/references/seo-patterns.md +0 -216
  42. package/templates/claude/skills/cmx-style/SKILL.md +0 -48
  43. package/templates/claude/skills/cmx-style/references/style-patterns.md +0 -114
@@ -1,123 +0,0 @@
1
- # コンポーネント定義 JSON リファレンス
2
-
3
- ## 必須フィールド
4
-
5
- | フィールド | 型 | 説明 |
6
- |-----------|------|------|
7
- | `name` | string | PascalCase。TSXファイル名・MDXタグ名と一致させる |
8
- | `displayName` | string | CMX Admin UIに表示される名前(日本語可) |
9
- | `description` | string | 用途の説明。1-2文 |
10
- | `propsSchema` | object | props定義(下記参照) |
11
-
12
- ## オプションフィールド
13
-
14
- | フィールド | 型 | 説明 |
15
- |-----------|------|------|
16
- | `examples` | string[] | MDXでの使用例。2-3個推奨 |
17
-
18
- ## propsSchema フォーマット
19
-
20
- ```json
21
- "propsSchema": {
22
- "propName": {
23
- "type": "string",
24
- "description": "Prop description",
25
- "required": true
26
- }
27
- }
28
- ```
29
-
30
- ### prop の type
31
-
32
- | type | 用途 | TSX型 |
33
- |------|------|-------|
34
- | `string` | テキスト | `string` |
35
- | `number` | 数値 | `number` |
36
- | `boolean` | フラグ | `boolean` |
37
- | `enum` | 列挙値 | `string` |
38
- | `asset` | アセットID | `string` |
39
- | `content` | コンテンツID | `string` |
40
-
41
- ### prop のフラグ
42
-
43
- - `"required": true` — 必須prop
44
- - `"required": false` — 任意prop
45
- - `"default": value` — デフォルト値(任意)
46
-
47
- ## examples フォーマット
48
-
49
- ### セルフクロージング
50
-
51
- ```json
52
- "examples": [
53
- "title=\"Example\" count={42}"
54
- ]
55
- ```
56
-
57
- MDXでは `<ComponentName title="Example" count={42} />` として表示。
58
-
59
- ### children あり
60
-
61
- ```json
62
- "examples": [
63
- "title=\"Title\">Content here</ComponentName>"
64
- ]
65
- ```
66
-
67
- MDXでは:
68
- ```mdx
69
- <ComponentName title="Title">
70
- Content here
71
- </ComponentName>
72
- ```
73
-
74
- ## バリデーションルール
75
-
76
- - `name`: PascalCase、英数字のみ、大文字始まり
77
- - `displayName`: 2-4語推奨
78
- - `description`: 1-2文
79
- - `propsSchema` の各 prop: `type` は必須
80
- - `type: object` / `properties` を使うJSON Schema形式は非対応
81
- - `examples`: 異なるpropの組み合わせを示す
82
-
83
- ## 完全な例
84
-
85
- ```json
86
- {
87
- "name": "PricingCard",
88
- "displayName": "Pricing Card",
89
- "description": "Display a pricing plan with features list and CTA button",
90
- "propsSchema": {
91
- "plan": {
92
- "type": "string",
93
- "description": "Plan name (e.g., 'Free', 'Pro', 'Enterprise')",
94
- "required": true
95
- },
96
- "price": {
97
- "type": "string",
98
- "description": "Price display text (e.g., '$9/mo', 'Custom')",
99
- "required": true
100
- },
101
- "features": {
102
- "type": "string",
103
- "description": "Comma-separated feature list",
104
- "required": true
105
- },
106
- "highlighted": {
107
- "type": "boolean",
108
- "description": "Highlight this card as recommended",
109
- "required": false,
110
- "default": false
111
- },
112
- "children": {
113
- "type": "string",
114
- "description": "Additional description or CTA content",
115
- "required": false
116
- }
117
- },
118
- "examples": [
119
- "plan=\"Free\" price=\"$0/mo\" features=\"5 posts,Basic support\"",
120
- "plan=\"Pro\" price=\"$29/mo\" features=\"Unlimited,Priority support\" highlighted={true}>Most popular</PricingCard>"
121
- ]
122
- }
123
- ```
@@ -1,158 +0,0 @@
1
- ---
2
- name: cmx-content
3
- description: |
4
- CMX Starter Kit のコンテンツ作成・投入スキル。Admin API 経由でのテストデータ投入、既存サイトからのコンテンツ移行、MDX テンプレート。
5
- トリガー: 「テストデータを入れたい」「記事を投入」「シードデータ」「サイト移行」
6
- 「コンテンツを移行」「既存サイトからインポート」「スクレイピングして記事を作成」
7
- 「ダミーデータ」「サンプル記事」「テスト用の記事」など。
8
- ---
9
-
10
- # CMX コンテンツ作成・投入
11
-
12
- ## 事前確認
13
-
14
- 1. `.env.local`(または `.env`)に `CMX_API_KEY` と `CMX_API_URL` が設定済みか確認
15
- 2. Admin 側でコレクションが登録済みか確認(未登録なら `/setup/03_schema` を先に)
16
- 3. `cmx/site-config.md` と `workflows/style-guide.md` を読み、トーン・スタイルに合った記事を生成する
17
-
18
- ## 2つのユースケース
19
-
20
- ### A. テストデータ投入(新規サイト)
21
-
22
- 初期構築時に表示確認用の記事を作成する。詳細は [references/seed-patterns.md](references/seed-patterns.md) を参照。
23
-
24
- ### B. サイト移行(既存コンテンツ取り込み)
25
-
26
- 既存サイトのページをスクレイピング → MDX に変換 → Admin API で投入。詳細は [references/migration-patterns.md](references/migration-patterns.md) を参照。
27
-
28
- ## ステータス運用ルール
29
-
30
- コンテンツ作成後のステータスは、タスクの性質に応じて使い分ける。**明示的に「公開して」と指示されない限り、公開(publish)は行わない。**
31
-
32
- | タスクの性質 | 保存先ステータス | 例 |
33
- |------------|----------------|-----|
34
- | 案出し・探索的なタスク | **draft**(下書き) | 「いくつか記事のアイデアを出して」「テスト記事を作って」 |
35
- | タスク内で記事作成が完結する場合 | **review**(レビュー依頼) | 「新しく記事を作成して」「移行記事を投入して」 |
36
- | ユーザーが明示的に公開を指示した場合のみ | **published**(公開) | 「公開して」「publishして」 |
37
-
38
- ## Admin API でのコンテンツ作成
39
-
40
- CMX SDK CLIコマンドでコンテンツを作成します:
41
-
42
- ```bash
43
- npx cmx-sdk create-content --collection blog --json '{
44
- "title": "記事タイトル",
45
- "slug": "article-slug",
46
- "description": "記事の説明文",
47
- "mdx": "# 見出し\n\n本文..."
48
- }'
49
- ```
50
-
51
- または、ファイルから読み込む場合:
52
-
53
- ```bash
54
- npx cmx-sdk create-content --collection blog --file content.json
55
- ```
56
-
57
- コマンドの出力例:
58
- ```json
59
- {
60
- "id": "uuid",
61
- "slug": "article-slug"
62
- }
63
- ```
64
-
65
- 初期ステータスは `draft` です。作成されたコンテンツIDを控えておいてください。
66
-
67
- ### レビューに送る場合(タスク完結時)
68
-
69
- コンテンツを作成した後、レビューステータスに変更:
70
-
71
- ```bash
72
- npx cmx-sdk request-review-content --id {contentId}
73
- ```
74
-
75
- これにより、ステータスが `draft` → `review` に変更されます。
76
-
77
- ### 公開する場合(ユーザーが明示的に指示した場合のみ)
78
-
79
- 公開には `review` ステータスが前提です。まだ `draft` の場合は `request-review-content` を先に実行してください。
80
-
81
- ```bash
82
- npx cmx-sdk publish-content --id {contentId}
83
- ```
84
-
85
- これにより、ステータスが `review` → `published` に変更され、公開URLが返されます。
86
-
87
- > **注意**: `publish-content` は `review` ステータスのコンテンツにのみ実行可能です。`draft` から直接公開することはできません。
88
-
89
- ### コレクション一覧の確認
90
-
91
- ```bash
92
- npx cmx-sdk list-collections
93
- ```
94
-
95
- このコマンドで、コレクションの slug や ID を確認できます。`create-content` コマンドでは `--collection` オプションに slug を指定すれば、自動的に ID に変換されます。
96
-
97
- ## データタイプのテストデータ
98
-
99
- ### グローバルデータタイプ(公開サイトに直接表示)
100
-
101
- 公開サイトに直接表示されるデータタイプ(スタッフ、商品、店舗等)のエントリを作成する場合、`published` フィールドを `true` に設定する必要があります(デフォルトは `false`)。
102
-
103
- ```bash
104
- # 例: スタッフ情報のエントリを作成(published: true で公開)
105
- npx cmx-sdk create-data-entry --type-slug staff --json '{"name":"山田太郎","role":"エンジニア","published":true}'
106
-
107
- # 例: 店舗情報のエントリを作成(published: true で公開)
108
- npx cmx-sdk create-data-entry --type-slug locations --json '{"name":"東京オフィス","address":"東京都渋谷区...","published":true}'
109
-
110
- # カスタム: 商品情報のエントリを作成
111
- npx cmx-sdk create-data-entry --type-slug products --json '{"name":"商品A","price":1000,"published":true}'
112
- ```
113
-
114
- **重要:** `published: false` または未設定の場合、Public API では取得できません。
115
-
116
- ### コレクション付属データタイプ(カテゴリ・タグ等)
117
-
118
- コレクションに付属データタイプ(カテゴリ・タグ等)がある場合、エントリ作成→コンテンツへの参照設定が必要。
119
-
120
- #### 1. 付属データタイプのエントリ作成
121
-
122
- ```bash
123
- # コレクションの付属データタイプを確認
124
- npx cmx-sdk list-collection-data-types --collection blog
125
-
126
- # カテゴリエントリを作成
127
- npx cmx-sdk create-data-entry --type-slug blog-categories --json '{"name":"技術ブログ","description":"テック系の記事"}'
128
- npx cmx-sdk create-data-entry --type-slug blog-categories --json '{"name":"デザイン","description":"デザイン系の記事"}'
129
-
130
- # タグエントリを作成
131
- npx cmx-sdk create-data-entry --type-slug blog-tags --json '{"name":"Next.js"}'
132
- npx cmx-sdk create-data-entry --type-slug blog-tags --json '{"name":"TypeScript"}'
133
- ```
134
-
135
- #### 2. コンテンツに参照を設定
136
-
137
- コンテンツ作成後、CLIコマンドで参照を設定:
138
-
139
- ```bash
140
- npx cmx-sdk set-content-references --id {contentId} --json '{
141
- "references": [
142
- { "fieldSlug": "categories", "dataEntryIds": ["カテゴリエントリのUUID"] },
143
- { "fieldSlug": "tags", "dataEntryIds": ["タグ1のUUID", "タグ2のUUID"] }
144
- ]
145
- }'
146
- ```
147
-
148
- または、ファイルから読み込む場合:
149
-
150
- ```bash
151
- npx cmx-sdk set-content-references --id {contentId} --file references.json
152
- ```
153
-
154
- ## 変更後
155
-
156
- 1. Admin の投稿一覧で記事が作成されていることを確認
157
- 2. フロントの開発サーバーで記事が表示されることを確認
158
- 3. テストデータは確認後に削除可能(Admin の投稿一覧から)
@@ -1,120 +0,0 @@
1
- # サイト移行パターン
2
-
3
- ## 移行フロー
4
-
5
- ```
6
- 1. 既存サイトの URL 一覧を取得(sitemap.xml or 手動リスト)
7
- 2. 各ページをスクレイピングしてコンテンツを取得
8
- 3. HTML → MDX に変換
9
- 4. Admin API で draft として投入
10
- 5. 内容を確認・調整
11
- 6. 問題なければ publish
12
- ```
13
-
14
- ## ステップ 1: URL 一覧の取得
15
-
16
- ### sitemap.xml から
17
-
18
- ```typescript
19
- const sitemapUrl = "https://old-site.com/sitemap.xml"
20
- const response = await fetch(sitemapUrl)
21
- const xml = await response.text()
22
- // XML をパースして <loc> タグから URL を抽出
23
- ```
24
-
25
- ### 手動リスト
26
-
27
- ユーザーに URL リストを提供してもらう。
28
-
29
- ## ステップ 2: スクレイピング
30
-
31
- ```typescript
32
- const response = await fetch(url)
33
- const html = await response.text()
34
- // HTML をパースして記事コンテンツを抽出
35
- ```
36
-
37
- **抽出対象:**
38
- - タイトル(`<h1>` or `<title>`)
39
- - 本文(`<article>` or `<main>` 内のコンテンツ)
40
- - メタ説明文(`<meta name="description">`)
41
- - 公開日(`<time>` or meta タグ)
42
- - アイキャッチ画像(OG image or 最初の画像)
43
-
44
- ## ステップ 3: HTML → MDX 変換
45
-
46
- ### 基本変換ルール
47
-
48
- | HTML | MDX |
49
- |------|-----|
50
- | `<h2>` | `## ` |
51
- | `<h3>` | `### ` |
52
- | `<p>` | そのまま(タグ除去) |
53
- | `<strong>` | `**テキスト**` |
54
- | `<em>` | `*テキスト*` |
55
- | `<a href="url">` | `[テキスト](url)` |
56
- | `<ul><li>` | `- テキスト` |
57
- | `<ol><li>` | `1. テキスト` |
58
- | `<blockquote>` | `> テキスト` |
59
- | `<code>` | `` `テキスト` `` |
60
- | `<pre><code>` | ` ```lang\nコード\n``` ` |
61
- | `<img>` | `![alt](src)` |
62
- | `<table>` | Markdown テーブル |
63
-
64
- ### 注意点
65
-
66
- - `<script>`, `<style>`, `<iframe>` は除去
67
- - クラス名・ID は除去
68
- - インライン style は除去
69
- - 相対 URL は絶対 URL に変換
70
- - 画像は外部 URL のまま(後で Admin にアップロード可能)
71
-
72
- ## ステップ 4: CLIコマンドで投入
73
-
74
- 各ページのデータをJSONファイルに保存し、CLIコマンドで投入:
75
-
76
- ```bash
77
- # 各ページごとにコンテンツを作成
78
- for page in convertedPages; do
79
- npx cmx-sdk create-content --collection blog --json '{
80
- "title": "'"$page.title"'",
81
- "slug": "'"$page.slug"'",
82
- "description": "'"$page.description"'",
83
- "mdx": "'"$page.mdx"'"
84
- }'
85
- done
86
- ```
87
-
88
- または、JSONファイルから一括投入する場合:
89
-
90
- ```bash
91
- # content1.json, content2.json などのファイルを作成しておき
92
- npx cmx-sdk create-content --collection blog --file content1.json
93
- npx cmx-sdk create-content --collection blog --file content2.json
94
- # ...
95
- ```
96
-
97
- ## ステップ 5: 確認・調整
98
-
99
- - Admin の投稿一覧で全記事が作成されていることを確認
100
- - プレビューで MDX のレンダリングを確認
101
- - 変換エラー(崩れたテーブル、欠落した画像等)を手動修正
102
-
103
- ## コレクションの振り分け
104
-
105
- 移行元のページ構造に応じて振り分ける:
106
-
107
- | 移行元 | 振り分け先 |
108
- |--------|-----------|
109
- | ブログ記事 | post タイプのコレクション |
110
- | ニュース・お知らせ | news タイプのコレクション |
111
- | 固定ページ(会社概要等) | page タイプのコレクション |
112
- | ヘルプ・ドキュメント | doc タイプのコレクション |
113
-
114
- ## slug の生成
115
-
116
- 移行元の URL パスから生成:
117
-
118
- - `https://old-site.com/blog/2024/01/my-article` → `my-article`
119
- - 日本語 URL の場合はローマ字化 or 英語に変換
120
- - 重複チェック: `search_posts` で既存 slug と衝突しないか確認
@@ -1,146 +0,0 @@
1
- # テストデータ投入パターン
2
-
3
- ## 投入フロー
4
-
5
- ```
6
- 1. コレクション一覧を取得(npx cmx-sdk list-collections)
7
- 2. 各コレクションの type に合わせた記事を生成
8
- 3. CLIコマンドで draft として作成(npx cmx-sdk create-content)
9
- 4. request-review-content でレビューステータスに変更(テストデータ投入はタスク完結型のため)
10
- 5. ユーザーが「公開して」と指示した場合のみ publish-content で公開
11
- 6. フロントの開発サーバーで確認
12
- ```
13
-
14
- > **注意**: `publish-content` は `review` ステータスからのみ実行可能。`draft` から直接公開はできない。
15
- > **重要**: テストデータ投入はタスク完結型のため `review` まで進める。公開は明示的な指示があった場合のみ。
16
-
17
- ## コレクション type 別のテスト記事
18
-
19
- ### post(ブログ)
20
-
21
- 各コレクションに 2-3 件。異なる長さ・構成の記事を含める。
22
-
23
- ```markdown
24
- ---
25
- title: テスト記事のタイトル
26
- description: SEO用の説明文(120-160文字)
27
- category: "技術ブログ"
28
- tags: ["Next.js", "TypeScript"]
29
- ---
30
-
31
- ## セクション1
32
-
33
- 本文テキスト。`site-config.md` のトーンに合わせた文体で書く。
34
-
35
- ## セクション2
36
-
37
- リストや画像を含むセクション。
38
-
39
- - 箇条書き項目1
40
- - 箇条書き項目2
41
-
42
- ## まとめ
43
-
44
- 記事のまとめ。
45
- ```
46
-
47
- ### news(ニュース)
48
-
49
- 2 件程度。短めの告知文。
50
-
51
- ### page(固定ページ)
52
-
53
- About ページ等があれば 1 件。
54
-
55
- ### doc(ドキュメント)
56
-
57
- ドキュメントがあれば 1 件。親子構造の確認用。
58
-
59
- ## コレクション付属データタイプのテストデータ
60
-
61
- コレクションに付属データタイプがある場合、コンテンツ投入前にエントリを作成し、参照を設定する。
62
-
63
- ### フロー
64
-
65
- ```
66
- 1. コレクションの付属データタイプ一覧を取得
67
- 2. 各データタイプにテストエントリを作成(カテゴリ2-3件、タグ3-5件)
68
- 3. コンテンツ作成
69
- 4. コンテンツに参照を設定(PUT /contents/:id/references)
70
- 5. 表示確認
71
- ```
72
-
73
- ### カテゴリ例
74
-
75
- ```bash
76
- npx cmx-sdk create-data-entry --type-slug blog-categories --json '{"name":"技術","description":"テック系の記事"}'
77
- npx cmx-sdk create-data-entry --type-slug blog-categories --json '{"name":"デザイン","description":"デザイン系の記事"}'
78
- npx cmx-sdk create-data-entry --type-slug blog-categories --json '{"name":"ビジネス","description":"ビジネス系の記事"}'
79
- ```
80
-
81
- ### タグ例
82
-
83
- ```bash
84
- npx cmx-sdk create-data-entry --type-slug blog-tags --json '{"name":"Next.js"}'
85
- npx cmx-sdk create-data-entry --type-slug blog-tags --json '{"name":"TypeScript"}'
86
- npx cmx-sdk create-data-entry --type-slug blog-tags --json '{"name":"React"}'
87
- npx cmx-sdk create-data-entry --type-slug blog-tags --json '{"name":"CSS"}'
88
- ```
89
-
90
- ### 参照設定例
91
-
92
- テスト記事にカテゴリ1つ + タグ2つを設定:
93
-
94
- ```bash
95
- npx cmx-sdk set-content-references --id {contentId} --json '{
96
- "references": [
97
- { "fieldSlug": "categories", "dataEntryIds": ["{categoryId}"] },
98
- { "fieldSlug": "tags", "dataEntryIds": ["{tagId1}", "{tagId2}"] }
99
- ]
100
- }'
101
- ```
102
-
103
- ## slug の命名規則
104
-
105
- テストデータは `test-` プレフィックスを付けると後で判別しやすい:
106
-
107
- - `test-first-post`
108
- - `test-long-article`
109
- - `test-news-announcement`
110
-
111
- ## MDX テンプレート(最小限)
112
-
113
- ```markdown
114
- ## はじめに
115
-
116
- この記事はテストデータです。サイトの表示確認用に作成されました。
117
-
118
- ## 本文
119
-
120
- ここに本文が入ります。このセクションでは、テキストのフォーマットや
121
- レイアウトが正しく表示されることを確認します。
122
-
123
- **太字テキスト**や`コード`、[リンク](https://example.com)の表示も確認できます。
124
-
125
- ## まとめ
126
-
127
- テストデータの確認が完了したら、Admin の投稿一覧から削除できます。
128
- ```
129
-
130
- ## MDX テンプレート(コンポーネント含む)
131
-
132
- 登録済みコンポーネントを含むテスト記事。コンポーネントの表示確認用。
133
-
134
- ```markdown
135
- ## コンポーネント表示テスト
136
-
137
- <Callout type="info">
138
- これは情報コールアウトのテストです。
139
- </Callout>
140
-
141
- <Callout type="warning" title="注意">
142
- これは警告コールアウトのテストです。
143
- </Callout>
144
- ```
145
-
146
- **注意:** 使用するコンポーネントは `src/components/custom/index.ts` に export されているもののみ。未登録コンポーネントを使うと MDX レンダリングでエラーになる。