Skip to content

Conversation

@piekstra
Copy link
Contributor

[7]

Add CLI flags to export installed plugins to a JSON file and import them on another machine or project.

Summary

  • Add --export <file> / -e <file> flag to export installed plugins to JSON
  • Add --import <file> / -i <file> flag to import plugins from a JSON file
  • Export format includes plugin ID, scope, and enabled state
  • Import shows confirmation prompt listing plugins to install
  • Skip already-installed plugins during import

Export format

{
  "version": 1,
  "plugins": [
    {"id": "plugin@marketplace", "scope": "user", "enabled": true},
    {"id": "other@marketplace", "scope": "project", "enabled": false}
  ]
}

Test plan

  • Run cpm --export plugins.json and verify JSON file is created with correct format
  • Run cpm --import plugins.json and verify confirmation prompt appears
  • Verify skipped plugins are reported correctly
  • Run cpm --help and verify new flags are documented

Add CLI flags to export installed plugins to a JSON file and import
them on another machine or project.

Export format includes plugin ID, scope, and enabled state.
Import shows a confirmation prompt before installing missing plugins.

[7]
- Fix file permissions: use 0o600 instead of 0o644 (gosec G306)
- Reorder ExportFile struct for optimal memory alignment

[7]
The Claude CLI returns different JSON formats depending on the
--available flag:
- With --available: {installed: [...], available: [...]}
- Without --available: [...] (just installed plugins array)

This updates ListPlugins to parse both formats correctly.

[7]
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.

2 participants