Skip to content
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
34 changes: 19 additions & 15 deletions packages/cli/src/commands/serve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,29 +86,33 @@ async function downloadWebDist(version: string, targetDir: string): Promise<void
log.info({ version, targetDir }, 'web_dist.download_started');
console.log(`Web UI not found locally — downloading from release v${version}...`);

// Download checksums
const checksumsRes = await fetch(checksumsUrl).catch((err: unknown) => {
throw new Error(
`Network error fetching checksums from ${checksumsUrl}: ${(err as Error).message}`
);
});
// Download checksums and tarball in parallel
console.log(`Downloading ${tarballUrl}...`);
const [checksumsRes, tarballRes] = await Promise.all([
fetch(checksumsUrl).catch((err: unknown) => {
throw new Error(
`Network error fetching checksums from ${checksumsUrl}: ${(err as Error).message}`
);
}),
fetch(tarballUrl).catch((err: unknown) => {
throw new Error(
`Network error fetching tarball from ${tarballUrl}: ${(err as Error).message}`
);
}),
]);
if (!checksumsRes.ok) {
throw new Error(
`Failed to download checksums: ${checksumsRes.status} ${checksumsRes.statusText}`
);
}
const checksumsText = await checksumsRes.text();
const expectedHash = parseChecksum(checksumsText, 'archon-web.tar.gz');

// Download tarball
console.log(`Downloading ${tarballUrl}...`);
const tarballRes = await fetch(tarballUrl).catch((err: unknown) => {
throw new Error(`Network error fetching tarball from ${tarballUrl}: ${(err as Error).message}`);
});
if (!tarballRes.ok) {
throw new Error(`Failed to download web UI: ${tarballRes.status} ${tarballRes.statusText}`);
}
const tarballBuffer = await tarballRes.arrayBuffer();
const [checksumsText, tarballBuffer] = await Promise.all([
checksumsRes.text(),
tarballRes.arrayBuffer(),
]);
const expectedHash = parseChecksum(checksumsText, 'archon-web.tar.gz');

// Verify checksum
const hasher = new Bun.CryptoHasher('sha256');
Expand Down
3 changes: 1 addition & 2 deletions packages/cli/src/commands/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1203,7 +1203,7 @@ export function copyArchonSkill(targetPath: string): void {
function trySpawn(
command: string,
args: string[],
options: { detached: boolean; stdio: 'ignore'; shell?: boolean }
options: { detached: boolean; stdio: 'ignore' }
): boolean {
try {
const child: ChildProcess = spawn(command, args, options);
Expand Down Expand Up @@ -1238,7 +1238,6 @@ function spawnWindowsTerminal(repoPath: string): SpawnResult {
trySpawn('cmd.exe', ['/c', 'start', '""', '/D', repoPath, 'cmd', '/k', 'archon setup'], {
detached: true,
stdio: 'ignore',
shell: true,
})
) {
return { success: true };
Expand Down
3 changes: 1 addition & 2 deletions packages/paths/src/update-check.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { join } from 'path';
import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'fs';
import { readFileSync, writeFileSync, mkdirSync } from 'fs';
import { getArchonHome } from './archon-paths';
import { createLogger } from './logger';

Expand Down Expand Up @@ -30,7 +30,6 @@ function getCachePath(): string {
function readCache(): UpdateCheckCache | null {
const cachePath = getCachePath();
try {
if (!existsSync(cachePath)) return null;
const raw = readFileSync(cachePath, 'utf-8');
const data = JSON.parse(raw) as UpdateCheckCache;
if (!data.latestVersion || !data.releaseUrl || typeof data.checkedAt !== 'number') {
Expand Down
Loading