Something went wrong. Try again.
Open source agent hosting on the AT Protocol
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637#!/usr/bin/env node// languid CLI entry. A static import of a missing package fails while Node links// modules, before any of the CLI runs, so the CLI is loaded here dynamically to// turn an unfinished install into an instruction instead of a stack trace.
import fs from 'node:fs'import path from 'node:path'
const ROOT = path.resolve(import.meta.dirname, '..')
try { const args = process.argv.slice(2) if (args[0] === 'update') { const { clientUpdateCommand } = await import('./client-update.ts') process.exitCode = await clientUpdateCommand(args.slice(1)) } else if (args.length === 1 && (args[0] === '--version' || args[0] === '-v')) { const { clientVersion } = await import('./client-update.ts') console.log(`languid ${clientVersion()}`) } else await import('./main.ts')} catch (e: any) { const missing = e?.code === 'ERR_MODULE_NOT_FOUND' && /Cannot find package '([^']+)'/.exec(e.message)?.[1] if (!missing || !declared(missing)) throw e console.error(`\x1b[31merror:\x1b[0m languid's dependencies aren't installed (missing ${missing}).\n` + ` Run: cd ${ROOT} && pnpm install`) process.exit(1)}
/** Whether package.json lists the package: then it's the install that's behind, not the code. */function declared(name: string): boolean { try { const pkg = JSON.parse(fs.readFileSync(path.join(ROOT, 'package.json'), 'utf8')) return name in { ...pkg.dependencies, ...pkg.devDependencies } } catch { return false }}