On Linux, Playwright's --with-deps flag runs sudo to install system packages. npm's spinner hides the password prompt, making the install appear to hang. Now installs without --with-deps and directs Linux users to run it manually if browser tools fail. Closes #67 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
55 lines
2.1 KiB
JavaScript
55 lines
2.1 KiB
JavaScript
#!/usr/bin/env node
|
|
import { execSync } from 'child_process'
|
|
import { createRequire } from 'module'
|
|
import os from 'os'
|
|
import { fileURLToPath } from 'url'
|
|
import { dirname, resolve } from 'path'
|
|
|
|
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
const require = createRequire(import.meta.url)
|
|
const pkg = require(resolve(__dirname, '..', 'package.json'))
|
|
|
|
// Colors
|
|
const cyan = '\x1b[36m'
|
|
const green = '\x1b[32m'
|
|
const yellow = '\x1b[33m'
|
|
const dim = '\x1b[2m'
|
|
const reset = '\x1b[0m'
|
|
|
|
const banner =
|
|
'\n' +
|
|
cyan +
|
|
' ██████╗ ███████╗██████╗ \n' +
|
|
' ██╔════╝ ██╔════╝██╔══██╗\n' +
|
|
' ██║ ███╗███████╗██║ ██║\n' +
|
|
' ██║ ██║╚════██║██║ ██║\n' +
|
|
' ╚██████╔╝███████║██████╔╝\n' +
|
|
' ╚═════╝ ╚══════╝╚═════╝ ' +
|
|
reset + '\n' +
|
|
'\n' +
|
|
` Get Shit Done ${dim}v${pkg.version}${reset}\n` +
|
|
` A standalone coding agent that plans, executes, and ships.\n` +
|
|
'\n' +
|
|
` ${green}✓${reset} Installed successfully\n` +
|
|
` ${dim}Run ${reset}${cyan}gsd${reset}${dim} to get started.${reset}\n`
|
|
|
|
process.stderr.write(banner)
|
|
|
|
// Apply patches to upstream dependencies (non-fatal)
|
|
try {
|
|
execSync('npx patch-package', { stdio: 'inherit', cwd: resolve(__dirname, '..') })
|
|
process.stderr.write(`\n ${green}✓${reset} Patches applied\n`)
|
|
} catch {
|
|
process.stderr.write(`\n ${yellow}⚠${reset} Failed to apply patches — run ${cyan}npx patch-package${reset} manually\n`)
|
|
}
|
|
|
|
// Install Playwright chromium for browser tools (non-fatal)
|
|
try {
|
|
execSync('npx playwright install chromium', { stdio: 'inherit' })
|
|
process.stderr.write(`\n ${green}✓${reset} Browser tools ready\n\n`)
|
|
} catch {
|
|
const hint = os.platform() === 'linux'
|
|
? `${cyan}npx playwright install --with-deps chromium${reset}`
|
|
: `${cyan}npx playwright install chromium${reset}`
|
|
process.stderr.write(`\n ${yellow}⚠${reset} Browser tools unavailable — run ${hint} to enable\n\n`)
|
|
}
|