diff --git a/.husky/pre-commit b/.husky/pre-commit old mode 100644 new mode 100755 index a04a981..3081b0d --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,3 +1,14 @@ +#!/bin/sh + +# Prevent commits on main branch +BRANCH=$(git rev-parse --abbrev-ref HEAD) +if [ "$BRANCH" = "main" ]; then + echo "🚫 Direct commits to main branch are not allowed." + echo "Please create a feature branch first:" + echo " git checkout -b feature/your-feature-name" + exit 1 +fi + npm run lint npm run typecheck -npm run test:unit -- --coverage +npm run test:unit -- --coverage \ No newline at end of file diff --git a/opencode/plans/feat-config.md b/opencode/plans/feat-config.md deleted file mode 100644 index 0fa952c..0000000 --- a/opencode/plans/feat-config.md +++ /dev/null @@ -1,19 +0,0 @@ -# Plan: Persistent Configuration - -- **Feature**: Persistent user settings (volume, color scheme). -- **Branch**: `feature/persistent-config` -- **Status**: `Completed` -- **Summary**: This plan covers loading user settings from a global configuration file on startup and saving them when they are changed. It introduces one new dependency. - ---- - -### Checklist - -- `[ ]` **(Mandatory)** Install `env-paths` dependency to locate the config directory. -- `[ ]` **(Mandatory)** Create `src/config.ts` module with functions for loading and saving `settings.json`. -- `[ ]` **(Mandatory)** Refactor `DoroApp` and `cli.ts` to support asynchronous startup. -- `[ ]` **(Mandatory)** Integrate config loading into `DoroApp` to initialize with saved settings. -- `[ ]` **(Mandatory)** Refactor `DoroUi` to be stateless regarding its color scheme. -- `[ ]` **(Mandatory)** Update `DoroApp` handlers to save settings when they are changed by the user. -- `[ ]` **(Mandatory)** Add a "Reset Settings" command (`Shift+R`). -- `[ ]` **(Mandatory)** Verify changes by running the type checker and unit tests. diff --git a/opencode/plans/feat-stats.md b/opencode/plans/feat-stats.md index ae6a2b6..4780092 100644 --- a/opencode/plans/feat-stats.md +++ b/opencode/plans/feat-stats.md @@ -3,15 +3,16 @@ - **Feature**: Usage statistics collection and display. - **Branch**: `feature/usage-stats` - **Status**: `Pending` +- **Depends On**: N/A - **Summary**: This plan covers recording session statistics to a local file with protection against race conditions from concurrent instances. It adds a new `--stats` command to display the data. It introduces one new dependency. --- ### Checklist -- `[ ]` **(Mandatory)** Install `proper-lockfile` dependency to manage concurrent file access. -- `[ ]` **(Mandatory)** Create `src/stats.ts` module with file-locking logic for reading and writing `stats.json`. -- `[ ]` **(Mandatory)** Integrate session recording into `DoroApp`, calling the stats module upon session completion. -- `[ ]` **(Mandatory)** Add `--stats` flag handling to `src/cli.ts` to trigger the stats view. -- `[ ]` **(Mandatory)** Create `src/stats-ui.ts` to render the statistics in a clean, responsive, full-screen view. -- `[ ]` **(Mandatory)** Verify changes by running the type checker and adding new unit tests for the stats logic. +- [ ] **(Mandatory)** Install `proper-lockfile` dependency to manage concurrent file access. +- [ ] **(Mandatory)** Create `src/stats.ts` module with file-locking logic for reading and writing `stats.json`. +- [ ] **(Mandatory)** Integrate session recording into `DoroApp`, calling the stats module upon session completion. +- [ ] **(Mandatory)** Add `--stats` flag handling to `src/cli.ts` to trigger the stats view. +- [ ] **(Mandatory)** Create `src/stats-ui.ts` to render the statistics in a clean, responsive, full-screen view. +- [ ] **(Mandatory)** Verify changes by running the type checker and adding new unit tests for the stats logic. diff --git a/opencode/plans/fix-pause-audio.md b/opencode/plans/fix-pause-audio.md deleted file mode 100644 index df21974..0000000 --- a/opencode/plans/fix-pause-audio.md +++ /dev/null @@ -1,18 +0,0 @@ -# Plan: Fix Pause Audio Interruption and Transition Behavior - -- **Feature**: Improve pause behavior to interrupt audio and handle transition period correctly -- **Branch**: `fix/pause-audio-transition` -- **Status**: `Completed` -- **Depends On**: N/A -- **Summary**: Fix two pause-related issues: (1) pause should stop currently playing audio, and (2) pause during transition should confirm next mode but leave timer paused instead of running. No new dependencies required. - ---- - -### Checklist - -- [x] **(Mandatory)** Update `pauseResume` handler in `src/app.ts` to call `stopPlayback()` when transitioning from running to paused -- [x] **(Mandatory)** Add special handling for `pauseResume` during `switchPrompt` state to confirm transition and immediately pause -- [x] **(Mandatory)** Suppress start sound when pause is used during transition (option 2 from user choice) -- [x] **(Mandatory)** Add test for audio interruption on pause -- [x] **(Mandatory)** Add test for pause during transition behavior -- [x] **(Mandatory)** Verify changes by running the type checker and unit tests diff --git a/opencode/plans/ui-themes.md b/opencode/plans/ui-themes.md index ce8db3d..34293d3 100644 --- a/opencode/plans/ui-themes.md +++ b/opencode/plans/ui-themes.md @@ -3,18 +3,17 @@ - **Feature**: Premium UI theme system with multiple palettes and user selection. - **Branch**: `feature/ui-themes` - **Status**: `Pending` -- **Depends On**: `feat-config.md` -- **Summary**: Introduce a theme manager, add two extra default themes, and persist the selection via config. +- **Depends On**: N/A (config system already implemented) +- **Summary**: Introduce a theme manager, add two extra default themes, and persist the selection via config. Extends existing color scheme system from 2 to 4 themes. --- ### Checklist -- [ ] Install `chalk` v5. -- [ ] Create `src/theme.ts` with registry for `modern`, `calm`, `vivid`, `monochrome` palettes. -- [ ] Refactor UI components to use theme tokens. -- [ ] Add `--theme` CLI flag. -- [ ] Implement keyboard shortcut `c` to toggle themes. -- [ ] Update config handling to persist selected theme (depends on `feat-config` plan). -- [ ] Write unit tests for theme manager. -- [ ] Document usage and customization. +- [ ] **(Mandatory)** Create `src/theme.ts` with registry for `modern`, `calm`, `vivid`, `monochrome` palettes. +- [ ] **(Mandatory)** Refactor UI components to use theme tokens from theme manager. +- [ ] **(Mandatory)** Add `--theme` CLI flag for setting theme at startup. +- [ ] **(Mandatory)** Update config handling to persist selected theme (extends existing colorScheme field). +- [ ] **(Mandatory)** Write unit tests for theme manager. +- [ ] **(Optional)** Document usage and customization. +- [ ] **(Mandatory)** Verify changes by running the type checker and unit tests. diff --git a/opencode/plans/vrt.md b/opencode/plans/vrt.md deleted file mode 100644 index 18cb709..0000000 --- a/opencode/plans/vrt.md +++ /dev/null @@ -1,27 +0,0 @@ -# Plan: Visual Regression Tests - -- **Feature**: Add pixel-perfect visual regression testing for the terminal UI using Playwright, node-pty, and xterm.js, integrated into GitHub Actions. -- **Branch**: `feature/visual-regression-tests` -- **Status**: `Pending` -- **Depends On**: None -- **Summary**: This plan covers installing necessary dependencies, creating an HTML harness for xterm.js, writing the Playwright test script to capture initial and post-interaction states, and setting up the CI workflow. - -### Dependencies & Roles - -| Dependency | Role | Documentation | -| :--- | :--- | :--- | -| [`@playwright/test`](https://playwright.dev/) | Test runner and browser automation framework. | [Docs](https://playwright.dev/docs/intro) | -| [`node-pty`](https://github.com/microsoft/node-pty) | Spawns pseudoterminals to run the CLI in a realistic environment. | [GitHub](https://github.com/microsoft/node-pty) | -| [`xterm`](https://xtermjs.org/) | Terminal emulator used to render PTY output in the browser harness. | [Docs](https://xtermjs.org/docs/) | - - ---- - -### Checklist - -- [ ] **(Mandatory)** Install `@playwright/test`, `node-pty`, and `xterm` as dev dependencies, and install Playwright browsers. -- [ ] **(Mandatory)** Create `tests/terminal.html` to host the xterm.js terminal instance. -- [ ] **(Mandatory)** Create `tests/visual.spec.ts` to spawn the CLI via node-pty, pipe output to the browser, interact with it, and take screenshots. -- [ ] **(Mandatory)** Add GitHub Actions workflow `.github/workflows/visual-tests.yml` to run Playwright tests on push and pull requests. -- [ ] **(Optional)** Add npm scripts for running visual tests locally (e.g., `test:visual`). -- [ ] **(Mandatory)** Verify changes by running the type checker and unit tests.