UNPKG

buddy-bot

Version:

Automated & optimized dependency updates for JavaScript & TypeScript projects. Like Renovate & Dependabot.

334 lines 10.1 kB
// Core configuration types export declare interface BuddyBotConfig { verbose?: boolean repository?: { /** Git provider (github, gitlab, etc.) */ provider: 'github' | 'gitlab' | 'bitbucket' /** Repository owner/organization */ owner: string /** Repository name */ name: string /** Base branch for PRs */ baseBranch?: string /** Access token for API operations */ token?: string } schedule?: { /** Cron expression for scheduled runs */ cron?: string /** Time zone for scheduling */ timezone?: string } packages?: { /** Update strategy for dependencies */ strategy: 'major' | 'minor' | 'patch' | 'all' /** Packages to ignore */ ignore?: string[] /** File/directory paths to ignore using glob patterns */ ignorePaths?: string[] /** Packages to pin to specific versions */ pin?: Record<string, string> /** Group related packages together */ groups?: PackageGroup[] /** Include prerelease versions (alpha, beta, rc, etc.) */ includePrerelease?: boolean /** Exclude major version updates (even if strategy allows them) */ excludeMajor?: boolean /** Respect "latest" and "*" version indicators (default: true) */ respectLatest?: boolean } pullRequest?: { /** Commit message format */ commitMessageFormat?: string /** PR title format */ titleFormat?: string /** PR body template */ bodyTemplate?: string /** Auto-merge settings */ autoMerge?: { enabled: boolean strategy: 'merge' | 'squash' | 'rebase' conditions?: string[] } /** Reviewers to assign */ reviewers?: string[] /** Assignees to assign */ assignees?: string[] /** Labels to add */ labels?: string[] } workflows?: { /** Enable workflow generation */ enabled?: boolean /** Output directory for workflows */ outputDir?: string /** Workflow templates to generate */ templates?: { /** Generate comprehensive multi-strategy workflow */ comprehensive?: boolean /** Generate daily patch updates workflow */ daily?: boolean /** Generate weekly minor updates workflow */ weekly?: boolean /** Generate monthly major updates workflow */ monthly?: boolean /** Generate Docker-based workflow */ docker?: boolean /** Generate monorepo workflow */ monorepo?: boolean } /** Custom workflow configurations */ custom?: { /** Workflow name */ name: string /** Cron schedule */ schedule: string /** Update strategy */ strategy?: 'major' | 'minor' | 'patch' | 'all' /** Auto-merge enabled */ autoMerge?: boolean /** Reviewers */ reviewers?: string[] /** Assignees */ assignees?: string[] /** Labels */ labels?: string[] }[] } dashboard?: { /** Enable dependency dashboard */ enabled?: boolean /** Dashboard title */ title?: string /** Dashboard body template */ bodyTemplate?: string /** Labels to add to dashboard issue */ labels?: string[] /** Assignees to assign to dashboard issue */ assignees?: string[] /** Include package.json dependencies */ includePackageJson?: boolean /** Include dependency files (deps.yaml, etc.) */ includeDependencyFiles?: boolean /** Include GitHub Actions */ includeGitHubActions?: boolean /** Show open PRs section */ showOpenPRs?: boolean /** Show detected dependencies section */ showDetectedDependencies?: boolean /** Show deprecated dependencies section */ showDeprecatedDependencies?: boolean /** Issue number to update (if it exists) */ issueNumber?: number } } export declare interface PackageGroup { name: string patterns: string[] strategy?: 'major' | 'minor' | 'patch' | 'all' } // Package management types export declare interface PackageFile { path: string type: 'package.json' | 'bun.lockb' | 'package-lock.json' | 'yarn.lock' | 'pnpm-lock.yaml' | 'deps.yaml' | 'deps.yml' | 'dependencies.yaml' | 'dependencies.yml' | 'pkgx.yaml' | 'pkgx.yml' | '.deps.yaml' | '.deps.yml' | 'composer.json' | 'composer.lock' | 'github-actions' | 'Dockerfile' content: string dependencies: Dependency[] } export declare interface Dependency { name: string currentVersion: string type: 'dependencies' | 'devDependencies' | 'peerDependencies' | 'optionalDependencies' | 'require' | 'require-dev' | 'github-actions' | 'docker-image' file: string line?: number } export declare interface PackageUpdate { name: string currentVersion: string newVersion: string updateType: 'major' | 'minor' | 'patch' dependencyType: 'dependencies' | 'devDependencies' | 'peerDependencies' | 'optionalDependencies' | 'require' | 'require-dev' | 'github-actions' | 'docker-image' file: string metadata?: PackageMetadata releaseNotesUrl?: string changelogUrl?: string homepage?: string } export declare interface PackageMetadata { name: string description?: string repository?: string homepage?: string license?: string author?: string | { name: string, email?: string } keywords?: string[] latestVersion: string versions: string[] weeklyDownloads?: number dependencies?: Record<string, string> devDependencies?: Record<string, string> peerDependencies?: Record<string, string> } // Git and PR types export declare interface GitProvider { createBranch: (branchName: string, baseBranch: string) => Promise<void> commitChanges: (branchName: string, message: string, files: FileChange[]) => Promise<void> createPullRequest: (options: PullRequestOptions) => Promise<PullRequest> getPullRequests: (state?: 'open' | 'closed' | 'all') => Promise<PullRequest[]> updatePullRequest: (prNumber: number, options: Partial<PullRequestOptions>) => Promise<PullRequest> closePullRequest: (prNumber: number) => Promise<void> createComment: (prNumber: number, comment: string) => Promise<void> mergePullRequest: (prNumber: number, strategy?: 'merge' | 'squash' | 'rebase') => Promise<void> deleteBranch: (branchName: string) => Promise<void> createIssue: (options: IssueOptions) => Promise<Issue> getIssues: (state?: 'open' | 'closed' | 'all') => Promise<Issue[]> updateIssue: (issueNumber: number, options: Partial<IssueOptions>) => Promise<Issue> closeIssue: (issueNumber: number) => Promise<void> unpinIssue: (issueNumber: number) => Promise<void> } export declare interface FileChange { path: string content: string type: 'create' | 'update' | 'delete' } export declare interface PullRequestOptions { title: string body: string head: string base: string draft?: boolean reviewers?: string[] teamReviewers?: string[] assignees?: string[] labels?: string[] milestone?: number } export declare interface PullRequest { number: number title: string body: string head: string base: string state: 'open' | 'closed' | 'merged' url: string createdAt: Date updatedAt: Date mergedAt?: Date author: string reviewers: string[] assignees: string[] labels: string[] draft: boolean } export declare interface IssueOptions { title: string body: string assignees?: string[] labels?: string[] milestone?: number } export declare interface Issue { number: number title: string body: string state: 'open' | 'closed' url: string createdAt: Date updatedAt: Date closedAt?: Date author: string assignees: string[] labels: string[] pinned?: boolean } // Update scanning and processing types export declare interface UpdateScanResult { totalPackages: number updates: PackageUpdate[] groups: UpdateGroup[] scannedAt: Date duration: number } export declare interface UpdateGroup { name: string updates: PackageUpdate[] updateType: 'major' | 'minor' | 'patch' title: string body: string } export declare interface DashboardData { openPRs: PullRequest[] detectedDependencies: { /** Package.json files */ packageJson: PackageFile[] /** Dependency files (deps.yaml, etc.) */ dependencyFiles: PackageFile[] /** GitHub Actions files */ githubActions: PackageFile[] } deprecatedDependencies?: DeprecatedDependency[] repository: { owner: string name: string provider: string } lastUpdated: Date } export declare interface DeprecatedDependency { name: string currentVersion: string datasource: string file: string type: string replacementAvailable: boolean suggestedReplacement?: string deprecationMessage?: string } // CLI and command types export declare interface BuddyCommand { name: string description: string options?: CommandOption[] action: (args: any) => Promise<void> } export declare interface CommandOption { name: string description: string type: 'string' | 'boolean' | 'number' default?: any required?: boolean alias?: string } // Utility types export declare interface Logger { info: (message: string, ...args: any[]) => void warn: (message: string, ...args: any[]) => void error: (message: string, ...args: any[]) => void debug: (message: string, ...args: any[]) => void success: (message: string, ...args: any[]) => void } export declare interface VersionRange { raw: string range: string isExact: boolean satisfies: (version: string) => boolean getLatest: (versions: string[]) => string | null } export type BuddyBotOptions = Partial<BuddyBotConfig> // Error types export declare class BuddyError extends Error { public code?: string; public details?: any; constructor(message: string, code?: string, details?: any); } export declare class PackageRegistryError extends BuddyError { public packageName?: string; constructor(message: string, packageName?: string); } export declare class GitProviderError extends BuddyError { public operation?: string; constructor(message: string, operation?: string); } export declare class ConfigurationError extends BuddyError { public configKey?: string; constructor(message: string, configKey?: string); }