Shared utilities for invoking Fractary CLI from work plugin skills
Shared utilities for invoking Fractary CLI from other plugin skills. Used internally when skills need to create, update, or query work items across GitHub, Jira, or Linear platforms.
/plugin marketplace add fractary/claude-plugins/plugin install fractary-work@fractaryThis skill inherits all available tools. When active, it can use any tool Claude has access to.
scripts/invoke-cli.shThe 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.
</CONTEXT>
<CRITICAL_RULES>
Skills should invoke the CLI using this pattern:
# Direct CLI invocation (recommended)
result=$(fractary work <subcommand> [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" <subcommand> [options] --json 2>&1)
exit_code=$?
fractary work issue create --title "Title" --body "Body" --labels "a,b" --json
fractary work issue fetch <number> --json
fractary work issue update <number> --title "New title" --json
fractary work issue close <number> --json
fractary work issue search --state open --limit 10 --json
fractary work comment create <issue_number> --body "Comment text" --json
fractary work comment list <issue_number> --json
fractary work label add <issue_number> --labels "label1,label2" --json
fractary work label remove <issue_number> --labels "label1" --json
fractary work label list --json
fractary work milestone list --json
fractary work milestone set <issue_number> --milestone "v1.0" --json
CLI returns JSON with consistent structure:
{
"status": "success",
"data": {
// Operation-specific data
}
}
{
"status": "error",
"error": {
"code": "ERROR_CODE",
"message": "Human-readable message",
"details": {}
}
}
Skills should map CLI responses to the standard plugin response format:
# 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 <<EOF
{
"status": "success",
"operation": "create-issue",
"result": {
"id": "$issue_id",
"identifier": "#$issue_id",
"url": "$issue_url",
"platform": "github"
}
}
EOF
else
# Extract error and return plugin error format
error_code=$(echo "$cli_response" | jq -r '.error.code // "UNKNOWN_ERROR"')
error_msg=$(echo "$cli_response" | jq -r '.error.message // "Unknown error"')
cat <<EOF
{
"status": "error",
"operation": "create-issue",
"code": "$error_code",
"message": "$error_msg"
}
EOF
fi
Map CLI errors to plugin error codes:
| CLI Exit Code | CLI Error Code | Plugin Error Code | Description |
|---|---|---|---|
| 0 | - | - | Success |
| 1 | CLI_NOT_FOUND | 1 | CLI not installed |
| 1 | AUTH_FAILED | 11 | Authentication failed |
| 1 | NOT_FOUND | 3 | Resource not found |
| 1 | NETWORK_ERROR | 12 | Network connectivity issue |
| 1 | VALIDATION_ERROR | 2 | Invalid parameters |
| 1 | API_ERROR | 10 | Platform API error |
@fractary/cli >= 0.3.0 - Fractary CLI with work modulejq - JSON parsingbash - Shell executionSkills reference this helper by:
Direct CLI invocation (recommended):
fractary work issue create --title "Title" --json
Using helper script (for version checking):
bash plugins/work/skills/cli-helper/scripts/invoke-cli.sh issue create --title "Title" --json
The helper script adds:
# Test CLI availability
fractary --version
# Test work module
fractary work --help
# Test JSON output
fractary work issue fetch 1 --json
This skill should be used when the user asks to "create a hookify rule", "write a hook rule", "configure hookify", "add a hookify rule", or needs guidance on hookify rule syntax and patterns.
Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.