Skip to content

Add desktop hooks settings UI / 添加桌面端 Hooks 设置界面#4118

Merged
esengine merged 3 commits into
main-v2from
feature/hooks-settings-ui
Jun 12, 2026
Merged

Add desktop hooks settings UI / 添加桌面端 Hooks 设置界面#4118
esengine merged 3 commits into
main-v2from
feature/hooks-settings-ui

Conversation

@SivanCola

Copy link
Copy Markdown
Collaborator

Summary

  • Add a desktop Hooks settings page for global and project scopes, including settings path display, project trust state, and direct JSON copy/paste/format/save.
  • Add Wails bindings for reading, saving, and trusting Hooks settings with an explicit workspace root.
  • Add /hooks trust support in the CLI/controller path and regression coverage for the trust behavior.

Safety

  • Project hook trust remains stored in user-global state, not in the project settings file.
  • The desktop trust action uses the workspace root shown in the settings view, avoiding ambiguity when multiple projects are open.

Verification

  • wails generate module
  • go test from the desktop package
  • go test ./internal/hook
  • go test ./internal/control with an isolated HOME
  • pnpm --dir desktop/frontend typecheck
  • pnpm --dir desktop/frontend check:css
  • git diff --check

@SivanCola SivanCola requested a review from esengine as a code owner June 12, 2026 04:08
@github-actions github-actions Bot added v2 Go rewrite (1.x) — main-v2 branch, active development desktop Wails desktop app (desktop/**) agent Core agent loop (internal/agent, internal/control) labels Jun 12, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 691dfc8e3c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

try {
const parsed = parseHooksEditorJSON();
if (!parsed) return;
await app.SaveHooksSettings(scope, parsed.hooks);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Pass the displayed project root when saving hooks

When the project hooks page has loaded for workspace A and the active tab changes before Save (for example via global shortcuts/palette while the settings modal remains open), this call only sends scope, so the Go binding recomputes activeHookProjectRoot() and can write the edited JSON into workspace B's .reasonix/settings.json while the UI still shows A's path/root. The trust flow already passes the displayed projectRoot; saving project hooks needs the same root/path to avoid modifying the wrong workspace.

Useful? React with 👍 / 👎.

@SivanCola

Copy link
Copy Markdown
Collaborator Author

Fixed the Windows CI failure in 211aa26.

Root cause:

  • The new hook trust test isolated HOME but not USERPROFILE; Windows os.UserHomeDir() reads USERPROFILE, so the test wrote and read different trust stores.

What changed:

  • The test now sets both HOME and USERPROFILE to the same temporary home before exercising /hooks trust.

Verified:

  • go test ./internal/control with isolated home passed locally.
  • go test from the desktop package passed locally.
  • pnpm --dir desktop/frontend typecheck passed locally.
  • pnpm --dir desktop/frontend check:css passed locally.
  • GitHub CI is now green, including test (windows-latest).

SaveHooksSettings recomputed the active project root, so switching the
active tab while the hooks settings modal stayed open could write the
edited JSON into a different workspace's settings.json than the one
shown. Add a root-aware SaveHooksSettingsForRoot mirroring the trust
flow, and pass the displayed projectRoot from the settings UI.
@esengine

Copy link
Copy Markdown
Owner

Thanks @SivanCola — really solid hooks settings UI. The binding contract (interface + dev mock kept in sync) and the trust model (project trust in global state, no auto-trust on save) are exactly right, and the test coverage is great.

I pushed one follow-up commit before merging: SaveHooksSettings recomputed the active project root, so the codex note is right — switching the active tab while the settings modal stayed open could write the edited JSON into the wrong workspace. Added a root-aware SaveHooksSettingsForRoot mirroring your TrustProjectHooksForRoot, and the UI now passes the displayed projectRoot on save, with a regression test. Merging once CI is green.

@esengine esengine merged commit e3771b8 into main-v2 Jun 12, 2026
13 checks passed
@esengine esengine deleted the feature/hooks-settings-ui branch June 12, 2026 05:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent Core agent loop (internal/agent, internal/control) desktop Wails desktop app (desktop/**) v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants