espcli 0.0.1

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.
Files changed (39) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +183 -0
  3. package/dist/index.js +185 -0
  4. package/package.json +50 -0
  5. package/src/core/constants.ts +107 -0
  6. package/src/core/emitter.ts +48 -0
  7. package/src/core/operations/build.ts +70 -0
  8. package/src/core/operations/clean.ts +42 -0
  9. package/src/core/operations/devices.ts +11 -0
  10. package/src/core/operations/flash.ts +49 -0
  11. package/src/core/operations/init.ts +39 -0
  12. package/src/core/operations/install.ts +99 -0
  13. package/src/core/operations/monitor.ts +67 -0
  14. package/src/core/services/health.ts +214 -0
  15. package/src/core/services/idf.ts +98 -0
  16. package/src/core/services/ports.ts +172 -0
  17. package/src/core/services/process.ts +144 -0
  18. package/src/core/services/shell.ts +74 -0
  19. package/src/core/templates/files.ts +78 -0
  20. package/src/core/templates/index.ts +52 -0
  21. package/src/core/types.ts +128 -0
  22. package/src/index.ts +5 -0
  23. package/src/serve.ts +8 -0
  24. package/src/server/index.ts +105 -0
  25. package/src/server/routes.ts +175 -0
  26. package/src/server/schema.ts +81 -0
  27. package/src/tui/commands/build.ts +48 -0
  28. package/src/tui/commands/clean.ts +36 -0
  29. package/src/tui/commands/devices.ts +18 -0
  30. package/src/tui/commands/doctor.ts +70 -0
  31. package/src/tui/commands/flash.ts +61 -0
  32. package/src/tui/commands/init.ts +59 -0
  33. package/src/tui/commands/install.ts +89 -0
  34. package/src/tui/commands/monitor.ts +63 -0
  35. package/src/tui/commands/run.ts +99 -0
  36. package/src/tui/display.ts +96 -0
  37. package/src/tui/index.ts +96 -0
  38. package/src/tui/logger.ts +35 -0
  39. package/src/tui/prompts.ts +99 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 rds_agi
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/README.md ADDED
@@ -0,0 +1,183 @@
1
+ # espcli
2
+
3
+ A modern CLI for ESP-IDF development. Simplifies project creation, building, flashing, and monitoring for ESP32 microcontrollers.
4
+
5
+ > **Note:** Currently supports macOS and Linux only.
6
+
7
+ ## Features
8
+
9
+ - 🚀 **One-command setup** — Install ESP-IDF with automatic shell configuration
10
+ - 📁 **Project scaffolding** — Generate C or C++ projects with proper structure
11
+ - 🔌 **Device detection** — Auto-detect connected ESP boards via USB
12
+ - 🔨 **Build integration** — Compile projects with target selection
13
+ - ⚡ **Flash firmware** — Program devices with configurable baud rates
14
+ - 📡 **Serial monitor** — Real-time UART output with color support
15
+ - 🔄 **Run workflow** — Build, flash, and monitor in a single command
16
+ - 🩺 **Health checks** — Diagnose ESP-IDF installation issues
17
+
18
+ ## Supported Chips
19
+
20
+ | Xtensa | RISC-V | 802.15.4/Thread |
21
+ |--------|--------|-----------------|
22
+ | ESP32 | ESP32-C2 | ESP32-H2 |
23
+ | ESP32-S2 | ESP32-C3 | |
24
+ | ESP32-S3 | ESP32-C6 | |
25
+ | | ESP32-P4 | |
26
+
27
+ ## Installation
28
+
29
+ ### Prerequisites
30
+
31
+ - Git
32
+ - Python 3.8+
33
+
34
+ ### Install globally
35
+
36
+ ```bash
37
+ npm install -g espcli
38
+ ```
39
+
40
+ ### Or run directly with npx/bunx
41
+
42
+ ```bash
43
+ npx espcli <command>
44
+ # or
45
+ bunx espcli <command>
46
+ ```
47
+
48
+ ## Quick Start
49
+
50
+ ### 1. Install ESP-IDF
51
+
52
+ ```bash
53
+ espcli install
54
+ ```
55
+
56
+ This downloads ESP-IDF, installs toolchains, and configures your shell.
57
+
58
+ ### 2. Create a Project
59
+
60
+ ```bash
61
+ espcli init my-project
62
+ ```
63
+
64
+ Interactive prompts let you choose language (C/C++) and target chip.
65
+
66
+ ### 3. Build, Flash & Monitor
67
+
68
+ ```bash
69
+ cd my-project
70
+ espcli run
71
+ ```
72
+
73
+ Or run each step separately:
74
+
75
+ ```bash
76
+ espcli build
77
+ espcli flash
78
+ espcli monitor
79
+ ```
80
+
81
+ ## Commands
82
+
83
+ | Command | Description |
84
+ |---------|-------------|
85
+ | `install` | Install ESP-IDF framework |
86
+ | `init [name]` | Create a new ESP-IDF project |
87
+ | `devices` | List connected ESP devices |
88
+ | `build` | Build the current project |
89
+ | `flash` | Flash firmware to device |
90
+ | `monitor` | Open serial monitor |
91
+ | `run` | Build, flash, and monitor |
92
+ | `clean` | Clean build artifacts |
93
+ | `doctor` | Check system health |
94
+
95
+ ### Command Options
96
+
97
+ ```bash
98
+ # Install with custom path and target
99
+ espcli install --path ~/esp --target esp32s3
100
+
101
+ # Initialize with language and target
102
+ espcli init my-project --lang cpp --target esp32c3
103
+
104
+ # Build with target change and clean
105
+ espcli build --target esp32s3 --clean
106
+
107
+ # Flash with specific port and baud rate
108
+ espcli flash --port /dev/ttyUSB0 --baud 921600
109
+
110
+ # Monitor with specific port
111
+ espcli monitor --port /dev/ttyUSB0 --baud 115200
112
+
113
+ # Run with options
114
+ espcli run --port /dev/ttyUSB0 --skip-build
115
+
116
+ # Full clean including sdkconfig
117
+ espcli clean --full
118
+ ```
119
+
120
+ ## Project Structure
121
+
122
+ Generated projects follow ESP-IDF conventions:
123
+
124
+ ```
125
+ my-project/
126
+ ├── CMakeLists.txt
127
+ ├── main/
128
+ │ ├── CMakeLists.txt
129
+ │ └── main.c (or main.cpp)
130
+ └── sdkconfig
131
+ ```
132
+
133
+ ## Troubleshooting
134
+
135
+ ### ESP-IDF not found
136
+
137
+ Run `espcli doctor` to check your installation, then:
138
+
139
+ ```bash
140
+ espcli install
141
+ ```
142
+
143
+ ### Device not detected
144
+
145
+ 1. Check USB connection
146
+ 2. Run `espcli devices` to list ports
147
+ 3. Ensure you have permission to access serial ports:
148
+ ```bash
149
+ # Linux
150
+ sudo usermod -aG dialout $USER
151
+ ```
152
+
153
+ ### Build fails
154
+
155
+ ```bash
156
+ espcli clean --full
157
+ espcli build
158
+ ```
159
+
160
+ ## Contributing
161
+
162
+ ```bash
163
+ git clone https://github.com/rudrodip/espcli.git
164
+ cd espcli
165
+ bun install
166
+
167
+ # Run in development
168
+ bun run dev
169
+
170
+ # Type check
171
+ bun run typecheck
172
+
173
+ # Build for distribution
174
+ bun run build
175
+ ```
176
+
177
+ ## License
178
+
179
+ [MIT](LICENSE)
180
+
181
+ ## Author
182
+
183
+ [rds_agi](https://github.com/rudrodip)