bevor-cli 0.1.0__tar.gz → 0.1.2__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 (109) hide show
  1. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/.gitignore +2 -1
  2. bevor_cli-0.1.2/PKG-INFO +131 -0
  3. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/README.md +1 -0
  4. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/apps/main.py +31 -1
  5. bevor_cli-0.1.2/bevor_cli/callbacks/notify.py +26 -0
  6. bevor_cli-0.1.2/bevor_cli/callbacks/upgrade.py +23 -0
  7. bevor_cli-0.1.2/bevor_cli/callbacks/version.py +25 -0
  8. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/analyses/create.py +4 -3
  9. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/analyses/retry.py +12 -8
  10. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/analyses/run.py +11 -9
  11. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/auth/login.py +2 -0
  12. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/codes/push.py +6 -3
  13. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/codes/view.py +3 -3
  14. bevor_cli-0.1.2/bevor_cli/commands/workspaces/__init__.py +0 -0
  15. bevor_cli-0.1.2/bevor_cli/configuration/__init__.py +0 -0
  16. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/configuration/creds.py +5 -2
  17. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/configuration/state.py +12 -9
  18. bevor_cli-0.1.2/bevor_cli/configuration/update.py +50 -0
  19. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/main.py +19 -3
  20. bevor_cli-0.1.2/bevor_cli/settings.py +4 -0
  21. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/pyproject.toml +4 -2
  22. bevor_cli-0.1.0/PKG-INFO +0 -14
  23. bevor_cli-0.1.0/bevor_cli/settings.py +0 -4
  24. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/__init__.py +0 -0
  25. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/annotations/__init__.py +0 -0
  26. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/annotations/confirmations.py +0 -0
  27. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/annotations/query.py +0 -0
  28. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/apps/agent.py +0 -0
  29. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/apps/analyses.py +0 -0
  30. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/apps/chat.py +0 -0
  31. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/apps/codes.py +0 -0
  32. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/apps/findings.py +0 -0
  33. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/apps/nodes.py +0 -0
  34. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/apps/projects.py +0 -0
  35. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/apps/sessions.py +0 -0
  36. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/apps/workspaces.py +0 -0
  37. {bevor_cli-0.1.0/bevor_cli/commands → bevor_cli-0.1.2/bevor_cli/callbacks}/__init__.py +0 -0
  38. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/client.py +0 -0
  39. {bevor_cli-0.1.0/bevor_cli/commands/agent → bevor_cli-0.1.2/bevor_cli/commands}/__init__.py +0 -0
  40. {bevor_cli-0.1.0/bevor_cli/commands/analyses → bevor_cli-0.1.2/bevor_cli/commands/agent}/__init__.py +0 -0
  41. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/agent/materialze_cmd.py +0 -0
  42. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/agent/setup_cmd.py +0 -0
  43. {bevor_cli-0.1.0/bevor_cli/commands/analyses/chats → bevor_cli-0.1.2/bevor_cli/commands/analyses}/__init__.py +0 -0
  44. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/analyses/active.py +0 -0
  45. {bevor_cli-0.1.0/bevor_cli/commands/codes → bevor_cli-0.1.2/bevor_cli/commands/analyses/chats}/__init__.py +0 -0
  46. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/analyses/chats/get.py +0 -0
  47. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/analyses/chats/list.py +0 -0
  48. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/analyses/chats/messages.py +0 -0
  49. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/analyses/chats/new.py +0 -0
  50. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/analyses/chats/resume.py +0 -0
  51. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/analyses/chats/session.py +0 -0
  52. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/analyses/child.py +0 -0
  53. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/analyses/commit.py +0 -0
  54. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/analyses/delete.py +0 -0
  55. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/analyses/diff.py +0 -0
  56. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/analyses/entrypoints.py +0 -0
  57. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/analyses/findings.py +0 -0
  58. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/analyses/fork.py +0 -0
  59. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/analyses/list.py +0 -0
  60. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/analyses/merge.py +0 -0
  61. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/analyses/select.py +0 -0
  62. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/analyses/set_head.py +0 -0
  63. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/analyses/transitions.py +0 -0
  64. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/analyses/view.py +0 -0
  65. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/auth/__init__.py +0 -0
  66. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/auth/logout.py +0 -0
  67. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/auth/whoami.py +0 -0
  68. {bevor_cli-0.1.0/bevor_cli/commands/findings → bevor_cli-0.1.2/bevor_cli/commands/codes}/__init__.py +0 -0
  69. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/codes/list.py +0 -0
  70. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/codes/select.py +0 -0
  71. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/context/__init__.py +0 -0
  72. {bevor_cli-0.1.0/bevor_cli/commands/graph → bevor_cli-0.1.2/bevor_cli/commands/findings}/__init__.py +0 -0
  73. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/findings/acknowledge.py +0 -0
  74. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/findings/add.py +0 -0
  75. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/findings/bulk.py +0 -0
  76. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/findings/delete.py +0 -0
  77. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/findings/edit.py +0 -0
  78. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/findings/get.py +0 -0
  79. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/findings/interactive.py +0 -0
  80. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/findings/list.py +0 -0
  81. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/findings/revert.py +0 -0
  82. {bevor_cli-0.1.0/bevor_cli/commands/nodes → bevor_cli-0.1.2/bevor_cli/commands/graph}/__init__.py +0 -0
  83. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/graph/call_chain.py +0 -0
  84. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/graph/edges.py +0 -0
  85. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/graph/interactive.py +0 -0
  86. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/graph/renderer.py +0 -0
  87. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/link/__init__.py +0 -0
  88. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/link/helpers.py +0 -0
  89. {bevor_cli-0.1.0/bevor_cli/commands/projects → bevor_cli-0.1.2/bevor_cli/commands/nodes}/__init__.py +0 -0
  90. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/nodes/get.py +0 -0
  91. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/nodes/list.py +0 -0
  92. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/nodes/source.py +0 -0
  93. {bevor_cli-0.1.0/bevor_cli/commands/sessions → bevor_cli-0.1.2/bevor_cli/commands/projects}/__init__.py +0 -0
  94. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/projects/create.py +0 -0
  95. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/projects/list.py +0 -0
  96. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/projects/select.py +0 -0
  97. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/projects/view.py +0 -0
  98. {bevor_cli-0.1.0/bevor_cli/commands/workspaces → bevor_cli-0.1.2/bevor_cli/commands/sessions}/__init__.py +0 -0
  99. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/sessions/list.py +0 -0
  100. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/sessions/revoke.py +0 -0
  101. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/workspaces/list.py +0 -0
  102. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/workspaces/pick.py +0 -0
  103. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/workspaces/select.py +0 -0
  104. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/commands/workspaces/view.py +0 -0
  105. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/configuration/settings.py +0 -0
  106. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/findings_yaml.py +0 -0
  107. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/output.py +0 -0
  108. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/bevor_cli/select.py +0 -0
  109. {bevor_cli-0.1.0 → bevor_cli-0.1.2}/cli-hierarchy.py +0 -0
@@ -25,6 +25,7 @@ htmlcov/
25
25
  # Env files
26
26
  .env
27
27
  .env.*
28
+ !.env.test
28
29
  !.env.example
29
30
 
30
31
  # Terraform
@@ -34,13 +35,13 @@ htmlcov/
34
35
  *.tfvars
35
36
  *.tfvars.json
36
37
  !*.tfvars.example
38
+ *.tfplan
37
39
  crash.log
38
40
  crash.*.log
39
41
 
40
42
  # Editors / OS
41
43
  .vscode/
42
44
  .idea/
43
- .zed/
44
45
  .DS_Store
45
46
 
46
47
  # Scratch
@@ -0,0 +1,131 @@
1
+ Metadata-Version: 2.5
2
+ Name: bevor-cli
3
+ Version: 0.1.2
4
+ Summary: Bevor CLI tool for security analysis and graph inspection
5
+ Classifier: Development Status :: 3 - Alpha
6
+ Requires-Python: >=3.13
7
+ Requires-Dist: bevor-sdk==0.1.2
8
+ Requires-Dist: click~=8.1
9
+ Requires-Dist: httpx~=0.28
10
+ Requires-Dist: packaging~=26.2
11
+ Requires-Dist: pydantic~=2.12
12
+ Requires-Dist: pyyaml~=6.0
13
+ Requires-Dist: questionary~=2.0
14
+ Requires-Dist: rich~=15.0
15
+ Requires-Dist: typer~=0.26
16
+ Description-Content-Type: text/markdown
17
+
18
+ # Bevor CLI
19
+
20
+ The official command-line interface for [Bevor](https://bevor.io) — smart contract security analysis and code graph exploration.
21
+
22
+ Use `bevor` to upload Solidity codebases, run security analyses, explore the code graph interactively, and manage findings — all from your terminal.
23
+
24
+ ---
25
+
26
+ ## Installation
27
+
28
+ ```bash
29
+ curl -LsSf https://bevor.io/install.sh | bash
30
+ ```
31
+
32
+ ---
33
+
34
+ ## Setup
35
+
36
+ ```bash
37
+ bevor login
38
+ bevor link
39
+ #
40
+ bevor codes push
41
+ bevor analyses create
42
+ ```
43
+
44
+ ---
45
+
46
+ ## Contents
47
+
48
+ `[]` -> optional args.
49
+ `<>` -> required args.
50
+
51
+ Simplification: EVERYTHING operates on the currently configured analysis. Findings as well.
52
+ Simplifies the DX, and we can take the stance that it's a rare state to want to operate on OTHER things via the CLI.
53
+ "version" is a flag that can be passed, but it's intentionally hard to act on arbitrary versions, unless the head is moved or the flag is passed.
54
+
55
+ ### Local Configuration
56
+
57
+ - workspace [id]
58
+ - project [id]
59
+ - code [id, fingerprint]
60
+ - analysis [id]
61
+
62
+ ```bash
63
+ help
64
+ login
65
+ logout
66
+ whoami [--json]
67
+ link
68
+ context [--json]
69
+ sessions
70
+ sessions list
71
+ sessions revoke <token_id>
72
+ workspaces
73
+ workspaces list [--json]
74
+ workspaces view [workspace_id] [--json]
75
+ workspaces select [workspace_id]
76
+ projects
77
+ projects list [--json]
78
+ projects view [project_id] [--json]
79
+ projects select [project_id]
80
+ projects create [--name] [--description] [--kind] [--yes]
81
+ codes
82
+ codes list [--page] [--page-size] [--order] [--order-by] [--project] [--network] [--identifier] [--status] [--json]
83
+ codes view [code_id] [--json]
84
+ codes select [code_id]
85
+ codes push [--path] [--no-wait] [--yes]
86
+ codes nodes
87
+ codes nodes list [--code] [--entrypoints] [--file] [--no-deps] [--name] [--node-type] [--json]
88
+ codes nodes view <node_id> [--code] [--json]
89
+ codes nodes content <node_id> [--code]
90
+ codes nodes edges <node_id> [--code] [--direction] [--type] [--json]
91
+ codes nodes call-chain <node_id> [--code] [--json]
92
+ codes nodes interactive <node_id> [--code]
93
+ analyses
94
+ analyses list [--page] [--page-size] [--order] [--order-by] [--project] [--user] [--is-owner] [--json]
95
+ analyses view [analysis_id] [--version] [--json]
96
+ analyses select [analysis_id] [--page] [--page-size]
97
+ analyses recent [--json]
98
+ analyses create [--name] [--collision] [--yes] [--json] [--force]
99
+ analyses set-head <version_id>
100
+ analyses run [--version] [--no-wait] [--silent]
101
+ analyses retry [--version] [--no-wait] [--silent]
102
+ analyses diff [--version] [--staged] [--json]
103
+ analyses commit [--version]
104
+ analyses child [--version] [--collision]
105
+ analyses fork [--version]
106
+ analyses merge <from_analysis> [--to]
107
+ analyses findings [--version] [--interactive] [--json] [--sarif]
108
+ analyses entrypoints [--version] [--json]
109
+ analyses transitions [--page] [--page-size] [--order] [--order-by] [--reason] [--version] [--project-wide] [--json]
110
+ analyses delete
111
+ analyses delete full
112
+ analyses delete version [version]
113
+ findings
114
+ findings list [--page] [--page-size] [--order] [--order-by] [--project] [--self] [--user] [--code] [--analyses] [--type] [--level] [--acknowledged] [--operation] [--created-by-self] [--created-by] [--json]
115
+ findings view <finding_id> [--json]
116
+ findings add [--version] [--file] [--interactive] [--type] [--level] [--name] [--explanation] [--recommendation] [--poc] [--tool] [--node] [--location] [--uri] [--start-line] [--start-column] [--end-line] [--end-column] [--char-offset] [--char-length] [--byte-offset] [--byte-length] [--fqn]
117
+ findings bulk <source> [--version]
118
+ findings edit <finding_id> [--file]
119
+ findings delete <finding_id>
120
+ findings revert <finding_id>
121
+ findings acknowledge <finding_id>
122
+ agent
123
+ agent setup
124
+ agent materialize
125
+ chats
126
+ chats list --page --page-size --order --order-by --project [--json]
127
+ chats view <chat_id> [--json]
128
+ chats messages <chat_id> [--json]
129
+ chats new <mode>
130
+ chats resume <chat_id>
131
+ ```
@@ -36,6 +36,7 @@ Simplifies the DX, and we can take the stance that it's a rare state to want to
36
36
  "version" is a flag that can be passed, but it's intentionally hard to act on arbitrary versions, unless the head is moved or the flag is passed.
37
37
 
38
38
  ### Local Configuration
39
+
39
40
  - workspace [id]
40
41
  - project [id]
41
42
  - code [id, fingerprint]
@@ -1,3 +1,5 @@
1
+ import subprocess
2
+
1
3
  import typer
2
4
  from bevor_cli import output
3
5
  from bevor_cli.apps import (
@@ -10,6 +12,9 @@ from bevor_cli.apps import (
10
12
  sessions,
11
13
  workspaces,
12
14
  )
15
+ from bevor_cli.callbacks.notify import _notify_if_outdated, _update_check_enabled
16
+ from bevor_cli.callbacks.upgrade import _upgrade_command
17
+ from bevor_cli.callbacks.version import _current_version, _latest_version, _version_callback
13
18
  from bevor_cli.commands.auth import login, logout, whoami
14
19
  from bevor_cli.commands.context import run_context
15
20
  from bevor_cli.commands.link import run_link
@@ -26,13 +31,24 @@ app = typer.Typer(
26
31
 
27
32
  @app.callback(invoke_without_command=True)
28
33
  def _root(
34
+ ctx: typer.Context,
29
35
  quiet: bool = typer.Option(
30
36
  False,
31
37
  "--quiet",
32
38
  help="Suppress informational output; useful for scripting.",
33
- is_eager=False,
39
+ ),
40
+ version: bool = typer.Option(
41
+ False,
42
+ "--version",
43
+ "-v",
44
+ help="Show the CLI version and exit.",
45
+ callback=_version_callback,
46
+ is_eager=True,
34
47
  ),
35
48
  ) -> None:
49
+ if ctx.invoked_subcommand != "upgrade" and _update_check_enabled(quiet):
50
+ ctx.call_on_close(_notify_if_outdated)
51
+
36
52
  output.set_quiet(quiet)
37
53
 
38
54
 
@@ -43,6 +59,20 @@ def help_command(ctx: typer.Context) -> None:
43
59
  console.print(root_ctx.get_help())
44
60
 
45
61
 
62
+ @app.command("upgrade")
63
+ def upgrade() -> None:
64
+ """Upgrade bevor-cli to the latest release."""
65
+ current = _current_version()
66
+ latest = _latest_version()
67
+ if current >= latest:
68
+ typer.echo(f"Already on the latest version ({current}).")
69
+ return
70
+
71
+ typer.echo(f"Upgrading {current} → {latest}")
72
+ result = subprocess.run(_upgrade_command())
73
+ raise typer.Exit(result.returncode)
74
+
75
+
46
76
  app.command("login")(login)
47
77
  app.command("logout")(logout)
48
78
  app.command("whoami")(whoami)
@@ -0,0 +1,26 @@
1
+ import os
2
+ import sys
3
+
4
+ import typer
5
+
6
+ from bevor_cli.callbacks.version import _current_version
7
+ from bevor_cli.configuration.update import UpdateCheck
8
+
9
+
10
+ def _notify_if_outdated() -> None:
11
+ check = UpdateCheck.refresh()
12
+ if check and check.is_outdated:
13
+ typer.echo(
14
+ f"\nA new version of bevor-cli is available: {_current_version()} → {check.latest}\n"
15
+ "Run `bevor upgrade` to update.",
16
+ err=True,
17
+ )
18
+
19
+
20
+ def _update_check_enabled(quiet: bool) -> bool:
21
+ return (
22
+ not quiet
23
+ and sys.stderr.isatty()
24
+ and not os.environ.get("CI")
25
+ and not os.environ.get("BEVOR_NO_UPDATE_CHECK")
26
+ )
@@ -0,0 +1,23 @@
1
+ import shutil
2
+ import subprocess
3
+ import sys
4
+ from pathlib import Path
5
+
6
+ PACKAGE = "bevor-cli"
7
+
8
+
9
+ def _uv_tool_dir(uv: str) -> Path | None:
10
+ result = subprocess.run([uv, "tool", "dir"], capture_output=True, text=True)
11
+ if result.returncode != 0:
12
+ return None
13
+ return Path(result.stdout.strip()).resolve()
14
+
15
+
16
+ def _upgrade_command() -> list[str]:
17
+ prefix = Path(sys.prefix).resolve()
18
+ uv = shutil.which("uv")
19
+ if uv:
20
+ tool_dir = _uv_tool_dir(uv)
21
+ if tool_dir and prefix.is_relative_to(tool_dir):
22
+ return [uv, "tool", "upgrade", PACKAGE]
23
+ return [sys.executable, "-m", "pip", "install", "--upgrade", PACKAGE]
@@ -0,0 +1,25 @@
1
+ import importlib.metadata
2
+ import json
3
+ import urllib.request
4
+
5
+ import typer
6
+ from packaging.version import Version
7
+
8
+ PACKAGE = "bevor-cli"
9
+
10
+
11
+ def _current_version() -> Version:
12
+ return Version(importlib.metadata.version(PACKAGE))
13
+
14
+
15
+ def _latest_version(timeout: float = 5) -> Version:
16
+ url = f"https://pypi.org/pypi/{PACKAGE}/json"
17
+ with urllib.request.urlopen(url, timeout=timeout) as res:
18
+ return Version(json.load(res)["info"]["version"])
19
+
20
+
21
+ def _version_callback(value: bool) -> None:
22
+ if not value:
23
+ return
24
+ typer.echo(f"bevor-cli {_current_version()}")
25
+ raise typer.Exit()
@@ -4,7 +4,7 @@ from pathlib import Path
4
4
  from typing import Literal, Optional
5
5
 
6
6
  import typer
7
- from bevor_sdk.helpers.source_fingerprint import zip_source_tree
7
+ from bevor_sdk.helpers.source_fingerprint import directory_files, fingerprint_source
8
8
  from bevor_sdk.types import ID
9
9
  from bevor_sdk.types.requests.security.analyses import CreateAnalysisRootBodyDict
10
10
  from bevor_sdk.types.responses.security import AnalysisCollisionResult, AnalysisCreatedResult
@@ -38,8 +38,9 @@ def apply_create_analysis(
38
38
  code_id = state.validate_code()
39
39
 
40
40
  if not force:
41
- _, _, content_hash = zip_source_tree(Path.cwd())
42
- if content_hash != state.code_fingerprint:
41
+ root = Path.cwd()
42
+ _, _, _, fingerprint = fingerprint_source(directory_files(root), root.name)
43
+ if fingerprint != state.code_fingerprint:
43
44
  output.error(
44
45
  "Working directory does not match the configured code fingerprint "
45
46
  "(run `bevor codes push` after your latest changes).",
@@ -6,6 +6,8 @@ import typer
6
6
  from bevor_sdk._sync.resources._modules import EventResource
7
7
  from bevor_sdk.types import ID
8
8
  from bevor_sdk.types.requests.security import VersionBodyDict
9
+ from bevor_sdk.types.responses.events import AnalysisRunStatusEventData
10
+ from rich.live import Live
9
11
 
10
12
  from bevor_cli import output
11
13
  from bevor_cli.annotations.confirmations import NO_WAIT, SILENT
@@ -55,17 +57,19 @@ def retry_analysis(
55
57
  ep_map[ep.node.id] = (ep.node.short_id, ep.node.name, ep.pipeline_status)
56
58
 
57
59
  if not silent:
58
- with output.spinner("Analysis running…"):
60
+ with Live(render_status(ep_map), console=output.console, refresh_per_second=8) as live:
59
61
  for event in run_result.stream_completion():
60
- if event.id in ep_map:
61
- short_id, name, _ = ep_map[event.id]
62
- ep_map[event.id] = (short_id, name, event.status)
63
- render_status(ep_map)
62
+ if isinstance(event, AnalysisRunStatusEventData):
63
+ if event.payload.node_id in ep_map:
64
+ short_id, name, _ = ep_map[event.payload.node_id]
65
+ ep_map[event.payload.node_id] = (short_id, name, event.payload.status)
66
+ live.update(render_status(ep_map))
64
67
  else:
65
68
  for event in run_result.stream_completion():
66
- if event.id in ep_map:
67
- short_id, name, _ = ep_map[event.id]
68
- ep_map[event.id] = (short_id, name, event.status)
69
+ if isinstance(event, AnalysisRunStatusEventData):
70
+ if event.payload.node_id in ep_map:
71
+ short_id, name, _ = ep_map[event.payload.node_id]
72
+ ep_map[event.payload.node_id] = (short_id, name, event.payload.status)
69
73
 
70
74
  n_failures = sum(1 if status == "failed" else 0 for _, _, status in ep_map.values())
71
75
  if n_failures > 0:
@@ -7,6 +7,7 @@ from bevor_sdk._sync.resources._modules import EventResource
7
7
  from bevor_sdk.types import ID
8
8
  from bevor_sdk.types.literals import AnalysisRunStatus
9
9
  from bevor_sdk.types.requests.security import RunAnalysisBodyDict
10
+ from bevor_sdk.types.responses.events import AnalysisRunStatusEventData
10
11
  from rich.live import Live
11
12
  from rich.table import Table
12
13
 
@@ -39,11 +40,10 @@ def run_analysis(
39
40
  creds.require_token()
40
41
 
41
42
  state = State.load()
42
- workspace_id = state.validate_workspace()
43
43
 
44
44
  wait = not no_wait
45
45
  client = BevorInternalClient(
46
- creds=creds, workspace_id=workspace_id, project_id=state.validate_project()
46
+ creds=creds, workspace_id=state.validate_workspace(), project_id=state.validate_project()
47
47
  )
48
48
 
49
49
  opts: RunAnalysisBodyDict = {}
@@ -67,15 +67,17 @@ def run_analysis(
67
67
  if not silent:
68
68
  with Live(render_status(ep_map), console=output.console, refresh_per_second=8) as live:
69
69
  for event in run_result.stream_completion():
70
- if event.id in ep_map:
71
- short_id, name, _ = ep_map[event.id]
72
- ep_map[event.id] = (short_id, name, event.status)
73
- live.update(render_status(ep_map))
70
+ if isinstance(event, AnalysisRunStatusEventData):
71
+ if event.payload.node_id in ep_map:
72
+ short_id, name, _ = ep_map[event.payload.node_id]
73
+ ep_map[event.payload.node_id] = (short_id, name, event.payload.status)
74
+ live.update(render_status(ep_map))
74
75
  else:
75
76
  for event in run_result.stream_completion():
76
- if event.id in ep_map:
77
- short_id, name, _ = ep_map[event.id]
78
- ep_map[event.id] = (short_id, name, event.status)
77
+ if isinstance(event, AnalysisRunStatusEventData):
78
+ if event.payload.node_id in ep_map:
79
+ short_id, name, _ = ep_map[event.payload.node_id]
80
+ ep_map[event.payload.node_id] = (short_id, name, event.payload.status)
79
81
 
80
82
  n_failures = sum(1 if status == "failed" else 0 for _, _, status in ep_map.values())
81
83
  if n_failures > 0:
@@ -126,8 +126,10 @@ def login() -> None:
126
126
  raise typer.Exit(1)
127
127
 
128
128
  raw = payload["token"]
129
+ output.info(f"TOKEN {raw}")
129
130
  bearer = raw if raw.startswith("cli_") else f"cli_{raw}"
130
131
  creds = Credentials.save(token=bearer)
132
+ output.info(f"CREDS {creds.model_dump_json()}")
131
133
 
132
134
  client = BevorInternalBusinessClient(creds=creds)
133
135
  user = client.me()
@@ -5,7 +5,7 @@ from typing import Optional
5
5
 
6
6
  import typer
7
7
  from bevor_sdk.exceptions import NotFoundError
8
- from bevor_sdk.helpers.source_fingerprint import zip_source_tree
8
+ from bevor_sdk.helpers.source_fingerprint import directory_files, fingerprint_source
9
9
  from bevor_sdk.types import ID
10
10
 
11
11
  from bevor_cli import output
@@ -39,14 +39,17 @@ def push_code(
39
39
  root = path or Path.cwd()
40
40
  try:
41
41
  with output.spinner("Packaging source tree..."):
42
- zip_bytes, n_files, content_hash = zip_source_tree(root)
42
+ root = root.resolve()
43
+ zip_bytes, n_files, _, fingerprint = fingerprint_source(directory_files(root), root.name)
44
+ if n_files == 0:
45
+ raise ValueError("no UTF-8 source files found after filters")
43
46
  except ValueError as exc:
44
47
  output.error(str(exc), hint="Make sure you're in the project root directory.")
45
48
  raise typer.Exit(1)
46
49
  size_kb = len(zip_bytes) // 1024
47
50
  output.info(f"Compressed {n_files} files → {size_kb} KB")
48
51
 
49
- if state.code_id and state.code_fingerprint == content_hash:
52
+ if state.code_id and state.code_fingerprint == fingerprint:
50
53
  # requests are project-scoped, so a code that still resolves belongs to the linked project.
51
54
  try:
52
55
  client.codes.get(ID(state.code_id))
@@ -4,7 +4,7 @@ from pathlib import Path
4
4
  from typing import Optional
5
5
 
6
6
  import typer
7
- from bevor_sdk.helpers.source_fingerprint import zip_source_tree
7
+ from bevor_sdk.helpers.source_fingerprint import directory_files, fingerprint_source
8
8
  from bevor_sdk.types import ID
9
9
  from rich.table import Table
10
10
 
@@ -47,7 +47,7 @@ def view_code(
47
47
  return
48
48
 
49
49
  root = Path.cwd()
50
- _, _, content_hash = zip_source_tree(root)
50
+ _, _, _, fingerprint = fingerprint_source(directory_files(root), root.name)
51
51
 
52
52
  table = Table(show_header=False, box=None, padding=(0, 1))
53
53
  table.add_column(style="bold")
@@ -57,7 +57,7 @@ def view_code(
57
57
  table.add_row("Status", code.status)
58
58
  table.add_row("Version method", code.version_method)
59
59
  table.add_row("Fingerprint", code.version_fingerprint)
60
- table.add_row("In sync (cwd)", str(content_hash == code.version_fingerprint))
60
+ table.add_row("In sync (cwd)", str(fingerprint == code.version_fingerprint))
61
61
  table.add_row("Created", str(code.created_at.date()))
62
62
 
63
63
  if code.network:
File without changes
@@ -5,10 +5,12 @@ import json
5
5
  from pathlib import Path
6
6
 
7
7
  import typer
8
- from bevor_cli import output
9
8
  from pydantic import BaseModel
10
9
 
11
- _CREDENTIALS_PATH = Path.home() / ".bevor" / "credentials"
10
+ from bevor_cli import output
11
+
12
+ BEVOR_DIR = Path.home() / ".bevor"
13
+ _CREDENTIALS_PATH = BEVOR_DIR / "credentials"
12
14
 
13
15
 
14
16
  class Credentials(BaseModel):
@@ -29,6 +31,7 @@ class Credentials(BaseModel):
29
31
 
30
32
  @classmethod
31
33
  def save(cls, token: str) -> "Credentials":
34
+ print(_CREDENTIALS_PATH, token)
32
35
  _CREDENTIALS_PATH.parent.mkdir(parents=True, exist_ok=True)
33
36
  _CREDENTIALS_PATH.write_text(
34
37
  json.dumps(
@@ -5,21 +5,17 @@ from pathlib import Path
5
5
  from typing import Optional
6
6
 
7
7
  import typer
8
- from bevor_cli import output
9
8
  from bevor_sdk.types import ID
10
9
  from bevor_sdk.types.responses.graph import CodeMappingSchema
11
10
  from bevor_sdk.types.responses.security import AnalysisSchema
12
11
  from pydantic import BaseModel
13
12
 
13
+ from bevor_cli import output
14
+
14
15
  _CONFIG_DIR = ".bevor"
15
16
  _CONFIG_FILE = "config.json"
16
17
 
17
18
 
18
- def _state_path(cwd: Path | None = None) -> Path:
19
- base = cwd or Path.cwd()
20
- return base / _CONFIG_DIR / _CONFIG_FILE
21
-
22
-
23
19
  class State(BaseModel):
24
20
  workspace_id: Optional[str] = None
25
21
  project_id: Optional[str] = None
@@ -27,9 +23,14 @@ class State(BaseModel):
27
23
  code_fingerprint: Optional[str] = None
28
24
  analysis_id: Optional[str] = None
29
25
 
26
+ @staticmethod
27
+ def _path(cls, cwd: Path | None = None) -> Path:
28
+ base = cwd or Path.cwd()
29
+ return base / _CONFIG_DIR / _CONFIG_FILE
30
+
30
31
  @classmethod
31
32
  def load(cls, cwd: Path | None = None) -> "State":
32
- path = _state_path(cwd)
33
+ path = cls._path(cwd)
33
34
  if not path.exists():
34
35
  return cls()
35
36
  try:
@@ -39,7 +40,7 @@ class State(BaseModel):
39
40
  return cls()
40
41
 
41
42
  def save(self, cwd: Path | None = None) -> None:
42
- path = _state_path(cwd)
43
+ path = self._path(cwd)
43
44
  path.parent.mkdir(parents=True, exist_ok=True)
44
45
  path.write_text(self.model_dump_json(indent=2))
45
46
 
@@ -95,7 +96,9 @@ class State(BaseModel):
95
96
  if fallback:
96
97
  return ID(fallback)
97
98
 
98
- output.error("Code Configuration required", hint="Run `bevor codes push` or `bevor codes select`.")
99
+ output.error(
100
+ "Code Configuration required", hint="Run `bevor codes push` or `bevor codes select`."
101
+ )
99
102
  raise typer.Exit(1)
100
103
 
101
104
  def validate_analysis(self, priority: str | None = None, fallback: str | None = None) -> ID:
@@ -0,0 +1,50 @@
1
+ import datetime
2
+
3
+ from packaging.version import Version
4
+ from pydantic import BaseModel
5
+
6
+ from bevor_cli.callbacks.version import _current_version, _latest_version
7
+
8
+ from .creds import BEVOR_DIR
9
+
10
+ _UPDATE_CHECK_PATH = BEVOR_DIR / "update-check.json"
11
+ _UPDATE_CHECK_INTERVAL = datetime.timedelta(days=1)
12
+
13
+
14
+ class UpdateCheck(BaseModel):
15
+ latest: str
16
+ checked_at: datetime.datetime
17
+
18
+ @property
19
+ def is_stale(self) -> bool:
20
+ return datetime.datetime.now(datetime.UTC) - self.checked_at >= _UPDATE_CHECK_INTERVAL
21
+
22
+ @property
23
+ def is_outdated(self) -> bool:
24
+ return Version(self.latest) > _current_version()
25
+
26
+ @classmethod
27
+ def load(cls) -> "UpdateCheck | None":
28
+ if not _UPDATE_CHECK_PATH.exists():
29
+ return None
30
+ try:
31
+ return cls.model_validate_json(_UPDATE_CHECK_PATH.read_text())
32
+ except Exception:
33
+ return None
34
+
35
+ @classmethod
36
+ def save(cls, latest: Version) -> "UpdateCheck":
37
+ check = cls(latest=str(latest), checked_at=datetime.datetime.now(datetime.UTC))
38
+ _UPDATE_CHECK_PATH.parent.mkdir(parents=True, exist_ok=True)
39
+ _UPDATE_CHECK_PATH.write_text(check.model_dump_json(indent=2))
40
+ return check
41
+
42
+ @classmethod
43
+ def refresh(cls) -> "UpdateCheck | None":
44
+ check = cls.load()
45
+ if check and not check.is_stale:
46
+ return check
47
+ try:
48
+ return cls.save(_latest_version(timeout=1))
49
+ except (OSError, ValueError):
50
+ return check
@@ -1,17 +1,32 @@
1
1
  import sys
2
2
 
3
3
  import typer
4
- from bevor_sdk.exceptions import BaseError, InvalidScopeError, UnauthorizedError
4
+ from bevor_sdk.exceptions import (
5
+ BaseError,
6
+ InvalidScopeError,
7
+ SessionExpiredError,
8
+ UnauthenticatedError,
9
+ UnauthorizedError,
10
+ )
5
11
 
6
12
  from bevor_cli import output
7
13
  from bevor_cli.apps.main import app
14
+ from bevor_cli.configuration.creds import Credentials
8
15
 
9
16
 
10
17
  def main() -> None:
11
18
  try:
12
- app(standalone_mode=False)
19
+ app()
20
+ except UnauthenticatedError:
21
+ Credentials.delete()
22
+ output.error("Unauthenticated.", hint="Run `bevor login`.")
23
+ sys.exit(1)
13
24
  except UnauthorizedError:
14
- output.error("Unauthorized.", hint="Run `bevor login`.")
25
+ output.error("Unauthorized.", hint="Run `bevor link`.")
26
+ sys.exit(1)
27
+ except SessionExpiredError:
28
+ Credentials.delete()
29
+ output.error("Session Expired. Please re-authenticate", hint="Run `bevor login`.")
15
30
  sys.exit(1)
16
31
  except InvalidScopeError:
17
32
  output.error("Unauthorized: configure a workspace and project.", hint="Run `bevor link`.")
@@ -25,6 +40,7 @@ def main() -> None:
25
40
  except typer.Exit as e:
26
41
  sys.exit(e.exit_code)
27
42
  except Exception as e:
43
+ print(e, type(e))
28
44
  output.error(f"Unexpected error: {e}")
29
45
  sys.exit(1)
30
46
 
@@ -0,0 +1,4 @@
1
+ import os
2
+
3
+ API_URL = os.environ.get("BEVOR_API_URL", "https://api.bevor.io")
4
+ APP_URL = os.environ.get("BEVOR_APP_URL", "https://app.bevor.io")
@@ -1,10 +1,10 @@
1
1
  [project]
2
2
  name = "bevor-cli"
3
- version = "0.1.0"
3
+ version = "0.1.2"
4
4
  description = "Bevor CLI tool for security analysis and graph inspection"
5
5
  requires-python = ">=3.13"
6
6
  dependencies = [
7
- "bevor-sdk==0.1.0",
7
+ "bevor-sdk==0.1.2",
8
8
  "typer~=0.26",
9
9
  "httpx~=0.28",
10
10
  "pydantic~=2.12",
@@ -12,8 +12,10 @@ dependencies = [
12
12
  "rich~=15.0",
13
13
  "pyyaml~=6.0",
14
14
  "click~=8.1",
15
+ "packaging~=26.2",
15
16
  ]
16
17
  classifiers = ["Development Status :: 3 - Alpha"]
18
+ readme = "README.md"
17
19
 
18
20
  [project.scripts]
19
21
  bevor = "bevor_cli.main:main"
bevor_cli-0.1.0/PKG-INFO DELETED
@@ -1,14 +0,0 @@
1
- Metadata-Version: 2.5
2
- Name: bevor-cli
3
- Version: 0.1.0
4
- Summary: Bevor CLI tool for security analysis and graph inspection
5
- Classifier: Development Status :: 3 - Alpha
6
- Requires-Python: >=3.13
7
- Requires-Dist: bevor-sdk==0.1.0
8
- Requires-Dist: click~=8.1
9
- Requires-Dist: httpx~=0.28
10
- Requires-Dist: pydantic~=2.12
11
- Requires-Dist: pyyaml~=6.0
12
- Requires-Dist: questionary~=2.0
13
- Requires-Dist: rich~=15.0
14
- Requires-Dist: typer~=0.26
@@ -1,4 +0,0 @@
1
- import os
2
-
3
- API_URL = os.environ.get("BEVOR_API_URL", "https://api.bevor.ai")
4
- APP_URL = os.environ.get("BEVOR_APP_URL", "https://app.bevor.ai")
File without changes
File without changes
File without changes
File without changes