chore: improve bun clawdhub runner

This commit is contained in:
Peter Steinberger
2026-01-04 05:55:26 +01:00
parent 809119c99a
commit b42573cd3e
2 changed files with 29 additions and 2 deletions
+28 -1
View File
@@ -1,3 +1,30 @@
#!/usr/bin/env bun
import './packages/clawdhub/bin/clawdhub.js'
import { existsSync } from 'node:fs'
import { stat } from 'node:fs/promises'
import { fileURLToPath } from 'node:url'
const distCliUrl = new URL('./packages/clawdhub/dist/cli.js', import.meta.url)
const distCliPath = fileURLToPath(distCliUrl)
const srcCliPath = fileURLToPath(new URL('./packages/clawdhub/src/cli.ts', import.meta.url))
const shouldBuild = await (async () => {
if (!existsSync(distCliPath)) return true
try {
const [src, dist] = await Promise.all([stat(srcCliPath), stat(distCliPath)])
return src.mtimeMs > dist.mtimeMs
} catch {
return true
}
})()
if (shouldBuild) {
const proc = Bun.spawn(['bunx', 'tsc', '-p', 'packages/clawdhub/tsconfig.json'], {
stdin: 'inherit',
stdout: 'inherit',
stderr: 'inherit',
})
const code = await proc.exited
if (code !== 0) process.exit(code)
}
await import(distCliUrl.href)
+1 -1
View File
@@ -1,6 +1,6 @@
- [ ] Browser-based CLI login (`clawdhub auth login`) via loopback + auto token creation (deps: none)
- [ ] Web route `/cli/auth` to mint API token + redirect back to CLI (deps: none)
- [ ] Local repo shortcut `bun clawdhub …` with auto-build of CLI dist (deps: none)
- [x] ~~Local repo shortcut `bun clawdhub …` with auto-build of CLI dist (deps: none)~~
- [ ] CLI: prefer stored `registry` from global config for all network commands (deps: none)
- [ ] Confirm shared runtime schemas are used across CLI + Convex (`@clawdhub/schema`, `arktype`)
- [ ] Dependency audit/update (deps: `@biomejs/biome`, `oxlint`, `vitest`, etc.)