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:
2026-03-04 19:53:55 +00:00
parent e352fd530f
commit e973b2ce20
49 changed files with 1492 additions and 3303 deletions
+71
View File
@@ -178,6 +178,77 @@ type ListSummary struct {
ClosedCards int `json:"closedCards"`
}
type User struct {
ID string `json:"id"`
Name string `json:"name"`
Username *string `json:"username"`
Email string `json:"email"`
}
// Export types - portable structs without Planka IDs
type ExportEnvelope struct {
Version int `json:"version"`
ExportedAt string `json:"exportedAt"`
Project ExportProject `json:"project"`
}
type ExportProject struct {
Name string `json:"name"`
Description *string `json:"description,omitempty"`
Boards []ExportBoard `json:"boards"`
}
type ExportBoard struct {
Name string `json:"name"`
Position float64 `json:"position"`
Lists []ExportList `json:"lists"`
Labels []ExportLabel `json:"labels"`
Cards []ExportCard `json:"cards"`
}
type ExportList struct {
Name string `json:"name"`
Position float64 `json:"position"`
Type string `json:"type"`
Color *string `json:"color,omitempty"`
}
type ExportLabel struct {
Name *string `json:"name,omitempty"`
Position float64 `json:"position"`
Color string `json:"color"`
}
type ExportCard struct {
Name string `json:"name"`
Position *float64 `json:"position,omitempty"`
ListName string `json:"listName"`
LabelNames []string `json:"labelNames,omitempty"`
Description *string `json:"description,omitempty"`
DueDate *string `json:"dueDate,omitempty"`
IsClosed bool `json:"isClosed,omitempty"`
Type string `json:"type"`
TaskLists []ExportTaskList `json:"taskLists,omitempty"`
Comments []ExportComment `json:"comments,omitempty"`
}
type ExportTaskList struct {
Name string `json:"name"`
Position float64 `json:"position"`
Tasks []ExportTask `json:"tasks"`
}
type ExportTask struct {
Name string `json:"name"`
Position float64 `json:"position"`
IsCompleted bool `json:"isCompleted"`
}
type ExportComment struct {
Text string `json:"text"`
}
type APIError struct {
StatusCode int
Message string