@agiflowai/scaffold-mcp 1.0.24 → 1.0.26
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/README.md +25 -19
- package/dist/{ListScaffoldingMethodsTool-Cx-0gpV3.mjs → ListScaffoldingMethodsTool-D6BkKQyK.mjs} +1 -1
- package/dist/{ListScaffoldingMethodsTool-CkIkgP_u.cjs → ListScaffoldingMethodsTool-DBwZzJTA.cjs} +1 -1
- package/dist/{claudeCode-DBoEGOeu.cjs → claudeCode-B6CWgRYJ.cjs} +7 -23
- package/dist/{claudeCode-lHW7zQ5G.mjs → claudeCode-Dozuzn4S.mjs} +7 -23
- package/dist/cli.cjs +34 -9
- package/dist/cli.mjs +34 -9
- package/dist/{geminiCli-BHyWDBcF.cjs → geminiCli-COS3X1P7.cjs} +13 -16
- package/dist/{geminiCli-DBdxdDMM.mjs → geminiCli-CzgQDDMl.mjs} +14 -17
- package/dist/index.cjs +3 -3
- package/dist/index.mjs +3 -3
- package/dist/shared-fkWett9D.cjs +58 -0
- package/dist/shared-oDx2Btq0.mjs +44 -0
- package/dist/{src-B4ixzARA.cjs → src-DxoKQE4s.cjs} +6 -6
- package/dist/{src-COn3FXEz.mjs → src-sY88BbkJ.mjs} +6 -6
- package/dist/{tools-CC-lrhQ8.cjs → tools-DsnQImJ1.cjs} +3 -3
- package/dist/{tools-DtGTxmf-.mjs → tools-t-HMGLVh.mjs} +3 -3
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -2,17 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> MCP server for scaffolding applications with templates and feature generators
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
## Why Use This?
|
|
8
|
-
|
|
9
|
-
When you ask an AI agent to "add a new page," it generates working code—but not necessarily code that follows your team's patterns. scaffold-mcp solves this by:
|
|
10
|
-
|
|
11
|
-
1. **Providing templates** for common patterns your team has standardized
|
|
12
|
-
2. **Enforcing structure** so every route, component, or service looks the same
|
|
13
|
-
3. **Reducing boilerplate** by generating the repetitive parts automatically
|
|
14
|
-
|
|
15
|
-
Think of it as "Rails generators" or "Angular schematics" for any stack.
|
|
5
|
+
Use this server to generate projects and feature boilerplate from template-defined scaffolds.
|
|
16
6
|
|
|
17
7
|
---
|
|
18
8
|
|
|
@@ -45,7 +35,7 @@ Add to your MCP config (`.mcp.json`, `.cursor/mcp.json`, etc.):
|
|
|
45
35
|
|
|
46
36
|
### 3. Start Using
|
|
47
37
|
|
|
48
|
-
Your
|
|
38
|
+
Your agent can now call scaffold tools:
|
|
49
39
|
|
|
50
40
|
```
|
|
51
41
|
You: "Create a new Next.js app called dashboard"
|
|
@@ -93,9 +83,9 @@ apps/
|
|
|
93
83
|
│ └── page.tsx └── src/ ← Template files (.liquid)
|
|
94
84
|
```
|
|
95
85
|
|
|
96
|
-
1.
|
|
97
|
-
2.
|
|
98
|
-
3.
|
|
86
|
+
1. Templates define boilerplates and features in `scaffold.yaml`
|
|
87
|
+
2. Projects reference templates with `sourceTemplate`
|
|
88
|
+
3. Tools read the template and generate files
|
|
99
89
|
|
|
100
90
|
---
|
|
101
91
|
|
|
@@ -162,6 +152,22 @@ npx @agiflowai/scaffold-mcp mcp-serve \
|
|
|
162
152
|
--fallback-tool-config '{"model":"claude-sonnet-4-6"}'
|
|
163
153
|
```
|
|
164
154
|
|
|
155
|
+
For `.toolkit/settings.yaml` or `.toolkit/settings.local.yaml`, you can define multiple ordered fallbacks:
|
|
156
|
+
|
|
157
|
+
```yaml
|
|
158
|
+
scaffold-mcp:
|
|
159
|
+
mcp-serve:
|
|
160
|
+
fallbacks:
|
|
161
|
+
- tool: gemini-cli
|
|
162
|
+
config:
|
|
163
|
+
model: gemini-2.0-flash
|
|
164
|
+
- tool: codex
|
|
165
|
+
config:
|
|
166
|
+
model: gpt-5.2-mini
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
The first valid entry is used when `fallbackTool` is not set.
|
|
170
|
+
|
|
165
171
|
| Option | Description | Default |
|
|
166
172
|
|--------|-------------|---------|
|
|
167
173
|
| `-t, --type` | Transport: `stdio`, `http`, `sse` | `stdio` |
|
|
@@ -170,13 +176,13 @@ npx @agiflowai/scaffold-mcp mcp-serve \
|
|
|
170
176
|
| `--admin-enable` | Enable template creation tools | `false` |
|
|
171
177
|
| `--prompt-as-skill` | Render MCP prompts with Claude Code skill front matter, exposing them as `/skill` commands | `false` |
|
|
172
178
|
| `--fallback-tool` | LLM tool for scaffold operations (`claude-code`, `gemini-cli`, `codex`) | disabled |
|
|
173
|
-
| `--fallback-tool-config` | JSON config for the fallback tool
|
|
179
|
+
| `--fallback-tool-config` | JSON config for the CLI fallback tool; settings files may also use ordered `fallbacks` entries | `{}` |
|
|
174
180
|
|
|
175
181
|
---
|
|
176
182
|
|
|
177
183
|
## Creating Custom Templates
|
|
178
184
|
|
|
179
|
-
### Option 1: Using Admin Tools
|
|
185
|
+
### Option 1: Using Admin Tools
|
|
180
186
|
|
|
181
187
|
Ask your AI agent:
|
|
182
188
|
```
|
|
@@ -184,8 +190,8 @@ Ask your AI agent:
|
|
|
184
190
|
```
|
|
185
191
|
|
|
186
192
|
The agent will use:
|
|
187
|
-
1. `generate-boilerplate`
|
|
188
|
-
2. `generate-boilerplate-file`
|
|
193
|
+
1. `generate-boilerplate`
|
|
194
|
+
2. `generate-boilerplate-file`
|
|
189
195
|
|
|
190
196
|
### Option 2: Manually
|
|
191
197
|
|
package/dist/{ListScaffoldingMethodsTool-Cx-0gpV3.mjs → ListScaffoldingMethodsTool-D6BkKQyK.mjs}
RENAMED
|
@@ -974,7 +974,7 @@ Please follow this **instruction**: \n ${method.instruction ? this.processScaffo
|
|
|
974
974
|
|
|
975
975
|
//#endregion
|
|
976
976
|
//#region src/instructions/tools/list-scaffolding-methods/description.md?raw
|
|
977
|
-
var description_default = "Lists all available scaffolding methods (features) that can be added to an existing project{% if not isMonolith %} or for a specific template{% endif %}.\n\nThis tool:\n{% if isMonolith %}\n- Reads your project's sourceTemplate from toolkit.yaml at workspace root\n{% else %}\n- Reads the project's sourceTemplate from project.json (monorepo) or toolkit.yaml (monolith), OR\n- Directly uses the provided templateName to list available features\n{% endif %}\n- Returns available features for that template type\n- Provides variable schemas for each scaffolding method\n- Shows descriptions of what each method creates\n\nUse this FIRST when adding features to understand:\n- What scaffolding methods are available\n- What variables each method requires\n- What files/features will be generated\n\nExample methods might include:\n- Adding new React routes (for React apps)\n- Creating API endpoints (for backend projects)\n- Adding new components (for frontend projects)\n- Setting up database models (for API projects)\n";
|
|
977
|
+
var description_default = "Lists all available scaffolding methods (features) that can be added to an existing project{% if not isMonolith %} or for a specific template{% endif %}.\n\nThis tool:\n{% if isMonolith %}\n- Reads your project's sourceTemplate from .toolkit/settings.yaml at workspace root\n{% else %}\n- Reads the project's sourceTemplate from project.json (monorepo) or .toolkit/settings.yaml (monolith), OR\n- Directly uses the provided templateName to list available features\n{% endif %}\n- Returns available features for that template type\n- Provides variable schemas for each scaffolding method\n- Shows descriptions of what each method creates\n\nUse this FIRST when adding features to understand:\n- What scaffolding methods are available\n- What variables each method requires\n- What files/features will be generated\n\nExample methods might include:\n- Adding new React routes (for React apps)\n- Creating API endpoints (for backend projects)\n- Adding new components (for frontend projects)\n- Setting up database models (for API projects)\n";
|
|
978
978
|
|
|
979
979
|
//#endregion
|
|
980
980
|
//#region src/tools/ListScaffoldingMethodsTool.ts
|
package/dist/{ListScaffoldingMethodsTool-CkIkgP_u.cjs → ListScaffoldingMethodsTool-DBwZzJTA.cjs}
RENAMED
|
@@ -1003,7 +1003,7 @@ Please follow this **instruction**: \n ${method.instruction ? this.processScaffo
|
|
|
1003
1003
|
|
|
1004
1004
|
//#endregion
|
|
1005
1005
|
//#region src/instructions/tools/list-scaffolding-methods/description.md?raw
|
|
1006
|
-
var description_default = "Lists all available scaffolding methods (features) that can be added to an existing project{% if not isMonolith %} or for a specific template{% endif %}.\n\nThis tool:\n{% if isMonolith %}\n- Reads your project's sourceTemplate from toolkit.yaml at workspace root\n{% else %}\n- Reads the project's sourceTemplate from project.json (monorepo) or toolkit.yaml (monolith), OR\n- Directly uses the provided templateName to list available features\n{% endif %}\n- Returns available features for that template type\n- Provides variable schemas for each scaffolding method\n- Shows descriptions of what each method creates\n\nUse this FIRST when adding features to understand:\n- What scaffolding methods are available\n- What variables each method requires\n- What files/features will be generated\n\nExample methods might include:\n- Adding new React routes (for React apps)\n- Creating API endpoints (for backend projects)\n- Adding new components (for frontend projects)\n- Setting up database models (for API projects)\n";
|
|
1006
|
+
var description_default = "Lists all available scaffolding methods (features) that can be added to an existing project{% if not isMonolith %} or for a specific template{% endif %}.\n\nThis tool:\n{% if isMonolith %}\n- Reads your project's sourceTemplate from .toolkit/settings.yaml at workspace root\n{% else %}\n- Reads the project's sourceTemplate from project.json (monorepo) or .toolkit/settings.yaml (monolith), OR\n- Directly uses the provided templateName to list available features\n{% endif %}\n- Returns available features for that template type\n- Provides variable schemas for each scaffolding method\n- Shows descriptions of what each method creates\n\nUse this FIRST when adding features to understand:\n- What scaffolding methods are available\n- What variables each method requires\n- What files/features will be generated\n\nExample methods might include:\n- Adding new React routes (for React apps)\n- Creating API endpoints (for backend projects)\n- Adding new components (for frontend projects)\n- Setting up database models (for API projects)\n";
|
|
1007
1007
|
|
|
1008
1008
|
//#endregion
|
|
1009
1009
|
//#region src/tools/ListScaffoldingMethodsTool.ts
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
const require_ListScaffoldingMethodsTool = require('./ListScaffoldingMethodsTool-
|
|
2
|
-
require('./tools-
|
|
1
|
+
const require_ListScaffoldingMethodsTool = require('./ListScaffoldingMethodsTool-DBwZzJTA.cjs');
|
|
2
|
+
require('./tools-DsnQImJ1.cjs');
|
|
3
|
+
const require_shared = require('./shared-fkWett9D.cjs');
|
|
3
4
|
let __agiflowai_aicode_utils = require("@agiflowai/aicode-utils");
|
|
4
5
|
let node_path = require("node:path");
|
|
5
6
|
node_path = require_ListScaffoldingMethodsTool.__toESM(node_path);
|
|
@@ -188,25 +189,10 @@ var UseScaffoldMethodHook = class {
|
|
|
188
189
|
message: "Not a tool use event"
|
|
189
190
|
};
|
|
190
191
|
const filePath = context.tool_input?.file_path;
|
|
191
|
-
|
|
192
|
+
const absoluteFilePath = await require_shared.resolveNewFileWriteTarget(context.cwd, context.tool_name, filePath);
|
|
193
|
+
if (!absoluteFilePath || !filePath) return {
|
|
192
194
|
decision: __agiflowai_hooks_adapter.DECISION_SKIP,
|
|
193
|
-
message: "Not a file write operation"
|
|
194
|
-
};
|
|
195
|
-
const absoluteFilePath = node_path.default.isAbsolute(filePath) ? filePath : node_path.default.join(context.cwd, filePath);
|
|
196
|
-
if (!absoluteFilePath.startsWith(context.cwd + node_path.default.sep) && absoluteFilePath !== context.cwd) return {
|
|
197
|
-
decision: __agiflowai_hooks_adapter.DECISION_SKIP,
|
|
198
|
-
message: "File is outside working directory - skipping scaffold method check"
|
|
199
|
-
};
|
|
200
|
-
let fileExists = false;
|
|
201
|
-
try {
|
|
202
|
-
await node_fs_promises.default.access(absoluteFilePath);
|
|
203
|
-
fileExists = true;
|
|
204
|
-
} catch (accessErr) {
|
|
205
|
-
if (!(accessErr instanceof Error && "code" in accessErr && accessErr.code === "ENOENT")) throw accessErr;
|
|
206
|
-
}
|
|
207
|
-
if (fileExists) return {
|
|
208
|
-
decision: __agiflowai_hooks_adapter.DECISION_SKIP,
|
|
209
|
-
message: "File already exists - skipping scaffold method check"
|
|
195
|
+
message: "Not a new file write operation"
|
|
210
196
|
};
|
|
211
197
|
const executionLog = new __agiflowai_hooks_adapter.ExecutionLogService(context.session_id);
|
|
212
198
|
if (await executionLog.hasExecuted({
|
|
@@ -255,9 +241,7 @@ var UseScaffoldMethodHook = class {
|
|
|
255
241
|
message: "No scaffolding methods are available for this project template. You should write new files directly using the Write tool."
|
|
256
242
|
};
|
|
257
243
|
}
|
|
258
|
-
|
|
259
|
-
for (const method of data.methods) message += `- **${method.name}**: ${method.description || "No description available"}\n`;
|
|
260
|
-
if (data.nextCursor) message += `\n_More methods available (cursor: "${data.nextCursor}")._\n`;
|
|
244
|
+
const message = require_shared.formatScaffoldMethodsHookMessage(data.methods);
|
|
261
245
|
await executionLog.logExecution({
|
|
262
246
|
filePath,
|
|
263
247
|
operation: "list-scaffold-methods",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { t as ListScaffoldingMethodsTool } from "./ListScaffoldingMethodsTool-
|
|
2
|
-
import "./tools-
|
|
1
|
+
import { t as ListScaffoldingMethodsTool } from "./ListScaffoldingMethodsTool-D6BkKQyK.mjs";
|
|
2
|
+
import "./tools-t-HMGLVh.mjs";
|
|
3
|
+
import { n as resolveNewFileWriteTarget, t as formatScaffoldMethodsHookMessage } from "./shared-oDx2Btq0.mjs";
|
|
3
4
|
import { ProjectFinderService, TemplatesManagerService } from "@agiflowai/aicode-utils";
|
|
4
5
|
import path from "node:path";
|
|
5
6
|
import fs from "node:fs/promises";
|
|
@@ -185,25 +186,10 @@ var UseScaffoldMethodHook = class {
|
|
|
185
186
|
message: "Not a tool use event"
|
|
186
187
|
};
|
|
187
188
|
const filePath = context.tool_input?.file_path;
|
|
188
|
-
|
|
189
|
+
const absoluteFilePath = await resolveNewFileWriteTarget(context.cwd, context.tool_name, filePath);
|
|
190
|
+
if (!absoluteFilePath || !filePath) return {
|
|
189
191
|
decision: DECISION_SKIP,
|
|
190
|
-
message: "Not a file write operation"
|
|
191
|
-
};
|
|
192
|
-
const absoluteFilePath = path.isAbsolute(filePath) ? filePath : path.join(context.cwd, filePath);
|
|
193
|
-
if (!absoluteFilePath.startsWith(context.cwd + path.sep) && absoluteFilePath !== context.cwd) return {
|
|
194
|
-
decision: DECISION_SKIP,
|
|
195
|
-
message: "File is outside working directory - skipping scaffold method check"
|
|
196
|
-
};
|
|
197
|
-
let fileExists = false;
|
|
198
|
-
try {
|
|
199
|
-
await fs.access(absoluteFilePath);
|
|
200
|
-
fileExists = true;
|
|
201
|
-
} catch (accessErr) {
|
|
202
|
-
if (!(accessErr instanceof Error && "code" in accessErr && accessErr.code === "ENOENT")) throw accessErr;
|
|
203
|
-
}
|
|
204
|
-
if (fileExists) return {
|
|
205
|
-
decision: DECISION_SKIP,
|
|
206
|
-
message: "File already exists - skipping scaffold method check"
|
|
192
|
+
message: "Not a new file write operation"
|
|
207
193
|
};
|
|
208
194
|
const executionLog = new ExecutionLogService(context.session_id);
|
|
209
195
|
if (await executionLog.hasExecuted({
|
|
@@ -252,9 +238,7 @@ var UseScaffoldMethodHook = class {
|
|
|
252
238
|
message: "No scaffolding methods are available for this project template. You should write new files directly using the Write tool."
|
|
253
239
|
};
|
|
254
240
|
}
|
|
255
|
-
|
|
256
|
-
for (const method of data.methods) message += `- **${method.name}**: ${method.description || "No description available"}\n`;
|
|
257
|
-
if (data.nextCursor) message += `\n_More methods available (cursor: "${data.nextCursor}")._\n`;
|
|
241
|
+
const message = formatScaffoldMethodsHookMessage(data.methods);
|
|
258
242
|
await executionLog.logExecution({
|
|
259
243
|
filePath,
|
|
260
244
|
operation: "list-scaffold-methods",
|
package/dist/cli.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const require_ListScaffoldingMethodsTool = require('./ListScaffoldingMethodsTool-
|
|
3
|
-
const require_src = require('./src-
|
|
4
|
-
const require_tools = require('./tools-
|
|
2
|
+
const require_ListScaffoldingMethodsTool = require('./ListScaffoldingMethodsTool-DBwZzJTA.cjs');
|
|
3
|
+
const require_src = require('./src-DxoKQE4s.cjs');
|
|
4
|
+
const require_tools = require('./tools-DsnQImJ1.cjs');
|
|
5
5
|
let __agiflowai_aicode_utils = require("@agiflowai/aicode-utils");
|
|
6
6
|
let node_path = require("node:path");
|
|
7
7
|
node_path = require_ListScaffoldingMethodsTool.__toESM(node_path);
|
|
@@ -196,6 +196,17 @@ function parseJsonConfig(value, flagName) {
|
|
|
196
196
|
throw new Error(`Invalid JSON for ${flagName}: ${error instanceof Error ? error.message : String(error)}`);
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
|
+
function resolveFallbackConfig$1(config) {
|
|
200
|
+
if (config.fallbackTool) return {
|
|
201
|
+
tool: config.fallbackTool,
|
|
202
|
+
config: config.fallbackToolConfig
|
|
203
|
+
};
|
|
204
|
+
const firstValidFallback = config.fallbacks?.find((entry) => entry?.tool);
|
|
205
|
+
return firstValidFallback ? {
|
|
206
|
+
tool: firstValidFallback.tool,
|
|
207
|
+
config: firstValidFallback.config
|
|
208
|
+
} : {};
|
|
209
|
+
}
|
|
199
210
|
/**
|
|
200
211
|
* Start MCP server with given transport handler
|
|
201
212
|
*/
|
|
@@ -239,8 +250,9 @@ const mcpServeCommand = new commander.Command("mcp-serve").description("Start MC
|
|
|
239
250
|
const transportType = (options.type ?? fileConfig.type ?? "stdio").toLowerCase();
|
|
240
251
|
const adminEnable = options.adminEnable || fileConfig.adminEnable || false;
|
|
241
252
|
const promptAsSkill = options.promptAsSkill || fileConfig.promptAsSkill || false;
|
|
242
|
-
const
|
|
243
|
-
const
|
|
253
|
+
const configuredFallback = resolveFallbackConfig$1(fileConfig);
|
|
254
|
+
const fallbackTool = parseLlmToolOption(options.fallbackTool ?? configuredFallback.tool, "--fallback-tool");
|
|
255
|
+
const fallbackToolConfig = options.fallbackToolConfig ? parseJsonConfig(options.fallbackToolConfig, "--fallback-tool-config") : configuredFallback.config;
|
|
244
256
|
let isMonolith = false;
|
|
245
257
|
try {
|
|
246
258
|
isMonolith = (await __agiflowai_aicode_utils.ProjectConfigResolver.resolveProjectConfig(process.cwd())).type === "monolith";
|
|
@@ -536,6 +548,18 @@ function parseJsonConfigOption(value, flagName) {
|
|
|
536
548
|
throw new Error(`Invalid JSON for ${flagName}. Expected format: '{"key":"value"}'. Parse error: ${error instanceof Error ? error.message : String(error)}`);
|
|
537
549
|
}
|
|
538
550
|
}
|
|
551
|
+
function resolveFallbackConfig(config) {
|
|
552
|
+
if (!config) return {};
|
|
553
|
+
if (config["fallback-tool"]) return {
|
|
554
|
+
tool: config["fallback-tool"],
|
|
555
|
+
config: config["fallback-tool-config"]
|
|
556
|
+
};
|
|
557
|
+
const firstValidFallback = config.fallbacks?.find((entry) => entry?.tool);
|
|
558
|
+
return firstValidFallback ? {
|
|
559
|
+
tool: firstValidFallback.tool,
|
|
560
|
+
config: firstValidFallback.config
|
|
561
|
+
} : {};
|
|
562
|
+
}
|
|
539
563
|
/**
|
|
540
564
|
* Hook command for executing scaffold hooks
|
|
541
565
|
*/
|
|
@@ -545,8 +569,9 @@ const hookCommand = new commander.Command("hook").description("Execute scaffold
|
|
|
545
569
|
const { agent, hookMethod } = (0, __agiflowai_hooks_adapter.parseHookType)(options.type);
|
|
546
570
|
const methodConfig = ((await __agiflowai_aicode_utils.TemplatesManagerService.readToolkitConfig())?.["scaffold-mcp"]?.hook)?.[agent]?.[hookMethod];
|
|
547
571
|
const marker = options.marker ?? "@scaffold-generated";
|
|
548
|
-
const
|
|
549
|
-
const
|
|
572
|
+
const configuredFallback = resolveFallbackConfig(methodConfig);
|
|
573
|
+
const fallbackToolStr = options.fallbackTool ?? methodConfig?.["fallback-tool"] ?? methodConfig?.["llm-tool"] ?? configuredFallback.tool;
|
|
574
|
+
const fallbackToolConfig = options.fallbackToolConfig ? parseJsonConfigOption(options.fallbackToolConfig, "--fallback-tool-config") : methodConfig?.["fallback-tool-config"] ?? methodConfig?.["tool-config"] ?? configuredFallback.config;
|
|
550
575
|
if (fallbackToolStr && !(0, __agiflowai_coding_agent_bridge.isValidLlmTool)(fallbackToolStr)) throw new Error(`Invalid --fallback-tool: ${fallbackToolStr}. Supported: ${__agiflowai_coding_agent_bridge.SUPPORTED_LLM_TOOLS.join(", ")}`);
|
|
551
576
|
const adapterConfig = {};
|
|
552
577
|
if (fallbackToolConfig) adapterConfig.tool_config = fallbackToolConfig;
|
|
@@ -554,7 +579,7 @@ const hookCommand = new commander.Command("hook").description("Execute scaffold
|
|
|
554
579
|
const resolvedAdapterConfig = Object.keys(adapterConfig).length > 0 ? adapterConfig : void 0;
|
|
555
580
|
if (!isHookMethod(hookMethod)) process.exit(0);
|
|
556
581
|
if (agent === __agiflowai_coding_agent_bridge.CLAUDE_CODE) {
|
|
557
|
-
const hookModule = await Promise.resolve().then(() => require("./claudeCode-
|
|
582
|
+
const hookModule = await Promise.resolve().then(() => require("./claudeCode-B6CWgRYJ.cjs"));
|
|
558
583
|
const claudeCallbacks = [];
|
|
559
584
|
if (hookModule.UseScaffoldMethodHook) {
|
|
560
585
|
const hookInstance = new hookModule.UseScaffoldMethodHook();
|
|
@@ -569,7 +594,7 @@ const hookCommand = new commander.Command("hook").description("Execute scaffold
|
|
|
569
594
|
if (claudeCallbacks.length === 0) process.exit(0);
|
|
570
595
|
await new __agiflowai_hooks_adapter.ClaudeCodeAdapter().executeMultiple(claudeCallbacks, resolvedAdapterConfig);
|
|
571
596
|
} else if (agent === __agiflowai_coding_agent_bridge.GEMINI_CLI) {
|
|
572
|
-
const hookModule = await Promise.resolve().then(() => require("./geminiCli-
|
|
597
|
+
const hookModule = await Promise.resolve().then(() => require("./geminiCli-COS3X1P7.cjs"));
|
|
573
598
|
const geminiCallbacks = [];
|
|
574
599
|
if (hookModule.UseScaffoldMethodHook) {
|
|
575
600
|
const hookInstance = new hookModule.UseScaffoldMethodHook();
|
package/dist/cli.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as createServer, i as StdioTransportHandler, n as HttpTransportHandler, o as version, r as SseTransportHandler, t as TransportMode } from "./src-
|
|
3
|
-
import { n as ScaffoldingMethodsService, s as FileSystemService } from "./ListScaffoldingMethodsTool-
|
|
4
|
-
import { l as BoilerplateService } from "./tools-
|
|
2
|
+
import { a as createServer, i as StdioTransportHandler, n as HttpTransportHandler, o as version, r as SseTransportHandler, t as TransportMode } from "./src-sY88BbkJ.mjs";
|
|
3
|
+
import { n as ScaffoldingMethodsService, s as FileSystemService } from "./ListScaffoldingMethodsTool-D6BkKQyK.mjs";
|
|
4
|
+
import { l as BoilerplateService } from "./tools-t-HMGLVh.mjs";
|
|
5
5
|
import { ProjectConfigResolver, TemplatesManagerService, icons, messages, print, sections } from "@agiflowai/aicode-utils";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { Command } from "commander";
|
|
@@ -195,6 +195,17 @@ function parseJsonConfig(value, flagName) {
|
|
|
195
195
|
throw new Error(`Invalid JSON for ${flagName}: ${error instanceof Error ? error.message : String(error)}`);
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
|
+
function resolveFallbackConfig$1(config) {
|
|
199
|
+
if (config.fallbackTool) return {
|
|
200
|
+
tool: config.fallbackTool,
|
|
201
|
+
config: config.fallbackToolConfig
|
|
202
|
+
};
|
|
203
|
+
const firstValidFallback = config.fallbacks?.find((entry) => entry?.tool);
|
|
204
|
+
return firstValidFallback ? {
|
|
205
|
+
tool: firstValidFallback.tool,
|
|
206
|
+
config: firstValidFallback.config
|
|
207
|
+
} : {};
|
|
208
|
+
}
|
|
198
209
|
/**
|
|
199
210
|
* Start MCP server with given transport handler
|
|
200
211
|
*/
|
|
@@ -238,8 +249,9 @@ const mcpServeCommand = new Command("mcp-serve").description("Start MCP server w
|
|
|
238
249
|
const transportType = (options.type ?? fileConfig.type ?? "stdio").toLowerCase();
|
|
239
250
|
const adminEnable = options.adminEnable || fileConfig.adminEnable || false;
|
|
240
251
|
const promptAsSkill = options.promptAsSkill || fileConfig.promptAsSkill || false;
|
|
241
|
-
const
|
|
242
|
-
const
|
|
252
|
+
const configuredFallback = resolveFallbackConfig$1(fileConfig);
|
|
253
|
+
const fallbackTool = parseLlmToolOption(options.fallbackTool ?? configuredFallback.tool, "--fallback-tool");
|
|
254
|
+
const fallbackToolConfig = options.fallbackToolConfig ? parseJsonConfig(options.fallbackToolConfig, "--fallback-tool-config") : configuredFallback.config;
|
|
243
255
|
let isMonolith = false;
|
|
244
256
|
try {
|
|
245
257
|
isMonolith = (await ProjectConfigResolver.resolveProjectConfig(process.cwd())).type === "monolith";
|
|
@@ -535,6 +547,18 @@ function parseJsonConfigOption(value, flagName) {
|
|
|
535
547
|
throw new Error(`Invalid JSON for ${flagName}. Expected format: '{"key":"value"}'. Parse error: ${error instanceof Error ? error.message : String(error)}`);
|
|
536
548
|
}
|
|
537
549
|
}
|
|
550
|
+
function resolveFallbackConfig(config) {
|
|
551
|
+
if (!config) return {};
|
|
552
|
+
if (config["fallback-tool"]) return {
|
|
553
|
+
tool: config["fallback-tool"],
|
|
554
|
+
config: config["fallback-tool-config"]
|
|
555
|
+
};
|
|
556
|
+
const firstValidFallback = config.fallbacks?.find((entry) => entry?.tool);
|
|
557
|
+
return firstValidFallback ? {
|
|
558
|
+
tool: firstValidFallback.tool,
|
|
559
|
+
config: firstValidFallback.config
|
|
560
|
+
} : {};
|
|
561
|
+
}
|
|
538
562
|
/**
|
|
539
563
|
* Hook command for executing scaffold hooks
|
|
540
564
|
*/
|
|
@@ -544,8 +568,9 @@ const hookCommand = new Command("hook").description("Execute scaffold hooks for
|
|
|
544
568
|
const { agent, hookMethod } = parseHookType(options.type);
|
|
545
569
|
const methodConfig = ((await TemplatesManagerService.readToolkitConfig())?.["scaffold-mcp"]?.hook)?.[agent]?.[hookMethod];
|
|
546
570
|
const marker = options.marker ?? "@scaffold-generated";
|
|
547
|
-
const
|
|
548
|
-
const
|
|
571
|
+
const configuredFallback = resolveFallbackConfig(methodConfig);
|
|
572
|
+
const fallbackToolStr = options.fallbackTool ?? methodConfig?.["fallback-tool"] ?? methodConfig?.["llm-tool"] ?? configuredFallback.tool;
|
|
573
|
+
const fallbackToolConfig = options.fallbackToolConfig ? parseJsonConfigOption(options.fallbackToolConfig, "--fallback-tool-config") : methodConfig?.["fallback-tool-config"] ?? methodConfig?.["tool-config"] ?? configuredFallback.config;
|
|
549
574
|
if (fallbackToolStr && !isValidLlmTool(fallbackToolStr)) throw new Error(`Invalid --fallback-tool: ${fallbackToolStr}. Supported: ${SUPPORTED_LLM_TOOLS.join(", ")}`);
|
|
550
575
|
const adapterConfig = {};
|
|
551
576
|
if (fallbackToolConfig) adapterConfig.tool_config = fallbackToolConfig;
|
|
@@ -553,7 +578,7 @@ const hookCommand = new Command("hook").description("Execute scaffold hooks for
|
|
|
553
578
|
const resolvedAdapterConfig = Object.keys(adapterConfig).length > 0 ? adapterConfig : void 0;
|
|
554
579
|
if (!isHookMethod(hookMethod)) process.exit(0);
|
|
555
580
|
if (agent === CLAUDE_CODE) {
|
|
556
|
-
const hookModule = await import("./claudeCode-
|
|
581
|
+
const hookModule = await import("./claudeCode-Dozuzn4S.mjs");
|
|
557
582
|
const claudeCallbacks = [];
|
|
558
583
|
if (hookModule.UseScaffoldMethodHook) {
|
|
559
584
|
const hookInstance = new hookModule.UseScaffoldMethodHook();
|
|
@@ -568,7 +593,7 @@ const hookCommand = new Command("hook").description("Execute scaffold hooks for
|
|
|
568
593
|
if (claudeCallbacks.length === 0) process.exit(0);
|
|
569
594
|
await new ClaudeCodeAdapter().executeMultiple(claudeCallbacks, resolvedAdapterConfig);
|
|
570
595
|
} else if (agent === GEMINI_CLI) {
|
|
571
|
-
const hookModule = await import("./geminiCli-
|
|
596
|
+
const hookModule = await import("./geminiCli-CzgQDDMl.mjs");
|
|
572
597
|
const geminiCallbacks = [];
|
|
573
598
|
if (hookModule.UseScaffoldMethodHook) {
|
|
574
599
|
const hookInstance = new hookModule.UseScaffoldMethodHook();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
const require_ListScaffoldingMethodsTool = require('./ListScaffoldingMethodsTool-
|
|
1
|
+
const require_ListScaffoldingMethodsTool = require('./ListScaffoldingMethodsTool-DBwZzJTA.cjs');
|
|
2
|
+
const require_shared = require('./shared-fkWett9D.cjs');
|
|
2
3
|
let __agiflowai_aicode_utils = require("@agiflowai/aicode-utils");
|
|
3
4
|
let __agiflowai_hooks_adapter = require("@agiflowai/hooks-adapter");
|
|
4
5
|
|
|
@@ -20,8 +21,14 @@ var UseScaffoldMethodHook = class {
|
|
|
20
21
|
*/
|
|
21
22
|
async preToolUse(context) {
|
|
22
23
|
try {
|
|
24
|
+
const filePath = context.tool_input?.file_path;
|
|
25
|
+
const absoluteFilePath = await require_shared.resolveNewFileWriteTarget(context.cwd, context.tool_name, filePath);
|
|
26
|
+
if (!absoluteFilePath || !filePath) return {
|
|
27
|
+
decision: __agiflowai_hooks_adapter.DECISION_SKIP,
|
|
28
|
+
message: "Not a new file write operation"
|
|
29
|
+
};
|
|
23
30
|
const executionLog = new __agiflowai_hooks_adapter.ExecutionLogService(context.session_id);
|
|
24
|
-
const sessionKey =
|
|
31
|
+
const sessionKey = filePath;
|
|
25
32
|
if (await executionLog.hasExecuted({
|
|
26
33
|
filePath: sessionKey,
|
|
27
34
|
decision: __agiflowai_hooks_adapter.DECISION_DENY
|
|
@@ -41,7 +48,9 @@ var UseScaffoldMethodHook = class {
|
|
|
41
48
|
decision: __agiflowai_hooks_adapter.DECISION_SKIP,
|
|
42
49
|
message: "Templates folder not found - skipping scaffold method check"
|
|
43
50
|
};
|
|
44
|
-
const
|
|
51
|
+
const tool = new require_ListScaffoldingMethodsTool.ListScaffoldingMethodsTool(templatesPath, false);
|
|
52
|
+
const projectPath = (await new __agiflowai_aicode_utils.ProjectFinderService(await __agiflowai_aicode_utils.TemplatesManagerService.getWorkspaceRoot(context.cwd)).findProjectForFile(absoluteFilePath))?.root || context.cwd;
|
|
53
|
+
const result = await tool.execute({ projectPath });
|
|
45
54
|
const firstContent = result.content[0];
|
|
46
55
|
if (firstContent?.type !== "text") return {
|
|
47
56
|
decision: __agiflowai_hooks_adapter.DECISION_SKIP,
|
|
@@ -75,19 +84,7 @@ var UseScaffoldMethodHook = class {
|
|
|
75
84
|
message: "No scaffolding methods are available for this project template. You should write new files directly using the Write tool."
|
|
76
85
|
};
|
|
77
86
|
}
|
|
78
|
-
|
|
79
|
-
message += "Before writing new files, check if any of these scaffolding methods match your needs:\n\n";
|
|
80
|
-
for (const method of data.methods) {
|
|
81
|
-
message += `**${method.name}**\n`;
|
|
82
|
-
message += `${method.instruction || method.description || "No description available"}\n`;
|
|
83
|
-
if (method.variables_schema?.required && method.variables_schema.required.length > 0) message += `Required: ${method.variables_schema.required.join(", ")}\n`;
|
|
84
|
-
message += "\n";
|
|
85
|
-
}
|
|
86
|
-
if (data.nextCursor) message += `\n_Note: More methods available. Use cursor "${data.nextCursor}" to see more._\n\n`;
|
|
87
|
-
message += "\n**Instructions:**\n";
|
|
88
|
-
message += "1. If one of these scaffold methods matches what you need to create, use the `use-scaffold-method` MCP tool instead of writing files manually\n";
|
|
89
|
-
message += "2. If none of these methods are relevant to your task, proceed to write new files directly using the Write tool\n";
|
|
90
|
-
message += "3. Using scaffold methods ensures consistency with project patterns and includes all necessary boilerplate\n";
|
|
87
|
+
const message = require_shared.formatScaffoldMethodsHookMessage(data.methods, { includeRequiredVars: true });
|
|
91
88
|
await executionLog.logExecution({
|
|
92
89
|
filePath: sessionKey,
|
|
93
90
|
operation: "list-scaffold-methods",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { t as ListScaffoldingMethodsTool } from "./ListScaffoldingMethodsTool-
|
|
2
|
-
import {
|
|
1
|
+
import { t as ListScaffoldingMethodsTool } from "./ListScaffoldingMethodsTool-D6BkKQyK.mjs";
|
|
2
|
+
import { n as resolveNewFileWriteTarget, t as formatScaffoldMethodsHookMessage } from "./shared-oDx2Btq0.mjs";
|
|
3
|
+
import { ProjectFinderService, TemplatesManagerService } from "@agiflowai/aicode-utils";
|
|
3
4
|
import { DECISION_ALLOW, DECISION_DENY, DECISION_SKIP, ExecutionLogService } from "@agiflowai/hooks-adapter";
|
|
4
5
|
|
|
5
6
|
//#region src/hooks/geminiCli/useScaffoldMethod.ts
|
|
@@ -20,8 +21,14 @@ var UseScaffoldMethodHook = class {
|
|
|
20
21
|
*/
|
|
21
22
|
async preToolUse(context) {
|
|
22
23
|
try {
|
|
24
|
+
const filePath = context.tool_input?.file_path;
|
|
25
|
+
const absoluteFilePath = await resolveNewFileWriteTarget(context.cwd, context.tool_name, filePath);
|
|
26
|
+
if (!absoluteFilePath || !filePath) return {
|
|
27
|
+
decision: DECISION_SKIP,
|
|
28
|
+
message: "Not a new file write operation"
|
|
29
|
+
};
|
|
23
30
|
const executionLog = new ExecutionLogService(context.session_id);
|
|
24
|
-
const sessionKey =
|
|
31
|
+
const sessionKey = filePath;
|
|
25
32
|
if (await executionLog.hasExecuted({
|
|
26
33
|
filePath: sessionKey,
|
|
27
34
|
decision: DECISION_DENY
|
|
@@ -41,7 +48,9 @@ var UseScaffoldMethodHook = class {
|
|
|
41
48
|
decision: DECISION_SKIP,
|
|
42
49
|
message: "Templates folder not found - skipping scaffold method check"
|
|
43
50
|
};
|
|
44
|
-
const
|
|
51
|
+
const tool = new ListScaffoldingMethodsTool(templatesPath, false);
|
|
52
|
+
const projectPath = (await new ProjectFinderService(await TemplatesManagerService.getWorkspaceRoot(context.cwd)).findProjectForFile(absoluteFilePath))?.root || context.cwd;
|
|
53
|
+
const result = await tool.execute({ projectPath });
|
|
45
54
|
const firstContent = result.content[0];
|
|
46
55
|
if (firstContent?.type !== "text") return {
|
|
47
56
|
decision: DECISION_SKIP,
|
|
@@ -75,19 +84,7 @@ var UseScaffoldMethodHook = class {
|
|
|
75
84
|
message: "No scaffolding methods are available for this project template. You should write new files directly using the Write tool."
|
|
76
85
|
};
|
|
77
86
|
}
|
|
78
|
-
|
|
79
|
-
message += "Before writing new files, check if any of these scaffolding methods match your needs:\n\n";
|
|
80
|
-
for (const method of data.methods) {
|
|
81
|
-
message += `**${method.name}**\n`;
|
|
82
|
-
message += `${method.instruction || method.description || "No description available"}\n`;
|
|
83
|
-
if (method.variables_schema?.required && method.variables_schema.required.length > 0) message += `Required: ${method.variables_schema.required.join(", ")}\n`;
|
|
84
|
-
message += "\n";
|
|
85
|
-
}
|
|
86
|
-
if (data.nextCursor) message += `\n_Note: More methods available. Use cursor "${data.nextCursor}" to see more._\n\n`;
|
|
87
|
-
message += "\n**Instructions:**\n";
|
|
88
|
-
message += "1. If one of these scaffold methods matches what you need to create, use the `use-scaffold-method` MCP tool instead of writing files manually\n";
|
|
89
|
-
message += "2. If none of these methods are relevant to your task, proceed to write new files directly using the Write tool\n";
|
|
90
|
-
message += "3. Using scaffold methods ensures consistency with project patterns and includes all necessary boilerplate\n";
|
|
87
|
+
const message = formatScaffoldMethodsHookMessage(data.methods, { includeRequiredVars: true });
|
|
91
88
|
await executionLog.logExecution({
|
|
92
89
|
filePath: sessionKey,
|
|
93
90
|
operation: "list-scaffold-methods",
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const require_ListScaffoldingMethodsTool = require('./ListScaffoldingMethodsTool-
|
|
2
|
-
const require_src = require('./src-
|
|
3
|
-
const require_tools = require('./tools-
|
|
1
|
+
const require_ListScaffoldingMethodsTool = require('./ListScaffoldingMethodsTool-DBwZzJTA.cjs');
|
|
2
|
+
const require_src = require('./src-DxoKQE4s.cjs');
|
|
3
|
+
const require_tools = require('./tools-DsnQImJ1.cjs');
|
|
4
4
|
|
|
5
5
|
exports.BoilerplateGeneratorService = require_tools.BoilerplateGeneratorService;
|
|
6
6
|
exports.BoilerplateService = require_tools.BoilerplateService;
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as createServer, i as StdioTransportHandler, n as HttpTransportHandler, r as SseTransportHandler, t as TransportMode } from "./src-
|
|
2
|
-
import { a as ScaffoldProcessingService, i as ScaffoldService, l as TemplateService, n as ScaffoldingMethodsService, o as ScaffoldConfigLoader, r as VariableReplacementService, s as FileSystemService, t as ListScaffoldingMethodsTool } from "./ListScaffoldingMethodsTool-
|
|
3
|
-
import { a as GenerateFeatureScaffoldTool, c as ScaffoldGeneratorService, i as ListBoilerplatesTool, l as BoilerplateService, n as UseScaffoldMethodTool, o as GenerateBoilerplateTool, r as UseBoilerplateTool, s as GenerateBoilerplateFileTool, t as WriteToFileTool, u as BoilerplateGeneratorService } from "./tools-
|
|
1
|
+
import { a as createServer, i as StdioTransportHandler, n as HttpTransportHandler, r as SseTransportHandler, t as TransportMode } from "./src-sY88BbkJ.mjs";
|
|
2
|
+
import { a as ScaffoldProcessingService, i as ScaffoldService, l as TemplateService, n as ScaffoldingMethodsService, o as ScaffoldConfigLoader, r as VariableReplacementService, s as FileSystemService, t as ListScaffoldingMethodsTool } from "./ListScaffoldingMethodsTool-D6BkKQyK.mjs";
|
|
3
|
+
import { a as GenerateFeatureScaffoldTool, c as ScaffoldGeneratorService, i as ListBoilerplatesTool, l as BoilerplateService, n as UseScaffoldMethodTool, o as GenerateBoilerplateTool, r as UseBoilerplateTool, s as GenerateBoilerplateFileTool, t as WriteToFileTool, u as BoilerplateGeneratorService } from "./tools-t-HMGLVh.mjs";
|
|
4
4
|
|
|
5
5
|
export { BoilerplateGeneratorService, BoilerplateService, FileSystemService, GenerateBoilerplateFileTool, GenerateBoilerplateTool, GenerateFeatureScaffoldTool, HttpTransportHandler, ListBoilerplatesTool, ListScaffoldingMethodsTool, ScaffoldConfigLoader, ScaffoldGeneratorService, ScaffoldProcessingService, ScaffoldService, ScaffoldingMethodsService, SseTransportHandler, StdioTransportHandler, TemplateService, TransportMode, UseBoilerplateTool, UseScaffoldMethodTool, VariableReplacementService, WriteToFileTool, createServer };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
const require_ListScaffoldingMethodsTool = require('./ListScaffoldingMethodsTool-DBwZzJTA.cjs');
|
|
2
|
+
let node_path = require("node:path");
|
|
3
|
+
node_path = require_ListScaffoldingMethodsTool.__toESM(node_path);
|
|
4
|
+
let node_fs_promises = require("node:fs/promises");
|
|
5
|
+
node_fs_promises = require_ListScaffoldingMethodsTool.__toESM(node_fs_promises);
|
|
6
|
+
|
|
7
|
+
//#region src/hooks/shared.ts
|
|
8
|
+
const MAX_SCAFFOLD_METHODS_IN_HOOK = 5;
|
|
9
|
+
const MAX_REQUIRED_VARS_IN_HOOK = 3;
|
|
10
|
+
const REQUIRED_VARS_METHOD_LIMIT = 2;
|
|
11
|
+
async function resolveNewFileWriteTarget(cwd, toolName, filePath) {
|
|
12
|
+
if (!filePath || toolName.toLowerCase() !== "write") return null;
|
|
13
|
+
const absoluteFilePath = node_path.default.isAbsolute(filePath) ? filePath : node_path.default.join(cwd, filePath);
|
|
14
|
+
if (!absoluteFilePath.startsWith(cwd + node_path.default.sep) && absoluteFilePath !== cwd) return null;
|
|
15
|
+
try {
|
|
16
|
+
await node_fs_promises.default.access(absoluteFilePath);
|
|
17
|
+
return null;
|
|
18
|
+
} catch (error) {
|
|
19
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT") return absoluteFilePath;
|
|
20
|
+
throw error;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function formatScaffoldMethodsHookMessage(methods, options) {
|
|
24
|
+
const maxMethods = options?.maxMethods ?? MAX_SCAFFOLD_METHODS_IN_HOOK;
|
|
25
|
+
const requiredVarsMethodLimit = options?.requiredVarsMethodLimit ?? REQUIRED_VARS_METHOD_LIMIT;
|
|
26
|
+
const maxRequiredVars = options?.maxRequiredVars ?? MAX_REQUIRED_VARS_IN_HOOK;
|
|
27
|
+
const visibleMethods = methods.slice(0, maxMethods);
|
|
28
|
+
const hiddenCount = Math.max(methods.length - visibleMethods.length, 0);
|
|
29
|
+
let message = "Before writing this new file, use `use-scaffold-method` if any of these fit:\n\n";
|
|
30
|
+
for (const [index, method] of visibleMethods.entries()) {
|
|
31
|
+
message += `- **${method.name}**: ${method.description || "No description available"}\n`;
|
|
32
|
+
if (options?.includeRequiredVars && index < requiredVarsMethodLimit) {
|
|
33
|
+
const requiredVars = method.variables_schema?.required ?? [];
|
|
34
|
+
if (requiredVars.length > 0) {
|
|
35
|
+
const visibleVars = requiredVars.slice(0, maxRequiredVars);
|
|
36
|
+
const moreCount = Math.max(requiredVars.length - visibleVars.length, 0);
|
|
37
|
+
const suffix = moreCount > 0 ? `, +${moreCount} more` : "";
|
|
38
|
+
message += ` Required: ${visibleVars.join(", ")}${suffix}\n`;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
if (hiddenCount > 0) message += `\n...and ${hiddenCount} more methods. Call \`list-scaffolding-methods\` for the full list.\n`;
|
|
43
|
+
return message.trimEnd();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
//#endregion
|
|
47
|
+
Object.defineProperty(exports, 'formatScaffoldMethodsHookMessage', {
|
|
48
|
+
enumerable: true,
|
|
49
|
+
get: function () {
|
|
50
|
+
return formatScaffoldMethodsHookMessage;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
Object.defineProperty(exports, 'resolveNewFileWriteTarget', {
|
|
54
|
+
enumerable: true,
|
|
55
|
+
get: function () {
|
|
56
|
+
return resolveNewFileWriteTarget;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import fs from "node:fs/promises";
|
|
3
|
+
|
|
4
|
+
//#region src/hooks/shared.ts
|
|
5
|
+
const MAX_SCAFFOLD_METHODS_IN_HOOK = 5;
|
|
6
|
+
const MAX_REQUIRED_VARS_IN_HOOK = 3;
|
|
7
|
+
const REQUIRED_VARS_METHOD_LIMIT = 2;
|
|
8
|
+
async function resolveNewFileWriteTarget(cwd, toolName, filePath) {
|
|
9
|
+
if (!filePath || toolName.toLowerCase() !== "write") return null;
|
|
10
|
+
const absoluteFilePath = path.isAbsolute(filePath) ? filePath : path.join(cwd, filePath);
|
|
11
|
+
if (!absoluteFilePath.startsWith(cwd + path.sep) && absoluteFilePath !== cwd) return null;
|
|
12
|
+
try {
|
|
13
|
+
await fs.access(absoluteFilePath);
|
|
14
|
+
return null;
|
|
15
|
+
} catch (error) {
|
|
16
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT") return absoluteFilePath;
|
|
17
|
+
throw error;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function formatScaffoldMethodsHookMessage(methods, options) {
|
|
21
|
+
const maxMethods = options?.maxMethods ?? MAX_SCAFFOLD_METHODS_IN_HOOK;
|
|
22
|
+
const requiredVarsMethodLimit = options?.requiredVarsMethodLimit ?? REQUIRED_VARS_METHOD_LIMIT;
|
|
23
|
+
const maxRequiredVars = options?.maxRequiredVars ?? MAX_REQUIRED_VARS_IN_HOOK;
|
|
24
|
+
const visibleMethods = methods.slice(0, maxMethods);
|
|
25
|
+
const hiddenCount = Math.max(methods.length - visibleMethods.length, 0);
|
|
26
|
+
let message = "Before writing this new file, use `use-scaffold-method` if any of these fit:\n\n";
|
|
27
|
+
for (const [index, method] of visibleMethods.entries()) {
|
|
28
|
+
message += `- **${method.name}**: ${method.description || "No description available"}\n`;
|
|
29
|
+
if (options?.includeRequiredVars && index < requiredVarsMethodLimit) {
|
|
30
|
+
const requiredVars = method.variables_schema?.required ?? [];
|
|
31
|
+
if (requiredVars.length > 0) {
|
|
32
|
+
const visibleVars = requiredVars.slice(0, maxRequiredVars);
|
|
33
|
+
const moreCount = Math.max(requiredVars.length - visibleVars.length, 0);
|
|
34
|
+
const suffix = moreCount > 0 ? `, +${moreCount} more` : "";
|
|
35
|
+
message += ` Required: ${visibleVars.join(", ")}${suffix}\n`;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
if (hiddenCount > 0) message += `\n...and ${hiddenCount} more methods. Call \`list-scaffolding-methods\` for the full list.\n`;
|
|
40
|
+
return message.trimEnd();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
//#endregion
|
|
44
|
+
export { resolveNewFileWriteTarget as n, formatScaffoldMethodsHookMessage as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_ListScaffoldingMethodsTool = require('./ListScaffoldingMethodsTool-
|
|
2
|
-
const require_tools = require('./tools-
|
|
1
|
+
const require_ListScaffoldingMethodsTool = require('./ListScaffoldingMethodsTool-DBwZzJTA.cjs');
|
|
2
|
+
const require_tools = require('./tools-DsnQImJ1.cjs');
|
|
3
3
|
let __agiflowai_aicode_utils = require("@agiflowai/aicode-utils");
|
|
4
4
|
let __modelcontextprotocol_sdk_server_index_js = require("@modelcontextprotocol/sdk/server/index.js");
|
|
5
5
|
let __modelcontextprotocol_sdk_types_js = require("@modelcontextprotocol/sdk/types.js");
|
|
@@ -12,11 +12,11 @@ let node_crypto = require("node:crypto");
|
|
|
12
12
|
let __modelcontextprotocol_sdk_server_streamableHttp_js = require("@modelcontextprotocol/sdk/server/streamableHttp.js");
|
|
13
13
|
|
|
14
14
|
//#region package.json
|
|
15
|
-
var version = "1.0.
|
|
15
|
+
var version = "1.0.25";
|
|
16
16
|
|
|
17
17
|
//#endregion
|
|
18
18
|
//#region src/instructions/server.md?raw
|
|
19
|
-
var server_default = "Use this MCP server to {% if isMonolith %}create your monolith project and add features (pages, components, services, etc.){% else %}create new projects and add features (pages, components, services, etc.){% endif %}.\n\n## Workflow:\n{% if not isMonolith %}\n1. **Creating New Project**: Use `list-boilerplates` → `use-boilerplate`\n2. **Adding Features**: Use `list-scaffolding-methods` → `use-scaffold-method`\n{% else %}\n1. **Creating Project**: Use `use-boilerplate` (boilerplateName auto-detected from toolkit.yaml)\n2. **Adding Features**: Use `list-scaffolding-methods` → `use-scaffold-method`\n{% endif %}\n\n## AI Usage Guidelines:\n{% if not isMonolith %}\n- Always call `list-boilerplates` first when creating new projects to see available options\n{% endif %}\n- Always call `list-scaffolding-methods` first when adding features to understand what's available\n- Follow the exact variable schema provided - validation will fail if required fields are missing\n{% if not isMonolith %}\n- Use kebab-case for project names (e.g., \"my-new-app\")\n{% else %}\n- In monolith mode, parameters like `boilerplateName` and `templateName` are auto-detected from toolkit.yaml
|
|
19
|
+
var server_default = "Use this MCP server to {% if isMonolith %}create your monolith project and add features (pages, components, services, etc.){% else %}create new projects and add features (pages, components, services, etc.){% endif %}.\n\n## Workflow:\n{% if not isMonolith %}\n1. **Creating New Project**: Use `list-boilerplates` → `use-boilerplate`\n2. **Adding Features**: Use `list-scaffolding-methods` → `use-scaffold-method`\n{% else %}\n1. **Creating Project**: Use `use-boilerplate` (boilerplateName auto-detected from `.toolkit/settings.yaml`)\n2. **Adding Features**: Use `list-scaffolding-methods` → `use-scaffold-method`\n{% endif %}\n\n## AI Usage Guidelines:\n{% if not isMonolith %}\n- Always call `list-boilerplates` first when creating new projects to see available options\n{% endif %}\n- Always call `list-scaffolding-methods` first when adding features to understand what's available\n- Follow the exact variable schema provided - validation will fail if required fields are missing\n{% if not isMonolith %}\n- Use kebab-case for project names (e.g., \"my-new-app\")\n{% else %}\n- In monolith mode, parameters like `boilerplateName` and `templateName` are auto-detected from `.toolkit/settings.yaml`\n- You only need to provide `variables` when calling `use-boilerplate` or `use-scaffold-method`\n{% endif %}\n- The tools automatically handle file placement, imports, and code generation\n- Check the returned JSON schemas to understand required vs optional variables\n{% if adminEnabled %}\n\n## Admin Mode (Template Generation):\n\nWhen creating custom boilerplate templates for frameworks not yet supported:\n\n1. **Create Boilerplate Configuration**: Use `generate-boilerplate` to add a new boilerplate entry to a template's scaffold.yaml\n - Specify template name, boilerplate name, description, target folder, and variable schema\n - This creates the scaffold.yaml structure following the nextjs-15 pattern\n - Optional: Add detailed instruction about file purposes and design patterns\n\n2. **Create Feature Configuration**: Use `generate-feature-scaffold` to add a new feature entry to a template's scaffold.yaml\n - Specify template name, feature name, generator, description, and variable schema\n - This creates the scaffold.yaml structure for feature scaffolds (pages, components, etc.)\n - Optional: Add detailed instruction about file purposes and design patterns\n - Optional: Specify patterns to match existing files this feature works with\n\n3. **Create Template Files**: Use `generate-boilerplate-file` to create the actual template files\n - Create files referenced in the boilerplate's or feature's includes array\n - Use {{ variableName }} syntax for Liquid variable placeholders\n - Can copy from existing source files or provide content directly\n - Files automatically get .liquid extension\n\n4. **Test the Template**: Use `list-boilerplates`/`list-scaffolding-methods` and `use-boilerplate`/`use-scaffold-method` to verify your template works\n\nExample workflow for boilerplate:\n```\n1. generate-boilerplate { templateName: \"react-vite\", boilerplateName: \"scaffold-vite-app\", ... }\n2. generate-boilerplate-file { templateName: \"react-vite\", filePath: \"package.json\", content: \"...\" }\n3. generate-boilerplate-file { templateName: \"react-vite\", filePath: \"src/App.tsx\", content: \"...\" }\n4. list-boilerplates (verify it appears)\n5. use-boilerplate { boilerplateName: \"scaffold-vite-app\", variables: {...} }\n```\n\nExample workflow for feature:\n```\n1. generate-feature-scaffold { templateName: \"nextjs-15\", featureName: \"scaffold-nextjs-component\", generator: \"componentGenerator.ts\", ... }\n2. generate-boilerplate-file { templateName: \"nextjs-15\", filePath: \"src/components/Component.tsx\", content: \"...\" }\n3. list-scaffolding-methods (verify it appears)\n4. use-scaffold-method { scaffoldName: \"scaffold-nextjs-component\", variables: {...} }\n```\n{% endif %}\n";
|
|
20
20
|
|
|
21
21
|
//#endregion
|
|
22
22
|
//#region src/instructions/prompts/generate-boilerplate.md?raw
|
|
@@ -80,7 +80,7 @@ var GenerateBoilerplatePrompt = class GenerateBoilerplatePrompt {
|
|
|
80
80
|
|
|
81
81
|
//#endregion
|
|
82
82
|
//#region src/instructions/prompts/generate-feature-scaffold.md?raw
|
|
83
|
-
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";
|
|
83
|
+
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/settings.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/settings.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";
|
|
84
84
|
|
|
85
85
|
//#endregion
|
|
86
86
|
//#region src/prompts/GenerateFeatureScaffoldPrompt.ts
|
|
@@ -140,7 +140,7 @@ var GenerateFeatureScaffoldPrompt = class GenerateFeatureScaffoldPrompt {
|
|
|
140
140
|
|
|
141
141
|
//#endregion
|
|
142
142
|
//#region src/instructions/prompts/scaffold-application.md?raw
|
|
143
|
-
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 - **REMOVE the `// @scaffold-generated` marker** from each file after implementing it (see below)\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## Scaffold Marker — Remove After Implementing\nGenerated `.ts`/`.tsx`/`.js`/`.jsx` files contain `// @scaffold-generated` at the top. This comment flags unimplemented boilerplate files.\n\n**You MUST delete this line once a file is fully implemented.** Leaving it in place marks the file as a \"phantom\" — a scaffolded file whose logic was never written. The marker is checked at session boundaries to catch files that were accidentally left as empty templates.\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
|
|
143
|
+
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/settings.yaml` file (or legacy `toolkit.yaml` if present).{% 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/settings.yaml` sourceTemplate{% 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/settings.yaml` (or legacy `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 - **REMOVE the `// @scaffold-generated` marker** from each file after implementing it (see below)\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## Scaffold Marker — Remove After Implementing\nGenerated `.ts`/`.tsx`/`.js`/`.jsx` files contain `// @scaffold-generated` at the top. This comment flags unimplemented boilerplate files.\n\n**You MUST delete this line once a file is fully implemented.** Leaving it in place marks the file as a \"phantom\" — a scaffolded file whose logic was never written. The marker is checked at session boundaries to catch files that were accidentally left as empty templates.\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 the monolith template's variables_schema from `.toolkit/settings.yaml`\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. **REMOVE `// @scaffold-generated`** from each file once implemented\n9. Report success and next steps to the user\n";
|
|
144
144
|
|
|
145
145
|
//#endregion
|
|
146
146
|
//#region src/prompts/ScaffoldApplicationPrompt.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as TemplateService, t as ListScaffoldingMethodsTool } from "./ListScaffoldingMethodsTool-
|
|
2
|
-
import { a as GenerateFeatureScaffoldTool, i as ListBoilerplatesTool, n as UseScaffoldMethodTool, o as GenerateBoilerplateTool, r as UseBoilerplateTool, s as GenerateBoilerplateFileTool, t as WriteToFileTool } from "./tools-
|
|
1
|
+
import { l as TemplateService, t as ListScaffoldingMethodsTool } from "./ListScaffoldingMethodsTool-D6BkKQyK.mjs";
|
|
2
|
+
import { a as GenerateFeatureScaffoldTool, i as ListBoilerplatesTool, n as UseScaffoldMethodTool, o as GenerateBoilerplateTool, r as UseBoilerplateTool, s as GenerateBoilerplateFileTool, t as WriteToFileTool } from "./tools-t-HMGLVh.mjs";
|
|
3
3
|
import { TemplatesManagerService } from "@agiflowai/aicode-utils";
|
|
4
4
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
5
5
|
import { CallToolRequestSchema, GetPromptRequestSchema, ListPromptsRequestSchema, ListToolsRequestSchema, isInitializeRequest } from "@modelcontextprotocol/sdk/types.js";
|
|
@@ -11,11 +11,11 @@ import { randomUUID } from "node:crypto";
|
|
|
11
11
|
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
12
12
|
|
|
13
13
|
//#region package.json
|
|
14
|
-
var version = "1.0.
|
|
14
|
+
var version = "1.0.25";
|
|
15
15
|
|
|
16
16
|
//#endregion
|
|
17
17
|
//#region src/instructions/server.md?raw
|
|
18
|
-
var server_default = "Use this MCP server to {% if isMonolith %}create your monolith project and add features (pages, components, services, etc.){% else %}create new projects and add features (pages, components, services, etc.){% endif %}.\n\n## Workflow:\n{% if not isMonolith %}\n1. **Creating New Project**: Use `list-boilerplates` → `use-boilerplate`\n2. **Adding Features**: Use `list-scaffolding-methods` → `use-scaffold-method`\n{% else %}\n1. **Creating Project**: Use `use-boilerplate` (boilerplateName auto-detected from toolkit.yaml)\n2. **Adding Features**: Use `list-scaffolding-methods` → `use-scaffold-method`\n{% endif %}\n\n## AI Usage Guidelines:\n{% if not isMonolith %}\n- Always call `list-boilerplates` first when creating new projects to see available options\n{% endif %}\n- Always call `list-scaffolding-methods` first when adding features to understand what's available\n- Follow the exact variable schema provided - validation will fail if required fields are missing\n{% if not isMonolith %}\n- Use kebab-case for project names (e.g., \"my-new-app\")\n{% else %}\n- In monolith mode, parameters like `boilerplateName` and `templateName` are auto-detected from toolkit.yaml
|
|
18
|
+
var server_default = "Use this MCP server to {% if isMonolith %}create your monolith project and add features (pages, components, services, etc.){% else %}create new projects and add features (pages, components, services, etc.){% endif %}.\n\n## Workflow:\n{% if not isMonolith %}\n1. **Creating New Project**: Use `list-boilerplates` → `use-boilerplate`\n2. **Adding Features**: Use `list-scaffolding-methods` → `use-scaffold-method`\n{% else %}\n1. **Creating Project**: Use `use-boilerplate` (boilerplateName auto-detected from `.toolkit/settings.yaml`)\n2. **Adding Features**: Use `list-scaffolding-methods` → `use-scaffold-method`\n{% endif %}\n\n## AI Usage Guidelines:\n{% if not isMonolith %}\n- Always call `list-boilerplates` first when creating new projects to see available options\n{% endif %}\n- Always call `list-scaffolding-methods` first when adding features to understand what's available\n- Follow the exact variable schema provided - validation will fail if required fields are missing\n{% if not isMonolith %}\n- Use kebab-case for project names (e.g., \"my-new-app\")\n{% else %}\n- In monolith mode, parameters like `boilerplateName` and `templateName` are auto-detected from `.toolkit/settings.yaml`\n- You only need to provide `variables` when calling `use-boilerplate` or `use-scaffold-method`\n{% endif %}\n- The tools automatically handle file placement, imports, and code generation\n- Check the returned JSON schemas to understand required vs optional variables\n{% if adminEnabled %}\n\n## Admin Mode (Template Generation):\n\nWhen creating custom boilerplate templates for frameworks not yet supported:\n\n1. **Create Boilerplate Configuration**: Use `generate-boilerplate` to add a new boilerplate entry to a template's scaffold.yaml\n - Specify template name, boilerplate name, description, target folder, and variable schema\n - This creates the scaffold.yaml structure following the nextjs-15 pattern\n - Optional: Add detailed instruction about file purposes and design patterns\n\n2. **Create Feature Configuration**: Use `generate-feature-scaffold` to add a new feature entry to a template's scaffold.yaml\n - Specify template name, feature name, generator, description, and variable schema\n - This creates the scaffold.yaml structure for feature scaffolds (pages, components, etc.)\n - Optional: Add detailed instruction about file purposes and design patterns\n - Optional: Specify patterns to match existing files this feature works with\n\n3. **Create Template Files**: Use `generate-boilerplate-file` to create the actual template files\n - Create files referenced in the boilerplate's or feature's includes array\n - Use {{ variableName }} syntax for Liquid variable placeholders\n - Can copy from existing source files or provide content directly\n - Files automatically get .liquid extension\n\n4. **Test the Template**: Use `list-boilerplates`/`list-scaffolding-methods` and `use-boilerplate`/`use-scaffold-method` to verify your template works\n\nExample workflow for boilerplate:\n```\n1. generate-boilerplate { templateName: \"react-vite\", boilerplateName: \"scaffold-vite-app\", ... }\n2. generate-boilerplate-file { templateName: \"react-vite\", filePath: \"package.json\", content: \"...\" }\n3. generate-boilerplate-file { templateName: \"react-vite\", filePath: \"src/App.tsx\", content: \"...\" }\n4. list-boilerplates (verify it appears)\n5. use-boilerplate { boilerplateName: \"scaffold-vite-app\", variables: {...} }\n```\n\nExample workflow for feature:\n```\n1. generate-feature-scaffold { templateName: \"nextjs-15\", featureName: \"scaffold-nextjs-component\", generator: \"componentGenerator.ts\", ... }\n2. generate-boilerplate-file { templateName: \"nextjs-15\", filePath: \"src/components/Component.tsx\", content: \"...\" }\n3. list-scaffolding-methods (verify it appears)\n4. use-scaffold-method { scaffoldName: \"scaffold-nextjs-component\", variables: {...} }\n```\n{% endif %}\n";
|
|
19
19
|
|
|
20
20
|
//#endregion
|
|
21
21
|
//#region src/instructions/prompts/generate-boilerplate.md?raw
|
|
@@ -79,7 +79,7 @@ var GenerateBoilerplatePrompt = class GenerateBoilerplatePrompt {
|
|
|
79
79
|
|
|
80
80
|
//#endregion
|
|
81
81
|
//#region src/instructions/prompts/generate-feature-scaffold.md?raw
|
|
82
|
-
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";
|
|
82
|
+
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/settings.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/settings.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";
|
|
83
83
|
|
|
84
84
|
//#endregion
|
|
85
85
|
//#region src/prompts/GenerateFeatureScaffoldPrompt.ts
|
|
@@ -139,7 +139,7 @@ var GenerateFeatureScaffoldPrompt = class GenerateFeatureScaffoldPrompt {
|
|
|
139
139
|
|
|
140
140
|
//#endregion
|
|
141
141
|
//#region src/instructions/prompts/scaffold-application.md?raw
|
|
142
|
-
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 - **REMOVE the `// @scaffold-generated` marker** from each file after implementing it (see below)\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## Scaffold Marker — Remove After Implementing\nGenerated `.ts`/`.tsx`/`.js`/`.jsx` files contain `// @scaffold-generated` at the top. This comment flags unimplemented boilerplate files.\n\n**You MUST delete this line once a file is fully implemented.** Leaving it in place marks the file as a \"phantom\" — a scaffolded file whose logic was never written. The marker is checked at session boundaries to catch files that were accidentally left as empty templates.\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
|
|
142
|
+
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/settings.yaml` file (or legacy `toolkit.yaml` if present).{% 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/settings.yaml` sourceTemplate{% 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/settings.yaml` (or legacy `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 - **REMOVE the `// @scaffold-generated` marker** from each file after implementing it (see below)\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## Scaffold Marker — Remove After Implementing\nGenerated `.ts`/`.tsx`/`.js`/`.jsx` files contain `// @scaffold-generated` at the top. This comment flags unimplemented boilerplate files.\n\n**You MUST delete this line once a file is fully implemented.** Leaving it in place marks the file as a \"phantom\" — a scaffolded file whose logic was never written. The marker is checked at session boundaries to catch files that were accidentally left as empty templates.\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 the monolith template's variables_schema from `.toolkit/settings.yaml`\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. **REMOVE `// @scaffold-generated`** from each file once implemented\n9. Report success and next steps to the user\n";
|
|
143
143
|
|
|
144
144
|
//#endregion
|
|
145
145
|
//#region src/prompts/ScaffoldApplicationPrompt.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_ListScaffoldingMethodsTool = require('./ListScaffoldingMethodsTool-
|
|
1
|
+
const require_ListScaffoldingMethodsTool = require('./ListScaffoldingMethodsTool-DBwZzJTA.cjs');
|
|
2
2
|
let __agiflowai_aicode_utils = require("@agiflowai/aicode-utils");
|
|
3
3
|
let zod = require("zod");
|
|
4
4
|
let node_path = require("node:path");
|
|
@@ -1181,7 +1181,7 @@ Use this to add custom feature scaffolds (pages, components, services, etc.) for
|
|
|
1181
1181
|
|
|
1182
1182
|
//#endregion
|
|
1183
1183
|
//#region src/instructions/tools/list-boilerplates/description.md?raw
|
|
1184
|
-
var description_default$1 = "{% if isMonolith %}\nNot available for monolith projects. Monolith uses a single template defined in
|
|
1184
|
+
var description_default$1 = "{% if isMonolith %}\nNot available for monolith projects. Monolith uses a single template defined in `.toolkit/settings.yaml`.\n\nUse `list-scaffolding-methods` for available features instead.\n{% else %}\nLists all available project boilerplates for creating new applications, APIs, or packages in the monorepo.\n\nEach boilerplate includes:\n- Complete project template with starter files\n- Variable schema for customization\n- Target directory information (e.g., apps/, packages/)\n- Required and optional configuration options\n\nUse this FIRST when creating new projects to understand available templates and their requirements.\n{% endif %}\n";
|
|
1185
1185
|
|
|
1186
1186
|
//#endregion
|
|
1187
1187
|
//#region src/tools/ListBoilerplatesTool.ts
|
|
@@ -1238,7 +1238,7 @@ var ListBoilerplatesTool = class ListBoilerplatesTool {
|
|
|
1238
1238
|
|
|
1239
1239
|
//#endregion
|
|
1240
1240
|
//#region src/instructions/tools/use-boilerplate/description.md?raw
|
|
1241
|
-
var description_default = "{% if isMonolith %}\nThis tool is not available for monolith projects.\n\nMonolith projects use a single template specified in
|
|
1241
|
+
var description_default = "{% if isMonolith %}\nThis tool is not available for monolith projects.\n\nMonolith projects use a single template specified in `.toolkit/settings.yaml` (`sourceTemplate`). The template cannot be changed through this tool - it's determined by the workspace configuration.\n\nUse `list-scaffolding-methods` and `use-scaffold-method` to add features to your monolith project instead.\n{% else %}\nCreates a new project from a boilerplate template with the specified variables.\n\n**For Monorepo Projects Only:**\nThis tool creates new sub-projects (apps, packages) in your monorepo. Each project can use a different template.\n\nThis tool will:\n- Generate all necessary files from the selected boilerplate template\n- Replace template variables with provided values\n- Create the project in targetFolder/projectName (e.g., apps/my-new-app)\n- Set up initial configuration files (package.json, tsconfig.json, etc.)\n- Create project.json with sourceTemplate reference\n\nIMPORTANT:\n- Always call `list-boilerplates` first to get the exact variable schema\n- Follow the schema exactly - required fields must be provided\n- Use kebab-case for project names (e.g., \"my-new-app\", not \"MyNewApp\")\n- The tool will validate all variables against the schema before proceeding\n- Each new project can use a different boilerplate template\n{% endif %}\n";
|
|
1242
1242
|
|
|
1243
1243
|
//#endregion
|
|
1244
1244
|
//#region src/tools/UseBoilerplateTool.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as PaginationHelper, i as ScaffoldService, l as TemplateService, n as ScaffoldingMethodsService, o as ScaffoldConfigLoader, r as VariableReplacementService, s as FileSystemService } from "./ListScaffoldingMethodsTool-
|
|
1
|
+
import { c as PaginationHelper, i as ScaffoldService, l as TemplateService, n as ScaffoldingMethodsService, o as ScaffoldConfigLoader, r as VariableReplacementService, s as FileSystemService } from "./ListScaffoldingMethodsTool-D6BkKQyK.mjs";
|
|
2
2
|
import { ProjectConfigResolver, ensureDir, generateStableId, log, pathExists, pathExistsSync, readFile, readFileSync, readdir, statSync, writeFile } from "@agiflowai/aicode-utils";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import * as path$1 from "node:path";
|
|
@@ -1178,7 +1178,7 @@ Use this to add custom feature scaffolds (pages, components, services, etc.) for
|
|
|
1178
1178
|
|
|
1179
1179
|
//#endregion
|
|
1180
1180
|
//#region src/instructions/tools/list-boilerplates/description.md?raw
|
|
1181
|
-
var description_default$1 = "{% if isMonolith %}\nNot available for monolith projects. Monolith uses a single template defined in
|
|
1181
|
+
var description_default$1 = "{% if isMonolith %}\nNot available for monolith projects. Monolith uses a single template defined in `.toolkit/settings.yaml`.\n\nUse `list-scaffolding-methods` for available features instead.\n{% else %}\nLists all available project boilerplates for creating new applications, APIs, or packages in the monorepo.\n\nEach boilerplate includes:\n- Complete project template with starter files\n- Variable schema for customization\n- Target directory information (e.g., apps/, packages/)\n- Required and optional configuration options\n\nUse this FIRST when creating new projects to understand available templates and their requirements.\n{% endif %}\n";
|
|
1182
1182
|
|
|
1183
1183
|
//#endregion
|
|
1184
1184
|
//#region src/tools/ListBoilerplatesTool.ts
|
|
@@ -1235,7 +1235,7 @@ var ListBoilerplatesTool = class ListBoilerplatesTool {
|
|
|
1235
1235
|
|
|
1236
1236
|
//#endregion
|
|
1237
1237
|
//#region src/instructions/tools/use-boilerplate/description.md?raw
|
|
1238
|
-
var description_default = "{% if isMonolith %}\nThis tool is not available for monolith projects.\n\nMonolith projects use a single template specified in
|
|
1238
|
+
var description_default = "{% if isMonolith %}\nThis tool is not available for monolith projects.\n\nMonolith projects use a single template specified in `.toolkit/settings.yaml` (`sourceTemplate`). The template cannot be changed through this tool - it's determined by the workspace configuration.\n\nUse `list-scaffolding-methods` and `use-scaffold-method` to add features to your monolith project instead.\n{% else %}\nCreates a new project from a boilerplate template with the specified variables.\n\n**For Monorepo Projects Only:**\nThis tool creates new sub-projects (apps, packages) in your monorepo. Each project can use a different template.\n\nThis tool will:\n- Generate all necessary files from the selected boilerplate template\n- Replace template variables with provided values\n- Create the project in targetFolder/projectName (e.g., apps/my-new-app)\n- Set up initial configuration files (package.json, tsconfig.json, etc.)\n- Create project.json with sourceTemplate reference\n\nIMPORTANT:\n- Always call `list-boilerplates` first to get the exact variable schema\n- Follow the schema exactly - required fields must be provided\n- Use kebab-case for project names (e.g., \"my-new-app\", not \"MyNewApp\")\n- The tool will validate all variables against the schema before proceeding\n- Each new project can use a different boilerplate template\n{% endif %}\n";
|
|
1239
1239
|
|
|
1240
1240
|
//#endregion
|
|
1241
1241
|
//#region src/tools/UseBoilerplateTool.ts
|
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.
|
|
4
|
+
"version": "1.0.26",
|
|
5
5
|
"license": "AGPL-3.0",
|
|
6
6
|
"author": "AgiflowIO",
|
|
7
7
|
"repository": {
|
|
@@ -43,15 +43,15 @@
|
|
|
43
43
|
"execa": "^9.5.2",
|
|
44
44
|
"express": "^4.21.2",
|
|
45
45
|
"js-yaml": "4.1.1",
|
|
46
|
-
"liquidjs": "10.
|
|
46
|
+
"liquidjs": "10.25.0",
|
|
47
47
|
"minimatch": "^10.2.3",
|
|
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.
|
|
52
|
-
"@agiflowai/
|
|
53
|
-
"@agiflowai/
|
|
54
|
-
"@agiflowai/
|
|
51
|
+
"@agiflowai/aicode-utils": "1.0.19",
|
|
52
|
+
"@agiflowai/coding-agent-bridge": "1.0.22",
|
|
53
|
+
"@agiflowai/hooks-adapter": "0.0.20",
|
|
54
|
+
"@agiflowai/architect-mcp": "1.0.24"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@types/express": "^5.0.0",
|