← back to naufalafif__homebrew-tap

Function bodies 4 total

All specs Real LLM only Function bodies
AgentGuard class · ruby · L1-L43 (43 LOC)
Formula/agent-guard.rb
class AgentGuard < Formula
  desc "macOS menu bar security scanner for MCP servers and AI agent skills"
  homepage "https://github.com/naufalafif/agent-guard"
  url "https://github.com/naufalafif/agent-guard/archive/refs/tags/v1.0.0.tar.gz"
  sha256 "d4679bb627de218d916a9d401b1e5566ab8a7507a63543e29f302cc592d41f28"
  license "MIT"

  depends_on :macos
  depends_on xcode: ["14.0", :build]
  depends_on "uv"

  def install
    system "swift", "build", "-c", "release", "--disable-sandbox"

    # Create .app bundle
    app_contents = prefix/"AgentGuard.app/Contents"
    (app_contents/"MacOS").mkpath
    (app_contents/"MacOS").install ".build/release/AgentGuard"
    app_contents.install "Info.plist"

    # Ad-hoc sign
    system "codesign", "--force", "--sign", "-", prefix/"AgentGuard.app"
  end

  def post_install
    ohai "Installing mcp-scanner..."
    system "uv", "tool", "install", "cisco-ai-mcp-scanner"

    ohai "Installing skill-scanner..."
    system "uv", "tool", "install", "cisco-
install method · ruby · L12-L23 (12 LOC)
Formula/agent-guard.rb
  def install
    system "swift", "build", "-c", "release", "--disable-sandbox"

    # Create .app bundle
    app_contents = prefix/"AgentGuard.app/Contents"
    (app_contents/"MacOS").mkpath
    (app_contents/"MacOS").install ".build/release/AgentGuard"
    app_contents.install "Info.plist"

    # Ad-hoc sign
    system "codesign", "--force", "--sign", "-", prefix/"AgentGuard.app"
  end
post_install method · ruby · L25-L40 (16 LOC)
Formula/agent-guard.rb
  def post_install
    ohai "Installing mcp-scanner..."
    system "uv", "tool", "install", "cisco-ai-mcp-scanner"

    ohai "Installing skill-scanner..."
    system "uv", "tool", "install", "cisco-ai-skill-scanner"

    # Initialize config and cache dirs
    config_dir = Pathname.new(Dir.home)/".config/mcp-scan"
    cache_dir = Pathname.new(Dir.home)/".cache/mcp-scan"
    config_dir.mkpath
    cache_dir.mkpath

    unless (config_dir/"config").exist?
      (config_dir/"config").write("SCAN_INTERVAL=30  # Scan interval in minutes\n")
    end
caveats function · ruby · L46-L58 (13 LOC)
Formula/agent-guard.rb
  def caveats
    <<~EOS
      To start AgentGuard:
        open #{prefix}/AgentGuard.app

      To launch at login:
        Add AgentGuard.app in System Settings > General > Login Items

      To uninstall scanners:
        uv tool uninstall cisco-ai-mcp-scanner
        uv tool uninstall cisco-ai-skill-scanner
    EOS
  end