Repository navigation
refactor(capture): data-driven hook mappings for all four adapters - #2
Merged
Merged
Conversation
Contributor
Author
|
Tracking issue with contributor guidance (real Cursor/Copilot payloads wanted): #4 |
Move every adapter's hook contract — event names, field names, snake/camel variants, tool→op — out of Go and into internal/capture/maps/<tool>.json, read by a small shared engine (mapping.go). A vendor renaming a field or an event is now a JSON edit, not a Go change + rebuild. - claude-code, codex, cursor, copilot parsers are now ~15-line delegators to applyMapping(); all behavior preserved (every existing fixture test passes unchanged). - Maps are go:embed'd, so a fresh install works offline with no setup. The loader is the single seam a future `shale update-map` overlay would hook into. - Structural extraction that can't be a flat field map stays in code via a structuralHandlers registry: Codex's apply_patch envelope is wired in as the codex map's tool_fallback, self-guarding on the tool name. - Shared object/path helpers (only the still-hand-written adapters used them) removed; helpers.go keeps just firstNonEmpty + firstRaw. - New mapping_test.go guards that every embedded map is loadable and complete, so a malformed map can't ship as a silent no-op. Follow-ups (designed, not in this change): value-shape fallback for unseen field names; quarantine of unmatched payloads to surface silent drift; a signed mapping pack distributed via opt-in `shale update-map`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
tabladrum
force-pushed
the
feat/data-driven-capture-maps
branch
from
October 23, 2026 00:03
2f05c70 to
b613650
Compare
tabladrum
marked this pull request as ready for review
October 23, 2026 00:06
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rebased onto main (2026-10-22), ready for review. It was held during the open-source launch freeze; the freeze is over. The rebase had no conflicts (nothing under
internal/capture/changed on main in the meantime), and build/vet/gofmt/go test ./...plus CI (lint + tests on ubuntu/windows/macos) are green afterwards.What this does
Moves every adapter's hook contract (event names, field names, snake/camel variants, tool→op) out of Go and into
internal/capture/maps/<tool>.json, read by a shared engine (mapping.go). A vendor renaming a field or event becomes a JSON edit, not a code change + rebuild.claude-code,codex,cursor,copilotparsers are now ~15-line delegators toapplyMapping().go:embed'd — fresh install works offline, no setup. The loader is the seam a futureshale update-mapoverlay plugs into.structuralHandlersregistry: Codex'sapply_patchenvelope is wired in as the codex map'stool_fallback, self-guarding on the tool name.mapping_test.gofails CI if any embedded map is malformed or incomplete (no silent no-op).Why it's safe to merge
go vet+gofmtclean locally.Designed follow-ups (intentionally NOT here)
Value-shape fallback for unseen fields · quarantine of unmatched payloads to surface silent drift · signed mapping pack via opt-in
shale update-map.🤖 Generated with Claude Code