Files
cmshoppe/docs/current-state.md
T
chengmaandClaude Opus 4.8 479d02a2b8 docs: 初始化 cmshopee 文档、设计与项目骨架
- docs/ 完整 harness coding 文档集(愿景/需求/技术栈/架构/编码规则/任务/api/routes/current-state)
- 5 Tab 流水线设计 + UI 效果图 SVG(docs/ui/)
- cdp.py CDP 底座;prototypes/ 已验证原型脚本(待 editor.py 移植后清理)
- AGENTS.md/CLAUDE.md 入口、progress.md 执行流水、.gitignore(排除凭证/DB/图片)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-26 15:30:37 +08:00

86 lines
4.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 当前实现状态
> 本文是可覆盖的当前快照,记录代码与任务看板的现实状态。
> 历史执行流水追加到 [`../progress.md`](../progress.md),不在本文重复完整日志。
## 当前快照
- 日期:2026-06-25
- 阶段:单账号 CDP 流程已验证;多账号管理 + 5 Tab GUI + Excel/AI 流水线为既定设计,尚未开始编码。
- 技术栈:Python 3.10+,自研 CDP(websocket-client + requests),SQLite(sqlite3)+ `config.json` + openpyxl + AI(服务商待定),GUI Tkinter 5 Tab(待最终确认)。
- 生产代码:尚无 `appconfig/db/excel/config/chrome/editor/gui`;现有为验证脚本 + `cdp.py`。
- 测试:以 `py_compile` + 在测试商品上手动跑 `prototypes/demo.py` 为主,无自动化测试。
- 数据:无 `config.json`、`cmshopee.db`、`chrome_user_data_dir/`(待 Phase 0/1 建立)。
## 既定设计要点(文档已定)
- GUI:**5 Tab 流水线**,顺序 ① 导入采集 → ② AI生成 → ③ 更新shopee → ④ 账号管理 → ⑤ 设置。
- 流水线阶段:imported → collected(采集旧标题/旧封面+下载+回写)→ generated(AI 提示词生成新标题/新封面)→ applied(改 Shopee 并直接提交)。**无 confirmed、无提交开关。**
- 存储:`config.json`(应用设置含 AI Key)+ SQLite `cmshopee.db`(账号/任务/各阶段结果)+ openpyxl(Excel)+ 本地 `images/`(旧/新封面)。
- 多账号隔离:每账号独立 user-data-dir(非 profile)。
- 账号↔任务绑定:以 Excel“别名”列为权威;未匹配略过,结束弹窗汇总。
- 执行:多账号串行、单条失败继续;③ 执行即点「更新」提交线上(无确认、无开关)。
- AI:服务商待定;生成内容直接用于更新,本地留档+回写 Excel 供追溯。
- 登录:人工登录 + 程序检测,不自动登录;首次未配账号/未登录时 ① ③ 禁用并引导去④。
## 当前目录要点
| 路径 | 状态 | 说明 |
| --- | --- | --- |
| `docs/` | 已有 | 本 harness coding 文档集合 |
| `cdp.py` | 已有 | CDP 底座:连接/找 tab/开 tab/执行 JS/拖拽(正式模块,留根目录) |
| `prototypes/` | 已有 | 已验证原型/探查脚本(demo/set_title/set_cover/get_title/cookies/inspect_images/grab/1.py),逻辑待并入 `editor.py` 后清理;见 `prototypes/README.md` |
| `chrome-remote-debug-lan.md` | 已有 | WSL→Windows CDP 转发排查记录 |
| `appconfig.py` / `db.py` / `excel.py` / `config.py` / `chrome.py` / `editor.py` / `gui.py` | 待建 | Phase 0-3 产出 |
| `config.json` / `cmshopee.db` / `chrome_user_data_dir/` | 待建 | 含配置/业务/凭证,须 gitignore |
## 已验证能力(单账号)
- CDP 连接 Chrome、遍历 tab、读取 shopee.tw Cookie。
- 找到/新建商品详情页 tab,等编辑器就绪。
- 改标题:原生 setter + 派发事件,`value` 与 `modelvalue` 双等于新值。
- 换封面:`setFileInputFiles` 上传(`.shopee-image-manager__upload input[type=file]`)→ 等 CDN 链接 → `Input.dispatchMouseEvent` 拖到第一位(落点 `first.left - 0.30*w`)。
- 「更新」按钮:可点才点,禁用态识别;默认不提交。
## 任务看板状态
任务状态以 [`06-tasks.md`](06-tasks.md) 为准,历史记录见 [`../progress.md`](../progress.md)。
- 已完成:无(任务均为 TODO;单账号能力以脚本形式存在,待 T-001 模块化)。
- 正在进行:无。
- 下一个可领取任务:Phase 0 的 **T-001(`editor.py` 含采集)/ T-002(`appconfig.py`+`config.json`)/ T-003(`db.py`+SQLite)**——三者无相互依赖,可任选其一起步。
## 当前可运行内容
```bash
# 语法检查
python -m py_compile *.py
# 单账号闭环(不提交线上)
python prototypes/demo.py # 分步(需根目录 cdp.py 可导入)
set AUTO=1 && python prototypes/demo.py # 自动(cmd)
# 真实提交(谨慎)
set UPDATE=1 && python prototypes/demo.py
```
前置条件:
- Chrome 已用某 user-data-dir 带 `--remote-debugging-port` + `--remote-allow-origins=*` 启动并登录 Shopee。
- 已 `pip install websocket-client requests`。
- 默认连 `127.0.0.1:9222`(开发期可用 `CDP_HOST` 指向 WSL 转发的 `192.168.0.224:9333`)。
## 开始编码前检查
1. 读仓库级 `AGENTS.md` / `CLAUDE.md`(如有)。
2. 读 `docs/00-ai-start-here.md`。
3. 读 `docs/05-coding-rules.md` 与 `docs/04-architecture.md` 第四节。
4. 在 `docs/06-tasks.md` 取第一个 `TODO` 且依赖 `DONE` 的任务。
5. 将该任务状态改为 `DOING`。
## 维护规则
- 新建 `config/chrome/editor/gui` 或改 CDP 选择器后,更新本文与 `04-architecture.md`。
- 任务状态变化同步 [`06-tasks.md`](06-tasks.md);执行记录追加 [`../progress.md`](../progress.md)。
- 本文只保留当前快照,不保留完整历史。