donna.cost.tool_lint¶
donna.cost.tool_lint
¶
Lint pipeline for tool_request_fulfillment builds (slice 22).
Realizes docs/superpowers/specs/manual-escalation.md §10.5 — the
extra checks tool builds get on top of the slice-21 claude_code
protocol.
Pipeline (executed in order):
- AST parse each
.pysource under the diff scope. -
Per-file rules:
-
:func:
donna.cost.tool_lint.anthropic_import.check_anthropic_import(§10.5 row 3) - :func:
donna.cost.tool_lint.import_io.check_import_time_io(§10.5 row 5) - :func:
donna.cost.tool_lint.secrets.scan_for_secrets(§10.5 row 2) - :func:
donna.cost.tool_lint.metadata.check_tool_metadata(§10.5 rows 1 + 6) -
Whole-diff rules:
-
:func:
donna.cost.tool_lint.allowlist.check_allowlist_update(§10.5 row 4) - :func:
donna.cost.tool_lint.inert_test.check_inert_at_import_test(§10.5 row 5) -
Optional execution gate:
-
:func:
donna.cost.tool_lint.import_smoke.run_import_smoke(validation step — runs after lint passes).
Failures stop validation; warnings (e.g. requires_rebuild=True)
flow through to the dashboard panel.
LintFailure
dataclass
¶
One lint violation.
rule matches the §10.5 row name (secrets, anthropic_import,
import_io, allowlist, metadata, inert_test,
syntax, requires_rebuild_warning).
LintResult
dataclass
¶
ToolLintConfig
dataclass
¶
check_allowlist_update
¶
check_allowlist_update(diff_paths: list[str], source_text_by_path: dict[str, str], tool_name: str) -> list[LintFailure]
Verify tool is allowlisted somewhere or marked unallowlisted=True.
Source code in src/donna/cost/tool_lint/allowlist.py
check_anthropic_import
¶
Walk tree and reject any anthropic[.…] import.
Returns one :class:LintFailure per offending statement.
Source code in src/donna/cost/tool_lint/anthropic_import.py
check_import_time_io
¶
Reject top-level network/disk I/O in tool source files.
Source code in src/donna/cost/tool_lint/import_io.py
check_inert_at_import_test
¶
check_inert_at_import_test(diff_paths: list[str], source_text_by_path: dict[str, str], tool_name: str) -> list[LintFailure]
Source code in src/donna/cost/tool_lint/inert_test.py
check_tool_metadata
¶
Verify tool source declares the required metadata fields.
Looks for src/donna/skills/tools/<tool_name>.py (or
donna/skills/tools/<tool_name>.py if the diff is rooted
differently — picked by suffix match).
Source code in src/donna/cost/tool_lint/metadata.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | |
scan_for_secrets
¶
scan_for_secrets(text: str, path: str, *, detect_secrets_enabled: bool = False) -> list[LintFailure]
Scan text for hardcoded credentials.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
File source. |
required |
path
|
str
|
Logical path (for the failure record). |
required |
detect_secrets_enabled
|
bool
|
If True and the |
False
|
Source code in src/donna/cost/tool_lint/secrets.py
lint_tool_branch
async
¶
lint_tool_branch(*, branch: str, diff_paths: list[str], tool_name: str, source_text_by_path: dict[str, str], config: ToolLintConfig | None = None) -> LintResult
Run every §10.5 lint rule against a tool-build branch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
branch
|
str
|
Branch name (used only for logging). |
required |
diff_paths
|
list[str]
|
Paths the user touched, scope-validated by
:class: |
required |
tool_name
|
str
|
The tool being built (matches |
required |
source_text_by_path
|
dict[str, str]
|
Pre-fetched committed source for every
path in |
required |
config
|
ToolLintConfig | None
|
Tunables ( |
None
|
Returns:
| Type | Description |
|---|---|
LintResult
|
class: |