Add custom parser for props["pluginctl"] with ignore assets support
- Add PluginCtlConfig struct with IgnoreAssets field for glob patterns - Add ParsePluginCtlConfig function to parse manifest props["pluginctl"] - Update updateassets command to respect ignore patterns with glob matching - Add comprehensive logging when files are skipped due to ignore patterns - Support patterns like *.test.js, build/, node_modules for flexible exclusion - Add extensive tests for config parsing and path matching functionality - Maintain backward compatibility with existing manifests - Fix Makefile check-changes target and add logger init to tests 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
4d9c958fc9
commit
873bf78c22
5 changed files with 320 additions and 6 deletions
36
plugin.go
36
plugin.go
|
@ -11,6 +11,11 @@ import (
|
|||
|
||||
const PluginManifestName = "plugin.json"
|
||||
|
||||
// PluginCtlConfig represents the configuration for pluginctl stored in the manifest props.
|
||||
type PluginCtlConfig struct {
|
||||
IgnoreAssets []string `json:"ignore_assets,omitempty"`
|
||||
}
|
||||
|
||||
// LoadPluginManifest loads and parses the plugin.json file from the current directory.
|
||||
func LoadPluginManifest() (*model.Manifest, error) {
|
||||
return LoadPluginManifestFromPath(".")
|
||||
|
@ -78,3 +83,34 @@ func GetEffectivePluginPath(flagPath string) string {
|
|||
|
||||
return cwd
|
||||
}
|
||||
|
||||
// ParsePluginCtlConfig extracts and parses the pluginctl configuration from the manifest props.
|
||||
func ParsePluginCtlConfig(manifest *model.Manifest) (*PluginCtlConfig, error) {
|
||||
// Default configuration
|
||||
config := &PluginCtlConfig{
|
||||
IgnoreAssets: []string{},
|
||||
}
|
||||
|
||||
// Check if props exist
|
||||
if manifest.Props == nil {
|
||||
return config, nil
|
||||
}
|
||||
|
||||
// Check if pluginctl config exists in props
|
||||
pluginctlData, exists := manifest.Props["pluginctl"]
|
||||
if !exists {
|
||||
return config, nil
|
||||
}
|
||||
|
||||
// Convert to JSON and parse
|
||||
jsonData, err := json.Marshal(pluginctlData)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to marshal pluginctl config: %w", err)
|
||||
}
|
||||
|
||||
if err := json.Unmarshal(jsonData, config); err != nil {
|
||||
return nil, fmt.Errorf("failed to parse pluginctl config: %w", err)
|
||||
}
|
||||
|
||||
return config, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue