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.
This commit is contained in:
@@ -8,6 +8,7 @@ A command-line interface for interacting with the [Planka](https://planka.app/)
|
||||
- **JSON-first output** - Machine-parseable by default, with optional table format for humans
|
||||
- **Environment-based auth** - Configure once via environment variables
|
||||
- **Full CRUD operations** - Manage cards, comments, tasks, labels, and more
|
||||
- **Project export/import** - Portable JSON backup and migration between instances
|
||||
- **Cursor-based pagination** - Automatic handling of paginated API responses
|
||||
- **Structured logging** - Debug-level HTTP request/response logging available
|
||||
|
||||
@@ -67,8 +68,21 @@ pcli project list
|
||||
|
||||
# Get a specific project
|
||||
pcli project get <project-id>
|
||||
|
||||
# Create a project (type: private or shared)
|
||||
pcli project create --name "My Project" --type private
|
||||
|
||||
# Export a project (all boards, or filter by board)
|
||||
pcli project export <project-id-or-name> > backup.json
|
||||
pcli project export "My Project" --board "Sprint Board" > board-backup.json
|
||||
|
||||
# Import a project from JSON
|
||||
pcli project import --file backup.json
|
||||
pcli project import < backup.json
|
||||
```
|
||||
|
||||
**Note on project types:** Planka v2 accepts `private` or `shared` (not `public`). Use `private` for projects visible only to members, `shared` for projects visible to all users.
|
||||
|
||||
### Boards
|
||||
|
||||
```bash
|
||||
@@ -263,16 +277,23 @@ pcli card list --list <source-list-id> | jq -r '.data[].id' | while read card_id
|
||||
done
|
||||
```
|
||||
|
||||
### Export board structure
|
||||
### Export and import a project
|
||||
|
||||
```bash
|
||||
# Get board with all lists
|
||||
pcli board get <board-id> > board.json
|
||||
# Export entire project to portable JSON
|
||||
pcli project export "My Project" > project-backup.json
|
||||
|
||||
# Get all cards for the board
|
||||
pcli card list --board <board-id> > cards.json
|
||||
# Export a single board
|
||||
pcli project export "My Project" --board "Sprint Board" > board-backup.json
|
||||
|
||||
# Import to another instance
|
||||
PLANKA_URL=https://other.planka.example pcli project import --file project-backup.json
|
||||
```
|
||||
|
||||
Export uses names (not IDs) so the file is portable across instances. Import creates all resources with fresh IDs. If the project already exists on the target, boards are added to it — but import fails if a board with the same name already exists under that project.
|
||||
|
||||
Comments are exported with a `(Original comment by <username>)` text prefix to preserve attribution, since user IDs are not portable.
|
||||
|
||||
## Future Enhancements
|
||||
|
||||
The following improvements are planned for future releases:
|
||||
@@ -287,6 +308,8 @@ The following improvements are planned for future releases:
|
||||
|
||||
Built against Planka v2.0 API. See `planka-api.json` for the full OpenAPI specification.
|
||||
|
||||
**Note:** Planka v2 project types are `private` and `shared` (not `public` as in earlier versions).
|
||||
|
||||
## Contributing
|
||||
|
||||
Contributions welcome! Please open an issue or pull request on [GitLab](https://git.franklin.lab/steve.cliff/pcli).
|
||||
|
||||
Reference in New Issue
Block a user