infra-kit 0.1.41 → 0.1.44
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/cli.js +13 -13
- package/dist/cli.js.map +4 -4
- package/dist/mcp.js +13 -13
- package/dist/mcp.js.map +4 -4
- package/package.json +2 -1
- package/src/commands/gh-merge-dev/gh-merge-dev.ts +11 -17
- package/src/commands/gh-release-create/gh-release-create.ts +10 -14
- package/src/commands/gh-release-deliver/gh-release-deliver.ts +10 -14
- package/src/commands/gh-release-deploy/gh-release-deploy.ts +13 -17
- package/src/commands/gh-release-list/gh-release-list.ts +8 -12
- package/src/commands/worktrees-add/worktrees-add.ts +11 -15
- package/src/commands/worktrees-list/worktrees-list.ts +22 -26
- package/src/commands/worktrees-remove/worktrees-remove.ts +10 -14
- package/src/commands/worktrees-sync/worktrees-sync.ts +9 -13
- package/src/entry/cli.ts +1 -1
- package/src/entry/mcp.ts +3 -1
- package/src/lib/error-handlers/index.ts +1 -1
- package/src/{shared → lib}/gh-cli-auth/gh-cli-auth.ts +1 -1
- package/src/{shared → lib}/gh-release-prs/gh-release-prs.ts +1 -1
- package/src/lib/logger/index.ts +6 -2
- package/src/{shared → lib}/tool-handler/tool-handler.ts +1 -2
- package/src/mcp/prompts/index.ts +2 -2
- package/src/mcp/resources/index.ts +2 -2
- package/src/mcp/server.ts +2 -8
- package/src/mcp/tools/index.ts +3 -6
- package/src/types.ts +2 -1
- package/src/shared/logger/index.ts +0 -4
- /package/src/{shared → lib}/constants.ts +0 -0
- /package/src/{shared → lib}/gh-cli-auth/index.ts +0 -0
- /package/src/{shared → lib}/gh-release-prs/index.ts +0 -0
- /package/src/{shared → lib}/git-utils/git-utils.ts +0 -0
- /package/src/{shared → lib}/git-utils/index.ts +0 -0
- /package/src/{shared → lib}/tool-handler/index.ts +0 -0
- /package/src/{shared → lib}/version-utils/index.ts +0 -0
- /package/src/{shared → lib}/version-utils/version-utils.ts +0 -0
|
@@ -4,8 +4,8 @@ import process from 'node:process'
|
|
|
4
4
|
import { z } from 'zod'
|
|
5
5
|
import { $ } from 'zx'
|
|
6
6
|
|
|
7
|
-
import { getReleasePRs } from 'src/
|
|
8
|
-
import { logger } from 'src/
|
|
7
|
+
import { getReleasePRs } from 'src/lib/gh-release-prs'
|
|
8
|
+
import { logger } from 'src/lib/logger'
|
|
9
9
|
import type { RequiredConfirmedOptionArg, ToolsExecutionResult } from 'src/types'
|
|
10
10
|
|
|
11
11
|
interface GhMergeDevArgs extends RequiredConfirmedOptionArg {
|
|
@@ -109,8 +109,6 @@ export const ghMergeDev = async (args: GhMergeDevArgs): Promise<ToolsExecutionRe
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
const mergeDev = async (branch: string): Promise<boolean> => {
|
|
112
|
-
logger.info(`Merging dev into ${branch}...`)
|
|
113
|
-
|
|
114
112
|
try {
|
|
115
113
|
await $`git switch ${branch}`
|
|
116
114
|
|
|
@@ -135,21 +133,17 @@ const mergeDev = async (branch: string): Promise<boolean> => {
|
|
|
135
133
|
}
|
|
136
134
|
|
|
137
135
|
// MCP Tool Registration
|
|
138
|
-
const ghMergeDevSchema = z.object({
|
|
139
|
-
all: z.boolean().describe('Merge dev into all release branches without prompting'),
|
|
140
|
-
})
|
|
141
|
-
|
|
142
|
-
const ghMergeDevOutputSchema = z.object({
|
|
143
|
-
successfulMerges: z.number().describe('Number of successful merges'),
|
|
144
|
-
failedMerges: z.number().describe('Number of failed merges'),
|
|
145
|
-
failedBranches: z.array(z.string()).describe('List of branches that failed to merge'),
|
|
146
|
-
totalBranches: z.number().describe('Total number of branches processed'),
|
|
147
|
-
})
|
|
148
|
-
|
|
149
136
|
export const ghMergeDevMcpTool = {
|
|
150
137
|
name: 'gh-merge-dev',
|
|
151
138
|
description: 'Merge dev branch into selected release branches',
|
|
152
|
-
inputSchema:
|
|
153
|
-
|
|
139
|
+
inputSchema: {
|
|
140
|
+
all: z.boolean().describe('Merge dev into all release branches without prompting'),
|
|
141
|
+
},
|
|
142
|
+
outputSchema: {
|
|
143
|
+
successfulMerges: z.number().describe('Number of successful merges'),
|
|
144
|
+
failedMerges: z.number().describe('Number of failed merges'),
|
|
145
|
+
failedBranches: z.array(z.string()).describe('List of branches that failed to merge'),
|
|
146
|
+
totalBranches: z.number().describe('Total number of branches processed'),
|
|
147
|
+
},
|
|
154
148
|
handler: ghMergeDev,
|
|
155
149
|
}
|
|
@@ -3,7 +3,7 @@ import process from 'node:process'
|
|
|
3
3
|
import { z } from 'zod'
|
|
4
4
|
import { $, question } from 'zx'
|
|
5
5
|
|
|
6
|
-
import { logger } from 'src/
|
|
6
|
+
import { logger } from 'src/lib/logger'
|
|
7
7
|
import type { RequiredConfirmedOptionArg, ToolsExecutionResult } from 'src/types'
|
|
8
8
|
|
|
9
9
|
interface GhReleaseCreateArgs extends RequiredConfirmedOptionArg {
|
|
@@ -130,21 +130,17 @@ async function createReleaseBranch(version: string) {
|
|
|
130
130
|
// #endregion Declarations
|
|
131
131
|
|
|
132
132
|
// MCP Tool Registration
|
|
133
|
-
const ghReleaseCreateSchema = z.object({
|
|
134
|
-
versions: z.string().describe('Comma-separated list of versions to create (e.g., "1.2.5, 1.2.6")'),
|
|
135
|
-
checkout: z.boolean().optional().describe('Checkout to the created branch (only works with single version)'),
|
|
136
|
-
})
|
|
137
|
-
|
|
138
|
-
const ghReleaseCreateOutputSchema = z.object({
|
|
139
|
-
createdBranches: z.array(z.string()).describe('List of created release branches'),
|
|
140
|
-
branchCount: z.number().describe('Number of branches created'),
|
|
141
|
-
isCheckedOut: z.boolean().describe('Whether the branch was checked out'),
|
|
142
|
-
})
|
|
143
|
-
|
|
144
133
|
export const ghReleaseCreateMcpTool = {
|
|
145
134
|
name: 'gh-release-create',
|
|
146
135
|
description: 'Create new release branches for specified versions',
|
|
147
|
-
inputSchema:
|
|
148
|
-
|
|
136
|
+
inputSchema: {
|
|
137
|
+
versions: z.string().describe('Comma-separated list of versions to create (e.g., "1.2.5, 1.2.6")'),
|
|
138
|
+
checkout: z.boolean().optional().describe('Checkout to the created branch (only works with single version)'),
|
|
139
|
+
},
|
|
140
|
+
outputSchema: {
|
|
141
|
+
createdBranches: z.array(z.string()).describe('List of created release branches'),
|
|
142
|
+
branchCount: z.number().describe('Number of branches created'),
|
|
143
|
+
isCheckedOut: z.boolean().describe('Whether the branch was checked out'),
|
|
144
|
+
},
|
|
149
145
|
handler: ghReleaseCreate,
|
|
150
146
|
}
|
|
@@ -4,8 +4,8 @@ import process from 'node:process'
|
|
|
4
4
|
import { z } from 'zod'
|
|
5
5
|
import { $ } from 'zx'
|
|
6
6
|
|
|
7
|
-
import { getReleasePRs } from 'src/
|
|
8
|
-
import { logger } from 'src/
|
|
7
|
+
import { getReleasePRs } from 'src/lib/gh-release-prs'
|
|
8
|
+
import { logger } from 'src/lib/logger'
|
|
9
9
|
import type { RequiredConfirmedOptionArg, ToolsExecutionResult } from 'src/types'
|
|
10
10
|
|
|
11
11
|
interface GhReleaseDeliverArgs extends RequiredConfirmedOptionArg {
|
|
@@ -88,20 +88,16 @@ export const ghReleaseDeliver = async (args: GhReleaseDeliverArgs): Promise<Tool
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
// MCP Tool Registration
|
|
91
|
-
const ghReleaseDeliverSchema = z.object({
|
|
92
|
-
version: z.string().describe('Version to deliver to production (e.g., "1.2.5")'),
|
|
93
|
-
})
|
|
94
|
-
|
|
95
|
-
const ghReleaseDeliverOutputSchema = z.object({
|
|
96
|
-
releaseBranch: z.string().describe('The release branch that was delivered'),
|
|
97
|
-
version: z.string().describe('The version that was delivered'),
|
|
98
|
-
success: z.boolean().describe('Whether the delivery was successful'),
|
|
99
|
-
})
|
|
100
|
-
|
|
101
91
|
export const ghReleaseDeliverMcpTool = {
|
|
102
92
|
name: 'gh-release-deliver',
|
|
103
93
|
description: 'Deliver a release branch to production',
|
|
104
|
-
inputSchema:
|
|
105
|
-
|
|
94
|
+
inputSchema: {
|
|
95
|
+
version: z.string().describe('Version to deliver to production (e.g., "1.2.5")'),
|
|
96
|
+
},
|
|
97
|
+
outputSchema: {
|
|
98
|
+
releaseBranch: z.string().describe('The release branch that was delivered'),
|
|
99
|
+
version: z.string().describe('The version that was delivered'),
|
|
100
|
+
success: z.boolean().describe('Whether the delivery was successful'),
|
|
101
|
+
},
|
|
106
102
|
handler: ghReleaseDeliver,
|
|
107
103
|
}
|
|
@@ -3,9 +3,9 @@ import process from 'node:process'
|
|
|
3
3
|
import { z } from 'zod'
|
|
4
4
|
import { $ } from 'zx'
|
|
5
5
|
|
|
6
|
-
import { ENVs } from 'src/
|
|
7
|
-
import { getReleasePRs } from 'src/
|
|
8
|
-
import { logger } from 'src/
|
|
6
|
+
import { ENVs } from 'src/lib/constants'
|
|
7
|
+
import { getReleasePRs } from 'src/lib/gh-release-prs'
|
|
8
|
+
import { logger } from 'src/lib/logger'
|
|
9
9
|
import type { ToolsExecutionResult } from 'src/types'
|
|
10
10
|
|
|
11
11
|
interface GhReleaseDeployArgs {
|
|
@@ -97,22 +97,18 @@ export const ghReleaseDeploy = async (args: GhReleaseDeployArgs): Promise<ToolsE
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
// MCP Tool Registration
|
|
100
|
-
const ghReleaseDeploySchema = z.object({
|
|
101
|
-
version: z.string().describe('Version to deploy (e.g., "1.2.5")'),
|
|
102
|
-
env: z.string().describe('Environment to deploy to (e.g., "dev", "renana", "oriana")'),
|
|
103
|
-
})
|
|
104
|
-
|
|
105
|
-
const ghReleaseDeployOutputSchema = z.object({
|
|
106
|
-
releaseBranch: z.string().describe('The release branch that was deployed'),
|
|
107
|
-
version: z.string().describe('The version that was deployed'),
|
|
108
|
-
environment: z.string().describe('The environment deployed to'),
|
|
109
|
-
success: z.boolean().describe('Whether the deployment was successful'),
|
|
110
|
-
})
|
|
111
|
-
|
|
112
100
|
export const ghReleaseDeployMcpTool = {
|
|
113
101
|
name: 'gh-release-deploy',
|
|
114
102
|
description: 'Deploy a release branch to a specified environment',
|
|
115
|
-
inputSchema:
|
|
116
|
-
|
|
103
|
+
inputSchema: {
|
|
104
|
+
version: z.string().describe('Version to deploy (e.g., "1.2.5")'),
|
|
105
|
+
env: z.string().describe('Environment to deploy to (e.g., "dev", "renana", "oriana")'),
|
|
106
|
+
},
|
|
107
|
+
outputSchema: {
|
|
108
|
+
releaseBranch: z.string().describe('The release branch that was deployed'),
|
|
109
|
+
version: z.string().describe('The version that was deployed'),
|
|
110
|
+
environment: z.string().describe('The environment deployed to'),
|
|
111
|
+
success: z.boolean().describe('Whether the deployment was successful'),
|
|
112
|
+
},
|
|
117
113
|
handler: ghReleaseDeploy,
|
|
118
114
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod'
|
|
2
2
|
|
|
3
|
-
import { getReleasePRs } from 'src/
|
|
4
|
-
import { logger } from 'src/
|
|
5
|
-
import { sortVersions } from 'src/
|
|
3
|
+
import { getReleasePRs } from 'src/lib/gh-release-prs'
|
|
4
|
+
import { logger } from 'src/lib/logger'
|
|
5
|
+
import { sortVersions } from 'src/lib/version-utils'
|
|
6
6
|
import type { ToolsExecutionResult } from 'src/types'
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -34,17 +34,13 @@ export const ghReleaseList = async (): Promise<ToolsExecutionResult> => {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
// MCP Tool Registration
|
|
37
|
-
const ghReleaseListSchema = z.object({})
|
|
38
|
-
|
|
39
|
-
const ghReleaseListOutputSchema = z.object({
|
|
40
|
-
releases: z.array(z.string()).describe('List of all release branches'),
|
|
41
|
-
count: z.number().describe('Number of release branches'),
|
|
42
|
-
})
|
|
43
|
-
|
|
44
37
|
export const ghReleaseListMcpTool = {
|
|
45
38
|
name: 'gh-release-list',
|
|
46
39
|
description: 'List all open release branches',
|
|
47
|
-
inputSchema:
|
|
48
|
-
outputSchema:
|
|
40
|
+
inputSchema: {},
|
|
41
|
+
outputSchema: {
|
|
42
|
+
releases: z.array(z.string()).describe('List of all release branches'),
|
|
43
|
+
count: z.number().describe('Number of release branches'),
|
|
44
|
+
},
|
|
49
45
|
handler: ghReleaseList,
|
|
50
46
|
}
|
|
@@ -4,10 +4,10 @@ import process from 'node:process'
|
|
|
4
4
|
import { z } from 'zod'
|
|
5
5
|
import { $ } from 'zx'
|
|
6
6
|
|
|
7
|
-
import { WORKTREES_DIR_SUFFIX } from 'src/
|
|
8
|
-
import { getReleasePRs } from 'src/
|
|
9
|
-
import { getCurrentWorktrees, getProjectRoot } from 'src/
|
|
10
|
-
import { logger } from 'src/
|
|
7
|
+
import { WORKTREES_DIR_SUFFIX } from 'src/lib/constants'
|
|
8
|
+
import { getReleasePRs } from 'src/lib/gh-release-prs'
|
|
9
|
+
import { getCurrentWorktrees, getProjectRoot } from 'src/lib/git-utils'
|
|
10
|
+
import { logger } from 'src/lib/logger'
|
|
11
11
|
import type { RequiredConfirmedOptionArg, ToolsExecutionResult } from 'src/types'
|
|
12
12
|
|
|
13
13
|
// Constants
|
|
@@ -153,19 +153,15 @@ const logResults = (created: string[]): void => {
|
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
// MCP Tool Registration
|
|
156
|
-
const worktreesAddSchema = z.object({
|
|
157
|
-
all: z.boolean().describe('Add worktrees for all release branches without prompting'),
|
|
158
|
-
})
|
|
159
|
-
|
|
160
|
-
const worktreesAddOutputSchema = z.object({
|
|
161
|
-
createdWorktrees: z.array(z.string()).describe('List of created worktree branches'),
|
|
162
|
-
count: z.number().describe('Number of worktrees created'),
|
|
163
|
-
})
|
|
164
|
-
|
|
165
156
|
export const worktreesAddMcpTool = {
|
|
166
157
|
name: 'worktrees-add',
|
|
167
158
|
description: 'Create worktrees for selected release branches',
|
|
168
|
-
inputSchema:
|
|
169
|
-
|
|
159
|
+
inputSchema: {
|
|
160
|
+
all: z.boolean().describe('Add worktrees for all release branches without prompting'),
|
|
161
|
+
},
|
|
162
|
+
outputSchema: {
|
|
163
|
+
createdWorktrees: z.array(z.string()).describe('List of created worktree branches'),
|
|
164
|
+
count: z.number().describe('Number of worktrees created'),
|
|
165
|
+
},
|
|
170
166
|
handler: worktreesAdd,
|
|
171
167
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod'
|
|
2
2
|
import { $ } from 'zx'
|
|
3
3
|
|
|
4
|
-
import { getCurrentWorktrees, getProjectRoot } from 'src/
|
|
5
|
-
import { logger } from 'src/
|
|
4
|
+
import { getCurrentWorktrees, getProjectRoot } from 'src/lib/git-utils'
|
|
5
|
+
import { logger } from 'src/lib/logger'
|
|
6
6
|
import type { ToolsExecutionResult } from 'src/types'
|
|
7
7
|
|
|
8
8
|
interface WorktreeInfo {
|
|
@@ -281,32 +281,28 @@ const getStatusIndicator = (status: string): string => {
|
|
|
281
281
|
}
|
|
282
282
|
|
|
283
283
|
// MCP Tool Registration
|
|
284
|
-
const worktreesListSchema = z.object({})
|
|
285
|
-
|
|
286
|
-
const worktreesListOutputSchema = z.object({
|
|
287
|
-
worktrees: z
|
|
288
|
-
.array(
|
|
289
|
-
z.object({
|
|
290
|
-
branch: z.string(),
|
|
291
|
-
path: z.string(),
|
|
292
|
-
commit: z.string(),
|
|
293
|
-
isCurrent: z.boolean(),
|
|
294
|
-
type: z.enum(['release', 'feature']),
|
|
295
|
-
status: z.string(),
|
|
296
|
-
lastCommitMessage: z.string(),
|
|
297
|
-
aheadBehind: z.string(),
|
|
298
|
-
}),
|
|
299
|
-
)
|
|
300
|
-
.describe('List of all worktrees with details'),
|
|
301
|
-
totalCount: z.number().describe('Total number of worktrees'),
|
|
302
|
-
releaseCount: z.number().describe('Number of release worktrees'),
|
|
303
|
-
featureCount: z.number().describe('Number of feature worktrees'),
|
|
304
|
-
})
|
|
305
|
-
|
|
306
284
|
export const worktreesListMcpTool = {
|
|
307
285
|
name: 'worktrees-list',
|
|
308
286
|
description: 'List all git worktrees with detailed information',
|
|
309
|
-
inputSchema:
|
|
310
|
-
outputSchema:
|
|
287
|
+
inputSchema: {},
|
|
288
|
+
outputSchema: {
|
|
289
|
+
worktrees: z
|
|
290
|
+
.array(
|
|
291
|
+
z.object({
|
|
292
|
+
branch: z.string(),
|
|
293
|
+
path: z.string(),
|
|
294
|
+
commit: z.string(),
|
|
295
|
+
isCurrent: z.boolean(),
|
|
296
|
+
type: z.enum(['release', 'feature']),
|
|
297
|
+
status: z.string(),
|
|
298
|
+
lastCommitMessage: z.string(),
|
|
299
|
+
aheadBehind: z.string(),
|
|
300
|
+
}),
|
|
301
|
+
)
|
|
302
|
+
.describe('List of all worktrees with details'),
|
|
303
|
+
totalCount: z.number().describe('Total number of worktrees'),
|
|
304
|
+
releaseCount: z.number().describe('Number of release worktrees'),
|
|
305
|
+
featureCount: z.number().describe('Number of feature worktrees'),
|
|
306
|
+
},
|
|
311
307
|
handler: worktreesList,
|
|
312
308
|
}
|
|
@@ -4,9 +4,9 @@ import process from 'node:process'
|
|
|
4
4
|
import { z } from 'zod'
|
|
5
5
|
import { $ } from 'zx'
|
|
6
6
|
|
|
7
|
-
import { WORKTREES_DIR_SUFFIX } from 'src/
|
|
8
|
-
import { getCurrentWorktrees, getProjectRoot } from 'src/
|
|
9
|
-
import { logger } from 'src/
|
|
7
|
+
import { WORKTREES_DIR_SUFFIX } from 'src/lib/constants'
|
|
8
|
+
import { getCurrentWorktrees, getProjectRoot } from 'src/lib/git-utils'
|
|
9
|
+
import { logger } from 'src/lib/logger'
|
|
10
10
|
import type { RequiredConfirmedOptionArg, ToolsExecutionResult } from 'src/types'
|
|
11
11
|
|
|
12
12
|
// Constants
|
|
@@ -111,19 +111,15 @@ const logResults = (removed: string[]): void => {
|
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
// MCP Tool Registration
|
|
114
|
-
const worktreesRemoveSchema = z.object({
|
|
115
|
-
all: z.boolean().describe('Remove all worktrees without prompting'),
|
|
116
|
-
})
|
|
117
|
-
|
|
118
|
-
const worktreesRemoveOutputSchema = z.object({
|
|
119
|
-
removedWorktrees: z.array(z.string()).describe('List of removed worktree branches'),
|
|
120
|
-
count: z.number().describe('Number of worktrees removed'),
|
|
121
|
-
})
|
|
122
|
-
|
|
123
114
|
export const worktreesRemoveMcpTool = {
|
|
124
115
|
name: 'worktrees-remove',
|
|
125
116
|
description: 'Remove selected worktrees',
|
|
126
|
-
inputSchema:
|
|
127
|
-
|
|
117
|
+
inputSchema: {
|
|
118
|
+
all: z.boolean().describe('Remove all worktrees without prompting'),
|
|
119
|
+
},
|
|
120
|
+
outputSchema: {
|
|
121
|
+
removedWorktrees: z.array(z.string()).describe('List of removed worktree branches'),
|
|
122
|
+
count: z.number().describe('Number of worktrees removed'),
|
|
123
|
+
},
|
|
128
124
|
handler: worktreesRemove,
|
|
129
125
|
}
|
|
@@ -3,10 +3,10 @@ import process from 'node:process'
|
|
|
3
3
|
import { z } from 'zod'
|
|
4
4
|
import { $ } from 'zx'
|
|
5
5
|
|
|
6
|
-
import { WORKTREES_DIR_SUFFIX } from 'src/
|
|
7
|
-
import { getReleasePRs } from 'src/
|
|
8
|
-
import { getCurrentWorktrees, getProjectRoot } from 'src/
|
|
9
|
-
import { logger } from 'src/
|
|
6
|
+
import { WORKTREES_DIR_SUFFIX } from 'src/lib/constants'
|
|
7
|
+
import { getReleasePRs } from 'src/lib/gh-release-prs'
|
|
8
|
+
import { getCurrentWorktrees, getProjectRoot } from 'src/lib/git-utils'
|
|
9
|
+
import { logger } from 'src/lib/logger'
|
|
10
10
|
import type { RequiredConfirmedOptionArg, ToolsExecutionResult } from 'src/types'
|
|
11
11
|
|
|
12
12
|
// Constants
|
|
@@ -121,17 +121,13 @@ const logResults = (removed: string[]): void => {
|
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
// MCP Tool Registration
|
|
124
|
-
const worktreesSyncSchema = z.object({})
|
|
125
|
-
|
|
126
|
-
const worktreesSyncOutputSchema = z.object({
|
|
127
|
-
removedWorktrees: z.array(z.string()).describe('List of removed worktree branches'),
|
|
128
|
-
count: z.number().describe('Number of worktrees removed during sync'),
|
|
129
|
-
})
|
|
130
|
-
|
|
131
124
|
export const worktreesSyncMcpTool = {
|
|
132
125
|
name: 'worktrees-sync',
|
|
133
126
|
description: 'Synchronize worktrees with active release branches',
|
|
134
|
-
inputSchema:
|
|
135
|
-
outputSchema:
|
|
127
|
+
inputSchema: {},
|
|
128
|
+
outputSchema: {
|
|
129
|
+
removedWorktrees: z.array(z.string()).describe('List of removed worktree branches'),
|
|
130
|
+
count: z.number().describe('Number of worktrees removed during sync'),
|
|
131
|
+
},
|
|
136
132
|
handler: worktreesSync,
|
|
137
133
|
}
|
package/src/entry/cli.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { worktreesAdd } from 'src/commands/worktrees-add'
|
|
|
9
9
|
import { worktreesList } from 'src/commands/worktrees-list'
|
|
10
10
|
import { worktreesRemove } from 'src/commands/worktrees-remove'
|
|
11
11
|
import { worktreesSync } from 'src/commands/worktrees-sync'
|
|
12
|
-
import { validateGitHubCliAndAuth } from 'src/
|
|
12
|
+
import { validateGitHubCliAndAuth } from 'src/lib/gh-cli-auth'
|
|
13
13
|
|
|
14
14
|
const program = new Command()
|
|
15
15
|
|
package/src/entry/mcp.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio'
|
|
1
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
|
|
2
2
|
import process from 'node:process'
|
|
3
3
|
|
|
4
4
|
import { setupErrorHandlers } from 'src/lib/error-handlers'
|
|
@@ -12,6 +12,8 @@ const startServer = async () => {
|
|
|
12
12
|
let server
|
|
13
13
|
try {
|
|
14
14
|
server = await createMcpServer()
|
|
15
|
+
|
|
16
|
+
logger.info('MCP Server instance created')
|
|
15
17
|
} catch (error) {
|
|
16
18
|
logger.error({ err: error, msg: 'Failed to create MCP server' })
|
|
17
19
|
logger.error(`Fatal error during server creation.`)
|
package/src/lib/logger/index.ts
CHANGED
|
@@ -2,12 +2,13 @@ import process from 'node:process'
|
|
|
2
2
|
import pino from 'pino'
|
|
3
3
|
import pretty from 'pino-pretty'
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// eslint-disable-next-line sonarjs/publicly-writable-directories
|
|
6
|
+
export const LOG_FILE_PATH = '/tmp/mcp-infra-kit.log'
|
|
6
7
|
|
|
7
8
|
export const initLoggerMcp = () => {
|
|
8
9
|
const logLevel = process.argv.includes('--debug') ? 'debug' : 'info'
|
|
9
10
|
|
|
10
|
-
const logger = pino({ level: logLevel })
|
|
11
|
+
const logger = pino({ level: logLevel }, pino.destination({ dest: LOG_FILE_PATH }))
|
|
11
12
|
|
|
12
13
|
logger.info(`Logger initialized with level: ${logLevel}. Logging to: ${LOG_FILE_PATH}`)
|
|
13
14
|
|
|
@@ -33,3 +34,6 @@ export const initLoggerCLI = () => {
|
|
|
33
34
|
|
|
34
35
|
return logger
|
|
35
36
|
}
|
|
37
|
+
|
|
38
|
+
// Singleton logger instance for CLI usage
|
|
39
|
+
export const logger = initLoggerCLI()
|
package/src/mcp/prompts/index.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
|
|
2
2
|
|
|
3
|
-
export const initializePrompts = async (_server:
|
|
3
|
+
export const initializePrompts = async (_server: McpServer) => {}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
|
|
2
2
|
|
|
3
|
-
export const initializeResources = async (_server:
|
|
3
|
+
export const initializeResources = async (_server: McpServer) => {}
|
package/src/mcp/server.ts
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { initLoggerMcp } from 'src/lib/logger'
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
|
|
4
2
|
|
|
5
3
|
import { initializePrompts } from './prompts'
|
|
6
4
|
import { initializeResources } from './resources'
|
|
7
5
|
import { initializeTools } from './tools'
|
|
8
6
|
|
|
9
|
-
const logger = initLoggerMcp()
|
|
10
|
-
|
|
11
7
|
export async function createMcpServer() {
|
|
12
|
-
const server = new
|
|
8
|
+
const server = new McpServer(
|
|
13
9
|
{
|
|
14
10
|
name: 'infra-kit',
|
|
15
11
|
description: 'Infra Kit is a tool that helps you manage your infrastructure.',
|
|
@@ -28,7 +24,5 @@ export async function createMcpServer() {
|
|
|
28
24
|
await initializeResources(server)
|
|
29
25
|
await initializeTools(server)
|
|
30
26
|
|
|
31
|
-
logger.info('MCP Server instance created')
|
|
32
|
-
|
|
33
27
|
return server
|
|
34
28
|
}
|
package/src/mcp/tools/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
|
|
2
2
|
|
|
3
3
|
import { ghMergeDevMcpTool } from 'src/commands/gh-merge-dev'
|
|
4
4
|
import { ghReleaseCreateMcpTool } from 'src/commands/gh-release-create'
|
|
@@ -9,7 +9,7 @@ import { worktreesAddMcpTool } from 'src/commands/worktrees-add'
|
|
|
9
9
|
import { worktreesListMcpTool } from 'src/commands/worktrees-list'
|
|
10
10
|
import { worktreesRemoveMcpTool } from 'src/commands/worktrees-remove'
|
|
11
11
|
import { worktreesSyncMcpTool } from 'src/commands/worktrees-sync'
|
|
12
|
-
import { createToolHandler } from 'src/
|
|
12
|
+
import { createToolHandler } from 'src/lib/tool-handler'
|
|
13
13
|
|
|
14
14
|
const tools = [
|
|
15
15
|
ghMergeDevMcpTool,
|
|
@@ -23,17 +23,14 @@ const tools = [
|
|
|
23
23
|
worktreesSyncMcpTool,
|
|
24
24
|
]
|
|
25
25
|
|
|
26
|
-
export const initializeTools = async (server:
|
|
26
|
+
export const initializeTools = async (server: McpServer) => {
|
|
27
27
|
for (const tool of tools) {
|
|
28
|
-
// eslint-disable-next-line ts/ban-ts-comment
|
|
29
|
-
// @ts-expect-error
|
|
30
28
|
server.registerTool(
|
|
31
29
|
tool.name,
|
|
32
30
|
{
|
|
33
31
|
description: tool.description,
|
|
34
32
|
inputSchema: tool.inputSchema,
|
|
35
33
|
outputSchema: tool.outputSchema,
|
|
36
|
-
handler: tool.handler,
|
|
37
34
|
},
|
|
38
35
|
createToolHandler({ toolName: tool.name, handler: tool.handler }),
|
|
39
36
|
)
|
package/src/types.ts
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|