Skip to content

Commit 223c3dc

Browse files
chore(ci): add and apply fmt:check script (pingdotgg#779)
* Add formatting conventions * Add a fmt lint check * rely on defaults --------- Co-authored-by: Julius Marminge <julius0216@outlook.com>
1 parent afb6e89 commit 223c3dc

106 files changed

Lines changed: 2137 additions & 1868 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
jobs:
1010
quality:
11-
name: Lint, Typecheck, Test, Browser Test, Build
11+
name: Format, Lint, Typecheck, Test, Browser Test, Build
1212
runs-on: blacksmith-4vcpu-ubuntu-2404
1313
steps:
1414
- name: Checkout
@@ -45,6 +45,9 @@ jobs:
4545
- name: Install dependencies
4646
run: bun install --frozen-lockfile
4747

48+
- name: Format
49+
run: bun run fmt:check
50+
4851
- name: Lint
4952
run: bun run lint
5053

.oxfmtrc.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"node_modules",
88
"bun.lock",
99
"*.tsbuildinfo",
10-
"**/routeTree.gen.ts"
10+
"**/routeTree.gen.ts",
11+
"apps/web/public/mockServiceWorker.js"
1112
],
12-
"experimentalSortPackageJson": {}
13+
"sortPackageJson": {}
1314
}

.plans/01-shared-model-normalization.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
# Plan: Centralize Model Normalization in Contracts
22

33
## Summary
4+
45
Move model alias/default normalization into `packages/contracts` so desktop and renderer use one shared source of truth.
56

67
## Motivation
8+
79
- Removes duplicated logic between:
810
- `apps/desktop/src/codexAppServerManager.ts`
911
- `apps/renderer/src/model-logic.ts`
1012
- Prevents behavior drift when model aliases/defaults are updated.
1113

1214
## Scope
15+
1316
- Add shared model utilities to contracts.
1417
- Update desktop and renderer to consume shared utilities.
1518
- Keep renderer-specific display options in renderer.
1619

1720
## Proposed Changes
21+
1822
1. Add `packages/contracts/src/model.ts` with:
1923
- Canonical model list
2024
- Alias map
@@ -29,14 +33,17 @@ Move model alias/default normalization into `packages/contracts` so desktop and
2933
- Keep renderer tests focused on renderer-only behavior.
3034

3135
## Risks
36+
3237
- Desktop/renderer may currently rely on slightly different fallback behavior.
3338
- Import graph must avoid bundling issues for Electron main/preload.
3439

3540
## Validation
41+
3642
- `bun run test`
3743
- `bun run typecheck`
3844
- Manual check that model selection and session start still send expected model slug.
3945

4046
## Done Criteria
47+
4148
- No duplicated alias/default map in desktop and renderer.
4249
- Shared model utilities are contract-tested.

.plans/02-typed-ipc-boundaries.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
# Plan: Strengthen Typed IPC Boundaries in Main Process
22

33
## Summary
4+
45
Replace loose payload casting in IPC handlers with strict schema parsing and typed helper wrappers.
56

67
## Motivation
8+
79
- `apps/desktop/src/main.ts` currently uses casts like `payload as Parameters<...>`.
810
- Casts can hide contract breakages until runtime.
911

1012
## Scope
13+
1114
- Desktop main process IPC registration.
1215
- Optional shared helper for handler registration.
1316

1417
## Proposed Changes
18+
1519
1. Add IPC helper utility (e.g. `apps/desktop/src/ipcHelpers.ts`) to:
1620
- Parse payload(s) with Zod schemas
1721
- Standardize typed handler signatures
@@ -24,14 +28,17 @@ Replace loose payload casting in IPC handlers with strict schema parsing and typ
2428
4. Add tests for handler parsing failure paths (invalid payloads).
2529

2630
## Risks
31+
2732
- Refactor can subtly change IPC error shape/messages.
2833
- Helper abstraction should stay simple and not obscure control flow.
2934

3035
## Validation
36+
3137
- `bun run test`
3238
- `bun run typecheck`
3339
- Manual invalid payload check from renderer/devtools to confirm fast failure.
3440

3541
## Done Criteria
42+
3643
- No provider handler uses `payload as Parameters<...>`.
3744
- All IPC entrypoints parse unknown payloads at boundary.

.plans/03-split-codex-app-server-manager.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# Plan: Decompose CodexAppServerManager
22

33
## Summary
4+
45
Split `CodexAppServerManager` into smaller modules with clear responsibilities.
56

67
## Motivation
8+
79
- `apps/desktop/src/codexAppServerManager.ts` is large and mixes:
810
- Process lifecycle
911
- JSON-RPC parsing/routing
@@ -12,10 +14,12 @@ Split `CodexAppServerManager` into smaller modules with clear responsibilities.
1214
- This increases regression risk and slows changes.
1315

1416
## Scope
17+
1518
- Desktop provider internals only.
1619
- Keep external behavior/API stable.
1720

1821
## Proposed Changes
22+
1923
1. Extract modules:
2024
- `codex/processLifecycle.ts`
2125
- `codex/jsonrpcRouter.ts`
@@ -29,13 +33,16 @@ Split `CodexAppServerManager` into smaller modules with clear responsibilities.
2933
- Session state transitions
3034

3135
## Risks
36+
3237
- Reordering event handling can change behavior.
3338
- Must preserve pending request timeout/cancellation semantics.
3439

3540
## Validation
41+
3642
- Existing tests pass.
3743
- Add module-level tests for parsing and transition logic.
3844

3945
## Done Criteria
46+
4047
- Main manager file materially smaller and orchestration-focused.
4148
- Core protocol/state logic covered by focused tests.

.plans/04-split-chatview-component.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# Plan: Split ChatView into Smaller UI/Logic Units
22

33
## Summary
4+
45
Refactor `ChatView.tsx` into composable pieces with isolated responsibilities.
56

67
## Motivation
8+
79
- `apps/renderer/src/components/ChatView.tsx` is large and handles:
810
- Session orchestration
911
- Send/interrupt actions
@@ -13,10 +15,12 @@ Refactor `ChatView.tsx` into composable pieces with isolated responsibilities.
1315
- Hard to test and maintain as one component.
1416

1517
## Scope
18+
1619
- Renderer component boundaries and hooks.
1720
- Keep visual behavior unchanged.
1821

1922
## Proposed Changes
23+
2024
1. Create hook: `apps/renderer/src/hooks/useChatSession.ts`
2125
- `ensureSession`
2226
- `sendTurn`
@@ -29,12 +33,15 @@ Refactor `ChatView.tsx` into composable pieces with isolated responsibilities.
2933
4. Add focused tests for hook behavior (error handling, session reuse).
3034

3135
## Risks
36+
3237
- Refactor can break subtle UI interactions (auto-scroll, menu close, keyboard send).
3338

3439
## Validation
40+
3541
- `bun run test`
3642
- Manual smoke: send, stream, interrupt, model switch.
3743

3844
## Done Criteria
45+
3946
- `ChatView.tsx` significantly reduced and easier to scan.
4047
- Session logic isolated from rendering.

.plans/05-zod-persisted-state-validation.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
# Plan: Move Renderer Persisted-State Validation to Zod
22

33
## Summary
4+
45
Use explicit Zod schemas for localStorage state parsing and migration.
56

67
## Motivation
8+
79
- `apps/renderer/src/store.ts` has large manual sanitize functions.
810
- Manual type guards are verbose and easier to get wrong during schema evolution.
911

1012
## Scope
13+
1114
- Renderer state hydration/persistence path.
1215
- No backend/protocol changes.
1316

1417
## Proposed Changes
18+
1519
1. Add schema module: `apps/renderer/src/persistenceSchema.ts`
1620
- Persisted payload versions (`v1`, `v2`)
1721
- Thread/message/project schemas
@@ -23,12 +27,15 @@ Use explicit Zod schemas for localStorage state parsing and migration.
2327
- Unknown thread/project references filtered
2428

2529
## Risks
30+
2631
- Overly strict schemas could drop valid historical data unexpectedly.
2732

2833
## Validation
34+
2935
- Unit tests for migration/hydration.
3036
- Manual reload test with existing localStorage data.
3137

3238
## Done Criteria
39+
3340
- Store hydration logic is schema-driven.
3441
- Migration behavior is tested and documented.

.plans/06-provider-logstream-lifecycle.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
# Plan: Add Provider Log Stream Lifecycle Management
22

33
## Summary
4+
45
Ensure `ProviderManager` logging stream is initialized, rotated/structured, and closed safely.
56

67
## Motivation
8+
79
- `apps/desktop/src/providerManager.ts` opens a write stream in constructor.
810
- Stream lifecycle is not explicit on shutdown.
911

1012
## Scope
13+
1114
- Desktop provider logging behavior.
1215
- App shutdown integration.
1316

1417
## Proposed Changes
18+
1519
1. Add explicit `dispose()` on `ProviderManager`:
1620
- Remove event listeners
1721
- End/close log stream
@@ -20,12 +24,15 @@ Ensure `ProviderManager` logging stream is initialized, rotated/structured, and
2024
4. Optional: per-session log files under `.logs/providers/`.
2125

2226
## Risks
27+
2328
- Improper close sequencing may lose final log lines.
2429

2530
## Validation
31+
2632
- Manual run/quit cycle to ensure no open handle warnings.
2733
- Confirm logs flush on quit and file descriptors are not leaked.
2834

2935
## Done Criteria
36+
3037
- ProviderManager owns complete log stream lifecycle.
3138
- Shutdown path explicitly disposes provider resources.

.plans/07-ci-quality-gates.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
# Plan: Add CI Workflow for Core Quality Gates
22

33
## Summary
4+
45
Add GitHub Actions workflow to run lint/typecheck/test (and optionally smoke-test) on pushes and PRs.
56

67
## Motivation
8+
79
- Repository currently has no CI workflow files.
810
- Quality checks are only local/manual.
911

1012
## Scope
13+
1114
- `.github/workflows/ci.yml`
1215
- Bun + Turbo setup in CI.
1316

1417
## Proposed Changes
18+
1519
1. Add `ci.yml` with jobs:
1620
- Setup Bun and Node environment
1721
- Install deps
@@ -22,13 +26,16 @@ Add GitHub Actions workflow to run lint/typecheck/test (and optionally smoke-tes
2226
3. Configure caching for Bun/Turbo as appropriate.
2327

2428
## Risks
29+
2530
- Smoke test may be flaky in headless CI environments.
2631
- CI runtime can grow if caching is misconfigured.
2732

2833
## Validation
34+
2935
- Verify workflow runs on a branch PR.
3036
- Ensure failures surface clearly by job name.
3137

3238
## Done Criteria
39+
3340
- CI blocks regressions in lint/typecheck/test.
3441
- Workflow docs added to README.

.plans/08-precommit-format-and-lint.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
# Plan: Add Pre-Commit Formatting/Lint Hooks
22

33
## Summary
4+
45
Introduce pre-commit automation so formatting and basic lint checks happen before commits.
56

67
## Motivation
8+
79
- Current lint failures include formatting-only issues.
810
- Shift-left feedback reduces noisy CI failures and cleanup churn.
911

1012
## Scope
13+
1114
- Root tooling config and package scripts.
1215
- No runtime code changes.
1316

1417
## Proposed Changes
18+
1519
1. Add hook tooling (e.g. Husky + lint-staged or Lefthook).
1620
2. Configure staged-file tasks:
1721
- `biome format --write`
@@ -20,13 +24,16 @@ Introduce pre-commit automation so formatting and basic lint checks happen befor
2024
4. Keep checks fast to avoid developer friction.
2125

2226
## Risks
27+
2328
- Slow hooks can frustrate contributors and be bypassed.
2429
- Need to ensure compatibility with Bun workspace setup.
2530

2631
## Validation
32+
2733
- Create sample staged changes and verify hook behavior.
2834
- Confirm formatting fixes are applied automatically.
2935

3036
## Done Criteria
37+
3138
- Pre-commit hook installed and documented.
3239
- Formatting-only lint failures drop significantly.

0 commit comments

Comments
 (0)