@d-zero/scaffold 5.0.0-alpha.44 → 5.0.0-alpha.46

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 (35) hide show
  1. package/.clineignore +6 -0
  2. package/.clinerules +17 -0
  3. package/.gitignore +2 -0
  4. package/.stylelintrc +8 -0
  5. package/.vscode/settings.json +1 -5
  6. package/CHANGELOG.md +18 -0
  7. package/__assets/_libs/component/c-card-list.scss +0 -2
  8. package/__assets/_libs/component/c-card.scss +0 -2
  9. package/__assets/_libs/component/c-content-index.scss +0 -2
  10. package/__assets/_libs/component/c-content-main.scss +0 -2
  11. package/__assets/_libs/component/c-footer.scss +0 -2
  12. package/__assets/_libs/component/c-header.scss +0 -2
  13. package/__assets/_libs/component/c-media-list.scss +0 -2
  14. package/__assets/_libs/component/c-media.scss +0 -2
  15. package/__assets/_libs/component/c-nav-breadcrumb.scss +0 -2
  16. package/__assets/_libs/component/c-nav-global.scss +0 -2
  17. package/__assets/_libs/component/c-nav-sitemap.scss +0 -2
  18. package/__assets/_libs/component/c-page-home.scss +0 -2
  19. package/__assets/_libs/component/c-page-sub.scss +0 -2
  20. package/__assets/_libs/component/c-pagination.scss +0 -2
  21. package/__assets/_libs/component/c-title-page.scss +0 -2
  22. package/__assets/_libs/style/base/root.scss +61 -15
  23. package/__assets/_libs/style/general/all.scss +0 -2
  24. package/__assets/_libs/style/general/body.scss +1 -3
  25. package/__assets/_libs/style/general/button.scss +0 -2
  26. package/__assets/_libs/style/general/img.scss +0 -2
  27. package/ai-tasks/create-component.md +127 -0
  28. package/ai-tasks/create-page.md +110 -0
  29. package/ai-tasks/page-to-burger.md +68 -0
  30. package/package.json +14 -13
  31. package/__assets/_libs/style/theme/color.scss +0 -4
  32. package/__assets/_libs/style/theme/dimension.scss +0 -53
  33. package/__assets/_libs/style/theme/font.scss +0 -2
  34. package/__assets/_libs/style/theme/index.scss +0 -3
  35. package/coding-rule.mdc +0 -163
package/.clineignore ADDED
@@ -0,0 +1,6 @@
1
+ node_modules
2
+ yarn.lock
3
+ package-lock.json
4
+ .env
5
+ .cursor
6
+ ai-tasks
package/.clinerules ADDED
@@ -0,0 +1,17 @@
1
+ # コーディングに関するAIエージェントの規定
2
+
3
+ ## プロンプトに対する振る舞い
4
+
5
+ ### コード生成
6
+
7
+ #### Figmaからコンポーネント生成
8
+
9
+ Figmaからコード生成に関する指令を受たら`use_mcp_tool:frontend_env:get_task_step(./ai-tasks/create-component.md)`を実行し、サーバが返す指示を一言一句漏らさず確認してそのとおりに従え。
10
+
11
+ #### BurgerEditorコンテンツ生成
12
+
13
+ 特定のウェブページをBurgerEditorコンテンツ化するように指令を受たら`use_mcp_tool:frontend_env:get_task_step(./ai-tasks/page-to-burger.md)`を実行し、サーバが返す指示を一言一句漏らさず確認してそのとおりに従え。
14
+
15
+ #### ページ生成
16
+
17
+ 何かしらのページを作成するように指令を受たらファイルを`read_file`する前に`use_mcp_tool:frontend_env:get_task_step(./ai-tasks/create-page.md)`を実行し、サーバが返す指示を一言一句漏らさず確認してそのとおりに従え。
package/.gitignore CHANGED
@@ -3,6 +3,7 @@ node_modules
3
3
  npm-error.log
4
4
  yarn-error.log
5
5
  .env
6
+ .husky/_/*
6
7
 
7
8
  # Huge File
8
9
  *.zip
@@ -19,6 +20,7 @@ yarn-error.log
19
20
  # Temporary
20
21
  .11ty
21
22
  .serve
23
+ .cache
22
24
 
23
25
  # Document Root
24
26
  htdocs/*
package/.stylelintrc CHANGED
@@ -1,5 +1,13 @@
1
1
  {
2
2
  "extends": ["@d-zero/stylelint-config"],
3
+ "rules": {
4
+ "selector-type-no-unknown": [
5
+ true,
6
+ {
7
+ "ignoreTypes": ["/^c-.+$/"]
8
+ }
9
+ ]
10
+ },
3
11
  "overrides": [
4
12
  {
5
13
  "files": ["c-*.scss"],
@@ -11,6 +11,7 @@
11
11
  "stylelint.validate": ["css", "scss"],
12
12
  "files.associations": {
13
13
  "*.mdc": "markdown",
14
+ ".clinerules": "markdown",
14
15
  ".stylelintrc": "json",
15
16
  ".markuplintrc": "json",
16
17
  ".pug-lintrc": "json"
@@ -33,10 +34,5 @@
33
34
  "editor.codeActionsOnSave": {
34
35
  "source.fixAll.eslint": "explicit",
35
36
  "source.fixAll.stylelint": "explicit"
36
- },
37
-
38
- // GitHub Copilot
39
- "github.copilot.enable": {
40
- "*": false
41
37
  }
42
38
  }
package/CHANGELOG.md CHANGED
@@ -3,6 +3,24 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [5.0.0-alpha.46](https://github.com/d-zero-dev/frontend-env/compare/v5.0.0-alpha.45...v5.0.0-alpha.46) (2025-05-19)
7
+
8
+ ### Features
9
+
10
+ - **scaffold:** add ai tasks and enhance rules ([db109a8](https://github.com/d-zero-dev/frontend-env/commit/db109a8d268dee572431d1865d870a5bb30c7193))
11
+
12
+ # [5.0.0-alpha.45](https://github.com/d-zero-dev/frontend-env/compare/v5.0.0-alpha.44...v5.0.0-alpha.45) (2025-04-11)
13
+
14
+ ### Features
15
+
16
+ - **custom-components:** add `custom-components` ([1eb7b04](https://github.com/d-zero-dev/frontend-env/commit/1eb7b04b12d0aeec457a32e8c2b398374b8bca89))
17
+ - **scaffold:** clinerulesの改善 ([154348b](https://github.com/d-zero-dev/frontend-env/commit/154348bbd6e59adc60a0d43fc404de3225665c82))
18
+ - **scaffold:** remove SASS variables and theme files ([f48f60f](https://github.com/d-zero-dev/frontend-env/commit/f48f60f243b19ad7aac704f59fb473eb3842b568))
19
+
20
+ ### BREAKING CHANGES
21
+
22
+ - **scaffold:** remove SASS variables
23
+
6
24
  # [5.0.0-alpha.44](https://github.com/d-zero-dev/frontend-env/compare/v5.0.0-alpha.43...v5.0.0-alpha.44) (2025-03-12)
7
25
 
8
26
  ### Features
@@ -1,5 +1,3 @@
1
- @use '../style/theme' as *;
2
-
3
1
  .c-card-list {
4
2
  display: grid;
5
3
  grid-template-columns: repeat(auto-fit, minmax(calc(200 / 17 * 1em), 1fr));
@@ -1,5 +1,3 @@
1
- @use '../style/theme' as *;
2
-
3
1
  .c-card {
4
2
  position: relative;
5
3
  block-size: 100%;
@@ -1,5 +1,3 @@
1
- @use '../style/theme' as *;
2
-
3
1
  .c-content-index {
4
2
  &__body {
5
3
  margin-block: 0;
@@ -1,5 +1,3 @@
1
- @use '../style/theme' as *;
2
-
3
1
  // 🃏 このファイルのStylelintルールはoverridesによって特別に変更されています
4
2
 
5
3
  // メインコンテンツ(content-mainコンポーネント)の内容はCMSなどで管理されるHTMLを含んだり、
@@ -1,5 +1,3 @@
1
- @use '../style/theme' as *;
2
-
3
1
  .c-footer {
4
2
  padding-block-end: 2em;
5
3
 
@@ -1,5 +1,3 @@
1
- @use '../style/theme' as *;
2
-
3
1
  .c-header {
4
2
  padding-block: 1.5em 1.7em;
5
3
  padding-inline: 2em;
@@ -1,5 +1,3 @@
1
- @use '../style/theme' as *;
2
-
3
1
  .c-media-list {
4
2
  display: grid;
5
3
  grid-template-columns: 1fr;
@@ -1,5 +1,3 @@
1
- @use '../style/theme' as *;
2
-
3
1
  .c-media {
4
2
  position: relative;
5
3
  block-size: 100%;
@@ -1,5 +1,3 @@
1
- @use '../style/theme' as *;
2
-
3
1
  .c-nav-breadcrumb {
4
2
  @media (--md-lte) {
5
3
  display: none;
@@ -1,5 +1,3 @@
1
- @use '../style/theme' as *;
2
-
3
1
  .c-nav-global {
4
2
  position: relative;
5
3
  margin-block-end: 1em;
@@ -1,5 +1,3 @@
1
- @use '../style/theme' as *;
2
-
3
1
  .c-nav-sitemap {
4
2
  padding-block: 2em;
5
3
  padding-inline: 0;
@@ -1,5 +1,3 @@
1
- @use '../style/theme' as *;
2
-
3
1
  .c-page-home {
4
2
  inline-size: 100%;
5
3
  block-size: 100%;
@@ -1,5 +1,3 @@
1
- @use '../style/theme' as *;
2
-
3
1
  .c-page-sub {
4
2
  inline-size: 100%;
5
3
  block-size: 100%;
@@ -1,5 +1,3 @@
1
- @use '../style/theme' as *;
2
-
3
1
  .c-pagination {
4
2
  clear: both;
5
3
  display: flex;
@@ -1,5 +1,3 @@
1
- @use '../style/theme' as *;
2
-
3
1
  .c-title-page {
4
2
  h1 {
5
3
  margin: 0;
@@ -1,20 +1,18 @@
1
- @use 'sass:math';
2
- @use '../theme' as *;
3
-
4
1
  :root {
2
+ --lightest-color: #fff;
3
+ --darkest-color: #333;
4
+
5
5
  // 配色
6
- --base-font-color: #{$darkest-color};
7
- --base-font-size: #{$base-font-size * 1px};
8
- --base-line-height: #{$base-line-height};
9
- --border-color: #{$darkest-color};
6
+ --base-font-color: var(--darkest-color);
7
+ --border-color: var(--darkest-color);
10
8
 
11
- // コンテンツ幅
12
- --content-width: #{math.div($breakpoint-sm, $base-font-size) * 1rem};
13
- --wide-layout-width: #{math.div($breakpoint-md, $base-font-size) * 1rem};
9
+ // タイポグラフィ
10
+ --base-font-size: 16px;
11
+ --base-line-height: 1.8;
14
12
 
15
13
  // フォントファミリー
16
- --font-family-body: #{$font-family-body};
17
- --font-family-heading: #{$font-family-heading};
14
+ --font-family-body: sans-serif;
15
+ --font-family-heading: helvetica, var(--font-family-body);
18
16
 
19
17
  // 見出し調和数列スケーリング
20
18
  // @see https://standard.shiftbrain.com/blog/music-math-typography
@@ -24,7 +22,55 @@
24
22
  --font-size-h4: calc(1em * 8 / 5);
25
23
  --font-size-h5: calc(1em * 8 / 6);
26
24
  --font-size-h6: calc(1em * 8 / 7);
27
-
28
- // 定義
29
- font-size: var(--base-font-size);
30
25
  }
26
+
27
+ // ----------------------------------------
28
+ //
29
+ // カスタムメディア
30
+ //
31
+ // ----------------------------------------
32
+ $breakpoint-xs: 576;
33
+ $breakpoint-sm: 768;
34
+ $breakpoint-md: 992;
35
+ $breakpoint-lg: 1200;
36
+ // xsのみ
37
+ @custom-media --xs (max-width: #{$breakpoint-xs * 1px});
38
+
39
+ // smのみ
40
+ @custom-media --sm (min-width: #{$breakpoint-xs * 1px}) and (max-width: #{$breakpoint-sm * 1px - 1px});
41
+
42
+ // mdのみ
43
+ @custom-media --md (min-width: #{$breakpoint-sm * 1px}) and (max-width: #{$breakpoint-md * 1px - 1px});
44
+
45
+ // lgのみ
46
+ @custom-media --lg (min-width: #{$breakpoint-md * 1px}) and (max-width: #{$breakpoint-lg * 1px - 1px});
47
+
48
+ // xlのみ
49
+ @custom-media --xl (min-width: #{$breakpoint-lg * 1px});
50
+
51
+ // xs以下 = xsのみ
52
+ @custom-media --xs-lte (max-width: #{$breakpoint-xs * 1px - 1px});
53
+
54
+ // sm以下
55
+ @custom-media --sm-lte (max-width: #{$breakpoint-sm * 1px - 1px});
56
+
57
+ // md以下
58
+ @custom-media --md-lte (max-width: #{$breakpoint-md * 1px - 1px});
59
+
60
+ // lg以下
61
+ @custom-media --lg-lte (max-width: #{$breakpoint-lg * 1px - 1px});
62
+
63
+ // xs超え
64
+ @custom-media --xs-gt (min-width: #{$breakpoint-xs * 1px});
65
+
66
+ // sm超え
67
+ @custom-media --sm-gt (min-width: #{$breakpoint-sm * 1px});
68
+
69
+ // md超え
70
+ @custom-media --md-gt (min-width: #{$breakpoint-md * 1px});
71
+
72
+ // lg超え
73
+ @custom-media --lg-gt (min-width: #{$breakpoint-lg * 1px});
74
+
75
+ // high resolution
76
+ @custom-media --hr (min-resolution: 2dppx);
@@ -1,5 +1,3 @@
1
- @use '../theme' as *;
2
-
3
1
  /* stylelint-disable selector-max-universal -- this is universal selector rules */
4
2
  * {
5
3
  &,
@@ -1,10 +1,8 @@
1
- @use '../theme' as *;
2
-
3
1
  body {
4
2
  padding: 0;
5
3
  margin: 0;
6
4
  font-family: var(--font-family-body);
7
- font-size: 1rem;
5
+ font-size: var(--base-font-size);
8
6
  line-height: var(--base-line-height);
9
7
  color: var(--base-font-color);
10
8
  }
@@ -1,5 +1,3 @@
1
- @use '../theme' as *;
2
-
3
1
  button {
4
2
  border-radius: 0;
5
3
  }
@@ -1,5 +1,3 @@
1
- @use '../theme' as *;
2
-
3
1
  img {
4
2
  min-inline-size: 0;
5
3
  min-block-size: 0;
@@ -0,0 +1,127 @@
1
+ # 1
2
+
3
+ `use_mcp_tool:burger_editor`関連の実行を禁止する。
4
+ FigmaデータのURLをユーザーに要求せよ。
5
+ ユーザーから受け取ったURLで`use_mcp_tool:frontend_env:get_figma_data`せよ。
6
+ 得られたファイルパスを`execute_command:mv`で`.cache/figma-data.yaml`に保存し、ステップ2を実行せよ。
7
+ ユーザーがURLを入力しなかったら、ステップ4を実行せよ。
8
+
9
+ # 2
10
+
11
+ ステップ1で得られたFigmaデータを`read_file`で読み込め。
12
+ ここでどんなコンポーネントを作るのか記憶せよ。
13
+ Figmaデータのトップレイヤーのフレーム名をコンポーネント名にせよ。
14
+ カスタム要素が含まれていてもそれはコンポーネントの一部であり、別々で生成する必要はない。
15
+ コンポーネントが不明瞭な場合、Figmaのレイヤー名を変更するようにユーザーに警告、ステップは継続せず全タスクを終了せよ。
16
+ コンポーネントが名が判明したらステップ3を実行せよ。
17
+
18
+ # 3
19
+
20
+ FigmaのFileデータから全体のnodeIdで`use_mcp_tool:frontend_env:get_figma_image`から全体の画像を取得せよ。
21
+ MCPサーバから返却されたURLを`execute_command:curl`して、`.cache/コンポーネント名.png`として保存。
22
+ URLをブラウザで開いてはいけない。
23
+ これらのタスクが完了したら、ステップ4を実行せよ。
24
+
25
+ # 4
26
+
27
+ `.cache/コンポーネント名.png`を解析し全体デザインを確認し、構造やスタイルを分析せよ。
28
+ Figmaデータに`boundVariables`ノードをもつ場合、ユーザーにVariablesの詳細情報を要求せよ。
29
+ `__assets/_libs/style/base/root.scss`を`read_file`し、既にCSSカスタムプロパティが存在してたらスキップしてステップ6へ。
30
+ ユーザーからVariablesの詳細情報を得られたら、ステップ5を実行せよ。拒否されたら、ステップ6を実行せよ。
31
+
32
+ # 5
33
+
34
+ `__assets/_libs/style/base/root.scss`を`read_file`せよ。
35
+ たとえば`--primary-color[VariableCollectionId:5:13/VariableID:5:14]={"r":0.9529411792755127,"g":0.572549045085907,"b":0,"a":1}`を受け取っていれば`--primary-color: rgb(243 156 18 / 100%);`のように変換せよ。
36
+ Variables変換したCSSカスタムプロパティとして`:root`に上書きせずに追記せよ。
37
+ `--primary-color: rgb(243 156 18 / 100%); /* VariableID:5:14 */`のようにコメントもつけろ。
38
+ 「カラーシンタックスがフォーマットと異なる」類のstylelintエラーはこのステップでは無視してよい。
39
+ これらのタスクが完了したら、ステップ6を実行せよ。
40
+
41
+ # 6
42
+
43
+ Figmaのデータにカスタム要素が存在するか確認せよ。
44
+ `use_mcp_tool:frontend_env:get_coding_guidelines(web-components)`を確認し、**プレフィックスは`c`としてカスタム要素名を記憶せよ**。
45
+ **注意**: カスタム要素が含まれたとしてもコンポーネントの一部であり別々で生成する必要はない。
46
+ これらのタスクが完了したら、ステップ7を実行せよ。
47
+
48
+ # 7
49
+
50
+ ステップ1で`.cache/コンポーネント名.yaml`に保存していた場合データを読み込め。
51
+ ステップ2で`.cache/コンポーネント名.png`に保存していた場合画像を画像解析せよ。
52
+ 画像化する必要があるFigmaノードを特定せよ。
53
+ カスタム要素に相当するノード内は無視すること。
54
+ `use_mcp_tool:frontend_env:get_figma_image`で画像のURLを取得し、`execute_command:curl`で`htdocs/img/`に保存せよ。
55
+ `use_mcp_tool:frontend_env:get_coding_guidelines(media)`の規定に従うこと。
56
+ サブディレクトリは作らないこと。
57
+ SVGもsvgファイル画像として保存すること。
58
+ これらのタスクが完了したら、ステップ8を実行せよ。
59
+
60
+ # 8
61
+
62
+ HTMLを作成する。
63
+ 作成するのはFigmaのトップレイヤーのコンポーネントのみである。
64
+ `use_mcp_tool:frontend_env:get_coding_guidelines(html)`の規定に従い設計せよ。
65
+ 作成するコンポーネントの名前でpugファイルを作成(場所は`__assets/_libs/component/コンポーネント名.pug`)せよ。
66
+ 既にファイルが存在する場合は、そのファイルを上書きせよ。
67
+ 要素の順番はスクリーンリーダーやフォーカスの順番に依存し重要であるため、Figmaレイヤーの順番にはこだわらず、情報設計的な在り方を最優先に視覚的な配置を加味して順番を決定すること。
68
+ **カスタム要素の要素名のプレフィックスは`c-`をつけること。**
69
+ インラインSVGは作ってはならない。必要なのであればステップ7に戻って再作成すること。
70
+ これらのタスクが完了したら、ステップ9を実行せよ。
71
+
72
+ # 9
73
+
74
+ 作成したコンポーネントファイルで代替テキストが必要か確認せよ。
75
+ 必要な場合は、コーディングガイドラインで代替テキストの情報を確認せよ。
76
+ 確認ができたら、ファイルを修正せよ。
77
+ これらのタスクが完了したら、ステップ10を実行せよ。
78
+
79
+ # 10
80
+
81
+ CSSを作成する。
82
+ 一般的なCSSの実装方法を一切忘れてのぞめ。
83
+ `use_mcp_tool:frontend_env:get_coding_guidelines(css)`に従い設計せよ。
84
+ ステップ1で`.cache/コンポーネント名.yaml`に保存していた場合データを読み込め。
85
+ ステップ2で`.cache/コンポーネント名.png`に保存していた場合画像を画像解析せよ。
86
+ ステップ8で作成したpugファイルを読み込め。
87
+ 確認ができたら、作成するコンポーネントの名前でscssファイルを作成(場所は`__assets/_libs/component/コンポーネント名.scss`)せよ。
88
+ これらJSONと画像とHTMLを解析して、コンポーネントのスタイルを生成せよ。
89
+ **レスポンシブが想定されていてもメディアクエリを使用して非表示の要素を作らないこと。**
90
+ **レスポンシブが想定されていてもメディアクエリを使用して非表示の要素を作らないこと!**
91
+ **レスポンシブが想定されていてもメディアクエリを使用して非表示の要素を作らないこと!!!**
92
+ **Figmaデータからあるがままスタイルに変換すること。**
93
+ **カスタム要素のカスタムプロパティは反映すること。**
94
+ **カスタム要素が固定のサイズを持つ場合は、`inline-size`などで指定すること。**
95
+ HTMLと同様にカスタム要素のプレフィックスは`c-`である。
96
+ stylelintのエラーが発生した場合は、直接編集せず、`npx stylelint --fix <fileName>`を実行せよ。
97
+ stylelintのselector-type-no-unknownエラーが発生している場合、カスタム要素の命名が間違っているので、ステップ7に戻って必要な部分だけ修正せよ。
98
+ これらのタスクが完了したら、ステップ11を実行せよ。
99
+
100
+ # 11
101
+
102
+ カスタム要素を使用していた場合は、JSに`@d-zero/custom-components`を読み込め。
103
+
104
+ ```ts
105
+ import { defineXXXXX } from '@d-zero/custom-components/XXXXX';
106
+ defineXXXXX('c'); // プレフィックスは"c-"
107
+ ```
108
+
109
+ としろ。
110
+ `__assets/htdocs/js/script.ts`に上書きせずに追記せよ。
111
+ **他の実装は不要。**
112
+ **他の実装は不要!**
113
+ **他の実装は不要!!!**
114
+ これらのタスクが完了したら、ステップ12を実行せよ。
115
+
116
+ # 12
117
+
118
+ コンポーネントがどのページに影響するかを報告せよ。
119
+ どのページかどうかは`__assets/htdocs/`ディレクトリ内から`@include`もしくはクラス名を検索して特定せよ。
120
+ CLIを使って検索しても構わない。
121
+ これらのタスクが完了したら、ステップ13を実行せよ。
122
+
123
+ # 13
124
+
125
+ `git status`を実行して、変更があったファイルとその内容を確認せよ。
126
+ 差分は`git --no-pager diff <fileName>`で実行せよ。
127
+ 内容に問題があれば、各ステップに戻り修正せよ。
@@ -0,0 +1,110 @@
1
+ # 1
2
+
3
+ `use_mcp_tool:burger_editor`関連の実行を禁止する。
4
+ 指示があるまで一切の`list_files`、`search_files`、`read_file`および`write_to_file`を禁止する。
5
+ その他余計な推論やファイル読み込み操作はせずに次のステップに進め。
6
+
7
+ # 2
8
+
9
+ 対象のページと利用するコンポーネントをユーザーに要求せよ。
10
+
11
+ 得られた情報を次のYAMLのように整理し、スレッドに出力しユーザーの承認を待て。
12
+ この情報整理をこなすのには`use_mcp_tool:frontend_env:get_coding_guidelines(html)`の知識が必要である。
13
+
14
+ 例1:
15
+
16
+ ```yaml
17
+ pagePath: 000_home.pug
18
+ pageType: c-page-home
19
+ components:
20
+ - c-header
21
+ - c-hero
22
+ - c-section01
23
+ - c-section02
24
+ - c-banners
25
+ - c-footer
26
+ ```
27
+
28
+ 例2:
29
+
30
+ ```yaml
31
+ pageName: 100_sub.pug
32
+ pageType: c-page-sub
33
+ components:
34
+ - c-header
35
+ - c-page-title
36
+ - c-content-main
37
+ - c-banners
38
+ - c-footer
39
+ ```
40
+
41
+ 承認を得たら次のステップに進め。
42
+
43
+ # 3
44
+
45
+ `list_files`で`__assets/htdocs/_libs/component/`にファイルが存在するか確認せよ。
46
+ コンポーネントがない場合はタスクの一切を強制中止せよ。
47
+ コンポーネントがすべて揃っていれば次のステップに進め。
48
+
49
+ # 4
50
+
51
+ 前ステップで得た情報を元に、以下のようなpugファイルを`write_to_file`せよ。
52
+
53
+ ```pug
54
+ html(lang="ja")
55
+ head
56
+ include /mixin/meta.pug
57
+ +meta('__サイトタイトル__')
58
+ body.c-page-home
59
+ .c-page-home__base
60
+ .c-page-home__header
61
+ include /component/c-header.pug
62
+ .c-page-home__hero
63
+ include /component/c-hero.pug
64
+ .c-page-home__section01
65
+ include /component/c-section01.pug
66
+ .c-page-home__section02
67
+ include /component/c-section02.pug
68
+ .c-page-home__banners
69
+ include /component/c-banners.pug
70
+ .c-page-home__footer
71
+ include /component/c-footer.pug
72
+ ```
73
+
74
+ ```pug
75
+ html(lang="ja")
76
+ head
77
+ include /mixin/meta.pug
78
+ +meta('__サイトタイトル__')
79
+ body.c-page-sub
80
+ .c-page-sub__base
81
+ .c-page-sub__header
82
+ include /component/c-header.pug
83
+ .c-page-sub__page-title
84
+ include /component/c-page-title.pug
85
+ .c-page-sub__content-main
86
+ include /component/c-content-main.pug
87
+ .c-page-sub__banners
88
+ include /component/c-banners.pug
89
+ .c-page-sub__footer
90
+ include /component/c-footer.pug
91
+ ```
92
+
93
+ 既に同名のファイルが存在する場合は、**既存のコードは一切参考にせずすべて削除し**指示された構造をそのまま反映せよ。
94
+ 作成したら、`__assets/htdocs/__tmpl/`に保存せよ。`__assets/htdocs/__tmpl/`の外に作ってはならない。
95
+ パスはViteの機能に従い`/component/`で始めことができる。
96
+ ファイルのナンバリングは重要である。
97
+ 保存したら次のステップに進め。
98
+
99
+ # 5
100
+
101
+ `__assets/htdocs/_libs/component/`のコンポーネントと対になっているSASSファイルが同フォルダに存在するので、それを`__assets/htdocs/css/style.scss`に追記せよ。
102
+ 保存したら次のステップに進め。
103
+
104
+ # 6
105
+
106
+ タスクは完了である。以下は不要。
107
+
108
+ - ビルド
109
+ - ブラウザチェック
110
+ - テスト
@@ -0,0 +1,68 @@
1
+ # 1
2
+
3
+ URLをユーザーに尋ねて`execute_command:curl`を実行し構造を把握せよ。
4
+ 文字コードがUTF-8でない場合は変換コマンドをパイプして構造を把握せよ。
5
+ ページサイズが5MBを超えないのであれば`head`コマンド使わずに一度に取得せよ。
6
+ 把握できたらステップ2に進め。
7
+
8
+ # 2
9
+
10
+ `browser_action`を実行しメインコンテンツのレイアウトと内容を視覚的に解析せよ。
11
+ 画面固定されているバナーがあれば閉じよ。
12
+ 予期せぬページ移動や画面遷移があれば直ちに停止しユーザーに指示を仰げ。
13
+ 把握できたらステップ3に進め。
14
+
15
+ # 3
16
+
17
+ 取得したメインコンテンツの各ブロック(セクションではない)をレイアウトタイプと内容をMarkdown+frontmatter形式の単一のファイルに書き出せ。
18
+ 保存先は`.cache`ディレクトリで、ブロックごとにファイルを分けること。
19
+ ファイル名はURLとブロック名を組み合わせて、ブロックの順番に連番にせよ。
20
+ 内容のフォーマットは次の通り。
21
+
22
+ ```markdown
23
+ ---
24
+ url: https://example.com/path/to/page
25
+ blockType: '{{block_type}}'
26
+ ---
27
+
28
+ {{section_content_body}}
29
+ ```
30
+
31
+ Frontmatterの情報は`url`と`blockType`の2つのみ。他の指定は禁止。
32
+
33
+ ## block_type
34
+
35
+ `use_mcp_tool:burger_editor:get_block_type`
36
+
37
+ ## section_content_body
38
+
39
+ - Markdown形式
40
+ - 画像はURLをそのまま記載
41
+ - 画像のalt属性は抽出する
42
+ - 画像のキャプションはalt属性と明確に区別し抽出
43
+ - layout_typeに基づくカラムの区切りは`<!-- column-separator -->\n---\n<!-- column-separator -->`で記載
44
+ - Markdownで表現できない特性があれば`<!-- -->`の形式でコメントとして記載
45
+ - 例:
46
+ - `<!-- 見出しレベルは見た目と矛盾している -->`
47
+ - `<!-- 画像はアニメーションGIF -->`
48
+ - `<!-- iframeのURL -->`
49
+ - `<!-- YouTubeのURL -->`
50
+ - `<!-- Google MapsのURLもしくは緯度経度 -->`
51
+ - カルーセルは画像をリストとして記載
52
+
53
+ # 4
54
+
55
+ 生成した各ファイルに対して次を実行せよ。
56
+ `use_mcp_tool:burger_editor:get_block_data_params_v3`を実行し、`blockType`を`blockName`に渡して必要パラメータを取得せよ。
57
+ 取得したパラメータを元に`use_mcp_tool:burger_editor:create_block_v3`を実行し、`blockName`を`data`に渡して、HTMLを取得せよ。
58
+ 取得したHTMLを同名で拡張子を`.html`にして保存せよ。
59
+
60
+ # 5
61
+
62
+ 生成したHTMLを`execute_command:cat`で1つのファイルにまとめよ。
63
+ 取得したURLと同様のパスとファイル名で`./htdocs`に保存せよ。
64
+ URLが`https://example.com/path/to/page`であれば、保存先は`./htdocs/path/to/page.html`となる。
65
+
66
+ # 6
67
+
68
+ 完了
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d-zero/scaffold",
3
- "version": "5.0.0-alpha.44",
3
+ "version": "5.0.0-alpha.46",
4
4
  "description": "Frontend scaffold files of D-ZERO Co., Ltd.",
5
5
  "repository": "https://github.com/d-zero-dev/frontend-env.git",
6
6
  "author": "D-ZERO Co., Ltd.",
@@ -37,27 +37,28 @@
37
37
  "last 2 ios_saf version"
38
38
  ],
39
39
  "devDependencies": {
40
- "@d-zero/builder": "5.0.0-alpha.44",
41
- "@d-zero/linters": "5.0.0-alpha.61",
42
- "@d-zero/postcss-config": "5.0.0-alpha.44",
40
+ "@d-zero/builder": "5.0.0-alpha.46",
41
+ "@d-zero/linters": "5.0.0-alpha.63",
42
+ "@d-zero/postcss-config": "5.0.0-alpha.46",
43
43
  "@d-zero/tsconfig": "0.4.1",
44
- "@types/node": "22.13.10",
44
+ "@types/node": "22.15.19",
45
45
  "cross-env": "7.0.3",
46
46
  "husky": "9.1.7",
47
- "npm-run-all2": "7.0.2",
48
- "sass": "1.85.1",
49
- "typescript": "5.8.2",
50
- "vitest": "3.0.8"
47
+ "npm-run-all2": "8.0.2",
48
+ "sass": "1.89.0",
49
+ "typescript": "5.8.3",
50
+ "vitest": "3.1.3"
51
51
  },
52
52
  "dependencies": {
53
+ "@d-zero/custom-components": "5.0.0-alpha.46",
53
54
  "destyle.css": "4.0.1",
54
- "dialog-toggle-events-polyfill": "1.1.2",
55
- "invokers-polyfill": "0.5.2",
55
+ "dialog-toggle-events-polyfill": "1.1.4",
56
+ "invokers-polyfill": "0.5.4",
56
57
  "tslib": "2.8.1"
57
58
  },
58
59
  "volta": {
59
- "node": "22.14.0",
60
+ "node": "22.15.1",
60
61
  "yarn": "1.22.22"
61
62
  },
62
- "gitHead": "203bd77b8ad7bb5b4eefd69302ccb4770ffc32c2"
63
+ "gitHead": "5739429584e4a491fc93662a25948539bb87c550"
63
64
  }
@@ -1,4 +0,0 @@
1
- // サイトで最も明るい色
2
- $lightest-color: #fff;
3
- // サイトで最も暗い色
4
- $darkest-color: #333;
@@ -1,53 +0,0 @@
1
- // # タイポグラフィ
2
- // @see https://techblog.yahoo.co.jp/entry/2023052430423559/
3
- $base-font-size: 17;
4
- $base-line-height: 1.8;
5
-
6
- // # 寸法
7
- //
8
- $breakpoint-xs: 576;
9
- $breakpoint-sm: 768;
10
- $breakpoint-md: 992;
11
- $breakpoint-lg: 1200;
12
-
13
- // xsのみ
14
- @custom-media --xs (max-width: #{$breakpoint-xs * 1px});
15
-
16
- // smのみ
17
- @custom-media --sm (min-width: #{$breakpoint-xs * 1px}) and (max-width: #{$breakpoint-sm * 1px - 1px});
18
-
19
- // mdのみ
20
- @custom-media --md (min-width: #{$breakpoint-sm * 1px}) and (max-width: #{$breakpoint-md * 1px - 1px});
21
-
22
- // lgのみ
23
- @custom-media --lg (min-width: #{$breakpoint-md * 1px}) and (max-width: #{$breakpoint-lg * 1px - 1px});
24
-
25
- // xlのみ
26
- @custom-media --xl (min-width: #{$breakpoint-lg * 1px});
27
-
28
- // xs以下 = xsのみ
29
- @custom-media --xs-lte (max-width: #{$breakpoint-xs * 1px - 1px});
30
-
31
- // sm以下
32
- @custom-media --sm-lte (max-width: #{$breakpoint-sm * 1px - 1px});
33
-
34
- // md以下
35
- @custom-media --md-lte (max-width: #{$breakpoint-md * 1px - 1px});
36
-
37
- // lg以下
38
- @custom-media --lg-lte (max-width: #{$breakpoint-lg * 1px - 1px});
39
-
40
- // xs超え
41
- @custom-media --xs-gt (min-width: #{$breakpoint-xs * 1px});
42
-
43
- // sm超え
44
- @custom-media --sm-gt (min-width: #{$breakpoint-sm * 1px});
45
-
46
- // md超え
47
- @custom-media --md-gt (min-width: #{$breakpoint-md * 1px});
48
-
49
- // lg超え
50
- @custom-media --lg-gt (min-width: #{$breakpoint-lg * 1px});
51
-
52
- // high resolution
53
- @custom-media --hr (min-resolution: 2dppx);
@@ -1,2 +0,0 @@
1
- $font-family-body: sans-serif;
2
- $font-family-heading: Helvetica, $font-family-body;
@@ -1,3 +0,0 @@
1
- @forward 'color';
2
- @forward 'dimension';
3
- @forward 'font';
package/coding-rule.mdc DELETED
@@ -1,163 +0,0 @@
1
- # コーディングに関するAIエージェントの規定
2
-
3
- ## プロンプトに対する振る舞い
4
-
5
- ### コード生成
6
-
7
- コード生成に関する指令を受けたときは、以下の手順で基本的に対応する。
8
-
9
- <!-- ユーザー向け情報: @d-zero/mcp-serverをCLINEに設定している前提 -->
10
-
11
- - コーディングガイドラインをMCPサーバ経由で読み、一旦内容を記憶する
12
- - FigmaのURLを受け取り、MCPサーバ経由でFigmaのFileデータを取得する
13
- - FigmaのFileデータを解析し、指令に対応するコンポーネントの準備をする
14
- - 必要なコンポーネントファイルを作成する
15
- - マークアップの形式はPugが良いかHTMLが良いかは最初は尋ねる
16
- - 要素の順番はスクリーンリーダーやフォーカスの順番に依存し重要であるため、Figmaレイヤーの順番にはこだわらず、情報設計的な在り方を最優先に視覚的な配置を加味して順番を決定する
17
- - マークアップは暗黙のロールに気をつけて、然るべきHTML要素を採用すること
18
- - 選択肢がいくつもある場合はユーザーに尋ねること
19
- - CSSを変更した際にStylelintの警告が発生するが、保存と同時に自動修正がかかる場合があるので、保存実行後は内容を再読み込みしてから必要な警告は再把握すること
20
-
21
- ## 実装方針
22
-
23
- コード生成にあたってコーディングガイドラインにない細かい実装方針を記す。
24
-
25
- ### 全般
26
-
27
- - Linterの警告は数回トライして直せない場合は、無効化するかどうかユーザーに尋ねる
28
- - cSpellの警告は単純なスペルミスは修正し、固有名詞と思われるものであれば`cspell.json`に単語を追加する
29
- - 省略可能単語はコーディングガイドラインに準ずる
30
-
31
- ### HTML
32
-
33
- - ページ遷移しない(リンクでない)インタラクションにa要素を使わない
34
- - WAI-ARIAを用いる必要があるときは適宜ユーザーに確認する
35
- - WAI-ARIAを必要とする基準はARIA Authoring Practice Guideのコンポーネント
36
- - APG以外に必要とする例外
37
- - aria-currentはパンくず、フォームのプロセスなどに用いる
38
- - data属性はJSでインタラクティブな状態変化をつけるときのみに用いて静的なスタイルを適用しない
39
- - 改行でbr要素使わず、span要素とdisplay:block/inline-blockを活用する
40
- - 詩・ポエムは除く
41
-
42
- ### CSS
43
-
44
- - ウィンドウ幅がどの幅でも横スクロールを発生させない
45
- - data属性はJSでインタラクティブな状態変化をつけるときのみに用いて静的なスタイルを適用しない
46
- - 色を使用する場合は、:rootにカスタムプロパティを定義して使用する
47
- - 参照する際に `var(--primary-color, #000)` のようなフォールバック用の第2引数は用いない
48
-
49
- ### JavaScript
50
-
51
- - TypeScriptで書く
52
- - if/elseifよりもswitch/caseやハッシュマップを用いる
53
- - なるべく早期returnを用いてネストを深くしない
54
- - 関数はひとつのファイルに切り出す
55
- - 純粋関数はテストコードを書くかどうかユーザーに尋ねる
56
- - テストはvitestを用いる
57
- - テストファイルは `*.spec.ts` という命名にする
58
- - 一般的なデザインパターンに当てはまらないならclassは用いずに関数ベースの実装をする
59
- - JSDocsは日本語で書く
60
- - `<script type="module">`を用いてモジュール化しているので`DOMContentLoaded`イベントは**不要**
61
- - document.querySelectorなどで要素の型をジェネリクスで受け取る場合、`HTMLElement`型を用いてよい
62
- - HTMLやCSSクラスと照らし合わせて、セレクタの対象要素の種類が明らかな場合は`HTMLInputElement`型などを用いてよい
63
- - `any`型に関して
64
- - `any`型を定義する場合は`unknown`型に置き換える
65
- - モジュールの型定義がない場合は、暗黙の`any`型として実装するが、プロパティやメソッドを利用する際に明示的に型を指定する
66
- - 型エラーに関して
67
- - 定義されていないプロパティやメソッドを利用する際には、型エラーが発生するが、その場合はユーザーに確認を取り以下のいずれかの対応を取る
68
- - `@ts-ignore`を利用してエラーを無視する
69
- - `in`演算子を利用してプロパティの存在を確認する
70
- - 型を新たに定義してエラーを回避する
71
- - ESLintの警告はWarningレベルでも修正する
72
-
73
- ### コンポーネント
74
-
75
- #### ランドマーク
76
-
77
- - ランドマークはページコンポーネント(`c-page-*`)に実装し、UIコンポーネントには使用しない
78
- - ここでいうランドマークはLandmark Roleを持つ要素のことで以下の要素を指す
79
- - `<header>`
80
- - `<footer>`
81
- - `<nav>`
82
- - `<main>`
83
- - `<aside>`
84
-
85
- #### インタラクティブコンポーネント
86
-
87
- - インタラクティブな呼び出し元ボタンはbutton要素を用いる
88
- - アクションはcommand属性を用いる
89
- - command属性に規定されているアクションはそのまま活用する
90
- - `command="toggle-popover"`はポップオーバーUIの開閉を行う
91
- - `command="show-popover"`はポップオーバーUIの展開を行う
92
- - `command="hide-popover"`はポップオーバーUIの収納を行う
93
- - `command="show-modal"`はモーダルUIの展開を行う
94
- - `command="close"`はモーダルUIの収納を行う
95
- - 上記以外はカスタムコマンドを用意する
96
- - カスタムコマンドは`command="--command-name"`のように記述して、実装はJavaScriptに記述する
97
- - 規定アクション中に内部的な処理を施す場合はCommandEventを利用してJavaScriptに記述する
98
- - 状況によっては`beforetoggle`や`toggle`、`close`などのイベントが適切なので適宜利用する
99
-
100
- ### カスタムコマンドの実装例
101
-
102
- ```html
103
- <button command="--custom-command" commandfor="target01">カスタムコマンド</button>
104
-
105
- <div id="target01">カスタムコマンドの対象</div>
106
- ```
107
-
108
- ```typescript
109
- for (button of document.querySelectorAll<HTMLButtonElement>('[command]')) {
110
- const targetId = button.getAttribute('commandfor') ?? null;
111
- if (!targetId) {
112
- continue;
113
- }
114
- const target = document.getElementById(targetId);
115
- target?.addEventListener('command', (e) => {
116
- switch (e.command) {
117
- case '--custom-command': {
118
- const invoker: HTMLButtonElement = e.source; // 呼び出し元ボタンの特定
119
- // カスタムコマンドの処理
120
- console.log(`Hello, Custom Command: ${e.command}`);
121
- break;
122
- }
123
- }
124
- });
125
- }
126
- ```
127
-
128
- ### 規定アクションのイベントフックの実装例
129
-
130
- ```html
131
- <button type="button" command="show-modal" commandfor="dialog01">メニュー</button>
132
-
133
- <dialog id="dialog01" aria-labelledby="dialog01-title">
134
- <h2 id="dialog01-title">メニュー</h2>
135
- <p>メニューの内容</p>
136
- </dialog>
137
- ```
138
-
139
- ```typescript
140
- for (button of document.querySelectorAll<HTMLButtonElement>('[command]')) {
141
- const targetId = button.getAttribute('commandfor') ?? null;
142
- if (!targetId) {
143
- continue;
144
- }
145
- const target = document.getElementById(targetId);
146
- target?.addEventListener('command', (e) => {
147
- switch (e.command) {
148
- case 'show-modal': {
149
- const invoker: HTMLButtonElement = e.source; // 呼び出し元ボタンの特定
150
- // フック処理
151
- console.log(`Invoked: ${e.command}`);
152
- break;
153
- }
154
- }
155
- });
156
-
157
- // もしくは<dialog>要素であればbeforetoggleやtoggleイベントなどを利用できる
158
- target?.addEventListener('beforetoggle', (e) => {
159
- // フック処理
160
- console.log(`Fired: beforetoggle`);
161
- });
162
- }
163
- ```