@simon_he/pi 0.2.10 → 0.2.11
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 +55 -1
- package/dist/index.cjs +494 -36
- package/dist/index.mjs +499 -42
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
- [Language Settings](#-language)
|
|
19
19
|
- [Installation](#-installation)
|
|
20
20
|
- [Usage](#-usage)
|
|
21
|
+
- [Workspace Tool Selection](#-workspace-tool-selection)
|
|
21
22
|
- [Supported Features](#-features)
|
|
22
23
|
- [Special Features](#-feature)
|
|
23
24
|
- [Custom Configuration](#-custom-configuration)
|
|
@@ -96,6 +97,20 @@ export PI_Lang=en
|
|
|
96
97
|
# According to the environment of the current directory to analyze which package manager to use,go、rust、pnpm、yarn、npm
|
|
97
98
|
# Install dependencies
|
|
98
99
|
pi xxx
|
|
100
|
+
# Re-pick the package manager used by the current workspace
|
|
101
|
+
pi --choose-tool
|
|
102
|
+
# Pick the tool directly without opening the selector
|
|
103
|
+
pi --choose-tool bun
|
|
104
|
+
# Clear the saved package manager choice for the current workspace
|
|
105
|
+
pi --forget-tool
|
|
106
|
+
# Show which package manager the current workspace will use
|
|
107
|
+
pi --show-tool
|
|
108
|
+
# Show the current workspace tool as JSON
|
|
109
|
+
pi --show-tool --json
|
|
110
|
+
# List all detected package-manager candidates
|
|
111
|
+
pi --list-tools
|
|
112
|
+
# List candidates as JSON
|
|
113
|
+
pi --list-tools --json
|
|
99
114
|
# Uninstall dependencies
|
|
100
115
|
pui xxx
|
|
101
116
|
# Execute command
|
|
@@ -114,6 +129,45 @@ export PI_Lang=en
|
|
|
114
129
|
|
|
115
130
|
```
|
|
116
131
|
|
|
132
|
+
## :triangular_ruler: Workspace Tool Selection
|
|
133
|
+
|
|
134
|
+
When a workspace contains multiple package-manager indicators, for example `bun.lock` and `pnpm-lock.yaml`, `pi`, `pil`, and `pci` will ask once which tool to use and remember that choice for the current workspace.
|
|
135
|
+
|
|
136
|
+
- The saved choice is stored locally in your config directory, for example `~/.config/pi/workspace-tools.json`.
|
|
137
|
+
- The record is local to your machine and should not be committed into the repository.
|
|
138
|
+
- If the remembered tool no longer exists in that workspace, PI ignores the old value and removes the stale record automatically.
|
|
139
|
+
- Use `pi --choose-tool` or `pil --choose-tool` to switch the remembered tool.
|
|
140
|
+
- You can also choose directly with `pi --choose-tool bun` or `pil --choose-tool pnpm`.
|
|
141
|
+
- Use `pi --forget-tool` or `pil --forget-tool` to clear the remembered tool.
|
|
142
|
+
- Use `pi --show-tool` or `pil --show-tool` to inspect the current tool and where that decision came from.
|
|
143
|
+
- Add `--json` to `--show-tool` when you want script-friendly output.
|
|
144
|
+
- Use `pi --list-tools` or `pil --list-tools` to inspect all detected candidates, roots, and lockfile indicators.
|
|
145
|
+
- `pci --choose-tool` and `pci --forget-tool` follow the same behavior.
|
|
146
|
+
- `pci --show-tool` follows the same behavior too.
|
|
147
|
+
- `pci --list-tools` follows the same behavior too.
|
|
148
|
+
- `pui` and `pio` will also reuse the same remembered tool when they resolve the package manager.
|
|
149
|
+
|
|
150
|
+
Examples:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
pi react --choose-tool
|
|
154
|
+
pi --choose-tool bun
|
|
155
|
+
pil --choose-tool
|
|
156
|
+
pil --choose-tool pnpm
|
|
157
|
+
pi --forget-tool
|
|
158
|
+
pil --forget-tool
|
|
159
|
+
pi --show-tool
|
|
160
|
+
pil --show-tool
|
|
161
|
+
pi --show-tool --json
|
|
162
|
+
pi --list-tools
|
|
163
|
+
pi --list-tools --json
|
|
164
|
+
pci --choose-tool
|
|
165
|
+
pci --forget-tool
|
|
166
|
+
pci --show-tool
|
|
167
|
+
pci --show-tool --json
|
|
168
|
+
pci --list-tools
|
|
169
|
+
```
|
|
170
|
+
|
|
117
171
|
## Shell Integration (prun)
|
|
118
172
|
|
|
119
173
|
```
|
|
@@ -199,7 +253,7 @@ You can configure the loading style in .zshrc, as follows:
|
|
|
199
253
|
```
|
|
200
254
|
export PI_COLOR=red # loadingstyle color
|
|
201
255
|
export PI_SPINNER=star # loadingstyle
|
|
202
|
-
export PI_DEFAULT=pnpm #
|
|
256
|
+
export PI_DEFAULT=pnpm # Used as the fallback tool when PI cannot infer a better choice for the current workspace
|
|
203
257
|
```
|
|
204
258
|
|
|
205
259
|
- 70+ types of styles, from [cli-spinners](https://jsfiddle.net/sindresorhus/2eLtsbey/embedded/result/),You can choose to fill in the name in PI_SPINNER.
|