infra-kit 0.1.71 → 0.1.74

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.
@@ -0,0 +1,23 @@
1
+ import path from 'node:path'
2
+
3
+ import { DOPPLER_PROJECT_MAP } from 'src/lib/constants'
4
+ import { getProjectRoot } from 'src/lib/git-utils'
5
+
6
+ /**
7
+ * Resolve Doppler project name from the current working directory
8
+ */
9
+ export const getDopplerProject = async (): Promise<string> => {
10
+ const projectRoot = await getProjectRoot()
11
+
12
+ const dirName = path.basename(projectRoot)
13
+ const dopplerProject = DOPPLER_PROJECT_MAP[dirName]
14
+
15
+ if (!dopplerProject) {
16
+ throw new Error(
17
+ `Could not determine Doppler project for directory "${dirName}". ` +
18
+ `Expected one of: ${Object.keys(DOPPLER_PROJECT_MAP).join(', ')}`,
19
+ )
20
+ }
21
+
22
+ return dopplerProject
23
+ }
@@ -0,0 +1,2 @@
1
+ export { validateDopplerCliAndAuth } from './doppler-cli-auth'
2
+ export { getDopplerProject } from './doppler-project'
@@ -3,6 +3,24 @@
3
3
  */
4
4
  export const ENVs = ['dev', 'arthur', 'renana', 'roman', 'eliran', 'oriana']
5
5
 
6
+ export const DOPPLER_PROJECT_MAP: Record<string, string> = {
7
+ 'hulyo-monorepo': 'hulyo',
8
+ 'travelist-monorepo': 'travelist',
9
+ }
10
+
11
+ export const ENV_CACHE_DIR = './node_modules/.cache/infra-kit'
12
+ export const ENV_CACHE_FILE = 'env-cache.json'
13
+
14
+ export const INFRA_KIT_ENV_CONFIG_VAR = 'INFRA_KIT_ENV_CONFIG'
15
+ export const INFRA_KIT_ENV_PROJECT_VAR = 'INFRA_KIT_ENV_PROJECT'
16
+ export const INFRA_KIT_ENV_LOADED_AT_VAR = 'INFRA_KIT_ENV_LOADED_AT'
17
+
18
+ export interface EnvCache {
19
+ config: string
20
+ loadedAt: string
21
+ varNames: string[]
22
+ }
23
+
6
24
  export const WORKTREES_DIR_SUFFIX = '-worktrees'
7
25
  // eslint-disable-next-line sonarjs/publicly-writable-directories
8
26
  export const LOG_FILE_PATH = '/tmp/mcp-infra-kit.log'
@@ -15,6 +15,7 @@ export const loadEnvFromGitRoot = async (): Promise<void> => {
15
15
 
16
16
  const gitRoot = await getProjectRoot()
17
17
 
18
+ // TODO: remove this after new env managemement
18
19
  config({ path: resolve(gitRoot, '.env'), quiet: true })
19
20
 
20
21
  logger.info('Loaded .env file from git repository root')
@@ -1,5 +1,9 @@
1
1
  import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
2
2
 
3
+ import { envClearMcpTool } from 'src/commands/env-clear'
4
+ import { envListMcpTool } from 'src/commands/env-list'
5
+ import { envLoadMcpTool } from 'src/commands/env-load'
6
+ import { envStatusMcpTool } from 'src/commands/env-status'
3
7
  import { ghMergeDevMcpTool } from 'src/commands/gh-merge-dev'
4
8
  import { ghReleaseDeliverMcpTool } from 'src/commands/gh-release-deliver'
5
9
  import { ghReleaseDeployAllMcpTool } from 'src/commands/gh-release-deploy-all'
@@ -15,6 +19,10 @@ import { worktreesSyncMcpTool } from 'src/commands/worktrees-sync'
15
19
  import { createToolHandler } from 'src/lib/tool-handler'
16
20
 
17
21
  const tools = [
22
+ envStatusMcpTool,
23
+ envListMcpTool,
24
+ envLoadMcpTool,
25
+ envClearMcpTool,
18
26
  ghMergeDevMcpTool,
19
27
  releaseCreateMcpTool,
20
28
  releaseCreateBatchMcpTool,
@@ -1,25 +0,0 @@
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
- }
@@ -1 +0,0 @@
1
- export { validateAtlassianCliAndAuth } from './acli-auth'
@@ -1 +0,0 @@
1
- export { validateAtlassianCliAndAuth } from './acli-auth'