Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Tests

on:
pull_request:
push:
branches:
- main

permissions:
contents: read

jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.4.0

- name: Install dependencies
run: bun install --frozen-lockfile

- name: Typecheck
run: bun run typecheck

- name: Lint
run: bun run lint

- name: Build
run: bun run build

- name: Run tests
run: bun test
272 changes: 272 additions & 0 deletions bun.lock

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import js from "@eslint/js"
import { defineConfig } from "eslint/config"
import reactHooks from "eslint-plugin-react-hooks"
import reactRefresh from "eslint-plugin-react-refresh"
import globals from "globals"
import tseslint from "typescript-eslint"

export default defineConfig(
{ ignores: ["dist/**", "node_modules/**"] },
js.configs.recommended,
...tseslint.configs.recommended,
{
languageOptions: {
globals: {
...globals.browser,
...globals.node,
...globals.bun,
},
},
},
{
files: ["**/*.tsx"],
plugins: {
"react-hooks": reactHooks,
"react-refresh": reactRefresh,
},
rules: {
...reactHooks.configs.recommended.rules,
"react-refresh/only-export-components": ["warn", { allowConstantExport: true }],
},
},
)
11 changes: 9 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"scripts": {
"dev": "bun --hot src/collector/index.ts",
"test": "bun test",
"lint": "eslint .",
"typecheck": "tsc --noEmit",
"build": "bun build --target=bun --production --outdir=dist src/collector/index.ts src/plugin/index.ts",
"start": "bun dist/collector/index.js"
Expand All @@ -20,12 +21,18 @@
"zod": "^3"
},
"devDependencies": {
"@eslint/js": "^10.0.1",
"@tanstack/react-query-devtools": "^5",
"@types/bun": "^1",
"@types/react": "^19",
"@types/react-dom": "^19",
"bun-plugin-tailwind": "^0.1",
"eslint": "^10.10.0",
"eslint-plugin-react-hooks": "^7.1.1",
"eslint-plugin-react-refresh": "^0.5.6",
"globals": "^17.12.0",
"tailwindcss": "^4",
"typescript": "^5"
"typescript": "^5",
"typescript-eslint": "^8.70.0"
}
}
}
2 changes: 1 addition & 1 deletion src/collector/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ import { createServer } from "./server";
createServer({
hostname: "127.0.0.1",
port: 4747,
dashboard: dashboard as any,
dashboard,
});
2 changes: 1 addition & 1 deletion src/collector/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ async function mutateOpenCodeSession(
type CollectorConfig = {
hostname: string
port: number
dashboard: any
dashboard: Bun.HTMLBundle
}

export function createServer(config: CollectorConfig) {
Expand Down
8 changes: 4 additions & 4 deletions src/collector/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ const STALE_THRESHOLD_MS = 30_000

export const collectorInstanceId = crypto.randomUUID()

let processes = new Map<string, StoredProcess>()
let projects = new Map<string, StoredProject>()
let sessions = new Map<string, StoredSession>()
let subscribers = new Set<SseSubscriber>()
const processes = new Map<string, StoredProcess>()
const projects = new Map<string, StoredProject>()
const sessions = new Map<string, StoredSession>()
const subscribers = new Set<SseSubscriber>()
let receivedGlobalSnapshot = false

export function isReconciliationRequired() {
Expand Down
Loading