@nahisaho/musubix-codegraph 3.4.4 → 3.6.0

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.
package/dist/index.d.ts CHANGED
@@ -16,4 +16,5 @@ export { TypedEventEmitter, CodeGraphEventEmitter, } from './events/index.js';
16
16
  export type { Language, EntityType, Entity, EntityInput, RelationType, Relation, RelationInput, CodeGraphOptions, ParserOptions, GraphOptions, IndexerOptions, GraphRAGOptions, StorageAdapter, StorageStats, CodeGraphEvents, IndexProgress, QueryResult, IndexResult, CallPath, ModuleAnalysis, CodeSnippet, FileStructure, SearchResult, Community, GraphStatistics, ParseResult, GraphQuery, DependencyOptions, LocalSearchOptions, GlobalSearchOptions, } from './types.js';
17
17
  export { LANGUAGE_EXTENSIONS, DEFAULT_CODEGRAPH_OPTIONS, generateEntityId, generateRelationId, isSupportedLanguage, getLanguageFromExtension, } from './types.js';
18
18
  export { createPRCreator, PRCreator, GitOperations, GitHubAdapter, RefactoringApplier, PRTemplateGenerator, type RefactoringSuggestion, type CodeChange, type PRCreateOptions, type PRCreateResult, type PRPreview, type GitHubConfig, type PRInfo, type FileDiff, type PRCreatorEvents, generateBranchName, generateCommitMessage, } from './pr/index.js';
19
+ export * from './validator/index.js';
19
20
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAG5D,OAAO,EACL,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,mBAAmB,CAAC;AAG3B,YAAY,EAEV,QAAQ,EAGR,UAAU,EACV,MAAM,EACN,WAAW,EAGX,YAAY,EACZ,QAAQ,EACR,aAAa,EAGb,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,cAAc,EACd,eAAe,EAGf,cAAc,EACd,YAAY,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,GACpB,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAEL,eAAe,EAGf,SAAS,EACT,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,mBAAmB,EAGnB,KAAK,qBAAqB,EAC1B,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,MAAM,EACX,KAAK,QAAQ,EACb,KAAK,eAAe,EAGpB,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,eAAe,CAAC;AAGvB,cAAc,sBAAsB,CAAC"}
package/dist/index.js CHANGED
@@ -25,4 +25,6 @@ createPRCreator,
25
25
  PRCreator, GitOperations, GitHubAdapter, RefactoringApplier, PRTemplateGenerator,
26
26
  // Utilities
27
27
  generateBranchName, generateCommitMessage, } from './pr/index.js';
28
+ // FastRender Validator Module (v3.6.0)
29
+ export * from './validator/index.js';
28
30
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,cAAc;AACd,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAE5D,eAAe;AACf,OAAO,EACL,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,mBAAmB,CAAC;AAmD3B,YAAY;AACZ,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,YAAY,CAAC;AAEpB,mCAAmC;AACnC,OAAO;AACL,eAAe;AACf,eAAe;AAEf,UAAU;AACV,SAAS,EACT,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,mBAAmB;AAanB,YAAY;AACZ,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,cAAc;AACd,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAE5D,eAAe;AACf,OAAO,EACL,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,mBAAmB,CAAC;AAmD3B,YAAY;AACZ,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,YAAY,CAAC;AAEpB,mCAAmC;AACnC,OAAO;AACL,eAAe;AACf,eAAe;AAEf,UAAU;AACV,SAAS,EACT,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,mBAAmB;AAanB,YAAY;AACZ,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,eAAe,CAAC;AAEvB,uCAAuC;AACvC,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,105 @@
1
+ /**
2
+ * TestPlacement Types
3
+ *
4
+ * @description
5
+ * テスト配置検証の型定義
6
+ *
7
+ * @see TSK-FR-048 - TestPlacement型定義
8
+ * @see REQ-FR-046〜050 - TestPlacementValidator
9
+ * @trace DES-MUSUBIX-FR-001 DES-CODEGRAPH-001
10
+ */
11
+ /**
12
+ * テスト配置のステータス
13
+ */
14
+ export type PlacementStatus = 'valid' | 'warning' | 'invalid';
15
+ /**
16
+ * テストファイルの種類
17
+ */
18
+ export type TestFileType = 'unit' | 'integration' | 'e2e' | 'snapshot' | 'unknown';
19
+ /**
20
+ * テスト配置ルール
21
+ */
22
+ export interface PlacementRule {
23
+ readonly id: string;
24
+ readonly name: string;
25
+ readonly description: string;
26
+ readonly pattern: string;
27
+ readonly expectedLocation: string;
28
+ readonly severity: 'error' | 'warning' | 'info';
29
+ readonly enabled: boolean;
30
+ }
31
+ /**
32
+ * テスト配置情報
33
+ */
34
+ export interface TestPlacement {
35
+ readonly testFilePath: string;
36
+ readonly sourceFilePath: string | null;
37
+ readonly type: TestFileType;
38
+ readonly status: PlacementStatus;
39
+ readonly violations: readonly PlacementViolation[];
40
+ readonly suggestions: readonly string[];
41
+ readonly metadata?: Readonly<Record<string, unknown>>;
42
+ }
43
+ /**
44
+ * 配置違反
45
+ */
46
+ export interface PlacementViolation {
47
+ readonly ruleId: string;
48
+ readonly ruleName: string;
49
+ readonly message: string;
50
+ readonly severity: 'error' | 'warning' | 'info';
51
+ readonly suggestedPath?: string;
52
+ }
53
+ /**
54
+ * 配置検証結果
55
+ */
56
+ export interface PlacementValidationResult {
57
+ readonly isValid: boolean;
58
+ readonly placements: readonly TestPlacement[];
59
+ readonly summary: PlacementSummary;
60
+ readonly timestamp: number;
61
+ }
62
+ /**
63
+ * 配置サマリー
64
+ */
65
+ export interface PlacementSummary {
66
+ readonly totalTests: number;
67
+ readonly validCount: number;
68
+ readonly warningCount: number;
69
+ readonly invalidCount: number;
70
+ readonly byType: Readonly<Record<TestFileType, number>>;
71
+ readonly coverageEstimate: number;
72
+ }
73
+ /**
74
+ * TestPlacementValidator設定
75
+ */
76
+ export interface TestPlacementConfig {
77
+ readonly rules: readonly PlacementRule[];
78
+ readonly ignorePatterns: readonly string[];
79
+ readonly strictMode: boolean;
80
+ }
81
+ /**
82
+ * デフォルトの配置ルール
83
+ */
84
+ export declare const DEFAULT_PLACEMENT_RULES: readonly PlacementRule[];
85
+ /**
86
+ * デフォルト設定
87
+ */
88
+ export declare const DEFAULT_TEST_PLACEMENT_CONFIG: TestPlacementConfig;
89
+ /**
90
+ * テストファイルタイプを推定
91
+ */
92
+ export declare function inferTestFileType(filePath: string): TestFileType;
93
+ /**
94
+ * ソースファイルパスを推定
95
+ */
96
+ export declare function inferSourceFilePath(testFilePath: string): string | null;
97
+ /**
98
+ * TestPlacementを作成
99
+ */
100
+ export declare function createTestPlacement(testFilePath: string, violations?: readonly PlacementViolation[], suggestions?: readonly string[]): TestPlacement;
101
+ /**
102
+ * 配置サマリーを計算
103
+ */
104
+ export declare function calculatePlacementSummary(placements: readonly TestPlacement[]): PlacementSummary;
105
+ //# sourceMappingURL=TestPlacement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TestPlacement.d.ts","sourceRoot":"","sources":["../../src/types/TestPlacement.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;GAEG;AACH,MAAM,MAAM,eAAe,GACvB,OAAO,GACP,SAAS,GACT,SAAS,CAAC;AAEd;;GAEG;AACH,MAAM,MAAM,YAAY,GACpB,MAAM,GACN,aAAa,GACb,KAAK,GACL,UAAU,GACV,SAAS,CAAC;AAEd;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,QAAQ,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;IAChD,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;IACjC,QAAQ,CAAC,UAAU,EAAE,SAAS,kBAAkB,EAAE,CAAC;IACnD,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAA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,MAAM,6BAA6B,EAAE,mBAI1C,CAAC;AAEH;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY,CAiBhE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAcvE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,MAAM,EACpB,UAAU,GAAE,SAAS,kBAAkB,EAAO,EAC9C,WAAW,GAAE,SAAS,MAAM,EAAO,GAClC,aAAa,CAqBf;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,SAAS,aAAa,EAAE,GAAG,gBAAgB,CAuChG"}
@@ -0,0 +1,159 @@
1
+ /**
2
+ * TestPlacement Types
3
+ *
4
+ * @description
5
+ * テスト配置検証の型定義
6
+ *
7
+ * @see TSK-FR-048 - TestPlacement型定義
8
+ * @see REQ-FR-046〜050 - TestPlacementValidator
9
+ * @trace DES-MUSUBIX-FR-001 DES-CODEGRAPH-001
10
+ */
11
+ /**
12
+ * デフォルトの配置ルール
13
+ */
14
+ export const DEFAULT_PLACEMENT_RULES = Object.freeze([
15
+ {
16
+ id: 'TPR-001',
17
+ name: 'Co-located Unit Tests',
18
+ description: 'Unit tests should be co-located with source files in __tests__ directory',
19
+ pattern: '**/*.test.ts',
20
+ expectedLocation: '{dir}/__tests__/{name}.test.ts',
21
+ severity: 'error',
22
+ enabled: true,
23
+ },
24
+ {
25
+ id: 'TPR-002',
26
+ name: 'Integration Tests Location',
27
+ description: 'Integration tests should be in a dedicated integration directory',
28
+ pattern: '**/*.integration.test.ts',
29
+ expectedLocation: '**/integration/**/*.integration.test.ts',
30
+ severity: 'warning',
31
+ enabled: true,
32
+ },
33
+ {
34
+ id: 'TPR-003',
35
+ name: 'E2E Tests Location',
36
+ description: 'E2E tests should be in e2e or tests/e2e directory',
37
+ pattern: '**/*.e2e.test.ts',
38
+ expectedLocation: '**/e2e/**/*.e2e.test.ts',
39
+ severity: 'warning',
40
+ enabled: true,
41
+ },
42
+ {
43
+ id: 'TPR-004',
44
+ name: 'Test File Naming',
45
+ description: 'Test files should follow naming convention: {source}.test.ts',
46
+ pattern: '**/__tests__/*.ts',
47
+ expectedLocation: '**/__tests__/*.test.ts',
48
+ severity: 'info',
49
+ enabled: true,
50
+ },
51
+ ]);
52
+ /**
53
+ * デフォルト設定
54
+ */
55
+ export const DEFAULT_TEST_PLACEMENT_CONFIG = Object.freeze({
56
+ rules: DEFAULT_PLACEMENT_RULES,
57
+ ignorePatterns: Object.freeze(['**/node_modules/**', '**/dist/**', '**/build/**']),
58
+ strictMode: false,
59
+ });
60
+ /**
61
+ * テストファイルタイプを推定
62
+ */
63
+ export function inferTestFileType(filePath) {
64
+ const lowerPath = filePath.toLowerCase();
65
+ if (lowerPath.includes('.e2e.') || lowerPath.includes('/e2e/')) {
66
+ return 'e2e';
67
+ }
68
+ if (lowerPath.includes('.integration.') || lowerPath.includes('/integration/')) {
69
+ return 'integration';
70
+ }
71
+ if (lowerPath.includes('.snap') || lowerPath.includes('snapshot')) {
72
+ return 'snapshot';
73
+ }
74
+ if (lowerPath.includes('.test.') || lowerPath.includes('.spec.') || lowerPath.includes('__tests__')) {
75
+ return 'unit';
76
+ }
77
+ return 'unknown';
78
+ }
79
+ /**
80
+ * ソースファイルパスを推定
81
+ */
82
+ export function inferSourceFilePath(testFilePath) {
83
+ // __tests__/Foo.test.ts → ../Foo.ts
84
+ const match = testFilePath.match(/(.+)\/__tests__\/(.+)\.test\.ts$/);
85
+ if (match) {
86
+ return `${match[1]}/${match[2]}.ts`;
87
+ }
88
+ // Foo.test.ts → Foo.ts (same directory)
89
+ const simpleMatch = testFilePath.match(/(.+)\.test\.ts$/);
90
+ if (simpleMatch) {
91
+ return `${simpleMatch[1]}.ts`;
92
+ }
93
+ return null;
94
+ }
95
+ /**
96
+ * TestPlacementを作成
97
+ */
98
+ export function createTestPlacement(testFilePath, violations = [], suggestions = []) {
99
+ const type = inferTestFileType(testFilePath);
100
+ const sourceFilePath = inferSourceFilePath(testFilePath);
101
+ let status;
102
+ if (violations.some(v => v.severity === 'error')) {
103
+ status = 'invalid';
104
+ }
105
+ else if (violations.some(v => v.severity === 'warning')) {
106
+ status = 'warning';
107
+ }
108
+ else {
109
+ status = 'valid';
110
+ }
111
+ return Object.freeze({
112
+ testFilePath,
113
+ sourceFilePath,
114
+ type,
115
+ status,
116
+ violations: Object.freeze(violations),
117
+ suggestions: Object.freeze(suggestions),
118
+ });
119
+ }
120
+ /**
121
+ * 配置サマリーを計算
122
+ */
123
+ export function calculatePlacementSummary(placements) {
124
+ const byType = {
125
+ unit: 0,
126
+ integration: 0,
127
+ e2e: 0,
128
+ snapshot: 0,
129
+ unknown: 0,
130
+ };
131
+ let validCount = 0;
132
+ let warningCount = 0;
133
+ let invalidCount = 0;
134
+ for (const p of placements) {
135
+ byType[p.type]++;
136
+ switch (p.status) {
137
+ case 'valid':
138
+ validCount++;
139
+ break;
140
+ case 'warning':
141
+ warningCount++;
142
+ break;
143
+ case 'invalid':
144
+ invalidCount++;
145
+ break;
146
+ }
147
+ }
148
+ const totalTests = placements.length;
149
+ const coverageEstimate = totalTests > 0 ? validCount / totalTests : 0;
150
+ return Object.freeze({
151
+ totalTests,
152
+ validCount,
153
+ warningCount,
154
+ invalidCount,
155
+ byType: Object.freeze(byType),
156
+ coverageEstimate,
157
+ });
158
+ }
159
+ //# sourceMappingURL=TestPlacement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TestPlacement.js","sourceRoot":"","sources":["../../src/types/TestPlacement.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAwFH;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAA6B,MAAM,CAAC,MAAM,CAAC;IAC7E;QACE,EAAE,EAAE,SAAS;QACb,IAAI,EAAE,uBAAuB;QAC7B,WAAW,EAAE,0EAA0E;QACvF,OAAO,EAAE,cAAc;QACvB,gBAAgB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G,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;IAEtE,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,UAAU;QACV,UAAU;QACV,YAAY;QACZ,YAAY;QACZ,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;QAC7B,gBAAgB;KACjB,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,109 @@
1
+ /**
2
+ * TestPlacementValidator - テスト配置検証
3
+ *
4
+ * @description
5
+ * テストファイルの配置が規約に従っているか検証し、
6
+ * 適切な配置を提案する。EXIT_GATE層でPhase 4完了時に検証。
7
+ *
8
+ * @see DES-CODEGRAPH-001 - テスト配置検証システム
9
+ * @see TSK-FR-048 - TestPlacementValidatorインターフェース定義
10
+ * @see TSK-FR-049 - validateFile/validateAll実装
11
+ * @see TSK-FR-050 - suggestPlacement実装
12
+ * @see TSK-FR-051 - QualityGate統合
13
+ * @trace REQ-FR-006 - テスト品質保証
14
+ */
15
+ import type { TestPlacement, PlacementRule, PlacementViolation, PlacementValidationResult, TestPlacementConfig } from '../types/TestPlacement.js';
16
+ /**
17
+ * 検証統計
18
+ */
19
+ export interface ValidationStats {
20
+ readonly totalValidations: number;
21
+ readonly validCount: number;
22
+ readonly warningCount: number;
23
+ readonly invalidCount: number;
24
+ readonly lastValidatedAt: number | null;
25
+ }
26
+ /**
27
+ * TestPlacementValidatorインターフェース
28
+ *
29
+ * @trace DES-CODEGRAPH-001
30
+ */
31
+ export interface ITestPlacementValidator {
32
+ /**
33
+ * 単一テストファイルを検証
34
+ */
35
+ validateFile(testFilePath: string): Promise<TestPlacement>;
36
+ /**
37
+ * 複数テストファイルを検証
38
+ */
39
+ validateAll(testFilePaths: readonly string[]): Promise<PlacementValidationResult>;
40
+ /**
41
+ * 配置提案を取得
42
+ */
43
+ suggestPlacement(testFilePath: string): Promise<readonly string[]>;
44
+ /**
45
+ * 特定ルールをチェック
46
+ */
47
+ checkRule(testFilePath: string, ruleId: string): Promise<PlacementViolation | null>;
48
+ /**
49
+ * ルール一覧を取得
50
+ */
51
+ getRules(): readonly PlacementRule[];
52
+ /**
53
+ * ルールを追加
54
+ */
55
+ addRule(rule: PlacementRule): void;
56
+ /**
57
+ * ルールを有効化
58
+ */
59
+ enableRule(ruleId: string): void;
60
+ /**
61
+ * ルールを無効化
62
+ */
63
+ disableRule(ruleId: string): void;
64
+ /**
65
+ * 統計を取得
66
+ */
67
+ getStats(): ValidationStats;
68
+ }
69
+ /**
70
+ * TestPlacementValidator実装
71
+ *
72
+ * @trace DES-CODEGRAPH-001
73
+ */
74
+ export declare class TestPlacementValidator implements ITestPlacementValidator {
75
+ private readonly rules;
76
+ private readonly config;
77
+ private stats;
78
+ constructor(config?: TestPlacementConfig);
79
+ /**
80
+ * @trace TSK-FR-049
81
+ */
82
+ validateFile(testFilePath: string): Promise<TestPlacement>;
83
+ /**
84
+ * @trace TSK-FR-049
85
+ */
86
+ validateAll(testFilePaths: readonly string[]): Promise<PlacementValidationResult>;
87
+ /**
88
+ * @trace TSK-FR-050
89
+ */
90
+ suggestPlacement(testFilePath: string): Promise<readonly string[]>;
91
+ checkRule(testFilePath: string, ruleId: string): Promise<PlacementViolation | null>;
92
+ private checkRuleInternal;
93
+ private matchesGlob;
94
+ private matchesExpectedLocation;
95
+ private generateSuggestedPath;
96
+ getRules(): readonly PlacementRule[];
97
+ addRule(rule: PlacementRule): void;
98
+ enableRule(ruleId: string): void;
99
+ disableRule(ruleId: string): void;
100
+ getStats(): ValidationStats;
101
+ private updateStats;
102
+ }
103
+ /**
104
+ * ファクトリ関数
105
+ *
106
+ * @trace TSK-FR-048
107
+ */
108
+ export declare function createTestPlacementValidator(config?: TestPlacementConfig): ITestPlacementValidator;
109
+ //# sourceMappingURL=TestPlacementValidator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TestPlacementValidator.d.ts","sourceRoot":"","sources":["../../src/validator/TestPlacementValidator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAE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IAC/D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAsB;IAC7C,OAAO,CAAC,KAAK,CAMX;gBAEU,MAAM,GAAE,mBAAmD;IASvE;;OAEG;IACG,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IA4BhE;;OAEG;IACG,WAAW,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,yBAAyB,CAAC;IAsBvF;;OAEG;IACG,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC;IAyClE,SAAS,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC;YAS3E,iBAAiB;IA2B/B,OAAO,CAAC,WAAW;IAWnB,OAAO,CAAC,uBAAuB;IAY/B,OAAO,CAAC,qBAAqB;IAe7B,QAAQ,IAAI,SAAS,aAAa,EAAE;IAIpC,OAAO,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI;IAIlC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAOhC,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAOjC,QAAQ,IAAI,eAAe;IAI3B,OAAO,CAAC,WAAW;CASpB;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,CAAC,EAAE,mBAAmB,GAAG,uBAAuB,CAElG"}
@@ -0,0 +1,217 @@
1
+ /**
2
+ * TestPlacementValidator - テスト配置検証
3
+ *
4
+ * @description
5
+ * テストファイルの配置が規約に従っているか検証し、
6
+ * 適切な配置を提案する。EXIT_GATE層でPhase 4完了時に検証。
7
+ *
8
+ * @see DES-CODEGRAPH-001 - テスト配置検証システム
9
+ * @see TSK-FR-048 - TestPlacementValidatorインターフェース定義
10
+ * @see TSK-FR-049 - validateFile/validateAll実装
11
+ * @see TSK-FR-050 - suggestPlacement実装
12
+ * @see TSK-FR-051 - QualityGate統合
13
+ * @trace REQ-FR-006 - テスト品質保証
14
+ */
15
+ import { createTestPlacement, inferTestFileType, inferSourceFilePath, calculatePlacementSummary, DEFAULT_TEST_PLACEMENT_CONFIG, } from '../types/TestPlacement.js';
16
+ /**
17
+ * TestPlacementValidator実装
18
+ *
19
+ * @trace DES-CODEGRAPH-001
20
+ */
21
+ export class TestPlacementValidator {
22
+ rules = new Map();
23
+ config;
24
+ stats = {
25
+ totalValidations: 0,
26
+ validCount: 0,
27
+ warningCount: 0,
28
+ invalidCount: 0,
29
+ lastValidatedAt: null,
30
+ };
31
+ constructor(config = DEFAULT_TEST_PLACEMENT_CONFIG) {
32
+ this.config = config;
33
+ // デフォルトルールを登録
34
+ for (const rule of config.rules) {
35
+ this.rules.set(rule.id, rule);
36
+ }
37
+ }
38
+ /**
39
+ * @trace TSK-FR-049
40
+ */
41
+ async validateFile(testFilePath) {
42
+ const violations = [];
43
+ const suggestions = [];
44
+ // 有効なルールでチェック
45
+ for (const rule of this.rules.values()) {
46
+ if (!rule.enabled)
47
+ continue;
48
+ const violation = await this.checkRuleInternal(testFilePath, rule);
49
+ if (violation) {
50
+ violations.push(violation);
51
+ }
52
+ }
53
+ // 提案を生成
54
+ if (violations.length > 0) {
55
+ const suggested = await this.suggestPlacement(testFilePath);
56
+ suggestions.push(...suggested);
57
+ }
58
+ const placement = createTestPlacement(testFilePath, violations, suggestions);
59
+ // 統計更新
60
+ this.updateStats(placement);
61
+ return placement;
62
+ }
63
+ /**
64
+ * @trace TSK-FR-049
65
+ */
66
+ async validateAll(testFilePaths) {
67
+ const placements = [];
68
+ for (const path of testFilePaths) {
69
+ const placement = await this.validateFile(path);
70
+ placements.push(placement);
71
+ }
72
+ const summary = calculatePlacementSummary(placements);
73
+ const isValid = this.config.strictMode
74
+ ? summary.invalidCount === 0 && summary.warningCount === 0
75
+ : summary.invalidCount === 0;
76
+ return Object.freeze({
77
+ isValid,
78
+ placements: Object.freeze(placements),
79
+ summary,
80
+ timestamp: Date.now(),
81
+ });
82
+ }
83
+ /**
84
+ * @trace TSK-FR-050
85
+ */
86
+ async suggestPlacement(testFilePath) {
87
+ const suggestions = [];
88
+ const type = inferTestFileType(testFilePath);
89
+ // パスからディレクトリとファイル名を抽出
90
+ const parts = testFilePath.split('/');
91
+ const fileName = parts.pop() || '';
92
+ const baseName = fileName.replace(/\.test\.ts$/, '').replace(/\.spec\.ts$/, '');
93
+ // ディレクトリパス
94
+ const dirPath = parts.join('/');
95
+ // __tests__ディレクトリの提案
96
+ if (!testFilePath.includes('__tests__') && type === 'unit') {
97
+ suggestions.push(`${dirPath}/__tests__/${baseName}.test.ts`);
98
+ }
99
+ // integrationテストの場合
100
+ if (testFilePath.includes('.integration.') && !testFilePath.includes('/integration/')) {
101
+ suggestions.push(`${dirPath}/integration/${baseName}.integration.test.ts`);
102
+ }
103
+ // e2eテストの場合
104
+ if (testFilePath.includes('.e2e.') && !testFilePath.includes('/e2e/')) {
105
+ const rootDir = parts[0] || 'tests';
106
+ suggestions.push(`${rootDir}/e2e/${baseName}.e2e.test.ts`);
107
+ }
108
+ // ソースファイルに近い場所を提案
109
+ const sourcePath = inferSourceFilePath(testFilePath);
110
+ if (sourcePath) {
111
+ const sourceDir = sourcePath.split('/').slice(0, -1).join('/');
112
+ const sourceBaseName = sourcePath.split('/').pop()?.replace('.ts', '') || baseName;
113
+ if (!suggestions.some(s => s.includes('__tests__'))) {
114
+ suggestions.push(`${sourceDir}/__tests__/${sourceBaseName}.test.ts`);
115
+ }
116
+ }
117
+ return Object.freeze(suggestions);
118
+ }
119
+ async checkRule(testFilePath, ruleId) {
120
+ const rule = this.rules.get(ruleId);
121
+ if (!rule) {
122
+ return null;
123
+ }
124
+ return this.checkRuleInternal(testFilePath, rule);
125
+ }
126
+ async checkRuleInternal(testFilePath, rule) {
127
+ // シンプルなパターンマッチング
128
+ const matchesPattern = this.matchesGlob(testFilePath, rule.pattern);
129
+ if (!matchesPattern) {
130
+ // パターンに該当しない場合は違反なし
131
+ return null;
132
+ }
133
+ // 期待される配置パターンと比較
134
+ const matchesExpected = this.matchesExpectedLocation(testFilePath, rule.expectedLocation);
135
+ if (!matchesExpected) {
136
+ const suggestedPath = this.generateSuggestedPath(testFilePath, rule.expectedLocation);
137
+ return {
138
+ ruleId: rule.id,
139
+ ruleName: rule.name,
140
+ message: `${rule.description}. Current: ${testFilePath}`,
141
+ severity: rule.severity,
142
+ suggestedPath,
143
+ };
144
+ }
145
+ return null;
146
+ }
147
+ matchesGlob(path, pattern) {
148
+ // シンプルなglobマッチング実装
149
+ const regexPattern = pattern
150
+ .replace(/\*\*/g, '.*')
151
+ .replace(/\*/g, '[^/]*')
152
+ .replace(/\?/g, '.');
153
+ const regex = new RegExp(`^${regexPattern}$`);
154
+ return regex.test(path);
155
+ }
156
+ matchesExpectedLocation(path, expectedPattern) {
157
+ // テンプレートパターンを正規表現に変換
158
+ const regexPattern = expectedPattern
159
+ .replace(/\{dir\}/g, '.*')
160
+ .replace(/\{name\}/g, '[^/]+')
161
+ .replace(/\*\*/g, '.*')
162
+ .replace(/\*/g, '[^/]*');
163
+ const regex = new RegExp(`^${regexPattern}$`);
164
+ return regex.test(path);
165
+ }
166
+ generateSuggestedPath(currentPath, expectedPattern) {
167
+ // シンプルな提案パス生成
168
+ const parts = currentPath.split('/');
169
+ const fileName = parts.pop() || '';
170
+ const baseName = fileName.replace(/\.test\.ts$/, '').replace(/\.spec\.ts$/, '');
171
+ const dir = parts.join('/');
172
+ // {dir}/__tests__/{name}.test.ts パターンの場合
173
+ if (expectedPattern.includes('__tests__')) {
174
+ return `${dir}/__tests__/${baseName}.test.ts`;
175
+ }
176
+ return currentPath;
177
+ }
178
+ getRules() {
179
+ return Object.freeze(Array.from(this.rules.values()));
180
+ }
181
+ addRule(rule) {
182
+ this.rules.set(rule.id, rule);
183
+ }
184
+ enableRule(ruleId) {
185
+ const rule = this.rules.get(ruleId);
186
+ if (rule) {
187
+ this.rules.set(ruleId, { ...rule, enabled: true });
188
+ }
189
+ }
190
+ disableRule(ruleId) {
191
+ const rule = this.rules.get(ruleId);
192
+ if (rule) {
193
+ this.rules.set(ruleId, { ...rule, enabled: false });
194
+ }
195
+ }
196
+ getStats() {
197
+ return { ...this.stats };
198
+ }
199
+ updateStats(placement) {
200
+ this.stats = {
201
+ totalValidations: this.stats.totalValidations + 1,
202
+ validCount: this.stats.validCount + (placement.status === 'valid' ? 1 : 0),
203
+ warningCount: this.stats.warningCount + (placement.status === 'warning' ? 1 : 0),
204
+ invalidCount: this.stats.invalidCount + (placement.status === 'invalid' ? 1 : 0),
205
+ lastValidatedAt: Date.now(),
206
+ };
207
+ }
208
+ }
209
+ /**
210
+ * ファクトリ関数
211
+ *
212
+ * @trace TSK-FR-048
213
+ */
214
+ export function createTestPlacementValidator(config) {
215
+ return new TestPlacementValidator(config);
216
+ }
217
+ //# sourceMappingURL=TestPlacementValidator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TestPlacementValidator.js","sourceRoot":"","sources":["../../src/validator/TestPlacementValidator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAUH,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,yBAAyB,EACzB,6BAA6B,GAC9B,MAAM,2BAA2B,CAAC;AAiEnC;;;;GAIG;AACH,MAAM,OAAO,sBAAsB;IAChB,KAAK,GAA+B,IAAI,GAAG,EAAE,CAAC;IAC9C,MAAM,CAAsB;IACrC,KAAK,GAAoB;QAC/B,gBAAgB,EAAE,CAAC;QACnB,UAAU,EAAE,CAAC;QACb,YAAY,EAAE,CAAC;QACf,YAAY,EAAE,CAAC;QACf,eAAe,EAAE,IAAI;KACtB,CAAC;IAEF,YAAY,SAA8B,6BAA6B;QACrE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,cAAc;QACd,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;YAChC,IAAI,CAAC,KAAK,CAAC,GAAG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AC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Validator Module Index
3
+ *
4
+ * @see TSK-FR-047〜052 - TestPlacementValidator
5
+ * @see REQ-FR-040〜043 - TestPlacementValidator
6
+ */
7
+ export * from './TestPlacementValidator.js';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/validator/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,6BAA6B,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Validator Module Index
3
+ *
4
+ * @see TSK-FR-047〜052 - TestPlacementValidator
5
+ * @see REQ-FR-040〜043 - TestPlacementValidator
6
+ */
7
+ export * from './TestPlacementValidator.js';
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/validator/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,6BAA6B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nahisaho/musubix-codegraph",
3
- "version": "3.4.4",
3
+ "version": "3.6.0",
4
4
  "description": "MUSUBIX CodeGraph - Multi-language Code Graph Analysis Engine supporting 16 programming languages with PR generation",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",