bevor-cli 0.2.0rc1__tar.gz → 0.2.0rc2__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.0rc1 → bevor_cli-0.2.0rc2}/PKG-INFO +2 -2
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/actions.py +1 -2
- bevor_cli-0.2.0rc2/bevor_cli/annotations/literal_args.py +12 -0
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/client.py +0 -27
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/analyses/chats/get.py +1 -1
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/analyses/chats/list.py +11 -8
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/analyses/chats/messages.py +2 -4
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/analyses/chats/session.py +2 -2
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/analyses/commit.py +2 -2
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/analyses/create.py +9 -13
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/analyses/delete.py +1 -1
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/analyses/diff.py +4 -7
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/analyses/entrypoints.py +2 -2
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/analyses/fork.py +2 -2
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/analyses/list.py +4 -6
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/analyses/materialize.py +4 -6
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/analyses/merge.py +3 -3
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/analyses/reset.py +6 -2
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/analyses/retry.py +4 -4
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/analyses/run.py +11 -10
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/analyses/select.py +10 -8
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/analyses/set_head.py +3 -3
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/analyses/transitions.py +24 -16
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/analyses/view.py +1 -1
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/auth/login.py +2 -2
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/auth/whoami.py +5 -3
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/codes/list.py +29 -20
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/codes/push.py +2 -2
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/codes/select.py +12 -7
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/codes/view.py +2 -2
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/findings/acknowledge.py +1 -1
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/findings/add.py +52 -34
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/findings/delete.py +1 -1
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/findings/edit.py +4 -4
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/findings/get.py +1 -1
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/findings/import_findings.py +4 -5
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/findings/interactive.py +12 -12
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/findings/list.py +85 -40
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/findings/revert.py +1 -1
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/graph/call_chain.py +4 -4
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/graph/edges.py +22 -16
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/graph/interactive.py +12 -5
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/graph/renderer.py +15 -31
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/link/__init__.py +10 -8
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/link/helpers.py +3 -3
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/nodes/get.py +1 -1
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/nodes/list.py +12 -12
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/nodes/source.py +1 -1
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/projects/create.py +18 -10
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/projects/list.py +3 -1
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/projects/select.py +4 -3
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/status/__init__.py +11 -12
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/sync/__init__.py +7 -3
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/workspaces/list.py +13 -10
- bevor_cli-0.2.0rc2/bevor_cli/commands/workspaces/pick.py +19 -0
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/workspaces/select.py +11 -9
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/workspaces/view.py +11 -10
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/configuration/state.py +4 -5
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/findings_yaml.py +43 -31
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/target.py +1 -1
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/pyproject.toml +2 -2
- bevor_cli-0.2.0rc1/bevor_cli/commands/workspaces/pick.py +0 -20
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/.gitignore +0 -0
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/README.md +0 -0
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/__init__.py +0 -0
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/annotations/__init__.py +0 -0
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/annotations/confirmations.py +0 -0
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/annotations/query.py +0 -0
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/apps/analyses.py +0 -0
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/apps/chat.py +0 -0
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/apps/codes.py +0 -0
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/apps/findings.py +0 -0
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/apps/main.py +0 -0
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/apps/nodes.py +0 -0
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/apps/projects.py +0 -0
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/apps/sessions.py +0 -0
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/apps/workspaces.py +0 -0
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/callbacks/__init__.py +0 -0
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/callbacks/notify.py +0 -0
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/callbacks/upgrade.py +0 -0
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/callbacks/version.py +0 -0
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/__init__.py +0 -0
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/analyses/__init__.py +0 -0
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/analyses/chats/__init__.py +0 -0
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/analyses/chats/new.py +0 -0
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/analyses/chats/resume.py +0 -0
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/analyses/deselect.py +0 -0
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/analyses/lineage.py +0 -0
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/auth/__init__.py +0 -0
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/auth/logout.py +0 -0
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/codes/__init__.py +0 -0
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/findings/__init__.py +0 -0
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/graph/__init__.py +0 -0
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/nodes/__init__.py +0 -0
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/projects/__init__.py +0 -0
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/projects/view.py +0 -0
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/reflog/__init__.py +0 -0
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/sessions/__init__.py +0 -0
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/sessions/list.py +0 -0
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/sessions/revoke.py +0 -0
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/commands/workspaces/__init__.py +0 -0
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/configuration/__init__.py +0 -0
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/configuration/creds.py +0 -0
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/configuration/logs.py +0 -0
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/configuration/update.py +0 -0
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/fingerprint.py +0 -0
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/main.py +0 -0
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/output.py +0 -0
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/select.py +0 -0
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/bevor_cli/settings.py +0 -0
- {bevor_cli-0.2.0rc1 → bevor_cli-0.2.0rc2}/cli-hierarchy.py +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: bevor-cli
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.0rc2
|
|
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.0rc2
|
|
8
8
|
Requires-Dist: click~=8.1
|
|
9
9
|
Requires-Dist: httpx~=0.28
|
|
10
10
|
Requires-Dist: packaging~=26.2
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from typing import TypeAliasType, get_args
|
|
2
|
+
|
|
3
|
+
import typer
|
|
4
|
+
from typer._types import TyperChoice
|
|
5
|
+
from typer.models import OptionInfo
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def literal_option(alias: TypeAliasType, *names: str, help: str, **kwargs) -> OptionInfo:
|
|
9
|
+
# Typer can't unwrap `type` aliases ("Type not yet supported"), so give it the choices directly
|
|
10
|
+
return typer.Option(
|
|
11
|
+
*names, help=help, click_type=TyperChoice(get_args(alias.__value__)), **kwargs
|
|
12
|
+
)
|
|
@@ -8,13 +8,6 @@ import httpx
|
|
|
8
8
|
import typer
|
|
9
9
|
from bevor_sdk import BevorClient
|
|
10
10
|
from bevor_sdk.exceptions import ERROR_REGISTRY, BevorErrorTypes
|
|
11
|
-
from bevor_sdk.types.requests.manage import CreateProjectBodyDict
|
|
12
|
-
from bevor_sdk.types.responses import ResultsResponse
|
|
13
|
-
from bevor_sdk.types.responses.manage import (
|
|
14
|
-
ProjectSchema,
|
|
15
|
-
UserDetailedSchema,
|
|
16
|
-
WorkspaceDetailedSchema,
|
|
17
|
-
)
|
|
18
11
|
from httpx._types import QueryParamTypes, TimeoutTypes
|
|
19
12
|
|
|
20
13
|
from bevor_cli import output
|
|
@@ -135,23 +128,3 @@ class BevorInternalBusinessClient(httpx.Client):
|
|
|
135
128
|
response = super().send(request, **kwargs)
|
|
136
129
|
self._handle_http_error(response)
|
|
137
130
|
return response
|
|
138
|
-
|
|
139
|
-
def me(self) -> UserDetailedSchema:
|
|
140
|
-
data = self.get("/v1/me").json()
|
|
141
|
-
return UserDetailedSchema.model_validate(data)
|
|
142
|
-
|
|
143
|
-
def list_workspaces(self) -> ResultsResponse[WorkspaceDetailedSchema]:
|
|
144
|
-
data = self.get("/v1/me/workspaces").json()
|
|
145
|
-
return ResultsResponse[WorkspaceDetailedSchema].model_validate(data)
|
|
146
|
-
|
|
147
|
-
def get_workspace(self) -> WorkspaceDetailedSchema:
|
|
148
|
-
data = self.get("/v1/workspace").json()
|
|
149
|
-
return WorkspaceDetailedSchema.model_validate(data)
|
|
150
|
-
|
|
151
|
-
def list_projects(self) -> ResultsResponse[ProjectSchema]:
|
|
152
|
-
data = self.get("/v1/workspace/projects").json()
|
|
153
|
-
return ResultsResponse[ProjectSchema].model_validate(data)
|
|
154
|
-
|
|
155
|
-
def create_project(self, body: CreateProjectBodyDict) -> ProjectSchema:
|
|
156
|
-
data = self.post("/v1/workspace/projects", json=body).json()
|
|
157
|
-
return ProjectSchema.model_validate(data)
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
from typing import Annotated, Optional
|
|
4
4
|
|
|
5
5
|
import typer
|
|
6
|
-
from bevor_sdk.types.requests
|
|
6
|
+
from bevor_sdk.types.requests import ChatListParams
|
|
7
7
|
from rich.table import Table
|
|
8
8
|
|
|
9
9
|
from bevor_cli.annotations.confirmations import JSON_OUT
|
|
@@ -34,14 +34,17 @@ def list_chats(
|
|
|
34
34
|
creds=creds, workspace_id=workspace_id, project_id=state.validate_project(priority=project)
|
|
35
35
|
)
|
|
36
36
|
|
|
37
|
-
query_params =
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
query_params = ChatListParams()
|
|
38
|
+
if page is not None:
|
|
39
|
+
query_params["page"] = page
|
|
40
|
+
if page_size is not None:
|
|
41
|
+
query_params["page_size"] = page_size
|
|
42
|
+
if order is not None:
|
|
43
|
+
query_params["order"] = order
|
|
44
|
+
if order_by is not None:
|
|
45
|
+
query_params["order_by"] = order_by
|
|
43
46
|
|
|
44
|
-
found = client.chats.list(
|
|
47
|
+
found = client.chats.list(params=query_params)
|
|
45
48
|
|
|
46
49
|
if json_out:
|
|
47
50
|
print_json(found.model_dump_json(indent=2))
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import json
|
|
4
4
|
|
|
5
5
|
import typer
|
|
6
|
-
from bevor_sdk.types import ID
|
|
6
|
+
from bevor_sdk.types.shared import ID
|
|
7
7
|
|
|
8
8
|
from bevor_cli.annotations.confirmations import JSON_OUT
|
|
9
9
|
from bevor_cli.client import BevorInternalClient
|
|
@@ -30,9 +30,7 @@ def chat_messages(
|
|
|
30
30
|
messages = client.chats.messages(ID(chat_id))
|
|
31
31
|
|
|
32
32
|
if json_out:
|
|
33
|
-
print_json(
|
|
34
|
-
json.dumps([m.model_dump(mode="json") for m in messages.results], indent=2)
|
|
35
|
-
)
|
|
33
|
+
print_json(json.dumps([m.model_dump(mode="json") for m in messages.results], indent=2))
|
|
36
34
|
return
|
|
37
35
|
|
|
38
36
|
for m in messages.results:
|
|
@@ -10,8 +10,8 @@ from typing import Any, Dict, List
|
|
|
10
10
|
import httpx
|
|
11
11
|
import questionary
|
|
12
12
|
import typer
|
|
13
|
-
from bevor_sdk._sync.resources.
|
|
14
|
-
from bevor_sdk.types import ID
|
|
13
|
+
from bevor_sdk._sync.resources.chats import BoundChatResources
|
|
14
|
+
from bevor_sdk.types.shared import ID
|
|
15
15
|
from rich.console import Console, ConsoleOptions, RenderResult
|
|
16
16
|
from rich.live import Live
|
|
17
17
|
from rich.markdown import CodeBlock, Markdown
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
from typing import Optional
|
|
4
4
|
|
|
5
5
|
import typer
|
|
6
|
-
from bevor_sdk.types.requests
|
|
6
|
+
from bevor_sdk.types.requests import VersionIdentifierBody
|
|
7
7
|
|
|
8
8
|
from bevor_cli import output
|
|
9
9
|
from bevor_cli.client import BevorInternalClient
|
|
@@ -30,7 +30,7 @@ def commit_analysis(
|
|
|
30
30
|
creds=creds, workspace_id=workspace_id, project_id=state.validate_project()
|
|
31
31
|
)
|
|
32
32
|
|
|
33
|
-
body =
|
|
33
|
+
body = VersionIdentifierBody()
|
|
34
34
|
analysis_id, version_id = resolve_target(client, state, version)
|
|
35
35
|
if version_id:
|
|
36
36
|
body["version_id"] = version_id
|
|
@@ -3,13 +3,8 @@
|
|
|
3
3
|
from typing import Literal, Optional
|
|
4
4
|
|
|
5
5
|
import typer
|
|
6
|
-
from bevor_sdk.types import
|
|
7
|
-
from bevor_sdk.types.
|
|
8
|
-
from bevor_sdk.types.requests.security.analyses import CreateAnalysisRootBodyDict
|
|
9
|
-
from bevor_sdk.types.responses.security import (
|
|
10
|
-
AnalysisCollisionResult,
|
|
11
|
-
AnalysisCreatedResult,
|
|
12
|
-
)
|
|
6
|
+
from bevor_sdk.types.requests import AnalysisCreateChildBody, AnalysisCreateRootBody
|
|
7
|
+
from bevor_sdk.types.responses import AnalysisCollisionResult, AnalysisCreatedResult
|
|
13
8
|
from rich.prompt import Confirm
|
|
14
9
|
|
|
15
10
|
from bevor_cli import output
|
|
@@ -63,15 +58,16 @@ def create_from_pushed_code(
|
|
|
63
58
|
)
|
|
64
59
|
|
|
65
60
|
if start:
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
61
|
+
data = AnalysisCreateRootBody(code_id=code_id, on_collision=collision)
|
|
62
|
+
if name:
|
|
63
|
+
data["name"] = name
|
|
64
|
+
created = client.analyses.create_root(data)
|
|
69
65
|
else:
|
|
70
66
|
analysis_id, version_id = resolve_target(client, state, version)
|
|
71
|
-
|
|
67
|
+
data = AnalysisCreateChildBody(code_id=code_id, on_collision=collision)
|
|
72
68
|
if version_id:
|
|
73
|
-
|
|
74
|
-
created = client.analyses.create_child(analysis_id,
|
|
69
|
+
data["version_id"] = version_id
|
|
70
|
+
created = client.analyses.create_child(analysis_id, data)
|
|
75
71
|
|
|
76
72
|
if isinstance(created, AnalysisCreatedResult):
|
|
77
73
|
state.set_analysis(created.analysis)
|
|
@@ -3,11 +3,8 @@
|
|
|
3
3
|
from typing import Optional
|
|
4
4
|
|
|
5
5
|
import typer
|
|
6
|
-
from bevor_sdk.types.requests
|
|
7
|
-
from bevor_sdk.types.responses
|
|
8
|
-
FindingBareSchema,
|
|
9
|
-
FindingTransitionSchema,
|
|
10
|
-
)
|
|
6
|
+
from bevor_sdk.types.requests import VersionIdentifierParam
|
|
7
|
+
from bevor_sdk.types.responses import FindingBare, FindingTransition
|
|
11
8
|
from rich.table import Table
|
|
12
9
|
from rich.text import Text
|
|
13
10
|
|
|
@@ -20,7 +17,7 @@ from bevor_cli.output import console, print_json
|
|
|
20
17
|
from bevor_cli.target import resolve_target
|
|
21
18
|
|
|
22
19
|
|
|
23
|
-
def _snapshot(item:
|
|
20
|
+
def _snapshot(item: FindingTransition) -> FindingBare:
|
|
24
21
|
to_render = item.after_finding or item.before_finding
|
|
25
22
|
assert to_render
|
|
26
23
|
return to_render
|
|
@@ -52,7 +49,7 @@ def diff_analysis(
|
|
|
52
49
|
creds=creds, workspace_id=workspace_id, project_id=state.validate_project()
|
|
53
50
|
)
|
|
54
51
|
|
|
55
|
-
opts =
|
|
52
|
+
opts = VersionIdentifierParam()
|
|
56
53
|
analysis_id, version_id = resolve_target(client, state, version)
|
|
57
54
|
if version_id:
|
|
58
55
|
opts["version_id"] = version_id
|
|
@@ -4,7 +4,7 @@ import json
|
|
|
4
4
|
from typing import Optional
|
|
5
5
|
|
|
6
6
|
import typer
|
|
7
|
-
from bevor_sdk.types.requests
|
|
7
|
+
from bevor_sdk.types.requests import VersionIdentifierParam
|
|
8
8
|
|
|
9
9
|
from bevor_cli.annotations.confirmations import JSON_OUT
|
|
10
10
|
from bevor_cli.client import BevorInternalClient
|
|
@@ -33,7 +33,7 @@ def list_entrypoints(
|
|
|
33
33
|
creds=creds, workspace_id=workspace_id, project_id=state.validate_project()
|
|
34
34
|
)
|
|
35
35
|
|
|
36
|
-
opts =
|
|
36
|
+
opts = VersionIdentifierParam()
|
|
37
37
|
analysis_id, version_id = resolve_target(client, state, version)
|
|
38
38
|
if version_id:
|
|
39
39
|
opts["version_id"] = version_id
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
from typing import Optional
|
|
4
4
|
|
|
5
5
|
import typer
|
|
6
|
-
from bevor_sdk.types.requests
|
|
6
|
+
from bevor_sdk.types.requests import VersionIdentifierBody
|
|
7
7
|
|
|
8
8
|
from bevor_cli import output
|
|
9
9
|
from bevor_cli.client import BevorInternalClient
|
|
@@ -35,7 +35,7 @@ def fork_analysis(
|
|
|
35
35
|
creds=creds, workspace_id=workspace_id, project_id=state.validate_project()
|
|
36
36
|
)
|
|
37
37
|
|
|
38
|
-
body =
|
|
38
|
+
body = VersionIdentifierBody()
|
|
39
39
|
analysis_id, version_id = resolve_target(client, state, version)
|
|
40
40
|
if version_id:
|
|
41
41
|
body["version_id"] = version_id
|
|
@@ -4,8 +4,8 @@ import json
|
|
|
4
4
|
from typing import Optional
|
|
5
5
|
|
|
6
6
|
import typer
|
|
7
|
-
from bevor_sdk.types import
|
|
8
|
-
from bevor_sdk.types.
|
|
7
|
+
from bevor_sdk.types.requests import AnalysisListParams
|
|
8
|
+
from bevor_sdk.types.shared import ID
|
|
9
9
|
from rich.table import Table
|
|
10
10
|
|
|
11
11
|
from bevor_cli.annotations.confirmations import JSON_OUT
|
|
@@ -42,7 +42,7 @@ def list_analyses(
|
|
|
42
42
|
creds=creds, workspace_id=workspace_id, project_id=state.validate_project(priority=project)
|
|
43
43
|
)
|
|
44
44
|
|
|
45
|
-
query_params =
|
|
45
|
+
query_params = AnalysisListParams()
|
|
46
46
|
if page:
|
|
47
47
|
query_params["page"] = page
|
|
48
48
|
if page_size:
|
|
@@ -59,9 +59,7 @@ def list_analyses(
|
|
|
59
59
|
analyses = client.analyses.list(query_params)
|
|
60
60
|
|
|
61
61
|
if json_out:
|
|
62
|
-
print_json(
|
|
63
|
-
json.dumps([a.model_dump(mode="json") for a in analyses.results], indent=2)
|
|
64
|
-
)
|
|
62
|
+
print_json(json.dumps([a.model_dump(mode="json") for a in analyses.results], indent=2))
|
|
65
63
|
return
|
|
66
64
|
|
|
67
65
|
if not analyses.results:
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
from pathlib import Path
|
|
4
4
|
|
|
5
|
-
from bevor_sdk.types import
|
|
6
|
-
from bevor_sdk.types.
|
|
5
|
+
from bevor_sdk.types.requests import CallChainBody
|
|
6
|
+
from bevor_sdk.types.shared import ID
|
|
7
7
|
|
|
8
8
|
from bevor_cli import output
|
|
9
9
|
from bevor_cli.client import BevorInternalClient
|
|
@@ -51,7 +51,7 @@ def materialize_analysis() -> None:
|
|
|
51
51
|
|
|
52
52
|
source_text = node_resource.content(ID(entrypoint.node.id))
|
|
53
53
|
call_chain = node_resource.call_chain(
|
|
54
|
-
|
|
54
|
+
CallChainBody(node_ids=[ID(entrypoint.node.id)], response_type="text")
|
|
55
55
|
)
|
|
56
56
|
cc_text = str(call_chain) if call_chain else ""
|
|
57
57
|
path = out_root / f"{entrypoint.node.short_id}.raw.md"
|
|
@@ -61,6 +61,4 @@ def materialize_analysis() -> None:
|
|
|
61
61
|
)
|
|
62
62
|
written += 1
|
|
63
63
|
|
|
64
|
-
output.success(
|
|
65
|
-
f"Wrote {written} file(s) under {out_root.relative_to(Path.cwd())!s}/"
|
|
66
|
-
)
|
|
64
|
+
output.success(f"Wrote {written} file(s) under {out_root.relative_to(Path.cwd())!s}/")
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
from typing import Optional
|
|
4
4
|
|
|
5
5
|
import typer
|
|
6
|
-
from bevor_sdk.types import
|
|
7
|
-
from bevor_sdk.types.
|
|
6
|
+
from bevor_sdk.types.requests import AnalysisMergeBody
|
|
7
|
+
from bevor_sdk.types.shared import ID
|
|
8
8
|
|
|
9
9
|
from bevor_cli import output
|
|
10
10
|
from bevor_cli.client import BevorInternalClient
|
|
@@ -52,7 +52,7 @@ def merge_analysis(
|
|
|
52
52
|
to_ = client.analyses.get(to_analysis_id)
|
|
53
53
|
|
|
54
54
|
created = client.analyses.merge(
|
|
55
|
-
|
|
55
|
+
AnalysisMergeBody(to_version_id=to_.version.id, from_version_id=from_version_id)
|
|
56
56
|
)
|
|
57
57
|
|
|
58
58
|
state.set_analysis(created)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""``bevor analyses reset`` — discard every staged finding change on HEAD."""
|
|
2
2
|
|
|
3
3
|
import typer
|
|
4
|
-
from bevor_sdk.types.requests
|
|
4
|
+
from bevor_sdk.types.requests import VersionIdentifierParam
|
|
5
5
|
from rich.prompt import Confirm
|
|
6
6
|
|
|
7
7
|
from bevor_cli import output
|
|
@@ -24,7 +24,11 @@ def reset_analysis(yes: YES = False) -> None:
|
|
|
24
24
|
creds=creds, workspace_id=workspace_id, project_id=state.validate_project()
|
|
25
25
|
)
|
|
26
26
|
|
|
27
|
-
staged = [
|
|
27
|
+
staged = [
|
|
28
|
+
f
|
|
29
|
+
for f in client.analyses.list_findings(analysis_id, params=VersionIdentifierParam()).results
|
|
30
|
+
if f.operation is not None
|
|
31
|
+
]
|
|
28
32
|
if not staged:
|
|
29
33
|
output.info("Nothing staged.")
|
|
30
34
|
return
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
from typing import Optional
|
|
4
4
|
|
|
5
5
|
import typer
|
|
6
|
-
from bevor_sdk._sync.
|
|
7
|
-
from bevor_sdk.types.
|
|
8
|
-
from bevor_sdk.types.
|
|
6
|
+
from bevor_sdk._sync.streaming import EventResource
|
|
7
|
+
from bevor_sdk.types.events import AnalysisRunStatusEventData
|
|
8
|
+
from bevor_sdk.types.requests import VersionIdentifierBody
|
|
9
9
|
from rich.live import Live
|
|
10
10
|
|
|
11
11
|
from bevor_cli import output
|
|
@@ -39,7 +39,7 @@ def retry_analysis(
|
|
|
39
39
|
|
|
40
40
|
wait = not no_wait
|
|
41
41
|
|
|
42
|
-
opts:
|
|
42
|
+
opts: VersionIdentifierBody = {}
|
|
43
43
|
analysis_id, version_id = resolve_target(client, state, version)
|
|
44
44
|
if version_id:
|
|
45
45
|
opts["version_id"] = version_id
|
|
@@ -3,11 +3,14 @@
|
|
|
3
3
|
from typing import Mapping, Optional, Tuple
|
|
4
4
|
|
|
5
5
|
import typer
|
|
6
|
-
from bevor_sdk._sync.
|
|
7
|
-
from bevor_sdk.types import
|
|
8
|
-
from bevor_sdk.types.literals import
|
|
9
|
-
from bevor_sdk.types.requests
|
|
10
|
-
|
|
6
|
+
from bevor_sdk._sync.streaming import EventResource
|
|
7
|
+
from bevor_sdk.types.events import AnalysisRunStatusEventData
|
|
8
|
+
from bevor_sdk.types.literals import AnalysisEntrypointStatus
|
|
9
|
+
from bevor_sdk.types.requests import (
|
|
10
|
+
AnalysisRunStandardBody,
|
|
11
|
+
VersionIdentifierParam,
|
|
12
|
+
)
|
|
13
|
+
from bevor_sdk.types.shared import ID
|
|
11
14
|
from rich.live import Live
|
|
12
15
|
from rich.table import Table
|
|
13
16
|
|
|
@@ -19,7 +22,7 @@ from bevor_cli.configuration.state import State
|
|
|
19
22
|
from bevor_cli.target import resolve_target
|
|
20
23
|
|
|
21
24
|
|
|
22
|
-
def render_status(ep_map: Mapping[ID, Tuple[str, str,
|
|
25
|
+
def render_status(ep_map: Mapping[ID, Tuple[str, str, AnalysisEntrypointStatus]]) -> Table:
|
|
23
26
|
table = Table.grid(padding=(0, 1))
|
|
24
27
|
for k in sorted(ep_map.keys()):
|
|
25
28
|
short_id, name, status = ep_map[k]
|
|
@@ -38,18 +41,16 @@ def run_pipeline(*, version: str | None, all_entrypoints: bool, no_wait: bool, s
|
|
|
38
41
|
creds=creds, workspace_id=state.validate_workspace(), project_id=state.validate_project()
|
|
39
42
|
)
|
|
40
43
|
|
|
41
|
-
opts
|
|
44
|
+
opts = AnalysisRunStandardBody(mode="all" if all_entrypoints else "first_party")
|
|
42
45
|
analysis_id, version_id = resolve_target(client, state, version)
|
|
43
46
|
if version_id:
|
|
44
47
|
opts["version_id"] = version_id
|
|
45
|
-
if all_entrypoints:
|
|
46
|
-
opts["mode"] = "all"
|
|
47
48
|
|
|
48
49
|
run_result = client.analyses.run(analysis_id, opts, with_streaming=wait)
|
|
49
50
|
|
|
50
51
|
if wait and isinstance(run_result, EventResource):
|
|
51
52
|
ep_map = {}
|
|
52
|
-
ep_opts =
|
|
53
|
+
ep_opts = VersionIdentifierParam()
|
|
53
54
|
if version_id:
|
|
54
55
|
ep_opts["version_id"] = version_id
|
|
55
56
|
eps = client.analyses.entrypoints(analysis_id, ep_opts)
|
|
@@ -5,9 +5,9 @@ from typing import Optional
|
|
|
5
5
|
import questionary
|
|
6
6
|
import typer
|
|
7
7
|
from bevor_sdk.exceptions import NotFoundError
|
|
8
|
-
from bevor_sdk.types import
|
|
9
|
-
from bevor_sdk.types.
|
|
10
|
-
from bevor_sdk.types.
|
|
8
|
+
from bevor_sdk.types.requests import AnalysisListParams
|
|
9
|
+
from bevor_sdk.types.responses import Analysis
|
|
10
|
+
from bevor_sdk.types.shared import ID
|
|
11
11
|
|
|
12
12
|
from bevor_cli import output
|
|
13
13
|
from bevor_cli.client import BevorInternalClient
|
|
@@ -65,10 +65,12 @@ def select_analysis(
|
|
|
65
65
|
state.save()
|
|
66
66
|
return
|
|
67
67
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
query = AnalysisListParams()
|
|
69
|
+
if page is not None:
|
|
70
|
+
query["page"] = page
|
|
71
|
+
if page_size is not None:
|
|
72
|
+
query["page_size"] = page_size
|
|
73
|
+
analyses = client.analyses.list(query)
|
|
72
74
|
|
|
73
75
|
if not analyses.results:
|
|
74
76
|
output.error("No analyses found.", hint="Run `bevor analyses create` to create one.")
|
|
@@ -88,7 +90,7 @@ def select_analysis(
|
|
|
88
90
|
for a in analyses.results
|
|
89
91
|
] + [questionary.Choice(title="↵ Cancel", value=_CANCEL)]
|
|
90
92
|
|
|
91
|
-
analysis:
|
|
93
|
+
analysis: Analysis | None = _select("Select an analysis:", choices)
|
|
92
94
|
if analysis is None:
|
|
93
95
|
raise typer.Exit(0)
|
|
94
96
|
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
import re
|
|
4
4
|
|
|
5
5
|
import typer
|
|
6
|
-
from bevor_sdk.types import
|
|
7
|
-
from bevor_sdk.types.
|
|
6
|
+
from bevor_sdk.types.requests import AnalysisSetHeadBody
|
|
7
|
+
from bevor_sdk.types.shared import ID
|
|
8
8
|
|
|
9
9
|
from bevor_cli import output
|
|
10
10
|
from bevor_cli.client import BevorInternalClient
|
|
@@ -84,7 +84,7 @@ def set_analysis_head(
|
|
|
84
84
|
output.info(f"HEAD is already {target}.")
|
|
85
85
|
return
|
|
86
86
|
|
|
87
|
-
result = analysis_source.set_head(
|
|
87
|
+
result = analysis_source.set_head(AnalysisSetHeadBody(version_id=target))
|
|
88
88
|
state.set_analysis(result)
|
|
89
89
|
state.save()
|
|
90
90
|
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"""``bevor analyses transitions``."""
|
|
2
2
|
|
|
3
|
-
from typing import Optional
|
|
3
|
+
from typing import Annotated, Optional
|
|
4
4
|
|
|
5
5
|
import typer
|
|
6
|
-
from bevor_sdk.types import ID
|
|
7
6
|
from bevor_sdk.types.literals import FindingTransitionReason
|
|
8
|
-
from bevor_sdk.types.requests
|
|
7
|
+
from bevor_sdk.types.requests import TransitionListParams
|
|
9
8
|
from rich.table import Table
|
|
10
9
|
from rich.text import Text
|
|
11
10
|
|
|
12
11
|
from bevor_cli.annotations.confirmations import JSON_OUT
|
|
12
|
+
from bevor_cli.annotations.literal_args import literal_option
|
|
13
13
|
from bevor_cli.annotations.query import ORDER, ORDER_BY, PAGE, PAGE_SIZE
|
|
14
14
|
from bevor_cli.client import BevorInternalClient
|
|
15
15
|
from bevor_cli.commands.analyses.diff import _snapshot
|
|
@@ -24,9 +24,14 @@ def list_transitions(
|
|
|
24
24
|
page_size: PAGE_SIZE = None,
|
|
25
25
|
order: ORDER = None,
|
|
26
26
|
order_by: ORDER_BY = None,
|
|
27
|
-
reason:
|
|
28
|
-
None,
|
|
29
|
-
|
|
27
|
+
reason: Annotated[
|
|
28
|
+
FindingTransitionReason | None,
|
|
29
|
+
literal_option(
|
|
30
|
+
FindingTransitionReason,
|
|
31
|
+
"--reason",
|
|
32
|
+
help="Only show transitions with this reason (e.g. remediated).",
|
|
33
|
+
),
|
|
34
|
+
] = None,
|
|
30
35
|
version: Optional[str] = typer.Option(
|
|
31
36
|
None,
|
|
32
37
|
"--version",
|
|
@@ -50,21 +55,24 @@ def list_transitions(
|
|
|
50
55
|
creds=creds, workspace_id=workspace_id, project_id=state.validate_project()
|
|
51
56
|
)
|
|
52
57
|
|
|
53
|
-
query_params =
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
query_params = TransitionListParams()
|
|
59
|
+
if page is not None:
|
|
60
|
+
query_params["page"] = page
|
|
61
|
+
if page_size is not None:
|
|
62
|
+
query_params["page_size"] = page_size
|
|
63
|
+
if order is not None:
|
|
64
|
+
query_params["order"] = order
|
|
65
|
+
if order_by is not None:
|
|
66
|
+
query_params["order_by"] = order_by
|
|
67
|
+
if reason is not None:
|
|
68
|
+
query_params["reason"] = reason
|
|
61
69
|
if version:
|
|
62
|
-
query_params["after_version_id"] =
|
|
70
|
+
query_params["after_version_id"] = version
|
|
63
71
|
elif not project_wide:
|
|
64
72
|
analysis = client.analyses.get(state.validate_analysis())
|
|
65
73
|
query_params["after_version_id"] = analysis.version.id
|
|
66
74
|
|
|
67
|
-
result = client.transitions.list(
|
|
75
|
+
result = client.transitions.list(params=query_params)
|
|
68
76
|
|
|
69
77
|
if json_out:
|
|
70
78
|
print_json(result.model_dump_json(indent=2))
|
|
@@ -132,6 +132,6 @@ def login() -> None:
|
|
|
132
132
|
output.info(f"CREDS {creds.model_dump_json()}")
|
|
133
133
|
|
|
134
134
|
client = BevorInternalBusinessClient(creds=creds)
|
|
135
|
-
user = client.me()
|
|
135
|
+
user = client.get("/v1/me").json()
|
|
136
136
|
|
|
137
|
-
output.success(f"Logged in as {user
|
|
137
|
+
output.success(f"Logged in as {user['email'] or user['username']}")
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"""``bevor whoami``."""
|
|
2
2
|
|
|
3
|
+
import json
|
|
4
|
+
|
|
3
5
|
from bevor_cli import output
|
|
4
6
|
from bevor_cli.annotations.confirmations import JSON_OUT
|
|
5
7
|
from bevor_cli.client import BevorInternalBusinessClient
|
|
@@ -14,9 +16,9 @@ def whoami(json_out: JSON_OUT = False) -> None:
|
|
|
14
16
|
|
|
15
17
|
client = BevorInternalBusinessClient(creds=creds)
|
|
16
18
|
|
|
17
|
-
user = client.me()
|
|
19
|
+
user = client.get("/v1/me").json()
|
|
18
20
|
|
|
19
21
|
if json_out:
|
|
20
|
-
print_json(
|
|
22
|
+
print_json(json.dumps(user, indent=2))
|
|
21
23
|
else:
|
|
22
|
-
output.console.print(user
|
|
24
|
+
output.console.print(user["email"] or user["username"])
|