upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/docs/archive/2025-11-03-quick-reference.md
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2025-11-04 09:31:57 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2025-11-04 09:31:57 +0000
commit22557f15d6a7b77f72d4597fc05aa06346495a33 (patch)
treee31e0cdecfc4cb1e28246227a7ef295b71687b09 /docs/archive/2025-11-03-quick-reference.md
parentb3031800cd95601c2d9cd2d24034364d1496b073 (diff)
docs: major cleanup and reorganization
- Archive 30 completed session documents to docs/archive/ - Extract learnings to docs/learnings/ (nix-flakes, nostr-sdk, grasp-audit) - Create CURRENT_STATUS.md as single source of truth - Create AGENTS.md with documentation guidelines - Create docs/archive/README.md for archive organization - Clean root directory: 32 files → 4 files Root directory now contains only: - README.md (project overview) - AGENTS.md (documentation guidelines) - CURRENT_STATUS.md (current state) - CLEANUP_SUMMARY.md (cleanup report) All historical documents preserved in docs/archive/ with proper dating. All reusable knowledge extracted to docs/learnings/. Benefits: - Easy to find current information - Clear document lifecycle - No more documentation sprawl - Learnings are accessible and reusable - Better onboarding for new developers/agents File counts: - Root: 4 (was 32) - Permanent docs: 7 - Learnings: 3 (new) - Archive: 32 (new) - Total: 49 well-organized docs
Diffstat (limited to 'docs/archive/2025-11-03-quick-reference.md')
-rw-r--r--docs/archive/2025-11-03-quick-reference.md449
1 files changed, 449 insertions, 0 deletions
diff --git a/docs/archive/2025-11-03-quick-reference.md b/docs/archive/2025-11-03-quick-reference.md
new file mode 100644
index 0000000..b9b9943
--- /dev/null
+++ b/docs/archive/2025-11-03-quick-reference.md
@@ -0,0 +1,449 @@
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
12cd grasp-audit
13nix develop --command cargo build
14nix develop --command cargo test --lib
15
16# Run integration test (needs relay)
17docker run --rm -p 7000:7000 scsibug/nostr-rs-relay # Terminal 1
18cd grasp-audit && nix develop --command cargo test --ignored # Terminal 2
19```
20
21---
22
23## 📋 Common Commands
24
25### Build
26```bash
27cargo build # Debug build
28cargo build --release # Release build
29cargo build --bin grasp-audit # CLI only
30cargo build --example simple_audit # Example
31```
32
33### Test
34```bash
35cargo test --lib # Unit tests (no relay needed)
36cargo test --ignored # Integration tests (relay required)
37cargo test --all # All tests
38cargo test test_name # Specific test
39RUST_LOG=debug cargo test # With logging
40```
41
42### Run
43```bash
44# CLI
45cargo run -- audit --relay ws://localhost:7000 --mode ci --spec nip01-smoke
46
47# Example
48cargo run --example simple_audit
49
50# Help
51cargo run -- --help
52cargo run -- audit --help
53```
54
55### Development
56```bash
57cargo clippy # Linting
58cargo fmt # Format code
59cargo fmt --check # Check formatting
60cargo doc --open # Generate docs
61cargo clean # Clean build
62```
63
64---
65
66## 🧪 Testing
67
68### Start Test Relay
69```bash
70# Option 1: Docker (easiest)
71docker run --rm -p 7000:7000 scsibug/nostr-rs-relay
72
73# Option 2: Build from source
74git clone https://github.com/rust-nostr/nostr
75cd nostr/crates/nostr-relay-builder
76cargo run --example basic
77```
78
79### Run Tests
80```bash
81# Unit tests (fast, no relay)
82cargo test --lib
83
84# Integration tests (needs relay)
85cargo test --ignored
86
87# Specific test
88cargo test test_websocket_connection -- --nocapture
89
90# All tests
91cargo test --all
92```
93
94### Expected Results
95```
96Unit Tests: 12 passed, 0 failed
97Integration: 6 passed (with relay)
98Build Time: ~0.1s (incremental)
99Test Time: ~0.5s
100```
101
102---
103
104## 📁 File Locations
105
106### Source Code
107```
108grasp-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```
122grasp-audit/examples/
123└── simple_audit.rs # Basic usage
124```
125
126### Documentation
127```
128grasp-audit/
129├── README.md # Main documentation
130├── QUICK_START.md # Detailed setup
131└── Cargo.toml # Dependencies
132
133Project 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
146grasp-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
1711. `websocket_connection` - Basic connectivity
1722. `send_receive_event` - Event round-trip
1733. `create_subscription` - REQ message
1744. `close_subscription` - CLOSE message
1755. `reject_invalid_signature` - Validation
1766. `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
190cd grasp-audit
191nix develop
192cargo build
193```
194
195### Tests Fail: "Connection refused"
196```bash
197# Check relay is running
198docker ps | grep nostr
199
200# Start relay
201docker run --rm -p 7000:7000 scsibug/nostr-rs-relay
202
203# Test connection
204curl -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
217nix flake update
218
219# Rebuild environment
220nix 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
252cargo build
253
254# Unit tests
255cargo test --lib
256
257# Start relay
258docker run --rm -p 7000:7000 scsibug/nostr-rs-relay &
259
260# Integration tests
261cargo test --ignored
262
263# CLI test
264cargo run -- audit --relay ws://localhost:7000 --mode ci --spec nip01-smoke
265
266# Stop relay
267docker 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
276cargo 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
286cargo test --all
287```
288
289### Release Build
290```bash
291# Build release
292cargo build --release
293
294# Binary location
295./target/release/grasp-audit
296
297# Install globally
298cargo install --path grasp-audit
299grasp-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
355docker run --rm -p 7000:7000 scsibug/nostr-rs-relay
356
357# 2. Run integration tests
358cd grasp-audit
359nix develop --command cargo test --ignored
360
361# 3. Test CLI
362nix 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
385nix develop
386
387# Use cargo watch for auto-rebuild
388cargo install cargo-watch
389cargo watch -x test
390
391# Use cargo-expand to see macros
392cargo install cargo-expand
393cargo expand
394```
395
396### Debugging
397```bash
398# Run with logging
399RUST_LOG=debug cargo test -- --nocapture
400
401# Run specific test
402cargo test test_name -- --nocapture
403
404# Use rust-lldb or rust-gdb
405rust-lldb ./target/debug/grasp-audit
406```
407
408### Performance
409```bash
410# Profile build
411cargo build --timings
412
413# Benchmark
414cargo bench
415
416# Check binary size
417ls -lh ./target/release/grasp-audit
418```
419
420---
421
422## 📞 Getting Help
423
424### Documentation
4251. Check README.md
4262. Read QUICK_START.md
4273. Review examples/
4284. See inline docs: `cargo doc --open`
429
430### Troubleshooting
4311. Check this file
4322. Review VERIFICATION_COMPLETE.md
4333. Read error messages carefully
4344. 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! 📌*