Skip to content
Merged
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
2 changes: 2 additions & 0 deletions .github/workflows/update-toolhive-reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ jobs:

- name: Run update script
id: imports
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
chmod +x scripts/update-toolhive-reference.sh
if ! scripts/update-toolhive-reference.sh ${{ steps.get-version.outputs.version }}; then
Expand Down
2 changes: 1 addition & 1 deletion docs/toolhive/guides-cli/registry.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ purposes:

```json title='registry-with-groups.json'
{
"$schema": "https://raw.githubusercontent.com/stacklok/toolhive/main/pkg/registry/data/toolhive-legacy-registry.schema.json",
"$schema": "https://raw.githubusercontent.com/stacklok/toolhive-core/main/registry/types/data/toolhive-legacy-registry.schema.json",
"version": "1.0.0",
"last_updated": "2025-08-15T10:00:00Z",
"servers": {
Expand Down
2 changes: 1 addition & 1 deletion docs/toolhive/reference/registry-schema-toolhive.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ the top of your JSON file:

```json
{
"$schema": "https://raw.githubusercontent.com/stacklok/toolhive/main/pkg/registry/data/toolhive-legacy-registry.schema.json",
"$schema": "https://raw.githubusercontent.com/stacklok/toolhive-core/main/registry/types/data/toolhive-legacy-registry.schema.json",
...
}
```
Expand Down
4 changes: 2 additions & 2 deletions docs/toolhive/reference/registry-schema-upstream.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ the top of your JSON file:

```json
{
"$schema": "https://raw.githubusercontent.com/stacklok/toolhive/main/pkg/registry/data/upstream-registry.schema.json",
"$schema": "https://raw.githubusercontent.com/stacklok/toolhive-core/main/registry/types/data/upstream-registry.schema.json",
...
}
```
Expand Down Expand Up @@ -81,7 +81,7 @@ extensions you can use when building your own registry:

```json title="Example registry file with ToolHive extensions"
{
"$schema": "https://raw.githubusercontent.com/stacklok/toolhive/main/pkg/registry/data/upstream-registry.schema.json",
"$schema": "https://raw.githubusercontent.com/stacklok/toolhive-core/main/registry/types/data/upstream-registry.schema.json",
"version": "1.0.0",
"meta": {
"last_updated": "2026-02-05T16:59:49Z"
Expand Down
4 changes: 2 additions & 2 deletions docs/toolhive/tutorials/custom-registry.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Create a new file called `registry.json` and add the following content:

```json title='registry.json'
{
"$schema": "https://raw.githubusercontent.com/stacklok/toolhive/main/pkg/registry/data/toolhive-legacy-registry.schema.json",
"$schema": "https://raw.githubusercontent.com/stacklok/toolhive-core/main/registry/types/data/toolhive-legacy-registry.schema.json",
"version": "1.0.0",
"last_updated": "2025-08-15T10:00:00Z",
"servers": {
Expand Down Expand Up @@ -259,7 +259,7 @@ if you try to run it):

```json title='registry.json'
{
"$schema": "https://raw.githubusercontent.com/stacklok/toolhive/main/pkg/registry/data/toolhive-legacy-registry.schema.json",
"$schema": "https://raw.githubusercontent.com/stacklok/toolhive-core/main/registry/types/data/toolhive-legacy-registry.schema.json",
"version": "1.0.0",
"last_updated": "2025-08-15T10:00:00Z",
"servers": {
Expand Down
58 changes: 49 additions & 9 deletions scripts/update-toolhive-reference.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ CLI_DOCS_DST="${DOCS_DIR}/toolhive/reference/cli"
API_SPEC_SRC="${IMPORT_DIR}/toolhive/docs/server/swagger.yaml"
API_SPEC_DST="${STATIC_DIR}/api-specs/toolhive-api.yaml"

REGISTRY_SCHEMA_SRC="${IMPORT_DIR}/toolhive/pkg/registry/data/toolhive-legacy-registry.schema.json"
REGISTRY_SCHEMA_SRC="${IMPORT_DIR}/toolhive-core/registry/types/data/toolhive-legacy-registry.schema.json"
REGISTRY_SCHEMA_DST="${STATIC_DIR}/api-specs/toolhive-legacy-registry.schema.json"
UPSTREAM_REGISTRY_SCHEMA_SRC="${IMPORT_DIR}/toolhive/pkg/registry/data/upstream-registry.schema.json"
UPSTREAM_REGISTRY_SCHEMA_SRC="${IMPORT_DIR}/toolhive-core/registry/types/data/upstream-registry.schema.json"
UPSTREAM_REGISTRY_SCHEMA_DST="${STATIC_DIR}/api-specs/upstream-registry.schema.json"
REGISTRY_META_SCHEMA_SRC="${IMPORT_DIR}/toolhive/pkg/registry/data/publisher-provided.schema.json"
REGISTRY_META_SCHEMA_SRC="${IMPORT_DIR}/toolhive-core/registry/types/data/publisher-provided.schema.json"
REGISTRY_META_SCHEMA_DST="${STATIC_DIR}/api-specs/publisher-provided.schema.json"

CRD_API_SRC="${IMPORT_DIR}/toolhive/docs/operator/crd-api.md"
Expand Down Expand Up @@ -59,8 +59,14 @@ else
echo "Using specified tag: $TAG_NAME"
fi

# Build GitHub API auth headers (use GITHUB_TOKEN when available to avoid rate limiting)
GITHUB_API_HEADERS=( -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" )
if [ -n "${GITHUB_TOKEN:-}" ]; then
GITHUB_API_HEADERS+=( -H "Authorization: Bearer ${GITHUB_TOKEN}" )
fi

# Fetch release information
RELEASE_JSON=$(curl -sf "$API_ENDPOINT" || {
RELEASE_JSON=$(curl -sf "${GITHUB_API_HEADERS[@]}" "$API_ENDPOINT" || {
echo "Failed to fetch release information from GitHub API"
exit 1
})
Expand All @@ -78,15 +84,49 @@ if [ -n "${GITHUB_OUTPUT:-}" ]; then
echo "version=$RELEASE_VERSION" >> "$GITHUB_OUTPUT"
fi

# Clean up and prepare import directory
rm -rf ${IMPORT_DIR}/toolhive
mkdir -p ${IMPORT_DIR}/toolhive
# Clean up and prepare import directories
rm -rf ${IMPORT_DIR}/toolhive ${IMPORT_DIR}/toolhive-core
mkdir -p ${IMPORT_DIR}/toolhive ${IMPORT_DIR}/toolhive-core

echo "Fetching ToolHive release (${RELEASE_VERSION}) from: $RELEASE_TARBALL"
echo "Importing to: $IMPORT_DIR"

# Download and extract the release tarball
curl -sfL "$RELEASE_TARBALL" | tar xz --strip-components=1 -C ./imports/toolhive
# Download and extract the toolhive release tarball
curl -sfL "$RELEASE_TARBALL" | tar xz --strip-components=1 -C "${IMPORT_DIR}/toolhive"

# Derive the toolhive-core version used by this ToolHive release from go.mod
CORE_VERSION=$(grep 'github.com/stacklok/toolhive-core' "${IMPORT_DIR}/toolhive/go.mod" | awk '{print $2}' | head -1)
CORE_API_ENDPOINT="https://api.github.com/repos/stacklok/toolhive-core/releases/latest"
if [ -z "$CORE_VERSION" ]; then
echo "Warning: Could not determine toolhive-core version from go.mod; falling back to latest release"
else
echo "Detected toolhive-core version: ${CORE_VERSION}"
CORE_API_ENDPOINT="https://api.github.com/repos/stacklok/toolhive-core/releases/tags/${CORE_VERSION}"
fi

# Fetch the matching toolhive-core release (contains registry schemas)
CORE_RELEASE_JSON=$(curl -sf "${GITHUB_API_HEADERS[@]}" "${CORE_API_ENDPOINT}" || true)
if [ -z "$CORE_RELEASE_JSON" ] && [ -n "$CORE_VERSION" ]; then
echo "Warning: Could not fetch toolhive-core release for version ${CORE_VERSION}; falling back to latest release"
CORE_RELEASE_JSON=$(curl -sf "${GITHUB_API_HEADERS[@]}" \
"https://api.github.com/repos/stacklok/toolhive-core/releases/latest" || {
echo "Failed to fetch toolhive-core release information from GitHub API"
exit 1
})
elif [ -z "$CORE_RELEASE_JSON" ]; then
echo "Failed to fetch toolhive-core release information from GitHub API"
exit 1
fi
CORE_RELEASE_TARBALL=$(echo "$CORE_RELEASE_JSON" | jq -r '.tarball_url // empty')
CORE_RELEASE_VERSION=$(echo "$CORE_RELEASE_JSON" | jq -r '.tag_name // empty')

if [ -z "$CORE_RELEASE_TARBALL" ]; then
echo "Failed to get toolhive-core release tarball URL for version ${CORE_VERSION}"
exit 1
fi

echo "Fetching toolhive-core release (${CORE_RELEASE_VERSION}) for registry schemas"
curl -sfL "$CORE_RELEASE_TARBALL" | tar xz --strip-components=1 -C "${IMPORT_DIR}/toolhive-core"

## CLI reference
echo "Updating ToolHive CLI reference documentation in ${CLI_DOCS_DST}"
Expand Down