@dheerajsom/pinhub 0.1.2 → 0.2.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.
@@ -1,4 +1,4 @@
1
- # pinhub pinout diagrams in your terminal
1
+ # PinHub CLI (`ph`)
2
2
 
3
3
  `@dheerajsom/pinhub` installs a tiny cross-platform command, **`ph`**, that draws hardware
4
4
  board pinout diagrams straight in your terminal — pin numbers, GPIO names,
@@ -10,7 +10,7 @@ $ ph rpi5
10
10
 
11
11
  Raspberry Pi 5 — Raspberry Pi
12
12
  Source: Raspberry Pi GPIO documentation (official) — see ph raspberry-pi-5 --source
13
- GPIO uses 3.3 V logic. Do not apply 5 V to any GPIO pin.
13
+ GPIO uses 3.3 V logic. Do not apply 5 V to any GPIO pin.
14
14
 
15
15
  40-pin GPIO header (J8)
16
16
  ┌────────────────────┬────┬────┬───────────────────┐
@@ -55,6 +55,11 @@ ph --version # version
55
55
  Board names are forgiving: `ph rpi5`, `ph pi5`, `ph raspberry-pi-5`, and
56
56
  `ph raspberry pi 5` all resolve to the same board, case-insensitively.
57
57
 
58
+ Compatibility note for 0.2: `arduino-uno-rev3` is the canonical UNO identifier
59
+ used by list and JSON output; the former `arduino-uno-r3` spelling remains a
60
+ supported alias. `esp32` continues to select the DOIT 30-pin
61
+ `esp32-devkit-v1`; the distinct 38-pin Espressif board is `esp32-devkitc`.
62
+
58
63
  ### Output flags
59
64
 
60
65
  | Flag | Effect |
@@ -62,9 +67,20 @@ Board names are forgiving: `ph rpi5`, `ph pi5`, `ph raspberry-pi-5`, and
62
67
  | `--compact` | Tighter, borderless layout for small terminals |
63
68
  | `--ascii` | ASCII-only borders and symbols (no Unicode) |
64
69
  | `--no-color` | Disable ANSI colors |
65
- | `--json` | Emit the board's full data as JSON (stdout is pure JSON) |
66
- | `--source` | Print the board's documentation source links |
67
- | `--width <n>` | Override the detected terminal width |
70
+ | `--no-motion` | Disable the brief interactive signal pulse |
71
+ | `--details` | Show additional alternate pin functions |
72
+ | `--json` | Emit machine-readable JSON (one board or a list/search array) |
73
+ | `--source` | Print one board's documentation source links |
74
+ | `--width <n>` | Use a whole-number terminal width from 20 to 1000 |
75
+
76
+ Presentation flags are global and work in any position, including `ph list
77
+ --no-color`, `ph search pico --width 60`, and `ph info rpi5 --ascii`. JSON
78
+ always keeps stdout pure; `list` and `search` return arrays. Because `--source`
79
+ and `--details` are one-board views, using them with `list` or `search` fails
80
+ with a short correction instead of silently ignoring the flag. JSON is a
81
+ separate machine-readable view, so it cannot be combined with `--ascii`,
82
+ `--compact`, `--details`, `--source`, or `--width`; `--no-color` and
83
+ `--no-motion` remain safe global opt-outs.
68
84
 
69
85
  Examples:
70
86
 
@@ -72,15 +88,17 @@ Examples:
72
88
  ph rpi5
73
89
  ph esp32
74
90
  ph pico --compact
91
+ ph pico --details
75
92
  ph rpi5 --ascii --no-color
76
93
  ph uno --json | jq '.headers[].name'
94
+ ph search raspberry --json | jq '.[].id'
77
95
  ph rpi5 --source
78
96
  ```
79
97
 
80
98
  ## Boards
81
99
 
82
100
  The catalog carries the full [PinHub website](https://pinhub.vercel.app) board
83
- set — 125 boards across Raspberry Pi, Arduino, Espressif, STM32, Teensy,
101
+ set — 126 boards across Raspberry Pi, Arduino, Espressif, STM32, Teensy,
84
102
  Adafruit, SparkFun, Seeed, BeagleBone, Jetson, and more. Run `ph list` to see
85
103
  everything. A few starters:
86
104
 
@@ -103,10 +121,21 @@ everything. A few starters:
103
121
  is `--no-color`.
104
122
  - When output is piped or redirected (not a TTY), color is disabled
105
123
  automatically and the layout stays stable.
106
- - `--ascii` avoids all Unicode for legacy terminals and screen readers that
107
- struggle with box-drawing characters.
124
+ - `--ascii` guarantees ASCII-only text for legacy terminals and screen readers
125
+ that struggle with box-drawing characters.
108
126
  - On narrow terminals the diagram degrades gracefully: full bordered table →
109
- compact pairs → vertical list. Warnings and source lines are never truncated.
127
+ compact pairs → wrapped vertical list. Catalog tables, warnings, long source
128
+ titles, and URLs wrap to the requested terminal-cell width without truncating
129
+ hardware information.
130
+ - Danger, warning, and informational messages use distinct symbols (`✖`, `⚠`,
131
+ `ℹ`; or `X`, `!`, `i` in ASCII mode), so severity never depends on color.
132
+ - Interactive commands briefly show a color-cycling signal pulse before their
133
+ result. It is written to the TTY only and erases itself. It never runs for
134
+ pipes, CI, `TERM=dumb`, help, version, JSON, `--no-color`/`NO_COLOR`, or
135
+ `--no-motion`. `PINHUB_NO_MOTION=1` disables it persistently.
136
+ - Pin-specific notes are printed below their header and marked on the diagram.
137
+ The first alternate function remains inline; `--details` expands any
138
+ additional functions.
110
139
 
111
140
  ## Hardware safety disclaimer
112
141
 
@@ -128,7 +157,7 @@ Most of the catalog is **generated from the PinHub website data**
128
157
  `src/boards/generated.ts`.
129
158
  2. Add short aliases people actually type in `scripts/curated-aliases.ts`.
130
159
  3. Run `npm test` — catalog invariant tests check sources, warnings, alias
131
- uniqueness, and pin-grid consistency across all 125 boards.
160
+ uniqueness, and pin-grid consistency across all 126 boards.
132
161
 
133
162
  Five flagship boards (Pi 5, Pico, Pico W, UNO R3, ESP32 DevKit V1) have richer
134
163
  hand-written modules in `src/boards/`, one file per board, using the typed
@@ -151,15 +180,26 @@ npm run dev -- rpi5 # run from TypeScript source
151
180
  npm test # vitest suite (alias, JSON, rendering, snapshots)
152
181
  npm run lint # eslint
153
182
  npm run build # compile to dist/
183
+ npm run check:boards # verify generated catalog data is current
154
184
  npm run package:check # npm pack --dry-run
155
185
  ```
156
186
 
157
187
  The CLI entry point is `src/cli.ts`; `src/run.ts` contains the whole command
158
- surface as a testable function that writes to captured buffers. Renderers live
188
+ surface as a deterministic, testable function that writes to captured buffers.
189
+ The executable-only signal pulse stays at the `src/cli.ts` boundary, so library
190
+ callers and JSON output never receive animation controls. Renderers live
159
191
  in `src/render/` behind a small abstraction (`dual-row` bordered table,
160
192
  compact pairs, and vertical list), so new header layouts can be added without
161
193
  touching board data. CI runs lint, tests, build, and a smoke test on Windows,
162
194
  macOS, and Linux via GitHub Actions.
163
195
 
164
- To publish: `npm publish` from `cli/` (the `prepublishOnly` hook lints, tests,
165
- and builds; the `files` allowlist ships only `dist/`).
196
+ To publish a SemVer release from `cli/` (choose the appropriate version level):
197
+
198
+ ```bash
199
+ npm version patch
200
+ npm publish --access public
201
+ ```
202
+
203
+ The `prepublishOnly` hook verifies generated board data, lints, tests, and
204
+ builds. The `files` allowlist ships only the compiled CLI and its user
205
+ documentation.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Dheeraj Som
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/SETUP.md CHANGED
@@ -50,7 +50,7 @@ If `ph` prints a pinout diagram, you're done.
50
50
  ## 3. Install from source (this repository)
51
51
 
52
52
  ```bash
53
- git clone https://github.com/<your-org>/PinHub.git
53
+ git clone https://github.com/Dheerajsom/PinHub.git
54
54
  cd PinHub/cli
55
55
  npm install
56
56
  npm run build
@@ -70,7 +70,7 @@ npm run dev -- rpi5
70
70
  ## 4. First steps
71
71
 
72
72
  ```bash
73
- ph list # see all 125 boards in the catalog
73
+ ph list # see all 126 boards in the catalog
74
74
  ph rpi5 # Raspberry Pi 5 GPIO header
75
75
  ph pico # Raspberry Pi Pico
76
76
  ph uno # Arduino UNO R3
@@ -83,8 +83,13 @@ ph info esp32 # warnings, sources, aliases
83
83
  ph rpi5 --source # official documentation links
84
84
  ```
85
85
 
86
- Useful flags: `--compact` (small terminals), `--ascii` (no Unicode),
87
- `--no-color`, `--json` (script-friendly), `--width <n>`.
86
+ Useful flags: `--compact` (small terminals), `--ascii` (strict ASCII),
87
+ `--no-color`, `--no-motion`, `--details` (all alternate functions), `--json`
88
+ (script-friendly), and `--width <n>` (20 to 1000 columns).
89
+
90
+ `--json` is a separate machine-readable view and cannot be combined with
91
+ `--ascii`, `--compact`, `--details`, `--source`, or `--width`. Source and detail
92
+ views require one board and cannot be requested together.
88
93
 
89
94
  Board names are forgiving — `ph rpi5`, `ph pi5`, and `ph raspberry pi 5` all
90
95
  work. If you guess wrong, `ph` suggests the closest matches.
@@ -110,6 +115,11 @@ Color is automatically disabled when output is piped or when the
110
115
  [`NO_COLOR`](https://no-color.org/) environment variable is set. Force it off
111
116
  per-invocation with `--no-color`.
112
117
 
118
+ **You prefer no terminal animation**
119
+ The short signal pulse only appears in an interactive color terminal. It is
120
+ automatically disabled for pipes, CI, `TERM=dumb`, help, version, and JSON.
121
+ Use `--no-motion` for one command, or set `PINHUB_NO_MOTION=1` to keep it off.
122
+
113
123
  **The diagram looks cramped or wraps badly**
114
124
  `ph` adapts to terminal width and falls back to a compact layout, but you can
115
125
  control it: widen the terminal, or use `--compact`, or `--width 100`.
@@ -125,5 +135,6 @@ npm uninstall -g @dheerajsom/pinhub
125
135
  `ph` shows each board's voltage levels, reserved pins, and boot-strap pins,
126
136
  and cites its documentation sources — but board revisions differ (ESP32
127
137
  boards especially). Always cross-check your exact board's silkscreen and the
128
- official documentation (`ph <board> --source`) before wiring. 3.3 V GPIO does
138
+ source list (`ph <board> --source`), including any third-party label, before
139
+ wiring. 3.3 V GPIO does
129
140
  not forgive 5 V.
@@ -9,7 +9,7 @@ function col(physical, label, category, extra = {}) {
9
9
  }
10
10
  const V5 = { voltage: "5 V" };
11
11
  export const arduinoUnoR3 = {
12
- id: "arduino-uno-r3",
12
+ id: "arduino-uno-rev3",
13
13
  name: "Arduino UNO R3",
14
14
  manufacturer: "Arduino",
15
15
  aliases: ["uno", "uno-r3", "arduino-uno", "arduino-uno-r3", "arduino-uno-rev3"],
@@ -23,11 +23,9 @@ export const esp32DevkitV1 = {
23
23
  aliases: [
24
24
  "esp32",
25
25
  "esp32-devkit",
26
- "esp32-devkit-v1",
27
26
  "esp32-devkitv1",
28
27
  "doit-esp32-devkit-v1",
29
28
  "esp32-wroom-32",
30
- "esp32-devkitc",
31
29
  ],
32
30
  description: "The ubiquitous 30-pin ESP32-WROOM-32 breadboard dev kit. Wi-Fi + Bluetooth, two breadboard-friendly headers, 3.3 V logic.",
33
31
  revisionNote: "ESP32 dev boards vary a lot: 30-pin DevKit V1, 36-pin variants, and the 38-pin Espressif ESP32-DevKitC all have different headers. Verify the silkscreen of your exact board before wiring anything.",
@@ -58,16 +56,19 @@ export const esp32DevkitV1 = {
58
56
  title: "Espressif ESP32-WROOM-32 datasheet",
59
57
  url: "https://www.espressif.com/sites/default/files/documentation/esp32-wroom-32_datasheet_en.pdf",
60
58
  official: true,
59
+ type: "Datasheet",
61
60
  },
62
61
  {
63
62
  title: "Espressif ESP32 series datasheet",
64
63
  url: "https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf",
65
64
  official: true,
65
+ type: "Datasheet",
66
66
  },
67
67
  {
68
- title: "Last Minute Engineers — ESP32 DevKit pinout reference (third-party board layout)",
68
+ title: "Last Minute Engineers — ESP32 DevKit 30-pin layout",
69
69
  url: "https://lastminuteengineers.com/esp32-pinout-reference/",
70
70
  official: false,
71
+ type: "Pinout",
71
72
  },
72
73
  ],
73
74
  headers: [
@@ -132,7 +133,7 @@ export const esp32DevkitV1 = {
132
133
  pin(28, "D15", "gpio", {
133
134
  gpio: "GPIO15",
134
135
  functions: ["ADC2_CH3", "HSPI CS"],
135
- notes: ["Boot strap: keep high at reset to silence boot log"],
136
+ notes: ["Boot strap; pull low at reset to silence the ROM boot log"],
136
137
  ...V33,
137
138
  }),
138
139
  pin(29, "GND", "ground"),