mirror of
https://github.com/openclaw/clawhub.git
synced 2026-08-14 00:47:57 +00:00
chore: improve bun clawdhub runner
This commit is contained in:
@@ -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,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.)
|
||||
|
||||
Reference in New Issue
Block a user