fix: resolve type errors and harden pre-push hook

- Server<undefined> type param for Bun.serve (TS2314)
- Remove stale @ts-expect-error in deploy.ts (TS2578)
- Pre-push hook now runs tsc --noEmit for all packages
- Pre-push hook now tests all packages (was missing upulse, pulse-cursor, pulse-openclaw)
- Use subshells + absolute ROOT path instead of fragile cd chains

Fixes CI failure on PR #52.

— 小糯 🐱
This commit is contained in:
2026-04-15 07:41:20 +08:00
parent e84839d1f8
commit 0cfbce865b
4 changed files with 30 additions and 13 deletions
-1
View File
@@ -93,7 +93,6 @@ async function tryWriteMigrateEvents(
// Discover sense keys from vitals table first, then fall back to collect events
let senseKeys: string[] = [];
try {
// @ts-expect-error — accessing raw vitalsDb for key discovery
const vitalsDb = (store as any)._vitalsDb ?? (store as any).vitalsDb;
if (vitalsDb) {
const rows = vitalsDb
+1 -1
View File
@@ -46,7 +46,7 @@ function createTestConfig(baseDir: string): TestConfig {
}
describe('Pulse WebUI Server', () => {
let server: Server | null = null;
let server: Server<undefined> | null = null;
let baseUrl = '';
let testDir: string;
let config: TestConfig;
+4 -1
View File
@@ -189,7 +189,10 @@ function handleSenseKeys(config: UpulseConfig): Response {
// ── Server ─────────────────────────────────────────────────────
export function createUIServer(config: UpulseConfig, port: number): Server {
export function createUIServer(
config: UpulseConfig,
port: number,
): Server<undefined> {
return Bun.serve({
port,
hostname: '127.0.0.1',
+25 -10
View File
@@ -21,23 +21,38 @@ if (existsSync(hookPath)) {
const hook = `#!/bin/sh
# pulse-auto-hook — installed by scripts/install-hooks.mjs
# Runs lint + tests before pushing. Delete this file to disable.
# Runs lint + type-check + tests before pushing. Delete this file to disable.
set -e
ROOT=$(git rev-parse --show-toplevel)
echo "[pre-push] Running lint..."
bun x @biomejs/biome check packages/ || {
echo "\\n❌ Lint failed. Fix with: bun run lint:fix"
echo "\\\\n❌ Lint failed. Fix with: bun run lint:fix"
exit 1
}
echo "[pre-push] Running tests (pulse)..."
cd packages/pulse && bun test || {
echo "\\n❌ Tests failed (pulse)"
exit 1
}
echo "[pre-push] Type checking..."
for pkg in pulse upulse pulse-hermes pulse-cursor pulse-openclaw; do
if [ -f "$ROOT/packages/$pkg/tsconfig.json" ]; then
echo " tsc: $pkg"
(cd "$ROOT/packages/$pkg" && bun x tsc --noEmit) || {
echo "\\\\n❌ Type check failed ($pkg)"
exit 1
}
fi
done
echo "[pre-push] Running tests (pulse-hermes)..."
cd ../pulse-hermes && bun test || {
echo "\\n❌ Tests failed (pulse-hermes)"
echo "[pre-push] Running tests..."
for pkg in pulse pulse-hermes pulse-cursor pulse-openclaw; do
echo " test: $pkg"
(cd "$ROOT/packages/$pkg" && bun test) || {
echo "\\\\n❌ Tests failed ($pkg)"
exit 1
}
done
echo " test: upulse"
(cd "$ROOT/packages/upulse" && bun test src/config.test.ts) || {
echo "\\\\n❌ Tests failed (upulse)"
exit 1
}