From 6b4a7220dc6808f528a9b07c430706b0c1e793a1 Mon Sep 17 00:00:00 2001 From: NewsguyTor Date: Sat, 9 Aug 2025 22:58:40 +0200 Subject: [PATCH] Support running at paths with spaces/special char Signed-off-by: NewsguyTor --- src/claude-auto-commit.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) mode change 100644 => 100755 src/claude-auto-commit.js diff --git a/src/claude-auto-commit.js b/src/claude-auto-commit.js old mode 100644 new mode 100755 index 24220a8..80afdeb --- a/src/claude-auto-commit.js +++ b/src/claude-auto-commit.js @@ -566,10 +566,21 @@ Configuration: return options; } -if (import.meta.url === `file://${process.argv[1]}`) { +// Check if this script is being run directly +import { fileURLToPath } from 'url'; +import { pathToFileURL } from 'url'; + +const __filename = fileURLToPath(import.meta.url); +const scriptPath = process.argv[1]; + +// Compare the resolved paths +if (__filename === scriptPath || pathToFileURL(scriptPath).href === import.meta.url) { const options = parseArgs(); const autoCommit = new ClaudeAutoCommit(options); - autoCommit.run(); + autoCommit.run().catch(error => { + console.error('Fatal error:', error); + process.exit(1); + }); } export default ClaudeAutoCommit; \ No newline at end of file