refactor(plugins): move onboarding auth metadata to manifests

This commit is contained in:
Peter Steinberger
2026-03-15 23:47:07 -07:00
parent f5ef936615
commit ae60094fb5
77 changed files with 2334 additions and 1100 deletions

View File

@@ -66,6 +66,7 @@ export function createProviderApiKeyAuthMethod(
const opts = ctx.opts as Record<string, unknown> | undefined;
const flagValue = resolveStringOption(opts, params.optionKey);
let capturedSecretInput: SecretInput | undefined;
let capturedCredential = false;
let capturedMode: "plaintext" | "ref" | undefined;
await ensureApiKeyFromOptionEnvOrPrompt({
@@ -89,13 +90,15 @@ export function createProviderApiKeyAuthMethod(
noteTitle: params.noteTitle,
setCredential: async (apiKey, mode) => {
capturedSecretInput = apiKey;
capturedCredential = true;
capturedMode = mode;
},
});
if (!capturedSecretInput) {
if (!capturedCredential) {
throw new Error(`Missing API key input for provider "${params.providerId}".`);
}
const credentialInput = capturedSecretInput ?? "";
return {
profiles: [
@@ -103,7 +106,7 @@ export function createProviderApiKeyAuthMethod(
profileId: resolveProfileId(params),
credential: buildApiKeyCredential(
params.providerId,
capturedSecretInput,
credentialInput,
params.metadata,
capturedMode ? { secretInputMode: capturedMode } : undefined,
),