bevor-cli 0.1.2__tar.gz → 0.1.3__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.1.2 → bevor_cli-0.1.3}/PKG-INFO +2 -2
- bevor_cli-0.1.3/bevor_cli/actions.py +25 -0
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/apps/analyses.py +33 -19
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/apps/codes.py +1 -1
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/apps/findings.py +15 -4
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/apps/main.py +11 -5
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/analyses/chats/get.py +2 -2
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/analyses/chats/list.py +12 -12
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/analyses/chats/messages.py +2 -2
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/analyses/chats/resume.py +1 -1
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/analyses/commit.py +6 -12
- bevor_cli-0.1.3/bevor_cli/commands/analyses/create.py +156 -0
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/analyses/delete.py +5 -16
- bevor_cli-0.1.3/bevor_cli/commands/analyses/deselect.py +17 -0
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/analyses/diff.py +15 -15
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/analyses/entrypoints.py +9 -13
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/analyses/fork.py +12 -11
- bevor_cli-0.1.3/bevor_cli/commands/analyses/lineage.py +104 -0
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/analyses/list.py +19 -12
- bevor_cli-0.1.2/bevor_cli/commands/agent/materialze_cmd.py → bevor_cli-0.1.3/bevor_cli/commands/analyses/materialize.py +9 -8
- bevor_cli-0.1.3/bevor_cli/commands/analyses/merge.py +61 -0
- bevor_cli-0.1.3/bevor_cli/commands/analyses/reset.py +38 -0
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/analyses/retry.py +6 -10
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/analyses/run.py +31 -19
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/analyses/select.py +21 -5
- bevor_cli-0.1.3/bevor_cli/commands/analyses/set_head.py +91 -0
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/analyses/transitions.py +8 -9
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/analyses/view.py +27 -25
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/auth/whoami.py +2 -1
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/codes/list.py +5 -7
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/codes/push.py +28 -10
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/codes/select.py +3 -5
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/codes/view.py +5 -7
- bevor_cli-0.1.3/bevor_cli/commands/findings/acknowledge.py +43 -0
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/findings/add.py +8 -16
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/findings/delete.py +2 -2
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/findings/edit.py +8 -4
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/findings/get.py +2 -2
- bevor_cli-0.1.2/bevor_cli/commands/findings/bulk.py → bevor_cli-0.1.3/bevor_cli/commands/findings/import_findings.py +10 -19
- bevor_cli-0.1.3/bevor_cli/commands/findings/list.py +297 -0
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/findings/revert.py +2 -2
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/graph/call_chain.py +4 -4
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/graph/edges.py +8 -8
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/graph/interactive.py +2 -2
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/link/__init__.py +2 -1
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/nodes/get.py +2 -2
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/nodes/list.py +4 -4
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/nodes/source.py +2 -2
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/projects/list.py +3 -3
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/projects/select.py +1 -1
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/projects/view.py +2 -2
- bevor_cli-0.1.3/bevor_cli/commands/reflog/__init__.py +54 -0
- bevor_cli-0.1.3/bevor_cli/commands/status/__init__.py +154 -0
- bevor_cli-0.1.3/bevor_cli/commands/sync/__init__.py +56 -0
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/workspaces/list.py +2 -2
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/workspaces/view.py +2 -2
- bevor_cli-0.1.3/bevor_cli/configuration/logs.py +61 -0
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/configuration/state.py +31 -1
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/findings_yaml.py +1 -1
- bevor_cli-0.1.3/bevor_cli/fingerprint.py +24 -0
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/main.py +1 -8
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/output.py +16 -1
- bevor_cli-0.1.3/bevor_cli/target.py +15 -0
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/pyproject.toml +2 -2
- bevor_cli-0.1.2/bevor_cli/apps/agent.py +0 -10
- bevor_cli-0.1.2/bevor_cli/commands/agent/setup_cmd.py +0 -18
- bevor_cli-0.1.2/bevor_cli/commands/analyses/active.py +0 -42
- bevor_cli-0.1.2/bevor_cli/commands/analyses/child.py +0 -81
- bevor_cli-0.1.2/bevor_cli/commands/analyses/create.py +0 -106
- bevor_cli-0.1.2/bevor_cli/commands/analyses/findings.py +0 -129
- bevor_cli-0.1.2/bevor_cli/commands/analyses/merge.py +0 -46
- bevor_cli-0.1.2/bevor_cli/commands/analyses/set_head.py +0 -45
- bevor_cli-0.1.2/bevor_cli/commands/context/__init__.py +0 -92
- bevor_cli-0.1.2/bevor_cli/commands/findings/acknowledge.py +0 -28
- bevor_cli-0.1.2/bevor_cli/commands/findings/list.py +0 -108
- bevor_cli-0.1.2/bevor_cli/configuration/__init__.py +0 -0
- bevor_cli-0.1.2/bevor_cli/configuration/settings.py +0 -54
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/.gitignore +0 -0
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/README.md +0 -0
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/__init__.py +0 -0
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/annotations/__init__.py +0 -0
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/annotations/confirmations.py +0 -0
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/annotations/query.py +0 -0
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/apps/chat.py +0 -0
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/apps/nodes.py +0 -0
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/apps/projects.py +0 -0
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/apps/sessions.py +0 -0
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/apps/workspaces.py +0 -0
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/callbacks/__init__.py +0 -0
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/callbacks/notify.py +0 -0
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/callbacks/upgrade.py +0 -0
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/callbacks/version.py +0 -0
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/client.py +0 -0
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/__init__.py +0 -0
- {bevor_cli-0.1.2/bevor_cli/commands/agent → bevor_cli-0.1.3/bevor_cli/commands/analyses}/__init__.py +0 -0
- {bevor_cli-0.1.2/bevor_cli/commands/analyses → bevor_cli-0.1.3/bevor_cli/commands/analyses/chats}/__init__.py +0 -0
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/analyses/chats/new.py +0 -0
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/analyses/chats/session.py +0 -0
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/auth/__init__.py +0 -0
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/auth/login.py +0 -0
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/auth/logout.py +0 -0
- {bevor_cli-0.1.2/bevor_cli/commands/analyses/chats → bevor_cli-0.1.3/bevor_cli/commands/codes}/__init__.py +0 -0
- {bevor_cli-0.1.2/bevor_cli/commands/codes → bevor_cli-0.1.3/bevor_cli/commands/findings}/__init__.py +0 -0
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/findings/interactive.py +0 -0
- {bevor_cli-0.1.2/bevor_cli/commands/findings → bevor_cli-0.1.3/bevor_cli/commands/graph}/__init__.py +0 -0
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/graph/renderer.py +0 -0
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/link/helpers.py +0 -0
- {bevor_cli-0.1.2/bevor_cli/commands/graph → bevor_cli-0.1.3/bevor_cli/commands/nodes}/__init__.py +0 -0
- {bevor_cli-0.1.2/bevor_cli/commands/nodes → bevor_cli-0.1.3/bevor_cli/commands/projects}/__init__.py +0 -0
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/projects/create.py +0 -0
- {bevor_cli-0.1.2/bevor_cli/commands/projects → bevor_cli-0.1.3/bevor_cli/commands/sessions}/__init__.py +0 -0
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/sessions/list.py +0 -0
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/sessions/revoke.py +0 -0
- {bevor_cli-0.1.2/bevor_cli/commands/sessions → bevor_cli-0.1.3/bevor_cli/commands/workspaces}/__init__.py +0 -0
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/workspaces/pick.py +0 -0
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/commands/workspaces/select.py +0 -0
- {bevor_cli-0.1.2/bevor_cli/commands/workspaces → bevor_cli-0.1.3/bevor_cli/configuration}/__init__.py +0 -0
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/configuration/creds.py +0 -0
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/configuration/update.py +0 -0
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/select.py +0 -0
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/bevor_cli/settings.py +0 -0
- {bevor_cli-0.1.2 → bevor_cli-0.1.3}/cli-hierarchy.py +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: bevor-cli
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.3
|
|
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.1.
|
|
7
|
+
Requires-Dist: bevor-sdk==0.1.3
|
|
8
8
|
Requires-Dist: click~=8.1
|
|
9
9
|
Requires-Dist: httpx~=0.28
|
|
10
10
|
Requires-Dist: packaging~=26.2
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from bevor_sdk.types.responses import ActionDetails
|
|
2
|
+
from bevor_sdk.types.responses.security import AnalysisActions
|
|
3
|
+
|
|
4
|
+
from bevor_cli.output import console
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def action_commands(actions: AnalysisActions) -> list[tuple[str, ActionDetails]]:
|
|
8
|
+
return [
|
|
9
|
+
("sync / create", actions.create_child),
|
|
10
|
+
("commit", actions.commit_changes),
|
|
11
|
+
("findings add/import/edit/delete", actions.stage_changes),
|
|
12
|
+
("run", actions.run_first_party_pipeline),
|
|
13
|
+
("run --all", actions.run_pipeline),
|
|
14
|
+
("retry", actions.retry_pipeline),
|
|
15
|
+
("fork", actions.fork),
|
|
16
|
+
("merge (into this)", actions.merge_to),
|
|
17
|
+
("merge (from this)", actions.merge_from),
|
|
18
|
+
("set-head", actions.set_as_head),
|
|
19
|
+
("delete", actions.delete),
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def print_actions(actions: AnalysisActions, label_width: int, separator: str = "") -> None:
|
|
24
|
+
allowed = [label for label, details in action_commands(actions) if details.is_allowed]
|
|
25
|
+
console.print(f"{'Can run':<{label_width}}{separator} {', '.join(allowed) or '(nothing)'}")
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import typer
|
|
2
|
-
from bevor_cli.commands.analyses.active import active_analysis
|
|
3
|
-
from bevor_cli.commands.analyses.child import create_child_analysis
|
|
4
2
|
from bevor_cli.commands.analyses.commit import commit_analysis
|
|
5
3
|
from bevor_cli.commands.analyses.create import create_analysis
|
|
6
|
-
from bevor_cli.commands.analyses.delete import
|
|
4
|
+
from bevor_cli.commands.analyses.delete import (
|
|
5
|
+
delete_analysis_full,
|
|
6
|
+
delete_analysis_version,
|
|
7
|
+
)
|
|
8
|
+
from bevor_cli.commands.analyses.deselect import deselect_analysis
|
|
7
9
|
from bevor_cli.commands.analyses.diff import diff_analysis
|
|
8
10
|
from bevor_cli.commands.analyses.entrypoints import list_entrypoints
|
|
9
|
-
from bevor_cli.commands.analyses.findings import list_analysis_findings
|
|
10
11
|
from bevor_cli.commands.analyses.fork import fork_analysis
|
|
12
|
+
from bevor_cli.commands.analyses.lineage import lineage_analysis
|
|
11
13
|
from bevor_cli.commands.analyses.list import list_analyses
|
|
14
|
+
from bevor_cli.commands.analyses.materialize import materialize_analysis
|
|
12
15
|
from bevor_cli.commands.analyses.merge import merge_analysis
|
|
16
|
+
from bevor_cli.commands.analyses.reset import reset_analysis
|
|
13
17
|
from bevor_cli.commands.analyses.retry import retry_analysis
|
|
14
18
|
from bevor_cli.commands.analyses.run import run_analysis
|
|
15
19
|
from bevor_cli.commands.analyses.select import select_analysis
|
|
@@ -17,31 +21,41 @@ from bevor_cli.commands.analyses.set_head import set_analysis_head
|
|
|
17
21
|
from bevor_cli.commands.analyses.transitions import list_transitions
|
|
18
22
|
from bevor_cli.commands.analyses.view import view_analysis
|
|
19
23
|
|
|
20
|
-
app = typer.Typer(
|
|
24
|
+
app = typer.Typer(
|
|
25
|
+
help=(
|
|
26
|
+
"Manage analyses.\n\n"
|
|
27
|
+
"An analysis is a history of versions, like a git repository. HEAD is the version commands "
|
|
28
|
+
"act on by default; pass --version to target another. Findings staged with `bevor findings` "
|
|
29
|
+
"sit on HEAD until you commit them, which creates a new version. After a code change, "
|
|
30
|
+
"`bevor sync` pushes it and adds it as a new version."
|
|
31
|
+
),
|
|
32
|
+
no_args_is_help=True,
|
|
33
|
+
)
|
|
21
34
|
|
|
22
35
|
app.command("list")(list_analyses)
|
|
23
36
|
app.command("view")(view_analysis)
|
|
37
|
+
app.command("lineage")(lineage_analysis)
|
|
24
38
|
app.command("select")(select_analysis)
|
|
25
|
-
app.command("
|
|
26
|
-
app.command("create")(create_analysis)
|
|
27
|
-
app.command("set-head")(set_analysis_head)
|
|
28
|
-
|
|
29
|
-
delete_app = typer.Typer(help="Delete an analysis container or version.", no_args_is_help=True)
|
|
30
|
-
delete_app.command("full")(delete_analysis_full)
|
|
31
|
-
delete_app.command("version")(delete_analysis_version)
|
|
32
|
-
app.add_typer(delete_app, name="delete")
|
|
39
|
+
app.command("deselect")(deselect_analysis)
|
|
33
40
|
|
|
34
|
-
app.command("
|
|
35
|
-
app.command("retry")(retry_analysis)
|
|
36
|
-
app.command("diff")(diff_analysis)
|
|
41
|
+
app.command("create")(create_analysis)
|
|
37
42
|
app.command("commit")(commit_analysis)
|
|
38
|
-
app.command("
|
|
43
|
+
app.command("reset")(reset_analysis)
|
|
39
44
|
app.command("fork")(fork_analysis)
|
|
40
45
|
app.command("merge")(merge_analysis)
|
|
41
|
-
app.command("findings")(list_analysis_findings)
|
|
42
|
-
|
|
43
46
|
|
|
47
|
+
app.command("run")(run_analysis)
|
|
48
|
+
app.command("retry")(retry_analysis)
|
|
44
49
|
app.command("entrypoints")(list_entrypoints)
|
|
50
|
+
app.command("materialize")(materialize_analysis)
|
|
51
|
+
app.command("diff")(diff_analysis)
|
|
45
52
|
app.command("transitions")(list_transitions)
|
|
46
53
|
|
|
54
|
+
app.command("set-head")(set_analysis_head)
|
|
55
|
+
|
|
56
|
+
delete_app = typer.Typer(help="Delete a version, or the entire analysis.", no_args_is_help=True)
|
|
57
|
+
delete_app.command("full")(delete_analysis_full)
|
|
58
|
+
delete_app.command("version")(delete_analysis_version)
|
|
59
|
+
app.add_typer(delete_app, name="delete")
|
|
60
|
+
|
|
47
61
|
__all__ = ["app"]
|
|
@@ -6,7 +6,7 @@ from bevor_cli.commands.codes.select import select_code
|
|
|
6
6
|
from bevor_cli.commands.codes.view import view_code
|
|
7
7
|
|
|
8
8
|
app = typer.Typer(
|
|
9
|
-
help="
|
|
9
|
+
help="Upload, list, and inspect code versions in the selected project.",
|
|
10
10
|
no_args_is_help=True,
|
|
11
11
|
)
|
|
12
12
|
app.command("list")(list_code_versions)
|
|
@@ -1,22 +1,33 @@
|
|
|
1
1
|
import typer
|
|
2
|
-
from bevor_cli.commands.findings.acknowledge import
|
|
2
|
+
from bevor_cli.commands.findings.acknowledge import (
|
|
3
|
+
acknowledge_finding,
|
|
4
|
+
unacknowledge_finding,
|
|
5
|
+
)
|
|
3
6
|
from bevor_cli.commands.findings.add import add_finding
|
|
4
|
-
from bevor_cli.commands.findings.bulk import bulk_findings
|
|
5
7
|
from bevor_cli.commands.findings.delete import delete_finding
|
|
6
8
|
from bevor_cli.commands.findings.edit import edit_finding
|
|
7
9
|
from bevor_cli.commands.findings.get import get_finding
|
|
10
|
+
from bevor_cli.commands.findings.import_findings import import_findings
|
|
8
11
|
from bevor_cli.commands.findings.list import list_findings
|
|
9
12
|
from bevor_cli.commands.findings.revert import revert_finding
|
|
10
13
|
|
|
11
|
-
app = typer.Typer(
|
|
14
|
+
app = typer.Typer(
|
|
15
|
+
help=(
|
|
16
|
+
"Stage, review, and search findings.\n\n"
|
|
17
|
+
"add, import, edit, and delete stage changes on HEAD of the selected analysis; "
|
|
18
|
+
"`bevor analyses commit` turns them into a new version."
|
|
19
|
+
),
|
|
20
|
+
no_args_is_help=True,
|
|
21
|
+
)
|
|
12
22
|
|
|
13
23
|
app.command("list")(list_findings)
|
|
14
24
|
app.command("view")(get_finding)
|
|
15
25
|
app.command("add")(add_finding)
|
|
16
|
-
app.command("
|
|
26
|
+
app.command("import")(import_findings)
|
|
17
27
|
app.command("edit")(edit_finding)
|
|
18
28
|
app.command("delete")(delete_finding)
|
|
19
29
|
app.command("revert")(revert_finding)
|
|
20
30
|
app.command("acknowledge")(acknowledge_finding)
|
|
31
|
+
app.command("unacknowledge")(unacknowledge_finding)
|
|
21
32
|
|
|
22
33
|
__all__ = ["app"]
|
|
@@ -3,7 +3,6 @@ import subprocess
|
|
|
3
3
|
import typer
|
|
4
4
|
from bevor_cli import output
|
|
5
5
|
from bevor_cli.apps import (
|
|
6
|
-
agent,
|
|
7
6
|
analyses,
|
|
8
7
|
chat,
|
|
9
8
|
codes,
|
|
@@ -14,10 +13,16 @@ from bevor_cli.apps import (
|
|
|
14
13
|
)
|
|
15
14
|
from bevor_cli.callbacks.notify import _notify_if_outdated, _update_check_enabled
|
|
16
15
|
from bevor_cli.callbacks.upgrade import _upgrade_command
|
|
17
|
-
from bevor_cli.callbacks.version import
|
|
16
|
+
from bevor_cli.callbacks.version import (
|
|
17
|
+
_current_version,
|
|
18
|
+
_latest_version,
|
|
19
|
+
_version_callback,
|
|
20
|
+
)
|
|
18
21
|
from bevor_cli.commands.auth import login, logout, whoami
|
|
19
|
-
from bevor_cli.commands.context import run_context
|
|
20
22
|
from bevor_cli.commands.link import run_link
|
|
23
|
+
from bevor_cli.commands.reflog import run_reflog
|
|
24
|
+
from bevor_cli.commands.status import run_status
|
|
25
|
+
from bevor_cli.commands.sync import run_sync
|
|
21
26
|
from bevor_cli.output import console
|
|
22
27
|
|
|
23
28
|
app = typer.Typer(
|
|
@@ -77,7 +82,9 @@ app.command("login")(login)
|
|
|
77
82
|
app.command("logout")(logout)
|
|
78
83
|
app.command("whoami")(whoami)
|
|
79
84
|
app.command("link")(run_link)
|
|
80
|
-
app.command("
|
|
85
|
+
app.command("status")(run_status)
|
|
86
|
+
app.command("sync")(run_sync)
|
|
87
|
+
app.command("reflog")(run_reflog)
|
|
81
88
|
|
|
82
89
|
app.add_typer(sessions.app, name="sessions")
|
|
83
90
|
app.add_typer(workspaces.app, name="workspaces")
|
|
@@ -85,7 +92,6 @@ app.add_typer(projects.app, name="projects")
|
|
|
85
92
|
app.add_typer(codes.app, name="codes")
|
|
86
93
|
app.add_typer(analyses.app, name="analyses")
|
|
87
94
|
app.add_typer(findings.app, name="findings")
|
|
88
|
-
app.add_typer(agent.app, name="agent")
|
|
89
95
|
app.add_typer(chat.app, name="chats")
|
|
90
96
|
|
|
91
97
|
__all__ = ["app"]
|
|
@@ -8,7 +8,7 @@ from bevor_cli.annotations.confirmations import JSON_OUT
|
|
|
8
8
|
from bevor_cli.client import BevorInternalClient
|
|
9
9
|
from bevor_cli.configuration.creds import Credentials
|
|
10
10
|
from bevor_cli.configuration.state import State
|
|
11
|
-
from bevor_cli.output import
|
|
11
|
+
from bevor_cli.output import print_json
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
def get_chat(chat_id: str = typer.Argument(..., help="Chat ID."), json_out: JSON_OUT = False) -> None:
|
|
@@ -25,7 +25,7 @@ def get_chat(chat_id: str = typer.Argument(..., help="Chat ID."), json_out: JSON
|
|
|
25
25
|
chat = client.chats.get(ID(chat_id))
|
|
26
26
|
|
|
27
27
|
if json_out:
|
|
28
|
-
|
|
28
|
+
print_json(chat.model_dump_json(indent=2))
|
|
29
29
|
return
|
|
30
30
|
|
|
31
31
|
table = Table(show_header=False, box=None, padding=(0, 1))
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""``bevor
|
|
1
|
+
"""``bevor analyses chats list``."""
|
|
2
2
|
|
|
3
3
|
from typing import Annotated, Optional
|
|
4
4
|
|
|
@@ -10,25 +10,25 @@ from bevor_cli.annotations.confirmations import JSON_OUT
|
|
|
10
10
|
from bevor_cli.annotations.query import ORDER, ORDER_BY, PAGE, PAGE_SIZE
|
|
11
11
|
from bevor_cli.client import BevorInternalClient
|
|
12
12
|
from bevor_cli.configuration.creds import Credentials
|
|
13
|
-
from bevor_cli.configuration.settings import Settings
|
|
14
13
|
from bevor_cli.configuration.state import State
|
|
15
|
-
from bevor_cli.output import console
|
|
14
|
+
from bevor_cli.output import console, print_json
|
|
16
15
|
|
|
17
16
|
|
|
18
17
|
def list_chats(
|
|
19
|
-
page: PAGE,
|
|
20
|
-
page_size: PAGE_SIZE,
|
|
21
|
-
order: ORDER,
|
|
22
|
-
order_by: ORDER_BY,
|
|
23
|
-
project: Annotated[
|
|
18
|
+
page: PAGE = None,
|
|
19
|
+
page_size: PAGE_SIZE = None,
|
|
20
|
+
order: ORDER = None,
|
|
21
|
+
order_by: ORDER_BY = None,
|
|
22
|
+
project: Annotated[
|
|
23
|
+
Optional[str], typer.Option("--project", help="project to list chats for")
|
|
24
|
+
] = None,
|
|
24
25
|
json_out: JSON_OUT = False,
|
|
25
26
|
) -> None:
|
|
26
|
-
"""List chats
|
|
27
|
+
"""List chats in the selected project (or ``--project``)."""
|
|
27
28
|
creds = Credentials.load()
|
|
28
29
|
creds.require_token()
|
|
29
30
|
|
|
30
31
|
state = State.load()
|
|
31
|
-
settings = Settings.load()
|
|
32
32
|
workspace_id = state.validate_workspace()
|
|
33
33
|
client = BevorInternalClient(
|
|
34
34
|
creds=creds, workspace_id=workspace_id, project_id=state.validate_project(priority=project)
|
|
@@ -36,7 +36,7 @@ def list_chats(
|
|
|
36
36
|
|
|
37
37
|
query_params = ChatsQueryParams(
|
|
38
38
|
page=page,
|
|
39
|
-
page_size=page_size
|
|
39
|
+
page_size=page_size,
|
|
40
40
|
order=order,
|
|
41
41
|
order_by=order_by,
|
|
42
42
|
)
|
|
@@ -44,7 +44,7 @@ def list_chats(
|
|
|
44
44
|
found = client.chats.list(options=query_params)
|
|
45
45
|
|
|
46
46
|
if json_out:
|
|
47
|
-
|
|
47
|
+
print_json(found.model_dump_json(indent=2))
|
|
48
48
|
return
|
|
49
49
|
|
|
50
50
|
if not found.results:
|
|
@@ -9,7 +9,7 @@ from bevor_cli.annotations.confirmations import JSON_OUT
|
|
|
9
9
|
from bevor_cli.client import BevorInternalClient
|
|
10
10
|
from bevor_cli.configuration.creds import Credentials
|
|
11
11
|
from bevor_cli.configuration.state import State
|
|
12
|
-
from bevor_cli.output import console
|
|
12
|
+
from bevor_cli.output import console, print_json
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
def chat_messages(
|
|
@@ -30,7 +30,7 @@ def chat_messages(
|
|
|
30
30
|
messages = client.chats.messages(ID(chat_id))
|
|
31
31
|
|
|
32
32
|
if json_out:
|
|
33
|
-
|
|
33
|
+
print_json(
|
|
34
34
|
json.dumps([m.model_dump(mode="json") for m in messages.results], indent=2)
|
|
35
35
|
)
|
|
36
36
|
return
|
|
@@ -1,45 +1,39 @@
|
|
|
1
|
-
"""``bevor
|
|
1
|
+
"""``bevor analyses commit`` — commit staged finding changes."""
|
|
2
2
|
|
|
3
3
|
from typing import Optional
|
|
4
4
|
|
|
5
5
|
import typer
|
|
6
|
-
from bevor_sdk.types import ID
|
|
7
6
|
from bevor_sdk.types.requests.security import VersionBodyDict
|
|
8
7
|
|
|
9
8
|
from bevor_cli import output
|
|
10
9
|
from bevor_cli.client import BevorInternalClient
|
|
11
10
|
from bevor_cli.configuration.creds import Credentials
|
|
12
11
|
from bevor_cli.configuration.state import State
|
|
12
|
+
from bevor_cli.target import resolve_target
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
def commit_analysis(
|
|
16
16
|
version: Optional[str] = typer.Option(
|
|
17
17
|
None,
|
|
18
18
|
"--version",
|
|
19
|
-
help="
|
|
19
|
+
help="Use this version instead of HEAD.",
|
|
20
20
|
),
|
|
21
21
|
) -> None:
|
|
22
|
-
"""Commit staged findings
|
|
23
|
-
analysis associated to the --version."""
|
|
22
|
+
"""Commit the staged findings on HEAD (or ``--version``) as a new version, and move HEAD to it."""
|
|
24
23
|
creds = Credentials.load()
|
|
25
24
|
creds.require_token()
|
|
26
25
|
|
|
27
26
|
state = State.load()
|
|
28
27
|
workspace_id = state.validate_workspace()
|
|
29
|
-
analysis_id = state.validate_analysis()
|
|
30
28
|
|
|
31
29
|
client = BevorInternalClient(
|
|
32
30
|
creds=creds, workspace_id=workspace_id, project_id=state.validate_project()
|
|
33
31
|
)
|
|
34
32
|
|
|
35
33
|
body = VersionBodyDict()
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
analysis_id = v_.analysis_meta.id
|
|
39
|
-
version_id = v_.id
|
|
34
|
+
analysis_id, version_id = resolve_target(client, state, version)
|
|
35
|
+
if version_id:
|
|
40
36
|
body["version_id"] = version_id
|
|
41
|
-
else:
|
|
42
|
-
analysis_id = state.validate_analysis()
|
|
43
37
|
|
|
44
38
|
result = client.analyses.commit(analysis_id, body)
|
|
45
39
|
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
"""``bevor analyses create`` — add the pushed code to the selected analysis, or start a new one."""
|
|
2
|
+
|
|
3
|
+
from typing import Literal, Optional
|
|
4
|
+
|
|
5
|
+
import typer
|
|
6
|
+
from bevor_sdk.types import ID
|
|
7
|
+
from bevor_sdk.types.requests.security import CreateAnalysisChildBodyDict
|
|
8
|
+
from bevor_sdk.types.requests.security.analyses import CreateAnalysisRootBodyDict
|
|
9
|
+
from bevor_sdk.types.responses.security import (
|
|
10
|
+
AnalysisCollisionResult,
|
|
11
|
+
AnalysisCreatedResult,
|
|
12
|
+
)
|
|
13
|
+
from rich.prompt import Confirm
|
|
14
|
+
|
|
15
|
+
from bevor_cli import output
|
|
16
|
+
from bevor_cli.annotations.confirmations import FORCE, JSON_OUT, YES
|
|
17
|
+
from bevor_cli.client import BevorInternalClient
|
|
18
|
+
from bevor_cli.configuration.creds import Credentials
|
|
19
|
+
from bevor_cli.configuration.state import State
|
|
20
|
+
from bevor_cli.fingerprint import require_code_in_sync
|
|
21
|
+
from bevor_cli.output import console, print_json
|
|
22
|
+
from bevor_cli.target import resolve_target
|
|
23
|
+
|
|
24
|
+
Collision = Literal["surface", "force", "merge"]
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def create_from_pushed_code(
|
|
28
|
+
*,
|
|
29
|
+
new: bool,
|
|
30
|
+
name: str | None,
|
|
31
|
+
version: str | None,
|
|
32
|
+
collision: Collision,
|
|
33
|
+
json_out: bool,
|
|
34
|
+
yes: bool,
|
|
35
|
+
) -> None:
|
|
36
|
+
"""Add the pushed code as a new version on HEAD of the selected analysis, or start a new analysis
|
|
37
|
+
when none is selected (or ``new`` is set)."""
|
|
38
|
+
creds = Credentials.load()
|
|
39
|
+
creds.require_token()
|
|
40
|
+
|
|
41
|
+
state = State.load()
|
|
42
|
+
workspace_id = state.validate_workspace()
|
|
43
|
+
code_id = state.validate_code()
|
|
44
|
+
|
|
45
|
+
start = new or (state.analysis_id is None and version is None)
|
|
46
|
+
|
|
47
|
+
if start and version:
|
|
48
|
+
output.error("--version can't be combined with --new.")
|
|
49
|
+
raise typer.Exit(1)
|
|
50
|
+
if not start and name:
|
|
51
|
+
output.error(
|
|
52
|
+
"--name only applies when starting a new analysis.",
|
|
53
|
+
hint="Pass `--new` to start one, or drop `--name` to add a version to the selected analysis.",
|
|
54
|
+
)
|
|
55
|
+
raise typer.Exit(1)
|
|
56
|
+
|
|
57
|
+
if start and not yes:
|
|
58
|
+
if not Confirm.ask(f"Start a new analysis from code {code_id}?"):
|
|
59
|
+
raise typer.Exit(0)
|
|
60
|
+
|
|
61
|
+
client = BevorInternalClient(
|
|
62
|
+
creds=creds, workspace_id=workspace_id, project_id=state.validate_project()
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
if start:
|
|
66
|
+
created = client.analyses.create_root(
|
|
67
|
+
CreateAnalysisRootBodyDict(code_id=ID(code_id), name=name, on_collision=collision)
|
|
68
|
+
)
|
|
69
|
+
else:
|
|
70
|
+
analysis_id, version_id = resolve_target(client, state, version)
|
|
71
|
+
body = CreateAnalysisChildBodyDict(code_id=code_id, on_collision=collision)
|
|
72
|
+
if version_id:
|
|
73
|
+
body["version_id"] = version_id
|
|
74
|
+
created = client.analyses.create_child(analysis_id, body)
|
|
75
|
+
|
|
76
|
+
if isinstance(created, AnalysisCreatedResult):
|
|
77
|
+
state.set_analysis(created.analysis)
|
|
78
|
+
state.save()
|
|
79
|
+
|
|
80
|
+
if json_out:
|
|
81
|
+
print_json(created.analysis.model_dump_json(indent=2))
|
|
82
|
+
elif start:
|
|
83
|
+
output.success(
|
|
84
|
+
f"Started analysis {created.analysis.id} and selected it. "
|
|
85
|
+
"Next: `bevor analyses run` or `bevor findings add`."
|
|
86
|
+
)
|
|
87
|
+
else:
|
|
88
|
+
output.success(
|
|
89
|
+
f"Added version {created.analysis.version.id} to analysis {created.analysis.id}. HEAD moved to it."
|
|
90
|
+
)
|
|
91
|
+
return
|
|
92
|
+
|
|
93
|
+
if isinstance(created, AnalysisCollisionResult):
|
|
94
|
+
if json_out:
|
|
95
|
+
print_json(created.model_dump_json(indent=2))
|
|
96
|
+
return
|
|
97
|
+
|
|
98
|
+
print_collision(created)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def print_collision(collision: AnalysisCollisionResult) -> None:
|
|
103
|
+
output.warning("This exact code already has a version in this project; nothing was created.")
|
|
104
|
+
for candidate in collision.candidates:
|
|
105
|
+
meta = candidate.analysis_meta
|
|
106
|
+
owner = "yours" if candidate.on_collision == "view" else meta.user.username
|
|
107
|
+
head = " (HEAD)" if candidate.is_head else ""
|
|
108
|
+
view = (
|
|
109
|
+
f"bevor analyses view {meta.id}"
|
|
110
|
+
if candidate.is_head
|
|
111
|
+
else f"bevor analyses view --version {candidate.id}"
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
console.print(
|
|
115
|
+
f"\n [bold]{meta.name}[/bold] ({owner}, {candidate.created_at.date()})"
|
|
116
|
+
f"\n analysis {meta.id} version {candidate.id}{head}"
|
|
117
|
+
)
|
|
118
|
+
console.print(f" view: {view}")
|
|
119
|
+
if candidate.on_collision == "fork":
|
|
120
|
+
console.print(f" fork: bevor analyses fork --version {candidate.id}")
|
|
121
|
+
elif candidate.on_collision == "merge":
|
|
122
|
+
console.print(f" merge: bevor analyses merge --from-version {candidate.id}")
|
|
123
|
+
else:
|
|
124
|
+
console.print(f" select: bevor analyses select {meta.id}")
|
|
125
|
+
console.print("\nTo create a new one anyway, pass --collision force.")
|
|
126
|
+
|
|
127
|
+
def create_analysis(
|
|
128
|
+
new: bool = typer.Option(
|
|
129
|
+
False, "--new", help="Start a new analysis even if one is selected."
|
|
130
|
+
),
|
|
131
|
+
name: Optional[str] = typer.Option(None, "--name", help="Name for a new analysis."),
|
|
132
|
+
version: Optional[str] = typer.Option(
|
|
133
|
+
None, "--version", help="Add the new version on top of this version instead of HEAD."
|
|
134
|
+
),
|
|
135
|
+
collision: Collision = typer.Option(
|
|
136
|
+
"surface",
|
|
137
|
+
"--collision",
|
|
138
|
+
help="What to do if this code already has a version: surface the candidates (default), force, or merge.",
|
|
139
|
+
),
|
|
140
|
+
yes: YES = False,
|
|
141
|
+
json_out: JSON_OUT = False,
|
|
142
|
+
force: FORCE = False,
|
|
143
|
+
) -> None:
|
|
144
|
+
"""Create a version for the pushed code.
|
|
145
|
+
|
|
146
|
+
With an analysis selected, adds it as a new version on HEAD and moves HEAD to it. With none
|
|
147
|
+
selected (or ``--new``), starts a new analysis and selects it. Nothing is run; use
|
|
148
|
+
`bevor analyses run` for that. The working directory must match the last push; `bevor sync`
|
|
149
|
+
pushes and does this in one step.
|
|
150
|
+
"""
|
|
151
|
+
if not force:
|
|
152
|
+
require_code_in_sync(State.load())
|
|
153
|
+
|
|
154
|
+
create_from_pushed_code(
|
|
155
|
+
new=new, name=name, version=version, collision=collision, json_out=json_out, yes=yes
|
|
156
|
+
)
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
"""``bevor
|
|
2
|
-
|
|
3
|
-
from typing import Optional
|
|
1
|
+
"""``bevor analyses delete {full|version}``."""
|
|
4
2
|
|
|
5
3
|
import typer
|
|
6
4
|
from bevor_sdk.types import ID
|
|
@@ -12,7 +10,7 @@ from bevor_cli.configuration.state import State
|
|
|
12
10
|
|
|
13
11
|
|
|
14
12
|
def delete_analysis_full() -> None:
|
|
15
|
-
"""Delete the
|
|
13
|
+
"""Delete the selected analysis and all of its versions."""
|
|
16
14
|
creds = Credentials.load()
|
|
17
15
|
creds.require_token()
|
|
18
16
|
|
|
@@ -32,12 +30,9 @@ def delete_analysis_full() -> None:
|
|
|
32
30
|
|
|
33
31
|
|
|
34
32
|
def delete_analysis_version(
|
|
35
|
-
version:
|
|
36
|
-
None,
|
|
37
|
-
help="Version id to delete (default: configured analysis head).",
|
|
38
|
-
),
|
|
33
|
+
version: str = typer.Argument(..., help="Version id to delete. Must be a leaf version."),
|
|
39
34
|
) -> None:
|
|
40
|
-
"""Delete a single
|
|
35
|
+
"""Delete a single leaf version. If it was HEAD, HEAD moves to its parent."""
|
|
41
36
|
creds = Credentials.load()
|
|
42
37
|
creds.require_token()
|
|
43
38
|
|
|
@@ -48,16 +43,10 @@ def delete_analysis_version(
|
|
|
48
43
|
creds=creds, workspace_id=workspace_id, project_id=state.validate_project()
|
|
49
44
|
)
|
|
50
45
|
|
|
51
|
-
|
|
52
|
-
analysis_id = state.validate_analysis()
|
|
53
|
-
analysis = client.analyses.get(analysis_id)
|
|
54
|
-
id_to_delete = analysis.version.id
|
|
55
|
-
else:
|
|
56
|
-
id_to_delete = ID(version)
|
|
46
|
+
id_to_delete = ID(version)
|
|
57
47
|
|
|
58
48
|
result = client.analysis_versions.delete(id_to_delete)
|
|
59
49
|
|
|
60
|
-
# HEAD may have moved back to parent — refresh config if still same container.
|
|
61
50
|
if state.analysis_id == result.id:
|
|
62
51
|
state.set_analysis(result)
|
|
63
52
|
state.save()
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"""``bevor analyses deselect`` — clear the selected analysis."""
|
|
2
|
+
|
|
3
|
+
from bevor_cli import output
|
|
4
|
+
from bevor_cli.configuration.state import State
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def deselect_analysis() -> None:
|
|
8
|
+
"""Clear the selected analysis. Nothing is deleted; the pushed code stays selected."""
|
|
9
|
+
state = State.load()
|
|
10
|
+
if state.analysis_id is None:
|
|
11
|
+
output.info("No analysis is selected.")
|
|
12
|
+
return
|
|
13
|
+
|
|
14
|
+
analysis_id = state.analysis_id
|
|
15
|
+
state.clear_analysis()
|
|
16
|
+
state.save()
|
|
17
|
+
output.success(f"Deselected analysis {analysis_id}.")
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
"""``bevor
|
|
1
|
+
"""``bevor analyses diff``."""
|
|
2
2
|
|
|
3
3
|
from typing import Optional
|
|
4
4
|
|
|
5
5
|
import typer
|
|
6
|
-
from bevor_sdk.types import ID
|
|
7
6
|
from bevor_sdk.types.requests.security import VersionQueryParams
|
|
8
|
-
from bevor_sdk.types.responses.security import
|
|
7
|
+
from bevor_sdk.types.responses.security import (
|
|
8
|
+
FindingBareSchema,
|
|
9
|
+
FindingTransitionSchema,
|
|
10
|
+
)
|
|
9
11
|
from rich.table import Table
|
|
10
12
|
from rich.text import Text
|
|
11
13
|
|
|
@@ -14,7 +16,8 @@ from bevor_cli.client import BevorInternalClient
|
|
|
14
16
|
from bevor_cli.commands.findings.get import LEVEL_COLORS
|
|
15
17
|
from bevor_cli.configuration.creds import Credentials
|
|
16
18
|
from bevor_cli.configuration.state import State
|
|
17
|
-
from bevor_cli.output import console
|
|
19
|
+
from bevor_cli.output import console, print_json
|
|
20
|
+
from bevor_cli.target import resolve_target
|
|
18
21
|
|
|
19
22
|
|
|
20
23
|
def _snapshot(item: FindingTransitionSchema) -> FindingBareSchema:
|
|
@@ -27,7 +30,7 @@ def diff_analysis(
|
|
|
27
30
|
version: Optional[str] = typer.Option(
|
|
28
31
|
None,
|
|
29
32
|
"--version",
|
|
30
|
-
help="
|
|
33
|
+
help="Use this version instead of HEAD.",
|
|
31
34
|
),
|
|
32
35
|
staged: bool = typer.Option(
|
|
33
36
|
False,
|
|
@@ -36,9 +39,9 @@ def diff_analysis(
|
|
|
36
39
|
),
|
|
37
40
|
json_out: JSON_OUT = False,
|
|
38
41
|
) -> None:
|
|
39
|
-
"""Show
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
"""Show how findings changed between HEAD (or ``--version``) and its parent.
|
|
43
|
+
|
|
44
|
+
With ``--staged``, show the uncommitted changes on HEAD instead."""
|
|
42
45
|
creds = Credentials.load()
|
|
43
46
|
creds.require_token()
|
|
44
47
|
|
|
@@ -50,12 +53,9 @@ def diff_analysis(
|
|
|
50
53
|
)
|
|
51
54
|
|
|
52
55
|
opts = VersionQueryParams()
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
opts["version_id"] = v_.id
|
|
57
|
-
else:
|
|
58
|
-
analysis_id = state.validate_analysis()
|
|
56
|
+
analysis_id, version_id = resolve_target(client, state, version)
|
|
57
|
+
if version_id:
|
|
58
|
+
opts["version_id"] = version_id
|
|
59
59
|
|
|
60
60
|
analysis_source = client.analyses(analysis_id)
|
|
61
61
|
|
|
@@ -65,7 +65,7 @@ def diff_analysis(
|
|
|
65
65
|
page = analysis_source.diff_version(opts)
|
|
66
66
|
|
|
67
67
|
if json_out:
|
|
68
|
-
|
|
68
|
+
print_json(page.model_dump_json(indent=2))
|
|
69
69
|
return
|
|
70
70
|
|
|
71
71
|
if not page.results:
|