@agiflowai/scaffold-mcp 1.0.5 → 1.0.7
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 +40 -0
- package/dist/ListScaffoldingMethodsTool-BLTCwsd1.mjs +350 -0
- package/dist/ListScaffoldingMethodsTool-BuxKRbwi.cjs +376 -0
- package/dist/{ScaffoldConfigLoader-B-NLy6VP.cjs → ScaffoldConfigLoader-BB4_YUFL.cjs} +1 -1
- package/dist/{ScaffoldConfigLoader-SHk-KEje.mjs → ScaffoldConfigLoader-DKJtnrWT.mjs} +1 -1
- package/dist/ScaffoldService-BCjJE9yK.mjs +3 -0
- package/dist/ScaffoldService-Bhzxp5-C.cjs +3 -0
- package/dist/TemplateService-B1bd6iHw.mjs +3 -0
- package/dist/TemplateService-BrJGDvQt.cjs +3 -0
- package/dist/VariableReplacementService-BO-UYgcf.mjs +3 -0
- package/dist/{VariableReplacementService-DKaF2C9l.cjs → VariableReplacementService-CNimgwaq.cjs} +1 -1
- package/dist/cli.cjs +89 -11
- package/dist/cli.mjs +84 -6
- package/dist/index.cjs +9 -8
- package/dist/index.d.cts +7 -0
- package/dist/index.d.mts +7 -0
- package/dist/index.mjs +6 -5
- package/dist/{stdio-BGj_FLky.cjs → stdio-BcTSxlVH.cjs} +47 -367
- package/dist/{stdio-wAlpLC6l.mjs → stdio-DovjJsGY.mjs} +42 -347
- package/dist/useScaffoldMethod-Btc_9iCj.cjs +237 -0
- package/dist/useScaffoldMethod-C1hQdBVD.cjs +267 -0
- package/dist/useScaffoldMethod-CHJAsgA2.mjs +236 -0
- package/dist/useScaffoldMethod-CsBTssSw.mjs +263 -0
- package/package.json +6 -2
- package/dist/ScaffoldService-BNOyoqSb.cjs +0 -3
- package/dist/ScaffoldService-BNdfC21Z.mjs +0 -3
- package/dist/TemplateService-BRfzfaZs.mjs +0 -3
- package/dist/TemplateService-DqieT1Tq.cjs +0 -3
- package/dist/VariableReplacementService-BWCd-z7X.mjs +0 -3
- /package/dist/{ScaffoldConfigLoader-BDMJNI1o.mjs → ScaffoldConfigLoader-8YI7v2GJ.mjs} +0 -0
- /package/dist/{ScaffoldConfigLoader-Y_SBLPg7.cjs → ScaffoldConfigLoader-CQlXVksz.cjs} +0 -0
- /package/dist/{ScaffoldService-ChzxM0Yc.cjs → ScaffoldService-BPyiY_0B.cjs} +0 -0
- /package/dist/{ScaffoldService-BNuN00Fm.mjs → ScaffoldService-CgYunbKN.mjs} +0 -0
- /package/dist/{TemplateService-D3ydJR_R.cjs → TemplateService-CAD8jkoO.cjs} +0 -0
- /package/dist/{TemplateService-Cg5QV29n.mjs → TemplateService-CVDL2uqt.mjs} +0 -0
- /package/dist/{VariableReplacementService-DHIINRnJ.mjs → VariableReplacementService-B9RA8D0a.mjs} +0 -0
- /package/dist/{VariableReplacementService-CAjesAYq.cjs → VariableReplacementService-DDG5KZpb.cjs} +0 -0
package/dist/cli.mjs
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as UseScaffoldMethodTool, c as
|
|
3
|
-
import "./
|
|
4
|
-
import "./
|
|
5
|
-
import
|
|
6
|
-
import "./
|
|
2
|
+
import { a as UseScaffoldMethodTool, c as GenerateFeatureScaffoldTool, f as BoilerplateService, i as WriteToFileTool, l as GenerateBoilerplateTool, n as SseTransportHandler, o as UseBoilerplateTool, r as HttpTransportHandler, s as ListBoilerplatesTool, t as StdioTransportHandler, u as GenerateBoilerplateFileTool } from "./stdio-DovjJsGY.mjs";
|
|
3
|
+
import { n as ScaffoldingMethodsService, r as FileSystemService, t as ListScaffoldingMethodsTool } from "./ListScaffoldingMethodsTool-BLTCwsd1.mjs";
|
|
4
|
+
import "./ScaffoldConfigLoader-8YI7v2GJ.mjs";
|
|
5
|
+
import "./ScaffoldService-CgYunbKN.mjs";
|
|
6
|
+
import { t as TemplateService } from "./TemplateService-CVDL2uqt.mjs";
|
|
7
|
+
import "./VariableReplacementService-B9RA8D0a.mjs";
|
|
7
8
|
import path from "node:path";
|
|
8
9
|
import { ProjectConfigResolver, TemplatesManagerService, icons, messages, print, sections } from "@agiflowai/aicode-utils";
|
|
9
10
|
import { CallToolRequestSchema, GetPromptRequestSchema, ListPromptsRequestSchema, ListToolsRequestSchema } from "@modelcontextprotocol/sdk/types.js";
|
|
10
11
|
import { Command } from "commander";
|
|
11
12
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
13
|
+
import { CLAUDE_CODE, GEMINI_CLI } from "@agiflowai/coding-agent-bridge";
|
|
14
|
+
import { ClaudeCodeAdapter, GeminiCliAdapter, parseHookType } from "@agiflowai/hooks-adapter";
|
|
12
15
|
|
|
13
16
|
//#region package.json
|
|
14
|
-
var version = "1.0.
|
|
17
|
+
var version = "1.0.6";
|
|
15
18
|
|
|
16
19
|
//#endregion
|
|
17
20
|
//#region src/commands/boilerplate.ts
|
|
@@ -695,6 +698,80 @@ scaffoldCommand.command("info <featureName>").description("Show detailed informa
|
|
|
695
698
|
}
|
|
696
699
|
});
|
|
697
700
|
|
|
701
|
+
//#endregion
|
|
702
|
+
//#region src/commands/hook.ts
|
|
703
|
+
/**
|
|
704
|
+
* Hook Command
|
|
705
|
+
*
|
|
706
|
+
* DESIGN PATTERNS:
|
|
707
|
+
* - Command pattern with Commander for CLI argument parsing
|
|
708
|
+
* - Async/await pattern for asynchronous operations
|
|
709
|
+
* - Error handling pattern with try-catch and proper exit codes
|
|
710
|
+
*
|
|
711
|
+
* CODING STANDARDS:
|
|
712
|
+
* - Use async action handlers for asynchronous operations
|
|
713
|
+
* - Provide clear option descriptions and default values
|
|
714
|
+
* - Handle errors gracefully with process.exit()
|
|
715
|
+
* - Log progress and errors to console
|
|
716
|
+
* - Use Commander's .option() for inputs
|
|
717
|
+
*
|
|
718
|
+
* AVOID:
|
|
719
|
+
* - Synchronous blocking operations in action handlers
|
|
720
|
+
* - Missing error handling (always use try-catch)
|
|
721
|
+
* - Hardcoded values (use options or environment variables)
|
|
722
|
+
* - Not exiting with appropriate exit codes on errors
|
|
723
|
+
*/
|
|
724
|
+
/**
|
|
725
|
+
* Hook command for executing scaffold hooks
|
|
726
|
+
*/
|
|
727
|
+
const hookCommand = new 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) => {
|
|
728
|
+
try {
|
|
729
|
+
if (!options.type) {
|
|
730
|
+
print.error("--type option is required");
|
|
731
|
+
print.info("Examples:");
|
|
732
|
+
print.info(" scaffold hook --type claude-code.preToolUse");
|
|
733
|
+
print.info(" scaffold hook --type claude-code.postToolUse");
|
|
734
|
+
print.info(" scaffold hook --type gemini-cli.beforeTool");
|
|
735
|
+
print.info(" scaffold hook --type gemini-cli.afterTool");
|
|
736
|
+
process.exit(1);
|
|
737
|
+
}
|
|
738
|
+
const { agent, hookMethod } = parseHookType(options.type);
|
|
739
|
+
if (agent === CLAUDE_CODE) {
|
|
740
|
+
const useScaffoldMethodModule = await import("./useScaffoldMethod-CsBTssSw.mjs");
|
|
741
|
+
const claudeCallbacks = [];
|
|
742
|
+
if (useScaffoldMethodModule.UseScaffoldMethodHook) {
|
|
743
|
+
const hookInstance = new useScaffoldMethodModule.UseScaffoldMethodHook();
|
|
744
|
+
const hookFn = hookInstance[hookMethod];
|
|
745
|
+
if (hookFn) claudeCallbacks.push(hookFn.bind(hookInstance));
|
|
746
|
+
}
|
|
747
|
+
if (claudeCallbacks.length === 0) {
|
|
748
|
+
print.error(`Hook not found: ${hookMethod} in Claude Code hooks`);
|
|
749
|
+
process.exit(1);
|
|
750
|
+
}
|
|
751
|
+
await new ClaudeCodeAdapter().executeMultiple(claudeCallbacks);
|
|
752
|
+
} else if (agent === GEMINI_CLI) {
|
|
753
|
+
const useScaffoldMethodModule = await import("./useScaffoldMethod-CHJAsgA2.mjs");
|
|
754
|
+
const geminiCallbacks = [];
|
|
755
|
+
if (useScaffoldMethodModule.UseScaffoldMethodHook) {
|
|
756
|
+
const hookInstance = new useScaffoldMethodModule.UseScaffoldMethodHook();
|
|
757
|
+
const hookFn = hookInstance[hookMethod];
|
|
758
|
+
if (hookFn) geminiCallbacks.push(hookFn.bind(hookInstance));
|
|
759
|
+
}
|
|
760
|
+
if (geminiCallbacks.length === 0) {
|
|
761
|
+
print.error(`Hook not found: ${hookMethod} in Gemini CLI hooks`);
|
|
762
|
+
process.exit(1);
|
|
763
|
+
}
|
|
764
|
+
await new GeminiCliAdapter().executeMultiple(geminiCallbacks);
|
|
765
|
+
} else {
|
|
766
|
+
print.error(`Unsupported agent: ${agent}. Supported: ${CLAUDE_CODE}, ${GEMINI_CLI}`);
|
|
767
|
+
process.exit(1);
|
|
768
|
+
}
|
|
769
|
+
} catch (error) {
|
|
770
|
+
print.error(`Hook error: ${error.message}`);
|
|
771
|
+
process.exit(1);
|
|
772
|
+
}
|
|
773
|
+
});
|
|
774
|
+
|
|
698
775
|
//#endregion
|
|
699
776
|
//#region src/cli.ts
|
|
700
777
|
/**
|
|
@@ -706,6 +783,7 @@ async function main() {
|
|
|
706
783
|
program.addCommand(mcpServeCommand);
|
|
707
784
|
program.addCommand(boilerplateCommand);
|
|
708
785
|
program.addCommand(scaffoldCommand);
|
|
786
|
+
program.addCommand(hookCommand);
|
|
709
787
|
await program.parseAsync(process.argv);
|
|
710
788
|
}
|
|
711
789
|
main();
|
package/dist/index.cjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
|
-
const require_stdio = require('./stdio-
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
2
|
+
const require_stdio = require('./stdio-BcTSxlVH.cjs');
|
|
3
|
+
const require_ListScaffoldingMethodsTool = require('./ListScaffoldingMethodsTool-BuxKRbwi.cjs');
|
|
4
|
+
const require_ScaffoldConfigLoader = require('./ScaffoldConfigLoader-CQlXVksz.cjs');
|
|
5
|
+
const require_ScaffoldService = require('./ScaffoldService-BPyiY_0B.cjs');
|
|
6
|
+
const require_TemplateService = require('./TemplateService-CAD8jkoO.cjs');
|
|
7
|
+
const require_VariableReplacementService = require('./VariableReplacementService-DDG5KZpb.cjs');
|
|
7
8
|
let node_path = require("node:path");
|
|
8
9
|
node_path = require_chunk.__toESM(node_path);
|
|
9
10
|
let __agiflowai_aicode_utils = require("@agiflowai/aicode-utils");
|
|
@@ -136,18 +137,18 @@ async function fetchGitHubDirectoryContents(owner, repo, path$1, branch = "main"
|
|
|
136
137
|
//#endregion
|
|
137
138
|
exports.BoilerplateGeneratorService = require_stdio.BoilerplateGeneratorService;
|
|
138
139
|
exports.BoilerplateService = require_stdio.BoilerplateService;
|
|
139
|
-
exports.FileSystemService =
|
|
140
|
+
exports.FileSystemService = require_ListScaffoldingMethodsTool.FileSystemService;
|
|
140
141
|
exports.GenerateBoilerplateFileTool = require_stdio.GenerateBoilerplateFileTool;
|
|
141
142
|
exports.GenerateBoilerplateTool = require_stdio.GenerateBoilerplateTool;
|
|
142
143
|
exports.GenerateFeatureScaffoldTool = require_stdio.GenerateFeatureScaffoldTool;
|
|
143
144
|
exports.HttpTransportHandler = require_stdio.HttpTransportHandler;
|
|
144
145
|
exports.ListBoilerplatesTool = require_stdio.ListBoilerplatesTool;
|
|
145
|
-
exports.ListScaffoldingMethodsTool =
|
|
146
|
+
exports.ListScaffoldingMethodsTool = require_ListScaffoldingMethodsTool.ListScaffoldingMethodsTool;
|
|
146
147
|
exports.ScaffoldConfigLoader = require_ScaffoldConfigLoader.ScaffoldConfigLoader;
|
|
147
148
|
exports.ScaffoldGeneratorService = require_stdio.ScaffoldGeneratorService;
|
|
148
149
|
exports.ScaffoldProcessingService = require_ScaffoldService.ScaffoldProcessingService;
|
|
149
150
|
exports.ScaffoldService = require_ScaffoldService.ScaffoldService;
|
|
150
|
-
exports.ScaffoldingMethodsService =
|
|
151
|
+
exports.ScaffoldingMethodsService = require_ListScaffoldingMethodsTool.ScaffoldingMethodsService;
|
|
151
152
|
exports.SseTransportHandler = require_stdio.SseTransportHandler;
|
|
152
153
|
exports.StdioTransportHandler = require_stdio.StdioTransportHandler;
|
|
153
154
|
exports.TemplateService = require_TemplateService.TemplateService;
|
package/dist/index.d.cts
CHANGED
|
@@ -372,6 +372,8 @@ interface UseScaffoldMethodRequest {
|
|
|
372
372
|
projectPath: string;
|
|
373
373
|
scaffold_feature_name: string;
|
|
374
374
|
variables: Record<string, any>;
|
|
375
|
+
/** Optional session ID for logging scaffold execution */
|
|
376
|
+
sessionId?: string;
|
|
375
377
|
}
|
|
376
378
|
declare class ScaffoldingMethodsService {
|
|
377
379
|
private fileSystem;
|
|
@@ -646,10 +648,15 @@ declare class UseBoilerplateTool {
|
|
|
646
648
|
//#region src/tools/UseScaffoldMethodTool.d.ts
|
|
647
649
|
declare class UseScaffoldMethodTool {
|
|
648
650
|
static readonly TOOL_NAME = "use-scaffold-method";
|
|
651
|
+
private static readonly TEMP_LOG_DIR;
|
|
649
652
|
private fileSystemService;
|
|
650
653
|
private scaffoldingMethodsService;
|
|
651
654
|
private isMonolith;
|
|
652
655
|
constructor(templatesPath: string, isMonolith?: boolean);
|
|
656
|
+
/**
|
|
657
|
+
* Write scaffold execution info to temp log file for hook processing
|
|
658
|
+
*/
|
|
659
|
+
private writePendingScaffoldLog;
|
|
653
660
|
/**
|
|
654
661
|
* Get the tool definition for MCP
|
|
655
662
|
*/
|
package/dist/index.d.mts
CHANGED
|
@@ -373,6 +373,8 @@ interface UseScaffoldMethodRequest {
|
|
|
373
373
|
projectPath: string;
|
|
374
374
|
scaffold_feature_name: string;
|
|
375
375
|
variables: Record<string, any>;
|
|
376
|
+
/** Optional session ID for logging scaffold execution */
|
|
377
|
+
sessionId?: string;
|
|
376
378
|
}
|
|
377
379
|
declare class ScaffoldingMethodsService {
|
|
378
380
|
private fileSystem;
|
|
@@ -647,10 +649,15 @@ declare class UseBoilerplateTool {
|
|
|
647
649
|
//#region src/tools/UseScaffoldMethodTool.d.ts
|
|
648
650
|
declare class UseScaffoldMethodTool {
|
|
649
651
|
static readonly TOOL_NAME = "use-scaffold-method";
|
|
652
|
+
private static readonly TEMP_LOG_DIR;
|
|
650
653
|
private fileSystemService;
|
|
651
654
|
private scaffoldingMethodsService;
|
|
652
655
|
private isMonolith;
|
|
653
656
|
constructor(templatesPath: string, isMonolith?: boolean);
|
|
657
|
+
/**
|
|
658
|
+
* Write scaffold execution info to temp log file for hook processing
|
|
659
|
+
*/
|
|
660
|
+
private writePendingScaffoldLog;
|
|
654
661
|
/**
|
|
655
662
|
* Get the tool definition for MCP
|
|
656
663
|
*/
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { a as UseScaffoldMethodTool, c as
|
|
2
|
-
import { t as
|
|
3
|
-
import {
|
|
4
|
-
import { t as
|
|
5
|
-
import { t as
|
|
1
|
+
import { a as UseScaffoldMethodTool, c as GenerateFeatureScaffoldTool, d as ScaffoldGeneratorService, f as BoilerplateService, i as WriteToFileTool, l as GenerateBoilerplateTool, n as SseTransportHandler, o as UseBoilerplateTool, p as BoilerplateGeneratorService, r as HttpTransportHandler, s as ListBoilerplatesTool, t as StdioTransportHandler, u as GenerateBoilerplateFileTool } from "./stdio-DovjJsGY.mjs";
|
|
2
|
+
import { n as ScaffoldingMethodsService, r as FileSystemService, t as ListScaffoldingMethodsTool } from "./ListScaffoldingMethodsTool-BLTCwsd1.mjs";
|
|
3
|
+
import { t as ScaffoldConfigLoader } from "./ScaffoldConfigLoader-8YI7v2GJ.mjs";
|
|
4
|
+
import { n as ScaffoldProcessingService, t as ScaffoldService } from "./ScaffoldService-CgYunbKN.mjs";
|
|
5
|
+
import { t as TemplateService } from "./TemplateService-CVDL2uqt.mjs";
|
|
6
|
+
import { t as VariableReplacementService } from "./VariableReplacementService-B9RA8D0a.mjs";
|
|
6
7
|
import path from "node:path";
|
|
7
8
|
import { move, pathExists, remove, writeFile } from "@agiflowai/aicode-utils";
|
|
8
9
|
import { execa } from "execa";
|