Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ node_modules/
.pnp.js

# Build outputs
dist/
lib/
*.tsbuildinfo

Expand Down
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.0.1] - 2025-08-12

### Fixed
- Fixed "Git command failed: symbolic-ref refs/remotes/origin/HEAD" error in GitHub Actions environments (#3)
- Fixed "File not found: dist/index.js" error by committing distribution files (#7)
- Improved default branch detection with robust fallback strategies
- Enhanced repository validation to work in environments where symbolic-ref is not available

### Changed
- Repository validation now uses current branch or falls back to 'main' instead of relying solely on symbolic-ref
- Removed `dist/` from `.gitignore` to allow GitHub Actions distribution files to be committed

## [1.0.0] - 2025-08-10

### Added
- Initial release of ReleaseBot
- AI-powered release automation for GitHub Actions
- Automated changelog generation
- Semantic versioning support
- Release workflow management
- Git operations and repository validation
87 changes: 87 additions & 0 deletions dist/KeepAChangelogManager.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/**
* KeepAChangelogManager - Manages CHANGELOG.md files following Keep a Changelog format
*
* This module provides functionality to parse, update, and maintain CHANGELOG.md files
* following the Keep a Changelog specification (https://keepachangelog.com/).
*
* @example
* ```typescript
* const manager = new KeepAChangelogManager();
* const content = await manager.readChangelogFile();
* const changelog = manager.parseChangelog(content);
* await manager.addUnreleasedEntries([newEntry]);
* ```
*/
import type { ChangelogEntry, ChangelogData, SemanticVersion, ParsedChangelog, ChangelogGenerationOptions, ChangelogValidationResult } from './types/index.js';
/**
* Custom error class for changelog-related operations
*/
export declare class ChangelogError extends Error {
readonly code: string;
readonly context: Record<string, unknown> | undefined;
readonly recoverable: boolean;
constructor(message: string, code?: string, context?: Record<string, unknown>, recoverable?: boolean);
}
/**
* Keep a Changelog manager for parsing, updating, and maintaining CHANGELOG.md files
*/
export declare class KeepAChangelogManager {
private static readonly DEFAULT_HEADER;
private static readonly SECTION_ORDER;
private static readonly SECTION_MAPPING;
private changelogPath;
private currentChangelog?;
/**
* Creates a new KeepAChangelogManager instance
* @param changelogPath - Path to the CHANGELOG.md file
*/
constructor(changelogPath?: string);
/**
* Parse a changelog from markdown content
* @param content - Raw markdown content
* @returns Parsed changelog structure
*/
parseChangelog(content: string): ParsedChangelog;
/**
* Generate markdown content from changelog data
* @param data - Changelog data structure
* @param options - Generation options
* @returns Generated markdown content
*/
generateMarkdown(data: ChangelogData, options?: ChangelogGenerationOptions): string;
/**
* Add new entries to the unreleased section
* @param entries - Changelog entries to add
*/
addUnreleasedEntries(entries: ChangelogEntry[]): Promise<void>;
/**
* Create a new release from unreleased entries
* @param version - Version for the new release
* @param date - Release date (defaults to now)
* @returns Changelog data for the new release
*/
createRelease(version: SemanticVersion, date?: Date): Promise<ChangelogData>;
/**
* Read changelog file from disk
* @param filePath - Optional file path (uses instance path if not provided)
* @returns File content as string
*/
readChangelogFile(filePath?: string): Promise<string>;
/**
* Write changelog content to disk
* @param content - Markdown content to write
* @param filePath - Optional file path (uses instance path if not provided)
*/
writeChangelogFile(content: string, filePath?: string): Promise<void>;
/**
* Validate changelog format
* @param content - Markdown content to validate
* @returns Validation result
*/
validateFormat(content: string): ChangelogValidationResult;
private getEntriesForSection;
private formatEntry;
private formatVersion;
private formatDate;
private rebuildMarkdown;
}
1 change: 1 addition & 0 deletions dist/KeepAChangelogManager.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

116 changes: 116 additions & 0 deletions dist/ReleaseWorkflow.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
/**
* ReleaseWorkflow - Main orchestrator for the AI Release Tool
*
* This class coordinates all the core modules to execute a complete release workflow:
* 1. Git operations - analyze changes and commits
* 2. Version analysis - determine appropriate version bump
* 3. AI analysis - categorize changes and generate descriptions
* 4. Changelog management - update CHANGELOG.md
* 5. Git operations - create release branch and commit changes
*/
import type { VersionBumpType, ChangelogData } from './types/index.js';
/**
* Configuration for the release workflow
*/
export interface WorkflowConfig {
mainBranch: string;
featureBranch: string;
githubToken: string;
packageJsonPath: string;
changelogPath: string;
versioningStrategy: 'conventional' | 'ai' | 'hybrid';
aiProvider: 'openai' | 'anthropic';
openaiApiKey?: string;
anthropicApiKey?: string;
aiModel: string;
aiConfidenceThreshold: number;
conventionalTypes: string[];
preRelease: boolean;
preReleaseIdentifier: string;
skipChangelog: boolean;
skipGitTag: boolean;
maxCommitsAnalysis: number;
debugMode: boolean;
}
/**
* Result of the release workflow execution
*/
export interface ReleaseResult {
version: string;
releaseBranch: string;
versionBump: VersionBumpType;
changelogEntry: string;
analysisStrategy: string;
aiConfidence: number | undefined;
reasoning: string[];
commitCount: number;
breakingChanges: boolean;
changelogData: ChangelogData | undefined;
}
/**
* Custom error class for workflow-related operations
*/
export declare class WorkflowError extends Error {
readonly code: string;
readonly context: Record<string, unknown> | undefined;
readonly recoverable: boolean;
constructor(message: string, code: string, context?: Record<string, unknown>, recoverable?: boolean);
}
/**
* Main Release Workflow Class
*
* Orchestrates the complete release process by coordinating git operations,
* version analysis, AI-powered change categorization, and changelog management.
*/
export declare class ReleaseWorkflow {
private readonly config;
private readonly gitOps;
private readonly versionAnalyzer;
private readonly aiAnalyzer;
private readonly changelogManager;
constructor(config: WorkflowConfig);
/**
* Execute the complete release workflow
*/
execute(): Promise<ReleaseResult>;
/**
* Step 1: Analyze repository changes and commits
*/
private analyzeChanges;
/**
* Step 2: Determine version bump using conventional commits analysis
*/
private analyzeVersion;
/**
* Step 3: Analyze changes with AI (if strategy requires it)
*/
private analyzeWithAI;
/**
* Step 4: Update changelog with analyzed changes
*/
private updateChangelog;
/**
* Step 5: Create release branch and commit changes
*/
private createReleaseBranch;
/**
* Helper: Create basic changelog entries from commits using conventional commit analysis
*/
private createBasicChangelogEntries;
/**
* Helper: Check if AI should be used based on strategy
*/
private shouldUseAI;
/**
* Helper: Create AI analyzer instance
*/
private createAIAnalyzer;
/**
* Helper: Validate workflow configuration
*/
private validateConfiguration;
/**
* Helper: Format semantic version object to string
*/
private formatVersion;
}
1 change: 1 addition & 0 deletions dist/ReleaseWorkflow.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

91 changes: 91 additions & 0 deletions dist/ai-analyzer.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/**
* AI Analyzer Module
* Integrates with OpenAI to analyze git diffs and categorize changes for intelligent release management
*/
import type { GitDiff, AIAnalysisResult, ReleaseConfig, VersioningStrategy, VersionAnalyzer } from './types/index.js';
/**
* Configuration for the AI Analyzer
*/
export interface AIAnalyzerConfig {
/** OpenAI API key */
apiKey: string;
/** OpenAI model to use */
model?: string;
/** Temperature for AI responses */
temperature?: number;
/** Maximum tokens for responses */
maxTokens?: number;
/** Maximum retries for failed requests */
maxRetries?: number;
/** Retry delay in milliseconds */
retryDelay?: number;
/** Confidence threshold for accepting AI results */
confidenceThreshold?: number;
}
/**
* Error thrown when AI analysis fails
*/
export declare class AIAnalysisError extends Error {
readonly cause?: Error | undefined;
readonly retryable: boolean;
readonly tokensUsed: number;
constructor(message: string, cause?: Error | undefined, retryable?: boolean, tokensUsed?: number);
}
/**
* AI-powered change analyzer using OpenAI
*/
export declare class AIAnalyzer implements VersionAnalyzer {
private readonly openai;
private readonly config;
private readonly retryConfig;
private confidence;
constructor(config: AIAnalyzerConfig);
/**
* Analyze git changes using AI to determine version bump and changelog entries
*/
analyze(gitDiff: GitDiff): Promise<AIAnalysisResult>;
/**
* Get the current confidence level
*/
getConfidence(): number;
/**
* Get the strategy name
*/
getStrategy(): VersioningStrategy;
/**
* Validate configuration
*/
validateConfig(config: ReleaseConfig): boolean;
/**
* Build the analysis prompt for OpenAI
*/
private buildAnalysisPrompt;
/**
* Call OpenAI API with the analysis prompt
*/
private callOpenAI;
/**
* Parse and validate AI response
*/
private parseAIResponse;
/**
* Type guard for validating parsed AI response
*/
private isValidParsedResponse;
/**
* Calculate confidence based on response quality and consistency
*/
private calculateConfidence;
/**
* Build analysis metadata
*/
private buildAnalysisMetadata;
/**
* Calculate estimated cost for OpenAI API usage
*/
private calculateCost;
/**
* Execute operation with exponential backoff retry logic
*/
private executeWithRetry;
}
1 change: 1 addition & 0 deletions dist/ai-analyzer.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading