oh-my-opencode 4.8.1 → 4.9.1
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/prometheus/system-prompt.d.ts +1 -1
- package/dist/agents/sisyphus/claude-fable-5.d.ts +19 -0
- package/dist/agents/sisyphus/claude-opus-4-7.d.ts +3 -1
- package/dist/agents/sisyphus/claude-opus-4-8.d.ts +19 -0
- package/dist/agents/sisyphus/index.d.ts +4 -0
- package/dist/agents/types.d.ts +2 -2
- package/dist/cli/doctor/checks/codex.d.ts +1 -0
- package/dist/cli/doctor/checks/dependencies.d.ts +2 -2
- package/dist/cli/doctor/checks/tools-gh.d.ts +8 -1
- package/dist/cli/doctor/index.d.ts +1 -0
- package/dist/cli/doctor/types.d.ts +2 -0
- package/dist/cli/index.js +1908 -787
- package/dist/cli/install-codex/codex-config-permissions.d.ts +1 -1
- package/dist/cli/install-codex/codex-config-plugins.d.ts +1 -0
- package/dist/cli/install-codex/codex-config-toml.d.ts +1 -0
- package/dist/cli/install-codex/codex-installer-bin-dir.d.ts +8 -0
- package/dist/cli/install-codex/install-codex.d.ts +1 -8
- package/dist/cli/install-codex/lsp-daemon-reaper.d.ts +5 -0
- package/dist/cli/sparkshell-condense.d.ts +10 -0
- package/dist/cli/sparkshell-parse.d.ts +3 -0
- package/dist/cli/sparkshell-session-context.d.ts +20 -0
- package/dist/cli/sparkshell-spark.d.ts +23 -0
- package/dist/cli/sparkshell.d.ts +8 -1
- package/dist/cli-node/index.js +92564 -0
- package/dist/config/schema/agent-names.d.ts +2 -0
- package/dist/config/schema/hooks.d.ts +0 -2
- package/dist/config/schema/keyword-detector.d.ts +0 -6
- package/dist/config/schema/oh-my-opencode-config.d.ts +2 -4
- package/dist/create-hooks.d.ts +0 -2
- package/dist/features/background-agent/parent-wake-dedupe.d.ts +2 -0
- package/dist/features/background-agent/parent-wake-flush-runner.d.ts +2 -0
- package/dist/features/background-agent/parent-wake-prompt-dispatch.d.ts +1 -0
- package/dist/features/background-agent/parent-wake-session-history.d.ts +4 -0
- package/dist/features/background-agent/parent-wake-session-inspector.d.ts +1 -0
- package/dist/features/builtin-commands/templates/handoff.d.ts +1 -1
- package/dist/features/builtin-skills/index.d.ts +1 -1
- package/dist/features/builtin-skills/skills.d.ts +4 -0
- package/dist/features/opencode-runtime-skills/source-server.d.ts +16 -1
- package/dist/features/opencode-skill-loader/skill-definition-record.d.ts +2 -0
- package/dist/features/team-mode/tools/lifecycle-test-fixture.d.ts +2 -0
- package/dist/features/team-mode/types.d.ts +1 -0
- package/dist/features/tmux-subagent/failed-readiness-cache.d.ts +28 -0
- package/dist/features/tmux-subagent/manager.d.ts +1 -9
- package/dist/features/tmux-subagent/resolve-server-url.d.ts +3 -0
- package/dist/hooks/anthropic-context-window-limit-recovery/executor.d.ts +1 -1
- package/dist/hooks/index.d.ts +0 -1
- package/dist/hooks/keyword-detector/constants.d.ts +0 -4
- package/dist/hooks/keyword-detector/ultrawork/source-detector.d.ts +1 -1
- package/dist/index.js +9001 -1795
- package/dist/oh-my-opencode.schema.json +2 -4
- package/dist/plugin/chat-params.d.ts +1 -8
- package/dist/plugin/hooks/create-core-hooks.d.ts +0 -2
- package/dist/plugin/hooks/create-session-hooks.d.ts +0 -2
- package/dist/plugin/hooks/create-transform-hooks.d.ts +1 -2
- package/dist/plugin/messages-transform.d.ts +0 -1
- package/dist/shared/model-availability.d.ts +10 -2
- package/dist/shared/module-resolution-failure.d.ts +7 -0
- package/package.json +25 -18
- package/packages/ast-grep-mcp/dist/cli.js +2 -10
- package/packages/git-bash-mcp/dist/cli.js +11 -4
- package/packages/lsp-daemon/dist/cli.d.ts +2 -0
- package/packages/lsp-daemon/dist/cli.js +3711 -0
- package/packages/lsp-daemon/dist/daemon-client.d.ts +19 -0
- package/packages/lsp-daemon/dist/daemon-client.js +114 -0
- package/packages/lsp-daemon/dist/daemon-server.d.ts +12 -0
- package/packages/lsp-daemon/dist/daemon-server.js +106 -0
- package/packages/lsp-daemon/dist/ensure-daemon.d.ts +21 -0
- package/packages/lsp-daemon/dist/ensure-daemon.js +97 -0
- package/packages/lsp-daemon/dist/index.d.ts +5 -0
- package/packages/lsp-daemon/dist/index.js +3573 -0
- package/packages/lsp-daemon/dist/lock.d.ts +7 -0
- package/packages/lsp-daemon/dist/lock.js +61 -0
- package/packages/lsp-daemon/dist/package.json +6 -0
- package/packages/lsp-daemon/dist/paths.d.ts +11 -0
- package/packages/lsp-daemon/dist/paths.js +49 -0
- package/packages/lsp-daemon/dist/proxy.d.ts +10 -0
- package/packages/lsp-daemon/dist/proxy.js +61 -0
- package/packages/lsp-daemon/dist/request-routing.d.ts +9 -0
- package/packages/lsp-daemon/dist/request-routing.js +44 -0
- package/packages/lsp-daemon/dist/run-daemon.d.ts +1 -0
- package/packages/lsp-daemon/dist/run-daemon.js +11 -0
- package/packages/lsp-daemon/dist/socket-jsonrpc.d.ts +5 -0
- package/packages/lsp-daemon/dist/socket-jsonrpc.js +25 -0
- package/packages/lsp-daemon/package.json +38 -0
- package/packages/lsp-tools-mcp/dist/cli.js +0 -0
- package/packages/lsp-tools-mcp/dist/lsp/client-wrapper.js +40 -17
- package/packages/lsp-tools-mcp/dist/lsp/client.js +11 -9
- package/packages/lsp-tools-mcp/dist/lsp/config-loader.js +5 -5
- package/packages/lsp-tools-mcp/dist/lsp/directory-diagnostics.js +5 -3
- package/packages/lsp-tools-mcp/dist/lsp/effective-extension.d.ts +1 -0
- package/packages/lsp-tools-mcp/dist/lsp/effective-extension.js +8 -0
- package/packages/lsp-tools-mcp/dist/lsp/infer-extension.js +3 -2
- package/packages/lsp-tools-mcp/dist/lsp/language-mappings.js +1 -0
- package/packages/lsp-tools-mcp/dist/lsp/server-definitions.js +12 -0
- package/packages/lsp-tools-mcp/dist/lsp/server-install-state.d.ts +12 -0
- package/packages/lsp-tools-mcp/dist/lsp/server-install-state.js +51 -0
- package/packages/lsp-tools-mcp/dist/lsp/workspace-edit.js +2 -1
- package/packages/lsp-tools-mcp/dist/request-context.d.ts +7 -0
- package/packages/lsp-tools-mcp/dist/request-context.js +14 -0
- package/packages/lsp-tools-mcp/dist/tools.js +44 -1
- package/packages/omo-codex/plugin/.codex-plugin/plugin.json +46 -33
- package/packages/omo-codex/plugin/.mcp.json +1 -1
- package/packages/omo-codex/plugin/components/comment-checker/dist/apply-patch.d.ts +7 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/apply-patch.js +173 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/cli.d.ts +2 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/cli.js +10 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/codex-hook.d.ts +22 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/codex-hook.js +165 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/core-values.d.ts +1 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/core-values.js +1 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/core.d.ts +5 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/core.js +4 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/hook-input.d.ts +6 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/hook-input.js +10 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/record.d.ts +2 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/record.js +11 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/request-extractor.d.ts +3 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/request-extractor.js +104 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/runner.d.ts +26 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/runner.js +144 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/types.d.ts +43 -0
- package/packages/omo-codex/plugin/components/comment-checker/dist/types.js +1 -0
- package/packages/omo-codex/plugin/components/comment-checker/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/comment-checker/package.json +1 -1
- package/packages/omo-codex/plugin/components/git-bash/dist/cli.d.ts +2 -0
- package/packages/omo-codex/plugin/components/git-bash/dist/cli.js +29 -0
- package/packages/omo-codex/plugin/components/git-bash/dist/codex-hook.d.ts +28 -0
- package/packages/omo-codex/plugin/components/git-bash/dist/codex-hook.js +137 -0
- package/packages/omo-codex/plugin/components/git-bash/dist/index.d.ts +1 -0
- package/packages/omo-codex/plugin/components/git-bash/dist/index.js +1 -0
- package/packages/omo-codex/plugin/components/git-bash/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/git-bash/package.json +5 -2
- package/packages/omo-codex/plugin/components/lsp/.mcp.json +1 -1
- package/packages/omo-codex/plugin/components/lsp/dist/cli.d.ts +2 -0
- package/packages/omo-codex/plugin/components/lsp/dist/cli.js +42 -0
- package/packages/omo-codex/plugin/components/lsp/dist/codex-hook-cli.d.ts +2 -0
- package/packages/omo-codex/plugin/components/lsp/dist/codex-hook-cli.js +40 -0
- package/packages/omo-codex/plugin/components/lsp/dist/codex-hook.d.ts +16 -0
- package/packages/omo-codex/plugin/components/lsp/dist/codex-hook.js +180 -0
- package/packages/omo-codex/plugin/components/lsp/dist/lsp-session-state.d.ts +12 -0
- package/packages/omo-codex/plugin/components/lsp/dist/lsp-session-state.js +95 -0
- package/packages/omo-codex/plugin/components/lsp/dist/mutated-file-paths.d.ts +6 -0
- package/packages/omo-codex/plugin/components/lsp/dist/mutated-file-paths.js +79 -0
- package/packages/omo-codex/plugin/components/lsp/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/lsp/package.json +7 -7
- package/packages/omo-codex/plugin/components/lsp/scripts/build-lsp-daemon.mjs +68 -0
- package/packages/omo-codex/plugin/components/lsp/scripts/build-lsp-tools.mjs +45 -22
- package/packages/omo-codex/plugin/components/lsp/src/cli.ts +1 -1
- package/packages/omo-codex/plugin/components/lsp/src/codex-hook-cli.ts +1 -1
- package/packages/omo-codex/plugin/components/lsp/src/codex-hook.ts +6 -2
- package/packages/omo-codex/plugin/components/lsp/src/lsp-session-state.ts +4 -0
- package/packages/omo-codex/plugin/components/lsp/test/codex-hook-unavailable.test.ts +68 -0
- package/packages/omo-codex/plugin/components/lsp/test/package-smoke.test.ts +8 -20
- package/packages/omo-codex/plugin/components/rules/bundled-rules/hephaestus.md +69 -96
- package/packages/omo-codex/plugin/components/rules/dist/cli.d.ts +2 -0
- package/packages/omo-codex/plugin/components/rules/dist/cli.js +118 -0
- package/packages/omo-codex/plugin/components/rules/dist/codex-hook-options.d.ts +5 -0
- package/packages/omo-codex/plugin/components/rules/dist/codex-hook-options.js +1 -0
- package/packages/omo-codex/plugin/components/rules/dist/codex-hook.d.ts +47 -0
- package/packages/omo-codex/plugin/components/rules/dist/codex-hook.js +127 -0
- package/packages/omo-codex/plugin/components/rules/dist/config.d.ts +2 -0
- package/packages/omo-codex/plugin/components/rules/dist/config.js +100 -0
- package/packages/omo-codex/plugin/components/rules/dist/context-pressure.d.ts +2 -0
- package/packages/omo-codex/plugin/components/rules/dist/context-pressure.js +26 -0
- package/packages/omo-codex/plugin/components/rules/dist/debug-log.d.ts +8 -0
- package/packages/omo-codex/plugin/components/rules/dist/debug-log.js +36 -0
- package/packages/omo-codex/plugin/components/rules/dist/dynamic-target-fingerprints.d.ts +7 -0
- package/packages/omo-codex/plugin/components/rules/dist/dynamic-target-fingerprints.js +65 -0
- package/packages/omo-codex/plugin/components/rules/dist/event-budget.d.ts +3 -0
- package/packages/omo-codex/plugin/components/rules/dist/event-budget.js +14 -0
- package/packages/omo-codex/plugin/components/rules/dist/hook-output.d.ts +2 -0
- package/packages/omo-codex/plugin/components/rules/dist/hook-output.js +24 -0
- package/packages/omo-codex/plugin/components/rules/dist/path-utils.d.ts +4 -0
- package/packages/omo-codex/plugin/components/rules/dist/path-utils.js +24 -0
- package/packages/omo-codex/plugin/components/rules/dist/persistent-cache.d.ts +13 -0
- package/packages/omo-codex/plugin/components/rules/dist/persistent-cache.js +172 -0
- package/packages/omo-codex/plugin/components/rules/dist/post-compact-budget.d.ts +6 -0
- package/packages/omo-codex/plugin/components/rules/dist/post-compact-budget.js +74 -0
- package/packages/omo-codex/plugin/components/rules/dist/post-compact-claim.d.ts +4 -0
- package/packages/omo-codex/plugin/components/rules/dist/post-compact-claim.js +6 -0
- package/packages/omo-codex/plugin/components/rules/dist/post-compact-directive.d.ts +1 -0
- package/packages/omo-codex/plugin/components/rules/dist/post-compact-directive.js +32 -0
- package/packages/omo-codex/plugin/components/rules/dist/post-compact-state.d.ts +13 -0
- package/packages/omo-codex/plugin/components/rules/dist/post-compact-state.js +29 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/cache.d.ts +9 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/cache.js +51 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/constants.d.ts +70 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/constants.js +101 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-dynamic-cache.d.ts +5 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-dynamic-cache.js +60 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-dynamic-loader.d.ts +6 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-dynamic-loader.js +61 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-loader.d.ts +7 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-loader.js +60 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-paths.d.ts +11 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-paths.js +75 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-static-loader.d.ts +6 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-static-loader.js +29 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-types.d.ts +44 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine-types.js +1 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine.d.ts +5 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/engine.js +85 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/errors.d.ts +6 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/errors.js +12 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/finder-cache.d.ts +14 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/finder-cache.js +51 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/finder-paths.d.ts +6 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/finder-paths.js +33 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/finder-sources.d.ts +5 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/finder-sources.js +40 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/finder.d.ts +28 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/finder.js +146 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/formatter.d.ts +7 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/formatter.js +112 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/matcher.d.ts +18 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/matcher.js +93 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/ordering.d.ts +3 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/ordering.js +27 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/parser-frontmatter.d.ts +7 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/parser-frontmatter.js +30 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/parser-yaml.d.ts +2 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/parser-yaml.js +237 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/parser.d.ts +3 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/parser.js +31 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/plugin-root.d.ts +1 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/plugin-root.js +48 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/project-root.d.ts +1 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/project-root.js +23 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/scanner.d.ts +14 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/scanner.js +111 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/sources.d.ts +3 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/sources.js +9 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/truncator.d.ts +18 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/truncator.js +59 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/types.d.ts +126 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules/types.js +8 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules-engine-factory.d.ts +6 -0
- package/packages/omo-codex/plugin/components/rules/dist/rules-engine-factory.js +20 -0
- package/packages/omo-codex/plugin/components/rules/dist/session-state-lock.d.ts +3 -0
- package/packages/omo-codex/plugin/components/rules/dist/session-state-lock.js +41 -0
- package/packages/omo-codex/plugin/components/rules/dist/sparkshell-awareness.d.ts +10 -0
- package/packages/omo-codex/plugin/components/rules/dist/sparkshell-awareness.js +90 -0
- package/packages/omo-codex/plugin/components/rules/dist/static-injection.d.ts +3 -0
- package/packages/omo-codex/plugin/components/rules/dist/static-injection.js +128 -0
- package/packages/omo-codex/plugin/components/rules/dist/tool-paths.d.ts +6 -0
- package/packages/omo-codex/plugin/components/rules/dist/tool-paths.js +168 -0
- package/packages/omo-codex/plugin/components/rules/dist/transcript-rule-filter.d.ts +4 -0
- package/packages/omo-codex/plugin/components/rules/dist/transcript-rule-filter.js +49 -0
- package/packages/omo-codex/plugin/components/rules/dist/transcript-search.d.ts +4 -0
- package/packages/omo-codex/plugin/components/rules/dist/transcript-search.js +91 -0
- package/packages/omo-codex/plugin/components/rules/hooks/hooks.json +4 -4
- package/packages/omo-codex/plugin/components/rules/package.json +1 -1
- package/packages/omo-codex/plugin/components/rules/src/codex-hook.ts +4 -2
- package/packages/omo-codex/plugin/components/rules/src/config.ts +13 -0
- package/packages/omo-codex/plugin/components/rules/src/event-budget.ts +17 -0
- package/packages/omo-codex/plugin/components/rules/src/persistent-cache.ts +4 -1
- package/packages/omo-codex/plugin/components/rules/src/post-compact-directive.ts +39 -0
- package/packages/omo-codex/plugin/components/rules/src/rules/constants.ts +16 -0
- package/packages/omo-codex/plugin/components/rules/src/rules/engine.ts +8 -0
- package/packages/omo-codex/plugin/components/rules/src/rules/types.ts +4 -0
- package/packages/omo-codex/plugin/components/rules/src/sparkshell-awareness.ts +53 -4
- package/packages/omo-codex/plugin/components/rules/src/static-injection.ts +127 -7
- package/packages/omo-codex/plugin/components/rules/src/transcript-rule-filter.ts +9 -1
- package/packages/omo-codex/plugin/components/rules/test/bundled-rules.test.ts +4 -2
- package/packages/omo-codex/plugin/components/rules/test/codex-hook-post-compact-budget.test.ts +7 -2
- package/packages/omo-codex/plugin/components/rules/test/codex-hook-post-compact-context.test.ts +9 -9
- package/packages/omo-codex/plugin/components/rules/test/codex-hook-post-compact-dedup.test.ts +10 -4
- package/packages/omo-codex/plugin/components/rules/test/codex-hook-post-compact-directive.test.ts +241 -0
- package/packages/omo-codex/plugin/components/rules/test/event-budget.test.ts +168 -0
- package/packages/omo-codex/plugin/components/rules/test/post-compact-budget.test.ts +4 -0
- package/packages/omo-codex/plugin/components/rules/test/sparkshell-awareness.test.ts +86 -3
- package/packages/omo-codex/plugin/components/start-work-continuation/directive.md +15 -15
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/boulder-reader.d.ts +16 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/boulder-reader.js +146 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/cli.d.ts +2 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/cli.js +49 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/codex-hook.d.ts +2 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/codex-hook.js +80 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/directive.d.ts +1 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/directive.js +2 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/index.d.ts +5 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/index.js +3 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/types.d.ts +20 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/dist/types.js +1 -0
- package/packages/omo-codex/plugin/components/start-work-continuation/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/start-work-continuation/package.json +1 -1
- package/packages/omo-codex/plugin/components/start-work-continuation/test/codex-hook.test.ts +24 -2
- package/packages/omo-codex/plugin/components/telemetry/dist/atomic-write.d.ts +1 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/atomic-write.js +18 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/cli.d.ts +2 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/cli.js +62 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/codex-hook.d.ts +15 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/codex-hook.js +42 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/data-path.d.ts +10 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/data-path.js +35 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/diagnostics.d.ts +12 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/diagnostics.js +108 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/env-flags.d.ts +4 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/env-flags.js +31 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/posthog-activity-state.d.ts +8 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/posthog-activity-state.js +68 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/posthog.d.ts +21 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/posthog.js +133 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/product-identity.d.ts +8 -0
- package/packages/omo-codex/plugin/components/telemetry/dist/product-identity.js +29 -0
- package/packages/omo-codex/plugin/components/telemetry/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/telemetry/package.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/agents/explorer.toml +5 -13
- package/packages/omo-codex/plugin/components/ultrawork/agents/librarian.toml +61 -185
- package/packages/omo-codex/plugin/components/ultrawork/agents/plan.toml +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/directive.md +122 -117
- package/packages/omo-codex/plugin/components/ultrawork/dist/cli.d.ts +2 -0
- package/packages/omo-codex/plugin/components/ultrawork/dist/cli.js +48 -0
- package/packages/omo-codex/plugin/components/ultrawork/dist/codex-hook.d.ts +7 -0
- package/packages/omo-codex/plugin/components/ultrawork/dist/codex-hook.js +122 -0
- package/packages/omo-codex/plugin/components/ultrawork/dist/directive.d.ts +1 -0
- package/packages/omo-codex/plugin/components/ultrawork/dist/directive.js +2 -0
- package/packages/omo-codex/plugin/components/ultrawork/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/package.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/SKILL.md +20 -11
- package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/references/full-workflow.md +17 -11
- package/packages/omo-codex/plugin/components/ultrawork/test/codex-hook.test.ts +2 -5
- package/packages/omo-codex/plugin/components/ultrawork/test/package-smoke.test.ts +0 -71
- package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint.d.ts +16 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint.js +200 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-arg-parser.d.ts +17 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-arg-parser.js +97 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-commands.d.ts +4 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-commands.js +183 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-output.d.ts +6 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-output.js +55 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-steering.d.ts +12 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli-steering.js +145 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli.d.ts +2 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/cli.js +39 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/codex-goal-instruction.d.ts +13 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/codex-goal-instruction.js +100 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/codex-goal-snapshot.d.ts +26 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/codex-goal-snapshot.js +97 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/codex-hook.d.ts +28 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/codex-hook.js +145 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/command-types.d.ts +34 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/command-types.js +1 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/constants.d.ts +16 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/constants.js +41 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/domain-types.d.ts +95 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/domain-types.js +1 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/evidence.d.ts +31 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/evidence.js +119 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/goal-status.d.ts +12 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/goal-status.js +69 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/paths.d.ts +16 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/paths.js +59 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/plan-crud.d.ts +48 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/plan-crud.js +119 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/plan-io.d.ts +8 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/plan-io.js +89 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate.d.ts +6 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate.js +123 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/review-blockers.d.ts +16 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/review-blockers.js +70 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/runtime.d.ts +10 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/runtime.js +13 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/steering-types.d.ts +63 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/steering-types.js +1 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/steering.d.ts +6 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/steering.js +292 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/types.d.ts +5 -0
- package/packages/omo-codex/plugin/components/ulw-loop/dist/types.js +5 -0
- package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/ulw-loop/package.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/SKILL.md +14 -14
- package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/references/full-workflow.md +24 -25
- package/packages/omo-codex/plugin/components/ulw-loop/src/cli-commands.ts +17 -3
- package/packages/omo-codex/plugin/components/ulw-loop/src/cli.ts +2 -1
- package/packages/omo-codex/plugin/components/ulw-loop/src/codex-goal-instruction.ts +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/test/cli-entrypoint.test.ts +95 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/package-smoke.test.ts +0 -96
- package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate.test.ts +23 -0
- package/packages/omo-codex/plugin/components/ulw-loop/test/skill-contract.test.ts +46 -0
- package/packages/omo-codex/plugin/hooks/hooks.json +16 -16
- package/packages/omo-codex/plugin/package-lock.json +10 -9
- package/packages/omo-codex/plugin/package.json +27 -26
- package/packages/omo-codex/plugin/scripts/auto-update.mjs +64 -15
- package/packages/omo-codex/plugin/scripts/build-bundled-mcp-runtimes.mjs +16 -0
- package/packages/omo-codex/plugin/scripts/migrate-codex-config/multi-agent-v2-guard.mjs +82 -18
- package/packages/omo-codex/plugin/scripts/migrate-codex-config.mjs +2 -2
- package/packages/omo-codex/plugin/scripts/sync-skills.mjs +23 -11
- package/packages/omo-codex/plugin/scripts/sync-version.mjs +94 -0
- package/packages/omo-codex/plugin/skills/init-deep/SKILL.md +9 -9
- package/packages/omo-codex/plugin/skills/lcx-contribute-bug-fix/SKILL.md +16 -1
- package/packages/omo-codex/plugin/skills/lcx-doctor/SKILL.md +93 -0
- package/packages/omo-codex/plugin/skills/lcx-doctor/agents/openai.yaml +11 -0
- package/packages/omo-codex/plugin/skills/lcx-report-bug/SKILL.md +17 -13
- package/packages/omo-codex/plugin/skills/lsp-setup/SKILL.md +139 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/bash/README.md +60 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/c-cpp/README.md +61 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/csharp/README.md +71 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/dart/README.md +48 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/elixir/README.md +51 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/go/README.md +57 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/haskell/README.md +57 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/java/README.md +57 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/julia/README.md +60 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/kotlin/README.md +59 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/lua/README.md +66 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/php/README.md +62 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/python/README.md +71 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/ruby/README.md +53 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/rust/README.md +59 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/swift/README.md +51 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/terraform/README.md +62 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/typescript/README.md +77 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/yaml/README.md +70 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/references/zig/README.md +49 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/scripts/detect-lsp.ts +210 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/scripts/lsp-server-table.ts +177 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/scripts/tsconfig.json +17 -0
- package/packages/omo-codex/plugin/skills/lsp-setup/scripts/verify-lsp.ts +147 -0
- package/packages/omo-codex/plugin/skills/refactor/SKILL.md +9 -9
- package/packages/omo-codex/plugin/skills/remove-ai-slops/SKILL.md +10 -10
- package/packages/omo-codex/plugin/skills/review-work/SKILL.md +20 -22
- package/packages/omo-codex/plugin/skills/start-work/SKILL.md +38 -61
- package/packages/omo-codex/plugin/skills/ultraresearch/SKILL.md +135 -677
- package/packages/omo-codex/plugin/skills/ulw-loop/SKILL.md +14 -14
- package/packages/omo-codex/plugin/skills/ulw-loop/references/full-workflow.md +24 -25
- package/packages/omo-codex/plugin/skills/ulw-plan/SKILL.md +20 -11
- package/packages/omo-codex/plugin/skills/ulw-plan/references/full-workflow.md +17 -11
- package/packages/omo-codex/plugin/skills/visual-qa/SKILL.md +9 -9
- package/packages/omo-codex/plugin/test/aggregate-build.test.mjs +2 -1
- package/packages/omo-codex/plugin/test/aggregate-mcp.test.mjs +1 -1
- package/packages/omo-codex/plugin/test/aggregate-plugin-fixture.mjs +5 -5
- package/packages/omo-codex/plugin/test/aggregate-skills.test.mjs +6 -6
- package/packages/omo-codex/plugin/test/auto-update-restart-notice.test.mjs +194 -0
- package/packages/omo-codex/plugin/test/auto-update.test.mjs +17 -0
- package/packages/omo-codex/plugin/test/lcx-bug-skills.test.mjs +15 -44
- package/packages/omo-codex/plugin/test/lsp-prebuild-layouts.test.mjs +140 -0
- package/packages/omo-codex/plugin/test/migrate-codex-config.test.mjs +189 -7
- package/packages/omo-codex/plugin/test/start-work-skill.test.mjs +9 -31
- package/packages/omo-codex/plugin/test/sync-skills-orchestration.test.mjs +68 -4
- package/packages/omo-codex/plugin/test/sync-skills-test-support.mjs +119 -0
- package/packages/omo-codex/plugin/test/sync-skills.test.mjs +11 -112
- package/packages/omo-codex/plugin/test/sync-version.test.mjs +68 -0
- package/packages/omo-codex/plugin/test/ultraresearch-skill-contract.test.mjs +126 -0
- package/packages/omo-codex/plugin/test/ulw-plan-skill.test.mjs +2 -2
- package/packages/omo-codex/scripts/install/bin-dir.mjs +20 -0
- package/packages/omo-codex/scripts/install/bin-links.mjs +43 -6
- package/packages/omo-codex/scripts/install/cache.mjs +4 -0
- package/packages/omo-codex/scripts/install/config.mjs +4 -4
- package/packages/omo-codex/scripts/install/delegated-command.mjs +5 -1
- package/packages/omo-codex/scripts/install/git-bash-mcp-env.mjs +28 -0
- package/packages/omo-codex/scripts/install/git-bash.mjs +12 -4
- package/packages/omo-codex/scripts/install/git-bash.test.mjs +39 -4
- package/packages/omo-codex/scripts/install/hook-targets.mjs +46 -0
- package/packages/omo-codex/scripts/install/multi-agent-v2-config.mjs +12 -2
- package/packages/omo-codex/scripts/install/process.mjs +1 -0
- package/packages/omo-codex/scripts/install-bin-links.test.mjs +131 -3
- package/packages/omo-codex/scripts/install-config-git-bash.test.mjs +91 -0
- package/packages/omo-codex/scripts/install-config.test.mjs +50 -44
- package/packages/omo-codex/scripts/install-delegated-command.test.mjs +78 -0
- package/packages/omo-codex/scripts/install-git-bash-mcp-env.test.mjs +93 -0
- package/packages/omo-codex/scripts/install-hook-targets.test.mjs +100 -0
- package/packages/omo-codex/scripts/install-lazycodex-version-stamp.test.mjs +3 -1
- package/packages/omo-codex/scripts/install-local.mjs +7 -18
- package/packages/omo-codex/scripts/install-local.test.mjs +34 -1
- package/packages/shared-skills/skills/lcx-contribute-bug-fix/SKILL.md +16 -1
- package/packages/shared-skills/skills/lcx-doctor/SKILL.md +93 -0
- package/packages/shared-skills/skills/lcx-doctor/agents/openai.yaml +11 -0
- package/packages/shared-skills/skills/lcx-report-bug/SKILL.md +17 -13
- package/packages/shared-skills/skills/lsp-setup/SKILL.md +139 -0
- package/packages/shared-skills/skills/lsp-setup/references/bash/README.md +60 -0
- package/packages/shared-skills/skills/lsp-setup/references/c-cpp/README.md +61 -0
- package/packages/shared-skills/skills/lsp-setup/references/csharp/README.md +71 -0
- package/packages/shared-skills/skills/lsp-setup/references/dart/README.md +48 -0
- package/packages/shared-skills/skills/lsp-setup/references/elixir/README.md +51 -0
- package/packages/shared-skills/skills/lsp-setup/references/go/README.md +57 -0
- package/packages/shared-skills/skills/lsp-setup/references/haskell/README.md +57 -0
- package/packages/shared-skills/skills/lsp-setup/references/java/README.md +57 -0
- package/packages/shared-skills/skills/lsp-setup/references/julia/README.md +60 -0
- package/packages/shared-skills/skills/lsp-setup/references/kotlin/README.md +59 -0
- package/packages/shared-skills/skills/lsp-setup/references/lua/README.md +66 -0
- package/packages/shared-skills/skills/lsp-setup/references/php/README.md +62 -0
- package/packages/shared-skills/skills/lsp-setup/references/python/README.md +71 -0
- package/packages/shared-skills/skills/lsp-setup/references/ruby/README.md +53 -0
- package/packages/shared-skills/skills/lsp-setup/references/rust/README.md +59 -0
- package/packages/shared-skills/skills/lsp-setup/references/swift/README.md +51 -0
- package/packages/shared-skills/skills/lsp-setup/references/terraform/README.md +62 -0
- package/packages/shared-skills/skills/lsp-setup/references/typescript/README.md +77 -0
- package/packages/shared-skills/skills/lsp-setup/references/yaml/README.md +70 -0
- package/packages/shared-skills/skills/lsp-setup/references/zig/README.md +49 -0
- package/packages/shared-skills/skills/lsp-setup/scripts/detect-lsp.ts +210 -0
- package/packages/shared-skills/skills/lsp-setup/scripts/lsp-server-table.ts +177 -0
- package/packages/shared-skills/skills/lsp-setup/scripts/tsconfig.json +17 -0
- package/packages/shared-skills/skills/lsp-setup/scripts/verify-lsp.ts +147 -0
- package/packages/shared-skills/skills/remove-ai-slops/SKILL.md +1 -1
- package/packages/shared-skills/skills/review-work/SKILL.md +10 -14
- package/packages/shared-skills/skills/start-work/SKILL.md +30 -59
- package/packages/shared-skills/skills/ultraresearch/SKILL.md +126 -667
- package/dist/hooks/anthropic-effort/hook.d.ts +0 -26
- package/dist/hooks/anthropic-effort/index.d.ts +0 -1
- package/dist/hooks/keyword-detector/analyze/default.d.ts +0 -12
- package/dist/hooks/keyword-detector/analyze/index.d.ts +0 -1
- package/dist/hooks/keyword-detector/search/default.d.ts +0 -12
- package/dist/hooks/keyword-detector/search/index.d.ts +0 -1
- package/dist/hooks/thinking-block-validator/hook.d.ts +0 -12
- package/dist/hooks/thinking-block-validator/index.d.ts +0 -1
- package/packages/omo-codex/plugin/components/ultrawork/test/directive-contract.test.ts +0 -18
- package/packages/omo-codex/plugin/test/global-review-debug-gate.test.mjs +0 -29
- package/packages/omo-codex/plugin/test/subagent-guidance.test.mjs +0 -151
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { stdin as processStdin, stdout as processStdout } from "node:process";
|
|
3
|
+
import { extractCommentCheckRequests, isRecord, toHookInput, } from "./core.js";
|
|
4
|
+
import { runCommentChecker } from "./runner.js";
|
|
5
|
+
const DEFAULT_MAX_HOOK_FEEDBACK_CHARS = 8000;
|
|
6
|
+
const CONTEXT_PRESSURE_MAX_HOOK_FEEDBACK_CHARS = 1200;
|
|
7
|
+
const CONTEXT_PRESSURE_MARKERS = [
|
|
8
|
+
"context compacted",
|
|
9
|
+
"context_length_exceeded",
|
|
10
|
+
"skill descriptions were shortened",
|
|
11
|
+
"context_too_large",
|
|
12
|
+
"codex ran out of room in the model's context window",
|
|
13
|
+
"your input exceeds the context window",
|
|
14
|
+
"long threads and multiple compactions",
|
|
15
|
+
];
|
|
16
|
+
export function extractCodexCommentCheckRequests(input) {
|
|
17
|
+
return extractCommentCheckRequests(toToolResultLike(input));
|
|
18
|
+
}
|
|
19
|
+
export async function runCommentCheckerPostToolUse(input, options = {}) {
|
|
20
|
+
const requests = extractCodexCommentCheckRequests(input);
|
|
21
|
+
if (requests.length === 0)
|
|
22
|
+
return "";
|
|
23
|
+
const runner = options.run ?? runCommentChecker;
|
|
24
|
+
const warnings = [];
|
|
25
|
+
for (const request of requests) {
|
|
26
|
+
const context = {
|
|
27
|
+
sessionId: input.session_id,
|
|
28
|
+
cwd: input.cwd,
|
|
29
|
+
...(input.transcript_path === null ? {} : { transcriptPath: input.transcript_path }),
|
|
30
|
+
};
|
|
31
|
+
const result = await runner(toHookInput(request, context));
|
|
32
|
+
if (result.status === "missing" || result.status === "pass")
|
|
33
|
+
continue;
|
|
34
|
+
if (result.status === "error")
|
|
35
|
+
continue;
|
|
36
|
+
const message = normalizeHookText(result.message);
|
|
37
|
+
if (message.length > 0) {
|
|
38
|
+
warnings.push({ filePath: request.filePath, message });
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (warnings.length === 0)
|
|
42
|
+
return "";
|
|
43
|
+
return JSON.stringify({
|
|
44
|
+
decision: "block",
|
|
45
|
+
reason: limitHookText(formatWarnings(warnings), hookFeedbackLimit(input.transcript_path)),
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
export async function runCodexHookCli() {
|
|
49
|
+
const input = await readStdin();
|
|
50
|
+
if (input.trim().length === 0)
|
|
51
|
+
return;
|
|
52
|
+
const parsed = parseCodexPostToolUseInput(input);
|
|
53
|
+
if (!parsed)
|
|
54
|
+
return;
|
|
55
|
+
const output = await runCommentCheckerPostToolUse(parsed);
|
|
56
|
+
if (output.length > 0) {
|
|
57
|
+
processStdout.write(output);
|
|
58
|
+
processStdout.write("\n");
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
export function parseCodexPostToolUseInput(input) {
|
|
62
|
+
let parsed;
|
|
63
|
+
try {
|
|
64
|
+
parsed = JSON.parse(input);
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
return isCodexPostToolUseInput(parsed) ? parsed : undefined;
|
|
70
|
+
}
|
|
71
|
+
function toToolResultLike(input) {
|
|
72
|
+
return {
|
|
73
|
+
toolName: input.tool_name,
|
|
74
|
+
input: normalizeToolInput(input.tool_name, input.tool_input),
|
|
75
|
+
content: normalizeToolResponse(input.tool_response),
|
|
76
|
+
isError: isErrorResponse(input.tool_response),
|
|
77
|
+
details: isRecord(input.tool_response) ? input.tool_response : undefined,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function normalizeToolInput(toolName, toolInput) {
|
|
81
|
+
if (toolName === "apply_patch" && typeof toolInput["command"] === "string") {
|
|
82
|
+
return {
|
|
83
|
+
...toolInput,
|
|
84
|
+
input: toolInput["command"],
|
|
85
|
+
patch: toolInput["command"],
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
return toolInput;
|
|
89
|
+
}
|
|
90
|
+
function normalizeToolResponse(toolResponse) {
|
|
91
|
+
if (typeof toolResponse === "string") {
|
|
92
|
+
return [{ type: "text", text: toolResponse }];
|
|
93
|
+
}
|
|
94
|
+
if (isRecord(toolResponse) && typeof toolResponse["text"] === "string") {
|
|
95
|
+
return [{ type: "text", text: toolResponse["text"] }];
|
|
96
|
+
}
|
|
97
|
+
return [];
|
|
98
|
+
}
|
|
99
|
+
function isErrorResponse(toolResponse) {
|
|
100
|
+
return isRecord(toolResponse) && toolResponse["is_error"] === true;
|
|
101
|
+
}
|
|
102
|
+
function formatWarnings(warnings) {
|
|
103
|
+
return warnings
|
|
104
|
+
.map((warning) => `comment-checker found issues in ${warning.filePath}:\n${warning.message}`)
|
|
105
|
+
.join("\n\n");
|
|
106
|
+
}
|
|
107
|
+
function normalizeHookText(value) {
|
|
108
|
+
return value.replace(/\r\n/g, "\n").replace(/\r/g, "\n").trim();
|
|
109
|
+
}
|
|
110
|
+
function hookFeedbackLimit(transcriptPath) {
|
|
111
|
+
return isContextPressureTranscript(transcriptPath)
|
|
112
|
+
? CONTEXT_PRESSURE_MAX_HOOK_FEEDBACK_CHARS
|
|
113
|
+
: DEFAULT_MAX_HOOK_FEEDBACK_CHARS;
|
|
114
|
+
}
|
|
115
|
+
function isContextPressureTranscript(transcriptPath) {
|
|
116
|
+
if (transcriptPath === null)
|
|
117
|
+
return false;
|
|
118
|
+
try {
|
|
119
|
+
return hasContextPressureMarker(readFileSync(transcriptPath, "utf8"));
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
if (error instanceof Error)
|
|
123
|
+
return false;
|
|
124
|
+
throw error;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
function hasContextPressureMarker(text) {
|
|
128
|
+
const normalizedText = text.toLowerCase();
|
|
129
|
+
return CONTEXT_PRESSURE_MARKERS.some((marker) => normalizedText.includes(marker));
|
|
130
|
+
}
|
|
131
|
+
function limitHookText(text, maxChars) {
|
|
132
|
+
if (text.length <= maxChars)
|
|
133
|
+
return text;
|
|
134
|
+
const marker = `\n\n[Truncated hook output to ${maxChars} chars to avoid Codex context overflow.]`;
|
|
135
|
+
if (marker.length >= maxChars)
|
|
136
|
+
return marker.slice(0, maxChars);
|
|
137
|
+
const head = text.slice(0, maxChars - marker.length).replace(/[ \t\r\n]+$/, "");
|
|
138
|
+
return `${head}${marker}`;
|
|
139
|
+
}
|
|
140
|
+
function isCodexPostToolUseInput(value) {
|
|
141
|
+
return (isRecord(value) &&
|
|
142
|
+
value["hook_event_name"] === "PostToolUse" &&
|
|
143
|
+
typeof value["session_id"] === "string" &&
|
|
144
|
+
typeof value["turn_id"] === "string" &&
|
|
145
|
+
(typeof value["transcript_path"] === "string" || value["transcript_path"] === null) &&
|
|
146
|
+
typeof value["cwd"] === "string" &&
|
|
147
|
+
typeof value["model"] === "string" &&
|
|
148
|
+
typeof value["permission_mode"] === "string" &&
|
|
149
|
+
typeof value["tool_name"] === "string" &&
|
|
150
|
+
isRecord(value["tool_input"]) &&
|
|
151
|
+
typeof value["tool_use_id"] === "string");
|
|
152
|
+
}
|
|
153
|
+
function readStdin() {
|
|
154
|
+
return new Promise((resolve, reject) => {
|
|
155
|
+
let data = "";
|
|
156
|
+
processStdin.setEncoding("utf-8");
|
|
157
|
+
processStdin.on("data", (chunk) => {
|
|
158
|
+
data += chunk;
|
|
159
|
+
});
|
|
160
|
+
processStdin.once("error", reject);
|
|
161
|
+
processStdin.once("end", () => {
|
|
162
|
+
resolve(data);
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getString, isRecord } from "./record.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getString, isRecord } from "./record.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { parseApplyPatchRequests } from "./apply-patch.js";
|
|
2
|
+
export { toHookInput } from "./hook-input.js";
|
|
3
|
+
export { isRecord } from "./record.js";
|
|
4
|
+
export { extractCommentCheckRequests, isToolFailureOutput } from "./request-extractor.js";
|
|
5
|
+
export type { CheckerEdit, CheckerToolInput, CheckerToolName, CommentCheckerHookInput, CommentCheckRequest, ImageContent, TextContent, ToolResultContent, ToolResultLike, } from "./types.js";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CommentCheckerHookInput, CommentCheckRequest } from "./types.js";
|
|
2
|
+
export declare function toHookInput(request: CommentCheckRequest, context: {
|
|
3
|
+
readonly sessionId: string;
|
|
4
|
+
readonly cwd: string;
|
|
5
|
+
readonly transcriptPath?: string;
|
|
6
|
+
}): CommentCheckerHookInput;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export function toHookInput(request, context) {
|
|
2
|
+
return {
|
|
3
|
+
session_id: context.sessionId,
|
|
4
|
+
tool_name: request.toolName,
|
|
5
|
+
transcript_path: context.transcriptPath ?? "",
|
|
6
|
+
cwd: context.cwd,
|
|
7
|
+
hook_event_name: "PostToolUse",
|
|
8
|
+
tool_input: request.toolInput,
|
|
9
|
+
};
|
|
10
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export function getString(input, keys) {
|
|
2
|
+
for (const key of keys) {
|
|
3
|
+
const value = input[key];
|
|
4
|
+
if (typeof value === "string")
|
|
5
|
+
return value;
|
|
6
|
+
}
|
|
7
|
+
return undefined;
|
|
8
|
+
}
|
|
9
|
+
export function isRecord(value) {
|
|
10
|
+
return typeof value === "object" && value !== null;
|
|
11
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { extractApplyPatchRequests } from "./apply-patch.js";
|
|
2
|
+
import { getString, isRecord } from "./record.js";
|
|
3
|
+
export function extractCommentCheckRequests(event) {
|
|
4
|
+
if (event.isError)
|
|
5
|
+
return [];
|
|
6
|
+
if (isToolFailureOutput(getContentText(event.content)))
|
|
7
|
+
return [];
|
|
8
|
+
const toolName = event.toolName.toLowerCase();
|
|
9
|
+
if (toolName === "write")
|
|
10
|
+
return extractWriteRequest(event);
|
|
11
|
+
if (toolName === "edit")
|
|
12
|
+
return extractEditRequest(event);
|
|
13
|
+
if (toolName === "multiedit" || toolName === "multi_edit")
|
|
14
|
+
return extractMultiEditRequest(event);
|
|
15
|
+
if (toolName === "apply_patch")
|
|
16
|
+
return extractApplyPatchRequests(event);
|
|
17
|
+
return [];
|
|
18
|
+
}
|
|
19
|
+
export function isToolFailureOutput(text) {
|
|
20
|
+
const lower = text.trim().toLowerCase();
|
|
21
|
+
return (lower.startsWith("error") ||
|
|
22
|
+
lower.includes("error:") ||
|
|
23
|
+
lower.includes("failed to") ||
|
|
24
|
+
lower.includes("could not"));
|
|
25
|
+
}
|
|
26
|
+
function extractWriteRequest(event) {
|
|
27
|
+
const filePath = getString(event.input, ["filePath", "file_path", "path"]);
|
|
28
|
+
const content = getString(event.input, ["content"]);
|
|
29
|
+
if (!filePath || content === undefined)
|
|
30
|
+
return [];
|
|
31
|
+
return [
|
|
32
|
+
{
|
|
33
|
+
sourceToolName: event.toolName,
|
|
34
|
+
toolName: "Write",
|
|
35
|
+
filePath,
|
|
36
|
+
toolInput: {
|
|
37
|
+
file_path: filePath,
|
|
38
|
+
content,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
];
|
|
42
|
+
}
|
|
43
|
+
function extractEditRequest(event) {
|
|
44
|
+
const filePath = getString(event.input, ["filePath", "file_path", "path"]);
|
|
45
|
+
const oldString = getString(event.input, ["oldString", "old_string"]);
|
|
46
|
+
const newString = getString(event.input, ["newString", "new_string"]);
|
|
47
|
+
if (!filePath || oldString === undefined || newString === undefined)
|
|
48
|
+
return [];
|
|
49
|
+
return [
|
|
50
|
+
{
|
|
51
|
+
sourceToolName: event.toolName,
|
|
52
|
+
toolName: "Edit",
|
|
53
|
+
filePath,
|
|
54
|
+
toolInput: {
|
|
55
|
+
file_path: filePath,
|
|
56
|
+
old_string: oldString,
|
|
57
|
+
new_string: newString,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
];
|
|
61
|
+
}
|
|
62
|
+
function extractMultiEditRequest(event) {
|
|
63
|
+
const filePath = getString(event.input, ["filePath", "file_path", "path"]);
|
|
64
|
+
const edits = getEdits(event.input["edits"]);
|
|
65
|
+
if (!filePath || edits.length === 0)
|
|
66
|
+
return [];
|
|
67
|
+
return [
|
|
68
|
+
{
|
|
69
|
+
sourceToolName: event.toolName,
|
|
70
|
+
toolName: "MultiEdit",
|
|
71
|
+
filePath,
|
|
72
|
+
toolInput: {
|
|
73
|
+
file_path: filePath,
|
|
74
|
+
edits,
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
];
|
|
78
|
+
}
|
|
79
|
+
function getEdits(value) {
|
|
80
|
+
if (!Array.isArray(value))
|
|
81
|
+
return [];
|
|
82
|
+
const edits = [];
|
|
83
|
+
for (const item of value) {
|
|
84
|
+
if (!isRecord(item))
|
|
85
|
+
continue;
|
|
86
|
+
const oldString = getString(item, ["oldString", "old_string"]);
|
|
87
|
+
const newString = getString(item, ["newString", "new_string"]);
|
|
88
|
+
if (oldString === undefined || newString === undefined)
|
|
89
|
+
continue;
|
|
90
|
+
edits.push({
|
|
91
|
+
old_string: oldString,
|
|
92
|
+
new_string: newString,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
return edits;
|
|
96
|
+
}
|
|
97
|
+
function getContentText(content) {
|
|
98
|
+
if (!content)
|
|
99
|
+
return "";
|
|
100
|
+
return content
|
|
101
|
+
.filter((block) => block.type === "text")
|
|
102
|
+
.map((block) => block.text)
|
|
103
|
+
.join("\n");
|
|
104
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { CommentCheckerHookInput } from "./core.js";
|
|
2
|
+
export type ProcessResult = {
|
|
3
|
+
exitCode: number | null;
|
|
4
|
+
stdout: string;
|
|
5
|
+
stderr: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const MAX_PROCESS_OUTPUT_BYTES: number;
|
|
8
|
+
export type ProcessExecutor = (command: string, args: string[], stdin: string) => Promise<ProcessResult>;
|
|
9
|
+
export type RunCommentCheckerOptions = {
|
|
10
|
+
binaryPath?: string;
|
|
11
|
+
customPrompt?: string;
|
|
12
|
+
resolveBinary?: () => string | undefined;
|
|
13
|
+
executor?: ProcessExecutor;
|
|
14
|
+
};
|
|
15
|
+
export type CommentCheckerRunResult = {
|
|
16
|
+
status: "pass" | "warning" | "error" | "missing";
|
|
17
|
+
message: string;
|
|
18
|
+
binaryPath?: string;
|
|
19
|
+
exitCode?: number | null;
|
|
20
|
+
stdout?: string;
|
|
21
|
+
stderr?: string;
|
|
22
|
+
};
|
|
23
|
+
export type CommentCheckerRunner = (input: CommentCheckerHookInput) => Promise<CommentCheckerRunResult>;
|
|
24
|
+
export declare function runCommentChecker(input: CommentCheckerHookInput, options?: RunCommentCheckerOptions): Promise<CommentCheckerRunResult>;
|
|
25
|
+
export declare function resolveCommentCheckerBinary(): string | undefined;
|
|
26
|
+
export declare function spawnProcess(command: string, args: string[], stdin: string, maxOutputBytes?: number): Promise<ProcessResult>;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
import { createRequire } from "node:module";
|
|
4
|
+
import { dirname, join } from "node:path";
|
|
5
|
+
export const MAX_PROCESS_OUTPUT_BYTES = 64 * 1024;
|
|
6
|
+
export async function runCommentChecker(input, options = {}) {
|
|
7
|
+
const binaryPath = options.binaryPath ?? (options.resolveBinary ? options.resolveBinary() : resolveCommentCheckerBinary());
|
|
8
|
+
if (!binaryPath) {
|
|
9
|
+
return {
|
|
10
|
+
status: "missing",
|
|
11
|
+
message: "comment-checker binary not found. Run npm install for the codex-comment-checker plugin.",
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
const args = ["check"];
|
|
15
|
+
if (options.customPrompt) {
|
|
16
|
+
args.push("--prompt", options.customPrompt);
|
|
17
|
+
}
|
|
18
|
+
const executor = options.executor ?? spawnProcess;
|
|
19
|
+
const result = await executor(binaryPath, args, JSON.stringify(input));
|
|
20
|
+
const message = result.stderr || result.stdout;
|
|
21
|
+
if (result.exitCode === 0) {
|
|
22
|
+
return {
|
|
23
|
+
status: "pass",
|
|
24
|
+
message: "",
|
|
25
|
+
binaryPath,
|
|
26
|
+
exitCode: result.exitCode,
|
|
27
|
+
stdout: result.stdout,
|
|
28
|
+
stderr: result.stderr,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
if (result.exitCode === 2) {
|
|
32
|
+
return {
|
|
33
|
+
status: "warning",
|
|
34
|
+
message,
|
|
35
|
+
binaryPath,
|
|
36
|
+
exitCode: result.exitCode,
|
|
37
|
+
stdout: result.stdout,
|
|
38
|
+
stderr: result.stderr,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
status: "error",
|
|
43
|
+
message,
|
|
44
|
+
binaryPath,
|
|
45
|
+
exitCode: result.exitCode,
|
|
46
|
+
stdout: result.stdout,
|
|
47
|
+
stderr: result.stderr,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export function resolveCommentCheckerBinary() {
|
|
51
|
+
const binaryName = process.platform === "win32" ? "comment-checker.exe" : "comment-checker";
|
|
52
|
+
const fromPackageApi = resolvePackageApiBinary();
|
|
53
|
+
if (fromPackageApi)
|
|
54
|
+
return fromPackageApi;
|
|
55
|
+
const fromPackage = resolvePackageBinary(binaryName);
|
|
56
|
+
if (fromPackage)
|
|
57
|
+
return fromPackage;
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|
|
60
|
+
function resolvePackageApiBinary() {
|
|
61
|
+
try {
|
|
62
|
+
const require = createRequire(import.meta.url);
|
|
63
|
+
const packageExports = require("@code-yeongyu/comment-checker");
|
|
64
|
+
if (!isCommentCheckerPackage(packageExports))
|
|
65
|
+
return undefined;
|
|
66
|
+
const binaryPath = packageExports.getBinaryPath();
|
|
67
|
+
return existsSync(binaryPath) ? binaryPath : undefined;
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
return undefined;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function resolvePackageBinary(binaryName) {
|
|
74
|
+
try {
|
|
75
|
+
const require = createRequire(import.meta.url);
|
|
76
|
+
const packagePath = require.resolve("@code-yeongyu/comment-checker/package.json");
|
|
77
|
+
const binaryPath = join(dirname(packagePath), "bin", binaryName);
|
|
78
|
+
return existsSync(binaryPath) ? binaryPath : undefined;
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
function isCommentCheckerPackage(value) {
|
|
85
|
+
return isRecord(value) && typeof value["getBinaryPath"] === "function";
|
|
86
|
+
}
|
|
87
|
+
function isRecord(value) {
|
|
88
|
+
return typeof value === "object" && value !== null;
|
|
89
|
+
}
|
|
90
|
+
function appendOutput(output, chunk, maxOutputBytes) {
|
|
91
|
+
if (output.truncated)
|
|
92
|
+
return;
|
|
93
|
+
const remainingBytes = maxOutputBytes - output.bytes;
|
|
94
|
+
const chunkBytes = Buffer.byteLength(chunk, "utf8");
|
|
95
|
+
if (chunkBytes <= remainingBytes) {
|
|
96
|
+
output.text += chunk;
|
|
97
|
+
output.bytes += chunkBytes;
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
if (remainingBytes > 0) {
|
|
101
|
+
output.text += Buffer.from(chunk, "utf8").subarray(0, remainingBytes).toString("utf8");
|
|
102
|
+
output.bytes += remainingBytes;
|
|
103
|
+
}
|
|
104
|
+
output.truncated = true;
|
|
105
|
+
}
|
|
106
|
+
function formatOutput(output, streamName, maxOutputBytes) {
|
|
107
|
+
if (!output.truncated)
|
|
108
|
+
return output.text;
|
|
109
|
+
return `${output.text}\n[${streamName} truncated after ${maxOutputBytes} bytes]`;
|
|
110
|
+
}
|
|
111
|
+
export function spawnProcess(command, args, stdin, maxOutputBytes = MAX_PROCESS_OUTPUT_BYTES) {
|
|
112
|
+
return new Promise((resolve) => {
|
|
113
|
+
const outputByteLimit = Number.isFinite(maxOutputBytes) && maxOutputBytes > 0 ? Math.floor(maxOutputBytes) : 0;
|
|
114
|
+
const proc = spawn(command, args, {
|
|
115
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
116
|
+
});
|
|
117
|
+
const stdout = { text: "", bytes: 0, truncated: false };
|
|
118
|
+
const stderr = { text: "", bytes: 0, truncated: false };
|
|
119
|
+
proc.stdout.setEncoding("utf-8");
|
|
120
|
+
proc.stderr.setEncoding("utf-8");
|
|
121
|
+
proc.stdout.on("data", (chunk) => {
|
|
122
|
+
appendOutput(stdout, chunk, outputByteLimit);
|
|
123
|
+
});
|
|
124
|
+
proc.stderr.on("data", (chunk) => {
|
|
125
|
+
appendOutput(stderr, chunk, outputByteLimit);
|
|
126
|
+
});
|
|
127
|
+
proc.once("error", (error) => {
|
|
128
|
+
appendOutput(stderr, error.message, outputByteLimit);
|
|
129
|
+
resolve({
|
|
130
|
+
exitCode: null,
|
|
131
|
+
stdout: formatOutput(stdout, "stdout", outputByteLimit),
|
|
132
|
+
stderr: formatOutput(stderr, "stderr", outputByteLimit),
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
proc.once("close", (exitCode) => {
|
|
136
|
+
resolve({
|
|
137
|
+
exitCode,
|
|
138
|
+
stdout: formatOutput(stdout, "stdout", outputByteLimit),
|
|
139
|
+
stderr: formatOutput(stderr, "stderr", outputByteLimit),
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
proc.stdin.end(stdin);
|
|
143
|
+
});
|
|
144
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export type TextContent = {
|
|
2
|
+
type: "text";
|
|
3
|
+
text: string;
|
|
4
|
+
};
|
|
5
|
+
export type ImageContent = {
|
|
6
|
+
type: "image";
|
|
7
|
+
data: string;
|
|
8
|
+
mimeType: string;
|
|
9
|
+
};
|
|
10
|
+
export type CheckerToolName = "Write" | "Edit" | "MultiEdit";
|
|
11
|
+
export type CheckerEdit = {
|
|
12
|
+
old_string: string;
|
|
13
|
+
new_string: string;
|
|
14
|
+
};
|
|
15
|
+
export type CheckerToolInput = {
|
|
16
|
+
file_path: string;
|
|
17
|
+
content?: string;
|
|
18
|
+
old_string?: string;
|
|
19
|
+
new_string?: string;
|
|
20
|
+
edits?: CheckerEdit[];
|
|
21
|
+
};
|
|
22
|
+
export type CommentCheckRequest = {
|
|
23
|
+
sourceToolName: string;
|
|
24
|
+
toolName: CheckerToolName;
|
|
25
|
+
filePath: string;
|
|
26
|
+
toolInput: CheckerToolInput;
|
|
27
|
+
};
|
|
28
|
+
export type CommentCheckerHookInput = {
|
|
29
|
+
session_id: string;
|
|
30
|
+
tool_name: CheckerToolName;
|
|
31
|
+
transcript_path: string;
|
|
32
|
+
cwd: string;
|
|
33
|
+
hook_event_name: "PostToolUse";
|
|
34
|
+
tool_input: CheckerToolInput;
|
|
35
|
+
};
|
|
36
|
+
export type ToolResultContent = TextContent | ImageContent;
|
|
37
|
+
export type ToolResultLike = {
|
|
38
|
+
toolName: string;
|
|
39
|
+
input: Record<string, unknown>;
|
|
40
|
+
content?: ToolResultContent[];
|
|
41
|
+
isError?: boolean;
|
|
42
|
+
details?: unknown;
|
|
43
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { runGitBashHookCli } from "./codex-hook.js";
|
|
3
|
+
const TOP_LEVEL_HELP = "Usage:\n omo-git-bash-hook hook pre-tool-use\n omo-git-bash-hook hook post-compact\n omo-git-bash-hook help | --help | -h\n";
|
|
4
|
+
async function main() {
|
|
5
|
+
const argv = process.argv.slice(2);
|
|
6
|
+
const command = argv[0];
|
|
7
|
+
if (command === undefined || command === "help" || command === "--help" || command === "-h") {
|
|
8
|
+
process.stdout.write(TOP_LEVEL_HELP);
|
|
9
|
+
return 0;
|
|
10
|
+
}
|
|
11
|
+
if (command === "hook" && argv[1] === "pre-tool-use") {
|
|
12
|
+
await runGitBashHookCli(process.stdin, process.stdout, "pre-tool-use");
|
|
13
|
+
return 0;
|
|
14
|
+
}
|
|
15
|
+
if (command === "hook" && argv[1] === "post-compact") {
|
|
16
|
+
await runGitBashHookCli(process.stdin, process.stdout, "post-compact");
|
|
17
|
+
return 0;
|
|
18
|
+
}
|
|
19
|
+
process.stderr.write(`[omo-git-bash-hook] unknown command: ${argv.join(" ")}\n${TOP_LEVEL_HELP}`);
|
|
20
|
+
return 1;
|
|
21
|
+
}
|
|
22
|
+
main()
|
|
23
|
+
.then((code) => {
|
|
24
|
+
process.exit(code);
|
|
25
|
+
})
|
|
26
|
+
.catch((error) => {
|
|
27
|
+
process.stderr.write(`[omo-git-bash-hook] ${error instanceof Error ? error.message : String(error)}\n`);
|
|
28
|
+
process.exit(1);
|
|
29
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface PreToolUsePayload {
|
|
2
|
+
readonly cwd: string;
|
|
3
|
+
readonly hook_event_name: "PreToolUse";
|
|
4
|
+
readonly model: string;
|
|
5
|
+
readonly permission_mode: string;
|
|
6
|
+
readonly session_id: string;
|
|
7
|
+
readonly tool_input: unknown;
|
|
8
|
+
readonly tool_name: string;
|
|
9
|
+
readonly tool_use_id: string;
|
|
10
|
+
readonly transcript_path: string | null;
|
|
11
|
+
readonly turn_id: string;
|
|
12
|
+
}
|
|
13
|
+
export interface GitBashHookOptions {
|
|
14
|
+
readonly env?: NodeJS.ProcessEnv;
|
|
15
|
+
readonly platform?: NodeJS.Platform | string;
|
|
16
|
+
readonly pluginDataRoot?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface PostCompactPayload {
|
|
19
|
+
readonly hook_event_name: "PostCompact";
|
|
20
|
+
readonly session_id: string;
|
|
21
|
+
readonly transcript_path?: string | null;
|
|
22
|
+
readonly trigger?: string;
|
|
23
|
+
}
|
|
24
|
+
export declare function parsePreToolUsePayload(raw: string): PreToolUsePayload | null;
|
|
25
|
+
export declare function parsePostCompactPayload(raw: string): PostCompactPayload | null;
|
|
26
|
+
export declare function applyGitBashPreToolUseReminder(payload: PreToolUsePayload, options?: GitBashHookOptions): string;
|
|
27
|
+
export declare function applyGitBashPostCompactReset(payload: PostCompactPayload, options?: GitBashHookOptions): string;
|
|
28
|
+
export declare function runGitBashHookCli(stdin: NodeJS.ReadableStream, stdout: NodeJS.WritableStream, eventName?: "pre-tool-use" | "post-compact", options?: GitBashHookOptions): Promise<void>;
|