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

115 lines
3.0 KiB
Bash
Executable File

#!/usr/bin/env bash
#
# stack-start.sh - Start an inactive Portainer stack
#
# Usage: stack-start.sh -n <stack-name>
#
# Environment variables:
# PORTAINER_URL - Portainer instance URL (e.g., https://portainer.example.com:9443)
# PORTAINER_API_KEY - API access token
#
# Options:
# -n name Stack name (required)
# -i id Stack ID (alternative to -n)
# -h Show this help
set -euo pipefail
# Default values
STACK_NAME=""
STACK_ID=""
# Parse arguments
while getopts "n:i:h" opt; do
case $opt in
n) STACK_NAME="$OPTARG" ;;
i) STACK_ID="$OPTARG" ;;
h)
head -16 "$0" | grep "^#" | sed 's/^# \?//'
exit 0
;;
*)
echo "Usage: $0 -n <stack-name>" >&2
exit 1
;;
esac
done
# Validate environment
if [[ -z "${PORTAINER_URL:-}" ]]; then
echo "Error: PORTAINER_URL environment variable not set" >&2
exit 1
fi
if [[ -z "${PORTAINER_API_KEY:-}" ]]; then
echo "Error: PORTAINER_API_KEY environment variable not set" >&2
exit 1
fi
if [[ -z "$STACK_NAME" && -z "$STACK_ID" ]]; then
echo "Error: Either -n <stack-name> or -i <stack-id> is required" >&2
exit 1
fi
# Remove trailing slash from URL
PORTAINER_URL="${PORTAINER_URL%/}"
# Function to make API requests
api_request() {
local method="$1"
local endpoint="$2"
curl -s -w "\n%{http_code}" -X "$method" \
-H "X-API-Key: ${PORTAINER_API_KEY}" \
"${PORTAINER_URL}${endpoint}"
}
# Get stack info by name
if [[ -n "$STACK_NAME" ]]; then
response=$(api_request GET "/api/stacks")
http_code=$(echo "$response" | tail -n1)
body=$(echo "$response" | sed '$d')
if [[ "$http_code" != "200" ]]; then
echo "Error: Failed to list stacks (HTTP $http_code)" >&2
exit 1
fi
stack_info=$(echo "$body" | jq --arg name "$STACK_NAME" '.[] | select(.Name == $name)')
if [[ -z "$stack_info" || "$stack_info" == "null" ]]; then
echo "Error: Stack '$STACK_NAME' not found" >&2
exit 1
fi
STACK_ID=$(echo "$stack_info" | jq -r '.Id')
ENDPOINT_ID=$(echo "$stack_info" | jq -r '.EndpointId')
else
response=$(api_request GET "/api/stacks/${STACK_ID}")
http_code=$(echo "$response" | tail -n1)
body=$(echo "$response" | sed '$d')
if [[ "$http_code" != "200" ]]; then
echo "Error: Failed to get stack (HTTP $http_code)" >&2
exit 1
fi
stack_info="$body"
STACK_NAME=$(echo "$stack_info" | jq -r '.Name')
ENDPOINT_ID=$(echo "$stack_info" | jq -r '.EndpointId')
fi
echo "Starting stack '$STACK_NAME' (ID: $STACK_ID)..."
response=$(api_request POST "/api/stacks/${STACK_ID}/start?endpointId=${ENDPOINT_ID}")
http_code=$(echo "$response" | tail -n1)
body=$(echo "$response" | sed '$d')
if [[ "$http_code" == "200" ]]; then
echo "Successfully started stack '$STACK_NAME'"
else
echo "Error: Failed to start stack (HTTP $http_code)" >&2
echo "$body" | jq '.' 2>/dev/null || echo "$body" >&2
exit 1
fi