Skip to content

feat: add project export and import CLI commands (#1025)#98

Merged
rquidute merged 3 commits into
v2.15.1-cli-developfrom
feature/1025_project_export_import
Jun 22, 2026
Merged

feat: add project export and import CLI commands (#1025)#98
rquidute merged 3 commits into
v2.15.1-cli-developfrom
feature/1025_project_export_import

Conversation

@rquidute

Copy link
Copy Markdown
Contributor

Add 'project export' and 'project import' subcommands to the CLI, wiring up the existing backend endpoints:

  • GET /api/v1/projects/{id}/export
  • POST /api/v1/projects/import

project export:

  • Downloads the project config as a JSON file
  • Defaults to '-project-config.json' if no output file is given
  • Accepts --output-file / -o to specify a custom path

project import:

  • Accepts --file / -f pointing to a previously exported JSON file
  • Sends the file bytes to the backend and prints the new project ID

Also adds full unit test coverage in tests/test_project_commands.py (TestExportProjectCommand and TestImportProjectCommand).

Testing

  • Exporting a project
Screenshot 2026-06-22 at 11 48 04
  • Import a project
Screenshot 2026-06-22 at 11 48 16

Closes #1025

rquidute added 2 commits June 22, 2026 11:38
Add 'project export' and 'project import' subcommands to the CLI,
wiring up the existing backend endpoints:
- GET /api/v1/projects/{id}/export
- POST /api/v1/projects/import

project export:
- Downloads the project config as a JSON file
- Defaults to '<project-name>-project-config.json' if no output file is given
- Accepts --output-file / -o to specify a custom path

project import:
- Accepts --file / -f pointing to a previously exported JSON file
- Sends the file bytes to the backend and prints the new project ID

Also adds full unit test coverage in tests/test_project_commands.py
(TestExportProjectCommand and TestImportProjectCommand).

Closes #1025
…ests

- Add missing 'import json' to test_project_commands.py
- Update test_run_tests_logger_configuration to include enable_log_streaming=True
  in the expected configure_logger_for_run call, matching the actual call signature
@rquidute rquidute self-assigned this Jun 22, 2026
@mergify

mergify Bot commented Jun 22, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces new CLI commands to export and import project configurations, along with comprehensive unit and CLI tests. The feedback suggests two improvements: first, using Pydantic's native model_dump_json instead of json.dumps(model_dump()) to safely serialize the exported project configuration; second, refining the error handling when reading the import file to avoid wrapping generic OSError exceptions in a FileNotFoundError constructor, which results in confusing error messages.

Comment thread th_cli/commands/project.py Outdated
Comment thread th_cli/commands/project.py Outdated
- Use model_dump_json(indent=2) instead of model_dump() + json.dumps()
  to correctly serialize Pydantic models with non-standard types
- Split OSError handling in _import_project into FileNotFoundError
  and generic OSError to avoid broken error messages from wrapping
  OSError in FileNotFoundError
@rquidute rquidute requested review from antonio-amjr and oxesoft June 22, 2026 14:56
@rquidute rquidute merged commit 34de9c3 into v2.15.1-cli-develop Jun 22, 2026
3 of 4 checks passed
@rquidute rquidute deleted the feature/1025_project_export_import branch June 22, 2026 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants