Files
Jason Woltje b38cfac760
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/pr/ci Pipeline was successful
feat: integrate framework files into monorepo under packages/mosaic/framework/
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).
2026-04-01 21:19:21 -05:00

51 lines
1.5 KiB
Bash
Executable File

#!/usr/bin/env bash
#
# _lib.sh — Shared helpers for Woodpecker CI tool scripts
#
# Usage: source "$(dirname "${BASH_SOURCE[0]}")/_lib.sh"
#
# Requires: WOODPECKER_URL and WOODPECKER_TOKEN to be set (via load_credentials)
# Resolve owner/repo name to numeric repo ID (required by Woodpecker v3 API)
# Usage: REPO_ID=$(wp_resolve_repo_id "owner/repo")
wp_resolve_repo_id() {
local full_name="$1"
local response http_code body repo_id
response=$(curl -sk -w "\n%{http_code}" \
-H "Authorization: Bearer $WOODPECKER_TOKEN" \
"${WOODPECKER_URL}/api/repos/lookup/${full_name}")
http_code=$(echo "$response" | tail -n1)
body=$(echo "$response" | sed '$d')
if [[ "$http_code" != "200" ]]; then
echo "Error: Failed to look up repo '${full_name}' (HTTP $http_code)" >&2
if echo "$body" | jq -e '.message' &>/dev/null; then
echo " $(echo "$body" | jq -r '.message')" >&2
fi
return 1
fi
repo_id=$(echo "$body" | jq -r '.id // empty')
if [[ -z "$repo_id" ]]; then
echo "Error: Repo lookup returned no ID for '${full_name}'" >&2
return 1
fi
echo "$repo_id"
}
# Auto-detect repo name from git remote origin
# Usage: REPO=$(wp_detect_repo)
wp_detect_repo() {
local remote_url
remote_url=$(git remote get-url origin 2>/dev/null || true)
if [[ -n "$remote_url" ]]; then
echo "$remote_url" | sed -E 's|\.git$||' | sed -E 's|.*[:/]([^/]+/[^/]+)$|\1|'
else
echo "Error: -r owner/repo required (not in a git repository)" >&2
return 1
fi
}