@agiflowai/scaffold-mcp 1.0.9 → 1.0.11
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/{ListScaffoldingMethodsTool-BLTCwsd1.mjs → ListScaffoldingMethodsTool-B49G_iLj.mjs} +1 -1
- package/dist/{ListScaffoldingMethodsTool-9bLDuvy1.cjs → ListScaffoldingMethodsTool-DuYGFDwJ.cjs} +1 -1
- package/dist/{ScaffoldService-S6ggnyvn.cjs → ScaffoldService-DSQBnAHm.cjs} +3 -1
- package/dist/{ScaffoldService-CgYunbKN.mjs → ScaffoldService-DcsGLMuD.mjs} +3 -1
- package/dist/ScaffoldService-DfXjmrNT.cjs +3 -0
- package/dist/ScaffoldService-dL74anIv.mjs +3 -0
- package/dist/cli.cjs +127 -33
- package/dist/cli.mjs +127 -33
- package/dist/index.cjs +4 -139
- package/dist/index.d.cts +1 -39
- package/dist/index.d.mts +1 -39
- package/dist/index.mjs +4 -132
- package/dist/{stdio-DovjJsGY.mjs → stdio-AbTm52SJ.mjs} +2 -2
- package/dist/{stdio-BjCeL-i_.cjs → stdio-baUp7xGL.cjs} +2 -2
- package/dist/{useScaffoldMethod-CsBTssSw.mjs → useScaffoldMethod-BMWhFebp.mjs} +14 -4
- package/dist/{useScaffoldMethod-CHJAsgA2.mjs → useScaffoldMethod-CPgJIBHx.mjs} +14 -4
- package/dist/{useScaffoldMethod-DfG9reER.cjs → useScaffoldMethod-CcrpFEPv.cjs} +14 -4
- package/dist/{useScaffoldMethod-FvOmyD91.cjs → useScaffoldMethod-DOvwnNOJ.cjs} +14 -4
- package/package.json +7 -7
- package/dist/ScaffoldService-BCjJE9yK.mjs +0 -3
- package/dist/ScaffoldService-ybJPks4R.cjs +0 -3
package/dist/{ListScaffoldingMethodsTool-BLTCwsd1.mjs → ListScaffoldingMethodsTool-B49G_iLj.mjs}
RENAMED
|
@@ -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-
|
|
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;
|
package/dist/{ListScaffoldingMethodsTool-9bLDuvy1.cjs → ListScaffoldingMethodsTool-DuYGFDwJ.cjs}
RENAMED
|
@@ -223,7 +223,7 @@ 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-
|
|
226
|
+
const ScaffoldService = (await Promise.resolve().then(() => require("./ScaffoldService-DfXjmrNT.cjs"))).ScaffoldService;
|
|
227
227
|
const ScaffoldConfigLoader = (await Promise.resolve().then(() => require("./ScaffoldConfigLoader-HutEtfaH.cjs"))).ScaffoldConfigLoader;
|
|
228
228
|
const VariableReplacementService = (await Promise.resolve().then(() => require("./VariableReplacementService-wuYKgeui.cjs"))).VariableReplacementService;
|
|
229
229
|
const TemplateService$1 = (await Promise.resolve().then(() => require("./TemplateService-DUbdBOFs.cjs"))).TemplateService;
|
|
@@ -112,7 +112,9 @@ var ScaffoldService = class {
|
|
|
112
112
|
this.fileSystem = fileSystem;
|
|
113
113
|
this.scaffoldConfigLoader = scaffoldConfigLoader;
|
|
114
114
|
this.variableReplacer = variableReplacer;
|
|
115
|
-
|
|
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
|
-
|
|
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
|
/**
|
package/dist/cli.cjs
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
const require_chunk = require('./chunk-CbDLau6x.cjs');
|
|
3
|
-
const require_stdio = require('./stdio-
|
|
4
|
-
const require_ListScaffoldingMethodsTool = require('./ListScaffoldingMethodsTool-
|
|
3
|
+
const require_stdio = require('./stdio-baUp7xGL.cjs');
|
|
4
|
+
const require_ListScaffoldingMethodsTool = require('./ListScaffoldingMethodsTool-DuYGFDwJ.cjs');
|
|
5
5
|
require('./ScaffoldConfigLoader-BWpNpMx-.cjs');
|
|
6
|
-
require('./ScaffoldService-
|
|
6
|
+
require('./ScaffoldService-DSQBnAHm.cjs');
|
|
7
7
|
const require_TemplateService = require('./TemplateService-7QcWREot.cjs');
|
|
8
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");
|
|
12
|
+
let zod = require("zod");
|
|
12
13
|
let __modelcontextprotocol_sdk_types_js = require("@modelcontextprotocol/sdk/types.js");
|
|
13
14
|
let commander = require("commander");
|
|
14
15
|
let __modelcontextprotocol_sdk_server_index_js = require("@modelcontextprotocol/sdk/server/index.js");
|
|
@@ -16,7 +17,7 @@ let __agiflowai_coding_agent_bridge = require("@agiflowai/coding-agent-bridge");
|
|
|
16
17
|
let __agiflowai_hooks_adapter = require("@agiflowai/hooks-adapter");
|
|
17
18
|
|
|
18
19
|
//#region package.json
|
|
19
|
-
var version = "1.0.
|
|
20
|
+
var version = "1.0.11";
|
|
20
21
|
|
|
21
22
|
//#endregion
|
|
22
23
|
//#region src/commands/boilerplate.ts
|
|
@@ -26,7 +27,12 @@ var version = "1.0.8";
|
|
|
26
27
|
const boilerplateCommand = new commander.Command("boilerplate").description("Manage boilerplate templates");
|
|
27
28
|
boilerplateCommand.command("list").description("List all available boilerplate templates").option("-c, --cursor <cursor>", "Pagination cursor for next page").action(async (options) => {
|
|
28
29
|
try {
|
|
29
|
-
const
|
|
30
|
+
const templatesDir = await __agiflowai_aicode_utils.TemplatesManagerService.findTemplatesPath();
|
|
31
|
+
if (!templatesDir) {
|
|
32
|
+
__agiflowai_aicode_utils.messages.error("Templates folder not found. Create a templates folder or specify templatesPath in toolkit.yaml");
|
|
33
|
+
process.exit(1);
|
|
34
|
+
}
|
|
35
|
+
const { boilerplates, nextCursor } = await new require_stdio.BoilerplateService(templatesDir).listBoilerplates(options.cursor);
|
|
30
36
|
if (boilerplates.length === 0) {
|
|
31
37
|
__agiflowai_aicode_utils.messages.warning("No boilerplate templates found.");
|
|
32
38
|
return;
|
|
@@ -52,7 +58,12 @@ boilerplateCommand.command("list").description("List all available boilerplate t
|
|
|
52
58
|
});
|
|
53
59
|
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
60
|
try {
|
|
55
|
-
const
|
|
61
|
+
const templatesDir = await __agiflowai_aicode_utils.TemplatesManagerService.findTemplatesPath();
|
|
62
|
+
if (!templatesDir) {
|
|
63
|
+
__agiflowai_aicode_utils.messages.error("Templates folder not found. Create a templates folder or specify templatesPath in toolkit.yaml");
|
|
64
|
+
process.exit(1);
|
|
65
|
+
}
|
|
66
|
+
const boilerplateService = new require_stdio.BoilerplateService(templatesDir);
|
|
56
67
|
let variables = {};
|
|
57
68
|
if (options.vars) try {
|
|
58
69
|
variables = JSON.parse(options.vars);
|
|
@@ -124,7 +135,12 @@ boilerplateCommand.command("create <boilerplateName>").description("Create a new
|
|
|
124
135
|
});
|
|
125
136
|
boilerplateCommand.command("info <boilerplateName>").description("Show detailed information about a boilerplate template").action(async (boilerplateName) => {
|
|
126
137
|
try {
|
|
127
|
-
const
|
|
138
|
+
const templatesDir = await __agiflowai_aicode_utils.TemplatesManagerService.findTemplatesPath();
|
|
139
|
+
if (!templatesDir) {
|
|
140
|
+
__agiflowai_aicode_utils.messages.error("Templates folder not found. Create a templates folder or specify templatesPath in toolkit.yaml");
|
|
141
|
+
process.exit(1);
|
|
142
|
+
}
|
|
143
|
+
const bp = await new require_stdio.BoilerplateService(templatesDir).getBoilerplate(boilerplateName);
|
|
128
144
|
if (!bp) {
|
|
129
145
|
__agiflowai_aicode_utils.messages.error(`Boilerplate '${boilerplateName}' not found.`);
|
|
130
146
|
process.exit(1);
|
|
@@ -148,18 +164,30 @@ var server_default = "Use this MCP server to {% if isMonolith %}create your mono
|
|
|
148
164
|
|
|
149
165
|
//#endregion
|
|
150
166
|
//#region src/instructions/prompts/generate-boilerplate.md?raw
|
|
151
|
-
var generate_boilerplate_default = "You are helping create a new boilerplate template configuration using the scaffold-mcp MCP tools.\n\n{% if request %}User request: {{ request }}\n{% endif %}\nYour task:\n\n1. **Gather Information**: Ask for any missing details:\n - Framework/technology (e.g., \"React Vite\", \"Express API\", \"Next.js 15\")\n - Template name (kebab-case, e.g., \"react-vite\", \"nextjs-15\")\n - Boilerplate name (prefixed with \"scaffold-\", e.g., \"scaffold-vite-app\")\n {% if not isMonolith %}- Target folder (e.g., \"apps\", \"packages\"){% else %}- Target folder (defaults to \".\" for monolith mode){% endif %}\n - Project type (app, library, service, etc.)\n - Required variables (at minimum: appName or packageName)\n - Files to include in the template\n\n2. **Use MCP Tools** in order:\n - `generate-boilerplate` - Creates the boilerplate configuration\n - `generate-boilerplate-file` - Creates each template file\n {% if not isMonolith %}- `list-boilerplates` - Verify it appears{% endif %}\n - `use-boilerplate` - Test the boilerplate\n\nImportant:\n- Template naming: Use kebab-case (e.g., \"react-vite\", \"express-api\")\n- Boilerplate naming: Prefix with \"scaffold-\" (e.g., \"scaffold-vite-app\")\n{% if not isMonolith %}- Target folder: \"apps\" for applications, \"packages\" for libraries{% else %}- Target folder: \".\" for monolith projects (creates files at workspace root){% endif %}\n- Include files explicitly - avoid wildcards\n- Template syntax: use {{ variableName }}\n\n**Description Field Guidelines (CRITICAL)**:\nThe description should be a comprehensive multi-paragraph overview (3-5 sentences):\n- Paragraph 1: Core technology stack and primary value proposition\n- Paragraph 2: Target use cases and ideal project types\n- Paragraph 3: Key integrations or special features (if applicable)\n\nExample:\n\"A modern React SPA template powered by Vite for lightning-fast HMR, featuring TanStack Router for type-safe routing and TanStack Query for server state management.\nPerfect for building data-driven dashboards, admin panels, and interactive web applications requiring client-side routing and real-time data synchronization.\n\nIncludes Agiflow Config Management System integration with systematic environment variable naming (VITE_{CATEGORY}_{SUBCATEGORY}_{PROPERTY}) and auto-generated configuration templates for cloud deployment.\"\n\n**Instruction Field Guidelines (CRITICAL)**:\nThe instruction should be a detailed multi-section guide that helps AI understand the codebase:\n\n1. **File purposes** section: List each major file/directory with its purpose\n Format: \"- path/to/file: Description of what this file does\"\n\n2. **How to use the scaffolded code** section: Step-by-step workflows\n Format: Numbered list with specific examples\n - How to add routes/pages\n - How to fetch data\n - How to handle authentication\n - How to configure environment variables\n\n3. **Design patterns to follow** section: Key architectural decisions\n Format: \"- Pattern Name: Explanation and when to use it\"\n - Routing patterns\n - State management patterns\n - Data fetching patterns\n - Error handling patterns\n - Performance optimization patterns\n\nExample structure:\n\"[Framework] application template with [key technologies].\n\nFile purposes:\n- package.json: NPM package configuration with [framework] and dependencies\n- src/main.tsx: Application entry point with [setup details]\n- src/routes/: Route definitions following [pattern]\n[... list all major files ...]\n\nHow to use the scaffolded code:\n1. Routes: Create new routes by [specific instructions with example]\n2. Data Fetching: Use [specific pattern] for [use case]\n3. Authentication: Use [specific components/modules] for user management\n[... numbered steps for common tasks ...]\n\nDesign patterns to follow:\n- File-based Routing: Use directory structure in src/routes/ to define URL paths\n- Type-safe Routes: Leverage [framework] type inference for params\n- State Management: Use [library] for server state, [library] for client state\n[... list key patterns with explanations ...]\"\n\nTemplate File Content Guidelines:\n- Keep content MINIMAL and business-agnostic\n- Focus on structure and patterns, not business logic\n- Use placeholder/generic examples only\n- Include essential boilerplate code only\n- Let AI fill in specific logic later\n- Add clear headers with design patterns and coding standards\n";
|
|
167
|
+
var generate_boilerplate_default = "{% if promptAsSkill %}---\nname: generate-boilerplate\ndescription: Create a new boilerplate template configuration for scaffolding new projects. Use this skill when the user wants to define a reusable project template (e.g., React app, Express API, Next.js starter) that can be used to bootstrap future projects. This is an admin/developer tool for creating the template definitions themselves, not for using existing templates. It generates scaffold.yaml configuration and template files with Liquid syntax for variable substitution.\n---\n\n{% endif %}You are helping create a new boilerplate template configuration using the scaffold-mcp MCP tools.\n\n{% if request %}User request: {{ request }}\n{% endif %}\nYour task:\n\n1. **Gather Information**: Ask for any missing details:\n - Framework/technology (e.g., \"React Vite\", \"Express API\", \"Next.js 15\")\n - Template name (kebab-case, e.g., \"react-vite\", \"nextjs-15\")\n - Boilerplate name (prefixed with \"scaffold-\", e.g., \"scaffold-vite-app\")\n {% if not isMonolith %}- Target folder (e.g., \"apps\", \"packages\"){% else %}- Target folder (defaults to \".\" for monolith mode){% endif %}\n - Project type (app, library, service, etc.)\n - Required variables (at minimum: appName or packageName)\n - Files to include in the template\n\n2. **Use MCP Tools** in order:\n - `generate-boilerplate` - Creates the boilerplate configuration\n - `generate-boilerplate-file` - Creates each template file\n {% if not isMonolith %}- `list-boilerplates` - Verify it appears{% endif %}\n - `use-boilerplate` - Test the boilerplate\n\nImportant:\n- Template naming: Use kebab-case (e.g., \"react-vite\", \"express-api\")\n- Boilerplate naming: Prefix with \"scaffold-\" (e.g., \"scaffold-vite-app\")\n{% if not isMonolith %}- Target folder: \"apps\" for applications, \"packages\" for libraries{% else %}- Target folder: \".\" for monolith projects (creates files at workspace root){% endif %}\n- Include files explicitly - avoid wildcards\n- Template syntax: use {{ variableName }}\n\n**Description Field Guidelines (CRITICAL)**:\nThe description should be a comprehensive multi-paragraph overview (3-5 sentences):\n- Paragraph 1: Core technology stack and primary value proposition\n- Paragraph 2: Target use cases and ideal project types\n- Paragraph 3: Key integrations or special features (if applicable)\n\nExample:\n\"A modern React SPA template powered by Vite for lightning-fast HMR, featuring TanStack Router for type-safe routing and TanStack Query for server state management.\nPerfect for building data-driven dashboards, admin panels, and interactive web applications requiring client-side routing and real-time data synchronization.\n\nIncludes Agiflow Config Management System integration with systematic environment variable naming (VITE_{CATEGORY}_{SUBCATEGORY}_{PROPERTY}) and auto-generated configuration templates for cloud deployment.\"\n\n**Instruction Field Guidelines (CRITICAL)**:\nThe instruction should be a detailed multi-section guide that helps AI understand the codebase:\n\n1. **File purposes** section: List each major file/directory with its purpose\n Format: \"- path/to/file: Description of what this file does\"\n\n2. **How to use the scaffolded code** section: Step-by-step workflows\n Format: Numbered list with specific examples\n - How to add routes/pages\n - How to fetch data\n - How to handle authentication\n - How to configure environment variables\n\n3. **Design patterns to follow** section: Key architectural decisions\n Format: \"- Pattern Name: Explanation and when to use it\"\n - Routing patterns\n - State management patterns\n - Data fetching patterns\n - Error handling patterns\n - Performance optimization patterns\n\nExample structure:\n\"[Framework] application template with [key technologies].\n\nFile purposes:\n- package.json: NPM package configuration with [framework] and dependencies\n- src/main.tsx: Application entry point with [setup details]\n- src/routes/: Route definitions following [pattern]\n[... list all major files ...]\n\nHow to use the scaffolded code:\n1. Routes: Create new routes by [specific instructions with example]\n2. Data Fetching: Use [specific pattern] for [use case]\n3. Authentication: Use [specific components/modules] for user management\n[... numbered steps for common tasks ...]\n\nDesign patterns to follow:\n- File-based Routing: Use directory structure in src/routes/ to define URL paths\n- Type-safe Routes: Leverage [framework] type inference for params\n- State Management: Use [library] for server state, [library] for client state\n[... list key patterns with explanations ...]\"\n\nTemplate File Content Guidelines:\n- Keep content MINIMAL and business-agnostic\n- Focus on structure and patterns, not business logic\n- Use placeholder/generic examples only\n- Include essential boilerplate code only\n- Let AI fill in specific logic later\n- Add clear headers with design patterns and coding standards\n";
|
|
152
168
|
|
|
153
169
|
//#endregion
|
|
154
170
|
//#region src/prompts/GenerateBoilerplatePrompt.ts
|
|
155
171
|
/**
|
|
172
|
+
* Schema for GenerateBoilerplatePrompt constructor options
|
|
173
|
+
*/
|
|
174
|
+
const generateBoilerplatePromptOptionsSchema = zod.z.object({
|
|
175
|
+
isMonolith: zod.z.boolean().default(false).describe("Whether the project is a monolith"),
|
|
176
|
+
promptAsSkill: zod.z.boolean().default(false).describe("Render prompt with skill front matter")
|
|
177
|
+
});
|
|
178
|
+
/**
|
|
156
179
|
* Prompt for generating boilerplates
|
|
157
180
|
*/
|
|
158
181
|
var GenerateBoilerplatePrompt = class GenerateBoilerplatePrompt {
|
|
159
182
|
static PROMPT_NAME = "generate-boilerplate";
|
|
160
183
|
templateService = new require_TemplateService.TemplateService();
|
|
161
|
-
|
|
162
|
-
|
|
184
|
+
options;
|
|
185
|
+
constructor(options = {}) {
|
|
186
|
+
try {
|
|
187
|
+
this.options = generateBoilerplatePromptOptionsSchema.parse(options);
|
|
188
|
+
} catch (error) {
|
|
189
|
+
throw new Error(`Invalid GenerateBoilerplatePrompt options: ${error instanceof Error ? error.message : String(error)}`);
|
|
190
|
+
}
|
|
163
191
|
}
|
|
164
192
|
/**
|
|
165
193
|
* Get the prompt definition for MCP
|
|
@@ -186,7 +214,8 @@ var GenerateBoilerplatePrompt = class GenerateBoilerplatePrompt {
|
|
|
186
214
|
type: "text",
|
|
187
215
|
text: this.templateService.renderString(generate_boilerplate_default, {
|
|
188
216
|
request,
|
|
189
|
-
isMonolith: this.isMonolith
|
|
217
|
+
isMonolith: this.options.isMonolith,
|
|
218
|
+
promptAsSkill: this.options.promptAsSkill
|
|
190
219
|
})
|
|
191
220
|
}
|
|
192
221
|
}];
|
|
@@ -195,18 +224,30 @@ var GenerateBoilerplatePrompt = class GenerateBoilerplatePrompt {
|
|
|
195
224
|
|
|
196
225
|
//#endregion
|
|
197
226
|
//#region src/instructions/prompts/generate-feature-scaffold.md?raw
|
|
198
|
-
var generate_feature_scaffold_default = "You are helping create a new feature scaffold configuration using the scaffold-mcp MCP tools.\n\n{% if request %}User request: {{ request }}\n{% endif %}\nYour task:\n\n1. **Gather Information**: Ask for any missing details:\n {% if not isMonolith %}- Template name (e.g., \"nextjs-15\", \"react-vite\"){% else %}- Template name (will be auto-detected from toolkit.yaml){% endif %}\n - Feature name (prefixed with \"scaffold-\", e.g., \"scaffold-nextjs-page\")\n - Feature type (page, component, service, etc.)\n - Variables needed\n - Files to include\n\n2. **Use MCP Tools** in order:\n - `generate-feature-scaffold` - Creates the feature configuration\n - `generate-boilerplate-file` - Creates each template file\n - `list-scaffolding-methods` - Verify it appears\n - `use-scaffold-method` - Test the feature\n\nImportant:\n- Feature names: prefix with \"scaffold-\"\n- Conditional includes: use \"file.tsx?withLayout=true\"\n- Template syntax: use {{ variableName }}\n{% if isMonolith %}- Template name will be auto-detected from toolkit.yaml{% endif %}\n\n**Description Field Guidelines (CRITICAL)**:\nThe description should explain what the feature scaffold generates (2-3 sentences):\n- Sentence 1: What type of code it generates (component, page, service, etc.)\n- Sentence 2: Key features or capabilities included\n- Sentence 3: Primary use cases or when to use it\n\nExample:\n\"Generate a new service class for TypeScript libraries following best practices. Creates a service class with interface, implementation, and unit tests. Perfect for creating reusable service modules with dependency injection patterns.\"\n\n**Instruction Field Guidelines (CRITICAL)**:\nThe instruction should provide specific guidance for using the generated feature:\n\n1. **Pattern explanation**: Describe the architectural pattern used\n2. **File organization**: Where files should be placed\n3. **Naming conventions**: How to name things (PascalCase, camelCase, etc.)\n4. **Usage guidelines**: How to use the generated code\n5. **Testing approach**: How to test the feature\n\nExample structure:\n\"[Feature type] follow a [pattern name] pattern with [key characteristics].\n[Explanation of how it works and integrates with the project].\nPlace [files] in [directory].\nFor [features with X], define [Y] in [Z] for better separation of concerns.\n[Feature names] should be [case style] and [suffix/prefix rules].\nWrite comprehensive [tests/docs] for all [public methods/exports].\"\n\nKeep it concise but informative - focus on the patterns and conventions that AI needs to understand to work with the generated code effectively.\n\nTemplate File Content Guidelines:\n- Keep content MINIMAL and business-agnostic\n- Focus on structure and patterns, not business logic\n- Use placeholder/generic examples only\n- Include essential boilerplate code only\n- Let AI fill in specific logic later\n- Add clear headers with design patterns and coding standards\n";
|
|
227
|
+
var generate_feature_scaffold_default = "{% if promptAsSkill %}---\nname: generate-feature-scaffold\ndescription: Create a new feature scaffold configuration for adding features to existing projects. Use this skill when the user wants to define a reusable feature template (e.g., page, component, service, API route) that can be used to add functionality to projects of a specific type. This is an admin/developer tool for creating the feature scaffold definitions themselves, not for using existing scaffolds. It generates feature configurations in scaffold.yaml and template files with Liquid syntax and conditional includes.\n---\n\n{% endif %}You are helping create a new feature scaffold configuration using the scaffold-mcp MCP tools.\n\n{% if request %}User request: {{ request }}\n{% endif %}\nYour task:\n\n1. **Gather Information**: Ask for any missing details:\n {% if not isMonolith %}- Template name (e.g., \"nextjs-15\", \"react-vite\"){% else %}- Template name (will be auto-detected from toolkit.yaml){% endif %}\n - Feature name (prefixed with \"scaffold-\", e.g., \"scaffold-nextjs-page\")\n - Feature type (page, component, service, etc.)\n - Variables needed\n - Files to include\n\n2. **Use MCP Tools** in order:\n - `generate-feature-scaffold` - Creates the feature configuration\n - `generate-boilerplate-file` - Creates each template file\n - `list-scaffolding-methods` - Verify it appears\n - `use-scaffold-method` - Test the feature\n\nImportant:\n- Feature names: prefix with \"scaffold-\"\n- Conditional includes: use \"file.tsx?withLayout=true\"\n- Template syntax: use {{ variableName }}\n{% if isMonolith %}- Template name will be auto-detected from toolkit.yaml{% endif %}\n\n**Description Field Guidelines (CRITICAL)**:\nThe description should explain what the feature scaffold generates (2-3 sentences):\n- Sentence 1: What type of code it generates (component, page, service, etc.)\n- Sentence 2: Key features or capabilities included\n- Sentence 3: Primary use cases or when to use it\n\nExample:\n\"Generate a new service class for TypeScript libraries following best practices. Creates a service class with interface, implementation, and unit tests. Perfect for creating reusable service modules with dependency injection patterns.\"\n\n**Instruction Field Guidelines (CRITICAL)**:\nThe instruction should provide specific guidance for using the generated feature:\n\n1. **Pattern explanation**: Describe the architectural pattern used\n2. **File organization**: Where files should be placed\n3. **Naming conventions**: How to name things (PascalCase, camelCase, etc.)\n4. **Usage guidelines**: How to use the generated code\n5. **Testing approach**: How to test the feature\n\nExample structure:\n\"[Feature type] follow a [pattern name] pattern with [key characteristics].\n[Explanation of how it works and integrates with the project].\nPlace [files] in [directory].\nFor [features with X], define [Y] in [Z] for better separation of concerns.\n[Feature names] should be [case style] and [suffix/prefix rules].\nWrite comprehensive [tests/docs] for all [public methods/exports].\"\n\nKeep it concise but informative - focus on the patterns and conventions that AI needs to understand to work with the generated code effectively.\n\nTemplate File Content Guidelines:\n- Keep content MINIMAL and business-agnostic\n- Focus on structure and patterns, not business logic\n- Use placeholder/generic examples only\n- Include essential boilerplate code only\n- Let AI fill in specific logic later\n- Add clear headers with design patterns and coding standards\n";
|
|
199
228
|
|
|
200
229
|
//#endregion
|
|
201
230
|
//#region src/prompts/GenerateFeatureScaffoldPrompt.ts
|
|
202
231
|
/**
|
|
232
|
+
* Schema for GenerateFeatureScaffoldPrompt constructor options
|
|
233
|
+
*/
|
|
234
|
+
const generateFeatureScaffoldPromptOptionsSchema = zod.z.object({
|
|
235
|
+
isMonolith: zod.z.boolean().default(false).describe("Whether the project is a monolith"),
|
|
236
|
+
promptAsSkill: zod.z.boolean().default(false).describe("Render prompt with skill front matter")
|
|
237
|
+
});
|
|
238
|
+
/**
|
|
203
239
|
* Prompt for generating feature scaffolds
|
|
204
240
|
*/
|
|
205
241
|
var GenerateFeatureScaffoldPrompt = class GenerateFeatureScaffoldPrompt {
|
|
206
242
|
static PROMPT_NAME = "generate-feature-scaffold";
|
|
207
243
|
templateService = new require_TemplateService.TemplateService();
|
|
208
|
-
|
|
209
|
-
|
|
244
|
+
options;
|
|
245
|
+
constructor(options = {}) {
|
|
246
|
+
try {
|
|
247
|
+
this.options = generateFeatureScaffoldPromptOptionsSchema.parse(options);
|
|
248
|
+
} catch (error) {
|
|
249
|
+
throw new Error(`Invalid GenerateFeatureScaffoldPrompt options: ${error instanceof Error ? error.message : String(error)}`);
|
|
250
|
+
}
|
|
210
251
|
}
|
|
211
252
|
/**
|
|
212
253
|
* Get the prompt definition for MCP
|
|
@@ -233,7 +274,8 @@ var GenerateFeatureScaffoldPrompt = class GenerateFeatureScaffoldPrompt {
|
|
|
233
274
|
type: "text",
|
|
234
275
|
text: this.templateService.renderString(generate_feature_scaffold_default, {
|
|
235
276
|
request,
|
|
236
|
-
isMonolith: this.isMonolith
|
|
277
|
+
isMonolith: this.options.isMonolith,
|
|
278
|
+
promptAsSkill: this.options.promptAsSkill
|
|
237
279
|
})
|
|
238
280
|
}
|
|
239
281
|
}];
|
|
@@ -242,18 +284,30 @@ var GenerateFeatureScaffoldPrompt = class GenerateFeatureScaffoldPrompt {
|
|
|
242
284
|
|
|
243
285
|
//#endregion
|
|
244
286
|
//#region src/instructions/prompts/scaffold-application.md?raw
|
|
245
|
-
var scaffold_application_default = "You are helping create a new {% if isMonolith %}monolith application{% else %}application{% endif %} using the scaffold-mcp MCP tools.\n\n{% if request %}User request: {{ request }}\n{% endif %}\nYour task is to scaffold a new application by following this workflow:\n\n## Step 1: {% if isMonolith %}Prepare to Create Application{% else %}List Available Boilerplates{% endif %}\n{% if isMonolith %}You will use the `use-boilerplate` tool to create your monolith application. The boilerplate name will be auto-detected from your toolkit.yaml file.{% else %}Use the `list-boilerplates` tool to see all available project templates.\n\n**What to look for:**\n- Boilerplate name (e.g., \"scaffold-nextjs-app\", \"scaffold-vite-app\")\n- Description of what the boilerplate creates\n- Target folder where projects will be created (e.g., \"apps\", \"packages\")\n- Required and optional variables in the variables_schema{% endif %}\n\n## Step 2: Gather Required Information\nBased on the {% if isMonolith %}toolkit.yaml{% else %}selected boilerplate's variables_schema{% endif %}, collect:\n{% if not isMonolith %}- **Project name**: Must be kebab-case (e.g., \"my-new-app\", not \"MyNewApp\")\n{% endif %}- **Required variables**: All variables marked as required: true\n- **Optional variables**: Variables with required: false (ask user if needed)\n\nCommon variables:\n- `appName` or `packageName`: The project name (kebab-case)\n- `description`: Brief description of what the project does\n- `author`: Author name\n\n## Step 3: Execute the Boilerplate\nUse the `use-boilerplate` tool with:\n{% if not isMonolith %}- `boilerplateName`: Exact name from list-boilerplates response\n{% endif %}- `variables`: Object matching the variables_schema exactly\n\n**Example:**\n```json\n{\n{% if not isMonolith %} \"boilerplateName\": \"scaffold-nextjs-app\",\n{% endif %} \"variables\": {\n \"appName\": \"my-dashboard\",\n \"description\": \"Admin dashboard for managing users\",\n \"author\": \"John Doe\"\n }\n}\n```\n\n## Important Guidelines:\n{% if not isMonolith %}- **Always call `list-boilerplates` first** to see available options and their schemas{% else %}- The boilerplate name is auto-detected from toolkit.yaml{% endif %}\n- **Use exact variable names** from the schema (case-sensitive)\n- **Provide all required variables** - the tool will fail if any are missing\n{% if not isMonolith %}- **Use kebab-case for project names** (e.g., \"user-dashboard\", not \"UserDashboard\")\n- The tool will create the project in the appropriate directory automatically{% else %}- The tool will create files at the workspace root{% endif %}\n- After creation, inform the user {% if isMonolith %}what files were created{% else %}where the project was created{% endif %}\n\n## Step 4: Review and Add Features (If Needed)\nAfter the boilerplate is created, **consider if additional features are needed**:\n1. **READ** the generated {% if isMonolith %}application{% else %}project{% endif %} structure to understand what was created\n2. **REVIEW** the user's request to see if they asked for specific features (e.g., \"with tool for X\", \"with prompt for Y\")\n3. **If features are needed**:\n - Use `list-scaffolding-methods`{% if not isMonolith %} with the new project path{% endif %}\n - Use `use-scaffold-method` to add tools, services, prompts, etc.\n - **IMPLEMENT** the actual logic in the scaffolded feature files\n - **REGISTER** the features in `src/server/index.ts`\n4. **Install dependencies**: Remind user to run `pnpm install`\n5. **Report** the complete setup including any features added\n\n## Example Workflow:\n{% if not isMonolith %}1. Call `list-boilerplates` → See available templates\n2. Ask user which template to use (or infer from request)\n3. Collect required variables based on schema\n4. Call `use-boilerplate` with boilerplateName and variables{% else %}1. Collect required variables based on toolkit.yaml variables_schema\n2. Call `use-boilerplate` with variables (boilerplateName auto-detected){% endif %}\n5. **Review if user requested specific features (tools, prompts, etc.)**\n6. **If features needed**: Add them using `list-scaffolding-methods` and `use-scaffold-method`\n7. **READ and IMPLEMENT** the scaffolded feature files with actual logic\n8. Report success and next steps to the user\n";
|
|
287
|
+
var scaffold_application_default = "{% if promptAsSkill %}---\nname: scaffold-application\ndescription: Create a new application or project from a boilerplate template. Use this skill when the user wants to start a new project, create a new app, or bootstrap a new codebase from scratch. This skill lists available boilerplate templates (React, Next.js, Express, etc.), gathers required configuration variables, generates the complete project structure, and provides guidance on next steps including adding features.\n---\n\n{% endif %}You are helping create a new {% if isMonolith %}monolith application{% else %}application{% endif %} using the scaffold-mcp MCP tools.\n\n{% if request %}User request: {{ request }}\n{% endif %}\nYour task is to scaffold a new application by following this workflow:\n\n## Step 1: {% if isMonolith %}Prepare to Create Application{% else %}List Available Boilerplates{% endif %}\n{% if isMonolith %}You will use the `use-boilerplate` tool to create your monolith application. The boilerplate name will be auto-detected from your toolkit.yaml file.{% else %}Use the `list-boilerplates` tool to see all available project templates.\n\n**What to look for:**\n- Boilerplate name (e.g., \"scaffold-nextjs-app\", \"scaffold-vite-app\")\n- Description of what the boilerplate creates\n- Target folder where projects will be created (e.g., \"apps\", \"packages\")\n- Required and optional variables in the variables_schema{% endif %}\n\n## Step 2: Gather Required Information\nBased on the {% if isMonolith %}toolkit.yaml{% else %}selected boilerplate's variables_schema{% endif %}, collect:\n{% if not isMonolith %}- **Project name**: Must be kebab-case (e.g., \"my-new-app\", not \"MyNewApp\")\n{% endif %}- **Required variables**: All variables marked as required: true\n- **Optional variables**: Variables with required: false (ask user if needed)\n\nCommon variables:\n- `appName` or `packageName`: The project name (kebab-case)\n- `description`: Brief description of what the project does\n- `author`: Author name\n\n## Step 3: Execute the Boilerplate\nUse the `use-boilerplate` tool with:\n{% if not isMonolith %}- `boilerplateName`: Exact name from list-boilerplates response\n{% endif %}- `variables`: Object matching the variables_schema exactly\n\n**Example:**\n```json\n{\n{% if not isMonolith %} \"boilerplateName\": \"scaffold-nextjs-app\",\n{% endif %} \"variables\": {\n \"appName\": \"my-dashboard\",\n \"description\": \"Admin dashboard for managing users\",\n \"author\": \"John Doe\"\n }\n}\n```\n\n## Important Guidelines:\n{% if not isMonolith %}- **Always call `list-boilerplates` first** to see available options and their schemas{% else %}- The boilerplate name is auto-detected from toolkit.yaml{% endif %}\n- **Use exact variable names** from the schema (case-sensitive)\n- **Provide all required variables** - the tool will fail if any are missing\n{% if not isMonolith %}- **Use kebab-case for project names** (e.g., \"user-dashboard\", not \"UserDashboard\")\n- The tool will create the project in the appropriate directory automatically{% else %}- The tool will create files at the workspace root{% endif %}\n- After creation, inform the user {% if isMonolith %}what files were created{% else %}where the project was created{% endif %}\n\n## Step 4: Review and Add Features (If Needed)\nAfter the boilerplate is created, **consider if additional features are needed**:\n1. **READ** the generated {% if isMonolith %}application{% else %}project{% endif %} structure to understand what was created\n2. **REVIEW** the user's request to see if they asked for specific features (e.g., \"with tool for X\", \"with prompt for Y\")\n3. **If features are needed**:\n - Use `list-scaffolding-methods`{% if not isMonolith %} with the new project path{% endif %}\n - Use `use-scaffold-method` to add tools, services, prompts, etc.\n - **IMPLEMENT** the actual logic in the scaffolded feature files\n - **REGISTER** the features in `src/server/index.ts`\n4. **Install dependencies**: Remind user to run `pnpm install`\n5. **Report** the complete setup including any features added\n\n## Example Workflow:\n{% if not isMonolith %}1. Call `list-boilerplates` → See available templates\n2. Ask user which template to use (or infer from request)\n3. Collect required variables based on schema\n4. Call `use-boilerplate` with boilerplateName and variables{% else %}1. Collect required variables based on toolkit.yaml variables_schema\n2. Call `use-boilerplate` with variables (boilerplateName auto-detected){% endif %}\n5. **Review if user requested specific features (tools, prompts, etc.)**\n6. **If features needed**: Add them using `list-scaffolding-methods` and `use-scaffold-method`\n7. **READ and IMPLEMENT** the scaffolded feature files with actual logic\n8. Report success and next steps to the user\n";
|
|
246
288
|
|
|
247
289
|
//#endregion
|
|
248
290
|
//#region src/prompts/ScaffoldApplicationPrompt.ts
|
|
249
291
|
/**
|
|
292
|
+
* Schema for ScaffoldApplicationPrompt constructor options
|
|
293
|
+
*/
|
|
294
|
+
const scaffoldApplicationPromptOptionsSchema = zod.z.object({
|
|
295
|
+
isMonolith: zod.z.boolean().default(false).describe("Whether the project is a monolith"),
|
|
296
|
+
promptAsSkill: zod.z.boolean().default(false).describe("Render prompt with skill front matter")
|
|
297
|
+
});
|
|
298
|
+
/**
|
|
250
299
|
* Prompt for scaffolding a new application using boilerplate templates
|
|
251
300
|
*/
|
|
252
301
|
var ScaffoldApplicationPrompt = class ScaffoldApplicationPrompt {
|
|
253
302
|
static PROMPT_NAME = "scaffold-application";
|
|
254
303
|
templateService = new require_TemplateService.TemplateService();
|
|
255
|
-
|
|
256
|
-
|
|
304
|
+
options;
|
|
305
|
+
constructor(options = {}) {
|
|
306
|
+
try {
|
|
307
|
+
this.options = scaffoldApplicationPromptOptionsSchema.parse(options);
|
|
308
|
+
} catch (error) {
|
|
309
|
+
throw new Error(`Invalid ScaffoldApplicationPrompt options: ${error instanceof Error ? error.message : String(error)}`);
|
|
310
|
+
}
|
|
257
311
|
}
|
|
258
312
|
/**
|
|
259
313
|
* Get the prompt definition for MCP
|
|
@@ -280,7 +334,8 @@ var ScaffoldApplicationPrompt = class ScaffoldApplicationPrompt {
|
|
|
280
334
|
type: "text",
|
|
281
335
|
text: this.templateService.renderString(scaffold_application_default, {
|
|
282
336
|
request,
|
|
283
|
-
isMonolith: this.isMonolith
|
|
337
|
+
isMonolith: this.options.isMonolith,
|
|
338
|
+
promptAsSkill: this.options.promptAsSkill
|
|
284
339
|
})
|
|
285
340
|
}
|
|
286
341
|
}];
|
|
@@ -289,18 +344,30 @@ var ScaffoldApplicationPrompt = class ScaffoldApplicationPrompt {
|
|
|
289
344
|
|
|
290
345
|
//#endregion
|
|
291
346
|
//#region src/instructions/prompts/scaffold-feature.md?raw
|
|
292
|
-
var scaffold_feature_default = "You are helping add a new feature to an existing project using the scaffold-mcp MCP tools.\n\n{% if request %}User request: {{ request }}\n{% endif %}{% if projectPath %}Project path: {{ projectPath }}\n{% endif %}\nYour task is to scaffold a new feature by following this workflow:\n\n## Step 1: Identify the Project\nDetermine the project path where the feature will be added:\n- If projectPath is provided, use it\n- Otherwise, ask the user or infer from context (e.g., \"apps/my-app\", \"packages/my-lib\")\n{% if isMonolith %}- In monolith mode, you can use the current working directory (no projectPath needed){% else %}- The path should point to a directory containing a `project.json` file{% endif %}\n\n## Step 2: List Available Scaffolding Methods\nUse the `list-scaffolding-methods` tool{% if not isMonolith %} with the projectPath{% endif %}.\n\n**What to look for:**\n- Feature name (e.g., \"scaffold-nextjs-page\", \"scaffold-react-component\")\n- Description of what files/code it generates\n- Required and optional variables in the variables_schema\n- The template type (derived from project's sourceTemplate)\n\n**Example:**\n```json\n{% if isMonolith %}{}{% else %}{\n \"projectPath\": \"apps/my-dashboard\"\n}{% endif %}\n```\n\n## Step 3: Gather Required Information\nBased on the selected scaffolding method's variables_schema, collect:\n- **Feature-specific variables**: Name, path, type, etc.\n- **Required variables**: All variables marked as required: true\n- **Optional variables**: Variables with required: false (ask user if needed)\n\nCommon variables:\n- `componentName` / `pageName` / `serviceName`: Name in PascalCase\n- `componentPath` / `pagePath`: Where to place the file (may use kebab-case)\n- Boolean flags: `withTests`, `withLayout`, `withStyles`, etc.\n\n## Step 4: Execute the Scaffolding Method\nUse the `use-scaffold-method` tool with:\n{% if not isMonolith %}- `projectPath`: Same path from step 1\n{% endif %}- `scaffold_feature_name`: Exact name from list-scaffolding-methods response\n- `variables`: Object matching the variables_schema exactly\n\n**Example:**\n```json\n{\n{% if not isMonolith %} \"projectPath\": \"apps/my-dashboard\",\n{% endif %} \"scaffold_feature_name\": \"scaffold-nextjs-page\",\n \"variables\": {\n \"pageName\": \"UserProfile\",\n \"pagePath\": \"user/profile\",\n \"withLayout\": true,\n \"withTests\": false\n }\n}\n```\n\n## Important Guidelines:\n- **Always call `list-scaffolding-methods` first**{% if not isMonolith %} with the projectPath{% endif %}\n- **Use exact variable names** from the schema (case-sensitive)\n- **Provide all required variables** - the tool will fail if any are missing\n- **Follow naming conventions**:\n - Component/Page/Service names: PascalCase (e.g., \"UserProfile\")\n - File paths: kebab-case or as specified in schema (e.g., \"user/profile\")\n- **Conditional files**: Files with `?condition=true` are only included when the variable is true\n- The tool will create files in the appropriate locations automatically\n- After creation, inform the user what files were created\n\n## Step 5: Review and Implement Generated Files\nAfter scaffolding completes, **you MUST**:\n1. **READ** all generated files to understand their structure\n2. **IMPLEMENT** the actual business logic:\n - Replace TODO comments with real code\n - Replace template placeholders with actual implementation\n - Add the specific functionality described in the user's request\n3. **REGISTER** the feature in appropriate files:\n - Import and register tools in `src/server/index.ts`\n - Export new modules from `index.ts` files\n - Update any necessary configuration files\n4. **TEST** to ensure the implementation works correctly\n5. **DO NOT SKIP** this step - scaffolded files are templates that need actual code\n\n## Example Workflow:\n1. Identify project path (provided or ask user){% if not isMonolith %}\n2. Call `list-scaffolding-methods` → See available features for this project{% else %}\n2. Call `list-scaffolding-methods` → See available features for your template{% endif %}\n3. Ask user which feature to add (or infer from request)\n4. Collect required variables based on schema\n5. Call `use-scaffold-method` with {% if not isMonolith %}projectPath, {% endif %}scaffold_feature_name, and variables\n6. **READ the generated files and IMPLEMENT the actual logic**\n7. **REGISTER the feature in server/index.ts and other config files**\n8. Report success and list created files with implementation details\n";
|
|
347
|
+
var scaffold_feature_default = "{% if promptAsSkill %}---\nname: scaffold-feature\ndescription: Add a new feature to an existing project such as service, route, page, component, or API endpoint. Use this skill when the user wants to add functionality to an existing codebase using predefined scaffolding templates. This skill lists available scaffolding methods for the project's template type, gathers required variables, generates boilerplate files, and guides implementation of the actual business logic.\n---\n\n{% endif %}You are helping add a new feature to an existing project using the scaffold-mcp MCP tools.\n\n{% if request %}User request: {{ request }}\n{% endif %}{% if projectPath %}Project path: {{ projectPath }}\n{% endif %}\nYour task is to scaffold a new feature by following this workflow:\n\n## Step 1: Identify the Project\nDetermine the project path where the feature will be added:\n- If projectPath is provided, use it\n- Otherwise, ask the user or infer from context (e.g., \"apps/my-app\", \"packages/my-lib\")\n{% if isMonolith %}- In monolith mode, you can use the current working directory (no projectPath needed){% else %}- The path should point to a directory containing a `project.json` file{% endif %}\n\n## Step 2: List Available Scaffolding Methods\nUse the `list-scaffolding-methods` tool{% if not isMonolith %} with the projectPath{% endif %}.\n\n**What to look for:**\n- Feature name (e.g., \"scaffold-nextjs-page\", \"scaffold-react-component\")\n- Description of what files/code it generates\n- Required and optional variables in the variables_schema\n- The template type (derived from project's sourceTemplate)\n\n**Example:**\n```json\n{% if isMonolith %}{}{% else %}{\n \"projectPath\": \"apps/my-dashboard\"\n}{% endif %}\n```\n\n## Step 3: Gather Required Information\nBased on the selected scaffolding method's variables_schema, collect:\n- **Feature-specific variables**: Name, path, type, etc.\n- **Required variables**: All variables marked as required: true\n- **Optional variables**: Variables with required: false (ask user if needed)\n\nCommon variables:\n- `componentName` / `pageName` / `serviceName`: Name in PascalCase\n- `componentPath` / `pagePath`: Where to place the file (may use kebab-case)\n- Boolean flags: `withTests`, `withLayout`, `withStyles`, etc.\n\n## Step 4: Execute the Scaffolding Method\nUse the `use-scaffold-method` tool with:\n{% if not isMonolith %}- `projectPath`: Same path from step 1\n{% endif %}- `scaffold_feature_name`: Exact name from list-scaffolding-methods response\n- `variables`: Object matching the variables_schema exactly\n\n**Example:**\n```json\n{\n{% if not isMonolith %} \"projectPath\": \"apps/my-dashboard\",\n{% endif %} \"scaffold_feature_name\": \"scaffold-nextjs-page\",\n \"variables\": {\n \"pageName\": \"UserProfile\",\n \"pagePath\": \"user/profile\",\n \"withLayout\": true,\n \"withTests\": false\n }\n}\n```\n\n## Important Guidelines:\n- **Always call `list-scaffolding-methods` first**{% if not isMonolith %} with the projectPath{% endif %}\n- **Use exact variable names** from the schema (case-sensitive)\n- **Provide all required variables** - the tool will fail if any are missing\n- **Follow naming conventions**:\n - Component/Page/Service names: PascalCase (e.g., \"UserProfile\")\n - File paths: kebab-case or as specified in schema (e.g., \"user/profile\")\n- **Conditional files**: Files with `?condition=true` are only included when the variable is true\n- The tool will create files in the appropriate locations automatically\n- After creation, inform the user what files were created\n\n## Step 5: Review and Implement Generated Files\nAfter scaffolding completes, **you MUST**:\n1. **READ** all generated files to understand their structure\n2. **IMPLEMENT** the actual business logic:\n - Replace TODO comments with real code\n - Replace template placeholders with actual implementation\n - Add the specific functionality described in the user's request\n3. **REGISTER** the feature in appropriate files:\n - Import and register tools in `src/server/index.ts`\n - Export new modules from `index.ts` files\n - Update any necessary configuration files\n4. **TEST** to ensure the implementation works correctly\n5. **DO NOT SKIP** this step - scaffolded files are templates that need actual code\n\n## Example Workflow:\n1. Identify project path (provided or ask user){% if not isMonolith %}\n2. Call `list-scaffolding-methods` → See available features for this project{% else %}\n2. Call `list-scaffolding-methods` → See available features for your template{% endif %}\n3. Ask user which feature to add (or infer from request)\n4. Collect required variables based on schema\n5. Call `use-scaffold-method` with {% if not isMonolith %}projectPath, {% endif %}scaffold_feature_name, and variables\n6. **READ the generated files and IMPLEMENT the actual logic**\n7. **REGISTER the feature in server/index.ts and other config files**\n8. Report success and list created files with implementation details\n";
|
|
293
348
|
|
|
294
349
|
//#endregion
|
|
295
350
|
//#region src/prompts/ScaffoldFeaturePrompt.ts
|
|
296
351
|
/**
|
|
352
|
+
* Schema for ScaffoldFeaturePrompt constructor options
|
|
353
|
+
*/
|
|
354
|
+
const scaffoldFeaturePromptOptionsSchema = zod.z.object({
|
|
355
|
+
isMonolith: zod.z.boolean().default(false).describe("Whether the project is a monolith"),
|
|
356
|
+
promptAsSkill: zod.z.boolean().default(false).describe("Render prompt with skill front matter")
|
|
357
|
+
});
|
|
358
|
+
/**
|
|
297
359
|
* Prompt for scaffolding a new feature in an existing project
|
|
298
360
|
*/
|
|
299
361
|
var ScaffoldFeaturePrompt = class ScaffoldFeaturePrompt {
|
|
300
362
|
static PROMPT_NAME = "scaffold-feature";
|
|
301
363
|
templateService = new require_TemplateService.TemplateService();
|
|
302
|
-
|
|
303
|
-
|
|
364
|
+
options;
|
|
365
|
+
constructor(options = {}) {
|
|
366
|
+
try {
|
|
367
|
+
this.options = scaffoldFeaturePromptOptionsSchema.parse(options);
|
|
368
|
+
} catch (error) {
|
|
369
|
+
throw new Error(`Invalid ScaffoldFeaturePrompt options: ${error instanceof Error ? error.message : String(error)}`);
|
|
370
|
+
}
|
|
304
371
|
}
|
|
305
372
|
/**
|
|
306
373
|
* Get the prompt definition for MCP
|
|
@@ -333,7 +400,8 @@ var ScaffoldFeaturePrompt = class ScaffoldFeaturePrompt {
|
|
|
333
400
|
text: this.templateService.renderString(scaffold_feature_default, {
|
|
334
401
|
request,
|
|
335
402
|
projectPath,
|
|
336
|
-
isMonolith: this.isMonolith
|
|
403
|
+
isMonolith: this.options.isMonolith,
|
|
404
|
+
promptAsSkill: this.options.promptAsSkill
|
|
337
405
|
})
|
|
338
406
|
}
|
|
339
407
|
}];
|
|
@@ -343,8 +411,9 @@ var ScaffoldFeaturePrompt = class ScaffoldFeaturePrompt {
|
|
|
343
411
|
//#endregion
|
|
344
412
|
//#region src/server/index.ts
|
|
345
413
|
function createServer(options = {}) {
|
|
346
|
-
const { adminEnabled = false, isMonolith = false } = options;
|
|
414
|
+
const { adminEnabled = false, isMonolith = false, promptAsSkill = false } = options;
|
|
347
415
|
const templatesPath = __agiflowai_aicode_utils.TemplatesManagerService.findTemplatesPathSync();
|
|
416
|
+
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
417
|
const listBoilerplatesTool = !isMonolith ? new require_stdio.ListBoilerplatesTool(templatesPath, isMonolith) : null;
|
|
349
418
|
const useBoilerplateTool = !isMonolith ? new require_stdio.UseBoilerplateTool(templatesPath, isMonolith) : null;
|
|
350
419
|
const listScaffoldingMethodsTool = new require_ListScaffoldingMethodsTool.ListScaffoldingMethodsTool(templatesPath, isMonolith);
|
|
@@ -353,10 +422,22 @@ function createServer(options = {}) {
|
|
|
353
422
|
const generateBoilerplateTool = adminEnabled ? new require_stdio.GenerateBoilerplateTool(templatesPath, isMonolith) : null;
|
|
354
423
|
const generateBoilerplateFileTool = adminEnabled ? new require_stdio.GenerateBoilerplateFileTool(templatesPath, isMonolith) : null;
|
|
355
424
|
const generateFeatureScaffoldTool = adminEnabled ? new require_stdio.GenerateFeatureScaffoldTool(templatesPath, isMonolith) : null;
|
|
356
|
-
const generateBoilerplatePrompt = adminEnabled ? new GenerateBoilerplatePrompt(
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
425
|
+
const generateBoilerplatePrompt = adminEnabled ? new GenerateBoilerplatePrompt({
|
|
426
|
+
isMonolith,
|
|
427
|
+
promptAsSkill
|
|
428
|
+
}) : null;
|
|
429
|
+
const generateFeatureScaffoldPrompt = adminEnabled ? new GenerateFeatureScaffoldPrompt({
|
|
430
|
+
isMonolith,
|
|
431
|
+
promptAsSkill
|
|
432
|
+
}) : null;
|
|
433
|
+
const scaffoldApplicationPrompt = new ScaffoldApplicationPrompt({
|
|
434
|
+
isMonolith,
|
|
435
|
+
promptAsSkill
|
|
436
|
+
});
|
|
437
|
+
const scaffoldFeaturePrompt = new ScaffoldFeaturePrompt({
|
|
438
|
+
isMonolith,
|
|
439
|
+
promptAsSkill
|
|
440
|
+
});
|
|
360
441
|
const instructions = new require_TemplateService.TemplateService().renderString(server_default, {
|
|
361
442
|
adminEnabled,
|
|
362
443
|
isMonolith
|
|
@@ -468,7 +549,7 @@ async function startServer(handler) {
|
|
|
468
549
|
await handler.stop();
|
|
469
550
|
process.exit(0);
|
|
470
551
|
} catch (error) {
|
|
471
|
-
console.error("Error during shutdown:", error);
|
|
552
|
+
console.error("Error during shutdown:", error instanceof Error ? error.message : String(error));
|
|
472
553
|
process.exit(1);
|
|
473
554
|
}
|
|
474
555
|
};
|
|
@@ -478,7 +559,7 @@ async function startServer(handler) {
|
|
|
478
559
|
/**
|
|
479
560
|
* MCP Serve command
|
|
480
561
|
*/
|
|
481
|
-
const mcpServeCommand = new commander.Command("mcp-serve").description("Start MCP server with specified transport").option("-t, --type <type>", "Transport type: stdio, http, or sse", "stdio").option("-p, --port <port>", "Port to listen on (http/sse only)", (val) => parseInt(val, 10), 3e3).option("--host <host>", "Host to bind to (http/sse only)", "localhost").option("--admin-enable", "Enable admin tools (generate-boilerplate)", false).action(async (options) => {
|
|
562
|
+
const mcpServeCommand = new commander.Command("mcp-serve").description("Start MCP server with specified transport").option("-t, --type <type>", "Transport type: stdio, http, or sse", "stdio").option("-p, --port <port>", "Port to listen on (http/sse only)", (val) => parseInt(val, 10), 3e3).option("--host <host>", "Host to bind to (http/sse only)", "localhost").option("--admin-enable", "Enable admin tools (generate-boilerplate)", false).option("--prompt-as-skill", "Render prompts with skill front matter for Claude Code skills", false).action(async (options) => {
|
|
482
563
|
try {
|
|
483
564
|
const transportType = options.type.toLowerCase();
|
|
484
565
|
let isMonolith = false;
|
|
@@ -489,7 +570,8 @@ const mcpServeCommand = new commander.Command("mcp-serve").description("Start MC
|
|
|
489
570
|
}
|
|
490
571
|
const serverOptions = {
|
|
491
572
|
adminEnabled: options.adminEnable,
|
|
492
|
-
isMonolith
|
|
573
|
+
isMonolith,
|
|
574
|
+
promptAsSkill: options.promptAsSkill
|
|
493
575
|
};
|
|
494
576
|
if (transportType === "stdio") await startServer(new require_stdio.StdioTransportHandler(createServer(serverOptions)));
|
|
495
577
|
else if (transportType === "http") await startServer(new require_stdio.HttpTransportHandler(() => createServer(serverOptions), {
|
|
@@ -528,6 +610,10 @@ scaffoldCommand.command("list [projectPath]").description("List available scaffo
|
|
|
528
610
|
process.exit(1);
|
|
529
611
|
}
|
|
530
612
|
const templatesDir = await __agiflowai_aicode_utils.TemplatesManagerService.findTemplatesPath();
|
|
613
|
+
if (!templatesDir) {
|
|
614
|
+
__agiflowai_aicode_utils.messages.error("Templates folder not found. Create a templates folder or specify templatesPath in toolkit.yaml");
|
|
615
|
+
process.exit(1);
|
|
616
|
+
}
|
|
531
617
|
const scaffoldingMethodsService = new require_ListScaffoldingMethodsTool.ScaffoldingMethodsService(new require_ListScaffoldingMethodsTool.FileSystemService(), templatesDir);
|
|
532
618
|
let result;
|
|
533
619
|
let displayName;
|
|
@@ -585,6 +671,10 @@ scaffoldCommand.command("add <featureName>").description("Add a feature to an ex
|
|
|
585
671
|
process.exit(1);
|
|
586
672
|
}
|
|
587
673
|
const templatesDir = await __agiflowai_aicode_utils.TemplatesManagerService.findTemplatesPath();
|
|
674
|
+
if (!templatesDir) {
|
|
675
|
+
__agiflowai_aicode_utils.messages.error("Templates folder not found. Create a templates folder or specify templatesPath in toolkit.yaml");
|
|
676
|
+
process.exit(1);
|
|
677
|
+
}
|
|
588
678
|
const scaffoldingMethodsService = new require_ListScaffoldingMethodsTool.ScaffoldingMethodsService(new require_ListScaffoldingMethodsTool.FileSystemService(), templatesDir);
|
|
589
679
|
let allMethods = [];
|
|
590
680
|
let cursor;
|
|
@@ -656,6 +746,10 @@ scaffoldCommand.command("info <featureName>").description("Show detailed informa
|
|
|
656
746
|
process.exit(1);
|
|
657
747
|
}
|
|
658
748
|
const templatesDir = await __agiflowai_aicode_utils.TemplatesManagerService.findTemplatesPath();
|
|
749
|
+
if (!templatesDir) {
|
|
750
|
+
__agiflowai_aicode_utils.messages.error("Templates folder not found. Create a templates folder or specify templatesPath in toolkit.yaml");
|
|
751
|
+
process.exit(1);
|
|
752
|
+
}
|
|
659
753
|
const scaffoldingMethodsService = new require_ListScaffoldingMethodsTool.ScaffoldingMethodsService(new require_ListScaffoldingMethodsTool.FileSystemService(), templatesDir);
|
|
660
754
|
let allMethods = [];
|
|
661
755
|
let cursor;
|
|
@@ -739,7 +833,7 @@ const hookCommand = new commander.Command("hook").description("Execute scaffold
|
|
|
739
833
|
}
|
|
740
834
|
const { agent, hookMethod } = (0, __agiflowai_hooks_adapter.parseHookType)(options.type);
|
|
741
835
|
if (agent === __agiflowai_coding_agent_bridge.CLAUDE_CODE) {
|
|
742
|
-
const useScaffoldMethodModule = await Promise.resolve().then(() => require("./useScaffoldMethod-
|
|
836
|
+
const useScaffoldMethodModule = await Promise.resolve().then(() => require("./useScaffoldMethod-DOvwnNOJ.cjs"));
|
|
743
837
|
const claudeCallbacks = [];
|
|
744
838
|
if (useScaffoldMethodModule.UseScaffoldMethodHook) {
|
|
745
839
|
const hookInstance = new useScaffoldMethodModule.UseScaffoldMethodHook();
|
|
@@ -752,7 +846,7 @@ const hookCommand = new commander.Command("hook").description("Execute scaffold
|
|
|
752
846
|
}
|
|
753
847
|
await new __agiflowai_hooks_adapter.ClaudeCodeAdapter().executeMultiple(claudeCallbacks);
|
|
754
848
|
} else if (agent === __agiflowai_coding_agent_bridge.GEMINI_CLI) {
|
|
755
|
-
const useScaffoldMethodModule = await Promise.resolve().then(() => require("./useScaffoldMethod-
|
|
849
|
+
const useScaffoldMethodModule = await Promise.resolve().then(() => require("./useScaffoldMethod-CcrpFEPv.cjs"));
|
|
756
850
|
const geminiCallbacks = [];
|
|
757
851
|
if (useScaffoldMethodModule.UseScaffoldMethodHook) {
|
|
758
852
|
const hookInstance = new useScaffoldMethodModule.UseScaffoldMethodHook();
|