bevor-cli 0.1.3__tar.gz → 0.2.0__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.
Files changed (112) hide show
  1. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/.gitignore +4 -2
  2. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/PKG-INFO +3 -3
  3. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/actions.py +3 -7
  4. bevor_cli-0.2.0/bevor_cli/annotations/literal_args.py +12 -0
  5. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/apps/analyses.py +0 -8
  6. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/apps/findings.py +2 -2
  7. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/client.py +11 -30
  8. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/analyses/chats/get.py +1 -1
  9. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/analyses/chats/list.py +11 -8
  10. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/analyses/chats/messages.py +2 -4
  11. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/analyses/chats/session.py +2 -2
  12. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/analyses/create.py +11 -17
  13. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/analyses/delete.py +1 -1
  14. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/analyses/entrypoints.py +5 -3
  15. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/analyses/fork.py +2 -2
  16. bevor_cli-0.2.0/bevor_cli/commands/analyses/lineage.py +53 -0
  17. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/analyses/list.py +5 -7
  18. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/analyses/materialize.py +4 -6
  19. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/analyses/merge.py +3 -3
  20. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/analyses/run.py +11 -10
  21. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/analyses/select.py +11 -10
  22. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/analyses/set_head.py +3 -3
  23. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/analyses/transitions.py +34 -20
  24. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/analyses/view.py +2 -9
  25. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/auth/login.py +2 -2
  26. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/auth/whoami.py +5 -3
  27. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/codes/list.py +24 -20
  28. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/codes/push.py +2 -2
  29. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/codes/select.py +12 -7
  30. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/codes/view.py +3 -3
  31. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/findings/acknowledge.py +1 -1
  32. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/findings/add.py +52 -34
  33. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/findings/delete.py +1 -1
  34. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/findings/edit.py +4 -4
  35. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/findings/get.py +1 -1
  36. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/findings/import_findings.py +4 -5
  37. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/findings/interactive.py +23 -23
  38. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/findings/list.py +74 -46
  39. bevor_cli-0.1.3/bevor_cli/commands/findings/revert.py → bevor_cli-0.2.0/bevor_cli/commands/findings/undo.py +5 -5
  40. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/graph/call_chain.py +4 -4
  41. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/graph/edges.py +22 -16
  42. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/graph/interactive.py +13 -6
  43. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/graph/renderer.py +15 -31
  44. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/link/__init__.py +10 -8
  45. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/link/helpers.py +3 -3
  46. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/nodes/get.py +2 -2
  47. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/nodes/list.py +13 -13
  48. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/nodes/source.py +1 -1
  49. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/projects/create.py +18 -10
  50. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/projects/list.py +3 -1
  51. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/projects/select.py +4 -3
  52. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/status/__init__.py +12 -23
  53. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/sync/__init__.py +6 -7
  54. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/workspaces/list.py +13 -10
  55. bevor_cli-0.2.0/bevor_cli/commands/workspaces/pick.py +19 -0
  56. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/workspaces/select.py +11 -9
  57. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/workspaces/view.py +11 -10
  58. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/configuration/state.py +4 -5
  59. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/findings_yaml.py +43 -31
  60. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/main.py +2 -2
  61. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/output.py +19 -10
  62. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/target.py +1 -1
  63. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/pyproject.toml +3 -3
  64. bevor_cli-0.1.3/bevor_cli/commands/analyses/commit.py +0 -43
  65. bevor_cli-0.1.3/bevor_cli/commands/analyses/diff.py +0 -87
  66. bevor_cli-0.1.3/bevor_cli/commands/analyses/lineage.py +0 -104
  67. bevor_cli-0.1.3/bevor_cli/commands/analyses/reset.py +0 -38
  68. bevor_cli-0.1.3/bevor_cli/commands/analyses/retry.py +0 -77
  69. bevor_cli-0.1.3/bevor_cli/commands/workspaces/pick.py +0 -20
  70. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/README.md +0 -0
  71. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/__init__.py +0 -0
  72. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/annotations/__init__.py +0 -0
  73. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/annotations/confirmations.py +0 -0
  74. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/annotations/query.py +0 -0
  75. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/apps/chat.py +0 -0
  76. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/apps/codes.py +0 -0
  77. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/apps/main.py +0 -0
  78. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/apps/nodes.py +0 -0
  79. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/apps/projects.py +0 -0
  80. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/apps/sessions.py +0 -0
  81. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/apps/workspaces.py +0 -0
  82. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/callbacks/__init__.py +0 -0
  83. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/callbacks/notify.py +0 -0
  84. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/callbacks/upgrade.py +0 -0
  85. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/callbacks/version.py +0 -0
  86. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/__init__.py +0 -0
  87. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/analyses/__init__.py +0 -0
  88. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/analyses/chats/__init__.py +0 -0
  89. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/analyses/chats/new.py +0 -0
  90. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/analyses/chats/resume.py +0 -0
  91. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/analyses/deselect.py +0 -0
  92. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/auth/__init__.py +0 -0
  93. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/auth/logout.py +0 -0
  94. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/codes/__init__.py +0 -0
  95. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/findings/__init__.py +0 -0
  96. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/graph/__init__.py +0 -0
  97. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/nodes/__init__.py +0 -0
  98. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/projects/__init__.py +0 -0
  99. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/projects/view.py +0 -0
  100. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/reflog/__init__.py +0 -0
  101. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/sessions/__init__.py +0 -0
  102. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/sessions/list.py +0 -0
  103. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/sessions/revoke.py +0 -0
  104. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/commands/workspaces/__init__.py +0 -0
  105. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/configuration/__init__.py +0 -0
  106. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/configuration/creds.py +0 -0
  107. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/configuration/logs.py +0 -0
  108. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/configuration/update.py +0 -0
  109. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/fingerprint.py +0 -0
  110. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/select.py +0 -0
  111. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/bevor_cli/settings.py +0 -0
  112. {bevor_cli-0.1.3 → bevor_cli-0.2.0}/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/integration/fixtures/real_repos/*
58
- !tests/integration/fixtures/real_repos/config.py
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.1.3
3
+ Version: 0.2.0
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.3
7
+ Requires-Dist: bevor-sdk==0.2.0
8
8
  Requires-Dist: click~=8.1
9
9
  Requires-Dist: httpx~=0.28
10
10
  Requires-Dist: packaging~=26.2
@@ -12,7 +12,7 @@ Requires-Dist: pydantic~=2.12
12
12
  Requires-Dist: pyyaml~=6.0
13
13
  Requires-Dist: questionary~=2.0
14
14
  Requires-Dist: rich~=15.0
15
- Requires-Dist: typer~=0.26
15
+ Requires-Dist: typer<0.29,>=0.26
16
16
  Description-Content-Type: text/markdown
17
17
 
18
18
  # Bevor CLI
@@ -1,5 +1,4 @@
1
- from bevor_sdk.types.responses import ActionDetails
2
- from bevor_sdk.types.responses.security import AnalysisActions
1
+ from bevor_sdk.types.responses import ActionDetails, AnalysisActions
3
2
 
4
3
  from bevor_cli.output import console
5
4
 
@@ -7,11 +6,8 @@ from bevor_cli.output import console
7
6
  def action_commands(actions: AnalysisActions) -> list[tuple[str, ActionDetails]]:
8
7
  return [
9
8
  ("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),
9
+ ("alter findings", actions.alter_findings),
10
+ ("run", actions.run_pipeline),
15
11
  ("fork", actions.fork),
16
12
  ("merge (into this)", actions.merge_to),
17
13
  ("merge (from this)", actions.merge_from),
@@ -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
+ )
@@ -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.revert import revert_finding
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("revert")(revert_finding)
29
+ app.command("undo")(undo_change)
30
30
  app.command("acknowledge")(acknowledge_finding)
31
31
  app.command("unacknowledge")(unacknowledge_finding)
32
32
 
@@ -7,17 +7,11 @@ from typing import Any, Dict, cast
7
7
  import httpx
8
8
  import typer
9
9
  from bevor_sdk import BevorClient
10
- from bevor_sdk.exceptions import ERROR_REGISTRY, AppErrorTypes
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
- )
10
+ from bevor_sdk.exceptions import ERROR_REGISTRY, BevorErrorTypes
18
11
  from httpx._types import QueryParamTypes, TimeoutTypes
19
12
 
20
13
  from bevor_cli import output
14
+ from bevor_cli.callbacks.version import _current_version
21
15
  from bevor_cli.configuration.creds import Credentials
22
16
  from bevor_cli.settings import API_URL
23
17
 
@@ -45,7 +39,12 @@ class BevorInternalClient(BevorClient):
45
39
  headers.update({"bevor-workspace-id": workspace_id})
46
40
  if project_id:
47
41
  headers.update({"bevor-project-id": project_id})
48
- super().__init__(api_key=creds.token, base_url=API_URL, default_headers=headers)
42
+ super().__init__(
43
+ api_key=creds.token,
44
+ base_url=API_URL,
45
+ default_headers=headers,
46
+ app=f"bevor-cli/{_current_version()}",
47
+ )
49
48
 
50
49
 
51
50
  class BevorInternalBusinessClient(httpx.Client):
@@ -58,6 +57,8 @@ class BevorInternalBusinessClient(httpx.Client):
58
57
  ) -> None:
59
58
  super().__init__(base_url=API_URL, timeout=timeout or self._TIMEOUT)
60
59
 
60
+ self.headers.update({"User-Agent": f"bevor-cli/{_current_version()}"})
61
+
61
62
  if creds.token:
62
63
  self.headers.update({"Authorization": f"Bearer {creds.token}"})
63
64
  if workspace_id:
@@ -104,7 +105,7 @@ class BevorInternalBusinessClient(httpx.Client):
104
105
  # couldn't parse, so raise.
105
106
  response.raise_for_status()
106
107
 
107
- exc_cls = ERROR_REGISTRY.get(cast(AppErrorTypes, code))
108
+ exc_cls = ERROR_REGISTRY.get(cast(BevorErrorTypes, code))
108
109
  if exc_cls is None:
109
110
  response.raise_for_status()
110
111
  return False # just for typing...
@@ -135,23 +136,3 @@ class BevorInternalBusinessClient(httpx.Client):
135
136
  response = super().send(request, **kwargs)
136
137
  self._handle_http_error(response)
137
138
  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)
@@ -1,7 +1,7 @@
1
1
  """``bevor analyses chats get``."""
2
2
 
3
3
  import typer
4
- from bevor_sdk.types import ID
4
+ from bevor_sdk.types.shared import ID
5
5
  from rich.table import Table
6
6
 
7
7
  from bevor_cli.annotations.confirmations import JSON_OUT
@@ -3,7 +3,7 @@
3
3
  from typing import Annotated, Optional
4
4
 
5
5
  import typer
6
- from bevor_sdk.types.requests.chat import ChatsQueryParams
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 = ChatsQueryParams(
38
- page=page,
39
- page_size=page_size,
40
- order=order,
41
- order_by=order_by,
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(options=query_params)
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.chat.chats import BoundChatResources
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,13 +3,8 @@
3
3
  from typing import Literal, Optional
4
4
 
5
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
- )
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
- created = client.analyses.create_root(
67
- CreateAnalysisRootBodyDict(code_id=ID(code_id), name=name, on_collision=collision)
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
- body = CreateAnalysisChildBodyDict(code_id=code_id, on_collision=collision)
67
+ data = AnalysisCreateChildBody(code_id=code_id, on_collision=collision)
72
68
  if version_id:
73
- body["version_id"] = version_id
74
- created = client.analyses.create_child(analysis_id, body)
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)
@@ -98,7 +94,6 @@ def create_from_pushed_code(
98
94
  print_collision(created)
99
95
 
100
96
 
101
-
102
97
  def print_collision(collision: AnalysisCollisionResult) -> None:
103
98
  output.warning("This exact code already has a version in this project; nothing was created.")
104
99
  for candidate in collision.candidates:
@@ -124,10 +119,9 @@ def print_collision(collision: AnalysisCollisionResult) -> None:
124
119
  console.print(f" select: bevor analyses select {meta.id}")
125
120
  console.print("\nTo create a new one anyway, pass --collision force.")
126
121
 
122
+
127
123
  def create_analysis(
128
- new: bool = typer.Option(
129
- False, "--new", help="Start a new analysis even if one is selected."
130
- ),
124
+ new: bool = typer.Option(False, "--new", help="Start a new analysis even if one is selected."),
131
125
  name: Optional[str] = typer.Option(None, "--name", help="Name for a new analysis."),
132
126
  version: Optional[str] = typer.Option(
133
127
  None, "--version", help="Add the new version on top of this version instead of HEAD."
@@ -1,7 +1,7 @@
1
1
  """``bevor analyses delete {full|version}``."""
2
2
 
3
3
  import typer
4
- from bevor_sdk.types import ID
4
+ from bevor_sdk.types.shared import ID
5
5
 
6
6
  from bevor_cli import output
7
7
  from bevor_cli.client import BevorInternalClient
@@ -4,7 +4,7 @@ import json
4
4
  from typing import Optional
5
5
 
6
6
  import typer
7
- from bevor_sdk.types.requests.security import VersionQueryParams
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 = VersionQueryParams()
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
@@ -49,4 +49,6 @@ def list_entrypoints(
49
49
  return
50
50
 
51
51
  for s in page.results:
52
- console.print(f"{s.node.short_id} {s.node.name} ({s.node.path}) [{s.pipeline_status}]")
52
+ console.print(
53
+ f"{s.node.short_id} {s.node.name} ({s.node.file_path}) [{s.pipeline_status}]"
54
+ )
@@ -3,7 +3,7 @@
3
3
  from typing import Optional
4
4
 
5
5
  import typer
6
- from bevor_sdk.types.requests.security import VersionBodyDict
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 = VersionBodyDict()
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
@@ -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}")
@@ -4,8 +4,8 @@ import json
4
4
  from typing import Optional
5
5
 
6
6
  import typer
7
- from bevor_sdk.types import ID
8
- from bevor_sdk.types.requests.security import AnalysesQueryParams
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 = AnalysesQueryParams()
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:
@@ -75,7 +73,7 @@ def list_analyses(
75
73
  a.id,
76
74
  a.name,
77
75
  head.code_version.id,
78
- f"{head.n_findings}{findings_detail(head.n_staged, head.n_remediations)}",
76
+ f"{findings_detail(head.n_findings, head.n_remediations)}",
79
77
  a.user.username,
80
78
  str(a.created_at.date()),
81
79
  ]
@@ -2,8 +2,8 @@
2
2
 
3
3
  from pathlib import Path
4
4
 
5
- from bevor_sdk.types import ID
6
- from bevor_sdk.types.requests.graph import CallChainBodyDict
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
- CallChainBodyDict(node_ids=[ID(entrypoint.node.id)], response_type="text")
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 ID
7
- from bevor_sdk.types.requests.security import MergeAnalysisBodyDict
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
- MergeAnalysisBodyDict(to_version_id=to_.version.id, from_version_id=from_version_id)
55
+ AnalysisMergeBody(to_version_id=to_.version.id, from_version_id=from_version_id)
56
56
  )
57
57
 
58
58
  state.set_analysis(created)
@@ -3,11 +3,14 @@
3
3
  from typing import Mapping, Optional, Tuple
4
4
 
5
5
  import typer
6
- from bevor_sdk._sync.resources._modules import EventResource
7
- from bevor_sdk.types import ID
8
- from bevor_sdk.types.literals import AnalysisRunStatus
9
- from bevor_sdk.types.requests.security import RunAnalysisBodyDict, VersionQueryParams
10
- from bevor_sdk.types.responses.events import AnalysisRunStatusEventData
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, AnalysisRunStatus]]) -> Table:
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: RunAnalysisBodyDict = {}
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 = VersionQueryParams()
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 ID
9
- from bevor_sdk.types.requests.security import AnalysesQueryParams
10
- from bevor_sdk.types.responses.security import AnalysisSchema
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
- analyses = client.analyses.list(
70
- AnalysesQueryParams(page_size=page_size, page=page)
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.")
@@ -78,8 +80,7 @@ def select_analysis(
78
80
  questionary.Choice(
79
81
  title=(
80
82
  f"{a.name} · {a.version.code_version.id} "
81
- f"{a.version.n_findings} findings"
82
- f"{findings_detail(a.version.n_staged, a.version.n_remediations)} "
83
+ f"{findings_detail(a.version.n_findings, a.version.n_remediations)} "
83
84
  f"{a.user.username} "
84
85
  f"{a.id} {a.created_at.date()}"
85
86
  ),
@@ -88,7 +89,7 @@ def select_analysis(
88
89
  for a in analyses.results
89
90
  ] + [questionary.Choice(title="↵ Cancel", value=_CANCEL)]
90
91
 
91
- analysis: AnalysisSchema | None = _select("Select an analysis:", choices)
92
+ analysis: Analysis | None = _select("Select an analysis:", choices)
92
93
  if analysis is None:
93
94
  raise typer.Exit(0)
94
95
 
@@ -3,8 +3,8 @@
3
3
  import re
4
4
 
5
5
  import typer
6
- from bevor_sdk.types import ID
7
- from bevor_sdk.types.requests.security import SetHeadBodyDict
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(SetHeadBodyDict(version_id=ID(target)))
87
+ result = analysis_source.set_head(AnalysisSetHeadBody(version_id=target))
88
88
  state.set_analysis(result)
89
89
  state.save()
90
90