@noyrax/documentation-system-plugin 1.0.4-beta.1
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/.vscodeignore +41 -0
- package/LICENSE +21 -0
- package/MCP_SERVER_SETUP.md +371 -0
- package/README.md +663 -0
- package/assets/icon.svg +27 -0
- package/docs/LINKEDIN_ANTWORT_SEQUENZDIAGRAMME.md +190 -0
- package/docs/SEQUENZDIAGRAMM_BEWEIS.md +469 -0
- package/docs/SEQUENZDIAGRAMM_VALIDATE_FLOW.md +282 -0
- package/docs/adr/001-signatur-abweichung-fix.md +54 -0
- package/docs/adr/002-file-specific-validation-1.0.1.md +45 -0
- package/docs/adr/003-documentation-generation-bugs.md +134 -0
- package/docs/adr/004-validator-signature-matching-fix.md +121 -0
- package/docs/adr/005-validator-generic-simplification-tightening.md +35 -0
- package/docs/adr/006-parser-variable-type-extraction.md +33 -0
- package/docs/adr/007-ts-parser-load-libs-for-accurate-types.md +31 -0
- package/docs/adr/008-dependencies-cache-phase1.md +133 -0
- package/docs/adr/009-consolidation-union-logic-phase1-2.md +147 -0
- package/docs/adr/010-extension-union-integration-phase1-3-and-phase2.md +179 -0
- package/docs/adr/011-module-doc-change-tracking-phase3.md +190 -0
- package/docs/adr/012-git-deletions-change-report-phase4.md +235 -0
- package/docs/adr/013-system-functionality-fixes.md +279 -0
- package/docs/adr/014-rules-migration-und-mcp-integration.md +113 -0
- package/docs/adr/015-global-agent-package.md +158 -0
- package/docs/adr/016-produktisierung-docguard.md +193 -0
- package/docs/adr/017-signature-matching-optional-fields.md +128 -0
- package/docs/adr/018-rebranding-docguard-to-noyrax.md +109 -0
- package/docs/adr/019-system-schwachstellen-analyse-und-fixes.md +204 -0
- package/docs/adr/020-api-doc-tiefe-und-signatureformatter.md +74 -0
- package/docs/adr/021-semantic-api-docs-and-symbol-classifier.md +125 -0
- package/docs/adr/022-semantic-class-and-constants-rendering.md +82 -0
- package/docs/adr/023-adr-verknuepfung-modul-doku.md +54 -0
- package/docs/adr/024-cursor-rules-mehrdimensionaler-raum.md +230 -0
- package/docs/adr/025-mcp-tools-scan-validate-cli-bridge.md +202 -0
- package/docs/adr/026-reality-driven-development-system.md +173 -0
- package/docs/adr/027-scanner-excludes-and-union-logic-fix.md +189 -0
- package/docs/adr/028-src-coverage-union-resync.md +124 -0
- package/docs/adr/029-parser-flow-kopplung-und-sync-drift-modi.md +102 -0
- package/docs/adr/030-dependency-import-symbol-names-preservation.md +123 -0
- package/docs/adr/031-generate-cli-vollstaendige-dokumentation.md +99 -0
- package/docs/adr/032-windows-optimized-verification-scripts.md +165 -0
- package/docs/adr/036-enhanced-dependency-metadata.md +190 -0
- package/docs/adr/TEMPLATE.md +76 -0
- package/docs/index/symbols.jsonl +31 -0
- package/docs/modules/action__action.yml.md +50 -0
- package/docs/modules/documentation.config.schema.json.md +37 -0
- package/docs/modules/mcp__package.json.md +130 -0
- package/docs/modules/mcp__src__resources__docs.ts.md +94 -0
- package/docs/modules/mcp__src__server.ts.md +15 -0
- package/docs/modules/mcp__src__tools__drift.ts.md +110 -0
- package/docs/modules/mcp__src__tools__impact.ts.md +127 -0
- package/docs/modules/mcp__src__tools__scan.ts.md +75 -0
- package/docs/modules/mcp__src__tools__validate.ts.md +116 -0
- package/docs/modules/mcp__src__tools__verify-adrs.ts.md +106 -0
- package/docs/modules/mcp__tsconfig.json.md +22 -0
- package/docs/modules/package.json.md +131 -0
- package/docs/modules/packages__doc-system-agent__examples__basic-project__package.json.md +43 -0
- package/docs/modules/packages__doc-system-agent__examples__basic-project__src__calculator.ts.md +81 -0
- package/docs/modules/packages__doc-system-agent__package.json.md +154 -0
- package/docs/modules/packages__doc-system-agent__src__cli__index.ts.md +8 -0
- package/docs/modules/packages__doc-system-agent__src__cli__init.ts.md +93 -0
- package/docs/modules/packages__doc-system-agent__src__cli__update.ts.md +113 -0
- package/docs/modules/packages__doc-system-agent__src__constants.ts.md +29 -0
- package/docs/modules/packages__doc-system-agent__src__index.ts.md +234 -0
- package/docs/modules/packages__doc-system-agent__src__mcp__resources__docs.ts.md +94 -0
- package/docs/modules/packages__doc-system-agent__src__mcp__server.ts.md +17 -0
- package/docs/modules/packages__doc-system-agent__src__mcp__tools__drift.ts.md +38 -0
- package/docs/modules/packages__doc-system-agent__src__mcp__tools__impact.ts.md +75 -0
- package/docs/modules/packages__doc-system-agent__src__mcp__tools__scan.ts.md +23 -0
- package/docs/modules/packages__doc-system-agent__src__mcp__tools__validate.ts.md +23 -0
- package/docs/modules/packages__doc-system-agent__src__mcp__tools__verify-adrs.ts.md +106 -0
- package/docs/modules/packages__doc-system-agent__src__mcp__types.ts.md +355 -0
- package/docs/modules/packages__doc-system-agent__tsconfig.json.md +22 -0
- package/docs/modules/scripts__verify-adrs.js.md +97 -0
- package/docs/modules/scripts__verify-architecture.js.md +93 -0
- package/docs/modules/scripts__verify-imports.js.md +114 -0
- package/docs/modules/src____tests____setup.ts.md +8 -0
- package/docs/modules/src____tests____signature-formatter.test.ts.md +16 -0
- package/docs/modules/src____tests____snapshot-doc-generation.test.ts.md +8 -0
- package/docs/modules/src____tests____symbol-classifier.test.ts.md +16 -0
- package/docs/modules/src__cache__ast-cache.ts.md +91 -0
- package/docs/modules/src__cache__dependencies-cache.ts.md +89 -0
- package/docs/modules/src__cache__output-cache.ts.md +91 -0
- package/docs/modules/src__cache__signature-cache.ts.md +76 -0
- package/docs/modules/src__cli__generate-cli.ts.md +130 -0
- package/docs/modules/src__cli__scan-cli.ts.md +99 -0
- package/docs/modules/src__cli__validate-cli.ts.md +144 -0
- package/docs/modules/src__core__async.ts.md +18 -0
- package/docs/modules/src__core__consolidation.ts.md +158 -0
- package/docs/modules/src__core__git.ts.md +35 -0
- package/docs/modules/src__core__language-detection.ts.md +31 -0
- package/docs/modules/src__core__scanner.ts.md +101 -0
- package/docs/modules/src__core__signature-formatter.ts.md +232 -0
- package/docs/modules/src__core__symbol-classifier.ts.md +178 -0
- package/docs/modules/src__core__symbols.ts.md +31 -0
- package/docs/modules/src__drift__index.ts.md +53 -0
- package/docs/modules/src__extension.ts.md +418 -0
- package/docs/modules/src__generator__adr-linker.ts.md +154 -0
- package/docs/modules/src__generator__change-report.ts.md +85 -0
- package/docs/modules/src__generator__dependency-graph.ts.md +63 -0
- package/docs/modules/src__generator__index.ts.md +40 -0
- package/docs/modules/src__generator__module-doc.ts.md +242 -0
- package/docs/modules/src__index__index.ts.md +141 -0
- package/docs/modules/src__logging__index.ts.md +87 -0
- package/docs/modules/src__parsers__dependencies.ts.md +69 -0
- package/docs/modules/src__parsers__json-yaml.ts.md +81 -0
- package/docs/modules/src__parsers__python.ts.md +73 -0
- package/docs/modules/src__parsers__ts-js.ts.md +48 -0
- package/docs/modules/src__parsers__types.ts.md +99 -0
- package/docs/modules/src__ui__commands-provider.ts.md +70 -0
- package/docs/modules/src__ui__status-bar.ts.md +79 -0
- package/docs/modules/src__validator__index.ts.md +211 -0
- package/docs/modules/src__validator__signature-matching.ts.md +209 -0
- package/docs/modules/src__validator__status.ts.md +72 -0
- package/docs/modules/test-mcp-resources.js.md +27 -0
- package/docs/modules/tsconfig.json.md +22 -0
- package/docs/system/CHANGE_REPORT.md +19 -0
- package/docs/system/DEPENDENCIES.md +430 -0
- package/docs/system/DEPENDENCY_GRAPH.md +368 -0
- package/docs/system/NAVIGATION_SPACE_ANALYSIS.md +244 -0
- package/docs/system/NPX_CACHE_FIX.md +85 -0
- package/docs/system/NPX_LOCAL_USAGE.md +66 -0
- package/docs/system/PLUGIN_ECOSYSTEM_STATUS.md +465 -0
- package/docs/system/PLUGIN_UPDATE_GUIDE.md +212 -0
- package/docs/system/RULES_UPDATE_GUIDE.md +182 -0
- package/docs/system/SYSTEM_ANALYSIS.md +947 -0
- package/documentation.config.schema.json +77 -0
- package/noyrax-5d-database-plugin-0.1.8.tgz +0 -0
- package/out/cache/ast-cache.js +69 -0
- package/out/cache/ast-cache.js.map +1 -0
- package/out/cache/dependencies-cache.js +73 -0
- package/out/cache/dependencies-cache.js.map +1 -0
- package/out/cache/output-cache.js +69 -0
- package/out/cache/output-cache.js.map +1 -0
- package/out/cache/signature-cache.js +60 -0
- package/out/cache/signature-cache.js.map +1 -0
- package/out/cli/generate-cli.js +330 -0
- package/out/cli/generate-cli.js.map +1 -0
- package/out/cli/scan-cli.js +151 -0
- package/out/cli/scan-cli.js.map +1 -0
- package/out/cli/validate-cli.js +258 -0
- package/out/cli/validate-cli.js.map +1 -0
- package/out/core/async.js +38 -0
- package/out/core/async.js.map +1 -0
- package/out/core/consolidation.js +230 -0
- package/out/core/consolidation.js.map +1 -0
- package/out/core/git.js +48 -0
- package/out/core/git.js.map +1 -0
- package/out/core/language-detection.js +29 -0
- package/out/core/language-detection.js.map +1 -0
- package/out/core/scanner.js +179 -0
- package/out/core/scanner.js.map +1 -0
- package/out/core/signature-formatter.js +162 -0
- package/out/core/signature-formatter.js.map +1 -0
- package/out/core/symbol-classifier.js +96 -0
- package/out/core/symbol-classifier.js.map +1 -0
- package/out/core/symbols.js +24 -0
- package/out/core/symbols.js.map +1 -0
- package/out/drift/index.js +28 -0
- package/out/drift/index.js.map +1 -0
- package/out/extension.js +984 -0
- package/out/extension.js.map +1 -0
- package/out/generator/adr-linker.js +216 -0
- package/out/generator/adr-linker.js.map +1 -0
- package/out/generator/change-report.js +124 -0
- package/out/generator/change-report.js.map +1 -0
- package/out/generator/dependency-graph.js +98 -0
- package/out/generator/dependency-graph.js.map +1 -0
- package/out/generator/index.js +117 -0
- package/out/generator/index.js.map +1 -0
- package/out/generator/module-doc.js +438 -0
- package/out/generator/module-doc.js.map +1 -0
- package/out/index/index.js +147 -0
- package/out/index/index.js.map +1 -0
- package/out/logging/index.js +24 -0
- package/out/logging/index.js.map +1 -0
- package/out/parsers/dependencies.js +126 -0
- package/out/parsers/dependencies.js.map +1 -0
- package/out/parsers/json-yaml.js +90 -0
- package/out/parsers/json-yaml.js.map +1 -0
- package/out/parsers/python.js +160 -0
- package/out/parsers/python.js.map +1 -0
- package/out/parsers/ts-js.js +397 -0
- package/out/parsers/ts-js.js.map +1 -0
- package/out/parsers/types.js +3 -0
- package/out/parsers/types.js.map +1 -0
- package/out/ui/commands-provider.js +91 -0
- package/out/ui/commands-provider.js.map +1 -0
- package/out/ui/status-bar.js +85 -0
- package/out/ui/status-bar.js.map +1 -0
- package/out/validator/index.js +185 -0
- package/out/validator/index.js.map +1 -0
- package/out/validator/signature-matching.js +261 -0
- package/out/validator/signature-matching.js.map +1 -0
- package/out/validator/status.js +38 -0
- package/out/validator/status.js.map +1 -0
- package/package.json +306 -0
- package/publish.ps1 +21 -0
- package/scripts/verify-adrs.js +312 -0
- package/scripts/verify-architecture.js +181 -0
- package/scripts/verify-imports.js +274 -0
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Verification Script: Architecture Rules
|
|
5
|
+
*
|
|
6
|
+
* Prüft Architektur-Regeln:
|
|
7
|
+
* - Keine direkten Imports von mcp/ nach src/
|
|
8
|
+
* - Import-Richtungen respektiert
|
|
9
|
+
* - Keine zirkulären Abhängigkeiten
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const fs = require('fs');
|
|
13
|
+
const path = require('path');
|
|
14
|
+
const { execSync } = require('child_process');
|
|
15
|
+
|
|
16
|
+
const errors = [];
|
|
17
|
+
const warnings = [];
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Prüft ob mcp/ direkt nach src/ importiert
|
|
21
|
+
*/
|
|
22
|
+
function checkMcpToSrcImports() {
|
|
23
|
+
console.log('🔍 Checking for invalid imports from mcp/ to src/...');
|
|
24
|
+
|
|
25
|
+
const mcpSrcDir = path.join(__dirname, '..', 'mcp', 'src');
|
|
26
|
+
if (!fs.existsSync(mcpSrcDir)) {
|
|
27
|
+
console.log('⚠️ mcp/src directory not found, skipping check');
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const files = getAllTsFiles(mcpSrcDir);
|
|
32
|
+
let foundInvalid = false;
|
|
33
|
+
|
|
34
|
+
for (const file of files) {
|
|
35
|
+
const content = fs.readFileSync(file, 'utf8');
|
|
36
|
+
const lines = content.split('\n');
|
|
37
|
+
|
|
38
|
+
lines.forEach((line, index) => {
|
|
39
|
+
// Pattern: import ... from '../../../src/...'
|
|
40
|
+
// Pattern: import ... from '../../src/...'
|
|
41
|
+
// Pattern: import ... from '../src/...'
|
|
42
|
+
if (line.match(/import.*from\s+['"]\.\.\/.*src\//)) {
|
|
43
|
+
const relativePath = path.relative(process.cwd(), file);
|
|
44
|
+
errors.push({
|
|
45
|
+
file: relativePath,
|
|
46
|
+
line: index + 1,
|
|
47
|
+
message: `Invalid import from src/ detected: ${line.trim()}`,
|
|
48
|
+
rule: 'mcp/ cannot import directly from src/ (use npm scripts with shell boundary instead)'
|
|
49
|
+
});
|
|
50
|
+
foundInvalid = true;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (!foundInvalid) {
|
|
56
|
+
console.log('✅ No invalid imports from mcp/ to src/ found');
|
|
57
|
+
} else {
|
|
58
|
+
console.log(`❌ Found ${errors.length} invalid import(s)`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Prüft Import-Richtungen
|
|
64
|
+
*/
|
|
65
|
+
function checkImportDirections() {
|
|
66
|
+
console.log('🔍 Checking import directions...');
|
|
67
|
+
|
|
68
|
+
// Import-Richtung: core → parsers → symbols → generator/validator → cli
|
|
69
|
+
const allowedDirections = [
|
|
70
|
+
{ from: 'core', to: ['parsers', 'symbols', 'generator', 'validator', 'cli', 'ui'] },
|
|
71
|
+
{ from: 'parsers', to: ['symbols', 'generator', 'validator', 'cli'] },
|
|
72
|
+
{ from: 'symbols', to: ['generator', 'validator', 'cli'] },
|
|
73
|
+
{ from: 'generator', to: ['cli'] },
|
|
74
|
+
{ from: 'validator', to: ['cli'] },
|
|
75
|
+
];
|
|
76
|
+
|
|
77
|
+
// Vereinfachte Prüfung: Nur Warnung wenn offensichtlich falsch
|
|
78
|
+
// Vollständige Zyklus-Erkennung wäre komplexer
|
|
79
|
+
console.log('✅ Import direction check completed (simplified)');
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Prüft package.json type Feld
|
|
84
|
+
*/
|
|
85
|
+
function checkPackageJsonType() {
|
|
86
|
+
console.log('🔍 Checking package.json type fields...');
|
|
87
|
+
|
|
88
|
+
const rootPackageJson = path.join(__dirname, '..', 'package.json');
|
|
89
|
+
const mcpPackageJson = path.join(__dirname, '..', 'mcp', 'package.json');
|
|
90
|
+
|
|
91
|
+
if (fs.existsSync(rootPackageJson)) {
|
|
92
|
+
const rootPkg = JSON.parse(fs.readFileSync(rootPackageJson, 'utf8'));
|
|
93
|
+
if (!rootPkg.type) {
|
|
94
|
+
console.log('✅ Root package.json has no type field (defaults to CommonJS)');
|
|
95
|
+
} else {
|
|
96
|
+
console.log(`✅ Root package.json type: ${rootPkg.type}`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (fs.existsSync(mcpPackageJson)) {
|
|
101
|
+
const mcpPkg = JSON.parse(fs.readFileSync(mcpPackageJson, 'utf8'));
|
|
102
|
+
if (mcpPkg.type === 'module') {
|
|
103
|
+
console.log('✅ mcp/package.json type: module (ESM)');
|
|
104
|
+
} else {
|
|
105
|
+
warnings.push({
|
|
106
|
+
file: 'mcp/package.json',
|
|
107
|
+
message: `mcp/package.json type is "${mcpPkg.type || 'CommonJS'}", expected "module" for ESM`
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Sammelt alle TypeScript-Dateien rekursiv
|
|
115
|
+
*/
|
|
116
|
+
function getAllTsFiles(dir) {
|
|
117
|
+
const files = [];
|
|
118
|
+
|
|
119
|
+
function traverse(currentDir) {
|
|
120
|
+
const entries = fs.readdirSync(currentDir, { withFileTypes: true });
|
|
121
|
+
|
|
122
|
+
for (const entry of entries) {
|
|
123
|
+
const fullPath = path.join(currentDir, entry.name);
|
|
124
|
+
|
|
125
|
+
if (entry.isDirectory()) {
|
|
126
|
+
// Skip node_modules, out, dist, .git
|
|
127
|
+
if (!['node_modules', 'out', 'dist', '.git'].includes(entry.name)) {
|
|
128
|
+
traverse(fullPath);
|
|
129
|
+
}
|
|
130
|
+
} else if (entry.isFile() && entry.name.endsWith('.ts')) {
|
|
131
|
+
files.push(fullPath);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
traverse(dir);
|
|
137
|
+
return files;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Hauptfunktion
|
|
142
|
+
*/
|
|
143
|
+
function main() {
|
|
144
|
+
console.log('🚀 Starting architecture verification...\n');
|
|
145
|
+
|
|
146
|
+
checkMcpToSrcImports();
|
|
147
|
+
checkImportDirections();
|
|
148
|
+
checkPackageJsonType();
|
|
149
|
+
|
|
150
|
+
console.log('\n📊 Verification Summary:');
|
|
151
|
+
console.log(` Errors: ${errors.length}`);
|
|
152
|
+
console.log(` Warnings: ${warnings.length}`);
|
|
153
|
+
|
|
154
|
+
if (errors.length > 0) {
|
|
155
|
+
console.log('\n❌ ERRORS:');
|
|
156
|
+
errors.forEach((err, index) => {
|
|
157
|
+
console.log(` ${index + 1}. ${err.file}:${err.line}`);
|
|
158
|
+
console.log(` ${err.message}`);
|
|
159
|
+
console.log(` Rule: ${err.rule}`);
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
if (warnings.length > 0) {
|
|
164
|
+
console.log('\n⚠️ WARNINGS:');
|
|
165
|
+
warnings.forEach((warn, index) => {
|
|
166
|
+
console.log(` ${index + 1}. ${warn.file}`);
|
|
167
|
+
console.log(` ${warn.message}`);
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if (errors.length > 0) {
|
|
172
|
+
console.log('\n❌ Architecture verification FAILED');
|
|
173
|
+
process.exit(1);
|
|
174
|
+
} else {
|
|
175
|
+
console.log('\n✅ Architecture verification PASSED');
|
|
176
|
+
process.exit(0);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
main();
|
|
181
|
+
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Verification Script: Import Verification
|
|
5
|
+
*
|
|
6
|
+
* Prüft Import-Verfügbarkeit:
|
|
7
|
+
* - Exports existieren (grep für export statements)
|
|
8
|
+
* - Import-Pfade sind korrekt
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const fs = require('fs');
|
|
12
|
+
const path = require('path');
|
|
13
|
+
const { execSync } = require('child_process');
|
|
14
|
+
|
|
15
|
+
const errors = [];
|
|
16
|
+
const warnings = [];
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Sammelt alle TypeScript-Dateien rekursiv
|
|
20
|
+
*/
|
|
21
|
+
function getAllTsFiles(dir) {
|
|
22
|
+
const files = [];
|
|
23
|
+
|
|
24
|
+
function traverse(currentDir) {
|
|
25
|
+
if (!fs.existsSync(currentDir)) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const entries = fs.readdirSync(currentDir, { withFileTypes: true });
|
|
30
|
+
|
|
31
|
+
for (const entry of entries) {
|
|
32
|
+
const fullPath = path.join(currentDir, entry.name);
|
|
33
|
+
|
|
34
|
+
if (entry.isDirectory()) {
|
|
35
|
+
// Skip node_modules, out, dist, .git
|
|
36
|
+
if (!['node_modules', 'out', 'dist', '.git', '.cursor'].includes(entry.name)) {
|
|
37
|
+
traverse(fullPath);
|
|
38
|
+
}
|
|
39
|
+
} else if (entry.isFile() && entry.name.endsWith('.ts')) {
|
|
40
|
+
files.push(fullPath);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
traverse(dir);
|
|
46
|
+
return files;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Extrahiert alle Exports aus einer Datei
|
|
51
|
+
*/
|
|
52
|
+
function extractExports(filePath) {
|
|
53
|
+
const content = fs.readFileSync(filePath, 'utf8');
|
|
54
|
+
const exports = [];
|
|
55
|
+
|
|
56
|
+
// Pattern: export function name
|
|
57
|
+
// Pattern: export class Name
|
|
58
|
+
// Pattern: export const name
|
|
59
|
+
// Pattern: export { name }
|
|
60
|
+
// Pattern: export type { name }
|
|
61
|
+
// Pattern: export interface name
|
|
62
|
+
// Pattern: export default
|
|
63
|
+
const exportPatterns = [
|
|
64
|
+
/export\s+(?:async\s+)?function\s+(\w+)/g,
|
|
65
|
+
/export\s+class\s+(\w+)/g,
|
|
66
|
+
/export\s+(?:const|let|var)\s+(\w+)/g,
|
|
67
|
+
/export\s+type\s+(\w+)/g,
|
|
68
|
+
/export\s+interface\s+(\w+)/g,
|
|
69
|
+
/export\s*\{\s*([^}]+)\}/g,
|
|
70
|
+
/export\s+type\s*\{\s*([^}]+)\}/g,
|
|
71
|
+
/export\s+default\s+/g,
|
|
72
|
+
];
|
|
73
|
+
|
|
74
|
+
exportPatterns.forEach(pattern => {
|
|
75
|
+
let match;
|
|
76
|
+
while ((match = pattern.exec(content)) !== null) {
|
|
77
|
+
if (match[1]) {
|
|
78
|
+
// Für export { a, b, c }
|
|
79
|
+
const names = match[1].split(',').map(n => n.trim().split(/\s+as\s+/)[0]);
|
|
80
|
+
exports.push(...names);
|
|
81
|
+
} else {
|
|
82
|
+
// Für export default
|
|
83
|
+
exports.push('default');
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
return exports;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Prüft ob ein Import verfügbar ist
|
|
93
|
+
*/
|
|
94
|
+
function checkImport(importPath, importedName, fromFile) {
|
|
95
|
+
const workspaceRoot = path.join(__dirname, '..');
|
|
96
|
+
|
|
97
|
+
// Resolve import path
|
|
98
|
+
let targetFile;
|
|
99
|
+
|
|
100
|
+
if (importPath.startsWith('.')) {
|
|
101
|
+
// Relative import
|
|
102
|
+
const fromDir = path.dirname(fromFile);
|
|
103
|
+
targetFile = path.resolve(fromDir, importPath);
|
|
104
|
+
|
|
105
|
+
// Try .ts extension
|
|
106
|
+
if (!targetFile.endsWith('.ts') && !targetFile.endsWith('.js')) {
|
|
107
|
+
if (fs.existsSync(targetFile + '.ts')) {
|
|
108
|
+
targetFile = targetFile + '.ts';
|
|
109
|
+
} else if (fs.existsSync(targetFile + '.js')) {
|
|
110
|
+
targetFile = targetFile + '.js';
|
|
111
|
+
} else if (fs.existsSync(path.join(targetFile, 'index.ts'))) {
|
|
112
|
+
targetFile = path.join(targetFile, 'index.ts');
|
|
113
|
+
} else if (fs.existsSync(path.join(targetFile, 'index.js'))) {
|
|
114
|
+
targetFile = path.join(targetFile, 'index.js');
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
} else {
|
|
118
|
+
// Node module import - skip for now
|
|
119
|
+
return true;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (!fs.existsSync(targetFile)) {
|
|
123
|
+
warnings.push({
|
|
124
|
+
file: path.relative(workspaceRoot, fromFile),
|
|
125
|
+
import: importPath,
|
|
126
|
+
message: `Import path ${importPath} not found (file: ${targetFile})`
|
|
127
|
+
});
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Check if export exists
|
|
132
|
+
const exports = extractExports(targetFile);
|
|
133
|
+
|
|
134
|
+
if (importedName === '*' || importedName === 'default') {
|
|
135
|
+
// Namespace or default import - assume OK
|
|
136
|
+
return true;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (!exports.includes(importedName)) {
|
|
140
|
+
warnings.push({
|
|
141
|
+
file: path.relative(workspaceRoot, fromFile),
|
|
142
|
+
import: importPath,
|
|
143
|
+
name: importedName,
|
|
144
|
+
message: `Export ${importedName} not found in ${importPath}`,
|
|
145
|
+
availableExports: exports.slice(0, 5) // Show first 5
|
|
146
|
+
});
|
|
147
|
+
return false;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
return true;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Prüft alle Imports in einer Datei
|
|
155
|
+
*/
|
|
156
|
+
function checkFileImports(filePath, workspaceRoot) {
|
|
157
|
+
const content = fs.readFileSync(filePath, 'utf8');
|
|
158
|
+
const lines = content.split('\n');
|
|
159
|
+
|
|
160
|
+
// Pattern: import ... from '...'
|
|
161
|
+
// Pattern: import ... from "..."
|
|
162
|
+
const importPattern = /import\s+(.+?)\s+from\s+['"](.+?)['"]/g;
|
|
163
|
+
|
|
164
|
+
let match;
|
|
165
|
+
while ((match = importPattern.exec(content)) !== null) {
|
|
166
|
+
const importSpec = match[1].trim();
|
|
167
|
+
const importPath = match[2].trim();
|
|
168
|
+
|
|
169
|
+
// Parse import spec
|
|
170
|
+
// Pattern: { name1, name2 }
|
|
171
|
+
// Pattern: name
|
|
172
|
+
// Pattern: * as name
|
|
173
|
+
// Pattern: default, { name }
|
|
174
|
+
let importedNames = [];
|
|
175
|
+
|
|
176
|
+
if (importSpec.startsWith('{')) {
|
|
177
|
+
// Named imports: { a, b, c }
|
|
178
|
+
const names = importSpec.slice(1, -1).split(',').map(n => n.trim().split(/\s+as\s+/)[0]);
|
|
179
|
+
importedNames = names;
|
|
180
|
+
} else if (importSpec.startsWith('*')) {
|
|
181
|
+
// Namespace import: * as name
|
|
182
|
+
importedNames = ['*'];
|
|
183
|
+
} else if (importSpec.includes(',')) {
|
|
184
|
+
// Default + named: default, { a, b }
|
|
185
|
+
const parts = importSpec.split(',');
|
|
186
|
+
importedNames.push('default');
|
|
187
|
+
const namedPart = parts.find(p => p.includes('{'));
|
|
188
|
+
if (namedPart) {
|
|
189
|
+
const names = namedPart.match(/\{([^}]+)\}/)?.[1].split(',').map(n => n.trim().split(/\s+as\s+/)[0]) || [];
|
|
190
|
+
importedNames.push(...names);
|
|
191
|
+
}
|
|
192
|
+
} else {
|
|
193
|
+
// Default import or single name
|
|
194
|
+
importedNames = [importSpec.trim().split(/\s+as\s+/)[0]];
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// Check each imported name
|
|
198
|
+
importedNames.forEach(name => {
|
|
199
|
+
checkImport(importPath, name, filePath);
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Hauptfunktion
|
|
206
|
+
*/
|
|
207
|
+
function main() {
|
|
208
|
+
const workspaceRoot = path.join(__dirname, '..');
|
|
209
|
+
|
|
210
|
+
console.log('🚀 Starting import verification...\n');
|
|
211
|
+
|
|
212
|
+
// Check src/ directory
|
|
213
|
+
const srcDir = path.join(workspaceRoot, 'src');
|
|
214
|
+
if (!fs.existsSync(srcDir)) {
|
|
215
|
+
console.log('⚠️ src/ directory not found, skipping verification');
|
|
216
|
+
process.exit(0);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
const files = getAllTsFiles(srcDir);
|
|
220
|
+
console.log(`📁 Found ${files.length} TypeScript files\n`);
|
|
221
|
+
|
|
222
|
+
let checkedFiles = 0;
|
|
223
|
+
for (const file of files) {
|
|
224
|
+
checkFileImports(file, workspaceRoot);
|
|
225
|
+
checkedFiles++;
|
|
226
|
+
|
|
227
|
+
if (checkedFiles % 10 === 0) {
|
|
228
|
+
process.stdout.write(` Checked ${checkedFiles}/${files.length} files...\r`);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
console.log(`\n✅ Checked ${checkedFiles} files\n`);
|
|
233
|
+
|
|
234
|
+
console.log(`📊 Verification Summary:`);
|
|
235
|
+
console.log(` Errors: ${errors.length}`);
|
|
236
|
+
console.log(` Warnings: ${warnings.length}`);
|
|
237
|
+
|
|
238
|
+
if (warnings.length > 0) {
|
|
239
|
+
console.log('\n⚠️ WARNINGS:');
|
|
240
|
+
warnings.slice(0, 20).forEach((warn, index) => {
|
|
241
|
+
console.log(` ${index + 1}. ${warn.file}`);
|
|
242
|
+
console.log(` ${warn.message}`);
|
|
243
|
+
if (warn.availableExports) {
|
|
244
|
+
console.log(` Available exports: ${warn.availableExports.join(', ')}${warn.availableExports.length === 5 ? '...' : ''}`);
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
if (warnings.length > 20) {
|
|
249
|
+
console.log(` ... and ${warnings.length - 20} more warnings`);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
if (errors.length > 0) {
|
|
254
|
+
console.log('\n❌ ERRORS:');
|
|
255
|
+
errors.forEach((err, index) => {
|
|
256
|
+
console.log(` ${index + 1}. ${err.file}`);
|
|
257
|
+
console.log(` ${err.message}`);
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
if (errors.length > 0) {
|
|
262
|
+
console.log('\n❌ Import verification FAILED');
|
|
263
|
+
process.exit(1);
|
|
264
|
+
} else {
|
|
265
|
+
console.log('\n✅ Import verification PASSED');
|
|
266
|
+
if (warnings.length > 0) {
|
|
267
|
+
console.log(` (${warnings.length} warnings - may be false positives)`);
|
|
268
|
+
}
|
|
269
|
+
process.exit(0);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
main();
|
|
274
|
+
|