# 星图达人视频传播数据导出 Implementation Plan > **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. **Goal:** 导出 CSV 前按配置调用 `get_author_spread_info`,追加个人视频和星图视频传播指标列。 **Architecture:** 新增独立的 spread-info 模块负责参数配置、URL、响应映射和并发加载;列表解析保留 `authorId`,额外保存 `spreadAuthorId` 作为 `o_author_id`;CSV exporter 只负责把已加载的 spread metrics 输出成列。导出入口在生成 CSV 前补齐 spread metrics。 **Tech Stack:** TypeScript, Chrome content script, Vitest, jsdom. --- ### Task 1: Spread Info Client And Mapping **Files:** - Create: `src/content/market/spread-info.ts` - Modify: `src/content/market/types.ts` - Test: `tests/spread-info.test.ts` - [ ] **Step 1: Write failing tests** Cover URL construction, label/header generation, response mapping, personal-video fixed params, and Xingtu-video multi-param configs. - [ ] **Step 2: Run failing tests** Run: `npx vitest run tests/spread-info.test.ts` Expected: FAIL because `spread-info.ts` does not exist. - [ ] **Step 3: Implement spread-info module and types** Implement typed configs, formatter helpers, response mapper, client, and limited-concurrency loader. - [ ] **Step 4: Run tests** Run: `npx vitest run tests/spread-info.test.ts` Expected: PASS. ### Task 2: Preserve Spread Author ID From Search Rows **Files:** - Modify: `src/content/market/types.ts` - Modify: `src/content/market/market-list-row.ts` - Modify: `src/content/market/page-bridge.ts` - Test: `tests/market-page-bridge.test.ts` - Test: `tests/silent-export-controller.test.ts` - [ ] **Step 1: Write failing tests** Verify `attribute_datas.id` is retained as `spreadAuthorId` and preferred over top-level `star_id` for spread-info requests. - [ ] **Step 2: Run failing tests** Run focused tests for row parsing and silent export. - [ ] **Step 3: Implement parser changes** Store `spreadAuthorId` on snapshots and merge it in result store. - [ ] **Step 4: Run focused tests** Expected: PASS. ### Task 3: CSV Columns **Files:** - Modify: `src/content/market/csv-exporter.ts` - Test: `tests/csv-exporter.test.ts` - [ ] **Step 1: Write failing tests** Verify spread headers append after backend metrics and blank cells are exported when metrics are absent. - [ ] **Step 2: Implement CSV spread columns** Read `record.spreadMetrics` by generated header names. - [ ] **Step 3: Run focused tests** Run: `npx vitest run tests/csv-exporter.test.ts` Expected: PASS. ### Task 4: Export Hydration **Files:** - Modify: `src/content/market/index.ts` - Modify: `src/content/market/result-store.ts` - Test: `tests/market-content-entry.test.ts` - [ ] **Step 1: Write failing tests** Verify export calls spread-info with `spreadAuthorId`, waits before CSV generation, preserves row order, and leaves blanks on failure. - [ ] **Step 2: Implement hydration** Inject `loadSpreadMetrics` for tests, default to spread-info loader, and hydrate records before `buildCsv`. - [ ] **Step 3: Run focused tests** Run focused content-entry tests. ### Task 5: Final Verification - [ ] Run `npm test`. - [ ] Run `npm run build`. - [ ] Review `git diff`.