Phase 1: Parse Arguments

argument-hint: "[description] | analyze [path-to-file]"

Phase 1:

Parse Arguments for the Happycapy "bug-report" Skill

The "bug-report" skill on the Happycapy Skills platform provides a robust framework for structured bug reporting and analysis. The first step in utilizing this skill is "Phase 1: Parse Arguments." This phase is pivotal for determining the intended operation mode based on user input, ensuring the skill can effectively generate, analyze, verify, or close bug reports. Below, we explore what this phase is, its technical rationale, and how you can use it effectively in your development workflow.


What Is This Phase?

Phase 1: Parse Arguments is the initial logic layer for the bug-report skill. Its purpose is to interpret the arguments passed by the user and select the appropriate operational mode. The skill supports four distinct modes:

  1. Description Mode: Triggered by default or when no keyword is present. It creates a complete bug report from a user's descriptive input.
  2. Analyze Mode: Activated by the analyze [path-to-file] keyword. This mode inspects code files to identify possible bugs.
  3. Verify Mode: Invoked with verify [BUG-ID]. It checks whether a previously reported bug has been resolved.
  4. Close Mode: Accessed via close [BUG-ID]. It marks a bug report as closed, logging the resolution.

If no arguments are provided, the skill prompts the user to supply a bug description, ensuring it always has actionable input.

Argument Syntax

  • Description: Any descriptive text without a keyword (e.g., "The login button doesn't work after the last update.")
  • Analyze: analyze path/to/file.js
  • Verify: verify BUG-1024
  • Close: close BUG-1024

This argument parsing phase ensures that subsequent processing is contextually appropriate and that user intent is always clear.


Why Use This Phase?

Effective argument parsing is essential for multi-modal skills like bug-report because:

  • Clarity of Intent: It removes ambiguity from user commands, making it clear whether the user wants to report, analyze, verify, or close a bug.
  • Streamlined Workflow: By determining the operational mode upfront, the skill can provide specific guidance, prompts, or automated actions tailored to the user's needs.
  • Error Prevention: Early validation of arguments helps prevent misinterpretation and potential errors in downstream phases.

For example, in a collaborative development environment, different team members may interact with the skill for different purposes. Parsing the arguments at the outset ensures consistent experiences and reliable results.


How to Use It

To use the argument parsing phase, invoke the skill with one of the supported argument formats. Here is how the logic works in practice:

def parse_arguments(argument):
    if argument.startswith('analyze '):
        return 'analyze', argument[len('analyze '):]
    elif argument.startswith('verify '):
        return 'verify', argument[len('verify '):]
    elif argument.startswith('close '):
        return 'close', argument[len('close '):]
    elif argument.strip() == '':
        return 'prompt', None
    else:
        return 'description', argument

Example Usages:

  • To generate a new bug report:
    bug-report The application crashes when uploading large files.
  • To analyze a specific file for bugs:
    bug-report analyze src/components/FileUploader.js
  • To verify a fix:
    bug-report verify BUG-1003
  • To close a resolved issue:
    bug-report close BUG-1003

If invoked without arguments, the skill will prompt:

Please provide a bug description to continue.

When to Use It

Phase 1 should be used every time the bug-report skill is called, regardless of the intended action. This is because:

  • It ensures the skill is always operating in the correct mode.
  • It provides the necessary context for subsequent logic, such as reading files or generating structured reports.
  • It enables seamless transitions between different bug lifecycle stages (reporting, analyzing, verifying, and closing).

This phase is especially critical when integrating bug-report into automated pipelines, chatops tools, or when supporting multiple user roles within a project.


Important Notes

  • Strict Syntax: The keywords (analyze, verify, close) must be at the start of the argument for mode detection. Any deviation may result in the skill defaulting to Description Mode.
  • User Guidance: If no argument is provided, the skill will not proceed silently. Instead, it prompts the user, ensuring clarity and preventing incomplete operations.
  • Tool Access: The skill uses the following tools based on the mode: Read, Glob, Grep, Write. These are scoped according to the operational context determined during argument parsing.
  • Security Considerations: When analyzing files, ensure path arguments are sanitized and restricted to prevent unauthorized file access.

By adhering to this argument parsing methodology, the bug-report skill maintains reliability, user-friendliness, and consistent functionality across diverse use cases in the Happycapy ecosystem.