vibe-action 0.2.2

Command router — execute shell commands and LLM prompts via simple YAML actions.
version: 0.0.1

name: explain
about: Explain what the selected code does in simple terms
notify: true

# IDE plugin integration: maps argument names to IDE contexts
api:
  # Target for the final result (replace | clipboard | dialog)
  output: replace
  # Source for the {query} tag
  input: query

actions:
  # Read input from query (prioritize file path if valid, otherwise use raw text)
  - tag: tag_content
    run: cmd
    expect: string
    check: .+
    action:
      - when: '{query|file_path|empty:not}'
        then: cat "{query|file_path|load}"
      - when: '{query|empty:not}'
        then: echo "{query}"
      - when: 'true'
        then: echo "ERROR - No input provided"

  # Add summary and detailed comments to the code
  - tag: tag_explanation
    run: medium
    expect: string
    action: |
      [Task]
      1. Keep the code logic identical, but add comments above EACH logical block.
      2. Inside each comment, briefly explain the language-specific constructs, macros, or types used.
      3. Split comments into multiple lines using the appropriate comment syntax for the selected language (e.g., `// ` or `# `).
      4. Use Markdown formatting, and place the code inside code blocks.
      5. Language for comments: {system_language}

      [Example]
      ```language
      // This is a comment
      // Explaining the code below
      let x = 5;
      ```

      [Code]
      {tag_content}

  # Copy result to clipboard and output
  - tag: tag_clipboard
    run: value
    expect: string
    action: '{tag_explanation|clipboard}'