bevor-cli 0.1.2__tar.gz → 0.2.0rc1__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 (122) hide show
  1. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/PKG-INFO +2 -2
  2. bevor_cli-0.2.0rc1/bevor_cli/actions.py +25 -0
  3. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/apps/analyses.py +33 -19
  4. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/apps/codes.py +1 -1
  5. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/apps/findings.py +15 -4
  6. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/apps/main.py +11 -5
  7. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/client.py +2 -2
  8. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/analyses/chats/get.py +2 -2
  9. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/analyses/chats/list.py +12 -12
  10. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/analyses/chats/messages.py +2 -2
  11. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/analyses/chats/resume.py +1 -1
  12. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/analyses/commit.py +6 -12
  13. bevor_cli-0.2.0rc1/bevor_cli/commands/analyses/create.py +154 -0
  14. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/analyses/delete.py +5 -16
  15. bevor_cli-0.2.0rc1/bevor_cli/commands/analyses/deselect.py +17 -0
  16. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/analyses/diff.py +15 -15
  17. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/analyses/entrypoints.py +9 -13
  18. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/analyses/fork.py +12 -11
  19. bevor_cli-0.2.0rc1/bevor_cli/commands/analyses/lineage.py +104 -0
  20. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/analyses/list.py +19 -12
  21. bevor_cli-0.1.2/bevor_cli/commands/agent/materialze_cmd.py → bevor_cli-0.2.0rc1/bevor_cli/commands/analyses/materialize.py +9 -8
  22. bevor_cli-0.2.0rc1/bevor_cli/commands/analyses/merge.py +61 -0
  23. bevor_cli-0.2.0rc1/bevor_cli/commands/analyses/reset.py +38 -0
  24. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/analyses/retry.py +6 -10
  25. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/analyses/run.py +31 -19
  26. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/analyses/select.py +21 -5
  27. bevor_cli-0.2.0rc1/bevor_cli/commands/analyses/set_head.py +91 -0
  28. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/analyses/transitions.py +8 -9
  29. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/analyses/view.py +27 -25
  30. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/auth/whoami.py +2 -1
  31. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/codes/list.py +5 -7
  32. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/codes/push.py +28 -10
  33. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/codes/select.py +3 -5
  34. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/codes/view.py +5 -7
  35. bevor_cli-0.2.0rc1/bevor_cli/commands/findings/acknowledge.py +43 -0
  36. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/findings/add.py +8 -16
  37. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/findings/delete.py +2 -2
  38. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/findings/edit.py +8 -4
  39. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/findings/get.py +2 -2
  40. bevor_cli-0.1.2/bevor_cli/commands/findings/bulk.py → bevor_cli-0.2.0rc1/bevor_cli/commands/findings/import_findings.py +10 -19
  41. bevor_cli-0.2.0rc1/bevor_cli/commands/findings/list.py +297 -0
  42. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/findings/revert.py +2 -2
  43. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/graph/call_chain.py +4 -4
  44. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/graph/edges.py +8 -8
  45. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/graph/interactive.py +2 -2
  46. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/link/__init__.py +2 -1
  47. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/nodes/get.py +2 -2
  48. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/nodes/list.py +4 -4
  49. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/nodes/source.py +2 -2
  50. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/projects/list.py +3 -3
  51. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/projects/select.py +1 -1
  52. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/projects/view.py +2 -2
  53. bevor_cli-0.2.0rc1/bevor_cli/commands/reflog/__init__.py +54 -0
  54. bevor_cli-0.2.0rc1/bevor_cli/commands/status/__init__.py +154 -0
  55. bevor_cli-0.2.0rc1/bevor_cli/commands/sync/__init__.py +56 -0
  56. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/workspaces/list.py +2 -2
  57. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/workspaces/view.py +2 -2
  58. bevor_cli-0.2.0rc1/bevor_cli/configuration/logs.py +61 -0
  59. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/configuration/state.py +31 -1
  60. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/findings_yaml.py +1 -1
  61. bevor_cli-0.2.0rc1/bevor_cli/fingerprint.py +24 -0
  62. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/main.py +3 -10
  63. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/output.py +16 -1
  64. bevor_cli-0.2.0rc1/bevor_cli/target.py +15 -0
  65. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/pyproject.toml +2 -2
  66. bevor_cli-0.1.2/bevor_cli/apps/agent.py +0 -10
  67. bevor_cli-0.1.2/bevor_cli/commands/agent/setup_cmd.py +0 -18
  68. bevor_cli-0.1.2/bevor_cli/commands/analyses/active.py +0 -42
  69. bevor_cli-0.1.2/bevor_cli/commands/analyses/child.py +0 -81
  70. bevor_cli-0.1.2/bevor_cli/commands/analyses/create.py +0 -106
  71. bevor_cli-0.1.2/bevor_cli/commands/analyses/findings.py +0 -129
  72. bevor_cli-0.1.2/bevor_cli/commands/analyses/merge.py +0 -46
  73. bevor_cli-0.1.2/bevor_cli/commands/analyses/set_head.py +0 -45
  74. bevor_cli-0.1.2/bevor_cli/commands/context/__init__.py +0 -92
  75. bevor_cli-0.1.2/bevor_cli/commands/findings/acknowledge.py +0 -28
  76. bevor_cli-0.1.2/bevor_cli/commands/findings/list.py +0 -108
  77. bevor_cli-0.1.2/bevor_cli/configuration/__init__.py +0 -0
  78. bevor_cli-0.1.2/bevor_cli/configuration/settings.py +0 -54
  79. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/.gitignore +0 -0
  80. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/README.md +0 -0
  81. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/__init__.py +0 -0
  82. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/annotations/__init__.py +0 -0
  83. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/annotations/confirmations.py +0 -0
  84. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/annotations/query.py +0 -0
  85. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/apps/chat.py +0 -0
  86. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/apps/nodes.py +0 -0
  87. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/apps/projects.py +0 -0
  88. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/apps/sessions.py +0 -0
  89. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/apps/workspaces.py +0 -0
  90. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/callbacks/__init__.py +0 -0
  91. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/callbacks/notify.py +0 -0
  92. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/callbacks/upgrade.py +0 -0
  93. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/callbacks/version.py +0 -0
  94. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/__init__.py +0 -0
  95. {bevor_cli-0.1.2/bevor_cli/commands/agent → bevor_cli-0.2.0rc1/bevor_cli/commands/analyses}/__init__.py +0 -0
  96. {bevor_cli-0.1.2/bevor_cli/commands/analyses → bevor_cli-0.2.0rc1/bevor_cli/commands/analyses/chats}/__init__.py +0 -0
  97. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/analyses/chats/new.py +0 -0
  98. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/analyses/chats/session.py +0 -0
  99. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/auth/__init__.py +0 -0
  100. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/auth/login.py +0 -0
  101. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/auth/logout.py +0 -0
  102. {bevor_cli-0.1.2/bevor_cli/commands/analyses/chats → bevor_cli-0.2.0rc1/bevor_cli/commands/codes}/__init__.py +0 -0
  103. {bevor_cli-0.1.2/bevor_cli/commands/codes → bevor_cli-0.2.0rc1/bevor_cli/commands/findings}/__init__.py +0 -0
  104. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/findings/interactive.py +0 -0
  105. {bevor_cli-0.1.2/bevor_cli/commands/findings → bevor_cli-0.2.0rc1/bevor_cli/commands/graph}/__init__.py +0 -0
  106. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/graph/renderer.py +0 -0
  107. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/link/helpers.py +0 -0
  108. {bevor_cli-0.1.2/bevor_cli/commands/graph → bevor_cli-0.2.0rc1/bevor_cli/commands/nodes}/__init__.py +0 -0
  109. {bevor_cli-0.1.2/bevor_cli/commands/nodes → bevor_cli-0.2.0rc1/bevor_cli/commands/projects}/__init__.py +0 -0
  110. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/projects/create.py +0 -0
  111. {bevor_cli-0.1.2/bevor_cli/commands/projects → bevor_cli-0.2.0rc1/bevor_cli/commands/sessions}/__init__.py +0 -0
  112. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/sessions/list.py +0 -0
  113. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/sessions/revoke.py +0 -0
  114. {bevor_cli-0.1.2/bevor_cli/commands/sessions → bevor_cli-0.2.0rc1/bevor_cli/commands/workspaces}/__init__.py +0 -0
  115. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/workspaces/pick.py +0 -0
  116. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/commands/workspaces/select.py +0 -0
  117. {bevor_cli-0.1.2/bevor_cli/commands/workspaces → bevor_cli-0.2.0rc1/bevor_cli/configuration}/__init__.py +0 -0
  118. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/configuration/creds.py +0 -0
  119. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/configuration/update.py +0 -0
  120. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/select.py +0 -0
  121. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/bevor_cli/settings.py +0 -0
  122. {bevor_cli-0.1.2 → bevor_cli-0.2.0rc1}/cli-hierarchy.py +0 -0
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: bevor-cli
3
- Version: 0.1.2
3
+ Version: 0.2.0rc1
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.2
7
+ Requires-Dist: bevor-sdk==0.2.0rc1
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 delete_analysis_full, delete_analysis_version
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(help="Manage analyses.", no_args_is_help=True)
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("recent")(active_analysis)
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("run")(run_analysis)
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("child")(create_child_analysis)
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="List, inspect, and upload code versions for the active project.",
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 acknowledge_finding
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(help="Findings for the configured analysis.", no_args_is_help=True)
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("bulk")(bulk_findings)
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 _current_version, _latest_version, _version_callback
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("context")(run_context)
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"]
@@ -7,7 +7,7 @@ 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
10
+ from bevor_sdk.exceptions import ERROR_REGISTRY, BevorErrorTypes
11
11
  from bevor_sdk.types.requests.manage import CreateProjectBodyDict
12
12
  from bevor_sdk.types.responses import ResultsResponse
13
13
  from bevor_sdk.types.responses.manage import (
@@ -104,7 +104,7 @@ class BevorInternalBusinessClient(httpx.Client):
104
104
  # couldn't parse, so raise.
105
105
  response.raise_for_status()
106
106
 
107
- exc_cls = ERROR_REGISTRY.get(cast(AppErrorTypes, code))
107
+ exc_cls = ERROR_REGISTRY.get(cast(BevorErrorTypes, code))
108
108
  if exc_cls is None:
109
109
  response.raise_for_status()
110
110
  return False # just for typing...
@@ -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 console
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
- console.print_json(chat.model_dump_json(indent=2))
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 analysis chats list``."""
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[Optional[str], typer.Option("--project", help="project to list chats for")],
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. Uses the currently configured project, or --project"""
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 or settings.default_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
- console.print_json(found.model_dump_json(indent=2))
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
- console.print_json(
33
+ print_json(
34
34
  json.dumps([m.model_dump(mode="json") for m in messages.results], indent=2)
35
35
  )
36
36
  return
@@ -30,7 +30,7 @@ def chat_resume(
30
30
 
31
31
  if not state.analysis_id:
32
32
  output.error(
33
- "No analysis is configured.",
33
+ "No analysis is selected.",
34
34
  hint="Run `bevor analyses select` or `bevor analyses create`.",
35
35
  )
36
36
  raise typer.Exit(1)
@@ -1,45 +1,39 @@
1
- """``bevor analysis commit`` — commit staged finding changes."""
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="Version id to commit (default: configured analysis head).",
19
+ help="Use this version instead of HEAD.",
20
20
  ),
21
21
  ) -> None:
22
- """Commit staged findings for an analysis. This will update the HEAD of the configured analysis, or of the
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
- if version:
37
- v_ = client.analysis_versions.get(ID(version))
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,154 @@
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
+ def print_collision(collision: AnalysisCollisionResult) -> None:
102
+ output.warning("This exact code already has a version in this project; nothing was created.")
103
+ for candidate in collision.candidates:
104
+ meta = candidate.analysis_meta
105
+ owner = "yours" if candidate.on_collision == "view" else meta.user.username
106
+ head = " (HEAD)" if candidate.is_head else ""
107
+ view = (
108
+ f"bevor analyses view {meta.id}"
109
+ if candidate.is_head
110
+ else f"bevor analyses view --version {candidate.id}"
111
+ )
112
+
113
+ console.print(
114
+ f"\n [bold]{meta.name}[/bold] ({owner}, {candidate.created_at.date()})"
115
+ f"\n analysis {meta.id} version {candidate.id}{head}"
116
+ )
117
+ console.print(f" view: {view}")
118
+ if candidate.on_collision == "fork":
119
+ console.print(f" fork: bevor analyses fork --version {candidate.id}")
120
+ elif candidate.on_collision == "merge":
121
+ console.print(f" merge: bevor analyses merge --from-version {candidate.id}")
122
+ else:
123
+ console.print(f" select: bevor analyses select {meta.id}")
124
+ console.print("\nTo create a new one anyway, pass --collision force.")
125
+
126
+
127
+ def create_analysis(
128
+ new: bool = typer.Option(False, "--new", help="Start a new analysis even if one is selected."),
129
+ name: Optional[str] = typer.Option(None, "--name", help="Name for a new analysis."),
130
+ version: Optional[str] = typer.Option(
131
+ None, "--version", help="Add the new version on top of this version instead of HEAD."
132
+ ),
133
+ collision: Collision = typer.Option(
134
+ "surface",
135
+ "--collision",
136
+ help="What to do if this code already has a version: surface the candidates (default), force, or merge.",
137
+ ),
138
+ yes: YES = False,
139
+ json_out: JSON_OUT = False,
140
+ force: FORCE = False,
141
+ ) -> None:
142
+ """Create a version for the pushed code.
143
+
144
+ With an analysis selected, adds it as a new version on HEAD and moves HEAD to it. With none
145
+ selected (or ``--new``), starts a new analysis and selects it. Nothing is run; use
146
+ `bevor analyses run` for that. The working directory must match the last push; `bevor sync`
147
+ pushes and does this in one step.
148
+ """
149
+ if not force:
150
+ require_code_in_sync(State.load())
151
+
152
+ create_from_pushed_code(
153
+ new=new, name=name, version=version, collision=collision, json_out=json_out, yes=yes
154
+ )
@@ -1,6 +1,4 @@
1
- """``bevor analysis delete {full|branch|version}``."""
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 entire currently configured analysis container"""
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: Optional[str] = typer.Argument(
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 analysis version (leaf)."""
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
- if not version:
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}.")