mirror of
https://github.com/outbackdingo/optimclaw.git
synced 2026-08-25 14:53:34 +00:00
* refactor(registry): move MCP server entries from code to JSON manifests Move 8 hardcoded MCP server RegistryEntry structs from builtin_entries() into data-driven JSON files under registry/mcp-servers/, matching the existing pattern used by tools and channels. Exclude the GitHub MCP entry which conflicts with the WASM GitHub tool's OAuth flow. Extend ManifestKind with McpServer, make version/source optional on ExtensionManifest (MCP servers don't need them), and add url/auth fields for MCP-specific config. Update build.rs, embedded catalog, catalog loader, installer, and CLI display to handle the new kind and optional fields. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * fix(registry): address PR review — add missing slack-mcp, remove .expect(), fix fmt - Add missing slack-mcp.json (was dropped during migration) - Remove production .expect() in get_strict(), replace with .ok_or_else() - Clean up unwrap_or_default() in key_for() to use .next() directly - Log warning for MCP manifests missing url field instead of silent empty - Run cargo fmt to fix formatting diffs Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * ci: re-trigger CI with correct base branch (staging) Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * fix(ci): improve no-panics check to properly exclude test modules The grep-based filter only excluded lines literally containing #[cfg(test)], #[test], or 'mod tests' — not lines *inside* test modules. Use awk to track hunk context from diff @@ headers and skip all added lines within test module hunks. [skip-regression-check] Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * refactor(registry): remove slack-mcp MCP entry (conflicts with WASM slack tool) Remove slack-mcp.json alongside the already-excluded github MCP entry — both conflict with existing WASM tools of the same name. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * fix(registry): address re-review — skip invalid MCP entries, fix install order - to_registry_entry() now returns Option<RegistryEntry>; MCP manifests missing a url field are skipped with a warning instead of creating broken entries with empty URLs - Move McpServer early-return before require_source() in install paths so the error message is clear ("cannot install MCP servers") rather than the misleading "missing source spec" - Add test for MCP manifest with missing URL returning None Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
153 lines
4.9 KiB
YAML
153 lines
4.9 KiB
YAML
name: Code Style
|
|
on:
|
|
pull_request:
|
|
|
|
jobs:
|
|
format:
|
|
name: Formatting
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v6
|
|
- name: Install Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
components: rustfmt
|
|
- name: Check formatting
|
|
run: cargo fmt --all -- --check
|
|
|
|
deny-check:
|
|
name: cargo-deny
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v6
|
|
- name: Run cargo deny
|
|
uses: EmbarkStudios/cargo-deny-action@v2
|
|
|
|
clippy:
|
|
name: Clippy (${{ matrix.name }})
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- name: all-features
|
|
flags: "--all-features"
|
|
- name: default
|
|
flags: ""
|
|
- name: libsql-only
|
|
flags: "--no-default-features --features libsql"
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v6
|
|
- name: Install Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
components: clippy
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
key: clippy-${{ matrix.name }}
|
|
- name: Check lints
|
|
run: cargo clippy --all --benches --tests --examples ${{ matrix.flags }} -- -D warnings
|
|
|
|
clippy-windows:
|
|
name: Clippy Windows (${{ matrix.name }})
|
|
if: github.base_ref == 'main'
|
|
runs-on: windows-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- name: all-features
|
|
flags: "--all-features"
|
|
- name: default
|
|
flags: ""
|
|
- name: libsql-only
|
|
flags: "--no-default-features --features libsql"
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v6
|
|
- name: Install Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
components: clippy
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
key: clippy-windows-${{ matrix.name }}
|
|
- name: Check lints
|
|
run: cargo clippy --all --benches --tests --examples ${{ matrix.flags }} -- -D warnings
|
|
|
|
no-panics:
|
|
name: No panics in production code
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v6
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Check for .unwrap(), .expect(), assert!() in production code
|
|
run: |
|
|
BASE="${{ github.event.pull_request.base.sha }}"
|
|
# Get the full diff for .rs files (production only, exclude tests/ directory)
|
|
DIFF=$(git diff "$BASE"...HEAD -- 'src/**/*.rs' 'crates/**/*.rs' || true)
|
|
|
|
if [ -z "$DIFF" ]; then
|
|
echo "No production Rust changes detected."
|
|
exit 0
|
|
fi
|
|
|
|
# Extract added lines, skipping those inside test modules.
|
|
# Track whether we're inside a test module by watching hunk headers
|
|
# (lines starting with @@) whose context contains "mod tests" or "#[cfg(test)]".
|
|
ADDED=$(echo "$DIFF" | awk '
|
|
/^@@/ {
|
|
# Hunk context (after the second @@) tells us the function/module scope
|
|
in_test = (tolower($0) ~ /mod tests/ || $0 ~ /#\[cfg\(test\)\]/ || $0 ~ /#\[test\]/)
|
|
}
|
|
/^\+[^+]/ && !in_test { print }
|
|
' || true)
|
|
|
|
if [ -z "$ADDED" ]; then
|
|
echo "No production Rust changes detected (test-only changes excluded)."
|
|
exit 0
|
|
fi
|
|
|
|
# Match panic-inducing patterns, excluding safety suppressions
|
|
VIOLATIONS=$(echo "$ADDED" \
|
|
| grep -E '\.(unwrap|expect)\(|[^_]assert(_eq|_ne)?!' \
|
|
| grep -Ev 'debug_assert|// safety:' \
|
|
|| true)
|
|
|
|
if [ -n "$VIOLATIONS" ]; then
|
|
echo "::error::Found .unwrap(), .expect(), or assert!() in production code."
|
|
echo "Production code must use proper error handling instead of panicking."
|
|
echo "Suppress false positives with an inline '// safety: <reason>' comment."
|
|
echo ""
|
|
echo "$VIOLATIONS" | head -20
|
|
echo ""
|
|
COUNT=$(echo "$VIOLATIONS" | wc -l | tr -d ' ')
|
|
echo "Total: $COUNT violation(s)"
|
|
exit 1
|
|
fi
|
|
|
|
echo "OK: No panic-inducing calls in changed production code."
|
|
|
|
# Roll-up job for branch protection
|
|
code-style:
|
|
name: Code Style (fmt + clippy + deny)
|
|
runs-on: ubuntu-latest
|
|
if: always()
|
|
needs: [format, clippy, clippy-windows, deny-check, no-panics]
|
|
steps:
|
|
- run: |
|
|
if [[ "${{ needs.format.result }}" != "success" || "${{ needs.clippy.result }}" != "success" || "${{ needs.deny-check.result }}" != "success" || "${{ needs.no-panics.result }}" != "success" ]]; then
|
|
echo "One or more jobs failed"
|
|
exit 1
|
|
fi
|
|
# clippy-windows only runs on main PRs, so skipped is acceptable but failure is not
|
|
if [[ "${{ needs.clippy-windows.result }}" != "success" && "${{ needs.clippy-windows.result }}" != "skipped" ]]; then
|
|
echo "Windows clippy failed: ${{ needs.clippy-windows.result }}"
|
|
exit 1
|
|
fi
|