mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-13 22:06:14 +01:00
Add .oxfmtignore to skip generated bindings and wasm-pack output. Add npm format script, update DEVELOPMENT.md for Vite+ toolchain, and format all non-generated files with oxfmt. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
51 lines
1.5 KiB
TypeScript
51 lines
1.5 KiB
TypeScript
import { showPromptForm } from "../../lib/prompt-form";
|
|
import { Banner } from "../core/Banner";
|
|
import { InlineCode } from "../core/InlineCode";
|
|
|
|
export interface GitCredentials {
|
|
username: string;
|
|
password: string;
|
|
}
|
|
|
|
export async function promptCredentials({
|
|
url: remoteUrl,
|
|
error,
|
|
}: {
|
|
url: string;
|
|
error: string | null;
|
|
}): Promise<GitCredentials | null> {
|
|
const isGitHub = /github\.com/i.test(remoteUrl);
|
|
const userLabel = isGitHub ? "GitHub Username" : "Username";
|
|
const passLabel = isGitHub ? "GitHub Personal Access Token" : "Password / Token";
|
|
const userDescription = isGitHub ? "Use your GitHub username (not your email)." : undefined;
|
|
const passDescription = isGitHub
|
|
? "GitHub requires a Personal Access Token (PAT) for write operations over HTTPS. Passwords are not supported."
|
|
: "Enter your password or access token for this Git server.";
|
|
const r = await showPromptForm({
|
|
id: "git-credentials",
|
|
title: "Credentials Required",
|
|
description: error ? (
|
|
<Banner color="danger">{error}</Banner>
|
|
) : (
|
|
<>
|
|
Enter credentials for <InlineCode>{remoteUrl}</InlineCode>
|
|
</>
|
|
),
|
|
inputs: [
|
|
{ type: "text", name: "username", label: userLabel, description: userDescription },
|
|
{
|
|
type: "text",
|
|
name: "password",
|
|
label: passLabel,
|
|
description: passDescription,
|
|
password: true,
|
|
},
|
|
],
|
|
});
|
|
if (r == null) return null;
|
|
|
|
const username = String(r.username || "");
|
|
const password = String(r.password || "");
|
|
return { username, password };
|
|
}
|