@telora/mcp-products 0.22.3 → 0.22.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telora/mcp-products",
3
- "version": "0.22.3",
3
+ "version": "0.22.5",
4
4
  "description": "MCP server exposing Telora product operations to Claude Code",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,10 +0,0 @@
1
- import { Project, type SourceFile } from 'ts-morph';
2
- import type { ExtractedMember } from './types.js';
3
- /**
4
- * Create a ts-morph Project configured for the given repo.
5
- */
6
- export declare function createProject(repoRoot: string): Project;
7
- /**
8
- * Extract public API members from a source file.
9
- */
10
- export declare function extractMembers(sourceFile: SourceFile): ExtractedMember[];
@@ -1,156 +0,0 @@
1
- // AST-based extraction of component members using ts-morph.
2
- import { Project, SyntaxKind, } from 'ts-morph';
3
- /**
4
- * Create a ts-morph Project configured for the given repo.
5
- */
6
- export function createProject(repoRoot) {
7
- const project = new Project({
8
- tsConfigFilePath: `${repoRoot}/tsconfig.json`,
9
- skipAddingFilesFromTsConfig: true,
10
- skipFileDependencyResolution: true,
11
- });
12
- return project;
13
- }
14
- /**
15
- * Extract public API members from a source file.
16
- */
17
- export function extractMembers(sourceFile) {
18
- const members = [];
19
- // Extract exported functions
20
- for (const fn of sourceFile.getFunctions()) {
21
- if (!fn.isExported())
22
- continue;
23
- const name = fn.getName();
24
- if (!name)
25
- continue;
26
- const memberType = detectFunctionMemberType(name, fn);
27
- members.push({
28
- memberType,
29
- name,
30
- signature: getSignatureText(fn),
31
- });
32
- }
33
- // Extract exported variable declarations (arrow functions, consts)
34
- for (const varStmt of sourceFile.getVariableStatements()) {
35
- if (!varStmt.isExported())
36
- continue;
37
- for (const decl of varStmt.getDeclarations()) {
38
- const name = decl.getName();
39
- const initializer = decl.getInitializer();
40
- if (initializer) {
41
- const kind = initializer.getKind();
42
- if (kind === SyntaxKind.ArrowFunction || kind === SyntaxKind.FunctionExpression) {
43
- const memberType = detectFunctionMemberType(name, decl);
44
- members.push({
45
- memberType,
46
- name,
47
- signature: getVarSignature(decl),
48
- });
49
- continue;
50
- }
51
- }
52
- // Regular exported const
53
- members.push({
54
- memberType: 'export_const',
55
- name,
56
- signature: getVarSignature(decl),
57
- });
58
- }
59
- }
60
- // Extract exported interfaces
61
- for (const iface of sourceFile.getInterfaces()) {
62
- if (!iface.isExported())
63
- continue;
64
- members.push({
65
- memberType: 'export_type',
66
- name: iface.getName(),
67
- signature: `interface ${iface.getName()}`,
68
- });
69
- // If this looks like a Props interface, extract individual props
70
- if (iface.getName().endsWith('Props') || iface.getName().endsWith('Properties')) {
71
- extractPropsFromInterface(iface, members);
72
- }
73
- }
74
- // Extract exported type aliases
75
- for (const typeAlias of sourceFile.getTypeAliases()) {
76
- if (!typeAlias.isExported())
77
- continue;
78
- members.push({
79
- memberType: 'export_type',
80
- name: typeAlias.getName(),
81
- signature: getTypeAliasSignature(typeAlias),
82
- });
83
- }
84
- // Extract exported enums
85
- for (const enumDecl of sourceFile.getEnums()) {
86
- if (!enumDecl.isExported())
87
- continue;
88
- members.push({
89
- memberType: 'export_type',
90
- name: enumDecl.getName(),
91
- signature: `enum ${enumDecl.getName()}`,
92
- });
93
- }
94
- return members;
95
- }
96
- function detectFunctionMemberType(name, _node) {
97
- // Hook detection
98
- if (name.startsWith('use') && name.length > 3 && name[3] === name[3].toUpperCase()) {
99
- return 'hook_return';
100
- }
101
- return 'export_function';
102
- }
103
- function getSignatureText(fn) {
104
- const params = fn.getParameters().map(p => {
105
- const name = p.getName();
106
- const type = p.getTypeNode()?.getText() ?? 'unknown';
107
- const optional = p.isOptional() ? '?' : '';
108
- return `${name}${optional}: ${type}`;
109
- });
110
- const returnType = fn.getReturnTypeNode()?.getText() ?? 'unknown';
111
- return `(${params.join(', ')}) => ${returnType}`;
112
- }
113
- function getVarSignature(decl) {
114
- const typeNode = decl.getTypeNode();
115
- if (typeNode)
116
- return typeNode.getText();
117
- // Try to infer from initializer
118
- try {
119
- const type = decl.getType();
120
- const text = type.getText(decl);
121
- // Truncate long types
122
- if (text.length > 200)
123
- return text.substring(0, 197) + '...';
124
- return text;
125
- }
126
- catch {
127
- return 'unknown';
128
- }
129
- }
130
- function getTypeAliasSignature(typeAlias) {
131
- const typeNode = typeAlias.getTypeNode();
132
- if (!typeNode)
133
- return `type ${typeAlias.getName()}`;
134
- const text = typeNode.getText();
135
- if (text.length > 200)
136
- return `type ${typeAlias.getName()} = ${text.substring(0, 150)}...`;
137
- return `type ${typeAlias.getName()} = ${text}`;
138
- }
139
- function extractPropsFromInterface(iface, members) {
140
- for (const prop of iface.getProperties()) {
141
- extractPropMember(prop, members);
142
- }
143
- }
144
- function extractPropMember(prop, members) {
145
- const name = prop.getName();
146
- const typeNode = prop.getTypeNode();
147
- const signature = typeNode ? typeNode.getText() : 'unknown';
148
- const required = !prop.hasQuestionToken();
149
- members.push({
150
- memberType: 'prop',
151
- name,
152
- signature,
153
- required,
154
- });
155
- }
156
- //# sourceMappingURL=ast-extraction.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ast-extraction.js","sourceRoot":"","sources":["../../src/scanner/ast-extraction.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAE5D,OAAO,EACL,OAAO,EAEP,UAAU,GAMX,MAAM,UAAU,CAAC;AAGlB;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,QAAgB;IAC5C,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC;QAC1B,gBAAgB,EAAE,GAAG,QAAQ,gBAAgB;QAC7C,2BAA2B,EAAE,IAAI;QACjC,4BAA4B,EAAE,IAAI;KACnC,CAAC,CAAC;IACH,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,UAAsB;IACnD,MAAM,OAAO,GAAsB,EAAE,CAAC;IAEtC,6BAA6B;IAC7B,KAAK,MAAM,EAAE,IAAI,UAAU,CAA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AAE,MAAM;QAClB,IAAI;QACJ,SAAS;QACT,QAAQ;KACT,CAAC,CAAC;AACL,CAAC"}
@@ -1,9 +0,0 @@
1
- import type { ComponentType, DiscoveredFile } from './types.js';
2
- /**
3
- * Classify a directory component type based on its path.
4
- */
5
- export declare function classifyDirectory(relPath: string): ComponentType;
6
- /**
7
- * Walk the source tree and discover all TypeScript/JavaScript files.
8
- */
9
- export declare function discoverFiles(repoRoot: string, sourceRoot: string): DiscoveredFile[];
@@ -1,134 +0,0 @@
1
- // File discovery and classification for the component scanner.
2
- import * as fs from 'node:fs';
3
- import * as path from 'node:path';
4
- const SKIP_DIRS = new Set([
5
- 'node_modules', 'dist', 'coverage', '.vite', '.git', '.telora',
6
- '__tests__', '__mocks__', '.next', 'build',
7
- ]);
8
- const SKIP_FILE_PATTERNS = [
9
- /\.test\.[jt]sx?$/,
10
- /\.spec\.[jt]sx?$/,
11
- /\.stories\.[jt]sx?$/,
12
- /\.d\.ts$/,
13
- ];
14
- const TS_EXTENSIONS = new Set(['.ts', '.tsx', '.js', '.jsx']);
15
- /**
16
- * Classify a file based on its directory path and content patterns.
17
- */
18
- function classifyFile(relPath, content) {
19
- const parts = relPath.split('/');
20
- // Check if this is a barrel file (index.ts with only re-exports)
21
- if (path.basename(relPath).match(/^index\.[jt]sx?$/)) {
22
- const hasExportFrom = /export\s+\{[^}]*\}\s+from\s+/m.test(content);
23
- const hasExportStar = /export\s+\*\s+from\s+/m.test(content);
24
- const hasOwnCode = /^(?:const|let|var|function|class|interface|type)\s/m.test(content);
25
- if ((hasExportFrom || hasExportStar) && !hasOwnCode) {
26
- return 'barrel';
27
- }
28
- }
29
- // Directory-based classification
30
- for (const part of parts) {
31
- if (part === 'pages' || part === 'routes')
32
- return 'page';
33
- if (part === 'hooks')
34
- return 'hook';
35
- if (part === 'contexts')
36
- return 'context';
37
- if (part === 'types')
38
- return 'type_definition';
39
- }
40
- // Check for component directories
41
- if (parts.includes('components') || parts.includes('ui'))
42
- return 'component';
43
- // Check for lib/utils
44
- if (parts.includes('lib') || parts.includes('utils'))
45
- return 'library';
46
- // Content-based heuristics for ambiguous files
47
- const hasJsx = /(?:React\.createElement|<[A-Z]|\breturn\s+\(?\s*<)/m.test(content);
48
- const hasUsePrefix = /^export\s+(?:function|const)\s+use[A-Z]/m.test(content);
49
- if (hasUsePrefix)
50
- return 'hook';
51
- if (hasJsx)
52
- return 'component';
53
- // Type-only files
54
- if (relPath.endsWith('.ts') && !relPath.endsWith('.tsx')) {
55
- const hasOnlyTypes = /^(?:export\s+)?(?:type|interface)\s/m.test(content) &&
56
- !/^(?:export\s+)?(?:function|const|let|var|class)\s/m.test(content);
57
- if (hasOnlyTypes)
58
- return 'type_definition';
59
- }
60
- return 'utility';
61
- }
62
- /**
63
- * Classify a directory component type based on its path.
64
- */
65
- export function classifyDirectory(relPath) {
66
- const name = path.basename(relPath);
67
- if (name === 'pages' || name === 'routes')
68
- return 'page';
69
- if (name === 'hooks')
70
- return 'hook';
71
- if (name === 'contexts')
72
- return 'context';
73
- if (name === 'types')
74
- return 'type_definition';
75
- if (name === 'components' || name === 'ui')
76
- return 'component';
77
- if (name === 'lib' || name === 'utils')
78
- return 'library';
79
- return 'library'; // default for directories
80
- }
81
- /**
82
- * Walk the source tree and discover all TypeScript/JavaScript files.
83
- */
84
- export function discoverFiles(repoRoot, sourceRoot) {
85
- const absSourceRoot = path.resolve(repoRoot, sourceRoot);
86
- const files = [];
87
- function walk(dir) {
88
- let entries;
89
- try {
90
- entries = fs.readdirSync(dir, { withFileTypes: true });
91
- }
92
- catch {
93
- return;
94
- }
95
- for (const entry of entries) {
96
- const absPath = path.join(dir, entry.name);
97
- const relPath = path.relative(repoRoot, absPath);
98
- if (entry.isDirectory()) {
99
- if (SKIP_DIRS.has(entry.name))
100
- continue;
101
- walk(absPath);
102
- continue;
103
- }
104
- if (!entry.isFile())
105
- continue;
106
- const ext = path.extname(entry.name);
107
- if (!TS_EXTENSIONS.has(ext))
108
- continue;
109
- // Skip test/story files
110
- if (SKIP_FILE_PATTERNS.some(p => p.test(entry.name)))
111
- continue;
112
- let content;
113
- try {
114
- content = fs.readFileSync(absPath, 'utf-8');
115
- }
116
- catch {
117
- continue;
118
- }
119
- const lineCount = content.split('\n').length;
120
- const componentType = classifyFile(relPath, content);
121
- const displayName = path.basename(entry.name, ext);
122
- files.push({
123
- path: relPath,
124
- name: displayName,
125
- componentType,
126
- lineCount,
127
- parentDir: path.dirname(relPath),
128
- });
129
- }
130
- }
131
- walk(absSourceRoot);
132
- return files;
133
- }
134
- //# sourceMappingURL=file-discovery.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"file-discovery.js","sourceRoot":"","sources":["../../src/scanner/file-discovery.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAE/D,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAGlC,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC;IACxB,cAAc,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS;IAC9D,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO;CAC3C,CAAC,CAAC;AAEH,MAAM,kBAAkB,GAAG;IACzB,kBAAkB;IAClB,kBAAkB;IAClB,qBAAqB;IACrB,UAAU;CACX,CAAC;AAEF,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;AAE9D;;GAEG;AACH,SAAS,YAAY,CAAC,OAAe,EAAE,OAAe;IACpD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAEjC,iEAAiE;IACjE,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC,EAAE,CAAC;QACrD,MAAM,aAAa,GAAG,+BAA+B,CAAC,IAAI,CAAC,OAAO,CA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,CAAC,OAAO,CAAC;aACjC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,IAAI,CAAC,aAAa,CAAC,CAAC;IACpB,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -1,19 +0,0 @@
1
- import { type TrackerConfig } from '../shared.js';
2
- export interface ScanOptions {
3
- productId: string;
4
- repoPath: string;
5
- sourceRoot?: string;
6
- maxScans?: number;
7
- }
8
- export interface ScanResult {
9
- scanId: string;
10
- componentCount: number;
11
- memberCount: number;
12
- relationshipCount: number;
13
- commitSha: string | null;
14
- }
15
- /**
16
- * Run a full component scan: discover files, parse AST, extract relationships,
17
- * persist to DB via product API.
18
- */
19
- export declare function runScan(creds: TrackerConfig, options: ScanOptions): Promise<ScanResult>;
@@ -1,193 +0,0 @@
1
- // Scanner orchestrator: runs file discovery, AST extraction, relationship
2
- // extraction, and persists results via the product API.
3
- import * as path from 'node:path';
4
- import { execSync } from 'node:child_process';
5
- import { discoverFiles, classifyDirectory } from './file-discovery.js';
6
- import { createProject, extractMembers } from './ast-extraction.js';
7
- import { extractRelationships, parseTsconfigPaths } from './relationship-extraction.js';
8
- import { callProductApi } from '../shared.js';
9
- /**
10
- * Run a full component scan: discover files, parse AST, extract relationships,
11
- * persist to DB via product API.
12
- */
13
- export async function runScan(creds, options) {
14
- const { productId, repoPath, sourceRoot = 'src/', maxScans } = options;
15
- // Get current commit SHA
16
- let commitSha = null;
17
- try {
18
- commitSha = execSync('git rev-parse HEAD', { cwd: repoPath, encoding: 'utf-8' }).trim();
19
- }
20
- catch {
21
- // Not a git repo or no commits — continue without SHA
22
- }
23
- // Step 1: Create scan record
24
- const createResult = await callProductApi(creds, {
25
- action: 'component_scan_create',
26
- productId,
27
- sourceRoot,
28
- fields: { commitSha },
29
- });
30
- const scanId = createResult.scan.id;
31
- try {
32
- // Step 2: Discover files
33
- const files = discoverFiles(repoPath, sourceRoot);
34
- // Step 3: Build directory hierarchy
35
- const { components } = buildComponentHierarchy(files, sourceRoot);
36
- // Step 4: Extract members via AST
37
- const members = [];
38
- const project = createProject(repoPath);
39
- const knownPaths = new Set(files.map(f => f.path));
40
- for (const file of files) {
41
- const absPath = path.resolve(repoPath, file.path);
42
- const tempId = file.path; // path is the temp ID
43
- try {
44
- const sourceFile = project.addSourceFileAtPath(absPath);
45
- const extractedMembers = extractMembers(sourceFile);
46
- for (const m of extractedMembers) {
47
- members.push({
48
- componentTempId: tempId,
49
- memberType: m.memberType,
50
- name: m.name,
51
- signature: m.signature,
52
- required: m.required,
53
- defaultValue: m.defaultValue,
54
- });
55
- }
56
- }
57
- catch {
58
- // Skip files that can't be parsed
59
- continue;
60
- }
61
- }
62
- // Step 5: Extract relationships
63
- const relationships = [];
64
- const pathAliases = parseTsconfigPaths(repoPath);
65
- const tempIdByPath = new Map();
66
- for (const c of components) {
67
- tempIdByPath.set(c.path, c.tempId);
68
- }
69
- for (const file of files) {
70
- const absPath = path.resolve(repoPath, file.path);
71
- try {
72
- const sourceFile = project.getSourceFile(absPath);
73
- if (!sourceFile)
74
- continue;
75
- const extracted = extractRelationships(sourceFile, file.path, knownPaths, repoPath, pathAliases);
76
- for (const rel of extracted) {
77
- const sourceTempId = tempIdByPath.get(rel.sourcePath);
78
- const targetTempId = tempIdByPath.get(rel.targetPath);
79
- if (sourceTempId && targetTempId && sourceTempId !== targetTempId) {
80
- relationships.push({
81
- sourceTempId,
82
- targetTempId,
83
- relationshipType: rel.relationshipType,
84
- metadata: rel.metadata,
85
- });
86
- }
87
- }
88
- }
89
- catch {
90
- continue;
91
- }
92
- }
93
- // Deduplicate relationships (same source+target+type)
94
- const relKey = (r) => `${r.sourceTempId}|${r.targetTempId}|${r.relationshipType}`;
95
- const seenRels = new Set();
96
- const uniqueRelationships = relationships.filter(r => {
97
- const key = relKey(r);
98
- if (seenRels.has(key))
99
- return false;
100
- seenRels.add(key);
101
- return true;
102
- });
103
- // Step 6: Persist everything (also triggers cleanup of old scans)
104
- const persistPayload = {
105
- action: 'component_scan_persist',
106
- scanId,
107
- components,
108
- members,
109
- relationships: uniqueRelationships,
110
- };
111
- if (maxScans !== undefined)
112
- persistPayload.maxScans = maxScans;
113
- const persistResult = await callProductApi(creds, persistPayload);
114
- return {
115
- scanId,
116
- componentCount: persistResult.componentCount,
117
- memberCount: persistResult.memberCount,
118
- relationshipCount: persistResult.relationshipCount,
119
- commitSha,
120
- };
121
- }
122
- catch (err) {
123
- // Mark scan as failed
124
- try {
125
- await callProductApi(creds, {
126
- action: 'component_scan_update',
127
- scanId,
128
- fields: {
129
- status: 'failed',
130
- metadata: { error: err.message },
131
- },
132
- });
133
- }
134
- catch {
135
- // Best effort
136
- }
137
- throw err;
138
- }
139
- }
140
- /**
141
- * Build the component hierarchy from discovered files.
142
- * Creates directory components as parents, file components as children.
143
- */
144
- function buildComponentHierarchy(files, sourceRoot) {
145
- const components = [];
146
- const dirTempIds = new Map();
147
- // Collect all unique directories
148
- const dirs = new Set();
149
- for (const file of files) {
150
- let dir = file.parentDir;
151
- while (dir && dir !== '.' && dir !== sourceRoot.replace(/\/$/, '')) {
152
- dirs.add(dir);
153
- dir = path.dirname(dir);
154
- // Stop at sourceRoot level
155
- if (dir.length < sourceRoot.replace(/\/$/, '').length)
156
- break;
157
- }
158
- }
159
- // Sort directories by depth (parents first)
160
- const sortedDirs = [...dirs].sort((a, b) => {
161
- const aDepth = a.split('/').length;
162
- const bDepth = b.split('/').length;
163
- return aDepth - bDepth;
164
- });
165
- // Create directory components
166
- for (const dir of sortedDirs) {
167
- const parentDir = path.dirname(dir);
168
- const parentTempId = dirTempIds.get(parentDir);
169
- const tempId = `dir:${dir}`;
170
- dirTempIds.set(dir, tempId);
171
- components.push({
172
- tempId,
173
- parentTempId: parentTempId,
174
- name: path.basename(dir),
175
- path: dir,
176
- componentType: classifyDirectory(dir),
177
- });
178
- }
179
- // Create file components
180
- for (const file of files) {
181
- const parentTempId = dirTempIds.get(file.parentDir);
182
- components.push({
183
- tempId: file.path,
184
- parentTempId: parentTempId,
185
- name: file.name,
186
- path: file.path,
187
- componentType: file.componentType,
188
- lineCount: file.lineCount,
189
- });
190
- }
191
- return { components, dirTempIds };
192
- }
193
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/scanner/index.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,wDAAwD;AAExD,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AACxF,OAAO,EAAE,cAAc,EAAsB,MAAM,cAAc,CAAC;AAuBlE;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO,CAC3B,KAAoB,EACpB,OAAoB;IAEpB,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,GAAG,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAEvE,yBAAyB;IACzB,IAAI,SAAS,GAAkB,IAAI,CAAC;IACpC,IAAI,CAAC;QACH,SAAS,GAAG,QAAQ,CAAC,oBAAoB,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAC1F,CAAC;IAAC,MAAM,CAAC;QACP,sDAAsD;IACxD,CAAC;IAED,6BAA6B;IAC7B,MAAM,YAAY,GAAG,MAAM,cAAc,CAAC,KAAK,EAAE;QAC/C,MAAM,EAAE,uBAAuB;QAC/B,SAAS;QACT,UAAU;QACV,MAAM,EAAE,EAAE,SAAS,EAAE;KACtB,CAA6B,CAAC;IAC/B,MAAM,MAAM,GAAG,YAAY,CAAC,IAAI,CAAC,EAAE,CA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AAC;QAC/C,MAAM,MAAM,GAAG,OAAO,GAAG,EAAE,CAAC;QAC5B,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QAE5B,UAAU,CAAC,IAAI,CAAC;YACd,MAAM;YACN,YAAY,EAAE,YAAY;YAC1B,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;YACxB,IAAI,EAAE,GAAG;YACT,aAAa,EAAE,iBAAiB,CAAC,GAAG,CAAC;SACtC,CAAC,CAAC;IACL,CAAC;IAED,yBAAyB;IACzB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,YAAY,GAAG,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACpD,UAAU,CAAC,IAAI,CAAC;YACd,MAAM,EAAE,IAAI,CAAC,IAAI;YACjB,YAAY,EAAE,YAAY;YAC1B,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,SAAS,EAAE,IAAI,CAAC,SAAS;SAC1B,CAAC,CAAC;IACL,CAAC;IAED,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC;AACpC,CAAC"}
@@ -1,11 +0,0 @@
1
- import type { SourceFile } from 'ts-morph';
2
- import type { ExtractedRelationship } from './types.js';
3
- /**
4
- * Extract import relationships from a source file.
5
- * Only tracks imports that resolve to discovered components (internal).
6
- */
7
- export declare function extractRelationships(sourceFile: SourceFile, sourcePath: string, knownPaths: Set<string>, repoRoot: string, pathAliases: Record<string, string>): ExtractedRelationship[];
8
- /**
9
- * Parse tsconfig.json paths to extract alias mappings.
10
- */
11
- export declare function parseTsconfigPaths(repoRoot: string): Record<string, string>;
@@ -1,187 +0,0 @@
1
- // Extract import relationships between discovered components.
2
- import * as path from 'node:path';
3
- import * as fs from 'node:fs';
4
- /**
5
- * Extract import relationships from a source file.
6
- * Only tracks imports that resolve to discovered components (internal).
7
- */
8
- export function extractRelationships(sourceFile, sourcePath, knownPaths, repoRoot, pathAliases) {
9
- const relationships = [];
10
- // Process import declarations
11
- for (const importDecl of sourceFile.getImportDeclarations()) {
12
- const moduleSpecifier = importDecl.getModuleSpecifierValue();
13
- const resolvedPath = resolveImportPath(sourcePath, moduleSpecifier, knownPaths, repoRoot, pathAliases);
14
- if (!resolvedPath)
15
- continue;
16
- const namedImports = importDecl.getNamedImports().map(ni => ni.getName());
17
- const defaultImport = importDecl.getDefaultImport()?.getText();
18
- const namespaceImport = importDecl.getNamespaceImport()?.getText();
19
- const allImports = [
20
- ...namedImports,
21
- ...(defaultImport ? [defaultImport] : []),
22
- ...(namespaceImport ? [namespaceImport] : []),
23
- ];
24
- relationships.push({
25
- sourcePath,
26
- targetPath: resolvedPath,
27
- relationshipType: 'imports',
28
- metadata: { namedImports: allImports },
29
- });
30
- }
31
- // Process re-exports (export { X } from './Y')
32
- for (const exportDecl of sourceFile.getExportDeclarations()) {
33
- const moduleSpecifier = exportDecl.getModuleSpecifierValue();
34
- if (!moduleSpecifier)
35
- continue;
36
- const resolvedPath = resolveImportPath(sourcePath, moduleSpecifier, knownPaths, repoRoot, pathAliases);
37
- if (!resolvedPath)
38
- continue;
39
- const namedExports = exportDecl.getNamedExports().map(ne => ne.getName());
40
- const isStarExport = exportDecl.isNamespaceExport() || namedExports.length === 0;
41
- relationships.push({
42
- sourcePath,
43
- targetPath: resolvedPath,
44
- relationshipType: 're_exports',
45
- metadata: {
46
- namedExports: isStarExport ? ['*'] : namedExports,
47
- },
48
- });
49
- }
50
- // Detect JSX renders (component A renders component B)
51
- detectRenders(sourceFile, sourcePath, knownPaths, repoRoot, pathAliases, relationships);
52
- return relationships;
53
- }
54
- /**
55
- * Resolve an import specifier to a known component path.
56
- */
57
- function resolveImportPath(sourcePath, specifier, knownPaths, repoRoot, pathAliases) {
58
- // Skip external packages
59
- if (!specifier.startsWith('.') && !specifier.startsWith('@/') && !specifier.startsWith('~/')) {
60
- // Check path aliases
61
- let resolved = null;
62
- for (const [alias, target] of Object.entries(pathAliases)) {
63
- const aliasPrefix = alias.replace('/*', '/');
64
- const targetPrefix = target.replace('/*', '/');
65
- if (specifier.startsWith(aliasPrefix)) {
66
- const rest = specifier.slice(aliasPrefix.length);
67
- resolved = targetPrefix + rest;
68
- break;
69
- }
70
- // Exact match (no wildcard)
71
- if (alias === specifier) {
72
- resolved = target;
73
- break;
74
- }
75
- }
76
- if (!resolved)
77
- return null;
78
- return tryResolveToKnown(resolved, knownPaths);
79
- }
80
- // Handle @/ alias (common in Vite/Next projects)
81
- if (specifier.startsWith('@/') || specifier.startsWith('~/')) {
82
- const aliasValue = pathAliases['@/*'] || pathAliases['~/*'] || 'src/*';
83
- const targetPrefix = aliasValue.replace('/*', '/');
84
- const rest = specifier.slice(2); // remove @/ or ~/
85
- return tryResolveToKnown(targetPrefix + rest, knownPaths);
86
- }
87
- // Relative import
88
- const sourceDir = path.dirname(sourcePath);
89
- const resolved = path.normalize(path.join(sourceDir, specifier));
90
- return tryResolveToKnown(resolved, knownPaths);
91
- }
92
- /**
93
- * Try to resolve a partial path to a known component path.
94
- * Handles: exact match, .ts/.tsx extension, /index.ts barrel.
95
- */
96
- function tryResolveToKnown(partial, knownPaths) {
97
- // Normalize separators
98
- const normalized = partial.replace(/\\/g, '/');
99
- // Exact match
100
- if (knownPaths.has(normalized))
101
- return normalized;
102
- // Try extensions
103
- const extensions = ['.ts', '.tsx', '.js', '.jsx'];
104
- for (const ext of extensions) {
105
- const withExt = normalized + ext;
106
- if (knownPaths.has(withExt))
107
- return withExt;
108
- }
109
- // Try index file
110
- for (const ext of extensions) {
111
- const indexPath = normalized + '/index' + ext;
112
- if (knownPaths.has(indexPath))
113
- return indexPath;
114
- }
115
- return null;
116
- }
117
- /**
118
- * Detect JSX render relationships by scanning import declarations
119
- * and checking if imported identifiers appear in JSX-like patterns.
120
- */
121
- function detectRenders(sourceFile, sourcePath, knownPaths, repoRoot, pathAliases, relationships) {
122
- const text = sourceFile.getFullText();
123
- // Collect imported component names (PascalCase = likely React component)
124
- const importedComponents = new Map(); // name -> resolved path
125
- for (const importDecl of sourceFile.getImportDeclarations()) {
126
- const moduleSpecifier = importDecl.getModuleSpecifierValue();
127
- const resolvedPath = resolveImportPath(sourcePath, moduleSpecifier, knownPaths, repoRoot, pathAliases);
128
- if (!resolvedPath)
129
- continue;
130
- const defaultImport = importDecl.getDefaultImport()?.getText();
131
- if (defaultImport && isPascalCase(defaultImport)) {
132
- importedComponents.set(defaultImport, resolvedPath);
133
- }
134
- for (const named of importDecl.getNamedImports()) {
135
- const name = named.getAliasNode()?.getText() || named.getName();
136
- if (isPascalCase(name)) {
137
- importedComponents.set(name, resolvedPath);
138
- }
139
- }
140
- }
141
- // Check if any imported PascalCase identifiers appear as JSX tags
142
- for (const [name, targetPath] of importedComponents) {
143
- // Look for <ComponentName or <ComponentName> patterns
144
- const jsxPattern = new RegExp(`<${name}[\\s/>]`);
145
- if (jsxPattern.test(text)) {
146
- // Don't duplicate if we already have an imports relationship for this target
147
- const existingImport = relationships.find(r => r.sourcePath === sourcePath && r.targetPath === targetPath && r.relationshipType === 'imports');
148
- if (existingImport) {
149
- // Upgrade: also add a renders relationship
150
- relationships.push({
151
- sourcePath,
152
- targetPath,
153
- relationshipType: 'renders',
154
- metadata: { renderedComponent: name },
155
- });
156
- }
157
- }
158
- }
159
- }
160
- function isPascalCase(name) {
161
- return /^[A-Z][a-zA-Z0-9]*$/.test(name);
162
- }
163
- /**
164
- * Parse tsconfig.json paths to extract alias mappings.
165
- */
166
- export function parseTsconfigPaths(repoRoot) {
167
- const aliases = {};
168
- try {
169
- const tsconfigPath = path.join(repoRoot, 'tsconfig.json');
170
- const content = JSON.parse(fs.readFileSync(tsconfigPath, 'utf-8'));
171
- const paths = content?.compilerOptions?.paths;
172
- if (paths) {
173
- for (const [alias, targets] of Object.entries(paths)) {
174
- const targetArray = targets;
175
- if (targetArray.length > 0) {
176
- aliases[alias] = targetArray[0];
177
- }
178
- }
179
- }
180
- }
181
- catch {
182
- // Default alias if tsconfig not found
183
- aliases['@/*'] = 'src/*';
184
- }
185
- return aliases;
186
- }
187
- //# sourceMappingURL=relationship-extraction.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"relationship-extraction.js","sourceRoot":"","sources":["../../src/scanner/relationship-extraction.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAG9D,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAG9B;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAClC,UAAsB,EACtB,UAAkB,EAClB,UAAuB,EACvB,QAAgB,EAChB,WAAmC;IAEnC,MAAM,aAAa,GAA4B,EAAE,CAAC;IAElD,8BAA8B;IAC9B,KAAK,MAAM,UAAU,IAAI,UAAU,CAAC,qBAAqB,EAAE,EAAE,CAAC;QAC5D,MAAM,eAAe,GAAG,UAAU,CAAC,uBAAuB,EAAE,CAAC;QAC7D,MAAM,YAAY,GAAG,iBAAiB,CAAC,UAAU,EAAE,eAAe,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;QACvG,IAAI,CAAC,YAAY;YAAE,SAAS;QAE5B,MAAM,YAAY,GAAG,UAAU,CAAC,eAAe,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;QAC1E,MAAM,aAAa,GAAG,UAAU,CAAC,gBAAgB,EAAE,EAAE,OAAO,EAAE,CAAC;QAC/D,MAAM,eAAe,GAAG,UAAU,CAAC,kBAAkB,EAAE,EAAE,OAAO,EAAE,CAAC;QAEnE,MAAM,UAAU,GAAG;YACjB,GAAG,YAAY;YACf,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACzC,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,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ACH,CAAC;QACH,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,sCAAsC;QACtC,OAAO,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC;IAC3B,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -1,45 +0,0 @@
1
- export type ComponentType = 'page' | 'component' | 'hook' | 'context' | 'library' | 'utility' | 'type_definition' | 'barrel';
2
- export type MemberType = 'prop' | 'method' | 'hook_return' | 'export_function' | 'export_const' | 'export_type' | 'state' | 'context_value';
3
- export type RelationshipType = 'imports' | 're_exports' | 'renders';
4
- export interface DiscoveredFile {
5
- path: string;
6
- name: string;
7
- componentType: ComponentType;
8
- lineCount: number;
9
- parentDir: string;
10
- }
11
- export interface ExtractedMember {
12
- memberType: MemberType;
13
- name: string;
14
- signature?: string;
15
- required?: boolean;
16
- defaultValue?: string;
17
- }
18
- export interface ExtractedRelationship {
19
- sourcePath: string;
20
- targetPath: string;
21
- relationshipType: RelationshipType;
22
- metadata?: Record<string, unknown>;
23
- }
24
- export interface ComponentInput {
25
- tempId: string;
26
- parentTempId?: string;
27
- name: string;
28
- path: string;
29
- componentType: ComponentType;
30
- lineCount?: number;
31
- }
32
- export interface MemberInput {
33
- componentTempId: string;
34
- memberType: MemberType;
35
- name: string;
36
- signature?: string;
37
- required?: boolean;
38
- defaultValue?: string;
39
- }
40
- export interface RelationshipInput {
41
- sourceTempId: string;
42
- targetTempId: string;
43
- relationshipType: RelationshipType;
44
- metadata?: Record<string, unknown>;
45
- }
@@ -1,3 +0,0 @@
1
- // Scanner types shared across modules
2
- export {};
3
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/scanner/types.ts"],"names":[],"mappings":"AAAA,sCAAsC"}