@bunshin-cc/bunshin 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +5 -5
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -5465,11 +5465,11 @@ async function readStdin2() {
|
|
|
5465
5465
|
process.stdin.on("error", reject);
|
|
5466
5466
|
});
|
|
5467
5467
|
}
|
|
5468
|
-
async function connect(args, cwd, prompt = true) {
|
|
5468
|
+
async function connect(args, cwd, prompt = true, reuseKey = true) {
|
|
5469
5469
|
const project = Store.discover(cwd)?.config();
|
|
5470
5470
|
const apiUrl = (str3(args.flags["api-url"]) ?? project?.apiUrl ?? process.env.BUNSHIN_API_URL ?? HOSTED_API2).replace(/\/$/, "");
|
|
5471
5471
|
let key = bool2(args.flags["key-stdin"]) ? await readStdin2() : void 0;
|
|
5472
|
-
key ||= process.env.BUNSHIN_API_KEY || (project?.apiUrl?.replace(/\/$/, "") === apiUrl ? project?.apiKey : void 0) || resolveGitKey(apiUrl);
|
|
5472
|
+
if (reuseKey) key ||= process.env.BUNSHIN_API_KEY || (project?.apiUrl?.replace(/\/$/, "") === apiUrl ? project?.apiKey : void 0) || resolveGitKey(apiUrl);
|
|
5473
5473
|
if (!key && prompt) {
|
|
5474
5474
|
const { readKey: readKey2 } = await Promise.resolve().then(() => (init_setup(), setup_exports));
|
|
5475
5475
|
key = await readKey2();
|
|
@@ -5482,7 +5482,7 @@ async function connect(args, cwd, prompt = true) {
|
|
|
5482
5482
|
if (e instanceof GitApiError && e.status === 401) throw new Error("Bunshin refused this key");
|
|
5483
5483
|
throw e;
|
|
5484
5484
|
}
|
|
5485
|
-
if (!process.env.BUNSHIN_API_KEY || key !== process.env.BUNSHIN_API_KEY) saveGitCredential(apiUrl, key);
|
|
5485
|
+
if (!reuseKey || !process.env.BUNSHIN_API_KEY || key !== process.env.BUNSHIN_API_KEY) saveGitCredential(apiUrl, key);
|
|
5486
5486
|
return client;
|
|
5487
5487
|
}
|
|
5488
5488
|
function toplevel(dir) {
|
|
@@ -5746,7 +5746,7 @@ async function cmdRepo(args, cwd, out, err) {
|
|
|
5746
5746
|
return 0;
|
|
5747
5747
|
}
|
|
5748
5748
|
case "login": {
|
|
5749
|
-
const client = await connect(rest, cwd);
|
|
5749
|
+
const client = await connect(rest, cwd, true, false);
|
|
5750
5750
|
out(`Key stored for git access to ${client.apiUrl}
|
|
5751
5751
|
`);
|
|
5752
5752
|
return 0;
|
|
@@ -5793,7 +5793,7 @@ var init_gitrepo = __esm({
|
|
|
5793
5793
|
bunshin repo verify compare this clone, Bunshin and the old GitHub remote
|
|
5794
5794
|
bunshin repo list repositories you can read
|
|
5795
5795
|
bunshin repo url owner/repo the git remote URL
|
|
5796
|
-
bunshin repo login [--api-url URL] [--key-stdin] store
|
|
5796
|
+
bunshin repo login [--api-url URL] [--key-stdin] store a new key for git (asks for it, or reads stdin)
|
|
5797
5797
|
|
|
5798
5798
|
Common flags: --api-url URL (default: this project's, else https://api.bunshin.cc), --key-stdin
|
|
5799
5799
|
`;
|