Skip to content

feat: add hooks cli and trace tooling#717

Open
Cai-Tang-www wants to merge 4 commits into
1024XEngineer:mainfrom
Cai-Tang-www:codex/issue-686-hooks-cli
Open

feat: add hooks cli and trace tooling#717
Cai-Tang-www wants to merge 4 commits into
1024XEngineer:mainfrom
Cai-Tang-www:codex/issue-686-hooks-cli

Conversation

@Cai-Tang-www

Copy link
Copy Markdown
Collaborator

Summary

  • add neocode hook subcommands for lint, dry-run, and trace
  • add shared fixture parsing and shared hook-spec compilation helpers for CLI/runtime reuse
  • persist hook runtime trace events behind --trace-hooks and document the new workflow

Testing

  • go test ./internal/app -run "TestBuildRuntimeTraceHooksPersistsHookEvents|TestBuildRuntimeUsesWorkdirOverride|TestBuildRuntimeSucceedsWhenSkillsRootMissing"
  • go test ./internal/cli -run "TestRootCommandIncludesHookCommand|TestHookCommandsHelp|TestReadHookTraceRecordsAndAggregate|TestHookTraceCommandReturnsExitCodeWhenTraceMissing|TestHookTraceCommandReadsCorruptedTraceAsSystemError|TestHookTraceCommandPrintsReplayAndSummary|TestHookLintCommandDetectsExpectedScenarios|TestHookLintCommandSkipsMissingDefaultFiles|TestHookDryRunCommandPassesBuiltInHook|TestHookDryRunCommandSupportsBuiltinHandlersAndExitCodes|TestHookDryRunCommandRejectsInvalidFixtureAndPointMismatch|TestHookDryRunPrefersUserHookUnlessRepoRequested"
  • go test ./internal/runtime ./internal/runtime/hooks/fixture -run "TestHookTracePath|TestHookTraceRecorderWritesHookEvents|TestParseBytesYAMLAndJSON|TestParseBytesRejectsUnknownFieldsAndSchemaMismatch"
  • go test ./cmd/neocode ./cmd/neocode-gateway -run TestDoesNotExist

Closes #686

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I found three issues that should be addressed before merging. The main risks are an unsafe trace path derived from run_id, and CLI behavior that rejects or fails valid repo-hook workflows.

Comment thread internal/runtime/hook_trace.go Outdated
Comment thread internal/cli/hook_command.go
Comment thread internal/cli/hook_command.go Outdated
@codecov

codecov Bot commented Jun 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.81081% with 68 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/cli/hook_command.go 88.81% 29 Missing and 23 partials ⚠️
internal/runtime/hook_trace.go 90.90% 6 Missing and 6 partials ⚠️
internal/runtime/hooks/fixture/fixture.go 93.33% 2 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

@Cai-Tang-www

Copy link
Copy Markdown
Collaborator Author

/code 帮我补齐到90%以上的测试率,完成后推送到我的pr分支内

internal/cli/hook_command.go | 81.93% | 48 Missing and 36 partials ⚠️
internal/runtime/hook_trace.go | 64.39% | 29 Missing and 18 partials ⚠️
internal/runtime/hooks/fixture/fixture.go | 68.33% | 12 Missing and 7 partials ⚠️
internal/cli/exit_code.go | 62.50% | 3 Missing and 3 partials ⚠️
internal/cli/gateway_runtime_bridge.go | 55.55% | 4 Missing ⚠️
cmd/neocode-gateway/main.go | 60.00% | 1 Missing and 1 partial ⚠️
internal/runtime/event_emitter.go | 0.00% | 1 Missing and 1 partial ⚠️
internal/runtime/runtime.go | 50.00% | 2 Missing ⚠️
cmd/neocode/main.go | 91.66% | 1 Missing ⚠️

@fennoai

fennoai Bot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

已完成

已补充 hooks CLI、trace、fixture、exit-code、gateway main 与 runtime recorder 相关测试,并推送到 PR 分支 Cai-Tang-www:codex/issue-686-hooks-cli

提交:72a1aa50 test: raise hooks cli coverage

覆盖率复核(本地 go test coverprofile):

  • internal/cli/hook_command.go: 91.67%
  • internal/runtime/hook_trace.go: 93.94%
  • internal/runtime/hooks/fixture/fixture.go: 95.45%
  • internal/cli/exit_code.go: 100.00%
  • cmd/neocode-gateway/main.go: 100.00%
  • internal/runtime/event_emitter.go: 98.15%
  • internal/runtime/runtime.go: 91.44%
  • cmd/neocode/main.go: 100.00%
  • internal/cli/gateway_runtime_bridge.go: 本 PR 新增可执行行 9/9 = 100.00%(整文件历史覆盖为 79.30%

验证已通过:

  • go test ./internal/cli ./internal/runtime ./internal/runtime/hooks/fixture ./cmd/neocode ./cmd/neocode-gateway -coverprofile=/tmp/neo-cover-4.out -covermode=count
  • go test ./...

View job run

Generated with [FennoAI](https://github.com/apps/fennoai)

Co-authored-by: Cai-Tang-www <106404101+Cai-Tang-www@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Hooks RFC #679] Task DX: hook lint / dry-run / trace CLI

1 participant