File tree Expand file tree Collapse file tree 4 files changed +15
-13
lines changed
claude-config-composer/src Expand file tree Collapse file tree 4 files changed +15
-13
lines changed Original file line number Diff line number Diff line change @@ -196,7 +196,8 @@ export class GenerateCommand {
196196 */
197197 private static async isClaudeConfigRepo ( ) : Promise < boolean > {
198198 try {
199- const packageJson = await fs . readFile ( path . join ( process . cwd ( ) , 'package.json' ) , 'utf-8' ) ;
199+ // Use relative path to avoid process.cwd() issues in CI
200+ const packageJson = await fs . readFile ( 'package.json' , 'utf-8' ) ;
200201 const pkg = JSON . parse ( packageJson ) ;
201202 return pkg . name === 'claude-config-composer' ;
202203 } catch {
Original file line number Diff line number Diff line change @@ -45,7 +45,8 @@ export class BackupUtils {
4545 return ErrorHandler . wrapAsync (
4646 async ( ) => {
4747 try {
48- const gitignorePath = path . join ( process . cwd ( ) , '.gitignore' ) ;
48+ // Use relative path to avoid process.cwd() issues in CI
49+ const gitignorePath = '.gitignore' ;
4950 let gitignoreContent = '' ;
5051
5152 try {
Original file line number Diff line number Diff line change @@ -32,16 +32,15 @@ export class ConfigGenerator {
3232 showProgress : boolean = true
3333 ) : Promise < void > {
3434 // Handle output directory path
35- // For absolute paths (like temp directories in tests), use directly
36- // For relative paths, just resolve them
37- if ( path . isAbsolute ( outputDir ) ) {
38- // For absolute paths (e.g., temp directories in CI), use as-is
39- outputDir = path . normalize ( outputDir ) ;
40- } else {
41- // For relative paths, resolve from current directory
42- // Don't use sanitizePath here as it rejects valid paths
43- outputDir = path . resolve ( process . cwd ( ) , outputDir || '.' ) ;
35+ // Always normalize the path, whether absolute or relative
36+ // This avoids the need for process.cwd() which can fail in CI
37+ if ( ! outputDir ) {
38+ outputDir = '.' ;
4439 }
40+
41+ // Normalize the path - this works for both absolute and relative paths
42+ // and doesn't require process.cwd()
43+ outputDir = path . normalize ( outputDir ) ;
4544
4645 // Validate input configurations
4746 try {
Original file line number Diff line number Diff line change @@ -231,8 +231,9 @@ export class PathValidator {
231231 * Safely creates a directory path, ensuring it's within the allowed base path
232232 */
233233 static async createSafeDirectory ( targetPath : string , basePath : string ) : Promise < string > {
234- // Handle current directory case
235- const effectiveBasePath = basePath === '.' ? process . cwd ( ) : basePath ;
234+ // Handle current directory case - just use the provided basePath
235+ // Avoid process.cwd() which can fail in CI when directory is deleted
236+ const effectiveBasePath = basePath || '.' ;
236237
237238 const validatedPath = PathValidator . validatePath ( targetPath , effectiveBasePath ) ;
238239 const fullPath = path . join ( effectiveBasePath , validatedPath ) ;
You can’t perform that action at this time.
0 commit comments