infra-kit 0.1.45 → 0.1.50

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.
@@ -2,7 +2,6 @@ import { z } from 'zod'
2
2
 
3
3
  import { getReleasePRs } from 'src/lib/gh-release-prs'
4
4
  import { logger } from 'src/lib/logger'
5
- import { sortVersions } from 'src/lib/version-utils'
6
5
  import type { ToolsExecutionResult } from 'src/types'
7
6
 
8
7
  /**
@@ -12,14 +11,13 @@ export const ghReleaseList = async (): Promise<ToolsExecutionResult> => {
12
11
  const releasePRs = await getReleasePRs()
13
12
 
14
13
  const releasePRsList = releasePRs.map((pr) => pr.replace('release/', ''))
15
- const sortedReleases = sortVersions(releasePRsList)
16
14
 
17
15
  logger.info('All release branches: \n')
18
- logger.info(sortedReleases.join('\n'))
16
+ logger.info(`\n${releasePRsList.join('\n')}`)
19
17
 
20
18
  const structuredContent = {
21
- releases: sortedReleases,
22
- count: sortedReleases.length,
19
+ releases: releasePRsList,
20
+ count: releasePRsList.length,
23
21
  }
24
22
 
25
23
  return {
package/src/entry/cli.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { Command } from 'commander'
2
2
 
3
+ // Commands
3
4
  import { ghMergeDev } from 'src/commands/gh-merge-dev'
4
5
  import { ghReleaseCreate } from 'src/commands/gh-release-create'
5
6
  import { ghReleaseDeliver } from 'src/commands/gh-release-deliver'
@@ -9,7 +10,8 @@ import { worktreesAdd } from 'src/commands/worktrees-add'
9
10
  import { worktreesList } from 'src/commands/worktrees-list'
10
11
  import { worktreesRemove } from 'src/commands/worktrees-remove'
11
12
  import { worktreesSync } from 'src/commands/worktrees-sync'
12
- import { validateGitHubCliAndAuth } from 'src/lib/gh-cli-auth'
13
+ // Integrations
14
+ import { validateGitHubCliAndAuth } from 'src/integrations/gh'
13
15
 
14
16
  const program = new Command()
15
17
 
@@ -0,0 +1,25 @@
1
+ import process from 'node:process'
2
+ import { $ } from 'zx'
3
+
4
+ import { logger } from 'src/lib/logger'
5
+
6
+ /**
7
+ * Validate Atlassian CLI installation and authentication status and throw an error if not valid
8
+ */
9
+ export const validateAtlassianCliAndAuth = async () => {
10
+ try {
11
+ await $`acli --version`
12
+ } catch (error: unknown) {
13
+ logger.error({ error }, 'Error: Atlassian CLI (atlassian) is not installed.')
14
+ logger.error('Please install it from: https://developer.atlassian.com/cloud/acli/guides/install-macos/')
15
+ process.exit(1)
16
+ }
17
+
18
+ try {
19
+ await $`gh auth status`
20
+ } catch (error: unknown) {
21
+ logger.error({ error }, 'Error: GitHub CLI (gh) is not authenticated.')
22
+ logger.error('Please authenticate it from: https://cli.github.com/manual/gh_auth_login or type "gh auth login"')
23
+ process.exit(1)
24
+ }
25
+ }
@@ -0,0 +1 @@
1
+ export { validateAtlassianCliAndAuth } from './acli-auth'
@@ -0,0 +1 @@
1
+ export { validateAtlassianCliAndAuth } from './acli-auth'
@@ -0,0 +1 @@
1
+ export { validateGitHubCliAndAuth } from './gh-cli-auth'
@@ -2,6 +2,7 @@ import process from 'node:process'
2
2
  import { $ } from 'zx'
3
3
 
4
4
  import { logger } from 'src/lib/logger'
5
+ import { sortVersions } from 'src/lib/version-utils'
5
6
 
6
7
  interface ReleasePR {
7
8
  headRefName: string
@@ -13,10 +14,10 @@ interface ReleasePR {
13
14
 
14
15
  /**
15
16
  * Fetch open release PRs from GitHub with 'Release' in the title and base 'dev'.
16
- * Returns an array of headRefName strings.
17
+ * Returns an array of headRefName strings sorted by semver in ascending order.
17
18
  * Throws an error if fetching fails.
18
19
  *
19
- * @returns [release/v1.18.22, release/v1.18.23, release/v1.18.24]
20
+ * @returns [release/v1.18.22, release/v1.18.23, release/v1.18.24] (sorted by semver)
20
21
  */
21
22
  export const getReleasePRs = async (): Promise<string[]> => {
22
23
  try {
@@ -31,7 +32,8 @@ export const getReleasePRs = async (): Promise<string[]> => {
31
32
  process.exit(1)
32
33
  }
33
34
 
34
- return releasePRsArray.map((pr) => pr.headRefName)
35
+ const headRefNames = releasePRsArray.map((pr) => pr.headRefName)
36
+ return sortVersions(headRefNames)
35
37
  } catch (error) {
36
38
  logger.error({ error }, '❌ Error fetching release PRs')
37
39
  process.exit(1)
@@ -7,9 +7,10 @@ export const parseVersion = (versionStr: string): [number, number, number] => {
7
7
 
8
8
  /**
9
9
  * Sort version strings in ascending order
10
+ * Note: Returns a new sorted array without mutating the original
10
11
  */
11
12
  export const sortVersions = (versions: string[]): string[] => {
12
- return versions.sort((a, b) => {
13
+ return [...versions].sort((a, b) => {
13
14
  const [majA, minA, patchA] = parseVersion(a)
14
15
  const [majB, minB, patchB] = parseVersion(b)
15
16
 
package/src/mcp/server.ts CHANGED
@@ -8,7 +8,6 @@ export async function createMcpServer() {
8
8
  const server = new McpServer(
9
9
  {
10
10
  name: 'infra-kit',
11
- description: 'Infra Kit is a tool that helps you manage your infrastructure.',
12
11
  version: '0.1.0',
13
12
  },
14
13
  {
package/tsconfig.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "lib": ["ESNext"],
9
9
  "baseUrl": ".",
10
10
  "module": "ESNext",
11
- "moduleResolution": "node",
11
+ "moduleResolution": "bundler",
12
12
  "resolveJsonModule": true,
13
13
  "types": ["node"],
14
14
  "allowJs": true,
@@ -0,0 +1,16 @@
1
+ import react from '@vitejs/plugin-react-swc'
2
+ import path from 'node:path'
3
+ import { defineConfig } from 'vitest/config'
4
+
5
+ export default defineConfig(() => ({
6
+ plugins: [react()],
7
+ resolve: {
8
+ alias: {
9
+ '#root': path.resolve(__dirname, './src'),
10
+ },
11
+ },
12
+ test: {
13
+ environment: 'jsdom',
14
+ setupFiles: ['./vitest.setup.ts'],
15
+ },
16
+ }))
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom/vitest'