bevor-cli 0.1.2__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 (125) hide show
  1. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/.gitignore +4 -2
  2. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/PKG-INFO +3 -3
  3. bevor_cli-0.2.0/bevor_cli/actions.py +21 -0
  4. bevor_cli-0.2.0/bevor_cli/annotations/literal_args.py +12 -0
  5. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/apps/analyses.py +29 -23
  6. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/apps/codes.py +1 -1
  7. bevor_cli-0.2.0/bevor_cli/apps/findings.py +33 -0
  8. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/apps/main.py +11 -5
  9. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/client.py +11 -30
  10. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/commands/analyses/chats/get.py +3 -3
  11. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/commands/analyses/chats/list.py +22 -19
  12. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/commands/analyses/chats/messages.py +3 -5
  13. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/commands/analyses/chats/resume.py +1 -1
  14. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/commands/analyses/chats/session.py +2 -2
  15. bevor_cli-0.2.0/bevor_cli/commands/analyses/create.py +150 -0
  16. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/commands/analyses/delete.py +6 -17
  17. bevor_cli-0.2.0/bevor_cli/commands/analyses/deselect.py +17 -0
  18. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/commands/analyses/entrypoints.py +14 -16
  19. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/commands/analyses/fork.py +14 -13
  20. bevor_cli-0.2.0/bevor_cli/commands/analyses/lineage.py +53 -0
  21. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/commands/analyses/list.py +21 -16
  22. bevor_cli-0.1.2/bevor_cli/commands/agent/materialze_cmd.py → bevor_cli-0.2.0/bevor_cli/commands/analyses/materialize.py +12 -13
  23. bevor_cli-0.2.0/bevor_cli/commands/analyses/merge.py +61 -0
  24. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/commands/analyses/run.py +38 -25
  25. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/commands/analyses/select.py +29 -12
  26. bevor_cli-0.2.0/bevor_cli/commands/analyses/set_head.py +91 -0
  27. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/commands/analyses/transitions.py +41 -28
  28. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/commands/analyses/view.py +21 -26
  29. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/commands/auth/login.py +2 -2
  30. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/commands/auth/whoami.py +6 -3
  31. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/commands/codes/list.py +28 -26
  32. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/commands/codes/push.py +30 -12
  33. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/commands/codes/select.py +14 -11
  34. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/commands/codes/view.py +8 -10
  35. bevor_cli-0.2.0/bevor_cli/commands/findings/acknowledge.py +43 -0
  36. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/commands/findings/add.py +60 -50
  37. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/commands/findings/delete.py +3 -3
  38. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/commands/findings/edit.py +12 -8
  39. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/commands/findings/get.py +3 -3
  40. bevor_cli-0.1.2/bevor_cli/commands/findings/bulk.py → bevor_cli-0.2.0/bevor_cli/commands/findings/import_findings.py +14 -24
  41. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/commands/findings/interactive.py +23 -23
  42. bevor_cli-0.2.0/bevor_cli/commands/findings/list.py +325 -0
  43. bevor_cli-0.1.2/bevor_cli/commands/findings/revert.py → bevor_cli-0.2.0/bevor_cli/commands/findings/undo.py +6 -6
  44. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/commands/graph/call_chain.py +7 -7
  45. bevor_cli-0.2.0/bevor_cli/commands/graph/edges.py +65 -0
  46. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/commands/graph/interactive.py +15 -8
  47. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/commands/graph/renderer.py +15 -31
  48. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/commands/link/__init__.py +12 -9
  49. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/commands/link/helpers.py +3 -3
  50. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/commands/nodes/get.py +4 -4
  51. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/commands/nodes/list.py +17 -17
  52. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/commands/nodes/source.py +3 -3
  53. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/commands/projects/create.py +18 -10
  54. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/commands/projects/list.py +6 -4
  55. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/commands/projects/select.py +5 -4
  56. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/commands/projects/view.py +2 -2
  57. bevor_cli-0.2.0/bevor_cli/commands/reflog/__init__.py +54 -0
  58. bevor_cli-0.2.0/bevor_cli/commands/status/__init__.py +143 -0
  59. bevor_cli-0.2.0/bevor_cli/commands/sync/__init__.py +55 -0
  60. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/commands/workspaces/list.py +14 -11
  61. bevor_cli-0.2.0/bevor_cli/commands/workspaces/pick.py +19 -0
  62. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/commands/workspaces/select.py +11 -9
  63. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/commands/workspaces/view.py +12 -11
  64. bevor_cli-0.2.0/bevor_cli/configuration/logs.py +61 -0
  65. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/configuration/state.py +35 -6
  66. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/findings_yaml.py +44 -32
  67. bevor_cli-0.2.0/bevor_cli/fingerprint.py +24 -0
  68. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/main.py +3 -10
  69. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/output.py +25 -1
  70. bevor_cli-0.2.0/bevor_cli/target.py +15 -0
  71. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/pyproject.toml +3 -3
  72. bevor_cli-0.1.2/bevor_cli/apps/agent.py +0 -10
  73. bevor_cli-0.1.2/bevor_cli/apps/findings.py +0 -22
  74. bevor_cli-0.1.2/bevor_cli/commands/agent/setup_cmd.py +0 -18
  75. bevor_cli-0.1.2/bevor_cli/commands/analyses/active.py +0 -42
  76. bevor_cli-0.1.2/bevor_cli/commands/analyses/child.py +0 -81
  77. bevor_cli-0.1.2/bevor_cli/commands/analyses/commit.py +0 -49
  78. bevor_cli-0.1.2/bevor_cli/commands/analyses/create.py +0 -106
  79. bevor_cli-0.1.2/bevor_cli/commands/analyses/diff.py +0 -87
  80. bevor_cli-0.1.2/bevor_cli/commands/analyses/findings.py +0 -129
  81. bevor_cli-0.1.2/bevor_cli/commands/analyses/merge.py +0 -46
  82. bevor_cli-0.1.2/bevor_cli/commands/analyses/retry.py +0 -81
  83. bevor_cli-0.1.2/bevor_cli/commands/analyses/set_head.py +0 -45
  84. bevor_cli-0.1.2/bevor_cli/commands/context/__init__.py +0 -92
  85. bevor_cli-0.1.2/bevor_cli/commands/findings/acknowledge.py +0 -28
  86. bevor_cli-0.1.2/bevor_cli/commands/findings/list.py +0 -108
  87. bevor_cli-0.1.2/bevor_cli/commands/graph/edges.py +0 -59
  88. bevor_cli-0.1.2/bevor_cli/commands/workspaces/pick.py +0 -20
  89. bevor_cli-0.1.2/bevor_cli/configuration/__init__.py +0 -0
  90. bevor_cli-0.1.2/bevor_cli/configuration/settings.py +0 -54
  91. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/README.md +0 -0
  92. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/__init__.py +0 -0
  93. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/annotations/__init__.py +0 -0
  94. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/annotations/confirmations.py +0 -0
  95. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/annotations/query.py +0 -0
  96. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/apps/chat.py +0 -0
  97. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/apps/nodes.py +0 -0
  98. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/apps/projects.py +0 -0
  99. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/apps/sessions.py +0 -0
  100. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/apps/workspaces.py +0 -0
  101. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/callbacks/__init__.py +0 -0
  102. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/callbacks/notify.py +0 -0
  103. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/callbacks/upgrade.py +0 -0
  104. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/callbacks/version.py +0 -0
  105. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/commands/__init__.py +0 -0
  106. {bevor_cli-0.1.2/bevor_cli/commands/agent → bevor_cli-0.2.0/bevor_cli/commands/analyses}/__init__.py +0 -0
  107. {bevor_cli-0.1.2/bevor_cli/commands/analyses → bevor_cli-0.2.0/bevor_cli/commands/analyses/chats}/__init__.py +0 -0
  108. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/commands/analyses/chats/new.py +0 -0
  109. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/commands/auth/__init__.py +0 -0
  110. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/commands/auth/logout.py +0 -0
  111. {bevor_cli-0.1.2/bevor_cli/commands/analyses/chats → bevor_cli-0.2.0/bevor_cli/commands/codes}/__init__.py +0 -0
  112. {bevor_cli-0.1.2/bevor_cli/commands/codes → bevor_cli-0.2.0/bevor_cli/commands/findings}/__init__.py +0 -0
  113. {bevor_cli-0.1.2/bevor_cli/commands/findings → bevor_cli-0.2.0/bevor_cli/commands/graph}/__init__.py +0 -0
  114. {bevor_cli-0.1.2/bevor_cli/commands/graph → bevor_cli-0.2.0/bevor_cli/commands/nodes}/__init__.py +0 -0
  115. {bevor_cli-0.1.2/bevor_cli/commands/nodes → bevor_cli-0.2.0/bevor_cli/commands/projects}/__init__.py +0 -0
  116. {bevor_cli-0.1.2/bevor_cli/commands/projects → bevor_cli-0.2.0/bevor_cli/commands/sessions}/__init__.py +0 -0
  117. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/commands/sessions/list.py +0 -0
  118. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/commands/sessions/revoke.py +0 -0
  119. {bevor_cli-0.1.2/bevor_cli/commands/sessions → bevor_cli-0.2.0/bevor_cli/commands/workspaces}/__init__.py +0 -0
  120. {bevor_cli-0.1.2/bevor_cli/commands/workspaces → bevor_cli-0.2.0/bevor_cli/configuration}/__init__.py +0 -0
  121. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/configuration/creds.py +0 -0
  122. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/configuration/update.py +0 -0
  123. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/select.py +0 -0
  124. {bevor_cli-0.1.2 → bevor_cli-0.2.0}/bevor_cli/settings.py +0 -0
  125. {bevor_cli-0.1.2 → 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.2
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.2
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
@@ -0,0 +1,21 @@
1
+ from bevor_sdk.types.responses import ActionDetails, AnalysisActions
2
+
3
+ from bevor_cli.output import console
4
+
5
+
6
+ def action_commands(actions: AnalysisActions) -> list[tuple[str, ActionDetails]]:
7
+ return [
8
+ ("sync / create", actions.create_child),
9
+ ("alter findings", actions.alter_findings),
10
+ ("run", actions.run_pipeline),
11
+ ("fork", actions.fork),
12
+ ("merge (into this)", actions.merge_to),
13
+ ("merge (from this)", actions.merge_from),
14
+ ("set-head", actions.set_as_head),
15
+ ("delete", actions.delete),
16
+ ]
17
+
18
+
19
+ def print_actions(actions: AnalysisActions, label_width: int, separator: str = "") -> None:
20
+ allowed = [label for label, details in action_commands(actions) if details.is_allowed]
21
+ console.print(f"{'Can run':<{label_width}}{separator} {', '.join(allowed) or '(nothing)'}")
@@ -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,47 +1,53 @@
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
- from bevor_cli.commands.analyses.commit import commit_analysis
5
2
  from bevor_cli.commands.analyses.create import create_analysis
6
- from bevor_cli.commands.analyses.delete import delete_analysis_full, delete_analysis_version
7
- from bevor_cli.commands.analyses.diff import diff_analysis
3
+ from bevor_cli.commands.analyses.delete import (
4
+ delete_analysis_full,
5
+ delete_analysis_version,
6
+ )
7
+ from bevor_cli.commands.analyses.deselect import deselect_analysis
8
8
  from bevor_cli.commands.analyses.entrypoints import list_entrypoints
9
- from bevor_cli.commands.analyses.findings import list_analysis_findings
10
9
  from bevor_cli.commands.analyses.fork import fork_analysis
10
+ from bevor_cli.commands.analyses.lineage import lineage_analysis
11
11
  from bevor_cli.commands.analyses.list import list_analyses
12
+ from bevor_cli.commands.analyses.materialize import materialize_analysis
12
13
  from bevor_cli.commands.analyses.merge import merge_analysis
13
- from bevor_cli.commands.analyses.retry import retry_analysis
14
14
  from bevor_cli.commands.analyses.run import run_analysis
15
15
  from bevor_cli.commands.analyses.select import select_analysis
16
16
  from bevor_cli.commands.analyses.set_head import set_analysis_head
17
17
  from bevor_cli.commands.analyses.transitions import list_transitions
18
18
  from bevor_cli.commands.analyses.view import view_analysis
19
19
 
20
- app = typer.Typer(help="Manage analyses.", no_args_is_help=True)
20
+ app = typer.Typer(
21
+ help=(
22
+ "Manage analyses.\n\n"
23
+ "An analysis is a history of versions, like a git repository. HEAD is the version commands "
24
+ "act on by default; pass --version to target another. Findings staged with `bevor findings` "
25
+ "sit on HEAD until you commit them, which creates a new version. After a code change, "
26
+ "`bevor sync` pushes it and adds it as a new version."
27
+ ),
28
+ no_args_is_help=True,
29
+ )
21
30
 
22
31
  app.command("list")(list_analyses)
23
32
  app.command("view")(view_analysis)
33
+ app.command("lineage")(lineage_analysis)
24
34
  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")
35
+ app.command("deselect")(deselect_analysis)
33
36
 
34
- app.command("run")(run_analysis)
35
- app.command("retry")(retry_analysis)
36
- app.command("diff")(diff_analysis)
37
- app.command("commit")(commit_analysis)
38
- app.command("child")(create_child_analysis)
37
+ app.command("create")(create_analysis)
39
38
  app.command("fork")(fork_analysis)
40
39
  app.command("merge")(merge_analysis)
41
- app.command("findings")(list_analysis_findings)
42
-
43
40
 
41
+ app.command("run")(run_analysis)
44
42
  app.command("entrypoints")(list_entrypoints)
43
+ app.command("materialize")(materialize_analysis)
45
44
  app.command("transitions")(list_transitions)
46
45
 
46
+ app.command("set-head")(set_analysis_head)
47
+
48
+ delete_app = typer.Typer(help="Delete a version, or the entire analysis.", no_args_is_help=True)
49
+ delete_app.command("full")(delete_analysis_full)
50
+ delete_app.command("version")(delete_analysis_version)
51
+ app.add_typer(delete_app, name="delete")
52
+
47
53
  __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)
@@ -0,0 +1,33 @@
1
+ import typer
2
+ from bevor_cli.commands.findings.acknowledge import (
3
+ acknowledge_finding,
4
+ unacknowledge_finding,
5
+ )
6
+ from bevor_cli.commands.findings.add import add_finding
7
+ from bevor_cli.commands.findings.delete import delete_finding
8
+ from bevor_cli.commands.findings.edit import edit_finding
9
+ from bevor_cli.commands.findings.get import get_finding
10
+ from bevor_cli.commands.findings.import_findings import import_findings
11
+ from bevor_cli.commands.findings.list import list_findings
12
+ from bevor_cli.commands.findings.undo import undo_change
13
+
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
+ )
22
+
23
+ app.command("list")(list_findings)
24
+ app.command("view")(get_finding)
25
+ app.command("add")(add_finding)
26
+ app.command("import")(import_findings)
27
+ app.command("edit")(edit_finding)
28
+ app.command("delete")(delete_finding)
29
+ app.command("undo")(undo_change)
30
+ app.command("acknowledge")(acknowledge_finding)
31
+ app.command("unacknowledge")(unacknowledge_finding)
32
+
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,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,14 +1,14 @@
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
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,50 +1,53 @@
1
- """``bevor analysis chats list``."""
1
+ """``bevor analyses chats list``."""
2
2
 
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
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)
35
35
  )
36
36
 
37
- query_params = ChatsQueryParams(
38
- page=page,
39
- page_size=page_size or settings.default_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
- console.print_json(found.model_dump_json(indent=2))
50
+ print_json(found.model_dump_json(indent=2))
48
51
  return
49
52
 
50
53
  if not found.results:
@@ -3,13 +3,13 @@
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
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,9 +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(
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:
@@ -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)
@@ -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
@@ -0,0 +1,150 @@
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.requests import AnalysisCreateChildBody, AnalysisCreateRootBody
7
+ from bevor_sdk.types.responses import AnalysisCollisionResult, AnalysisCreatedResult
8
+ from rich.prompt import Confirm
9
+
10
+ from bevor_cli import output
11
+ from bevor_cli.annotations.confirmations import FORCE, JSON_OUT, YES
12
+ from bevor_cli.client import BevorInternalClient
13
+ from bevor_cli.configuration.creds import Credentials
14
+ from bevor_cli.configuration.state import State
15
+ from bevor_cli.fingerprint import require_code_in_sync
16
+ from bevor_cli.output import console, print_json
17
+ from bevor_cli.target import resolve_target
18
+
19
+ Collision = Literal["surface", "force", "merge"]
20
+
21
+
22
+ def create_from_pushed_code(
23
+ *,
24
+ new: bool,
25
+ name: str | None,
26
+ version: str | None,
27
+ collision: Collision,
28
+ json_out: bool,
29
+ yes: bool,
30
+ ) -> None:
31
+ """Add the pushed code as a new version on HEAD of the selected analysis, or start a new analysis
32
+ when none is selected (or ``new`` is set)."""
33
+ creds = Credentials.load()
34
+ creds.require_token()
35
+
36
+ state = State.load()
37
+ workspace_id = state.validate_workspace()
38
+ code_id = state.validate_code()
39
+
40
+ start = new or (state.analysis_id is None and version is None)
41
+
42
+ if start and version:
43
+ output.error("--version can't be combined with --new.")
44
+ raise typer.Exit(1)
45
+ if not start and name:
46
+ output.error(
47
+ "--name only applies when starting a new analysis.",
48
+ hint="Pass `--new` to start one, or drop `--name` to add a version to the selected analysis.",
49
+ )
50
+ raise typer.Exit(1)
51
+
52
+ if start and not yes:
53
+ if not Confirm.ask(f"Start a new analysis from code {code_id}?"):
54
+ raise typer.Exit(0)
55
+
56
+ client = BevorInternalClient(
57
+ creds=creds, workspace_id=workspace_id, project_id=state.validate_project()
58
+ )
59
+
60
+ if start:
61
+ data = AnalysisCreateRootBody(code_id=code_id, on_collision=collision)
62
+ if name:
63
+ data["name"] = name
64
+ created = client.analyses.create_root(data)
65
+ else:
66
+ analysis_id, version_id = resolve_target(client, state, version)
67
+ data = AnalysisCreateChildBody(code_id=code_id, on_collision=collision)
68
+ if version_id:
69
+ data["version_id"] = version_id
70
+ created = client.analyses.create_child(analysis_id, data)
71
+
72
+ if isinstance(created, AnalysisCreatedResult):
73
+ state.set_analysis(created.analysis)
74
+ state.save()
75
+
76
+ if json_out:
77
+ print_json(created.analysis.model_dump_json(indent=2))
78
+ elif start:
79
+ output.success(
80
+ f"Started analysis {created.analysis.id} and selected it. "
81
+ "Next: `bevor analyses run` or `bevor findings add`."
82
+ )
83
+ else:
84
+ output.success(
85
+ f"Added version {created.analysis.version.id} to analysis {created.analysis.id}. HEAD moved to it."
86
+ )
87
+ return
88
+
89
+ if isinstance(created, AnalysisCollisionResult):
90
+ if json_out:
91
+ print_json(created.model_dump_json(indent=2))
92
+ return
93
+
94
+ print_collision(created)
95
+
96
+
97
+ def print_collision(collision: AnalysisCollisionResult) -> None:
98
+ output.warning("This exact code already has a version in this project; nothing was created.")
99
+ for candidate in collision.candidates:
100
+ meta = candidate.analysis_meta
101
+ owner = "yours" if candidate.on_collision == "view" else meta.user.username
102
+ head = " (HEAD)" if candidate.is_head else ""
103
+ view = (
104
+ f"bevor analyses view {meta.id}"
105
+ if candidate.is_head
106
+ else f"bevor analyses view --version {candidate.id}"
107
+ )
108
+
109
+ console.print(
110
+ f"\n [bold]{meta.name}[/bold] ({owner}, {candidate.created_at.date()})"
111
+ f"\n analysis {meta.id} version {candidate.id}{head}"
112
+ )
113
+ console.print(f" view: {view}")
114
+ if candidate.on_collision == "fork":
115
+ console.print(f" fork: bevor analyses fork --version {candidate.id}")
116
+ elif candidate.on_collision == "merge":
117
+ console.print(f" merge: bevor analyses merge --from-version {candidate.id}")
118
+ else:
119
+ console.print(f" select: bevor analyses select {meta.id}")
120
+ console.print("\nTo create a new one anyway, pass --collision force.")
121
+
122
+
123
+ def create_analysis(
124
+ new: bool = typer.Option(False, "--new", help="Start a new analysis even if one is selected."),
125
+ name: Optional[str] = typer.Option(None, "--name", help="Name for a new analysis."),
126
+ version: Optional[str] = typer.Option(
127
+ None, "--version", help="Add the new version on top of this version instead of HEAD."
128
+ ),
129
+ collision: Collision = typer.Option(
130
+ "surface",
131
+ "--collision",
132
+ help="What to do if this code already has a version: surface the candidates (default), force, or merge.",
133
+ ),
134
+ yes: YES = False,
135
+ json_out: JSON_OUT = False,
136
+ force: FORCE = False,
137
+ ) -> None:
138
+ """Create a version for the pushed code.
139
+
140
+ With an analysis selected, adds it as a new version on HEAD and moves HEAD to it. With none
141
+ selected (or ``--new``), starts a new analysis and selects it. Nothing is run; use
142
+ `bevor analyses run` for that. The working directory must match the last push; `bevor sync`
143
+ pushes and does this in one step.
144
+ """
145
+ if not force:
146
+ require_code_in_sync(State.load())
147
+
148
+ create_from_pushed_code(
149
+ new=new, name=name, version=version, collision=collision, json_out=json_out, yes=yes
150
+ )
@@ -1,9 +1,7 @@
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
- from bevor_sdk.types import ID
4
+ from bevor_sdk.types.shared import ID
7
5
 
8
6
  from bevor_cli import output
9
7
  from bevor_cli.client import BevorInternalClient
@@ -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()