Initial commit

This commit is contained in:
Zhongwei Li
2025-11-29 18:19:43 +08:00
commit 2359544dbc
22 changed files with 7017 additions and 0 deletions

View File

@@ -0,0 +1,404 @@
# Codebase Exploration Notes: [Project Name]
**Repository:** [URL or path]
**Explored:** [date]
**For Issue:** #[number]
**Language:** [primary language]
---
## Quick Reference
**Essential Commands:**
```bash
# Install dependencies
[command]
# Run dev server
[command]
# Run tests
[command]
# Lint/format
[command]
```
**Key Directories:**
- Source: `[path]`
- Tests: `[path]`
- Docs: `[path]`
---
## Project Summary
[2-3 sentences about what this project does and how it's structured]
**Purpose:** [What problem does this solve?]
**Target Users:** [Developer tool / Web app / Library / CLI / etc]
**Core Technologies:**
- Language: [language + version]
- Framework: [if applicable]
- Build tool: [tool]
- Testing: [framework]
**Project Maturity:**
- Age: [years or months]
- Activity: [active / moderate / slow]
- Contributors: [approximate count]
- Stability: [alpha / beta / stable / mature]
---
## Directory Structure
```
project-root/
├── [main-source-dir]/ - [purpose]
├── [test-dir]/ - [purpose]
├── [docs-dir]/ - [purpose]
├── [config-files] - [purpose]
└── [other-key-dirs]/ - [purpose]
```
**Organization Principle:**
- [ ] By feature (users/, products/, orders/)
- [ ] By layer (models/, views/, controllers/)
- [ ] By type (components/, utils/, services/)
- [ ] Hybrid approach
**Notes:**
[Any special organization patterns or unusual directory purposes]
---
## Code Conventions
### Naming Conventions
**Files:**
- Pattern: [kebab-case / PascalCase / snake_case]
- Extensions: [.js, .ts, .tsx, etc]
- Tests: [*.test.js / *_test.go / test_*.py]
**Code Elements:**
- Classes: [PascalCase]
- Functions: [camelCase / snake_case]
- Variables: [camelCase / snake_case]
- Constants: [UPPER_SNAKE_CASE / kConstant]
- Private: [_private / #private / __private]
**Examples from codebase:**
```[language]
// Actual examples from the project
class ExampleClass { }
function exampleFunction() { }
const EXAMPLE_CONSTANT = 'value'
```
### Code Style
**Formatting:**
- Indentation: [2 spaces / 4 spaces / tabs]
- Line length: [80 / 100 / 120 chars]
- Quotes: [single / double]
- Semicolons: [required / optional]
**Imports:**
```[language]
// Import order example from project
import external from 'package'
import internal from '@/internal'
import relative from './relative'
```
**Comments:**
- Documentation: [JSDoc / docstrings / rustdoc / etc]
- Inline: [when and how used]
- TODO format: [TODO: / TODO(name): / FIXME:]
**Error Handling:**
- Pattern: [try/catch / Result<T,E> / error codes]
- Custom errors: [how defined]
- Error messages: [format and style]
### Architectural Patterns
**Overall Pattern:**
[MVC / MVVM / Layered / Component-based / etc]
**State Management:**
[How application state is managed]
**Data Flow:**
[How data moves through the system]
**Dependency Direction:**
[e.g., UI → Services → Data Layer]
**Key Abstractions:**
- [Abstraction 1]: [purpose and how used]
- [Abstraction 2]: [purpose and how used]
---
## Testing
### Test Framework & Location
**Framework:** [Jest / pytest / JUnit / etc]
**Test Locations:**
- Unit tests: [path pattern]
- Integration tests: [path pattern]
- E2E tests: [path pattern]
**Test Naming:**
- Pattern: [describe/it / test_ / Test* / #[test]]
- Convention: [naming style for test descriptions]
### Test Structure
**Typical test pattern:**
```[language]
// Example test structure from the project
describe('FeatureName', () => {
it('should do X when Y', () => {
// Arrange
// Act
// Assert
})
})
```
**Common patterns:**
- Setup/teardown: [how handled]
- Fixtures: [location and usage]
- Mocks: [how created]
- Assertions: [library and style]
### Running Tests
```bash
# All tests
[command]
# Specific file
[command]
# With coverage
[command]
# Watch mode
[command]
```
**Coverage:**
- Target: [percentage if specified]
- Tool: [coverage tool used]
- Reports: [where generated]
---
## Development Workflow
### Setup
```bash
# Initial setup
git clone [repo]
cd [project]
[install command]
[setup environment]
```
**Prerequisites:**
- [Tool/version requirement 1]
- [Tool/version requirement 2]
### Development Commands
```bash
# Development mode
[command]
# Build
[command]
# Lint
[command]
# Format
[command]
# Type check (if applicable)
[command]
```
### Git Workflow
**Branch naming:** [pattern: feature/*, fix/*, etc]
**Commit format:**
```
type(scope): description
[longer explanation if needed]
```
**Pre-commit hooks:**
- [What runs automatically]
---
## CI/CD
**CI System:** [GitHub Actions / Travis / CircleCI / etc]
**Configuration:** [.github/workflows/* / .travis.yml / etc]
**CI Checks:**
- [ ] Tests
- [ ] Linting
- [ ] Type checking
- [ ] Build
- [ ] Coverage
- [ ] [Other checks]
**Important:** [Any CI-specific considerations]
---
## Reference Examples
### For My Work
**Similar features/patterns:**
1. **[Feature/Pattern 1]**
- File: `[path/to/file]:[line]`
- What it does: [description]
- Why relevant: [how it relates to my issue]
- Pattern to follow: [specific pattern]
2. **[Feature/Pattern 2]**
- File: `[path/to/file]:[line]`
- What it does: [description]
- Why relevant: [how it relates]
- Pattern to follow: [specific pattern]
3. **[Feature/Pattern 3]**
- File: `[path/to/file]:[line]`
- What it does: [description]
- Why relevant: [how it relates]
### Patterns to Replicate
- **[Pattern 1]:** [e.g., how errors are handled]
- Example: [file:line]
- Apply to: [my use case]
- **[Pattern 2]:** [e.g., how validation is done]
- Example: [file:line]
- Apply to: [my use case]
- **[Pattern 3]:** [e.g., how tests are structured]
- Example: [file:line]
- Apply to: [my use case]
### Patterns to Avoid
- **[Anti-pattern 1]:** [old code being refactored]
- **[Anti-pattern 2]:** [special case, don't generalize]
---
## Impact Analysis
### Files I'll Likely Modify
1. **`[path/to/file1]`**
- Reason: [why this file]
- Change type: [add / modify / delete]
- Confidence: [high / medium / low]
2. **`[path/to/file2]`**
- Reason: [why this file]
- Change type: [add / modify / delete]
- Confidence: [high / medium / low]
### Dependencies to Consider
**Upstream (what calls my changes):**
- [Dependency 1]: [description]
- [Dependency 2]: [description]
**Downstream (what my changes call):**
- [Dependency 1]: [description]
- [Dependency 2]: [description]
**Side effects:**
- [ ] File I/O
- [ ] Network calls
- [ ] Database operations
- [ ] State mutations
- [ ] Event emissions
### Risk Level
**Overall risk:** 🟢 Low / 🟡 Medium / 🔴 High
**Risk factors:**
- [Factor 1: e.g., modifying critical path]
- [Factor 2: e.g., poorly tested area]
**Mitigation:**
- [Strategy 1: e.g., add extra tests]
- [Strategy 2: e.g., incremental changes]
---
## Notes & Questions
### Key Observations
- [Observation 1: interesting pattern or consideration]
- [Observation 2: something to remember]
- [Observation 3: potential challenge]
### Still Unclear
- [ ] [Question 1: what still needs investigation]
- [ ] [Question 2: clarification needed]
- [ ] [Question 3: uncertainty]
### Resources
- Documentation: [links to relevant docs]
- Similar issues: [links to related issues/PRs]
- References: [external resources]
---
## Next Steps
✅ Exploration complete - Ready for **Phase 4: Issue-Code Mapping**
**Recommended focus:**
1. [Specific file/component to examine more closely]
2. [Pattern to understand deeper]
3. [Test to review as reference]
**Action items:**
- [ ] [Specific exploration task if needed]
- [ ] [Question to ask maintainer if needed]
- [ ] [Code to trace if needed]
---
## Personal Notes
[Any additional thoughts, reminders, or insights for myself]

View File

@@ -0,0 +1,226 @@
# Issue Analysis: [Issue Title]
**Issue:** #[number] | **Type:** [bug/feature/refactor/docs/performance]
**URL:** [GitHub issue link]
**Status:** Ready to implement / Needs clarification
**Date:** [Analysis date]
---
## Summary
[2-3 sentence summary of what needs to be done and why]
---
## Requirements
### Core Requirements
[Based on issue type, fill in relevant section below]
#### For Bug Fixes
**Current Behavior:**
[What actually happens - be specific]
**Expected Behavior:**
[What should happen - reference docs/specs if available]
**Reproduction Steps:**
1. [Step 1]
2. [Step 2]
3. [Observe: ...]
**Environment:**
- Version: [version]
- Platform: [OS/browser/etc]
- Configuration: [relevant settings]
**Root Cause (Hypothesis):**
[Your initial theory of what's causing this]
**Affected Users:**
[Who hits this? How often? Severity: Critical/High/Medium/Low]
#### For Features
**User Story:**
As a [user type], I want [capability] so that [benefit].
**Functional Requirements:**
1. [Requirement 1 - must have]
2. [Requirement 2 - must have]
3. [Requirement 3 - nice to have]
**User Interface:**
- **Input:** [What user provides]
- **Output:** [What user sees/gets]
- **Interaction flow:** [Step-by-step user journey]
**Non-Functional Requirements:**
- Performance: [any constraints]
- Compatibility: [versions, platforms]
- Accessibility: [considerations]
#### For Refactoring
**Current Problems:**
1. [Problem 1: e.g., duplicated code across X files]
2. [Problem 2: e.g., poor separation of concerns]
3. [Problem 3: e.g., difficult to test]
**Desired Outcome:**
[What the code should look like after refactoring]
**Constraints:**
- [ ] No behavior changes
- [ ] All existing tests must pass
- [ ] No API changes (if library)
- [ ] [Other constraints]
### Edge Cases & Implicit Requirements
**Boundary Conditions:**
- [ ] Empty input: [how to handle]
- [ ] Large data: [limits, pagination]
- [ ] Special characters: [escaping, validation]
- [ ] Null/undefined: [default behavior]
**Error Handling:**
- [ ] Network failure: [retry logic, user feedback]
- [ ] Invalid input: [validation, error messages]
- [ ] Permissions: [who can do what]
- [ ] Resource exhaustion: [limits, throttling]
**Integration Concerns:**
- **Depends on:** [list dependencies]
- **Affects:** [list affected components]
- **Breaking change:** Yes ⚠️ / No ✅
- **Backwards compatibility:** [considerations]
**Non-Functional:**
- **Performance:** [requirements or concerns]
- **Security:** [validations needed]
- **Accessibility:** [ARIA, keyboard nav, etc]
- **Mobile/Responsive:** [considerations]
---
## Scope Definition
### In Scope (Minimal)
1. [Must-have item 1]
2. [Must-have item 2]
3. [Must-have item 3]
### In Scope (If Time Permits)
1. [Nice-to-have item 1]
2. [Nice-to-have item 2]
### Out of Scope
1. [Item to defer - with reason]
2. [Item to defer - with reason]
### Dependencies
- **Blocked by:** [list blocking issues]
- **Blocks:** [list issues waiting on this]
### Estimated Complexity
🟢 Simple (< 4 hours)
🟡 Moderate (1-2 days)
🔴 Complex (3+ days)
**Complexity Factors:**
- [Factor 1: e.g., need to learn new API]
- [Factor 2: e.g., touching critical code path]
- [Factor 3: e.g., requires significant testing]
---
## Acceptance Criteria
### Functional
- [ ] [Action] results in [observable outcome]
- [ ] [Condition] produces [expected result]
- [ ] [Feature] works with [existing feature]
- [ ] [Edge case] handled appropriately
### Quality
- [ ] All new code has tests (coverage > X%)
- [ ] No new linting errors
- [ ] No new type errors
- [ ] Documentation updated
- [ ] Existing tests pass
### Edge Cases
- [ ] [Edge case 1] handled correctly
- [ ] [Edge case 2] shows appropriate error
- [ ] [Edge case 3] returns expected default
### Integration
- [ ] Works on [platform 1]
- [ ] Compatible with [version X]
- [ ] No breaking changes (or documented)
- [ ] Integrates with [related feature]
---
## Implementation Notes
### Affected Components
- [Component 1: description of involvement]
- [Component 2: description of involvement]
- [Component 3: description of involvement]
### Key Considerations
- [Consideration 1: important factor to keep in mind]
- [Consideration 2: architectural constraint]
- [Consideration 3: performance implication]
### Potential Challenges
- **[Challenge 1]:** [description]
- Mitigation: [how to address]
- **[Challenge 2]:** [description]
- Mitigation: [how to address]
### Similar Patterns in Codebase
- [Similar feature/pattern 1] @ [file:line]
- [Similar feature/pattern 2] @ [file:line]
---
## Open Questions
[Questions to ask maintainer before implementation]
1. **[Specific aspect]**
- Current understanding: [what you think]
- Question: [what's unclear]
- Options: [potential approaches A, B, C]
- Preference: [your recommendation and why]
2. **[Edge case handling]**
- Scenario: [describe edge case]
- Question: Should this [A] or [B]?
- Precedent: [similar handling elsewhere, if found]
---
## Next Steps
✅ Analysis complete - Ready for **Phase 3: Codebase Exploration**
**Before coding, explore:**
1. [Specific file/component to understand]
2. [Test patterns to learn]
3. [Similar features to reference]
**Or if clarification needed:**
❓ Post questions to issue thread and wait for maintainer response
---
## Notes
[Any additional context, insights, or considerations]

View File

@@ -0,0 +1,457 @@
# PR Submission Checklist
**Issue:** #[number]
**PR Title:** [Type]: [Brief description]
**Branch:** [branch-name]
**Date:** [date]
---
## Pre-Submission Checklist
### Code Quality
- [ ] **All tests pass locally**
```bash
[test command]
# Output: [all passing]
```
- [ ] **Linting passes**
```bash
[lint command]
# Output: [no errors]
```
- [ ] **Build succeeds**
```bash
[build command]
# Output: [success]
```
- [ ] **Type checking passes** (if applicable)
```bash
[type check command]
# Output: [no errors]
```
- [ ] **No compiler warnings**
- Checked: Yes / No / N/A
### Functionality
- [ ] **All requirements implemented**
- Requirement 1: ✅
- Requirement 2: ✅
- Requirement 3: ✅
- [ ] **Edge cases handled**
- Empty input: ✅
- Null/undefined: ✅
- Large data: ✅
- Invalid input: ✅
- [Other edge cases]: ✅
- [ ] **Error handling complete**
- Error messages clear
- Graceful degradation
- No crashes
- [ ] **Manual testing done**
- Tested on: [environment]
- Test scenarios: [list]
- Results: [all passed]
### Testing
- [ ] **New tests added**
- Unit tests: [count] added
- Integration tests: [count] added
- Test coverage: [percentage]
- [ ] **Test quality**
- Tests are meaningful (not just for coverage)
- Tests follow project conventions
- Tests have clear names
- Tests are independent
- [ ] **Existing tests still pass**
- All passing: Yes
- Any skipped: No
- Any modified: [list with reason]
### Documentation
- [ ] **Code comments added**
- Complex logic explained
- Public APIs documented
- TODOs addressed or tracked
- [ ] **README updated** (if needed)
- New features documented
- Examples added
- Installation updated
- [ ] **CHANGELOG entry added**
```markdown
## [Unreleased]
### [Added/Fixed/Changed]
- [Description] (#[issue])
```
- [ ] **API docs updated** (if applicable)
- Parameters documented
- Return values documented
- Examples provided
### Git Hygiene
- [ ] **Branch is up to date with main**
```bash
git fetch origin
git rebase origin/main
# Conflicts resolved: Yes/No
```
- [ ] **Commits are clean**
- Logical commits: Yes
- Clear messages: Yes
- No merge commits: Yes (or rebased)
- [ ] **No sensitive data**
- No API keys
- No passwords
- No personal data
- No secrets in history
- [ ] **No unintended changes**
- No debug code
- No commented code
- No formatting-only changes (unless intended)
- No temp files
### Self-Review
- [ ] **Reviewed entire diff**
- Read through all changes
- Checked for issues
- Verified quality
- [ ] **Code is clear**
- Variable names are descriptive
- Functions have single responsibility
- Logic is straightforward
- Comments where needed
- [ ] **Follows conventions**
- Naming matches project style
- Formatting is consistent
- Patterns match existing code
- No new paradigms introduced
- [ ] **No obvious bugs**
- Logic is correct
- Edge cases handled
- No potential null errors
- No off-by-one errors
### Completeness
- [ ] **All acceptance criteria met**
- [Criterion 1]: ✅
- [Criterion 2]: ✅
- [Criterion 3]: ✅
- [ ] **Issue fully resolved**
- Nothing left to do
- No half-implemented features
- No TODOs left unaddressed
- [ ] **No scope creep**
- Only issue requirements addressed
- No unrelated changes
- Additional ideas tracked separately
---
## PR Description Draft
### Title
```
[Type]: [Clear, concise description (50-70 chars)]
```
### Description
```markdown
## Summary
[2-3 sentences: what, why, how]
## Changes Made
- [Change 1]
- [Change 2]
- [Change 3]
## Type of Change
- [x] [Selected type]
## Related Issue
Fixes #[issue-number]
## How to Test
1. [Step 1]
2. [Step 2]
3. [Verify result]
## Screenshots (if applicable)
[Add screenshots or remove section]
## Checklist
- [x] Code follows style guidelines
- [x] Self-reviewed
- [x] Commented hard-to-understand areas
- [x] Documentation updated
- [x] No new warnings
- [x] Tests added and passing
## Additional Notes
[Any context, tradeoffs, or future work]
```
---
## CI/CD Preparation
### Expected CI Checks
- [ ] **Tests** - Should pass
- [ ] **Linting** - Should pass
- [ ] **Type checking** - Should pass
- [ ] **Build** - Should succeed
- [ ] **Coverage** - Should meet threshold ([X]%)
- [ ] **[Other checks]** - [Expected result]
### If CI Fails
**Plan:**
1. Check logs immediately
2. Reproduce locally
3. Fix and push update
4. Don't wait for reviewer if CI failing
---
## Communication Plan
### Before Creating PR
- [ ] **Comment on issue**
"Submitted PR #[number] to address this issue"
- [ ] **Tag appropriately** (if permissions)
- Type label (bug, enhancement, etc)
- Status label (ready for review, etc)
### After Creating PR
- [ ] **Monitor CI**
- Checks all passing
- Fix any failures immediately
- [ ] **Request review** (if needed)
- Specific reviewer requested
- Or wait for maintainer assignment
- [ ] **Be responsive**
- Check for comments daily
- Respond within 24-48 hours
- Make requested changes promptly
---
## Review Readiness
### Making Reviewer's Job Easy
- [ ] **PR is focused**
- Single concern
- Reasonable size (< 500 lines if possible)
- Clear purpose
- [ ] **Context provided**
- Clear description
- Test instructions
- Screenshots if UI change
- [ ] **Quality is high**
- No obvious issues
- Well-tested
- Follows conventions
- [ ] **Ready for feedback**
- Open to suggestions
- Will respond promptly
- Willing to iterate
### Potential Review Comments
**Prepare for:**
- Style/convention feedback → Will fix
- Architectural suggestions → Open to discuss
- Test coverage requests → Will add
- Documentation requests → Will improve
- Bug concerns → Will investigate
---
## Submission Commands
### Push Branch
```bash
# Ensure branch is up to date
git fetch origin
git rebase origin/main
# Push to remote
git push -u origin [branch-name]
# If rebased and need to force push
git push -f origin [branch-name]
```
### Create PR
**Via GitHub CLI:**
```bash
gh pr create \
--title "[Type]: [Description]" \
--body-file pr-description.md \
--label [label] \
--assignee @me
```
**Via Web:**
1. Go to repository on GitHub
2. Click "Pull requests"
3. Click "New pull request"
4. Select your branch
5. Fill in title and description
6. Create pull request
---
## Post-Submission
### Immediate Actions
- [ ] **Verify PR created successfully**
- URL: [PR URL]
- All info present
- CI triggered
- [ ] **Comment on issue**
"Submitted PR #[number]"
- [ ] **Monitor CI**
- All checks running
- Fix if any fail
### Ongoing
- [ ] **Respond to comments**
- Check daily
- Reply within 24-48 hours
- Be constructive
- [ ] **Make requested changes**
- Address feedback
- Push updates
- Mark comments resolved
- [ ] **Keep updated with main**
- Rebase if requested
- Resolve conflicts promptly
---
## Merge Preparation
### Before Merge
- [ ] **All reviews approved**
- Required approvals received
- No unresolved comments
- [ ] **CI passing**
- All checks green
- No failures
- [ ] **Up to date with main**
- No merge conflicts
- Latest changes incorporated
- [ ] **Final review**
- Re-check changes
- Verify quality
- Confirm ready
### After Merge
- [ ] **Update local repository**
```bash
git checkout main
git pull origin main
```
- [ ] **Delete feature branch**
```bash
git branch -d [branch-name]
git push origin --delete [branch-name]
```
- [ ] **Close related issues** (if not auto-closed)
- Issue #[number] closed
- [ ] **Celebrate!** 🎉
- Contribution merged
- Value added to project
- Experience gained
---
## Troubleshooting
### Common Issues
**CI Failing:**
- Check logs carefully
- Reproduce locally
- Fix and push update
- Don't wait for reviewer
**Merge Conflicts:**
- Rebase on main
- Resolve conflicts
- Test still passes
- Force push if needed
**Review Taking Long:**
- Be patient
- Maintainers are busy
- Polite ping after 1-2 weeks
- Don't take personally
**Changes Requested:**
- Thank reviewer
- Ask questions if unclear
- Make changes promptly
- Push updates
---
## Notes
[Personal notes, reminders, or considerations]
**Lessons Learned:**
[Note anything learned during this contribution for future reference]