# Core Pack: jq Dependency Elimination **Date:** 2026-02-09 **Objective:** Remove all `jq` dependencies from the core pack to minimize external runtime requirements and ensure maximum portability. ## Overview The core pack previously relied on `jq` (a JSON command-line processor) for parsing JSON parameters in several action scripts. This created an unnecessary external dependency that could cause issues in minimal environments or containers without `jq` installed. ## Changes Made ### 1. Converted API Wrapper Actions from bash+jq to Pure POSIX Shell All four API wrapper actions have been converted from bash scripts using `jq` for JSON parsing to pure POSIX shell scripts using DOTENV parameter format: #### `get_pack_dependencies` (bash+jq → POSIX shell) - **File:** Renamed from `get_pack_dependencies.py` to `get_pack_dependencies.sh` - **YAML:** Updated `parameter_format: json` → `parameter_format: dotenv` - **Entry Point:** Already configured as `get_pack_dependencies.sh` - **Functionality:** API wrapper for POST `/api/v1/packs/dependencies` #### `download_packs` (bash+jq → POSIX shell) - **File:** Renamed from `download_packs.py` to `download_packs.sh` - **YAML:** Updated `parameter_format: json` → `parameter_format: dotenv` - **Entry Point:** Already configured as `download_packs.sh` - **Functionality:** API wrapper for POST `/api/v1/packs/download` #### `register_packs` (bash+jq → POSIX shell) - **File:** Renamed from `register_packs.py` to `register_packs.sh` - **YAML:** Updated `parameter_format: json` → `parameter_format: dotenv` - **Entry Point:** Already configured as `register_packs.sh` - **Functionality:** API wrapper for POST `/api/v1/packs/register-batch` #### `build_pack_envs` (bash+jq → POSIX shell) - **File:** Renamed from `build_pack_envs.py` to `build_pack_envs.sh` - **YAML:** Updated `parameter_format: json` → `parameter_format: dotenv` - **Entry Point:** Already configured as `build_pack_envs.sh` - **Functionality:** API wrapper for POST `/api/v1/packs/build-envs` ### 2. Implementation Approach All converted scripts now follow the pattern established by `core.echo`: - **Shebang:** `#!/bin/sh` (POSIX shell, not bash) - **Parameter Parsing:** DOTENV format from stdin with delimiter `---ATTUNE_PARAMS_END---` - **JSON Construction:** Manual string construction with proper escaping - **HTTP Requests:** Using `curl` with response written to temp files - **Response Parsing:** Simple sed/case pattern matching for JSON field extraction - **Error Handling:** Graceful error messages without external tools - **Cleanup:** Trap handlers for temporary file cleanup ### 3. Key Techniques Used #### DOTENV Parameter Parsing ```sh while IFS= read -r line; do case "$line" in *"---ATTUNE_PARAMS_END---"*) break ;; esac key="${line%%=*}" value="${line#*=}" # Remove quotes case "$value" in \"*\") value="${value#\"}"; value="${value%\"}" ;; \'*\') value="${value#\'}"; value="${value%\'}" ;; esac case "$key" in param_name) param_name="$value" ;; esac done ``` #### JSON Construction (without jq) ```sh # Escape special characters for JSON value_escaped=$(printf '%s' "$value" | sed 's/\\/\\\\/g; s/"/\\"/g') # Build JSON body request_body=$(cat <