Skip to content
This repository was archived by the owner on May 1, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
"@types/node": "^25.0.0",
"@types/node-forge": "^1.3.14",
"@types/prettyjson": "^0.0.33",
"@types/qrcode": "^1.5.6",
"@types/react": "^18.3.28",
"@types/tmp": "^0.2.6",
"@vercel/ncc": "^0.38.4",
Expand All @@ -121,6 +122,7 @@
"ink-spinner": "^5.0.0",
"jsonwebtoken": "^9.0.3",
"node-forge": "^1.3.3",
"qrcode": "^1.5.4",
"react": "^18.3.1"
}
}
9 changes: 9 additions & 0 deletions src/build/onboarding/ui/app.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { FC } from 'react'
import type { BuildLogger } from '../../request.js'
import type { ApiKeyData, CertificateData, OnboardingProgress, OnboardingStep, ProfileData } from '../types.js'
import { handleCustomMsg } from '../../qr.js'
import { Buffer } from 'node:buffer'
import { existsSync } from 'node:fs'
import { copyFile, readFile } from 'node:fs/promises'
Expand Down Expand Up @@ -542,6 +543,14 @@
return [...prev, line]
})
},
customMsg: async (kind: string, data: Record<string, unknown>) => {
await handleCustomMsg(
kind,
data,
(line: string) => setBuildOutput(prev => [...prev, line]),

Check failure on line 550 in src/build/onboarding/ui/app.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Refactor this code to not nest functions more than 4 levels deep.

See more on https://sonarcloud.io/project/issues?id=Cap-go_capgo-cli&issues=AZ1eCI4o7Pzve-iuv5pX&open=AZ1eCI4o7Pzve-iuv5pX&pullRequest=574
(line: string) => setBuildOutput(prev => [...prev, line]),

Check failure on line 551 in src/build/onboarding/ui/app.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Refactor this code to not nest functions more than 4 levels deep.

See more on https://sonarcloud.io/project/issues?id=Cap-go_capgo-cli&issues=AZ1eCI4o7Pzve-iuv5pY&open=AZ1eCI4o7Pzve-iuv5pY&pullRequest=574
)
},
}

setBuildOutput([`Requesting build for ${appId} (ios)...`])
Expand Down
41 changes: 41 additions & 0 deletions src/build/qr.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import QRCode from 'qrcode'

/**
* Handle a custom_msg from the websocket stream.
* Known kinds get rich rendering; unknown kinds get a warning + raw dump.
*/
export async function handleCustomMsg(
kind: string,
data: Record<string, unknown>,
log: (line: string) => void,
warn: (line: string) => void,
): Promise<void> {
if (kind === 'qr_download_link') {
const url = data.url
if (typeof url !== 'string') {
warn('qr_download_link message missing url field')
return
}

try {
const qrText = await QRCode.toString(url, { type: 'utf8', errorCorrectionLevel: 'L' })
log('')
for (const line of qrText.split('\n')) {
log(line)
}
log(url)
log('')
}
catch {
// Fallback: just show the URL if QR generation fails
log('')
log(url)
log('')
}
return
}

// Unknown kind — warn and dump raw data
warn(`Unknown message type "${kind}" — you may need to update the CLI`)
log(JSON.stringify(data, null, 2))
}
Loading
Loading