-
Notifications
You must be signed in to change notification settings - Fork 2
feat/build pkgx install #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,19 @@ | ||
| #!/bin/sh | ||
|
||
| set -e | ||
| set -eu | ||
|
|
||
| # docker/entrypoint.sh - small wrapper to start cratedocs with the configured mode | ||
| MODE="${CRATEDOCS_MODE:-http}" | ||
| ADDRESS="${CRATEDOCS_ADDRESS:-0.0.0.0:8080}" | ||
| DEBUG="${CRATEDOCS_DEBUG:-false}" | ||
|
|
||
| if [ "$MODE" = "http" ]; then | ||
| if [ "$DEBUG" = "true" ]; then | ||
| exec /usr/local/bin/cratedocs http --address "$ADDRESS" --debug "$@" | ||
| else | ||
| exec /usr/local/bin/cratedocs http --address "$ADDRESS" "$@" | ||
| fi | ||
| else | ||
| exec /usr/local/bin/cratedocs "$MODE" "$@" | ||
| fi | ||
| # If explicit args provided, run with those | ||
| if [ "$#" -gt 0 ]; then | ||
| exec /usr/local/bin/cratedocs "$@" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| dependencies: | ||
| pkgx.sh/brewkit: ^0 || ^1 | ||
|
|
||
| env: | ||
| PKGX_PANTRY_PATH: ${{srcroot}} | ||
| PKGX_PANTRY_DIR: ${{srcroot}} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| distributable: | ||
| url: https://github.com/promptexecution/rust-cargo-docs-rag-mcp/archive/refs/tags/{{ version.tag }}.tar.gz | ||
| strip-components: 1 | ||
|
|
||
| versions: | ||
| github: promptexecution/rust-cargo-docs-rag-mcp | ||
|
|
||
| dependencies: | ||
| openssl.org: '>=1.1' | ||
|
|
||
| build: | ||
| dependencies: | ||
| rust-lang.org: '>=1.91' | ||
| rust-lang.org/cargo: '*' | ||
| script: | ||
| - cargo install --locked \ | ||
| --root={{ prefix }} \ | ||
| --path=. \ | ||
| --bin cratedocs | ||
|
|
||
| provides: | ||
| - bin/cratedocs | ||
|
|
||
| test: | ||
| - cratedocs version | grep {{version}} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,22 +1,52 @@ | ||
| #!/bin/sh | ||
| set -e | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| if [ -z "$1" ]; then | ||
| echo "Usage: $0 <version>" >&2 | ||
| exit 2 | ||
| if [ "$#" -ne 1 ]; then | ||
| echo "usage: $0 <semver>" >&2 | ||
| exit 1 | ||
| fi | ||
| VER="$1" | ||
|
|
||
| # Update Cargo.toml version field | ||
| if command -v perl >/dev/null 2>&1; then | ||
| perl -0777 -pe "s/^version\s*=\s*\".*\"/version = \"${VER}\"/m" -i Cargo.toml | ||
| else | ||
| sed -E "s/^version[[:space:]]*=.*$/version = \"${VER}\"/" Cargo.toml > Cargo.toml.tmp && mv Cargo.toml.tmp Cargo.toml | ||
| fi | ||
| version="$1" | ||
|
|
||
| # Regenerate lockfile | ||
| if command -v cargo >/dev/null 2>&1; then | ||
| cargo generate-lockfile || true | ||
| fi | ||
| # Update Cargo.toml package version (first occurrence only to avoid dependency matches) | ||
| python3 - "$version" <<'PY' | ||
| import pathlib, re, sys | ||
| version = sys.argv[1] | ||
| path = pathlib.Path("Cargo.toml") | ||
| text = path.read_text() | ||
| new_text, count = re.subn(r'(?m)^(version\s*=\s*)"[^"]+"', rf'\1"{version}"', text, count=1) | ||
| if count != 1: | ||
| raise SystemExit("Could not update version in Cargo.toml") | ||
| path.write_text(new_text) | ||
| PY | ||
|
|
||
| # Update Cargo.lock entry for this crate | ||
| python3 - "$version" <<'PY' | ||
| import pathlib, sys | ||
| version = sys.argv[1] | ||
| path = pathlib.Path("Cargo.lock") | ||
| lines = path.read_text().splitlines() | ||
| out_lines = [] | ||
| in_pkg = False | ||
| target = 'name = "rust-cargo-docs-rag-mcp"' | ||
| updated = False | ||
| for line in lines: | ||
| stripped = line.strip() | ||
| if stripped == target: | ||
| in_pkg = True | ||
| out_lines.append(line) | ||
| continue | ||
| if in_pkg and stripped.startswith("version = "): | ||
| out_lines.append(f'version = "{version}"') | ||
| in_pkg = False | ||
| updated = True | ||
| continue | ||
| if stripped.startswith("name = ") and stripped != target: | ||
| in_pkg = False | ||
| out_lines.append(line) | ||
|
|
||
| if not updated: | ||
| raise SystemExit("Could not update version in Cargo.lock") | ||
|
|
||
| exit 0 | ||
| path.write_text("\n".join(out_lines) + "\n") | ||
| PY |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| { | ||
| "$schema": "https://static.modelcontextprotocol.io/schemas/2025-10-17/server.schema.json", | ||
| "name": "io.github.promptexecution/rust-cargo-docs-rag-mcp", | ||
| "title": "Rust Cargo Docs RAG", | ||
| "description": "Lookup Rust crate and item documentation via docs.rs and crates.io search.", | ||
| "websiteUrl": "https://github.com/promptexecution/rust-cargo-docs-rag-mcp", | ||
| "repository": { | ||
| "url": "https://github.com/promptexecution/rust-cargo-docs-rag-mcp", | ||
| "source": "github" | ||
| }, | ||
| "version": "0.3.0", | ||
| "packages": [ | ||
| { | ||
| "registryType": "oci", | ||
| "identifier": "ghcr.io/promptexecution/rust-cargo-docs-rag-mcp:0.3.0", | ||
| "runtimeHint": "docker", | ||
| "transport": { | ||
| "type": "stdio" | ||
| }, | ||
| "environmentVariables": [ | ||
| { | ||
| "name": "CRATEDOCS_MODE", | ||
| "value": "stdio", | ||
| "description": "Ensure the container exposes the MCP stdio transport when run by clients." | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.