@jlcpcb/cli 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/CHANGELOG.md +15 -0
- package/README.md +251 -0
- package/dist/index.js +51677 -0
- package/package.json +53 -0
- package/src/app/App.tsx +85 -0
- package/src/app/components/DetailView.tsx +173 -0
- package/src/app/components/Divider.tsx +10 -0
- package/src/app/components/InstalledView.tsx +70 -0
- package/src/app/components/ListView.tsx +93 -0
- package/src/app/hooks/useTerminalSize.ts +29 -0
- package/src/app/navigation/NavigationContext.tsx +87 -0
- package/src/app/navigation/types.ts +66 -0
- package/src/app/screens/InfoScreen.tsx +203 -0
- package/src/app/screens/InstallScreen.tsx +54 -0
- package/src/app/screens/InstalledScreen.tsx +39 -0
- package/src/app/screens/LibraryScreen.tsx +259 -0
- package/src/app/screens/LibrarySetupScreen.tsx +120 -0
- package/src/app/screens/SearchScreen.tsx +74 -0
- package/src/app/state/AppStateContext.tsx +64 -0
- package/src/commands/info.ts +37 -0
- package/src/commands/install.ts +113 -0
- package/src/commands/library.ts +56 -0
- package/src/commands/search.ts +38 -0
- package/src/index.ts +70 -0
- package/tsconfig.json +10 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# @jlcpcb/cli
|
|
2
|
+
|
|
3
|
+
## 0.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`cc44735`](https://github.com/l3wi/jlc-cli/commit/cc44735cc56191533f1a088101dfe2b368929048) Thanks [@l3wi](https://github.com/l3wi)! - Initial release of @jlcpcb packages for JLC/EasyEDA component sourcing and KiCad integration.
|
|
8
|
+
- **@jlcpcb/core**: Core library with API clients, converters, and services
|
|
9
|
+
- **@jlcpcb/cli**: Interactive terminal UI for component search and library management
|
|
10
|
+
- **@jlcpcb/mcp**: MCP server for Claude Desktop/Code integration
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies [[`cc44735`](https://github.com/l3wi/jlc-cli/commit/cc44735cc56191533f1a088101dfe2b368929048)]:
|
|
15
|
+
- @jlcpcb/core@0.1.0
|
package/README.md
ADDED
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
# @jlcpcb/cli
|
|
2
|
+
|
|
3
|
+
> **Unofficial package** - This is a community-maintained tool and is not affiliated with, endorsed by, or officially connected to JLCPCB, LCSC, or EasyEDA.
|
|
4
|
+
|
|
5
|
+
Interactive terminal UI for JLCPCB component search and KiCad library management. Built with React and Ink for a rich terminal experience.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Install globally
|
|
11
|
+
npm install -g @jlcpcb/cli
|
|
12
|
+
|
|
13
|
+
# Or run directly with npx
|
|
14
|
+
npx @jlcpcb/cli search "STM32F103"
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Commands
|
|
18
|
+
|
|
19
|
+
### `jlc search <query>`
|
|
20
|
+
|
|
21
|
+
Search for components from LCSC or EasyEDA community library.
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# Basic search
|
|
25
|
+
jlc search "STM32F103"
|
|
26
|
+
jlc search "100nF 0402"
|
|
27
|
+
|
|
28
|
+
# Filter options
|
|
29
|
+
jlc search "STM32" --limit 50
|
|
30
|
+
jlc search "capacitor" --in-stock --basic-only
|
|
31
|
+
jlc search "XIAO RP2040" --community
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**Options:**
|
|
35
|
+
|
|
36
|
+
| Option | Description |
|
|
37
|
+
|--------|-------------|
|
|
38
|
+
| `-l, --limit <n>` | Maximum results (default: 20) |
|
|
39
|
+
| `--in-stock` | Only show in-stock components |
|
|
40
|
+
| `--basic-only` | Only JLCPCB basic parts (no extended fee) |
|
|
41
|
+
| `--community` | Search EasyEDA community library |
|
|
42
|
+
|
|
43
|
+
**Interactive Mode:**
|
|
44
|
+
|
|
45
|
+
- Use `↑` `↓` to navigate results
|
|
46
|
+
- Press `Enter` to view component details
|
|
47
|
+
- Press `Tab` to toggle between basic/all parts
|
|
48
|
+
- Press `Esc` to exit
|
|
49
|
+
|
|
50
|
+
### `jlc info <id>`
|
|
51
|
+
|
|
52
|
+
Display detailed component information.
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# By LCSC part number
|
|
56
|
+
jlc info C8734
|
|
57
|
+
|
|
58
|
+
# JSON output (for scripting)
|
|
59
|
+
jlc info C8734 --json
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**Options:**
|
|
63
|
+
|
|
64
|
+
| Option | Description |
|
|
65
|
+
|--------|-------------|
|
|
66
|
+
| `--json` | Output as JSON (non-interactive) |
|
|
67
|
+
|
|
68
|
+
**Interactive Actions:**
|
|
69
|
+
|
|
70
|
+
| Key | Action |
|
|
71
|
+
|-----|--------|
|
|
72
|
+
| `Enter` | Install component |
|
|
73
|
+
| `S` | Open symbol file |
|
|
74
|
+
| `F` | Open footprint file |
|
|
75
|
+
| `M` | Open 3D model |
|
|
76
|
+
| `D` | Open datasheet URL |
|
|
77
|
+
| `R` | Regenerate symbol/footprint |
|
|
78
|
+
| `Esc` | Go back |
|
|
79
|
+
|
|
80
|
+
### `jlc install [id]`
|
|
81
|
+
|
|
82
|
+
Install a component to KiCad libraries.
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# Interactive mode (search, select, install)
|
|
86
|
+
jlc install
|
|
87
|
+
|
|
88
|
+
# Install specific component
|
|
89
|
+
jlc install C8734
|
|
90
|
+
|
|
91
|
+
# Install with options
|
|
92
|
+
jlc install C8734 --with-3d
|
|
93
|
+
jlc install C8734 --project ./my-kicad-project
|
|
94
|
+
jlc install C8734 --force # Regenerate if exists
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**Options:**
|
|
98
|
+
|
|
99
|
+
| Option | Description |
|
|
100
|
+
|--------|-------------|
|
|
101
|
+
| `-p, --project <path>` | Install to project-local library |
|
|
102
|
+
| `--with-3d` | Include 3D model (STEP) |
|
|
103
|
+
| `-f, --force` | Force reinstall/regenerate |
|
|
104
|
+
|
|
105
|
+
**Installation Result:**
|
|
106
|
+
|
|
107
|
+
After installation, you'll see:
|
|
108
|
+
- **Symbol reference**: e.g., `JLC-MCP-ICs:STM32F103C8T6`
|
|
109
|
+
- **Footprint reference**: e.g., `Package_QFP:LQFP-48_7x7mm_P0.5mm`
|
|
110
|
+
- Validation info (pin/pad counts, power pins detected)
|
|
111
|
+
|
|
112
|
+
### `jlc library`
|
|
113
|
+
|
|
114
|
+
View and manage installed components.
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
# Interactive library browser
|
|
118
|
+
jlc library
|
|
119
|
+
|
|
120
|
+
# JSON output
|
|
121
|
+
jlc library --json
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
**Options:**
|
|
125
|
+
|
|
126
|
+
| Option | Description |
|
|
127
|
+
|--------|-------------|
|
|
128
|
+
| `--json` | Output library status as JSON |
|
|
129
|
+
|
|
130
|
+
**Library View:**
|
|
131
|
+
|
|
132
|
+
Shows all installed components with:
|
|
133
|
+
- Name and category
|
|
134
|
+
- Description
|
|
135
|
+
- Symbol status (Y/N)
|
|
136
|
+
- Footprint type (Standard/Custom)
|
|
137
|
+
- 3D model status (Y/N)
|
|
138
|
+
|
|
139
|
+
Navigate with `↑` `↓` and press `Enter` to view component details.
|
|
140
|
+
|
|
141
|
+
## Keyboard Navigation
|
|
142
|
+
|
|
143
|
+
Global keyboard shortcuts across all screens:
|
|
144
|
+
|
|
145
|
+
| Key | Action |
|
|
146
|
+
|-----|--------|
|
|
147
|
+
| `↑` `↓` | Navigate list |
|
|
148
|
+
| `Enter` | Select / Confirm |
|
|
149
|
+
| `Backspace` | Go back |
|
|
150
|
+
| `Esc` | Exit / Cancel |
|
|
151
|
+
| `Tab` | Switch focus / Toggle filter |
|
|
152
|
+
|
|
153
|
+
## Workflows
|
|
154
|
+
|
|
155
|
+
### 1. Interactive Search and Install
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
jlc search "STM32F103"
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
1. Results appear in a table with MFR Part, Description, Package, Stock, Price
|
|
162
|
+
2. Navigate with arrow keys, press `Enter` to select
|
|
163
|
+
3. View component details (datasheet, attributes, pins)
|
|
164
|
+
4. Press `Enter` again to install
|
|
165
|
+
5. Component is added to your KiCad library
|
|
166
|
+
|
|
167
|
+
### 2. Direct Install from LCSC ID
|
|
168
|
+
|
|
169
|
+
If you know the LCSC part number:
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
jlc install C8734 --force
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Directly installs without interactive UI.
|
|
176
|
+
|
|
177
|
+
### 3. Browse Installed Library
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
jlc library
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
1. See library status (installed, linked to KiCad)
|
|
184
|
+
2. Browse all installed components
|
|
185
|
+
3. Select any component to view details
|
|
186
|
+
4. Regenerate or update as needed
|
|
187
|
+
|
|
188
|
+
### 4. Scripting / Automation
|
|
189
|
+
|
|
190
|
+
Use `--json` flag for machine-readable output:
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
# Get component data
|
|
194
|
+
jlc info C8734 --json > component.json
|
|
195
|
+
|
|
196
|
+
# Get library status
|
|
197
|
+
jlc library --json > status.json
|
|
198
|
+
|
|
199
|
+
# Parse with jq
|
|
200
|
+
jlc info C8734 --json | jq '.symbol.pins | length'
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
## Library Structure
|
|
204
|
+
|
|
205
|
+
Components are organized by category:
|
|
206
|
+
|
|
207
|
+
```
|
|
208
|
+
~/Documents/KiCad/9.0/3rdparty/jlc_mcp/
|
|
209
|
+
├── symbols/
|
|
210
|
+
│ ├── JLC-MCP-Resistors.kicad_sym
|
|
211
|
+
│ ├── JLC-MCP-Capacitors.kicad_sym
|
|
212
|
+
│ ├── JLC-MCP-ICs.kicad_sym
|
|
213
|
+
│ └── ...
|
|
214
|
+
├── footprints/
|
|
215
|
+
│ └── JLC-MCP.pretty/
|
|
216
|
+
└── 3dmodels/
|
|
217
|
+
└── JLC-MCP.3dshapes/
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
Libraries are automatically registered in KiCad's global `sym-lib-table` and `fp-lib-table`.
|
|
221
|
+
|
|
222
|
+
## Why LCSC/JLCPCB?
|
|
223
|
+
|
|
224
|
+
- **LCSC is JLCPCB's parts supplier** - Components are guaranteed available for PCB assembly
|
|
225
|
+
- **Basic Parts** have no extended part fee ($3 savings per unique component)
|
|
226
|
+
- **Direct integration** - Fetched components work seamlessly with JLCPCB assembly
|
|
227
|
+
|
|
228
|
+
## Development
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
# Install dependencies
|
|
232
|
+
bun install
|
|
233
|
+
|
|
234
|
+
# Development with watch mode
|
|
235
|
+
bun run dev
|
|
236
|
+
|
|
237
|
+
# Build
|
|
238
|
+
bun run build
|
|
239
|
+
|
|
240
|
+
# Type check
|
|
241
|
+
bun run typecheck
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
## Related Packages
|
|
245
|
+
|
|
246
|
+
- [`@jlcpcb/core`](../core) - Core library with API clients and converters
|
|
247
|
+
- [`@jlcpcb/mcp`](../mcp) - MCP server for Claude Desktop/Code integration
|
|
248
|
+
|
|
249
|
+
## License
|
|
250
|
+
|
|
251
|
+
MIT
|