refactor(hooks): follow-up improvements from PR #1069 - #1215
Conversation
- Add regression test for Factory Droid config isolation - Add documentation comments for Cursor identity mapping loops - Add event map completeness and Factory Droid naming assertions - Extract shared Pascal hooks converter to reduce duplication Closes dyoshikawa#1077
|
/opencode review |
This comment has been minimized.
This comment has been minimized.
|
@saitota Thank you. Please fix the points of the AI review. |
- Apply safeString validation to prompt field in HookDefinitionSchema - Escape regex special characters in projectDirVar for reverse conversion - Add direct unit tests for pascal-hooks-converter (29 test cases)
|
Fixed. PTAL
|
…limit Point 7 was a "Consider" suggestion, not a required fix.
| } | ||
| const config = rulesyncHooks.getJson(); | ||
| const claudeHooks = canonicalToClaudeHooks(config); | ||
| const claudeHooks = canonicalToPascalHooks({ |
There was a problem hiding this comment.
I'd say that the fact that for existing events simply converting the casing works is accidental. For some agents, the event names are completely different, and this might be the case for claude code or factorydroid if they add new events as well.
There was a problem hiding this comment.
Thank you. Renamed pascal-hooks-converter.ts → tool-hooks-converter.ts and related symbols (canonicalToPascalHooks → canonicalToToolHooks, etc.) to align with the existing canonicalToCopilotHooks naming pattern.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Address reviewer feedback: event name conversion uses explicit mapping tables, not algorithmic PascalCase conversion. Rename to align with existing canonicalToCopilotHooks/copilotHooksToCanonical pattern. - pascal-hooks-converter.ts → tool-hooks-converter.ts - PascalHooksConverterConfig → ToolHooksConverterConfig - canonicalToPascalHooks → canonicalToToolHooks - pascalHooksToCanonical → toolHooksToCanonical - Remove unnecessary `const entry = rawEntry` after type guard
This comment has been minimized.
This comment has been minimized.
PR Review Summary: PR #1215 - Hooks Conversion RefactoringCode Review Findings
Security Review Findings
Overall Assessment: The refactoring is well-executed with good security improvements applied. The most actionable items are:
|
Summary
pascal-hooks-converter.tsCloses #1077
References
Test plan