27 lines
835 B
JavaScript
Executable File
27 lines
835 B
JavaScript
Executable File
#!/usr/bin/env node
|
|
|
|
import { existsSync } from "node:fs";
|
|
import { dirname, join, resolve } from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
import { spawnSync } from "node:child_process";
|
|
|
|
const scriptDir = dirname(fileURLToPath(import.meta.url));
|
|
const skillDir = resolve(scriptDir, "..");
|
|
const tsxBin = join(skillDir, "node_modules", ".bin", "tsx");
|
|
|
|
if (!existsSync(tsxBin)) {
|
|
process.stderr.write(`Missing local Node dependencies for spotify. Run 'cd ${skillDir} && npm install' first.\n`);
|
|
process.exit(1);
|
|
}
|
|
|
|
const result = spawnSync(process.execPath, [tsxBin, join(skillDir, "src", "cli.ts"), ...process.argv.slice(2)], {
|
|
stdio: "inherit"
|
|
});
|
|
|
|
if (result.error) {
|
|
process.stderr.write(`${result.error.message}\n`);
|
|
process.exit(1);
|
|
}
|
|
|
|
process.exit(typeof result.status === "number" ? result.status : 1);
|