2.4 KiB
Market Backend Metrics CSV 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: Extend CSV export so it appends the six backend metrics already stored on each market record.
Architecture: Keep the existing export flow intact and modify only the CSV column definition layer. Reuse MarketRecord.backendMetrics as the sole source for the six new CSV columns so the exported data matches what the plugin already loaded into memory.
Tech Stack: TypeScript, existing market CSV exporter, Vitest
File Map
- Modify:
src/content/market/csv-exporter.ts- Append six backend metrics columns after existing CSV columns.
- Modify:
tests/csv-exporter.test.ts- Add failing tests for backend metric headers and values.
Task 1: Backend Metrics CSV Columns
Files:
-
Modify:
tests/csv-exporter.test.ts -
Modify:
src/content/market/csv-exporter.ts -
Step 1: Write the failing CSV exporter tests
Add tests for:
-
the six backend metric headers appended after current columns
-
backend metric values exported from
record.backendMetrics -
blank cells when
backendMetricsis absent -
Step 2: Run test to verify it fails
Run: npm test -- tests/csv-exporter.test.ts
Expected: FAIL because the exporter does not include backend metric columns yet.
- Step 3: Write the minimal exporter change
Append these six columns:
看后搜率看后搜数新增A3数新增A3率CPA3cp_search
Each column reads from:
-
record.backendMetrics?.afterViewSearchRate -
record.backendMetrics?.afterViewSearchCount -
record.backendMetrics?.a3IncreaseCount -
record.backendMetrics?.newA3Rate -
record.backendMetrics?.cpa3 -
record.backendMetrics?.cpSearch -
Step 4: Run test to verify it passes
Run: npm test -- tests/csv-exporter.test.ts
Expected: PASS
- Step 5: Run full verification
Run:
npm test
npm run build
Expected:
-
full test suite passes
-
build succeeds
-
Step 6: Commit
git add src/content/market/csv-exporter.ts tests/csv-exporter.test.ts docs/superpowers/specs/2026-04-22-market-backend-metrics-csv-design.md docs/superpowers/plans/2026-04-22-market-backend-metrics-csv.md
git commit -m "feat: export backend metrics in csv"