earshot-cli 0.2.0__tar.gz → 0.3.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 (34) hide show
  1. {earshot_cli-0.2.0 → earshot_cli-0.3.0}/PKG-INFO +4 -3
  2. {earshot_cli-0.2.0 → earshot_cli-0.3.0}/README.md +3 -2
  3. {earshot_cli-0.2.0 → earshot_cli-0.3.0}/pyproject.toml +1 -1
  4. {earshot_cli-0.2.0 → earshot_cli-0.3.0}/src/earshot/cli.py +19 -0
  5. earshot_cli-0.3.0/tests/test_me.py +51 -0
  6. {earshot_cli-0.2.0 → earshot_cli-0.3.0}/.github/workflows/ci.yml +0 -0
  7. {earshot_cli-0.2.0 → earshot_cli-0.3.0}/.github/workflows/publish.yml +0 -0
  8. {earshot_cli-0.2.0 → earshot_cli-0.3.0}/.gitignore +0 -0
  9. {earshot_cli-0.2.0 → earshot_cli-0.3.0}/LICENSE +0 -0
  10. {earshot_cli-0.2.0 → earshot_cli-0.3.0}/scripts/download_models.sh +0 -0
  11. {earshot_cli-0.2.0 → earshot_cli-0.3.0}/src/earshot/__init__.py +0 -0
  12. {earshot_cli-0.2.0 → earshot_cli-0.3.0}/src/earshot/auth.py +0 -0
  13. {earshot_cli-0.2.0 → earshot_cli-0.3.0}/src/earshot/capture.py +0 -0
  14. {earshot_cli-0.2.0 → earshot_cli-0.3.0}/src/earshot/compose.py +0 -0
  15. {earshot_cli-0.2.0 → earshot_cli-0.3.0}/src/earshot/config.py +0 -0
  16. {earshot_cli-0.2.0 → earshot_cli-0.3.0}/src/earshot/deliver.py +0 -0
  17. {earshot_cli-0.2.0 → earshot_cli-0.3.0}/src/earshot/extract.py +0 -0
  18. {earshot_cli-0.2.0 → earshot_cli-0.3.0}/src/earshot/live.py +0 -0
  19. {earshot_cli-0.2.0 → earshot_cli-0.3.0}/src/earshot/models.py +0 -0
  20. {earshot_cli-0.2.0 → earshot_cli-0.3.0}/src/earshot/subtitle.py +0 -0
  21. {earshot_cli-0.2.0 → earshot_cli-0.3.0}/src/earshot/transcribe.py +0 -0
  22. {earshot_cli-0.2.0 → earshot_cli-0.3.0}/src/earshot/transcribe_cloud.py +0 -0
  23. {earshot_cli-0.2.0 → earshot_cli-0.3.0}/tests/conftest.py +0 -0
  24. {earshot_cli-0.2.0 → earshot_cli-0.3.0}/tests/test_auth.py +0 -0
  25. {earshot_cli-0.2.0 → earshot_cli-0.3.0}/tests/test_compose.py +0 -0
  26. {earshot_cli-0.2.0 → earshot_cli-0.3.0}/tests/test_config.py +0 -0
  27. {earshot_cli-0.2.0 → earshot_cli-0.3.0}/tests/test_deliver.py +0 -0
  28. {earshot_cli-0.2.0 → earshot_cli-0.3.0}/tests/test_deliver_api.py +0 -0
  29. {earshot_cli-0.2.0 → earshot_cli-0.3.0}/tests/test_do_deliver.py +0 -0
  30. {earshot_cli-0.2.0 → earshot_cli-0.3.0}/tests/test_extract.py +0 -0
  31. {earshot_cli-0.2.0 → earshot_cli-0.3.0}/tests/test_live.py +0 -0
  32. {earshot_cli-0.2.0 → earshot_cli-0.3.0}/tests/test_subtitle.py +0 -0
  33. {earshot_cli-0.2.0 → earshot_cli-0.3.0}/tests/test_wizard.py +0 -0
  34. {earshot_cli-0.2.0 → earshot_cli-0.3.0}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: earshot-cli
3
- Version: 0.2.0
3
+ Version: 0.3.0
4
4
  Summary: 旁听剪藏:跨平台桌面端系统声录制 → 本地转写 → 投递知识库(默认 ExoMind,可插拔)
5
5
  Project-URL: Homepage, https://github.com/helloworldtang/earshot
6
6
  Project-URL: Repository, https://github.com/helloworldtang/earshot
@@ -60,7 +60,7 @@ uv tool upgrade earshot-cli
60
60
  源码安装请**锁版本 tag**,不要引滚动的 `main`(消费方 `uv sync`/`pip install` 会隐性升级到未审阅代码;升级应当是显式改版本号的决策):
61
61
 
62
62
  ```bash
63
- uv tool install "earshot-cli @ https://github.com/helloworldtang/earshot/archive/refs/tags/v0.2.0.tar.gz"
63
+ uv tool install "earshot-cli @ https://github.com/helloworldtang/earshot/archive/refs/tags/v0.3.0.tar.gz"
64
64
  ```
65
65
 
66
66
  - **零系统依赖**:ffmpeg 已随 Python wheel 内置([imageio-ffmpeg](https://pypi.org/project/imageio-ffmpeg),MoviePy 同款),无需 brew/apt。
@@ -104,7 +104,8 @@ earshot audio recording.mp4 --title "通勤听书笔记" --deliver none
104
104
  # 补投/重投 outbox 里的笔记(如环境问题当时没投出去)
105
105
  earshot deliver ~/.earshot/outbox/20261030-xxxx.md
106
106
 
107
- # 列出采集设备 / 环境自检 / 清理过期留档
107
+ # 查看凭据状态 / 列出采集设备 / 环境自检 / 清理过期留档
108
+ earshot me
108
109
  earshot devices
109
110
  earshot doctor
110
111
  earshot clean --days 30
@@ -27,7 +27,7 @@ uv tool upgrade earshot-cli
27
27
  源码安装请**锁版本 tag**,不要引滚动的 `main`(消费方 `uv sync`/`pip install` 会隐性升级到未审阅代码;升级应当是显式改版本号的决策):
28
28
 
29
29
  ```bash
30
- uv tool install "earshot-cli @ https://github.com/helloworldtang/earshot/archive/refs/tags/v0.2.0.tar.gz"
30
+ uv tool install "earshot-cli @ https://github.com/helloworldtang/earshot/archive/refs/tags/v0.3.0.tar.gz"
31
31
  ```
32
32
 
33
33
  - **零系统依赖**:ffmpeg 已随 Python wheel 内置([imageio-ffmpeg](https://pypi.org/project/imageio-ffmpeg),MoviePy 同款),无需 brew/apt。
@@ -71,7 +71,8 @@ earshot audio recording.mp4 --title "通勤听书笔记" --deliver none
71
71
  # 补投/重投 outbox 里的笔记(如环境问题当时没投出去)
72
72
  earshot deliver ~/.earshot/outbox/20261030-xxxx.md
73
73
 
74
- # 列出采集设备 / 环境自检 / 清理过期留档
74
+ # 查看凭据状态 / 列出采集设备 / 环境自检 / 清理过期留档
75
+ earshot me
75
76
  earshot devices
76
77
  earshot doctor
77
78
  earshot clean --days 30
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "earshot-cli"
3
- version = "0.2.0"
3
+ version = "0.3.0"
4
4
  description = "旁听剪藏:跨平台桌面端系统声录制 → 本地转写 → 投递知识库(默认 ExoMind,可插拔)"
5
5
  readme = "README.md"
6
6
  license = "MIT"
@@ -78,6 +78,8 @@ def build_parser() -> argparse.ArgumentParser:
78
78
  )
79
79
  p_deliver.add_argument("--webhook", help="webhook 地址(--deliver webhook 时必填)")
80
80
 
81
+ sub.add_parser("me", help="显示凭据状态与服务连通性")
82
+
81
83
  p_login = sub.add_parser("login", help="设备流登录 exomind(免装 emcli,写入 ~/.exomind/config.json)")
82
84
  p_login.add_argument("--base-url", default=DEFAULT_EXOMIND_BASE_URL, help="exomind API 地址")
83
85
  p_login.add_argument("--force", action="store_true", help="跳过「凭据仍有效」检查,无条件重新登录")
@@ -513,6 +515,22 @@ def cmd_clean(args: argparse.Namespace, settings: Settings) -> int:
513
515
  return EXIT_OK
514
516
 
515
517
 
518
+ def cmd_me(_args: argparse.Namespace, settings: Settings) -> int:
519
+ """显示凭据状态与服务连通性(与 wxpub/emcli me 对齐)。"""
520
+ print(f"服务地址:{settings.exomind_base_url}")
521
+ if not settings.exomind_api_key:
522
+ print("凭据:未配置(earshot login,或设 EXOMIND_API_KEY 环境变量)")
523
+ return EXIT_FAIL
524
+ key = settings.exomind_api_key
525
+ masked = f"{key[:8]}…{key[-4:]}" if len(key) > 12 else key
526
+ print(f"凭据:{masked}")
527
+ if verify_key(settings.exomind_base_url, key):
528
+ print("凭据状态:有效")
529
+ return EXIT_OK
530
+ print("凭据状态:无效或服务不可达(重登用: earshot login --force)")
531
+ return EXIT_FAIL
532
+
533
+
516
534
  def cmd_login(args: argparse.Namespace, settings: Settings) -> int:
517
535
  """设备流登录 exomind:已有凭据探活仍有效则直接返回(与 emcli/wxpub 同款智能登录)。"""
518
536
  base_url = args.base_url
@@ -543,6 +561,7 @@ def main(argv: list[str] | None = None) -> int:
543
561
  "video": cmd_video,
544
562
  "deliver": cmd_deliver,
545
563
  "login": cmd_login,
564
+ "me": cmd_me,
546
565
  "devices": cmd_devices,
547
566
  "doctor": cmd_doctor,
548
567
  "clean": cmd_clean,
@@ -0,0 +1,51 @@
1
+ """cmd_me 测试:凭据状态展示三分支(有效/无效/未配置),探活注入不联网。"""
2
+
3
+ from __future__ import annotations
4
+
5
+ import argparse
6
+ from pathlib import Path
7
+
8
+ import pytest
9
+
10
+ from earshot.cli import cmd_me
11
+ from earshot.config import Settings
12
+
13
+
14
+ def _settings(api_key: str = "") -> Settings:
15
+ return Settings(
16
+ home=Path("/tmp/earshot-test"),
17
+ model_root=Path("/tmp/earshot-test/models"),
18
+ exomind_base_url="https://exomind.example",
19
+ exomind_api_key=api_key,
20
+ )
21
+
22
+
23
+ def test_me_valid_key(
24
+ monkeypatch: pytest.MonkeyPatch,
25
+ capsys: pytest.CaptureFixture[str],
26
+ ) -> None:
27
+ monkeypatch.setattr("earshot.cli.verify_key", lambda base, key: True)
28
+ code = cmd_me(argparse.Namespace(), _settings("sk_live_valid_key"))
29
+ out = capsys.readouterr().out
30
+ assert code == 0
31
+ assert "https://exomind.example" in out
32
+ assert "sk_live_…_key" in out, "凭据掩码展示"
33
+ assert "凭据状态:有效" in out
34
+
35
+
36
+ def test_me_invalid_key(
37
+ monkeypatch: pytest.MonkeyPatch,
38
+ capsys: pytest.CaptureFixture[str],
39
+ ) -> None:
40
+ monkeypatch.setattr("earshot.cli.verify_key", lambda base, key: False)
41
+ code = cmd_me(argparse.Namespace(), _settings("sk_live_invalid_"))
42
+ out = capsys.readouterr().out
43
+ assert code == 1
44
+ assert "earshot login --force" in out, "无效要指路重登"
45
+
46
+
47
+ def test_me_no_key(capsys: pytest.CaptureFixture[str]) -> None:
48
+ code = cmd_me(argparse.Namespace(), _settings(""))
49
+ out = capsys.readouterr().out
50
+ assert code == 1
51
+ assert "未配置" in out and "earshot login" in out
File without changes
File without changes
File without changes