Skip to content

feat(settings): add global hooks panel - #1154

Open
taltas wants to merge 2 commits into
fm/zoo-hooks-contractsfrom
fm/zoo-hooks-settings
Open

feat(settings): add global hooks panel#1154
taltas wants to merge 2 commits into
fm/zoo-hooks-contractsfrom
fm/zoo-hooks-settings

Conversation

@taltas

@taltas taltas commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Stack

This is 2 of 4 in the Zoo Code hooks MVP stack. Review and merge from the bottom upward. Do not merge this PR until #1153 is merged.

Position Pull request Base Scope
1 #1153 main Hook contracts and policies
2 (this PR) #1154 fm/zoo-hooks-contracts Global settings and Hooks panel
3 #1156 fm/zoo-hooks-settings Runner and sessionStart integration
4 #1155 fm/zoo-hooks-session-start preToolUse, E2E, and documentation

Summary

Add the complete persisted-settings round trip and a dedicated Hooks settings panel, while keeping unsaved edits isolated in SettingsView.cachedState.

Scope

  • Add hookDefinitions to global settings, extension state, ContextProxy, and ClineProvider state returned to the webview.
  • Validate updates atomically in webviewMessageHandler; malformed definitions are rejected without partially persisting data.
  • Exclude executable hook configuration from settings import/export because commands are machine-local and security-sensitive.
  • Add a searchable, deep-linkable Hooks panel for adding, editing, enabling, disabling, and removing definitions.
  • Bind all controls to local cachedState and persist only through the existing explicit Save flow.
  • Add localized settings copy for every supported locale.
  • Test schema persistence, webview round trips, malformed payload rejection, import/export exclusion, and cached-state UI behavior.

Settings Flow

flowchart LR
    A[Hooks panel controls] --> B[SettingsView cachedState]
    B -->|Save| C[updateSettings message]
    C --> D[Atomic schema validation]
    D -->|valid| E[ContextProxy persistence]
    D -->|invalid| F[Localized error, no write]
    E --> G[ClineProvider state]
    G --> H[Webview refresh]
    H --> B
Loading

Tests

  • packages/types/src/__tests__/hooks.test.ts
  • src/core/config/__tests__/ContextProxy.spec.ts
  • src/core/config/__tests__/importExport.spec.ts
  • src/core/webview/__tests__/ClineProvider.spec.ts
  • src/core/webview/__tests__/webviewMessageHandler.spec.ts
  • webview-ui/src/components/settings/__tests__/HooksSettings.spec.tsx
  • webview-ui/src/components/settings/__tests__/SettingsView.spec.tsx
  • Focused settings coverage validation: 29 tests passed; HooksSettings.tsx reached 95.08% line coverage.
  • Full stack validation at the top branch: pnpm test (437 files passed, 7,356 tests passed, 39 skipped).
  • Full stack validation at the top branch: pnpm check-types, pnpm lint, and pnpm build passed.
  • Full stack VS Code smoke validation: USE_MOCK=true TEST_FILE=hooks.test pnpm --filter @roo-code/vscode-e2e test:run passed.

Risks

  • Hook commands can execute local programs, so import/export intentionally does not transport them between machines.
  • Settings controls must remain bound to cachedState; binding them to live extension state would reintroduce save races and discarded edits.
  • Atomic validation rejects the entire hook list if any entry is malformed. This favors predictable persisted state over partial recovery.
  • Localization touches every supported settings locale, but only adds the new Hooks namespace content.

Review Notes

  • The unique diff is against fm/zoo-hooks-contracts, not main.
  • Additive follow-up 8089b3c4a fixes the malformed-payload test type and expands panel interaction coverage; no published history was rewritten.
  • No hook process is executed in this layer.
  • No changeset is included, per repository guidance.
  • Merge order is #1153 -> #1154 -> #1156 -> #1155.

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 7dbf6300-c29e-4218-a869-91855c94c319

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.88889% with 11 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...bview-ui/src/components/settings/HooksSettings.tsx 88.88% 3 Missing and 5 partials ⚠️
src/core/webview/webviewMessageHandler.ts 88.88% 0 Missing and 2 partials ⚠️
src/core/webview/ClineProvider.ts 50.00% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@github-actions github-actions Bot added the awaiting-review PR changes are ready and waiting for maintainer re-review label Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-review PR changes are ready and waiting for maintainer re-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant