| 
 | 1 | +# Copilot Instructions for json-rs  | 
 | 2 | + | 
 | 3 | +## Project Overview  | 
 | 4 | + | 
 | 5 | +This is a Rust monorepo for a JSON parser ported from TypeScript. It consists of three main crates:  | 
 | 6 | + | 
 | 7 | +- **shared-lib**: Core library for parsing and representing JSON.  | 
 | 8 | +- **cli**: Command-line interface for parsing JSON from stdin.  | 
 | 9 | +- **api-rocket**: HTTP API server exposing JSON parsing via Rocket.  | 
 | 10 | + | 
 | 11 | +## Workspace Structure  | 
 | 12 | + | 
 | 13 | +- `shared-lib/`: Contains parsing logic and types. Exposes `parse`, `Json`, `ValueToken`, and `pretty_print_token`.  | 
 | 14 | +- `cli/`: Reads JSON from stdin, parses it using shared-lib, and prints a pretty-formatted result or error.  | 
 | 15 | +- `api-rocket/`: Provides a POST `/api/v1/parse` endpoint. Accepts plain text JSON, returns pretty-printed output or error JSON.  | 
 | 16 | +- `testdata/`: Contains `.rest` files for API testing with VSCode REST Client.  | 
 | 17 | + | 
 | 18 | +## Build, Test, Format, Lint  | 
 | 19 | + | 
 | 20 | +- Build all crates: `cargo build --workspace`  | 
 | 21 | +- Test all crates: `cargo test --workspace`  | 
 | 22 | +- Format: `cargo fmt`  | 
 | 23 | +- Lint: `cargo clippy -p cli -p shared-lib --all-targets --all-features`  | 
 | 24 | + | 
 | 25 | +## Usage  | 
 | 26 | + | 
 | 27 | +- **CLI**: `cargo run --package cli < input.json` or enter JSON manually.  | 
 | 28 | +- **API**: `cargo run --package api-rocket` (default: http://localhost:8000). Test with `.rest` files in `testdata/`.  | 
 | 29 | + | 
 | 30 | +## Coding Conventions  | 
 | 31 | + | 
 | 32 | +- Use types and parsing functions from shared-lib.  | 
 | 33 | +- Prefer workspace-level commands for build/test.  | 
 | 34 | +- Add new features as modules in shared-lib if they relate to JSON parsing.  | 
 | 35 | +- For API changes, update Rocket routes in api-rocket.  | 
 | 36 | +- For CLI changes, update main.rs in cli.  | 
 | 37 | + | 
 | 38 | +## Copilot Agent Guidance  | 
 | 39 | + | 
 | 40 | +- When processing Copilot requests, follow Rust best practices and workspace conventions.  | 
 | 41 | +- For parsing logic, use or extend shared-lib.  | 
 | 42 | +- For CLI/API features, ensure integration with shared-lib.  | 
 | 43 | +- Add tests in shared-lib/tests or appropriate crate.  | 
 | 44 | +- Use `.rest` files in testdata/ for API testing.  | 
 | 45 | +- Reference README.md for additional details.  | 
0 commit comments