Initial commit: Clean DSS implementation
Migrated from design-system-swarm with fresh git history.
Old project history preserved in /home/overbits/apps/design-system-swarm
Core components:
- MCP Server (Python FastAPI with mcp 1.23.1)
- Claude Plugin (agents, commands, skills, strategies, hooks, core)
- DSS Backend (dss-mvp1 - token translation, Figma sync)
- Admin UI (Node.js/React)
- Server (Node.js/Express)
- Storybook integration (dss-mvp1/.storybook)
Self-contained configuration:
- All paths relative or use DSS_BASE_PATH=/home/overbits/dss
- PYTHONPATH configured for dss-mvp1 and dss-claude-plugin
- .env file with all configuration
- Claude plugin uses ${CLAUDE_PLUGIN_ROOT} for portability
Migration completed: $(date)
🤖 Clean migration with full functionality preserved
This commit is contained in:
121
demo/tools/discovery/discover-docker.sh
Executable file
121
demo/tools/discovery/discover-docker.sh
Executable file
@@ -0,0 +1,121 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# DSS - Docker Discovery
|
||||
# Container status, images, networks, volumes
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
PROJECT_PATH="${1:-.}"
|
||||
|
||||
# Check if Docker is available
|
||||
if ! command -v docker &> /dev/null; then
|
||||
cat <<EOF
|
||||
{
|
||||
"scan_type": "docker",
|
||||
"available": false,
|
||||
"message": "Docker not installed or not in PATH"
|
||||
}
|
||||
EOF
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Check if Docker daemon is running
|
||||
if ! docker info &> /dev/null; then
|
||||
cat <<EOF
|
||||
{
|
||||
"scan_type": "docker",
|
||||
"available": true,
|
||||
"daemon_running": false,
|
||||
"message": "Docker daemon not running or no permissions"
|
||||
}
|
||||
EOF
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Get running containers
|
||||
get_containers() {
|
||||
local containers=()
|
||||
|
||||
while IFS= read -r line; do
|
||||
if [[ -n "$line" ]]; then
|
||||
local id=$(echo "$line" | cut -d'|' -f1)
|
||||
local name=$(echo "$line" | cut -d'|' -f2)
|
||||
local image=$(echo "$line" | cut -d'|' -f3)
|
||||
local status=$(echo "$line" | cut -d'|' -f4)
|
||||
local ports=$(echo "$line" | cut -d'|' -f5 | sed 's/"/\\"/g')
|
||||
|
||||
containers+=("{\"id\":\"$id\",\"name\":\"$name\",\"image\":\"$image\",\"status\":\"$status\",\"ports\":\"$ports\"}")
|
||||
fi
|
||||
done < <(docker ps --format '{{.ID}}|{{.Names}}|{{.Image}}|{{.Status}}|{{.Ports}}' 2>/dev/null)
|
||||
|
||||
echo "${containers[@]}"
|
||||
}
|
||||
|
||||
# Get images
|
||||
get_images() {
|
||||
local images=()
|
||||
|
||||
while IFS= read -r line; do
|
||||
if [[ -n "$line" ]]; then
|
||||
local repo=$(echo "$line" | cut -d'|' -f1)
|
||||
local tag=$(echo "$line" | cut -d'|' -f2)
|
||||
local size=$(echo "$line" | cut -d'|' -f3)
|
||||
|
||||
images+=("{\"repository\":\"$repo\",\"tag\":\"$tag\",\"size\":\"$size\"}")
|
||||
fi
|
||||
done < <(docker images --format '{{.Repository}}|{{.Tag}}|{{.Size}}' 2>/dev/null | head -20)
|
||||
|
||||
echo "${images[@]}"
|
||||
}
|
||||
|
||||
# Check for docker-compose files
|
||||
get_compose_info() {
|
||||
local compose_files=()
|
||||
|
||||
for file in "docker-compose.yml" "docker-compose.yaml" "compose.yml" "compose.yaml"; do
|
||||
if [[ -f "$PROJECT_PATH/$file" ]]; then
|
||||
local services=$(grep -E "^ [a-zA-Z]" "$PROJECT_PATH/$file" 2>/dev/null | sed 's/://g' | tr -d ' ' | head -10)
|
||||
compose_files+=("{\"file\":\"$file\",\"services\":$(echo "$services" | jq -R -s 'split("\n") | map(select(. != ""))')}")
|
||||
fi
|
||||
done
|
||||
|
||||
echo "${compose_files[@]}"
|
||||
}
|
||||
|
||||
# Get resource usage
|
||||
get_stats() {
|
||||
local stats=$(docker stats --no-stream --format '{"name":"{{.Name}}","cpu":"{{.CPUPerc}}","memory":"{{.MemUsage}}"}' 2>/dev/null | head -10 | tr '\n' ',' | sed 's/,$//')
|
||||
echo "[$stats]"
|
||||
}
|
||||
|
||||
# Build output
|
||||
containers=$(get_containers)
|
||||
images=$(get_images)
|
||||
compose=$(get_compose_info)
|
||||
stats=$(get_stats)
|
||||
|
||||
containers_json=$(IFS=,; echo "${containers[*]}")
|
||||
images_json=$(IFS=,; echo "${images[*]}")
|
||||
compose_json=$(IFS=,; echo "${compose[*]}")
|
||||
|
||||
cat <<EOF
|
||||
{
|
||||
"scan_type": "docker",
|
||||
"timestamp": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
|
||||
"available": true,
|
||||
"daemon_running": true,
|
||||
"docker_version": "$(docker --version | cut -d' ' -f3 | tr -d ',')",
|
||||
"containers": {
|
||||
"running": $(docker ps -q 2>/dev/null | wc -l),
|
||||
"total": $(docker ps -aq 2>/dev/null | wc -l),
|
||||
"list": [${containers_json:-}]
|
||||
},
|
||||
"images": {
|
||||
"total": $(docker images -q 2>/dev/null | wc -l),
|
||||
"list": [${images_json:-}]
|
||||
},
|
||||
"compose_files": [${compose_json:-}],
|
||||
"resource_usage": ${stats:-[]}
|
||||
}
|
||||
EOF
|
||||
Reference in New Issue
Block a user