diff options
Diffstat (limited to 'docs/archive/2025-11-03-quick-reference.md')
| -rw-r--r-- | docs/archive/2025-11-03-quick-reference.md | 449 |
1 files changed, 0 insertions, 449 deletions
diff --git a/docs/archive/2025-11-03-quick-reference.md b/docs/archive/2025-11-03-quick-reference.md deleted file mode 100644 index b9b9943..0000000 --- a/docs/archive/2025-11-03-quick-reference.md +++ /dev/null | |||
| @@ -1,449 +0,0 @@ | |||
| 1 | # โก Quick Reference - grasp-audit | ||
| 2 | |||
| 3 | **Last Updated:** November 4, 2025 | ||
| 4 | **Status:** โ Ready for use | ||
| 5 | |||
| 6 | --- | ||
| 7 | |||
| 8 | ## ๐ One-Minute Quick Start | ||
| 9 | |||
| 10 | ```bash | ||
| 11 | # Build and test | ||
| 12 | cd grasp-audit | ||
| 13 | nix develop --command cargo build | ||
| 14 | nix develop --command cargo test --lib | ||
| 15 | |||
| 16 | # Run integration test (needs relay) | ||
| 17 | docker run --rm -p 7000:7000 scsibug/nostr-rs-relay # Terminal 1 | ||
| 18 | cd grasp-audit && nix develop --command cargo test --ignored # Terminal 2 | ||
| 19 | ``` | ||
| 20 | |||
| 21 | --- | ||
| 22 | |||
| 23 | ## ๐ Common Commands | ||
| 24 | |||
| 25 | ### Build | ||
| 26 | ```bash | ||
| 27 | cargo build # Debug build | ||
| 28 | cargo build --release # Release build | ||
| 29 | cargo build --bin grasp-audit # CLI only | ||
| 30 | cargo build --example simple_audit # Example | ||
| 31 | ``` | ||
| 32 | |||
| 33 | ### Test | ||
| 34 | ```bash | ||
| 35 | cargo test --lib # Unit tests (no relay needed) | ||
| 36 | cargo test --ignored # Integration tests (relay required) | ||
| 37 | cargo test --all # All tests | ||
| 38 | cargo test test_name # Specific test | ||
| 39 | RUST_LOG=debug cargo test # With logging | ||
| 40 | ``` | ||
| 41 | |||
| 42 | ### Run | ||
| 43 | ```bash | ||
| 44 | # CLI | ||
| 45 | cargo run -- audit --relay ws://localhost:7000 --mode ci --spec nip01-smoke | ||
| 46 | |||
| 47 | # Example | ||
| 48 | cargo run --example simple_audit | ||
| 49 | |||
| 50 | # Help | ||
| 51 | cargo run -- --help | ||
| 52 | cargo run -- audit --help | ||
| 53 | ``` | ||
| 54 | |||
| 55 | ### Development | ||
| 56 | ```bash | ||
| 57 | cargo clippy # Linting | ||
| 58 | cargo fmt # Format code | ||
| 59 | cargo fmt --check # Check formatting | ||
| 60 | cargo doc --open # Generate docs | ||
| 61 | cargo clean # Clean build | ||
| 62 | ``` | ||
| 63 | |||
| 64 | --- | ||
| 65 | |||
| 66 | ## ๐งช Testing | ||
| 67 | |||
| 68 | ### Start Test Relay | ||
| 69 | ```bash | ||
| 70 | # Option 1: Docker (easiest) | ||
| 71 | docker run --rm -p 7000:7000 scsibug/nostr-rs-relay | ||
| 72 | |||
| 73 | # Option 2: Build from source | ||
| 74 | git clone https://github.com/rust-nostr/nostr | ||
| 75 | cd nostr/crates/nostr-relay-builder | ||
| 76 | cargo run --example basic | ||
| 77 | ``` | ||
| 78 | |||
| 79 | ### Run Tests | ||
| 80 | ```bash | ||
| 81 | # Unit tests (fast, no relay) | ||
| 82 | cargo test --lib | ||
| 83 | |||
| 84 | # Integration tests (needs relay) | ||
| 85 | cargo test --ignored | ||
| 86 | |||
| 87 | # Specific test | ||
| 88 | cargo test test_websocket_connection -- --nocapture | ||
| 89 | |||
| 90 | # All tests | ||
| 91 | cargo test --all | ||
| 92 | ``` | ||
| 93 | |||
| 94 | ### Expected Results | ||
| 95 | ``` | ||
| 96 | Unit Tests: 12 passed, 0 failed | ||
| 97 | Integration: 6 passed (with relay) | ||
| 98 | Build Time: ~0.1s (incremental) | ||
| 99 | Test Time: ~0.5s | ||
| 100 | ``` | ||
| 101 | |||
| 102 | --- | ||
| 103 | |||
| 104 | ## ๐ File Locations | ||
| 105 | |||
| 106 | ### Source Code | ||
| 107 | ``` | ||
| 108 | grasp-audit/src/ | ||
| 109 | โโโ lib.rs # Library root | ||
| 110 | โโโ audit.rs # Audit framework | ||
| 111 | โโโ client.rs # Nostr client | ||
| 112 | โโโ isolation.rs # Test isolation | ||
| 113 | โโโ result.rs # Result types | ||
| 114 | โโโ bin/grasp-audit.rs # CLI tool | ||
| 115 | โโโ specs/ | ||
| 116 | โโโ mod.rs # Spec registry | ||
| 117 | โโโ nip01_smoke.rs # Smoke tests | ||
| 118 | ``` | ||
| 119 | |||
| 120 | ### Examples | ||
| 121 | ``` | ||
| 122 | grasp-audit/examples/ | ||
| 123 | โโโ simple_audit.rs # Basic usage | ||
| 124 | ``` | ||
| 125 | |||
| 126 | ### Documentation | ||
| 127 | ``` | ||
| 128 | grasp-audit/ | ||
| 129 | โโโ README.md # Main documentation | ||
| 130 | โโโ QUICK_START.md # Detailed setup | ||
| 131 | โโโ Cargo.toml # Dependencies | ||
| 132 | |||
| 133 | Project Root/ | ||
| 134 | โโโ VERIFICATION_COMPLETE.md # Verification report | ||
| 135 | โโโ READY_FOR_NEXT_PHASE.md # Next steps | ||
| 136 | โโโ SESSION_COMPLETE_2025_11_04.md # Session summary | ||
| 137 | โโโ QUICK_REFERENCE.md # This file | ||
| 138 | ``` | ||
| 139 | |||
| 140 | --- | ||
| 141 | |||
| 142 | ## ๐ฏ CLI Usage | ||
| 143 | |||
| 144 | ### Basic Usage | ||
| 145 | ```bash | ||
| 146 | grasp-audit audit \ | ||
| 147 | --relay ws://localhost:7000 \ | ||
| 148 | --mode ci \ | ||
| 149 | --spec nip01-smoke | ||
| 150 | ``` | ||
| 151 | |||
| 152 | ### Options | ||
| 153 | ``` | ||
| 154 | --relay <URL> Relay WebSocket URL (required) | ||
| 155 | --mode <MODE> Test mode: ci or production | ||
| 156 | --spec <SPEC> Test specification to run | ||
| 157 | ``` | ||
| 158 | |||
| 159 | ### Modes | ||
| 160 | - **ci**: Ephemeral test events (auto-cleanup) | ||
| 161 | - **production**: Permanent audit trail | ||
| 162 | |||
| 163 | ### Specs | ||
| 164 | - **nip01-smoke**: 6 basic NIP-01 tests | ||
| 165 | |||
| 166 | --- | ||
| 167 | |||
| 168 | ## ๐ Test Specifications | ||
| 169 | |||
| 170 | ### NIP-01 Smoke Tests | ||
| 171 | 1. `websocket_connection` - Basic connectivity | ||
| 172 | 2. `send_receive_event` - Event round-trip | ||
| 173 | 3. `create_subscription` - REQ message | ||
| 174 | 4. `close_subscription` - CLOSE message | ||
| 175 | 5. `reject_invalid_signature` - Validation | ||
| 176 | 6. `reject_invalid_event_id` - Validation | ||
| 177 | |||
| 178 | ### Future Specs (Planned) | ||
| 179 | - `grasp-01-relay` - GRASP-01 compliance | ||
| 180 | - `grasp-02-sync` - Proactive sync | ||
| 181 | - `grasp-05-archive` - Archive mode | ||
| 182 | |||
| 183 | --- | ||
| 184 | |||
| 185 | ## ๐ง Troubleshooting | ||
| 186 | |||
| 187 | ### Build Fails: "linker 'cc' not found" | ||
| 188 | ```bash | ||
| 189 | # Use nix develop | ||
| 190 | cd grasp-audit | ||
| 191 | nix develop | ||
| 192 | cargo build | ||
| 193 | ``` | ||
| 194 | |||
| 195 | ### Tests Fail: "Connection refused" | ||
| 196 | ```bash | ||
| 197 | # Check relay is running | ||
| 198 | docker ps | grep nostr | ||
| 199 | |||
| 200 | # Start relay | ||
| 201 | docker run --rm -p 7000:7000 scsibug/nostr-rs-relay | ||
| 202 | |||
| 203 | # Test connection | ||
| 204 | curl -I http://localhost:7000 | ||
| 205 | ``` | ||
| 206 | |||
| 207 | ### Integration Tests Timeout | ||
| 208 | ```bash | ||
| 209 | # Increase timeout in test code | ||
| 210 | # Or use a faster relay | ||
| 211 | # Or check network/firewall | ||
| 212 | ``` | ||
| 213 | |||
| 214 | ### Nix Issues | ||
| 215 | ```bash | ||
| 216 | # Update flake | ||
| 217 | nix flake update | ||
| 218 | |||
| 219 | # Rebuild environment | ||
| 220 | nix develop --rebuild | ||
| 221 | ``` | ||
| 222 | |||
| 223 | --- | ||
| 224 | |||
| 225 | ## ๐ Key Resources | ||
| 226 | |||
| 227 | ### Documentation | ||
| 228 | - [README.md](grasp-audit/README.md) - Full documentation | ||
| 229 | - [QUICK_START.md](grasp-audit/QUICK_START.md) - Setup guide | ||
| 230 | - [VERIFICATION_COMPLETE.md](VERIFICATION_COMPLETE.md) - Current status | ||
| 231 | - [READY_FOR_NEXT_PHASE.md](READY_FOR_NEXT_PHASE.md) - Next steps | ||
| 232 | |||
| 233 | ### Code Examples | ||
| 234 | - [nip01_smoke.rs](grasp-audit/src/specs/nip01_smoke.rs) - Test examples | ||
| 235 | - [simple_audit.rs](grasp-audit/examples/simple_audit.rs) - Usage example | ||
| 236 | - [client.rs](grasp-audit/src/client.rs) - Client API | ||
| 237 | |||
| 238 | ### External Links | ||
| 239 | - [GRASP Protocol](https://gitworkshop.dev/danconwaydev.com/grasp) | ||
| 240 | - [nostr-sdk 0.43](https://docs.rs/nostr-sdk/0.43.0) | ||
| 241 | - [rust-nostr](https://github.com/rust-nostr/nostr) | ||
| 242 | - [NIP-01](https://nips.nostr.com/01) | ||
| 243 | - [NIP-34](https://nips.nostr.com/34) | ||
| 244 | |||
| 245 | --- | ||
| 246 | |||
| 247 | ## ๐ฏ Common Tasks | ||
| 248 | |||
| 249 | ### Run Full Verification | ||
| 250 | ```bash | ||
| 251 | # Build | ||
| 252 | cargo build | ||
| 253 | |||
| 254 | # Unit tests | ||
| 255 | cargo test --lib | ||
| 256 | |||
| 257 | # Start relay | ||
| 258 | docker run --rm -p 7000:7000 scsibug/nostr-rs-relay & | ||
| 259 | |||
| 260 | # Integration tests | ||
| 261 | cargo test --ignored | ||
| 262 | |||
| 263 | # CLI test | ||
| 264 | cargo run -- audit --relay ws://localhost:7000 --mode ci --spec nip01-smoke | ||
| 265 | |||
| 266 | # Stop relay | ||
| 267 | docker stop $(docker ps -q --filter ancestor=scsibug/nostr-rs-relay) | ||
| 268 | ``` | ||
| 269 | |||
| 270 | ### Add New Test | ||
| 271 | ```bash | ||
| 272 | # 1. Edit src/specs/nip01_smoke.rs | ||
| 273 | # 2. Add test function | ||
| 274 | # 3. Register in run_smoke_tests() | ||
| 275 | # 4. Test it | ||
| 276 | cargo test test_your_new_test -- --nocapture | ||
| 277 | ``` | ||
| 278 | |||
| 279 | ### Create New Spec | ||
| 280 | ```bash | ||
| 281 | # 1. Create src/specs/your_spec.rs | ||
| 282 | # 2. Implement tests | ||
| 283 | # 3. Add to src/specs/mod.rs | ||
| 284 | # 4. Register in CLI | ||
| 285 | # 5. Test | ||
| 286 | cargo test --all | ||
| 287 | ``` | ||
| 288 | |||
| 289 | ### Release Build | ||
| 290 | ```bash | ||
| 291 | # Build release | ||
| 292 | cargo build --release | ||
| 293 | |||
| 294 | # Binary location | ||
| 295 | ./target/release/grasp-audit | ||
| 296 | |||
| 297 | # Install globally | ||
| 298 | cargo install --path grasp-audit | ||
| 299 | grasp-audit --help | ||
| 300 | ``` | ||
| 301 | |||
| 302 | --- | ||
| 303 | |||
| 304 | ## ๐ Project Stats | ||
| 305 | |||
| 306 | ### Code | ||
| 307 | - **Total Lines:** 1,079 lines Rust | ||
| 308 | - **Source Files:** 9 files | ||
| 309 | - **Test Files:** 3 files | ||
| 310 | - **Examples:** 1 file | ||
| 311 | |||
| 312 | ### Tests | ||
| 313 | - **Unit Tests:** 12 tests | ||
| 314 | - **Integration Tests:** 6 tests | ||
| 315 | - **Pass Rate:** 100% | ||
| 316 | |||
| 317 | ### Performance | ||
| 318 | - **Build Time:** ~0.1s (incremental) | ||
| 319 | - **Test Time:** ~0.5s (unit) | ||
| 320 | - **Total Verification:** <1 minute | ||
| 321 | |||
| 322 | ### Dependencies | ||
| 323 | - **nostr-sdk:** 0.43.0 (latest) | ||
| 324 | - **Rust:** 1.91.0 | ||
| 325 | - **Nix:** Latest stable | ||
| 326 | |||
| 327 | --- | ||
| 328 | |||
| 329 | ## โ Status Checklist | ||
| 330 | |||
| 331 | ### Working โ | ||
| 332 | - [x] Build system | ||
| 333 | - [x] Unit tests | ||
| 334 | - [x] CLI tool | ||
| 335 | - [x] Examples | ||
| 336 | - [x] Documentation | ||
| 337 | |||
| 338 | ### Ready โณ | ||
| 339 | - [ ] Integration tests (needs relay) | ||
| 340 | - [ ] End-to-end testing (needs relay) | ||
| 341 | - [ ] Performance testing | ||
| 342 | |||
| 343 | ### Planned ๐ | ||
| 344 | - [ ] GRASP-01 tests | ||
| 345 | - [ ] ngit-grasp relay | ||
| 346 | - [ ] Full compliance | ||
| 347 | |||
| 348 | --- | ||
| 349 | |||
| 350 | ## ๐ Next Steps | ||
| 351 | |||
| 352 | ### Today (30 min) | ||
| 353 | ```bash | ||
| 354 | # 1. Start relay | ||
| 355 | docker run --rm -p 7000:7000 scsibug/nostr-rs-relay | ||
| 356 | |||
| 357 | # 2. Run integration tests | ||
| 358 | cd grasp-audit | ||
| 359 | nix develop --command cargo test --ignored | ||
| 360 | |||
| 361 | # 3. Test CLI | ||
| 362 | nix develop --command cargo run -- audit \ | ||
| 363 | --relay ws://localhost:7000 \ | ||
| 364 | --mode ci \ | ||
| 365 | --spec nip01-smoke | ||
| 366 | ``` | ||
| 367 | |||
| 368 | ### This Week | ||
| 369 | - Implement GRASP-01 tests OR | ||
| 370 | - Start ngit-grasp relay OR | ||
| 371 | - Both in parallel | ||
| 372 | |||
| 373 | ### Next 2-3 Weeks | ||
| 374 | - Complete GRASP-01 compliance | ||
| 375 | - Full integration testing | ||
| 376 | - Production ready | ||
| 377 | |||
| 378 | --- | ||
| 379 | |||
| 380 | ## ๐ก Tips | ||
| 381 | |||
| 382 | ### Fast Development | ||
| 383 | ```bash | ||
| 384 | # Use nix develop for consistent environment | ||
| 385 | nix develop | ||
| 386 | |||
| 387 | # Use cargo watch for auto-rebuild | ||
| 388 | cargo install cargo-watch | ||
| 389 | cargo watch -x test | ||
| 390 | |||
| 391 | # Use cargo-expand to see macros | ||
| 392 | cargo install cargo-expand | ||
| 393 | cargo expand | ||
| 394 | ``` | ||
| 395 | |||
| 396 | ### Debugging | ||
| 397 | ```bash | ||
| 398 | # Run with logging | ||
| 399 | RUST_LOG=debug cargo test -- --nocapture | ||
| 400 | |||
| 401 | # Run specific test | ||
| 402 | cargo test test_name -- --nocapture | ||
| 403 | |||
| 404 | # Use rust-lldb or rust-gdb | ||
| 405 | rust-lldb ./target/debug/grasp-audit | ||
| 406 | ``` | ||
| 407 | |||
| 408 | ### Performance | ||
| 409 | ```bash | ||
| 410 | # Profile build | ||
| 411 | cargo build --timings | ||
| 412 | |||
| 413 | # Benchmark | ||
| 414 | cargo bench | ||
| 415 | |||
| 416 | # Check binary size | ||
| 417 | ls -lh ./target/release/grasp-audit | ||
| 418 | ``` | ||
| 419 | |||
| 420 | --- | ||
| 421 | |||
| 422 | ## ๐ Getting Help | ||
| 423 | |||
| 424 | ### Documentation | ||
| 425 | 1. Check README.md | ||
| 426 | 2. Read QUICK_START.md | ||
| 427 | 3. Review examples/ | ||
| 428 | 4. See inline docs: `cargo doc --open` | ||
| 429 | |||
| 430 | ### Troubleshooting | ||
| 431 | 1. Check this file | ||
| 432 | 2. Review VERIFICATION_COMPLETE.md | ||
| 433 | 3. Read error messages carefully | ||
| 434 | 4. Check GitHub issues | ||
| 435 | |||
| 436 | ### Community | ||
| 437 | - GRASP Protocol: https://gitworkshop.dev/danconwaydev.com/grasp | ||
| 438 | - rust-nostr: https://github.com/rust-nostr/nostr | ||
| 439 | - Nostr: https://nostr.com | ||
| 440 | |||
| 441 | --- | ||
| 442 | |||
| 443 | **Quick Reference Version:** 1.0 | ||
| 444 | **Last Updated:** November 4, 2025 | ||
| 445 | **Status:** โ Current | ||
| 446 | |||
| 447 | --- | ||
| 448 | |||
| 449 | *Keep this file handy for quick lookups! ๐* | ||