Repository: cppa-cursor-browser
Assignee: Brad @bradjin8
Severity: High
Problem
scripts/export.py operates as a ~700-line parallel implementation of the web application's data pipeline rather than a thin CLI wrapper over the service layer. It reimplements workspace scanning, database reading, conversation assembly, path normalization, and Markdown generation — logic that already exists in services/ and utils/. Functions like to_epoch_ms and normalize_file_path are copied rather than imported. This creates dual maintenance paths: a bug fix in utils/ must be independently located and replicated in the export script's private copy, with no static link between them.
Acceptance Criteria
Implementation Notes
This is the largest structural refactoring item and has a dependency on item 4 (pyproject.toml). Without an installable package path, shared-module reuse remains mechanically awkward. Recommended sequencing: land pyproject.toml first, then refactor the export script in a follow-up PR. The service layer already encapsulates the patterns the script needs — workspace_db.py, workspace_listing.py, and workspace_tabs.py are the primary targets. Start by identifying every function in export.py that has a counterpart in services/ or utils/, build an import map, and replace incrementally. Keep the CLI argument parsing and output formatting in the script; move all data-access and transformation logic to shared modules.
References
- Eval finding: test 4
- Cluster:
export-parallel-implementation
- Related files:
scripts/export.py, services/workspace_db.py, services/workspace_listing.py, services/workspace_tabs.py, utils/path_helpers.py
- Compounds: COMPOUND-A (parallel impl blocks utility consolidation), COMPOUND-C (no install path + parallel implementation)
Repository: cppa-cursor-browser
Assignee: Brad @bradjin8
Severity: High
Problem
scripts/export.pyoperates as a ~700-line parallel implementation of the web application's data pipeline rather than a thin CLI wrapper over the service layer. It reimplements workspace scanning, database reading, conversation assembly, path normalization, and Markdown generation — logic that already exists inservices/andutils/. Functions liketo_epoch_msandnormalize_file_pathare copied rather than imported. This creates dual maintenance paths: a bug fix inutils/must be independently located and replicated in the export script's private copy, with no static link between them.Acceptance Criteria
scripts/export.pydelegates workspace scanning toservices/workspace_listing.pyinstead of reimplementing itscripts/export.pydelegates database reading toservices/workspace_db.pyinstead of reimplementing itscripts/export.pydelegates conversation assembly to existing service-layer functionsto_epoch_ms,normalize_file_path, etc.) are removed; the script imports fromutils/insteadsys.path.insert(0, project_root)hack is replaced by a proper import mechanism (requires item 4 — pyproject.toml)Implementation Notes
This is the largest structural refactoring item and has a dependency on item 4 (pyproject.toml). Without an installable package path, shared-module reuse remains mechanically awkward. Recommended sequencing: land pyproject.toml first, then refactor the export script in a follow-up PR. The service layer already encapsulates the patterns the script needs —
workspace_db.py,workspace_listing.py, andworkspace_tabs.pyare the primary targets. Start by identifying every function inexport.pythat has a counterpart inservices/orutils/, build an import map, and replace incrementally. Keep the CLI argument parsing and output formatting in the script; move all data-access and transformation logic to shared modules.References
export-parallel-implementationscripts/export.py,services/workspace_db.py,services/workspace_listing.py,services/workspace_tabs.py,utils/path_helpers.py