Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions sitemd/0.1.3/.codex-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "sitemd",
"version": "0.1.3"
}
11 changes: 11 additions & 0 deletions sitemd/0.1.3/.mcp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"mcpServers": {
"sitemd": {
"type": "stdio",
"command": "./sitemd/sitemd",
"args": ["mcp"],
"env": {},
"startup_timeout_sec": 20
}
}
}
139 changes: 139 additions & 0 deletions sitemd/0.1.3/sitemd/install
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
#!/bin/sh
# sitemd install — downloads the sitemd binary for your platform.
# No Node.js required. Run: ./sitemd/install
#
# This script detects your OS and architecture, downloads the correct
# binary from GitHub Releases, and places it at sitemd/sitemd.

set -e

REPO="sitemd-cc/sitemd"
# On-disk name is sitemd-bin to avoid collision with the sitemd/cli.js JS
# wrapper that npm's bin shim points at. Archive still ships the file as
# `sitemd` / `sitemd.exe` — we rename during extraction (see below).
BINARY_NAME="sitemd-bin"
ARCHIVE_BINARY_NAME="sitemd"
FORCE=0
[ "$1" = "--force" ] && FORCE=1

# Detect platform
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)

case "$OS" in
darwin) PLATFORM="darwin" ;;
linux) PLATFORM="linux" ;;
mingw*|msys*|cygwin*) PLATFORM="win" ;;
*) echo "Unsupported OS: $OS" >&2; exit 1 ;;
esac

case "$ARCH" in
x86_64|amd64) ARCH="x64" ;;
arm64|aarch64) ARCH="arm64" ;;
*) echo "Unsupported architecture: $ARCH" >&2; exit 1 ;;
esac

if [ "$PLATFORM" = "win" ]; then
ASSET="sitemd-${PLATFORM}-${ARCH}.zip"
BINARY_NAME="sitemd-bin.exe"
ARCHIVE_BINARY_NAME="sitemd.exe"
else
ASSET="sitemd-*-${PLATFORM}-${ARCH}.tar.gz"
fi

# Find the sitemd directory (where this script lives)
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"

# Determine wanted version. Prefer the sibling package.json (npm package or
# project created by `sitemd init`); fall back to GitHub Releases API for
# clone-from-source and download-the-tarball flows.
WANTED_VERSION=""
if [ -f "$SCRIPT_DIR/../package.json" ]; then
WANTED_VERSION=$(grep '"version"' "$SCRIPT_DIR/../package.json" | head -1 | sed 's/.*"version" *: *"\([^"]*\)".*/\1/')
fi

if [ -z "$WANTED_VERSION" ]; then
echo " sitemd install"
echo " Platform: ${PLATFORM}-${ARCH}"
echo " Finding latest release..."
if command -v curl >/dev/null 2>&1; then
LATEST=$(curl -fsSL "https://api.github.com/repos/$REPO/releases/latest" | grep '"tag_name"' | head -1 | sed 's/.*"tag_name": *"//;s/".*//')
elif command -v wget >/dev/null 2>&1; then
LATEST=$(wget -qO- "https://api.github.com/repos/$REPO/releases/latest" | grep '"tag_name"' | head -1 | sed 's/.*"tag_name": *"//;s/".*//')
else
echo " Error: curl or wget required" >&2
exit 1
fi
if [ -z "$LATEST" ]; then
echo " Error: could not determine latest release" >&2
exit 1
fi
WANTED_VERSION="${LATEST#v}"
fi

VERSION="$WANTED_VERSION"
LATEST="v$VERSION"

# Idempotency: if a binary is already installed at the wanted version, exit.
if [ "$FORCE" = "0" ] && [ -f "$SCRIPT_DIR/$BINARY_NAME" ]; then
EXISTING_VERSION=$("$SCRIPT_DIR/$BINARY_NAME" --version 2>/dev/null | head -1 | sed 's/.*[^0-9]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/')
if [ -n "$EXISTING_VERSION" ] && [ "$EXISTING_VERSION" = "$VERSION" ]; then
exit 0
fi
if [ -n "$EXISTING_VERSION" ] && [ "$EXISTING_VERSION" != "$VERSION" ]; then
echo " sitemd: upgrading $EXISTING_VERSION -> $VERSION"
fi
fi

echo " sitemd install"
echo " Platform: ${PLATFORM}-${ARCH}"
echo " Version: $VERSION"

# Build download URL
ARCHIVE="sitemd-${VERSION}-${PLATFORM}-${ARCH}"
if [ "$PLATFORM" = "win" ]; then
ARCHIVE="${ARCHIVE}.zip"
else
ARCHIVE="${ARCHIVE}.tar.gz"
fi
URL="https://github.com/$REPO/releases/download/$LATEST/$ARCHIVE"

# Download
TMPDIR=$(mktemp -d)
TMPFILE="$TMPDIR/$ARCHIVE"

echo " Downloading $ARCHIVE..."
if command -v curl >/dev/null 2>&1; then
curl -fsSL -o "$TMPFILE" "$URL"
else
wget -q -O "$TMPFILE" "$URL"
fi

# Extract binary
echo " Extracting..."
if [ "$PLATFORM" = "win" ]; then
unzip -qo "$TMPFILE" -d "$TMPDIR/extracted"
else
mkdir -p "$TMPDIR/extracted"
tar -xzf "$TMPFILE" -C "$TMPDIR/extracted"
fi

# Find the binary inside the archive (ships as sitemd/sitemd, renamed on extraction to sitemd-bin)
EXTRACTED_BIN=$(find "$TMPDIR/extracted" -name "$ARCHIVE_BINARY_NAME" -type f | head -1)
if [ -z "$EXTRACTED_BIN" ]; then
echo " Error: binary not found in archive" >&2
rm -rf "$TMPDIR"
exit 1
fi

# Install
cp "$EXTRACTED_BIN" "$SCRIPT_DIR/$BINARY_NAME"
chmod +x "$SCRIPT_DIR/$BINARY_NAME"

# Clean up
rm -rf "$TMPDIR"

echo ""
echo " Installed: $SCRIPT_DIR/$BINARY_NAME"
echo " Run: ./sitemd/sitemd launch"
echo ""
Loading