mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-06-29 21:52:09 -07:00
global: snapshot
This commit is contained in:
@@ -0,0 +1,221 @@
|
||||
# Changelog Generation for Claude Code
|
||||
|
||||
**TASK**: Update docs/CHANGELOG.md for ALL latest releases missing from the file.
|
||||
|
||||
## ⚠️ CRITICAL FAILURE MODE TO AVOID ⚠️
|
||||
**THE #1 FAILURE**: Ignoring most changes and only documenting a few
|
||||
**ABSOLUTELY FORBIDDEN**: Skipping changes, summarizing with "and other updates", or being incomplete
|
||||
**YOU MUST DOCUMENT EVERY SINGLE MEANINGFUL CHANGE - NO EXCEPTIONS**
|
||||
|
||||
## CORE WORKFLOW - EXECUTE EXACTLY:
|
||||
|
||||
### Step 1: Get Release Information
|
||||
```bash
|
||||
git tag --list --sort=version:refname
|
||||
```
|
||||
|
||||
### Step 2: Process ONE Release at a Time
|
||||
For each missing release, execute these commands to get complete information:
|
||||
|
||||
**First, get the file list:**
|
||||
```bash
|
||||
git diff --name-only [previous-tag]..[current-tag]
|
||||
```
|
||||
|
||||
**Then, get changes excluding Cargo.lock:**
|
||||
```bash
|
||||
git diff [previous-tag]..[current-tag] -- . ':(exclude)Cargo.lock'
|
||||
```
|
||||
|
||||
**If output is too large, examine files individually:**
|
||||
```bash
|
||||
git diff [previous-tag]..[current-tag] -- path/to/specific/file.rs
|
||||
```
|
||||
|
||||
**For summary of changes per file (if needed):**
|
||||
```bash
|
||||
git diff --stat [previous-tag]..[current-tag]
|
||||
```
|
||||
|
||||
### Step 3: Analyze Before Writing
|
||||
**MANDATORY**: Before writing ANY changelog entry, analyze the diff output and explain:
|
||||
- **Use `git diff --name-only` to see ALL changed files** - this prevents truncation issues
|
||||
- **Use `git diff -- . ':(exclude)Cargo.lock'` to see actual changes** without Cargo.lock noise
|
||||
- **If output is large, examine key files individually** with `git diff [tags] -- path/to/file`
|
||||
- **Identify every functional change** - what new capabilities, fixes, or modifications were made
|
||||
- What each code change accomplishes functionally
|
||||
- The user-facing or system impact of modifications
|
||||
- **Which crate each change belongs to** (based on file paths)
|
||||
- How changes group together logically within and across crates
|
||||
- What functionality is added/removed/modified per crate
|
||||
|
||||
**COMPLETENESS CHECK**: State "I have analyzed X files and identified Y distinct functional changes to document"
|
||||
|
||||
### Step 4: Write Changelog Entry
|
||||
Only after analysis, update CHANGELOG.md with ONE release entry.
|
||||
|
||||
**REQUIRED**: End each release entry with a comparison link:
|
||||
```markdown
|
||||
[View changes](https://github.com/bitcoinresearchkit/brk/compare/vPREVIOUS...vCURRENT)
|
||||
```
|
||||
Where PREVIOUS is the previous release tag and CURRENT is the current release tag.
|
||||
|
||||
### Step 5: Stop and Confirm
|
||||
**CRITICAL**: Process only ONE release, then ask for confirmation to continue.
|
||||
|
||||
---
|
||||
|
||||
## STRICT RULES
|
||||
|
||||
### FORBIDDEN - NEVER MENTION:
|
||||
- **Cargo.lock** (ignore completely)
|
||||
- **Line counts** ("added 50 lines", "removed 200 lines")
|
||||
- **Dependency version bumps** (unless enabling major new features)
|
||||
- **Local crate version changes** (0.0.61 → 0.0.62)
|
||||
- **Vague words**: "Enhanced", "Improved", "Updated", "Refactored"
|
||||
|
||||
### FORBIDDEN PHRASES:
|
||||
- "and other changes"
|
||||
- "various updates"
|
||||
- "along with minor improvements"
|
||||
- "among other enhancements"
|
||||
- **"along with other modifications"**
|
||||
- **"plus additional changes"**
|
||||
- **"including other updates"**
|
||||
- **"and more"**
|
||||
- **ANY phrase that suggests you're skipping changes**
|
||||
|
||||
### REQUIRED - MUST INCLUDE:
|
||||
- **Every meaningful change** in the diff (no shortcuts)
|
||||
- **Specific functionality** descriptions
|
||||
- **Business impact** of each change
|
||||
- **Complete coverage** - if 20 changes exist, document all 20
|
||||
- **Source links** for significant changes (new features, breaking changes, major bug fixes)
|
||||
|
||||
## WORKSPACE-SPECIFIC RULES
|
||||
|
||||
### Crate Identification:
|
||||
- **Determine crate from file paths** in the diff (e.g., `crates/brk-core/src/lib.rs` → `brk-core`)
|
||||
- **Group all changes by their crate** before writing changelog entries
|
||||
- **Use crate name as subheading** under each change type section
|
||||
- **For root-level files**: Use `workspace` as the crate name
|
||||
|
||||
### Cross-Crate Changes:
|
||||
- **When changes span multiple crates** for one feature, mention the relationship
|
||||
- **Example**: "Added new transaction API in `brk-core` with corresponding HTTP endpoints in `brk-api`"
|
||||
|
||||
### Crate Naming:
|
||||
- **Use backticks** around crate names: `brk-core`, `brk-api`
|
||||
- **Use workspace structure** as shown in file paths, not display names
|
||||
|
||||
### File Header (if missing):
|
||||
```markdown
|
||||
<!-- This changelog was generated by Claude Code -->
|
||||
```
|
||||
|
||||
### Release Entry Format:
|
||||
```markdown
|
||||
## [vX.Y.Z](https://github.com/bitcoinresearchkit/brk/releases/tag/vX.Y.Z) - YYYY-MM-DD
|
||||
|
||||
### Breaking Changes
|
||||
#### `crate-name`
|
||||
- Specific change with functional impact explanation ([source](https://github.com/bitcoinresearchkit/brk/blob/vX.Y.Z/path/to/file.rs))
|
||||
|
||||
### New Features
|
||||
#### `crate-name`
|
||||
- Feature description with user benefit ([source](https://github.com/bitcoinresearchkit/brk/blob/vX.Y.Z/path/to/main/file.rs))
|
||||
- Another feature with implementation details
|
||||
|
||||
#### `another-crate`
|
||||
- Feature specific to this crate
|
||||
|
||||
### Bug Fixes
|
||||
#### `crate-name`
|
||||
- Specific problem that was resolved ([source](https://github.com/bitcoinresearchkit/brk/blob/vX.Y.Z/path/to/file.rs))
|
||||
- Another bug fix with impact description
|
||||
|
||||
### Internal Changes
|
||||
#### `crate-name`
|
||||
- Architectural improvement with purpose
|
||||
- Code organization change with benefit
|
||||
|
||||
[View changes](https://github.com/bitcoinresearchkit/brk/compare/vPREVIOUS...vCURRENT)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## ANALYSIS REQUIREMENTS
|
||||
|
||||
**Before writing changelog text, you MUST state:**
|
||||
|
||||
1. **File discovery**: "Using git diff --name-only, I see X files were modified"
|
||||
2. **Cargo.lock check**: "After excluding Cargo.lock, Y files contain actual changes"
|
||||
3. **Functional changes identified**: "I identified these distinct changes: A, B, C, D..."
|
||||
4. **What each change does**: "Change A: adds new API endpoints, Change B: fixes memory leak, etc."
|
||||
5. **Which crates are affected**: "Changes span crates: A, B, C"
|
||||
6. **What this means for users**: "Users can now do X, bug Y is fixed, etc."
|
||||
7. **How changes group together**: "Changes A and B work together to implement feature W"
|
||||
8. **Cross-crate dependencies**: "Crate A's new feature requires the new API in crate B"
|
||||
9. **Any unclear changes**: "I cannot determine the purpose of change X from the diff"
|
||||
10. **FINAL CHECK**: "I will now document all X functional changes without listing files"
|
||||
|
||||
**MANDATORY**: The changelog should describe FUNCTIONALITY, not files. But you must capture ALL functionality changes.
|
||||
|
||||
**Only after this analysis, write the changelog entry.**
|
||||
|
||||
---
|
||||
|
||||
## EXAMPLES
|
||||
|
||||
### ❌ BAD (Vague, incomplete):
|
||||
```markdown
|
||||
### New Features
|
||||
- Enhanced blockchain processing capabilities
|
||||
- Improved error handling and various other updates
|
||||
```
|
||||
|
||||
### ✅ GOOD (Specific, complete, grouped by crate, with source links):
|
||||
```markdown
|
||||
### New Features
|
||||
#### `brk-core`
|
||||
- Added `TransactionAnalyzer` struct with fee calculation and coinbase detection methods ([source](https://github.com/bitcoinresearchkit/brk/blob/v0.0.108/crates/brk-core/src/analyzer.rs))
|
||||
- Implemented in-memory caching layer for blockchain queries using HashMap storage
|
||||
|
||||
#### `brk-api`
|
||||
- Added three new API endpoints: `/api/blocks/{hash}`, `/api/transactions/search`, and `/api/stats/network` ([source](https://github.com/bitcoinresearchkit/brk/blob/v0.0.108/crates/brk-api/src/routes.rs))
|
||||
- Implemented standardized error responses with error codes and descriptions
|
||||
|
||||
### Bug Fixes
|
||||
#### `brk-core`
|
||||
- Fixed panic when processing blocks with zero transactions by adding explicit empty block validation ([source](https://github.com/bitcoinresearchkit/brk/blob/v0.0.108/crates/brk-core/src/block.rs))
|
||||
|
||||
#### `brk-api`
|
||||
- Resolved memory leak in connection pool by implementing proper cleanup in Drop trait
|
||||
|
||||
[View changes](https://github.com/bitcoinresearchkit/brk/compare/v0.0.107...v0.0.108)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## SUCCESS CRITERIA
|
||||
|
||||
✅ **COUNT files modified for internal verification only**
|
||||
✅ **Identify EVERY distinct functional change**
|
||||
✅ **Document ALL functionality changes (no "other changes")**
|
||||
✅ **Changelog describes WHAT users can do, not which files changed**
|
||||
✅ **Never mention Cargo.lock or line counts**
|
||||
✅ **Use specific, functional descriptions**
|
||||
✅ **Complete analysis before writing**
|
||||
✅ **Stop and ask for confirmation after each release**
|
||||
|
||||
**FAILURE INDICATORS - If you do any of these, you FAILED:**
|
||||
❌ "and other changes"
|
||||
❌ "various updates"
|
||||
❌ "among other improvements"
|
||||
❌ **Diff shows new API endpoints but changelog doesn't mention them**
|
||||
❌ **Diff shows bug fixes but changelog misses some**
|
||||
❌ **Diff shows new structs/functions but changelog ignores them**
|
||||
❌ Missing obvious functional changes from the diff
|
||||
❌ Summarizing instead of listing each distinct functionality change
|
||||
|
||||
**KEY PRINCIPLE**: Count files internally to ensure you don't miss changes, but write about FUNCTIONALITY for users.
|
||||
@@ -0,0 +1,172 @@
|
||||
# README Generation Prompt
|
||||
|
||||
Generate a professional, comprehensive README.md for each crate based SOLELY on code analysis. Use NO external documentation, commit messages, or existing READMEs.
|
||||
|
||||
## MANDATORY PROCESS - FOLLOW EXACTLY:
|
||||
1. **IGNORE EXISTING DOCS**: Do NOT read any .md, .txt, .rst, or documentation files in the crate directory
|
||||
2. **CODE-ONLY ANALYSIS**: Examine ONLY these files:
|
||||
- All .rs files in src/ directory and subdirectories
|
||||
- Cargo.toml for dependencies and metadata
|
||||
- Code structure and organization
|
||||
3. **MANDATORY CODE ANALYSIS**: Before writing ANY README content, you MUST:
|
||||
- Examine all Rust files in src/ directory
|
||||
- Identify the main structs, enums, traits, and functions
|
||||
- Understand the crate's architecture and data flow
|
||||
- Determine the crate's purpose from its implementation
|
||||
- Map dependencies to understand external integrations
|
||||
4. **FRESH PERSPECTIVE**: Write the README as if you're the first person to document this crate
|
||||
5. Generate one complete README.md per crate
|
||||
6. Focus on one crate at a time for thorough analysis
|
||||
|
||||
## ABSOLUTE REQUIREMENTS:
|
||||
- **SOURCE OF TRUTH**: Use ONLY the actual Rust code - no external docs, comments may provide hints but focus on implementation
|
||||
- **CRITICAL**: DO NOT read any existing README.md, CHANGELOG.md, or documentation files
|
||||
- **IGNORE ALL TEXT FILES**: .md, .txt, .rst files are FORBIDDEN sources - treat them as if they don't exist
|
||||
- **CODE ONLY**: Focus exclusively on .rs files, Cargo.toml, and code structure
|
||||
- **PROFESSIONAL GRADE**: Write as if this will be published on crates.io for other developers
|
||||
- **PROGRAMMER FOCUSED**: Assume audience knows Rust and relevant domain concepts
|
||||
- **IMPLEMENTATION-BASED**: Describe what the code actually does, not what comments claim it should do
|
||||
- **If you cannot determine functionality from code alone, state this explicitly**
|
||||
|
||||
## README STRUCTURE (MANDATORY):
|
||||
|
||||
### 1. CRATE HEADER
|
||||
```markdown
|
||||
# Crate Name
|
||||
|
||||
Brief one-line description of what this crate does (max 80 chars).
|
||||
|
||||
[](https://crates.io/crates/CRATE_NAME)
|
||||
[](https://docs.rs/CRATE_NAME)
|
||||
```
|
||||
|
||||
### 2. OVERVIEW SECTION
|
||||
- **Purpose**: What problem does this crate solve?
|
||||
- **Key Features**: 3-5 bullet points of main capabilities (derived from code analysis)
|
||||
- **Target Use Cases**: Who would use this and for what?
|
||||
|
||||
### 3. INSTALLATION
|
||||
```toml
|
||||
[dependencies]
|
||||
crate_name = "X.Y.Z"
|
||||
```
|
||||
|
||||
### 4. QUICK START / USAGE
|
||||
- **Minimal working example** showing the primary API
|
||||
- **Common patterns** observed in the code
|
||||
- **Key structs/traits** that users will interact with
|
||||
|
||||
### 5. API OVERVIEW
|
||||
- **Core Types**: Main structs, enums, traits with brief descriptions
|
||||
- **Key Methods**: Most important public functions
|
||||
- **Module Structure**: Brief overview of how code is organized
|
||||
|
||||
### 6. FEATURES (if applicable)
|
||||
- Cargo features and what they enable
|
||||
- Optional dependencies and their purpose
|
||||
|
||||
### 7. EXAMPLES
|
||||
- 2-3 practical code examples showing different use cases
|
||||
- Based on public API analysis, not existing examples
|
||||
|
||||
## WRITING REQUIREMENTS:
|
||||
|
||||
### TONE AND STYLE:
|
||||
- **Concise but comprehensive**: Every sentence must add value
|
||||
- **Technical precision**: Use exact terminology, avoid marketing speak
|
||||
- **Active voice**: "Provides X" not "X is provided"
|
||||
- **Present tense**: "The crate handles..." not "The crate will handle..."
|
||||
|
||||
### FORBIDDEN PATTERNS:
|
||||
- **NEVER** use vague terms: "powerful", "flexible", "robust", "comprehensive", "advanced"
|
||||
- **NEVER** write marketing copy: "cutting-edge", "state-of-the-art", "enterprise-grade"
|
||||
- **NEVER** make claims you can't verify from code: "blazingly fast", "memory efficient"
|
||||
- **NEVER** copy-paste from existing documentation or comments
|
||||
- **NEVER** read or reference existing README.md files - pretend they don't exist
|
||||
- **NEVER** use phrases like "as mentioned in the documentation" or "according to the docs"
|
||||
- **NEVER** let existing documentation influence your analysis or writing
|
||||
|
||||
### REQUIRED SPECIFICITY:
|
||||
- **Data structures**: Mention specific types (HashMap, Vec, etc.)
|
||||
- **Algorithms**: Reference actual implementations found in code
|
||||
- **Integration points**: Specific traits implemented, dependencies used
|
||||
- **Error handling**: How errors are represented and handled
|
||||
- **Async/sync**: Clearly state if operations are blocking or async
|
||||
|
||||
### ANTI-BIAS PROTOCOL:
|
||||
|
||||
### BEFORE STARTING ANY ANALYSIS:
|
||||
1. **Explicitly ignore**: Any README.md, CHANGELOG.md, docs/, documentation files
|
||||
2. **File filtering**: Only examine .rs and Cargo.toml files
|
||||
3. **Fresh eyes approach**: Analyze the code as if you've never seen this crate before
|
||||
4. **Independent thinking**: Form your own understanding purely from code inspection
|
||||
|
||||
### IF YOU ACCIDENTALLY READ EXISTING DOCS:
|
||||
- Stop immediately and restart your analysis
|
||||
- Consciously disregard any information from documentation files
|
||||
- Base all descriptions solely on what you observe in the code
|
||||
- Ask yourself: "What would I think this code does if I had no documentation?"
|
||||
|
||||
### VALIDATION CHECKS:
|
||||
- **Unique descriptions**: Your descriptions should differ significantly from any existing docs
|
||||
- **Code-derived insights**: Every feature mentioned must be visible in the source code
|
||||
- **Independent voice**: Write in your own technical style, not mimicking existing documentation
|
||||
- **Fresh examples**: Create new code examples based on API analysis, not existing samples
|
||||
|
||||
## CODE ANALYSIS DEPTH:
|
||||
**You MUST analyze and understand:**
|
||||
1. **Public API surface**: All pub structs, functions, traits, modules
|
||||
2. **Core abstractions**: Main data types and their relationships
|
||||
3. **Error types**: Custom errors, Result patterns, panic conditions
|
||||
4. **Dependencies**: How external crates are integrated
|
||||
5. **Feature flags**: Conditional compilation and optional functionality
|
||||
6. **Async patterns**: Use of futures, tokio, async-std, etc.
|
||||
7. **Serialization**: Serde implementations, custom serialization
|
||||
8. **Performance characteristics**: Algorithm complexity where obvious
|
||||
|
||||
### EXAMPLE STRUCTURE ANALYSIS OUTPUT:
|
||||
```markdown
|
||||
## Code Analysis Summary
|
||||
**Main Types**: `BlockProcessor`, `Transaction`, `ValidationError`
|
||||
**Core Trait**: `Validator` - implemented by `BasicValidator` and `StrictValidator`
|
||||
**Async Support**: All processing methods return `impl Future`
|
||||
**Error Handling**: Custom `ValidationError` enum with specific error types
|
||||
**Dependencies**: Uses `tokio` for async runtime, `serde` for serialization
|
||||
**Architecture**: Pipeline pattern with configurable validation stages
|
||||
```
|
||||
|
||||
## EXAMPLES OF QUALITY:
|
||||
|
||||
### ❌ BAD (VAGUE):
|
||||
```markdown
|
||||
# My Crate
|
||||
A powerful and flexible library for blockchain operations.
|
||||
|
||||
## Features
|
||||
- Fast processing
|
||||
- Easy to use
|
||||
- Robust error handling
|
||||
```
|
||||
|
||||
### ✅ GOOD (SPECIFIC):
|
||||
```markdown
|
||||
# brk-chain-analyzer
|
||||
Bitcoin blockchain analysis tools for transaction pattern detection.
|
||||
|
||||
## Overview
|
||||
Provides utilities for analyzing Bitcoin transaction data, detecting address clustering patterns, and computing blockchain statistics. Built around a streaming parser that processes block data without loading entire blocks into memory.
|
||||
|
||||
## Key Types
|
||||
- `TransactionAnalyzer`: Stateful analyzer for computing fees, detecting coinbase transactions
|
||||
- `ClusterDetector`: Implements common input ownership heuristics for address clustering
|
||||
- `BlockStream`: Async iterator over blockchain data with configurable batch sizes
|
||||
```
|
||||
|
||||
## FINAL REQUIREMENTS:
|
||||
- **One README per crate** - don't combine multiple crates
|
||||
- **Minimum 200 words** - be thorough but concise
|
||||
- **Maximum 800 words** - stay focused and relevant
|
||||
- **Code examples must be syntactically correct** and compilable
|
||||
- **All claims must be verifiable** from the source code
|
||||
|
||||
**PROCESS ONE CRATE AT A TIME. ANALYZE THE CODE THOROUGHLY BEFORE WRITING.**
|
||||
Reference in New Issue
Block a user