npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

repo-patrol

v0.1.12

Published

AI-powered OSS repository maintenance patrol agent as a CDK L3 Construct

Downloads

1,619

Readme

repo-patrol

AI-powered OSS repository maintenance patrol agent as an AWS CDK L3 Construct.

Automates routine repository maintenance tasks — PR review, issue triage, Dependabot handling, CI failure analysis, dependency checks, and health monitoring — using Strands Agents on Amazon Bedrock AgentCore.

Architecture

┌──────────────────────────────────────────────────────────────────┐
│ RepoPatrol (CDK L3 Construct)                                    │
│                                                                  │
│  CloudFront ──── Next.js Lambda (Dashboard)                      │
│                    │  next-auth + Cognito                         │
│                    ↕              ↕                               │
│              S3 (reports)   DynamoDB                              │
│                    ↑         ├─ repos (repository config)         │
│                    │         ├─ job_history (execution logs)      │
│                    │         └─ processed_items (idempotency)     │
│                    │                                             │
│  EventBridge Scheduler ──── Dispatcher Lambda                    │
│  (per repo × jobType)        ↕                                   │
│                         Bedrock AgentCore Runtime                │
│                         (Docker / Python / Strands)              │
│                              ↕                                   │
│                         GitHub API (GitHub App auth)              │
│                                                                  │
│  Cognito User Pool (user management)                             │
│  Secrets Manager (GitHub App credentials)                        │
└──────────────────────────────────────────────────────────────────┘

Install

npm install repo-patrol
# or
pnpm add repo-patrol

Peer dependencies:

npm install aws-cdk-lib constructs @aws-cdk/aws-bedrock-agentcore-alpha

Usage

import { Duration } from 'aws-cdk-lib';
import { ScheduleExpression } from 'aws-cdk-lib/aws-scheduler';
import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager';
import { RepoPatrol, JobType } from 'repo-patrol';

const secret = secretsmanager.Secret.fromSecretNameV2(this, 'Secret', 'repo-patrol/github-app');

new RepoPatrol(this, 'Patrol', {
  githubAppSecret: secret,

  // Optional
  modelId: 'us.anthropic.claude-sonnet-4-20250514-v1:0',
  dryRun: false,
  enableDashboard: true,
  mfaRequired: true, // TOTP MFA for dashboard login (default: true)
  adminEmails: ['[email protected]'],

  // IaC-managed repositories (optional)
  repositories: [
    {
      owner: 'my-org',
      repo: 'my-app',
      jobs: {
        [JobType.REVIEW_PULL_REQUESTS]: {
          schedule: ScheduleExpression.cron({ hour: '1', minute: '0' }),
        },
        [JobType.HANDLE_DEPENDABOT]: {
          schedule: ScheduleExpression.rate(Duration.hours(6)),
        },
        [JobType.REPO_HEALTH_CHECK]: {
          schedule: ScheduleExpression.cron({ minute: '0', hour: '0', weekDay: 'MON' }),
        },
      },
    },
  ],
});

Repository Management

Repositories can be managed in two ways:

1. IaC-managed (via repositories prop)

Repositories defined in the repositories prop are registered automatically at deploy time. A Custom Resource invokes the Registry Lambda to create DynamoDB records and EventBridge schedules. The GitHub App installation ID is resolved automatically.

  • Add: Include in repositories array -> deployed on cdk deploy
  • Update: Change schedule/config in code -> updated on next deploy
  • Remove: Remove from array -> DynamoDB record + EventBridge schedules are deleted

2. UI-managed (via Dashboard)

Repositories can also be registered and configured through the Dashboard UI after deployment. No CDK changes required.

Mixed mode: Both approaches coexist independently. IaC-managed and UI-managed repositories do not interfere with each other. However, if a UI-managed repository is later added to the repositories prop, the CDK definition becomes the source of truth and UI changes will be overwritten on deploy (drift).

Prerequisites

GitHub App

Create a GitHub App with the following permissions:

| Permission | Access | Purpose | |---|---|---| | Pull requests | Read & Write | Review, comment, approve, merge | | Issues | Read & Write | Triage, label, comment | | Contents | Read | Read repository files | | Checks / Commit statuses | Read | CI failure analysis |

Store the credentials in AWS Secrets Manager:

{
  "app_id": "123456",
  "private_key": "-----BEGIN RSA PRIVATE KEY-----\n..."
}

Amazon Bedrock

Enable the desired foundation model (default: us.anthropic.claude-haiku-4-5-20251001-v1:0) in your AWS account via the Bedrock console.

Job Types

| Job | Description | |---|---| | review_pull_requests | Review open PRs and post comments | | triage_issues | Analyze issues, add labels, post comments | | handle_dependabot | Auto-approve/merge Dependabot PRs | | analyze_ci_failures | Analyze CI failure logs, suggest fixes | | check_dependencies | Check for dependency updates | | repo_health_check | Audit README, LICENSE, CI config |

All jobs default to daily at UTC 00:00 (cron(0 0 * * ? *)). Override per job via the Dashboard UI or Registry API.

How It Works

  1. Register repositories via the Registry API (or Dashboard UI)
  2. EventBridge Scheduler creates independent schedules per (repo x jobType)
  3. Dispatcher Lambda receives the schedule event and invokes the Bedrock AgentCore Runtime
  4. Strands Agent executes the job using 25 tools (GitHub API, CI analysis, dependency checks, etc.)
  5. Reports are saved to S3 and execution history to DynamoDB
  6. Dashboard displays repository status, job history, and reports

Idempotency

Each PR/Issue is processed only once per job run. The processed_items DynamoDB table tracks what has been handled, with a 30-day TTL for automatic cleanup.

Drift Protection

Dynamic EventBridge Schedules are managed outside CloudFormation. To prevent orphaned resources:

  • Stack deletion: A Custom Resource automatically deletes all repo-patrol-* schedules
  • Partial failure (POST): If schedule creation fails, the DynamoDB entry is rolled back
  • Partial failure (PUT): Returns a warning; retry the update to re-sync
  • Manual repair: POST /repos/sync re-syncs all schedules from DynamoDB state

Dashboard

When enableDashboard: true (default), the construct deploys:

  • Cognito User Pool for authentication (self-signup disabled)
  • Next.js 15 app on Lambda (ARM64, Docker) via CloudFront
  • Repository management UI (register, configure, delete)
  • Job status monitoring and report viewing

Safety

  • dryRun: true disables all GitHub write operations
  • Dependabot: auto-merge patch, auto-approve minor, report-only for major
  • Bot comments are prefixed with [repo-patrol]
  • GitHub App uses short-lived installation tokens (1-hour expiry)

AWS Resources Created

| Resource | Count | Description | |---|---|---| | S3 Bucket | 1 | Report storage | | DynamoDB Tables | 3 | repos, job_history, processed_items | | Bedrock AgentCore Runtime | 1 | Strands Agent container (ARM64) | | Lambda Functions | 4 | Dispatcher, Registry API, Schedule Cleanup, Webapp | | IAM Roles | 1 + per-Lambda | Scheduler execution role + Lambda execution roles | | EventBridge Schedules | Dynamic | Per repo x jobType (e.g. 5 repos x 6 jobs = 30 schedules) | | Custom Resources | 1 + per IaC repo | Schedule Cleanup + Repo Seeder per IaC-managed repository | | Secrets Manager | 0 | Uses existing secret (user-provided ARN) | | CloudFront Distribution | 0-1 | Dashboard CDN (if enableDashboard: true) | | Cognito User Pool | 0-1 | Dashboard auth with MFA (if enableDashboard: true) |

Cost Estimate

All resources are serverless / pay-per-use. Prices are for us-east-1 (On-Demand).

Per-Resource Pricing

| Resource | Pricing Model | Unit Price | |---|---|---| | Bedrock AgentCore Runtime | vCPU + Memory | $0.0895/vCPU-hour + $0.00945/GB-hour | | Bedrock Model (Haiku 4.5) | Token-based | $0.25/1M input tokens, ~$0.25/1M output tokens | | Lambda (ARM64) | Request + Duration | $0.20/1M requests + $0.0000133334/GB-second | | DynamoDB (On-Demand) | Read/Write units | $0.125/1M RRU + $0.625/1M WRU + $0.25/GB-month storage | | S3 (Standard) | Storage + Requests | $0.023/GB-month + $0.005/1K PUT + $0.0004/1K GET | | EventBridge Scheduler | Invocations | First 14M/month free, then $1.00/1M | | CloudFront | Requests + Transfer | $0.01/10K HTTPS requests + 1TB/month free transfer | | Cognito (Advanced Security) | MAU | $0.02/MAU (Plus tier) | | Secrets Manager | Per secret | $0.40/secret/month + $0.05/10K API calls |

Monthly Cost Estimate

Assumes each job runs ~2 min with 2 vCPU + 4 GB, processing ~15K tokens per run.

| Category | 5 repos (small) | 20 repos (medium) | |---|---|---| | Bedrock AgentCore Runtime | ~$6.50 | ~$26.00 | | Bedrock Model (Haiku 4.5) | ~$3.50 | ~$14.00 | | Lambda (all functions) | ~$0.10 | ~$0.30 | | Secrets Manager | $0.40 | $0.40 | | DynamoDB | ~$0.01 | ~$0.05 | | S3 | ~$0.02 | ~$0.05 | | EventBridge Scheduler | $0.00 | $0.00 | | CloudFront + Cognito | ~$0.15 | ~$0.15 | | Total | ~$10–12/month | ~$41–47/month |

Cost drivers: AgentCore Runtime compute and Bedrock model invocations account for ~90% of the cost. Costs scale linearly with the number of repositories and schedule frequency.

To reduce costs:

  • Use Haiku 4.5 (default) instead of Sonnet (~12x cheaper per token)
  • Reduce schedule frequency for less critical jobs
  • Set enableDashboard: false to eliminate CloudFront + Cognito + Webapp Lambda
  • Reduce the number of enabled job types per repository

API Reference

See API.md for the full construct API documentation.

Development

# Install dependencies
pnpm install

# Build (jsii compile + test + lint + package)
pnpm exec projen build

# Run tests only
pnpm exec projen test

# Synthesize projen config
pnpm exec projen

License

Apache-2.0