@agiflowai/aicode-toolkit 0.6.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/LICENSE +661 -0
- package/README.md +151 -0
- package/dist/cli.cjs +732 -0
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +727 -0
- package/dist/index.cjs +17 -0
- package/dist/index.d.cts +282 -0
- package/dist/index.d.ts +282 -0
- package/dist/index.js +4 -0
- package/dist/mcp-Bdxvi2Ej.cjs +4 -0
- package/dist/mcp-BmhiAfeF.js +47 -0
- package/dist/mcp-CZIiB-6Y.js +3 -0
- package/dist/mcp-Dwt8nYQV.cjs +65 -0
- package/dist/services-DNldrNnu.js +739 -0
- package/dist/services-s1vmufE4.cjs +859 -0
- package/package.json +85 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const require_services = require('./services-s1vmufE4.cjs');
|
|
2
|
+
require('./mcp-Dwt8nYQV.cjs');
|
|
3
|
+
|
|
4
|
+
exports.BANNER_GRADIENT = require_services.BANNER_GRADIENT;
|
|
5
|
+
exports.CodingAgentService = require_services.CodingAgentService;
|
|
6
|
+
exports.NewProjectService = require_services.NewProjectService;
|
|
7
|
+
exports.THEME = require_services.THEME;
|
|
8
|
+
exports.TemplateSelectionService = require_services.TemplateSelectionService;
|
|
9
|
+
exports.TemplatesService = require_services.TemplatesService;
|
|
10
|
+
exports.cloneRepository = require_services.cloneRepository;
|
|
11
|
+
exports.cloneSubdirectory = require_services.cloneSubdirectory;
|
|
12
|
+
exports.displayBanner = require_services.displayBanner;
|
|
13
|
+
exports.displayCompactBanner = require_services.displayCompactBanner;
|
|
14
|
+
exports.fetchGitHubDirectoryContents = require_services.fetchGitHubDirectoryContents;
|
|
15
|
+
exports.findWorkspaceRoot = require_services.findWorkspaceRoot;
|
|
16
|
+
exports.gitInit = require_services.gitInit;
|
|
17
|
+
exports.parseGitHubUrl = require_services.parseGitHubUrl;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import { CodingAgentId } from "@agiflowai/coding-agent-bridge";
|
|
2
|
+
import { ProjectType } from "@agiflowai/aicode-utils";
|
|
3
|
+
|
|
4
|
+
//#region src/constants/theme.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Theme color constants for AICode Toolkit
|
|
7
|
+
* Defines the brand color palette used throughout the CLI
|
|
8
|
+
*/
|
|
9
|
+
declare const THEME: {
|
|
10
|
+
readonly colors: {
|
|
11
|
+
readonly primary: {
|
|
12
|
+
readonly default: "#10b981";
|
|
13
|
+
readonly dark: "#059669";
|
|
14
|
+
readonly text: "#ffffff";
|
|
15
|
+
};
|
|
16
|
+
readonly secondary: {
|
|
17
|
+
readonly default: "#0d9488";
|
|
18
|
+
readonly dark: "#0f766e";
|
|
19
|
+
readonly light: "#14b8a6";
|
|
20
|
+
readonly text: "#ffffff";
|
|
21
|
+
};
|
|
22
|
+
readonly accent: {
|
|
23
|
+
readonly default: "#c44569";
|
|
24
|
+
readonly dark: "#c44569";
|
|
25
|
+
readonly text: "#2a0b14";
|
|
26
|
+
};
|
|
27
|
+
readonly semantic: {
|
|
28
|
+
readonly info: "#5fb3d4";
|
|
29
|
+
readonly success: "#5fb368";
|
|
30
|
+
readonly error: "#d45959";
|
|
31
|
+
readonly alert: "#d4b359";
|
|
32
|
+
};
|
|
33
|
+
readonly cta: {
|
|
34
|
+
readonly from: "#10b981";
|
|
35
|
+
readonly to: "#0d9488";
|
|
36
|
+
readonly text: "#ffffff";
|
|
37
|
+
};
|
|
38
|
+
readonly transparent: "rgba(0, 0, 0, 0)";
|
|
39
|
+
readonly white: "#c4cccf";
|
|
40
|
+
readonly black: "#424549";
|
|
41
|
+
readonly background: {
|
|
42
|
+
readonly dark: {
|
|
43
|
+
readonly default: "#0f0f0f";
|
|
44
|
+
readonly shade: "#141414";
|
|
45
|
+
readonly dark: "#0a0a0a";
|
|
46
|
+
readonly light: "#1a1a1a";
|
|
47
|
+
};
|
|
48
|
+
readonly light: {
|
|
49
|
+
readonly default: "#fff";
|
|
50
|
+
readonly shade: "#EAEAEA";
|
|
51
|
+
readonly dark: "#17202a";
|
|
52
|
+
readonly light: "#EAEAEA";
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Gradient colors for banner (primary green -> secondary teal)
|
|
59
|
+
*/
|
|
60
|
+
declare const BANNER_GRADIENT: ("#10b981" | "#059669" | "#0d9488" | "#0f766e")[];
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region src/services/CodingAgentService.d.ts
|
|
63
|
+
|
|
64
|
+
type CodingAgent = CodingAgentId;
|
|
65
|
+
declare class CodingAgentService {
|
|
66
|
+
private workspaceRoot;
|
|
67
|
+
constructor(workspaceRoot: string);
|
|
68
|
+
/**
|
|
69
|
+
* Detect which coding agent is enabled in the workspace
|
|
70
|
+
* Checks for Claude Code, Codex, and Gemini CLI installations
|
|
71
|
+
* @param workspaceRoot - The workspace root directory
|
|
72
|
+
* @returns Promise resolving to detected agent ID or null
|
|
73
|
+
*/
|
|
74
|
+
static detectCodingAgent(workspaceRoot: string): Promise<CodingAgent | null>;
|
|
75
|
+
/**
|
|
76
|
+
* Get available coding agents with their descriptions
|
|
77
|
+
*/
|
|
78
|
+
static getAvailableAgents(): Array<{
|
|
79
|
+
value: CodingAgent;
|
|
80
|
+
name: string;
|
|
81
|
+
description: string;
|
|
82
|
+
}>;
|
|
83
|
+
/**
|
|
84
|
+
* Setup MCP configuration for the selected coding agent
|
|
85
|
+
* @param agent - The coding agent to configure
|
|
86
|
+
*/
|
|
87
|
+
setupMCP(agent: CodingAgent): Promise<void>;
|
|
88
|
+
}
|
|
89
|
+
//#endregion
|
|
90
|
+
//#region src/services/NewProjectService.d.ts
|
|
91
|
+
declare class NewProjectService {
|
|
92
|
+
private readonly providedName?;
|
|
93
|
+
private readonly providedProjectType?;
|
|
94
|
+
constructor(providedName?: string, providedProjectType?: string);
|
|
95
|
+
/**
|
|
96
|
+
* Validate project name against naming rules
|
|
97
|
+
* @param value - Project name to validate
|
|
98
|
+
* @returns true if valid, error message string if invalid
|
|
99
|
+
*/
|
|
100
|
+
validateProjectName(value: string): true | string;
|
|
101
|
+
/**
|
|
102
|
+
* Validate project type
|
|
103
|
+
* @param projectType - Project type to validate
|
|
104
|
+
* @throws Error if invalid project type
|
|
105
|
+
*/
|
|
106
|
+
validateProjectType(projectType: string): void;
|
|
107
|
+
/**
|
|
108
|
+
* Get the provided name from constructor
|
|
109
|
+
*/
|
|
110
|
+
getProvidedName(): string | undefined;
|
|
111
|
+
/**
|
|
112
|
+
* Get the provided project type from constructor
|
|
113
|
+
*/
|
|
114
|
+
getProvidedProjectType(): string | undefined;
|
|
115
|
+
/**
|
|
116
|
+
* Create project directory atomically
|
|
117
|
+
* @param projectPath - Full path where project should be created
|
|
118
|
+
* @param projectName - Name of the project (for error messages)
|
|
119
|
+
*/
|
|
120
|
+
createProjectDirectory(projectPath: string, projectName: string): Promise<void>;
|
|
121
|
+
/**
|
|
122
|
+
* Clone an existing Git repository
|
|
123
|
+
* @param repoUrl - Repository URL to clone
|
|
124
|
+
* @param projectPath - Destination path for the cloned repository
|
|
125
|
+
*/
|
|
126
|
+
cloneExistingRepository(repoUrl: string, projectPath: string): Promise<void>;
|
|
127
|
+
/**
|
|
128
|
+
* Initialize a new Git repository
|
|
129
|
+
* @param projectPath - Path where git repository should be initialized
|
|
130
|
+
*/
|
|
131
|
+
initializeGitRepository(projectPath: string): Promise<void>;
|
|
132
|
+
/**
|
|
133
|
+
* Validate repository URL format
|
|
134
|
+
* @param value - Repository URL to validate
|
|
135
|
+
* @returns true if valid, error message string if invalid
|
|
136
|
+
*/
|
|
137
|
+
validateRepositoryUrl(value: string): true | string;
|
|
138
|
+
}
|
|
139
|
+
//#endregion
|
|
140
|
+
//#region src/services/TemplatesService.d.ts
|
|
141
|
+
/**
|
|
142
|
+
* TemplatesService
|
|
143
|
+
*
|
|
144
|
+
* DESIGN PATTERNS:
|
|
145
|
+
* - Service pattern for business logic encapsulation
|
|
146
|
+
* - Single responsibility principle
|
|
147
|
+
*
|
|
148
|
+
* CODING STANDARDS:
|
|
149
|
+
* - Use async/await for asynchronous operations
|
|
150
|
+
* - Throw descriptive errors for error cases
|
|
151
|
+
* - Keep methods focused and well-named
|
|
152
|
+
* - Document complex logic with comments
|
|
153
|
+
*
|
|
154
|
+
* AVOID:
|
|
155
|
+
* - Mixing concerns (keep focused on single domain)
|
|
156
|
+
* - Direct tool implementation (services should be tool-agnostic)
|
|
157
|
+
*/
|
|
158
|
+
interface TemplateRepoConfig {
|
|
159
|
+
owner: string;
|
|
160
|
+
repo: string;
|
|
161
|
+
branch: string;
|
|
162
|
+
path: string;
|
|
163
|
+
}
|
|
164
|
+
declare class TemplatesService {
|
|
165
|
+
/**
|
|
166
|
+
* Download templates from a GitHub repository with UI feedback
|
|
167
|
+
* @param templatesPath - Local path where templates should be downloaded
|
|
168
|
+
* @param repoConfig - Repository configuration (owner, repo, branch, path)
|
|
169
|
+
*/
|
|
170
|
+
downloadTemplates(templatesPath: string, repoConfig: TemplateRepoConfig): Promise<void>;
|
|
171
|
+
/**
|
|
172
|
+
* Initialize templates folder with README
|
|
173
|
+
* @param templatesPath - Path where templates folder should be created
|
|
174
|
+
*/
|
|
175
|
+
initializeTemplatesFolder(templatesPath: string): Promise<void>;
|
|
176
|
+
}
|
|
177
|
+
//#endregion
|
|
178
|
+
//#region src/services/TemplateSelectionService.d.ts
|
|
179
|
+
interface TemplateInfo {
|
|
180
|
+
name: string;
|
|
181
|
+
path: string;
|
|
182
|
+
description?: string;
|
|
183
|
+
}
|
|
184
|
+
declare class TemplateSelectionService {
|
|
185
|
+
private tmpDir;
|
|
186
|
+
constructor(existingTmpDir?: string);
|
|
187
|
+
/**
|
|
188
|
+
* Download templates to OS tmp directory
|
|
189
|
+
* @param repoConfig - Repository configuration
|
|
190
|
+
* @returns Path to the tmp directory containing templates
|
|
191
|
+
*/
|
|
192
|
+
downloadTemplatesToTmp(repoConfig: TemplateRepoConfig): Promise<string>;
|
|
193
|
+
/**
|
|
194
|
+
* List available templates in the tmp directory
|
|
195
|
+
* @returns Array of template information
|
|
196
|
+
*/
|
|
197
|
+
listTemplates(): Promise<TemplateInfo[]>;
|
|
198
|
+
/**
|
|
199
|
+
* Copy selected templates to destination
|
|
200
|
+
* @param templateNames - Names of templates to copy
|
|
201
|
+
* @param destinationPath - Destination templates folder path
|
|
202
|
+
* @param projectType - Project type (monolith allows only single template)
|
|
203
|
+
* @param selectedMcpServers - Optional array of selected MCP servers to filter files
|
|
204
|
+
*/
|
|
205
|
+
copyTemplates(templateNames: string[], destinationPath: string, projectType: ProjectType, selectedMcpServers?: string[]): Promise<void>;
|
|
206
|
+
/**
|
|
207
|
+
* Copy template files with MCP server filtering
|
|
208
|
+
* @param sourcePath - Source template path
|
|
209
|
+
* @param targetPath - Target template path
|
|
210
|
+
* @param selectedMcpServers - Selected MCP servers
|
|
211
|
+
*/
|
|
212
|
+
private copyTemplateWithMcpFilter;
|
|
213
|
+
/**
|
|
214
|
+
* Read template description from README or scaffold.yaml
|
|
215
|
+
* @param templatePath - Path to the template directory
|
|
216
|
+
* @returns Description string or undefined
|
|
217
|
+
*/
|
|
218
|
+
private readTemplateDescription;
|
|
219
|
+
/**
|
|
220
|
+
* Get the tmp directory path
|
|
221
|
+
*/
|
|
222
|
+
getTmpDir(): string;
|
|
223
|
+
/**
|
|
224
|
+
* Clean up tmp directory
|
|
225
|
+
*/
|
|
226
|
+
cleanup(): Promise<void>;
|
|
227
|
+
}
|
|
228
|
+
//#endregion
|
|
229
|
+
//#region src/utils/banner.d.ts
|
|
230
|
+
/**
|
|
231
|
+
* Displays the AICode Toolkit banner with gradient effect
|
|
232
|
+
* Uses gradient-string with theme colors (primary green -> secondary teal)
|
|
233
|
+
*/
|
|
234
|
+
declare function displayBanner(): void;
|
|
235
|
+
/**
|
|
236
|
+
* Simplified banner for compact display
|
|
237
|
+
*/
|
|
238
|
+
declare function displayCompactBanner(): void;
|
|
239
|
+
//#endregion
|
|
240
|
+
//#region src/utils/git.d.ts
|
|
241
|
+
/**
|
|
242
|
+
* Execute git init safely using execa to prevent command injection
|
|
243
|
+
*/
|
|
244
|
+
declare function gitInit(projectPath: string): Promise<void>;
|
|
245
|
+
/**
|
|
246
|
+
* Find the workspace root by searching upwards for .git folder
|
|
247
|
+
* Returns null if no .git folder is found (indicating a new project setup is needed)
|
|
248
|
+
*/
|
|
249
|
+
declare function findWorkspaceRoot(startPath?: string): Promise<string | null>;
|
|
250
|
+
/**
|
|
251
|
+
* Parse GitHub URL to detect if it's a subdirectory
|
|
252
|
+
* Supports formats:
|
|
253
|
+
* - https://github.com/user/repo
|
|
254
|
+
* - https://github.com/user/repo/tree/branch/path/to/dir
|
|
255
|
+
* - https://github.com/user/repo/tree/main/path/to/dir
|
|
256
|
+
*/
|
|
257
|
+
declare function parseGitHubUrl(url: string): {
|
|
258
|
+
owner?: string;
|
|
259
|
+
repo?: string;
|
|
260
|
+
repoUrl: string;
|
|
261
|
+
branch?: string;
|
|
262
|
+
subdirectory?: string;
|
|
263
|
+
isSubdirectory: boolean;
|
|
264
|
+
};
|
|
265
|
+
/**
|
|
266
|
+
* Clone a subdirectory from a git repository using sparse checkout
|
|
267
|
+
*/
|
|
268
|
+
declare function cloneSubdirectory(repoUrl: string, branch: string, subdirectory: string, targetFolder: string): Promise<void>;
|
|
269
|
+
/**
|
|
270
|
+
* Clone entire repository
|
|
271
|
+
*/
|
|
272
|
+
declare function cloneRepository(repoUrl: string, targetFolder: string): Promise<void>;
|
|
273
|
+
/**
|
|
274
|
+
* Fetch directory listing from GitHub API
|
|
275
|
+
*/
|
|
276
|
+
declare function fetchGitHubDirectoryContents(owner: string, repo: string, path: string, branch?: string): Promise<Array<{
|
|
277
|
+
name: string;
|
|
278
|
+
type: string;
|
|
279
|
+
path: string;
|
|
280
|
+
}>>;
|
|
281
|
+
//#endregion
|
|
282
|
+
export { BANNER_GRADIENT, type CodingAgent, CodingAgentService, NewProjectService, THEME, TemplateSelectionService, TemplatesService, cloneRepository, cloneSubdirectory, displayBanner, displayCompactBanner, fetchGitHubDirectoryContents, findWorkspaceRoot, gitInit, parseGitHubUrl };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import { ProjectType } from "@agiflowai/aicode-utils";
|
|
2
|
+
import { CodingAgentId } from "@agiflowai/coding-agent-bridge";
|
|
3
|
+
|
|
4
|
+
//#region src/constants/theme.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Theme color constants for AICode Toolkit
|
|
7
|
+
* Defines the brand color palette used throughout the CLI
|
|
8
|
+
*/
|
|
9
|
+
declare const THEME: {
|
|
10
|
+
readonly colors: {
|
|
11
|
+
readonly primary: {
|
|
12
|
+
readonly default: "#10b981";
|
|
13
|
+
readonly dark: "#059669";
|
|
14
|
+
readonly text: "#ffffff";
|
|
15
|
+
};
|
|
16
|
+
readonly secondary: {
|
|
17
|
+
readonly default: "#0d9488";
|
|
18
|
+
readonly dark: "#0f766e";
|
|
19
|
+
readonly light: "#14b8a6";
|
|
20
|
+
readonly text: "#ffffff";
|
|
21
|
+
};
|
|
22
|
+
readonly accent: {
|
|
23
|
+
readonly default: "#c44569";
|
|
24
|
+
readonly dark: "#c44569";
|
|
25
|
+
readonly text: "#2a0b14";
|
|
26
|
+
};
|
|
27
|
+
readonly semantic: {
|
|
28
|
+
readonly info: "#5fb3d4";
|
|
29
|
+
readonly success: "#5fb368";
|
|
30
|
+
readonly error: "#d45959";
|
|
31
|
+
readonly alert: "#d4b359";
|
|
32
|
+
};
|
|
33
|
+
readonly cta: {
|
|
34
|
+
readonly from: "#10b981";
|
|
35
|
+
readonly to: "#0d9488";
|
|
36
|
+
readonly text: "#ffffff";
|
|
37
|
+
};
|
|
38
|
+
readonly transparent: "rgba(0, 0, 0, 0)";
|
|
39
|
+
readonly white: "#c4cccf";
|
|
40
|
+
readonly black: "#424549";
|
|
41
|
+
readonly background: {
|
|
42
|
+
readonly dark: {
|
|
43
|
+
readonly default: "#0f0f0f";
|
|
44
|
+
readonly shade: "#141414";
|
|
45
|
+
readonly dark: "#0a0a0a";
|
|
46
|
+
readonly light: "#1a1a1a";
|
|
47
|
+
};
|
|
48
|
+
readonly light: {
|
|
49
|
+
readonly default: "#fff";
|
|
50
|
+
readonly shade: "#EAEAEA";
|
|
51
|
+
readonly dark: "#17202a";
|
|
52
|
+
readonly light: "#EAEAEA";
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Gradient colors for banner (primary green -> secondary teal)
|
|
59
|
+
*/
|
|
60
|
+
declare const BANNER_GRADIENT: ("#10b981" | "#059669" | "#0d9488" | "#0f766e")[];
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region src/services/CodingAgentService.d.ts
|
|
63
|
+
|
|
64
|
+
type CodingAgent = CodingAgentId;
|
|
65
|
+
declare class CodingAgentService {
|
|
66
|
+
private workspaceRoot;
|
|
67
|
+
constructor(workspaceRoot: string);
|
|
68
|
+
/**
|
|
69
|
+
* Detect which coding agent is enabled in the workspace
|
|
70
|
+
* Checks for Claude Code, Codex, and Gemini CLI installations
|
|
71
|
+
* @param workspaceRoot - The workspace root directory
|
|
72
|
+
* @returns Promise resolving to detected agent ID or null
|
|
73
|
+
*/
|
|
74
|
+
static detectCodingAgent(workspaceRoot: string): Promise<CodingAgent | null>;
|
|
75
|
+
/**
|
|
76
|
+
* Get available coding agents with their descriptions
|
|
77
|
+
*/
|
|
78
|
+
static getAvailableAgents(): Array<{
|
|
79
|
+
value: CodingAgent;
|
|
80
|
+
name: string;
|
|
81
|
+
description: string;
|
|
82
|
+
}>;
|
|
83
|
+
/**
|
|
84
|
+
* Setup MCP configuration for the selected coding agent
|
|
85
|
+
* @param agent - The coding agent to configure
|
|
86
|
+
*/
|
|
87
|
+
setupMCP(agent: CodingAgent): Promise<void>;
|
|
88
|
+
}
|
|
89
|
+
//#endregion
|
|
90
|
+
//#region src/services/NewProjectService.d.ts
|
|
91
|
+
declare class NewProjectService {
|
|
92
|
+
private readonly providedName?;
|
|
93
|
+
private readonly providedProjectType?;
|
|
94
|
+
constructor(providedName?: string, providedProjectType?: string);
|
|
95
|
+
/**
|
|
96
|
+
* Validate project name against naming rules
|
|
97
|
+
* @param value - Project name to validate
|
|
98
|
+
* @returns true if valid, error message string if invalid
|
|
99
|
+
*/
|
|
100
|
+
validateProjectName(value: string): true | string;
|
|
101
|
+
/**
|
|
102
|
+
* Validate project type
|
|
103
|
+
* @param projectType - Project type to validate
|
|
104
|
+
* @throws Error if invalid project type
|
|
105
|
+
*/
|
|
106
|
+
validateProjectType(projectType: string): void;
|
|
107
|
+
/**
|
|
108
|
+
* Get the provided name from constructor
|
|
109
|
+
*/
|
|
110
|
+
getProvidedName(): string | undefined;
|
|
111
|
+
/**
|
|
112
|
+
* Get the provided project type from constructor
|
|
113
|
+
*/
|
|
114
|
+
getProvidedProjectType(): string | undefined;
|
|
115
|
+
/**
|
|
116
|
+
* Create project directory atomically
|
|
117
|
+
* @param projectPath - Full path where project should be created
|
|
118
|
+
* @param projectName - Name of the project (for error messages)
|
|
119
|
+
*/
|
|
120
|
+
createProjectDirectory(projectPath: string, projectName: string): Promise<void>;
|
|
121
|
+
/**
|
|
122
|
+
* Clone an existing Git repository
|
|
123
|
+
* @param repoUrl - Repository URL to clone
|
|
124
|
+
* @param projectPath - Destination path for the cloned repository
|
|
125
|
+
*/
|
|
126
|
+
cloneExistingRepository(repoUrl: string, projectPath: string): Promise<void>;
|
|
127
|
+
/**
|
|
128
|
+
* Initialize a new Git repository
|
|
129
|
+
* @param projectPath - Path where git repository should be initialized
|
|
130
|
+
*/
|
|
131
|
+
initializeGitRepository(projectPath: string): Promise<void>;
|
|
132
|
+
/**
|
|
133
|
+
* Validate repository URL format
|
|
134
|
+
* @param value - Repository URL to validate
|
|
135
|
+
* @returns true if valid, error message string if invalid
|
|
136
|
+
*/
|
|
137
|
+
validateRepositoryUrl(value: string): true | string;
|
|
138
|
+
}
|
|
139
|
+
//#endregion
|
|
140
|
+
//#region src/services/TemplatesService.d.ts
|
|
141
|
+
/**
|
|
142
|
+
* TemplatesService
|
|
143
|
+
*
|
|
144
|
+
* DESIGN PATTERNS:
|
|
145
|
+
* - Service pattern for business logic encapsulation
|
|
146
|
+
* - Single responsibility principle
|
|
147
|
+
*
|
|
148
|
+
* CODING STANDARDS:
|
|
149
|
+
* - Use async/await for asynchronous operations
|
|
150
|
+
* - Throw descriptive errors for error cases
|
|
151
|
+
* - Keep methods focused and well-named
|
|
152
|
+
* - Document complex logic with comments
|
|
153
|
+
*
|
|
154
|
+
* AVOID:
|
|
155
|
+
* - Mixing concerns (keep focused on single domain)
|
|
156
|
+
* - Direct tool implementation (services should be tool-agnostic)
|
|
157
|
+
*/
|
|
158
|
+
interface TemplateRepoConfig {
|
|
159
|
+
owner: string;
|
|
160
|
+
repo: string;
|
|
161
|
+
branch: string;
|
|
162
|
+
path: string;
|
|
163
|
+
}
|
|
164
|
+
declare class TemplatesService {
|
|
165
|
+
/**
|
|
166
|
+
* Download templates from a GitHub repository with UI feedback
|
|
167
|
+
* @param templatesPath - Local path where templates should be downloaded
|
|
168
|
+
* @param repoConfig - Repository configuration (owner, repo, branch, path)
|
|
169
|
+
*/
|
|
170
|
+
downloadTemplates(templatesPath: string, repoConfig: TemplateRepoConfig): Promise<void>;
|
|
171
|
+
/**
|
|
172
|
+
* Initialize templates folder with README
|
|
173
|
+
* @param templatesPath - Path where templates folder should be created
|
|
174
|
+
*/
|
|
175
|
+
initializeTemplatesFolder(templatesPath: string): Promise<void>;
|
|
176
|
+
}
|
|
177
|
+
//#endregion
|
|
178
|
+
//#region src/services/TemplateSelectionService.d.ts
|
|
179
|
+
interface TemplateInfo {
|
|
180
|
+
name: string;
|
|
181
|
+
path: string;
|
|
182
|
+
description?: string;
|
|
183
|
+
}
|
|
184
|
+
declare class TemplateSelectionService {
|
|
185
|
+
private tmpDir;
|
|
186
|
+
constructor(existingTmpDir?: string);
|
|
187
|
+
/**
|
|
188
|
+
* Download templates to OS tmp directory
|
|
189
|
+
* @param repoConfig - Repository configuration
|
|
190
|
+
* @returns Path to the tmp directory containing templates
|
|
191
|
+
*/
|
|
192
|
+
downloadTemplatesToTmp(repoConfig: TemplateRepoConfig): Promise<string>;
|
|
193
|
+
/**
|
|
194
|
+
* List available templates in the tmp directory
|
|
195
|
+
* @returns Array of template information
|
|
196
|
+
*/
|
|
197
|
+
listTemplates(): Promise<TemplateInfo[]>;
|
|
198
|
+
/**
|
|
199
|
+
* Copy selected templates to destination
|
|
200
|
+
* @param templateNames - Names of templates to copy
|
|
201
|
+
* @param destinationPath - Destination templates folder path
|
|
202
|
+
* @param projectType - Project type (monolith allows only single template)
|
|
203
|
+
* @param selectedMcpServers - Optional array of selected MCP servers to filter files
|
|
204
|
+
*/
|
|
205
|
+
copyTemplates(templateNames: string[], destinationPath: string, projectType: ProjectType, selectedMcpServers?: string[]): Promise<void>;
|
|
206
|
+
/**
|
|
207
|
+
* Copy template files with MCP server filtering
|
|
208
|
+
* @param sourcePath - Source template path
|
|
209
|
+
* @param targetPath - Target template path
|
|
210
|
+
* @param selectedMcpServers - Selected MCP servers
|
|
211
|
+
*/
|
|
212
|
+
private copyTemplateWithMcpFilter;
|
|
213
|
+
/**
|
|
214
|
+
* Read template description from README or scaffold.yaml
|
|
215
|
+
* @param templatePath - Path to the template directory
|
|
216
|
+
* @returns Description string or undefined
|
|
217
|
+
*/
|
|
218
|
+
private readTemplateDescription;
|
|
219
|
+
/**
|
|
220
|
+
* Get the tmp directory path
|
|
221
|
+
*/
|
|
222
|
+
getTmpDir(): string;
|
|
223
|
+
/**
|
|
224
|
+
* Clean up tmp directory
|
|
225
|
+
*/
|
|
226
|
+
cleanup(): Promise<void>;
|
|
227
|
+
}
|
|
228
|
+
//#endregion
|
|
229
|
+
//#region src/utils/banner.d.ts
|
|
230
|
+
/**
|
|
231
|
+
* Displays the AICode Toolkit banner with gradient effect
|
|
232
|
+
* Uses gradient-string with theme colors (primary green -> secondary teal)
|
|
233
|
+
*/
|
|
234
|
+
declare function displayBanner(): void;
|
|
235
|
+
/**
|
|
236
|
+
* Simplified banner for compact display
|
|
237
|
+
*/
|
|
238
|
+
declare function displayCompactBanner(): void;
|
|
239
|
+
//#endregion
|
|
240
|
+
//#region src/utils/git.d.ts
|
|
241
|
+
/**
|
|
242
|
+
* Execute git init safely using execa to prevent command injection
|
|
243
|
+
*/
|
|
244
|
+
declare function gitInit(projectPath: string): Promise<void>;
|
|
245
|
+
/**
|
|
246
|
+
* Find the workspace root by searching upwards for .git folder
|
|
247
|
+
* Returns null if no .git folder is found (indicating a new project setup is needed)
|
|
248
|
+
*/
|
|
249
|
+
declare function findWorkspaceRoot(startPath?: string): Promise<string | null>;
|
|
250
|
+
/**
|
|
251
|
+
* Parse GitHub URL to detect if it's a subdirectory
|
|
252
|
+
* Supports formats:
|
|
253
|
+
* - https://github.com/user/repo
|
|
254
|
+
* - https://github.com/user/repo/tree/branch/path/to/dir
|
|
255
|
+
* - https://github.com/user/repo/tree/main/path/to/dir
|
|
256
|
+
*/
|
|
257
|
+
declare function parseGitHubUrl(url: string): {
|
|
258
|
+
owner?: string;
|
|
259
|
+
repo?: string;
|
|
260
|
+
repoUrl: string;
|
|
261
|
+
branch?: string;
|
|
262
|
+
subdirectory?: string;
|
|
263
|
+
isSubdirectory: boolean;
|
|
264
|
+
};
|
|
265
|
+
/**
|
|
266
|
+
* Clone a subdirectory from a git repository using sparse checkout
|
|
267
|
+
*/
|
|
268
|
+
declare function cloneSubdirectory(repoUrl: string, branch: string, subdirectory: string, targetFolder: string): Promise<void>;
|
|
269
|
+
/**
|
|
270
|
+
* Clone entire repository
|
|
271
|
+
*/
|
|
272
|
+
declare function cloneRepository(repoUrl: string, targetFolder: string): Promise<void>;
|
|
273
|
+
/**
|
|
274
|
+
* Fetch directory listing from GitHub API
|
|
275
|
+
*/
|
|
276
|
+
declare function fetchGitHubDirectoryContents(owner: string, repo: string, path: string, branch?: string): Promise<Array<{
|
|
277
|
+
name: string;
|
|
278
|
+
type: string;
|
|
279
|
+
path: string;
|
|
280
|
+
}>>;
|
|
281
|
+
//#endregion
|
|
282
|
+
export { BANNER_GRADIENT, type CodingAgent, CodingAgentService, NewProjectService, THEME, TemplateSelectionService, TemplatesService, cloneRepository, cloneSubdirectory, displayBanner, displayCompactBanner, fetchGitHubDirectoryContents, findWorkspaceRoot, gitInit, parseGitHubUrl };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import "./mcp-BmhiAfeF.js";
|
|
2
|
+
import { BANNER_GRADIENT, CodingAgentService, NewProjectService, THEME, TemplateSelectionService, TemplatesService, cloneRepository, cloneSubdirectory, displayBanner, displayCompactBanner, fetchGitHubDirectoryContents, findWorkspaceRoot, gitInit, parseGitHubUrl } from "./services-DNldrNnu.js";
|
|
3
|
+
|
|
4
|
+
export { BANNER_GRADIENT, CodingAgentService, NewProjectService, THEME, TemplateSelectionService, TemplatesService, cloneRepository, cloneSubdirectory, displayBanner, displayCompactBanner, fetchGitHubDirectoryContents, findWorkspaceRoot, gitInit, parseGitHubUrl };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
//#region src/constants/mcp.ts
|
|
2
|
+
/**
|
|
3
|
+
* MCP (Model Context Protocol) Server Constants
|
|
4
|
+
*
|
|
5
|
+
* DESIGN PATTERNS:
|
|
6
|
+
* - Centralized constants for MCP server configuration
|
|
7
|
+
* - Enum pattern for type-safe MCP server selection
|
|
8
|
+
*
|
|
9
|
+
* CODING STANDARDS:
|
|
10
|
+
* - Use UPPER_CASE for constant values
|
|
11
|
+
* - Document each constant with JSDoc comments
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Available MCP servers
|
|
15
|
+
*/
|
|
16
|
+
let MCPServer = /* @__PURE__ */ function(MCPServer$1) {
|
|
17
|
+
MCPServer$1["ARCHITECT"] = "architect-mcp";
|
|
18
|
+
MCPServer$1["SCAFFOLD"] = "scaffold-mcp";
|
|
19
|
+
return MCPServer$1;
|
|
20
|
+
}({});
|
|
21
|
+
/**
|
|
22
|
+
* MCP server configuration files
|
|
23
|
+
* Maps each MCP server to its specific configuration files
|
|
24
|
+
*
|
|
25
|
+
* - architect-mcp: Only needs RULES.yaml and architect.yaml
|
|
26
|
+
* - scaffold-mcp: Needs all other template files (excluding architect files)
|
|
27
|
+
*/
|
|
28
|
+
const MCP_CONFIG_FILES = {
|
|
29
|
+
[MCPServer.ARCHITECT]: ["RULES.yaml", "architect.yaml"],
|
|
30
|
+
[MCPServer.SCAFFOLD]: []
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* MCP server display names and descriptions for user prompts
|
|
34
|
+
*/
|
|
35
|
+
const MCP_SERVER_INFO = {
|
|
36
|
+
[MCPServer.ARCHITECT]: {
|
|
37
|
+
name: "Architect MCP",
|
|
38
|
+
description: "Code review, design patterns, and coding standards enforcement"
|
|
39
|
+
},
|
|
40
|
+
[MCPServer.SCAFFOLD]: {
|
|
41
|
+
name: "Scaffold MCP",
|
|
42
|
+
description: "Project scaffolding, boilerplates, and feature generation"
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
//#endregion
|
|
47
|
+
export { MCPServer, MCP_CONFIG_FILES, MCP_SERVER_INFO };
|