-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimize plugin namespace #139
Conversation
WalkthroughThe pull request modifies the Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/AppStore/src/Command/CreateCommand.php (2)
72-75
: Add path format validationWhile the path handling is improved, consider adding validation for the plugin path format to ensure it follows the expected structure (e.g., vendor/plugin-name).
public function createMineJson(string $path, string $name, PluginTypeEnum $pluginType): void { $pluginPath = Str::replace(Plugin::PLUGIN_PATH . '/', '', $path); + if (!preg_match('/^[a-z0-9-]+\/[a-z0-9-]+$/', $pluginPath)) { + throw new \InvalidArgumentException('Plugin path must follow format: vendor/plugin-name'); + } $output = new \stdClass(); $output->name = $pluginPath ?? $name;
Line range hint
156-160
: Maintain consistency in option namingThe shorthand 'desc' for description option differs from the pattern used by other options. Consider using 'description' instead of 'desc' to maintain consistency with other option names.
$this->addArgument('path', InputArgument::REQUIRED, 'Plugin Path') ->addOption('name', 'name', InputOption::VALUE_REQUIRED, 'Plug-in Name') ->addOption('type', 'type', InputOption::VALUE_OPTIONAL, 'Plugin type, default mix optional mix,frond,backend') - ->addOption('description', 'desc', InputOption::VALUE_OPTIONAL, 'Plug-in Introduction') + ->addOption('description', 'description', InputOption::VALUE_OPTIONAL, 'Plug-in Introduction') ->addOption('author', 'author', InputOption::VALUE_OPTIONAL, 'Plugin Author Information');
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/AppStore/src/Command/CreateCommand.php
(1 hunks)
🔇 Additional comments (1)
src/AppStore/src/Command/CreateCommand.php (1)
72-75
: Verify plugin path usage across the codebase
The changes to plugin path handling might affect existing plugins or related functionality.
✅ Verification successful
Let me check the actual usage of Plugin::PLUGIN_PATH in the files to understand the impact.
Path handling changes are consistent with existing usage
The changes to plugin path handling in CreateCommand.php are consistent with the codebase's existing pattern:
- AppStoreServiceImpl uses Plugin::PLUGIN_PATH for download/extraction operations
- InitialCommand uses it for directory creation
- CreateCommand's path manipulation maintains the expected structure where:
- Full paths are used for file operations (exists checks, creation)
- Relative paths are used for namespace and configuration generation
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check for other uses of Plugin::PLUGIN_PATH and potential impacts
rg -l "Plugin::PLUGIN_PATH" --type php
# Check for existing mine.json files to understand current path patterns
fd -e json mine.json
# Look for other methods that might be affected by the path handling changes
ast-grep --pattern 'function $_(string $path, $_) { $$$ }'
Length of output: 263
Script:
#!/bin/bash
# Check the context of Plugin::PLUGIN_PATH usage in other files
rg "Plugin::PLUGIN_PATH" -B 2 -A 2 --type php
# Check for any path manipulation methods in these files
rg "Str::replace.*path" -B 2 -A 2 --type php
Length of output: 4064
Summary by CodeRabbit
New Features
Bug Fixes