codesynapse 1.0.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/README.md +270 -0
- package/bin/cli.js +79 -0
- package/client/build/asset-manifest.json +14 -0
- package/client/build/index.html +1 -0
- package/client/build/static/css/main.23fcdbf2.css +2 -0
- package/client/build/static/css/main.23fcdbf2.css.map +1 -0
- package/client/build/static/js/main.5c90edac.js +3 -0
- package/client/build/static/js/main.5c90edac.js.LICENSE.txt +51 -0
- package/client/build/static/js/main.5c90edac.js.map +1 -0
- package/client/build/static/media/ngraph.events.d3dfed5ea2f996b98f21.cjs +1 -0
- package/package.json +61 -0
- package/server/dist/DependencyParser.d.ts +8 -0
- package/server/dist/DependencyParser.js +178 -0
- package/server/dist/DependencyParser.js.map +1 -0
- package/server/dist/FileWatcher.d.ts +12 -0
- package/server/dist/FileWatcher.js +125 -0
- package/server/dist/FileWatcher.js.map +1 -0
- package/server/dist/GitIntegration.d.ts +11 -0
- package/server/dist/GitIntegration.js +140 -0
- package/server/dist/GitIntegration.js.map +1 -0
- package/server/dist/GraphBuilder.d.ts +21 -0
- package/server/dist/GraphBuilder.js +201 -0
- package/server/dist/GraphBuilder.js.map +1 -0
- package/server/dist/index.d.ts +1 -0
- package/server/dist/index.js +338 -0
- package/server/dist/index.js.map +1 -0
- package/server/dist/types.d.ts +46 -0
- package/server/dist/types.js +3 -0
- package/server/dist/types.js.map +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function c(e){s(e);const t=a(e);return e.on=t.on,e.off=t.off,e.fire=t.fire,e}function a(e){let t=Object.create(null);return{on:function(n,r,o){if("function"!=typeof r)throw new Error("callback is expected to be a function");let c=t[n];return c||(c=t[n]=[]),c.push({callback:r,ctx:o}),e},off:function(n,r){if(typeof n>"u")return t=Object.create(null),e;if(t[n])if("function"!=typeof r)delete t[n];else{const e=t[n];for(let t=0;t<e.length;++t)e[t].callback===r&&e.splice(t,1)}return e},fire:function(n){const r=t[n];if(!r)return e;let o;arguments.length>1&&(o=Array.prototype.slice.call(arguments,1));for(let e=0;e<r.length;++e){const t=r[e];t.callback.apply(t.ctx,o)}return e}}}function s(e){if(!e)throw new Error("Eventify cannot use falsy object as events subject");const t=["on","fire","off"];for(let n=0;n<t.length;++n)if(e.hasOwnProperty(t[n]))throw new Error("Subject cannot be eventified, since it already has property '"+t[n]+"'")}module.exports=c;
|
package/package.json
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "codesynapse",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Real-time codebase visualization tool with neural network-style 3D graph. Watch your code evolve as AI agents work.",
|
|
5
|
+
"main": "server/dist/index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"codesynapse": "./bin/cli.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"bin/",
|
|
11
|
+
"server/dist/",
|
|
12
|
+
"client/build/",
|
|
13
|
+
"README.md",
|
|
14
|
+
"LICENSE"
|
|
15
|
+
],
|
|
16
|
+
"workspaces": [
|
|
17
|
+
"server",
|
|
18
|
+
"client"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"install:all": "npm install && npm install --workspace=server && npm install --workspace=client",
|
|
22
|
+
"dev": "npm run build --workspace=client && npm run dev --workspace=server",
|
|
23
|
+
"build": "npm run build --workspace=client && npm run build --workspace=server",
|
|
24
|
+
"start": "node server/dist/index.js",
|
|
25
|
+
"watch": "npm run dev",
|
|
26
|
+
"prepublishOnly": "npm run build"
|
|
27
|
+
},
|
|
28
|
+
"keywords": [
|
|
29
|
+
"visualization",
|
|
30
|
+
"codebase",
|
|
31
|
+
"3d",
|
|
32
|
+
"graph",
|
|
33
|
+
"real-time",
|
|
34
|
+
"ai-agent",
|
|
35
|
+
"development-tools",
|
|
36
|
+
"code-visualization",
|
|
37
|
+
"neural-network",
|
|
38
|
+
"dependency-graph",
|
|
39
|
+
"live-coding",
|
|
40
|
+
"developer-tools"
|
|
41
|
+
],
|
|
42
|
+
"author": "Christian Johnson",
|
|
43
|
+
"license": "MIT",
|
|
44
|
+
"repository": {
|
|
45
|
+
"type": "git",
|
|
46
|
+
"url": "https://github.com/christianjohnson/codesynapse.git"
|
|
47
|
+
},
|
|
48
|
+
"bugs": {
|
|
49
|
+
"url": "https://github.com/christianjohnson/codesynapse/issues"
|
|
50
|
+
},
|
|
51
|
+
"homepage": "https://github.com/christianjohnson/codesynapse#readme",
|
|
52
|
+
"engines": {
|
|
53
|
+
"node": ">=16.0.0"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"concurrently": "^8.2.2"
|
|
57
|
+
},
|
|
58
|
+
"dependencies": {
|
|
59
|
+
"open": "^11.0.0"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DependencyMap } from './types';
|
|
2
|
+
export declare class DependencyParser {
|
|
3
|
+
private supportedExtensions;
|
|
4
|
+
parseFile(filePath: string): string[];
|
|
5
|
+
private extractDependencies;
|
|
6
|
+
private resolvePath;
|
|
7
|
+
buildDependencyMap(files: string[]): DependencyMap;
|
|
8
|
+
}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.DependencyParser = void 0;
|
|
40
|
+
const parser = __importStar(require("@babel/parser"));
|
|
41
|
+
const traverse_1 = __importDefault(require("@babel/traverse"));
|
|
42
|
+
const fs = __importStar(require("fs"));
|
|
43
|
+
const path = __importStar(require("path"));
|
|
44
|
+
class DependencyParser {
|
|
45
|
+
constructor() {
|
|
46
|
+
this.supportedExtensions = ['.js', '.jsx', '.ts', '.tsx', '.mjs', '.cjs'];
|
|
47
|
+
}
|
|
48
|
+
parseFile(filePath) {
|
|
49
|
+
const ext = path.extname(filePath);
|
|
50
|
+
if (!this.supportedExtensions.includes(ext)) {
|
|
51
|
+
return [];
|
|
52
|
+
}
|
|
53
|
+
try {
|
|
54
|
+
const content = fs.readFileSync(filePath, 'utf-8');
|
|
55
|
+
return this.extractDependencies(content, filePath);
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
console.error(`Error parsing ${filePath}:`, error);
|
|
59
|
+
return [];
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
extractDependencies(code, filePath) {
|
|
63
|
+
const dependencies = [];
|
|
64
|
+
try {
|
|
65
|
+
const ast = parser.parse(code, {
|
|
66
|
+
sourceType: 'module',
|
|
67
|
+
plugins: [
|
|
68
|
+
'typescript',
|
|
69
|
+
'jsx',
|
|
70
|
+
'decorators-legacy',
|
|
71
|
+
'classProperties',
|
|
72
|
+
'dynamicImport'
|
|
73
|
+
]
|
|
74
|
+
});
|
|
75
|
+
(0, traverse_1.default)(ast, {
|
|
76
|
+
// ES6 imports: import foo from 'bar'
|
|
77
|
+
ImportDeclaration: (path) => {
|
|
78
|
+
const importPath = path.node.source.value;
|
|
79
|
+
const resolved = this.resolvePath(importPath, filePath);
|
|
80
|
+
if (resolved) {
|
|
81
|
+
dependencies.push(resolved);
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
// Dynamic imports: import('bar')
|
|
85
|
+
CallExpression: (path) => {
|
|
86
|
+
// Handle require()
|
|
87
|
+
if (path.node.callee.type === 'Identifier' &&
|
|
88
|
+
path.node.callee.name === 'require' &&
|
|
89
|
+
path.node.arguments.length > 0) {
|
|
90
|
+
const arg = path.node.arguments[0];
|
|
91
|
+
if (arg.type === 'StringLiteral') {
|
|
92
|
+
const requirePath = arg.value;
|
|
93
|
+
const resolved = this.resolvePath(requirePath, filePath);
|
|
94
|
+
if (resolved) {
|
|
95
|
+
dependencies.push(resolved);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
// Handle dynamic import()
|
|
100
|
+
if (path.node.callee.type === 'Import' &&
|
|
101
|
+
path.node.arguments.length > 0) {
|
|
102
|
+
const arg = path.node.arguments[0];
|
|
103
|
+
if (arg.type === 'StringLiteral') {
|
|
104
|
+
const importPath = arg.value;
|
|
105
|
+
const resolved = this.resolvePath(importPath, filePath);
|
|
106
|
+
if (resolved) {
|
|
107
|
+
dependencies.push(resolved);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
// Export from: export { foo } from 'bar'
|
|
113
|
+
ExportNamedDeclaration: (path) => {
|
|
114
|
+
if (path.node.source) {
|
|
115
|
+
const exportPath = path.node.source.value;
|
|
116
|
+
const resolved = this.resolvePath(exportPath, filePath);
|
|
117
|
+
if (resolved) {
|
|
118
|
+
dependencies.push(resolved);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
// Export all: export * from 'bar'
|
|
123
|
+
ExportAllDeclaration: (path) => {
|
|
124
|
+
const exportPath = path.node.source.value;
|
|
125
|
+
const resolved = this.resolvePath(exportPath, filePath);
|
|
126
|
+
if (resolved) {
|
|
127
|
+
dependencies.push(resolved);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
catch (error) {
|
|
133
|
+
console.error(`Error parsing AST for ${filePath}:`, error);
|
|
134
|
+
}
|
|
135
|
+
return [...new Set(dependencies)]; // Remove duplicates
|
|
136
|
+
}
|
|
137
|
+
resolvePath(importPath, fromFile) {
|
|
138
|
+
// Skip node_modules and external packages
|
|
139
|
+
if (!importPath.startsWith('.') && !importPath.startsWith('/')) {
|
|
140
|
+
return null;
|
|
141
|
+
}
|
|
142
|
+
const dir = path.dirname(fromFile);
|
|
143
|
+
let resolved = path.resolve(dir, importPath);
|
|
144
|
+
// Try to find the file with various extensions
|
|
145
|
+
if (fs.existsSync(resolved)) {
|
|
146
|
+
const stat = fs.statSync(resolved);
|
|
147
|
+
if (stat.isDirectory()) {
|
|
148
|
+
// Try index files
|
|
149
|
+
for (const ext of this.supportedExtensions) {
|
|
150
|
+
const indexFile = path.join(resolved, `index${ext}`);
|
|
151
|
+
if (fs.existsSync(indexFile)) {
|
|
152
|
+
return indexFile;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
return resolved;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
// Try adding extensions
|
|
161
|
+
for (const ext of this.supportedExtensions) {
|
|
162
|
+
const withExt = `${resolved}${ext}`;
|
|
163
|
+
if (fs.existsSync(withExt)) {
|
|
164
|
+
return withExt;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
169
|
+
buildDependencyMap(files) {
|
|
170
|
+
const map = {};
|
|
171
|
+
for (const file of files) {
|
|
172
|
+
map[file] = this.parseFile(file);
|
|
173
|
+
}
|
|
174
|
+
return map;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
exports.DependencyParser = DependencyParser;
|
|
178
|
+
//# sourceMappingURL=DependencyParser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DependencyParser.js","sourceRoot":"","sources":["../src/DependencyParser.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAAwC;AACxC,+DAAuC;AACvC,uCAAyB;AACzB,2CAA6B;AAG7B,MAAa,gBAAgB;IAA7B;QACU,wBAAmB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAqJ/E,CAAC;IAnJC,SAAS,CAAC,QAAgB;QACxB,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAEnC,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YAC5C,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CA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AAC;oBAC3C,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,GAAG,EAAE,CAAC,CAAC;oBACrD,IAAI,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;wBAC7B,OAAO,SAAS,CAAC;oBACnB,CAAC;gBACH,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,OAAO,QAAQ,CAAC;YAClB,CAAC;QACH,CAAC;QAED,wBAAwB;QACxB,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,mBAAmB,EAAE,CAAC;YAC3C,MAAM,OAAO,GAAG,GAAG,QAAQ,GAAG,GAAG,EAAE,CAAC;YACpC,IAAI,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC3B,OAAO,OAAO,CAAC;YACjB,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED,kBAAkB,CAAC,KAAe;QAChC,MAAM,GAAG,GAAkB,EAAE,CAAC;QAE9B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,GAAG,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACnC,CAAC;QAED,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AAtJD,4CAsJC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { EventEmitter } from 'events';
|
|
2
|
+
export declare class FileWatcher extends EventEmitter {
|
|
3
|
+
private watcher;
|
|
4
|
+
private watchPath;
|
|
5
|
+
private ignorePatterns;
|
|
6
|
+
constructor();
|
|
7
|
+
start(watchPath: string, customIgnorePatterns?: string[]): void;
|
|
8
|
+
private emitChange;
|
|
9
|
+
stop(): void;
|
|
10
|
+
getWatchPath(): string;
|
|
11
|
+
isWatching(): boolean;
|
|
12
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.FileWatcher = void 0;
|
|
40
|
+
const chokidar_1 = __importDefault(require("chokidar"));
|
|
41
|
+
const events_1 = require("events");
|
|
42
|
+
const path = __importStar(require("path"));
|
|
43
|
+
class FileWatcher extends events_1.EventEmitter {
|
|
44
|
+
constructor() {
|
|
45
|
+
super();
|
|
46
|
+
this.watcher = null;
|
|
47
|
+
this.watchPath = '';
|
|
48
|
+
this.ignorePatterns = [
|
|
49
|
+
'**/node_modules/**',
|
|
50
|
+
'**/.git/**',
|
|
51
|
+
'**/dist/**',
|
|
52
|
+
'**/build/**',
|
|
53
|
+
'**/.next/**',
|
|
54
|
+
'**/coverage/**',
|
|
55
|
+
'**/.cache/**',
|
|
56
|
+
'**/tmp/**',
|
|
57
|
+
'**/.DS_Store'
|
|
58
|
+
];
|
|
59
|
+
}
|
|
60
|
+
start(watchPath, customIgnorePatterns) {
|
|
61
|
+
if (this.watcher) {
|
|
62
|
+
this.stop();
|
|
63
|
+
}
|
|
64
|
+
this.watchPath = path.resolve(watchPath);
|
|
65
|
+
if (customIgnorePatterns) {
|
|
66
|
+
this.ignorePatterns = [...this.ignorePatterns, ...customIgnorePatterns];
|
|
67
|
+
}
|
|
68
|
+
console.log(`Starting file watcher on: ${this.watchPath}`);
|
|
69
|
+
console.log(`Ignoring patterns:`, this.ignorePatterns);
|
|
70
|
+
this.watcher = chokidar_1.default.watch(this.watchPath, {
|
|
71
|
+
ignored: this.ignorePatterns,
|
|
72
|
+
persistent: true,
|
|
73
|
+
ignoreInitial: false,
|
|
74
|
+
awaitWriteFinish: {
|
|
75
|
+
stabilityThreshold: 300,
|
|
76
|
+
pollInterval: 100
|
|
77
|
+
},
|
|
78
|
+
depth: 99
|
|
79
|
+
});
|
|
80
|
+
this.watcher
|
|
81
|
+
.on('add', (filePath, stats) => {
|
|
82
|
+
this.emitChange('add', filePath, stats);
|
|
83
|
+
})
|
|
84
|
+
.on('change', (filePath, stats) => {
|
|
85
|
+
this.emitChange('change', filePath, stats);
|
|
86
|
+
})
|
|
87
|
+
.on('unlink', (filePath) => {
|
|
88
|
+
this.emitChange('unlink', filePath);
|
|
89
|
+
})
|
|
90
|
+
.on('error', (error) => {
|
|
91
|
+
console.error('Watcher error:', error);
|
|
92
|
+
this.emit('error', error);
|
|
93
|
+
})
|
|
94
|
+
.on('ready', () => {
|
|
95
|
+
console.log('Initial scan complete. Ready for changes.');
|
|
96
|
+
this.emit('ready');
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
emitChange(type, filePath, stats) {
|
|
100
|
+
const event = {
|
|
101
|
+
type,
|
|
102
|
+
path: filePath,
|
|
103
|
+
stats: stats ? {
|
|
104
|
+
size: stats.size,
|
|
105
|
+
mtime: stats.mtime
|
|
106
|
+
} : undefined
|
|
107
|
+
};
|
|
108
|
+
this.emit('fileChange', event);
|
|
109
|
+
}
|
|
110
|
+
stop() {
|
|
111
|
+
if (this.watcher) {
|
|
112
|
+
console.log('Stopping file watcher');
|
|
113
|
+
this.watcher.close();
|
|
114
|
+
this.watcher = null;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
getWatchPath() {
|
|
118
|
+
return this.watchPath;
|
|
119
|
+
}
|
|
120
|
+
isWatching() {
|
|
121
|
+
return this.watcher !== null;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
exports.FileWatcher = FileWatcher;
|
|
125
|
+
//# sourceMappingURL=FileWatcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileWatcher.js","sourceRoot":"","sources":["../src/FileWatcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wDAA+C;AAC/C,mCAAsC;AACtC,2CAA6B;AAI7B,MAAa,WAAY,SAAQ,qBAAY;IAe3C;QACE,KAAK,EAAE,CAAC;QAfF,YAAO,GAAqB,IAAI,CAAC;QACjC,cAAS,GAAW,EAAE,CAAC;QACvB,mBAAc,GAAa;YACjC,oBAAoB;YACpB,YAAY;YACZ,YAAY;YACZ,aAAa;YACb,aAAa;YACb,gBAAgB;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|
|
3
|
+
private diffCache;
|
|
4
|
+
private cacheTimeout;
|
|
5
|
+
initialize(repoPath: string): Promise<boolean>;
|
|
6
|
+
getFileDiff(filePath: string): Promise<string | null>;
|
|
7
|
+
getRecentChanges(): Promise<string[]>;
|
|
8
|
+
getRepoRoot(): Promise<string>;
|
|
9
|
+
clearCache(): void;
|
|
10
|
+
isInitialized(): boolean;
|
|
11
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.GitIntegration = void 0;
|
|
40
|
+
const simple_git_1 = __importDefault(require("simple-git"));
|
|
41
|
+
const path = __importStar(require("path"));
|
|
42
|
+
const fs = __importStar(require("fs"));
|
|
43
|
+
class GitIntegration {
|
|
44
|
+
constructor() {
|
|
45
|
+
this.git = null;
|
|
46
|
+
this.diffCache = new Map();
|
|
47
|
+
this.cacheTimeout = 5000; // 5 seconds
|
|
48
|
+
}
|
|
49
|
+
async initialize(repoPath) {
|
|
50
|
+
try {
|
|
51
|
+
this.git = (0, simple_git_1.default)(repoPath);
|
|
52
|
+
const isRepo = await this.git.checkIsRepo();
|
|
53
|
+
if (!isRepo) {
|
|
54
|
+
console.log('Not a git repository, git features disabled');
|
|
55
|
+
this.git = null;
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
console.log('Git integration initialized');
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
console.error('Error initializing git:', error);
|
|
63
|
+
this.git = null;
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
async getFileDiff(filePath) {
|
|
68
|
+
if (!this.git) {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
// Check cache
|
|
72
|
+
const cached = this.diffCache.get(filePath);
|
|
73
|
+
if (cached && Date.now() - cached.timestamp < this.cacheTimeout) {
|
|
74
|
+
return cached.diff;
|
|
75
|
+
}
|
|
76
|
+
try {
|
|
77
|
+
// Check if file exists in git
|
|
78
|
+
const status = await this.git.status();
|
|
79
|
+
const relativePath = path.relative(await this.getRepoRoot(), filePath);
|
|
80
|
+
// File is untracked
|
|
81
|
+
if (status.not_added.includes(relativePath)) {
|
|
82
|
+
const content = fs.readFileSync(filePath, 'utf-8');
|
|
83
|
+
const diff = `New file (not tracked in git)\n\n${content}`;
|
|
84
|
+
this.diffCache.set(filePath, { diff, timestamp: Date.now() });
|
|
85
|
+
return diff;
|
|
86
|
+
}
|
|
87
|
+
// Get diff for modified files
|
|
88
|
+
if (status.modified.includes(relativePath) || status.created.includes(relativePath)) {
|
|
89
|
+
const diff = await this.git.diff([relativePath]);
|
|
90
|
+
this.diffCache.set(filePath, { diff, timestamp: Date.now() });
|
|
91
|
+
return diff;
|
|
92
|
+
}
|
|
93
|
+
// File is tracked but unchanged
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
console.error(`Error getting diff for ${filePath}:`, error);
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
async getRecentChanges() {
|
|
102
|
+
if (!this.git) {
|
|
103
|
+
return [];
|
|
104
|
+
}
|
|
105
|
+
try {
|
|
106
|
+
const status = await this.git.status();
|
|
107
|
+
const repoRoot = await this.getRepoRoot();
|
|
108
|
+
const changed = [
|
|
109
|
+
...status.modified,
|
|
110
|
+
...status.created,
|
|
111
|
+
...status.not_added
|
|
112
|
+
].map(file => path.join(repoRoot, file));
|
|
113
|
+
return changed;
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
console.error('Error getting recent changes:', error);
|
|
117
|
+
return [];
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
async getRepoRoot() {
|
|
121
|
+
if (!this.git) {
|
|
122
|
+
throw new Error('Git not initialized');
|
|
123
|
+
}
|
|
124
|
+
try {
|
|
125
|
+
const root = await this.git.revparse(['--show-toplevel']);
|
|
126
|
+
return root.trim();
|
|
127
|
+
}
|
|
128
|
+
catch (error) {
|
|
129
|
+
throw new Error('Failed to get repo root');
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
clearCache() {
|
|
133
|
+
this.diffCache.clear();
|
|
134
|
+
}
|
|
135
|
+
isInitialized() {
|
|
136
|
+
return this.git !== null;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
exports.GitIntegration = GitIntegration;
|
|
140
|
+
//# sourceMappingURL=GitIntegration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GitIntegration.js","sourceRoot":"","sources":["../src/GitIntegration.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4DAAkD;AAClD,2CAA6B;AAC7B,uCAAyB;AAEzB,MAAa,cAAc;IAA3B;QACU,QAAG,GAAqB,IAAI,CAAC;QAC7B,cAAS,GAAqD,IAAI,GAAG,EAAE,CAAC;QACxE,iBAAY,GAAG,IAAI,CAAC,CAAC,YAAY;IAqG3C,CAAC;IAnGC,KAAK,CAAC,UAAU,CAAC,QAAgB;QAC/B,IAAI,CAAC;YACH,IAAI,CAAC,GAAG,GAAG,IAAA,oBAAS,EAAC,QAAQ,CAAC,CAAC;YAC/B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;YAC5C,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,OAAO,CAAC,GAAG,CAAC,6CAA6C,CAAC,CAAC;gBAC3D,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC;gBAChB,OAAO,KAAK,CAAC;YACf,CAAC;YACD,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;YAC3C,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,yBAAyB,EAAE,KAAK,CAAC,CAAC;YAChD,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC;YAChB,OAAO,KAAK,CAAC;QACf,CAAC;I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AAiB,CAAC,CAAC,CAAC;YAC1D,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;QACrB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;QAC7C,CAAC;IACH,CAAC;IAED,UAAU;QACR,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;IACzB,CAAC;IAED,aAAa;QACX,OAAO,IAAI,CAAC,GAAG,KAAK,IAAI,CAAC;IAC3B,CAAC;CACF;AAxGD,wCAwGC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { GraphData, GraphNode, GraphLink, DependencyMap } from './types';
|
|
2
|
+
export declare class GraphBuilder {
|
|
3
|
+
private nodes;
|
|
4
|
+
private links;
|
|
5
|
+
private changeFrequency;
|
|
6
|
+
buildGraph(files: string[], dependencyMap: DependencyMap): GraphData;
|
|
7
|
+
addNode(filePath: string): GraphNode;
|
|
8
|
+
updateNode(filePath: string, changes: Partial<GraphNode>): GraphNode | null;
|
|
9
|
+
removeNode(filePath: string): boolean;
|
|
10
|
+
addLink(source: string, target: string, type: 'import' | 'require'): GraphLink;
|
|
11
|
+
removeLink(source: string, target: string): boolean;
|
|
12
|
+
getGraphData(): GraphData;
|
|
13
|
+
getNode(filePath: string): GraphNode | undefined;
|
|
14
|
+
private getFileType;
|
|
15
|
+
getStats(): {
|
|
16
|
+
fileCount: number;
|
|
17
|
+
connectionCount: number;
|
|
18
|
+
changeCount: number;
|
|
19
|
+
lastChangeTime: number;
|
|
20
|
+
};
|
|
21
|
+
}
|