fix(agentrun): authenticate managed repository imports
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env node
|
||||
import { readFileSync } from "node:fs";
|
||||
|
||||
const tokenPath = new URL("./token", import.meta.url);
|
||||
const prompt = process.argv[2] ?? "";
|
||||
|
||||
if (/username/iu.test(prompt)) {
|
||||
process.stdout.write("x-access-token\n");
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
if (!/password/iu.test(prompt)) process.exit(1);
|
||||
|
||||
let token;
|
||||
try {
|
||||
token = readFileSync(tokenPath, "utf8").trim();
|
||||
} catch {
|
||||
process.exit(1);
|
||||
}
|
||||
if (token.length === 0 || /[\u0000\r\n]/u.test(token)) process.exit(1);
|
||||
process.stdout.write(`${token}\n`);
|
||||
Reference in New Issue
Block a user