@aramassa/ai-rules 0.1.1-npmjs.20250910072942

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 (72) hide show
  1. package/README-npmjs.md +37 -0
  2. package/README.md +37 -0
  3. package/artifact/chatmodes/Instruction Improve.md +142 -0
  4. package/artifact/chatmodes/Planning.md +173 -0
  5. package/artifact/instructions/git-rules.md +68 -0
  6. package/artifact/instructions/package-management.md +113 -0
  7. package/artifact/instructions/planning.md +54 -0
  8. package/artifact/instructions/python/workspace-management.md +673 -0
  9. package/artifact/instructions/python-cli.md +261 -0
  10. package/artifact/instructions/retrospective.md +32 -0
  11. package/artifact/instructions/rules/coding/nodejs.md +299 -0
  12. package/artifact/instructions/rules/coding/openai.md +39 -0
  13. package/artifact/instructions/rules/coding/typescript.md +92 -0
  14. package/artifact/instructions/rules/development/ansible.md +258 -0
  15. package/artifact/instructions/rules/development/code-quality-tools.md +181 -0
  16. package/artifact/instructions/rules/development/github.md +140 -0
  17. package/artifact/instructions/rules/development/npm-publish.md +108 -0
  18. package/artifact/instructions/rules/development/typescript-rollup-build.md +249 -0
  19. package/artifact/instructions/rules/development/typescript.md +46 -0
  20. package/artifact/instructions/rules/documentation/common.md +16 -0
  21. package/artifact/instructions/rules/documentation/docs-ai-external.md +12 -0
  22. package/artifact/instructions/rules/documentation/docs-ai-history.md +46 -0
  23. package/artifact/instructions/rules/documentation/docs-ai-internal.md +70 -0
  24. package/artifact/instructions/rules/documentation/docs-ai-learning.md +53 -0
  25. package/artifact/instructions/rules/documentation/docs.md +41 -0
  26. package/artifact/instructions/rules/documentation/github-protection.md +122 -0
  27. package/artifact/instructions/rules/test/e2e-bdd.md +31 -0
  28. package/artifact/instructions/rules/test/nodejs-test-restrictions.md +101 -0
  29. package/artifact/instructions/rules/test/timeout-configuration-typescript.md +67 -0
  30. package/artifact/instructions/rules/test/timeout-configuration.md +89 -0
  31. package/artifact/instructions/skel/common/change_plans/.gitkeep +0 -0
  32. package/artifact/instructions/skel/common/docs/.gitkeep +0 -0
  33. package/artifact/instructions/skel/common/docs_ai/.gitkeep +0 -0
  34. package/artifact/instructions/skel/common/skel/.gitkeep +0 -0
  35. package/artifact/instructions/skel/common/todo_plans/.gitkeep +0 -0
  36. package/artifact/instructions/skel/typescript/tsconfig.build.json +17 -0
  37. package/artifact/instructions/skel/typescript/tsconfig.json +117 -0
  38. package/artifact/instructions/skel/typescript/tsdoc.json +4 -0
  39. package/artifact/instructions/skel.md +88 -0
  40. package/artifact/instructions/todo_planning.md +25 -0
  41. package/artifact/instructions/tyding-up.md +30 -0
  42. package/dist/cli.d.ts +3 -0
  43. package/dist/cli.d.ts.map +1 -0
  44. package/dist/cli.js +10934 -0
  45. package/dist/filter.d.ts +8 -0
  46. package/dist/filter.d.ts.map +1 -0
  47. package/dist/filter.js +72 -0
  48. package/dist/index.d.ts +1 -0
  49. package/dist/index.d.ts.map +1 -0
  50. package/dist/index.js +1 -0
  51. package/dist/optionValidator.d.ts +28 -0
  52. package/dist/optionValidator.d.ts.map +1 -0
  53. package/dist/optionValidator.js +29 -0
  54. package/dist/templateEngine.d.ts +55 -0
  55. package/dist/templateEngine.d.ts.map +1 -0
  56. package/dist/templateEngine.js +124 -0
  57. package/dist/utils/objectUtils.d.ts +11 -0
  58. package/dist/utils/objectUtils.d.ts.map +1 -0
  59. package/dist/utils/objectUtils.js +17 -0
  60. package/dist/utils/test/structureExtractors.d.ts +30 -0
  61. package/dist/utils/test/structureExtractors.d.ts.map +1 -0
  62. package/dist/utils/test/structureExtractors.js +164 -0
  63. package/dist/variableResolver.d.ts +68 -0
  64. package/dist/variableResolver.d.ts.map +1 -0
  65. package/dist/variableResolver.js +190 -0
  66. package/package.json +69 -0
  67. package/presets/README.md +109 -0
  68. package/presets/basic.yaml +14 -0
  69. package/presets/chatmodes.yaml +64 -0
  70. package/presets/docs-ai.yaml +7 -0
  71. package/presets/infrastructure-ansible.yaml +19 -0
  72. package/presets/typescript.yaml +16 -0
@@ -0,0 +1,122 @@
1
+ ---
2
+ type: documentation
3
+ category: github-protection
4
+ focus: file-protection
5
+ applyTo: "**/*"
6
+ human-instruction: |-
7
+ ## .github ディレクトリの編集について
8
+
9
+ このルールは、AIエージェントが .github ディレクトリ下のファイルを編集することを禁止するものです。
10
+ これらのファイルは人間が慎重に設計したAI向けの指示や設定が含まれており、
11
+ 個別の案件で「ついで」に修正すると、その後のAIコーディング品質に予期しない影響を与える可能性があります。
12
+
13
+ 人間の開発者の方へ:
14
+ - .github ディレクトリの変更は慎重に検討してください
15
+ - 変更が必要な場合は、その影響範囲を十分に検討してください
16
+ - AIコーディング品質への影響を評価してください
17
+ ---
18
+
19
+ # GitHub Directory Protection Rules
20
+
21
+ ## 概要
22
+
23
+ `.github` ディレクトリ下にあるファイルは、AI エージェントによる編集を**禁止**します。これらのファイルには AI 向けの指示や設定が含まれており、安易な編集は AI コーディング品質に重大な影響を与える可能性があります。
24
+
25
+ ## 基本ルール
26
+
27
+ ### 編集禁止の対象
28
+
29
+ 以下のファイル・ディレクトリは AI エージェントによる編集を**絶対に**禁止します:
30
+
31
+ - `.github/instructions/` - AI向けの指示ファイル
32
+ - `.github/copilot-instructions.md` - GitHub Copilot向けの指示
33
+ - `.github/workflows/` - CI/CD ワークフロー設定
34
+ - `.github/ISSUE_TEMPLATE/` - Issue テンプレート
35
+ - `.github/PULL_REQUEST_TEMPLATE.md` - PR テンプレート
36
+ - その他 `.github/` 下のすべてのファイル
37
+
38
+ ### 厳格な禁止事項
39
+
40
+ 1. **ファイルの編集**: 内容の変更、追記、削除は一切禁止
41
+ 2. **ファイルの削除**: ファイル全体の削除は**特に厳禁**
42
+ 3. **ファイルの作成**: 新規ファイルの作成も原則禁止
43
+ 4. **ディレクトリの変更**: ディレクトリ構造の変更も禁止
44
+
45
+ ## 理由・背景
46
+
47
+ ### AI コーディング品質への影響
48
+
49
+ - `.github` 下のファイルは AI エージェントの動作を制御する重要な設定
50
+ - 人間が慎重に検討して作成された指示やルールが含まれている
51
+ - 無断で変更すると、その後のすべての AI コーディング作業に影響が波及する
52
+
53
+ ### 管理の一元化
54
+
55
+ - AI コーディング品質は厳格にコントロールする必要がある
56
+ - 個別の案件で「ついで」のように修正してはいけない
57
+ - 変更は専用のタスクとして、慎重に検討して実施する
58
+
59
+ ## 実装ガイドライン
60
+
61
+ ### PR での確認事項
62
+
63
+ 1. **差分チェック**: PR に `.github/` 下のファイル変更が含まれていないことを確認
64
+ 2. **意図確認**: もし変更が含まれている場合は、その必要性を厳格に検証
65
+ 3. **影響評価**: 変更による AI コーディング品質への影響を評価
66
+
67
+ ### 例外的な編集が必要な場合
68
+
69
+ 明確に編集が必要な状況でない限り、以下のルールに従う:
70
+
71
+ 1. **事前相談**: 人間の開発者に編集の必要性を相談する
72
+ 2. **影響範囲の確認**: 変更がもたらす影響を十分に検討する
73
+ 3. **最小限の変更**: 必要最小限の変更に留める
74
+ 4. **詳細な説明**: 変更理由と影響を詳細に文書化する
75
+
76
+ ## 違反例と対応
77
+
78
+ ### ❌ 悪い例
79
+
80
+ ```
81
+ # 個別機能実装時に「ついで」で .github ファイルを修正
82
+ - feature: Add new API endpoint
83
+ - fix: Update CI workflow (← これは禁止)
84
+ - docs: Fix typo in copilot-instructions.md (← これも禁止)
85
+ ```
86
+
87
+ ### ✅ 良い例
88
+
89
+ ```
90
+ # .github ファイルの変更は避ける
91
+ - feature: Add new API endpoint
92
+ - test: Add tests for new API endpoint
93
+ - docs: Update README with API usage
94
+ ```
95
+
96
+ ### 緊急時の対応
97
+
98
+ もし誤って `.github` ファイルを変更してしまった場合:
99
+
100
+ 1. **即座に復元**: `git checkout HEAD~1 .github/` で変更前の状態に戻す
101
+ 2. **変更内容の確認**: 何が変更されたかを確認する
102
+ 3. **影響評価**: 変更による影響がないか確認する
103
+ 4. **報告**: 人間の開発者に状況を報告する
104
+
105
+ ## 運用における注意点
106
+
107
+ ### AI エージェント開発者向け
108
+
109
+ - このルールは AI エージェントの品質保証のために設けられている
110
+ - `.github` ディレクトリへの変更は、専用のタスクとして別途検討する
111
+ - 不明な点がある場合は、必ず人間の開発者に確認を取る
112
+
113
+ ### 人間の開発者向け
114
+
115
+ - `.github` ディレクトリの変更は慎重に行う
116
+ - 変更時は、AI コーディング品質への影響を十分に検討する
117
+ - 必要に応じて、このルールファイル自体も更新する
118
+
119
+ ## 関連ドキュメント
120
+
121
+ - [GitHub Issue Template Rules](github.md) - Issue テンプレートの使用方法
122
+ - [Documentation Guidelines](common.md) - ドキュメント作成の基本方針
@@ -0,0 +1,31 @@
1
+ ---
2
+ type: test
3
+ framework: bdd
4
+ ---
5
+
6
+ ## E2E BDD テストの目的
7
+
8
+ E2E BDD (Behavior-Driven Development) テストは、システム全体の動作をユーザー視点で検証することを目的としています。これにより、要件が正しく実装されているか、ユーザーの期待に応える動作をしているかを確認します。
9
+
10
+ ## BDD 記述言語
11
+
12
+ Gauge 記法を使用して、シナリオを自然言語で記述します。以下の要素を含めます。
13
+
14
+ ### シナリオ記述箇所
15
+
16
+ /e2e/ ディレクトリに、各機能や要件ごとにサブディレクトリを作成し、その中にシナリオファイルを配置します。
17
+ ファイル名は `機能名.gauge.md` とします。
18
+
19
+ ## テスト実行対象とツール
20
+
21
+ ### Web GUI アプリケーション
22
+
23
+ ### Web HTTP API
24
+
25
+ ### Web HTTP API (SSE)
26
+
27
+ ### CLI/TUI アプリケーション
28
+
29
+ ### MCPサーバ (STDOUT)
30
+
31
+ ### MCPサーバ (HTTP API)
@@ -0,0 +1,101 @@
1
+ ---
2
+ type: test
3
+ category: restrictions
4
+ focus: structure
5
+ language:
6
+ - typescript
7
+ - nodejs
8
+ ---
9
+
10
+ # Node.js/TypeScript テストコード制限
11
+
12
+ ## 概要
13
+
14
+ Node.js/TypeScript プロジェクトでスケルトン構造検証システムを使用する場合のテストコード制限事項です。
15
+
16
+ ## 制限事項
17
+
18
+ ### it.each の使用禁止
19
+
20
+ **`it.each` は使用してはいけません**
21
+
22
+ #### 理由
23
+
24
+ - スケルトン構造検証システム(`test/skeleton-structure-validation.test.ts`)が正常に動作しなくなるため
25
+ - `it.each` はテストケースを動的に生成するため、静的解析によるスケルトンファイル(`skel/test/`)との構造比較ができない
26
+ - スケルトンファイルの構造同期が破綻し、CI/CD パイプラインでエラーが発生する
27
+
28
+ #### 対象フレームワーク
29
+
30
+ - Vitest
31
+ - Jest
32
+ - その他の `it.each` をサポートするテストフレームワーク
33
+
34
+ #### 代替手段
35
+
36
+ 複数のテストケースが必要な場合は、個別の `it` ブロックを明示的に記述してください。
37
+
38
+ ```typescript
39
+ // ❌ 禁止: it.each の使用
40
+ it.each([
41
+ { input: 1, expected: 2 },
42
+ { input: 2, expected: 4 },
43
+ { input: 3, expected: 6 },
44
+ ])('should multiply by 2: $input -> $expected', ({ input, expected }) => {
45
+ expect(multiply(input, 2)).toBe(expected);
46
+ });
47
+
48
+ // ✅ 推奨: 個別の it ブロック
49
+ describe('multiply function', () => {
50
+ it('should multiply 1 by 2 to get 2', () => {
51
+ expect(multiply(1, 2)).toBe(2);
52
+ });
53
+
54
+ it('should multiply 2 by 2 to get 4', () => {
55
+ expect(multiply(2, 2)).toBe(4);
56
+ });
57
+
58
+ it('should multiply 3 by 2 to get 6', () => {
59
+ expect(multiply(3, 2)).toBe(6);
60
+ });
61
+ });
62
+ ```
63
+
64
+ #### ヘルパー関数を使った構造化
65
+
66
+ 多くのテストケースが必要な場合は、ヘルパー関数を使用して構造化できます:
67
+
68
+ ```typescript
69
+ // ✅ 推奨: ヘルパー関数を使った構造化
70
+ describe('multiply function', () => {
71
+ const testCases = [
72
+ { input: 1, expected: 2 },
73
+ { input: 2, expected: 4 },
74
+ { input: 3, expected: 6 },
75
+ ];
76
+
77
+ // ヘルパー関数でテストケースを生成
78
+ const createMultiplyTest = (input: number, expected: number) => {
79
+ return () => {
80
+ expect(multiply(input, 2)).toBe(expected);
81
+ };
82
+ };
83
+
84
+ it('should multiply 1 by 2 to get 2', createMultiplyTest(1, 2));
85
+ it('should multiply 2 by 2 to get 4', createMultiplyTest(2, 4));
86
+ it('should multiply 3 by 2 to get 6', createMultiplyTest(3, 6));
87
+ });
88
+ ```
89
+
90
+ ## 関連情報
91
+
92
+ - [スケルトン構造管理ルール](../skel.md)
93
+ - [Node.js コーディング規約](../coding/nodejs.md#テスト方針)
94
+
95
+ ## 影響範囲
96
+
97
+ この制限は以下のプロジェクトに適用されます:
98
+
99
+ - スケルトン構造検証システム(`test/skeleton-structure-validation.test.ts`)を使用するプロジェクト
100
+ - `skel/test/` ディレクトリを持つプロジェクト
101
+ - Node.js/TypeScript プロジェクト
@@ -0,0 +1,67 @@
1
+ ---
2
+ type: test
3
+ category: configuration
4
+ focus: timeout
5
+ language: typescript
6
+ ---
7
+
8
+ # TypeScript / Vitest でのテストタイムアウト設定
9
+
10
+ ## 概要
11
+
12
+ TypeScript プロジェクトで Vitest を使用する際のテストタイムアウト設定に関する具体的なガイドラインです。
13
+
14
+ ## 推奨設定
15
+
16
+ ### デフォルトタイムアウト設定
17
+
18
+ - **推奨値**: `vitest.config.ts` で `testTimeout: 20000` (20秒) を設定する
19
+ - **理由**: Vitest のデフォルト 5000ms では、CLI テストやファイル I/O を伴うテストで失敗する可能性が高い
20
+
21
+ ### 個別テストでのタイムアウト上書き
22
+
23
+ - **長時間テスト**: `{ timeout: 60000 }` オプションを使用してタイムアウトを上書きする
24
+ - **対象**: Docker コンテナ起動、大きなファイル操作、外部 API 呼び出しなど
25
+
26
+ ### CI 環境での考慮事項
27
+
28
+ - **タイムアウト値**: CI 環境では処理が遅くなる可能性を考慮し、本番環境より 1.5〜2 倍のタイムアウト値を設定する
29
+
30
+ ## 実装例
31
+
32
+ ### vitest.config.ts での設定
33
+
34
+ ```typescript
35
+ import { defineConfig } from "vitest/config";
36
+
37
+ export default defineConfig({
38
+ test: {
39
+ globals: true,
40
+ environment: "node",
41
+ testTimeout: 20000, // デフォルト20秒
42
+ coverage: {
43
+ reporter: ["text", "json", "html"],
44
+ },
45
+ },
46
+ });
47
+ ```
48
+
49
+ ### 個別テストでのタイムアウト上書き例
50
+
51
+ ```typescript
52
+ describe("CLI テスト", () => {
53
+ it("should process large files", async () => {
54
+ // 長時間処理用に60秒に設定
55
+ }, { timeout: 60000 });
56
+
57
+ it("should start Docker container", async () => {
58
+ // Docker起動用に90秒に設定
59
+ }, { timeout: 90000 });
60
+ });
61
+ ```
62
+
63
+ ## ベストプラクティス
64
+
65
+ - **段階的な設定**: まずデフォルトタイムアウト(20秒)で実行し、必要に応じて個別テストで調整
66
+ - **適切な値の選択**: 処理内容に応じた適切なタイムアウト値を設定(過度に長すぎない)
67
+ - **CI 環境での検証**: CI 環境でも安定して動作することを確認
@@ -0,0 +1,89 @@
1
+ ---
2
+ type: test
3
+ category: configuration
4
+ focus: timeout
5
+ ---
6
+
7
+ # テストタイムアウト設定に関する注意事項
8
+
9
+ ## 概要
10
+
11
+ このドキュメントでは、テスト実行時のタイムアウト設定に関する重要な注意事項とガイドラインを記載します。適切なタイムアウト設定は、テストの安定性と実行時間のバランスを保つために不可欠です。
12
+
13
+ ## 基本原則
14
+
15
+ ### デフォルトタイムアウト設定
16
+
17
+ - **推奨値**: テスト設定ファイルで `testTimeout: 20000` (20秒) を設定する
18
+ - **理由**: 多くのテストフレームワークのデフォルト 5000ms では、CLI テストやファイル I/O を伴うテストで失敗する可能性が高い
19
+ - **対象**: 一般的なユニットテスト、統合テスト、軽量なCLIテスト
20
+
21
+ ### 長時間テスト用の個別設定
22
+
23
+ - **方法**: 個別テストで `{ timeout: 60000 }` オプションを使用してタイムアウトを上書きする
24
+ - **対象例**:
25
+ - Docker コンテナ起動を伴うテスト
26
+ - 大きなファイル操作を伴うテスト
27
+ - 外部 API 呼び出しを伴うテスト
28
+ - ネットワーク I/O が発生するテスト
29
+
30
+ ### CI 環境での考慮事項
31
+
32
+ - **タイムアウト値**: CI 環境では処理が遅くなる可能性を考慮し、本番環境より 1.5〜2 倍のタイムアウト値を設定する
33
+ - **環境差**: CI 環境では CPU やディスク I/O が制限される場合があるため、余裕を持った設定が必要
34
+
35
+ ## 設定例
36
+
37
+ ### テスト設定ファイルの設定例
38
+
39
+ テストフレームワークの設定ファイルで、デフォルトタイムアウト値を設定します:
40
+
41
+ ```
42
+ testTimeout: 20000 // 20秒 - CLIテストやファイルI/O対応
43
+ ```
44
+
45
+ ### 個別テストでのタイムアウト上書き例
46
+
47
+ 特定のテストで長時間の処理が必要な場合は、個別にタイムアウト値を指定します:
48
+
49
+ - **ファイル処理テスト**: 60秒のタイムアウト設定
50
+ - **Docker操作テスト**: 90秒のタイムアウト設定
51
+ - **外部API通信テスト**: 45秒のタイムアウト設定
52
+
53
+ 各テストフレームワークの仕様に従い、適切な方法でタイムアウト値を個別設定してください。
54
+
55
+ ## トラブルシューティング
56
+
57
+ ### よくあるタイムアウトエラー
58
+
59
+ 1. **CLIテストの失敗**: コマンド実行に時間がかかる場合
60
+ - 解決策: 個別テストのタイムアウト値を増加(30-60秒)
61
+
62
+ 2. **ファイルI/Oテストの失敗**: 大きなファイルの読み書きでタイムアウト
63
+ - 解決策: 処理時間に応じてタイムアウト値を調整(60-120秒)
64
+
65
+ 3. **Docker関連テストの失敗**: コンテナ起動に時間がかかる場合
66
+ - 解決策: Docker操作用に90秒以上のタイムアウトを設定
67
+
68
+ ### 設定時の注意点
69
+
70
+ - **過度に長いタイムアウト**: テスト実行時間が長くなりすぎないよう、必要最小限の値を設定する
71
+ - **短すぎるタイムアウト**: CI環境での実行を考慮し、十分な余裕を持たせる
72
+ - **一貫性**: 同様の処理を行うテストでは、統一されたタイムアウト値を使用する
73
+
74
+ ## 運用指針
75
+
76
+ ### 新しいテスト作成時
77
+
78
+ 1. まずデフォルトタイムアウト(20秒)で実行してみる
79
+ 2. タイムアウトエラーが発生した場合、処理内容に応じて適切な値を設定
80
+ 3. CI 環境でも動作することを確認する
81
+
82
+ ### 既存テストの見直し
83
+
84
+ 1. タイムアウトエラーが頻発するテストを特定
85
+ 2. 処理内容を分析し、適切なタイムアウト値を設定
86
+ 3. 過度に長いタイムアウトが設定されているテストを見直し、最適化を検討
87
+
88
+ この設定により、テストの安定性を保ちながら適切な実行時間を維持できます。
89
+
@@ -0,0 +1,17 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "dist",
5
+ "rootDir": "src",
6
+ "declaration": true,
7
+ "declarationMap": true,
8
+ "sourceMap": true,
9
+ "removeComments": false,
10
+ "types": ["node"],
11
+ "module": "ESNext",
12
+ "target": "ES2020",
13
+ "moduleResolution": "Bundler"
14
+ },
15
+ "include": ["src/**/*"],
16
+ "exclude": ["test/**/*", "src/**/*.test.ts", "src/**/*.spec.ts", "**/*.test.ts", "**/*.spec.ts"]
17
+ }
@@ -0,0 +1,117 @@
1
+ {
2
+ "compilerOptions": {
3
+ /* Visit https://aka.ms/tsconfig to read more about this file */
4
+
5
+ /* Projects */
6
+ // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
7
+ // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
8
+ // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
9
+ // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
10
+ // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
11
+ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
12
+
13
+ /* Language and Environment */
14
+ "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
15
+ // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
16
+ // "jsx": "preserve", /* Specify what JSX code is generated. */
17
+ // "libReplacement": true, /* Enable lib replacement. */
18
+ // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
19
+ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
20
+ // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
21
+ // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
22
+ // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
23
+ // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
24
+ // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
25
+ // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
26
+ // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
27
+
28
+ /* Modules */
29
+ "module": "NodeNext", /* Specify what module code is generated. */
30
+ "outDir": "dist", /* Specify an output folder for all emitted files. */
31
+ "rootDir": ".", /* Specify the root folder within your source files. */
32
+ "moduleResolution": "NodeNext", /* Specify how TypeScript looks up a file from a given module specifier. */
33
+ "resolveJsonModule": true, /* Enable importing .json files. */
34
+ // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
35
+ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
36
+ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
37
+ // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
38
+ // "types": [], /* Specify type package names to be included without being referenced in a source file. */
39
+ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
40
+ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
41
+ // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
42
+ // "rewriteRelativeImportExtensions": true, /* Rewrite '.ts', '.tsx', '.mts', and '.cts' file extensions in relative import paths to their JavaScript equivalent in output files. */
43
+ // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
44
+ // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
45
+ // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
46
+ // "noUncheckedSideEffectImports": true, /* Check side effect imports. */
47
+ // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
48
+ // "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
49
+
50
+ /* JavaScript Support */
51
+ // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
52
+ // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
53
+ // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
54
+
55
+ /* Emit */
56
+ // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
57
+ // "declarationMap": true, /* Create sourcemaps for d.ts files. */
58
+ // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
59
+ // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
60
+ // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
61
+ // "noEmit": true, /* Disable emitting files from a compilation. */
62
+ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
63
+ // "removeComments": true, /* Disable emitting comments. */
64
+ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
65
+ // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
66
+ // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
67
+ // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
68
+ // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
69
+ // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
70
+ // "newLine": "crlf", /* Set the newline character for emitting files. */
71
+ // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
72
+ // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
73
+ // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
74
+ // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
75
+ // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
76
+
77
+ /* Interop Constraints */
78
+ // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
79
+ // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
80
+ // "isolatedDeclarations": true, /* Require sufficient annotation on exports so other tools can trivially generate declaration files. */
81
+ // "erasableSyntaxOnly": true, /* Do not allow runtime constructs that are not part of ECMAScript. */
82
+ // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
83
+ "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
84
+ // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
85
+ "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
86
+
87
+ /* Type Checking */
88
+ "strict": true, /* Enable all strict type-checking options. */
89
+ // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
90
+ // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
91
+ // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
92
+ // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
93
+ // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
94
+ // "strictBuiltinIteratorReturn": true, /* Built-in iterators are instantiated with a 'TReturn' type of 'undefined' instead of 'any'. */
95
+ // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
96
+ // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
97
+ // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
98
+ // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
99
+ // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
100
+ // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
101
+ // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
102
+ // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
103
+ // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
104
+ // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
105
+ // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
106
+ // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
107
+ // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
108
+
109
+ /* Completeness */
110
+ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
111
+ "skipLibCheck": true /* Skip type checking all .d.ts files. */
112
+ },
113
+ "include": ["src/**/*", "test/**/*"],
114
+ "ts-node": {
115
+ "esm": true
116
+ }
117
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json",
3
+ "extends": []
4
+ }
@@ -0,0 +1,88 @@
1
+ ---
2
+ type: skel
3
+ ---
4
+
5
+ # skel/ ディレクトリの運用について
6
+
7
+ - ロジックの修正を行う前に、skel/ ディレクトリにあるスケルトンファイルを更新する。
8
+ - スケルトンファイルは、実装の構造を定義するためのもので、実装内容は含まない。
9
+ - スケルトンファイルの更新は、実装の前に必ず行うこと。
10
+ - 呼び出し元のコメント修正なども忘れないこと
11
+ - スケルトンファイルの変更差分をpatch形式で取得して、`change_plans/` に記載すること。
12
+ - `test/skeleton-structure-validation.test.ts` だけを実行して、構造が一致していることを確認する。
13
+
14
+ ## スケルトン(skel/ ディレクトリ)運用ルール
15
+
16
+ - `skel/` ディレクトリ(例: `skel/`, `test_skel/`
17
+ など)は、実装ファイルやテストファイルの「構造設計図」を管理するための専用ディレクトリです。
18
+ - スケルトンファイルは、**本体のクラス・関数・メソッド・プロパティ構造と厳密に一致**させてください。
19
+ - メソッド名・引数・戻り値・順序・static/instance区別・プロパティ名なども完全一致が必須です。
20
+ - 余計な定義や重複定義が混入しないよう注意してください。
21
+ - スケルトンは「実装詳細を含まず、構造のみ」を記述します。
22
+ - コードやテストの追加・修正時は、**必ず skel/ 側も同時に更新**してください。
23
+ - skel/ 側の構造は `test/skeleton-structure-validation.test.ts` で自動検証されます。
24
+ - 差分が検出された場合は、skel/ 側を本体に合わせて速やかに修正してください。
25
+ - スケルトンの目的:
26
+ - 実装とテストの構造同期・設計意図の明示・自動検証による品質担保
27
+ - 運用上の注意:
28
+ - skel/ 側の構造不一致はCIで検出されます。必ず全テスト合格状態を維持してください。
29
+ - スケルトンの自動生成・修正時は、不要な重複やゴミ定義が混入しないように注意してください。
30
+ - スケルトンの自動生成・修正時は、不要な重複やゴミ定義が混入しないように注意してください。
31
+
32
+ ---
33
+
34
+ ## @aramassa/skel-extractor の使い方
35
+
36
+ ### 概要
37
+
38
+ `@aramassa/skel-extractor` は、TypeScript/JavaScript/Markdown などの実装ファイルやテストファイルから「構造情報(スケルトン)」を自動抽出・生成・比較できるCLI/ライブラリです。skel/ ディレクトリのスケルトンファイルを最新の実装構造に同期させる用途で利用します。
39
+
40
+ ### インストール
41
+
42
+ ```sh
43
+ npm install --save-dev @aramassa/skel-extractor
44
+ ```
45
+
46
+ ### コマンド例
47
+
48
+ > **注意**: npx で利用する場合は `npx @aramassa/skel-extractor@latest` の形式で実行してください。
49
+
50
+ ```sh
51
+ # 既存ファイルを上書き
52
+ npx @aramassa/skel-extractor@latest "docs/**/*.md" "test/**/*.ts" "src/**/*.ts" --output ./skel --force
53
+
54
+ # 構造diff(./skel と src/ を比較)
55
+ npx @aramassa/skel-extractor@latest --diff --skel-dir ./skel --impl-dir ./src
56
+ ```
57
+
58
+ #### package.json スクリプト例
59
+
60
+ ```json
61
+ {
62
+ "scripts": {
63
+ "skel:update": "skel-extractor \"src/**/*.ts\" \"test/**/*.test.ts\"",
64
+ "skel:diff": "skel-extractor --diff"
65
+ }
66
+ }
67
+ ```
68
+
69
+ ### 生成例
70
+
71
+ - TypeScript: クラス・関数・型定義・インポート/エクスポート宣言などの構造のみ抽出
72
+ - テスト: describe/it 構造のみ抽出
73
+ - Markdown: ヘッダー構造とHTMLコメントのみ抽出
74
+
75
+ ### 活用例
76
+
77
+ - 実装と設計の構造同期・レビュー
78
+ - テストカバレッジの構造検証
79
+ - ドキュメントの構造可視化
80
+ - テンプレートや雛形生成
81
+
82
+ ### 注意点
83
+
84
+ - スケルトンファイルの自動生成・更新時は、不要な重複やゴミ定義が混入しないように注意してください。
85
+ - 抽出後は `test/skeleton-structure-validation.test.ts` を実行し、構造の同期を必ず確認してください。
86
+ - 詳細な使い方やカスタマイズは [公式リポジトリのREADME](https://www.npmjs.com/package/@aramassa/skel-extractor) も参照してください。
87
+
88
+ ---