@agiflowai/aicode-toolkit 1.0.2 → 1.0.4

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/cli.cjs CHANGED
@@ -1,120 +1,19 @@
1
1
  #!/usr/bin/env node
2
- const require_services = require('./services-C6lqyioO.cjs');
2
+ const require_services = require('./services-AGkvOBF_.cjs');
3
3
  const require_mcp = require('./mcp-Dwt8nYQV.cjs');
4
- let commander = require("commander");
5
- commander = require_services.__toESM(commander);
6
- let node_path = require("node:path");
7
- node_path = require_services.__toESM(node_path);
8
4
  let __agiflowai_aicode_utils = require("@agiflowai/aicode-utils");
9
- __agiflowai_aicode_utils = require_services.__toESM(__agiflowai_aicode_utils);
10
5
  let fs_extra = require("fs-extra");
11
6
  fs_extra = require_services.__toESM(fs_extra);
7
+ let node_path = require("node:path");
8
+ node_path = require_services.__toESM(node_path);
9
+ let commander = require("commander");
12
10
  let __inquirer_prompts = require("@inquirer/prompts");
13
- __inquirer_prompts = require_services.__toESM(__inquirer_prompts);
14
11
  let ora = require("ora");
15
12
  ora = require_services.__toESM(ora);
16
13
  let xstate = require("xstate");
17
- xstate = require_services.__toESM(xstate);
18
14
 
19
15
  //#region package.json
20
- var name = "@agiflowai/aicode-toolkit";
21
- var description = "AI-powered code toolkit CLI for scaffolding, architecture management, and development workflows";
22
- var version = "1.0.1";
23
- var license = "AGPL-3.0";
24
- var author = "AgiflowIO";
25
- var repository = {
26
- "type": "git",
27
- "url": "https://github.com/AgiFlow/aicode-toolkit.git",
28
- "directory": "apps/aicode-toolkit"
29
- };
30
- var homepage = "https://github.com/AgiFlow/aicode-toolkit#readme";
31
- var bugs = { "url": "https://github.com/AgiFlow/aicode-toolkit/issues" };
32
- var keywords = [
33
- "mcp",
34
- "model-context-protocol",
35
- "scaffold",
36
- "boilerplate",
37
- "template",
38
- "code-generation",
39
- "nextjs",
40
- "react",
41
- "vite"
42
- ];
43
- var bin = { "aicode": "./dist/cli.cjs" };
44
- var main$1 = "./dist/index.cjs";
45
- var types = "./dist/index.d.cts";
46
- var module$1 = "./dist/index.js";
47
- var files = ["dist", "README.md"];
48
- var scripts = {
49
- "dev": "node --loader ts-node/esm src/cli.ts",
50
- "build": "tsdown",
51
- "test": "vitest --run",
52
- "typecheck": "tsc --noEmit"
53
- };
54
- var dependencies = {
55
- "@agiflowai/aicode-utils": "workspace:*",
56
- "@agiflowai/coding-agent-bridge": "workspace:*",
57
- "@composio/json-schema-to-zod": "0.1.15",
58
- "@inquirer/prompts": "^7.8.6",
59
- "@modelcontextprotocol/sdk": "1.19.1",
60
- "chalk": "5.6.2",
61
- "commander": "14.0.1",
62
- "execa": "^9.5.2",
63
- "express": "^4.21.2",
64
- "fs-extra": "11.3.2",
65
- "gradient-string": "^3.0.0",
66
- "js-yaml": "4.1.0",
67
- "liquidjs": "10.21.1",
68
- "ora": "^9.0.0",
69
- "pino": "^10.0.0",
70
- "pino-pretty": "^13.1.1",
71
- "xstate": "^5.23.0",
72
- "zod": "3.25.76"
73
- };
74
- var devDependencies = {
75
- "@types/express": "^5.0.0",
76
- "@types/fs-extra": "^11.0.4",
77
- "@types/js-yaml": "^4.0.9",
78
- "@types/node": "^22.0.0",
79
- "tsdown": "^0.15.6",
80
- "typescript": "5.9.3",
81
- "unplugin-raw": "^0.6.3"
82
- };
83
- var publishConfig = { "access": "public" };
84
- var type = "module";
85
- var exports$1 = {
86
- ".": {
87
- "import": "./dist/index.js",
88
- "require": "./dist/index.cjs"
89
- },
90
- "./cli": {
91
- "import": "./dist/cli.js",
92
- "require": "./dist/cli.cjs"
93
- },
94
- "./package.json": "./package.json"
95
- };
96
- var package_default = {
97
- name,
98
- description,
99
- version,
100
- license,
101
- author,
102
- repository,
103
- homepage,
104
- bugs,
105
- keywords,
106
- bin,
107
- main: main$1,
108
- types,
109
- module: module$1,
110
- files,
111
- scripts,
112
- dependencies,
113
- devDependencies,
114
- publishConfig,
115
- type,
116
- exports: exports$1
117
- };
16
+ var version = "1.0.3";
118
17
 
119
18
  //#endregion
120
19
  //#region src/commands/add.ts
@@ -1000,7 +899,7 @@ const initCommand = new commander.Command("init").description("Initialize projec
1000
899
  */
1001
900
  async function main() {
1002
901
  const program = new commander.Command();
1003
- program.name("aicode").description("AI-powered code toolkit CLI for scaffolding, architecture management, and development workflows").version(package_default.version);
902
+ program.name("aicode").description("AI-powered code toolkit CLI for scaffolding, architecture management, and development workflows").version(version);
1004
903
  program.addCommand(initCommand);
1005
904
  program.addCommand(addCommand);
1006
905
  await program.parseAsync(process.argv);
@@ -1,113 +1,16 @@
1
1
  #!/usr/bin/env node
2
- import { MCPServer, MCP_SERVER_INFO } from "./mcp-BmhiAfeF.js";
3
- import { CodingAgentService, NewProjectService, SPEC_TOOL_INFO, SpecTool, SpecToolService, TemplateSelectionService, cloneRepository, cloneSubdirectory, displayBanner, findWorkspaceRoot, parseGitHubUrl } from "./services-zrdafWTg.js";
4
- import { Command } from "commander";
5
- import path from "node:path";
2
+ import { r as MCP_SERVER_INFO, t as MCPServer } from "./mcp-C3HR_ZNF.mjs";
3
+ import { a as SpecToolService, c as cloneSubdirectory, f as parseGitHubUrl, h as CodingAgentService, i as SpecTool, n as TemplateSelectionService, o as NewProjectService, p as displayBanner, r as SPEC_TOOL_INFO, s as cloneRepository, u as findWorkspaceRoot } from "./services-DNrFhooq.mjs";
6
4
  import { ProjectType, TemplatesManagerService, detectProjectType, icons, messages, print, sections } from "@agiflowai/aicode-utils";
7
5
  import * as fs from "fs-extra";
6
+ import path from "node:path";
7
+ import { Command } from "commander";
8
8
  import { confirm, input, select } from "@inquirer/prompts";
9
9
  import ora from "ora";
10
10
  import { assign, createActor, createMachine, fromPromise } from "xstate";
11
11
 
12
12
  //#region package.json
13
- var name = "@agiflowai/aicode-toolkit";
14
- var description = "AI-powered code toolkit CLI for scaffolding, architecture management, and development workflows";
15
- var version = "1.0.1";
16
- var license = "AGPL-3.0";
17
- var author = "AgiflowIO";
18
- var repository = {
19
- "type": "git",
20
- "url": "https://github.com/AgiFlow/aicode-toolkit.git",
21
- "directory": "apps/aicode-toolkit"
22
- };
23
- var homepage = "https://github.com/AgiFlow/aicode-toolkit#readme";
24
- var bugs = { "url": "https://github.com/AgiFlow/aicode-toolkit/issues" };
25
- var keywords = [
26
- "mcp",
27
- "model-context-protocol",
28
- "scaffold",
29
- "boilerplate",
30
- "template",
31
- "code-generation",
32
- "nextjs",
33
- "react",
34
- "vite"
35
- ];
36
- var bin = { "aicode": "./dist/cli.cjs" };
37
- var main$1 = "./dist/index.cjs";
38
- var types = "./dist/index.d.cts";
39
- var module = "./dist/index.js";
40
- var files = ["dist", "README.md"];
41
- var scripts = {
42
- "dev": "node --loader ts-node/esm src/cli.ts",
43
- "build": "tsdown",
44
- "test": "vitest --run",
45
- "typecheck": "tsc --noEmit"
46
- };
47
- var dependencies = {
48
- "@agiflowai/aicode-utils": "workspace:*",
49
- "@agiflowai/coding-agent-bridge": "workspace:*",
50
- "@composio/json-schema-to-zod": "0.1.15",
51
- "@inquirer/prompts": "^7.8.6",
52
- "@modelcontextprotocol/sdk": "1.19.1",
53
- "chalk": "5.6.2",
54
- "commander": "14.0.1",
55
- "execa": "^9.5.2",
56
- "express": "^4.21.2",
57
- "fs-extra": "11.3.2",
58
- "gradient-string": "^3.0.0",
59
- "js-yaml": "4.1.0",
60
- "liquidjs": "10.21.1",
61
- "ora": "^9.0.0",
62
- "pino": "^10.0.0",
63
- "pino-pretty": "^13.1.1",
64
- "xstate": "^5.23.0",
65
- "zod": "3.25.76"
66
- };
67
- var devDependencies = {
68
- "@types/express": "^5.0.0",
69
- "@types/fs-extra": "^11.0.4",
70
- "@types/js-yaml": "^4.0.9",
71
- "@types/node": "^22.0.0",
72
- "tsdown": "^0.15.6",
73
- "typescript": "5.9.3",
74
- "unplugin-raw": "^0.6.3"
75
- };
76
- var publishConfig = { "access": "public" };
77
- var type = "module";
78
- var exports = {
79
- ".": {
80
- "import": "./dist/index.js",
81
- "require": "./dist/index.cjs"
82
- },
83
- "./cli": {
84
- "import": "./dist/cli.js",
85
- "require": "./dist/cli.cjs"
86
- },
87
- "./package.json": "./package.json"
88
- };
89
- var package_default = {
90
- name,
91
- description,
92
- version,
93
- license,
94
- author,
95
- repository,
96
- homepage,
97
- bugs,
98
- keywords,
99
- bin,
100
- main: main$1,
101
- types,
102
- module,
103
- files,
104
- scripts,
105
- dependencies,
106
- devDependencies,
107
- publishConfig,
108
- type,
109
- exports
110
- };
13
+ var version = "1.0.3";
111
14
 
112
15
  //#endregion
113
16
  //#region src/commands/add.ts
@@ -993,7 +896,7 @@ const initCommand = new Command("init").description("Initialize project with tem
993
896
  */
994
897
  async function main() {
995
898
  const program = new Command();
996
- program.name("aicode").description("AI-powered code toolkit CLI for scaffolding, architecture management, and development workflows").version(package_default.version);
899
+ program.name("aicode").description("AI-powered code toolkit CLI for scaffolding, architecture management, and development workflows").version(version);
997
900
  program.addCommand(initCommand);
998
901
  program.addCommand(addCommand);
999
902
  await program.parseAsync(process.argv);
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- const require_services = require('./services-C6lqyioO.cjs');
1
+ const require_services = require('./services-AGkvOBF_.cjs');
2
2
  require('./mcp-Dwt8nYQV.cjs');
3
3
 
4
4
  exports.BANNER_GRADIENT = require_services.BANNER_GRADIENT;
@@ -1,5 +1,5 @@
1
- import { ProjectType } from "@agiflowai/aicode-utils";
2
1
  import { CodingAgentId } from "@agiflowai/coding-agent-bridge";
2
+ import { ProjectType } from "@agiflowai/aicode-utils";
3
3
 
4
4
  //#region src/constants/theme.d.ts
5
5
  /**
package/dist/index.mjs ADDED
@@ -0,0 +1,4 @@
1
+ import "./mcp-C3HR_ZNF.mjs";
2
+ import { _ as THEME, c as cloneSubdirectory, d as gitInit, f as parseGitHubUrl, g as BANNER_GRADIENT, h as CodingAgentService, l as fetchGitHubDirectoryContents, m as displayCompactBanner, n as TemplateSelectionService, o as NewProjectService, p as displayBanner, s as cloneRepository, t as TemplatesService, u as findWorkspaceRoot } from "./services-DNrFhooq.mjs";
3
+
4
+ export { BANNER_GRADIENT, CodingAgentService, NewProjectService, THEME, TemplateSelectionService, TemplatesService, cloneRepository, cloneSubdirectory, displayBanner, displayCompactBanner, fetchGitHubDirectoryContents, findWorkspaceRoot, gitInit, parseGitHubUrl };
@@ -0,0 +1,3 @@
1
+ import { n as MCP_CONFIG_FILES, r as MCP_SERVER_INFO, t as MCPServer } from "./mcp-C3HR_ZNF.mjs";
2
+
3
+ export { MCPServer, MCP_CONFIG_FILES };
@@ -44,4 +44,4 @@ const MCP_SERVER_INFO = {
44
44
  };
45
45
 
46
46
  //#endregion
47
- export { MCPServer, MCP_CONFIG_FILES, MCP_SERVER_INFO };
47
+ export { MCP_CONFIG_FILES as n, MCP_SERVER_INFO as r, MCPServer as t };
@@ -21,24 +21,20 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
21
21
  }) : target, mod));
22
22
 
23
23
  //#endregion
24
- let node_path = require("node:path");
25
- node_path = __toESM(node_path);
24
+ let __agiflowai_coding_agent_bridge = require("@agiflowai/coding-agent-bridge");
26
25
  let __agiflowai_aicode_utils = require("@agiflowai/aicode-utils");
27
- __agiflowai_aicode_utils = __toESM(__agiflowai_aicode_utils);
28
26
  let fs_extra = require("fs-extra");
29
27
  fs_extra = __toESM(fs_extra);
30
28
  let chalk = require("chalk");
31
29
  chalk = __toESM(chalk);
32
30
  let gradient_string = require("gradient-string");
33
31
  gradient_string = __toESM(gradient_string);
32
+ let node_path = require("node:path");
33
+ node_path = __toESM(node_path);
34
34
  let execa = require("execa");
35
- execa = __toESM(execa);
36
- let __agiflowai_coding_agent_bridge = require("@agiflowai/coding-agent-bridge");
37
- __agiflowai_coding_agent_bridge = __toESM(__agiflowai_coding_agent_bridge);
38
35
  let node_fs_promises = require("node:fs/promises");
39
36
  node_fs_promises = __toESM(node_fs_promises);
40
37
  let liquidjs = require("liquidjs");
41
- liquidjs = __toESM(liquidjs);
42
38
  let node_os = require("node:os");
43
39
  node_os = __toESM(node_os);
44
40
 
@@ -103,6 +99,187 @@ const BANNER_GRADIENT = [
103
99
  THEME.colors.secondary.dark
104
100
  ];
105
101
 
102
+ //#endregion
103
+ //#region src/services/CodingAgentService.ts
104
+ /**
105
+ * CodingAgentService
106
+ *
107
+ * DESIGN PATTERNS:
108
+ * - Service pattern for business logic encapsulation
109
+ * - Strategy pattern for different agent configurations
110
+ * - Single responsibility: Handle MCP setup for coding agents
111
+ *
112
+ * CODING STANDARDS:
113
+ * - Use async/await for asynchronous operations
114
+ * - Throw descriptive errors for error cases
115
+ * - Document methods with JSDoc comments
116
+ *
117
+ * AVOID:
118
+ * - Direct UI interaction (no prompts in services)
119
+ * - Hard-coding agent configurations (use strategies)
120
+ */
121
+ var CodingAgentService = class {
122
+ workspaceRoot;
123
+ constructor(workspaceRoot) {
124
+ this.workspaceRoot = workspaceRoot;
125
+ }
126
+ /**
127
+ * Detect which coding agent is enabled in the workspace
128
+ * Checks for Claude Code, Codex, Gemini CLI, GitHub Copilot, and Cursor installations
129
+ * @param workspaceRoot - The workspace root directory
130
+ * @returns Promise resolving to detected agent ID or null
131
+ */
132
+ static async detectCodingAgent(workspaceRoot) {
133
+ if (await new __agiflowai_coding_agent_bridge.ClaudeCodeService({ workspaceRoot }).isEnabled()) return __agiflowai_coding_agent_bridge.CLAUDE_CODE;
134
+ if (await new __agiflowai_coding_agent_bridge.CursorService({ workspaceRoot }).isEnabled()) return __agiflowai_coding_agent_bridge.CURSOR;
135
+ if (await new __agiflowai_coding_agent_bridge.GitHubCopilotService({ workspaceRoot }).isEnabled()) return __agiflowai_coding_agent_bridge.GITHUB_COPILOT;
136
+ if (await new __agiflowai_coding_agent_bridge.CodexService({ workspaceRoot }).isEnabled()) return __agiflowai_coding_agent_bridge.CODEX;
137
+ if (await new __agiflowai_coding_agent_bridge.GeminiCliService({ workspaceRoot }).isEnabled()) return __agiflowai_coding_agent_bridge.GEMINI_CLI;
138
+ return null;
139
+ }
140
+ /**
141
+ * Get available coding agents with their descriptions
142
+ */
143
+ static getAvailableAgents() {
144
+ return [
145
+ {
146
+ value: __agiflowai_coding_agent_bridge.CLAUDE_CODE,
147
+ name: "Claude Code",
148
+ description: "Anthropic Claude Code CLI agent"
149
+ },
150
+ {
151
+ value: __agiflowai_coding_agent_bridge.CURSOR,
152
+ name: "Cursor",
153
+ description: "Cursor AI-first code editor"
154
+ },
155
+ {
156
+ value: __agiflowai_coding_agent_bridge.GITHUB_COPILOT,
157
+ name: "GitHub Copilot",
158
+ description: "GitHub Copilot coding agent and CLI"
159
+ },
160
+ {
161
+ value: __agiflowai_coding_agent_bridge.CODEX,
162
+ name: "Codex",
163
+ description: "OpenAI Codex CLI agent"
164
+ },
165
+ {
166
+ value: __agiflowai_coding_agent_bridge.GEMINI_CLI,
167
+ name: "Gemini CLI",
168
+ description: "Google Gemini CLI agent"
169
+ },
170
+ {
171
+ value: __agiflowai_coding_agent_bridge.NONE,
172
+ name: "Other",
173
+ description: "Other coding agent or skip MCP configuration"
174
+ }
175
+ ];
176
+ }
177
+ /**
178
+ * Get the coding agent service instance
179
+ * @param agent - The coding agent to get service for
180
+ * @returns The service instance or null if not supported
181
+ */
182
+ getCodingAgentService(agent) {
183
+ if (agent === __agiflowai_coding_agent_bridge.CLAUDE_CODE) return new __agiflowai_coding_agent_bridge.ClaudeCodeService({ workspaceRoot: this.workspaceRoot });
184
+ if (agent === __agiflowai_coding_agent_bridge.CURSOR) return new __agiflowai_coding_agent_bridge.CursorService({ workspaceRoot: this.workspaceRoot });
185
+ if (agent === __agiflowai_coding_agent_bridge.GITHUB_COPILOT) return new __agiflowai_coding_agent_bridge.GitHubCopilotService({ workspaceRoot: this.workspaceRoot });
186
+ if (agent === __agiflowai_coding_agent_bridge.CODEX) return new __agiflowai_coding_agent_bridge.CodexService({ workspaceRoot: this.workspaceRoot });
187
+ if (agent === __agiflowai_coding_agent_bridge.GEMINI_CLI) return new __agiflowai_coding_agent_bridge.GeminiCliService({ workspaceRoot: this.workspaceRoot });
188
+ return null;
189
+ }
190
+ /**
191
+ * Update custom instructions/prompts for the coding agent
192
+ * Appends custom instruction prompt to the agent's configuration
193
+ * @param agent - The coding agent to update
194
+ * @param instructionPrompt - The instruction prompt to append
195
+ * @param customInstructionFile - Optional custom file path to write instructions to (e.g., '.claude/aicode-instructions.md')
196
+ */
197
+ async updateCustomInstructions(agent, instructionPrompt, customInstructionFile) {
198
+ if (agent === __agiflowai_coding_agent_bridge.NONE) {
199
+ __agiflowai_aicode_utils.print.info("Skipping custom instruction update");
200
+ return;
201
+ }
202
+ __agiflowai_aicode_utils.print.info(`\nUpdating custom instructions for ${agent}...`);
203
+ const service = this.getCodingAgentService(agent);
204
+ if (!service) {
205
+ __agiflowai_aicode_utils.print.info(`Custom instruction update for ${agent} is not yet supported.`);
206
+ __agiflowai_aicode_utils.print.info("Please manually add the instructions to your agent configuration.");
207
+ __agiflowai_aicode_utils.print.info("\nInstruction prompt to add:");
208
+ __agiflowai_aicode_utils.print.info(instructionPrompt);
209
+ return;
210
+ }
211
+ await service.updatePrompt({
212
+ systemPrompt: instructionPrompt,
213
+ customInstructionFile,
214
+ marker: true
215
+ });
216
+ if (customInstructionFile) __agiflowai_aicode_utils.print.success(`Custom instructions written to ${customInstructionFile} and referenced in CLAUDE.md and AGENTS.md`);
217
+ else __agiflowai_aicode_utils.print.success(`Custom instructions appended to CLAUDE.md and AGENTS.md`);
218
+ }
219
+ /**
220
+ * Setup MCP configuration for the selected coding agent
221
+ * @param agent - The coding agent to configure
222
+ */
223
+ async setupMCP(agent) {
224
+ if (agent === __agiflowai_coding_agent_bridge.NONE) {
225
+ __agiflowai_aicode_utils.print.info("Skipping MCP configuration");
226
+ return;
227
+ }
228
+ __agiflowai_aicode_utils.print.info(`\nSetting up MCP for ${agent}...`);
229
+ const service = this.getCodingAgentService(agent);
230
+ let configLocation = "";
231
+ let restartInstructions = "";
232
+ if (agent === __agiflowai_coding_agent_bridge.CLAUDE_CODE) {
233
+ configLocation = ".mcp.json";
234
+ restartInstructions = "Restart Claude Code to load the new MCP servers";
235
+ } else if (agent === __agiflowai_coding_agent_bridge.CURSOR) {
236
+ configLocation = "~/.cursor/mcp.json (or .cursor/mcp.json for workspace)";
237
+ restartInstructions = "Restart Cursor to load the new MCP servers";
238
+ } else if (agent === __agiflowai_coding_agent_bridge.GITHUB_COPILOT) {
239
+ configLocation = "~/.copilot/config.json (CLI) or GitHub UI (Coding Agent)";
240
+ restartInstructions = "Restart GitHub Copilot CLI or configure via GitHub repository settings";
241
+ } else if (agent === __agiflowai_coding_agent_bridge.CODEX) {
242
+ configLocation = "~/.codex/config.toml";
243
+ restartInstructions = "Restart Codex CLI to load the new MCP servers";
244
+ } else if (agent === __agiflowai_coding_agent_bridge.GEMINI_CLI) {
245
+ configLocation = "~/.gemini/settings.json";
246
+ restartInstructions = "Restart Gemini CLI to load the new MCP servers";
247
+ }
248
+ if (!service) {
249
+ __agiflowai_aicode_utils.print.info(`MCP configuration for ${agent} is not yet supported.`);
250
+ __agiflowai_aicode_utils.print.info("Please configure MCP servers manually for this coding agent.");
251
+ return;
252
+ }
253
+ await service.updateMcpSettings({ servers: {
254
+ "scaffold-mcp": {
255
+ type: "stdio",
256
+ command: "npx",
257
+ args: [
258
+ "-y",
259
+ "@agiflowai/scaffold-mcp",
260
+ "mcp-serve"
261
+ ],
262
+ disabled: false
263
+ },
264
+ "architect-mcp": {
265
+ type: "stdio",
266
+ command: "npx",
267
+ args: [
268
+ "-y",
269
+ "@agiflowai/architect-mcp",
270
+ "mcp-serve"
271
+ ],
272
+ disabled: false
273
+ }
274
+ } });
275
+ __agiflowai_aicode_utils.print.success(`Added scaffold-mcp and architect-mcp to ${configLocation}`);
276
+ __agiflowai_aicode_utils.print.info("\nNext steps:");
277
+ __agiflowai_aicode_utils.print.indent(`1. ${restartInstructions}`);
278
+ __agiflowai_aicode_utils.print.indent("2. The scaffold-mcp and architect-mcp servers will be available");
279
+ __agiflowai_aicode_utils.print.success("\nMCP configuration completed!");
280
+ }
281
+ };
282
+
106
283
  //#endregion
107
284
  //#region src/utils/banner.ts
108
285
  /**
@@ -284,172 +461,27 @@ async function fetchGitHubDirectoryContents(owner, repo, path$4, branch = "main"
284
461
  }));
285
462
  }
286
463
 
287
- //#endregion
288
- //#region src/services/CodingAgentService.ts
289
- var CodingAgentService = class {
290
- workspaceRoot;
291
- constructor(workspaceRoot) {
292
- this.workspaceRoot = workspaceRoot;
293
- }
294
- /**
295
- * Detect which coding agent is enabled in the workspace
296
- * Checks for Claude Code, Codex, Gemini CLI, GitHub Copilot, and Cursor installations
297
- * @param workspaceRoot - The workspace root directory
298
- * @returns Promise resolving to detected agent ID or null
299
- */
300
- static async detectCodingAgent(workspaceRoot) {
301
- if (await new __agiflowai_coding_agent_bridge.ClaudeCodeService({ workspaceRoot }).isEnabled()) return __agiflowai_coding_agent_bridge.CLAUDE_CODE;
302
- if (await new __agiflowai_coding_agent_bridge.CursorService({ workspaceRoot }).isEnabled()) return __agiflowai_coding_agent_bridge.CURSOR;
303
- if (await new __agiflowai_coding_agent_bridge.GitHubCopilotService({ workspaceRoot }).isEnabled()) return __agiflowai_coding_agent_bridge.GITHUB_COPILOT;
304
- if (await new __agiflowai_coding_agent_bridge.CodexService({ workspaceRoot }).isEnabled()) return __agiflowai_coding_agent_bridge.CODEX;
305
- if (await new __agiflowai_coding_agent_bridge.GeminiCliService({ workspaceRoot }).isEnabled()) return __agiflowai_coding_agent_bridge.GEMINI_CLI;
306
- return null;
307
- }
308
- /**
309
- * Get available coding agents with their descriptions
310
- */
311
- static getAvailableAgents() {
312
- return [
313
- {
314
- value: __agiflowai_coding_agent_bridge.CLAUDE_CODE,
315
- name: "Claude Code",
316
- description: "Anthropic Claude Code CLI agent"
317
- },
318
- {
319
- value: __agiflowai_coding_agent_bridge.CURSOR,
320
- name: "Cursor",
321
- description: "Cursor AI-first code editor"
322
- },
323
- {
324
- value: __agiflowai_coding_agent_bridge.GITHUB_COPILOT,
325
- name: "GitHub Copilot",
326
- description: "GitHub Copilot coding agent and CLI"
327
- },
328
- {
329
- value: __agiflowai_coding_agent_bridge.CODEX,
330
- name: "Codex",
331
- description: "OpenAI Codex CLI agent"
332
- },
333
- {
334
- value: __agiflowai_coding_agent_bridge.GEMINI_CLI,
335
- name: "Gemini CLI",
336
- description: "Google Gemini CLI agent"
337
- },
338
- {
339
- value: __agiflowai_coding_agent_bridge.NONE,
340
- name: "Other",
341
- description: "Other coding agent or skip MCP configuration"
342
- }
343
- ];
344
- }
345
- /**
346
- * Get the coding agent service instance
347
- * @param agent - The coding agent to get service for
348
- * @returns The service instance or null if not supported
349
- */
350
- getCodingAgentService(agent) {
351
- if (agent === __agiflowai_coding_agent_bridge.CLAUDE_CODE) return new __agiflowai_coding_agent_bridge.ClaudeCodeService({ workspaceRoot: this.workspaceRoot });
352
- if (agent === __agiflowai_coding_agent_bridge.CURSOR) return new __agiflowai_coding_agent_bridge.CursorService({ workspaceRoot: this.workspaceRoot });
353
- if (agent === __agiflowai_coding_agent_bridge.GITHUB_COPILOT) return new __agiflowai_coding_agent_bridge.GitHubCopilotService({ workspaceRoot: this.workspaceRoot });
354
- if (agent === __agiflowai_coding_agent_bridge.CODEX) return new __agiflowai_coding_agent_bridge.CodexService({ workspaceRoot: this.workspaceRoot });
355
- if (agent === __agiflowai_coding_agent_bridge.GEMINI_CLI) return new __agiflowai_coding_agent_bridge.GeminiCliService({ workspaceRoot: this.workspaceRoot });
356
- return null;
357
- }
358
- /**
359
- * Update custom instructions/prompts for the coding agent
360
- * Appends custom instruction prompt to the agent's configuration
361
- * @param agent - The coding agent to update
362
- * @param instructionPrompt - The instruction prompt to append
363
- * @param customInstructionFile - Optional custom file path to write instructions to (e.g., '.claude/aicode-instructions.md')
364
- */
365
- async updateCustomInstructions(agent, instructionPrompt, customInstructionFile) {
366
- if (agent === __agiflowai_coding_agent_bridge.NONE) {
367
- __agiflowai_aicode_utils.print.info("Skipping custom instruction update");
368
- return;
369
- }
370
- __agiflowai_aicode_utils.print.info(`\nUpdating custom instructions for ${agent}...`);
371
- const service = this.getCodingAgentService(agent);
372
- if (!service) {
373
- __agiflowai_aicode_utils.print.info(`Custom instruction update for ${agent} is not yet supported.`);
374
- __agiflowai_aicode_utils.print.info("Please manually add the instructions to your agent configuration.");
375
- __agiflowai_aicode_utils.print.info("\nInstruction prompt to add:");
376
- __agiflowai_aicode_utils.print.info(instructionPrompt);
377
- return;
378
- }
379
- await service.updatePrompt({
380
- systemPrompt: instructionPrompt,
381
- customInstructionFile,
382
- marker: true
383
- });
384
- if (customInstructionFile) __agiflowai_aicode_utils.print.success(`Custom instructions written to ${customInstructionFile} and referenced in CLAUDE.md and AGENTS.md`);
385
- else __agiflowai_aicode_utils.print.success(`Custom instructions appended to CLAUDE.md and AGENTS.md`);
386
- }
387
- /**
388
- * Setup MCP configuration for the selected coding agent
389
- * @param agent - The coding agent to configure
390
- */
391
- async setupMCP(agent) {
392
- if (agent === __agiflowai_coding_agent_bridge.NONE) {
393
- __agiflowai_aicode_utils.print.info("Skipping MCP configuration");
394
- return;
395
- }
396
- __agiflowai_aicode_utils.print.info(`\nSetting up MCP for ${agent}...`);
397
- const service = this.getCodingAgentService(agent);
398
- let configLocation = "";
399
- let restartInstructions = "";
400
- if (agent === __agiflowai_coding_agent_bridge.CLAUDE_CODE) {
401
- configLocation = ".mcp.json";
402
- restartInstructions = "Restart Claude Code to load the new MCP servers";
403
- } else if (agent === __agiflowai_coding_agent_bridge.CURSOR) {
404
- configLocation = "~/.cursor/mcp.json (or .cursor/mcp.json for workspace)";
405
- restartInstructions = "Restart Cursor to load the new MCP servers";
406
- } else if (agent === __agiflowai_coding_agent_bridge.GITHUB_COPILOT) {
407
- configLocation = "~/.copilot/config.json (CLI) or GitHub UI (Coding Agent)";
408
- restartInstructions = "Restart GitHub Copilot CLI or configure via GitHub repository settings";
409
- } else if (agent === __agiflowai_coding_agent_bridge.CODEX) {
410
- configLocation = "~/.codex/config.toml";
411
- restartInstructions = "Restart Codex CLI to load the new MCP servers";
412
- } else if (agent === __agiflowai_coding_agent_bridge.GEMINI_CLI) {
413
- configLocation = "~/.gemini/settings.json";
414
- restartInstructions = "Restart Gemini CLI to load the new MCP servers";
415
- }
416
- if (!service) {
417
- __agiflowai_aicode_utils.print.info(`MCP configuration for ${agent} is not yet supported.`);
418
- __agiflowai_aicode_utils.print.info("Please configure MCP servers manually for this coding agent.");
419
- return;
420
- }
421
- await service.updateMcpSettings({ servers: {
422
- "scaffold-mcp": {
423
- type: "stdio",
424
- command: "npx",
425
- args: [
426
- "-y",
427
- "@agiflowai/scaffold-mcp",
428
- "mcp-serve"
429
- ],
430
- disabled: false
431
- },
432
- "architect-mcp": {
433
- type: "stdio",
434
- command: "npx",
435
- args: [
436
- "-y",
437
- "@agiflowai/architect-mcp",
438
- "mcp-serve"
439
- ],
440
- disabled: false
441
- }
442
- } });
443
- __agiflowai_aicode_utils.print.success(`Added scaffold-mcp and architect-mcp to ${configLocation}`);
444
- __agiflowai_aicode_utils.print.info("\nNext steps:");
445
- __agiflowai_aicode_utils.print.indent(`1. ${restartInstructions}`);
446
- __agiflowai_aicode_utils.print.indent("2. The scaffold-mcp and architect-mcp servers will be available");
447
- __agiflowai_aicode_utils.print.success("\nMCP configuration completed!");
448
- }
449
- };
450
-
451
464
  //#endregion
452
465
  //#region src/services/NewProjectService.ts
466
+ /**
467
+ * NewProjectService
468
+ *
469
+ * DESIGN PATTERNS:
470
+ * - Service pattern for business logic encapsulation
471
+ * - Single responsibility principle
472
+ * - No UI interaction (prompts handled by CLI layer)
473
+ *
474
+ * CODING STANDARDS:
475
+ * - Use async/await for asynchronous operations
476
+ * - Throw descriptive errors for error cases
477
+ * - Keep methods focused and well-named
478
+ * - Document complex logic with comments
479
+ *
480
+ * AVOID:
481
+ * - Mixing concerns (keep focused on single domain)
482
+ * - Direct UI interaction (no @inquirer/prompts in services)
483
+ * - Direct tool implementation (services should be tool-agnostic)
484
+ */
453
485
  const RESERVED_PROJECT_NAMES = [
454
486
  ".",
455
487
  "..",
@@ -574,6 +606,18 @@ var openspec_default = "When working on this project, follow the OpenSpec spec-d
574
606
  //#endregion
575
607
  //#region src/specs/openspec.ts
576
608
  /**
609
+ * OpenSpec Bridge Implementation
610
+ *
611
+ * DESIGN PATTERNS:
612
+ * - Bridge pattern implementation for OpenSpec
613
+ * - Singleton pattern for OpenSpec configuration
614
+ *
615
+ * CODING STANDARDS:
616
+ * - Implement ISpecBridge interface
617
+ * - Use async/await for I/O operations
618
+ * - Handle errors with descriptive messages
619
+ */
620
+ /**
577
621
  * OpenSpec configuration
578
622
  */
579
623
  const OPENSPEC_CONFIG = {
@@ -639,6 +683,18 @@ var OpenSpecBridge = class {
639
683
  //#endregion
640
684
  //#region src/services/SpecToolService.ts
641
685
  /**
686
+ * Spec Tool Service
687
+ *
688
+ * DESIGN PATTERNS:
689
+ * - Service pattern for spec tool detection and installation
690
+ * - Bridge pattern to abstract spec tool implementations
691
+ *
692
+ * CODING STANDARDS:
693
+ * - Use async/await for asynchronous operations
694
+ * - Handle errors with try/catch blocks
695
+ * - Use descriptive method names
696
+ */
697
+ /**
642
698
  * Available spec tools
643
699
  */
644
700
  let SpecTool = /* @__PURE__ */ function(SpecTool$1) {
@@ -716,6 +772,22 @@ var SpecToolService = class {
716
772
 
717
773
  //#endregion
718
774
  //#region src/services/TemplateSelectionService.ts
775
+ /**
776
+ * TemplateSelectionService
777
+ *
778
+ * DESIGN PATTERNS:
779
+ * - Service pattern for business logic encapsulation
780
+ * - Single responsibility: Handle template download, listing, and selection
781
+ *
782
+ * CODING STANDARDS:
783
+ * - Use async/await for asynchronous operations
784
+ * - Throw descriptive errors for error cases
785
+ * - Document methods with JSDoc comments
786
+ *
787
+ * AVOID:
788
+ * - Direct UI interaction (no prompts in services)
789
+ * - Mixing concerns beyond template management
790
+ */
719
791
  var TemplateSelectionService = class {
720
792
  tmpDir;
721
793
  constructor(existingTmpDir) {
@@ -888,6 +960,23 @@ var TemplateSelectionService = class {
888
960
 
889
961
  //#endregion
890
962
  //#region src/services/TemplatesService.ts
963
+ /**
964
+ * TemplatesService
965
+ *
966
+ * DESIGN PATTERNS:
967
+ * - Service pattern for business logic encapsulation
968
+ * - Single responsibility principle
969
+ *
970
+ * CODING STANDARDS:
971
+ * - Use async/await for asynchronous operations
972
+ * - Throw descriptive errors for error cases
973
+ * - Keep methods focused and well-named
974
+ * - Document complex logic with comments
975
+ *
976
+ * AVOID:
977
+ * - Mixing concerns (keep focused on single domain)
978
+ * - Direct tool implementation (services should be tool-agnostic)
979
+ */
891
980
  var TemplatesService = class {
892
981
  /**
893
982
  * Download templates from a GitHub repository with UI feedback
@@ -1,10 +1,10 @@
1
- import path from "node:path";
1
+ import { CLAUDE_CODE, CODEX, CURSOR, ClaudeCodeService, CodexService, CursorService, GEMINI_CLI, GITHUB_COPILOT, GeminiCliService, GitHubCopilotService, NONE } from "@agiflowai/coding-agent-bridge";
2
2
  import { ProjectType, messages, print } from "@agiflowai/aicode-utils";
3
3
  import * as fs$1 from "fs-extra";
4
4
  import chalk from "chalk";
5
5
  import gradient from "gradient-string";
6
+ import path from "node:path";
6
7
  import { execa } from "execa";
7
- import { CLAUDE_CODE, CODEX, CURSOR, ClaudeCodeService, CodexService, CursorService, GEMINI_CLI, GITHUB_COPILOT, GeminiCliService, GitHubCopilotService, NONE } from "@agiflowai/coding-agent-bridge";
8
8
  import fs from "node:fs/promises";
9
9
  import { Liquid } from "liquidjs";
10
10
  import os from "node:os";
@@ -70,6 +70,187 @@ const BANNER_GRADIENT = [
70
70
  THEME.colors.secondary.dark
71
71
  ];
72
72
 
73
+ //#endregion
74
+ //#region src/services/CodingAgentService.ts
75
+ /**
76
+ * CodingAgentService
77
+ *
78
+ * DESIGN PATTERNS:
79
+ * - Service pattern for business logic encapsulation
80
+ * - Strategy pattern for different agent configurations
81
+ * - Single responsibility: Handle MCP setup for coding agents
82
+ *
83
+ * CODING STANDARDS:
84
+ * - Use async/await for asynchronous operations
85
+ * - Throw descriptive errors for error cases
86
+ * - Document methods with JSDoc comments
87
+ *
88
+ * AVOID:
89
+ * - Direct UI interaction (no prompts in services)
90
+ * - Hard-coding agent configurations (use strategies)
91
+ */
92
+ var CodingAgentService = class {
93
+ workspaceRoot;
94
+ constructor(workspaceRoot) {
95
+ this.workspaceRoot = workspaceRoot;
96
+ }
97
+ /**
98
+ * Detect which coding agent is enabled in the workspace
99
+ * Checks for Claude Code, Codex, Gemini CLI, GitHub Copilot, and Cursor installations
100
+ * @param workspaceRoot - The workspace root directory
101
+ * @returns Promise resolving to detected agent ID or null
102
+ */
103
+ static async detectCodingAgent(workspaceRoot) {
104
+ if (await new ClaudeCodeService({ workspaceRoot }).isEnabled()) return CLAUDE_CODE;
105
+ if (await new CursorService({ workspaceRoot }).isEnabled()) return CURSOR;
106
+ if (await new GitHubCopilotService({ workspaceRoot }).isEnabled()) return GITHUB_COPILOT;
107
+ if (await new CodexService({ workspaceRoot }).isEnabled()) return CODEX;
108
+ if (await new GeminiCliService({ workspaceRoot }).isEnabled()) return GEMINI_CLI;
109
+ return null;
110
+ }
111
+ /**
112
+ * Get available coding agents with their descriptions
113
+ */
114
+ static getAvailableAgents() {
115
+ return [
116
+ {
117
+ value: CLAUDE_CODE,
118
+ name: "Claude Code",
119
+ description: "Anthropic Claude Code CLI agent"
120
+ },
121
+ {
122
+ value: CURSOR,
123
+ name: "Cursor",
124
+ description: "Cursor AI-first code editor"
125
+ },
126
+ {
127
+ value: GITHUB_COPILOT,
128
+ name: "GitHub Copilot",
129
+ description: "GitHub Copilot coding agent and CLI"
130
+ },
131
+ {
132
+ value: CODEX,
133
+ name: "Codex",
134
+ description: "OpenAI Codex CLI agent"
135
+ },
136
+ {
137
+ value: GEMINI_CLI,
138
+ name: "Gemini CLI",
139
+ description: "Google Gemini CLI agent"
140
+ },
141
+ {
142
+ value: NONE,
143
+ name: "Other",
144
+ description: "Other coding agent or skip MCP configuration"
145
+ }
146
+ ];
147
+ }
148
+ /**
149
+ * Get the coding agent service instance
150
+ * @param agent - The coding agent to get service for
151
+ * @returns The service instance or null if not supported
152
+ */
153
+ getCodingAgentService(agent) {
154
+ if (agent === CLAUDE_CODE) return new ClaudeCodeService({ workspaceRoot: this.workspaceRoot });
155
+ if (agent === CURSOR) return new CursorService({ workspaceRoot: this.workspaceRoot });
156
+ if (agent === GITHUB_COPILOT) return new GitHubCopilotService({ workspaceRoot: this.workspaceRoot });
157
+ if (agent === CODEX) return new CodexService({ workspaceRoot: this.workspaceRoot });
158
+ if (agent === GEMINI_CLI) return new GeminiCliService({ workspaceRoot: this.workspaceRoot });
159
+ return null;
160
+ }
161
+ /**
162
+ * Update custom instructions/prompts for the coding agent
163
+ * Appends custom instruction prompt to the agent's configuration
164
+ * @param agent - The coding agent to update
165
+ * @param instructionPrompt - The instruction prompt to append
166
+ * @param customInstructionFile - Optional custom file path to write instructions to (e.g., '.claude/aicode-instructions.md')
167
+ */
168
+ async updateCustomInstructions(agent, instructionPrompt, customInstructionFile) {
169
+ if (agent === NONE) {
170
+ print.info("Skipping custom instruction update");
171
+ return;
172
+ }
173
+ print.info(`\nUpdating custom instructions for ${agent}...`);
174
+ const service = this.getCodingAgentService(agent);
175
+ if (!service) {
176
+ print.info(`Custom instruction update for ${agent} is not yet supported.`);
177
+ print.info("Please manually add the instructions to your agent configuration.");
178
+ print.info("\nInstruction prompt to add:");
179
+ print.info(instructionPrompt);
180
+ return;
181
+ }
182
+ await service.updatePrompt({
183
+ systemPrompt: instructionPrompt,
184
+ customInstructionFile,
185
+ marker: true
186
+ });
187
+ if (customInstructionFile) print.success(`Custom instructions written to ${customInstructionFile} and referenced in CLAUDE.md and AGENTS.md`);
188
+ else print.success(`Custom instructions appended to CLAUDE.md and AGENTS.md`);
189
+ }
190
+ /**
191
+ * Setup MCP configuration for the selected coding agent
192
+ * @param agent - The coding agent to configure
193
+ */
194
+ async setupMCP(agent) {
195
+ if (agent === NONE) {
196
+ print.info("Skipping MCP configuration");
197
+ return;
198
+ }
199
+ print.info(`\nSetting up MCP for ${agent}...`);
200
+ const service = this.getCodingAgentService(agent);
201
+ let configLocation = "";
202
+ let restartInstructions = "";
203
+ if (agent === CLAUDE_CODE) {
204
+ configLocation = ".mcp.json";
205
+ restartInstructions = "Restart Claude Code to load the new MCP servers";
206
+ } else if (agent === CURSOR) {
207
+ configLocation = "~/.cursor/mcp.json (or .cursor/mcp.json for workspace)";
208
+ restartInstructions = "Restart Cursor to load the new MCP servers";
209
+ } else if (agent === GITHUB_COPILOT) {
210
+ configLocation = "~/.copilot/config.json (CLI) or GitHub UI (Coding Agent)";
211
+ restartInstructions = "Restart GitHub Copilot CLI or configure via GitHub repository settings";
212
+ } else if (agent === CODEX) {
213
+ configLocation = "~/.codex/config.toml";
214
+ restartInstructions = "Restart Codex CLI to load the new MCP servers";
215
+ } else if (agent === GEMINI_CLI) {
216
+ configLocation = "~/.gemini/settings.json";
217
+ restartInstructions = "Restart Gemini CLI to load the new MCP servers";
218
+ }
219
+ if (!service) {
220
+ print.info(`MCP configuration for ${agent} is not yet supported.`);
221
+ print.info("Please configure MCP servers manually for this coding agent.");
222
+ return;
223
+ }
224
+ await service.updateMcpSettings({ servers: {
225
+ "scaffold-mcp": {
226
+ type: "stdio",
227
+ command: "npx",
228
+ args: [
229
+ "-y",
230
+ "@agiflowai/scaffold-mcp",
231
+ "mcp-serve"
232
+ ],
233
+ disabled: false
234
+ },
235
+ "architect-mcp": {
236
+ type: "stdio",
237
+ command: "npx",
238
+ args: [
239
+ "-y",
240
+ "@agiflowai/architect-mcp",
241
+ "mcp-serve"
242
+ ],
243
+ disabled: false
244
+ }
245
+ } });
246
+ print.success(`Added scaffold-mcp and architect-mcp to ${configLocation}`);
247
+ print.info("\nNext steps:");
248
+ print.indent(`1. ${restartInstructions}`);
249
+ print.indent("2. The scaffold-mcp and architect-mcp servers will be available");
250
+ print.success("\nMCP configuration completed!");
251
+ }
252
+ };
253
+
73
254
  //#endregion
74
255
  //#region src/utils/banner.ts
75
256
  /**
@@ -251,172 +432,27 @@ async function fetchGitHubDirectoryContents(owner, repo, path$1, branch = "main"
251
432
  }));
252
433
  }
253
434
 
254
- //#endregion
255
- //#region src/services/CodingAgentService.ts
256
- var CodingAgentService = class {
257
- workspaceRoot;
258
- constructor(workspaceRoot) {
259
- this.workspaceRoot = workspaceRoot;
260
- }
261
- /**
262
- * Detect which coding agent is enabled in the workspace
263
- * Checks for Claude Code, Codex, Gemini CLI, GitHub Copilot, and Cursor installations
264
- * @param workspaceRoot - The workspace root directory
265
- * @returns Promise resolving to detected agent ID or null
266
- */
267
- static async detectCodingAgent(workspaceRoot) {
268
- if (await new ClaudeCodeService({ workspaceRoot }).isEnabled()) return CLAUDE_CODE;
269
- if (await new CursorService({ workspaceRoot }).isEnabled()) return CURSOR;
270
- if (await new GitHubCopilotService({ workspaceRoot }).isEnabled()) return GITHUB_COPILOT;
271
- if (await new CodexService({ workspaceRoot }).isEnabled()) return CODEX;
272
- if (await new GeminiCliService({ workspaceRoot }).isEnabled()) return GEMINI_CLI;
273
- return null;
274
- }
275
- /**
276
- * Get available coding agents with their descriptions
277
- */
278
- static getAvailableAgents() {
279
- return [
280
- {
281
- value: CLAUDE_CODE,
282
- name: "Claude Code",
283
- description: "Anthropic Claude Code CLI agent"
284
- },
285
- {
286
- value: CURSOR,
287
- name: "Cursor",
288
- description: "Cursor AI-first code editor"
289
- },
290
- {
291
- value: GITHUB_COPILOT,
292
- name: "GitHub Copilot",
293
- description: "GitHub Copilot coding agent and CLI"
294
- },
295
- {
296
- value: CODEX,
297
- name: "Codex",
298
- description: "OpenAI Codex CLI agent"
299
- },
300
- {
301
- value: GEMINI_CLI,
302
- name: "Gemini CLI",
303
- description: "Google Gemini CLI agent"
304
- },
305
- {
306
- value: NONE,
307
- name: "Other",
308
- description: "Other coding agent or skip MCP configuration"
309
- }
310
- ];
311
- }
312
- /**
313
- * Get the coding agent service instance
314
- * @param agent - The coding agent to get service for
315
- * @returns The service instance or null if not supported
316
- */
317
- getCodingAgentService(agent) {
318
- if (agent === CLAUDE_CODE) return new ClaudeCodeService({ workspaceRoot: this.workspaceRoot });
319
- if (agent === CURSOR) return new CursorService({ workspaceRoot: this.workspaceRoot });
320
- if (agent === GITHUB_COPILOT) return new GitHubCopilotService({ workspaceRoot: this.workspaceRoot });
321
- if (agent === CODEX) return new CodexService({ workspaceRoot: this.workspaceRoot });
322
- if (agent === GEMINI_CLI) return new GeminiCliService({ workspaceRoot: this.workspaceRoot });
323
- return null;
324
- }
325
- /**
326
- * Update custom instructions/prompts for the coding agent
327
- * Appends custom instruction prompt to the agent's configuration
328
- * @param agent - The coding agent to update
329
- * @param instructionPrompt - The instruction prompt to append
330
- * @param customInstructionFile - Optional custom file path to write instructions to (e.g., '.claude/aicode-instructions.md')
331
- */
332
- async updateCustomInstructions(agent, instructionPrompt, customInstructionFile) {
333
- if (agent === NONE) {
334
- print.info("Skipping custom instruction update");
335
- return;
336
- }
337
- print.info(`\nUpdating custom instructions for ${agent}...`);
338
- const service = this.getCodingAgentService(agent);
339
- if (!service) {
340
- print.info(`Custom instruction update for ${agent} is not yet supported.`);
341
- print.info("Please manually add the instructions to your agent configuration.");
342
- print.info("\nInstruction prompt to add:");
343
- print.info(instructionPrompt);
344
- return;
345
- }
346
- await service.updatePrompt({
347
- systemPrompt: instructionPrompt,
348
- customInstructionFile,
349
- marker: true
350
- });
351
- if (customInstructionFile) print.success(`Custom instructions written to ${customInstructionFile} and referenced in CLAUDE.md and AGENTS.md`);
352
- else print.success(`Custom instructions appended to CLAUDE.md and AGENTS.md`);
353
- }
354
- /**
355
- * Setup MCP configuration for the selected coding agent
356
- * @param agent - The coding agent to configure
357
- */
358
- async setupMCP(agent) {
359
- if (agent === NONE) {
360
- print.info("Skipping MCP configuration");
361
- return;
362
- }
363
- print.info(`\nSetting up MCP for ${agent}...`);
364
- const service = this.getCodingAgentService(agent);
365
- let configLocation = "";
366
- let restartInstructions = "";
367
- if (agent === CLAUDE_CODE) {
368
- configLocation = ".mcp.json";
369
- restartInstructions = "Restart Claude Code to load the new MCP servers";
370
- } else if (agent === CURSOR) {
371
- configLocation = "~/.cursor/mcp.json (or .cursor/mcp.json for workspace)";
372
- restartInstructions = "Restart Cursor to load the new MCP servers";
373
- } else if (agent === GITHUB_COPILOT) {
374
- configLocation = "~/.copilot/config.json (CLI) or GitHub UI (Coding Agent)";
375
- restartInstructions = "Restart GitHub Copilot CLI or configure via GitHub repository settings";
376
- } else if (agent === CODEX) {
377
- configLocation = "~/.codex/config.toml";
378
- restartInstructions = "Restart Codex CLI to load the new MCP servers";
379
- } else if (agent === GEMINI_CLI) {
380
- configLocation = "~/.gemini/settings.json";
381
- restartInstructions = "Restart Gemini CLI to load the new MCP servers";
382
- }
383
- if (!service) {
384
- print.info(`MCP configuration for ${agent} is not yet supported.`);
385
- print.info("Please configure MCP servers manually for this coding agent.");
386
- return;
387
- }
388
- await service.updateMcpSettings({ servers: {
389
- "scaffold-mcp": {
390
- type: "stdio",
391
- command: "npx",
392
- args: [
393
- "-y",
394
- "@agiflowai/scaffold-mcp",
395
- "mcp-serve"
396
- ],
397
- disabled: false
398
- },
399
- "architect-mcp": {
400
- type: "stdio",
401
- command: "npx",
402
- args: [
403
- "-y",
404
- "@agiflowai/architect-mcp",
405
- "mcp-serve"
406
- ],
407
- disabled: false
408
- }
409
- } });
410
- print.success(`Added scaffold-mcp and architect-mcp to ${configLocation}`);
411
- print.info("\nNext steps:");
412
- print.indent(`1. ${restartInstructions}`);
413
- print.indent("2. The scaffold-mcp and architect-mcp servers will be available");
414
- print.success("\nMCP configuration completed!");
415
- }
416
- };
417
-
418
435
  //#endregion
419
436
  //#region src/services/NewProjectService.ts
437
+ /**
438
+ * NewProjectService
439
+ *
440
+ * DESIGN PATTERNS:
441
+ * - Service pattern for business logic encapsulation
442
+ * - Single responsibility principle
443
+ * - No UI interaction (prompts handled by CLI layer)
444
+ *
445
+ * CODING STANDARDS:
446
+ * - Use async/await for asynchronous operations
447
+ * - Throw descriptive errors for error cases
448
+ * - Keep methods focused and well-named
449
+ * - Document complex logic with comments
450
+ *
451
+ * AVOID:
452
+ * - Mixing concerns (keep focused on single domain)
453
+ * - Direct UI interaction (no @inquirer/prompts in services)
454
+ * - Direct tool implementation (services should be tool-agnostic)
455
+ */
420
456
  const RESERVED_PROJECT_NAMES = [
421
457
  ".",
422
458
  "..",
@@ -541,6 +577,18 @@ var openspec_default = "When working on this project, follow the OpenSpec spec-d
541
577
  //#endregion
542
578
  //#region src/specs/openspec.ts
543
579
  /**
580
+ * OpenSpec Bridge Implementation
581
+ *
582
+ * DESIGN PATTERNS:
583
+ * - Bridge pattern implementation for OpenSpec
584
+ * - Singleton pattern for OpenSpec configuration
585
+ *
586
+ * CODING STANDARDS:
587
+ * - Implement ISpecBridge interface
588
+ * - Use async/await for I/O operations
589
+ * - Handle errors with descriptive messages
590
+ */
591
+ /**
544
592
  * OpenSpec configuration
545
593
  */
546
594
  const OPENSPEC_CONFIG = {
@@ -606,6 +654,18 @@ var OpenSpecBridge = class {
606
654
  //#endregion
607
655
  //#region src/services/SpecToolService.ts
608
656
  /**
657
+ * Spec Tool Service
658
+ *
659
+ * DESIGN PATTERNS:
660
+ * - Service pattern for spec tool detection and installation
661
+ * - Bridge pattern to abstract spec tool implementations
662
+ *
663
+ * CODING STANDARDS:
664
+ * - Use async/await for asynchronous operations
665
+ * - Handle errors with try/catch blocks
666
+ * - Use descriptive method names
667
+ */
668
+ /**
609
669
  * Available spec tools
610
670
  */
611
671
  let SpecTool = /* @__PURE__ */ function(SpecTool$1) {
@@ -683,6 +743,22 @@ var SpecToolService = class {
683
743
 
684
744
  //#endregion
685
745
  //#region src/services/TemplateSelectionService.ts
746
+ /**
747
+ * TemplateSelectionService
748
+ *
749
+ * DESIGN PATTERNS:
750
+ * - Service pattern for business logic encapsulation
751
+ * - Single responsibility: Handle template download, listing, and selection
752
+ *
753
+ * CODING STANDARDS:
754
+ * - Use async/await for asynchronous operations
755
+ * - Throw descriptive errors for error cases
756
+ * - Document methods with JSDoc comments
757
+ *
758
+ * AVOID:
759
+ * - Direct UI interaction (no prompts in services)
760
+ * - Mixing concerns beyond template management
761
+ */
686
762
  var TemplateSelectionService = class {
687
763
  tmpDir;
688
764
  constructor(existingTmpDir) {
@@ -793,7 +869,7 @@ var TemplateSelectionService = class {
793
869
  * @param selectedMcpServers - Selected MCP servers
794
870
  */
795
871
  async copyTemplateWithMcpFilter(sourcePath, targetPath, selectedMcpServers) {
796
- const { MCPServer: MCPServer$1, MCP_CONFIG_FILES: MCP_CONFIG_FILES$1 } = await import("./mcp-CZIiB-6Y.js");
872
+ const { MCPServer: MCPServer$1, MCP_CONFIG_FILES: MCP_CONFIG_FILES$1 } = await import("./mcp-BgNkvV6h.mjs");
797
873
  const architectFiles = MCP_CONFIG_FILES$1[MCPServer$1.ARCHITECT];
798
874
  const hasArchitect = selectedMcpServers.includes(MCPServer$1.ARCHITECT);
799
875
  const hasScaffold = selectedMcpServers.includes(MCPServer$1.SCAFFOLD);
@@ -855,6 +931,23 @@ var TemplateSelectionService = class {
855
931
 
856
932
  //#endregion
857
933
  //#region src/services/TemplatesService.ts
934
+ /**
935
+ * TemplatesService
936
+ *
937
+ * DESIGN PATTERNS:
938
+ * - Service pattern for business logic encapsulation
939
+ * - Single responsibility principle
940
+ *
941
+ * CODING STANDARDS:
942
+ * - Use async/await for asynchronous operations
943
+ * - Throw descriptive errors for error cases
944
+ * - Keep methods focused and well-named
945
+ * - Document complex logic with comments
946
+ *
947
+ * AVOID:
948
+ * - Mixing concerns (keep focused on single domain)
949
+ * - Direct tool implementation (services should be tool-agnostic)
950
+ */
858
951
  var TemplatesService = class {
859
952
  /**
860
953
  * Download templates from a GitHub repository with UI feedback
@@ -933,4 +1026,4 @@ See existing templates for examples and documentation for more details.
933
1026
  };
934
1027
 
935
1028
  //#endregion
936
- export { BANNER_GRADIENT, CodingAgentService, NewProjectService, SPEC_TOOL_INFO, SpecTool, SpecToolService, THEME, TemplateSelectionService, TemplatesService, cloneRepository, cloneSubdirectory, displayBanner, displayCompactBanner, fetchGitHubDirectoryContents, findWorkspaceRoot, gitInit, parseGitHubUrl };
1029
+ export { THEME as _, SpecToolService as a, cloneSubdirectory as c, gitInit as d, parseGitHubUrl as f, BANNER_GRADIENT as g, CodingAgentService as h, SpecTool as i, fetchGitHubDirectoryContents as l, displayCompactBanner as m, TemplateSelectionService as n, NewProjectService as o, displayBanner as p, SPEC_TOOL_INFO as r, cloneRepository as s, TemplatesService as t, findWorkspaceRoot as u };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@agiflowai/aicode-toolkit",
3
3
  "description": "AI-powered code toolkit CLI for scaffolding, architecture management, and development workflows",
4
- "version": "1.0.2",
4
+ "version": "1.0.4",
5
5
  "license": "AGPL-3.0",
6
6
  "author": "AgiflowIO",
7
7
  "repository": {
@@ -29,7 +29,7 @@
29
29
  },
30
30
  "main": "./dist/index.cjs",
31
31
  "types": "./dist/index.d.cts",
32
- "module": "./dist/index.js",
32
+ "module": "./dist/index.mjs",
33
33
  "files": [
34
34
  "dist",
35
35
  "README.md"
@@ -51,15 +51,15 @@
51
51
  "pino-pretty": "^13.1.1",
52
52
  "xstate": "^5.23.0",
53
53
  "zod": "3.25.76",
54
- "@agiflowai/aicode-utils": "1.0.2",
55
- "@agiflowai/coding-agent-bridge": "1.0.2"
54
+ "@agiflowai/aicode-utils": "1.0.3",
55
+ "@agiflowai/coding-agent-bridge": "1.0.4"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@types/express": "^5.0.0",
59
59
  "@types/fs-extra": "^11.0.4",
60
60
  "@types/js-yaml": "^4.0.9",
61
61
  "@types/node": "^22.0.0",
62
- "tsdown": "^0.15.6",
62
+ "tsdown": "^0.16.4",
63
63
  "typescript": "5.9.3",
64
64
  "unplugin-raw": "^0.6.3"
65
65
  },
@@ -69,11 +69,11 @@
69
69
  "type": "module",
70
70
  "exports": {
71
71
  ".": {
72
- "import": "./dist/index.js",
72
+ "import": "./dist/index.mjs",
73
73
  "require": "./dist/index.cjs"
74
74
  },
75
75
  "./cli": {
76
- "import": "./dist/cli.js",
76
+ "import": "./dist/cli.mjs",
77
77
  "require": "./dist/cli.cjs"
78
78
  },
79
79
  "./package.json": "./package.json"
package/dist/index.js DELETED
@@ -1,4 +0,0 @@
1
- import "./mcp-BmhiAfeF.js";
2
- import { BANNER_GRADIENT, CodingAgentService, NewProjectService, THEME, TemplateSelectionService, TemplatesService, cloneRepository, cloneSubdirectory, displayBanner, displayCompactBanner, fetchGitHubDirectoryContents, findWorkspaceRoot, gitInit, parseGitHubUrl } from "./services-zrdafWTg.js";
3
-
4
- export { BANNER_GRADIENT, CodingAgentService, NewProjectService, THEME, TemplateSelectionService, TemplatesService, cloneRepository, cloneSubdirectory, displayBanner, displayCompactBanner, fetchGitHubDirectoryContents, findWorkspaceRoot, gitInit, parseGitHubUrl };
@@ -1,3 +0,0 @@
1
- import { MCPServer, MCP_CONFIG_FILES, MCP_SERVER_INFO } from "./mcp-BmhiAfeF.js";
2
-
3
- export { MCPServer, MCP_CONFIG_FILES };
File without changes