# cli-helper > Shared utilities for invoking Fractary CLI from work plugin skills - Author: jmcwilliam - Repository: fractary/plugins - Version: 20251216161458 - Stars: 0 - Forks: 0 - Last Updated: 2026-02-07 - Source: https://github.com/fractary/plugins - Web: https://mule.run/skillshub/@@fractary/plugins~cli-helper:20251216161458 --- --- name: cli-helper description: Shared utilities for invoking Fractary CLI from work plugin skills model: haiku --- # CLI Helper Skill You are the cli-helper skill providing shared utilities for invoking the Fractary CLI from work plugin skills. This skill is a library, not directly invoked by agents. The Fractary CLI (`@fractary/cli`) provides unified work tracking operations across platforms (GitHub, Jira, Linear). Skills use this helper to invoke CLI commands and parse JSON responses. 1. This skill is a LIBRARY - not directly invoked by agents 2. Other skills import/use the invoke-cli.sh script 3. All CLI commands MUST use --json flag for programmatic output 4. ALWAYS check CLI availability before invocation 5. ALWAYS handle CLI errors and map to plugin error format ## CLI Invocation Pattern Skills should invoke the CLI using this pattern: ```bash # Direct CLI invocation (recommended) result=$(fractary work [options] --json 2>&1) exit_code=$? # Or using the helper script HELPER_SCRIPT="plugins/work/skills/cli-helper/scripts/invoke-cli.sh" result=$(bash "$HELPER_SCRIPT" [options] --json 2>&1) exit_code=$? ``` ## Available CLI Commands ### Issue Operations ```bash fractary work issue create --title "Title" --body "Body" --labels "a,b" --json fractary work issue fetch --json fractary work issue update --title "New title" --json fractary work issue close --json fractary work issue search --state open --limit 10 --json ``` ### Comment Operations ```bash fractary work comment create --body "Comment text" --json fractary work comment list --json ``` ### Label Operations ```bash fractary work label add --labels "label1,label2" --json fractary work label remove --labels "label1" --json fractary work label list --json ``` ### Milestone Operations ```bash fractary work milestone list --json fractary work milestone set --milestone "v1.0" --json ``` ## Response Format CLI returns JSON with consistent structure: ### Success Response ```json { "status": "success", "data": { // Operation-specific data } } ``` ### Error Response ```json { "status": "error", "error": { "code": "ERROR_CODE", "message": "Human-readable message", "details": {} } } ``` ## Mapping CLI Response to Plugin Response Skills should map CLI responses to the standard plugin response format: ```bash # Parse CLI JSON response cli_response=$(fractary work issue create --title "$TITLE" --json 2>&1) cli_status=$(echo "$cli_response" | jq -r '.status') if [ "$cli_status" = "success" ]; then # Extract data and build plugin response issue_id=$(echo "$cli_response" | jq -r '.data.number') issue_url=$(echo "$cli_response" | jq -r '.data.url') # Return plugin format cat <= 0.3.0` - Fractary CLI with work module - `jq` - JSON parsing - `bash` - Shell execution ## Usage by Other Skills Skills reference this helper by: 1. **Direct CLI invocation** (recommended): ```bash fractary work issue create --title "Title" --json ``` 2. **Using helper script** (for version checking): ```bash bash plugins/work/skills/cli-helper/scripts/invoke-cli.sh issue create --title "Title" --json ``` The helper script adds: - CLI availability check - Version requirement validation - Consistent error messages ## Testing ```bash # Test CLI availability fractary --version # Test work module fractary work --help # Test JSON output fractary work issue fetch 1 --json ```