Skip to content

refactor: rename use to focus and add device persistence - #35

Merged
codeasier merged 1 commit into
mainfrom
refactor/rename-use-to-focus
Apr 18, 2026
Merged

codeasier merged 1 commit into
mainfrom
refactor/rename-use-to-focus

Conversation

@codeasier

Copy link
Copy Markdown
Owner

📝 Description

将 pt-snap use 重命名为 pt-snap focus,同时将底层的"上下文"概念从 context 改为 focus,避免与 LLM 上下文混淆。新增 device_id 持久化能力,使得后续查询无需重复指定 --device。

核心改动:

  • pt-snap use → pt-snap focus(新增 --device/-d 选项)
  • context.json → focus.json,current_db_path → db_path
  • focus.json 新增 device_id 字段,支持 pt-snap focus --device N 独立更新设备
  • pt-snap query 自动使用 focus 中的 device(优先级:显式 --device > focused device > 首个发现)
  • 向后兼容:旧格式 current_db_path key 可被透明读取
  • 更新全部文档、测试(226 测试通过)、自动补全

🔗 Related Issue

Fixes #32

🧪 Testing

  • Tests added/updated
  • Manual testing completed

✅ Checklist

  • Code follows project guidelines
  • Documentation updated
  • No new warnings introduced
  • Changes tested locally

📋 Additional Notes

新增用法

# 设置数据库和设备
pt-snap focus snapshot.db --device 0

# 仅切换设备
pt-snap focus --device 1

# 查看当前焦点
pt-snap focus

Rename the database selection system from "context" to "focus" to avoid
confusion with LLM context, and replace the vague "use" command with
"focus" which better conveys setting the current analysis target.

- pt-snap use -> pt-snap focus (with new --device/-d option)
- context.json -> focus.json, current_db_path -> db_path
- Add device_id persistence alongside db_path
- Query auto-uses focused device when --device is not specified
- Backward compat: old current_db_path key still readable
- Update all docs, tests, and completion functions

Fixes #32
@codeasier
codeasier merged commit 1b4bcf1 into main Apr 18, 2026
5 checks passed
@codeasier
codeasier deleted the refactor/rename-use-to-focus branch April 18, 2026 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] 重命名 use 为 focus 并支持持久化 device 设置

1 participant