From 7e50a1991ed70adccc6e94a58f2a611a9123e7fb Mon Sep 17 00:00:00 2001 From: cunoe Date: Tue, 31 Mar 2026 12:26:54 +0800 Subject: [PATCH] fix(history): use dirname() for correct config path calculation (#8) --- src/commands/history.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/commands/history.ts b/src/commands/history.ts index 096b58b..a74b300 100644 --- a/src/commands/history.ts +++ b/src/commands/history.ts @@ -1,7 +1,7 @@ import { Command } from 'commander'; import chalk from 'chalk'; import { existsSync } from 'fs'; -import { join } from 'path'; +import { join, dirname } from 'path'; import { createDatabaseManagerFromConfigPath, EnvHistoryRecord } from '@/utils/db'; interface HistoryOptions { @@ -30,7 +30,7 @@ export function historyCommand(program: Command): void { .action(async (tag: string | undefined, options: HistoryOptions) => { try { const configPath = join(process.cwd(), options.config || './envx.config.yaml'); - const configDir = join(process.cwd(), options.config || './envx.config.yaml', '..'); + const configDir = dirname(configPath); console.log(chalk.blue('📚 Viewing environment variable history...')); console.log(chalk.gray(`📁 Config file: ${options.config}`));