oh-my-claude-sisyphus 1.4.1 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/document-writer.d.ts +11 -0
- package/dist/agents/document-writer.d.ts.map +1 -0
- package/dist/agents/document-writer.js +209 -0
- package/dist/agents/document-writer.js.map +1 -0
- package/dist/agents/explore.d.ts +12 -0
- package/dist/agents/explore.d.ts.map +1 -0
- package/dist/agents/explore.js +103 -0
- package/dist/agents/explore.js.map +1 -0
- package/dist/agents/frontend-engineer.d.ts +11 -0
- package/dist/agents/frontend-engineer.d.ts.map +1 -0
- package/dist/agents/frontend-engineer.js +115 -0
- package/dist/agents/frontend-engineer.js.map +1 -0
- package/dist/agents/index.d.ts +17 -1
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +21 -1
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/librarian.d.ts +12 -0
- package/dist/agents/librarian.d.ts.map +1 -0
- package/dist/agents/librarian.js +103 -0
- package/dist/agents/librarian.js.map +1 -0
- package/dist/agents/metis.d.ts +12 -0
- package/dist/agents/metis.d.ts.map +1 -0
- package/dist/agents/metis.js +117 -0
- package/dist/agents/metis.js.map +1 -0
- package/dist/agents/momus.d.ts +12 -0
- package/dist/agents/momus.d.ts.map +1 -0
- package/dist/agents/momus.js +128 -0
- package/dist/agents/momus.js.map +1 -0
- package/dist/agents/multimodal-looker.d.ts +11 -0
- package/dist/agents/multimodal-looker.d.ts.map +1 -0
- package/dist/agents/multimodal-looker.js +70 -0
- package/dist/agents/multimodal-looker.js.map +1 -0
- package/dist/agents/oracle.d.ts +13 -0
- package/dist/agents/oracle.d.ts.map +1 -0
- package/dist/agents/oracle.js +149 -0
- package/dist/agents/oracle.js.map +1 -0
- package/dist/agents/orchestrator-sisyphus.d.ts +11 -0
- package/dist/agents/orchestrator-sisyphus.d.ts.map +1 -0
- package/dist/agents/orchestrator-sisyphus.js +115 -0
- package/dist/agents/orchestrator-sisyphus.js.map +1 -0
- package/dist/agents/prometheus.d.ts +12 -0
- package/dist/agents/prometheus.d.ts.map +1 -0
- package/dist/agents/prometheus.js +156 -0
- package/dist/agents/prometheus.js.map +1 -0
- package/dist/agents/sisyphus-junior.d.ts +12 -0
- package/dist/agents/sisyphus-junior.d.ts.map +1 -0
- package/dist/agents/sisyphus-junior.js +93 -0
- package/dist/agents/sisyphus-junior.js.map +1 -0
- package/dist/agents/types.d.ts +120 -0
- package/dist/agents/types.d.ts.map +1 -0
- package/dist/agents/types.js +38 -0
- package/dist/agents/types.js.map +1 -0
- package/dist/agents/utils.d.ts +49 -0
- package/dist/agents/utils.d.ts.map +1 -0
- package/dist/agents/utils.js +164 -0
- package/dist/agents/utils.js.map +1 -0
- package/dist/features/auto-update.d.ts +52 -0
- package/dist/features/auto-update.d.ts.map +1 -1
- package/dist/features/auto-update.js +167 -0
- package/dist/features/auto-update.js.map +1 -1
- package/dist/features/background-agent/concurrency.d.ts +53 -0
- package/dist/features/background-agent/concurrency.d.ts.map +1 -0
- package/dist/features/background-agent/concurrency.js +121 -0
- package/dist/features/background-agent/concurrency.js.map +1 -0
- package/dist/features/background-agent/index.d.ts +12 -0
- package/dist/features/background-agent/index.d.ts.map +1 -0
- package/dist/features/background-agent/index.js +12 -0
- package/dist/features/background-agent/index.js.map +1 -0
- package/dist/features/background-agent/manager.d.ts +134 -0
- package/dist/features/background-agent/manager.d.ts.map +1 -0
- package/dist/features/background-agent/manager.js +412 -0
- package/dist/features/background-agent/manager.js.map +1 -0
- package/dist/features/background-agent/types.d.ts +99 -0
- package/dist/features/background-agent/types.d.ts.map +1 -0
- package/dist/features/background-agent/types.js +9 -0
- package/dist/features/background-agent/types.js.map +1 -0
- package/dist/features/boulder-state/constants.d.ts +20 -0
- package/dist/features/boulder-state/constants.d.ts.map +1 -0
- package/dist/features/boulder-state/constants.js +20 -0
- package/dist/features/boulder-state/constants.js.map +1 -0
- package/dist/features/boulder-state/index.d.ts +12 -0
- package/dist/features/boulder-state/index.d.ts.map +1 -0
- package/dist/features/boulder-state/index.js +13 -0
- package/dist/features/boulder-state/index.js.map +1 -0
- package/dist/features/boulder-state/storage.d.ts +58 -0
- package/dist/features/boulder-state/storage.d.ts.map +1 -0
- package/dist/features/boulder-state/storage.js +174 -0
- package/dist/features/boulder-state/storage.js.map +1 -0
- package/dist/features/boulder-state/types.d.ts +48 -0
- package/dist/features/boulder-state/types.d.ts.map +1 -0
- package/dist/features/boulder-state/types.js +10 -0
- package/dist/features/boulder-state/types.js.map +1 -0
- package/dist/features/builtin-skills/index.d.ts +10 -0
- package/dist/features/builtin-skills/index.d.ts.map +1 -0
- package/dist/features/builtin-skills/index.js +10 -0
- package/dist/features/builtin-skills/index.js.map +1 -0
- package/dist/features/builtin-skills/skills.d.ts +21 -0
- package/dist/features/builtin-skills/skills.d.ts.map +1 -0
- package/dist/features/builtin-skills/skills.js +367 -0
- package/dist/features/builtin-skills/skills.js.map +1 -0
- package/dist/features/builtin-skills/types.d.ts +60 -0
- package/dist/features/builtin-skills/types.d.ts.map +1 -0
- package/dist/features/builtin-skills/types.js +9 -0
- package/dist/features/builtin-skills/types.js.map +1 -0
- package/dist/features/context-injector/collector.d.ts +56 -0
- package/dist/features/context-injector/collector.d.ts.map +1 -0
- package/dist/features/context-injector/collector.js +122 -0
- package/dist/features/context-injector/collector.js.map +1 -0
- package/dist/features/context-injector/index.d.ts +12 -0
- package/dist/features/context-injector/index.d.ts.map +1 -0
- package/dist/features/context-injector/index.js +13 -0
- package/dist/features/context-injector/index.js.map +1 -0
- package/dist/features/context-injector/injector.d.ts +47 -0
- package/dist/features/context-injector/injector.d.ts.map +1 -0
- package/dist/features/context-injector/injector.js +103 -0
- package/dist/features/context-injector/injector.js.map +1 -0
- package/dist/features/context-injector/types.d.ts +103 -0
- package/dist/features/context-injector/types.d.ts.map +1 -0
- package/dist/features/context-injector/types.js +11 -0
- package/dist/features/context-injector/types.js.map +1 -0
- package/dist/features/index.d.ts +5 -1
- package/dist/features/index.d.ts.map +1 -1
- package/dist/features/index.js +25 -1
- package/dist/features/index.js.map +1 -1
- package/dist/hooks/agent-usage-reminder/constants.d.ts +17 -0
- package/dist/hooks/agent-usage-reminder/constants.d.ts.map +1 -0
- package/dist/hooks/agent-usage-reminder/constants.js +58 -0
- package/dist/hooks/agent-usage-reminder/constants.js.map +1 -0
- package/dist/hooks/agent-usage-reminder/index.d.ts +36 -0
- package/dist/hooks/agent-usage-reminder/index.d.ts.map +1 -0
- package/dist/hooks/agent-usage-reminder/index.js +89 -0
- package/dist/hooks/agent-usage-reminder/index.js.map +1 -0
- package/dist/hooks/agent-usage-reminder/storage.d.ts +12 -0
- package/dist/hooks/agent-usage-reminder/storage.d.ts.map +1 -0
- package/dist/hooks/agent-usage-reminder/storage.js +39 -0
- package/dist/hooks/agent-usage-reminder/storage.js.map +1 -0
- package/dist/hooks/agent-usage-reminder/types.d.ts +14 -0
- package/dist/hooks/agent-usage-reminder/types.d.ts.map +1 -0
- package/dist/hooks/agent-usage-reminder/types.js +9 -0
- package/dist/hooks/agent-usage-reminder/types.js.map +1 -0
- package/dist/hooks/auto-slash-command/constants.d.ts +19 -0
- package/dist/hooks/auto-slash-command/constants.d.ts.map +1 -0
- package/dist/hooks/auto-slash-command/constants.js +28 -0
- package/dist/hooks/auto-slash-command/constants.js.map +1 -0
- package/dist/hooks/auto-slash-command/detector.d.ts +33 -0
- package/dist/hooks/auto-slash-command/detector.d.ts.map +1 -0
- package/dist/hooks/auto-slash-command/detector.js +73 -0
- package/dist/hooks/auto-slash-command/detector.js.map +1 -0
- package/dist/hooks/auto-slash-command/executor.d.ts +29 -0
- package/dist/hooks/auto-slash-command/executor.d.ts.map +1 -0
- package/dist/hooks/auto-slash-command/executor.js +214 -0
- package/dist/hooks/auto-slash-command/executor.js.map +1 -0
- package/dist/hooks/auto-slash-command/index.d.ts +53 -0
- package/dist/hooks/auto-slash-command/index.d.ts.map +1 -0
- package/dist/hooks/auto-slash-command/index.js +105 -0
- package/dist/hooks/auto-slash-command/index.js.map +1 -0
- package/dist/hooks/auto-slash-command/types.d.ts +77 -0
- package/dist/hooks/auto-slash-command/types.d.ts.map +1 -0
- package/dist/hooks/auto-slash-command/types.js +9 -0
- package/dist/hooks/auto-slash-command/types.js.map +1 -0
- package/dist/hooks/background-notification/index.d.ts +60 -0
- package/dist/hooks/background-notification/index.d.ts.map +1 -0
- package/dist/hooks/background-notification/index.js +180 -0
- package/dist/hooks/background-notification/index.js.map +1 -0
- package/dist/hooks/background-notification/types.d.ts +64 -0
- package/dist/hooks/background-notification/types.d.ts.map +1 -0
- package/dist/hooks/background-notification/types.js +8 -0
- package/dist/hooks/background-notification/types.js.map +1 -0
- package/dist/hooks/bridge.d.ts +68 -0
- package/dist/hooks/bridge.d.ts.map +1 -0
- package/dist/hooks/bridge.js +225 -0
- package/dist/hooks/bridge.js.map +1 -0
- package/dist/hooks/comment-checker/constants.d.ts +28 -0
- package/dist/hooks/comment-checker/constants.d.ts.map +1 -0
- package/dist/hooks/comment-checker/constants.js +189 -0
- package/dist/hooks/comment-checker/constants.js.map +1 -0
- package/dist/hooks/comment-checker/filters.d.ts +39 -0
- package/dist/hooks/comment-checker/filters.d.ts.map +1 -0
- package/dist/hooks/comment-checker/filters.js +126 -0
- package/dist/hooks/comment-checker/filters.js.map +1 -0
- package/dist/hooks/comment-checker/index.d.ts +58 -0
- package/dist/hooks/comment-checker/index.d.ts.map +1 -0
- package/dist/hooks/comment-checker/index.js +298 -0
- package/dist/hooks/comment-checker/index.js.map +1 -0
- package/dist/hooks/comment-checker/types.d.ts +88 -0
- package/dist/hooks/comment-checker/types.d.ts.map +1 -0
- package/dist/hooks/comment-checker/types.js +9 -0
- package/dist/hooks/comment-checker/types.js.map +1 -0
- package/dist/hooks/context-window-limit-recovery/constants.d.ts +28 -0
- package/dist/hooks/context-window-limit-recovery/constants.d.ts.map +1 -0
- package/dist/hooks/context-window-limit-recovery/constants.js +85 -0
- package/dist/hooks/context-window-limit-recovery/constants.js.map +1 -0
- package/dist/hooks/context-window-limit-recovery/index.d.ts +62 -0
- package/dist/hooks/context-window-limit-recovery/index.d.ts.map +1 -0
- package/dist/hooks/context-window-limit-recovery/index.js +201 -0
- package/dist/hooks/context-window-limit-recovery/index.js.map +1 -0
- package/dist/hooks/context-window-limit-recovery/parser.d.ts +31 -0
- package/dist/hooks/context-window-limit-recovery/parser.d.ts.map +1 -0
- package/dist/hooks/context-window-limit-recovery/parser.js +241 -0
- package/dist/hooks/context-window-limit-recovery/parser.js.map +1 -0
- package/dist/hooks/context-window-limit-recovery/types.d.ts +84 -0
- package/dist/hooks/context-window-limit-recovery/types.d.ts.map +1 -0
- package/dist/hooks/context-window-limit-recovery/types.js +34 -0
- package/dist/hooks/context-window-limit-recovery/types.js.map +1 -0
- package/dist/hooks/directory-readme-injector/constants.d.ts +15 -0
- package/dist/hooks/directory-readme-injector/constants.d.ts.map +1 -0
- package/dist/hooks/directory-readme-injector/constants.js +17 -0
- package/dist/hooks/directory-readme-injector/constants.js.map +1 -0
- package/dist/hooks/directory-readme-injector/index.d.ts +41 -0
- package/dist/hooks/directory-readme-injector/index.d.ts.map +1 -0
- package/dist/hooks/directory-readme-injector/index.js +162 -0
- package/dist/hooks/directory-readme-injector/index.js.map +1 -0
- package/dist/hooks/directory-readme-injector/storage.d.ts +20 -0
- package/dist/hooks/directory-readme-injector/storage.d.ts.map +1 -0
- package/dist/hooks/directory-readme-injector/storage.js +56 -0
- package/dist/hooks/directory-readme-injector/storage.js.map +1 -0
- package/dist/hooks/directory-readme-injector/types.d.ts +20 -0
- package/dist/hooks/directory-readme-injector/types.d.ts.map +1 -0
- package/dist/hooks/directory-readme-injector/types.js +9 -0
- package/dist/hooks/directory-readme-injector/types.js.map +1 -0
- package/dist/hooks/edit-error-recovery/index.d.ts +62 -0
- package/dist/hooks/edit-error-recovery/index.d.ts.map +1 -0
- package/dist/hooks/edit-error-recovery/index.js +89 -0
- package/dist/hooks/edit-error-recovery/index.js.map +1 -0
- package/dist/hooks/empty-message-sanitizer/constants.d.ts +33 -0
- package/dist/hooks/empty-message-sanitizer/constants.d.ts.map +1 -0
- package/dist/hooks/empty-message-sanitizer/constants.js +37 -0
- package/dist/hooks/empty-message-sanitizer/constants.js.map +1 -0
- package/dist/hooks/empty-message-sanitizer/index.d.ts +59 -0
- package/dist/hooks/empty-message-sanitizer/index.d.ts.map +1 -0
- package/dist/hooks/empty-message-sanitizer/index.js +171 -0
- package/dist/hooks/empty-message-sanitizer/index.js.map +1 -0
- package/dist/hooks/empty-message-sanitizer/types.d.ts +79 -0
- package/dist/hooks/empty-message-sanitizer/types.d.ts.map +1 -0
- package/dist/hooks/empty-message-sanitizer/types.js +10 -0
- package/dist/hooks/empty-message-sanitizer/types.js.map +1 -0
- package/dist/hooks/index.d.ts +31 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +69 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/keyword-detector/index.d.ts +40 -0
- package/dist/hooks/keyword-detector/index.d.ts.map +1 -0
- package/dist/hooks/keyword-detector/index.js +88 -0
- package/dist/hooks/keyword-detector/index.js.map +1 -0
- package/dist/hooks/non-interactive-env/constants.d.ts +35 -0
- package/dist/hooks/non-interactive-env/constants.d.ts.map +1 -0
- package/dist/hooks/non-interactive-env/constants.js +69 -0
- package/dist/hooks/non-interactive-env/constants.js.map +1 -0
- package/dist/hooks/non-interactive-env/detector.d.ts +2 -0
- package/dist/hooks/non-interactive-env/detector.d.ts.map +1 -0
- package/dist/hooks/non-interactive-env/detector.js +16 -0
- package/dist/hooks/non-interactive-env/detector.js.map +1 -0
- package/dist/hooks/non-interactive-env/index.d.ts +14 -0
- package/dist/hooks/non-interactive-env/index.d.ts.map +1 -0
- package/dist/hooks/non-interactive-env/index.js +72 -0
- package/dist/hooks/non-interactive-env/index.js.map +1 -0
- package/dist/hooks/non-interactive-env/types.d.ts +14 -0
- package/dist/hooks/non-interactive-env/types.d.ts.map +1 -0
- package/dist/hooks/non-interactive-env/types.js +2 -0
- package/dist/hooks/non-interactive-env/types.js.map +1 -0
- package/dist/hooks/preemptive-compaction/constants.d.ts +48 -0
- package/dist/hooks/preemptive-compaction/constants.d.ts.map +1 -0
- package/dist/hooks/preemptive-compaction/constants.js +90 -0
- package/dist/hooks/preemptive-compaction/constants.js.map +1 -0
- package/dist/hooks/preemptive-compaction/index.d.ts +55 -0
- package/dist/hooks/preemptive-compaction/index.d.ts.map +1 -0
- package/dist/hooks/preemptive-compaction/index.js +237 -0
- package/dist/hooks/preemptive-compaction/index.js.map +1 -0
- package/dist/hooks/preemptive-compaction/types.d.ts +76 -0
- package/dist/hooks/preemptive-compaction/types.d.ts.map +1 -0
- package/dist/hooks/preemptive-compaction/types.js +9 -0
- package/dist/hooks/preemptive-compaction/types.js.map +1 -0
- package/dist/hooks/ralph-loop/index.d.ts +60 -0
- package/dist/hooks/ralph-loop/index.d.ts.map +1 -0
- package/dist/hooks/ralph-loop/index.js +155 -0
- package/dist/hooks/ralph-loop/index.js.map +1 -0
- package/dist/hooks/rules-injector/constants.d.ts +25 -0
- package/dist/hooks/rules-injector/constants.d.ts.map +1 -0
- package/dist/hooks/rules-injector/constants.js +40 -0
- package/dist/hooks/rules-injector/constants.js.map +1 -0
- package/dist/hooks/rules-injector/finder.d.ts +24 -0
- package/dist/hooks/rules-injector/finder.d.ts.map +1 -0
- package/dist/hooks/rules-injector/finder.js +215 -0
- package/dist/hooks/rules-injector/finder.js.map +1 -0
- package/dist/hooks/rules-injector/index.d.ts +45 -0
- package/dist/hooks/rules-injector/index.d.ts.map +1 -0
- package/dist/hooks/rules-injector/index.js +187 -0
- package/dist/hooks/rules-injector/index.js.map +1 -0
- package/dist/hooks/rules-injector/matcher.d.ts +25 -0
- package/dist/hooks/rules-injector/matcher.d.ts.map +1 -0
- package/dist/hooks/rules-injector/matcher.js +70 -0
- package/dist/hooks/rules-injector/matcher.js.map +1 -0
- package/dist/hooks/rules-injector/parser.d.ts +20 -0
- package/dist/hooks/rules-injector/parser.d.ts.map +1 -0
- package/dist/hooks/rules-injector/parser.js +179 -0
- package/dist/hooks/rules-injector/parser.js.map +1 -0
- package/dist/hooks/rules-injector/storage.d.ts +26 -0
- package/dist/hooks/rules-injector/storage.d.ts.map +1 -0
- package/dist/hooks/rules-injector/storage.js +61 -0
- package/dist/hooks/rules-injector/storage.js.map +1 -0
- package/dist/hooks/rules-injector/types.d.ts +101 -0
- package/dist/hooks/rules-injector/types.d.ts.map +1 -0
- package/dist/hooks/rules-injector/types.js +10 -0
- package/dist/hooks/rules-injector/types.js.map +1 -0
- package/dist/hooks/session-recovery/constants.d.ts +56 -0
- package/dist/hooks/session-recovery/constants.d.ts.map +1 -0
- package/dist/hooks/session-recovery/constants.js +78 -0
- package/dist/hooks/session-recovery/constants.js.map +1 -0
- package/dist/hooks/session-recovery/index.d.ts +53 -0
- package/dist/hooks/session-recovery/index.d.ts.map +1 -0
- package/dist/hooks/session-recovery/index.js +321 -0
- package/dist/hooks/session-recovery/index.js.map +1 -0
- package/dist/hooks/session-recovery/storage.d.ts +76 -0
- package/dist/hooks/session-recovery/storage.d.ts.map +1 -0
- package/dist/hooks/session-recovery/storage.js +383 -0
- package/dist/hooks/session-recovery/storage.js.map +1 -0
- package/dist/hooks/session-recovery/types.d.ts +145 -0
- package/dist/hooks/session-recovery/types.d.ts.map +1 -0
- package/dist/hooks/session-recovery/types.js +8 -0
- package/dist/hooks/session-recovery/types.js.map +1 -0
- package/dist/hooks/sisyphus-orchestrator/constants.d.ts +23 -0
- package/dist/hooks/sisyphus-orchestrator/constants.d.ts.map +1 -0
- package/dist/hooks/sisyphus-orchestrator/constants.js +142 -0
- package/dist/hooks/sisyphus-orchestrator/constants.js.map +1 -0
- package/dist/hooks/sisyphus-orchestrator/index.d.ts +113 -0
- package/dist/hooks/sisyphus-orchestrator/index.d.ts.map +1 -0
- package/dist/hooks/sisyphus-orchestrator/index.js +283 -0
- package/dist/hooks/sisyphus-orchestrator/index.js.map +1 -0
- package/dist/hooks/think-mode/detector.d.ts +28 -0
- package/dist/hooks/think-mode/detector.d.ts.map +1 -0
- package/dist/hooks/think-mode/detector.js +105 -0
- package/dist/hooks/think-mode/detector.js.map +1 -0
- package/dist/hooks/think-mode/index.d.ts +70 -0
- package/dist/hooks/think-mode/index.d.ts.map +1 -0
- package/dist/hooks/think-mode/index.js +144 -0
- package/dist/hooks/think-mode/index.js.map +1 -0
- package/dist/hooks/think-mode/switcher.d.ts +39 -0
- package/dist/hooks/think-mode/switcher.d.ts.map +1 -0
- package/dist/hooks/think-mode/switcher.js +180 -0
- package/dist/hooks/think-mode/switcher.js.map +1 -0
- package/dist/hooks/think-mode/types.d.ts +60 -0
- package/dist/hooks/think-mode/types.d.ts.map +1 -0
- package/dist/hooks/think-mode/types.js +9 -0
- package/dist/hooks/think-mode/types.js.map +1 -0
- package/dist/hooks/thinking-block-validator/constants.d.ts +37 -0
- package/dist/hooks/thinking-block-validator/constants.d.ts.map +1 -0
- package/dist/hooks/thinking-block-validator/constants.js +50 -0
- package/dist/hooks/thinking-block-validator/constants.js.map +1 -0
- package/dist/hooks/thinking-block-validator/index.d.ts +66 -0
- package/dist/hooks/thinking-block-validator/index.d.ts.map +1 -0
- package/dist/hooks/thinking-block-validator/index.js +205 -0
- package/dist/hooks/thinking-block-validator/index.js.map +1 -0
- package/dist/hooks/thinking-block-validator/types.d.ts +67 -0
- package/dist/hooks/thinking-block-validator/types.d.ts.map +1 -0
- package/dist/hooks/thinking-block-validator/types.js +9 -0
- package/dist/hooks/thinking-block-validator/types.js.map +1 -0
- package/dist/hooks/todo-continuation/index.d.ts +39 -0
- package/dist/hooks/todo-continuation/index.d.ts.map +1 -0
- package/dist/hooks/todo-continuation/index.js +140 -0
- package/dist/hooks/todo-continuation/index.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -1
- package/dist/installer/index.d.ts +1 -1
- package/dist/installer/index.d.ts.map +1 -1
- package/dist/installer/index.js +232 -1
- package/dist/installer/index.js.map +1 -1
- package/package.json +1 -1
- package/scripts/install.sh +181 -3
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook Bridge - TypeScript logic invoked by shell scripts
|
|
3
|
+
*
|
|
4
|
+
* This module provides the main entry point for shell hooks to call TypeScript
|
|
5
|
+
* for complex processing. The shell script reads stdin, passes it to this module,
|
|
6
|
+
* and writes the JSON output to stdout.
|
|
7
|
+
*
|
|
8
|
+
* Usage from shell:
|
|
9
|
+
* ```bash
|
|
10
|
+
* #!/bin/bash
|
|
11
|
+
* INPUT=$(cat)
|
|
12
|
+
* echo "$INPUT" | node ~/.claude/sisyphus/hook-bridge.mjs --hook=keyword-detector
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
import { detectKeywordsWithType, removeCodeBlocks } from './keyword-detector/index.js';
|
|
16
|
+
import { readRalphState, incrementRalphIteration, clearRalphState, detectCompletionPromise } from './ralph-loop/index.js';
|
|
17
|
+
import { checkIncompleteTodos } from './todo-continuation/index.js';
|
|
18
|
+
import { ULTRAWORK_MESSAGE, ULTRATHINK_MESSAGE, SEARCH_MESSAGE, ANALYZE_MESSAGE, TODO_CONTINUATION_PROMPT } from '../installer/hooks.js';
|
|
19
|
+
/**
|
|
20
|
+
* Extract prompt text from various input formats
|
|
21
|
+
*/
|
|
22
|
+
function getPromptText(input) {
|
|
23
|
+
if (input.prompt) {
|
|
24
|
+
return input.prompt;
|
|
25
|
+
}
|
|
26
|
+
if (input.message?.content) {
|
|
27
|
+
return input.message.content;
|
|
28
|
+
}
|
|
29
|
+
if (input.parts) {
|
|
30
|
+
return input.parts
|
|
31
|
+
.filter(p => p.type === 'text' && p.text)
|
|
32
|
+
.map(p => p.text)
|
|
33
|
+
.join(' ');
|
|
34
|
+
}
|
|
35
|
+
return '';
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Process keyword detection hook
|
|
39
|
+
* Detects ultrawork/ultrathink/search/analyze keywords and returns injection message
|
|
40
|
+
*/
|
|
41
|
+
function processKeywordDetector(input) {
|
|
42
|
+
const promptText = getPromptText(input);
|
|
43
|
+
if (!promptText) {
|
|
44
|
+
return { continue: true };
|
|
45
|
+
}
|
|
46
|
+
// Remove code blocks to prevent false positives
|
|
47
|
+
const cleanedText = removeCodeBlocks(promptText);
|
|
48
|
+
// Detect keywords
|
|
49
|
+
const keywords = detectKeywordsWithType(cleanedText);
|
|
50
|
+
if (keywords.length === 0) {
|
|
51
|
+
return { continue: true };
|
|
52
|
+
}
|
|
53
|
+
// Priority: ultrawork > ultrathink > search > analyze
|
|
54
|
+
const hasUltrawork = keywords.some(k => k.type === 'ultrawork');
|
|
55
|
+
const hasUltrathink = keywords.some(k => k.type === 'ultrathink');
|
|
56
|
+
const hasSearch = keywords.some(k => k.type === 'search');
|
|
57
|
+
const hasAnalyze = keywords.some(k => k.type === 'analyze');
|
|
58
|
+
if (hasUltrawork) {
|
|
59
|
+
return {
|
|
60
|
+
continue: true,
|
|
61
|
+
message: ULTRAWORK_MESSAGE
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
if (hasUltrathink) {
|
|
65
|
+
return {
|
|
66
|
+
continue: true,
|
|
67
|
+
message: ULTRATHINK_MESSAGE
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
if (hasSearch) {
|
|
71
|
+
return {
|
|
72
|
+
continue: true,
|
|
73
|
+
message: SEARCH_MESSAGE
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
if (hasAnalyze) {
|
|
77
|
+
return {
|
|
78
|
+
continue: true,
|
|
79
|
+
message: ANALYZE_MESSAGE
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
return { continue: true };
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Process stop continuation hook
|
|
86
|
+
* Checks for incomplete todos and blocks stop if tasks remain
|
|
87
|
+
*/
|
|
88
|
+
async function processStopContinuation(input) {
|
|
89
|
+
const sessionId = input.sessionId;
|
|
90
|
+
const directory = input.directory || process.cwd();
|
|
91
|
+
// Check for incomplete todos
|
|
92
|
+
const incompleteTodos = await checkIncompleteTodos(sessionId, directory);
|
|
93
|
+
if (incompleteTodos.count > 0) {
|
|
94
|
+
return {
|
|
95
|
+
continue: false,
|
|
96
|
+
reason: `${TODO_CONTINUATION_PROMPT}\n\n[Status: ${incompleteTodos.count} tasks remaining]`
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
return { continue: true };
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Process Ralph Loop hook (session.idle event)
|
|
103
|
+
* Continues work loops until completion promise is detected
|
|
104
|
+
*/
|
|
105
|
+
async function processRalphLoop(input) {
|
|
106
|
+
const sessionId = input.sessionId;
|
|
107
|
+
const directory = input.directory || process.cwd();
|
|
108
|
+
if (!sessionId) {
|
|
109
|
+
return { continue: true };
|
|
110
|
+
}
|
|
111
|
+
// Read Ralph state
|
|
112
|
+
const state = readRalphState(directory);
|
|
113
|
+
if (!state || !state.active) {
|
|
114
|
+
return { continue: true };
|
|
115
|
+
}
|
|
116
|
+
// Check if this is the right session
|
|
117
|
+
if (state.session_id && state.session_id !== sessionId) {
|
|
118
|
+
return { continue: true };
|
|
119
|
+
}
|
|
120
|
+
// Check for completion promise in transcript
|
|
121
|
+
const completed = detectCompletionPromise(sessionId, state.completion_promise);
|
|
122
|
+
if (completed) {
|
|
123
|
+
clearRalphState(directory);
|
|
124
|
+
return {
|
|
125
|
+
continue: true,
|
|
126
|
+
message: `[RALPH LOOP COMPLETE] Task completed after ${state.iteration} iteration(s).`
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
// Check max iterations
|
|
130
|
+
if (state.iteration >= state.max_iterations) {
|
|
131
|
+
clearRalphState(directory);
|
|
132
|
+
return {
|
|
133
|
+
continue: true,
|
|
134
|
+
message: `[RALPH LOOP STOPPED] Max iterations (${state.max_iterations}) reached without completion.`
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
// Increment and continue
|
|
138
|
+
const newState = incrementRalphIteration(directory);
|
|
139
|
+
if (!newState) {
|
|
140
|
+
return { continue: true };
|
|
141
|
+
}
|
|
142
|
+
const continuationPrompt = `[RALPH LOOP - ITERATION ${newState.iteration}/${newState.max_iterations}]
|
|
143
|
+
|
|
144
|
+
Your previous attempt did not output the completion promise. Continue working on the task.
|
|
145
|
+
|
|
146
|
+
IMPORTANT:
|
|
147
|
+
- Review your progress so far
|
|
148
|
+
- Continue from where you left off
|
|
149
|
+
- When FULLY complete, output: <promise>${newState.completion_promise}</promise>
|
|
150
|
+
- Do not stop until the task is truly done
|
|
151
|
+
|
|
152
|
+
Original task:
|
|
153
|
+
${newState.prompt}`;
|
|
154
|
+
return {
|
|
155
|
+
continue: true,
|
|
156
|
+
message: continuationPrompt
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Main hook processor
|
|
161
|
+
* Routes to specific hook handler based on type
|
|
162
|
+
*/
|
|
163
|
+
export async function processHook(hookType, input) {
|
|
164
|
+
try {
|
|
165
|
+
switch (hookType) {
|
|
166
|
+
case 'keyword-detector':
|
|
167
|
+
return processKeywordDetector(input);
|
|
168
|
+
case 'stop-continuation':
|
|
169
|
+
return await processStopContinuation(input);
|
|
170
|
+
case 'ralph-loop':
|
|
171
|
+
return await processRalphLoop(input);
|
|
172
|
+
case 'pre-tool-use':
|
|
173
|
+
// Pre-tool-use hooks can be extended here
|
|
174
|
+
return { continue: true };
|
|
175
|
+
case 'post-tool-use':
|
|
176
|
+
// Post-tool-use hooks can be extended here
|
|
177
|
+
return { continue: true };
|
|
178
|
+
default:
|
|
179
|
+
return { continue: true };
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
catch (error) {
|
|
183
|
+
// Log error but don't block execution
|
|
184
|
+
console.error(`[hook-bridge] Error in ${hookType}:`, error);
|
|
185
|
+
return { continue: true };
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* CLI entry point for shell script invocation
|
|
190
|
+
* Reads JSON from stdin, processes hook, writes JSON to stdout
|
|
191
|
+
*/
|
|
192
|
+
export async function main() {
|
|
193
|
+
const args = process.argv.slice(2);
|
|
194
|
+
const hookArg = args.find(a => a.startsWith('--hook='));
|
|
195
|
+
if (!hookArg) {
|
|
196
|
+
console.error('Usage: node hook-bridge.mjs --hook=<type>');
|
|
197
|
+
process.exit(1);
|
|
198
|
+
}
|
|
199
|
+
const hookType = hookArg.split('=')[1];
|
|
200
|
+
// Read stdin
|
|
201
|
+
const chunks = [];
|
|
202
|
+
for await (const chunk of process.stdin) {
|
|
203
|
+
chunks.push(chunk);
|
|
204
|
+
}
|
|
205
|
+
const inputStr = Buffer.concat(chunks).toString('utf-8');
|
|
206
|
+
let input;
|
|
207
|
+
try {
|
|
208
|
+
input = JSON.parse(inputStr);
|
|
209
|
+
}
|
|
210
|
+
catch {
|
|
211
|
+
input = {};
|
|
212
|
+
}
|
|
213
|
+
// Process hook
|
|
214
|
+
const output = await processHook(hookType, input);
|
|
215
|
+
// Write output to stdout
|
|
216
|
+
console.log(JSON.stringify(output));
|
|
217
|
+
}
|
|
218
|
+
// Run if called directly
|
|
219
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
220
|
+
main().catch(err => {
|
|
221
|
+
console.error('[hook-bridge] Fatal error:', err);
|
|
222
|
+
process.exit(1);
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
//# sourceMappingURL=bridge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bridge.js","sourceRoot":"","sources":["../../src/hooks/bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,sBAAsB,EAAqB,gBAAgB,EAAwB,MAAM,6BAA6B,CAAC;AAChI,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,eAAe,EAAE,uBAAuB,EAAuB,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ACtC,CAAC;AAED,yBAAyB;AACzB,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,UAAU,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IACpD,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE;QACjB,OAAO,CAAC,KAAK,CAAC,4BAA4B,EAAE,GAAG,CAAC,CAAC;QACjD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Comment Checker Constants
|
|
3
|
+
*
|
|
4
|
+
* Keywords and patterns for comment detection and filtering.
|
|
5
|
+
*
|
|
6
|
+
* Adapted from oh-my-opencode's comment-checker hook.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* BDD (Behavior-Driven Development) keywords that are acceptable in comments
|
|
10
|
+
*/
|
|
11
|
+
export declare const BDD_KEYWORDS: Set<string>;
|
|
12
|
+
/**
|
|
13
|
+
* Prefixes for type checker and linter directives (acceptable comments)
|
|
14
|
+
*/
|
|
15
|
+
export declare const TYPE_CHECKER_PREFIXES: string[];
|
|
16
|
+
/**
|
|
17
|
+
* Header message for comment detection
|
|
18
|
+
*/
|
|
19
|
+
export declare const HOOK_MESSAGE_HEADER = "COMMENT/DOCSTRING DETECTED - IMMEDIATE ACTION REQUIRED\n\nYour recent changes contain comments or docstrings, which triggered this hook.\nYou need to take immediate action. You must follow the conditions below.\n(Listed in priority order - you must always act according to this priority order)\n\nCRITICAL WARNING: This hook message MUST NEVER be ignored, even if you receive it multiple times.\nYou MUST provide corresponding explanation or action for EACH occurrence of this message.\nIgnoring this message or failing to respond appropriately is strictly prohibited.\n\nPRIORITY-BASED ACTION GUIDELINES:\n\n1. This is a comment/docstring that already existed before\n -> Explain to the user that this is an existing comment/docstring and proceed (justify it)\n\n2. This is a newly written comment: but it's in given, when, then format\n -> Tell the user it's a BDD comment and proceed (justify it)\n -> Note: This applies to comments only, not docstrings\n\n3. This is a newly written comment/docstring: but it's a necessary comment/docstring\n -> Tell the user why this comment/docstring is absolutely necessary and proceed (justify it)\n -> Examples of necessary comments: complex algorithms, security-related, performance optimization, regex, mathematical formulas\n -> Examples of necessary docstrings: public API documentation, complex module/class interfaces\n -> IMPORTANT: Most docstrings are unnecessary if the code is self-explanatory. Only keep truly essential ones.\n\n4. This is a newly written comment/docstring: but it's an unnecessary comment/docstring\n -> Apologize to the user and remove the comment/docstring.\n -> Make the code itself clearer so it can be understood without comments/docstrings.\n -> For verbose docstrings: refactor code to be self-documenting instead of adding lengthy explanations.\n\nCODE SMELL WARNING: Using comments as visual separators (e.g., \"// =========\", \"# ---\", \"// *** Section ***\")\nis a code smell. If you need separators, your file is too long or poorly organized.\nRefactor into smaller modules or use proper code organization instead of comment-based section dividers.\n\nMANDATORY REQUIREMENT: You must acknowledge this hook message and take one of the above actions.\nReview in the above priority order and take the corresponding action EVERY TIME this appears.\n\nDetected comments/docstrings:\n";
|
|
20
|
+
/**
|
|
21
|
+
* Pattern for detecting line comments by language
|
|
22
|
+
*/
|
|
23
|
+
export declare const LINE_COMMENT_PATTERNS: Record<string, RegExp>;
|
|
24
|
+
/**
|
|
25
|
+
* File extensions to language mapping
|
|
26
|
+
*/
|
|
27
|
+
export declare const EXTENSION_TO_LANGUAGE: Record<string, string>;
|
|
28
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/hooks/comment-checker/constants.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AACH,eAAO,MAAM,YAAY,aASvB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,qBAAqB,UA4CjC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,q1EAsC/B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAgCxD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAsCxD,CAAC"}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Comment Checker Constants
|
|
3
|
+
*
|
|
4
|
+
* Keywords and patterns for comment detection and filtering.
|
|
5
|
+
*
|
|
6
|
+
* Adapted from oh-my-opencode's comment-checker hook.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* BDD (Behavior-Driven Development) keywords that are acceptable in comments
|
|
10
|
+
*/
|
|
11
|
+
export const BDD_KEYWORDS = new Set([
|
|
12
|
+
'given',
|
|
13
|
+
'when',
|
|
14
|
+
'then',
|
|
15
|
+
'arrange',
|
|
16
|
+
'act',
|
|
17
|
+
'assert',
|
|
18
|
+
'when & then',
|
|
19
|
+
'when&then',
|
|
20
|
+
]);
|
|
21
|
+
/**
|
|
22
|
+
* Prefixes for type checker and linter directives (acceptable comments)
|
|
23
|
+
*/
|
|
24
|
+
export const TYPE_CHECKER_PREFIXES = [
|
|
25
|
+
// Python
|
|
26
|
+
'type:',
|
|
27
|
+
'noqa',
|
|
28
|
+
'pyright:',
|
|
29
|
+
'ruff:',
|
|
30
|
+
'mypy:',
|
|
31
|
+
'pylint:',
|
|
32
|
+
'flake8:',
|
|
33
|
+
'pyre:',
|
|
34
|
+
'pytype:',
|
|
35
|
+
// JavaScript/TypeScript
|
|
36
|
+
'eslint-disable',
|
|
37
|
+
'eslint-enable',
|
|
38
|
+
'eslint-ignore',
|
|
39
|
+
'prettier-ignore',
|
|
40
|
+
'ts-ignore',
|
|
41
|
+
'ts-expect-error',
|
|
42
|
+
'ts-nocheck',
|
|
43
|
+
'@ts-ignore',
|
|
44
|
+
'@ts-expect-error',
|
|
45
|
+
'@ts-nocheck',
|
|
46
|
+
// Rust
|
|
47
|
+
'clippy::',
|
|
48
|
+
'allow(',
|
|
49
|
+
'deny(',
|
|
50
|
+
'warn(',
|
|
51
|
+
'forbid(',
|
|
52
|
+
// Go
|
|
53
|
+
'nolint',
|
|
54
|
+
'go:generate',
|
|
55
|
+
'go:build',
|
|
56
|
+
'go:embed',
|
|
57
|
+
// Coverage
|
|
58
|
+
'coverage:',
|
|
59
|
+
'c8 ignore',
|
|
60
|
+
'istanbul ignore',
|
|
61
|
+
// Biome
|
|
62
|
+
'biome-ignore',
|
|
63
|
+
// Regions
|
|
64
|
+
'region',
|
|
65
|
+
'endregion',
|
|
66
|
+
'#region',
|
|
67
|
+
'#endregion',
|
|
68
|
+
];
|
|
69
|
+
/**
|
|
70
|
+
* Header message for comment detection
|
|
71
|
+
*/
|
|
72
|
+
export const HOOK_MESSAGE_HEADER = `COMMENT/DOCSTRING DETECTED - IMMEDIATE ACTION REQUIRED
|
|
73
|
+
|
|
74
|
+
Your recent changes contain comments or docstrings, which triggered this hook.
|
|
75
|
+
You need to take immediate action. You must follow the conditions below.
|
|
76
|
+
(Listed in priority order - you must always act according to this priority order)
|
|
77
|
+
|
|
78
|
+
CRITICAL WARNING: This hook message MUST NEVER be ignored, even if you receive it multiple times.
|
|
79
|
+
You MUST provide corresponding explanation or action for EACH occurrence of this message.
|
|
80
|
+
Ignoring this message or failing to respond appropriately is strictly prohibited.
|
|
81
|
+
|
|
82
|
+
PRIORITY-BASED ACTION GUIDELINES:
|
|
83
|
+
|
|
84
|
+
1. This is a comment/docstring that already existed before
|
|
85
|
+
-> Explain to the user that this is an existing comment/docstring and proceed (justify it)
|
|
86
|
+
|
|
87
|
+
2. This is a newly written comment: but it's in given, when, then format
|
|
88
|
+
-> Tell the user it's a BDD comment and proceed (justify it)
|
|
89
|
+
-> Note: This applies to comments only, not docstrings
|
|
90
|
+
|
|
91
|
+
3. This is a newly written comment/docstring: but it's a necessary comment/docstring
|
|
92
|
+
-> Tell the user why this comment/docstring is absolutely necessary and proceed (justify it)
|
|
93
|
+
-> Examples of necessary comments: complex algorithms, security-related, performance optimization, regex, mathematical formulas
|
|
94
|
+
-> Examples of necessary docstrings: public API documentation, complex module/class interfaces
|
|
95
|
+
-> IMPORTANT: Most docstrings are unnecessary if the code is self-explanatory. Only keep truly essential ones.
|
|
96
|
+
|
|
97
|
+
4. This is a newly written comment/docstring: but it's an unnecessary comment/docstring
|
|
98
|
+
-> Apologize to the user and remove the comment/docstring.
|
|
99
|
+
-> Make the code itself clearer so it can be understood without comments/docstrings.
|
|
100
|
+
-> For verbose docstrings: refactor code to be self-documenting instead of adding lengthy explanations.
|
|
101
|
+
|
|
102
|
+
CODE SMELL WARNING: Using comments as visual separators (e.g., "// =========", "# ---", "// *** Section ***")
|
|
103
|
+
is a code smell. If you need separators, your file is too long or poorly organized.
|
|
104
|
+
Refactor into smaller modules or use proper code organization instead of comment-based section dividers.
|
|
105
|
+
|
|
106
|
+
MANDATORY REQUIREMENT: You must acknowledge this hook message and take one of the above actions.
|
|
107
|
+
Review in the above priority order and take the corresponding action EVERY TIME this appears.
|
|
108
|
+
|
|
109
|
+
Detected comments/docstrings:
|
|
110
|
+
`;
|
|
111
|
+
/**
|
|
112
|
+
* Pattern for detecting line comments by language
|
|
113
|
+
*/
|
|
114
|
+
export const LINE_COMMENT_PATTERNS = {
|
|
115
|
+
// C-style: //, /* */
|
|
116
|
+
js: /\/\/.*$|\/\*[\s\S]*?\*\//gm,
|
|
117
|
+
ts: /\/\/.*$|\/\*[\s\S]*?\*\//gm,
|
|
118
|
+
jsx: /\/\/.*$|\/\*[\s\S]*?\*\//gm,
|
|
119
|
+
tsx: /\/\/.*$|\/\*[\s\S]*?\*\//gm,
|
|
120
|
+
java: /\/\/.*$|\/\*[\s\S]*?\*\//gm,
|
|
121
|
+
c: /\/\/.*$|\/\*[\s\S]*?\*\//gm,
|
|
122
|
+
cpp: /\/\/.*$|\/\*[\s\S]*?\*\//gm,
|
|
123
|
+
cs: /\/\/.*$|\/\*[\s\S]*?\*\//gm,
|
|
124
|
+
go: /\/\/.*$/gm,
|
|
125
|
+
rust: /\/\/.*$|\/\*[\s\S]*?\*\//gm,
|
|
126
|
+
swift: /\/\/.*$|\/\*[\s\S]*?\*\//gm,
|
|
127
|
+
kotlin: /\/\/.*$|\/\*[\s\S]*?\*\//gm,
|
|
128
|
+
// Hash-style: #
|
|
129
|
+
py: /#.*$|'''[\s\S]*?'''|"""[\s\S]*?"""/gm,
|
|
130
|
+
rb: /#.*$|=begin[\s\S]*?=end/gm,
|
|
131
|
+
sh: /#.*$/gm,
|
|
132
|
+
bash: /#.*$/gm,
|
|
133
|
+
zsh: /#.*$/gm,
|
|
134
|
+
yaml: /#.*$/gm,
|
|
135
|
+
yml: /#.*$/gm,
|
|
136
|
+
toml: /#.*$/gm,
|
|
137
|
+
// HTML-style: <!-- -->
|
|
138
|
+
html: /<!--[\s\S]*?-->/gm,
|
|
139
|
+
xml: /<!--[\s\S]*?-->/gm,
|
|
140
|
+
vue: /<!--[\s\S]*?-->|\/\/.*$|\/\*[\s\S]*?\*\//gm,
|
|
141
|
+
svelte: /<!--[\s\S]*?-->|\/\/.*$|\/\*[\s\S]*?\*\//gm,
|
|
142
|
+
// SQL-style: --
|
|
143
|
+
sql: /--.*$/gm,
|
|
144
|
+
// Lua-style: --
|
|
145
|
+
lua: /--.*$|--\[\[[\s\S]*?\]\]/gm,
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* File extensions to language mapping
|
|
149
|
+
*/
|
|
150
|
+
export const EXTENSION_TO_LANGUAGE = {
|
|
151
|
+
'.js': 'js',
|
|
152
|
+
'.mjs': 'js',
|
|
153
|
+
'.cjs': 'js',
|
|
154
|
+
'.ts': 'ts',
|
|
155
|
+
'.mts': 'ts',
|
|
156
|
+
'.cts': 'ts',
|
|
157
|
+
'.jsx': 'jsx',
|
|
158
|
+
'.tsx': 'tsx',
|
|
159
|
+
'.java': 'java',
|
|
160
|
+
'.c': 'c',
|
|
161
|
+
'.h': 'c',
|
|
162
|
+
'.cpp': 'cpp',
|
|
163
|
+
'.cc': 'cpp',
|
|
164
|
+
'.cxx': 'cpp',
|
|
165
|
+
'.hpp': 'cpp',
|
|
166
|
+
'.cs': 'cs',
|
|
167
|
+
'.go': 'go',
|
|
168
|
+
'.rs': 'rust',
|
|
169
|
+
'.swift': 'swift',
|
|
170
|
+
'.kt': 'kotlin',
|
|
171
|
+
'.kts': 'kotlin',
|
|
172
|
+
'.py': 'py',
|
|
173
|
+
'.pyi': 'py',
|
|
174
|
+
'.rb': 'rb',
|
|
175
|
+
'.sh': 'sh',
|
|
176
|
+
'.bash': 'bash',
|
|
177
|
+
'.zsh': 'zsh',
|
|
178
|
+
'.yaml': 'yaml',
|
|
179
|
+
'.yml': 'yml',
|
|
180
|
+
'.toml': 'toml',
|
|
181
|
+
'.html': 'html',
|
|
182
|
+
'.htm': 'html',
|
|
183
|
+
'.xml': 'xml',
|
|
184
|
+
'.vue': 'vue',
|
|
185
|
+
'.svelte': 'svelte',
|
|
186
|
+
'.sql': 'sql',
|
|
187
|
+
'.lua': 'lua',
|
|
188
|
+
};
|
|
189
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/hooks/comment-checker/constants.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC;IAClC,OAAO;IACP,MAAM;IACN,MAAM;IACN,SAAS;IACT,KAAK;IACL,QAAQ;IACR,aAAa;IACb,WAAW;CACZ,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,SAAS;IACT,OAAO;IACP,MAAM;IACN,UAAU;IACV,OAAO;IACP,OAAO;IACP,SAAS;IACT,SAAS;IACT,OAAO;IACP,SAAS;IACT,wBAAwB;IACxB,gBAAgB;IAChB,eAAe;IACf,eAAe;IACf,iBAAiB;IACjB,WAAW;IACX,i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AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAA2B;IAC3D,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,IAAI;IACZ,MAAM,EAAE,IAAI;IACZ,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,IAAI;IACZ,MAAM,EAAE,IAAI;IACZ,MAAM,EAAE,KAAK;IACb,MAAM,EAAE,KAAK;IACb,OAAO,EAAE,MAAM;IACf,IAAI,EAAE,GAAG;IACT,IAAI,EAAE,GAAG;IACT,MAAM,EAAE,KAAK;IACb,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE,KAAK;IACb,MAAM,EAAE,KAAK;IACb,KAAK,EAAE,IAAI;IACX,KAAK,EAAE,IAAI;IACX,KAAK,EAAE,MAAM;IACb,QAAQ,EAAE,OAAO;IACjB,KAAK,EAAE,QAAQ;IACf,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,IAAI;IACZ,KAAK,EAAE,IAAI;IACX,KAAK,EAAE,IAAI;IACX,OAAO,EAAE,MAAM;IACf,MAAM,EAAE,KAAK;IACb,OAAO,EAAE,MAAM;IACf,MAAM,EAAE,KAAK;IACb,OAAO,EAAE,MAAM;IACf,OAAO,EAAE,MAAM;IACf,MAAM,EAAE,MAAM;IACd,MAAM,EAAE,KAAK;IACb,MAAM,EAAE,KAAK;IACb,SAAS,EAAE,QAAQ;IACnB,MAAM,EAAE,KAAK;IACb,MAAM,EAAE,KAAK;CACd,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Comment Checker Filters
|
|
3
|
+
*
|
|
4
|
+
* Filters to determine which comments should be flagged vs skipped.
|
|
5
|
+
*
|
|
6
|
+
* Adapted from oh-my-opencode's comment-checker hook.
|
|
7
|
+
*/
|
|
8
|
+
import type { CommentInfo, FilterResult } from './types.js';
|
|
9
|
+
/**
|
|
10
|
+
* Filter for shebang comments (#!/usr/bin/env ...)
|
|
11
|
+
*/
|
|
12
|
+
export declare function filterShebangComments(comment: CommentInfo): FilterResult;
|
|
13
|
+
/**
|
|
14
|
+
* Filter for BDD (Behavior-Driven Development) comments
|
|
15
|
+
*/
|
|
16
|
+
export declare function filterBddComments(comment: CommentInfo): FilterResult;
|
|
17
|
+
/**
|
|
18
|
+
* Filter for type checker and linter directive comments
|
|
19
|
+
*/
|
|
20
|
+
export declare function filterDirectiveComments(comment: CommentInfo): FilterResult;
|
|
21
|
+
/**
|
|
22
|
+
* Filter for docstring comments in non-public functions
|
|
23
|
+
* (More lenient - only flags excessive docstrings)
|
|
24
|
+
*/
|
|
25
|
+
export declare function filterDocstringComments(comment: CommentInfo): FilterResult;
|
|
26
|
+
/**
|
|
27
|
+
* Filter for copyright/license headers
|
|
28
|
+
*/
|
|
29
|
+
export declare function filterCopyrightComments(comment: CommentInfo): FilterResult;
|
|
30
|
+
/**
|
|
31
|
+
* Filter for TODO/FIXME comments (these are acceptable)
|
|
32
|
+
*/
|
|
33
|
+
export declare function filterTodoComments(comment: CommentInfo): FilterResult;
|
|
34
|
+
/**
|
|
35
|
+
* Apply all filters to a list of comments
|
|
36
|
+
* Returns only comments that should be flagged
|
|
37
|
+
*/
|
|
38
|
+
export declare function applyFilters(comments: CommentInfo[]): CommentInfo[];
|
|
39
|
+
//# sourceMappingURL=filters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filters.d.ts","sourceRoot":"","sources":["../../../src/hooks/comment-checker/filters.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAiB,MAAM,YAAY,CAAC;AAE3E;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,WAAW,GAAG,YAAY,CAMxE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,WAAW,GAAG,YAAY,CAuBpE;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,WAAW,GAAG,YAAY,CAU1E;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,WAAW,GAAG,YAAY,CAI1E;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,WAAW,GAAG,YAAY,CAqB1E;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,WAAW,GAAG,YAAY,CAWrE;AAcD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,WAAW,EAAE,CAUnE"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Comment Checker Filters
|
|
3
|
+
*
|
|
4
|
+
* Filters to determine which comments should be flagged vs skipped.
|
|
5
|
+
*
|
|
6
|
+
* Adapted from oh-my-opencode's comment-checker hook.
|
|
7
|
+
*/
|
|
8
|
+
import { BDD_KEYWORDS, TYPE_CHECKER_PREFIXES } from './constants.js';
|
|
9
|
+
/**
|
|
10
|
+
* Filter for shebang comments (#!/usr/bin/env ...)
|
|
11
|
+
*/
|
|
12
|
+
export function filterShebangComments(comment) {
|
|
13
|
+
const text = comment.text.trim();
|
|
14
|
+
if (text.startsWith('#!') && comment.lineNumber === 1) {
|
|
15
|
+
return { shouldSkip: true, reason: 'shebang' };
|
|
16
|
+
}
|
|
17
|
+
return { shouldSkip: false };
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Filter for BDD (Behavior-Driven Development) comments
|
|
21
|
+
*/
|
|
22
|
+
export function filterBddComments(comment) {
|
|
23
|
+
// Don't filter docstrings
|
|
24
|
+
if (comment.isDocstring) {
|
|
25
|
+
return { shouldSkip: false };
|
|
26
|
+
}
|
|
27
|
+
const text = comment.text.toLowerCase().trim();
|
|
28
|
+
// Check for BDD keywords
|
|
29
|
+
for (const keyword of BDD_KEYWORDS) {
|
|
30
|
+
if (text.startsWith(`#${keyword}`) || text.startsWith(`// ${keyword}`)) {
|
|
31
|
+
return { shouldSkip: true, reason: `BDD keyword: ${keyword}` };
|
|
32
|
+
}
|
|
33
|
+
if (text.includes(keyword)) {
|
|
34
|
+
// More lenient check for keywords anywhere in comment
|
|
35
|
+
const words = text.split(/\s+/);
|
|
36
|
+
if (words.some(w => BDD_KEYWORDS.has(w.replace(/[^a-z&]/g, '')))) {
|
|
37
|
+
return { shouldSkip: true, reason: `BDD keyword detected` };
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return { shouldSkip: false };
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Filter for type checker and linter directive comments
|
|
45
|
+
*/
|
|
46
|
+
export function filterDirectiveComments(comment) {
|
|
47
|
+
const text = comment.text.toLowerCase().trim();
|
|
48
|
+
for (const prefix of TYPE_CHECKER_PREFIXES) {
|
|
49
|
+
if (text.includes(prefix.toLowerCase())) {
|
|
50
|
+
return { shouldSkip: true, reason: `directive: ${prefix}` };
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return { shouldSkip: false };
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Filter for docstring comments in non-public functions
|
|
57
|
+
* (More lenient - only flags excessive docstrings)
|
|
58
|
+
*/
|
|
59
|
+
export function filterDocstringComments(comment) {
|
|
60
|
+
// We don't skip docstrings by default - they should be reviewed
|
|
61
|
+
// This filter is here for extensibility
|
|
62
|
+
return { shouldSkip: false };
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Filter for copyright/license headers
|
|
66
|
+
*/
|
|
67
|
+
export function filterCopyrightComments(comment) {
|
|
68
|
+
const text = comment.text.toLowerCase();
|
|
69
|
+
const copyrightPatterns = [
|
|
70
|
+
'copyright',
|
|
71
|
+
'license',
|
|
72
|
+
'licensed under',
|
|
73
|
+
'spdx-license-identifier',
|
|
74
|
+
'all rights reserved',
|
|
75
|
+
'mit license',
|
|
76
|
+
'apache license',
|
|
77
|
+
'gnu general public',
|
|
78
|
+
'bsd license',
|
|
79
|
+
];
|
|
80
|
+
for (const pattern of copyrightPatterns) {
|
|
81
|
+
if (text.includes(pattern)) {
|
|
82
|
+
return { shouldSkip: true, reason: 'copyright/license' };
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return { shouldSkip: false };
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Filter for TODO/FIXME comments (these are acceptable)
|
|
89
|
+
*/
|
|
90
|
+
export function filterTodoComments(comment) {
|
|
91
|
+
const text = comment.text.toUpperCase();
|
|
92
|
+
const todoPatterns = ['TODO', 'FIXME', 'HACK', 'XXX', 'NOTE', 'REVIEW'];
|
|
93
|
+
for (const pattern of todoPatterns) {
|
|
94
|
+
if (text.includes(pattern)) {
|
|
95
|
+
return { shouldSkip: true, reason: `todo marker: ${pattern}` };
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return { shouldSkip: false };
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* All filters in order of application
|
|
102
|
+
*/
|
|
103
|
+
const ALL_FILTERS = [
|
|
104
|
+
filterShebangComments,
|
|
105
|
+
filterBddComments,
|
|
106
|
+
filterDirectiveComments,
|
|
107
|
+
filterCopyrightComments,
|
|
108
|
+
filterTodoComments,
|
|
109
|
+
filterDocstringComments,
|
|
110
|
+
];
|
|
111
|
+
/**
|
|
112
|
+
* Apply all filters to a list of comments
|
|
113
|
+
* Returns only comments that should be flagged
|
|
114
|
+
*/
|
|
115
|
+
export function applyFilters(comments) {
|
|
116
|
+
return comments.filter((comment) => {
|
|
117
|
+
for (const filter of ALL_FILTERS) {
|
|
118
|
+
const result = filter(comment);
|
|
119
|
+
if (result.shouldSkip) {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return true;
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=filters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filters.js","sourceRoot":"","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