@agiflowai/scaffold-mcp 1.0.8 → 1.0.10

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.
Files changed (29) hide show
  1. package/dist/{ListScaffoldingMethodsTool-BLTCwsd1.mjs → ListScaffoldingMethodsTool-B49G_iLj.mjs} +1 -1
  2. package/dist/{ListScaffoldingMethodsTool-BuxKRbwi.cjs → ListScaffoldingMethodsTool-DuYGFDwJ.cjs} +6 -6
  3. package/dist/{ScaffoldConfigLoader-CQlXVksz.cjs → ScaffoldConfigLoader-BWpNpMx-.cjs} +1 -1
  4. package/dist/{ScaffoldConfigLoader-BB4_YUFL.cjs → ScaffoldConfigLoader-HutEtfaH.cjs} +1 -1
  5. package/dist/{ScaffoldService-BPyiY_0B.cjs → ScaffoldService-DSQBnAHm.cjs} +4 -2
  6. package/dist/{ScaffoldService-CgYunbKN.mjs → ScaffoldService-DcsGLMuD.mjs} +3 -1
  7. package/dist/ScaffoldService-DfXjmrNT.cjs +3 -0
  8. package/dist/ScaffoldService-dL74anIv.mjs +3 -0
  9. package/dist/{TemplateService-CAD8jkoO.cjs → TemplateService-7QcWREot.cjs} +1 -1
  10. package/dist/TemplateService-DUbdBOFs.cjs +3 -0
  11. package/dist/{VariableReplacementService-DDG5KZpb.cjs → VariableReplacementService-DNYx0Dym.cjs} +1 -1
  12. package/dist/{VariableReplacementService-CNimgwaq.cjs → VariableReplacementService-wuYKgeui.cjs} +1 -1
  13. package/dist/{chunk-CUT6urMc.cjs → chunk-CbDLau6x.cjs} +10 -6
  14. package/dist/cli.cjs +41 -13
  15. package/dist/cli.mjs +37 -9
  16. package/dist/index.cjs +7 -142
  17. package/dist/index.d.cts +1 -39
  18. package/dist/index.d.mts +1 -39
  19. package/dist/index.mjs +4 -132
  20. package/dist/{stdio-DovjJsGY.mjs → stdio-AbTm52SJ.mjs} +2 -2
  21. package/dist/{stdio-BcTSxlVH.cjs → stdio-baUp7xGL.cjs} +6 -6
  22. package/dist/{useScaffoldMethod-CsBTssSw.mjs → useScaffoldMethod-BMWhFebp.mjs} +14 -4
  23. package/dist/{useScaffoldMethod-CHJAsgA2.mjs → useScaffoldMethod-CPgJIBHx.mjs} +14 -4
  24. package/dist/{useScaffoldMethod-Btc_9iCj.cjs → useScaffoldMethod-CcrpFEPv.cjs} +16 -6
  25. package/dist/{useScaffoldMethod-C1hQdBVD.cjs → useScaffoldMethod-DOvwnNOJ.cjs} +16 -6
  26. package/package.json +7 -7
  27. package/dist/ScaffoldService-BCjJE9yK.mjs +0 -3
  28. package/dist/ScaffoldService-Bhzxp5-C.cjs +0 -3
  29. package/dist/TemplateService-BrJGDvQt.cjs +0 -3
@@ -220,7 +220,7 @@ var ScaffoldingMethodsService = class {
220
220
  const availableMethods = scaffoldingMethods.methods.map((m) => m.name).join(", ");
221
221
  throw new Error(`Scaffold method '${scaffold_feature_name}' not found. Available methods: ${availableMethods}`);
222
222
  }
223
- const ScaffoldService = (await import("./ScaffoldService-BCjJE9yK.mjs")).ScaffoldService;
223
+ const ScaffoldService = (await import("./ScaffoldService-dL74anIv.mjs")).ScaffoldService;
224
224
  const ScaffoldConfigLoader = (await import("./ScaffoldConfigLoader-DKJtnrWT.mjs")).ScaffoldConfigLoader;
225
225
  const VariableReplacementService = (await import("./VariableReplacementService-BO-UYgcf.mjs")).VariableReplacementService;
226
226
  const TemplateService$1 = (await import("./TemplateService-B1bd6iHw.mjs")).TemplateService;
@@ -1,5 +1,5 @@
1
- const require_chunk = require('./chunk-CUT6urMc.cjs');
2
- const require_TemplateService = require('./TemplateService-CAD8jkoO.cjs');
1
+ const require_chunk = require('./chunk-CbDLau6x.cjs');
2
+ const require_TemplateService = require('./TemplateService-7QcWREot.cjs');
3
3
  let node_path = require("node:path");
4
4
  node_path = require_chunk.__toESM(node_path);
5
5
  let __agiflowai_aicode_utils = require("@agiflowai/aicode-utils");
@@ -223,10 +223,10 @@ var ScaffoldingMethodsService = class {
223
223
  const availableMethods = scaffoldingMethods.methods.map((m) => m.name).join(", ");
224
224
  throw new Error(`Scaffold method '${scaffold_feature_name}' not found. Available methods: ${availableMethods}`);
225
225
  }
226
- const ScaffoldService = (await Promise.resolve().then(() => require("./ScaffoldService-Bhzxp5-C.cjs"))).ScaffoldService;
227
- const ScaffoldConfigLoader = (await Promise.resolve().then(() => require("./ScaffoldConfigLoader-BB4_YUFL.cjs"))).ScaffoldConfigLoader;
228
- const VariableReplacementService = (await Promise.resolve().then(() => require("./VariableReplacementService-CNimgwaq.cjs"))).VariableReplacementService;
229
- const TemplateService$1 = (await Promise.resolve().then(() => require("./TemplateService-BrJGDvQt.cjs"))).TemplateService;
226
+ const ScaffoldService = (await Promise.resolve().then(() => require("./ScaffoldService-DfXjmrNT.cjs"))).ScaffoldService;
227
+ const ScaffoldConfigLoader = (await Promise.resolve().then(() => require("./ScaffoldConfigLoader-HutEtfaH.cjs"))).ScaffoldConfigLoader;
228
+ const VariableReplacementService = (await Promise.resolve().then(() => require("./VariableReplacementService-wuYKgeui.cjs"))).VariableReplacementService;
229
+ const TemplateService$1 = (await Promise.resolve().then(() => require("./TemplateService-DUbdBOFs.cjs"))).TemplateService;
230
230
  const templateService = new TemplateService$1();
231
231
  const scaffoldConfigLoader = new ScaffoldConfigLoader(this.fileSystem, templateService);
232
232
  const variableReplacer = new VariableReplacementService(this.fileSystem, templateService);
@@ -1,4 +1,4 @@
1
- const require_chunk = require('./chunk-CUT6urMc.cjs');
1
+ const require_chunk = require('./chunk-CbDLau6x.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-CQlXVksz.cjs');
1
+ const require_ScaffoldConfigLoader = require('./ScaffoldConfigLoader-BWpNpMx-.cjs');
2
2
 
3
3
  exports.ScaffoldConfigLoader = require_ScaffoldConfigLoader.ScaffoldConfigLoader;
@@ -1,4 +1,4 @@
1
- const require_chunk = require('./chunk-CUT6urMc.cjs');
1
+ const require_chunk = require('./chunk-CbDLau6x.cjs');
2
2
  let node_path = require("node:path");
3
3
  node_path = require_chunk.__toESM(node_path);
4
4
  let __agiflowai_aicode_utils = require("@agiflowai/aicode-utils");
@@ -112,7 +112,9 @@ var ScaffoldService = class {
112
112
  this.fileSystem = fileSystem;
113
113
  this.scaffoldConfigLoader = scaffoldConfigLoader;
114
114
  this.variableReplacer = variableReplacer;
115
- this.templatesRootPath = templatesRootPath || __agiflowai_aicode_utils.TemplatesManagerService.findTemplatesPathSync();
115
+ const resolvedPath = templatesRootPath || __agiflowai_aicode_utils.TemplatesManagerService.findTemplatesPathSync();
116
+ if (!resolvedPath) throw new Error("Templates folder not found. Please create a \"templates\" folder in your workspace root, or specify \"templatesPath\" in toolkit.yaml to point to your templates directory.");
117
+ this.templatesRootPath = resolvedPath;
116
118
  this.processingService = new ScaffoldProcessingService(fileSystem, variableReplacer);
117
119
  }
118
120
  /**
@@ -110,7 +110,9 @@ var ScaffoldService = class {
110
110
  this.fileSystem = fileSystem;
111
111
  this.scaffoldConfigLoader = scaffoldConfigLoader;
112
112
  this.variableReplacer = variableReplacer;
113
- this.templatesRootPath = templatesRootPath || TemplatesManagerService.findTemplatesPathSync();
113
+ const resolvedPath = templatesRootPath || TemplatesManagerService.findTemplatesPathSync();
114
+ if (!resolvedPath) throw new Error("Templates folder not found. Please create a \"templates\" folder in your workspace root, or specify \"templatesPath\" in toolkit.yaml to point to your templates directory.");
115
+ this.templatesRootPath = resolvedPath;
114
116
  this.processingService = new ScaffoldProcessingService(fileSystem, variableReplacer);
115
117
  }
116
118
  /**
@@ -0,0 +1,3 @@
1
+ const require_ScaffoldService = require('./ScaffoldService-DSQBnAHm.cjs');
2
+
3
+ exports.ScaffoldService = require_ScaffoldService.ScaffoldService;
@@ -0,0 +1,3 @@
1
+ import { t as ScaffoldService } from "./ScaffoldService-DcsGLMuD.mjs";
2
+
3
+ export { ScaffoldService };
@@ -1,4 +1,4 @@
1
- const require_chunk = require('./chunk-CUT6urMc.cjs');
1
+ const require_chunk = require('./chunk-CbDLau6x.cjs');
2
2
  let __agiflowai_aicode_utils = require("@agiflowai/aicode-utils");
3
3
  let liquidjs = require("liquidjs");
4
4
 
@@ -0,0 +1,3 @@
1
+ const require_TemplateService = require('./TemplateService-7QcWREot.cjs');
2
+
3
+ exports.TemplateService = require_TemplateService.TemplateService;
@@ -1,4 +1,4 @@
1
- const require_chunk = require('./chunk-CUT6urMc.cjs');
1
+ const require_chunk = require('./chunk-CbDLau6x.cjs');
2
2
  let node_path = require("node:path");
3
3
  node_path = require_chunk.__toESM(node_path);
4
4
  let __agiflowai_aicode_utils = require("@agiflowai/aicode-utils");
@@ -1,3 +1,3 @@
1
- const require_VariableReplacementService = require('./VariableReplacementService-DDG5KZpb.cjs');
1
+ const require_VariableReplacementService = require('./VariableReplacementService-DNYx0Dym.cjs');
2
2
 
3
3
  exports.VariableReplacementService = require_VariableReplacementService.VariableReplacementService;
@@ -6,12 +6,16 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
8
  var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
- key = keys[i];
11
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
- get: ((k) => from[k]).bind(null, key),
13
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
- });
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) {
13
+ __defProp(to, key, {
14
+ get: ((k) => from[k]).bind(null, key),
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ }
15
19
  }
16
20
  return to;
17
21
  };
package/dist/cli.cjs CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
- const require_chunk = require('./chunk-CUT6urMc.cjs');
3
- const require_stdio = require('./stdio-BcTSxlVH.cjs');
4
- const require_ListScaffoldingMethodsTool = require('./ListScaffoldingMethodsTool-BuxKRbwi.cjs');
5
- require('./ScaffoldConfigLoader-CQlXVksz.cjs');
6
- require('./ScaffoldService-BPyiY_0B.cjs');
7
- const require_TemplateService = require('./TemplateService-CAD8jkoO.cjs');
8
- require('./VariableReplacementService-DDG5KZpb.cjs');
2
+ const require_chunk = require('./chunk-CbDLau6x.cjs');
3
+ const require_stdio = require('./stdio-baUp7xGL.cjs');
4
+ const require_ListScaffoldingMethodsTool = require('./ListScaffoldingMethodsTool-DuYGFDwJ.cjs');
5
+ require('./ScaffoldConfigLoader-BWpNpMx-.cjs');
6
+ require('./ScaffoldService-DSQBnAHm.cjs');
7
+ const require_TemplateService = require('./TemplateService-7QcWREot.cjs');
8
+ require('./VariableReplacementService-DNYx0Dym.cjs');
9
9
  let node_path = require("node:path");
10
10
  node_path = require_chunk.__toESM(node_path);
11
11
  let __agiflowai_aicode_utils = require("@agiflowai/aicode-utils");
@@ -16,7 +16,7 @@ let __agiflowai_coding_agent_bridge = require("@agiflowai/coding-agent-bridge");
16
16
  let __agiflowai_hooks_adapter = require("@agiflowai/hooks-adapter");
17
17
 
18
18
  //#region package.json
19
- var version = "1.0.7";
19
+ var version = "1.0.9";
20
20
 
21
21
  //#endregion
22
22
  //#region src/commands/boilerplate.ts
@@ -26,7 +26,12 @@ var version = "1.0.7";
26
26
  const boilerplateCommand = new commander.Command("boilerplate").description("Manage boilerplate templates");
27
27
  boilerplateCommand.command("list").description("List all available boilerplate templates").option("-c, --cursor <cursor>", "Pagination cursor for next page").action(async (options) => {
28
28
  try {
29
- const { boilerplates, nextCursor } = await new require_stdio.BoilerplateService(await __agiflowai_aicode_utils.TemplatesManagerService.findTemplatesPath()).listBoilerplates(options.cursor);
29
+ const templatesDir = await __agiflowai_aicode_utils.TemplatesManagerService.findTemplatesPath();
30
+ if (!templatesDir) {
31
+ __agiflowai_aicode_utils.messages.error("Templates folder not found. Create a templates folder or specify templatesPath in toolkit.yaml");
32
+ process.exit(1);
33
+ }
34
+ const { boilerplates, nextCursor } = await new require_stdio.BoilerplateService(templatesDir).listBoilerplates(options.cursor);
30
35
  if (boilerplates.length === 0) {
31
36
  __agiflowai_aicode_utils.messages.warning("No boilerplate templates found.");
32
37
  return;
@@ -52,7 +57,12 @@ boilerplateCommand.command("list").description("List all available boilerplate t
52
57
  });
53
58
  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("-m, --monolith", "Create as monolith project at workspace root with toolkit.yaml (default: false, creates as monorepo with project.json)").option("-t, --target-folder <path>", "Override target folder (defaults to boilerplate targetFolder for monorepo, workspace root for monolith)").option("--verbose", "Enable verbose logging").action(async (boilerplateName, options) => {
54
59
  try {
55
- const boilerplateService = new require_stdio.BoilerplateService(await __agiflowai_aicode_utils.TemplatesManagerService.findTemplatesPath());
60
+ const templatesDir = await __agiflowai_aicode_utils.TemplatesManagerService.findTemplatesPath();
61
+ if (!templatesDir) {
62
+ __agiflowai_aicode_utils.messages.error("Templates folder not found. Create a templates folder or specify templatesPath in toolkit.yaml");
63
+ process.exit(1);
64
+ }
65
+ const boilerplateService = new require_stdio.BoilerplateService(templatesDir);
56
66
  let variables = {};
57
67
  if (options.vars) try {
58
68
  variables = JSON.parse(options.vars);
@@ -124,7 +134,12 @@ boilerplateCommand.command("create <boilerplateName>").description("Create a new
124
134
  });
125
135
  boilerplateCommand.command("info <boilerplateName>").description("Show detailed information about a boilerplate template").action(async (boilerplateName) => {
126
136
  try {
127
- const bp = await new require_stdio.BoilerplateService(await __agiflowai_aicode_utils.TemplatesManagerService.findTemplatesPath()).getBoilerplate(boilerplateName);
137
+ const templatesDir = await __agiflowai_aicode_utils.TemplatesManagerService.findTemplatesPath();
138
+ if (!templatesDir) {
139
+ __agiflowai_aicode_utils.messages.error("Templates folder not found. Create a templates folder or specify templatesPath in toolkit.yaml");
140
+ process.exit(1);
141
+ }
142
+ const bp = await new require_stdio.BoilerplateService(templatesDir).getBoilerplate(boilerplateName);
128
143
  if (!bp) {
129
144
  __agiflowai_aicode_utils.messages.error(`Boilerplate '${boilerplateName}' not found.`);
130
145
  process.exit(1);
@@ -345,6 +360,7 @@ var ScaffoldFeaturePrompt = class ScaffoldFeaturePrompt {
345
360
  function createServer(options = {}) {
346
361
  const { adminEnabled = false, isMonolith = false } = options;
347
362
  const templatesPath = __agiflowai_aicode_utils.TemplatesManagerService.findTemplatesPathSync();
363
+ if (!templatesPath) throw new Error("Templates folder not found. Please create a \"templates\" folder in your workspace root, or specify \"templatesPath\" in toolkit.yaml to point to your templates directory.");
348
364
  const listBoilerplatesTool = !isMonolith ? new require_stdio.ListBoilerplatesTool(templatesPath, isMonolith) : null;
349
365
  const useBoilerplateTool = !isMonolith ? new require_stdio.UseBoilerplateTool(templatesPath, isMonolith) : null;
350
366
  const listScaffoldingMethodsTool = new require_ListScaffoldingMethodsTool.ListScaffoldingMethodsTool(templatesPath, isMonolith);
@@ -528,6 +544,10 @@ scaffoldCommand.command("list [projectPath]").description("List available scaffo
528
544
  process.exit(1);
529
545
  }
530
546
  const templatesDir = await __agiflowai_aicode_utils.TemplatesManagerService.findTemplatesPath();
547
+ if (!templatesDir) {
548
+ __agiflowai_aicode_utils.messages.error("Templates folder not found. Create a templates folder or specify templatesPath in toolkit.yaml");
549
+ process.exit(1);
550
+ }
531
551
  const scaffoldingMethodsService = new require_ListScaffoldingMethodsTool.ScaffoldingMethodsService(new require_ListScaffoldingMethodsTool.FileSystemService(), templatesDir);
532
552
  let result;
533
553
  let displayName;
@@ -585,6 +605,10 @@ scaffoldCommand.command("add <featureName>").description("Add a feature to an ex
585
605
  process.exit(1);
586
606
  }
587
607
  const templatesDir = await __agiflowai_aicode_utils.TemplatesManagerService.findTemplatesPath();
608
+ if (!templatesDir) {
609
+ __agiflowai_aicode_utils.messages.error("Templates folder not found. Create a templates folder or specify templatesPath in toolkit.yaml");
610
+ process.exit(1);
611
+ }
588
612
  const scaffoldingMethodsService = new require_ListScaffoldingMethodsTool.ScaffoldingMethodsService(new require_ListScaffoldingMethodsTool.FileSystemService(), templatesDir);
589
613
  let allMethods = [];
590
614
  let cursor;
@@ -656,6 +680,10 @@ scaffoldCommand.command("info <featureName>").description("Show detailed informa
656
680
  process.exit(1);
657
681
  }
658
682
  const templatesDir = await __agiflowai_aicode_utils.TemplatesManagerService.findTemplatesPath();
683
+ if (!templatesDir) {
684
+ __agiflowai_aicode_utils.messages.error("Templates folder not found. Create a templates folder or specify templatesPath in toolkit.yaml");
685
+ process.exit(1);
686
+ }
659
687
  const scaffoldingMethodsService = new require_ListScaffoldingMethodsTool.ScaffoldingMethodsService(new require_ListScaffoldingMethodsTool.FileSystemService(), templatesDir);
660
688
  let allMethods = [];
661
689
  let cursor;
@@ -739,7 +767,7 @@ const hookCommand = new commander.Command("hook").description("Execute scaffold
739
767
  }
740
768
  const { agent, hookMethod } = (0, __agiflowai_hooks_adapter.parseHookType)(options.type);
741
769
  if (agent === __agiflowai_coding_agent_bridge.CLAUDE_CODE) {
742
- const useScaffoldMethodModule = await Promise.resolve().then(() => require("./useScaffoldMethod-C1hQdBVD.cjs"));
770
+ const useScaffoldMethodModule = await Promise.resolve().then(() => require("./useScaffoldMethod-DOvwnNOJ.cjs"));
743
771
  const claudeCallbacks = [];
744
772
  if (useScaffoldMethodModule.UseScaffoldMethodHook) {
745
773
  const hookInstance = new useScaffoldMethodModule.UseScaffoldMethodHook();
@@ -752,7 +780,7 @@ const hookCommand = new commander.Command("hook").description("Execute scaffold
752
780
  }
753
781
  await new __agiflowai_hooks_adapter.ClaudeCodeAdapter().executeMultiple(claudeCallbacks);
754
782
  } else if (agent === __agiflowai_coding_agent_bridge.GEMINI_CLI) {
755
- const useScaffoldMethodModule = await Promise.resolve().then(() => require("./useScaffoldMethod-Btc_9iCj.cjs"));
783
+ const useScaffoldMethodModule = await Promise.resolve().then(() => require("./useScaffoldMethod-CcrpFEPv.cjs"));
756
784
  const geminiCallbacks = [];
757
785
  if (useScaffoldMethodModule.UseScaffoldMethodHook) {
758
786
  const hookInstance = new useScaffoldMethodModule.UseScaffoldMethodHook();
package/dist/cli.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import { a as UseScaffoldMethodTool, c as GenerateFeatureScaffoldTool, f as BoilerplateService, i as WriteToFileTool, l as GenerateBoilerplateTool, n as SseTransportHandler, o as UseBoilerplateTool, r as HttpTransportHandler, s as ListBoilerplatesTool, t as StdioTransportHandler, u as GenerateBoilerplateFileTool } from "./stdio-DovjJsGY.mjs";
3
- import { n as ScaffoldingMethodsService, r as FileSystemService, t as ListScaffoldingMethodsTool } from "./ListScaffoldingMethodsTool-BLTCwsd1.mjs";
2
+ import { a as UseScaffoldMethodTool, c as GenerateFeatureScaffoldTool, f as BoilerplateService, i as WriteToFileTool, l as GenerateBoilerplateTool, n as SseTransportHandler, o as UseBoilerplateTool, r as HttpTransportHandler, s as ListBoilerplatesTool, t as StdioTransportHandler, u as GenerateBoilerplateFileTool } from "./stdio-AbTm52SJ.mjs";
3
+ import { n as ScaffoldingMethodsService, r as FileSystemService, t as ListScaffoldingMethodsTool } from "./ListScaffoldingMethodsTool-B49G_iLj.mjs";
4
4
  import "./ScaffoldConfigLoader-8YI7v2GJ.mjs";
5
- import "./ScaffoldService-CgYunbKN.mjs";
5
+ import "./ScaffoldService-DcsGLMuD.mjs";
6
6
  import { t as TemplateService } from "./TemplateService-CVDL2uqt.mjs";
7
7
  import "./VariableReplacementService-B9RA8D0a.mjs";
8
8
  import path from "node:path";
@@ -14,7 +14,7 @@ import { CLAUDE_CODE, GEMINI_CLI } from "@agiflowai/coding-agent-bridge";
14
14
  import { ClaudeCodeAdapter, GeminiCliAdapter, parseHookType } from "@agiflowai/hooks-adapter";
15
15
 
16
16
  //#region package.json
17
- var version = "1.0.7";
17
+ var version = "1.0.9";
18
18
 
19
19
  //#endregion
20
20
  //#region src/commands/boilerplate.ts
@@ -24,7 +24,12 @@ var version = "1.0.7";
24
24
  const boilerplateCommand = new Command("boilerplate").description("Manage boilerplate templates");
25
25
  boilerplateCommand.command("list").description("List all available boilerplate templates").option("-c, --cursor <cursor>", "Pagination cursor for next page").action(async (options) => {
26
26
  try {
27
- const { boilerplates, nextCursor } = await new BoilerplateService(await TemplatesManagerService.findTemplatesPath()).listBoilerplates(options.cursor);
27
+ const templatesDir = await TemplatesManagerService.findTemplatesPath();
28
+ if (!templatesDir) {
29
+ messages.error("Templates folder not found. Create a templates folder or specify templatesPath in toolkit.yaml");
30
+ process.exit(1);
31
+ }
32
+ const { boilerplates, nextCursor } = await new BoilerplateService(templatesDir).listBoilerplates(options.cursor);
28
33
  if (boilerplates.length === 0) {
29
34
  messages.warning("No boilerplate templates found.");
30
35
  return;
@@ -50,7 +55,12 @@ boilerplateCommand.command("list").description("List all available boilerplate t
50
55
  });
51
56
  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("-m, --monolith", "Create as monolith project at workspace root with toolkit.yaml (default: false, creates as monorepo with project.json)").option("-t, --target-folder <path>", "Override target folder (defaults to boilerplate targetFolder for monorepo, workspace root for monolith)").option("--verbose", "Enable verbose logging").action(async (boilerplateName, options) => {
52
57
  try {
53
- const boilerplateService = new BoilerplateService(await TemplatesManagerService.findTemplatesPath());
58
+ const templatesDir = await TemplatesManagerService.findTemplatesPath();
59
+ if (!templatesDir) {
60
+ messages.error("Templates folder not found. Create a templates folder or specify templatesPath in toolkit.yaml");
61
+ process.exit(1);
62
+ }
63
+ const boilerplateService = new BoilerplateService(templatesDir);
54
64
  let variables = {};
55
65
  if (options.vars) try {
56
66
  variables = JSON.parse(options.vars);
@@ -122,7 +132,12 @@ boilerplateCommand.command("create <boilerplateName>").description("Create a new
122
132
  });
123
133
  boilerplateCommand.command("info <boilerplateName>").description("Show detailed information about a boilerplate template").action(async (boilerplateName) => {
124
134
  try {
125
- const bp = await new BoilerplateService(await TemplatesManagerService.findTemplatesPath()).getBoilerplate(boilerplateName);
135
+ const templatesDir = await TemplatesManagerService.findTemplatesPath();
136
+ if (!templatesDir) {
137
+ messages.error("Templates folder not found. Create a templates folder or specify templatesPath in toolkit.yaml");
138
+ process.exit(1);
139
+ }
140
+ const bp = await new BoilerplateService(templatesDir).getBoilerplate(boilerplateName);
126
141
  if (!bp) {
127
142
  messages.error(`Boilerplate '${boilerplateName}' not found.`);
128
143
  process.exit(1);
@@ -343,6 +358,7 @@ var ScaffoldFeaturePrompt = class ScaffoldFeaturePrompt {
343
358
  function createServer(options = {}) {
344
359
  const { adminEnabled = false, isMonolith = false } = options;
345
360
  const templatesPath = TemplatesManagerService.findTemplatesPathSync();
361
+ if (!templatesPath) throw new Error("Templates folder not found. Please create a \"templates\" folder in your workspace root, or specify \"templatesPath\" in toolkit.yaml to point to your templates directory.");
346
362
  const listBoilerplatesTool = !isMonolith ? new ListBoilerplatesTool(templatesPath, isMonolith) : null;
347
363
  const useBoilerplateTool = !isMonolith ? new UseBoilerplateTool(templatesPath, isMonolith) : null;
348
364
  const listScaffoldingMethodsTool = new ListScaffoldingMethodsTool(templatesPath, isMonolith);
@@ -526,6 +542,10 @@ scaffoldCommand.command("list [projectPath]").description("List available scaffo
526
542
  process.exit(1);
527
543
  }
528
544
  const templatesDir = await TemplatesManagerService.findTemplatesPath();
545
+ if (!templatesDir) {
546
+ messages.error("Templates folder not found. Create a templates folder or specify templatesPath in toolkit.yaml");
547
+ process.exit(1);
548
+ }
529
549
  const scaffoldingMethodsService = new ScaffoldingMethodsService(new FileSystemService(), templatesDir);
530
550
  let result;
531
551
  let displayName;
@@ -583,6 +603,10 @@ scaffoldCommand.command("add <featureName>").description("Add a feature to an ex
583
603
  process.exit(1);
584
604
  }
585
605
  const templatesDir = await TemplatesManagerService.findTemplatesPath();
606
+ if (!templatesDir) {
607
+ messages.error("Templates folder not found. Create a templates folder or specify templatesPath in toolkit.yaml");
608
+ process.exit(1);
609
+ }
586
610
  const scaffoldingMethodsService = new ScaffoldingMethodsService(new FileSystemService(), templatesDir);
587
611
  let allMethods = [];
588
612
  let cursor;
@@ -654,6 +678,10 @@ scaffoldCommand.command("info <featureName>").description("Show detailed informa
654
678
  process.exit(1);
655
679
  }
656
680
  const templatesDir = await TemplatesManagerService.findTemplatesPath();
681
+ if (!templatesDir) {
682
+ messages.error("Templates folder not found. Create a templates folder or specify templatesPath in toolkit.yaml");
683
+ process.exit(1);
684
+ }
657
685
  const scaffoldingMethodsService = new ScaffoldingMethodsService(new FileSystemService(), templatesDir);
658
686
  let allMethods = [];
659
687
  let cursor;
@@ -737,7 +765,7 @@ const hookCommand = new Command("hook").description("Execute scaffold hooks for
737
765
  }
738
766
  const { agent, hookMethod } = parseHookType(options.type);
739
767
  if (agent === CLAUDE_CODE) {
740
- const useScaffoldMethodModule = await import("./useScaffoldMethod-CsBTssSw.mjs");
768
+ const useScaffoldMethodModule = await import("./useScaffoldMethod-BMWhFebp.mjs");
741
769
  const claudeCallbacks = [];
742
770
  if (useScaffoldMethodModule.UseScaffoldMethodHook) {
743
771
  const hookInstance = new useScaffoldMethodModule.UseScaffoldMethodHook();
@@ -750,7 +778,7 @@ const hookCommand = new Command("hook").description("Execute scaffold hooks for
750
778
  }
751
779
  await new ClaudeCodeAdapter().executeMultiple(claudeCallbacks);
752
780
  } else if (agent === GEMINI_CLI) {
753
- const useScaffoldMethodModule = await import("./useScaffoldMethod-CHJAsgA2.mjs");
781
+ const useScaffoldMethodModule = await import("./useScaffoldMethod-CPgJIBHx.mjs");
754
782
  const geminiCallbacks = [];
755
783
  if (useScaffoldMethodModule.UseScaffoldMethodHook) {
756
784
  const hookInstance = new useScaffoldMethodModule.UseScaffoldMethodHook();
package/dist/index.cjs CHANGED
@@ -1,140 +1,10 @@
1
- const require_chunk = require('./chunk-CUT6urMc.cjs');
2
- const require_stdio = require('./stdio-BcTSxlVH.cjs');
3
- const require_ListScaffoldingMethodsTool = require('./ListScaffoldingMethodsTool-BuxKRbwi.cjs');
4
- const require_ScaffoldConfigLoader = require('./ScaffoldConfigLoader-CQlXVksz.cjs');
5
- const require_ScaffoldService = require('./ScaffoldService-BPyiY_0B.cjs');
6
- const require_TemplateService = require('./TemplateService-CAD8jkoO.cjs');
7
- const require_VariableReplacementService = require('./VariableReplacementService-DDG5KZpb.cjs');
8
- let node_path = require("node:path");
9
- node_path = require_chunk.__toESM(node_path);
10
- let __agiflowai_aicode_utils = require("@agiflowai/aicode-utils");
11
- let execa = require("execa");
1
+ const require_stdio = require('./stdio-baUp7xGL.cjs');
2
+ const require_ListScaffoldingMethodsTool = require('./ListScaffoldingMethodsTool-DuYGFDwJ.cjs');
3
+ const require_ScaffoldConfigLoader = require('./ScaffoldConfigLoader-BWpNpMx-.cjs');
4
+ const require_ScaffoldService = require('./ScaffoldService-DSQBnAHm.cjs');
5
+ const require_TemplateService = require('./TemplateService-7QcWREot.cjs');
6
+ const require_VariableReplacementService = require('./VariableReplacementService-DNYx0Dym.cjs');
12
7
 
13
- //#region src/utils/git.ts
14
- /**
15
- * Execute a git command safely using execa to prevent command injection
16
- */
17
- async function execGit(args, cwd) {
18
- try {
19
- await (0, execa.execa)("git", args, { cwd });
20
- } catch (error) {
21
- const execaError = error;
22
- throw new Error(`Git command failed: ${execaError.stderr || execaError.message}`);
23
- }
24
- }
25
- /**
26
- * Find the workspace root by searching upwards for .git folder
27
- * Returns null if no .git folder is found (indicating a new project setup is needed)
28
- */
29
- async function findWorkspaceRoot(startPath = process.cwd()) {
30
- let currentPath = node_path.default.resolve(startPath);
31
- const rootPath = node_path.default.parse(currentPath).root;
32
- while (true) {
33
- if (await (0, __agiflowai_aicode_utils.pathExists)(node_path.default.join(currentPath, ".git"))) return currentPath;
34
- if (currentPath === rootPath) return null;
35
- currentPath = node_path.default.dirname(currentPath);
36
- }
37
- }
38
- /**
39
- * Parse GitHub URL to detect if it's a subdirectory
40
- * Supports formats:
41
- * - https://github.com/user/repo
42
- * - https://github.com/user/repo/tree/branch/path/to/dir
43
- * - https://github.com/user/repo/tree/main/path/to/dir
44
- */
45
- function parseGitHubUrl(url) {
46
- const treeMatch = url.match(/^https?:\/\/github\.com\/([^/]+)\/([^/]+)\/tree\/([^/]+)\/(.+)$/);
47
- const blobMatch = url.match(/^https?:\/\/github\.com\/([^/]+)\/([^/]+)\/blob\/([^/]+)\/(.+)$/);
48
- const rootMatch = url.match(/^https?:\/\/github\.com\/([^/]+)\/([^/]+?)(?:\.git)?$/);
49
- if (treeMatch || blobMatch) {
50
- const match = treeMatch || blobMatch;
51
- return {
52
- owner: match?.[1],
53
- repo: match?.[2],
54
- repoUrl: `https://github.com/${match?.[1]}/${match?.[2]}.git`,
55
- branch: match?.[3],
56
- subdirectory: match?.[4],
57
- isSubdirectory: true
58
- };
59
- }
60
- if (rootMatch) return {
61
- owner: rootMatch[1],
62
- repo: rootMatch[2],
63
- repoUrl: `https://github.com/${rootMatch[1]}/${rootMatch[2]}.git`,
64
- isSubdirectory: false
65
- };
66
- return {
67
- repoUrl: url,
68
- isSubdirectory: false
69
- };
70
- }
71
- /**
72
- * Clone a subdirectory from a git repository using sparse checkout
73
- */
74
- async function cloneSubdirectory(repoUrl, branch, subdirectory, targetFolder) {
75
- const tempFolder = `${targetFolder}.tmp`;
76
- try {
77
- await execGit(["init", tempFolder]);
78
- await execGit([
79
- "remote",
80
- "add",
81
- "origin",
82
- repoUrl
83
- ], tempFolder);
84
- await execGit([
85
- "config",
86
- "core.sparseCheckout",
87
- "true"
88
- ], tempFolder);
89
- await (0, __agiflowai_aicode_utils.writeFile)(node_path.default.join(tempFolder, ".git", "info", "sparse-checkout"), `${subdirectory}\n`);
90
- await execGit([
91
- "pull",
92
- "--depth=1",
93
- "origin",
94
- branch
95
- ], tempFolder);
96
- const sourceDir = node_path.default.join(tempFolder, subdirectory);
97
- if (!await (0, __agiflowai_aicode_utils.pathExists)(sourceDir)) throw new Error(`Subdirectory '${subdirectory}' not found in repository at branch '${branch}'`);
98
- if (await (0, __agiflowai_aicode_utils.pathExists)(targetFolder)) throw new Error(`Target folder already exists: ${targetFolder}`);
99
- await (0, __agiflowai_aicode_utils.move)(sourceDir, targetFolder);
100
- await (0, __agiflowai_aicode_utils.remove)(tempFolder);
101
- } catch (error) {
102
- if (await (0, __agiflowai_aicode_utils.pathExists)(tempFolder)) await (0, __agiflowai_aicode_utils.remove)(tempFolder);
103
- throw error;
104
- }
105
- }
106
- /**
107
- * Clone entire repository
108
- */
109
- async function cloneRepository(repoUrl, targetFolder) {
110
- await execGit([
111
- "clone",
112
- repoUrl,
113
- targetFolder
114
- ]);
115
- const gitFolder = node_path.default.join(targetFolder, ".git");
116
- if (await (0, __agiflowai_aicode_utils.pathExists)(gitFolder)) await (0, __agiflowai_aicode_utils.remove)(gitFolder);
117
- }
118
- /**
119
- * Fetch directory listing from GitHub API
120
- */
121
- async function fetchGitHubDirectoryContents(owner, repo, path$1, branch = "main") {
122
- const url = `https://api.github.com/repos/${owner}/${repo}/contents/${path$1}?ref=${branch}`;
123
- const response = await fetch(url, { headers: {
124
- Accept: "application/vnd.github.v3+json",
125
- "User-Agent": "scaffold-mcp"
126
- } });
127
- if (!response.ok) throw new Error(`Failed to fetch directory contents: ${response.statusText}`);
128
- const data = await response.json();
129
- if (!Array.isArray(data)) throw new Error("Expected directory but got file");
130
- return data.map((item) => ({
131
- name: item.name,
132
- type: item.type,
133
- path: item.path
134
- }));
135
- }
136
-
137
- //#endregion
138
8
  exports.BoilerplateGeneratorService = require_stdio.BoilerplateGeneratorService;
139
9
  exports.BoilerplateService = require_stdio.BoilerplateService;
140
10
  exports.FileSystemService = require_ListScaffoldingMethodsTool.FileSystemService;
@@ -155,9 +25,4 @@ exports.TemplateService = require_TemplateService.TemplateService;
155
25
  exports.UseBoilerplateTool = require_stdio.UseBoilerplateTool;
156
26
  exports.UseScaffoldMethodTool = require_stdio.UseScaffoldMethodTool;
157
27
  exports.VariableReplacementService = require_VariableReplacementService.VariableReplacementService;
158
- exports.WriteToFileTool = require_stdio.WriteToFileTool;
159
- exports.cloneRepository = cloneRepository;
160
- exports.cloneSubdirectory = cloneSubdirectory;
161
- exports.fetchGitHubDirectoryContents = fetchGitHubDirectoryContents;
162
- exports.findWorkspaceRoot = findWorkspaceRoot;
163
- exports.parseGitHubUrl = parseGitHubUrl;
28
+ exports.WriteToFileTool = require_stdio.WriteToFileTool;
package/dist/index.d.cts CHANGED
@@ -794,42 +794,4 @@ interface Tool {
794
794
  execute: (args: unknown) => Promise<string>;
795
795
  }
796
796
  //#endregion
797
- //#region src/utils/git.d.ts
798
- /**
799
- * Find the workspace root by searching upwards for .git folder
800
- * Returns null if no .git folder is found (indicating a new project setup is needed)
801
- */
802
- declare function findWorkspaceRoot(startPath?: string): Promise<string | null>;
803
- /**
804
- * Parse GitHub URL to detect if it's a subdirectory
805
- * Supports formats:
806
- * - https://github.com/user/repo
807
- * - https://github.com/user/repo/tree/branch/path/to/dir
808
- * - https://github.com/user/repo/tree/main/path/to/dir
809
- */
810
- declare function parseGitHubUrl(url: string): {
811
- owner?: string;
812
- repo?: string;
813
- repoUrl: string;
814
- branch?: string;
815
- subdirectory?: string;
816
- isSubdirectory: boolean;
817
- };
818
- /**
819
- * Clone a subdirectory from a git repository using sparse checkout
820
- */
821
- declare function cloneSubdirectory(repoUrl: string, branch: string, subdirectory: string, targetFolder: string): Promise<void>;
822
- /**
823
- * Clone entire repository
824
- */
825
- declare function cloneRepository(repoUrl: string, targetFolder: string): Promise<void>;
826
- /**
827
- * Fetch directory listing from GitHub API
828
- */
829
- declare function fetchGitHubDirectoryContents(owner: string, repo: string, path: string, branch?: string): Promise<Array<{
830
- name: string;
831
- type: string;
832
- path: string;
833
- }>>;
834
- //#endregion
835
- export { ArchitectConfig, BoilerplateConfig, BoilerplateGeneratorService, BoilerplateInfo, BoilerplateOptions, BoilerplateService, FeatureConfig, FeatureOptions, FileSystemService, GenerateBoilerplateFileTool, GenerateBoilerplateTool, GenerateFeatureScaffoldTool, GeneratorContext, GeneratorFunction, HttpTransportHandler, IFileSystemService, INunjucksService, IScaffoldConfigLoader, IScaffoldService, ITemplateParserService, ITemplateService, IVariableReplacementService, ListBoilerplateResponse, ListBoilerplatesTool, ListScaffoldingMethodsTool, ParsedInclude, ScaffoldArgs, ScaffoldConfigLoader, ScaffoldGeneratorService, ScaffoldProcessingService, ScaffoldResult, ScaffoldService, ScaffoldYamlConfig, ScaffoldingMethodsService, SseTransportHandler, StdioTransportHandler, TemplateService, TemplateValidationResult, Tool, UseBoilerplateRequest, UseBoilerplateTool, UseScaffoldMethodTool, VariableReplacementService, WriteToFileTool, cloneRepository, cloneSubdirectory, fetchGitHubDirectoryContents, findWorkspaceRoot, parseGitHubUrl, scaffoldArgsSchema };
797
+ export { ArchitectConfig, BoilerplateConfig, BoilerplateGeneratorService, BoilerplateInfo, BoilerplateOptions, BoilerplateService, FeatureConfig, FeatureOptions, FileSystemService, GenerateBoilerplateFileTool, GenerateBoilerplateTool, GenerateFeatureScaffoldTool, GeneratorContext, GeneratorFunction, HttpTransportHandler, IFileSystemService, INunjucksService, IScaffoldConfigLoader, IScaffoldService, ITemplateParserService, ITemplateService, IVariableReplacementService, ListBoilerplateResponse, ListBoilerplatesTool, ListScaffoldingMethodsTool, ParsedInclude, ScaffoldArgs, ScaffoldConfigLoader, ScaffoldGeneratorService, ScaffoldProcessingService, ScaffoldResult, ScaffoldService, ScaffoldYamlConfig, ScaffoldingMethodsService, SseTransportHandler, StdioTransportHandler, TemplateService, TemplateValidationResult, Tool, UseBoilerplateRequest, UseBoilerplateTool, UseScaffoldMethodTool, VariableReplacementService, WriteToFileTool, scaffoldArgsSchema };
package/dist/index.d.mts CHANGED
@@ -795,42 +795,4 @@ interface Tool {
795
795
  execute: (args: unknown) => Promise<string>;
796
796
  }
797
797
  //#endregion
798
- //#region src/utils/git.d.ts
799
- /**
800
- * Find the workspace root by searching upwards for .git folder
801
- * Returns null if no .git folder is found (indicating a new project setup is needed)
802
- */
803
- declare function findWorkspaceRoot(startPath?: string): Promise<string | null>;
804
- /**
805
- * Parse GitHub URL to detect if it's a subdirectory
806
- * Supports formats:
807
- * - https://github.com/user/repo
808
- * - https://github.com/user/repo/tree/branch/path/to/dir
809
- * - https://github.com/user/repo/tree/main/path/to/dir
810
- */
811
- declare function parseGitHubUrl(url: string): {
812
- owner?: string;
813
- repo?: string;
814
- repoUrl: string;
815
- branch?: string;
816
- subdirectory?: string;
817
- isSubdirectory: boolean;
818
- };
819
- /**
820
- * Clone a subdirectory from a git repository using sparse checkout
821
- */
822
- declare function cloneSubdirectory(repoUrl: string, branch: string, subdirectory: string, targetFolder: string): Promise<void>;
823
- /**
824
- * Clone entire repository
825
- */
826
- declare function cloneRepository(repoUrl: string, targetFolder: string): Promise<void>;
827
- /**
828
- * Fetch directory listing from GitHub API
829
- */
830
- declare function fetchGitHubDirectoryContents(owner: string, repo: string, path: string, branch?: string): Promise<Array<{
831
- name: string;
832
- type: string;
833
- path: string;
834
- }>>;
835
- //#endregion
836
- export { ArchitectConfig, BoilerplateConfig, BoilerplateGeneratorService, BoilerplateInfo, BoilerplateOptions, BoilerplateService, FeatureConfig, FeatureOptions, FileSystemService, GenerateBoilerplateFileTool, GenerateBoilerplateTool, GenerateFeatureScaffoldTool, GeneratorContext, GeneratorFunction, HttpTransportHandler, IFileSystemService, INunjucksService, IScaffoldConfigLoader, IScaffoldService, ITemplateParserService, ITemplateService, IVariableReplacementService, ListBoilerplateResponse, ListBoilerplatesTool, ListScaffoldingMethodsTool, ParsedInclude, ScaffoldArgs, ScaffoldConfigLoader, ScaffoldGeneratorService, ScaffoldProcessingService, ScaffoldResult, ScaffoldService, ScaffoldYamlConfig, ScaffoldingMethodsService, SseTransportHandler, StdioTransportHandler, TemplateService, TemplateValidationResult, Tool, UseBoilerplateRequest, UseBoilerplateTool, UseScaffoldMethodTool, VariableReplacementService, WriteToFileTool, cloneRepository, cloneSubdirectory, fetchGitHubDirectoryContents, findWorkspaceRoot, parseGitHubUrl, scaffoldArgsSchema };
798
+ export { ArchitectConfig, BoilerplateConfig, BoilerplateGeneratorService, BoilerplateInfo, BoilerplateOptions, BoilerplateService, FeatureConfig, FeatureOptions, FileSystemService, GenerateBoilerplateFileTool, GenerateBoilerplateTool, GenerateFeatureScaffoldTool, GeneratorContext, GeneratorFunction, HttpTransportHandler, IFileSystemService, INunjucksService, IScaffoldConfigLoader, IScaffoldService, ITemplateParserService, ITemplateService, IVariableReplacementService, ListBoilerplateResponse, ListBoilerplatesTool, ListScaffoldingMethodsTool, ParsedInclude, ScaffoldArgs, ScaffoldConfigLoader, ScaffoldGeneratorService, ScaffoldProcessingService, ScaffoldResult, ScaffoldService, ScaffoldYamlConfig, ScaffoldingMethodsService, SseTransportHandler, StdioTransportHandler, TemplateService, TemplateValidationResult, Tool, UseBoilerplateRequest, UseBoilerplateTool, UseScaffoldMethodTool, VariableReplacementService, WriteToFileTool, scaffoldArgsSchema };
package/dist/index.mjs CHANGED
@@ -1,136 +1,8 @@
1
- import { a as UseScaffoldMethodTool, c as GenerateFeatureScaffoldTool, d as ScaffoldGeneratorService, f as BoilerplateService, i as WriteToFileTool, l as GenerateBoilerplateTool, n as SseTransportHandler, o as UseBoilerplateTool, p as BoilerplateGeneratorService, r as HttpTransportHandler, s as ListBoilerplatesTool, t as StdioTransportHandler, u as GenerateBoilerplateFileTool } from "./stdio-DovjJsGY.mjs";
2
- import { n as ScaffoldingMethodsService, r as FileSystemService, t as ListScaffoldingMethodsTool } from "./ListScaffoldingMethodsTool-BLTCwsd1.mjs";
1
+ import { a as UseScaffoldMethodTool, c as GenerateFeatureScaffoldTool, d as ScaffoldGeneratorService, f as BoilerplateService, i as WriteToFileTool, l as GenerateBoilerplateTool, n as SseTransportHandler, o as UseBoilerplateTool, p as BoilerplateGeneratorService, r as HttpTransportHandler, s as ListBoilerplatesTool, t as StdioTransportHandler, u as GenerateBoilerplateFileTool } from "./stdio-AbTm52SJ.mjs";
2
+ import { n as ScaffoldingMethodsService, r as FileSystemService, t as ListScaffoldingMethodsTool } from "./ListScaffoldingMethodsTool-B49G_iLj.mjs";
3
3
  import { t as ScaffoldConfigLoader } from "./ScaffoldConfigLoader-8YI7v2GJ.mjs";
4
- import { n as ScaffoldProcessingService, t as ScaffoldService } from "./ScaffoldService-CgYunbKN.mjs";
4
+ import { n as ScaffoldProcessingService, t as ScaffoldService } from "./ScaffoldService-DcsGLMuD.mjs";
5
5
  import { t as TemplateService } from "./TemplateService-CVDL2uqt.mjs";
6
6
  import { t as VariableReplacementService } from "./VariableReplacementService-B9RA8D0a.mjs";
7
- import path from "node:path";
8
- import { move, pathExists, remove, writeFile } from "@agiflowai/aicode-utils";
9
- import { execa } from "execa";
10
7
 
11
- //#region src/utils/git.ts
12
- /**
13
- * Execute a git command safely using execa to prevent command injection
14
- */
15
- async function execGit(args, cwd) {
16
- try {
17
- await execa("git", args, { cwd });
18
- } catch (error) {
19
- const execaError = error;
20
- throw new Error(`Git command failed: ${execaError.stderr || execaError.message}`);
21
- }
22
- }
23
- /**
24
- * Find the workspace root by searching upwards for .git folder
25
- * Returns null if no .git folder is found (indicating a new project setup is needed)
26
- */
27
- async function findWorkspaceRoot(startPath = process.cwd()) {
28
- let currentPath = path.resolve(startPath);
29
- const rootPath = path.parse(currentPath).root;
30
- while (true) {
31
- if (await pathExists(path.join(currentPath, ".git"))) return currentPath;
32
- if (currentPath === rootPath) return null;
33
- currentPath = path.dirname(currentPath);
34
- }
35
- }
36
- /**
37
- * Parse GitHub URL to detect if it's a subdirectory
38
- * Supports formats:
39
- * - https://github.com/user/repo
40
- * - https://github.com/user/repo/tree/branch/path/to/dir
41
- * - https://github.com/user/repo/tree/main/path/to/dir
42
- */
43
- function parseGitHubUrl(url) {
44
- const treeMatch = url.match(/^https?:\/\/github\.com\/([^/]+)\/([^/]+)\/tree\/([^/]+)\/(.+)$/);
45
- const blobMatch = url.match(/^https?:\/\/github\.com\/([^/]+)\/([^/]+)\/blob\/([^/]+)\/(.+)$/);
46
- const rootMatch = url.match(/^https?:\/\/github\.com\/([^/]+)\/([^/]+?)(?:\.git)?$/);
47
- if (treeMatch || blobMatch) {
48
- const match = treeMatch || blobMatch;
49
- return {
50
- owner: match?.[1],
51
- repo: match?.[2],
52
- repoUrl: `https://github.com/${match?.[1]}/${match?.[2]}.git`,
53
- branch: match?.[3],
54
- subdirectory: match?.[4],
55
- isSubdirectory: true
56
- };
57
- }
58
- if (rootMatch) return {
59
- owner: rootMatch[1],
60
- repo: rootMatch[2],
61
- repoUrl: `https://github.com/${rootMatch[1]}/${rootMatch[2]}.git`,
62
- isSubdirectory: false
63
- };
64
- return {
65
- repoUrl: url,
66
- isSubdirectory: false
67
- };
68
- }
69
- /**
70
- * Clone a subdirectory from a git repository using sparse checkout
71
- */
72
- async function cloneSubdirectory(repoUrl, branch, subdirectory, targetFolder) {
73
- const tempFolder = `${targetFolder}.tmp`;
74
- try {
75
- await execGit(["init", tempFolder]);
76
- await execGit([
77
- "remote",
78
- "add",
79
- "origin",
80
- repoUrl
81
- ], tempFolder);
82
- await execGit([
83
- "config",
84
- "core.sparseCheckout",
85
- "true"
86
- ], tempFolder);
87
- await writeFile(path.join(tempFolder, ".git", "info", "sparse-checkout"), `${subdirectory}\n`);
88
- await execGit([
89
- "pull",
90
- "--depth=1",
91
- "origin",
92
- branch
93
- ], tempFolder);
94
- const sourceDir = path.join(tempFolder, subdirectory);
95
- if (!await pathExists(sourceDir)) throw new Error(`Subdirectory '${subdirectory}' not found in repository at branch '${branch}'`);
96
- if (await pathExists(targetFolder)) throw new Error(`Target folder already exists: ${targetFolder}`);
97
- await move(sourceDir, targetFolder);
98
- await remove(tempFolder);
99
- } catch (error) {
100
- if (await pathExists(tempFolder)) await remove(tempFolder);
101
- throw error;
102
- }
103
- }
104
- /**
105
- * Clone entire repository
106
- */
107
- async function cloneRepository(repoUrl, targetFolder) {
108
- await execGit([
109
- "clone",
110
- repoUrl,
111
- targetFolder
112
- ]);
113
- const gitFolder = path.join(targetFolder, ".git");
114
- if (await pathExists(gitFolder)) await remove(gitFolder);
115
- }
116
- /**
117
- * Fetch directory listing from GitHub API
118
- */
119
- async function fetchGitHubDirectoryContents(owner, repo, path$1, branch = "main") {
120
- const url = `https://api.github.com/repos/${owner}/${repo}/contents/${path$1}?ref=${branch}`;
121
- const response = await fetch(url, { headers: {
122
- Accept: "application/vnd.github.v3+json",
123
- "User-Agent": "scaffold-mcp"
124
- } });
125
- if (!response.ok) throw new Error(`Failed to fetch directory contents: ${response.statusText}`);
126
- const data = await response.json();
127
- if (!Array.isArray(data)) throw new Error("Expected directory but got file");
128
- return data.map((item) => ({
129
- name: item.name,
130
- type: item.type,
131
- path: item.path
132
- }));
133
- }
134
-
135
- //#endregion
136
- export { BoilerplateGeneratorService, BoilerplateService, FileSystemService, GenerateBoilerplateFileTool, GenerateBoilerplateTool, GenerateFeatureScaffoldTool, HttpTransportHandler, ListBoilerplatesTool, ListScaffoldingMethodsTool, ScaffoldConfigLoader, ScaffoldGeneratorService, ScaffoldProcessingService, ScaffoldService, ScaffoldingMethodsService, SseTransportHandler, StdioTransportHandler, TemplateService, UseBoilerplateTool, UseScaffoldMethodTool, VariableReplacementService, WriteToFileTool, cloneRepository, cloneSubdirectory, fetchGitHubDirectoryContents, findWorkspaceRoot, parseGitHubUrl };
8
+ export { BoilerplateGeneratorService, BoilerplateService, FileSystemService, GenerateBoilerplateFileTool, GenerateBoilerplateTool, GenerateFeatureScaffoldTool, HttpTransportHandler, ListBoilerplatesTool, ListScaffoldingMethodsTool, ScaffoldConfigLoader, ScaffoldGeneratorService, ScaffoldProcessingService, ScaffoldService, ScaffoldingMethodsService, SseTransportHandler, StdioTransportHandler, TemplateService, UseBoilerplateTool, UseScaffoldMethodTool, VariableReplacementService, WriteToFileTool };
@@ -1,6 +1,6 @@
1
- import { i as PaginationHelper, n as ScaffoldingMethodsService, r as FileSystemService } from "./ListScaffoldingMethodsTool-BLTCwsd1.mjs";
1
+ import { i as PaginationHelper, n as ScaffoldingMethodsService, r as FileSystemService } from "./ListScaffoldingMethodsTool-B49G_iLj.mjs";
2
2
  import { t as ScaffoldConfigLoader } from "./ScaffoldConfigLoader-8YI7v2GJ.mjs";
3
- import { t as ScaffoldService } from "./ScaffoldService-CgYunbKN.mjs";
3
+ import { t as ScaffoldService } from "./ScaffoldService-DcsGLMuD.mjs";
4
4
  import { t as TemplateService } from "./TemplateService-CVDL2uqt.mjs";
5
5
  import { t as VariableReplacementService } from "./VariableReplacementService-B9RA8D0a.mjs";
6
6
  import * as path$1 from "node:path";
@@ -1,9 +1,9 @@
1
- const require_chunk = require('./chunk-CUT6urMc.cjs');
2
- const require_ListScaffoldingMethodsTool = require('./ListScaffoldingMethodsTool-BuxKRbwi.cjs');
3
- const require_ScaffoldConfigLoader = require('./ScaffoldConfigLoader-CQlXVksz.cjs');
4
- const require_ScaffoldService = require('./ScaffoldService-BPyiY_0B.cjs');
5
- const require_TemplateService = require('./TemplateService-CAD8jkoO.cjs');
6
- const require_VariableReplacementService = require('./VariableReplacementService-DDG5KZpb.cjs');
1
+ const require_chunk = require('./chunk-CbDLau6x.cjs');
2
+ const require_ListScaffoldingMethodsTool = require('./ListScaffoldingMethodsTool-DuYGFDwJ.cjs');
3
+ const require_ScaffoldConfigLoader = require('./ScaffoldConfigLoader-BWpNpMx-.cjs');
4
+ const require_ScaffoldService = require('./ScaffoldService-DSQBnAHm.cjs');
5
+ const require_TemplateService = require('./TemplateService-7QcWREot.cjs');
6
+ const require_VariableReplacementService = require('./VariableReplacementService-DNYx0Dym.cjs');
7
7
  let node_path = require("node:path");
8
8
  node_path = require_chunk.__toESM(node_path);
9
9
  let __agiflowai_aicode_utils = require("@agiflowai/aicode-utils");
@@ -1,4 +1,4 @@
1
- import { t as ListScaffoldingMethodsTool } from "./ListScaffoldingMethodsTool-BLTCwsd1.mjs";
1
+ import { t as ListScaffoldingMethodsTool } from "./ListScaffoldingMethodsTool-B49G_iLj.mjs";
2
2
  import "./TemplateService-CVDL2uqt.mjs";
3
3
  import path from "node:path";
4
4
  import { ProjectFinderService, TemplatesManagerService } from "@agiflowai/aicode-utils";
@@ -37,16 +37,26 @@ var UseScaffoldMethodHook = class {
37
37
  decision: DECISION_SKIP,
38
38
  message: "Scaffolding methods already provided for this file"
39
39
  };
40
- const tool = new ListScaffoldingMethodsTool(await TemplatesManagerService.findTemplatesPath(), false);
40
+ const templatesPath = await TemplatesManagerService.findTemplatesPath();
41
+ if (!templatesPath) return {
42
+ decision: DECISION_SKIP,
43
+ message: "Templates folder not found - skipping scaffold method check"
44
+ };
45
+ const tool = new ListScaffoldingMethodsTool(templatesPath, false);
41
46
  const projectFinder = new ProjectFinderService(await TemplatesManagerService.getWorkspaceRoot(context.cwd));
42
47
  const absoluteFilePath = path.isAbsolute(filePath) ? filePath : path.join(context.cwd, filePath);
43
48
  const projectPath = (await projectFinder.findProjectForFile(absoluteFilePath))?.root || context.cwd;
44
49
  const result = await tool.execute({ projectPath });
50
+ const firstContent = result.content[0];
51
+ if (firstContent?.type !== "text") return {
52
+ decision: DECISION_SKIP,
53
+ message: "⚠️ Unexpected response type from scaffolding methods tool"
54
+ };
45
55
  if (result.isError) return {
46
56
  decision: DECISION_SKIP,
47
- message: `⚠️ Could not load scaffolding methods: ${result.content[0].text}`
57
+ message: `⚠️ Could not load scaffolding methods: ${firstContent.text}`
48
58
  };
49
- const resultText = result.content[0]?.text;
59
+ const resultText = firstContent.text;
50
60
  if (typeof resultText !== "string") return {
51
61
  decision: DECISION_SKIP,
52
62
  message: "⚠️ Invalid response format from scaffolding methods tool"
@@ -1,4 +1,4 @@
1
- import { t as ListScaffoldingMethodsTool } from "./ListScaffoldingMethodsTool-BLTCwsd1.mjs";
1
+ import { t as ListScaffoldingMethodsTool } from "./ListScaffoldingMethodsTool-B49G_iLj.mjs";
2
2
  import "./TemplateService-CVDL2uqt.mjs";
3
3
  import { TemplatesManagerService } from "@agiflowai/aicode-utils";
4
4
  import { DECISION_ALLOW, DECISION_DENY, DECISION_SKIP, ExecutionLogService } from "@agiflowai/hooks-adapter";
@@ -37,7 +37,17 @@ var UseScaffoldMethodHook = class {
37
37
  message: "Scaffolding methods already provided in this session"
38
38
  };
39
39
  }
40
- const result = await new ListScaffoldingMethodsTool(await TemplatesManagerService.findTemplatesPath(), false).execute(context.tool_input || {});
40
+ const templatesPath = await TemplatesManagerService.findTemplatesPath();
41
+ if (!templatesPath) return {
42
+ decision: DECISION_SKIP,
43
+ message: "Templates folder not found - skipping scaffold method check"
44
+ };
45
+ const result = await new ListScaffoldingMethodsTool(templatesPath, false).execute(context.tool_input || {});
46
+ const firstContent = result.content[0];
47
+ if (firstContent?.type !== "text") return {
48
+ decision: DECISION_SKIP,
49
+ message: "⚠️ Unexpected response type from scaffolding methods tool"
50
+ };
41
51
  if (result.isError) {
42
52
  await executionLog.logExecution({
43
53
  filePath: sessionKey,
@@ -46,10 +56,10 @@ var UseScaffoldMethodHook = class {
46
56
  });
47
57
  return {
48
58
  decision: DECISION_SKIP,
49
- message: `⚠️ Could not load scaffolding methods: ${result.content[0].text}`
59
+ message: `⚠️ Could not load scaffolding methods: ${firstContent.text}`
50
60
  };
51
61
  }
52
- const resultText = result.content[0]?.text;
62
+ const resultText = firstContent.text;
53
63
  if (typeof resultText !== "string") return {
54
64
  decision: DECISION_SKIP,
55
65
  message: "⚠️ Invalid response format from scaffolding methods tool"
@@ -1,6 +1,6 @@
1
- const require_chunk = require('./chunk-CUT6urMc.cjs');
2
- const require_ListScaffoldingMethodsTool = require('./ListScaffoldingMethodsTool-BuxKRbwi.cjs');
3
- require('./TemplateService-CAD8jkoO.cjs');
1
+ const require_chunk = require('./chunk-CbDLau6x.cjs');
2
+ const require_ListScaffoldingMethodsTool = require('./ListScaffoldingMethodsTool-DuYGFDwJ.cjs');
3
+ require('./TemplateService-7QcWREot.cjs');
4
4
  let __agiflowai_aicode_utils = require("@agiflowai/aicode-utils");
5
5
  let __agiflowai_hooks_adapter = require("@agiflowai/hooks-adapter");
6
6
 
@@ -38,7 +38,17 @@ var UseScaffoldMethodHook = class {
38
38
  message: "Scaffolding methods already provided in this session"
39
39
  };
40
40
  }
41
- const result = await new require_ListScaffoldingMethodsTool.ListScaffoldingMethodsTool(await __agiflowai_aicode_utils.TemplatesManagerService.findTemplatesPath(), false).execute(context.tool_input || {});
41
+ const templatesPath = await __agiflowai_aicode_utils.TemplatesManagerService.findTemplatesPath();
42
+ if (!templatesPath) return {
43
+ decision: __agiflowai_hooks_adapter.DECISION_SKIP,
44
+ message: "Templates folder not found - skipping scaffold method check"
45
+ };
46
+ const result = await new require_ListScaffoldingMethodsTool.ListScaffoldingMethodsTool(templatesPath, false).execute(context.tool_input || {});
47
+ const firstContent = result.content[0];
48
+ if (firstContent?.type !== "text") return {
49
+ decision: __agiflowai_hooks_adapter.DECISION_SKIP,
50
+ message: "⚠️ Unexpected response type from scaffolding methods tool"
51
+ };
42
52
  if (result.isError) {
43
53
  await executionLog.logExecution({
44
54
  filePath: sessionKey,
@@ -47,10 +57,10 @@ var UseScaffoldMethodHook = class {
47
57
  });
48
58
  return {
49
59
  decision: __agiflowai_hooks_adapter.DECISION_SKIP,
50
- message: `⚠️ Could not load scaffolding methods: ${result.content[0].text}`
60
+ message: `⚠️ Could not load scaffolding methods: ${firstContent.text}`
51
61
  };
52
62
  }
53
- const resultText = result.content[0]?.text;
63
+ const resultText = firstContent.text;
54
64
  if (typeof resultText !== "string") return {
55
65
  decision: __agiflowai_hooks_adapter.DECISION_SKIP,
56
66
  message: "⚠️ Invalid response format from scaffolding methods tool"
@@ -1,6 +1,6 @@
1
- const require_chunk = require('./chunk-CUT6urMc.cjs');
2
- const require_ListScaffoldingMethodsTool = require('./ListScaffoldingMethodsTool-BuxKRbwi.cjs');
3
- require('./TemplateService-CAD8jkoO.cjs');
1
+ const require_chunk = require('./chunk-CbDLau6x.cjs');
2
+ const require_ListScaffoldingMethodsTool = require('./ListScaffoldingMethodsTool-DuYGFDwJ.cjs');
3
+ require('./TemplateService-7QcWREot.cjs');
4
4
  let node_path = require("node:path");
5
5
  node_path = require_chunk.__toESM(node_path);
6
6
  let __agiflowai_aicode_utils = require("@agiflowai/aicode-utils");
@@ -41,16 +41,26 @@ var UseScaffoldMethodHook = class {
41
41
  decision: __agiflowai_hooks_adapter.DECISION_SKIP,
42
42
  message: "Scaffolding methods already provided for this file"
43
43
  };
44
- const tool = new require_ListScaffoldingMethodsTool.ListScaffoldingMethodsTool(await __agiflowai_aicode_utils.TemplatesManagerService.findTemplatesPath(), false);
44
+ const templatesPath = await __agiflowai_aicode_utils.TemplatesManagerService.findTemplatesPath();
45
+ if (!templatesPath) return {
46
+ decision: __agiflowai_hooks_adapter.DECISION_SKIP,
47
+ message: "Templates folder not found - skipping scaffold method check"
48
+ };
49
+ const tool = new require_ListScaffoldingMethodsTool.ListScaffoldingMethodsTool(templatesPath, false);
45
50
  const projectFinder = new __agiflowai_aicode_utils.ProjectFinderService(await __agiflowai_aicode_utils.TemplatesManagerService.getWorkspaceRoot(context.cwd));
46
51
  const absoluteFilePath = node_path.default.isAbsolute(filePath) ? filePath : node_path.default.join(context.cwd, filePath);
47
52
  const projectPath = (await projectFinder.findProjectForFile(absoluteFilePath))?.root || context.cwd;
48
53
  const result = await tool.execute({ projectPath });
54
+ const firstContent = result.content[0];
55
+ if (firstContent?.type !== "text") return {
56
+ decision: __agiflowai_hooks_adapter.DECISION_SKIP,
57
+ message: "⚠️ Unexpected response type from scaffolding methods tool"
58
+ };
49
59
  if (result.isError) return {
50
60
  decision: __agiflowai_hooks_adapter.DECISION_SKIP,
51
- message: `⚠️ Could not load scaffolding methods: ${result.content[0].text}`
61
+ message: `⚠️ Could not load scaffolding methods: ${firstContent.text}`
52
62
  };
53
- const resultText = result.content[0]?.text;
63
+ const resultText = firstContent.text;
54
64
  if (typeof resultText !== "string") return {
55
65
  decision: __agiflowai_hooks_adapter.DECISION_SKIP,
56
66
  message: "⚠️ Invalid response format from scaffolding methods tool"
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": "1.0.8",
4
+ "version": "1.0.10",
5
5
  "license": "AGPL-3.0",
6
6
  "author": "AgiflowIO",
7
7
  "repository": {
@@ -37,21 +37,21 @@
37
37
  "dependencies": {
38
38
  "@composio/json-schema-to-zod": "0.1.15",
39
39
  "@inquirer/prompts": "^7.8.6",
40
- "@modelcontextprotocol/sdk": "1.19.1",
40
+ "@modelcontextprotocol/sdk": "1.24.0",
41
41
  "chalk": "5.6.2",
42
42
  "commander": "14.0.1",
43
43
  "execa": "^9.5.2",
44
44
  "express": "^4.21.2",
45
- "js-yaml": "4.1.0",
45
+ "js-yaml": "4.1.1",
46
46
  "liquidjs": "10.21.1",
47
47
  "minimatch": "^10.0.1",
48
48
  "pino": "^10.0.0",
49
49
  "pino-pretty": "^13.1.1",
50
50
  "zod": "3.25.76",
51
- "@agiflowai/aicode-utils": "1.0.7",
52
- "@agiflowai/coding-agent-bridge": "1.0.7",
53
- "@agiflowai/hooks-adapter": "0.0.3",
54
- "@agiflowai/architect-mcp": "1.0.8"
51
+ "@agiflowai/aicode-utils": "1.0.9",
52
+ "@agiflowai/architect-mcp": "1.0.10",
53
+ "@agiflowai/hooks-adapter": "0.0.5",
54
+ "@agiflowai/coding-agent-bridge": "1.0.9"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@types/express": "^5.0.0",
@@ -1,3 +0,0 @@
1
- import { t as ScaffoldService } from "./ScaffoldService-CgYunbKN.mjs";
2
-
3
- export { ScaffoldService };
@@ -1,3 +0,0 @@
1
- const require_ScaffoldService = require('./ScaffoldService-BPyiY_0B.cjs');
2
-
3
- exports.ScaffoldService = require_ScaffoldService.ScaffoldService;
@@ -1,3 +0,0 @@
1
- const require_TemplateService = require('./TemplateService-CAD8jkoO.cjs');
2
-
3
- exports.TemplateService = require_TemplateService.TemplateService;