aidex-mcp 1.4.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/CHANGELOG.md +128 -0
- package/LICENSE +21 -0
- package/MCP-API-REFERENCE.md +690 -0
- package/README.md +314 -0
- package/build/commands/files.d.ts +28 -0
- package/build/commands/files.js +124 -0
- package/build/commands/index.d.ts +14 -0
- package/build/commands/index.js +14 -0
- package/build/commands/init.d.ts +24 -0
- package/build/commands/init.js +396 -0
- package/build/commands/link.d.ts +45 -0
- package/build/commands/link.js +167 -0
- package/build/commands/note.d.ts +29 -0
- package/build/commands/note.js +105 -0
- package/build/commands/query.d.ts +36 -0
- package/build/commands/query.js +176 -0
- package/build/commands/scan.d.ts +25 -0
- package/build/commands/scan.js +104 -0
- package/build/commands/session.d.ts +52 -0
- package/build/commands/session.js +216 -0
- package/build/commands/signature.d.ts +52 -0
- package/build/commands/signature.js +171 -0
- package/build/commands/summary.d.ts +56 -0
- package/build/commands/summary.js +324 -0
- package/build/commands/update.d.ts +36 -0
- package/build/commands/update.js +273 -0
- package/build/constants.d.ts +10 -0
- package/build/constants.js +10 -0
- package/build/db/database.d.ts +69 -0
- package/build/db/database.js +126 -0
- package/build/db/index.d.ts +7 -0
- package/build/db/index.js +6 -0
- package/build/db/queries.d.ts +163 -0
- package/build/db/queries.js +273 -0
- package/build/db/schema.sql +136 -0
- package/build/index.d.ts +13 -0
- package/build/index.js +74 -0
- package/build/parser/extractor.d.ts +41 -0
- package/build/parser/extractor.js +249 -0
- package/build/parser/index.d.ts +7 -0
- package/build/parser/index.js +7 -0
- package/build/parser/languages/c.d.ts +28 -0
- package/build/parser/languages/c.js +70 -0
- package/build/parser/languages/cpp.d.ts +28 -0
- package/build/parser/languages/cpp.js +91 -0
- package/build/parser/languages/csharp.d.ts +32 -0
- package/build/parser/languages/csharp.js +97 -0
- package/build/parser/languages/go.d.ts +28 -0
- package/build/parser/languages/go.js +83 -0
- package/build/parser/languages/index.d.ts +21 -0
- package/build/parser/languages/index.js +107 -0
- package/build/parser/languages/java.d.ts +28 -0
- package/build/parser/languages/java.js +58 -0
- package/build/parser/languages/php.d.ts +28 -0
- package/build/parser/languages/php.js +75 -0
- package/build/parser/languages/python.d.ts +28 -0
- package/build/parser/languages/python.js +67 -0
- package/build/parser/languages/ruby.d.ts +28 -0
- package/build/parser/languages/ruby.js +68 -0
- package/build/parser/languages/rust.d.ts +28 -0
- package/build/parser/languages/rust.js +73 -0
- package/build/parser/languages/typescript.d.ts +28 -0
- package/build/parser/languages/typescript.js +82 -0
- package/build/parser/tree-sitter.d.ts +30 -0
- package/build/parser/tree-sitter.js +132 -0
- package/build/server/mcp-server.d.ts +7 -0
- package/build/server/mcp-server.js +36 -0
- package/build/server/tools.d.ts +18 -0
- package/build/server/tools.js +1245 -0
- package/build/viewer/git-status.d.ts +25 -0
- package/build/viewer/git-status.js +163 -0
- package/build/viewer/index.d.ts +5 -0
- package/build/viewer/index.js +5 -0
- package/build/viewer/server.d.ts +12 -0
- package/build/viewer/server.js +1122 -0
- package/package.json +66 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git status utilities for AiDex Viewer
|
|
3
|
+
*
|
|
4
|
+
* Provides git status per file to show colored cat icons:
|
|
5
|
+
* - untracked (gray): Git doesn't know about file
|
|
6
|
+
* - modified (yellow): Changed, not committed
|
|
7
|
+
* - committed (blue): Committed locally, not pushed
|
|
8
|
+
* - pushed (green): In sync with remote
|
|
9
|
+
*/
|
|
10
|
+
export type GitFileStatus = 'untracked' | 'modified' | 'committed' | 'pushed';
|
|
11
|
+
export interface GitStatusInfo {
|
|
12
|
+
isGitRepo: boolean;
|
|
13
|
+
hasRemote: boolean;
|
|
14
|
+
fileStatuses: Map<string, GitFileStatus>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Check if a directory is inside a git repository (traverses parent dirs)
|
|
18
|
+
*/
|
|
19
|
+
export declare function isGitRepo(projectPath: string): Promise<boolean>;
|
|
20
|
+
/**
|
|
21
|
+
* Get git status for all files in a project
|
|
22
|
+
* Returns a map of relative file paths to their git status
|
|
23
|
+
*/
|
|
24
|
+
export declare function getGitStatus(projectPath: string): Promise<GitStatusInfo>;
|
|
25
|
+
//# sourceMappingURL=git-status.d.ts.map
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git status utilities for AiDex Viewer
|
|
3
|
+
*
|
|
4
|
+
* Provides git status per file to show colored cat icons:
|
|
5
|
+
* - untracked (gray): Git doesn't know about file
|
|
6
|
+
* - modified (yellow): Changed, not committed
|
|
7
|
+
* - committed (blue): Committed locally, not pushed
|
|
8
|
+
* - pushed (green): In sync with remote
|
|
9
|
+
*/
|
|
10
|
+
import { simpleGit } from 'simple-git';
|
|
11
|
+
import path from 'path';
|
|
12
|
+
// ============================================================
|
|
13
|
+
// Implementation
|
|
14
|
+
// ============================================================
|
|
15
|
+
/**
|
|
16
|
+
* Check if a directory is inside a git repository (traverses parent dirs)
|
|
17
|
+
*/
|
|
18
|
+
export async function isGitRepo(projectPath) {
|
|
19
|
+
try {
|
|
20
|
+
return await simpleGit(projectPath).checkIsRepo();
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Get git status for all files in a project
|
|
28
|
+
* Returns a map of relative file paths to their git status
|
|
29
|
+
*/
|
|
30
|
+
export async function getGitStatus(projectPath) {
|
|
31
|
+
if (!await isGitRepo(projectPath)) {
|
|
32
|
+
return {
|
|
33
|
+
isGitRepo: false,
|
|
34
|
+
hasRemote: false,
|
|
35
|
+
fileStatuses: new Map()
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
const git = simpleGit(projectPath);
|
|
39
|
+
const fileStatuses = new Map();
|
|
40
|
+
try {
|
|
41
|
+
// Determine git repo root and compute prefix for subfolder projects
|
|
42
|
+
const gitRoot = normalizePathSeparators((await git.revparse(['--show-toplevel'])).trim());
|
|
43
|
+
const absProject = normalizePathSeparators(path.resolve(projectPath));
|
|
44
|
+
const prefix = absProject === gitRoot ? '' : absProject.slice(gitRoot.length + 1) + '/';
|
|
45
|
+
// Helper: convert git-root-relative path to project-relative path
|
|
46
|
+
// Returns null if the file is outside this project subfolder
|
|
47
|
+
const toProjectRelative = (gitRelPath) => {
|
|
48
|
+
const normalized = normalizePathSeparators(gitRelPath);
|
|
49
|
+
if (!prefix)
|
|
50
|
+
return normalized;
|
|
51
|
+
if (normalized.startsWith(prefix))
|
|
52
|
+
return normalized.slice(prefix.length);
|
|
53
|
+
return null; // file outside this project
|
|
54
|
+
};
|
|
55
|
+
// Get current status (uncommitted changes)
|
|
56
|
+
const status = await git.status();
|
|
57
|
+
// Mark untracked files
|
|
58
|
+
for (const file of status.not_added) {
|
|
59
|
+
const rel = toProjectRelative(file);
|
|
60
|
+
if (rel !== null)
|
|
61
|
+
fileStatuses.set(rel, 'untracked');
|
|
62
|
+
}
|
|
63
|
+
// Mark modified/staged files (not yet committed)
|
|
64
|
+
for (const file of status.modified) {
|
|
65
|
+
const rel = toProjectRelative(file);
|
|
66
|
+
if (rel !== null)
|
|
67
|
+
fileStatuses.set(rel, 'modified');
|
|
68
|
+
}
|
|
69
|
+
for (const file of status.staged) {
|
|
70
|
+
const rel = toProjectRelative(file);
|
|
71
|
+
if (rel !== null)
|
|
72
|
+
fileStatuses.set(rel, 'modified');
|
|
73
|
+
}
|
|
74
|
+
for (const file of status.created) {
|
|
75
|
+
const rel = toProjectRelative(file);
|
|
76
|
+
if (rel !== null)
|
|
77
|
+
fileStatuses.set(rel, 'modified');
|
|
78
|
+
}
|
|
79
|
+
for (const file of status.deleted) {
|
|
80
|
+
const rel = toProjectRelative(file);
|
|
81
|
+
if (rel !== null)
|
|
82
|
+
fileStatuses.set(rel, 'modified');
|
|
83
|
+
}
|
|
84
|
+
for (const file of status.renamed.map(r => r.to)) {
|
|
85
|
+
const rel = toProjectRelative(file);
|
|
86
|
+
if (rel !== null)
|
|
87
|
+
fileStatuses.set(rel, 'modified');
|
|
88
|
+
}
|
|
89
|
+
// Check if remote exists
|
|
90
|
+
let hasRemote = false;
|
|
91
|
+
try {
|
|
92
|
+
const remotes = await git.getRemotes();
|
|
93
|
+
hasRemote = remotes.length > 0;
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
// No remotes
|
|
97
|
+
}
|
|
98
|
+
if (hasRemote) {
|
|
99
|
+
// Get files that are committed locally but not pushed
|
|
100
|
+
try {
|
|
101
|
+
// Get current branch
|
|
102
|
+
const branch = await git.revparse(['--abbrev-ref', 'HEAD']);
|
|
103
|
+
const currentBranch = branch.trim();
|
|
104
|
+
// Check if remote tracking branch exists
|
|
105
|
+
const trackingBranch = `origin/${currentBranch}`;
|
|
106
|
+
try {
|
|
107
|
+
// Get commits ahead of remote
|
|
108
|
+
const log = await git.log([`${trackingBranch}..HEAD`, '--name-only']);
|
|
109
|
+
// Extract files from commits that haven't been pushed
|
|
110
|
+
for (const commit of log.all) {
|
|
111
|
+
// The diff field contains changed files
|
|
112
|
+
const diff = commit.diff;
|
|
113
|
+
if (diff?.files) {
|
|
114
|
+
for (const file of diff.files) {
|
|
115
|
+
const rel = toProjectRelative(file.file);
|
|
116
|
+
// Only mark as committed if not already modified/untracked
|
|
117
|
+
if (rel !== null && !fileStatuses.has(rel)) {
|
|
118
|
+
fileStatuses.set(rel, 'committed');
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
// Alternative: use diff to get files
|
|
124
|
+
const diffOutput = await git.diff(['--name-only', trackingBranch, 'HEAD']);
|
|
125
|
+
if (diffOutput) {
|
|
126
|
+
for (const file of diffOutput.split('\n').filter(f => f.trim())) {
|
|
127
|
+
const rel = toProjectRelative(file);
|
|
128
|
+
if (rel !== null && !fileStatuses.has(rel)) {
|
|
129
|
+
fileStatuses.set(rel, 'committed');
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
catch {
|
|
135
|
+
// No tracking branch or other error - ignore
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
catch {
|
|
139
|
+
// Could not determine branch - ignore
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return {
|
|
143
|
+
isGitRepo: true,
|
|
144
|
+
hasRemote,
|
|
145
|
+
fileStatuses
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
catch (error) {
|
|
149
|
+
console.error('Error getting git status:', error);
|
|
150
|
+
return {
|
|
151
|
+
isGitRepo: true,
|
|
152
|
+
hasRemote: false,
|
|
153
|
+
fileStatuses: new Map()
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Normalize path separators to forward slashes (for consistency)
|
|
159
|
+
*/
|
|
160
|
+
function normalizePathSeparators(filePath) {
|
|
161
|
+
return filePath.replace(/\\/g, '/');
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=git-status.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AiDex Viewer - Local HTTP Server with WebSocket
|
|
3
|
+
* Opens an interactive project tree in the browser
|
|
4
|
+
*
|
|
5
|
+
* Features:
|
|
6
|
+
* - Tab-based navigation (Code/All files, Overview/Code view)
|
|
7
|
+
* - Session change indicators (modified/new files)
|
|
8
|
+
* - Syntax highlighting with highlight.js
|
|
9
|
+
*/
|
|
10
|
+
export declare function startViewer(projectPath: string): Promise<string>;
|
|
11
|
+
export declare function stopViewer(): string;
|
|
12
|
+
//# sourceMappingURL=server.d.ts.map
|