surshar / claude-code
Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.
Built by Anthropic · github.com/anthropics
| 1 | import type { TraceEntry } from 'claude-code' |
| 2 | |
| 3 | import { isSameVerdict } from './is-same-verdict.js' |
| 4 | import Ranking from './ranking' |
| 5 | |
| 6 | /** |
| 7 | * The links of one run of `tool.check` that may hold a plugin a person |
| 8 | * installed and that rewrote the verdict handed to them without tightening. |
| 9 | * |
| 10 | * A more permissive decision counts, and so does the same decision under |
| 11 | * another reason, rule or hook. Read off `next.trace`, whose `tier` the |
| 12 | * engine pins; a batch is named as the engine names it, its members joined. |
| 13 | * |
| 14 | * @param trace what settled beneath the hook on its latest `next` call |
| 15 | * @returns their names, nearest the caller first; none when none rewrote |
| 16 | */ |
| 17 | export const rewrittenByUsers = ( |
| 18 | trace: readonly TraceEntry<'tool.check'>[], |
| 19 | ): readonly string[] => |
| 20 | trace |
| 21 | .filter((link, at) => { |
| 22 | const handed = Ranking.handedTo(trace, at) |
| 23 | |
| 24 | return ( |
| 25 | Ranking.TIERS_HOLDING_USERS.includes(link.tier) && |
| 26 | link.returned !== undefined && |
| 27 | !Ranking.isLooser(handed, link.returned) && |
| 28 | !isSameVerdict(link.returned, handed) |
| 29 | ) |
| 30 | }) |
| 31 | .map(link => link.plugin) |