@heyhuynhgiabuu/pi-pretty 0.6.15 → 0.6.17
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 +19 -116
- package/README.md +8 -16
- package/dist/collapsed-hint.d.ts +7 -0
- package/dist/collapsed-hint.d.ts.map +1 -0
- package/dist/collapsed-hint.js +17 -0
- package/dist/collapsed-hint.js.map +1 -0
- package/dist/config.d.ts +3 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +64 -19
- package/dist/config.js.map +1 -1
- package/dist/expand.d.ts +7 -0
- package/dist/expand.d.ts.map +1 -0
- package/dist/expand.js +11 -0
- package/dist/expand.js.map +1 -0
- package/dist/find-glob.d.ts +9 -0
- package/dist/find-glob.d.ts.map +1 -0
- package/dist/find-glob.js +29 -0
- package/dist/find-glob.js.map +1 -0
- package/dist/image.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -19
- package/dist/index.js.map +1 -1
- package/dist/render.d.ts +3 -5
- package/dist/render.d.ts.map +1 -1
- package/dist/render.js +24 -19
- package/dist/render.js.map +1 -1
- package/dist/tools/bash.d.ts +1 -1
- package/dist/tools/bash.d.ts.map +1 -1
- package/dist/tools/bash.js +22 -26
- package/dist/tools/bash.js.map +1 -1
- package/dist/tools/find.d.ts +3 -3
- package/dist/tools/find.d.ts.map +1 -1
- package/dist/tools/find.js +99 -50
- package/dist/tools/find.js.map +1 -1
- package/dist/tools/grep.d.ts +2 -2
- package/dist/tools/grep.d.ts.map +1 -1
- package/dist/tools/grep.js +12 -8
- package/dist/tools/grep.js.map +1 -1
- package/dist/tools/labels.d.ts +2 -0
- package/dist/tools/labels.d.ts.map +1 -0
- package/dist/tools/labels.js +7 -0
- package/dist/tools/labels.js.map +1 -0
- package/dist/tools/ls.d.ts +1 -1
- package/dist/tools/ls.d.ts.map +1 -1
- package/dist/tools/ls.js +9 -5
- package/dist/tools/ls.js.map +1 -1
- package/dist/tools/read.d.ts +1 -1
- package/dist/tools/read.d.ts.map +1 -1
- package/dist/tools/read.js +34 -48
- package/dist/tools/read.js.map +1 -1
- package/dist/tui-text.d.ts.map +1 -1
- package/dist/tui-text.js +1 -5
- package/dist/tui-text.js.map +1 -1
- package/dist/types.d.ts +4 -27
- package/dist/types.d.ts.map +1 -1
- package/package.json +5 -4
- package/src/collapsed-hint.ts +14 -0
- package/src/config.ts +70 -22
- package/src/expand.ts +10 -0
- package/src/find-glob.ts +21 -0
- package/src/image.ts +1 -1
- package/src/index.ts +25 -32
- package/src/notices.ts +1 -1
- package/src/render.ts +50 -41
- package/src/tools/bash.ts +27 -48
- package/src/tools/find.ts +131 -86
- package/src/tools/grep.ts +23 -17
- package/src/tools/labels.ts +3 -0
- package/src/tools/ls.ts +27 -13
- package/src/tools/metrics.ts +1 -1
- package/src/tools/read.ts +55 -66
- package/src/tui-text.ts +1 -5
- package/src/types.ts +4 -35
- package/dist/multi-grep-fallback.d.ts +0 -30
- package/dist/multi-grep-fallback.d.ts.map +0 -1
- package/dist/multi-grep-fallback.js +0 -205
- package/dist/multi-grep-fallback.js.map +0 -1
- package/dist/tools/multi-grep.d.ts +0 -7
- package/dist/tools/multi-grep.d.ts.map +0 -1
- package/dist/tools/multi-grep.js +0 -294
- package/dist/tools/multi-grep.js.map +0 -1
- package/src/multi-grep-fallback.ts +0 -248
- package/src/tools/multi-grep.ts +0 -331
package/CHANGELOG.md
CHANGED
|
@@ -1,133 +1,36 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## [0.6.
|
|
4
|
-
|
|
5
|
-
### Added
|
|
6
|
-
|
|
7
|
-
- **Bash** — `promptSnippet` and `promptGuidelines` added to encourage `rg -n` over
|
|
8
|
-
`grep` and document Rust regex alternation syntax (`|` = OR, `\|` = literal pipe).
|
|
9
|
-
|
|
10
|
-
## [0.6.12] - 2026-06-21
|
|
11
|
-
|
|
12
|
-
### Fixed
|
|
13
|
-
|
|
14
|
-
- **Published install resume crash on Pi 0.79.9** — remove the nested runtime
|
|
15
|
-
`@earendil-works/pi-coding-agent` dependency from published installs and make
|
|
16
|
-
FFF startup independent from the optional SDK tool-factory import. Published
|
|
17
|
-
extensions should not load a second Pi host runtime inside the Pi process.
|
|
18
|
-
|
|
19
|
-
- **FFF native teardown during resume/session switching** — stop destroying the
|
|
20
|
-
native FFF finder in `session_shutdown`; Pi can emit shutdown/start while the
|
|
21
|
-
same process continues, and native teardown in that transition is too risky.
|
|
22
|
-
|
|
23
|
-
## [0.6.11] - 2026-06-21
|
|
24
|
-
|
|
25
|
-
### Fixed
|
|
26
|
-
|
|
27
|
-
- **Pi resume crash with v0.6.10 on Pi 0.79.9** — `v0.6.10` promoted
|
|
28
|
-
`@earendil-works/pi-coding-agent` to a runtime dependency but kept the old
|
|
29
|
-
`^0.75.1` range. Published installs could therefore load a nested older Pi SDK
|
|
30
|
-
inside a Pi `0.79.9` host process during extension activation/resume.
|
|
31
|
-
|
|
32
|
-
Fix: align the runtime SDK dependency with Pi `0.79.9` and refresh the lockfile.
|
|
33
|
-
|
|
34
|
-
## [0.6.10] - 2026-06-21
|
|
35
|
-
|
|
36
|
-
### Fixed
|
|
37
|
-
|
|
38
|
-
- **Published npm extension did not register pretty tools or FFF commands** — the
|
|
39
|
-
extension dynamically imports `@earendil-works/pi-coding-agent` at activation time
|
|
40
|
-
to build the wrapped built-in tool definitions. Local development had that package
|
|
41
|
-
from `devDependencies`, but isolated Pi npm extension installs only install runtime
|
|
42
|
-
dependencies. The activation import failed, so published installs could silently
|
|
43
|
-
skip registering `find`, `grep`, `/fff-health`, `/fff-rescan`, and FFF indexing.
|
|
3
|
+
## [0.6.17] - 2026-07-11
|
|
44
4
|
|
|
45
|
-
|
|
46
|
-
published npm installs can activate the extension the same way local installs do.
|
|
5
|
+
### Changed
|
|
47
6
|
|
|
48
|
-
|
|
7
|
+
- Simplified tool headers: icon-prefixed `find`, `grep`, and `read` labels; cleaner bash result metadata and spacing.
|
|
8
|
+
- Disabled `ls` by default; removed the `multi_grep` custom tool.
|
|
9
|
+
- Added `customToolTitle()` for future pi-pretty custom tools (`⚙ <name>`).
|
|
49
10
|
|
|
50
11
|
### Fixed
|
|
51
12
|
|
|
52
|
-
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
`typebox` as a runtime dependency, so clean published installs could crash before
|
|
56
|
-
session handlers ran.
|
|
13
|
+
- `find` renders matching paths instead of `(no matches)` when results exist.
|
|
14
|
+
- `read` uses native Pi TUI image rendering, with terminal fallback and success/error backgrounds.
|
|
15
|
+
- Failed `find`, `grep`, and `read` call headers use the error theme color.
|
|
57
16
|
|
|
58
|
-
|
|
59
|
-
extension installs include the module.
|
|
17
|
+
## [0.6.16] - 2026-07-01
|
|
60
18
|
|
|
61
|
-
|
|
19
|
+
### Changed
|
|
62
20
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
- **
|
|
66
|
-
|
|
67
|
-
registration. In pi installations that don't alias pi-tui (e.g. `pikit` project),
|
|
68
|
-
this crashed the extension before it could load.
|
|
69
|
-
|
|
70
|
-
Fix: introduced `src/tui-text.ts` with a lazy `resolveTextCtor()` function that
|
|
71
|
-
catches the missing-module error and returns a no-op stub Text class. All six
|
|
72
|
-
tool files (`bash.ts`, `find.ts`, `grep.ts`, `ls.ts`, `multi-grep.ts`,
|
|
73
|
-
`read.ts`) now use this instead of the eager IIFE.
|
|
74
|
-
|
|
75
|
-
## [0.6.7] - 2026-06-21
|
|
76
|
-
|
|
77
|
-
### Fixed
|
|
78
|
-
|
|
79
|
-
- **Module loading crash before factory execution** — The v0.6.6 fix wrapped
|
|
80
|
-
`import("@earendil-works/pi-coding-agent")` in a try-catch block inside the
|
|
81
|
-
extension factory, but two files (`src/tools/grep.ts` and `src/render.ts`) had
|
|
82
|
-
**top-level value imports** from `@earendil-works/pi-coding-agent` (`keyHint`)
|
|
83
|
-
and `@earendil-works/pi-tui` (`truncateToWidth`). These compiled to top-level
|
|
84
|
-
`require()` calls that executed during **jiti module loading** (before the
|
|
85
|
-
factory), causing the extension to crash before the try-catch could fire.
|
|
86
|
-
|
|
87
|
-
Fix:
|
|
88
|
-
- `grep.ts`: replaced `import { keyHint }` with inline fallback text
|
|
89
|
-
- `render.ts`: replaced `import { truncateToWidth }` with lazy `require()`
|
|
90
|
-
inside a helper function (avoids top-level evaluation)
|
|
91
|
-
|
|
92
|
-
## [0.6.6] - 2026-06-21
|
|
21
|
+
- Pi **0.80.3** alignment: `peerDependencies` and dev dependencies on `@earendil-works/pi-coding-agent` `^0.80.0` / `^0.80.3`; `@earendil-works/pi-ai` `^0.80.0`.
|
|
22
|
+
- Tool result body indent: **one** leading space (`TOOL_RESULT_INDENT`) instead of two across read/bash/grep/ls/find/diff render paths.
|
|
23
|
+
- **Default collapsed tool output**: `toolOutputExpanded: false` on session start so result bodies are hidden until you expand (Pi **ctrl+o** / `app.tools.expand`, **Ctrl+Shift+O** expand all — see [Pi keybindings](https://pi.dev/docs/latest/keybindings)).
|
|
24
|
+
- **`find` tool**: normalize bare globs (`*.ts` → `**/*.ts`); keep `**/*` (no `*` collapse); when FFF `glob` returns 0 for a glob pattern, fall back to SDK **find (fd)**; surface engine in `details.notices` (FFF / SDK / weak-match).
|
|
93
25
|
|
|
94
26
|
### Fixed
|
|
95
27
|
|
|
96
|
-
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
CJS interop for ESM modules. The pi-ai package only has `"import"` conditions in
|
|
100
|
-
its `exports` map for subpath exports like `./base`. CJS resolution can't match
|
|
101
|
-
`"import"` conditions and falls back to legacy resolution — treating the main
|
|
102
|
-
entry `./dist/index.js` as a directory and appending `/base`, resulting in:
|
|
103
|
-
`Cannot find module '.../pi-ai/dist/index.js/base'`.
|
|
28
|
+
- `fillToolBackground`: skip extra width padding when a line already has `TOOL_RESULT_INDENT` (including after ANSI SGR prefixes).
|
|
29
|
+
- `bash` `renderCall`: no ellipsis on command when expanded; collapsed headers clip to terminal width.
|
|
30
|
+
- `read` image paths use core `convertToPng` (BMP and other rasters), matching Pi 0.80.3 built-in read behavior.
|
|
104
31
|
|
|
105
|
-
|
|
106
|
-
correctly resolves ESM subpath exports through the package's `exports` map.
|
|
107
|
-
The function signature was changed to `async` to support this.
|
|
108
|
-
|
|
109
|
-
## [0.6.5] - 2026-06-16
|
|
110
|
-
|
|
111
|
-
### Fixed
|
|
112
|
-
|
|
113
|
-
- **npm package missing dist/** — `.gitignore` excluded `dist/` from the published
|
|
114
|
-
npm package (`dist/` is in `.gitignore`, which npm uses as `.npmignore` by default
|
|
115
|
-
when no `.npmignore` exists). Pi could only see TypeScript source files, not compiled
|
|
116
|
-
JavaScript. The extension loaded but FFF service never initialized.
|
|
117
|
-
|
|
118
|
-
Fix: added `"files": ["dist/", "CHANGELOG.md", "src/"]` and `"main": "dist/index.js"`
|
|
119
|
-
to package.json to explicitly include compiled output in the published package.
|
|
120
|
-
|
|
121
|
-
## [0.6.4] - 2026-06-16
|
|
32
|
+
## [0.6.15] - 2026-06-26
|
|
122
33
|
|
|
123
34
|
### Fixed
|
|
124
35
|
|
|
125
|
-
-
|
|
126
|
-
which fails because the package is ESM-only (only `"import"` export, no `"require"`).
|
|
127
|
-
The async `import()` fallback never resolved before tool registration, leaving
|
|
128
|
-
`fffService` permanently `null`. Tool execution never loaded FFF.
|
|
129
|
-
|
|
130
|
-
Fix: always create `FffService(undefined, agentDir)` during activation. The
|
|
131
|
-
`tryLoadModule()` in the tool execution handler uses `await import()` which
|
|
132
|
-
correctly loads the ESM-only package. The broken synchronous `require()` +
|
|
133
|
-
orphaned `.then()` pattern is removed.
|
|
36
|
+
- `read` image attachments: `mimeType` is now `image/png` when the file is converted to PNG (e.g. BMP), so Kitty/iTerm inline previews work instead of showing a path-only placeholder.
|
package/README.md
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
|
|
6
6
|
A [pi](https://pi.dev) extension that upgrades built-in tool output in the terminal and includes built-in FFF-powered search for `find`/`grep`.
|
|
7
7
|
|
|
8
|
+
Tool **result bodies** start **collapsed** (header + line count). Use Pi **Ctrl+O** (`app.tools.expand`) on a tool block to show full output; **Ctrl+Shift+O** expands all. See [Pi keybindings](https://pi.dev/docs/latest/keybindings).
|
|
9
|
+
|
|
8
10
|
It currently enhances:
|
|
9
11
|
|
|
10
12
|
- **`read`**: syntax-highlighted text previews with line numbers, plus inline image rendering when the terminal supports it
|
|
@@ -98,20 +100,7 @@ read path="src/index.ts"
|
|
|
98
100
|
ls path="src"
|
|
99
101
|
```
|
|
100
102
|
|
|
101
|
-
### 4.
|
|
102
|
-
|
|
103
|
-
`multi_grep` is bundled on top of FFF and is useful when you want any of several patterns:
|
|
104
|
-
|
|
105
|
-
```text
|
|
106
|
-
multi_grep patterns=["handleRequest","handle_request","HandleRequest"] constraints="*.ts"
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
Good uses:
|
|
110
|
-
- find several naming variants at once
|
|
111
|
-
- search related symbols in one pass
|
|
112
|
-
- replace slow regex alternation with literal OR matching
|
|
113
|
-
|
|
114
|
-
### 5. Check FFF status or force a rescan
|
|
103
|
+
### 4. Check FFF status or force a rescan
|
|
115
104
|
|
|
116
105
|
pi-pretty also provides two maintenance commands:
|
|
117
106
|
|
|
@@ -128,7 +117,7 @@ Use them when:
|
|
|
128
117
|
### Notes
|
|
129
118
|
|
|
130
119
|
- `find` results are frecency-aware, so files you touch more often can bubble up earlier.
|
|
131
|
-
- `grep`
|
|
120
|
+
- `grep` can show a cursor notice when more results are available.
|
|
132
121
|
- If you see a partial index warning, let the session settle or run `/fff-rescan`.
|
|
133
122
|
|
|
134
123
|
## Configuration
|
|
@@ -161,10 +150,13 @@ Optional environment variables:
|
|
|
161
150
|
- `PRETTY_MAX_PREVIEW_LINES` (default: `80`)
|
|
162
151
|
- `PRETTY_CACHE_LIMIT` (default: `128`)
|
|
163
152
|
- `PRETTY_ICONS` (`nerd` by default, set to `none` to disable icons)
|
|
164
|
-
- `PRETTY_DISABLE_TOOLS` — comma-separated list of tool names to skip during registration (e.g. `read,grep`).
|
|
153
|
+
- `PRETTY_DISABLE_TOOLS` — comma-separated list of tool names to skip during registration (e.g. `read,grep`). Explicit disables take precedence over enabled defaults.
|
|
154
|
+
- `PRETTY_ENABLE_TOOLS` — comma-separated list of opt-in tools. `ls` is disabled by default; set `PRETTY_ENABLE_TOOLS=ls` to register it.
|
|
165
155
|
|
|
166
156
|
## Development
|
|
167
157
|
|
|
158
|
+
Future pi-pretty custom-tool renderers should use `customToolTitle(name)` from `src/tools/labels.ts`; it returns `⚙ <name>`. Built-in tool replacements keep their own labels.
|
|
159
|
+
|
|
168
160
|
```bash
|
|
169
161
|
npm install
|
|
170
162
|
npm run typecheck
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Shown in collapsed tool results; Pi keybinding is still `app.tools.expand` (Ctrl+O). */
|
|
2
|
+
export declare const COLLAPSED_EXPAND_LABEL = "ctrl+o to expand";
|
|
3
|
+
/** Collapsed hint line (no extra blank lines above/below). */
|
|
4
|
+
export declare function collapsedExpandBlock(countLabel: string): string;
|
|
5
|
+
/** When line count / metrics already appear on the header line (bash). */
|
|
6
|
+
export declare function collapsedExpandFooter(): string;
|
|
7
|
+
//# sourceMappingURL=collapsed-hint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collapsed-hint.d.ts","sourceRoot":"","sources":["../src/collapsed-hint.ts"],"names":[],"mappings":"AAEA,2FAA2F;AAC3F,eAAO,MAAM,sBAAsB,qBAAqB,CAAC;AAEzD,8DAA8D;AAC9D,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAE/D;AAED,0EAA0E;AAC1E,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.COLLAPSED_EXPAND_LABEL = void 0;
|
|
4
|
+
exports.collapsedExpandBlock = collapsedExpandBlock;
|
|
5
|
+
exports.collapsedExpandFooter = collapsedExpandFooter;
|
|
6
|
+
const config_js_1 = require("./config.js");
|
|
7
|
+
/** Shown in collapsed tool results; Pi keybinding is still `app.tools.expand` (Ctrl+O). */
|
|
8
|
+
exports.COLLAPSED_EXPAND_LABEL = "ctrl+o to expand";
|
|
9
|
+
/** Collapsed hint line (no extra blank lines above/below). */
|
|
10
|
+
function collapsedExpandBlock(countLabel) {
|
|
11
|
+
return `${config_js_1.TOOL_RESULT_INDENT}${config_js_1.FG_DIM}${countLabel} — ${exports.COLLAPSED_EXPAND_LABEL}${config_js_1.RST}\n`;
|
|
12
|
+
}
|
|
13
|
+
/** When line count / metrics already appear on the header line (bash). */
|
|
14
|
+
function collapsedExpandFooter() {
|
|
15
|
+
return `${config_js_1.TOOL_RESULT_INDENT}${config_js_1.FG_DIM}${exports.COLLAPSED_EXPAND_LABEL}${config_js_1.RST}\n`;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=collapsed-hint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collapsed-hint.js","sourceRoot":"","sources":["../src/collapsed-hint.ts"],"names":[],"mappings":";;;AAMA,oDAEC;AAGD,sDAEC;AAbD,2CAA8D;AAE9D,2FAA2F;AAC9E,QAAA,sBAAsB,GAAG,kBAAkB,CAAC;AAEzD,8DAA8D;AAC9D,SAAgB,oBAAoB,CAAC,UAAkB;IACtD,OAAO,GAAG,8BAAkB,GAAG,kBAAM,GAAG,UAAU,MAAM,8BAAsB,GAAG,eAAG,IAAI,CAAC;AAC1F,CAAC;AAED,0EAA0E;AAC1E,SAAgB,qBAAqB;IACpC,OAAO,GAAG,8BAAkB,GAAG,kBAAM,GAAG,8BAAsB,GAAG,eAAG,IAAI,CAAC;AAC1E,CAAC"}
|
package/dist/config.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* pi-pretty: ANSI codes, icons, theme, and environment config.
|
|
3
3
|
*/
|
|
4
|
+
/** Left indent for rendered tool result lines (was two spaces; one matches tighter TUI layout). */
|
|
5
|
+
export declare const TOOL_RESULT_INDENT = " ";
|
|
4
6
|
export declare let RST: string;
|
|
5
7
|
export declare const FG_LNUM = "\u001B[38;2;100;100;100m";
|
|
6
8
|
export declare const FG_DIM = "\u001B[38;2;80;80;80m";
|
|
@@ -14,6 +16,7 @@ export declare let BG_BASE: string;
|
|
|
14
16
|
export declare let BG_ERROR: string;
|
|
15
17
|
type BgThemeLike = {
|
|
16
18
|
getBgAnsi?: (key: string) => string;
|
|
19
|
+
bg?: (key: string, text: string) => string;
|
|
17
20
|
};
|
|
18
21
|
export declare function resolveBaseBackground(theme: BgThemeLike | null | undefined): void;
|
|
19
22
|
export declare function termWidth(): number;
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AASH,eAAO,IAAI,GAAG,QAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AASH,mGAAmG;AACnG,eAAO,MAAM,kBAAkB,MAAM,CAAC;AAEtC,eAAO,IAAI,GAAG,QAAY,CAAC;AAE3B,eAAO,MAAM,OAAO,6BAA2B,CAAC;AAChD,eAAO,MAAM,MAAM,0BAAwB,CAAC;AAC5C,eAAO,MAAM,OAAO,0BAAwB,CAAC;AAC7C,eAAO,MAAM,QAAQ,6BAA2B,CAAC;AACjD,eAAO,MAAM,MAAM,6BAA2B,CAAC;AAC/C,eAAO,MAAM,SAAS,4BAA0B,CAAC;AACjD,eAAO,MAAM,OAAO,6BAA2B,CAAC;AAChD,eAAO,MAAM,QAAQ,6BAA2B,CAAC;AAGjD,eAAO,IAAI,OAAO,QAAa,CAAC;AAChC,eAAO,IAAI,QAAQ,QAAa,CAAC;AAMjC,KAAK,WAAW,GAAG;IAClB,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;IACpC,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CAC3C,CAAC;AAyEF,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,CAYjF;AAMD,wBAAgB,SAAS,IAAI,MAAM,CAOlC;AAOD,eAAO,MAAM,SAAS,SAAgD,CAAC;AAEvE,eAAO,MAAM,MAAM,QAA2B,CAAC;AAC/C,eAAO,MAAM,UAAU,QAA0B,CAAC;AA4DlD,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAM3C;AAED,wBAAgB,OAAO,IAAI,MAAM,CAEhC;AAMD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAkD7C,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAKlE;AAMD,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAG7D;AAED,eAAO,MAAM,YAAY,QAAwC,CAAC;AAClE,eAAO,MAAM,iBAAiB,QAAyC,CAAC;AACxE,eAAO,MAAM,WAAW,QAAoC,CAAC;AAM7D,wBAAgB,kBAAkB,IAAI,MAAM,GAAG,SAAS,CAGvD"}
|
package/dist/config.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* pi-pretty: ANSI codes, icons, theme, and environment config.
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.CACHE_LIMIT = exports.MAX_PREVIEW_LINES = exports.MAX_HL_CHARS = exports.NF_DEFAULT = exports.NF_DIR = exports.USE_ICONS = exports.BG_ERROR = exports.BG_BASE = exports.FG_MUTED = exports.FG_BLUE = exports.FG_YELLOW = exports.FG_RED = exports.FG_GREEN = exports.FG_RULE = exports.FG_DIM = exports.FG_LNUM = exports.RST = void 0;
|
|
6
|
+
exports.CACHE_LIMIT = exports.MAX_PREVIEW_LINES = exports.MAX_HL_CHARS = exports.NF_DEFAULT = exports.NF_DIR = exports.USE_ICONS = exports.BG_ERROR = exports.BG_BASE = exports.FG_MUTED = exports.FG_BLUE = exports.FG_YELLOW = exports.FG_RED = exports.FG_GREEN = exports.FG_RULE = exports.FG_DIM = exports.FG_LNUM = exports.RST = exports.TOOL_RESULT_INDENT = void 0;
|
|
7
7
|
exports.resolveBaseBackground = resolveBaseBackground;
|
|
8
8
|
exports.termWidth = termWidth;
|
|
9
9
|
exports.fileIcon = fileIcon;
|
|
@@ -16,8 +16,9 @@ const node_path_1 = require("node:path");
|
|
|
16
16
|
// ---------------------------------------------------------------------------
|
|
17
17
|
// ANSI
|
|
18
18
|
// ---------------------------------------------------------------------------
|
|
19
|
+
/** Left indent for rendered tool result lines (was two spaces; one matches tighter TUI layout). */
|
|
20
|
+
exports.TOOL_RESULT_INDENT = " ";
|
|
19
21
|
exports.RST = "\x1b[0m";
|
|
20
|
-
const BOLD = "\x1b[1m";
|
|
21
22
|
exports.FG_LNUM = "\x1b[38;2;100;100;100m";
|
|
22
23
|
exports.FG_DIM = "\x1b[38;2;80;80;80m";
|
|
23
24
|
exports.FG_RULE = "\x1b[38;2;50;50;50m";
|
|
@@ -36,8 +37,14 @@ function parseAnsiRgb(ansi) {
|
|
|
36
37
|
}
|
|
37
38
|
function getThemeBgAnsi(theme, key) {
|
|
38
39
|
try {
|
|
39
|
-
const
|
|
40
|
-
|
|
40
|
+
const direct = theme.getBgAnsi?.(key);
|
|
41
|
+
if (direct && parseAnsiRgb(direct))
|
|
42
|
+
return direct;
|
|
43
|
+
const marker = "\0";
|
|
44
|
+
const styled = theme.bg?.(key, marker);
|
|
45
|
+
const markerIndex = styled?.indexOf(marker) ?? -1;
|
|
46
|
+
const ansi = markerIndex > 0 ? styled?.slice(0, markerIndex) : null;
|
|
47
|
+
return ansi && parseAnsiRgb(ansi) ? ansi : null;
|
|
41
48
|
}
|
|
42
49
|
catch {
|
|
43
50
|
return null;
|
|
@@ -92,9 +99,13 @@ function resolveBaseBackground(theme) {
|
|
|
92
99
|
const configDir = process.env.PRETTY_CONFIG_DIR ?? (home ? (0, node_path_1.join)(home, ".pi/agent") : undefined);
|
|
93
100
|
if (applyPrettyConfigBg(configDir))
|
|
94
101
|
return;
|
|
95
|
-
if (!theme?.getBgAnsi)
|
|
102
|
+
if (!theme?.getBgAnsi && !theme?.bg)
|
|
96
103
|
return;
|
|
97
|
-
exports.BG_BASE =
|
|
104
|
+
exports.BG_BASE =
|
|
105
|
+
getThemeBgAnsi(theme, "toolSuccessBg") ??
|
|
106
|
+
getThemeBgAnsi(theme, "toolBg") ??
|
|
107
|
+
getThemeBgAnsi(theme, "background") ??
|
|
108
|
+
BG_DEFAULT;
|
|
98
109
|
exports.BG_ERROR = getThemeBgAnsi(theme, "toolErrorBg") ?? exports.BG_BASE;
|
|
99
110
|
exports.RST = "\x1b[0m";
|
|
100
111
|
}
|
|
@@ -105,7 +116,8 @@ function termWidth() {
|
|
|
105
116
|
if (process.stdout.columns)
|
|
106
117
|
return Math.max(1, Math.min(process.stdout.columns, 210));
|
|
107
118
|
const raw = process.stderr.columns ||
|
|
108
|
-
Number.parseInt(process.env.COLUMNS ?? "", 10) ||
|
|
119
|
+
Number.parseInt(process.env.COLUMNS ?? "", 10) ||
|
|
120
|
+
200;
|
|
109
121
|
return Math.max(1, Math.min(raw - 4, 210));
|
|
110
122
|
}
|
|
111
123
|
// ---------------------------------------------------------------------------
|
|
@@ -184,18 +196,51 @@ function dirIcon() {
|
|
|
184
196
|
return exports.USE_ICONS ? `${exports.NF_DIR} ` : "";
|
|
185
197
|
}
|
|
186
198
|
const EXT_LANG = {
|
|
187
|
-
ts: "typescript",
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
+
ts: "typescript",
|
|
200
|
+
tsx: "tsx",
|
|
201
|
+
js: "javascript",
|
|
202
|
+
jsx: "jsx",
|
|
203
|
+
mjs: "javascript",
|
|
204
|
+
cjs: "javascript",
|
|
205
|
+
py: "python",
|
|
206
|
+
rb: "ruby",
|
|
207
|
+
rs: "rust",
|
|
208
|
+
go: "go",
|
|
209
|
+
java: "java",
|
|
210
|
+
c: "c",
|
|
211
|
+
cpp: "cpp",
|
|
212
|
+
h: "c",
|
|
213
|
+
hpp: "cpp",
|
|
214
|
+
cs: "csharp",
|
|
215
|
+
swift: "swift",
|
|
216
|
+
kt: "kotlin",
|
|
217
|
+
html: "html",
|
|
218
|
+
css: "css",
|
|
219
|
+
scss: "scss",
|
|
220
|
+
less: "css",
|
|
221
|
+
json: "json",
|
|
222
|
+
jsonc: "jsonc",
|
|
223
|
+
yaml: "yaml",
|
|
224
|
+
yml: "yaml",
|
|
225
|
+
toml: "toml",
|
|
226
|
+
md: "markdown",
|
|
227
|
+
mdx: "mdx",
|
|
228
|
+
sql: "sql",
|
|
229
|
+
sh: "bash",
|
|
230
|
+
bash: "bash",
|
|
231
|
+
zsh: "bash",
|
|
232
|
+
lua: "lua",
|
|
233
|
+
php: "php",
|
|
234
|
+
dart: "dart",
|
|
235
|
+
xml: "xml",
|
|
236
|
+
graphql: "graphql",
|
|
237
|
+
svelte: "svelte",
|
|
238
|
+
vue: "vue",
|
|
239
|
+
dockerfile: "dockerfile",
|
|
240
|
+
makefile: "make",
|
|
241
|
+
zig: "zig",
|
|
242
|
+
nim: "nim",
|
|
243
|
+
elixir: "elixir",
|
|
199
244
|
};
|
|
200
245
|
function detectLang(fp) {
|
|
201
246
|
const base = (0, node_path_1.basename)(fp).toLowerCase();
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";AAAA;;GAEG;;;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AA2GH,sDAYC;AAMD,8BAOC;AAsED,4BAMC;AAED,0BAEC;AAwDD,gCAKC;AAMD,wBAGC;AAUD,gDAGC;AArSD,qCAAuC;AACvC,yCAAoD;AAEpD,8EAA8E;AAC9E,OAAO;AACP,8EAA8E;AAE9E,mGAAmG;AACtF,QAAA,kBAAkB,GAAG,GAAG,CAAC;AAE3B,QAAA,GAAG,GAAG,SAAS,CAAC;AAEd,QAAA,OAAO,GAAG,wBAAwB,CAAC;AACnC,QAAA,MAAM,GAAG,qBAAqB,CAAC;AAC/B,QAAA,OAAO,GAAG,qBAAqB,CAAC;AAChC,QAAA,QAAQ,GAAG,wBAAwB,CAAC;AACpC,QAAA,MAAM,GAAG,wBAAwB,CAAC;AAClC,QAAA,SAAS,GAAG,uBAAuB,CAAC;AACpC,QAAA,OAAO,GAAG,wBAAwB,CAAC;AACnC,QAAA,QAAQ,GAAG,wBAAwB,CAAC;AAEjD,MAAM,UAAU,GAAG,UAAU,CAAC;AACnB,QAAA,OAAO,GAAG,UAAU,CAAC;AACrB,QAAA,QAAQ,GAAG,UAAU,CAAC;AAWjC,MAAM,MAAM,GAAG,QAAQ,CAAC;AAExB,SAAS,YAAY,CAAC,IAAY;IACjC,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,GAAG,MAAM,sCAAsC,CAAC,CAAC,CAAC;IAClF,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAA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G,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;IACvD,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;AACnD,CAAC;AAEY,QAAA,YAAY,GAAG,MAAM,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;AACrD,QAAA,iBAAiB,GAAG,MAAM,CAAC,0BAA0B,EAAE,EAAE,CAAC,CAAC;AAC3D,QAAA,WAAW,GAAG,MAAM,CAAC,oBAAoB,EAAE,GAAG,CAAC,CAAC;AAE7D,8EAA8E;AAC9E,0BAA0B;AAC1B,8EAA8E;AAE9E,SAAgB,kBAAkB;IACjC,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC;IACpC,OAAO,IAAI,CAAC,CAAC,CAAC,IAAA,gBAAI,EAAC,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACnD,CAAC"}
|
package/dist/expand.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Render context from pi tool UI (Ctrl+O toggles `expanded` per tool block). */
|
|
2
|
+
export type ToolRenderCtx = {
|
|
3
|
+
expanded?: boolean;
|
|
4
|
+
};
|
|
5
|
+
/** Lines to show in tool result body when collapsed vs expanded. */
|
|
6
|
+
export declare function previewLineCount(ctx: ToolRenderCtx, totalLines: number): number;
|
|
7
|
+
//# sourceMappingURL=expand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expand.d.ts","sourceRoot":"","sources":["../src/expand.ts"],"names":[],"mappings":"AAEA,iFAAiF;AACjF,MAAM,MAAM,aAAa,GAAG;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEnD,oEAAoE;AACpE,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAG/E"}
|
package/dist/expand.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.previewLineCount = previewLineCount;
|
|
4
|
+
const config_js_1 = require("./config.js");
|
|
5
|
+
/** Lines to show in tool result body when collapsed vs expanded. */
|
|
6
|
+
function previewLineCount(ctx, totalLines) {
|
|
7
|
+
if (ctx.expanded)
|
|
8
|
+
return totalLines;
|
|
9
|
+
return Math.min(totalLines, config_js_1.MAX_PREVIEW_LINES);
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=expand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expand.js","sourceRoot":"","sources":["../src/expand.ts"],"names":[],"mappings":";;AAMA,4CAGC;AATD,2CAAgD;AAKhD,oEAAoE;AACpE,SAAgB,gBAAgB,CAAC,GAAkB,EAAE,UAAkB;IACtE,IAAI,GAAG,CAAC,QAAQ;QAAE,OAAO,UAAU,CAAC;IACpC,OAAO,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,6BAAiB,CAAC,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Glob normalization for FFF glob() (repo-relative paths).
|
|
3
|
+
* Aligns with Pi SDK find: bare *.ts searches under cwd recursively.
|
|
4
|
+
*/
|
|
5
|
+
/** Do not collapse double-star-slash-star to single star. */
|
|
6
|
+
export declare function normalizeFindGlobPattern(pattern: string): string;
|
|
7
|
+
/** Patterns where an empty FFF result is suspicious — try SDK find (fd). */
|
|
8
|
+
export declare function isLikelyGlobPattern(pattern: string): boolean;
|
|
9
|
+
//# sourceMappingURL=find-glob.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-glob.d.ts","sourceRoot":"","sources":["../src/find-glob.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,6DAA6D;AAC7D,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAOhE;AAED,4EAA4E;AAC5E,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAI5D"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Glob normalization for FFF glob() (repo-relative paths).
|
|
4
|
+
* Aligns with Pi SDK find: bare *.ts searches under cwd recursively.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.normalizeFindGlobPattern = normalizeFindGlobPattern;
|
|
8
|
+
exports.isLikelyGlobPattern = isLikelyGlobPattern;
|
|
9
|
+
/** Do not collapse double-star-slash-star to single star. */
|
|
10
|
+
function normalizeFindGlobPattern(pattern) {
|
|
11
|
+
const p = pattern.trim();
|
|
12
|
+
if (!p)
|
|
13
|
+
return p;
|
|
14
|
+
if (p === "**/*")
|
|
15
|
+
return "**/*";
|
|
16
|
+
if (p.includes("/") || p.startsWith("**/"))
|
|
17
|
+
return p;
|
|
18
|
+
if (/[*?[\]]/.test(p))
|
|
19
|
+
return `**/${p}`;
|
|
20
|
+
return p;
|
|
21
|
+
}
|
|
22
|
+
/** Patterns where an empty FFF result is suspicious — try SDK find (fd). */
|
|
23
|
+
function isLikelyGlobPattern(pattern) {
|
|
24
|
+
const p = pattern.trim();
|
|
25
|
+
if (!p)
|
|
26
|
+
return false;
|
|
27
|
+
return /[*?[\]]/.test(p) || p === "**/*" || p.startsWith("**/");
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=find-glob.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-glob.js","sourceRoot":"","sources":["../src/find-glob.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAGH,4DAOC;AAGD,kDAIC;AAfD,6DAA6D;AAC7D,SAAgB,wBAAwB,CAAC,OAAe;IACvD,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IACzB,IAAI,CAAC,CAAC;QAAE,OAAO,CAAC,CAAC;IACjB,IAAI,CAAC,KAAK,MAAM;QAAE,OAAO,MAAM,CAAC;IAChC,IAAI,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC;IACrD,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;QAAE,OAAO,MAAM,CAAC,EAAE,CAAC;IACxC,OAAO,CAAC,CAAC;AACV,CAAC;AAED,4EAA4E;AAC5E,SAAgB,mBAAmB,CAAC,OAAe;IAClD,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IACzB,IAAI,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC;IACrB,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,MAAM,IAAI,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;AACjE,CAAC"}
|
package/dist/image.js
CHANGED
|
@@ -111,7 +111,7 @@ function getTmuxPassthroughWarning(protocol) {
|
|
|
111
111
|
if (!isTmuxSession() || protocol === "none")
|
|
112
112
|
return null;
|
|
113
113
|
if (tmuxAllowsPassthrough() === false) {
|
|
114
|
-
return
|
|
114
|
+
return "tmux allow-passthrough is off. Run: tmux set -g allow-passthrough on";
|
|
115
115
|
}
|
|
116
116
|
return null;
|
|
117
117
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* pi-pretty — Pretty terminal output for pi built-in tools.
|
|
3
3
|
*
|
|
4
|
-
* Enhances read, bash, ls, find, grep
|
|
4
|
+
* Enhances read, bash, ls, find, and grep with:
|
|
5
5
|
* • Syntax-highlighted file content (Shiki)
|
|
6
6
|
* • Colored bash exit status + output
|
|
7
7
|
* • Tree-view directory listings with file-type icons
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C,OAAO,KAAK,EAAE,YAAY,EAA6C,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C,OAAO,KAAK,EAAE,YAAY,EAA6C,MAAM,iCAAiC,CAAC;AAS/G,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAqB/C,YAAY,EAAE,YAAY,EAAE,CAAC;AAE7B,wBAA8B,iBAAiB,CAAC,EAAE,EAAE,YAAY,EAAE,IAAI,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CA+MpG"}
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* pi-pretty — Pretty terminal output for pi built-in tools.
|
|
4
4
|
*
|
|
5
|
-
* Enhances read, bash, ls, find, grep
|
|
5
|
+
* Enhances read, bash, ls, find, and grep with:
|
|
6
6
|
* • Syntax-highlighted file content (Shiki)
|
|
7
7
|
* • Colored bash exit status + output
|
|
8
8
|
* • Tree-view directory listings with file-type icons
|
|
@@ -15,28 +15,32 @@ exports.default = piPrettyExtension;
|
|
|
15
15
|
// Re-export for tests
|
|
16
16
|
var image_js_1 = require("./image.js");
|
|
17
17
|
Object.defineProperty(exports, "__imageInternals", { enumerable: true, get: function () { return image_js_1.__imageInternals; } });
|
|
18
|
+
const autocomplete_js_1 = require("./autocomplete.js");
|
|
19
|
+
const config_js_1 = require("./config.js");
|
|
18
20
|
const fff_js_1 = require("./fff.js");
|
|
19
|
-
const read_js_1 = require("./tools/read.js");
|
|
20
21
|
const bash_js_1 = require("./tools/bash.js");
|
|
21
|
-
const ls_js_1 = require("./tools/ls.js");
|
|
22
22
|
const find_js_1 = require("./tools/find.js");
|
|
23
23
|
const grep_js_1 = require("./tools/grep.js");
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const config_js_1 = require("./config.js");
|
|
27
|
-
const autocomplete_js_1 = require("./autocomplete.js");
|
|
24
|
+
const ls_js_1 = require("./tools/ls.js");
|
|
25
|
+
const read_js_1 = require("./tools/read.js");
|
|
28
26
|
// ---------------------------------------------------------------------------
|
|
29
27
|
// Config
|
|
30
28
|
// ---------------------------------------------------------------------------
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
const DEFAULT_DISABLED_TOOLS = new Set(["ls"]);
|
|
30
|
+
function envTools(name) {
|
|
31
|
+
return new Set((process.env[name] ?? "")
|
|
33
32
|
.split(",")
|
|
34
|
-
.map((
|
|
33
|
+
.map((tool) => tool.trim().toLowerCase())
|
|
35
34
|
.filter(Boolean));
|
|
36
35
|
}
|
|
37
36
|
async function piPrettyExtension(pi, deps) {
|
|
38
|
-
const disabledTools =
|
|
39
|
-
const
|
|
37
|
+
const disabledTools = envTools("PRETTY_DISABLE_TOOLS");
|
|
38
|
+
const enabledTools = envTools("PRETTY_ENABLE_TOOLS");
|
|
39
|
+
const isToolEnabled = (name) => {
|
|
40
|
+
const normalizedName = name.toLowerCase();
|
|
41
|
+
return (!disabledTools.has(normalizedName) &&
|
|
42
|
+
(!DEFAULT_DISABLED_TOOLS.has(normalizedName) || enabledTools.has(normalizedName)));
|
|
43
|
+
};
|
|
40
44
|
const cwd = process.cwd();
|
|
41
45
|
// ------------------------------------------------------------------
|
|
42
46
|
// FFF service init
|
|
@@ -47,9 +51,7 @@ async function piPrettyExtension(pi, deps) {
|
|
|
47
51
|
// should still work even when SDK tool factories are unavailable.
|
|
48
52
|
const maybeGetAgentDir = deps?.sdk?.getAgentDir;
|
|
49
53
|
const agentDir = typeof maybeGetAgentDir === "function" ? maybeGetAgentDir() : (0, config_js_1.getDefaultAgentDir)();
|
|
50
|
-
|
|
51
|
-
// Ripgrep fallback for multi_grep
|
|
52
|
-
const multiGrepFallback = deps?.multiGrepRipgrepFallback ?? multi_grep_fallback_js_1.runMultiGrepRipgrepFallback;
|
|
54
|
+
const fffService = (0, fff_js_1.getSharedFffService)(deps?.fffModule, agentDir);
|
|
53
55
|
// Text component for custom rendering (DI-friendly)
|
|
54
56
|
const TextComp = deps?.TextComponent;
|
|
55
57
|
// ------------------------------------------------------------------
|
|
@@ -60,7 +62,7 @@ async function piPrettyExtension(pi, deps) {
|
|
|
60
62
|
description: "Show FFF file finder health and indexer status",
|
|
61
63
|
handler: async (_args, ctx) => {
|
|
62
64
|
const fff = fffService;
|
|
63
|
-
if (!fff.isAvailable) {
|
|
65
|
+
if (!fff || !fff.isAvailable) {
|
|
64
66
|
ctx.ui.notify("FFF not initialized", "warning");
|
|
65
67
|
return;
|
|
66
68
|
}
|
|
@@ -199,9 +201,6 @@ async function piPrettyExtension(pi, deps) {
|
|
|
199
201
|
if (isToolEnabled("grep") && createGrepTool) {
|
|
200
202
|
(0, grep_js_1.registerGrepTool)(pi, cwd, fffService, createGrepTool(cwd), TextComp);
|
|
201
203
|
}
|
|
202
|
-
if (isToolEnabled("multi_grep") && (fffService || createGrepTool)) {
|
|
203
|
-
(0, multi_grep_js_1.registerMultiGrepTool)(pi, cwd, fffService, createGrepTool ? createGrepTool(cwd) : undefined, multiGrepFallback, TextComp);
|
|
204
|
-
}
|
|
205
204
|
// Fallback padding for SDK-rendered tool bodies. The SDK reads
|
|
206
205
|
// result.content[0].text and slices collapsed output to roughly the first
|
|
207
206
|
// 10 lines, so insert bottom padding inside that visible slice.
|