Skip to content

fix: write hooks to hooks.json#201

Open
benym wants to merge 44 commits into
masterfrom
fix/codex-hook-path
Open

fix: write hooks to hooks.json#201
benym wants to merge 44 commits into
masterfrom
fix/codex-hook-path

Conversation

@benym

@benym benym commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • route Codex project and global phase-guard hooks to the supported .codex/hooks.json file
  • safely migrate and uninstall only Comet-managed handlers from the legacy .codex/settings.local.json file while preserving user hooks, unknown fields, and matcher groups
  • harden hook matching for quoted Windows paths containing spaces and isolate per-file cleanup failures
  • update Bundle planning, regression coverage, and release metadata for 0.4.0-beta.5

Root cause

Codex reused the Claude-shaped hook format and therefore inherited Claude Code's default settings.local.json destination. Codex loads hooks from hooks.json, so globally or locally installed Comet guards were written to a file Codex did not read.

Impact

Existing Codex installs are migrated on init/update without overwriting invalid JSON or unrelated user configuration. Uninstall cleans both canonical and historical files, and failures in one file no longer prevent cleanup of the others.

Closes #199.

Validation

  • npx vitest run: 116 files passed, 1312 passed, 12 skipped
  • Codex hook regression set: 6 files, 248 tests passed
  • pnpm lint
  • pnpm build
  • Prettier check for all changed files
  • git diff --check

Summary by Sourcery

Fix Codex phase-guard hook installation and uninstall to use the canonical .codex/hooks.json file, safely migrate and clean up Comet-managed hooks from historical settings.local.json configurations, and update bundle planning, tests, and release metadata for version 0.4.0-beta.5.

Bug Fixes:

  • Route Codex project and global hooks to .codex/hooks.json and migrate existing Comet-managed entries from the legacy settings.local.json without altering user-defined configuration.
  • Improve managed hook detection to correctly handle quoted Windows paths with spaces and avoid failing hook installation or removal when individual files cannot be updated.

Enhancements:

  • Unify hook installation and uninstall logic for Claude-format platforms using configurable canonical and legacy hook files.
  • Adjust bundle planning so Codex hook disclosures target .codex/hooks.json while skill scripts remain under .agents.
  • Refine hook group merging to tolerate malformed entries and preserve empty groups and custom metadata during install/uninstall.

Documentation:

  • Update changelog for the 0.4.0-beta.5 release with Codex hook configuration fixes.

Tests:

  • Add regression tests covering Codex hook installation, migration from legacy settings files, uninstall behavior across canonical and historical files, Windows path handling, and bundle planning.
  • Update CLI help/version tests and init/update E2E tests to reflect the 0.4.0-beta.5 release and new Codex hook behavior.

Chores:

  • Bump package.json, package-lock.json, and assets manifest versions to 0.4.0-beta.5.

Summary by CodeRabbit

  • New Features
    • Codex hooks are now stored in .codex/hooks.json, with platform-aware hook config support.
    • Existing Comet-managed Codex hooks are safely migrated from legacy settings.local.json while preserving user-defined hooks.
  • Bug Fixes
    • /comet-open now enforces stricter split validation, recovery, and gating to prevent partially initialized outputs.
    • Hook installation/removal is more robust for quoted paths, malformed entries, and legacy configurations (including uninstall cleanup).
    • Improved Superpowers artifact write protection across phases and platforms.
  • Documentation
    • Updated Comet “Open” skill guidance for the new batch completion and recovery rules.

@sourcery-ai sourcery-ai 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.

Sorry @benym, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This release moves Codex hooks to .codex/hooks.json with legacy cleanup, makes /comet-open artifact generation and completion status-driven, and strengthens Superpowers artifact routing, phase guards, migration behavior, and benchmark coverage.

Changes

Codex hook migration

Layer / File(s) Summary
Platform hook paths
platform/install/platforms.ts, domains/bundle/bundle-platform.ts, test/domains/bundle/*, test/platform/detect.test.ts
Codex hook metadata and bundle planning target .codex/hooks.json while retaining legacy configuration paths.
Hook installation and migration
domains/skill/platform-install.ts, test/domains/skill/skills.test.ts
Installation safely parses, merges, migrates, and removes managed hooks while preserving unrelated entries and handling invalid or legacy JSON.
Hook uninstall cleanup
domains/skill/uninstall.ts, test/app/uninstall.test.ts
Uninstallation cleans canonical and legacy files and aggregates removals and write failures.
Release and validation
package.json, assets/manifest.json, CHANGELOG.md, test/app/*
Version metadata and migration expectations are updated to beta.5 and canonical Codex hook locations.

Comet Open workflow

Layer / File(s) Summary
Status-driven artifact generation
assets/skills*/comet-open/SKILL.md, test/domains/skill/*open*test.ts
Artifact creation follows OpenSpec ready states, instructions, resolved outputs, validation, and blocked-state reporting instead of a fixed document order.
Recovery and completion gating
assets/skills*/comet-open/SKILL.md, test/domains/skill/skills.test.ts
Batch progression and user confirmation require complete status graphs, done artifacts, non-empty outputs, and deterministic recovery for done, ready, and blocked states.

Superpowers artifact routing

Layer / File(s) Summary
Routing model and state loading
domains/comet-classic/classic-hook-guard.ts, assets/skills/comet/scripts/comet-runtime.mjs
Classic state loading, path comparison, and slot-based artifact matching determine governing changes and permitted first writes.
Blocked routing diagnostics
domains/comet-classic/classic-hook-guard.ts, assets/skills/comet/scripts/comet-runtime.mjs
Blocked responses describe phase mismatches, recorded artifacts, incomplete state, and unmatched paths.
Routing regression coverage
test/domains/comet-classic/*
Tests cover phase and slot gating, Windows path casing, selection requirements, standard writes, and read-only guard behavior.
Controlled benchmark validation
scripts/benchmark/classic-baseline-regression.mjs, test/scripts/classic-baseline-benchmark.test.ts
Benchmarks record migration-guard diagnostics and compare state before and after repeated hook-guard runs.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant CometOpen
  participant OpenSpec
  participant ArtifactFiles
  User->>CometOpen: start open workflow
  CometOpen->>OpenSpec: query artifact status
  OpenSpec-->>CometOpen: return ready or blocked artifacts
  CometOpen->>OpenSpec: fetch artifact instructions
  CometOpen->>ArtifactFiles: write and validate outputs
  CometOpen->>OpenSpec: recheck completion
  CometOpen-->>User: pause after complete integrity checks
Loading
sequenceDiagram
  participant WriteTool
  participant ClassicHookGuard
  participant ClassicState
  WriteTool->>ClassicHookGuard: submit Superpowers artifact write
  ClassicHookGuard->>ClassicState: read projected Classic state
  ClassicHookGuard->>ClassicHookGuard: match artifact slot and phase
  ClassicHookGuard-->>WriteTool: allow write or return blocked diagnostics
Loading

Possibly related PRs

  • rpamis/comet#78 — Related Claude-shaped hook installation and managed-command handling.
  • rpamis/comet#106 — Related managed-hook parsing, merging, and wiring changes.
  • rpamis/comet#164 — Related Classic hook-guard and Superpowers artifact routing changes.
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The PR also includes unrelated comet-open, classic hook-guard, benchmark, and test updates beyond the Codex hook location fix. Split the comet-open/classic/benchmark work into separate PRs and keep this change focused on Codex hooks.json installation and migration.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately summarizes the main change: routing Codex hooks to hooks.json.
Linked Issues check ✅ Passed The Codex hook installation changes satisfy #199 by writing user and global hooks to .codex/hooks.json and migrating legacy settings.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/codex-hook-path

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.

@benym benym changed the title fix(codex): write hooks to hooks.json fix: write hooks to hooks.json Jul 13, 2026
@benym benym marked this pull request as ready for review July 13, 2026 07:00
@greptile-apps

greptile-apps Bot commented Jul 13, 2026

Copy link
Copy Markdown

Greptile Summary

This PR fixes Codex hook installation and cleanup. The main changes are:

  • Route Codex phase-guard hooks to .codex/hooks.json.
  • Migrate Comet-managed legacy hooks from .codex/settings.local.json without rewriting unrelated user config.
  • Keep legacy hook cleanup best-effort during uninstall.
  • Report partial Skill, Rule, and Hook install or cleanup failures more consistently.
  • Update tests, release metadata, and bundled Skill content for 0.4.0-beta.5.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
domains/skill/platform-install.ts Adds canonical Codex hook installation, legacy hook migration, JSON-object validation, and managed hook command matching.
domains/skill/uninstall.ts Cleans canonical and legacy hook files while counting only canonical hook cleanup failures for Codex uninstall.
app/commands/uninstall.ts Reorders project cleanup so hook and rule cleanup run before Skill removal, with project cleanup gated on successful component cleanup.
domains/skill/platform-inspect.ts Adds Rule and Hook inspection for Doctor using expected managed command checks.
platform/install/platforms.ts Marks Codex hooks.json as the canonical hook file and settings.local.json as the legacy hook file.

Reviews (9): Last reviewed commit: "test: update classic contract projection" | Re-trigger Greptile

Comment thread domains/skill/platform-install.ts
@sourcery-ai

sourcery-ai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Reviewer's Guide

Codex phase-guard hooks are now written to .codex/hooks.json instead of settings.local.json, with robust migration and uninstall logic that only touches Comet-managed handlers, hardened command parsing for quoted Windows paths, bundle planning updated to use the new hook location, and release/test metadata bumped for 0.4.0-beta.5.

Sequence diagram for Codex hook install and migration

sequenceDiagram
  actor User
  participant comet_cli
  participant installCometHooksForPlatform
  participant installClaudeCodeHooks
  participant removeManagedHooksFromJsonFile

  User ->> comet_cli: run init_or_update
  comet_cli ->> installCometHooksForPlatform: installCometHooksForPlatform
  installCometHooksForPlatform ->> installClaudeCodeHooks: installClaudeCodeHooks(baseDir, platformBase, skillsDir, hooksConfig, hookConfigFile, strictJson)
  installClaudeCodeHooks ->> CodexHooksJson: write hooks to .codex/hooks.json
  installClaudeCodeHooks -->> installCometHooksForPlatform: { installed: true }
  installCometHooksForPlatform ->> removeManagedHooksFromJsonFile: removeManagedHooksFromJsonFile(platformBase/settings.local.json, Object.keys(hooksConfig))
  removeManagedHooksFromJsonFile ->> LegacySettingsLocalJson: remove Comet managed handlers only
  removeManagedHooksFromJsonFile -->> installCometHooksForPlatform: { removed, failed }
  installCometHooksForPlatform -->> comet_cli: { installed, reason? }
Loading

Sequence diagram for Codex hook uninstall across canonical and legacy files

sequenceDiagram
  actor User
  participant comet_cli
  participant removeCometHooksForPlatform
  participant removeManagedHooksFromJsonFile

  User ->> comet_cli: run uninstall
  comet_cli ->> removeCometHooksForPlatform: removeCometHooksForPlatform
  removeCometHooksForPlatform ->> removeManagedHooksFromJsonFile: removeManagedHooksFromJsonFile(.codex/hooks.json, scriptRelPaths)
  removeCometHooksFromJsonFile -->> removeCometHooksForPlatform: { removed, failed }
  removeCometHooksForPlatform ->> removeManagedHooksFromJsonFile: removeManagedHooksFromJsonFile(settings.local.json, scriptRelPaths)
  removeManagedHooksFromJsonFile -->> removeCometHooksForPlatform: { removed, failed }
  removeCometHooksForPlatform -->> comet_cli: { removed, failed }
Loading

Flow diagram for bundle hook destination selection

flowchart TD
  A[Platform.hookFormat == claude-code] --> B{platform.hookConfigFile set?}
  B -->|yes| C[hookDestination = configRoot/platform.hookConfigFile]
  B -->|no| D[hookDestination = configRoot/settings.local.json]
  A --> E[Other hook formats use their existing defaults]
Loading

File-Level Changes

Change Details Files
Route Codex hook installation to .codex/hooks.json and support platform-specific hook config files plus legacy cleanup.
  • Extend Platform metadata with hookConfigFile and legacyHookConfigFiles to describe canonical and historical hook config files.
  • Update installCometHooksForPlatform to pass a configurable JSON filename and call removeManagedHooksFromJsonFile on legacy files after successful installation.
  • Introduce removeManagedHooksFromJsonFile to selectively strip Comet-managed handlers from PreToolUse while preserving user hooks and group structure.
  • Wire Codex platform to use hooks.json as canonical and settings.local.json as legacy, and adjust detection tests accordingly.
platform/install/platforms.ts
domains/skill/platform-install.ts
domains/skill/uninstall.ts
test/platform/detect.test.ts
test/domains/skill/skills.test.ts
test/app/uninstall.test.ts
test/app/update.test.ts
test/app/init-e2e.test.ts
Harden managed hook detection and merging logic to cope with quoted Windows paths containing spaces and malformed hook groups.
  • Replace regex-based command parsing with parseCommandTokens that enforces simple shell-like tokenization, rejects shell metacharacters, and supports quoted arguments with spaces.
  • Adapt isManagedHookCommand to use parsed tokens and compare script basenames independent of extension.
  • Relax mergeHookGroups/asHookGroup to tolerate non-object and non-array entries, retain scalar markers, and only strip Comet-managed handlers while preserving group metadata and non-object handlers.
  • Update Windsurf hook merging to use the hardened isManagedHookCommand on handler.command extracted safely from possibly non-object entries.
domains/skill/platform-install.ts
domains/skill/uninstall.ts
test/domains/skill/skills.test.ts
test/app/uninstall.test.ts
Ensure uninstall and bundle planning handle multiple hook files and continue on per-file failures, and that Codex bundles plan hooks to hooks.json.
  • Refactor removeCometHooksForPlatform claude-code branch to iterate over canonical and legacy hook files via removeManagedHooksFromJsonFile, summing removed/failed counts instead of using a single settings.local.json.
  • Remove the old removeClaudeCodeHooks implementation in favor of the shared JSON cleanup helper.
  • In uninstall tests, add scenarios covering Codex canonical+legacy removal, quoted commands with spaces, and failure accounting when individual write operations fail.
  • Add getPlatformConfigDir usage and hookDestination logic so Codex bundle planning writes hooks to .codex/hooks.json while scripts remain under .agents.
domains/skill/uninstall.ts
domains/bundle/bundle-platform.ts
test/app/uninstall.test.ts
test/domains/bundle/bundle-platform.test.ts
Expand regression coverage for Codex hook migration and installation edge cases, including idempotency, malformed JSON, and legacy preservation.
  • Hoist and mock fs/promises.writeFile in skill and uninstall tests to simulate write failures without affecting other file operations.
  • Add Codex-focused tests for writing hooks.json, idempotent installs when paths contain spaces, preserving malformed entries and custom group metadata, migrating only Comet-managed hooks from legacy settings.local.json, and handling invalid canonical/legacy JSON without overwrites.
  • Verify that legacy Codex settings keep user-defined hooks and model fields after migration and that invalid JSON short-circuits strict Codex installs with a descriptive reason.
test/domains/skill/skills.test.ts
test/app/uninstall.test.ts
test/app/update.test.ts
test/app/init-e2e.test.ts
Update release/version metadata and CLI help expectations for 0.4.0-beta.5, including assets manifest alignment.
  • Bump package.json, package-lock.json, and assets/manifest.json versions from 0.4.0-beta.4 to 0.4.0-beta.5.
  • Adjust CLI help tests to assert the new version string in package.json, package-lock.json, and assets manifest.
  • Add a CHANGELOG entry describing the Codex hook configuration fix and linking to issue fix: codex hook安装错误 #199.
package.json
package-lock.json
assets/manifest.json
CHANGELOG.md
test/app/cli-help.test.ts

Assessment against linked issues

Issue Objective Addressed Explanation
#199 Ensure Codex hooks are installed to .codex/hooks.json instead of .codex/settings.local.json for both project and global installation scopes.
#199 Ensure Codex no longer relies on .codex/settings.local.json for hook loading so that installed hooks are discoverable by Codex.

Possibly linked issues

  • fix: codex hook安装错误 #199: PR changes Codex hook installation to .codex/hooks.json and migrates Comet-managed hooks from settings.local.json, fixing the reported bug.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai 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.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread domains/skill/platform-install.ts

@coderabbitai coderabbitai 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.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@assets/skills/comet-open/SKILL.md`:
- Around line 76-79: Update the `comet state check` invocation in the command
examples to use the established `node "$COMET_STATE"` wrapper, matching the
other state-command invocations while preserving the existing `<name> design`
arguments.

In `@docs/superpowers/plans/2026-07-13-standard-superpowers-artifact-routing.md`:
- Line 453: Correct the truncated variable assignment in the
blockedUnmatchedSuperpowersArtifact example by changing the right-hand-side
identifier from slo to slot, preserving the surrounding code unchanged.
- Around line 579-593: Correct the truncated verification commands in the
documented steps: update “pnpm lin” and “pnpm tes” to the complete lint and test
commands, and update “git status --shor” to “git status --short.”
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ef0c97a2-8dca-4a8f-8967-212e76c9de04

📥 Commits

Reviewing files that changed from the base of the PR and between 4a95629 and 424e25d.

📒 Files selected for processing (9)
  • CHANGELOG.md
  • assets/skills-zh/comet-open/SKILL.md
  • assets/skills/comet-open/SKILL.md
  • docs/superpowers/plans/2026-07-13-standard-superpowers-artifact-routing.md
  • docs/superpowers/specs/2026-07-13-standard-superpowers-artifact-routing-design.md
  • test/domains/skill/comet-open-batch-completion.test.ts
  • test/domains/skill/comet-open-english-batch-completion.test.ts
  • test/domains/skill/comet-open-recovery-semantics.test.ts
  • test/domains/skill/skills.test.ts

Comment thread assets/skills/comet-open/SKILL.md
Comment thread docs/superpowers/plans/2026-07-13-standard-superpowers-artifact-routing.md Outdated
Comment thread docs/superpowers/plans/2026-07-13-standard-superpowers-artifact-routing.md Outdated
Comment thread domains/skill/uninstall.ts Outdated
Comment thread domains/skill/platform-install.ts

@coderabbitai coderabbitai 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.

🧹 Nitpick comments (1)
test/app/uninstall.test.ts (1)

426-456: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Move this removeCometHooksForPlatform block out of test/app/uninstall.test.ts
This section exercises domain cleanup logic directly, so it belongs in test/domains/skill/. Keep test/app/ focused on app/ command and CLI behavior; the later uninstallCommand tests already cover that path.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/app/uninstall.test.ts` around lines 426 - 456, Move the tests that
directly exercise removeCometHooksForPlatform, including the malformed and
unreadable historical Codex hook cases, from test/app/uninstall.test.ts into the
appropriate test/domains/skill/ test file. Preserve their setup, assertions, and
coverage there, while keeping test/app/ focused on uninstall command and CLI
behavior.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@test/app/uninstall.test.ts`:
- Around line 426-456: Move the tests that directly exercise
removeCometHooksForPlatform, including the malformed and unreadable historical
Codex hook cases, from test/app/uninstall.test.ts into the appropriate
test/domains/skill/ test file. Preserve their setup, assertions, and coverage
there, while keeping test/app/ focused on uninstall command and CLI behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e0072db9-1ded-4f01-92c9-0cb0fef82e35

📥 Commits

Reviewing files that changed from the base of the PR and between cd89a88 and 6790ac3.

📒 Files selected for processing (3)
  • domains/skill/platform-install.ts
  • domains/skill/uninstall.ts
  • test/app/uninstall.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • domains/skill/uninstall.ts
  • domains/skill/platform-install.ts

@coderabbitai coderabbitai 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.

🧹 Nitpick comments (2)
domains/skill/platform-install.ts (2)

975-976: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Redundant reassignment of settings.hooks.

existingHooks is already settings.hooks (same reference from line 951), so line 976 is a no-op. Removing it would reduce confusion about whether a new object is being assigned.

♻️ Optional cleanup
  existingHooks.PreToolUse = filtered;
- settings.hooks = existingHooks;
  try {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@domains/skill/platform-install.ts` around lines 975 - 976, Remove the
redundant settings.hooks reassignment after updating existingHooks in the hook
configuration flow. Keep existingHooks.PreToolUse = filtered unchanged, since
existingHooks already references settings.hooks.

958-972: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Empty matcher groups are left in place after all managed hooks are removed.

When a group contains only managed hooks, after filtering it becomes { matcher: '...', hooks: [] }. The empty group (and an empty PreToolUse array if all groups are empty) persists in the written file. This is likely intentional to preserve structure, but if cleanup of empty groups is desired, it could be added after the filter pass.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@domains/skill/platform-install.ts` around lines 958 - 972, The filtering
logic leaves matcher groups with no remaining hooks in the persisted
configuration. Update the cleanup around the filtered existingPreToolUse groups
to remove groups whose resulting hooks array is empty, and ensure the enclosing
PreToolUse array is omitted or removed when all groups are eliminated while
preserving groups containing unmanaged hooks.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@domains/skill/platform-install.ts`:
- Around line 975-976: Remove the redundant settings.hooks reassignment after
updating existingHooks in the hook configuration flow. Keep
existingHooks.PreToolUse = filtered unchanged, since existingHooks already
references settings.hooks.
- Around line 958-972: The filtering logic leaves matcher groups with no
remaining hooks in the persisted configuration. Update the cleanup around the
filtered existingPreToolUse groups to remove groups whose resulting hooks array
is empty, and ensure the enclosing PreToolUse array is omitted or removed when
all groups are eliminated while preserving groups containing unmanaged hooks.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7adfda10-7148-4992-a029-59b3f8c066e2

📥 Commits

Reviewing files that changed from the base of the PR and between 6790ac3 and 2363b04.

📒 Files selected for processing (3)
  • domains/skill/platform-install.ts
  • domains/skill/uninstall.ts
  • test/app/uninstall.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • domains/skill/uninstall.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: codex hook安装错误

1 participant