@agiflowai/scaffold-mcp 1.0.19 → 1.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ListScaffoldingMethodsTool-T_o0iifQ.mjs → ListScaffoldingMethodsTool-DjhhMWjh.mjs} +37 -8
- package/dist/{ListScaffoldingMethodsTool-BVzCtkpA.cjs → ListScaffoldingMethodsTool-Dnd3E5X_.cjs} +37 -8
- package/dist/cli.cjs +95 -13
- package/dist/cli.mjs +95 -13
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +163 -24
- package/dist/index.d.mts +163 -24
- package/dist/index.mjs +2 -2
- package/dist/phantomCodeCheck-BXQonrXo.mjs +143 -0
- package/dist/phantomCodeCheck-DNkWyMRE.cjs +144 -0
- package/dist/{stdio-t-O7AO9u.mjs → stdio-Boc4SGGT.mjs} +19 -7
- package/dist/{stdio-DkLk-WCI.cjs → stdio-Bw7Hyv3X.cjs} +19 -7
- package/dist/{useScaffoldMethod-AuOga8Hc.cjs → useScaffoldMethod-BR3ESqor.cjs} +9 -1
- package/dist/{useScaffoldMethod-DhOHJdF-.cjs → useScaffoldMethod-CJG7ngkT.cjs} +1 -1
- package/dist/{useScaffoldMethod-U7nkNKZb.mjs → useScaffoldMethod-DaAZTyIM.mjs} +1 -1
- package/dist/{useScaffoldMethod-BhbJIvQG.mjs → useScaffoldMethod-DlrzH-3H.mjs} +9 -1
- package/package.json +7 -7
package/dist/{ListScaffoldingMethodsTool-T_o0iifQ.mjs → ListScaffoldingMethodsTool-DjhhMWjh.mjs}
RENAMED
|
@@ -369,7 +369,8 @@ var ScaffoldProcessingService = class {
|
|
|
369
369
|
|
|
370
370
|
//#endregion
|
|
371
371
|
//#region src/services/ScaffoldService.ts
|
|
372
|
-
var ScaffoldService = class {
|
|
372
|
+
var ScaffoldService = class ScaffoldService {
|
|
373
|
+
static DEFAULT_MARKER = "@scaffold-generated";
|
|
373
374
|
templatesRootPath;
|
|
374
375
|
processingService;
|
|
375
376
|
constructor(fileSystem, scaffoldConfigLoader, variableReplacer, templatesRootPath) {
|
|
@@ -386,7 +387,7 @@ var ScaffoldService = class {
|
|
|
386
387
|
*/
|
|
387
388
|
async useBoilerplate(options) {
|
|
388
389
|
try {
|
|
389
|
-
const { projectName, packageName, targetFolder, templateFolder, boilerplateName, variables = {} } = options;
|
|
390
|
+
const { projectName, packageName, targetFolder, templateFolder, boilerplateName, variables = {}, marker } = options;
|
|
390
391
|
const targetPath = path.isAbsolute(targetFolder) ? projectName ? path.join(targetFolder, projectName) : targetFolder : projectName ? path.join(process.cwd(), targetFolder, projectName) : path.join(process.cwd(), targetFolder);
|
|
391
392
|
const templatePath = path.join(this.templatesRootPath, templateFolder);
|
|
392
393
|
const validationResult = await this.scaffoldConfigLoader.validateTemplate(templatePath, "boilerplate");
|
|
@@ -425,7 +426,8 @@ var ScaffoldService = class {
|
|
|
425
426
|
targetPath,
|
|
426
427
|
templatePath,
|
|
427
428
|
allVariables,
|
|
428
|
-
scaffoldType: "boilerplate"
|
|
429
|
+
scaffoldType: "boilerplate",
|
|
430
|
+
marker: marker ?? ScaffoldService.DEFAULT_MARKER
|
|
429
431
|
});
|
|
430
432
|
} catch (error) {
|
|
431
433
|
return {
|
|
@@ -439,7 +441,7 @@ var ScaffoldService = class {
|
|
|
439
441
|
*/
|
|
440
442
|
async useFeature(options) {
|
|
441
443
|
try {
|
|
442
|
-
const { projectPath, templateFolder, featureName, variables = {} } = options;
|
|
444
|
+
const { projectPath, templateFolder, featureName, variables = {}, marker } = options;
|
|
443
445
|
const targetPath = path.resolve(projectPath);
|
|
444
446
|
const templatePath = path.join(this.templatesRootPath, templateFolder);
|
|
445
447
|
const projectName = path.basename(targetPath);
|
|
@@ -477,7 +479,8 @@ var ScaffoldService = class {
|
|
|
477
479
|
targetPath,
|
|
478
480
|
templatePath,
|
|
479
481
|
allVariables,
|
|
480
|
-
scaffoldType: "feature"
|
|
482
|
+
scaffoldType: "feature",
|
|
483
|
+
marker: marker ?? ScaffoldService.DEFAULT_MARKER
|
|
481
484
|
});
|
|
482
485
|
} catch (error) {
|
|
483
486
|
return {
|
|
@@ -487,10 +490,34 @@ var ScaffoldService = class {
|
|
|
487
490
|
}
|
|
488
491
|
}
|
|
489
492
|
/**
|
|
493
|
+
* Inject scaffold marker comment into generated code files.
|
|
494
|
+
* Prepends `// <marker>` to .ts/.tsx/.js/.jsx files that don't already have it.
|
|
495
|
+
* Fails silently — marker injection should never break scaffold output.
|
|
496
|
+
*/
|
|
497
|
+
async injectScaffoldMarkers(createdFiles, marker) {
|
|
498
|
+
const codeExtensions = new Set([
|
|
499
|
+
".ts",
|
|
500
|
+
".tsx",
|
|
501
|
+
".js",
|
|
502
|
+
".jsx"
|
|
503
|
+
]);
|
|
504
|
+
const markerComment = `// ${marker}`;
|
|
505
|
+
for (const filePath of createdFiles) {
|
|
506
|
+
if (!codeExtensions.has(path.extname(filePath))) continue;
|
|
507
|
+
try {
|
|
508
|
+
const content = await this.fileSystem.readFile(filePath, "utf8");
|
|
509
|
+
if (content.startsWith(markerComment)) continue;
|
|
510
|
+
await this.fileSystem.writeFile(filePath, `${markerComment}\n${content}`);
|
|
511
|
+
} catch (error) {
|
|
512
|
+
log.warn(`Failed to inject scaffold marker into ${filePath}:`, error);
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
490
517
|
* Common scaffolding processing logic shared by both useBoilerplate and useFeature
|
|
491
518
|
*/
|
|
492
519
|
async processScaffold(params) {
|
|
493
|
-
const { config, targetPath, templatePath, allVariables, scaffoldType } = params;
|
|
520
|
+
const { config, targetPath, templatePath, allVariables, scaffoldType, marker } = params;
|
|
494
521
|
log.debug("Config generator:", config.generator);
|
|
495
522
|
log.debug("Config:", JSON.stringify(config, null, 2));
|
|
496
523
|
if (config.generator) {
|
|
@@ -552,6 +579,7 @@ var ScaffoldService = class {
|
|
|
552
579
|
const targetFilePath = path.join(targetPath, parsed.targetPath);
|
|
553
580
|
await this.processingService.copyAndProcess(sourcePath, targetFilePath, variablesWithDefaults, createdFiles, existingFiles);
|
|
554
581
|
}));
|
|
582
|
+
if (marker && createdFiles.length > 0) await this.injectScaffoldMarkers(createdFiles, marker);
|
|
555
583
|
let message = `Successfully scaffolded ${scaffoldType} at ${targetPath}`;
|
|
556
584
|
if (existingFiles.length > 0) message += `. ${existingFiles.length} existing file(s) were preserved`;
|
|
557
585
|
message += ". Run 'pnpm install' to install dependencies.";
|
|
@@ -893,7 +921,7 @@ var ScaffoldingMethodsService = class {
|
|
|
893
921
|
return templateDirs;
|
|
894
922
|
}
|
|
895
923
|
async useScaffoldMethod(request) {
|
|
896
|
-
const { projectPath, scaffold_feature_name, variables, sessionId } = request;
|
|
924
|
+
const { projectPath, scaffold_feature_name, variables, sessionId, marker } = request;
|
|
897
925
|
const absoluteProjectPath = await this.resolveProjectPath(projectPath);
|
|
898
926
|
const sourceTemplate = (await ProjectConfigResolver.resolveProjectConfig(absoluteProjectPath)).sourceTemplate;
|
|
899
927
|
const { templatePath, methods: allMethods } = await this.collectAllMethodsByTemplate(sourceTemplate);
|
|
@@ -915,7 +943,8 @@ var ScaffoldingMethodsService = class {
|
|
|
915
943
|
...variables,
|
|
916
944
|
appPath: absoluteProjectPath,
|
|
917
945
|
appName: projectName
|
|
918
|
-
}
|
|
946
|
+
},
|
|
947
|
+
marker
|
|
919
948
|
});
|
|
920
949
|
if (!result.success) throw new Error(result.message);
|
|
921
950
|
if (sessionId && result.createdFiles && result.createdFiles.length > 0) try {
|
package/dist/{ListScaffoldingMethodsTool-BVzCtkpA.cjs → ListScaffoldingMethodsTool-Dnd3E5X_.cjs}
RENAMED
|
@@ -398,7 +398,8 @@ var ScaffoldProcessingService = class {
|
|
|
398
398
|
|
|
399
399
|
//#endregion
|
|
400
400
|
//#region src/services/ScaffoldService.ts
|
|
401
|
-
var ScaffoldService = class {
|
|
401
|
+
var ScaffoldService = class ScaffoldService {
|
|
402
|
+
static DEFAULT_MARKER = "@scaffold-generated";
|
|
402
403
|
templatesRootPath;
|
|
403
404
|
processingService;
|
|
404
405
|
constructor(fileSystem, scaffoldConfigLoader, variableReplacer, templatesRootPath) {
|
|
@@ -415,7 +416,7 @@ var ScaffoldService = class {
|
|
|
415
416
|
*/
|
|
416
417
|
async useBoilerplate(options) {
|
|
417
418
|
try {
|
|
418
|
-
const { projectName, packageName, targetFolder, templateFolder, boilerplateName, variables = {} } = options;
|
|
419
|
+
const { projectName, packageName, targetFolder, templateFolder, boilerplateName, variables = {}, marker } = options;
|
|
419
420
|
const targetPath = node_path.default.isAbsolute(targetFolder) ? projectName ? node_path.default.join(targetFolder, projectName) : targetFolder : projectName ? node_path.default.join(process.cwd(), targetFolder, projectName) : node_path.default.join(process.cwd(), targetFolder);
|
|
420
421
|
const templatePath = node_path.default.join(this.templatesRootPath, templateFolder);
|
|
421
422
|
const validationResult = await this.scaffoldConfigLoader.validateTemplate(templatePath, "boilerplate");
|
|
@@ -454,7 +455,8 @@ var ScaffoldService = class {
|
|
|
454
455
|
targetPath,
|
|
455
456
|
templatePath,
|
|
456
457
|
allVariables,
|
|
457
|
-
scaffoldType: "boilerplate"
|
|
458
|
+
scaffoldType: "boilerplate",
|
|
459
|
+
marker: marker ?? ScaffoldService.DEFAULT_MARKER
|
|
458
460
|
});
|
|
459
461
|
} catch (error) {
|
|
460
462
|
return {
|
|
@@ -468,7 +470,7 @@ var ScaffoldService = class {
|
|
|
468
470
|
*/
|
|
469
471
|
async useFeature(options) {
|
|
470
472
|
try {
|
|
471
|
-
const { projectPath, templateFolder, featureName, variables = {} } = options;
|
|
473
|
+
const { projectPath, templateFolder, featureName, variables = {}, marker } = options;
|
|
472
474
|
const targetPath = node_path.default.resolve(projectPath);
|
|
473
475
|
const templatePath = node_path.default.join(this.templatesRootPath, templateFolder);
|
|
474
476
|
const projectName = node_path.default.basename(targetPath);
|
|
@@ -506,7 +508,8 @@ var ScaffoldService = class {
|
|
|
506
508
|
targetPath,
|
|
507
509
|
templatePath,
|
|
508
510
|
allVariables,
|
|
509
|
-
scaffoldType: "feature"
|
|
511
|
+
scaffoldType: "feature",
|
|
512
|
+
marker: marker ?? ScaffoldService.DEFAULT_MARKER
|
|
510
513
|
});
|
|
511
514
|
} catch (error) {
|
|
512
515
|
return {
|
|
@@ -516,10 +519,34 @@ var ScaffoldService = class {
|
|
|
516
519
|
}
|
|
517
520
|
}
|
|
518
521
|
/**
|
|
522
|
+
* Inject scaffold marker comment into generated code files.
|
|
523
|
+
* Prepends `// <marker>` to .ts/.tsx/.js/.jsx files that don't already have it.
|
|
524
|
+
* Fails silently — marker injection should never break scaffold output.
|
|
525
|
+
*/
|
|
526
|
+
async injectScaffoldMarkers(createdFiles, marker) {
|
|
527
|
+
const codeExtensions = new Set([
|
|
528
|
+
".ts",
|
|
529
|
+
".tsx",
|
|
530
|
+
".js",
|
|
531
|
+
".jsx"
|
|
532
|
+
]);
|
|
533
|
+
const markerComment = `// ${marker}`;
|
|
534
|
+
for (const filePath of createdFiles) {
|
|
535
|
+
if (!codeExtensions.has(node_path.default.extname(filePath))) continue;
|
|
536
|
+
try {
|
|
537
|
+
const content = await this.fileSystem.readFile(filePath, "utf8");
|
|
538
|
+
if (content.startsWith(markerComment)) continue;
|
|
539
|
+
await this.fileSystem.writeFile(filePath, `${markerComment}\n${content}`);
|
|
540
|
+
} catch (error) {
|
|
541
|
+
__agiflowai_aicode_utils.log.warn(`Failed to inject scaffold marker into ${filePath}:`, error);
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
/**
|
|
519
546
|
* Common scaffolding processing logic shared by both useBoilerplate and useFeature
|
|
520
547
|
*/
|
|
521
548
|
async processScaffold(params) {
|
|
522
|
-
const { config, targetPath, templatePath, allVariables, scaffoldType } = params;
|
|
549
|
+
const { config, targetPath, templatePath, allVariables, scaffoldType, marker } = params;
|
|
523
550
|
__agiflowai_aicode_utils.log.debug("Config generator:", config.generator);
|
|
524
551
|
__agiflowai_aicode_utils.log.debug("Config:", JSON.stringify(config, null, 2));
|
|
525
552
|
if (config.generator) {
|
|
@@ -581,6 +608,7 @@ var ScaffoldService = class {
|
|
|
581
608
|
const targetFilePath = node_path.default.join(targetPath, parsed.targetPath);
|
|
582
609
|
await this.processingService.copyAndProcess(sourcePath, targetFilePath, variablesWithDefaults, createdFiles, existingFiles);
|
|
583
610
|
}));
|
|
611
|
+
if (marker && createdFiles.length > 0) await this.injectScaffoldMarkers(createdFiles, marker);
|
|
584
612
|
let message = `Successfully scaffolded ${scaffoldType} at ${targetPath}`;
|
|
585
613
|
if (existingFiles.length > 0) message += `. ${existingFiles.length} existing file(s) were preserved`;
|
|
586
614
|
message += ". Run 'pnpm install' to install dependencies.";
|
|
@@ -922,7 +950,7 @@ var ScaffoldingMethodsService = class {
|
|
|
922
950
|
return templateDirs;
|
|
923
951
|
}
|
|
924
952
|
async useScaffoldMethod(request) {
|
|
925
|
-
const { projectPath, scaffold_feature_name, variables, sessionId } = request;
|
|
953
|
+
const { projectPath, scaffold_feature_name, variables, sessionId, marker } = request;
|
|
926
954
|
const absoluteProjectPath = await this.resolveProjectPath(projectPath);
|
|
927
955
|
const sourceTemplate = (await __agiflowai_aicode_utils.ProjectConfigResolver.resolveProjectConfig(absoluteProjectPath)).sourceTemplate;
|
|
928
956
|
const { templatePath, methods: allMethods } = await this.collectAllMethodsByTemplate(sourceTemplate);
|
|
@@ -944,7 +972,8 @@ var ScaffoldingMethodsService = class {
|
|
|
944
972
|
...variables,
|
|
945
973
|
appPath: absoluteProjectPath,
|
|
946
974
|
appName: projectName
|
|
947
|
-
}
|
|
975
|
+
},
|
|
976
|
+
marker
|
|
948
977
|
});
|
|
949
978
|
if (!result.success) throw new Error(result.message);
|
|
950
979
|
if (sessionId && result.createdFiles && result.createdFiles.length > 0) try {
|
package/dist/cli.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const require_ListScaffoldingMethodsTool = require('./ListScaffoldingMethodsTool-
|
|
3
|
-
const require_stdio = require('./stdio-
|
|
2
|
+
const require_ListScaffoldingMethodsTool = require('./ListScaffoldingMethodsTool-Dnd3E5X_.cjs');
|
|
3
|
+
const require_stdio = require('./stdio-Bw7Hyv3X.cjs');
|
|
4
4
|
let node_path = require("node:path");
|
|
5
5
|
node_path = require_ListScaffoldingMethodsTool.__toESM(node_path);
|
|
6
6
|
let __agiflowai_aicode_utils = require("@agiflowai/aicode-utils");
|
|
@@ -12,7 +12,7 @@ let __agiflowai_coding_agent_bridge = require("@agiflowai/coding-agent-bridge");
|
|
|
12
12
|
let __agiflowai_hooks_adapter = require("@agiflowai/hooks-adapter");
|
|
13
13
|
|
|
14
14
|
//#region package.json
|
|
15
|
-
var version = "1.0.
|
|
15
|
+
var version = "1.0.20";
|
|
16
16
|
|
|
17
17
|
//#endregion
|
|
18
18
|
//#region src/commands/boilerplate.ts
|
|
@@ -279,7 +279,7 @@ var GenerateFeatureScaffoldPrompt = class GenerateFeatureScaffoldPrompt {
|
|
|
279
279
|
|
|
280
280
|
//#endregion
|
|
281
281
|
//#region src/instructions/prompts/scaffold-application.md?raw
|
|
282
|
-
var scaffold_application_default = "{% if promptAsSkill %}---\nname: scaffold-application\ndescription: Create a new application or project from a boilerplate template. Use this skill when the user wants to start a new project, create a new app, or bootstrap a new codebase from scratch. This skill lists available boilerplate templates (React, Next.js, Express, etc.), gathers required configuration variables, generates the complete project structure, and provides guidance on next steps including adding features.\n---\n\n{% endif %}You are helping create a new {% if isMonolith %}monolith application{% else %}application{% endif %} using the scaffold-mcp MCP tools.\n\n{% if request %}User request: {{ request }}\n{% endif %}\nYour task is to scaffold a new application by following this workflow:\n\n## Step 1: {% if isMonolith %}Prepare to Create Application{% else %}List Available Boilerplates{% endif %}\n{% if isMonolith %}You will use the `use-boilerplate` tool to create your monolith application. The boilerplate name will be auto-detected from your toolkit.yaml file.{% else %}Use the `list-boilerplates` tool to see all available project templates.\n\n**What to look for:**\n- Boilerplate name (e.g., \"scaffold-nextjs-app\", \"scaffold-vite-app\")\n- Description of what the boilerplate creates\n- Target folder where projects will be created (e.g., \"apps\", \"packages\")\n- Required and optional variables in the variables_schema{% endif %}\n\n## Step 2: Gather Required Information\nBased on the {% if isMonolith %}toolkit.yaml{% else %}selected boilerplate's variables_schema{% endif %}, collect:\n{% if not isMonolith %}- **Project name**: Must be kebab-case (e.g., \"my-new-app\", not \"MyNewApp\")\n{% endif %}- **Required variables**: All variables marked as required: true\n- **Optional variables**: Variables with required: false (ask user if needed)\n\nCommon variables:\n- `appName` or `packageName`: The project name (kebab-case)\n- `description`: Brief description of what the project does\n- `author`: Author name\n\n## Step 3: Execute the Boilerplate\nUse the `use-boilerplate` tool with:\n{% if not isMonolith %}- `boilerplateName`: Exact name from list-boilerplates response\n{% endif %}- `variables`: Object matching the variables_schema exactly\n\n**Example:**\n```json\n{\n{% if not isMonolith %} \"boilerplateName\": \"scaffold-nextjs-app\",\n{% endif %} \"variables\": {\n \"appName\": \"my-dashboard\",\n \"description\": \"Admin dashboard for managing users\",\n \"author\": \"John Doe\"\n }\n}\n```\n\n## Important Guidelines:\n{% if not isMonolith %}- **Always call `list-boilerplates` first** to see available options and their schemas{% else %}- The boilerplate name is auto-detected from toolkit.yaml{% endif %}\n- **Use exact variable names** from the schema (case-sensitive)\n- **Provide all required variables** - the tool will fail if any are missing\n{% if not isMonolith %}- **Use kebab-case for project names** (e.g., \"user-dashboard\", not \"UserDashboard\")\n- The tool will create the project in the appropriate directory automatically{% else %}- The tool will create files at the workspace root{% endif %}\n- After creation, inform the user {% if isMonolith %}what files were created{% else %}where the project was created{% endif %}\n\n## Step 4: Review and Add Features (If Needed)\nAfter the boilerplate is created, **consider if additional features are needed**:\n1. **READ** the generated {% if isMonolith %}application{% else %}project{% endif %} structure to understand what was created\n2. **REVIEW** the user's request to see if they asked for specific features (e.g., \"with tool for X\", \"with prompt for Y\")\n3. **If features are needed**:\n - Use `list-scaffolding-methods`{% if not isMonolith %} with the new project path{% endif %}\n - Use `use-scaffold-method` to add tools, services, prompts, etc.\n - **IMPLEMENT** the actual logic in the scaffolded feature files\n - **REGISTER** the features in `src/server/index.ts`\n4. **Install dependencies**: Remind user to run `pnpm install`\n5. **Report** the complete setup including any features added\n\n## Example Workflow:\n{% if not isMonolith %}1. Call `list-boilerplates` → See available templates\n2. Ask user which template to use (or infer from request)\n3. Collect required variables based on schema\n4. Call `use-boilerplate` with boilerplateName and variables{% else %}1. Collect required variables based on toolkit.yaml variables_schema\n2. Call `use-boilerplate` with variables (boilerplateName auto-detected){% endif %}\n5. **Review if user requested specific features (tools, prompts, etc.)**\n6. **If features needed**: Add them using `list-scaffolding-methods` and `use-scaffold-method`\n7. **READ and IMPLEMENT** the scaffolded feature files with actual logic\n8. Report success and next steps to the user\n";
|
|
282
|
+
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 variables_schema\n2. Call `use-boilerplate` with variables (boilerplateName auto-detected){% endif %}\n5. **Review if user requested specific features (tools, prompts, etc.)**\n6. **If features needed**: Add them using `list-scaffolding-methods` and `use-scaffold-method`\n7. **READ and IMPLEMENT** the scaffolded feature files with actual logic\n8. **REMOVE `// @scaffold-generated`** from each file once implemented\n9. Report success and next steps to the user\n";
|
|
283
283
|
|
|
284
284
|
//#endregion
|
|
285
285
|
//#region src/prompts/ScaffoldApplicationPrompt.ts
|
|
@@ -339,7 +339,7 @@ var ScaffoldApplicationPrompt = class ScaffoldApplicationPrompt {
|
|
|
339
339
|
|
|
340
340
|
//#endregion
|
|
341
341
|
//#region src/instructions/prompts/scaffold-feature.md?raw
|
|
342
|
-
var scaffold_feature_default = "{% if promptAsSkill %}---\nname: scaffold-feature\ndescription: Add a new feature to an existing project such as service, route, page, component, or API endpoint. Use this skill when the user wants to add functionality to an existing codebase using predefined scaffolding templates. This skill lists available scaffolding methods for the project's template type, gathers required variables, generates boilerplate files, and guides implementation of the actual business logic.\n---\n\n{% endif %}You are helping add a new feature to an existing project using the scaffold-mcp MCP tools.\n\n{% if request %}User request: {{ request }}\n{% endif %}{% if projectPath %}Project path: {{ projectPath }}\n{% endif %}\nYour task is to scaffold a new feature by following this workflow:\n\n## Step 1: Identify the Project\nDetermine the project path where the feature will be added:\n- If projectPath is provided, use it\n- Otherwise, ask the user or infer from context (e.g., \"apps/my-app\", \"packages/my-lib\")\n{% if isMonolith %}- In monolith mode, you can use the current working directory (no projectPath needed){% else %}- The path should point to a directory containing a `project.json` file{% endif %}\n\n## Step 2: List Available Scaffolding Methods\nUse the `list-scaffolding-methods` tool{% if not isMonolith %} with the projectPath{% endif %}.\n\n**What to look for:**\n- Feature name (e.g., \"scaffold-nextjs-page\", \"scaffold-react-component\")\n- Description of what files/code it generates\n- Required and optional variables in the variables_schema\n- The template type (derived from project's sourceTemplate)\n\n**Example:**\n```json\n{% if isMonolith %}{}{% else %}{\n \"projectPath\": \"apps/my-dashboard\"\n}{% endif %}\n```\n\n## Step 3: Gather Required Information\nBased on the selected scaffolding method's variables_schema, collect:\n- **Feature-specific variables**: Name, path, type, etc.\n- **Required variables**: All variables marked as required: true\n- **Optional variables**: Variables with required: false (ask user if needed)\n\nCommon variables:\n- `componentName` / `pageName` / `serviceName`: Name in PascalCase\n- `componentPath` / `pagePath`: Where to place the file (may use kebab-case)\n- Boolean flags: `withTests`, `withLayout`, `withStyles`, etc.\n\n## Step 4: Execute the Scaffolding Method\nUse the `use-scaffold-method` tool with:\n{% if not isMonolith %}- `projectPath`: Same path from step 1\n{% endif %}- `scaffold_feature_name`: Exact name from list-scaffolding-methods response\n- `variables`: Object matching the variables_schema exactly\n\n**Example:**\n```json\n{\n{% if not isMonolith %} \"projectPath\": \"apps/my-dashboard\",\n{% endif %} \"scaffold_feature_name\": \"scaffold-nextjs-page\",\n \"variables\": {\n \"pageName\": \"UserProfile\",\n \"pagePath\": \"user/profile\",\n \"withLayout\": true,\n \"withTests\": false\n }\n}\n```\n\n## Important Guidelines:\n- **Always call `list-scaffolding-methods` first**{% if not isMonolith %} with the projectPath{% endif %}\n- **Use exact variable names** from the schema (case-sensitive)\n- **Provide all required variables** - the tool will fail if any are missing\n- **Follow naming conventions**:\n - Component/Page/Service names: PascalCase (e.g., \"UserProfile\")\n - File paths: kebab-case or as specified in schema (e.g., \"user/profile\")\n- **Conditional files**: Files with `?condition=true` are only included when the variable is true\n- The tool will create files in the appropriate locations automatically\n- After creation, inform the user what files were created\n\n## Step 5: Review and Implement Generated Files\nAfter scaffolding completes, **you MUST**:\n1. **READ** all generated files to understand their structure\n2. **IMPLEMENT** the actual business logic:\n - Replace TODO comments with real code\n - Replace template placeholders with actual implementation\n - Add the specific functionality described in the user's request\n3. **REGISTER** the feature in appropriate files:\n - Import and register tools in `src/server/index.ts`\n - Export new modules from `index.ts` files\n - Update any necessary configuration files\
|
|
342
|
+
var scaffold_feature_default = "{% if promptAsSkill %}---\nname: scaffold-feature\ndescription: Add a new feature to an existing project such as service, route, page, component, or API endpoint. Use this skill when the user wants to add functionality to an existing codebase using predefined scaffolding templates. This skill lists available scaffolding methods for the project's template type, gathers required variables, generates boilerplate files, and guides implementation of the actual business logic.\n---\n\n{% endif %}You are helping add a new feature to an existing project using the scaffold-mcp MCP tools.\n\n{% if request %}User request: {{ request }}\n{% endif %}{% if projectPath %}Project path: {{ projectPath }}\n{% endif %}\nYour task is to scaffold a new feature by following this workflow:\n\n## Step 1: Identify the Project\nDetermine the project path where the feature will be added:\n- If projectPath is provided, use it\n- Otherwise, ask the user or infer from context (e.g., \"apps/my-app\", \"packages/my-lib\")\n{% if isMonolith %}- In monolith mode, you can use the current working directory (no projectPath needed){% else %}- The path should point to a directory containing a `project.json` file{% endif %}\n\n## Step 2: List Available Scaffolding Methods\nUse the `list-scaffolding-methods` tool{% if not isMonolith %} with the projectPath{% endif %}.\n\n**What to look for:**\n- Feature name (e.g., \"scaffold-nextjs-page\", \"scaffold-react-component\")\n- Description of what files/code it generates\n- Required and optional variables in the variables_schema\n- The template type (derived from project's sourceTemplate)\n\n**Example:**\n```json\n{% if isMonolith %}{}{% else %}{\n \"projectPath\": \"apps/my-dashboard\"\n}{% endif %}\n```\n\n## Step 3: Gather Required Information\nBased on the selected scaffolding method's variables_schema, collect:\n- **Feature-specific variables**: Name, path, type, etc.\n- **Required variables**: All variables marked as required: true\n- **Optional variables**: Variables with required: false (ask user if needed)\n\nCommon variables:\n- `componentName` / `pageName` / `serviceName`: Name in PascalCase\n- `componentPath` / `pagePath`: Where to place the file (may use kebab-case)\n- Boolean flags: `withTests`, `withLayout`, `withStyles`, etc.\n\n## Step 4: Execute the Scaffolding Method\nUse the `use-scaffold-method` tool with:\n{% if not isMonolith %}- `projectPath`: Same path from step 1\n{% endif %}- `scaffold_feature_name`: Exact name from list-scaffolding-methods response\n- `variables`: Object matching the variables_schema exactly\n\n**Example:**\n```json\n{\n{% if not isMonolith %} \"projectPath\": \"apps/my-dashboard\",\n{% endif %} \"scaffold_feature_name\": \"scaffold-nextjs-page\",\n \"variables\": {\n \"pageName\": \"UserProfile\",\n \"pagePath\": \"user/profile\",\n \"withLayout\": true,\n \"withTests\": false\n }\n}\n```\n\n## Important Guidelines:\n- **Always call `list-scaffolding-methods` first**{% if not isMonolith %} with the projectPath{% endif %}\n- **Use exact variable names** from the schema (case-sensitive)\n- **Provide all required variables** - the tool will fail if any are missing\n- **Follow naming conventions**:\n - Component/Page/Service names: PascalCase (e.g., \"UserProfile\")\n - File paths: kebab-case or as specified in schema (e.g., \"user/profile\")\n- **Conditional files**: Files with `?condition=true` are only included when the variable is true\n- The tool will create files in the appropriate locations automatically\n- After creation, inform the user what files were created\n\n## Step 5: Review and Implement Generated Files\nAfter scaffolding completes, **you MUST**:\n1. **READ** all generated files to understand their structure\n2. **IMPLEMENT** the actual business logic:\n - Replace TODO comments with real code\n - Replace template placeholders with actual implementation\n - Add the specific functionality described in the user's request\n3. **REMOVE the `// @scaffold-generated` marker** from each file after you finish implementing it:\n - Generated `.ts`/`.tsx`/`.js`/`.jsx` files will have `// @scaffold-generated` at the top\n - This marker flags files that still contain unimplemented boilerplate\n - **Delete this comment line** once a file is fully implemented\n - Leaving the marker in place signals that the file is a \"phantom\" — unimplemented boilerplate\n4. **REGISTER** the feature in appropriate files:\n - Import and register tools in `src/server/index.ts`\n - Export new modules from `index.ts` files\n - Update any necessary configuration files\n5. **TEST** to ensure the implementation works correctly\n6. **DO NOT SKIP** this step - scaffolded files are templates that need actual code\n\n## Example Workflow:\n1. Identify project path (provided or ask user){% if not isMonolith %}\n2. Call `list-scaffolding-methods` → See available features for this project{% else %}\n2. Call `list-scaffolding-methods` → See available features for your template{% endif %}\n3. Ask user which feature to add (or infer from request)\n4. Collect required variables based on schema\n5. Call `use-scaffold-method` with {% if not isMonolith %}projectPath, {% endif %}scaffold_feature_name, and variables\n6. **READ the generated files and IMPLEMENT the actual logic**\n7. **REMOVE `// @scaffold-generated` from each file once implemented**\n8. **REGISTER the feature in server/index.ts and other config files**\n9. Report success and list created files with implementation details\n";
|
|
343
343
|
|
|
344
344
|
//#endregion
|
|
345
345
|
//#region src/prompts/ScaffoldFeaturePrompt.ts
|
|
@@ -403,6 +403,71 @@ var ScaffoldFeaturePrompt = class ScaffoldFeaturePrompt {
|
|
|
403
403
|
}
|
|
404
404
|
};
|
|
405
405
|
|
|
406
|
+
//#endregion
|
|
407
|
+
//#region src/instructions/prompts/sync-template-patterns.md?raw
|
|
408
|
+
var sync_template_patterns_default = "{% if promptAsSkill %}---\nname: sync-template-patterns\ndescription: Update scaffold template files when design patterns have changed and there are discrepancies between templates and current coding standards. Use this skill when architect.yaml or RULES.yaml have been updated and existing .liquid template files need to be brought in line with the new patterns.\n---\n\n{% endif %}You are helping synchronize scaffold template files with the latest design patterns using architect-mcp and scaffold-mcp tools.\n\n{% if request %}User request: {{ request }}\n{% endif %}{% if templateName %}Template to sync: {{ templateName }}\n{% endif %}{% if filePath %}Focus on file type: {{ filePath }}\n{% endif %}\nYour task is to detect discrepancies between current design patterns and scaffold template files, then update the templates to match.\n\n## Step 1: Gather Context\n\nDetermine scope:\n- If `templateName` is provided, scope the work to that template\n- If `filePath` is provided, focus on templates that generate files matching that path pattern\n- Otherwise, ask the user which template or file type to update\n\n{% if not isMonolith %}Use `list-boilerplates` and `list-scaffolding-methods` to discover available templates and their file includes.{% else %}Use `list-scaffolding-methods` to discover available features and their file includes.{% endif %}\n\n## Step 2: Get Current Design Patterns\n\nFor each file type the template generates, use `get-file-design-pattern` from architect-mcp:\n\n```\nget-file-design-pattern({ file_path: \"<path matching the template's target file>\" })\n```\n\n**What to capture from the response:**\n- `must_do` rules — patterns that MUST appear in generated code\n- `must_not_do` rules — anti-patterns to eliminate from templates\n- `should_do` rules — best practices to incorporate\n- Code examples showing the expected structure\n- Naming conventions and architectural decisions\n\n**Important**: Use the TARGET file path (what the template generates), not the `.liquid` template file path.\nFor example, if a template generates `src/tools/MyTool.ts`, call `get-file-design-pattern` with `src/tools/ExistingTool.ts`.\n\n## Step 3: Read Existing Template Files\n\nFor each `.liquid` template file that corresponds to the file types you checked:\n- Read the current template content\n- Note what patterns, imports, class structures, and boilerplate it contains\n- Identify the Liquid variables in use (e.g., `{{ toolName }}`, `{{ serviceName }}`)\n\nTemplate files live in the templates directory under the template name folder with `.liquid` extension\n(e.g., `templates/nextjs-15/src/tools/Tool.ts.liquid`).\n\n## Step 4: Identify Discrepancies\n\nCompare template content against the design patterns. Look for:\n\n**Critical discrepancies (must fix):**\n- Missing required imports or base classes (`must_do` violations)\n- Presence of forbidden patterns (`must_not_do` violations)\n- Wrong class/function structure that contradicts current patterns\n- Outdated error handling, typing, or interface patterns\n\n**Important discrepancies (should fix):**\n- Missing `should_do` best practices\n- Outdated code examples in template headers\n- Stale design pattern documentation in the file header comment\n\n**Document each discrepancy before making changes:**\n- Which template file is affected\n- What the current template does\n- What the design pattern requires\n- What change is needed\n\n## Step 5: Update Template Files\n\nFor each discrepancy, use `generate-boilerplate-file` to update the template:\n\n```json\n{\n {% if not isMonolith %}\"templateName\": \"<the template name>\",{% endif %}\n \"filePath\": \"<relative path without .liquid extension>\",\n \"content\": \"<updated template content with Liquid variables preserved>\",\n \"header\": \"<updated design pattern summary reflecting the new patterns>\"\n}\n```\n\n**Critical rules when updating templates:**\n- **Preserve all Liquid variables** — `{{ variableName }}`, `{% if condition %}`, filter chains like `{{ name | pascalCase }}` must remain intact\n- **Keep templates minimal and business-agnostic** — structural/boilerplate code only, not specific logic\n- **Update the header comment** to reflect the new design patterns, coding standards, and things to avoid\n- **Do NOT hardcode business logic** — use placeholder examples only\n- **Do NOT overwrite variables with literals** — `{{ toolName }}` must never become a hardcoded string\n\n## Step 6: Update scaffold.yaml Instruction (If Needed)\n\nIf the design pattern changes affect the architectural guidance documented in the boilerplate/feature `instruction` field:\n\n1. Retrieve the current instruction via `list-boilerplates` or `list-scaffolding-methods`\n2. Update the entry using `generate-boilerplate` or `generate-feature-scaffold` with the revised `instruction`\n\n## Step 7: Verify\n\nAfter updating:\n1. Confirm all `must_do` patterns are present in the updated template\n2. Confirm all `must_not_do` patterns are removed\n3. Confirm Liquid syntax is valid (variables and tags intact)\n4. Optionally run `use-scaffold-method` or `use-boilerplate` to generate a sample and review output\n\n## Important Guidelines\n\n- **One file at a time** — work through discrepancies file by file\n- **Explain each change** — tell the user what was outdated and what you updated, and why\n- **Preserve variable placeholders** — never replace `{{ toolName }}` with a literal string\n- **Be conservative** — only change what the design patterns explicitly require\n- **Report skipped files** — if a template file has no discrepancies, say so explicitly\n\n## Example Workflow\n\n{% if not isMonolith %}1. Call `list-scaffolding-methods` with `{ \"templateName\": \"nextjs-15\" }` to see features and their includes\n{% else %}1. Call `list-scaffolding-methods` to see available features and their includes\n{% endif %}2. For each feature's included files, call `get-file-design-pattern` with a matching real file path\n3. Read the corresponding `.liquid` template files\n4. Document all discrepancies found\n5. Call `generate-boilerplate-file` for each file that needs updating\n6. Report a summary: which files were updated, what changed, and why\n";
|
|
409
|
+
|
|
410
|
+
//#endregion
|
|
411
|
+
//#region src/prompts/SyncTemplatePatterns.ts
|
|
412
|
+
const syncTemplatePatternsPromptOptionsSchema = zod.z.object({
|
|
413
|
+
isMonolith: zod.z.boolean().default(false).describe("Whether the project is a monolith"),
|
|
414
|
+
promptAsSkill: zod.z.boolean().default(false).describe("Render prompt with skill front matter")
|
|
415
|
+
});
|
|
416
|
+
var SyncTemplatePatternsPrompt = class SyncTemplatePatternsPrompt {
|
|
417
|
+
static PROMPT_NAME = "sync-template-patterns";
|
|
418
|
+
templateService = new require_ListScaffoldingMethodsTool.TemplateService();
|
|
419
|
+
options;
|
|
420
|
+
constructor(options = {}) {
|
|
421
|
+
try {
|
|
422
|
+
this.options = syncTemplatePatternsPromptOptionsSchema.parse(options);
|
|
423
|
+
} catch (error) {
|
|
424
|
+
throw new Error(`Invalid SyncTemplatePatternsPrompt options: ${error instanceof Error ? error.message : String(error)}`);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
getDefinition() {
|
|
428
|
+
return {
|
|
429
|
+
name: SyncTemplatePatternsPrompt.PROMPT_NAME,
|
|
430
|
+
description: "Detect discrepancies between scaffold template files and updated design patterns, then update the templates to match",
|
|
431
|
+
arguments: [
|
|
432
|
+
{
|
|
433
|
+
name: "request",
|
|
434
|
+
description: "Describe what changed or what to sync (optional)",
|
|
435
|
+
required: false
|
|
436
|
+
},
|
|
437
|
+
{
|
|
438
|
+
name: "templateName",
|
|
439
|
+
description: "Specific template to scope the sync to (e.g. \"nextjs-15\")",
|
|
440
|
+
required: false
|
|
441
|
+
},
|
|
442
|
+
{
|
|
443
|
+
name: "filePath",
|
|
444
|
+
description: "File type to focus on (e.g. \"src/tools/MyTool.ts\")",
|
|
445
|
+
required: false
|
|
446
|
+
}
|
|
447
|
+
]
|
|
448
|
+
};
|
|
449
|
+
}
|
|
450
|
+
async execute(args) {
|
|
451
|
+
try {
|
|
452
|
+
return { messages: [{
|
|
453
|
+
role: "user",
|
|
454
|
+
content: {
|
|
455
|
+
type: "text",
|
|
456
|
+
text: this.templateService.renderString(sync_template_patterns_default, {
|
|
457
|
+
request: args.request ?? "",
|
|
458
|
+
templateName: args.templateName ?? "",
|
|
459
|
+
filePath: args.filePath ?? "",
|
|
460
|
+
isMonolith: this.options.isMonolith,
|
|
461
|
+
promptAsSkill: this.options.promptAsSkill
|
|
462
|
+
})
|
|
463
|
+
}
|
|
464
|
+
}] };
|
|
465
|
+
} catch (error) {
|
|
466
|
+
throw new Error(`Failed to execute SyncTemplatePatternsPrompt: ${error instanceof Error ? error.message : String(error)}`);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
};
|
|
470
|
+
|
|
406
471
|
//#endregion
|
|
407
472
|
//#region src/server/index.ts
|
|
408
473
|
function createServer(options = {}) {
|
|
@@ -425,6 +490,10 @@ function createServer(options = {}) {
|
|
|
425
490
|
isMonolith,
|
|
426
491
|
promptAsSkill
|
|
427
492
|
}) : null;
|
|
493
|
+
const syncTemplatePatternsPrompt = adminEnabled ? new SyncTemplatePatternsPrompt({
|
|
494
|
+
isMonolith,
|
|
495
|
+
promptAsSkill
|
|
496
|
+
}) : null;
|
|
428
497
|
const scaffoldApplicationPrompt = new ScaffoldApplicationPrompt({
|
|
429
498
|
isMonolith,
|
|
430
499
|
promptAsSkill
|
|
@@ -498,6 +567,7 @@ function createServer(options = {}) {
|
|
|
498
567
|
if (adminEnabled) {
|
|
499
568
|
if (generateBoilerplatePrompt) prompts.push(generateBoilerplatePrompt.getDefinition());
|
|
500
569
|
if (generateFeatureScaffoldPrompt) prompts.push(generateFeatureScaffoldPrompt.getDefinition());
|
|
570
|
+
if (syncTemplatePatternsPrompt) prompts.push(syncTemplatePatternsPrompt.getDefinition());
|
|
501
571
|
}
|
|
502
572
|
return { prompts };
|
|
503
573
|
});
|
|
@@ -513,6 +583,10 @@ function createServer(options = {}) {
|
|
|
513
583
|
if (!generateFeatureScaffoldPrompt) throw new Error("Prompt not available");
|
|
514
584
|
return { messages: generateFeatureScaffoldPrompt.getMessages(args) };
|
|
515
585
|
}
|
|
586
|
+
if (name === SyncTemplatePatternsPrompt.PROMPT_NAME) {
|
|
587
|
+
if (!syncTemplatePatternsPrompt) throw new Error("Prompt not available");
|
|
588
|
+
return await syncTemplatePatternsPrompt.execute(args);
|
|
589
|
+
}
|
|
516
590
|
throw new Error(`Unknown prompt: ${name}`);
|
|
517
591
|
});
|
|
518
592
|
return server;
|
|
@@ -712,11 +786,15 @@ scaffoldCommand.command("add <featureName>").description("Add a feature to an ex
|
|
|
712
786
|
__agiflowai_aicode_utils.messages.success("✅ Feature added successfully!");
|
|
713
787
|
if (result.createdFiles && result.createdFiles.length > 0) {
|
|
714
788
|
__agiflowai_aicode_utils.print.header("\n📁 Created files:");
|
|
715
|
-
result.createdFiles.forEach((file) =>
|
|
789
|
+
result.createdFiles.forEach((file) => {
|
|
790
|
+
__agiflowai_aicode_utils.print.debug(` - ${file}`);
|
|
791
|
+
});
|
|
716
792
|
}
|
|
717
793
|
if (result.warnings && result.warnings.length > 0) {
|
|
718
794
|
__agiflowai_aicode_utils.messages.warning("\n⚠️ Warnings:");
|
|
719
|
-
result.warnings.forEach((warning) =>
|
|
795
|
+
result.warnings.forEach((warning) => {
|
|
796
|
+
__agiflowai_aicode_utils.print.debug(` - ${warning}`);
|
|
797
|
+
});
|
|
720
798
|
}
|
|
721
799
|
__agiflowai_aicode_utils.print.header("\n📋 Next steps:");
|
|
722
800
|
__agiflowai_aicode_utils.print.debug(" - Review the generated files");
|
|
@@ -815,7 +893,7 @@ scaffoldCommand.command("info <featureName>").description("Show detailed informa
|
|
|
815
893
|
/**
|
|
816
894
|
* Hook command for executing scaffold hooks
|
|
817
895
|
*/
|
|
818
|
-
const hookCommand = new commander.Command("hook").description("Execute scaffold hooks for AI agent integrations").option("--type <agentAndMethod>", "Hook type: <agent>.<method> (e.g., claude-code.postToolUse, gemini-cli.afterTool)").action(async (options) => {
|
|
896
|
+
const hookCommand = new commander.Command("hook").description("Execute scaffold hooks for AI agent integrations").option("--type <agentAndMethod>", "Hook type: <agent>.<method> (e.g., claude-code.postToolUse, gemini-cli.afterTool)").option("--marker <tag>", "Scaffold marker tag to scan for in phantom code check (default: @scaffold-generated)").action(async (options) => {
|
|
819
897
|
try {
|
|
820
898
|
if (!options.type) {
|
|
821
899
|
__agiflowai_aicode_utils.print.error("--type option is required");
|
|
@@ -828,20 +906,24 @@ const hookCommand = new commander.Command("hook").description("Execute scaffold
|
|
|
828
906
|
}
|
|
829
907
|
const { agent, hookMethod } = (0, __agiflowai_hooks_adapter.parseHookType)(options.type);
|
|
830
908
|
if (agent === __agiflowai_coding_agent_bridge.CLAUDE_CODE) {
|
|
831
|
-
const useScaffoldMethodModule = await Promise.resolve().then(() => require("./useScaffoldMethod-
|
|
909
|
+
const useScaffoldMethodModule = await Promise.resolve().then(() => require("./useScaffoldMethod-BR3ESqor.cjs"));
|
|
910
|
+
const phantomCodeCheckModule = await Promise.resolve().then(() => require("./phantomCodeCheck-DNkWyMRE.cjs"));
|
|
832
911
|
const claudeCallbacks = [];
|
|
833
912
|
if (useScaffoldMethodModule.UseScaffoldMethodHook) {
|
|
834
913
|
const hookInstance = new useScaffoldMethodModule.UseScaffoldMethodHook();
|
|
835
914
|
const hookFn = hookInstance[hookMethod];
|
|
836
915
|
if (hookFn) claudeCallbacks.push(hookFn.bind(hookInstance));
|
|
837
916
|
}
|
|
838
|
-
if (
|
|
839
|
-
|
|
840
|
-
|
|
917
|
+
if (phantomCodeCheckModule.PhantomCodeCheckHook) {
|
|
918
|
+
const markerValue = options.marker ?? "@scaffold-generated";
|
|
919
|
+
const hookInstance = new phantomCodeCheckModule.PhantomCodeCheckHook(markerValue);
|
|
920
|
+
const hookFn = hookInstance[hookMethod];
|
|
921
|
+
if (hookFn) claudeCallbacks.push(hookFn.bind(hookInstance));
|
|
841
922
|
}
|
|
923
|
+
if (claudeCallbacks.length === 0) process.exit(0);
|
|
842
924
|
await new __agiflowai_hooks_adapter.ClaudeCodeAdapter().executeMultiple(claudeCallbacks);
|
|
843
925
|
} else if (agent === __agiflowai_coding_agent_bridge.GEMINI_CLI) {
|
|
844
|
-
const useScaffoldMethodModule = await Promise.resolve().then(() => require("./useScaffoldMethod-
|
|
926
|
+
const useScaffoldMethodModule = await Promise.resolve().then(() => require("./useScaffoldMethod-CJG7ngkT.cjs"));
|
|
845
927
|
const geminiCallbacks = [];
|
|
846
928
|
if (useScaffoldMethodModule.UseScaffoldMethodHook) {
|
|
847
929
|
const hookInstance = new useScaffoldMethodModule.UseScaffoldMethodHook();
|