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

Function parseArgumentNames

source code/utils/argumentSubstitution.ts:52–70  ·  view source on GitHub ↗
(
  argumentNames: string | string[] | undefined,
)

Source from the content-addressed store, hash-verified

50 * - ["foo", "bar", "baz"] => ["foo", "bar", "baz"]
51 */
52export function parseArgumentNames(
53 argumentNames: string | string[] | undefined,
54): string[] {
55 if (!argumentNames) {
56 return []
57 }
58
59 // Filter out empty strings and numeric-only names (which conflict with $0, $1 shorthand)
60 const isValidName = (name: string): boolean =>
61 typeof name === 'string' && name.trim() !== '' && !/^\d+$/.test(name)
62
63 if (Array.isArray(argumentNames)) {
64 return argumentNames.filter(isValidName)
65 }
66 if (typeof argumentNames === 'string') {
67 return argumentNames.split(/\s+/).filter(isValidName)
68 }
69 return []
70}
71
72/**
73 * Generate argument hint showing remaining unfilled args.

Callers 2

createPluginCommandFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected