Moves all Mosaic framework runtime files from the separate bootstrap repo into the monorepo as canonical source. The @mosaic/mosaic npm package now ships the complete framework — bin scripts, runtime configs, tools, and templates — enabling standalone installation via npm install. Structure: packages/mosaic/framework/ ├── bin/ 28 CLI scripts (mosaic, mosaic-doctor, mosaic-sync-skills, etc.) ├── runtime/ Runtime adapters (claude, codex, opencode, pi, mcp) ├── tools/ Shell tooling (git, prdy, orchestrator, quality, etc.) ├── templates/ Agent and repo templates ├── defaults/ Default identity files (AGENTS.md, STANDARDS.md, SOUL.md, etc.) ├── install.sh Legacy bash installer └── remote-install.sh One-liner remote installer Key files with Pi support and recent fixes: - bin/mosaic: launch_pi() with skills-local loop - bin/mosaic-doctor: --fix auto-wiring for all 4 harnesses - bin/mosaic-sync-skills: Pi as 4th link target, symlink-aware find - bin/mosaic-link-runtime-assets: Pi settings.json patching - bin/mosaic-migrate-local-skills: Pi skill roots, symlink find - runtime/pi/RUNTIME.md + mosaic-extension.ts Package ships 251 framework files in the npm tarball (278KB compressed).
67 lines
2.2 KiB
Bash
Executable File
67 lines
2.2 KiB
Bash
Executable File
#!/bin/bash
|
|
# Universal remediation hook handler with error recovery
|
|
# Location: ~/.config/mosaic/tools/qa/remediation-hook-handler.sh
|
|
|
|
set -euo pipefail
|
|
|
|
PROJECT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
|
|
REPORT_FILE="${1:-}"
|
|
|
|
# Validate input
|
|
if [ -z "$REPORT_FILE" ] || [ ! -f "$REPORT_FILE" ]; then
|
|
echo "[ERROR] Invalid or missing report file: $REPORT_FILE" >&2
|
|
exit 1
|
|
fi
|
|
|
|
LOG_FILE="$PROJECT_ROOT/logs/qa-automation.log"
|
|
mkdir -p "$(dirname "$LOG_FILE")"
|
|
|
|
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Remediation triggered for: $REPORT_FILE" | tee -a "$LOG_FILE"
|
|
|
|
# Extract components from path and filename
|
|
BASE_NAME=$(basename "$REPORT_FILE" _remediation_needed.md)
|
|
DIR_PATH=$(dirname "$REPORT_FILE")
|
|
|
|
# Validate directory structure
|
|
if [[ ! "$DIR_PATH" =~ /pending$ ]]; then
|
|
echo "[ERROR] Report not in pending directory: $DIR_PATH" | tee -a "$LOG_FILE"
|
|
exit 1
|
|
fi
|
|
|
|
# Setup in-progress directory
|
|
IN_PROGRESS_DIR="${DIR_PATH/pending/in-progress}"
|
|
|
|
# Handle missing in-progress directory
|
|
if [ ! -d "$IN_PROGRESS_DIR" ]; then
|
|
echo "[WARN] Creating missing in-progress directory: $IN_PROGRESS_DIR" | tee -a "$LOG_FILE"
|
|
mkdir -p "$IN_PROGRESS_DIR"
|
|
|
|
# Also ensure done and escalated exist
|
|
mkdir -p "${DIR_PATH/pending/done}"
|
|
mkdir -p "${DIR_PATH/pending/escalated}"
|
|
fi
|
|
|
|
# Move from pending to in-progress (with error handling)
|
|
if ! mv "$REPORT_FILE" "$IN_PROGRESS_DIR/" 2>/dev/null; then
|
|
echo "[ERROR] Failed to move report to in-progress" | tee -a "$LOG_FILE"
|
|
# Check if already in progress
|
|
if [ -f "$IN_PROGRESS_DIR/$(basename "$REPORT_FILE")" ]; then
|
|
echo "[WARN] Report already in progress, skipping" | tee -a "$LOG_FILE"
|
|
exit 0
|
|
fi
|
|
exit 1
|
|
fi
|
|
|
|
# Create actions file
|
|
ACTIONS_FILE="${BASE_NAME}_remediation_actions.md"
|
|
ACTIONS_PATH="$IN_PROGRESS_DIR/$ACTIONS_FILE"
|
|
|
|
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Starting remediation: $ACTIONS_PATH" | tee -a "$LOG_FILE"
|
|
|
|
# Trigger remediation agent
|
|
claude -p "Use Task tool to launch auto-remediation-agent for:
|
|
- Remediation Report: $IN_PROGRESS_DIR/$(basename "$REPORT_FILE")
|
|
- Actions File: $ACTIONS_PATH
|
|
- Max Iterations: 5
|
|
Process the report, create action plan using Sequential Thinking, research with Context7, and execute fixes systematically." 2>&1 | tee -a "$LOG_FILE"
|