-
Notifications
You must be signed in to change notification settings - Fork 13.2k
AI Diagnostics: Enforce Centralized Type Registry and Actionable Type Hygiene Fixes #62107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@MyndScript please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
|
|
||
| // 5. Update imports in all files in workspace | ||
| const files = await vscode.workspace.findFiles('**/*.ts', '**/node_modules/**'); | ||
| const importRegex = new RegExp(`import\s+\{?\s*${typeName}\s*\}?\s+from\s+['\"](\.\.?\/[^'\"]*)['\"];?`, 'g'); |
Check failure
Code scanning / CodeQL
Useless regular-expression character escape High
regular expression
|
|
||
| // 5. Update imports in all files in workspace | ||
| const files = await vscode.workspace.findFiles('**/*.ts', '**/node_modules/**'); | ||
| const importRegex = new RegExp(`import\s+\{?\s*${typeName}\s*\}?\s+from\s+['\"](\.\.?\/[^'\"]*)['\"];?`, 'g'); |
Check failure
Code scanning / CodeQL
Useless regular-expression character escape High
regular expression
|
|
||
| // 5. Update imports in all files in workspace | ||
| const files = await vscode.workspace.findFiles('**/*.ts', '**/node_modules/**'); | ||
| const importRegex = new RegExp(`import\s+\{?\s*${typeName}\s*\}?\s+from\s+['\"](\.\.?\/[^'\"]*)['\"];?`, 'g'); |
Check failure
Code scanning / CodeQL
Useless regular-expression character escape High
regular expression
|
|
||
| // 5. Update imports in all files in workspace | ||
| const files = await vscode.workspace.findFiles('**/*.ts', '**/node_modules/**'); | ||
| const importRegex = new RegExp(`import\s+\{?\s*${typeName}\s*\}?\s+from\s+['\"](\.\.?\/[^'\"]*)['\"];?`, 'g'); |
Check failure
Code scanning / CodeQL
Useless regular-expression character escape High
regular expression
|
|
||
| // 5. Update imports in all files in workspace | ||
| const files = await vscode.workspace.findFiles('**/*.ts', '**/node_modules/**'); | ||
| const importRegex = new RegExp(`import\s+\{?\s*${typeName}\s*\}?\s+from\s+['\"](\.\.?\/[^'\"]*)['\"];?`, 'g'); |
Check failure
Code scanning / CodeQL
Useless regular-expression character escape High
regular expression
|
|
||
| // 5. Update imports in all files in workspace | ||
| const files = await vscode.workspace.findFiles('**/*.ts', '**/node_modules/**'); | ||
| const importRegex = new RegExp(`import\s+\{?\s*${typeName}\s*\}?\s+from\s+['\"](\.\.?\/[^'\"]*)['\"];?`, 'g'); |
Check failure
Code scanning / CodeQL
Useless regular-expression character escape High
regular expression
|
|
||
| // 5. Update imports in all files in workspace | ||
| const files = await vscode.workspace.findFiles('**/*.ts', '**/node_modules/**'); | ||
| const importRegex = new RegExp(`import\s+\{?\s*${typeName}\s*\}?\s+from\s+['\"](\.\.?\/[^'\"]*)['\"];?`, 'g'); |
Check failure
Code scanning / CodeQL
Useless regular-expression character escape High
regular expression
|
|
||
| // 5. Update imports in all files in workspace | ||
| const files = await vscode.workspace.findFiles('**/*.ts', '**/node_modules/**'); | ||
| const importRegex = new RegExp(`import\s+\{?\s*${typeName}\s*\}?\s+from\s+['\"](\.\.?\/[^'\"]*)['\"];?`, 'g'); |
Check failure
Code scanning / CodeQL
Useless regular-expression character escape High
regular expression
|
|
||
| // 5. Update imports in all files in workspace | ||
| const files = await vscode.workspace.findFiles('**/*.ts', '**/node_modules/**'); | ||
| const importRegex = new RegExp(`import\s+\{?\s*${typeName}\s*\}?\s+from\s+['\"](\.\.?\/[^'\"]*)['\"];?`, 'g'); |
Check failure
Code scanning / CodeQL
Useless regular-expression character escape High
regular expression
|
Please refer to CONTRIBUTING.md to understand pull request requirements |
This PR introduces and enforces a centralized type registry policy for TypeScript projects with AI-enhanced diagnostics. It includes:
Detection of type/interface/class/enum declarations defined outside the central types/ directory.
Actionable, explainable diagnostics with high-confidence, one-click fix suggestions to move types to the registry and update imports.
Expanded convertToAIDiagnostics logic for robust "why" explanations and type hygiene enforcement.
Thorough test coverage for type centralization scenarios.
Documentation updates in AI_DIAGNOSTICS_GUIDE.md to make the policy official and provide integration guidance.
This change helps prevent type sprawl and ambiguity, improves maintainability, and enables better AI-driven code generation and analysis.
Checklist:
Associated issue in Backlog milestone
Code is up-to-date with main
All tests pass (npx hereby runtests-parallel)
Lint and format clean (npx hereby lint & npx hereby format)
New/updated tests for type hygiene and centralization
Closes # (replace with actual issue number).