diff --git a/internal/library/plugin.go b/internal/library/plugin.go index bdd06f92a..f01ca1074 100644 --- a/internal/library/plugin.go +++ b/internal/library/plugin.go @@ -14,6 +14,8 @@ import ( "time" "gopkg.in/yaml.v3" + + "github.com/yetone/magpie/internal/lazyre" ) // A bundle is a Claude Code plugin kept in the library as one item @@ -157,7 +159,7 @@ func inside(dir, p string) (string, bool) { return p, true } -var pluginName = regexp.MustCompile(`[^A-Za-z0-9_-]+`) +var pluginName = lazyre.New(`[^A-Za-z0-9_-]+`) func pluginSlug(s string) string { s = strings.Trim(pluginName.ReplaceAllString(strings.TrimSpace(s), "-"), "-_") diff --git a/internal/provider/login_export.go b/internal/provider/login_export.go index 7edaef8df..211cf0aa1 100644 --- a/internal/provider/login_export.go +++ b/internal/provider/login_export.go @@ -20,10 +20,11 @@ import ( "fmt" "os" "path/filepath" - "regexp" "slices" "strings" "time" + + "github.com/yetone/magpie/internal/lazyre" ) // Export formats. @@ -155,7 +156,7 @@ func ExportLogins(agent, format string, users []string) (ExportResult, error) { return res, nil } -var exportUnsafe = regexp.MustCompile(`[^A-Za-z0-9@._+-]+`) +var exportUnsafe = lazyre.New(`[^A-Za-z0-9@._+-]+`) // exportName is CLIProxyAPI's name for an auth file: -.json, // a ChatGPT one's plan after the email.