chore(ai): add comprehensive CLI configurations for all AI assistants
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
141
.qwen/config/Makefile
Normal file
141
.qwen/config/Makefile
Normal file
@@ -0,0 +1,141 @@
|
||||
# Makefile for Qwen Code Integration
|
||||
|
||||
# Variables
|
||||
BINARY=mev-bot
|
||||
MAIN_FILE=cmd/mev-bot/main.go
|
||||
BINARY_PATH=bin/$(BINARY)
|
||||
|
||||
# Default target
|
||||
.PHONY: all
|
||||
all: build
|
||||
|
||||
# Build the application
|
||||
.PHONY: build
|
||||
build:
|
||||
@echo "Building $(BINARY)..."
|
||||
@mkdir -p bin
|
||||
@go build -o $(BINARY_PATH) $(MAIN_FILE)
|
||||
@echo "Build successful!"
|
||||
|
||||
# Run the application
|
||||
.PHONY: run
|
||||
run: build
|
||||
@echo "Running $(BINARY)..."
|
||||
@$(BINARY_PATH)
|
||||
|
||||
# Run tests
|
||||
.PHONY: test
|
||||
test:
|
||||
@echo "Running tests..."
|
||||
@go test -v ./...
|
||||
|
||||
# Run tests for mathematical functions
|
||||
.PHONY: test-math
|
||||
test-math:
|
||||
@echo "Running mathematical function tests..."
|
||||
@go test -v ./pkg/uniswap/... ./pkg/math/...
|
||||
|
||||
# Run property-based tests
|
||||
.PHONY: test-property
|
||||
test-property:
|
||||
@echo "Running property-based tests..."
|
||||
@go test -v -run=Property ./pkg/uniswap/... ./pkg/math/...
|
||||
|
||||
# Run fuzz tests
|
||||
.PHONY: test-fuzz
|
||||
test-fuzz:
|
||||
@echo "Running fuzz tests..."
|
||||
@go test -fuzz=Fuzz ./pkg/uniswap/... ./pkg/math/...
|
||||
|
||||
# Run benchmarks for mathematical functions
|
||||
.PHONY: bench-math
|
||||
bench-math:
|
||||
@echo "Running mathematical function benchmarks..."
|
||||
@go test -bench=. -benchmem ./pkg/uniswap/... ./pkg/math/...
|
||||
|
||||
# Run benchmarks with CPU profiling
|
||||
.PHONY: bench-cpu
|
||||
bench-cpu:
|
||||
@echo "Running benchmarks with CPU profiling..."
|
||||
@go test -bench=. -cpuprofile=cpu.prof ./pkg/uniswap/... ./pkg/math/...
|
||||
|
||||
# Run benchmarks with memory profiling
|
||||
.PHONY: bench-mem
|
||||
bench-mem:
|
||||
@echo "Running benchmarks with memory profiling..."
|
||||
@go test -bench=. -memprofile=mem.prof ./pkg/uniswap/... ./pkg/math/...
|
||||
|
||||
# Clean build artifacts
|
||||
.PHONY: clean
|
||||
clean:
|
||||
@echo "Cleaning..."
|
||||
@rm -rf bin/
|
||||
@rm -f *.prof
|
||||
@rm -f coverage.out coverage.html
|
||||
@echo "Clean complete!"
|
||||
|
||||
# Install dependencies
|
||||
.PHONY: deps
|
||||
deps:
|
||||
@echo "Installing dependencies..."
|
||||
@go mod tidy
|
||||
@echo "Dependencies installed!"
|
||||
|
||||
# Format code
|
||||
.PHONY: fmt
|
||||
fmt:
|
||||
@echo "Formatting code..."
|
||||
@go fmt ./...
|
||||
|
||||
# Vet code
|
||||
.PHONY: vet
|
||||
vet:
|
||||
@echo "Vetting code..."
|
||||
@go vet ./...
|
||||
|
||||
# Lint code (requires golangci-lint)
|
||||
.PHONY: lint
|
||||
lint:
|
||||
@echo "Linting code..."
|
||||
@which golangci-lint > /dev/null || (echo "golangci-lint not found, installing..." && go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest)
|
||||
@golangci-lint run
|
||||
|
||||
# Update dependencies
|
||||
.PHONY: update
|
||||
update:
|
||||
@echo "Updating dependencies..."
|
||||
@go get -u ./...
|
||||
@go mod tidy
|
||||
@echo "Dependencies updated!"
|
||||
|
||||
# Install test dependencies
|
||||
.PHONY: test-deps
|
||||
test-deps:
|
||||
@echo "Installing test dependencies..."
|
||||
@go get github.com/stretchr/testify/assert
|
||||
@go get github.com/leanovate/gopter/...
|
||||
@go mod tidy
|
||||
@echo "Test dependencies installed!"
|
||||
|
||||
# Help
|
||||
.PHONY: help
|
||||
help:
|
||||
@echo "Available targets:"
|
||||
@echo " all - Build the application (default)"
|
||||
@echo " build - Build the application"
|
||||
@echo " run - Build and run the application"
|
||||
@echo " test - Run tests"
|
||||
@echo " test-math - Run tests for mathematical functions"
|
||||
@echo " test-property - Run property-based tests"
|
||||
@echo " test-fuzz - Run fuzz tests"
|
||||
@echo " bench-math - Run benchmarks for mathematical functions"
|
||||
@echo " bench-cpu - Run benchmarks with CPU profiling"
|
||||
@echo " bench-mem - Run benchmarks with memory profiling"
|
||||
@echo " clean - Clean build artifacts"
|
||||
@echo " deps - Install dependencies"
|
||||
@echo " test-deps - Install test dependencies"
|
||||
@echo " fmt - Format code"
|
||||
@echo " vet - Vet code"
|
||||
@echo " lint - Lint code (requires golangci-lint)"
|
||||
@echo " update - Update dependencies"
|
||||
@echo " help - Show this help"
|
||||
73
.qwen/config/focus-areas.md
Normal file
73
.qwen/config/focus-areas.md
Normal file
@@ -0,0 +1,73 @@
|
||||
# Qwen Code Focus Area Definitions
|
||||
|
||||
## Primary Focus Areas
|
||||
|
||||
### 1. Mathematical Computations
|
||||
As Qwen Code, you're particularly skilled at implementing precise mathematical functions with high accuracy and performance. Focus on:
|
||||
- Implementing complex financial calculations with proper precision handling
|
||||
- Ensuring numerical stability across large ranges of values
|
||||
- Working with specialized mathematical libraries like `github.com/holiman/uint256`
|
||||
|
||||
### 2. Algorithmic Implementation
|
||||
You excel at converting mathematical formulas and algorithms into efficient Go code. Focus on:
|
||||
- Creating efficient algorithms for arbitrage detection
|
||||
- Implementing accurate conversions between different mathematical representations
|
||||
- Calculating price impact with proper precision handling
|
||||
|
||||
### 3. Precision Handling
|
||||
Your expertise in precision handling is critical for the MEV bot's success. Focus on:
|
||||
- Using appropriate data types for mathematical calculations
|
||||
- Implementing proper rounding strategies for financial calculations
|
||||
- Handling overflow and underflow conditions properly
|
||||
|
||||
### 4. Performance Optimization
|
||||
While maintaining precision, you're also skilled at optimizing mathematical computations. Focus on:
|
||||
- Minimizing memory allocations in hot paths
|
||||
- Optimizing uint256 arithmetic operations
|
||||
- Reducing garbage collection pressure
|
||||
- Improving mathematical computation efficiency
|
||||
|
||||
## Integration Guidelines
|
||||
|
||||
### Working with Uniswap V3 Mathematics
|
||||
- Focus on sqrtPriceX96 to price conversions
|
||||
- Implement accurate tick calculations
|
||||
- Handle liquidity-based calculations with precision
|
||||
- Optimize price impact computations
|
||||
|
||||
### Performance vs. Precision Balance
|
||||
- Always prioritize precision over performance in mathematical calculations
|
||||
- Use profiling to identify bottlenecks without compromising accuracy
|
||||
- Implement caching strategies for expensive computations
|
||||
- Leverage Go's concurrency for independent mathematical operations
|
||||
|
||||
## Code Quality Standards
|
||||
|
||||
### Testing Requirements
|
||||
- Achieve >95% test coverage for mathematical functions
|
||||
- Implement property-based tests for mathematical invariants
|
||||
- Use fuzz testing to find edge cases
|
||||
- Create benchmarks for performance-critical functions
|
||||
|
||||
### Documentation Standards
|
||||
- Document all mathematical formulas with clear explanations
|
||||
- Comment on precision handling decisions
|
||||
- Explain algorithmic choices and trade-offs
|
||||
- Provide usage examples for complex mathematical functions
|
||||
|
||||
## Collaboration with Other AI Assistants
|
||||
|
||||
### Claude (Architecture & System Design)
|
||||
- Follow architectural patterns defined by Claude
|
||||
- Integrate mathematical functions with system components
|
||||
- Adhere to error handling and logging standards
|
||||
|
||||
### OpenCode (Testing & Quality Assurance)
|
||||
- Work with OpenCode to ensure comprehensive test coverage
|
||||
- Follow testing patterns and quality standards
|
||||
- Address test failures and edge cases identified
|
||||
|
||||
### Gemini (Performance Optimization)
|
||||
- Collaborate on performance optimization strategies
|
||||
- Share profiling results and optimization insights
|
||||
- Coordinate on memory allocation reduction techniques
|
||||
51
.qwen/config/optimization.md
Normal file
51
.qwen/config/optimization.md
Normal file
@@ -0,0 +1,51 @@
|
||||
# Qwen Code Performance Optimization Settings
|
||||
|
||||
## Workflow Preferences
|
||||
- **Always commit changes**: Use `git commit -am "math: descriptive message"` for mathematical implementations
|
||||
- **Branch naming**: Use prefixes (`math-sqrt-price`, `algo-liquidity-calc`, `perf-uniswap`)
|
||||
- **Context management**: Focus on mathematical precision and performance
|
||||
- **Parallel processing**: Leverage Go's concurrency patterns for independent calculations
|
||||
|
||||
## File Organization Preferences
|
||||
- **Mathematical functions**: Place in `pkg/uniswap/` or `pkg/math/`
|
||||
- **Test files**: Place alongside source files with `_test.go` suffix
|
||||
- **Documentation**: Inline comments explaining mathematical formulas
|
||||
- **Precision libraries**: Use `github.com/holiman/uint256` for uint256 arithmetic
|
||||
|
||||
## Performance Monitoring
|
||||
```bash
|
||||
# Enable metrics endpoint for performance tracking
|
||||
export METRICS_ENABLED="true"
|
||||
export METRICS_PORT="9090"
|
||||
|
||||
# Monitor memory usage of mathematical calculations
|
||||
go tool pprof http://localhost:9090/debug/pprof/heap
|
||||
|
||||
# Monitor CPU usage of mathematical functions
|
||||
go tool pprof http://localhost:9090/debug/pprof/profile?seconds=30
|
||||
|
||||
# Run benchmarks for mathematical functions
|
||||
go test -bench=. -benchmem ./pkg/uniswap/...
|
||||
```
|
||||
|
||||
## Precision Requirements
|
||||
- **Uint256 Arithmetic**: Use `github.com/holiman/uint256` for all uint256 calculations
|
||||
- **Floating Point**: Use `math/big` for floating-point calculations when needed
|
||||
- **Rounding**: Implement proper rounding strategies for financial calculations
|
||||
- **Overflow Handling**: Handle overflow and underflow conditions properly
|
||||
|
||||
## Optimization Focus Areas
|
||||
1. **Mathematical Computation Efficiency**
|
||||
- Minimize computational overhead in pricing functions
|
||||
- Optimize sqrtPriceX96 to price conversions
|
||||
- Efficient tick calculations
|
||||
|
||||
2. **Memory Allocation Reduction**
|
||||
- Object pooling for frequently created mathematical objects
|
||||
- Pre-allocation of slices and buffers
|
||||
- Minimize garbage collection pressure
|
||||
|
||||
3. **Algorithmic Optimization**
|
||||
- Mathematical formula simplification
|
||||
- Lookup table implementation for repeated calculations
|
||||
- Caching strategies for expensive computations
|
||||
42
.qwen/config/performance.json
Normal file
42
.qwen/config/performance.json
Normal file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"focus_areas": [
|
||||
"Mathematical Computations",
|
||||
"Algorithmic Implementation",
|
||||
"Precision Handling",
|
||||
"Performance Optimization"
|
||||
],
|
||||
"primary_skills": [
|
||||
"Implementing precise Uniswap V3 pricing functions",
|
||||
"Ensuring numerical stability and precision",
|
||||
"Working with liquidity and fee calculations",
|
||||
"Creating efficient algorithms for arbitrage detection",
|
||||
"Implementing accurate tick and sqrtPriceX96 conversions",
|
||||
"Calculating price impact with proper precision handling"
|
||||
],
|
||||
"performance_optimization": {
|
||||
"enabled": true,
|
||||
"profiling": {
|
||||
"cpu": true,
|
||||
"memory": true,
|
||||
"goroutine": true
|
||||
},
|
||||
"optimization_targets": [
|
||||
"Minimize memory allocations in hot paths",
|
||||
"Optimize uint256 arithmetic operations",
|
||||
"Reduce garbage collection pressure",
|
||||
"Improve mathematical computation efficiency"
|
||||
]
|
||||
},
|
||||
"precision_requirements": {
|
||||
"math_library": "github.com/holiman/uint256",
|
||||
"floating_point": "math/big",
|
||||
"rounding_strategy": "bankers_rounding",
|
||||
"precision_target": "256_bits"
|
||||
},
|
||||
"testing": {
|
||||
"unit_test_coverage": 0.95,
|
||||
"property_based_testing": true,
|
||||
"fuzz_testing": true,
|
||||
"benchmarking": true
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user