Skip to content

Commit 98c03b2

Browse files
HerbHallclaude
andcommitted
feat: add GitHub Copilot integration files
Add AGENTS.md and copilot-instructions.md for Copilot coding agent, code review, and inline completions. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 8561b48 commit 98c03b2

2 files changed

Lines changed: 229 additions & 0 deletions

File tree

.github/copilot-instructions.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# DigitalRain -- Copilot Instructions
2+
3+
Matrix-style digital rain terminal visual effect written in Rust.
4+
5+
## Tech Stack
6+
7+
- **Language**: Rust (edition 2024, MSRV 1.85)
8+
- **Terminal**: crossterm 0.29 (cross-platform terminal manipulation)
9+
- **CLI**: clap 4 with derive macros
10+
- **Config**: toml + serde for TOML configuration files
11+
- **RNG**: rand 0.9 for randomized rain behavior
12+
13+
## Project Structure
14+
15+
```text
16+
DigitalRain/
17+
├── src/
18+
│ ├── main.rs - Entry point, CLI parsing, main loop
19+
│ ├── buffer.rs - Terminal buffer management
20+
│ ├── config.rs - Configuration loading and defaults
21+
│ ├── crt.rs - CRT monitor visual effect
22+
│ ├── overlay.rs - Text overlay rendering
23+
│ ├── terminal.rs - Terminal setup and teardown
24+
│ ├── timing.rs - Frame timing and tick control
25+
│ ├── transition.rs - Visual transition effects
26+
│ ├── color/ - Color schemes and gradient logic
27+
│ ├── effects/ - Visual effect implementations
28+
│ └── rain/ - Core rain drop simulation
29+
├── .github/ - CI workflows and Copilot config
30+
└── CLAUDE.md - Claude Code instructions
31+
```
32+
33+
## Code Style
34+
35+
- Conventional commits: `feat:`, `fix:`, `refactor:`, `docs:`, `test:`, `chore:`
36+
- Co-author tag: `Co-Authored-By: GitHub Copilot <noreply@github.com>`
37+
- Errors propagated with `?` operator and meaningful context via `.map_err()`
38+
- Tests use `#[cfg(test)]` modules with descriptive function names
39+
- All lint checks must pass before committing (`cargo clippy -- -D warnings`)
40+
- Code must be formatted with `cargo fmt`
41+
42+
## Coding Guidelines
43+
44+
- Fix errors immediately -- never classify them as pre-existing
45+
- Build, test, and lint must pass before any commit
46+
- Never skip hooks (`--no-verify`) or force-push main
47+
- Remove unused code completely; no backwards-compatibility hacks
48+
- Prefer `Option` over sentinel values for absent data
49+
- Use `match` or `if let` for pattern matching; avoid nested `unwrap()` chains
50+
- Keep `unsafe` blocks to an absolute minimum; document safety invariants
51+
52+
## Available Commands
53+
54+
```bash
55+
cargo build # Compile the project (debug)
56+
cargo build --release # Compile optimized release binary
57+
cargo test # Run all tests
58+
cargo clippy -- -D warnings # Run linter (warnings are errors)
59+
cargo fmt --check # Verify formatting
60+
cargo run # Run the application
61+
cargo run -- --help # Show CLI help
62+
```
63+
64+
## Do NOT
65+
66+
- Add `#[allow(clippy::...)]` directives without fixing the root cause first
67+
- Use `unwrap()` or `expect()` in library/non-main code without justification
68+
- Commit generated files without regenerating them first
69+
- Add dependencies without running `cargo build` to update `Cargo.lock`
70+
- Use `panic!` in library code; return `Result` instead
71+
- Store secrets, tokens, or credentials in code or config files
72+
- Mark work as complete when known errors remain
73+
- Use `unsafe` without a `// SAFETY:` comment explaining the invariant

AGENTS.md

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
<!--
2+
Scope: AGENTS.md guides the Copilot coding agent and Copilot Chat.
3+
For code completion and code review patterns, see .github/copilot-instructions.md
4+
For Claude Code, see CLAUDE.md
5+
-->
6+
7+
# DigitalRain
8+
9+
Matrix-style digital rain terminal visual effect written in Rust.
10+
11+
## Tech Stack
12+
13+
- **Language**: Rust (edition 2024, MSRV 1.85)
14+
- **Terminal**: crossterm 0.29 (cross-platform terminal manipulation)
15+
- **CLI**: clap 4 (command-line argument parsing with derive macros)
16+
- **Config**: toml + serde (TOML config file parsing)
17+
- **RNG**: rand 0.9 (random number generation for rain effects)
18+
- **Paths**: dirs 6 (platform-specific config directory resolution)
19+
20+
## Build and Test Commands
21+
22+
```bash
23+
# Build
24+
cargo build
25+
26+
# Build release (optimized)
27+
cargo build --release
28+
29+
# Test
30+
cargo test
31+
32+
# Lint
33+
cargo clippy -- -D warnings
34+
35+
# Format check
36+
cargo fmt --check
37+
38+
# Full verification (run before any PR)
39+
cargo build && cargo test && cargo clippy -- -D warnings && cargo fmt --check
40+
```
41+
42+
## Project Structure
43+
44+
```text
45+
DigitalRain/
46+
├── src/
47+
│ ├── main.rs - Entry point, CLI parsing, main loop
48+
│ ├── buffer.rs - Terminal buffer management
49+
│ ├── config.rs - Configuration loading and defaults
50+
│ ├── crt.rs - CRT monitor visual effect
51+
│ ├── overlay.rs - Text overlay rendering
52+
│ ├── terminal.rs - Terminal setup and teardown
53+
│ ├── timing.rs - Frame timing and tick control
54+
│ ├── transition.rs - Visual transition effects
55+
│ ├── color/ - Color schemes and gradient logic
56+
│ ├── effects/ - Visual effect implementations
57+
│ └── rain/ - Core rain drop simulation
58+
├── assets/ - Static assets (screenshots, etc.)
59+
├── docs/ - Project documentation
60+
├── scripts/ - Build and CI helper scripts
61+
├── .github/ - CI workflows and Copilot config
62+
├── Cargo.toml - Rust package manifest
63+
└── CLAUDE.md - Claude Code instructions
64+
```
65+
66+
## Workflow Rules
67+
68+
### Always Do
69+
70+
- Create a feature branch for every change (`feature/issue-NNN-description`)
71+
- Use conventional commits: `feat:`, `fix:`, `refactor:`, `docs:`, `test:`, `chore:`
72+
- Run build, test, and lint before opening a PR
73+
- Use the `?` operator for error propagation with meaningful context
74+
- Fix every error you find, regardless of who introduced it
75+
- Use `cargo fmt` to format code before committing
76+
77+
### Ask First
78+
79+
- Adding new dependencies (check if `std` covers the need)
80+
- Architectural changes (new modules, major trait changes)
81+
- Changes to CI/CD workflows
82+
- Removing or renaming public APIs or CLI flags
83+
- Changes to the config file schema
84+
85+
### Never Do
86+
87+
- Commit directly to `main` -- always use feature branches
88+
- Skip tests or lint checks -- even for "small changes"
89+
- Use `--no-verify` or `--force` flags
90+
- Commit secrets, credentials, or API keys
91+
- Add TODO comments without a linked issue number
92+
- Mark work as complete when build, test, or lint failures remain
93+
94+
## Core Principles
95+
96+
These are unconditional -- no optimization or time pressure overrides them:
97+
98+
1. **Quality**: Once found, always fix, never leave. There is no "pre-existing" error.
99+
2. **Verification**: Build, test, and lint must pass before any commit.
100+
3. **Safety**: Never force-push `main`. Never skip hooks. Never commit secrets.
101+
4. **Honesty**: Never mark work as complete when it is not.
102+
103+
## Error Handling
104+
105+
```rust
106+
// Use the ? operator to propagate errors with context
107+
fn load_config(path: &Path) -> Result<Config, Box<dyn std::error::Error>> {
108+
let content = std::fs::read_to_string(path)
109+
.map_err(|e| format!("failed to read config at {}: {}", path.display(), e))?;
110+
let config: Config = toml::from_str(&content)
111+
.map_err(|e| format!("failed to parse config: {}", e))?;
112+
Ok(config)
113+
}
114+
115+
// Use Option for values that may be absent (not sentinel values)
116+
fn find_column(&self, x: u16) -> Option<&RainColumn> {
117+
self.columns.iter().find(|c| c.x == x)
118+
}
119+
```
120+
121+
## Testing Conventions
122+
123+
```rust
124+
#[cfg(test)]
125+
mod tests {
126+
use super::*;
127+
128+
#[test]
129+
fn test_config_default_values() {
130+
let config = Config::default();
131+
assert!(config.speed > 0.0);
132+
assert!(!config.color_scheme.is_empty());
133+
}
134+
135+
#[test]
136+
fn test_buffer_dimensions() {
137+
let buffer = Buffer::new(80, 24);
138+
assert_eq!(buffer.width(), 80);
139+
assert_eq!(buffer.height(), 24);
140+
}
141+
}
142+
```
143+
144+
## Commit Format
145+
146+
```text
147+
feat: add configurable rain density
148+
149+
Adds --density CLI flag and config option to control drop spawn rate.
150+
151+
Closes #42
152+
Co-Authored-By: GitHub Copilot <copilot@github.com>
153+
```
154+
155+
Types: `feat` (new feature), `fix` (bug fix), `refactor` (no behavior change),
156+
`docs` (documentation only), `test` (tests only), `chore` (build/tooling).

0 commit comments

Comments
 (0)