blame
Everything exported by guardlink/blame, from the .d.ts files published in guardlink@2.2.0. See the entry points for the other subpaths, and use guardlink as a library for worked examples.
Interfaces
Section titled “Interfaces”AgentSummaryRow
Section titled “AgentSummaryRow”The analytics every summary row carries beyond its counts.
Extends
Section titled “Extends”Properties
Section titled “Properties”| Property | Type | Description | Inherited from |
|---|---|---|---|
commits |
number | null |
Commits crediting this identity in the whole history; null when no counts were supplied. | SummaryRowRates.commits |
fixed |
number |
- | - |
introduced |
number |
- | - |
lines |
number |
- | - |
median_time_to_fix_days |
number | null |
- | - |
model |
string | null |
- | - |
oldest_open_days |
number | null |
Whole days from the oldest open introduced exposure’s date to as_of; null when nothing is open or there is no as_of. |
SummaryRowRates.oldest_open_days |
open |
number |
- | - |
per_100_commits |
number | null |
introduced / commits × 100, one decimal; null when commits is null or 0. | SummaryRowRates.per_100_commits |
risk_score |
number |
Over the exposures this identity introduced that are still open: critical 8, high 4, medium 2, low 1, anything else 1 (P0..P3 alike, case-insensitively). |
SummaryRowRates.risk_score |
tool |
string |
- | - |
touched |
number |
- | - |
AiAttribution
Section titled “AiAttribution”One AI tool credited on a commit, from a trailer or a bot author identity.
Properties
Section titled “Properties”BlameComputation
Section titled “BlameComputation”Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
as_of |
string | null |
The HEAD commit’s author date — “now” for every age in the summary, so two runs on one HEAD agree. Null without git or when the walk was skipped. |
byRecord |
Map<object, RecordBlame> |
Keyed by the model record object itself; never written back unless attachBlame is asked to. |
commits |
CommitCounts | null |
Null without git or when the walk was skipped (history: false). |
head |
string | null |
- |
identity_mode |
IdentityMode |
- |
status |
ComputationStatus |
- |
BlameConfig
Section titled “BlameConfig”Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
identity |
IdentityMode |
- |
ignore_revs |
string | null |
Root-relative path handed to git blame --ignore-revs-file when it exists; null when unset or outside root. |
tools |
ToolRule[] |
User rules first, then the shipped defaults. First match wins. |
BlameEntry
Section titled “BlameEntry”Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
asset |
string |
- |
blame |
RecordBlame |
- |
file |
string |
- |
granularity |
BlameGranularity |
- |
key |
string |
The ledger claim key, so this joins to .guardlink/verified.json. |
line |
number |
- |
severity |
string | null |
- |
span |
string | null |
file#start-end of the anchored span, file#file for a file-wide anchor, null without one. Claims sharing a span share its lines. |
threat |
string |
- |
verb |
BlameVerb |
- |
BlamePayload
Section titled “BlamePayload”Properties
Section titled “Properties”| Property | Type |
|---|---|
entries |
BlameEntry[] |
head |
string | null |
identity_mode |
IdentityMode |
root |
string |
schema |
"guardlink.blame/v1" |
status |
ComputationStatus |
summary |
BlameSummary |
BlameSummary
Section titled “BlameSummary”Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
as_of |
string | null |
The instant every age was measured against: the HEAD commit’s author date. Null without one. |
by_agent |
AgentSummaryRow[] |
- |
by_human |
HumanSummaryRow[] |
- |
comparison |
{ ai: Cohort; human: Cohort; } | null |
Null when no commit counts were available to divide by. |
hot_files |
HotFile[] |
Hottest first: open desc, contributors desc, file asc; at most ten. |
trends |
TrendBucket[] |
- |
Cohort
Section titled “Cohort”Exposures whose introducing commit credits no AI tool (human) versus at least one (ai).
Properties
Section titled “Properties”CommitCounts
Section titled “CommitCounts”Commit counts over the history reachable from HEAD, the denominator of every “per 100 commits” rate. Attributed with the same rules and identity mode as the records, so an identity key here is the same string the rows carry.
Properties
Section titled “Properties”CommitRef
Section titled “CommitRef”Extended by
Section titled “Extended by”Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
assisted_by |
AiAttribution[] |
- |
author |
string |
human:<identity> — or agent:<tool> when a bot authored the commit and no human co-author exists. |
co_authors |
string[] |
Human co-authors from Co-authored-by trailers that matched no tool rule. |
date |
string |
Author date, ISO-8601 as git prints %aI. |
sha |
string |
- |
CompiledRule
Section titled “CompiledRule”Properties
Section titled “Properties”| Property | Type |
|---|---|
email? |
RegExp |
model? |
ModelRule |
name? |
RegExp |
tool |
string |
ComputeBlameOptions
Section titled “ComputeBlameOptions”Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
config? |
BlameConfig |
- |
exec? |
GitExec |
- |
file? |
string |
Root-relative path: compute only records declared in, or anchored to, this file. |
history? |
boolean |
Walk the whole history for commits and as_of — one more git call. Default true; false leaves both null. |
Contributor
Section titled “Contributor”Extends
Section titled “Extends”Properties
Section titled “Properties”| Property | Type | Description | Inherited from |
|---|---|---|---|
assisted_by |
AiAttribution[] |
- | CommitRef.assisted_by |
author |
string |
human:<identity> — or agent:<tool> when a bot authored the commit and no human co-author exists. |
CommitRef.author |
co_authors |
string[] |
Human co-authors from Co-authored-by trailers that matched no tool rule. |
CommitRef.co_authors |
date |
string |
Author date, ISO-8601 as git prints %aI. |
CommitRef.date |
lines |
number |
Lines of the span this commit last touched. | - |
sha |
string |
- | CommitRef.sha |
ExposureBlame
Section titled “ExposureBlame”Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
contributors |
Contributor[] |
Per-commit line ownership over the span, most lines first, then sha. |
error? |
string |
- |
fixed_before_introduced? |
true |
Set when the mitigation predates the introduction and the interval was clamped to 0. |
fixed_by |
CommitRef | null |
The earliest-declared @mitigates covering this exposure, or null while it is open. |
found_by |
CommitRef | null |
Blame of the annotation line itself — who declared the exposure. |
granularity |
BlameGranularity |
- |
introduced_by |
IntroducedBy | null |
- |
kind |
"exposure" |
- |
status |
BlameStatus |
- |
time_to_fix_days |
number | null |
Days from introduced_by.date to fixed_by.date, never negative. |
HotFile
Section titled “HotFile”Properties
Section titled “Properties”HumanSummaryRow
Section titled “HumanSummaryRow”The analytics every summary row carries beyond its counts.
Extends
Section titled “Extends”Properties
Section titled “Properties”| Property | Type | Description | Inherited from |
|---|---|---|---|
commits |
number | null |
Commits crediting this identity in the whole history; null when no counts were supplied. | SummaryRowRates.commits |
fixed |
number |
Exposures whose fixing commit credits this identity. | - |
identity |
string |
- | - |
introduced |
number |
Exposures whose introducing commit credits this identity. | - |
lines |
number |
Lines of exposed spans this identity currently owns. | - |
median_time_to_fix_days |
number | null |
- | - |
oldest_open_days |
number | null |
Whole days from the oldest open introduced exposure’s date to as_of; null when nothing is open or there is no as_of. |
SummaryRowRates.oldest_open_days |
open |
number |
Introduced and not yet fixed. | - |
per_100_commits |
number | null |
introduced / commits × 100, one decimal; null when commits is null or 0. | SummaryRowRates.per_100_commits |
risk_score |
number |
Over the exposures this identity introduced that are still open: critical 8, high 4, medium 2, low 1, anything else 1 (P0..P3 alike, case-insensitively). |
SummaryRowRates.risk_score |
touched |
number |
Exposures whose span this identity currently owns lines of (any commit, not only the introducer). | - |
IntroducedBy
Section titled “IntroducedBy”Extends
Section titled “Extends”Properties
Section titled “Properties”| Property | Type | Description | Inherited from |
|---|---|---|---|
assisted_by |
AiAttribution[] |
- | CommitRef.assisted_by |
author |
string |
human:<identity> — or agent:<tool> when a bot authored the commit and no human co-author exists. |
CommitRef.author |
co_authors |
string[] |
Human co-authors from Co-authored-by trailers that matched no tool rule. |
CommitRef.co_authors |
date |
string |
Author date, ISO-8601 as git prints %aI. |
CommitRef.date |
lower_bound? |
true |
The true introduction may be earlier: shallow clone, or a dirty file where -L could not run. | - |
method |
IntroducedMethod |
- | - |
sha |
string |
- | CommitRef.sha |
MitigationBlame
Section titled “MitigationBlame”Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
contributors |
Contributor[] |
- |
declared_by |
CommitRef | null |
Blame of the @mitigates line — who declared the fix. |
error? |
string |
- |
granularity |
BlameGranularity |
- |
kind |
"mitigation" |
- |
status |
BlameStatus |
- |
RawCommit
Section titled “RawCommit”One commit as git log printed it, before any rule is applied.
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
authorEmail |
string |
- |
authorName |
string |
- |
committerName |
string |
- |
date |
string |
- |
sha |
string |
- |
trailers |
string |
The unfolded trailer block, one Key: value per line. |
RawPerson
Section titled “RawPerson”Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
email |
string |
- |
name |
string |
- |
raw |
string |
The text this person was parsed from, trimmed. |
SummaryRowRates
Section titled “SummaryRowRates”The analytics every summary row carries beyond its counts.
Extended by
Section titled “Extended by”Properties
Section titled “Properties”ToolRule
Section titled “ToolRule”A row of blame.tools: a regex source for email and/or name, matched anchored and case-insensitively.
Properties
Section titled “Properties”| Property | Type |
|---|---|
email? |
string |
model? |
ModelRule |
name? |
string |
tool |
string |
TrendBucket
Section titled “TrendBucket”One quarter of the introduced/fixed timeline. Quarters are contiguous from the first to the last seen, so a chart has an even axis.
Properties
Section titled “Properties”Type Aliases
Section titled “Type Aliases”BlameGranularity
Section titled “BlameGranularity”BlameGranularity =
"symbol"|"block"|"file"|"none"
How much code the span behind a record covers. none when there is no anchor.
BlameStatus
Section titled “BlameStatus”BlameStatus =
"ok"|"no-git"|"shallow"|"uncommitted"|"no-anchor"|"file-missing"|"error"
BlameVerb
Section titled “BlameVerb”BlameVerb =
"exposes"|"confirmed"|"mitigates"
ComputationStatus
Section titled “ComputationStatus”ComputationStatus =
"ok"|"no-git"|"shallow"
IdentityMode
Section titled “IdentityMode”IdentityMode =
"name"|"email"|"hash"
What an identity string shows for a human: git name, email, or a 12-hex hash of the email.
IntroducedMethod
Section titled “IntroducedMethod”IntroducedMethod =
"log-L"|"file-add"|"blame"
ModelRule
Section titled “ModelRule”ModelRule =
"name"|"after-token"|"parens"
How a matched name yields a model: the whole name, the name minus its leading tool token, or the text in parentheses.
RecordBlame
Section titled “RecordBlame”RecordBlame =
ExposureBlame|MitigationBlame
Variables
Section titled “Variables”BLAME_SCHEMA
Section titled “BLAME_SCHEMA”
constBLAME_SCHEMA:"guardlink.blame/v1"="guardlink.blame/v1"
GuardLink Blame — shared types.
Attribution is computed from git at run time and never written into source.
Every surface (CLI, MCP, TUI, dashboard, report) reads these shapes; the
payload is versioned by BLAME_SCHEMA the way the verify output is.
Two vocabularies deliberately kept apart:
CommitRef.authoris an identity string in the ledger’s scheme —human:<name>oragent:<tool>— so a gate can key on the prefix.assisted_by[]is structured (tool,model) because “which model” is the question the dashboard groups by.
Comment
Section titled “Comment”– “Pure type declarations for the blame module; no I/O. The optional blame field these describe is invisible to the annotation hash and stripped from the committed model.json, exactly like anchor”
DEFAULT_IGNORE_REVS
Section titled “DEFAULT_IGNORE_REVS”
constDEFAULT_IGNORE_REVS:".git-blame-ignore-revs"=".git-blame-ignore-revs"
Functions
Section titled “Functions”attributeCommit()
Section titled “attributeCommit()”attributeCommit(
raw,rules,mode):CommitRef
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
raw |
RawCommit |
rules |
readonly CompiledRule[] |
mode |
IdentityMode |
Returns
Section titled “Returns”classifyPerson()
Section titled “classifyPerson()”classifyPerson(
p,rules):AiAttribution|null
The AI attribution a person resolves to, or null when they match no rule (a human).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
p |
RawPerson |
rules |
readonly CompiledRule[] |
Returns
Section titled “Returns”AiAttribution | null
compileRules()
Section titled “compileRules()”compileRules(
rules):CompiledRule[]
Compile rules for matching. A rule with no pattern, or with any pattern that is too long or invalid, is dropped whole: a rule that matched on email but lost its name pattern would attribute differently from what was written.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
rules |
readonly ToolRule[] |
Returns
Section titled “Returns”entriesFromModel()
Section titled “entriesFromModel()”entriesFromModel(
model):BlameEntry[]
Entries from a model whose records already carry blame (after
attachBlame). What the report and the dashboard read; empty when nothing
was attached, which is how both know to render nothing.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
model |
ThreatModel |
Returns
Section titled “Returns”identityFor()
Section titled “identityFor()”identityFor(
name,mode):string
human:<shown> where shown follows the identity mode. email and hash
fall back to the name when the commit carries no address; everything falls
back to unknown rather than an empty string.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
name |
string |
email |
string |
mode |
IdentityMode |
Returns
Section titled “Returns”string
listCommits()
Section titled “listCommits()”listCommits(
root,exec?):RawCommit[]
Every commit reachable from HEAD, newest first, with the fields
resolveCommits reads — the denominator of every “per 100 commits” rate
and the source of as_of. HEAD -- pins the argument as a revision even
when a file is named HEAD. An empty repository (no HEAD yet) or a plain
directory is an empty history, not an error.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
root |
string |
exec? |
GitExec |
Returns
Section titled “Returns”Exposes
Section titled “Exposes”#blame to #dos [low] cwe:CWE-400 – “listCommits() runs git log over every commit reachable from HEAD and parseLogRecords() parses each trailer block; history size, not model size, sets the cost”
Mitigates
Section titled “Mitigates”#blame against #dos using #resource-limits – “A single log call under the same 30 s timeout and 64 MiB output cap; nothing is spawned per commit, and compute.ts lets a caller skip the walk with history: false”
Handles
Section titled “Handles”pii on #blame – “Author names, emails and co-author trailers of every commit in the history”
GitRepo -> #blame via listCommits – “The reachable history, for commit counts and the HEAD author date”
Comment
Section titled “Comment”– “Reachable from HEAD only, never –all: what other branches carry is not this checkout’s history”
median()
Section titled “median()”median(
values):number|null
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
values |
number[] |
Returns
Section titled “Returns”number | null
parseAssistedBy()
Section titled “parseAssistedBy()”parseAssistedBy(
value,rules):AiAttribution
Linux-kernel style Assisted-by: AGENT:MODEL [tool …]. The agent token is
mapped through the rules by name (Claude → claude-code); an agent no
rule knows keeps its own lowercased name. Only an empty value is unknown.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
value |
string |
rules |
readonly CompiledRule[] |
Returns
Section titled “Returns”parseTrailerBlock()
Section titled “parseTrailerBlock()”parseTrailerBlock(
text):object
The two trailer keys attribution reads, from an unfolded trailer block.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
text |
string |
Returns
Section titled “Returns”object
assistedBy
Section titled “assistedBy”assistedBy:
string[]
coAuthors
Section titled “coAuthors”coAuthors:
RawPerson[]
safeRelPath()
Section titled “safeRelPath()”safeRelPath(
root,file):string|null
The path with / separators when it stays inside root; null otherwise.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
root |
string |
file |
string |
Returns
Section titled “Returns”string | null
splitPerson()
Section titled “splitPerson()”splitPerson(
value):RawPerson
Name <email> → parts. A value without angle brackets is a bare name.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
value |
string |
Returns
Section titled “Returns”summarise()
Section titled “summarise()”summarise(
entries,ctx?):BlameSummary
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
entries |
BlameEntry[] |
ctx? |
SummaryContext |
Returns
Section titled “Returns”References
Section titled “References”attachBlame
Section titled “attachBlame”Re-exports attachBlame
buildBlamePayload
Section titled “buildBlamePayload”Re-exports buildBlamePayload
computeBlame
Section titled “computeBlame”Re-exports computeBlame
DEFAULT_TOOL_RULES
Section titled “DEFAULT_TOOL_RULES”Re-exports DEFAULT_TOOL_RULES
formatBlameText
Section titled “formatBlameText”Re-exports formatBlameText
readBlameConfig
Section titled “readBlameConfig”Re-exports readBlameConfig

