advisor-agent 0.5.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- advisor/__init__.py +293 -0
- advisor/__main__.py +2543 -0
- advisor/_fs.py +167 -0
- advisor/_style.py +324 -0
- advisor/audit.py +380 -0
- advisor/baseline.py +250 -0
- advisor/checkpoint.py +203 -0
- advisor/cost.py +276 -0
- advisor/doctor.py +254 -0
- advisor/focus.py +264 -0
- advisor/git_scope.py +177 -0
- advisor/history.py +405 -0
- advisor/install.py +470 -0
- advisor/orchestrate/__init__.py +62 -0
- advisor/orchestrate/_fence.py +29 -0
- advisor/orchestrate/_prompts/__init__.py +6 -0
- advisor/orchestrate/_prompts/advisor.txt +182 -0
- advisor/orchestrate/_schema.py +10 -0
- advisor/orchestrate/advisor_prompt.py +117 -0
- advisor/orchestrate/config.py +244 -0
- advisor/orchestrate/pipeline.py +71 -0
- advisor/orchestrate/runner_prompts.py +658 -0
- advisor/orchestrate/verify_dispatch.py +52 -0
- advisor/pr_comment.py +130 -0
- advisor/presets.py +146 -0
- advisor/py.typed +0 -0
- advisor/rank.py +826 -0
- advisor/runner_budget.py +312 -0
- advisor/sarif.py +254 -0
- advisor/skill_asset.py +345 -0
- advisor/suppressions.py +273 -0
- advisor/verify.py +357 -0
- advisor/web/__init__.py +18 -0
- advisor/web/assets.py +716 -0
- advisor/web/server.py +459 -0
- advisor_agent-0.5.1.dist-info/METADATA +322 -0
- advisor_agent-0.5.1.dist-info/RECORD +39 -0
- advisor_agent-0.5.1.dist-info/WHEEL +4 -0
- advisor_agent-0.5.1.dist-info/entry_points.txt +2 -0
advisor/__init__.py
ADDED
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
"""Advisor tool pattern — native Claude Code implementation.
|
|
2
|
+
|
|
3
|
+
This project uses Claude Code's Agent tool to replicate the Anthropic API
|
|
4
|
+
advisor pattern. See CLAUDE.md for the workflow protocol.
|
|
5
|
+
|
|
6
|
+
Core building blocks:
|
|
7
|
+
rank — Priority-rank files by likelihood of containing issues
|
|
8
|
+
focus — Batched file review for parallel analysis
|
|
9
|
+
verify — Verification pass to filter noise from findings
|
|
10
|
+
orchestrate — Team config, prompt builders, dispatch message specs
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from importlib.metadata import PackageNotFoundError
|
|
14
|
+
from importlib.metadata import version as _pkg_version
|
|
15
|
+
|
|
16
|
+
try:
|
|
17
|
+
# ``advisor-agent`` is the distribution name on PyPI; ``advisor`` is the
|
|
18
|
+
# import name. ``importlib.metadata`` is the PEP 566-aligned source of
|
|
19
|
+
# truth — keeping ``__version__`` derived from it means we never drift
|
|
20
|
+
# from the number declared in ``pyproject.toml``.
|
|
21
|
+
__version__ = _pkg_version("advisor-agent")
|
|
22
|
+
except PackageNotFoundError: # pragma: no cover — editable, not-installed fallback
|
|
23
|
+
__version__ = "0+unknown"
|
|
24
|
+
|
|
25
|
+
from .audit import (
|
|
26
|
+
AuditReport,
|
|
27
|
+
audit_to_dict,
|
|
28
|
+
audit_transcript,
|
|
29
|
+
format_audit_report,
|
|
30
|
+
)
|
|
31
|
+
from .baseline import (
|
|
32
|
+
BaselineDiff,
|
|
33
|
+
BaselineEntry,
|
|
34
|
+
diff_against_baseline,
|
|
35
|
+
filter_against_baseline,
|
|
36
|
+
findings_to_entries,
|
|
37
|
+
read_baseline,
|
|
38
|
+
write_baseline,
|
|
39
|
+
)
|
|
40
|
+
from .checkpoint import (
|
|
41
|
+
CHECKPOINT_SCHEMA_VERSION,
|
|
42
|
+
Checkpoint,
|
|
43
|
+
checkpoint_path,
|
|
44
|
+
list_checkpoints,
|
|
45
|
+
load_checkpoint,
|
|
46
|
+
save_checkpoint,
|
|
47
|
+
)
|
|
48
|
+
from .cost import CostEstimate, estimate_cost, format_estimate, load_pricing
|
|
49
|
+
from .doctor import DoctorReport, run_doctor
|
|
50
|
+
from .focus import (
|
|
51
|
+
FocusBatch,
|
|
52
|
+
FocusTask,
|
|
53
|
+
create_focus_batches,
|
|
54
|
+
create_focus_tasks,
|
|
55
|
+
format_batch_plan,
|
|
56
|
+
format_dispatch_plan,
|
|
57
|
+
)
|
|
58
|
+
from .git_scope import GitScopeError, resolve_git_scope
|
|
59
|
+
from .history import (
|
|
60
|
+
HISTORY_SCHEMA_VERSION,
|
|
61
|
+
HistoryEntry,
|
|
62
|
+
append_entries,
|
|
63
|
+
entry_now,
|
|
64
|
+
file_repeat_counts,
|
|
65
|
+
file_repeat_scores,
|
|
66
|
+
format_history_block,
|
|
67
|
+
history_path,
|
|
68
|
+
load_recent,
|
|
69
|
+
load_recent_findings,
|
|
70
|
+
new_run_id,
|
|
71
|
+
)
|
|
72
|
+
from .install import (
|
|
73
|
+
ComponentStatus,
|
|
74
|
+
InstallAction,
|
|
75
|
+
InstallResult,
|
|
76
|
+
Status,
|
|
77
|
+
apply_nudge,
|
|
78
|
+
ensure_nudge,
|
|
79
|
+
get_installed_skill_version,
|
|
80
|
+
install,
|
|
81
|
+
install_skill,
|
|
82
|
+
parse_badge,
|
|
83
|
+
remove_nudge,
|
|
84
|
+
render_block,
|
|
85
|
+
should_auto_nudge,
|
|
86
|
+
status,
|
|
87
|
+
uninstall,
|
|
88
|
+
uninstall_skill,
|
|
89
|
+
)
|
|
90
|
+
from .orchestrate import (
|
|
91
|
+
KNOWN_MODEL_SHORTCUTS,
|
|
92
|
+
TeamConfig,
|
|
93
|
+
build_advisor_agent,
|
|
94
|
+
build_advisor_prompt,
|
|
95
|
+
build_fix_assignment_message,
|
|
96
|
+
build_runner_agents,
|
|
97
|
+
build_runner_batch_message,
|
|
98
|
+
build_runner_dispatch_messages,
|
|
99
|
+
build_runner_handoff_message,
|
|
100
|
+
build_runner_pool_agents,
|
|
101
|
+
build_runner_pool_prompt,
|
|
102
|
+
build_runner_prompt,
|
|
103
|
+
build_verify_dispatch_prompt,
|
|
104
|
+
build_verify_message,
|
|
105
|
+
check_batch_fix_budget,
|
|
106
|
+
default_team_config,
|
|
107
|
+
is_known_model,
|
|
108
|
+
render_pipeline,
|
|
109
|
+
)
|
|
110
|
+
from .pr_comment import format_pr_comment
|
|
111
|
+
from .presets import PRESETS, RulePack, get_preset, list_presets
|
|
112
|
+
from .rank import (
|
|
113
|
+
CONTENT_SCAN_LIMIT,
|
|
114
|
+
LANGUAGE_EXTRA_KEYWORDS,
|
|
115
|
+
PRIORITY_KEYWORDS,
|
|
116
|
+
RankedFile,
|
|
117
|
+
language_for_path,
|
|
118
|
+
load_advisorignore,
|
|
119
|
+
rank_files,
|
|
120
|
+
rank_to_prompt,
|
|
121
|
+
)
|
|
122
|
+
from .runner_budget import (
|
|
123
|
+
DEFAULT_CHAR_CEILING,
|
|
124
|
+
DEFAULT_FILE_READ_CEILING,
|
|
125
|
+
ROTATE_FRACTION,
|
|
126
|
+
SCOPE_STAGES,
|
|
127
|
+
SOFT_WARN_FRACTION,
|
|
128
|
+
RunnerBudget,
|
|
129
|
+
ScopeAnchor,
|
|
130
|
+
budget_status,
|
|
131
|
+
format_budget_nudge,
|
|
132
|
+
new_budget,
|
|
133
|
+
normalize_batch_files,
|
|
134
|
+
out_of_batch,
|
|
135
|
+
parse_scope_anchor,
|
|
136
|
+
stage_regressed,
|
|
137
|
+
update_budget,
|
|
138
|
+
)
|
|
139
|
+
from .sarif import (
|
|
140
|
+
SARIF_SCHEMA_URI,
|
|
141
|
+
SARIF_VERSION,
|
|
142
|
+
findings_to_sarif,
|
|
143
|
+
synthesize_rule_id,
|
|
144
|
+
)
|
|
145
|
+
from .skill_asset import SKILL_MD
|
|
146
|
+
from .suppressions import Suppression, apply_suppressions, load_suppressions
|
|
147
|
+
from .verify import (
|
|
148
|
+
Finding,
|
|
149
|
+
build_verify_prompt,
|
|
150
|
+
format_findings_block,
|
|
151
|
+
parse_findings_from_text,
|
|
152
|
+
parse_findings_with_drift,
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
__all__ = [
|
|
156
|
+
# version
|
|
157
|
+
"__version__",
|
|
158
|
+
# rank
|
|
159
|
+
"CONTENT_SCAN_LIMIT",
|
|
160
|
+
"LANGUAGE_EXTRA_KEYWORDS",
|
|
161
|
+
"PRIORITY_KEYWORDS",
|
|
162
|
+
"RankedFile",
|
|
163
|
+
"language_for_path",
|
|
164
|
+
"load_advisorignore",
|
|
165
|
+
"rank_files",
|
|
166
|
+
"rank_to_prompt",
|
|
167
|
+
# focus
|
|
168
|
+
"FocusBatch",
|
|
169
|
+
"FocusTask",
|
|
170
|
+
"create_focus_batches",
|
|
171
|
+
"create_focus_tasks",
|
|
172
|
+
"format_batch_plan",
|
|
173
|
+
"format_dispatch_plan",
|
|
174
|
+
# verify
|
|
175
|
+
"Finding",
|
|
176
|
+
"build_verify_prompt",
|
|
177
|
+
"format_findings_block",
|
|
178
|
+
"parse_findings_from_text",
|
|
179
|
+
"parse_findings_with_drift",
|
|
180
|
+
# orchestrate
|
|
181
|
+
"KNOWN_MODEL_SHORTCUTS",
|
|
182
|
+
"TeamConfig",
|
|
183
|
+
"default_team_config",
|
|
184
|
+
"is_known_model",
|
|
185
|
+
"build_advisor_agent",
|
|
186
|
+
"build_advisor_prompt",
|
|
187
|
+
"build_fix_assignment_message",
|
|
188
|
+
"build_runner_agents",
|
|
189
|
+
"build_runner_batch_message",
|
|
190
|
+
"build_runner_dispatch_messages",
|
|
191
|
+
"build_runner_handoff_message",
|
|
192
|
+
"build_runner_pool_agents",
|
|
193
|
+
"build_runner_pool_prompt",
|
|
194
|
+
"build_runner_prompt",
|
|
195
|
+
"build_verify_dispatch_prompt",
|
|
196
|
+
"build_verify_message",
|
|
197
|
+
"check_batch_fix_budget",
|
|
198
|
+
"render_pipeline",
|
|
199
|
+
# install
|
|
200
|
+
"ComponentStatus",
|
|
201
|
+
"InstallAction",
|
|
202
|
+
"InstallResult",
|
|
203
|
+
"Status",
|
|
204
|
+
"apply_nudge",
|
|
205
|
+
"ensure_nudge",
|
|
206
|
+
"get_installed_skill_version",
|
|
207
|
+
"install",
|
|
208
|
+
"install_skill",
|
|
209
|
+
"parse_badge",
|
|
210
|
+
"remove_nudge",
|
|
211
|
+
"render_block",
|
|
212
|
+
"should_auto_nudge",
|
|
213
|
+
"status",
|
|
214
|
+
"uninstall",
|
|
215
|
+
"uninstall_skill",
|
|
216
|
+
# git scope
|
|
217
|
+
"GitScopeError",
|
|
218
|
+
"resolve_git_scope",
|
|
219
|
+
# cost
|
|
220
|
+
"CostEstimate",
|
|
221
|
+
"estimate_cost",
|
|
222
|
+
"format_estimate",
|
|
223
|
+
"load_pricing",
|
|
224
|
+
# doctor
|
|
225
|
+
"DoctorReport",
|
|
226
|
+
"run_doctor",
|
|
227
|
+
# history
|
|
228
|
+
"HISTORY_SCHEMA_VERSION",
|
|
229
|
+
"HistoryEntry",
|
|
230
|
+
"append_entries",
|
|
231
|
+
"entry_now",
|
|
232
|
+
"file_repeat_counts",
|
|
233
|
+
"file_repeat_scores",
|
|
234
|
+
"format_history_block",
|
|
235
|
+
"history_path",
|
|
236
|
+
"load_recent",
|
|
237
|
+
"load_recent_findings",
|
|
238
|
+
"new_run_id",
|
|
239
|
+
# checkpoint
|
|
240
|
+
"CHECKPOINT_SCHEMA_VERSION",
|
|
241
|
+
"Checkpoint",
|
|
242
|
+
"checkpoint_path",
|
|
243
|
+
"list_checkpoints",
|
|
244
|
+
"load_checkpoint",
|
|
245
|
+
"save_checkpoint",
|
|
246
|
+
# audit
|
|
247
|
+
"AuditReport",
|
|
248
|
+
"audit_to_dict",
|
|
249
|
+
"audit_transcript",
|
|
250
|
+
"format_audit_report",
|
|
251
|
+
# presets
|
|
252
|
+
"PRESETS",
|
|
253
|
+
"RulePack",
|
|
254
|
+
"get_preset",
|
|
255
|
+
"list_presets",
|
|
256
|
+
# sarif
|
|
257
|
+
"SARIF_SCHEMA_URI",
|
|
258
|
+
"SARIF_VERSION",
|
|
259
|
+
"findings_to_sarif",
|
|
260
|
+
"synthesize_rule_id",
|
|
261
|
+
# baseline
|
|
262
|
+
"BaselineDiff",
|
|
263
|
+
"BaselineEntry",
|
|
264
|
+
"diff_against_baseline",
|
|
265
|
+
"filter_against_baseline",
|
|
266
|
+
"findings_to_entries",
|
|
267
|
+
"read_baseline",
|
|
268
|
+
"write_baseline",
|
|
269
|
+
# suppressions
|
|
270
|
+
"Suppression",
|
|
271
|
+
"apply_suppressions",
|
|
272
|
+
"load_suppressions",
|
|
273
|
+
# pr comment
|
|
274
|
+
"format_pr_comment",
|
|
275
|
+
# runner budget / scope anchor
|
|
276
|
+
"DEFAULT_CHAR_CEILING",
|
|
277
|
+
"DEFAULT_FILE_READ_CEILING",
|
|
278
|
+
"ROTATE_FRACTION",
|
|
279
|
+
"SCOPE_STAGES",
|
|
280
|
+
"SOFT_WARN_FRACTION",
|
|
281
|
+
"RunnerBudget",
|
|
282
|
+
"ScopeAnchor",
|
|
283
|
+
"budget_status",
|
|
284
|
+
"format_budget_nudge",
|
|
285
|
+
"new_budget",
|
|
286
|
+
"normalize_batch_files",
|
|
287
|
+
"out_of_batch",
|
|
288
|
+
"parse_scope_anchor",
|
|
289
|
+
"stage_regressed",
|
|
290
|
+
"update_budget",
|
|
291
|
+
# skill asset
|
|
292
|
+
"SKILL_MD",
|
|
293
|
+
]
|