galaxy-code 0.1.2 → 0.1.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/dist/app.d.ts +1 -1
- package/dist/app.js +5 -5
- package/dist/cli.js +4 -4
- package/dist/connections/claude.d.ts +71 -0
- package/dist/connections/claude.js +303 -0
- package/dist/connections/gemini.d.ts +40 -0
- package/dist/connections/gemini.js +232 -0
- package/dist/connections/index.d.ts +11 -0
- package/dist/connections/index.js +11 -0
- package/dist/connections/ollama.d.ts +37 -0
- package/dist/connections/ollama.js +73 -0
- package/dist/connections/types.d.ts +22 -0
- package/dist/connections/types.js +7 -0
- package/dist/node_modules/@workspace/agent-core/providers/agent-selector.d.ts.map +1 -1
- package/dist/node_modules/@workspace/agent-core/providers/agent-selector.js +18 -18
- package/dist/node_modules/@workspace/agent-core/providers/agent-selector.js.map +1 -1
- package/dist/prompts/ba-it-analyzer.d.ts +1 -0
- package/dist/prompts/ba-it-analyzer.js +143 -0
- package/dist/prompts/index.d.ts +11 -0
- package/dist/prompts/index.js +11 -0
- package/dist/prompts/orchestrator.d.ts +8 -0
- package/dist/prompts/orchestrator.js +88 -0
- package/dist/prompts/planning-agent.d.ts +8 -0
- package/dist/prompts/planning-agent.js +195 -0
- package/dist/prompts/universal-agent.d.ts +7 -0
- package/dist/prompts/universal-agent.js +111 -0
- package/dist/providers/agent-selector.d.ts +29 -0
- package/dist/providers/agent-selector.js +84 -0
- package/dist/providers/claude-agent.d.ts +29 -0
- package/dist/providers/claude-agent.js +121 -0
- package/dist/providers/gemini-agent.d.ts +36 -0
- package/dist/providers/gemini-agent.js +168 -0
- package/dist/providers/index.d.ts +12 -0
- package/dist/providers/index.js +12 -0
- package/dist/providers/ollama-agent.d.ts +53 -0
- package/dist/providers/ollama-agent.js +276 -0
- package/dist/providers/orchestrator.d.ts +16 -0
- package/dist/providers/orchestrator.js +76 -0
- package/dist/tools/ba-it-analyzer.d.ts +66 -0
- package/dist/tools/ba-it-analyzer.js +90 -0
- package/dist/tools/code-generate-agent.d.ts +51 -0
- package/dist/tools/code-generate-agent.js +159 -0
- package/dist/tools/command-runner.d.ts +14 -0
- package/dist/tools/command-runner.js +120 -0
- package/dist/tools/document-parser.d.ts +11 -0
- package/dist/tools/document-parser.js +83 -0
- package/dist/tools/file-operations.d.ts +17 -0
- package/dist/tools/file-operations.js +127 -0
- package/dist/tools/galaxy-ui-integration.d.ts +94 -0
- package/dist/tools/galaxy-ui-integration.js +244 -0
- package/dist/tools/git-operations.d.ts +11 -0
- package/dist/tools/git-operations.js +114 -0
- package/dist/tools/index.d.ts +10 -0
- package/dist/tools/index.js +10 -0
- package/dist/tools/planning-agent.d.ts +29 -0
- package/dist/tools/planning-agent.js +134 -0
- package/dist/tools/progress-reporter.d.ts +19 -0
- package/dist/tools/progress-reporter.js +52 -0
- package/dist/tools/registry.d.ts +21 -0
- package/dist/tools/registry.js +695 -0
- package/dist/tools/tool-event-emitter.d.ts +24 -0
- package/dist/tools/tool-event-emitter.js +25 -0
- package/dist/tools/types.d.ts +31 -0
- package/dist/tools/types.js +1 -0
- package/dist/types.d.ts +1 -1
- package/dist/utils/config-manager.d.ts +102 -0
- package/dist/utils/config-manager.js +326 -0
- package/dist/utils/devtools.d.ts +21 -0
- package/dist/utils/devtools.js +61 -0
- package/dist/utils/message-formatters.d.ts +32 -0
- package/dist/utils/message-formatters.js +590 -0
- package/dist/utils/progress-tracker.d.ts +59 -0
- package/dist/utils/progress-tracker.js +213 -0
- package/package.json +3 -2
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author Bùi Trọng Hiếu
|
|
3
|
+
* @email kevinbui210191@gmail.com
|
|
4
|
+
* @create 2024-10-13
|
|
5
|
+
* @modify 2024-10-13
|
|
6
|
+
* @desc Progress tracker for Galaxy CLI
|
|
7
|
+
*/
|
|
8
|
+
import fs from 'node:fs';
|
|
9
|
+
import path from 'node:path';
|
|
10
|
+
export class ProgressTracker {
|
|
11
|
+
constructor(workingDir = process.cwd()) {
|
|
12
|
+
Object.defineProperty(this, "progressFilePath", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
configurable: true,
|
|
15
|
+
writable: true,
|
|
16
|
+
value: void 0
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(this, "progress", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
configurable: true,
|
|
21
|
+
writable: true,
|
|
22
|
+
value: null
|
|
23
|
+
});
|
|
24
|
+
this.progressFilePath = path.join(workingDir, 'Improgress.md');
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Initialize new progress tracking
|
|
28
|
+
*/
|
|
29
|
+
initializeProgress(projectName, steps) {
|
|
30
|
+
this.progress = {
|
|
31
|
+
projectName,
|
|
32
|
+
startTime: new Date(),
|
|
33
|
+
lastUpdated: new Date(),
|
|
34
|
+
currentStep: 1,
|
|
35
|
+
totalSteps: steps.length,
|
|
36
|
+
steps: steps.map((step, index) => ({
|
|
37
|
+
...step,
|
|
38
|
+
status: index === 0 ? 'in-progress' : 'pending',
|
|
39
|
+
})),
|
|
40
|
+
};
|
|
41
|
+
this.saveProgress();
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Load existing progress
|
|
45
|
+
*/
|
|
46
|
+
loadProgress() {
|
|
47
|
+
try {
|
|
48
|
+
if (!fs.existsSync(this.progressFilePath)) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
const content = fs.readFileSync(this.progressFilePath, 'utf-8');
|
|
52
|
+
// Parse markdown to extract progress data
|
|
53
|
+
// For simplicity, we'll store JSON in a comment at the end
|
|
54
|
+
const jsonMatch = content.match(/<!-- PROGRESS_DATA\n([\s\S]*?)\n-->/);
|
|
55
|
+
if (jsonMatch && jsonMatch[1]) {
|
|
56
|
+
this.progress = JSON.parse(jsonMatch[1]);
|
|
57
|
+
return this.progress;
|
|
58
|
+
}
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
console.warn('⚠️ Failed to load progress:', error instanceof Error ? error.message : String(error));
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Update step status
|
|
68
|
+
*/
|
|
69
|
+
updateStepStatus(stepNum, status, error, filesCreated) {
|
|
70
|
+
if (!this.progress)
|
|
71
|
+
return;
|
|
72
|
+
const stepIndex = this.progress.steps.findIndex(s => s.step === stepNum);
|
|
73
|
+
if (stepIndex === -1)
|
|
74
|
+
return;
|
|
75
|
+
const now = new Date();
|
|
76
|
+
const currentStep = this.progress.steps[stepIndex];
|
|
77
|
+
if (!currentStep)
|
|
78
|
+
return;
|
|
79
|
+
// Update current step
|
|
80
|
+
this.progress.steps[stepIndex] = {
|
|
81
|
+
step: currentStep.step,
|
|
82
|
+
action: currentStep.action,
|
|
83
|
+
status,
|
|
84
|
+
startTime: currentStep.startTime,
|
|
85
|
+
endTime: status === 'completed' || status === 'failed' ? now : undefined,
|
|
86
|
+
error,
|
|
87
|
+
filesCreated,
|
|
88
|
+
};
|
|
89
|
+
// Update progress metadata
|
|
90
|
+
this.progress.lastUpdated = now;
|
|
91
|
+
if (status === 'completed' && stepNum < this.progress.totalSteps) {
|
|
92
|
+
this.progress.currentStep = stepNum + 1;
|
|
93
|
+
// Mark next step as in-progress
|
|
94
|
+
const nextStep = this.progress.steps[stepIndex + 1];
|
|
95
|
+
if (nextStep) {
|
|
96
|
+
nextStep.status = 'in-progress';
|
|
97
|
+
nextStep.startTime = now;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
this.saveProgress();
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Generate markdown content
|
|
104
|
+
*/
|
|
105
|
+
generateMarkdown() {
|
|
106
|
+
if (!this.progress)
|
|
107
|
+
return '';
|
|
108
|
+
const { projectName, startTime, lastUpdated, currentStep, totalSteps, steps } = this.progress;
|
|
109
|
+
let md = `# 🚀 ${projectName} - Implementation Progress\n\n`;
|
|
110
|
+
// Metadata
|
|
111
|
+
md += `**Started**: ${startTime.toLocaleString()}\n`;
|
|
112
|
+
md += `**Last Updated**: ${lastUpdated.toLocaleString()}\n`;
|
|
113
|
+
md += `**Progress**: ${currentStep - 1}/${totalSteps} steps completed\n\n`;
|
|
114
|
+
// Progress bar
|
|
115
|
+
const completed = steps.filter(s => s.status === 'completed').length;
|
|
116
|
+
const percentage = Math.round((completed / totalSteps) * 100);
|
|
117
|
+
const barLength = 30;
|
|
118
|
+
const filled = Math.round((completed / totalSteps) * barLength);
|
|
119
|
+
const bar = '█'.repeat(filled) + '░'.repeat(barLength - filled);
|
|
120
|
+
md += `\`\`\`\n[${bar}] ${percentage}%\n\`\`\`\n\n`;
|
|
121
|
+
// Steps
|
|
122
|
+
md += `## 📋 Implementation Steps\n\n`;
|
|
123
|
+
for (const step of steps) {
|
|
124
|
+
const icon = step.status === 'completed'
|
|
125
|
+
? '✅'
|
|
126
|
+
: step.status === 'in-progress'
|
|
127
|
+
? '🔄'
|
|
128
|
+
: step.status === 'failed'
|
|
129
|
+
? '❌'
|
|
130
|
+
: '⏳';
|
|
131
|
+
md += `### ${icon} Step ${step.step}: ${step.action}\n\n`;
|
|
132
|
+
md += `**Status**: ${step.status.toUpperCase()}\n`;
|
|
133
|
+
if (step.startTime) {
|
|
134
|
+
md += `**Started**: ${step.startTime.toLocaleString()}\n`;
|
|
135
|
+
}
|
|
136
|
+
if (step.endTime) {
|
|
137
|
+
md += `**Completed**: ${step.endTime.toLocaleString()}\n`;
|
|
138
|
+
if (step.startTime) {
|
|
139
|
+
const duration = step.endTime.getTime() - step.startTime.getTime();
|
|
140
|
+
md += `**Duration**: ${Math.round(duration / 1000)}s\n`;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
if (step.filesCreated && step.filesCreated.length > 0) {
|
|
144
|
+
md += `\n**Files Created**:\n`;
|
|
145
|
+
for (const file of step.filesCreated) {
|
|
146
|
+
md += `- \`${file}\`\n`;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
if (step.error) {
|
|
150
|
+
md += `\n**Error**: \`\`\`\n${step.error}\n\`\`\`\n`;
|
|
151
|
+
}
|
|
152
|
+
md += '\n';
|
|
153
|
+
}
|
|
154
|
+
// Summary
|
|
155
|
+
md += `## 📊 Summary\n\n`;
|
|
156
|
+
md += `- Total Steps: ${totalSteps}\n`;
|
|
157
|
+
md += `- Completed: ${steps.filter(s => s.status === 'completed').length}\n`;
|
|
158
|
+
md += `- In Progress: ${steps.filter(s => s.status === 'in-progress').length}\n`;
|
|
159
|
+
md += `- Pending: ${steps.filter(s => s.status === 'pending').length}\n`;
|
|
160
|
+
md += `- Failed: ${steps.filter(s => s.status === 'failed').length}\n\n`;
|
|
161
|
+
// Add JSON data as HTML comment for parsing
|
|
162
|
+
md += `<!-- PROGRESS_DATA\n${JSON.stringify(this.progress, null, 2)}\n-->\n`;
|
|
163
|
+
return md;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Save progress to markdown file
|
|
167
|
+
*/
|
|
168
|
+
saveProgress() {
|
|
169
|
+
if (!this.progress)
|
|
170
|
+
return;
|
|
171
|
+
try {
|
|
172
|
+
const markdown = this.generateMarkdown();
|
|
173
|
+
fs.writeFileSync(this.progressFilePath, markdown, 'utf-8');
|
|
174
|
+
}
|
|
175
|
+
catch (error) {
|
|
176
|
+
console.error('❌ Failed to save progress:', error instanceof Error ? error.message : String(error));
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Get current progress
|
|
181
|
+
*/
|
|
182
|
+
getProgress() {
|
|
183
|
+
return this.progress;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Check if progress file exists
|
|
187
|
+
*/
|
|
188
|
+
hasProgress() {
|
|
189
|
+
return fs.existsSync(this.progressFilePath);
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Clear progress (delete file)
|
|
193
|
+
*/
|
|
194
|
+
clearProgress() {
|
|
195
|
+
try {
|
|
196
|
+
if (fs.existsSync(this.progressFilePath)) {
|
|
197
|
+
fs.unlinkSync(this.progressFilePath);
|
|
198
|
+
}
|
|
199
|
+
this.progress = null;
|
|
200
|
+
}
|
|
201
|
+
catch (error) {
|
|
202
|
+
console.error('❌ Failed to clear progress:', error instanceof Error ? error.message : String(error));
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Get progress file path
|
|
207
|
+
*/
|
|
208
|
+
getProgressFilePath() {
|
|
209
|
+
return this.progressFilePath;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
// Create instance
|
|
213
|
+
export const progressTracker = new ProgressTracker();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "galaxy-code",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Galaxy Code - AI-powered coding assistant with MCP integration",
|
|
6
6
|
"author": "Galaxy Agent <galaxy.ai.dev@gmail.com> (https://github.com/galaxy-agent)",
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
"@anthropic-ai/sdk": "^0.27.0",
|
|
55
55
|
"@google/genai": "^1.21.0",
|
|
56
56
|
"dotenv": "^17.2.3",
|
|
57
|
+
"execa": "^9.6.0",
|
|
57
58
|
"figlet": "^1.9.3",
|
|
58
59
|
"ink": "^4.1.0",
|
|
59
60
|
"ink-spinner": "^5.0.0",
|
|
@@ -101,4 +102,4 @@
|
|
|
101
102
|
}
|
|
102
103
|
},
|
|
103
104
|
"prettier": "@vdemedes/prettier-config"
|
|
104
|
-
}
|
|
105
|
+
}
|