Preflight
preflight
Preflight hook action.
Runs git status --porcelain and git diff -U2 to report
working-tree state before a protocol phase.
PreflightHook
dataclass
Report working-tree status and diff as a pre-hook.
Designed for injection into protocol briefings via
inject_result + inline: true.
params:
path — project root (default ".").
diff_lines — max diff lines (default 200, 0 to disable).
Source code in packages/axm-git/src/axm_git/hooks/preflight.py
execute(context, **params)
Execute the hook action.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
dict[str, object]
|
Session context dictionary. |
required |
**params
|
object
|
Optional |
{}
|
Returns:
| Type | Description |
|---|---|
HookResult
|
HookResult with a compact |
HookResult
|
and metadata containing |
HookResult
|
and |
Source code in packages/axm-git/src/axm_git/hooks/preflight.py
truncate_diff(stdout, max_lines)
Truncate diff output to max_lines.
Returns the first max_lines lines joined by newlines,
or the stripped original when it fits. Returns an empty
string when max_lines is 0.