@thehoneyjar/sigil-hud 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,146 @@
1
+ # @sigil/hud
2
+
3
+ Diagnostic HUD for Sigil - composable React components for development.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pnpm add @sigil/hud
9
+
10
+ # Optional: Install packages you want to use
11
+ pnpm add @sigil/lens @sigil/fork @sigil/simulation @sigil/diagnostics
12
+ ```
13
+
14
+ ## Usage
15
+
16
+ ### Basic Setup
17
+
18
+ ```tsx
19
+ import { HudProvider, HudPanel, HudTrigger } from '@sigil/hud'
20
+ import { createLensService } from '@sigil/lens'
21
+ import { createDiagnosticsService } from '@sigil/diagnostics'
22
+
23
+ const lensService = createLensService()
24
+ const diagnosticsService = createDiagnosticsService()
25
+
26
+ function App() {
27
+ return (
28
+ <HudProvider
29
+ lensService={lensService}
30
+ diagnosticsService={diagnosticsService}
31
+ config={{
32
+ shortcuts: true,
33
+ position: 'bottom-right',
34
+ }}
35
+ >
36
+ <YourApp />
37
+ <HudTrigger />
38
+ <HudPanel>
39
+ <LensPanel />
40
+ <DiagnosticsPanel />
41
+ </HudPanel>
42
+ </HudProvider>
43
+ )
44
+ }
45
+ ```
46
+
47
+ ### Keyboard Shortcuts
48
+
49
+ | Shortcut | Action |
50
+ |----------|--------|
51
+ | `⌘⇧D` | Toggle HUD |
52
+ | `1-5` | Switch panels (when open) |
53
+ | `Esc` | Close HUD |
54
+
55
+ ```tsx
56
+ import { useKeyboardShortcuts } from '@sigil/hud'
57
+
58
+ function MyComponent() {
59
+ useKeyboardShortcuts({ enabled: true })
60
+ // ...
61
+ }
62
+ ```
63
+
64
+ ### Signal Capture
65
+
66
+ ```tsx
67
+ import { useSignalCapture } from '@sigil/hud'
68
+
69
+ function MyComponent() {
70
+ const { accept, modify, reject } = useSignalCapture()
71
+
72
+ const handleAccept = () => {
73
+ accept('ClaimButton', 'financial')
74
+ }
75
+
76
+ const handleModify = () => {
77
+ modify('ClaimButton', 'financial', {
78
+ from: '800ms',
79
+ to: '500ms',
80
+ })
81
+ }
82
+ }
83
+ ```
84
+
85
+ ### Observation Capture
86
+
87
+ ```tsx
88
+ import { useObservationCapture } from '@sigil/hud'
89
+
90
+ function MyComponent() {
91
+ const { captureUserTruth, captureIssue } = useObservationCapture()
92
+
93
+ const handleFeedback = () => {
94
+ captureUserTruth('This button feels too slow for power users', {
95
+ component: 'ClaimButton',
96
+ effect: 'financial',
97
+ })
98
+ }
99
+ }
100
+ ```
101
+
102
+ ## Components
103
+
104
+ | Component | Description |
105
+ |-----------|-------------|
106
+ | `HudProvider` | Context provider for HUD state and services |
107
+ | `HudPanel` | Main panel container |
108
+ | `HudTrigger` | Floating button to open HUD |
109
+ | `LensPanel` | Address impersonation controls |
110
+ | `SimulationPanel` | Transaction simulation info |
111
+ | `DiagnosticsPanel` | Physics compliance checking |
112
+ | `StateComparison` | Compare real vs impersonated state |
113
+
114
+ ## Hooks
115
+
116
+ | Hook | Description |
117
+ |------|-------------|
118
+ | `useHud()` | Access HUD context |
119
+ | `useKeyboardShortcuts()` | Enable keyboard shortcuts |
120
+ | `useSignalCapture()` | Capture taste signals |
121
+ | `useObservationCapture()` | Capture observations |
122
+
123
+ ## Progressive Enhancement
124
+
125
+ The HUD works with any subset of packages. Features gracefully degrade when packages are not installed:
126
+
127
+ - No `@sigil/lens` → Lens panel shows "not available" message
128
+ - No `@sigil/simulation` → Simulation panel shows "not available" message
129
+ - No `@sigil/diagnostics` → Diagnostics panel shows "not available" message
130
+
131
+ ## Configuration
132
+
133
+ ```typescript
134
+ interface HudConfig {
135
+ shortcuts?: boolean // Enable keyboard shortcuts
136
+ position?: HudPosition // 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left'
137
+ persist?: boolean // Persist state to localStorage
138
+ observationCapture?: boolean
139
+ signalCapture?: boolean
140
+ defaultPanel?: HudPanelType
141
+ }
142
+ ```
143
+
144
+ ## License
145
+
146
+ MIT