@agiflowai/scaffold-mcp 0.3.3 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- const require_chunk = require('./chunk-nOFOJqeH.js');
1
+ const require_chunk = require('./chunk-CUT6urMc.cjs');
2
2
  let node_path = require("node:path");
3
3
  node_path = require_chunk.__toESM(node_path);
4
4
  let js_yaml = require("js-yaml");
@@ -1,3 +1,3 @@
1
- const require_ScaffoldConfigLoader = require('./ScaffoldConfigLoader-CvIJEFcI.js');
1
+ const require_ScaffoldConfigLoader = require('./ScaffoldConfigLoader-BrmvENTo.cjs');
2
2
 
3
3
  exports.ScaffoldConfigLoader = require_ScaffoldConfigLoader.ScaffoldConfigLoader;
@@ -1,9 +1,9 @@
1
- const require_chunk = require('./chunk-nOFOJqeH.js');
2
- const require_logger = require('./logger-qztMS7ET.js');
1
+ const require_chunk = require('./chunk-CUT6urMc.cjs');
2
+ const require_logger = require('./logger-DqgpBYuP.cjs');
3
3
  let node_path = require("node:path");
4
4
  node_path = require_chunk.__toESM(node_path);
5
- let fs_extra = require("fs-extra");
6
- fs_extra = require_chunk.__toESM(fs_extra);
5
+ let __agiflowai_aicode_utils = require("@agiflowai/aicode-utils");
6
+ __agiflowai_aicode_utils = require_chunk.__toESM(__agiflowai_aicode_utils);
7
7
  let node_url = require("node:url");
8
8
  node_url = require_chunk.__toESM(node_url);
9
9
 
@@ -106,119 +106,6 @@ var ScaffoldProcessingService = class {
106
106
  }
107
107
  };
108
108
 
109
- //#endregion
110
- //#region src/services/TemplatesManager.ts
111
- var TemplatesManager = class TemplatesManager {
112
- static SCAFFOLD_CONFIG_FILE = "scaffold.yaml";
113
- static TEMPLATES_FOLDER = "templates";
114
- static TOOLKIT_CONFIG_FILE = "toolkit.yaml";
115
- /**
116
- * Find the templates directory by searching upwards from the starting path.
117
- *
118
- * Algorithm:
119
- * 1. Start from the provided path (default: current working directory)
120
- * 2. Search upwards to find the workspace root (where .git exists or filesystem root)
121
- * 3. Check if toolkit.yaml exists at workspace root
122
- * - If yes, read templatesPath from toolkit.yaml
123
- * - If no, default to 'templates' folder in workspace root
124
- * 4. Verify the templates directory exists
125
- *
126
- * @param startPath - The path to start searching from (defaults to process.cwd())
127
- * @returns The absolute path to the templates directory
128
- * @throws Error if templates directory is not found
129
- */
130
- static async findTemplatesPath(startPath = process.cwd()) {
131
- const workspaceRoot = await TemplatesManager.findWorkspaceRoot(startPath);
132
- const toolkitConfigPath = node_path.default.join(workspaceRoot, TemplatesManager.TOOLKIT_CONFIG_FILE);
133
- if (await fs_extra.pathExists(toolkitConfigPath)) {
134
- const yaml = await import("js-yaml");
135
- const content = await fs_extra.readFile(toolkitConfigPath, "utf-8");
136
- const config = yaml.load(content);
137
- if (config?.templatesPath) {
138
- const templatesPath$1 = node_path.default.isAbsolute(config.templatesPath) ? config.templatesPath : node_path.default.join(workspaceRoot, config.templatesPath);
139
- if (await fs_extra.pathExists(templatesPath$1)) return templatesPath$1;
140
- else throw new Error(`Templates path specified in toolkit.yaml does not exist: ${templatesPath$1}`);
141
- }
142
- }
143
- const templatesPath = node_path.default.join(workspaceRoot, TemplatesManager.TEMPLATES_FOLDER);
144
- if (await fs_extra.pathExists(templatesPath)) return templatesPath;
145
- throw new Error(`Templates folder not found at ${templatesPath}.\nEither create a 'templates' folder or specify templatesPath in toolkit.yaml`);
146
- }
147
- /**
148
- * Find the workspace root by searching upwards for .git folder
149
- */
150
- static async findWorkspaceRoot(startPath) {
151
- let currentPath = node_path.default.resolve(startPath);
152
- const rootPath = node_path.default.parse(currentPath).root;
153
- while (true) {
154
- const gitPath = node_path.default.join(currentPath, ".git");
155
- if (await fs_extra.pathExists(gitPath)) return currentPath;
156
- if (currentPath === rootPath) return process.cwd();
157
- currentPath = node_path.default.dirname(currentPath);
158
- }
159
- }
160
- /**
161
- * Get the templates path synchronously.
162
- * Use this when you need immediate access and are sure templates exist.
163
- *
164
- * @param startPath - The path to start searching from (defaults to process.cwd())
165
- * @returns The absolute path to the templates directory
166
- * @throws Error if templates directory is not found
167
- */
168
- static findTemplatesPathSync(startPath = process.cwd()) {
169
- const workspaceRoot = TemplatesManager.findWorkspaceRootSync(startPath);
170
- const toolkitConfigPath = node_path.default.join(workspaceRoot, TemplatesManager.TOOLKIT_CONFIG_FILE);
171
- if (fs_extra.pathExistsSync(toolkitConfigPath)) {
172
- const yaml = require("js-yaml");
173
- const content = fs_extra.readFileSync(toolkitConfigPath, "utf-8");
174
- const config = yaml.load(content);
175
- if (config?.templatesPath) {
176
- const templatesPath$1 = node_path.default.isAbsolute(config.templatesPath) ? config.templatesPath : node_path.default.join(workspaceRoot, config.templatesPath);
177
- if (fs_extra.pathExistsSync(templatesPath$1)) return templatesPath$1;
178
- else throw new Error(`Templates path specified in toolkit.yaml does not exist: ${templatesPath$1}`);
179
- }
180
- }
181
- const templatesPath = node_path.default.join(workspaceRoot, TemplatesManager.TEMPLATES_FOLDER);
182
- if (fs_extra.pathExistsSync(templatesPath)) return templatesPath;
183
- throw new Error(`Templates folder not found at ${templatesPath}.\nEither create a 'templates' folder or specify templatesPath in toolkit.yaml`);
184
- }
185
- /**
186
- * Find the workspace root synchronously by searching upwards for .git folder
187
- */
188
- static findWorkspaceRootSync(startPath) {
189
- let currentPath = node_path.default.resolve(startPath);
190
- const rootPath = node_path.default.parse(currentPath).root;
191
- while (true) {
192
- const gitPath = node_path.default.join(currentPath, ".git");
193
- if (fs_extra.pathExistsSync(gitPath)) return currentPath;
194
- if (currentPath === rootPath) return process.cwd();
195
- currentPath = node_path.default.dirname(currentPath);
196
- }
197
- }
198
- /**
199
- * Check if templates are initialized at the given path
200
- *
201
- * @param templatesPath - Path to check for templates
202
- * @returns true if templates folder exists and is a directory
203
- */
204
- static async isInitialized(templatesPath) {
205
- if (!await fs_extra.pathExists(templatesPath)) return false;
206
- return (await fs_extra.stat(templatesPath)).isDirectory();
207
- }
208
- /**
209
- * Get the scaffold config file name
210
- */
211
- static getConfigFileName() {
212
- return TemplatesManager.SCAFFOLD_CONFIG_FILE;
213
- }
214
- /**
215
- * Get the templates folder name
216
- */
217
- static getTemplatesFolderName() {
218
- return TemplatesManager.TEMPLATES_FOLDER;
219
- }
220
- };
221
-
222
109
  //#endregion
223
110
  //#region src/services/ScaffoldService.ts
224
111
  var ScaffoldService = class {
@@ -228,7 +115,7 @@ var ScaffoldService = class {
228
115
  this.fileSystem = fileSystem;
229
116
  this.scaffoldConfigLoader = scaffoldConfigLoader;
230
117
  this.variableReplacer = variableReplacer;
231
- this.templatesRootPath = templatesRootPath || TemplatesManager.findTemplatesPathSync();
118
+ this.templatesRootPath = templatesRootPath || __agiflowai_aicode_utils.TemplatesManagerService.findTemplatesPathSync();
232
119
  this.processingService = new ScaffoldProcessingService(fileSystem, variableReplacer);
233
120
  }
234
121
  /**
@@ -410,10 +297,4 @@ Object.defineProperty(exports, 'ScaffoldService', {
410
297
  get: function () {
411
298
  return ScaffoldService;
412
299
  }
413
- });
414
- Object.defineProperty(exports, 'TemplatesManager', {
415
- enumerable: true,
416
- get: function () {
417
- return TemplatesManager;
418
- }
419
300
  });
@@ -0,0 +1,4 @@
1
+ require('./logger-DqgpBYuP.cjs');
2
+ const require_ScaffoldService = require('./ScaffoldService-BtjrgKI1.cjs');
3
+
4
+ exports.ScaffoldService = require_ScaffoldService.ScaffoldService;
@@ -1,5 +1,5 @@
1
- const require_chunk = require('./chunk-nOFOJqeH.js');
2
- const require_logger = require('./logger-qztMS7ET.js');
1
+ const require_chunk = require('./chunk-CUT6urMc.cjs');
2
+ const require_logger = require('./logger-DqgpBYuP.cjs');
3
3
  let liquidjs = require("liquidjs");
4
4
  liquidjs = require_chunk.__toESM(liquidjs);
5
5
 
@@ -0,0 +1,4 @@
1
+ require('./logger-DqgpBYuP.cjs');
2
+ const require_TemplateService = require('./TemplateService-B6UG6adf.cjs');
3
+
4
+ exports.TemplateService = require_TemplateService.TemplateService;
@@ -1,4 +1,4 @@
1
- require('./logger-qztMS7ET.js');
2
- const require_VariableReplacementService = require('./VariableReplacementService-UjRQY5JS.js');
1
+ require('./logger-DqgpBYuP.cjs');
2
+ const require_VariableReplacementService = require('./VariableReplacementService-DuI8K1r2.cjs');
3
3
 
4
4
  exports.VariableReplacementService = require_VariableReplacementService.VariableReplacementService;
@@ -1,5 +1,5 @@
1
- const require_chunk = require('./chunk-nOFOJqeH.js');
2
- const require_logger = require('./logger-qztMS7ET.js');
1
+ const require_chunk = require('./chunk-CUT6urMc.cjs');
2
+ const require_logger = require('./logger-DqgpBYuP.cjs');
3
3
  let node_path = require("node:path");
4
4
  node_path = require_chunk.__toESM(node_path);
5
5
 
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
- const require_chunk = require('./chunk-nOFOJqeH.js');
3
- const require_logger = require('./logger-qztMS7ET.js');
4
- const require_ScaffoldConfigLoader = require('./ScaffoldConfigLoader-CvIJEFcI.js');
5
- const require_ScaffoldService = require('./ScaffoldService-B5ZpIjsn.js');
6
- const require_TemplateService = require('./TemplateService-wsvfwvRN.js');
7
- const require_VariableReplacementService = require('./VariableReplacementService-UjRQY5JS.js');
2
+ const require_chunk = require('./chunk-CUT6urMc.cjs');
3
+ const require_logger = require('./logger-DqgpBYuP.cjs');
4
+ const require_ScaffoldConfigLoader = require('./ScaffoldConfigLoader-BrmvENTo.cjs');
5
+ const require_ScaffoldService = require('./ScaffoldService-BtjrgKI1.cjs');
6
+ const require_TemplateService = require('./TemplateService-B6UG6adf.cjs');
7
+ const require_VariableReplacementService = require('./VariableReplacementService-DuI8K1r2.cjs');
8
8
  let commander = require("commander");
9
9
  commander = require_chunk.__toESM(commander);
10
10
  let node_path = require("node:path");
@@ -17,6 +17,8 @@ let node_util = require("node:util");
17
17
  node_util = require_chunk.__toESM(node_util);
18
18
  let chalk = require("chalk");
19
19
  chalk = require_chunk.__toESM(chalk);
20
+ let __agiflowai_aicode_utils = require("@agiflowai/aicode-utils");
21
+ __agiflowai_aicode_utils = require_chunk.__toESM(__agiflowai_aicode_utils);
20
22
  let __composio_json_schema_to_zod = require("@composio/json-schema-to-zod");
21
23
  __composio_json_schema_to_zod = require_chunk.__toESM(__composio_json_schema_to_zod);
22
24
  let js_yaml = require("js-yaml");
@@ -512,7 +514,7 @@ var BoilerplateService = class {
512
514
  const boilerplateCommand = new commander.Command("boilerplate").description("Manage boilerplate templates");
513
515
  boilerplateCommand.command("list").description("List all available boilerplate templates").action(async () => {
514
516
  try {
515
- const { boilerplates } = await new BoilerplateService(await require_ScaffoldService.TemplatesManager.findTemplatesPath()).listBoilerplates();
517
+ const { boilerplates } = await new BoilerplateService(await __agiflowai_aicode_utils.TemplatesManagerService.findTemplatesPath()).listBoilerplates();
516
518
  if (boilerplates.length === 0) {
517
519
  messages.warning("No boilerplate templates found.");
518
520
  return;
@@ -533,7 +535,7 @@ boilerplateCommand.command("list").description("List all available boilerplate t
533
535
  });
534
536
  boilerplateCommand.command("create <boilerplateName>").description("Create a new project from a boilerplate template").option("-v, --vars <json>", "JSON string containing variables for the boilerplate").option("--verbose", "Enable verbose logging").action(async (boilerplateName, options) => {
535
537
  try {
536
- const boilerplateService = new BoilerplateService(await require_ScaffoldService.TemplatesManager.findTemplatesPath());
538
+ const boilerplateService = new BoilerplateService(await __agiflowai_aicode_utils.TemplatesManagerService.findTemplatesPath());
537
539
  let variables = {};
538
540
  if (options.vars) try {
539
541
  variables = JSON.parse(options.vars);
@@ -592,7 +594,7 @@ boilerplateCommand.command("create <boilerplateName>").description("Create a new
592
594
  });
593
595
  boilerplateCommand.command("info <boilerplateName>").description("Show detailed information about a boilerplate template").action(async (boilerplateName) => {
594
596
  try {
595
- const bp = await new BoilerplateService(await require_ScaffoldService.TemplatesManager.findTemplatesPath()).getBoilerplate(boilerplateName);
597
+ const bp = await new BoilerplateService(await __agiflowai_aicode_utils.TemplatesManagerService.findTemplatesPath()).getBoilerplate(boilerplateName);
596
598
  if (!bp) {
597
599
  messages.error(`Boilerplate '${boilerplateName}' not found.`);
598
600
  process.exit(1);
@@ -2224,10 +2226,10 @@ var ScaffoldingMethodsService = class {
2224
2226
  const availableMethods = scaffoldingMethods.methods.map((m) => m.name).join(", ");
2225
2227
  throw new Error(`Scaffold method '${scaffold_feature_name}' not found. Available methods: ${availableMethods}`);
2226
2228
  }
2227
- const ScaffoldService$1 = (await Promise.resolve().then(() => require("./ScaffoldService-Dp9yhqVI.js"))).ScaffoldService;
2228
- const ScaffoldConfigLoader$1 = (await Promise.resolve().then(() => require("./ScaffoldConfigLoader-BhrrsLya.js"))).ScaffoldConfigLoader;
2229
- const VariableReplacementService$1 = (await Promise.resolve().then(() => require("./VariableReplacementService-C0BdOUm6.js"))).VariableReplacementService;
2230
- const TemplateService$1 = (await Promise.resolve().then(() => require("./TemplateService-lGQxhofk.js"))).TemplateService;
2229
+ const ScaffoldService$1 = (await Promise.resolve().then(() => require("./ScaffoldService-CkVFZBcb.cjs"))).ScaffoldService;
2230
+ const ScaffoldConfigLoader$1 = (await Promise.resolve().then(() => require("./ScaffoldConfigLoader-DQMCLVGD.cjs"))).ScaffoldConfigLoader;
2231
+ const VariableReplacementService$1 = (await Promise.resolve().then(() => require("./VariableReplacementService-CS_Uwxfu.cjs"))).VariableReplacementService;
2232
+ const TemplateService$1 = (await Promise.resolve().then(() => require("./TemplateService-DFiUdYAi.cjs"))).TemplateService;
2231
2233
  const templateService = new TemplateService$1();
2232
2234
  const scaffoldConfigLoader = new ScaffoldConfigLoader$1(this.fileSystem, templateService);
2233
2235
  const variableReplacer = new VariableReplacementService$1(this.fileSystem, templateService);
@@ -2577,7 +2579,7 @@ Parameters:
2577
2579
  //#region src/server/index.ts
2578
2580
  function createServer(options = {}) {
2579
2581
  const { adminEnabled = false } = options;
2580
- const templatesPath = require_ScaffoldService.TemplatesManager.findTemplatesPathSync();
2582
+ const templatesPath = __agiflowai_aicode_utils.TemplatesManagerService.findTemplatesPathSync();
2581
2583
  const listBoilerplatesTool = new ListBoilerplatesTool(templatesPath);
2582
2584
  const useBoilerplateTool = new UseBoilerplateTool(templatesPath);
2583
2585
  const listScaffoldingMethodsTool = new ListScaffoldingMethodsTool(templatesPath);
@@ -2592,7 +2594,7 @@ function createServer(options = {}) {
2592
2594
  const scaffoldFeaturePrompt = new ScaffoldFeaturePrompt();
2593
2595
  const server = new __modelcontextprotocol_sdk_server_index_js.Server({
2594
2596
  name: "scaffold-mcp",
2595
- version: "1.0.0"
2597
+ version: "0.4.0"
2596
2598
  }, {
2597
2599
  instructions: `Use this MCP server to create new project and adding a new feature (pages, component, services, etc...).
2598
2600
 
@@ -3115,7 +3117,7 @@ scaffoldCommand.command("list <projectPath>").description("List available scaffo
3115
3117
  messages.hint("Make sure you are in a valid project directory");
3116
3118
  process.exit(1);
3117
3119
  }
3118
- const templatesDir = await require_ScaffoldService.TemplatesManager.findTemplatesPath();
3120
+ const templatesDir = await __agiflowai_aicode_utils.TemplatesManagerService.findTemplatesPath();
3119
3121
  const methods = (await new ScaffoldingMethodsService(new FileSystemService(), templatesDir).listScaffoldingMethods(absolutePath)).methods;
3120
3122
  if (methods.length === 0) {
3121
3123
  messages.warning("No scaffolding methods available for this project.");
@@ -3149,7 +3151,7 @@ scaffoldCommand.command("add <featureName>").description("Add a feature to an ex
3149
3151
  messages.hint("Example: --vars '{\"componentName\": \"UserProfile\", \"description\": \"User profile component\"}'");
3150
3152
  process.exit(1);
3151
3153
  }
3152
- const templatesDir = await require_ScaffoldService.TemplatesManager.findTemplatesPath();
3154
+ const templatesDir = await __agiflowai_aicode_utils.TemplatesManagerService.findTemplatesPath();
3153
3155
  const scaffoldingMethodsService = new ScaffoldingMethodsService(new FileSystemService(), templatesDir);
3154
3156
  const methods = (await scaffoldingMethodsService.listScaffoldingMethods(projectPath)).methods;
3155
3157
  const method = methods.find((m) => m.name === featureName);
@@ -3214,7 +3216,7 @@ scaffoldCommand.command("info <featureName>").description("Show detailed informa
3214
3216
  messages.error(`❌ No project.json found in ${projectPath}`);
3215
3217
  process.exit(1);
3216
3218
  }
3217
- const templatesDir = await require_ScaffoldService.TemplatesManager.findTemplatesPath();
3219
+ const templatesDir = await __agiflowai_aicode_utils.TemplatesManagerService.findTemplatesPath();
3218
3220
  const method = (await new ScaffoldingMethodsService(new FileSystemService(), templatesDir).listScaffoldingMethods(projectPath)).methods.find((m) => m.name === featureName);
3219
3221
  if (!method) {
3220
3222
  messages.error(`❌ Scaffold method '${featureName}' not found.`);
@@ -3246,7 +3248,7 @@ scaffoldCommand.command("info <featureName>").description("Show detailed informa
3246
3248
  */
3247
3249
  async function main() {
3248
3250
  const program = new commander.Command();
3249
- program.name("scaffold-mcp").description("MCP server for scaffolding applications with boilerplate templates").version("1.0.0");
3251
+ program.name("scaffold-mcp").description("MCP server for scaffolding applications with boilerplate templates").version("0.4.0");
3250
3252
  program.addCommand(mcpServeCommand);
3251
3253
  program.addCommand(boilerplateCommand);
3252
3254
  program.addCommand(scaffoldCommand);
@@ -1,4 +1,4 @@
1
- const require_chunk = require('./chunk-nOFOJqeH.js');
1
+ const require_chunk = require('./chunk-CUT6urMc.cjs');
2
2
  let node_path = require("node:path");
3
3
  node_path = require_chunk.__toESM(node_path);
4
4
  let node_os = require("node:os");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@agiflowai/scaffold-mcp",
3
3
  "description": "MCP server for scaffolding applications with boilerplate templates",
4
- "version": "0.3.3",
4
+ "version": "0.4.1",
5
5
  "license": "AGPL-3.0",
6
6
  "author": "AgiflowIO",
7
7
  "repository": {
@@ -25,9 +25,9 @@
25
25
  "vite"
26
26
  ],
27
27
  "bin": {
28
- "scaffold-mcp": "./dist/index.js"
28
+ "scaffold-mcp": "./dist/index.cjs"
29
29
  },
30
- "main": "./dist/index.js",
30
+ "main": "./dist/index.cjs",
31
31
  "files": [
32
32
  "dist",
33
33
  "README.md"
@@ -44,7 +44,7 @@
44
44
  "pino": "^10.0.0",
45
45
  "pino-pretty": "^13.1.1",
46
46
  "zod": "3.25.76",
47
- "@agiflowai/scaffold-generator": "0.3.3"
47
+ "@agiflowai/aicode-utils": "0.4.1"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@types/express": "^5.0.0",
@@ -57,6 +57,7 @@
57
57
  "publishConfig": {
58
58
  "access": "public"
59
59
  },
60
+ "type": "module",
60
61
  "scripts": {
61
62
  "dev": "node --loader ts-node/esm src/index.ts",
62
63
  "build": "tsdown",
@@ -1,4 +0,0 @@
1
- require('./logger-qztMS7ET.js');
2
- const require_ScaffoldService = require('./ScaffoldService-B5ZpIjsn.js');
3
-
4
- exports.ScaffoldService = require_ScaffoldService.ScaffoldService;
@@ -1,4 +0,0 @@
1
- require('./logger-qztMS7ET.js');
2
- const require_TemplateService = require('./TemplateService-wsvfwvRN.js');
3
-
4
- exports.TemplateService = require_TemplateService.TemplateService;
File without changes