makecc 0.1.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/bin/cli.js +111 -0
- package/dist/assets/index-BcaHeFM8.css +1 -0
- package/dist/assets/index-CryYaA6W.js +57 -0
- package/dist/client/assets/index-BkAJX_uj.js +133 -0
- package/dist/client/assets/index-CRHGYTA2.css +1 -0
- package/dist/client/index.html +14 -0
- package/dist/client/vite.svg +1 -0
- package/dist/index.html +14 -0
- package/dist/server/index.js +207 -0
- package/dist/server/services/claudeService.js +153 -0
- package/dist/server/services/fileService.js +193 -0
- package/dist/server/services/skillExecutionService.js +622 -0
- package/dist/server/services/terminalService.js +216 -0
- package/dist/server/services/workflowAIService.js +191 -0
- package/dist/server/services/workflowExecutionService.js +342 -0
- package/dist/server/types.js +1 -0
- package/dist/vite.svg +1 -0
- package/package.json +84 -0
- package/server/index.ts +253 -0
- package/server/services/claudeService.ts +222 -0
- package/server/services/fileService.ts +277 -0
- package/server/services/skillExecutionService.ts +732 -0
- package/server/services/terminalService.ts +266 -0
- package/server/services/workflowAIService.ts +240 -0
- package/server/services/workflowExecutionService.ts +471 -0
- package/server/types.ts +110 -0
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import * as fs from 'fs/promises';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
import * as os from 'os';
|
|
4
|
+
export class FileService {
|
|
5
|
+
projectRoot;
|
|
6
|
+
constructor(projectRoot) {
|
|
7
|
+
this.projectRoot = projectRoot || process.cwd();
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Resolves a path, expanding ~ to home directory
|
|
11
|
+
*/
|
|
12
|
+
resolvePath(filePath) {
|
|
13
|
+
if (filePath.startsWith('~')) {
|
|
14
|
+
return path.join(os.homedir(), filePath.slice(1));
|
|
15
|
+
}
|
|
16
|
+
if (path.isAbsolute(filePath)) {
|
|
17
|
+
return filePath;
|
|
18
|
+
}
|
|
19
|
+
return path.join(this.projectRoot, filePath);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Ensures a directory exists
|
|
23
|
+
*/
|
|
24
|
+
async ensureDir(dirPath) {
|
|
25
|
+
const resolvedPath = this.resolvePath(dirPath);
|
|
26
|
+
await fs.mkdir(resolvedPath, { recursive: true });
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Writes content to a file, creating directories as needed
|
|
30
|
+
*/
|
|
31
|
+
async writeFile(filePath, content) {
|
|
32
|
+
const resolvedPath = this.resolvePath(filePath);
|
|
33
|
+
const dirPath = path.dirname(resolvedPath);
|
|
34
|
+
await this.ensureDir(dirPath);
|
|
35
|
+
await fs.writeFile(resolvedPath, content, 'utf-8');
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Saves a skill configuration
|
|
39
|
+
*/
|
|
40
|
+
async saveSkill(config) {
|
|
41
|
+
try {
|
|
42
|
+
await this.writeFile(config.path, config.content);
|
|
43
|
+
return { name: config.name, path: config.path, success: true };
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
47
|
+
return { name: config.name, path: config.path, success: false, error: errorMessage };
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Saves a command configuration
|
|
52
|
+
*/
|
|
53
|
+
async saveCommand(config) {
|
|
54
|
+
try {
|
|
55
|
+
await this.writeFile(config.path, config.content);
|
|
56
|
+
return { name: config.name, path: config.path, success: true };
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
60
|
+
return { name: config.name, path: config.path, success: false, error: errorMessage };
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Saves an agent configuration
|
|
65
|
+
*/
|
|
66
|
+
async saveAgent(config) {
|
|
67
|
+
try {
|
|
68
|
+
await this.writeFile(config.path, config.content);
|
|
69
|
+
return { name: config.name, path: config.path, success: true };
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
73
|
+
return { name: config.name, path: config.path, success: false, error: errorMessage };
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Updates MCP settings in settings.local.json
|
|
78
|
+
*/
|
|
79
|
+
async updateMcpSettings(settings, location) {
|
|
80
|
+
try {
|
|
81
|
+
const settingsPath = location === 'global'
|
|
82
|
+
? '~/.claude/settings.local.json'
|
|
83
|
+
: '.claude/settings.local.json';
|
|
84
|
+
const resolvedPath = this.resolvePath(settingsPath);
|
|
85
|
+
// Read existing settings if they exist
|
|
86
|
+
let existingSettings = {};
|
|
87
|
+
try {
|
|
88
|
+
const content = await fs.readFile(resolvedPath, 'utf-8');
|
|
89
|
+
existingSettings = JSON.parse(content);
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
// File doesn't exist or is invalid, start fresh
|
|
93
|
+
}
|
|
94
|
+
// Merge MCP servers
|
|
95
|
+
const existingMcpServers = existingSettings.mcpServers || {};
|
|
96
|
+
const mergedSettings = {
|
|
97
|
+
...existingSettings,
|
|
98
|
+
mcpServers: {
|
|
99
|
+
...existingMcpServers,
|
|
100
|
+
...settings.mcpServers,
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
// Write updated settings
|
|
104
|
+
const dirPath = path.dirname(resolvedPath);
|
|
105
|
+
await this.ensureDir(dirPath);
|
|
106
|
+
await fs.writeFile(resolvedPath, JSON.stringify(mergedSettings, null, 2), 'utf-8');
|
|
107
|
+
return { success: true };
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
111
|
+
return { success: false, error: errorMessage };
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Saves an entire workflow configuration
|
|
116
|
+
*/
|
|
117
|
+
async saveWorkflow(config, options) {
|
|
118
|
+
const result = {
|
|
119
|
+
success: true,
|
|
120
|
+
skills: [],
|
|
121
|
+
commands: [],
|
|
122
|
+
agents: [],
|
|
123
|
+
mcpSettings: null,
|
|
124
|
+
errors: [],
|
|
125
|
+
};
|
|
126
|
+
// Save skills
|
|
127
|
+
if (options.includeSkills) {
|
|
128
|
+
for (const skill of config.skills) {
|
|
129
|
+
const skillResult = await this.saveSkill(skill);
|
|
130
|
+
result.skills.push(skillResult);
|
|
131
|
+
if (!skillResult.success) {
|
|
132
|
+
result.success = false;
|
|
133
|
+
result.errors.push({
|
|
134
|
+
type: 'skill',
|
|
135
|
+
name: skill.name,
|
|
136
|
+
error: skillResult.error || 'Unknown error',
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
// Save commands
|
|
142
|
+
if (options.includeCommands) {
|
|
143
|
+
for (const command of config.commands) {
|
|
144
|
+
const commandResult = await this.saveCommand(command);
|
|
145
|
+
result.commands.push(commandResult);
|
|
146
|
+
if (!commandResult.success) {
|
|
147
|
+
result.success = false;
|
|
148
|
+
result.errors.push({
|
|
149
|
+
type: 'command',
|
|
150
|
+
name: command.name,
|
|
151
|
+
error: commandResult.error || 'Unknown error',
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
// Save agents
|
|
157
|
+
if (options.includeAgents) {
|
|
158
|
+
for (const agent of config.agents) {
|
|
159
|
+
const agentResult = await this.saveAgent(agent);
|
|
160
|
+
result.agents.push(agentResult);
|
|
161
|
+
if (!agentResult.success) {
|
|
162
|
+
result.success = false;
|
|
163
|
+
result.errors.push({
|
|
164
|
+
type: 'agent',
|
|
165
|
+
name: agent.name,
|
|
166
|
+
error: agentResult.error || 'Unknown error',
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
// Update MCP settings
|
|
172
|
+
if (options.includeMcpSettings && config.mcpSettings) {
|
|
173
|
+
const mcpResult = await this.updateMcpSettings(config.mcpSettings, options.location);
|
|
174
|
+
result.mcpSettings = mcpResult;
|
|
175
|
+
if (!mcpResult.success) {
|
|
176
|
+
result.success = false;
|
|
177
|
+
result.errors.push({
|
|
178
|
+
type: 'mcp',
|
|
179
|
+
name: 'settings.local.json',
|
|
180
|
+
error: mcpResult.error || 'Unknown error',
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return result;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Gets the project root path
|
|
188
|
+
*/
|
|
189
|
+
getProjectPath() {
|
|
190
|
+
return this.projectRoot;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
export const fileService = new FileService();
|