Skip to content

Commit 84fcb99

Browse files
authored
Initial commit
0 parents  commit 84fcb99

11 files changed

Lines changed: 1299 additions & 0 deletions

File tree

.github/copilot-instructions.md

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# GitHub Copilot Instructions
2+
3+
## Writing Style
4+
5+
Write naturally and conversationally, like a human developer would.
6+
7+
- Never use em dashes (—)
8+
- Keep sentences short and clear
9+
- Avoid AI-like phrasing and corporate jargon
10+
- Write concisely without unnecessary elaboration
11+
12+
## Code Comments
13+
14+
Always add comments to non-trivial code. Focus on explaining WHY something is done, not just WHAT it does.
15+
16+
Highlight:
17+
- Tradeoffs made in the implementation
18+
- Complexity considerations
19+
- Design decisions and rationale
20+
21+
## Style Enforcement
22+
23+
Follow these coding standards consistently:
24+
25+
- **No Magic Numbers**: Always use named constants instead of hardcoded values
26+
- Bad: `if (retry < 3)`
27+
- Good: `const MAX_RETRIES = 3; if (retry < MAX_RETRIES)`
28+
- **Consistent Naming**: Follow the project's naming conventions (check existing code)
29+
- **Error Handling**: Always handle errors explicitly, never silently ignore them
30+
- **DRY Principle**: Don't repeat yourself. Extract common patterns into reusable functions
31+
- **Single Responsibility**: Each function should do one thing well
32+
33+
## Interview Prep Mode
34+
35+
After implementing or modifying significant code:
36+
37+
1. **Ask**: "Would you like to update INTERVIEW_NOTES.md with this change?"
38+
2. **Suggest** adding to INTERVIEW_NOTES.md:
39+
- Trade-off bullet points for architectural decisions
40+
- Complexity analysis (time/space) for algorithms
41+
- Edge cases handled
42+
- Scaling considerations
43+
- Alternative approaches considered
44+
45+
Example prompt:
46+
```
47+
This implementation uses [approach]. I've added it to the code.
48+
49+
Would you like me to add an entry to INTERVIEW_NOTES.md covering:
50+
- Why we chose [approach] over [alternative]
51+
- Time complexity: O(n)
52+
- Trade-off: [benefit] vs [cost]
53+
```
54+
55+
## Code Quality Standards
56+
57+
Prefer patterns that are:
58+
- **Robust**: Handle edge cases and errors gracefully
59+
- **Maintainable**: Easy for others (or future you) to understand and modify
60+
- **Testable**: Written in a way that makes testing straightforward
61+
- **Clear**: Self-documenting code over clever one-liners
62+
63+
Avoid:
64+
- Clever tricks that sacrifice readability
65+
- Premature optimization
66+
- Over-engineering simple problems
67+
- Leaving TODO comments without creating issues
68+
69+
## Function Documentation
70+
71+
For public functions, always include:
72+
- Brief description of what it does
73+
- Parameters and their types/constraints
74+
- Return value and type
75+
- Any side effects or exceptions
76+
- Example usage (for complex functions)
77+
78+
## Interview-Focused Development
79+
80+
When code is added or modified, automatically:
81+
82+
1. Add interview-focused comments directly in the code that explain:
83+
- Why this approach was chosen
84+
- What alternatives were considered
85+
- Key tradeoffs and limitations
86+
- Performance or scalability implications
87+
88+
2. Suggest updating INTERVIEW_NOTES.md with:
89+
- Key decisions made
90+
- Tradeoffs considered
91+
- Complexity analysis
92+
- Potential improvements
93+
- Realistic interview questions with strong senior-level answers
94+
95+
## General Guidelines
96+
97+
- Prioritize readability and maintainability
98+
- Consider edge cases and error handling
99+
- Think about how the code would scale
100+
- Document assumptions and constraints
101+
- Write code that you would be proud to discuss in an interview
102+
- When suggesting code changes, explain the "why" behind your suggestions

.github/workflows/ci.yml

Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
name: CI Pipeline
2+
3+
on:
4+
push:
5+
branches: [ main, master, develop ]
6+
pull_request:
7+
branches: [ main, master, develop ]
8+
workflow_dispatch:
9+
10+
jobs:
11+
lint:
12+
name: Code Quality
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v3
18+
19+
- name: Run Linter
20+
run: |
21+
if [ -f "Makefile" ] && make -n lint > /dev/null 2>&1; then
22+
echo "Running: make lint"
23+
make lint
24+
else
25+
echo "No linter configured yet. Add 'make lint' target to enable linting."
26+
exit 0
27+
fi
28+
continue-on-error: true
29+
30+
test:
31+
name: Tests
32+
runs-on: ubuntu-latest
33+
# Optional: Matrix testing across multiple versions
34+
# strategy:
35+
# matrix:
36+
# version: ['3.9', '3.10', '3.11'] # Example for Python
37+
# # version: ['18', '20', '21'] # Example for Node.js
38+
39+
steps:
40+
- name: Checkout code
41+
uses: actions/checkout@v3
42+
43+
# Optional: Setup language runtime for matrix testing
44+
# - name: Set up Python ${{ matrix.version }}
45+
# uses: actions/setup-python@v4
46+
# with:
47+
# python-version: ${{ matrix.version }}
48+
49+
# - name: Set up Node.js ${{ matrix.version }}
50+
# uses: actions/setup-node@v3
51+
# with:
52+
# node-version: ${{ matrix.version }}
53+
54+
- name: Run Tests
55+
id: test
56+
run: |
57+
if [ -f "Makefile" ]; then
58+
echo "Found Makefile, attempting to run tests..."
59+
if make -n test > /dev/null 2>&1; then
60+
echo "Running: make test"
61+
make test
62+
elif make -n all > /dev/null 2>&1; then
63+
echo "Running: make all"
64+
make all
65+
elif make -n > /dev/null 2>&1; then
66+
echo "Running: make (default target)"
67+
make
68+
else
69+
echo "No suitable make target found. Add your tests to the tests/ directory"
70+
exit 0
71+
fi
72+
else
73+
echo "No Makefile found. Add a Makefile with a 'test' target to enable automated testing."
74+
exit 0
75+
fi
76+
77+
# Optional: Generate and upload test coverage
78+
# - name: Generate Coverage Report
79+
# if: success()
80+
# run: |
81+
# # Add coverage command for your language
82+
# # Python: pytest --cov=src --cov-report=xml
83+
# # Node.js: npm run coverage
84+
# # Go: go test -coverprofile=coverage.out ./...
85+
# echo "TODO: Configure coverage reporting"
86+
87+
# - name: Upload Coverage
88+
# if: success()
89+
# uses: codecov/codecov-action@v3
90+
# with:
91+
# file: ./coverage.xml # Adjust path based on your coverage tool
92+
93+
# Optional: Comment test results on PR
94+
# - name: Comment Test Results
95+
# if: github.event_name == 'pull_request' && always()
96+
# uses: actions/github-script@v6
97+
# with:
98+
# script: |
99+
# const output = `#### Test Results 🧪
100+
# - **Status**: ${{ steps.test.outcome }}
101+
#
102+
# Add coverage metrics here once configured.`;
103+
#
104+
# github.rest.issues.createComment({
105+
# issue_number: context.issue.number,
106+
# owner: context.repo.owner,
107+
# repo: context.repo.repo,
108+
# body: output
109+
# });
110+
111+
build:
112+
name: Build
113+
runs-on: ubuntu-latest
114+
needs: [lint, test]
115+
116+
steps:
117+
- name: Checkout code
118+
uses: actions/checkout@v3
119+
120+
- name: Build Project
121+
run: |
122+
if [ -f "Makefile" ] && make -n build > /dev/null 2>&1; then
123+
echo "Running: make build"
124+
make build
125+
else
126+
echo "No build target found. Add 'make build' target if your project requires compilation."
127+
exit 0
128+
fi
129+
continue-on-error: true
130+
131+
# Optional: Upload build artifacts
132+
# - name: Upload Artifacts
133+
# if: success()
134+
# uses: actions/upload-artifact@v3
135+
# with:
136+
# name: build-artifacts
137+
# path: |
138+
# dist/
139+
# build/
140+
# target/
141+
142+
security:
143+
name: Security Scan
144+
runs-on: ubuntu-latest
145+
146+
steps:
147+
- name: Checkout code
148+
uses: actions/checkout@v3
149+
150+
# Security scanning for dependencies
151+
- name: Run Dependency Check
152+
run: |
153+
echo "Security scanning..."
154+
echo "TODO: Add security scanning for your package manager"
155+
echo "Examples:"
156+
echo " - Python: pip-audit or safety check"
157+
echo " - Node.js: npm audit"
158+
echo " - Go: go list -json -m all | nancy sleuth"
159+
echo " - Java: mvn org.owasp:dependency-check-maven:check"
160+
continue-on-error: true
161+
162+
# Optional: Additional security tools
163+
# - name: Run Trivy vulnerability scanner
164+
# uses: aquasecurity/trivy-action@master
165+
# with:
166+
# scan-type: 'fs'
167+
# scan-ref: '.'
168+
# format: 'sarif'
169+
# output: 'trivy-results.sarif'
170+
171+
# - name: Upload Trivy results to GitHub Security
172+
# uses: github/codeql-action/upload-sarif@v2
173+
# with:
174+
# sarif_file: 'trivy-results.sarif'

.gitignore

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# Python
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
*.so
6+
.Python
7+
build/
8+
develop-eggs/
9+
dist/
10+
downloads/
11+
eggs/
12+
.eggs/
13+
lib/
14+
lib64/
15+
parts/
16+
sdist/
17+
var/
18+
wheels/
19+
*.egg-info/
20+
.installed.cfg
21+
*.egg
22+
MANIFEST
23+
venv/
24+
env/
25+
ENV/
26+
.venv
27+
28+
# Node.js
29+
node_modules/
30+
npm-debug.log*
31+
yarn-debug.log*
32+
yarn-error.log*
33+
.pnpm-debug.log*
34+
package-lock.json
35+
yarn.lock
36+
.npm
37+
.eslintcache
38+
.node_repl_history
39+
*.tgz
40+
.yarn-integrity
41+
42+
# Environment files
43+
.env
44+
.env.local
45+
.env.*.local
46+
*.env
47+
48+
# IDEs and editors
49+
.vscode/
50+
.idea/
51+
*.swp
52+
*.swo
53+
*~
54+
.DS_Store
55+
*.sublime-workspace
56+
*.sublime-project
57+
58+
# Build outputs
59+
*.out
60+
*.o
61+
*.a
62+
*.exe
63+
*.dll
64+
*.so
65+
*.dylib
66+
bin/
67+
obj/
68+
target/
69+
out/
70+
71+
# Logs
72+
*.log
73+
logs/
74+
npm-debug.log*
75+
yarn-debug.log*
76+
yarn-error.log*
77+
78+
# Testing
79+
coverage/
80+
.coverage
81+
*.cover
82+
.hypothesis/
83+
.pytest_cache/
84+
.nyc_output/
85+
htmlcov/
86+
87+
# OS files
88+
.DS_Store
89+
Thumbs.db
90+
Desktop.ini
91+
92+
# Temporary files
93+
tmp/
94+
temp/
95+
*.tmp
96+
*.bak
97+
*.swp

0 commit comments

Comments
 (0)