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

Function shouldStopAtArg

source code/utils/shell/specPrefix.ts:213–243  ·  view source on GitHub ↗
(
  arg: string,
  args: string[],
  spec: CommandSpec | null,
)

Source from the content-addressed store, hash-verified

211}
212
213async function shouldStopAtArg(
214 arg: string,
215 args: string[],
216 spec: CommandSpec | null,
217): Promise<boolean> {
218 if (arg.startsWith('-')) return true
219
220 const dotIndex = arg.lastIndexOf('.')
221 const hasExtension =
222 dotIndex > 0 &&
223 dotIndex < arg.length - 1 &&
224 !arg.substring(dotIndex + 1).includes(':')
225
226 const hasFile = arg.includes('/') || hasExtension
227 const hasUrl = URL_PROTOCOLS.some(proto => arg.startsWith(proto))
228
229 if (!hasFile && !hasUrl) return false
230
231 // Check if we're after a -m flag for python modules
232 if (spec?.options && args.length > 0 && args[args.length - 1] === '-m') {
233 const option = spec.options.find(opt =>
234 Array.isArray(opt.name) ? opt.name.includes('-m') : opt.name === '-m',
235 )
236 if (option?.args && toArray(option.args).some(arg => arg?.isModule)) {
237 return false // Don't stop at module names
238 }
239 }
240
241 // For actual files/URLs, always stop regardless of context
242 return true
243}

Callers 1

buildPrefixFunction · 0.85

Calls 1

toArrayFunction · 0.70

Tested by

no test coverage detected