MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / parsePluginArgs

Function parsePluginArgs

source code/commands/plugin/parseArgs.ts:19–105  ·  view source on GitHub ↗
(args?: string)

Source from the content-addressed store, hash-verified

17 }
18
19export function parsePluginArgs(args?: string): ParsedCommand {
20 if (!args) {
21 return { type: 'menu' }
22 }
23
24 const parts = args.trim().split(/\s+/)
25 const command = parts[0]?.toLowerCase()
26
27 switch (command) {
28 case 'help':
29 case '--help':
30 case '-h':
31 return { type: 'help' }
32
33 case 'install':
34 case 'i': {
35 const target = parts[1]
36 if (!target) {
37 return { type: 'install' }
38 }
39
40 // Check if it's in format plugin@marketplace
41 if (target.includes('@')) {
42 const [plugin, marketplace] = target.split('@')
43 return { type: 'install', plugin, marketplace }
44 }
45
46 // Check if the target looks like a marketplace (URL or path)
47 const isMarketplace =
48 target.startsWith('http://') ||
49 target.startsWith('https://') ||
50 target.startsWith('file://') ||
51 target.includes('/') ||
52 target.includes('\\')
53
54 if (isMarketplace) {
55 // This is a marketplace URL/path, no plugin specified
56 return { type: 'install', marketplace: target }
57 }
58
59 // Otherwise treat it as a plugin name
60 return { type: 'install', plugin: target }
61 }
62
63 case 'manage':
64 return { type: 'manage' }
65
66 case 'uninstall':
67 return { type: 'uninstall', plugin: parts[1] }
68
69 case 'enable':
70 return { type: 'enable', plugin: parts[1] }
71
72 case 'disable':
73 return { type: 'disable', plugin: parts[1] }
74
75 case 'validate': {
76 const target = parts.slice(1).join(' ').trim()

Callers 1

PluginSettingsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected