@tmustier/pi-files-widget 0.2.1 → 0.2.2
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 +5 -0
- package/README.md +5 -1
- package/index.ts +4 -5
- package/package.json +2 -2
- package/utils.ts +13 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this extension will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [0.2.2] - 2026-10-28
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
- Suggest `brew install` only on macOS when `bat`, `delta`, or `glow` is missing, and list only the missing packages. Other systems are pointed to the install instructions in the README, which now cover Debian and Ubuntu, where `bat` installs as `batcat`. Thanks to @curious2improve for the report ([#115](https://github.com/tmustier/pi-extensions/issues/115)).
|
|
9
|
+
|
|
5
10
|
## [0.2.1] - 2026-09-22
|
|
6
11
|
|
|
7
12
|
### Changed
|
package/README.md
CHANGED
|
@@ -22,10 +22,14 @@ Required deps (needed for /readfiles):
|
|
|
22
22
|
# macOS (Homebrew)
|
|
23
23
|
brew install bat git-delta glow
|
|
24
24
|
|
|
25
|
-
# Ubuntu
|
|
25
|
+
# Debian 13+ / Ubuntu 25.04+
|
|
26
26
|
sudo apt-get install -y bat git-delta glow
|
|
27
|
+
# Debian and Ubuntu install bat as batcat; files-widget looks for bat
|
|
28
|
+
mkdir -p ~/.local/bin && ln -s /usr/bin/batcat ~/.local/bin/bat
|
|
27
29
|
```
|
|
28
30
|
|
|
31
|
+
On other systems, install [bat](https://github.com/sharkdp/bat#installation), [delta](https://dandavison.github.io/delta/installation.html), and [glow](https://github.com/charmbracelet/glow#installation) with your package manager. The `bat`, `delta`, and `glow` commands must be on your `PATH`.
|
|
32
|
+
|
|
29
33
|
```bash
|
|
30
34
|
pi install git:github.com/tmustier/pi-extensions
|
|
31
35
|
```
|
package/index.ts
CHANGED
|
@@ -12,7 +12,7 @@ import { isAbsolute, join, resolve } from "node:path";
|
|
|
12
12
|
|
|
13
13
|
import { POLL_INTERVAL_MS } from "./constants";
|
|
14
14
|
import { formatCommentMessage } from "./comment";
|
|
15
|
-
import { hasCommand } from "./utils";
|
|
15
|
+
import { hasCommand, missingCommandsMessage, REQUIRED_COMMANDS } from "./utils";
|
|
16
16
|
|
|
17
17
|
function resolveInitialPath(arg: string | undefined, cwd: string): { path: string; error?: string } {
|
|
18
18
|
if (!arg) return { path: cwd };
|
|
@@ -38,15 +38,14 @@ function resolveInitialPath(arg: string | undefined, cwd: string): { path: strin
|
|
|
38
38
|
export default function editorExtension(pi: ExtensionAPI): void {
|
|
39
39
|
const cwd = process.cwd();
|
|
40
40
|
const agentModifiedFiles = new Set<string>();
|
|
41
|
-
const
|
|
42
|
-
const getMissingDeps = () => requiredDeps.filter((dep) => !hasCommand(dep));
|
|
41
|
+
const getMissingDeps = () => REQUIRED_COMMANDS.filter((dep) => !hasCommand(dep));
|
|
43
42
|
|
|
44
43
|
pi.registerCommand("readfiles", {
|
|
45
44
|
description: "Open file browser (optional: /readfiles <path> to start outside the current directory)",
|
|
46
45
|
handler: async (args, ctx) => {
|
|
47
46
|
const missing = getMissingDeps();
|
|
48
47
|
if (missing.length > 0) {
|
|
49
|
-
ctx.ui.notify(
|
|
48
|
+
ctx.ui.notify(missingCommandsMessage(missing), "error");
|
|
50
49
|
return;
|
|
51
50
|
}
|
|
52
51
|
|
|
@@ -119,7 +118,7 @@ export default function editorExtension(pi: ExtensionAPI): void {
|
|
|
119
118
|
pi.on("session_start", async (_event, ctx) => {
|
|
120
119
|
const missing = getMissingDeps();
|
|
121
120
|
if (missing.length > 0) {
|
|
122
|
-
ctx.ui.notify(
|
|
121
|
+
ctx.ui.notify(missingCommandsMessage(missing), "error");
|
|
123
122
|
}
|
|
124
123
|
|
|
125
124
|
agentModifiedFiles.clear();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tmustier/pi-files-widget",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "In-terminal file browser and viewer for Pi.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Thomas Mustier",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"@earendil-works/pi-tui": "*"
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|
|
22
|
-
"postinstall": "node -e \"console.log('pi-files-widget: required deps: bat, delta, glow. Install with: brew install bat git-delta glow')\""
|
|
22
|
+
"postinstall": "node -e \"console.log('pi-files-widget: required deps: bat, delta, glow. ' + (process.platform === 'darwin' ? 'Install with: brew install bat git-delta glow' : 'Install instructions: https://github.com/tmustier/pi-extensions/tree/main/files-widget#install'))\""
|
|
23
23
|
},
|
|
24
24
|
"pi": {
|
|
25
25
|
"extensions": [
|
package/utils.ts
CHANGED
|
@@ -38,6 +38,19 @@ export function hasCommand(cmd: string, options: CommandLookupOptions = {}): boo
|
|
|
38
38
|
return false;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
export const REQUIRED_COMMANDS = ["bat", "delta", "glow"] as const;
|
|
42
|
+
export type RequiredCommand = (typeof REQUIRED_COMMANDS)[number];
|
|
43
|
+
|
|
44
|
+
const HOMEBREW_PACKAGES: Record<RequiredCommand, string> = { bat: "bat", delta: "git-delta", glow: "glow" };
|
|
45
|
+
const INSTALL_DOCS_URL = "https://github.com/tmustier/pi-extensions/tree/main/files-widget#install";
|
|
46
|
+
|
|
47
|
+
export function missingCommandsMessage(missing: readonly RequiredCommand[], platform: NodeJS.Platform = process.platform): string {
|
|
48
|
+
const install = platform === "darwin"
|
|
49
|
+
? `Install: brew install ${missing.map((command) => HOMEBREW_PACKAGES[command]).join(" ")}`
|
|
50
|
+
: `Install with your package manager: ${INSTALL_DOCS_URL}`;
|
|
51
|
+
return `files-widget requires ${missing.join(", ")}. ${install}`;
|
|
52
|
+
}
|
|
53
|
+
|
|
41
54
|
export function isUntrackedStatus(status?: string): boolean {
|
|
42
55
|
return status === "?" || status === "??";
|
|
43
56
|
}
|