mega
Copilot instructions522 starsChanged 21 months agoApache-2.0View on GitHub
Mega is an unofficial open-source implementation of Google Piper: a monorepo/monolithic codebase management system with Git compatibility, FUSE mounting, and Buck2 integration. When proposing designs or code, optimize for very large repos, content-addressed storage, and Git internals (packfiles, MIDX, commit-graph, delta chains). License is Apache-2.0 + MIT; keep new files compatible with both. See docs/architecture.md for the full workspace map. Note: Scorpio (FUSE implementation) has been moved to https://github.com/web3infra-foundation/scorpiofs For FUSE-related development, refer to the scorpiofs repository.
We split this copilot-instructions.md into the rules it gives an agent
24 rules. About 1 is common, 21 are distinctive, and 2 are very specific to this project.
≈1
Common · estimate
Many files like this have a rule of this kind.
≈21
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 9
Prefer Rust (Edition 2021+).
- Distinctive: line 11
Avoid unsafe unless there’s a measurable win (perf or FFI).
- Distinctive: line 19
When generating commands, prefer:
- Common: line 45
Treat clippy warnings as errors for new/changed code.
- Distinctive: line 47
Prefer iterator and slice APIs to heap-allocating vectors in hot paths.
- Distinctive: line 52
When dealing with Git objects/packs, consider delta-chain depth, fanout tables, OID (SHA-1 vs SHA-256), and zstd/deflate trade-offs.
- Distinctive: line 67
Write unit + integration + property tests.
- Distinctive: line 68
Add concurrency tests (Tokio multi-task) where IO/state is involved.
- Distinctive: line 69
Prefer hermetic tests with temp dirs.
- Distinctive: line 73
Use tracing spans/fields; do not log secrets.
- Distinctive: line 78
No plaintext secrets, keys, or tokens in code or tests.
- Distinctive: line 79
Default to Rustls for TLS.
- Distinctive: line 80
Keep third-party code in third-party/ with license notices.
- Distinctive: line 84
Add module-level docs (//!) and public item docs (///) for all public items.
- Distinctive: line 95
Use present tense (e.g., "Add feature X" not "Added feature X").
- Distinctive: line 96
Keep lines under 72 characters.
- Distinctive: line 101
When the user asks for code, emit Rust first, then Buck2 snippets/macros if relevant.
- Distinctive: line 102
When suggesting design options, list trade-offs (perf, memory, portability, compatibility with Git).
- Distinctive: line 103
Prefer minimal, composable abstractions.
- Distinctive: line 107
Do not recommend migrating away from Git without explicit request.
- Distinctive: line 108
Do not propose language rewrites away from Rust unless integrating with existing systems.
- Very specific: line 113
DO:: When generating code, provide solutions in Rust for backend/core logic and TypeScript for frontend/tooling/SDKs.
- Distinctive: line 114
DO:: Ensure all commit message examples adhere to the Conventional Commits standard.
- Very specific: line 115
DO:: When asked about building or testing, refer to the Buck2 build system.
≈ “Common” is an estimate: at least 1 in 5 of the 3,669 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Mega – Repository Custom Instructions for GitHub Copilot
What this repo is
Mega is an unofficial open-source implementation of Google Piper: a monorepo/monolithic codebase management system with Git compatibility, FUSE mounting, and Buck2 integration. When proposing designs or code, optimize for very large repos, content-addressed storage, and Git internals (packfiles, MIDX, commit-graph, delta chains). License is Apache-2.0 + MIT; keep new files compatible with both.
Languages & defaults
- Prefer Rust (Edition 2021+). Use async/await with Tokio, and structured logging with tracing.
- Serialization: serde; CLI: clap; errors: thiserror (library) and anyhow (bin/tests/tools).
- Avoid unsafe unless there’s a measurable win (perf or FFI). If unsafe is required, add a // SAFETY: rationale comment and tests.
- For small utilities, you may use Python or Bash, but default to Rust when feasible.
Build & run
- Primary build: Buck2. Provide buck2 rules/macros and examples when adding code or docs.
- Crate local build: cargo build -p
<crate>is welcomed for dev loops; ensure parity with Buck2 rules. - When generating commands, prefer:
buck2 build //... for CI-style full builds
buck2 test //... for tests
cargo nextest run -p <crate> when suggesting fast local test runsKey Components (Modules)
| Crate | Role |
mono | Server binary (HTTP REST, Git HTTP/SSH, Swagger) |
ceres | Domain library: transport, application, HTTP DTOs |
jupiter / callisto | Storage and SeaORM entities |
jupiter-migrate | Database migrations |
orion / orion-server / orion-scheduler | Build orchestration |
saturn | Cedar policy |
vault | Crypto and secrets |
moon | Frontend (TypeScript) |
See docs/architecture.md for the full workspace map.
Coding style & quality
- Run rustfmt defaults.
- Treat clippy warnings as errors for new/changed code; prefer #[must_use], #[deny(unsafe_op_in_unsafe_fn)] where appropriate.
- Return Result<T, E>; avoid unwrap()/expect() in library code except in tests or when invariant-proofed and documented.
- Prefer iterator and slice APIs to heap-allocating vectors in hot paths. Use SmallVec, bytes, or no_std-friendly patterns when beneficial.
Performance & memory
- Mega targets huge repos; prioritize O(n) single-pass algorithms, streaming IO, mmap when safe, and bounded allocations.
- When dealing with Git objects/packs, consider delta-chain depth, fanout tables, OID (SHA-1 vs SHA-256), and zstd/deflate trade-offs. Include micro-benchmarks for hot paths via criterion.
Filesystems & FUSE
Note: Scorpio (FUSE implementation) has been moved to https://github.com/web3infra-foundation/scorpiofs
For FUSE-related development, refer to the scorpiofs repository.
API & CLI guidelines
- Public APIs: lean toward stable, versioned boundaries; avoid leaking internal pack/layout details unless clearly documented.
- CLI should default to safe, read-only modes for destructive commands; provide --dry-run and --json where reasonable.
Testing
- Write unit + integration + property tests. Use proptest for object/pack fuzzing, and insta for snapshots when output is textual.
- Add concurrency tests (Tokio multi-task) where IO/state is involved.
- Prefer hermetic tests with temp dirs; avoid network unless explicitly required.
Observability & errors
- Use tracing spans/fields; do not log secrets.
- Provide actionable error messages (context via anyhow::Context), and map OS/IO errors precisely.
Security & compliance
- No plaintext secrets, keys, or tokens in code or tests.
- Default to Rustls for TLS; avoid new C FFI unless justified.
- Keep third-party code in third-party/ with license notices; check compatibility with Apache-2.0/MIT.
Documentation
- Add module-level docs (//!) and public item docs (///) for all public items.
- For complex algorithms (e.g., pack rewriter, multi-pack-index), include a short overview, invariants, and example.
- English comments preferred; Chinese allowed for tricky parts (bilingual welcome).
Git workflow
We favor Trunk-Based Development and Conventional Commits.
Commit messages
- Concise imperative subject; body explains why and outlines bench/test evidence.
- Use present tense (e.g., "Add feature X" not "Added feature X").
- Keep lines under 72 characters.
- Reference issues/PRs liberally (e.g., "Fix #123" or "Add feature X (#123)").
How to talk back to us (Copilot prompts)
- When the user asks for code, emit Rust first, then Buck2 snippets/macros if relevant.
- When suggesting design options, list trade-offs (perf, memory, portability, compatibility with Git).
- Prefer minimal, composable abstractions; avoid premature global singletons.
Non-goals
- Do not recommend migrating away from Git without explicit request.
- Do not propose language rewrites away from Rust unless integrating with existing systems.
How to Assist Developers (Guidelines for Copilot)
- DON'T: Propose language rewrites away from Rust unless integrating with existing systems.
- DO: When generating code, provide solutions in Rust for backend/core logic and TypeScript for frontend/tooling/SDKs.
- DO: Ensure all commit message examples adhere to the Conventional Commits standard.
- DO: When asked about building or testing, refer to the Buck2 build system. Avoid suggesting root-level
cargoornpmcommands unless they are specific to a sub-package. - DON'T: Confuse this project with "mega.nz" (the cloud storage service) or other projects named "Mega." This project is "mega" for version control infrastructure.
- DO: Point users to
CONTRIBUTING.mdfor contribution guidelines and setup instructions.
Other versions1 project uses a version of this.
Word for word · 1
- gitmono-dev/mega★ 517100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
Where files are headingNew Copilot instructions files have more rules about branches and pull requests, and fewer about code style.
Of the Copilot instructions files we read, the 2,297 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

