infra-kit 0.1.90 → 0.1.93
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/.eslintcache +1 -1
- package/.turbo/turbo-eslint-check.log +5 -4
- package/.turbo/turbo-prettier-check.log +5 -4
- package/.turbo/turbo-test.log +18 -14
- package/.turbo/turbo-ts-check.log +5 -4
- package/dist/cli.js +26 -23
- package/dist/cli.js.map +4 -4
- package/dist/mcp.js +23 -20
- package/dist/mcp.js.map +4 -4
- package/package.json +1 -1
- package/src/commands/version/index.ts +1 -0
- package/src/commands/version/version.ts +38 -0
- package/src/entry/cli.ts +9 -1
- package/src/integrations/cmux/open-workspace-with-layout.ts +30 -2
- package/src/integrations/gh/gh-release-prs/gh-release-prs.ts +5 -2
- package/src/lib/infra-kit-config.ts +7 -1
- package/src/lib/release-utils/release-utils.ts +1 -1
- package/src/mcp/tools/index.ts +2 -0
- package/tsconfig.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { version, versionMcpTool } from './version'
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
|
|
3
|
+
import { logger } from 'src/lib/logger'
|
|
4
|
+
import type { ToolsExecutionResult } from 'src/types'
|
|
5
|
+
|
|
6
|
+
import packageJson from '../../../package.json' with { type: 'json' }
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Print the infra-kit CLI version
|
|
10
|
+
*/
|
|
11
|
+
export const version = async (): Promise<ToolsExecutionResult> => {
|
|
12
|
+
const cliVersion = packageJson.version
|
|
13
|
+
|
|
14
|
+
logger.info(cliVersion)
|
|
15
|
+
|
|
16
|
+
const structuredContent = { version: cliVersion }
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
content: [
|
|
20
|
+
{
|
|
21
|
+
type: 'text',
|
|
22
|
+
text: JSON.stringify(structuredContent, null, 2),
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
structuredContent,
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// MCP Tool Registration
|
|
30
|
+
export const versionMcpTool = {
|
|
31
|
+
name: 'version',
|
|
32
|
+
description: 'Print the installed infra-kit CLI version',
|
|
33
|
+
inputSchema: {},
|
|
34
|
+
outputSchema: {
|
|
35
|
+
version: z.string().describe('Installed infra-kit CLI version (from package.json)'),
|
|
36
|
+
},
|
|
37
|
+
handler: version,
|
|
38
|
+
}
|
package/src/entry/cli.ts
CHANGED
|
@@ -15,6 +15,7 @@ import { ghReleaseList } from 'src/commands/gh-release-list'
|
|
|
15
15
|
import { init } from 'src/commands/init'
|
|
16
16
|
import { releaseCreate } from 'src/commands/release-create'
|
|
17
17
|
import { releaseCreateBatch } from 'src/commands/release-create-batch'
|
|
18
|
+
import { version } from 'src/commands/version'
|
|
18
19
|
import { worktreesAdd } from 'src/commands/worktrees-add'
|
|
19
20
|
import { worktreesList } from 'src/commands/worktrees-list'
|
|
20
21
|
import { worktreesRemove } from 'src/commands/worktrees-remove'
|
|
@@ -176,6 +177,13 @@ program
|
|
|
176
177
|
await doctor()
|
|
177
178
|
})
|
|
178
179
|
|
|
180
|
+
program
|
|
181
|
+
.command('version')
|
|
182
|
+
.description('Print the installed infra-kit CLI version')
|
|
183
|
+
.action(async () => {
|
|
184
|
+
await version()
|
|
185
|
+
})
|
|
186
|
+
|
|
179
187
|
program
|
|
180
188
|
.command('env-status')
|
|
181
189
|
.description('Show Doppler authentication status and detected project info')
|
|
@@ -223,7 +231,7 @@ if (process.argv.length <= 2) {
|
|
|
223
231
|
'release-deliver',
|
|
224
232
|
]
|
|
225
233
|
const worktreeCommands = ['worktrees-add', 'worktrees-list', 'worktrees-remove', 'worktrees-sync']
|
|
226
|
-
const envCommands = ['doctor', 'init', 'env-status', 'env-list', 'env-load', 'env-clear']
|
|
234
|
+
const envCommands = ['doctor', 'init', 'version', 'env-status', 'env-list', 'env-load', 'env-clear']
|
|
227
235
|
|
|
228
236
|
const commandMap = new Map(
|
|
229
237
|
program.commands.map((cmd) => {
|
|
@@ -14,9 +14,9 @@ interface OpenCmuxWorkspaceArgs {
|
|
|
14
14
|
export const openCmuxWorkspaceWithLayout = async (args: OpenCmuxWorkspaceArgs): Promise<void> => {
|
|
15
15
|
const { cwd, title } = args
|
|
16
16
|
|
|
17
|
-
await $`cmux new-workspace --cwd ${cwd}`
|
|
17
|
+
const newWorkspaceOutput = (await $`cmux new-workspace --cwd ${cwd}`).stdout
|
|
18
18
|
|
|
19
|
-
const workspaceRef = (
|
|
19
|
+
const workspaceRef = parseWorkspaceRef(newWorkspaceOutput)
|
|
20
20
|
|
|
21
21
|
const surfacesOutput = (await $`cmux list-pane-surfaces --workspace ${workspaceRef}`).stdout
|
|
22
22
|
|
|
@@ -30,6 +30,15 @@ export const openCmuxWorkspaceWithLayout = async (args: OpenCmuxWorkspaceArgs):
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
/**
|
|
34
|
+
* Extracts the first `surface:<id>` reference from the output of
|
|
35
|
+
* `cmux list-pane-surfaces`. Used to locate the initial (primary) pane
|
|
36
|
+
* surface so subsequent splits can be anchored relative to it.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* const output = 'surface:12 (active)\nsurface:13\n'
|
|
40
|
+
* parseFirstSurfaceRef(output) // => 'surface:12'
|
|
41
|
+
*/
|
|
33
42
|
const parseFirstSurfaceRef = (output: string): string => {
|
|
34
43
|
const match = output.match(/surface:\d+/)
|
|
35
44
|
|
|
@@ -39,3 +48,22 @@ const parseFirstSurfaceRef = (output: string): string => {
|
|
|
39
48
|
|
|
40
49
|
return match[0]
|
|
41
50
|
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Extracts the `workspace:<id>` reference from the output of
|
|
54
|
+
* `cmux new-workspace`. The returned ref is used to target the newly
|
|
55
|
+
* created workspace in follow-up `cmux` commands (splits, rename, etc.).
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* const output = 'created workspace:7\n'
|
|
59
|
+
* parseWorkspaceRef(output) // => 'workspace:7'
|
|
60
|
+
*/
|
|
61
|
+
const parseWorkspaceRef = (output: string): string => {
|
|
62
|
+
const match = output.match(/workspace:\d+/)
|
|
63
|
+
|
|
64
|
+
if (!match) {
|
|
65
|
+
throw new Error('cmux: could not locate workspace ref in new-workspace output')
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return match[0]
|
|
69
|
+
}
|
|
@@ -113,18 +113,21 @@ interface CreateReleaseBranchArgs {
|
|
|
113
113
|
version: string
|
|
114
114
|
jiraVersionUrl: string
|
|
115
115
|
type: ReleaseType
|
|
116
|
+
description?: string
|
|
116
117
|
}
|
|
117
118
|
|
|
118
119
|
// Function to create a release branch
|
|
119
120
|
export const createReleaseBranch = async (
|
|
120
121
|
args: CreateReleaseBranchArgs,
|
|
121
122
|
): Promise<{ branchName: string; prUrl: string }> => {
|
|
122
|
-
const { version, jiraVersionUrl, type } = args
|
|
123
|
+
const { version, jiraVersionUrl, type, description } = args
|
|
123
124
|
const titlePrefix = type === 'hotfix' ? 'Hotfix' : 'Release'
|
|
124
125
|
const baseBranch = getBaseBranch(type)
|
|
125
126
|
|
|
126
127
|
const branchName = `release/v${version}`
|
|
127
128
|
|
|
129
|
+
const body = description && description.trim() !== '' ? `${jiraVersionUrl}\n\n${description}` : `${jiraVersionUrl} \n`
|
|
130
|
+
|
|
128
131
|
try {
|
|
129
132
|
$.quiet = true
|
|
130
133
|
|
|
@@ -137,7 +140,7 @@ export const createReleaseBranch = async (
|
|
|
137
140
|
|
|
138
141
|
// Create PR and capture URL
|
|
139
142
|
const prResult =
|
|
140
|
-
await $`gh pr create --title "${titlePrefix} v${version}" --body
|
|
143
|
+
await $`gh pr create --title "${titlePrefix} v${version}" --body ${body} --base ${baseBranch} --head ${branchName}`
|
|
141
144
|
|
|
142
145
|
const prLink = prResult.stdout.trim()
|
|
143
146
|
|
|
@@ -7,10 +7,16 @@ import { getProjectRoot } from 'src/lib/git-utils'
|
|
|
7
7
|
|
|
8
8
|
const INFRA_KIT_CONFIG_FILE = 'infra-kit.yml'
|
|
9
9
|
|
|
10
|
+
const jiraTaskManagerProviderSchema = z.object({
|
|
11
|
+
type: z.literal('jira'),
|
|
12
|
+
baseUrl: z.string().url(),
|
|
13
|
+
projectId: z.number().int().positive(),
|
|
14
|
+
})
|
|
15
|
+
|
|
10
16
|
const infraKitConfigSchema = z.object({
|
|
11
17
|
dopplerProjectName: z.string().min(1),
|
|
12
18
|
environments: z.array(z.string().min(1)).min(1),
|
|
13
|
-
taskManagerProvider: z.union([z.string(), z.literal(false)]),
|
|
19
|
+
taskManagerProvider: z.union([z.string(), z.literal(false), jiraTaskManagerProviderSchema]),
|
|
14
20
|
})
|
|
15
21
|
|
|
16
22
|
export type InfraKitConfig = z.infer<typeof infraKitConfigSchema>
|
|
@@ -68,7 +68,7 @@ export const createSingleRelease = async (args: CreateSingleReleaseArgs): Promis
|
|
|
68
68
|
const jiraVersionUrl = `${jiraConfig.baseUrl}/projects/${result.version!.projectId}/versions/${result.version!.id}/tab/release-report-all-issues`
|
|
69
69
|
|
|
70
70
|
// 2. Create GitHub release branch
|
|
71
|
-
const releaseInfo = await createReleaseBranch({ version, jiraVersionUrl, type })
|
|
71
|
+
const releaseInfo = await createReleaseBranch({ version, jiraVersionUrl, type, description })
|
|
72
72
|
|
|
73
73
|
return {
|
|
74
74
|
version,
|
package/src/mcp/tools/index.ts
CHANGED
|
@@ -11,6 +11,7 @@ import { ghReleaseDeploySelectedMcpTool } from 'src/commands/gh-release-deploy-s
|
|
|
11
11
|
import { ghReleaseListMcpTool } from 'src/commands/gh-release-list'
|
|
12
12
|
import { releaseCreateMcpTool } from 'src/commands/release-create'
|
|
13
13
|
import { releaseCreateBatchMcpTool } from 'src/commands/release-create-batch'
|
|
14
|
+
import { versionMcpTool } from 'src/commands/version'
|
|
14
15
|
import { worktreesAddMcpTool } from 'src/commands/worktrees-add'
|
|
15
16
|
import { worktreesListMcpTool } from 'src/commands/worktrees-list'
|
|
16
17
|
import { worktreesRemoveMcpTool } from 'src/commands/worktrees-remove'
|
|
@@ -29,6 +30,7 @@ const tools = [
|
|
|
29
30
|
ghReleaseDeployAllMcpTool,
|
|
30
31
|
ghReleaseDeploySelectedMcpTool,
|
|
31
32
|
ghReleaseListMcpTool,
|
|
33
|
+
versionMcpTool,
|
|
32
34
|
worktreesAddMcpTool,
|
|
33
35
|
worktreesListMcpTool,
|
|
34
36
|
worktreesRemoveMcpTool,
|