galaxy-code 0.1.0 → 0.1.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/dist/app.js +2 -1
- package/dist/node_modules/@workspace/agent-core/connections/claude.d.ts +72 -0
- package/dist/node_modules/@workspace/agent-core/connections/claude.d.ts.map +1 -0
- package/dist/node_modules/@workspace/agent-core/connections/claude.js +270 -0
- package/dist/node_modules/@workspace/agent-core/connections/claude.js.map +1 -0
- package/dist/node_modules/@workspace/agent-core/connections/gemini.d.ts +41 -0
- package/dist/node_modules/@workspace/agent-core/connections/gemini.d.ts.map +1 -0
- package/dist/node_modules/@workspace/agent-core/connections/gemini.js +203 -0
- package/dist/node_modules/@workspace/agent-core/connections/gemini.js.map +1 -0
- package/dist/node_modules/@workspace/agent-core/connections/index.d.ts +12 -0
- package/dist/node_modules/@workspace/agent-core/connections/index.d.ts.map +1 -0
- package/dist/node_modules/@workspace/agent-core/connections/index.js +12 -0
- package/dist/node_modules/@workspace/agent-core/connections/index.js.map +1 -0
- package/dist/node_modules/@workspace/agent-core/connections/ollama.d.ts +38 -0
- package/dist/node_modules/@workspace/agent-core/connections/ollama.d.ts.map +1 -0
- package/dist/node_modules/@workspace/agent-core/connections/ollama.js +64 -0
- package/dist/node_modules/@workspace/agent-core/connections/ollama.js.map +1 -0
- package/dist/node_modules/@workspace/agent-core/connections/types.d.ts +23 -0
- package/dist/node_modules/@workspace/agent-core/connections/types.d.ts.map +1 -0
- package/dist/node_modules/@workspace/agent-core/connections/types.js +8 -0
- package/dist/node_modules/@workspace/agent-core/connections/types.js.map +1 -0
- package/dist/node_modules/@workspace/agent-core/index.d.ts +13 -0
- package/dist/node_modules/@workspace/agent-core/index.d.ts.map +1 -0
- package/dist/node_modules/@workspace/agent-core/index.js +22 -0
- package/dist/node_modules/@workspace/agent-core/index.js.map +1 -0
- package/dist/node_modules/@workspace/agent-core/package.json +53 -0
- package/dist/node_modules/@workspace/agent-core/prompts/ba-it-analyzer.d.ts +2 -0
- package/dist/node_modules/@workspace/agent-core/prompts/ba-it-analyzer.d.ts.map +1 -0
- package/dist/node_modules/@workspace/agent-core/prompts/ba-it-analyzer.js +144 -0
- package/dist/node_modules/@workspace/agent-core/prompts/ba-it-analyzer.js.map +1 -0
- package/dist/node_modules/@workspace/agent-core/prompts/index.d.ts +12 -0
- package/dist/node_modules/@workspace/agent-core/prompts/index.d.ts.map +1 -0
- package/dist/node_modules/@workspace/agent-core/prompts/index.js +12 -0
- package/dist/node_modules/@workspace/agent-core/prompts/index.js.map +1 -0
- package/dist/node_modules/@workspace/agent-core/prompts/orchestrator.d.ts +9 -0
- package/dist/node_modules/@workspace/agent-core/prompts/orchestrator.d.ts.map +1 -0
- package/dist/node_modules/@workspace/agent-core/prompts/orchestrator.js +89 -0
- package/dist/node_modules/@workspace/agent-core/prompts/orchestrator.js.map +1 -0
- package/dist/node_modules/@workspace/agent-core/prompts/planning-agent.d.ts +9 -0
- package/dist/node_modules/@workspace/agent-core/prompts/planning-agent.d.ts.map +1 -0
- package/dist/node_modules/@workspace/agent-core/prompts/planning-agent.js +196 -0
- package/dist/node_modules/@workspace/agent-core/prompts/planning-agent.js.map +1 -0
- package/dist/node_modules/@workspace/agent-core/prompts/universal-agent.d.ts +8 -0
- package/dist/node_modules/@workspace/agent-core/prompts/universal-agent.d.ts.map +1 -0
- package/dist/node_modules/@workspace/agent-core/prompts/universal-agent.js +112 -0
- package/dist/node_modules/@workspace/agent-core/prompts/universal-agent.js.map +1 -0
- package/dist/node_modules/@workspace/agent-core/providers/agent-selector.d.ts +30 -0
- package/dist/node_modules/@workspace/agent-core/providers/agent-selector.d.ts.map +1 -0
- package/dist/node_modules/@workspace/agent-core/providers/agent-selector.js +76 -0
- package/dist/node_modules/@workspace/agent-core/providers/agent-selector.js.map +1 -0
- package/dist/node_modules/@workspace/agent-core/providers/claude-agent.d.ts +30 -0
- package/dist/node_modules/@workspace/agent-core/providers/claude-agent.d.ts.map +1 -0
- package/dist/node_modules/@workspace/agent-core/providers/claude-agent.js +107 -0
- package/dist/node_modules/@workspace/agent-core/providers/claude-agent.js.map +1 -0
- package/dist/node_modules/@workspace/agent-core/providers/gemini-agent.d.ts +37 -0
- package/dist/node_modules/@workspace/agent-core/providers/gemini-agent.d.ts.map +1 -0
- package/dist/node_modules/@workspace/agent-core/providers/gemini-agent.js +144 -0
- package/dist/node_modules/@workspace/agent-core/providers/gemini-agent.js.map +1 -0
- package/dist/node_modules/@workspace/agent-core/providers/index.d.ts +13 -0
- package/dist/node_modules/@workspace/agent-core/providers/index.d.ts.map +1 -0
- package/dist/node_modules/@workspace/agent-core/providers/index.js +13 -0
- package/dist/node_modules/@workspace/agent-core/providers/index.js.map +1 -0
- package/dist/node_modules/@workspace/agent-core/providers/ollama-agent.d.ts +54 -0
- package/dist/node_modules/@workspace/agent-core/providers/ollama-agent.d.ts.map +1 -0
- package/dist/node_modules/@workspace/agent-core/providers/ollama-agent.js +247 -0
- package/dist/node_modules/@workspace/agent-core/providers/ollama-agent.js.map +1 -0
- package/dist/node_modules/@workspace/agent-core/providers/orchestrator.d.ts +17 -0
- package/dist/node_modules/@workspace/agent-core/providers/orchestrator.d.ts.map +1 -0
- package/dist/node_modules/@workspace/agent-core/providers/orchestrator.js +62 -0
- package/dist/node_modules/@workspace/agent-core/providers/orchestrator.js.map +1 -0
- package/dist/node_modules/@workspace/agent-core/tools/ba-it-analyzer.d.ts +67 -0
- package/dist/node_modules/@workspace/agent-core/tools/ba-it-analyzer.d.ts.map +1 -0
- package/dist/node_modules/@workspace/agent-core/tools/ba-it-analyzer.js +81 -0
- package/dist/node_modules/@workspace/agent-core/tools/ba-it-analyzer.js.map +1 -0
- package/dist/node_modules/@workspace/agent-core/tools/code-generate-agent.d.ts +52 -0
- package/dist/node_modules/@workspace/agent-core/tools/code-generate-agent.d.ts.map +1 -0
- package/dist/node_modules/@workspace/agent-core/tools/code-generate-agent.js +150 -0
- package/dist/node_modules/@workspace/agent-core/tools/code-generate-agent.js.map +1 -0
- package/dist/node_modules/@workspace/agent-core/tools/command-runner.d.ts +15 -0
- package/dist/node_modules/@workspace/agent-core/tools/command-runner.d.ts.map +1 -0
- package/dist/node_modules/@workspace/agent-core/tools/command-runner.js +121 -0
- package/dist/node_modules/@workspace/agent-core/tools/command-runner.js.map +1 -0
- package/dist/node_modules/@workspace/agent-core/tools/document-parser.d.ts +12 -0
- package/dist/node_modules/@workspace/agent-core/tools/document-parser.d.ts.map +1 -0
- package/dist/node_modules/@workspace/agent-core/tools/document-parser.js +84 -0
- package/dist/node_modules/@workspace/agent-core/tools/document-parser.js.map +1 -0
- package/dist/node_modules/@workspace/agent-core/tools/file-operations.d.ts +18 -0
- package/dist/node_modules/@workspace/agent-core/tools/file-operations.d.ts.map +1 -0
- package/dist/node_modules/@workspace/agent-core/tools/file-operations.js +126 -0
- package/dist/node_modules/@workspace/agent-core/tools/file-operations.js.map +1 -0
- package/dist/node_modules/@workspace/agent-core/tools/galaxy-ui-integration.d.ts +95 -0
- package/dist/node_modules/@workspace/agent-core/tools/galaxy-ui-integration.d.ts.map +1 -0
- package/dist/node_modules/@workspace/agent-core/tools/galaxy-ui-integration.js +245 -0
- package/dist/node_modules/@workspace/agent-core/tools/galaxy-ui-integration.js.map +1 -0
- package/dist/node_modules/@workspace/agent-core/tools/git-operations.d.ts +12 -0
- package/dist/node_modules/@workspace/agent-core/tools/git-operations.d.ts.map +1 -0
- package/dist/node_modules/@workspace/agent-core/tools/git-operations.js +115 -0
- package/dist/node_modules/@workspace/agent-core/tools/git-operations.js.map +1 -0
- package/dist/node_modules/@workspace/agent-core/tools/index.d.ts +11 -0
- package/dist/node_modules/@workspace/agent-core/tools/index.d.ts.map +1 -0
- package/dist/node_modules/@workspace/agent-core/tools/index.js +11 -0
- package/dist/node_modules/@workspace/agent-core/tools/index.js.map +1 -0
- package/dist/node_modules/@workspace/agent-core/tools/planning-agent.d.ts +30 -0
- package/dist/node_modules/@workspace/agent-core/tools/planning-agent.d.ts.map +1 -0
- package/dist/node_modules/@workspace/agent-core/tools/planning-agent.js +125 -0
- package/dist/node_modules/@workspace/agent-core/tools/planning-agent.js.map +1 -0
- package/dist/node_modules/@workspace/agent-core/tools/progress-reporter.d.ts +20 -0
- package/dist/node_modules/@workspace/agent-core/tools/progress-reporter.d.ts.map +1 -0
- package/dist/node_modules/@workspace/agent-core/tools/progress-reporter.js +46 -0
- package/dist/node_modules/@workspace/agent-core/tools/progress-reporter.js.map +1 -0
- package/dist/node_modules/@workspace/agent-core/tools/registry.d.ts +22 -0
- package/dist/node_modules/@workspace/agent-core/tools/registry.d.ts.map +1 -0
- package/dist/node_modules/@workspace/agent-core/tools/registry.js +651 -0
- package/dist/node_modules/@workspace/agent-core/tools/registry.js.map +1 -0
- package/dist/node_modules/@workspace/agent-core/tools/tool-event-emitter.d.ts +25 -0
- package/dist/node_modules/@workspace/agent-core/tools/tool-event-emitter.d.ts.map +1 -0
- package/dist/node_modules/@workspace/agent-core/tools/tool-event-emitter.js +26 -0
- package/dist/node_modules/@workspace/agent-core/tools/tool-event-emitter.js.map +1 -0
- package/dist/node_modules/@workspace/agent-core/tools/types.d.ts +32 -0
- package/dist/node_modules/@workspace/agent-core/tools/types.d.ts.map +1 -0
- package/dist/node_modules/@workspace/agent-core/tools/types.js +2 -0
- package/dist/node_modules/@workspace/agent-core/tools/types.js.map +1 -0
- package/dist/node_modules/@workspace/agent-core/types.d.ts +40 -0
- package/dist/node_modules/@workspace/agent-core/types.d.ts.map +1 -0
- package/dist/node_modules/@workspace/agent-core/types.js +9 -0
- package/dist/node_modules/@workspace/agent-core/types.js.map +1 -0
- package/dist/node_modules/@workspace/agent-core/utils/config-manager.d.ts +103 -0
- package/dist/node_modules/@workspace/agent-core/utils/config-manager.d.ts.map +1 -0
- package/dist/node_modules/@workspace/agent-core/utils/config-manager.js +307 -0
- package/dist/node_modules/@workspace/agent-core/utils/config-manager.js.map +1 -0
- package/dist/node_modules/@workspace/agent-core/utils/devtools.d.ts +22 -0
- package/dist/node_modules/@workspace/agent-core/utils/devtools.d.ts.map +1 -0
- package/dist/node_modules/@workspace/agent-core/utils/devtools.js +62 -0
- package/dist/node_modules/@workspace/agent-core/utils/devtools.js.map +1 -0
- package/dist/node_modules/@workspace/agent-core/utils/message-formatters.d.ts +33 -0
- package/dist/node_modules/@workspace/agent-core/utils/message-formatters.d.ts.map +1 -0
- package/dist/node_modules/@workspace/agent-core/utils/message-formatters.js +591 -0
- package/dist/node_modules/@workspace/agent-core/utils/message-formatters.js.map +1 -0
- package/dist/node_modules/@workspace/agent-core/utils/progress-tracker.d.ts +60 -0
- package/dist/node_modules/@workspace/agent-core/utils/progress-tracker.d.ts.map +1 -0
- package/dist/node_modules/@workspace/agent-core/utils/progress-tracker.js +204 -0
- package/dist/node_modules/@workspace/agent-core/utils/progress-tracker.js.map +1 -0
- package/package.json +3 -2
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import fs from 'fs/promises';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { exec } from 'child_process';
|
|
4
|
+
import { promisify } from 'util';
|
|
5
|
+
const execAsync = promisify(exec);
|
|
6
|
+
export class FileOperations {
|
|
7
|
+
async readFile(filePath) {
|
|
8
|
+
try {
|
|
9
|
+
return await fs.readFile(filePath, 'utf-8');
|
|
10
|
+
}
|
|
11
|
+
catch (error) {
|
|
12
|
+
throw new Error(`Failed to read file ${filePath}: ${error.message}`);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
async writeFile(filePath, content) {
|
|
16
|
+
try {
|
|
17
|
+
// Check if file exists and read old content
|
|
18
|
+
let isNewFile = false;
|
|
19
|
+
let oldContent;
|
|
20
|
+
try {
|
|
21
|
+
oldContent = await fs.readFile(filePath, 'utf-8');
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
isNewFile = true;
|
|
25
|
+
}
|
|
26
|
+
// Create directory if needed
|
|
27
|
+
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
|
28
|
+
// Write new content
|
|
29
|
+
await fs.writeFile(filePath, content, 'utf-8');
|
|
30
|
+
// Calculate diff stats
|
|
31
|
+
const newLines = content.split('\n');
|
|
32
|
+
const oldLines = oldContent ? oldContent.split('\n') : [];
|
|
33
|
+
let linesAdded = 0;
|
|
34
|
+
let linesRemoved = 0;
|
|
35
|
+
if (isNewFile) {
|
|
36
|
+
linesAdded = newLines.length;
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
// Simple line-based diff calculation
|
|
40
|
+
// Count removed lines (in old but not in new)
|
|
41
|
+
linesRemoved = oldLines.length;
|
|
42
|
+
linesAdded = newLines.length;
|
|
43
|
+
// Better approach: use set intersection
|
|
44
|
+
const oldSet = new Set(oldLines);
|
|
45
|
+
const newSet = new Set(newLines);
|
|
46
|
+
// Lines only in old = removed
|
|
47
|
+
const onlyInOld = oldLines.filter(line => !newSet.has(line));
|
|
48
|
+
// Lines only in new = added
|
|
49
|
+
const onlyInNew = newLines.filter(line => !oldSet.has(line));
|
|
50
|
+
linesRemoved = onlyInOld.length;
|
|
51
|
+
linesAdded = onlyInNew.length;
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
isNewFile,
|
|
55
|
+
oldContent,
|
|
56
|
+
newContent: content,
|
|
57
|
+
linesAdded,
|
|
58
|
+
linesRemoved,
|
|
59
|
+
path: filePath,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
throw new Error(`Failed to write file ${filePath}: ${error.message}`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
async listFiles(dirPath, recursive = false) {
|
|
67
|
+
try {
|
|
68
|
+
if (recursive) {
|
|
69
|
+
const { stdout } = await execAsync(`find "${dirPath}" -type f -not -path "*/node_modules/*" -not -path "*/.git/*" -not -path "*/dist/*" -not -path "*/build/*" | head -500`, { timeout: 10000 });
|
|
70
|
+
return stdout.trim().split('\n').filter(Boolean);
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
const entries = await fs.readdir(dirPath, { withFileTypes: true });
|
|
74
|
+
return entries
|
|
75
|
+
.filter(entry => entry.isFile())
|
|
76
|
+
.map(entry => path.join(dirPath, entry.name));
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
throw new Error(`Failed to list files in ${dirPath}: ${error.message}`);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
async searchFiles(dirPath, pattern) {
|
|
84
|
+
try {
|
|
85
|
+
const { stdout } = await execAsync(`grep -r "${pattern}" "${dirPath}" --include="*.ts" --include="*.js" --include="*.tsx" --include="*.jsx" --include="*.json" --exclude-dir="node_modules" --exclude-dir=".git" --exclude-dir="dist" -l | head -100`, { timeout: 10000 });
|
|
86
|
+
return stdout.trim().split('\n').filter(Boolean);
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
return [];
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
async getFileDiff(filePath) {
|
|
93
|
+
try {
|
|
94
|
+
const { stdout } = await execAsync(`git diff "${filePath}"`, {
|
|
95
|
+
timeout: 5000,
|
|
96
|
+
});
|
|
97
|
+
return stdout || 'No changes';
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
return `Not a git repository or file doesn't exist: ${error.message}`;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
async applyPatch(filePath, patch) {
|
|
104
|
+
try {
|
|
105
|
+
const tempPatchFile = path.join('/tmp', `patch-${Date.now()}.patch`);
|
|
106
|
+
await fs.writeFile(tempPatchFile, patch);
|
|
107
|
+
await execAsync(`patch "${filePath}" < "${tempPatchFile}"`, {
|
|
108
|
+
timeout: 5000,
|
|
109
|
+
});
|
|
110
|
+
await fs.unlink(tempPatchFile);
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
throw new Error(`Failed to apply patch: ${error.message}`);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
async getFileTree(dirPath) {
|
|
117
|
+
try {
|
|
118
|
+
const { stdout } = await execAsync(`tree -L 3 -I "node_modules|.git|dist|build|.venv|venv|ios|android|.expo" -a --charset ascii "${dirPath}" 2>/dev/null || find "${dirPath}" -maxdepth 3 -not -path "*/node_modules/*" -not -path "*/.git/*" | head -500`, { timeout: 20000 });
|
|
119
|
+
return stdout;
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
return `Failed to generate file tree: ${error.message}`;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=file-operations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-operations.js","sourceRoot":"","sources":["../../src/tools/file-operations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAC,IAAI,EAAC,MAAM,eAAe,CAAC;AACnC,OAAO,EAAC,SAAS,EAAC,MAAM,MAAM,CAAC;AAE/B,MAAM,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;AAWlC,MAAM,OAAO,cAAc;IAC1B,KAAK,CAAC,QAAQ,CAAC,QAAgB;QAC9B,IAAI,CAAC;YACJ,OAAO,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC7C,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CAAC,uBAAuB,QAAQ,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QACtE,CAAC;IACF,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,QAAgB,EAAE,OAAe;QAChD,IAAI,CAAC;YACJ,4CAA4C;YAC5C,IAAI,SAAS,GAAG,KAAK,CAAC;YACtB,IAAI,UAA8B,CAAC;YAEnC,IAAI,CAAC;gBACJ,UAAU,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,OA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CAAC;IAED,KAAK,CAAC,WAAW,CAAC,OAAe;QAChC,IAAI,CAAC;YACJ,MAAM,EAAC,MAAM,EAAC,GAAG,MAAM,SAAS,CAC/B,gGAAgG,OAAO,0BAA0B,OAAO,+EAA+E,EACvN,EAAC,OAAO,EAAE,KAAK,EAAC,CAChB,CAAC;YACF,OAAO,MAAM,CAAC;QACf,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACrB,OAAO,iCAAiC,KAAK,CAAC,OAAO,EAAE,CAAC;QACzD,CAAC;IACF,CAAC;CACD"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool 1: List all components
|
|
3
|
+
* Fetches from GitHub registry.json
|
|
4
|
+
*/
|
|
5
|
+
export declare function galaxyUIListComponents(params?: {
|
|
6
|
+
category?: 'form' | 'layout' | 'navigation' | 'interactive' | 'overlay' | 'data-display' | 'utility' | 'all';
|
|
7
|
+
}): Promise<{
|
|
8
|
+
total: number;
|
|
9
|
+
components: Array<{
|
|
10
|
+
name: string;
|
|
11
|
+
description: string;
|
|
12
|
+
category: string;
|
|
13
|
+
docsUrl: string;
|
|
14
|
+
}>;
|
|
15
|
+
}>;
|
|
16
|
+
/**
|
|
17
|
+
* Tool 2: Search components by keyword
|
|
18
|
+
* Searches in component name and description
|
|
19
|
+
*/
|
|
20
|
+
export declare function galaxyUISearchComponents(params: {
|
|
21
|
+
query: string;
|
|
22
|
+
}): Promise<{
|
|
23
|
+
total: number;
|
|
24
|
+
components: Array<{
|
|
25
|
+
name: string;
|
|
26
|
+
description: string;
|
|
27
|
+
category: string;
|
|
28
|
+
docsUrl: string;
|
|
29
|
+
relevance: 'high' | 'medium' | 'low';
|
|
30
|
+
}>;
|
|
31
|
+
}>;
|
|
32
|
+
/**
|
|
33
|
+
* Tool 3: Get component details
|
|
34
|
+
* Returns component info from registry + docs URL
|
|
35
|
+
*/
|
|
36
|
+
export declare function galaxyUIGetComponent(params: {
|
|
37
|
+
name: string;
|
|
38
|
+
framework?: 'vue' | 'react' | 'angular';
|
|
39
|
+
}): Promise<{
|
|
40
|
+
name: string;
|
|
41
|
+
description: string;
|
|
42
|
+
category: string;
|
|
43
|
+
dependencies: string[];
|
|
44
|
+
peerDependencies: string[];
|
|
45
|
+
docsUrl: string;
|
|
46
|
+
docsUrlFramework?: string;
|
|
47
|
+
installCommand: string;
|
|
48
|
+
}>;
|
|
49
|
+
/**
|
|
50
|
+
* Tool 4: Get component categories with counts
|
|
51
|
+
* Groups components by category from registry
|
|
52
|
+
*/
|
|
53
|
+
export declare function galaxyUIGetCategories(): Promise<{
|
|
54
|
+
categories: Array<{
|
|
55
|
+
name: string;
|
|
56
|
+
count: number;
|
|
57
|
+
components: string[];
|
|
58
|
+
}>;
|
|
59
|
+
}>;
|
|
60
|
+
/**
|
|
61
|
+
* Tool 5: Add components to project
|
|
62
|
+
* Executes: npx galaxy-design add [components...] --cwd [path]
|
|
63
|
+
*/
|
|
64
|
+
export declare function galaxyUIAddComponents(params: {
|
|
65
|
+
components: string[];
|
|
66
|
+
cwd?: string;
|
|
67
|
+
}): Promise<{
|
|
68
|
+
success: boolean;
|
|
69
|
+
message: string;
|
|
70
|
+
output: string;
|
|
71
|
+
}>;
|
|
72
|
+
/**
|
|
73
|
+
* Tool 6: Initialize Galaxy UI in project
|
|
74
|
+
* Executes: npx galaxy-design@latest init --yes --cwd [path]
|
|
75
|
+
*/
|
|
76
|
+
export declare function galaxyUIInit(params?: {
|
|
77
|
+
cwd?: string;
|
|
78
|
+
skipPrompts?: boolean;
|
|
79
|
+
}): Promise<{
|
|
80
|
+
success: boolean;
|
|
81
|
+
message: string;
|
|
82
|
+
output: string;
|
|
83
|
+
}>;
|
|
84
|
+
/**
|
|
85
|
+
* Tool 7: Get documentation URL
|
|
86
|
+
* Returns direct link to component docs or main docs
|
|
87
|
+
*/
|
|
88
|
+
export declare function galaxyUIGetDocsUrl(params?: {
|
|
89
|
+
component?: string;
|
|
90
|
+
language?: 'en' | 'vi';
|
|
91
|
+
}): {
|
|
92
|
+
url: string;
|
|
93
|
+
description: string;
|
|
94
|
+
};
|
|
95
|
+
//# sourceMappingURL=galaxy-ui-integration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"galaxy-ui-integration.d.ts","sourceRoot":"","sources":["../../src/tools/galaxy-ui-integration.ts"],"names":[],"mappings":"AAkFA;;;GAGG;AACH,wBAAsB,sBAAsB,CAAC,MAAM,CAAC,EAAE;IACpD,QAAQ,CAAC,EACL,MAAM,GACN,QAAQ,GACR,YAAY,GACZ,aAAa,GACb,SAAS,GACT,cAAc,GACd,SAAS,GACT,KAAK,CAAA;CACV,GAAG,OAAO,CAAC;IACV,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,KAAK,CAAC;QAChB,IAAI,EAAE,MAAM,CAAA;QACZ,WAAW,EAAE,MAAM,CAAA;QACnB,QAAQ,EAAE,MAAM,CAAA;QAChB,OAAO,EAAE,MAAM,CAAA;KAChB,CAAC,CAAA;CACH,CAAC,CAmBD;AAED;;;GAGG;AACH,wBAAsB,wBAAwB,CAAC,MAAM,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC;IACjF,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,KAAK,CAAC;QAChB,IAAI,EAAE,MAAM,CAAA;QACZ,WAAW,EAAE,MAAM,CAAA;QACnB,QAAQ,EAAE,MAAM,CAAA;QAChB,OAAO,EAAE,MAAM,CAAA;QACf,SAAS,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAA;KACrC,CAAC,CAAA;CACH,CAAC,CAsCD;AAED;;;GAGG;AACH,wBAAsB,oBAAoB,CAAC,MAAM,EAAE;IACjD,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,SAAS,CAAA;CACxC,GAAG,OAAO,CAAC;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,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|
|
|
1
|
+
import { execa } from 'execa';
|
|
2
|
+
/**
|
|
3
|
+
* Galaxy UI CLI Integration
|
|
4
|
+
* Provides tools to discover, search, and install Galaxy UI components
|
|
5
|
+
*
|
|
6
|
+
* Data Sources:
|
|
7
|
+
* - Component Registry: npm CDN (https://unpkg.com/galaxy-design@latest/dist/registry.json)
|
|
8
|
+
* Alternative CDN: https://cdn.jsdelivr.net/npm/galaxy-design@latest/dist/registry.json
|
|
9
|
+
* - Documentation: https://galaxy-design.vercel.app
|
|
10
|
+
* - CLI Execution: npx galaxy-design@latest
|
|
11
|
+
*/
|
|
12
|
+
const GITHUB_REGISTRY_URL = 'https://unpkg.com/galaxy-design@latest/dist/registry.json';
|
|
13
|
+
const DOCS_BASE_URL = 'https://galaxy-design.vercel.app';
|
|
14
|
+
// Cache for registry data (5 minutes)
|
|
15
|
+
let registryCache = {
|
|
16
|
+
data: null,
|
|
17
|
+
timestamp: 0,
|
|
18
|
+
};
|
|
19
|
+
const CACHE_TTL = 5 * 60 * 1000; // 5 minutes
|
|
20
|
+
/**
|
|
21
|
+
* Fetch component registry from GitHub (supports private repos with GITHUB_TOKEN)
|
|
22
|
+
*/
|
|
23
|
+
async function fetchRegistry() {
|
|
24
|
+
const now = Date.now();
|
|
25
|
+
// Return cached data if still valid
|
|
26
|
+
if (registryCache.data && now - registryCache.timestamp < CACHE_TTL) {
|
|
27
|
+
return registryCache.data;
|
|
28
|
+
}
|
|
29
|
+
try {
|
|
30
|
+
// Prepare headers with authentication if GITHUB_TOKEN is available
|
|
31
|
+
const headers = {
|
|
32
|
+
'Accept': 'application/vnd.github.v3.raw',
|
|
33
|
+
};
|
|
34
|
+
const githubToken = process.env.GITHUB_TOKEN;
|
|
35
|
+
if (githubToken) {
|
|
36
|
+
headers['Authorization'] = `Bearer ${githubToken}`;
|
|
37
|
+
}
|
|
38
|
+
const response = await fetch(GITHUB_REGISTRY_URL, { headers });
|
|
39
|
+
if (!response.ok) {
|
|
40
|
+
throw new Error(`Failed to fetch registry: ${response.statusText}`);
|
|
41
|
+
}
|
|
42
|
+
const data = (await response.json());
|
|
43
|
+
// Update cache
|
|
44
|
+
registryCache = {
|
|
45
|
+
data,
|
|
46
|
+
timestamp: now,
|
|
47
|
+
};
|
|
48
|
+
return data;
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
throw new Error(`Failed to fetch Galaxy UI registry: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Tool 1: List all components
|
|
56
|
+
* Fetches from GitHub registry.json
|
|
57
|
+
*/
|
|
58
|
+
export async function galaxyUIListComponents(params) {
|
|
59
|
+
const registry = await fetchRegistry();
|
|
60
|
+
const components = Object.entries(registry.components).map(([name, config]) => ({
|
|
61
|
+
name,
|
|
62
|
+
description: config.description,
|
|
63
|
+
category: config.type,
|
|
64
|
+
docsUrl: `${DOCS_BASE_URL}/components/${name}`,
|
|
65
|
+
}));
|
|
66
|
+
// Filter by category if specified
|
|
67
|
+
const filtered = params?.category && params.category !== 'all'
|
|
68
|
+
? components.filter(c => c.category === params.category)
|
|
69
|
+
: components;
|
|
70
|
+
return {
|
|
71
|
+
total: filtered.length,
|
|
72
|
+
components: filtered,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Tool 2: Search components by keyword
|
|
77
|
+
* Searches in component name and description
|
|
78
|
+
*/
|
|
79
|
+
export async function galaxyUISearchComponents(params) {
|
|
80
|
+
const registry = await fetchRegistry();
|
|
81
|
+
const query = params.query.toLowerCase();
|
|
82
|
+
const results = Object.entries(registry.components)
|
|
83
|
+
.map(([name, config]) => {
|
|
84
|
+
const nameMatch = name.toLowerCase().includes(query);
|
|
85
|
+
const descMatch = config.description.toLowerCase().includes(query);
|
|
86
|
+
const categoryMatch = config.type.toLowerCase().includes(query);
|
|
87
|
+
// Calculate relevance
|
|
88
|
+
let relevance = 'low';
|
|
89
|
+
if (nameMatch)
|
|
90
|
+
relevance = 'high';
|
|
91
|
+
else if (categoryMatch)
|
|
92
|
+
relevance = 'medium';
|
|
93
|
+
else if (descMatch)
|
|
94
|
+
relevance = 'low';
|
|
95
|
+
const isMatch = nameMatch || descMatch || categoryMatch;
|
|
96
|
+
return {
|
|
97
|
+
name,
|
|
98
|
+
description: config.description,
|
|
99
|
+
category: config.type,
|
|
100
|
+
docsUrl: `${DOCS_BASE_URL}/components/${name}`,
|
|
101
|
+
relevance,
|
|
102
|
+
isMatch,
|
|
103
|
+
};
|
|
104
|
+
})
|
|
105
|
+
.filter(result => result.isMatch)
|
|
106
|
+
.sort((a, b) => {
|
|
107
|
+
// Sort by relevance: high > medium > low
|
|
108
|
+
const relevanceOrder = { high: 0, medium: 1, low: 2 };
|
|
109
|
+
return relevanceOrder[a.relevance] - relevanceOrder[b.relevance];
|
|
110
|
+
});
|
|
111
|
+
return {
|
|
112
|
+
total: results.length,
|
|
113
|
+
components: results,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Tool 3: Get component details
|
|
118
|
+
* Returns component info from registry + docs URL
|
|
119
|
+
*/
|
|
120
|
+
export async function galaxyUIGetComponent(params) {
|
|
121
|
+
const registry = await fetchRegistry();
|
|
122
|
+
const component = registry.components[params.name];
|
|
123
|
+
if (!component) {
|
|
124
|
+
throw new Error(`Component "${params.name}" not found. Use galaxy_ui_list_components or galaxy_ui_search_components to find available components.`);
|
|
125
|
+
}
|
|
126
|
+
const docsUrl = `${DOCS_BASE_URL}/components/${params.name}`;
|
|
127
|
+
const docsUrlFramework = params.framework ? `${docsUrl}?framework=${params.framework}` : undefined;
|
|
128
|
+
return {
|
|
129
|
+
name: params.name,
|
|
130
|
+
description: component.description,
|
|
131
|
+
category: component.type,
|
|
132
|
+
dependencies: component.dependencies || [],
|
|
133
|
+
peerDependencies: component.peerDependencies || [],
|
|
134
|
+
docsUrl,
|
|
135
|
+
docsUrlFramework,
|
|
136
|
+
installCommand: `npx galaxy-design add ${params.name}`,
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Tool 4: Get component categories with counts
|
|
141
|
+
* Groups components by category from registry
|
|
142
|
+
*/
|
|
143
|
+
export async function galaxyUIGetCategories() {
|
|
144
|
+
const registry = await fetchRegistry();
|
|
145
|
+
// Group components by category
|
|
146
|
+
const categoryMap = new Map();
|
|
147
|
+
for (const [name, config] of Object.entries(registry.components)) {
|
|
148
|
+
const category = config.type;
|
|
149
|
+
if (!categoryMap.has(category)) {
|
|
150
|
+
categoryMap.set(category, []);
|
|
151
|
+
}
|
|
152
|
+
categoryMap.get(category).push(name);
|
|
153
|
+
}
|
|
154
|
+
const categories = Array.from(categoryMap.entries())
|
|
155
|
+
.map(([name, components]) => ({
|
|
156
|
+
name,
|
|
157
|
+
count: components.length,
|
|
158
|
+
components: components.sort(),
|
|
159
|
+
}))
|
|
160
|
+
.sort((a, b) => b.count - a.count); // Sort by count descending
|
|
161
|
+
return { categories };
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Tool 5: Add components to project
|
|
165
|
+
* Executes: npx galaxy-design add [components...] --cwd [path]
|
|
166
|
+
*/
|
|
167
|
+
export async function galaxyUIAddComponents(params) {
|
|
168
|
+
try {
|
|
169
|
+
const args = ['galaxy-design', 'add', ...params.components];
|
|
170
|
+
if (params.cwd) {
|
|
171
|
+
args.push('--cwd', params.cwd);
|
|
172
|
+
}
|
|
173
|
+
const result = await execa('npx', args, {
|
|
174
|
+
cwd: params.cwd || process.cwd(),
|
|
175
|
+
stderr: 'pipe',
|
|
176
|
+
stdout: 'pipe',
|
|
177
|
+
});
|
|
178
|
+
return {
|
|
179
|
+
success: true,
|
|
180
|
+
message: `Successfully added components: ${params.components.join(', ')}`,
|
|
181
|
+
output: result.stdout,
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
catch (error) {
|
|
185
|
+
const execError = error;
|
|
186
|
+
return {
|
|
187
|
+
success: false,
|
|
188
|
+
message: `Failed to add components: ${params.components.join(', ')}`,
|
|
189
|
+
output: execError.stderr || execError.stdout || 'Unknown error',
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Tool 6: Initialize Galaxy UI in project
|
|
195
|
+
* Executes: npx galaxy-design@latest init --yes --cwd [path]
|
|
196
|
+
*/
|
|
197
|
+
export async function galaxyUIInit(params) {
|
|
198
|
+
try {
|
|
199
|
+
const args = ['galaxy-design@latest', 'init'];
|
|
200
|
+
if (params?.skipPrompts) {
|
|
201
|
+
args.push('--yes');
|
|
202
|
+
}
|
|
203
|
+
if (params?.cwd) {
|
|
204
|
+
args.push('--cwd', params.cwd);
|
|
205
|
+
}
|
|
206
|
+
const result = await execa('npx', args, {
|
|
207
|
+
cwd: params?.cwd || process.cwd(),
|
|
208
|
+
stderr: 'pipe',
|
|
209
|
+
stdout: 'pipe',
|
|
210
|
+
});
|
|
211
|
+
return {
|
|
212
|
+
success: true,
|
|
213
|
+
message: 'Successfully initialized Galaxy UI',
|
|
214
|
+
output: result.stdout,
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
catch (error) {
|
|
218
|
+
const execError = error;
|
|
219
|
+
return {
|
|
220
|
+
success: false,
|
|
221
|
+
message: 'Failed to initialize Galaxy UI',
|
|
222
|
+
output: execError.stderr || execError.stdout || 'Unknown error',
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Tool 7: Get documentation URL
|
|
228
|
+
* Returns direct link to component docs or main docs
|
|
229
|
+
*/
|
|
230
|
+
export function galaxyUIGetDocsUrl(params) {
|
|
231
|
+
if (params?.component) {
|
|
232
|
+
const lang = params.language === 'vi' ? '/vi' : '';
|
|
233
|
+
const url = `${DOCS_BASE_URL}${lang}/components/${params.component}`;
|
|
234
|
+
return {
|
|
235
|
+
url,
|
|
236
|
+
description: `Documentation for ${params.component} component`,
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
const lang = params?.language === 'vi' ? '/vi' : '';
|
|
240
|
+
return {
|
|
241
|
+
url: `${DOCS_BASE_URL}${lang}`,
|
|
242
|
+
description: 'Galaxy UI CLI Documentation',
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
//# sourceMappingURL=galaxy-ui-integration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"galaxy-ui-integration.js","sourceRoot":"","sources":["../../src/tools/galaxy-ui-integration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAE7B;;;;;;;;;GASG;AAEH,MAAM,mBAAmB,GACvB,2DAA2D,CAAA;AAC7D,MAAM,aAAa,GAAG,kCAAkC,CAAA;AAiBxD,sCAAsC;AACtC,IAAI,aAAa,GAAqD;IACpE,IAAI,EAAE,IAAI;IACV,SAAS,EAAE,CAAC;CACb,CAAA;AACD,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAA,CAAC,YAAY;AAE5C;;GAEG;AACH,KAAK,UAAU,aAAa;IAC1B,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;IAEtB,oCAAoC;IACpC,IAAI,aAAa,CAAC,IAAI,IAAI,GAAG,GAAG,aAAa,CAAC,SAAS,GAAG,SAAS,EAAE,CAAC;QACpE,OAAO,aAAa,CAAC,IAAI,CAAA;IAC3B,CAAC;IAED,IAAI,CAAC;QACH,mEAAmE;QACnE,MAAM,OAAO,GAAgB;YAC3B,QAAQ,EAAE,+BAA+B;SAC1C,CAAA;QAED,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAA;QAC5C,IAAI,WAAW,EAAE,CAAC;YAChB,OAAO,CAAC,eAAe,CAAC,GAAG,UAAU,WAAW,EAAE,CAAA;QACpD,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,mBAAmB,EA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EAAE,MAAM;SACf,CAAC,CAAA;QAEF,OAAO;YACL,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,oCAAoC;YAC7C,MAAM,EAAE,MAAM,CAAC,MAAM;SACtB,CAAA;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,SAAS,GAAG,KAA6C,CAAA;QAC/D,OAAO;YACL,OAAO,EAAE,KAAK;YACd,OAAO,EAAE,gCAAgC;YACzC,MAAM,EAAE,SAAS,CAAC,MAAM,IAAI,SAAS,CAAC,MAAM,IAAI,eAAe;SAChE,CAAA;IACH,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAuD;IAIxF,IAAI,MAAM,EAAE,SAAS,EAAE,CAAC;QACtB,MAAM,IAAI,GAAG,MAAM,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAA;QAClD,MAAM,GAAG,GAAG,GAAG,aAAa,GAAG,IAAI,eAAe,MAAM,CAAC,SAAS,EAAE,CAAA;QACpE,OAAO;YACL,GAAG;YACH,WAAW,EAAE,qBAAqB,MAAM,CAAC,SAAS,YAAY;SAC/D,CAAA;IACH,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,EAAE,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAA;IACnD,OAAO;QACL,GAAG,EAAE,GAAG,aAAa,GAAG,IAAI,EAAE;QAC9B,WAAW,EAAE,6BAA6B;KAC3C,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare class GitOperations {
|
|
2
|
+
getStatus(cwd: string): Promise<string>;
|
|
3
|
+
commit(cwd: string, message: string): Promise<string>;
|
|
4
|
+
push(cwd: string, remote?: string, branch?: string): Promise<string>;
|
|
5
|
+
pull(cwd: string, remote?: string, branch?: string): Promise<string>;
|
|
6
|
+
getDiff(cwd: string, file?: string): Promise<string>;
|
|
7
|
+
getLog(cwd: string, limit?: number): Promise<string>;
|
|
8
|
+
listBranches(cwd: string): Promise<string>;
|
|
9
|
+
createBranch(cwd: string, branchName: string): Promise<string>;
|
|
10
|
+
switchBranch(cwd: string, branchName: string): Promise<string>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=git-operations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-operations.d.ts","sourceRoot":"","sources":["../../src/tools/git-operations.ts"],"names":[],"mappings":"AAKA,qBAAa,aAAa;IACnB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAYvC,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAgBrD,IAAI,CACT,GAAG,EAAE,MAAM,EACX,MAAM,GAAE,MAAiB,EACzB,MAAM,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,MAAM,CAAC;IAaZ,IAAI,CACT,GAAG,EAAE,MAAM,EACX,MAAM,GAAE,MAAiB,EACzB,MAAM,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,MAAM,CAAC;IAaZ,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAapD,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,GAAE,MAAW,GAAG,OAAO,CAAC,MAAM,CAAC;IAYxD,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAS1C,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAY9D,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAWpE"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { exec } from 'child_process';
|
|
2
|
+
import { promisify } from 'util';
|
|
3
|
+
const execAsync = promisify(exec);
|
|
4
|
+
export class GitOperations {
|
|
5
|
+
async getStatus(cwd) {
|
|
6
|
+
try {
|
|
7
|
+
const { stdout } = await execAsync('git status --short', {
|
|
8
|
+
cwd,
|
|
9
|
+
timeout: 5000,
|
|
10
|
+
});
|
|
11
|
+
return stdout || 'Working tree clean';
|
|
12
|
+
}
|
|
13
|
+
catch (error) {
|
|
14
|
+
return `Not a git repository: ${error.message}`;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
async commit(cwd, message) {
|
|
18
|
+
try {
|
|
19
|
+
await execAsync('git add .', { cwd, timeout: 5000 });
|
|
20
|
+
const { stdout } = await execAsync(`git commit -m "${message.replace(/"/g, '\\"')}"`, {
|
|
21
|
+
cwd,
|
|
22
|
+
timeout: 10000,
|
|
23
|
+
});
|
|
24
|
+
return stdout;
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
return `Commit failed: ${error.message}`;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
async push(cwd, remote = 'origin', branch) {
|
|
31
|
+
try {
|
|
32
|
+
const branchArg = branch ? ` ${branch}` : '';
|
|
33
|
+
const { stdout } = await execAsync(`git push ${remote}${branchArg}`, {
|
|
34
|
+
cwd,
|
|
35
|
+
timeout: 30000,
|
|
36
|
+
});
|
|
37
|
+
return stdout;
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
return `Push failed: ${error.message}`;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
async pull(cwd, remote = 'origin', branch) {
|
|
44
|
+
try {
|
|
45
|
+
const branchArg = branch ? ` ${branch}` : '';
|
|
46
|
+
const { stdout } = await execAsync(`git pull ${remote}${branchArg}`, {
|
|
47
|
+
cwd,
|
|
48
|
+
timeout: 30000,
|
|
49
|
+
});
|
|
50
|
+
return stdout;
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
return `Pull failed: ${error.message}`;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
async getDiff(cwd, file) {
|
|
57
|
+
try {
|
|
58
|
+
const fileArg = file ? ` "${file}"` : '';
|
|
59
|
+
const { stdout } = await execAsync(`git diff${fileArg}`, {
|
|
60
|
+
cwd,
|
|
61
|
+
timeout: 10000,
|
|
62
|
+
});
|
|
63
|
+
return stdout || 'No changes';
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
return `Diff failed: ${error.message}`;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
async getLog(cwd, limit = 10) {
|
|
70
|
+
try {
|
|
71
|
+
const { stdout } = await execAsync(`git log --oneline -${limit}`, {
|
|
72
|
+
cwd,
|
|
73
|
+
timeout: 5000,
|
|
74
|
+
});
|
|
75
|
+
return stdout;
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
return `Log failed: ${error.message}`;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
async listBranches(cwd) {
|
|
82
|
+
try {
|
|
83
|
+
const { stdout } = await execAsync('git branch -a', { cwd, timeout: 5000 });
|
|
84
|
+
return stdout;
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
return `Branch list failed: ${error.message}`;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
async createBranch(cwd, branchName) {
|
|
91
|
+
try {
|
|
92
|
+
const { stdout } = await execAsync(`git checkout -b "${branchName}"`, {
|
|
93
|
+
cwd,
|
|
94
|
+
timeout: 5000,
|
|
95
|
+
});
|
|
96
|
+
return stdout;
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
return `Branch creation failed: ${error.message}`;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
async switchBranch(cwd, branchName) {
|
|
103
|
+
try {
|
|
104
|
+
const { stdout } = await execAsync(`git checkout "${branchName}"`, {
|
|
105
|
+
cwd,
|
|
106
|
+
timeout: 5000,
|
|
107
|
+
});
|
|
108
|
+
return stdout;
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
return `Branch switch failed: ${error.message}`;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=git-operations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-operations.js","sourceRoot":"","sources":["../../src/tools/git-operations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,eAAe,CAAC;AACnC,OAAO,EAAC,SAAS,EAAC,MAAM,MAAM,CAAC;AAE/B,MAAM,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;AAElC,MAAM,OAAO,aAAa;IACzB,KAAK,CAAC,SAAS,CAAC,GAAW;QAC1B,IAAI,CAAC;YACJ,MAAM,EAAC,MAAM,EAAC,GAAG,MAAM,SAAS,CAAC,oBAAoB,EAAE;gBACtD,GAAG;gBACH,OAAO,EAAE,IAAI;aACb,CAAC,CAAC;YACH,OAAO,MAAM,IAAI,oBAAoB,CAAC;QACvC,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACrB,OAAO,yBAAyB,KAAK,CAAC,OAAO,EAAE,CAAC;QACjD,CAAC;IACF,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,GAAW,EAAE,OAAe;QACxC,IAAI,CAAC;YACJ,MAAM,SAAS,CAAC,WAAW,EAAE,EAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC,CAAC;YACnD,MAAM,EAAC,MAAM,EAAC,GAAG,MAAM,SAAS,CAC/B,kBAAkB,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,EACjD;gBACC,GAAG;gBACH,OAAO,EAAE,KAAK;aACd,CACD,CAAC;YACF,OAAO,MAAM,CAAC;QACf,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACrB,OAAO,kBAAk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AAkB;QACjD,IAAI,CAAC;YACJ,MAAM,EAAC,MAAM,EAAC,GAAG,MAAM,SAAS,CAAC,iBAAiB,UAAU,GAAG,EAAE;gBAChE,GAAG;gBACH,OAAO,EAAE,IAAI;aACb,CAAC,CAAC;YACH,OAAO,MAAM,CAAC;QACf,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACrB,OAAO,yBAAyB,KAAK,CAAC,OAAO,EAAE,CAAC;QACjD,CAAC;IACF,CAAC;CACD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author Bùi Trọng Hiếu
|
|
3
|
+
* @email kevinbui210191@gmail.com
|
|
4
|
+
* @create 2024-10-08
|
|
5
|
+
* @modify 2024-10-08
|
|
6
|
+
* @desc Barrel exports for tool layer.
|
|
7
|
+
*/
|
|
8
|
+
export * from './types.js';
|
|
9
|
+
export * from './registry.js';
|
|
10
|
+
export * from './tool-event-emitter.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author Bùi Trọng Hiếu
|
|
3
|
+
* @email kevinbui210191@gmail.com
|
|
4
|
+
* @create 2024-10-08
|
|
5
|
+
* @modify 2024-10-08
|
|
6
|
+
* @desc Barrel exports for tool layer.
|
|
7
|
+
*/
|
|
8
|
+
export * from './types.js';
|
|
9
|
+
export * from './registry.js';
|
|
10
|
+
export * from './tool-event-emitter.js';
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,yBAAyB,CAAC"}
|