Files
pcli/openspec/changes/archive/2026-03-04-project-export-import/tasks.md
T
steve e973b2ce20 feat: add project export and import functionality
- Implemented `pcli project export` command to export project hierarchy as JSON.
- Added `pcli project import` command to import project data from JSON.
- Created user client to fetch user details for comment attribution.
- Introduced new data structures for export and import processes.
- Ensured name-based references in exports and handled conflicts during imports.
- Added versioning and progress reporting for import operations.
- Updated documentation and specifications for new features.
2026-03-04 19:53:55 +00:00

1.7 KiB

1. Model & Types

  • 1.1 Add User struct to model/types.go (id, name, username, email)
  • 1.2 Add export-specific portable types to model/types.go: ExportEnvelope, ExportProject, ExportBoard, ExportList, ExportLabel, ExportCard, ExportTaskList, ExportTask, ExportComment

2. User Client

  • 2.1 Create client/users.go with ListUsers() method (GET /api/users)

3. Project Export

  • 3.1 Create client/export.go with ExportProject(ctx, projectID, boardFilter) method that orchestrates data gathering: fetch users (build userId→name map), fetch board(s) with included data, fetch per-card comments/task lists/tasks, assemble into portable export types
  • 3.2 Create cmd/export.go with project export <project-id-or-name> [--board <name-or-id>] command: resolve project by name or ID, call ExportProject, marshal JSON to stdout
  • 3.3 Add project name/ID resolution helper: list projects, match by ID or exact name, error on ambiguous match

4. Project Import

  • 4.1 Create client/import.go with ImportProject(ctx, export) method that: resolves/creates project by name, checks board name conflicts (fail-fast), creates boards → lists → labels → cards → card-labels → task lists → tasks → comments in order, maintains name→ID maps at each level, reports progress to stderr
  • 4.2 Create cmd/import.go with project import [--file <path>] command: read JSON from stdin or file, unmarshal, validate version, call ImportProject

5. Wire Up & Integration

  • 5.1 Register export and import subcommands under project command in cmd/root.go or cmd/project.go
  • 5.2 End-to-end test: export a project, import to same instance under different project name, verify structure matches