UNPKG

@jamiehdev/commit-wizard

Version:

ai-powered conventional commit message generator. Analyses your git changes and suggests commit messages.

39 lines (34 loc) 1.29 kB
#!/usr/bin/env node // first try to use our npm module try { const { runCommitWizardCli } = require("./index"); const arguments = process.argv.slice(2); runCommitWizardCli(arguments) .then(commitMessage => { process.exit(0); }) .catch(error => { console.error("Could not run Node.js version, error:", error.message); // if napi version fails, fall back to CLI binary try { const path = require('path'); const { execFileSync } = require('child_process'); // find the native CLI binary relative to this script const binaryPath = path.resolve(__dirname, '..', 'target', 'release', 'commit-wizard'); console.log(`Using native binary: ${binaryPath}`); // pass through any arguments console.log(`Trying native binary at: ${binaryPath}`); execFileSync(binaryPath, process.argv.slice(2), { stdio: 'inherit', env: process.env }); process.exit(0); } catch (fallbackError) { console.error("Native binary fallback also failed:", fallbackError.message); process.exit(1); } }); } catch (initialError) { console.error("Could not load Node.js module:", initialError.message); process.exit(1); }