From ef904cef612c6b79adc6a80938e3ac183191976d Mon Sep 17 00:00:00 2001 From: Cameron Banowsky Date: Wed, 22 Oct 2025 10:41:18 -0700 Subject: [PATCH] fix: Resolve TypeScript compilation errors in GitHub integration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit fixes the TypeScript errors that were causing the release build to fail after merging PR #95 (GitHub GPG key integration). Changes: - Add missing 'github' and 'githubName' properties to KeysOptions interface - Fix type mismatch in githubUtils.ts by mapping PgpKeyInfo to GitHubKeyAddInfo - Map keyId to fingerprint (importPgpKey returns keyId, not fingerprint) - Convert email from 'string | null' to 'string | undefined' using nullish coalescing - Add 'github' to ImportOptions source type in unifiedKeyManager.ts Fixes build errors: - Property 'github' does not exist on type 'KeysOptions' (cli/index.ts:885-903) - Property 'githubName' does not exist on type 'KeysOptions' (cli/index.ts:897) - Property 'fingerprint' does not exist on type 'PgpKeyInfo' (cli/githubUtils.ts:177, 185) - Type 'string | null' is not assignable to type 'string | undefined' (cli/githubUtils.ts:186) - Argument of type 'PgpKeyInfo' is not assignable to parameter of type 'GitHubKeyAddInfo' (cli/githubUtils.ts:173) - Type '"github"' is not comparable to ImportOptions source types (cli/unifiedKeyManager.ts:664) Related to: #94 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- cli/githubUtils.ts | 19 +++++++++++++------ cli/index.ts | 2 ++ cli/unifiedKeyManager.ts | 2 +- package-lock.json | 4 ++-- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/cli/githubUtils.ts b/cli/githubUtils.ts index a4bdd20..8429c82 100644 --- a/cli/githubUtils.ts +++ b/cli/githubUtils.ts @@ -169,21 +169,28 @@ export async function addGitHubKey( // Generate key name const keyName = customName || `github:${sanitizedUsername}`; + // Map the PGP key info to GitHub key format + // importPgpKey returns keyId, but we use it as fingerprint for GitHub keys + const githubKeyInfo = { + fingerprint: keyInfo.keyId, + email: keyInfo.email ?? undefined + }; + // Add to key manager - await addGitHubKeyToManager(keyName, sanitizedUsername, keyInfo, gpgKeyData); + await addGitHubKeyToManager(keyName, sanitizedUsername, githubKeyInfo, gpgKeyData); if (!silent) { console.log(`✓ GitHub key added: ${keyName}`); - console.log(` Fingerprint: ${keyInfo.fingerprint}`); - if (keyInfo.email) { - console.log(` Email: ${keyInfo.email}`); + console.log(` Fingerprint: ${githubKeyInfo.fingerprint}`); + if (githubKeyInfo.email) { + console.log(` Email: ${githubKeyInfo.email}`); } } return { name: keyName, - fingerprint: keyInfo.fingerprint, - email: keyInfo.email + fingerprint: githubKeyInfo.fingerprint, + email: githubKeyInfo.email }; } diff --git a/cli/index.ts b/cli/index.ts index a87f5f2..b22d3a5 100644 --- a/cli/index.ts +++ b/cli/index.ts @@ -125,6 +125,8 @@ interface KeysOptions { nativePgp?: boolean; keybase?: string; keybaseName?: string; + github?: string; + githubName?: string; verify?: boolean; verbose?: boolean; debug?: boolean; diff --git a/cli/unifiedKeyManager.ts b/cli/unifiedKeyManager.ts index fb28d04..af743ee 100644 --- a/cli/unifiedKeyManager.ts +++ b/cli/unifiedKeyManager.ts @@ -65,7 +65,7 @@ export interface ExecResult { } export interface ImportOptions { - source: 'file' | 'pgp-server' | 'keybase' | 'gpg-import' | 'gpg-keyring'; + source: 'file' | 'pgp-server' | 'keybase' | 'github' | 'gpg-import' | 'gpg-keyring'; content?: string; name?: string; file?: string; diff --git a/package-lock.json b/package-lock.json index 68cde03..5cbb027 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "dedpaste", - "version": "1.19.1", + "version": "1.20.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "dedpaste", - "version": "1.19.1", + "version": "1.20.0", "hasInstallScript": true, "license": "ISC", "dependencies": {