Commit 223c3dc

Browse files
chore(ci): add and apply fmt:check script (#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)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

Commit 223c3dc

Browse files
chore(ci): add and apply fmt:check script (#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)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Commit 223c3dc

Browse files
chore(ci): add and apply fmt:check script (#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)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Commit 223c3dc

Browse files
chore(ci): add and apply fmt:check script (#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)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

Commit 223c3dc

Browse files
chore(ci): add and apply fmt:check script (#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)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Commit 223c3dc

Browse files
chore(ci): add and apply fmt:check script (#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)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Commit 223c3dc

Browse files
chore(ci): add and apply fmt:check script (#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)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

Commit 223c3dc

Browse files
chore(ci): add and apply fmt:check script (#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)