pi-extmgr 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.
- package/LICENSE +21 -0
- package/README.md +319 -0
- package/index.ts +1895 -0
- package/package.json +61 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Abdeslam Yassine Agmar
|
|
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,319 @@
|
|
|
1
|
+
# 🔧 pi-extmgr
|
|
2
|
+
|
|
3
|
+
> Enhanced UI/UX for managing Pi extensions and discovering community packages
|
|
4
|
+
|
|
5
|
+
[](https://github.com/ayagmar/pi-extmgr/actions/workflows/ci.yml)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
|
|
8
|
+
**pi-extmgr** transforms extension management in Pi from a command-line chore into a delightful interactive experience. Browse, install, and manage extensions with an intuitive TUI interface, smart autocomplete, and one-click operations.
|
|
9
|
+
|
|
10
|
+
<!-- Replace with actual demo GIF/Screenshot when available -->
|
|
11
|
+
<!--  -->
|
|
12
|
+
|
|
13
|
+
## ✨ Features
|
|
14
|
+
|
|
15
|
+
### 🎨 Interactive TUI Interface
|
|
16
|
+
|
|
17
|
+
- **Beautiful themed interface** with color-coded status indicators
|
|
18
|
+
- **Keyboard-driven navigation** - fast and efficient
|
|
19
|
+
- **Real-time previews** with package descriptions
|
|
20
|
+
- **Context-aware help** - press `?` anywhere for shortcuts
|
|
21
|
+
|
|
22
|
+
### 🔍 Smart Package Discovery
|
|
23
|
+
|
|
24
|
+
- **Browse community packages** with pagination (20 per page)
|
|
25
|
+
- **Cached search results** for lightning-fast navigation
|
|
26
|
+
- **Keyword filtering** - automatically shows `pi-package` tagged npm packages
|
|
27
|
+
- **Detailed package info** - view version, author, homepage
|
|
28
|
+
|
|
29
|
+
### 📦 Flexible Installation
|
|
30
|
+
|
|
31
|
+
- **Multiple source support**: npm, git, local paths
|
|
32
|
+
- **Two install modes**:
|
|
33
|
+
- **Managed** (npm) - Auto-updates with `pi update`, stored in pi's package cache
|
|
34
|
+
- **Standalone** (local) - Full package directory to `~/.pi/agent/extensions/{package}/`
|
|
35
|
+
- **Multi-file extension support** - Local install copies entire package directory, preserving imports
|
|
36
|
+
- **Auto-extract** from npm tarballs for local installs
|
|
37
|
+
- **One-click reload** after installation
|
|
38
|
+
|
|
39
|
+
### ⚡ Quick Extension Management
|
|
40
|
+
|
|
41
|
+
- **Enable/disable extensions** with staging (preview before applying)
|
|
42
|
+
- **Visual change indicators** (\*) show pending modifications
|
|
43
|
+
- **Bulk operations** - update all packages at once
|
|
44
|
+
- **Scope indicators**: Global (G) vs Project (P) extensions
|
|
45
|
+
|
|
46
|
+
### 🎯 Quality of Life
|
|
47
|
+
|
|
48
|
+
- **Tab autocomplete** for all subcommands
|
|
49
|
+
- **Status bar integration** - shows installed package count
|
|
50
|
+
- **Keyboard shortcut**: `Ctrl+Shift+E` opens extension manager
|
|
51
|
+
- **Non-interactive mode** - works in scripts and CI
|
|
52
|
+
- **Smart deduplication** - handles same package in multiple scopes
|
|
53
|
+
|
|
54
|
+
## 🚀 Installation
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pi install npm:pi-extmgr
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Then reload Pi:
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
/reload
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## 📖 Usage
|
|
67
|
+
|
|
68
|
+
### Interactive Mode (Recommended)
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
/extensions # Open full interactive manager
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
#### Local Extensions Manager
|
|
75
|
+
|
|
76
|
+
Manage your local extensions with an interactive list:
|
|
77
|
+
|
|
78
|
+
| Key | Action |
|
|
79
|
+
| ------------- | ----------------------- |
|
|
80
|
+
| `↑↓` | Navigate extensions |
|
|
81
|
+
| `Space/Enter` | Toggle enabled/disabled |
|
|
82
|
+
| `S` | Save changes |
|
|
83
|
+
| `I` | View installed packages |
|
|
84
|
+
| `R` | Browse remote packages |
|
|
85
|
+
| `M` | Return to command line |
|
|
86
|
+
| `?` | Show help |
|
|
87
|
+
| `Esc` | Cancel |
|
|
88
|
+
|
|
89
|
+
**Staged Changes**: Toggle extensions on/off without immediate effect. Press `S` to apply all changes at once. Pending changes show `*` next to the extension name.
|
|
90
|
+
|
|
91
|
+
#### Community Package Browser
|
|
92
|
+
|
|
93
|
+
Browse and install from npm:
|
|
94
|
+
|
|
95
|
+
| Key | Action |
|
|
96
|
+
| ------- | -------------------- |
|
|
97
|
+
| `↑↓` | Navigate packages |
|
|
98
|
+
| `Enter` | View package details |
|
|
99
|
+
| `N` | Next page |
|
|
100
|
+
| `P` | Previous page |
|
|
101
|
+
| `R` | Refresh search |
|
|
102
|
+
| `M` | Back to menu |
|
|
103
|
+
| `Esc` | Cancel |
|
|
104
|
+
|
|
105
|
+
### Command Reference
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
# Local Extension Management
|
|
109
|
+
/extensions list # List local extensions (text output)
|
|
110
|
+
/extensions local # Open interactive manager (default)
|
|
111
|
+
|
|
112
|
+
# Package Discovery
|
|
113
|
+
/extensions remote # Browse community packages
|
|
114
|
+
/extensions packages # Alias for remote
|
|
115
|
+
/extensions search <query> # Search npm for packages
|
|
116
|
+
|
|
117
|
+
# Package Management
|
|
118
|
+
/extensions installed # List installed packages with actions
|
|
119
|
+
/extensions install <source> # Install from npm/git/path
|
|
120
|
+
/extensions remove [source] # Remove package (interactive if no source)
|
|
121
|
+
/extensions uninstall [source]# Alias for remove
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Install Sources
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
# npm packages (auto-detected if no prefix)
|
|
128
|
+
/extensions install npm:some-package
|
|
129
|
+
/extensions install @scope/package
|
|
130
|
+
|
|
131
|
+
# Git repositories
|
|
132
|
+
/extensions install git:https://github.com/user/repo.git
|
|
133
|
+
|
|
134
|
+
# GitHub single-file extensions (.ts files)
|
|
135
|
+
# Automatically converts blob URLs to raw and downloads directly
|
|
136
|
+
/extensions install https://github.com/user/repo/blob/main/extension.ts
|
|
137
|
+
|
|
138
|
+
# Local paths
|
|
139
|
+
/extensions install /path/to/extension.ts
|
|
140
|
+
/extensions install ./my-extension/
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Non-Interactive Mode
|
|
144
|
+
|
|
145
|
+
All commands work in non-interactive environments (CI, scripts):
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
# These work without UI
|
|
149
|
+
/extensions list
|
|
150
|
+
/extensions installed
|
|
151
|
+
|
|
152
|
+
# These require arguments in non-interactive mode
|
|
153
|
+
/extensions install npm:package-name
|
|
154
|
+
/extensions remove npm:package-name
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## 🎮 Keyboard Shortcuts
|
|
158
|
+
|
|
159
|
+
### Global
|
|
160
|
+
|
|
161
|
+
- `Ctrl+Shift+E` - Open Extensions Manager
|
|
162
|
+
|
|
163
|
+
### In Interactive Mode
|
|
164
|
+
|
|
165
|
+
- `↑/↓` or `K/J` - Navigate
|
|
166
|
+
- `Enter/Space` - Select/Toggle
|
|
167
|
+
- `S` - Save changes
|
|
168
|
+
- `I` - Installed packages
|
|
169
|
+
- `R` - Remote packages
|
|
170
|
+
- `M` - Main menu / Back
|
|
171
|
+
- `?` or `H` - Help
|
|
172
|
+
- `Esc` - Cancel/Back
|
|
173
|
+
|
|
174
|
+
## 🏗️ Extension Discovery
|
|
175
|
+
|
|
176
|
+
pi-extmgr discovers extensions from two locations:
|
|
177
|
+
|
|
178
|
+
### Global Extensions
|
|
179
|
+
|
|
180
|
+
```
|
|
181
|
+
~/.pi/agent/extensions/
|
|
182
|
+
├── my-extension.ts
|
|
183
|
+
├── disabled-extension.ts.disabled
|
|
184
|
+
└── my-extension/
|
|
185
|
+
└── index.ts
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Project Extensions
|
|
189
|
+
|
|
190
|
+
```
|
|
191
|
+
./.pi/extensions/
|
|
192
|
+
├── project-tool.ts
|
|
193
|
+
└── local-helper/
|
|
194
|
+
└── index.ts
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
**Naming**: Append `.disabled` to disable an extension without removing it.
|
|
198
|
+
|
|
199
|
+
## 🔧 Configuration
|
|
200
|
+
|
|
201
|
+
No configuration needed! But you can customize your Pi theme to change the appearance:
|
|
202
|
+
|
|
203
|
+
```typescript
|
|
204
|
+
// In your theme extension
|
|
205
|
+
export default function myTheme(pi: ExtensionAPI) {
|
|
206
|
+
pi.registerTheme({
|
|
207
|
+
name: "my-theme",
|
|
208
|
+
colors: {
|
|
209
|
+
accent: "#00ff00",
|
|
210
|
+
success: "#00aa00",
|
|
211
|
+
error: "#ff0000",
|
|
212
|
+
warning: "#ffaa00",
|
|
213
|
+
// ... other colors
|
|
214
|
+
},
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
## 📝 Example Workflows
|
|
220
|
+
|
|
221
|
+
### Installing a New Extension
|
|
222
|
+
|
|
223
|
+
1. Press `Ctrl+Shift+E` or type `/extensions`
|
|
224
|
+
2. Press `R` for remote packages
|
|
225
|
+
3. Browse or search for the extension
|
|
226
|
+
4. Press `Enter` on the desired package
|
|
227
|
+
5. Choose install mode:
|
|
228
|
+
- **"Install via npm (managed)"** - Uses pi's package manager. Auto-updates with `pi update`. Best for most users.
|
|
229
|
+
- **"Install locally (standalone)"** - Copies entire package to `~/.pi/agent/extensions/{package}/`. Supports multi-file extensions with imports. Manual updates required.
|
|
230
|
+
6. Confirm installation
|
|
231
|
+
7. Choose to reload Pi to activate
|
|
232
|
+
|
|
233
|
+
**Local Install Directory Structure:**
|
|
234
|
+
|
|
235
|
+
```
|
|
236
|
+
~/.pi/agent/extensions/
|
|
237
|
+
└── pi-some-extension/ # Full package directory
|
|
238
|
+
├── index.ts # Entry point
|
|
239
|
+
├── utils.ts # Helper (imports work!)
|
|
240
|
+
└── package.json # Original package.json preserved
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### Disabling an Extension Temporarily
|
|
244
|
+
|
|
245
|
+
1. Type `/extensions` to open manager
|
|
246
|
+
2. Navigate to the extension with `↑↓`
|
|
247
|
+
3. Press `Space` to toggle it off
|
|
248
|
+
4. Press `S` to save
|
|
249
|
+
5. Confirm reload
|
|
250
|
+
|
|
251
|
+
The extension remains installed but won't load until re-enabled.
|
|
252
|
+
|
|
253
|
+
### Updating All Packages
|
|
254
|
+
|
|
255
|
+
1. Type `/extensions installed`
|
|
256
|
+
2. Select "[Update all packages]"
|
|
257
|
+
3. Wait for updates to complete
|
|
258
|
+
4. Reload Pi if updates were applied
|
|
259
|
+
|
|
260
|
+
## 🐛 Troubleshooting
|
|
261
|
+
|
|
262
|
+
### Commands not showing after install
|
|
263
|
+
|
|
264
|
+
Make sure to reload Pi:
|
|
265
|
+
|
|
266
|
+
```
|
|
267
|
+
/reload
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
### Extension not appearing in list
|
|
271
|
+
|
|
272
|
+
Check that the file has a `.ts` or `.js` extension and is in one of the discovery paths:
|
|
273
|
+
|
|
274
|
+
- `~/.pi/agent/extensions/` (global)
|
|
275
|
+
- `.pi/extensions/` (project)
|
|
276
|
+
|
|
277
|
+
### Package installation fails
|
|
278
|
+
|
|
279
|
+
- Check npm is installed and accessible
|
|
280
|
+
- For git installs, ensure git is available
|
|
281
|
+
- Verify the package has the `pi-package` keyword for browsing
|
|
282
|
+
|
|
283
|
+
### Same package showing twice in installed list
|
|
284
|
+
|
|
285
|
+
This can happen when `pi list` returns the same package in different formats (e.g., both `npm:package@1.0.0` and the full node_modules path). The extension now automatically deduplicates by package name.
|
|
286
|
+
|
|
287
|
+
## 🤝 Contributing
|
|
288
|
+
|
|
289
|
+
Contributions welcome! Please ensure:
|
|
290
|
+
|
|
291
|
+
1. Run `pnpm run check` before committing
|
|
292
|
+
2. Husky pre-commit hooks will validate automatically
|
|
293
|
+
3. Follow existing code style
|
|
294
|
+
|
|
295
|
+
```bash
|
|
296
|
+
# Setup
|
|
297
|
+
git clone https://github.com/ayagmar/pi-extmgr.git
|
|
298
|
+
cd pi-extmgr
|
|
299
|
+
pnpm install
|
|
300
|
+
|
|
301
|
+
# Development
|
|
302
|
+
pnpm run typecheck # Type checking
|
|
303
|
+
pnpm run lint # Linting
|
|
304
|
+
pnpm run check # Full validation
|
|
305
|
+
|
|
306
|
+
# Test in Pi
|
|
307
|
+
pi install ./index.ts
|
|
308
|
+
/reload
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
## 📄 License
|
|
312
|
+
|
|
313
|
+
MIT © [ayagmar](https://github.com/ayagmar)
|
|
314
|
+
|
|
315
|
+
---
|
|
316
|
+
|
|
317
|
+
<p align="center">
|
|
318
|
+
Made with ❤️ for the Pi community
|
|
319
|
+
</p>
|