opencode-db 0.6.0__tar.gz → 0.6.1__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 (36) hide show
  1. {opencode_db-0.6.0 → opencode_db-0.6.1}/PKG-INFO +1 -1
  2. {opencode_db-0.6.0 → opencode_db-0.6.1}/README.md +25 -0
  3. {opencode_db-0.6.0 → opencode_db-0.6.1}/cli.py +10 -0
  4. {opencode_db-0.6.0 → opencode_db-0.6.1}/config.py +3 -1
  5. {opencode_db-0.6.0 → opencode_db-0.6.1}/opencode_db.egg-info/PKG-INFO +1 -1
  6. {opencode_db-0.6.0 → opencode_db-0.6.1}/pyproject.toml +1 -1
  7. {opencode_db-0.6.0 → opencode_db-0.6.1}/LICENSE +0 -0
  8. {opencode_db-0.6.0 → opencode_db-0.6.1}/README_PYPI.md +0 -0
  9. {opencode_db-0.6.0 → opencode_db-0.6.1}/cmd_costs.py +0 -0
  10. {opencode_db-0.6.0 → opencode_db-0.6.1}/cmd_delete.py +0 -0
  11. {opencode_db-0.6.0 → opencode_db-0.6.1}/cmd_export.py +0 -0
  12. {opencode_db-0.6.0 → opencode_db-0.6.1}/cmd_help.py +0 -0
  13. {opencode_db-0.6.0 → opencode_db-0.6.1}/cmd_info.py +0 -0
  14. {opencode_db-0.6.0 → opencode_db-0.6.1}/cmd_list.py +0 -0
  15. {opencode_db-0.6.0 → opencode_db-0.6.1}/cmd_projects.py +0 -0
  16. {opencode_db-0.6.0 → opencode_db-0.6.1}/cmd_prune.py +0 -0
  17. {opencode_db-0.6.0 → opencode_db-0.6.1}/cmd_search.py +0 -0
  18. {opencode_db-0.6.0 → opencode_db-0.6.1}/cmd_stats.py +0 -0
  19. {opencode_db-0.6.0 → opencode_db-0.6.1}/cmd_todos.py +0 -0
  20. {opencode_db-0.6.0 → opencode_db-0.6.1}/cmd_tree.py +0 -0
  21. {opencode_db-0.6.0 → opencode_db-0.6.1}/cmd_vacuum.py +0 -0
  22. {opencode_db-0.6.0 → opencode_db-0.6.1}/commands/__init__.py +0 -0
  23. {opencode_db-0.6.0 → opencode_db-0.6.1}/db.py +0 -0
  24. {opencode_db-0.6.0 → opencode_db-0.6.1}/formatters.py +0 -0
  25. {opencode_db-0.6.0 → opencode_db-0.6.1}/i18n.py +0 -0
  26. {opencode_db-0.6.0 → opencode_db-0.6.1}/opencode_db.egg-info/SOURCES.txt +0 -0
  27. {opencode_db-0.6.0 → opencode_db-0.6.1}/opencode_db.egg-info/dependency_links.txt +0 -0
  28. {opencode_db-0.6.0 → opencode_db-0.6.1}/opencode_db.egg-info/entry_points.txt +0 -0
  29. {opencode_db-0.6.0 → opencode_db-0.6.1}/opencode_db.egg-info/top_level.txt +0 -0
  30. {opencode_db-0.6.0 → opencode_db-0.6.1}/setup.cfg +0 -0
  31. {opencode_db-0.6.0 → opencode_db-0.6.1}/tests/test_commands.py +0 -0
  32. {opencode_db-0.6.0 → opencode_db-0.6.1}/tests/test_db.py +0 -0
  33. {opencode_db-0.6.0 → opencode_db-0.6.1}/tests/test_formatters.py +0 -0
  34. {opencode_db-0.6.0 → opencode_db-0.6.1}/tests/test_i18n.py +0 -0
  35. {opencode_db-0.6.0 → opencode_db-0.6.1}/tests/test_utils.py +0 -0
  36. {opencode_db-0.6.0 → opencode_db-0.6.1}/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: opencode-db
3
- Version: 0.6.0
3
+ Version: 0.6.1
4
4
  Summary: OpenCode database CLI manager — browse, export, analyze, clean up sessions
5
5
  Project-URL: Homepage, https://github.com/VasilevNStas/opencode-db
6
6
  Project-URL: Source, https://github.com/VasilevNStas/opencode-db
@@ -26,6 +26,31 @@ opencode-db costs --total # total token costs
26
26
  - OpenCode (must have been run at least once — the database is created automatically)
27
27
  - macOS / Linux
28
28
 
29
+ ### Database location
30
+
31
+ By default, `opencode-db` looks for OpenCode's database at:
32
+
33
+ ```
34
+ ~/.local/share/opencode/opencode.db
35
+ ```
36
+
37
+ If your OpenCode stores the database at a custom path, you have two options:
38
+
39
+ **1. Environment variable** — set it once in your shell profile (`.zshrc`, `.bashrc`):
40
+
41
+ ```bash
42
+ export OPENCODE_DB=/path/to/opencode.db
43
+ ```
44
+
45
+ **2. Global `--db-path` flag** — for ad-hoc use or inspecting another database:
46
+
47
+ ```bash
48
+ opencode-db --db-path /path/to/opencode.db list
49
+ opencode-db --db-path /path/to/opencode.db stats
50
+ ```
51
+
52
+ The `--db-path` flag takes precedence over the environment variable.
53
+
29
54
  ### One-command install (recommended)
30
55
 
31
56
  ```bash
@@ -8,6 +8,7 @@
8
8
  """
9
9
 
10
10
  import argparse
11
+ import os
11
12
  import sys
12
13
  from typing import Any, Literal
13
14
 
@@ -28,6 +29,12 @@ def build_parser() -> argparse.ArgumentParser:
28
29
  default=None,
29
30
  help="Output language / язык вывода (en/ru)",
30
31
  )
32
+ parser.add_argument(
33
+ "--db-path",
34
+ type=str,
35
+ default=None,
36
+ help="Path to opencode.db (default: ~/.local/share/opencode/opencode.db)",
37
+ )
31
38
 
32
39
  subparsers = parser.add_subparsers(dest="command", required=True)
33
40
  for _name, mod in commands.get_all().items():
@@ -58,6 +65,9 @@ def main(argv=None) -> Any | Literal[0] | Literal[1]:
58
65
  if args.lang:
59
66
  set_lang(args.lang)
60
67
 
68
+ if args.db_path:
69
+ os.environ["OPENCODE_DB"] = args.db_path
70
+
61
71
  db = get_db()
62
72
 
63
73
  try:
@@ -8,7 +8,9 @@ import os
8
8
 
9
9
  # --- Пути ---
10
10
  # База данных opencode. Стандартное расположение для Linux/macOS.
11
- OPENCODE_DB = os.path.expanduser("~/.local/share/opencode/opencode.db")
11
+ OPENCODE_DB = os.environ.get("OPENCODE_DB") or os.path.expanduser(
12
+ "~/.local/share/opencode/opencode.db"
13
+ )
12
14
 
13
15
  # Директории, игнорируемые при сборе snapshot'а проекта
14
16
  IGNORE_DIRS = {".git", "node_modules", ".venv", "__pycache__", ".opencode"}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: opencode-db
3
- Version: 0.6.0
3
+ Version: 0.6.1
4
4
  Summary: OpenCode database CLI manager — browse, export, analyze, clean up sessions
5
5
  Project-URL: Homepage, https://github.com/VasilevNStas/opencode-db
6
6
  Project-URL: Source, https://github.com/VasilevNStas/opencode-db
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "opencode-db"
7
- version = "0.6.0"
7
+ version = "0.6.1"
8
8
  description = "OpenCode database CLI manager — browse, export, analyze, clean up sessions"
9
9
  readme = "README_PYPI.md"
10
10
  requires-python = ">=3.12"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes