bevor-cli 0.2.0rc3__tar.gz → 0.2.0rc5__tar.gz
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.
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/.gitignore +4 -2
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/PKG-INFO +2 -2
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/actions.py +2 -5
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/apps/analyses.py +0 -8
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/apps/findings.py +2 -2
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/analyses/entrypoints.py +3 -1
- bevor_cli-0.2.0rc5/bevor_cli/commands/analyses/lineage.py +53 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/analyses/list.py +1 -1
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/analyses/select.py +1 -2
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/analyses/transitions.py +17 -11
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/analyses/view.py +1 -8
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/findings/interactive.py +11 -11
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/findings/list.py +1 -18
- bevor_cli-0.2.0rc3/bevor_cli/commands/findings/revert.py → bevor_cli-0.2.0rc5/bevor_cli/commands/findings/undo.py +4 -4
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/graph/interactive.py +1 -1
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/nodes/get.py +1 -1
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/nodes/list.py +1 -1
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/status/__init__.py +1 -11
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/sync/__init__.py +1 -6
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/output.py +19 -10
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/pyproject.toml +2 -2
- bevor_cli-0.2.0rc3/bevor_cli/commands/analyses/commit.py +0 -43
- bevor_cli-0.2.0rc3/bevor_cli/commands/analyses/diff.py +0 -84
- bevor_cli-0.2.0rc3/bevor_cli/commands/analyses/lineage.py +0 -104
- bevor_cli-0.2.0rc3/bevor_cli/commands/analyses/reset.py +0 -42
- bevor_cli-0.2.0rc3/bevor_cli/commands/analyses/retry.py +0 -77
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/README.md +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/__init__.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/annotations/__init__.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/annotations/confirmations.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/annotations/literal_args.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/annotations/query.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/apps/chat.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/apps/codes.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/apps/main.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/apps/nodes.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/apps/projects.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/apps/sessions.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/apps/workspaces.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/callbacks/__init__.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/callbacks/notify.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/callbacks/upgrade.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/callbacks/version.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/client.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/__init__.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/analyses/__init__.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/analyses/chats/__init__.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/analyses/chats/get.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/analyses/chats/list.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/analyses/chats/messages.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/analyses/chats/new.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/analyses/chats/resume.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/analyses/chats/session.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/analyses/create.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/analyses/delete.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/analyses/deselect.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/analyses/fork.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/analyses/materialize.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/analyses/merge.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/analyses/run.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/analyses/set_head.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/auth/__init__.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/auth/login.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/auth/logout.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/auth/whoami.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/codes/__init__.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/codes/list.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/codes/push.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/codes/select.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/codes/view.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/findings/__init__.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/findings/acknowledge.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/findings/add.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/findings/delete.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/findings/edit.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/findings/get.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/findings/import_findings.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/graph/__init__.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/graph/call_chain.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/graph/edges.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/graph/renderer.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/link/__init__.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/link/helpers.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/nodes/__init__.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/nodes/source.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/projects/__init__.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/projects/create.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/projects/list.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/projects/select.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/projects/view.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/reflog/__init__.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/sessions/__init__.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/sessions/list.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/sessions/revoke.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/workspaces/__init__.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/workspaces/list.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/workspaces/pick.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/workspaces/select.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/commands/workspaces/view.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/configuration/__init__.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/configuration/creds.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/configuration/logs.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/configuration/state.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/configuration/update.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/findings_yaml.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/fingerprint.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/main.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/select.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/settings.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/bevor_cli/target.py +0 -0
- {bevor_cli-0.2.0rc3 → bevor_cli-0.2.0rc5}/cli-hierarchy.py +0 -0
|
@@ -54,8 +54,10 @@ logs/
|
|
|
54
54
|
# Local development / tests
|
|
55
55
|
.local/
|
|
56
56
|
.test-repo-cache/
|
|
57
|
-
tests/
|
|
58
|
-
!tests/
|
|
57
|
+
tests/fixtures/real_repos/*
|
|
58
|
+
!tests/fixtures/real_repos/config.py
|
|
59
|
+
tests/fixtures/**/target/
|
|
60
|
+
tests/fixtures/**/Cargo.lock
|
|
59
61
|
|
|
60
62
|
# Bevor
|
|
61
63
|
.bevor
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: bevor-cli
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.0rc5
|
|
4
4
|
Summary: Bevor CLI tool for security analysis and graph inspection
|
|
5
5
|
Classifier: Development Status :: 3 - Alpha
|
|
6
6
|
Requires-Python: >=3.13
|
|
7
|
-
Requires-Dist: bevor-sdk==0.2.
|
|
7
|
+
Requires-Dist: bevor-sdk==0.2.0rc5
|
|
8
8
|
Requires-Dist: click~=8.1
|
|
9
9
|
Requires-Dist: httpx~=0.28
|
|
10
10
|
Requires-Dist: packaging~=26.2
|
|
@@ -6,11 +6,8 @@ from bevor_cli.output import console
|
|
|
6
6
|
def action_commands(actions: AnalysisActions) -> list[tuple[str, ActionDetails]]:
|
|
7
7
|
return [
|
|
8
8
|
("sync / create", actions.create_child),
|
|
9
|
-
("
|
|
10
|
-
("
|
|
11
|
-
("run", actions.run_first_party_pipeline),
|
|
12
|
-
("run --all", actions.run_pipeline),
|
|
13
|
-
("retry", actions.retry_pipeline),
|
|
9
|
+
("alter findings", actions.alter_findings),
|
|
10
|
+
("run", actions.run_pipeline),
|
|
14
11
|
("fork", actions.fork),
|
|
15
12
|
("merge (into this)", actions.merge_to),
|
|
16
13
|
("merge (from this)", actions.merge_from),
|
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
import typer
|
|
2
|
-
from bevor_cli.commands.analyses.commit import commit_analysis
|
|
3
2
|
from bevor_cli.commands.analyses.create import create_analysis
|
|
4
3
|
from bevor_cli.commands.analyses.delete import (
|
|
5
4
|
delete_analysis_full,
|
|
6
5
|
delete_analysis_version,
|
|
7
6
|
)
|
|
8
7
|
from bevor_cli.commands.analyses.deselect import deselect_analysis
|
|
9
|
-
from bevor_cli.commands.analyses.diff import diff_analysis
|
|
10
8
|
from bevor_cli.commands.analyses.entrypoints import list_entrypoints
|
|
11
9
|
from bevor_cli.commands.analyses.fork import fork_analysis
|
|
12
10
|
from bevor_cli.commands.analyses.lineage import lineage_analysis
|
|
13
11
|
from bevor_cli.commands.analyses.list import list_analyses
|
|
14
12
|
from bevor_cli.commands.analyses.materialize import materialize_analysis
|
|
15
13
|
from bevor_cli.commands.analyses.merge import merge_analysis
|
|
16
|
-
from bevor_cli.commands.analyses.reset import reset_analysis
|
|
17
|
-
from bevor_cli.commands.analyses.retry import retry_analysis
|
|
18
14
|
from bevor_cli.commands.analyses.run import run_analysis
|
|
19
15
|
from bevor_cli.commands.analyses.select import select_analysis
|
|
20
16
|
from bevor_cli.commands.analyses.set_head import set_analysis_head
|
|
@@ -39,16 +35,12 @@ app.command("select")(select_analysis)
|
|
|
39
35
|
app.command("deselect")(deselect_analysis)
|
|
40
36
|
|
|
41
37
|
app.command("create")(create_analysis)
|
|
42
|
-
app.command("commit")(commit_analysis)
|
|
43
|
-
app.command("reset")(reset_analysis)
|
|
44
38
|
app.command("fork")(fork_analysis)
|
|
45
39
|
app.command("merge")(merge_analysis)
|
|
46
40
|
|
|
47
41
|
app.command("run")(run_analysis)
|
|
48
|
-
app.command("retry")(retry_analysis)
|
|
49
42
|
app.command("entrypoints")(list_entrypoints)
|
|
50
43
|
app.command("materialize")(materialize_analysis)
|
|
51
|
-
app.command("diff")(diff_analysis)
|
|
52
44
|
app.command("transitions")(list_transitions)
|
|
53
45
|
|
|
54
46
|
app.command("set-head")(set_analysis_head)
|
|
@@ -9,7 +9,7 @@ from bevor_cli.commands.findings.edit import edit_finding
|
|
|
9
9
|
from bevor_cli.commands.findings.get import get_finding
|
|
10
10
|
from bevor_cli.commands.findings.import_findings import import_findings
|
|
11
11
|
from bevor_cli.commands.findings.list import list_findings
|
|
12
|
-
from bevor_cli.commands.findings.
|
|
12
|
+
from bevor_cli.commands.findings.undo import undo_change
|
|
13
13
|
|
|
14
14
|
app = typer.Typer(
|
|
15
15
|
help=(
|
|
@@ -26,7 +26,7 @@ app.command("add")(add_finding)
|
|
|
26
26
|
app.command("import")(import_findings)
|
|
27
27
|
app.command("edit")(edit_finding)
|
|
28
28
|
app.command("delete")(delete_finding)
|
|
29
|
-
app.command("
|
|
29
|
+
app.command("undo")(undo_change)
|
|
30
30
|
app.command("acknowledge")(acknowledge_finding)
|
|
31
31
|
app.command("unacknowledge")(unacknowledge_finding)
|
|
32
32
|
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"""``bevor analyses lineage`` — ancestry of HEAD in the selected analysis."""
|
|
2
|
+
|
|
3
|
+
import typer
|
|
4
|
+
|
|
5
|
+
from bevor_cli.annotations.confirmations import JSON_OUT
|
|
6
|
+
from bevor_cli.client import BevorInternalClient
|
|
7
|
+
from bevor_cli.configuration.creds import Credentials
|
|
8
|
+
from bevor_cli.configuration.state import State
|
|
9
|
+
from bevor_cli.output import console, findings_detail, print_json
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def lineage_analysis(
|
|
13
|
+
limit: int = typer.Option(10, "--limit", "-n", help="Maximum number of versions to show."),
|
|
14
|
+
oneline: bool = typer.Option(False, "--oneline", help="One line per version."),
|
|
15
|
+
json_out: JSON_OUT = False,
|
|
16
|
+
) -> None:
|
|
17
|
+
"""Show HEAD of the selected analysis and its ancestors, back toward the root.
|
|
18
|
+
|
|
19
|
+
Each version is fetched individually, so keep ``--limit`` small on long histories.
|
|
20
|
+
"""
|
|
21
|
+
creds = Credentials.load()
|
|
22
|
+
creds.require_token()
|
|
23
|
+
|
|
24
|
+
state = State.load()
|
|
25
|
+
workspace_id = state.validate_workspace()
|
|
26
|
+
|
|
27
|
+
client = BevorInternalClient(
|
|
28
|
+
creds=creds, workspace_id=workspace_id, project_id=state.validate_project()
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
lineage = client.analyses.lineage(state.validate_analysis())
|
|
32
|
+
|
|
33
|
+
if json_out:
|
|
34
|
+
print_json(lineage.model_dump_json())
|
|
35
|
+
return
|
|
36
|
+
|
|
37
|
+
for i, e in enumerate(lineage.results):
|
|
38
|
+
head_marker = " [bold cyan](HEAD)[/bold cyan]" if e.is_head else ""
|
|
39
|
+
detail = findings_detail(e.n_findings, e.n_remediations)
|
|
40
|
+
|
|
41
|
+
if oneline:
|
|
42
|
+
console.print(f"[yellow]{e.id}[/yellow]{head_marker} {e.trigger} {detail}")
|
|
43
|
+
continue
|
|
44
|
+
|
|
45
|
+
if i:
|
|
46
|
+
console.print()
|
|
47
|
+
console.print(f"[yellow]version {e.id}[/yellow]{head_marker}")
|
|
48
|
+
if e.merged_from_version_id:
|
|
49
|
+
console.print(f"Merged: {e.merged_from_version_id}")
|
|
50
|
+
console.print(f"Trigger: {e.trigger}")
|
|
51
|
+
console.print(f"Code: {e.code_id}")
|
|
52
|
+
console.print(f"Findings: {e.n_findings}{detail}")
|
|
53
|
+
console.print(f"Date: {e.created_at:%Y-%m-%d %H:%M}")
|
|
@@ -80,8 +80,7 @@ def select_analysis(
|
|
|
80
80
|
questionary.Choice(
|
|
81
81
|
title=(
|
|
82
82
|
f"{a.name} · {a.version.code_version.id} "
|
|
83
|
-
f"{a.version.n_findings}
|
|
84
|
-
f"{findings_detail(a.version.n_staged, a.version.n_remediations)} "
|
|
83
|
+
f"{findings_detail(a.version.n_findings, a.version.n_remediations)} "
|
|
85
84
|
f"{a.user.username} "
|
|
86
85
|
f"{a.id} {a.created_at.date()}"
|
|
87
86
|
),
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
from typing import Annotated, Optional
|
|
4
4
|
|
|
5
5
|
import typer
|
|
6
|
-
from bevor_sdk.types.literals import
|
|
6
|
+
from bevor_sdk.types.literals import FindingTransitionKind
|
|
7
7
|
from bevor_sdk.types.requests import TransitionListParams
|
|
8
|
+
from bevor_sdk.types.responses import FindingBare, FindingTransition
|
|
8
9
|
from rich.table import Table
|
|
9
10
|
from rich.text import Text
|
|
10
11
|
|
|
@@ -12,24 +13,29 @@ from bevor_cli.annotations.confirmations import JSON_OUT
|
|
|
12
13
|
from bevor_cli.annotations.literal_args import literal_option
|
|
13
14
|
from bevor_cli.annotations.query import ORDER, ORDER_BY, PAGE, PAGE_SIZE
|
|
14
15
|
from bevor_cli.client import BevorInternalClient
|
|
15
|
-
from bevor_cli.commands.analyses.diff import _snapshot
|
|
16
16
|
from bevor_cli.commands.findings.get import LEVEL_COLORS
|
|
17
17
|
from bevor_cli.configuration.creds import Credentials
|
|
18
18
|
from bevor_cli.configuration.state import State
|
|
19
19
|
from bevor_cli.output import console, print_json
|
|
20
20
|
|
|
21
21
|
|
|
22
|
+
def _snapshot(item: FindingTransition) -> FindingBare:
|
|
23
|
+
to_render = item.after_finding or item.before_finding
|
|
24
|
+
assert to_render
|
|
25
|
+
return to_render
|
|
26
|
+
|
|
27
|
+
|
|
22
28
|
def list_transitions(
|
|
23
29
|
page: PAGE = None,
|
|
24
30
|
page_size: PAGE_SIZE = None,
|
|
25
31
|
order: ORDER = None,
|
|
26
32
|
order_by: ORDER_BY = None,
|
|
27
|
-
|
|
28
|
-
|
|
33
|
+
kind: Annotated[
|
|
34
|
+
FindingTransitionKind | None,
|
|
29
35
|
literal_option(
|
|
30
|
-
|
|
31
|
-
"--
|
|
32
|
-
help="Only show transitions with this
|
|
36
|
+
FindingTransitionKind,
|
|
37
|
+
"--kind",
|
|
38
|
+
help="Only show transitions with this kind (e.g. remediated, carried).",
|
|
33
39
|
),
|
|
34
40
|
] = None,
|
|
35
41
|
version: Optional[str] = typer.Option(
|
|
@@ -64,8 +70,8 @@ def list_transitions(
|
|
|
64
70
|
query_params["order"] = order
|
|
65
71
|
if order_by is not None:
|
|
66
72
|
query_params["order_by"] = order_by
|
|
67
|
-
if
|
|
68
|
-
query_params["
|
|
73
|
+
if kind is not None:
|
|
74
|
+
query_params["kind"] = kind
|
|
69
75
|
if version:
|
|
70
76
|
query_params["after_version_id"] = version
|
|
71
77
|
elif not project_wide:
|
|
@@ -82,11 +88,11 @@ def list_transitions(
|
|
|
82
88
|
console.print("No transitions.")
|
|
83
89
|
return
|
|
84
90
|
|
|
85
|
-
table = Table("
|
|
91
|
+
table = Table("Kind", "Type", "Level", "Name", "Version", "Created")
|
|
86
92
|
for item in result.results:
|
|
87
93
|
snapshot = _snapshot(item)
|
|
88
94
|
table.add_row(
|
|
89
|
-
item.
|
|
95
|
+
item.kind,
|
|
90
96
|
snapshot.type,
|
|
91
97
|
Text(snapshot.level, style=LEVEL_COLORS[snapshot.level]),
|
|
92
98
|
snapshot.name,
|
|
@@ -61,7 +61,7 @@ def view_analysis(
|
|
|
61
61
|
table.add_row("Owner", str(analysis_meta_.is_owner))
|
|
62
62
|
table.add_row(
|
|
63
63
|
"Findings",
|
|
64
|
-
f"{
|
|
64
|
+
f"{findings_detail(version_.n_findings, version_.n_remediations)}",
|
|
65
65
|
)
|
|
66
66
|
table.add_row("Code version", version_.code_version.id)
|
|
67
67
|
table.add_row("Is head", str(version_.is_head))
|
|
@@ -84,13 +84,6 @@ def view_analysis(
|
|
|
84
84
|
|
|
85
85
|
table.add_row("In sync w/ .bevor code", str(in_sync))
|
|
86
86
|
|
|
87
|
-
table.add_row(
|
|
88
|
-
"Staged",
|
|
89
|
-
f"{version_.n_staged} change(s) — `bevor analyses diff --staged`"
|
|
90
|
-
if version_.n_staged
|
|
91
|
-
else "nothing",
|
|
92
|
-
)
|
|
93
|
-
|
|
94
87
|
console.print(table)
|
|
95
88
|
console.print()
|
|
96
89
|
print_actions(version_.actions, label_width=8)
|
|
@@ -7,7 +7,7 @@ from typing import Callable, List
|
|
|
7
7
|
|
|
8
8
|
import click
|
|
9
9
|
import typer
|
|
10
|
-
from bevor_sdk.types.literals import
|
|
10
|
+
from bevor_sdk.types.literals import FindingEventKind
|
|
11
11
|
from bevor_sdk.types.responses import Finding
|
|
12
12
|
from rich.console import Group
|
|
13
13
|
from rich.live import Live
|
|
@@ -26,10 +26,10 @@ _MIN_DETAIL_LINES = 6
|
|
|
26
26
|
_OP_COLORS = {"add": "green", "edit": "yellow", "delete": "red"}
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
def _op_badge(
|
|
30
|
-
if not
|
|
29
|
+
def _op_badge(event_kind: FindingEventKind | None) -> Text:
|
|
30
|
+
if not event_kind:
|
|
31
31
|
return Text("—", style="dim")
|
|
32
|
-
return Text(
|
|
32
|
+
return Text(event_kind.upper(), style=f"bold {_OP_COLORS.get(event_kind, 'white')}")
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
def _nav_delta(key: str) -> int:
|
|
@@ -50,8 +50,8 @@ def _action_hints(finding: Finding) -> str:
|
|
|
50
50
|
parts = ["↑↓/j/k move", "q quit"]
|
|
51
51
|
if finding.actions.edit.is_allowed:
|
|
52
52
|
parts.append("e edit")
|
|
53
|
-
if finding.actions.
|
|
54
|
-
parts.append("
|
|
53
|
+
if finding.actions.undo.is_allowed:
|
|
54
|
+
parts.append("u undo")
|
|
55
55
|
if finding.actions.delete.is_allowed:
|
|
56
56
|
parts.append("x delete")
|
|
57
57
|
return " ".join(parts)
|
|
@@ -137,7 +137,7 @@ def _findings_table_with_ops(
|
|
|
137
137
|
for i, finding in enumerate(rows):
|
|
138
138
|
style = "reverse" if focus is not None and i == focus else ""
|
|
139
139
|
table.add_row(
|
|
140
|
-
_op_badge(finding.
|
|
140
|
+
_op_badge(finding.last_event_kind),
|
|
141
141
|
Text(finding.level, style=LEVEL_COLORS[finding.level]),
|
|
142
142
|
finding.type,
|
|
143
143
|
finding.name,
|
|
@@ -166,7 +166,7 @@ def _findings_table_with_ops(
|
|
|
166
166
|
for i in range(start, end):
|
|
167
167
|
finding = rows[i]
|
|
168
168
|
table.add_row(
|
|
169
|
-
_op_badge(finding.
|
|
169
|
+
_op_badge(finding.last_event_kind),
|
|
170
170
|
Text(finding.level, style=LEVEL_COLORS[finding.level]),
|
|
171
171
|
finding.type,
|
|
172
172
|
finding.name,
|
|
@@ -299,10 +299,10 @@ def browse_findings_with_actions(
|
|
|
299
299
|
|
|
300
300
|
f = rows[focus]
|
|
301
301
|
|
|
302
|
-
if key.lower() == "
|
|
302
|
+
if key.lower() == "u" and f.actions.undo.is_allowed:
|
|
303
303
|
live.stop()
|
|
304
|
-
if typer.confirm(f"Revert staged {f.
|
|
305
|
-
client.findings.
|
|
304
|
+
if typer.confirm(f"Revert staged {f.last_event_kind} on {f.name!r}?"):
|
|
305
|
+
client.findings.undo(f.id)
|
|
306
306
|
rows = refetch()
|
|
307
307
|
focus = min(focus, len(rows) - 1)
|
|
308
308
|
live.start()
|
|
@@ -7,7 +7,7 @@ from typing import Annotated, List, Literal, Optional
|
|
|
7
7
|
import typer
|
|
8
8
|
from bevor_sdk import Graph
|
|
9
9
|
from bevor_sdk.helpers.sarif import bevor_to_sarif_sync
|
|
10
|
-
from bevor_sdk.types.literals import
|
|
10
|
+
from bevor_sdk.types.literals import FindingLevel
|
|
11
11
|
from bevor_sdk.types.requests import (
|
|
12
12
|
FindingListParams,
|
|
13
13
|
VersionIdentifierParam,
|
|
@@ -35,7 +35,6 @@ def _matches(
|
|
|
35
35
|
finding_type: Optional[str],
|
|
36
36
|
level: Optional[FindingLevel],
|
|
37
37
|
is_acknowledged: Optional[bool],
|
|
38
|
-
operation: Optional[FindingDraftOperation],
|
|
39
38
|
) -> bool:
|
|
40
39
|
if finding_type and finding.type != finding_type:
|
|
41
40
|
return False
|
|
@@ -43,8 +42,6 @@ def _matches(
|
|
|
43
42
|
return False
|
|
44
43
|
if is_acknowledged is not None and finding.is_acknowledged is not is_acknowledged:
|
|
45
44
|
return False
|
|
46
|
-
if operation and finding.operation != operation:
|
|
47
|
-
return False
|
|
48
45
|
return True
|
|
49
46
|
|
|
50
47
|
|
|
@@ -86,15 +83,6 @@ def list_findings(
|
|
|
86
83
|
is_acknowledged: Optional[bool] = typer.Option(
|
|
87
84
|
None, "--acknowledged", help="Only acknowledged findings.", rich_help_panel=FILTER_PANEL
|
|
88
85
|
),
|
|
89
|
-
operation: Annotated[
|
|
90
|
-
FindingDraftOperation | None,
|
|
91
|
-
literal_option(
|
|
92
|
-
FindingDraftOperation,
|
|
93
|
-
"--operation",
|
|
94
|
-
help="Only staged changes of this kind.",
|
|
95
|
-
rich_help_panel=FILTER_PANEL,
|
|
96
|
-
),
|
|
97
|
-
] = None,
|
|
98
86
|
page: Annotated[
|
|
99
87
|
Optional[int], typer.Option("--page", help="Page number.", rich_help_panel=SEARCH_PANEL)
|
|
100
88
|
] = None,
|
|
@@ -205,7 +193,6 @@ def list_findings(
|
|
|
205
193
|
finding_type=finding_type,
|
|
206
194
|
level=level,
|
|
207
195
|
is_acknowledged=is_acknowledged,
|
|
208
|
-
operation=operation,
|
|
209
196
|
is_self=is_self,
|
|
210
197
|
user_id=user_id,
|
|
211
198
|
code_id=code_id,
|
|
@@ -235,7 +222,6 @@ def list_findings(
|
|
|
235
222
|
finding_type=finding_type,
|
|
236
223
|
level=level,
|
|
237
224
|
is_acknowledged=is_acknowledged,
|
|
238
|
-
operation=operation,
|
|
239
225
|
)
|
|
240
226
|
]
|
|
241
227
|
|
|
@@ -274,7 +260,6 @@ def _search_params(
|
|
|
274
260
|
finding_type: Optional[str],
|
|
275
261
|
level: Optional[FindingLevel],
|
|
276
262
|
is_acknowledged: Optional[bool],
|
|
277
|
-
operation: Optional[FindingDraftOperation],
|
|
278
263
|
is_self: Optional[bool],
|
|
279
264
|
user_id: Optional[str],
|
|
280
265
|
code_id: Optional[str],
|
|
@@ -297,8 +282,6 @@ def _search_params(
|
|
|
297
282
|
query_params["level"] = level
|
|
298
283
|
if is_acknowledged is not None:
|
|
299
284
|
query_params["is_acknowledged"] = is_acknowledged
|
|
300
|
-
if operation is not None:
|
|
301
|
-
query_params["operation"] = operation
|
|
302
285
|
|
|
303
286
|
if is_self is not None:
|
|
304
287
|
query_params["is_self"] = is_self
|
|
@@ -9,8 +9,8 @@ from bevor_cli.configuration.creds import Credentials
|
|
|
9
9
|
from bevor_cli.configuration.state import State
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
def
|
|
13
|
-
finding_id: str = typer.Argument(..., help="Finding id to
|
|
12
|
+
def undo_change(
|
|
13
|
+
finding_id: str = typer.Argument(..., help="Finding id to undo changes to."),
|
|
14
14
|
) -> None:
|
|
15
15
|
"""Discard the staged change to a finding. To discard everything staged, use `bevor analyses reset`."""
|
|
16
16
|
creds = Credentials.load()
|
|
@@ -23,6 +23,6 @@ def revert_finding(
|
|
|
23
23
|
creds=creds, workspace_id=workspace_id, project_id=state.validate_project()
|
|
24
24
|
)
|
|
25
25
|
|
|
26
|
-
client.findings.
|
|
26
|
+
client.findings.undo(ID(finding_id))
|
|
27
27
|
|
|
28
|
-
output.success("
|
|
28
|
+
output.success("Recent finding change undone.")
|
|
@@ -136,7 +136,7 @@ def interactive_cmd(
|
|
|
136
136
|
typer.echo(f"Short id: {node.short_id}")
|
|
137
137
|
typer.echo(f"Name: {node.name}")
|
|
138
138
|
typer.echo(f"Type: {node.node_type}")
|
|
139
|
-
typer.echo(f"File: {node.
|
|
139
|
+
typer.echo(f"File: {node.file_path} ({node.file_id})")
|
|
140
140
|
elif action == "s":
|
|
141
141
|
with output.spinner(f"Fetching source for {node.short_id}…"):
|
|
142
142
|
content = client.codes.nodes.content(code_id, ID(node.short_id))
|
|
@@ -47,6 +47,6 @@ def get_node(
|
|
|
47
47
|
table.add_row("Short id", str(node.short_id))
|
|
48
48
|
table.add_row("Name", node.name)
|
|
49
49
|
table.add_row("Type", str(node.node_type))
|
|
50
|
-
table.add_row("File", f"{node.
|
|
50
|
+
table.add_row("File", f"{node.file_path} ({node.file_id})")
|
|
51
51
|
|
|
52
52
|
console.print(table)
|
|
@@ -71,5 +71,5 @@ def list_nodes(
|
|
|
71
71
|
table.add_column("EP", justify="center")
|
|
72
72
|
|
|
73
73
|
for n in nodes.results:
|
|
74
|
-
table.add_row(n.short_id, n.name, n.node_type, n.
|
|
74
|
+
table.add_row(n.short_id, n.name, n.node_type, n.file_path, "⚡" if n.is_entrypoint else "")
|
|
75
75
|
console.print(table)
|
|
@@ -104,9 +104,7 @@ def run_status(
|
|
|
104
104
|
head = analysis.version
|
|
105
105
|
lines.append(f"Analysis : {analysis.name} [{analysis.id}]")
|
|
106
106
|
lines.append(f"HEAD : {head.id} ({head.trigger}, {head.created_at.date()})")
|
|
107
|
-
lines.append(
|
|
108
|
-
f"Findings : {head.n_findings}{findings_detail(head.n_staged, head.n_remediations)}"
|
|
109
|
-
)
|
|
107
|
+
lines.append(f"Findings : {findings_detail(head.n_findings, head.n_remediations)}")
|
|
110
108
|
payload["analysis"] = analysis.model_dump(mode="json")
|
|
111
109
|
|
|
112
110
|
head_matches = (
|
|
@@ -118,14 +116,6 @@ def run_status(
|
|
|
118
116
|
f"HEAD code : {head.code_version.id} (differs from pushed code — run `bevor sync`)"
|
|
119
117
|
)
|
|
120
118
|
|
|
121
|
-
payload["staged"] = head.n_staged
|
|
122
|
-
if head.n_staged:
|
|
123
|
-
lines.append(
|
|
124
|
-
f"Staged : {head.n_staged} change(s) — review with `bevor analyses diff --staged`"
|
|
125
|
-
)
|
|
126
|
-
else:
|
|
127
|
-
lines.append("Staged : nothing")
|
|
128
|
-
|
|
129
119
|
entrypoints = client.analyses.entrypoints(analysis.id)
|
|
130
120
|
counts = Counter(str(ep.pipeline_status) for ep in entrypoints.results)
|
|
131
121
|
payload["pipeline"] = dict(counts)
|
|
@@ -42,13 +42,8 @@ def run_sync(
|
|
|
42
42
|
output.info(f"Analysis {state.analysis_id} is already on this code.")
|
|
43
43
|
elif not head.actions.create_child.is_allowed:
|
|
44
44
|
reasons = "; ".join(head.actions.create_child.reasons) or "not allowed on this version"
|
|
45
|
-
hint = (
|
|
46
|
-
f"HEAD has {head.n_staged} staged change(s): run `bevor analyses commit` or `bevor analyses reset`, then `bevor sync`."
|
|
47
|
-
if head.n_staged
|
|
48
|
-
else None
|
|
49
|
-
)
|
|
50
45
|
output.error(
|
|
51
|
-
f"Pushed, but can't add a version to analysis {state.analysis_id}: {reasons}",
|
|
46
|
+
f"Pushed, but can't add a version to analysis {state.analysis_id}: {reasons}",
|
|
52
47
|
)
|
|
53
48
|
raise typer.Exit(1)
|
|
54
49
|
else:
|
|
@@ -72,13 +72,22 @@ def print_json(data: str) -> None:
|
|
|
72
72
|
sys.stdout.write(data if data.endswith("\n") else data + "\n")
|
|
73
73
|
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
75
|
+
def findings_detail(n_findings: int, n_remediations: int) -> str:
|
|
76
|
+
detail = ""
|
|
77
|
+
if n_remediations > 0:
|
|
78
|
+
detail = f" ({n_remediations} remediated)"
|
|
79
|
+
|
|
80
|
+
return f"{n_findings} finding{'' if n_findings == 1 else 's'}{detail}"
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
__all__ = [
|
|
84
|
+
"set_quiet",
|
|
85
|
+
"info",
|
|
86
|
+
"success",
|
|
87
|
+
"warning",
|
|
88
|
+
"error",
|
|
89
|
+
"spinner",
|
|
90
|
+
"console",
|
|
91
|
+
"print_json",
|
|
92
|
+
"findings_detail",
|
|
93
|
+
]
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "bevor-cli"
|
|
3
|
-
version = "0.2.
|
|
3
|
+
version = "0.2.0rc5"
|
|
4
4
|
description = "Bevor CLI tool for security analysis and graph inspection"
|
|
5
5
|
requires-python = ">=3.13"
|
|
6
6
|
dependencies = [
|
|
7
|
-
"bevor-sdk==0.2.
|
|
7
|
+
"bevor-sdk==0.2.0rc5",
|
|
8
8
|
"typer~=0.26",
|
|
9
9
|
"httpx~=0.28",
|
|
10
10
|
"pydantic~=2.12",
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"""``bevor analyses commit`` — commit staged finding changes."""
|
|
2
|
-
|
|
3
|
-
from typing import Optional
|
|
4
|
-
|
|
5
|
-
import typer
|
|
6
|
-
from bevor_sdk.types.requests import VersionIdentifierBody
|
|
7
|
-
|
|
8
|
-
from bevor_cli import output
|
|
9
|
-
from bevor_cli.client import BevorInternalClient
|
|
10
|
-
from bevor_cli.configuration.creds import Credentials
|
|
11
|
-
from bevor_cli.configuration.state import State
|
|
12
|
-
from bevor_cli.target import resolve_target
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
def commit_analysis(
|
|
16
|
-
version: Optional[str] = typer.Option(
|
|
17
|
-
None,
|
|
18
|
-
"--version",
|
|
19
|
-
help="Use this version instead of HEAD.",
|
|
20
|
-
),
|
|
21
|
-
) -> None:
|
|
22
|
-
"""Commit the staged findings on HEAD (or ``--version``) as a new version, and move HEAD to it."""
|
|
23
|
-
creds = Credentials.load()
|
|
24
|
-
creds.require_token()
|
|
25
|
-
|
|
26
|
-
state = State.load()
|
|
27
|
-
workspace_id = state.validate_workspace()
|
|
28
|
-
|
|
29
|
-
client = BevorInternalClient(
|
|
30
|
-
creds=creds, workspace_id=workspace_id, project_id=state.validate_project()
|
|
31
|
-
)
|
|
32
|
-
|
|
33
|
-
body = VersionIdentifierBody()
|
|
34
|
-
analysis_id, version_id = resolve_target(client, state, version)
|
|
35
|
-
if version_id:
|
|
36
|
-
body["version_id"] = version_id
|
|
37
|
-
|
|
38
|
-
result = client.analyses.commit(analysis_id, body)
|
|
39
|
-
|
|
40
|
-
state.set_analysis(result)
|
|
41
|
-
state.save()
|
|
42
|
-
|
|
43
|
-
output.success(f"Committed changes → new head {result.version.id} (analysis {result.id}).")
|