Second + final batch of the doc refresh. README + CLAUDE went out in
8c9ae29; deploy/nixos/README + obsolete-flow flags in 924844f. This
commit covers everything left.
docs/machine-installation.md
Was describing a manual AppImage scp deploy + a `lamassu-kiosk`
systemd unit that hasn't been the deployment path for months.
Replaced with a high-level "what the pipeline does and why"
overview that points at deploy/nixos/README.md for the full
command-by-command walkthrough. Includes the BATM3 chassis-mod
note (custom Dell OptiPlex retrofit, not a stock Dell).
docs/architecture-comparison.md
Rewrote the comparison to be lamassu-server (≤ v8.1.5) vs bitSpire
(LNbits-backed) instead of the original lamassu-server vs LP-backed
lamassu-next framing. Updated the cash-out + cash-in flow diagrams
to show the actual nostr-transport path (LNbits-bundled nostrrelay
extension at ws://<host>:5001/nostrrelay/test, no separate strfry
container). Replaced the migration-path section with a softer
"when to choose what" framing that includes Lamassu's current
commercial offering as a legitimate third option. Added a header
pointer to the Acknowledgements section.
docs/business-model.md
Light touch-ups: Lightning.Pub → LNbits where it appeared, swapped
the [[ndebit-cash-in-flow]] link for [[architecture-comparison]],
noted the kind-30078 service beacon for availability broadcasts.
docs/device-configuration.md
Dropped "Lamassu" branding from the machine-model headings
(Sintra / tejo / douro / batm3 are referenced by hardware identity
here, not by Lamassu's product line). Added the Sintra-specific
ttyS4-vs-placeholder-ttyS1..3 gotcha we hard-learned during the
first flash. Corrected the BATM3 entry: stock GeneralBytes chassis
with a Dell OptiPlex 9030 AIO motherboard physically grafted in,
NOT a Dell out of the box. Updated the example /dev/ttyJ* symlink
output to match what a healthy Sintra actually shows.
docs/adr/001-hal-architecture.md
ADRs are historical artifacts — kept the original decision text
intact. Added a postscript noting:
- The package rename @lamassu/hal → @bitSpire/hal
- The v8.1.5 boundary on any lamassu-machine source-tree
references (Lamassu's 2024-01-26 license transition)
- That the "Remaining Work" list is complete and the first
successful Sintra hardware integration ran on 2026-05-13
.claude/skills/lightning-check.md
Rewrote end-to-end. Was Lightning.Pub-flavoured with CLINK kinds
21001/21002 as the primary flows; now validates the LNbits nostr-
transport surface (kind-21000 envelope, NIP-44 v2 encryption,
subscribe_payments filter discipline, lnurlw link composition).
Preserved a --clink mode for the still-live kind-21003 operator-
management surface. Includes a "what to check" rubric for cash-out
vs cash-in flows that mirrors the actual code in
apps/machine/src/services/lightning.ts.
.claude/skills/hal-check.md
Two pivots: (1) acknowledge ADR-001's TypeScript-not-Rust choice
and reframe all the safety checklists in TS-flavour (type safety,
discriminated unions, single-writer serial, bounded emitters)
instead of Rust-flavour (unsafe, borrow checker). (2) Add explicit
v8.1.5 provenance boundary plus a "forbidden operations" section
that prohibits diffing or porting from v8.1.6+ lamassu-machine
source. Updated the port-validation source-reference table to
list TS file paths under packages/hal/ instead of Rust paths.
.claude/skills/docs.md
@lamassu/* → @bitSpire/*. Replaced the Lightning.Pub mermaid
diagram with a current cash-out flow showing the nostr-transport
RPC + subscribe_payments push path. Left the createOffer noffer
example in the API-docs template section since it's illustrative
("here's what a good TSDoc block looks like") rather than current
reference documentation.
.claude/skills/test.md
One-line: @lamassu/nostr-client → @bitSpire/nostr-client in the
pnpm-filter example.
deploy/nixos/README.md
Single touch-up: clarified the douro/batm3 hardware-module comments
to reflect that BATM3 is a custom-installed Dell board in a
GeneralBytes BATM3 chassis (not a Dell OEM).
Files NOT touched in this sweep (intentionally):
- packages/hal/src/**/*.ts attribution comments — those reference
"lamassu-machine" in their port-source headers. Those are
factually accurate (the drivers ARE ported from there, up to
v8.1.5) and constitute necessary license/attribution metadata.
Editing them would erase the provenance trail.
- .claude/skills/{nostr-check,security}.md — already protocol-
neutral, no LP/lamassu references to clean up.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
222 lines
5.4 KiB
Markdown
222 lines
5.4 KiB
Markdown
# /docs - Documentation Agent
|
|
|
|
## Purpose
|
|
Keep documentation synchronized with code, generate API docs, and maintain architecture diagrams.
|
|
|
|
## Invocation
|
|
```
|
|
/docs [command] [target]
|
|
```
|
|
|
|
Commands:
|
|
- `sync` - Sync docs with code changes
|
|
- `api` - Generate API documentation
|
|
- `diagram` - Update architecture diagrams
|
|
- `readme` - Update package README
|
|
- `changelog` - Generate changelog entry
|
|
|
|
## Documentation Structure
|
|
|
|
```
|
|
docs/
|
|
├── architecture/
|
|
│ ├── overview.md # High-level architecture
|
|
│ ├── nostr-protocol.md # Nostr integration details
|
|
│ ├── lightning-flow.md # Payment flows
|
|
│ └── hardware-hal.md # HAL documentation
|
|
├── api/
|
|
│ ├── nostr-client.md # @bitSpire/nostr-client API
|
|
│ ├── lnbits.md # @bitSpire/lnbits API (kind-21000 RPC surface)
|
|
│ ├── clink.md # @bitSpire/clink API (dormant on dev; 21003 management still wired)
|
|
│ ├── state-machine.md # @bitSpire/state-machine API
|
|
│ └── hal.md # @bitSpire/hal API
|
|
├── guides/
|
|
│ ├── development.md # Dev setup guide
|
|
│ ├── hardware-testing.md # Testing with real hardware
|
|
│ └── deployment.md # NixOS deployment guide
|
|
└── adrs/ # Architecture Decision Records
|
|
├── 001-nostr-backbone.md
|
|
├── 002-clink-over-bolt12.md
|
|
└── ...
|
|
```
|
|
|
|
## Sync Tasks
|
|
|
|
### Code → Docs Sync
|
|
When code changes:
|
|
1. Detect modified files
|
|
2. Check if related docs exist
|
|
3. Flag outdated documentation
|
|
4. Suggest updates
|
|
|
|
### Doc → Code Validation
|
|
Ensure docs reference actual code:
|
|
- [ ] Function names match
|
|
- [ ] Parameter types correct
|
|
- [ ] Return types accurate
|
|
- [ ] Examples compile/run
|
|
|
|
## API Documentation
|
|
|
|
### TypeScript Packages
|
|
Generate from TSDoc comments:
|
|
|
|
```typescript
|
|
/**
|
|
* Create a CLINK offer for receiving payments
|
|
*
|
|
* @param identity - Machine identity (nsec/npub)
|
|
* @param relays - Relay URLs to include in offer
|
|
* @param priceType - 'fixed' | 'variable' | 'spontaneous'
|
|
* @param amount - Amount in sats (required for fixed)
|
|
* @returns Encoded noffer string
|
|
*
|
|
* @example
|
|
* ```typescript
|
|
* const offer = createOffer(identity, ['wss://relay.example'], 'fixed', 10000)
|
|
* // Returns: noffer1...
|
|
* ```
|
|
*/
|
|
export function createOffer(...): string
|
|
```
|
|
|
|
### Rust Crate (HAL)
|
|
Generate from rustdoc comments:
|
|
|
|
```rust
|
|
/// Connect to a bill validator
|
|
///
|
|
/// # Arguments
|
|
/// * `port` - Serial port path (e.g., "/dev/ttyUSB0")
|
|
///
|
|
/// # Errors
|
|
/// Returns `ValidatorError::ConnectionFailed` if port unavailable
|
|
///
|
|
/// # Example
|
|
/// ```
|
|
/// let mut validator = Id003Validator::new("/dev/ttyUSB0", "USD");
|
|
/// validator.connect().await?;
|
|
/// ```
|
|
pub async fn connect(&mut self) -> Result<(), ValidatorError>
|
|
```
|
|
|
|
## Diagram Updates
|
|
|
|
### Mermaid Diagrams
|
|
Keep architecture diagrams current:
|
|
|
|
```mermaid
|
|
sequenceDiagram
|
|
participant U as Customer Wallet
|
|
participant A as ATM
|
|
participant R as Relay (LNbits-bundled nostrrelay)
|
|
participant L as LNbits (nostr-transport)
|
|
|
|
Note over A,L: cash-out flow (customer pays ATM, gets cash)
|
|
A->>R: kind-21000 RPC "create_invoice"
|
|
R->>L: forward to LNbits server pubkey
|
|
L->>R: kind-21000 ACK with BOLT11 invoice
|
|
R->>A: forward ACK
|
|
A->>U: display BOLT11 QR
|
|
A->>R: kind-21000 "subscribe_payments" by payment_hash
|
|
R->>L: forward
|
|
L->>R: kind-21000 ACK with subscription_id
|
|
R->>A: forward
|
|
U->>L: pay BOLT11 via Lightning Network
|
|
L->>R: kind-21000 push (settlement) tagged subscription_id
|
|
R->>A: forward
|
|
A->>A: dispense cash
|
|
```
|
|
|
|
### Auto-update triggers
|
|
- New event kinds added → Update protocol diagram
|
|
- State machine changes → Update flow diagram
|
|
- New hardware driver → Update HAL diagram
|
|
|
|
## Changelog Generation
|
|
|
|
### Format (Keep a Changelog)
|
|
```markdown
|
|
## [Unreleased]
|
|
|
|
### Added
|
|
- CLINK offer support for cash-in flow
|
|
- Puloon dispenser driver
|
|
|
|
### Changed
|
|
- Upgraded to XState v5 actor model
|
|
|
|
### Fixed
|
|
- Race condition in bill acceptance
|
|
|
|
### Security
|
|
- Added NIP-44 encryption for receipts
|
|
```
|
|
|
|
### Auto-detection
|
|
From git commits since last release:
|
|
- `feat:` → Added
|
|
- `fix:` → Fixed
|
|
- `refactor:` → Changed
|
|
- `security:` → Security
|
|
- `BREAKING:` → Breaking Changes
|
|
|
|
## Output Format
|
|
|
|
### Sync Report
|
|
```markdown
|
|
## Documentation Sync: [target]
|
|
|
|
### Outdated Docs
|
|
| Doc | Code Change | Status |
|
|
|-----|-------------|--------|
|
|
| api/clink.md | createOffer params | ⚠️ Outdated |
|
|
| guides/development.md | New env var | ⚠️ Missing |
|
|
|
|
### Suggested Updates
|
|
1. `api/clink.md:45` - Add `timeout` parameter to createOffer
|
|
2. `guides/development.md` - Add LIGHTNING_PUB_URL env var
|
|
|
|
### Missing Documentation
|
|
- `packages/cashu/src/wallet.ts` - No API docs
|
|
```
|
|
|
|
### Generated Docs
|
|
```markdown
|
|
## Generated: [file]
|
|
|
|
### API Reference
|
|
|
|
#### `createOffer(identity, relays, priceType, amount?)`
|
|
|
|
Creates a CLINK offer for receiving Lightning payments.
|
|
|
|
**Parameters:**
|
|
| Name | Type | Description |
|
|
|------|------|-------------|
|
|
| identity | MachineIdentity | Machine nsec/npub |
|
|
| relays | string[] | Relay URLs |
|
|
| priceType | 'fixed' \| 'variable' | Pricing model |
|
|
| amount | number? | Amount in sats |
|
|
|
|
**Returns:** `string` - Encoded noffer
|
|
|
|
**Example:**
|
|
```typescript
|
|
const offer = createOffer(identity, ['wss://relay'], 'fixed', 10000)
|
|
```
|
|
```
|
|
|
|
## Example Usage
|
|
|
|
```
|
|
/docs sync packages/clink/
|
|
```
|
|
|
|
```
|
|
/docs api packages/nostr-client/src/
|
|
```
|
|
|
|
```
|
|
/docs changelog --since v0.1.0
|
|
```
|