Common utilities for work plugin operations
Shared utilities library that other work plugin skills call directly via Bash for config loading and validation. Used internally when skills need to read `.fractary/plugins/work/config.json` from the project directory.
/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/config-loader.shscripts/error-codes.shscripts/get-repo-info.shscripts/jira-auth.shscripts/jql-builder.shscripts/markdown-to-adf.shscripts/normalize-issue.shscripts/validate-issue-id.shThis library provides:
<CRITICAL_RULES>
Purpose: Load and validate work plugin configuration
Location: plugins/work/skills/work-common/scripts/config-loader.sh
Usage:
CONFIG_JSON=$(./plugins/work/skills/work-common/scripts/config-loader.sh) || exit $?
PLATFORM=$(echo "$CONFIG_JSON" | jq -r '.handlers["work-tracker"].active')
Returns: Full configuration JSON to stdout
Exit Codes:
CRITICAL: Configuration must be loaded from the project working directory, NOT the plugin installation directory.
Configuration Location: .fractary/plugins/work/config.json (relative to project root / current working directory)
Common Mistake: Do NOT look in ~/.claude/plugins/marketplaces/fractary/plugins/work/ - that's the plugin installation directory, not the project config location.
Special Behavior: When config doesn't exist, the work plugin uses auto-detection (e.g., gh CLI automatically detects the repository). Skills can check if config exists and recommend running /work:init to persist settings.
Example:
# Load configuration
if ! CONFIG_JSON=$(./plugins/work/skills/work-common/scripts/config-loader.sh 2>&1); then
echo "Error: Failed to load configuration" >&2
exit 3
fi
# Extract platform-specific settings
PLATFORM=$(echo "$CONFIG_JSON" | jq -r '.handlers["work-tracker"].active')
GITHUB_OWNER=$(echo "$CONFIG_JSON" | jq -r '.handlers["work-tracker"].github.owner')
GITHUB_REPO=$(echo "$CONFIG_JSON" | jq -r '.handlers["work-tracker"].github.repo')
Purpose: Check if work plugin configuration file exists
Location: plugins/work/skills/work-common/scripts/check-config-exists.sh
Usage:
if [ -f ".fractary/plugins/work/config.json" ]; then
# Config exists
else
# Show recommendation to run /work:init
fi
Returns: Exit code 0 if config exists, 1 if not
Use Case: Skills can check config existence and include init recommendation in completion messages when config doesn't exist.
Purpose: Normalize platform-specific issue JSON to universal format
Status: Not yet implemented - placeholder for Phase 5+
Planned Usage:
NORMALIZED=$(./plugins/work/skills/work-common/scripts/normalize-issue.sh "$PLATFORM" "$ISSUE_JSON")
Purpose: Validate issue ID format for specific platform
Status: Not yet implemented - placeholder for Phase 5+
Planned Usage:
./plugins/work/skills/work-common/scripts/validate-issue-id.sh "github" "123"
Purpose: Centralized error code definitions and lookup
Status: Not yet implemented - placeholder for Phase 5+
Planned Usage:
source ./plugins/work/skills/work-common/scripts/error-codes.sh
exit $ERR_NOT_FOUND
</UTILITIES>
<ERROR_CODES>
Standard error codes used across all work plugin utilities:
</ERROR_CODES>
jq - JSON processingbash 4.0+ - Shell featuresgh for GitHubjira for Jiralinear for LinearCRITICAL: Configuration must be loaded from the project working directory, NOT the plugin installation directory.
Expected configuration file at .fractary/plugins/work/config.json (relative to project root / current working directory):
{
"version": "2.0",
"project": {
"issue_system": "github",
"repository": "owner/repo"
},
"handlers": {
"work-tracker": {
"active": "github",
"github": {
"owner": "myorg",
"repo": "my-project",
"api_url": "https://api.github.com"
}
}
}
}
See plugins/work/config/config.example.json for complete configuration template.
# Test successful load
cd /mnt/c/GitHub/fractary/claude-plugins
./plugins/work/skills/work-common/scripts/config-loader.sh
# Expected: Outputs valid JSON configuration
# Test missing config
mv .fractary/plugins/work/config.json .fractary/plugins/work/config.json.bak
./plugins/work/skills/work-common/scripts/config-loader.sh
# Expected: Exit code 3, error message "Configuration file not found"
# Test invalid JSON
echo "{ invalid json" > .fractary/plugins/work/config.json
./plugins/work/skills/work-common/scripts/config-loader.sh
# Expected: Exit code 3, error message "Invalid JSON"
Other skills and handlers integrate work-common utilities like this:
#!/bin/bash
# Example handler script
set -euo pipefail
# Load configuration using work-common utility
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
WORK_COMMON_DIR="$SCRIPT_DIR/../../work-common/scripts"
CONFIG_JSON=$("$WORK_COMMON_DIR/config-loader.sh") || exit $?
# Extract configuration values
PLATFORM=$(echo "$CONFIG_JSON" | jq -r '.handlers["work-tracker"].active')
# Continue with operation...
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.