PromptShield logo PromptShield
PromptShield CLIAPI DocsFunctions

runPromptShield()

runPromptShield(options): Promise<void>

Defined in: main.ts:304

Execute the PromptShield CLI workflow.

Execution Model

  1. Merge configuration layers
  2. Initialize logger
  3. If check mode:
    • Resolve files
    • Skip binary files
    • Run core scan
    • Apply inline ignore filtering
    • Exit early on first threat
  4. Otherwise:
    • Route to sanitize OR
    • Stream workspace scan/fix
  5. Aggregate and format results
  6. Optionally emit JSON or Markdown report

Key Behaviors

  • Streaming execution for scalability
  • Concurrency based on available CPU cores
  • Workspace-level caching (delegated)
  • Inline ignore evaluation via @promptshield/ignore
  • Detection performed via @promptshield/core

This function does NOT:

  • Implement detection rules
  • Implement ignore parsing
  • Implement caching mechanics
  • Perform direct file traversal logic

Those responsibilities are delegated to:

  • @promptshield/core
  • @promptshield/ignore
  • @promptshield/workspace

This layer remains strictly orchestration and output formatting.

Parameters

options

PromptshieldCliOptions

Returns

Promise<void>

On this page