Skip to content

Commit 419f3e9

Browse files
committed
docs: update documentation for simplified feature flags (lib/server/cli)
1 parent 54a44c8 commit 419f3e9

File tree

5 files changed

+86
-77
lines changed

5 files changed

+86
-77
lines changed

AGENTS.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,13 @@ src/
112112
│ └── monocle/ # Main repositories (asinfo, as2rel, rpki, pfx2as)
113113
├── lens/ # Business logic layer
114114
│ ├── utils.rs # OutputFormat, shared utilities
115-
│ ├── time/ # Time parsing (lens-core)
116-
│ ├── country.rs # Country lookup (lens-bgpkit)
117-
│ ├── parse/ # MRT parsing (lens-bgpkit)
118-
│ ├── search/ # BGP search (lens-bgpkit)
119-
│ ├── rpki/ # RPKI validation (lens-bgpkit)
120-
│ └── inspect/ # Unified inspection (lens-full)
121-
├── server/ # WebSocket server (cli feature)
115+
│ ├── time/ # Time parsing
116+
│ ├── country.rs # Country lookup
117+
│ ├── parse/ # MRT parsing
118+
│ ├── search/ # BGP search
119+
│ ├── rpki/ # RPKI validation
120+
│ └── inspect/ # Unified inspection
121+
├── server/ # WebSocket server (requires `server` feature)
122122
│ └── handlers/ # Method handlers
123123
└── bin/
124124
├── monocle.rs # CLI entry point

ARCHITECTURE.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -88,38 +88,38 @@ src/
8888
│ ├── mod.rs
8989
│ ├── README.md
9090
│ ├── utils.rs # OutputFormat, formatting helpers
91-
│ ├── country.rs # Country code/name lookup (lens-bgpkit)
91+
│ ├── country.rs # Country code/name lookup
9292
│ │
93-
│ ├── as2rel/ # AS relationship lens (lens-bgpkit)
93+
│ ├── as2rel/ # AS relationship lens
9494
│ │ ├── mod.rs
9595
│ │ ├── args.rs
9696
│ │ └── types.rs
9797
│ │
98-
│ ├── inspect/ # Unified AS/prefix inspection (lens-full)
98+
│ ├── inspect/ # Unified AS/prefix inspection
9999
│ │ ├── mod.rs # InspectLens implementation
100100
│ │ └── types.rs # Result types, section selection
101101
│ │
102-
│ ├── ip/ # IP information lookup (lens-bgpkit)
102+
│ ├── ip/ # IP information lookup
103103
│ │ └── mod.rs
104104
│ │
105-
│ ├── parse/ # MRT file parsing (lens-bgpkit)
105+
│ ├── parse/ # MRT file parsing
106106
│ │ └── mod.rs
107107
│ │
108-
│ ├── pfx2as/ # Prefix-to-ASN mapping types (lens-bgpkit)
108+
│ ├── pfx2as/ # Prefix-to-ASN mapping types
109109
│ │ └── mod.rs # Types only; repository handles lookups
110110
│ │
111-
│ ├── rpki/ # RPKI validation and data (lens-bgpkit)
111+
│ ├── rpki/ # RPKI validation and data
112112
│ │ ├── mod.rs # RpkiLens with validation logic
113113
│ │ └── commons.rs # bgpkit-commons integration
114114
│ │
115-
│ ├── search/ # BGP message search (lens-bgpkit)
115+
│ ├── search/ # BGP message search
116116
│ │ ├── mod.rs
117117
│ │ └── query_builder.rs
118118
│ │
119-
│ └── time/ # Time parsing and formatting (lens-core)
119+
│ └── time/ # Time parsing and formatting
120120
│ └── mod.rs
121121
122-
├── server/ # WebSocket server (cli feature)
122+
├── server/ # WebSocket server (requires `server` feature)
123123
│ ├── mod.rs # Server startup, handle_socket
124124
│ ├── protocol.rs # Core protocol types (RequestEnvelope, ResponseEnvelope)
125125
│ ├── router.rs # Router + Dispatcher

DEVELOPMENT.md

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,29 +17,29 @@ src/
1717
├── lib.rs # Public API exports
1818
├── config.rs # Configuration management
1919
20-
├── lens/ # Business logic layer (feature-gated)
20+
├── lens/ # Business logic layer (requires `lib` feature)
2121
│ ├── mod.rs # Lens module exports
2222
│ ├── utils.rs # Shared utilities (OutputFormat, truncate_name)
23-
│ ├── time/ # Time parsing lens (lens-core)
23+
│ ├── time/ # Time parsing lens
2424
│ │ └── mod.rs
25-
│ ├── country.rs # Country lookup (lens-bgpkit)
26-
│ ├── ip/ # IP information lookup (lens-bgpkit)
25+
│ ├── country.rs # Country lookup
26+
│ ├── ip/ # IP information lookup
2727
│ │ └── mod.rs
28-
│ ├── parse/ # MRT file parsing with progress (lens-bgpkit)
28+
│ ├── parse/ # MRT file parsing with progress
2929
│ │ └── mod.rs
30-
│ ├── search/ # BGP message search with progress (lens-bgpkit)
30+
│ ├── search/ # BGP message search with progress
3131
│ │ ├── mod.rs
3232
│ │ └── query_builder.rs
33-
│ ├── rpki/ # RPKI validation (lens-bgpkit)
33+
│ ├── rpki/ # RPKI validation
3434
│ │ ├── mod.rs
3535
│ │ └── commons.rs
36-
│ ├── pfx2as/ # Prefix-to-ASN types (lens-bgpkit)
36+
│ ├── pfx2as/ # Prefix-to-ASN types
3737
│ │ └── mod.rs
38-
│ ├── as2rel/ # AS-level relationship lens (lens-bgpkit)
38+
│ ├── as2rel/ # AS-level relationship lens
3939
│ │ ├── mod.rs
4040
│ │ ├── args.rs
4141
│ │ └── types.rs
42-
│ └── inspect/ # Unified AS/prefix inspection (lens-full)
42+
│ └── inspect/ # Unified AS/prefix inspection
4343
│ ├── mod.rs # InspectLens implementation
4444
│ └── types.rs # Result types, section selection
4545
@@ -52,7 +52,7 @@ src/
5252
│ ├── rpki.rs # RPKI ROA/ASPA (blob-based prefix storage)
5353
│ └── pfx2as.rs # Prefix-to-ASN (blob-based prefix storage)
5454
55-
├── server/ # WebSocket server (cli feature)
55+
├── server/ # WebSocket server (requires `server` feature)
5656
│ ├── mod.rs # Server startup, handle_socket
5757
│ ├── protocol.rs # Core protocol types
5858
│ ├── router.rs # Router + Dispatcher
@@ -498,18 +498,15 @@ pub struct MyArgs { ... }
498498
#[cfg_attr(feature = "display", derive(tabled::Tabled))]
499499
pub struct MyResult { ... }
500500

501-
// Lens-specific features
502-
#[cfg(feature = "lens-bgpkit")]
501+
// Lens module (requires `lib` feature)
502+
#[cfg(feature = "lib")]
503503
pub mod my_lens;
504504
```
505505

506-
Feature tiers:
507-
- `database`: SQLite operations only
508-
- `lens-core`: Standalone lenses (TimeLens)
509-
- `lens-bgpkit`: BGP-related lenses
510-
- `lens-full`: All lenses including InspectLens
511-
- `display`: Table formatting with tabled
512-
- `cli`: Full CLI binary with server support
506+
Feature tiers (simplified):
507+
- `lib`: Complete library (database + all lenses + display)
508+
- `server`: WebSocket server (implies lib)
509+
- `cli`: Full CLI binary (implies lib and server)
513510

514511
### Output Formatting
515512

README.md

Lines changed: 41 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ See through all Border Gateway Protocol (BGP) data with a monocle.
1616
- [Using `homebrew` on macOS](#using-homebrew-on-macos)
1717
- [Using `cargo-binstall`](#using-cargo-binstall)
1818
- [Library Usage](#library-usage)
19+
- [Documentation](#documentation)
1920
- [Usage](#usage)
2021
- [`monocle parse`](#monocle-parse)
2122
- [Output Format](#output-format)
@@ -98,52 +99,63 @@ Monocle can also be used as a library in your Rust projects. Add it to your `Car
9899

99100
```toml
100101
[dependencies]
101-
# Full library with CLI argument support (default)
102+
# Default: full CLI binary with all features
102103
monocle = "1.0"
103104

104-
# Minimal database access only
105-
monocle = { version = "1.0", default-features = false, features = ["database"] }
105+
# Library only - all lenses and database operations
106+
monocle = { version = "1.0", default-features = false, features = ["lib"] }
106107

107-
# BGP operations without CLI overhead
108-
monocle = { version = "1.0", default-features = false, features = ["lens-bgpkit"] }
109-
110-
# Full functionality without CLI
111-
monocle = { version = "1.0", default-features = false, features = ["lens-full"] }
108+
# Library + WebSocket server
109+
monocle = { version = "1.0", default-features = false, features = ["server"] }
112110
```
113111

114112
### Feature Tiers
115113

116-
Monocle's features are organized in tiers for minimal dependency footprint:
114+
Monocle uses a simplified feature system with three options:
115+
116+
| Feature | Description | Implies |
117+
|---------|-------------|---------|
118+
| `lib` | Complete library (database + all lenses + display) | - |
119+
| `server` | WebSocket server for programmatic API access | `lib` |
120+
| `cli` (default) | Full CLI binary with all functionality | `lib`, `server` |
121+
122+
### Documentation
123+
124+
The following documentation files are available in the repository:
117125

118-
| Feature | Description | Key Dependencies |
119-
|---------|-------------|------------------|
120-
| `database` | SQLite operations only | rusqlite, oneio, ipnet, chrono |
121-
| `lens-core` | Standalone lenses (TimeLens) | chrono-humanize, dateparser |
122-
| `lens-bgpkit` | BGP-related lenses | bgpkit-*, rayon, tabled |
123-
| `lens-full` | All lenses including InspectLens | All above |
124-
| `cli` (default) | Full CLI binary with server | axum, tokio, tower-http |
126+
| File | Description |
127+
|------|-------------|
128+
| [`README.md`](README.md) (this file) | User-facing CLI and library overview |
129+
| [`ARCHITECTURE.md`](ARCHITECTURE.md) | Overall project structure and design principles |
130+
| [`DEVELOPMENT.md`](DEVELOPMENT.md) | Contributor guide for adding lenses and fixing bugs |
131+
| [`AGENTS.md`](AGENTS.md) | AI coding agent guidelines and code style |
132+
| [`CHANGELOG.md`](CHANGELOG.md) | Version history and breaking changes |
133+
| [`src/server/README.md`](src/server/README.md) | WebSocket API specification |
134+
| [`src/lens/README.md`](src/lens/README.md) | Lens module patterns and conventions |
135+
| [`src/database/README.md`](src/database/README.md) | Database module overview |
136+
| [`examples/README.md`](examples/README.md) | Usage examples by feature tier |
125137

126138
### Architecture
127139

128140
The library is organized into the following core modules:
129141

130-
- **`database`**: All database functionality
142+
- **`database`**: All database functionality (requires `lib` feature)
131143
- `core`: Connection management and schema definitions
132144
- `session`: One-time storage for search results
133145
- `monocle`: Main monocle database with ASInfo, AS2Rel, RPKI, and Pfx2as caching
134146

135-
- **`lens`**: High-level business logic (reusable across CLI, API, GUI)
136-
- `time`: Time parsing and formatting lens (lens-core)
137-
- `country`: Country code/name lookup lens (lens-bgpkit)
138-
- `ip`: IP information lookup lens (lens-bgpkit)
139-
- `parse`: MRT file parsing lens with progress tracking (lens-bgpkit)
140-
- `search`: BGP message search lens with progress tracking (lens-bgpkit)
141-
- `rpki`: RPKI validation and data lens (lens-bgpkit)
142-
- `pfx2as`: Prefix-to-AS mapping types (lens-bgpkit)
143-
- `as2rel`: AS-level relationships lens (lens-bgpkit)
144-
- `inspect`: Unified AS/prefix inspection lens (lens-full)
145-
146-
- **`server`**: WebSocket API server (cli feature)
147+
- **`lens`**: High-level business logic (requires `lib` feature)
148+
- `time`: Time parsing and formatting lens
149+
- `country`: Country code/name lookup lens
150+
- `ip`: IP information lookup lens
151+
- `parse`: MRT file parsing lens with progress tracking
152+
- `search`: BGP message search lens with progress tracking
153+
- `rpki`: RPKI validation and data lens
154+
- `pfx2as`: Prefix-to-AS mapping types
155+
- `as2rel`: AS-level relationships lens
156+
- `inspect`: Unified AS/prefix inspection lens
157+
158+
- **`server`**: WebSocket API server (requires `server` feature)
147159

148160
For detailed architecture documentation, see [`ARCHITECTURE.md`](ARCHITECTURE.md).
149161

src/server/README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -263,17 +263,17 @@ Returns a minimal method catalog for discoverability (names + short schemas). Ke
263263

264264
| Namespace | Description | Feature |
265265
|-----------|-------------|---------|
266-
| `system.*` | Server introspection | cli |
267-
| `time.*` | Time parsing utilities | lens-core |
268-
| `ip.*` | IP information lookup | lens-bgpkit |
269-
| `rpki.*` | RPKI validation and data | lens-bgpkit |
270-
| `as2rel.*` | AS-level relationships | lens-bgpkit |
271-
| `pfx2as.*` | Prefix-to-ASN mapping | lens-bgpkit |
272-
| `country.*` | Country code/name lookup | lens-bgpkit |
273-
| `inspect.*` | Unified AS/prefix inspection | lens-full |
274-
| `parse.*` | MRT file parsing (streaming) | lens-bgpkit |
275-
| `search.*` | BGP message search (streaming) | lens-bgpkit |
276-
| `database.*` | Database management | database |
266+
| `system.*` | Server introspection | server |
267+
| `time.*` | Time parsing utilities | lib |
268+
| `ip.*` | IP information lookup | lib |
269+
| `rpki.*` | RPKI validation and data | lib |
270+
| `as2rel.*` | AS-level relationships | lib |
271+
| `pfx2as.*` | Prefix-to-ASN mapping | lib |
272+
| `country.*` | Country code/name lookup | lib |
273+
| `inspect.*` | Unified AS/prefix inspection | lib |
274+
| `parse.*` | MRT file parsing (streaming) | lib |
275+
| `search.*` | BGP message search (streaming) | lib |
276+
| `database.*` | Database management | lib |
277277

278278
Methods are organized into namespaces matching the lens modules:
279279

0 commit comments

Comments
 (0)