Skip to content

Commit c61215b

Browse files
authored
refactor(tools): replace hardcoded 'umi' with dynamic framework name (#6)
1 parent 1f2127e commit c61215b

File tree

9 files changed

+16
-16
lines changed

9 files changed

+16
-16
lines changed

src/tools/umi-build.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export const umiBuild = async ({
3333
});
3434

3535
server.addTool({
36-
name: 'umi-build',
36+
name: `${frameworkName}-build`,
3737
description: `Build the ${frameworkName} project.`,
3838
parameters: BuildParams,
3939
execute: async (params) => {

src/tools/umi-config.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const umiConfig = async ({
99
frameworkName,
1010
}: ToolContext) => {
1111
server.addTool({
12-
name: 'umi-config-list',
12+
name: `${frameworkName}-config-list`,
1313
description: `List all available ${frameworkName} config`,
1414
parameters: z.object({}),
1515
execute: async () => {
@@ -20,7 +20,7 @@ export const umiConfig = async ({
2020
});
2121

2222
server.addTool({
23-
name: 'umi-config-get',
23+
name: `${frameworkName}-config-get`,
2424
description: `Get the value of a config of the ${frameworkName} project`,
2525
parameters: z.object({
2626
key: z.string(),
@@ -33,7 +33,7 @@ export const umiConfig = async ({
3333
});
3434

3535
server.addTool({
36-
name: 'umi-config-set',
36+
name: `${frameworkName}-config-set`,
3737
description: `Set the value of a config of the ${frameworkName} project`,
3838
parameters: z.object({
3939
key: z.string(),
@@ -49,7 +49,7 @@ export const umiConfig = async ({
4949
});
5050

5151
server.addTool({
52-
name: 'umi-config-remove',
52+
name: `${frameworkName}-config-remove`,
5353
description: `Remove a config of the ${frameworkName} project`,
5454
parameters: z.object({
5555
key: z.string(),

src/tools/umi-deadcode.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const umiDeadcode = async ({
99
frameworkName,
1010
}: ToolContext) => {
1111
server.addTool({
12-
name: 'umi-deadcode',
12+
name: `${frameworkName}-deadcode`,
1313
description: `Find the dead code of the ${frameworkName} project`,
1414
parameters: z.object({}),
1515
execute: async () => {

src/tools/umi-generate.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export const umiGenerate = async ({
4141

4242
// 页面生成器
4343
server.addTool({
44-
name: 'umi-generate-page',
44+
name: `${frameworkName}-generate-page`,
4545
description: `Generate a page for the ${frameworkName} project`,
4646
parameters: z.object({
4747
name: z.string().describe('Page name to generate'),
@@ -63,7 +63,7 @@ export const umiGenerate = async ({
6363

6464
// 组件生成器
6565
server.addTool({
66-
name: 'umi-generate-component',
66+
name: `${frameworkName}-generate-component`,
6767
description: `Generate a component for the ${frameworkName} project`,
6868
parameters: z.object({
6969
name: z.string().describe('Component name to generate'),
@@ -80,7 +80,7 @@ export const umiGenerate = async ({
8080

8181
// RouteAPI 生成器
8282
server.addTool({
83-
name: 'umi-generate-api',
83+
name: `${frameworkName}-generate-api`,
8484
description: `Generate a route API for the ${frameworkName} project`,
8585
parameters: z.object({
8686
name: z.string().describe('API route name to generate'),
@@ -96,7 +96,7 @@ export const umiGenerate = async ({
9696

9797
// Mock 生成器
9898
server.addTool({
99-
name: 'umi-generate-mock',
99+
name: `${frameworkName}-generate-mock`,
100100
description: `Generate a mock file for the ${frameworkName} project`,
101101
parameters: z.object({
102102
name: z.string().describe('Mock file name to generate'),
@@ -112,7 +112,7 @@ export const umiGenerate = async ({
112112

113113
// Prettier 生成器、Jest 生成器、TailwindCSS 生成器、Dva 生成器、Precommit 生成器
114114
server.addTool({
115-
name: 'umi-generate-others',
115+
name: `${frameworkName}-generate-others`,
116116
description: `Generate more tools for the ${frameworkName} project`,
117117
parameters: z.object({
118118
type: z

src/tools/umi-help.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { ToolContext } from '../types';
55

66
export const umiHelp = async ({ server, root, frameworkName }: ToolContext) => {
77
server.addTool({
8-
name: 'umi-help',
8+
name: `${frameworkName}-help`,
99
description: `Get help description for ${frameworkName}`,
1010
parameters: z.object({}),
1111
execute: async () => {

src/tools/umi-lint.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { ToolContext } from '../types';
55

66
export const umiLint = async ({ server, root, frameworkName }: ToolContext) => {
77
server.addTool({
8-
name: 'umi-lint',
8+
name: `${frameworkName}-lint`,
99
description: `Run the linting of the ${frameworkName} project`,
1010
parameters: z.object({
1111
fix: z.boolean().optional().describe('Fix lint automatically'),

src/tools/umi-plugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const umiPlugin = async ({
99
frameworkName,
1010
}: ToolContext) => {
1111
server.addTool({
12-
name: 'umi-plugin-list',
12+
name: `${frameworkName}-plugin-list`,
1313
description: `List all plugins of the ${frameworkName} project`,
1414
parameters: z.object({}),
1515
execute: async () => {

src/tools/umi-setup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const umiSetup = async ({
99
frameworkName,
1010
}: ToolContext) => {
1111
server.addTool({
12-
name: 'umi-setup',
12+
name: `${frameworkName}-setup`,
1313
description: `Setup the ${frameworkName} project and generate tmp files in the .umi directory`,
1414
parameters: z.object({}),
1515
execute: async () => {

src/tools/umi-version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const umiVersion = async ({
99
frameworkName,
1010
}: ToolContext) => {
1111
server.addTool({
12-
name: 'umi-version',
12+
name: `${frameworkName}-version`,
1313
description: `Get the version of the ${frameworkName} project.`,
1414
parameters: z.object({}),
1515
execute: async () => {

0 commit comments

Comments
 (0)