@xynogen/pix-pretty 1.7.7 → 1.7.8

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 CHANGED
@@ -1,38 +1,39 @@
1
1
  # pix-pretty
2
2
 
3
- Complete rendering and formatting solution for Pi Coding Agent with syntax highlighting, file icons, tree views, FFF search, paste chip formatting, and reasoning tag cleanup.
3
+ Rendering and formatting library for Pi Coding Agent with syntax highlighting, file icons, tree views, FFF search integration, and gate-dialog overlay.
4
4
 
5
- ## Features
5
+ ## What it does
6
6
 
7
- ### Tool Output Rendering
7
+ This package is a **library + a small extension** that other pix packages
8
+ consume. It does not register user-facing tools itself — the tool renderers
9
+ (`pix-read`, `pix-bash`, `pix-ls`, `pix-find`, `pix-grep`, `pix-edit`,
10
+ `pix-write`) import from it. The extension entry point (`src/index.ts`) only
11
+ initializes the syntax-highlight theme from Pi settings, clears the highlight
12
+ cache, and registers two FFF slash commands (`/fff-health`, `/fff-rescan`)
13
+ once `pix-grep` has brought the FFF finder online.
8
14
 
9
- - **Syntax highlighting** - Uses `cli-highlight` (highlight.js-backed) for code blocks
10
- - **File icons** - Visual file type indicators in ls/find output
11
- - **Tree views** - Hierarchical directory display
12
- - **FFF search** - Fast full-text search integration with `@ff-labs/fff-node`
13
- - **Diff rendering** - Enhanced git diff and edit/write tool output
14
- - **Image metadata** - Display image dimensions and format info
15
- - **Bash exit summary** - Command status and timing info
15
+ ### Rendering
16
16
 
17
- ### Paste Chip Formatting
17
+ - **Syntax highlighting** — `cli-highlight` (highlight.js-backed)
18
+ - **File icons** — type-aware icons in ls/find output
19
+ - **Tree views** — hierarchical directory display for ls
20
+ - **Diff rendering** — side-by-side split diff for edit/write
21
+ - **Bash exit summary** — colored status, line count, truncation notice
18
22
 
19
- - **Image path collapsing** - Converts `/tmp/pi-clipboard-abc.png` → `[paste image #1]`
20
- - **Text paste markers** - Long pasted text → `[paste text +42 lines]`
21
- - **Atomic deletion** - Delete entire paste markers as single units
22
- - **Type-aware labels** - Visual distinction between image and text pastes
23
+ ### Shared overlay
23
24
 
24
- ### Permission Dialog Overlay
25
+ - **Gate overlay** (`./gate-overlay`) — the one permission-dialog component
26
+ shared by `pix-gate` and `pix-sudo`. Two modes: `confirm` (SelectList) and
27
+ `sudo` (SelectList + masked password). Returns
28
+ `{ action: "approved" | "denied" | "timeout", password? }`. Padded with
29
+ `Box` `paddingX=2`, `paddingY=1`. The simpler `./confirm` export is the
30
+ plain boolean Yes/No dialog.
25
31
 
26
- - **Shared gate overlay** - `showOverlay(ui, config)` (export `./gate-overlay`) is the one permission-dialog component used by both `pix-gate` and `pix-sudo`. Two modes: `mode:"confirm"` shows a SelectList only; `mode:"sudo"` shows a SelectList then a masked password stage. Returns `{ action: "approved" | "denied" | "timeout", password? }`. All dialogs are padded (`Box` `paddingX=2`, `paddingY=1`). The simpler `./confirm` export stays for plain boolean Yes/No prompts — `gate-overlay` is its richer multi-choice, password-capable sibling.
32
+ UI features that used to live here have moved to [`pix-display`](packages/pix-display):
33
+ paste chip rendering and reasoning-tag (`<think>`/`<thinking>`) → native
34
+ `thinking` content blocks.
27
35
 
28
- ### Reasoning Tag Rendering
29
-
30
- - **Live streaming** - Splits `<think>`/`<thinking>` regions into native Pi `thinking` content blocks token-by-token during streaming
31
- - **Finalized cleanup** - On `message_end`, re-splits every affected text block for persistence (the finalized message bypasses the live rebuild)
32
- - **Partial-tag safety** - Strips trailing half-streamed tags (e.g. `<thin`) so they never flash as literal text
33
- - **Visual distinction** - Uses Pi's native `thinking` block rendering (dim + italic via `thinkingText` theme token) — no ANSI injection, no markdown blockquote shim
34
-
35
- ## Installation
36
+ ## Install
36
37
 
37
38
  ```bash
38
39
  pi install npm:@xynogen/pix-pretty
@@ -42,40 +43,38 @@ pi install npm:@xynogen/pix-pretty
42
43
 
43
44
  ### Environment Variables
44
45
 
45
- **Tool rendering:**
46
-
47
- - `PRETTY_THEME` - Color theme for syntax highlighting
48
- - `PRETTY_MAX_HL_CHARS` - Max characters to highlight (default: 80000)
49
- - `PRETTY_MAX_PREVIEW_LINES` - Max lines in preview output
50
- - `PRETTY_CACHE_LIMIT` - FFF cache size limit
51
- - `PRETTY_ICONS` - Enable/disable file icons
52
- - `PRETTY_DISABLE_TOOLS` - Comma-separated list of tools to skip rendering
53
- - `PRETTY_IMAGE_PROTOCOL` - Protocol for image display (tmux passthrough)
54
- - `PRETTY_FFF_DIR` - Override FFF state dir (default: `~/.cache/pi/fff`)
55
-
56
- ## Architecture
57
-
58
- This package combines two rendering systems:
59
-
60
- 1. **Theme + FFF commands** (`src/index.ts`) - Initialises syntax-highlight theme from Pi settings, clears highlight cache, and registers FFF slash commands. Tool renderers live in the standalone `pix-{read,bash,ls,find,grep,edit,write}` packages — each self-registers via its own Pi extension entry point.
61
- 2. **Paste chip formatting** (`src/paste-chips.ts`) - Custom editor component for paste markers.
62
- 3. **Reasoning tag rendering** (`src/thinking.ts`) - Converts leaked `<think>`/`<thinking>` tags into native Pi `thinking` content blocks (dim + italic via `thinkingText` theme token).
46
+ - `PRETTY_THEME` — color theme for syntax highlighting
47
+ - `PRETTY_MAX_HL_CHARS` — max characters to highlight (default: 80000)
48
+ - `PRETTY_MAX_PREVIEW_LINES` max lines in preview output
49
+ - `PRETTY_CACHE_LIMIT` FFF cache size limit
50
+ - `PRETTY_ICONS` icon mode (`nerd` or `none`)
51
+ - `PRETTY_MAX_RENDER_LINES` max lines in edit/write diff render (default: 150)
52
+ - `PRETTY_FFF_DIR` override FFF state dir (default: `~/.cache/pi/fff`)
63
53
 
64
- Both work independently but complement each other for a cohesive visual experience.
54
+ ## Public exports
65
55
 
66
- ## Origin
56
+ The package exposes its sub-modules via `exports`:
67
57
 
68
- Tool rendering replaced `npm:@heyhuynhgiabuu/pi-pretty` (which was previously replaced by `npm:@heyhuynhgiabuu/pi-diff`). This package is a clean reimplementation — no code was copied directly. Developed independently; changes are not submitted back and upstream changes are not pulled in.
69
-
70
- Key divergences from upstream:
71
-
72
- 1. **Highlight engine: shiki → cli-highlight** - Simpler, no WASM, synchronous
73
- 2. **FFF state dir** - `~/.pi/agent/pi-pretty/fff` → `~/.cache/pi/fff` (XDG cache)
74
- 3. **Split diff view for edit/write tools** - Full side-by-side diff with gutter, line numbers, syntax highlighting
75
- 4. **Paste chip formatting** - Custom editor component for Pi's paste marker system (not in upstream)
76
- 5. **Reasoning tag rendering** - Converts leaked `<think>`/`<thinking>` tags into native Pi `thinking` content blocks (not in upstream)
77
-
78
- Paste chip formatting and reasoning tag rendering are original additions with no upstream equivalent.
58
+ ```
59
+ @xynogen/pix-pretty (default — extension entry)
60
+ @xynogen/pix-pretty/ansi
61
+ @xynogen/pix-pretty/confirm
62
+ @xynogen/pix-pretty/progress
63
+ @xynogen/pix-pretty/config
64
+ @xynogen/pix-pretty/diff
65
+ @xynogen/pix-pretty/diff-render
66
+ @xynogen/pix-pretty/highlight
67
+ @xynogen/pix-pretty/lang
68
+ @xynogen/pix-pretty/icons
69
+ @xynogen/pix-pretty/renderers
70
+ @xynogen/pix-pretty/fff
71
+ @xynogen/pix-pretty/types
72
+ @xynogen/pix-pretty/utils
73
+ @xynogen/pix-pretty/resize
74
+ @xynogen/pix-pretty/context
75
+ @xynogen/pix-pretty/gate-overlay
76
+ @xynogen/pix-pretty/modal-frame
77
+ ```
79
78
 
80
79
  ## Full distro
81
80
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@xynogen/pix-pretty",
3
- "version": "1.7.7",
4
- "description": "Enhanced tool output rendering with syntax highlighting, file icons, tree views, FFF search, and paste chip formatting",
3
+ "version": "1.7.8",
4
+ "description": "Enhanced tool output rendering with syntax highlighting, file icons, tree views, diff rendering, and FFF search",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
7
7
  "exports": {
package/src/README.md CHANGED
@@ -1,66 +1,36 @@
1
- # pretty (vendored)
1
+ # pix-pretty/src
2
2
 
3
- Local fork of [`@heyhuynhgiabuu/pi-pretty`](https://github.com/buddingnewinsights/pi-pretty)
4
- (v0.5.1). Enhances built-in `read` / `bash` / `ls` / `find` / `grep` /
5
- `multi_grep` tool output with syntax highlighting, file icons, tree views, and
6
- FFF-backed search.
3
+ > **Historical doc — kept for reference only.**
4
+ >
5
+ > This file originally described pix-pretty as a vendored fork of
6
+ > `@heyhuynhgiabuu/pi-pretty`. That is no longer accurate: pix-pretty has
7
+ > been completely reimplemented. The current source layout, exports, and
8
+ > dependency graph live in the package-level [`README.md`](../README.md).
9
+ >
10
+ > The notes below remain only as a record of two behavioral decisions that
11
+ > differ from the original upstream; both are still in force.
7
12
 
8
- ## Why vendored
13
+ ## Behavioral decisions that survive the rewrite
9
14
 
10
- We need two behavioral changes the upstream package does not expose as config,
11
- so the source is copied here 1:1 and patched:
15
+ These two changes were made when pix-pretty was a vendored fork and are
16
+ preserved in the reimplementation:
12
17
 
13
18
  1. **Highlight engine: shiki → cli-highlight.**
14
- Upstream uses `@shikijs/cli` (`codeToANSI`, TextMate grammars + WASM).
15
- This fork uses [`cli-highlight`](https://www.npmjs.com/package/cli-highlight)
16
- (highlight.js-backed, synchronous). The `hlBlock` interface, language table,
19
+ Upstream used `@shikijs/cli` (`codeToANSI`, TextMate grammars + WASM).
20
+ The reimplementation uses [`cli-highlight`](https://www.npmjs.com/package/cli-highlight)
21
+ (highlight.js-backed, synchronous). `HLJS_LANG_ALIAS` maps shiki-style ids
22
+ (`tsx`, `jsx`, `jsonc`, `mdx`, `make`, `svelte`, `vue`) onto
23
+ highlight.js-supported ids. The `hlBlock` interface, language table,
17
24
  line-number layout, and low-contrast normalization are unchanged.
18
25
 
19
26
  2. **FFF state dir: `~/.pi/agent/pi-pretty/fff` → `~/.cache/pi/fff`.**
20
- `getPiPrettyFffDir()` now resolves to `$XDG_CACHE_HOME/pi/fff`
21
- (default `~/.cache/pi/fff`), overridable with `PRETTY_FFF_DIR`.
27
+ `getPiPrettyFffDir()` resolves to `$XDG_CACHE_HOME/pi/fff` (default
28
+ `~/.cache/pi/fff`), overridable with `PRETTY_FFF_DIR`.
22
29
 
23
- Everything else (bash exit summary, ls tree, find grouping, grep highlighting,
24
- image metadata, tmux passthrough, `/fff-health`, `/fff-rescan`, multi_grep
25
- ripgrep fallback) is byte-for-byte upstream.
30
+ ## What moved out
26
31
 
27
- ## Diff vs upstream
32
+ - **Paste chip formatting** → [`@xynogen/pix-display`](../pix-display)
33
+ - **Reasoning tag (`<think>`/`<thinking>`) rendering** →
34
+ [`@xynogen/pix-display`](../pix-display)
28
35
 
29
- - `index.ts`
30
- - imports: `@shikijs/cli` + `shiki` types → `cli-highlight` (lazy `require`)
31
- with local `BundledLanguage`/`BundledTheme = string` aliases.
32
- - `FORCE_COLOR=3` default before chalk init (shiki always emitted truecolor;
33
- chalk decides level once at load). Respects an explicit `FORCE_COLOR` /
34
- `NO_COLOR`.
35
- - `HLJS_LANG_ALIAS` maps shiki-style ids (`tsx`, `jsx`, `jsonc`, `mdx`,
36
- `make`, `svelte`, `vue`) onto highlight.js-supported ids.
37
- - `hlBlock()` calls `highlight(code, { language, ignoreIllegals: true })`
38
- instead of `await codeToANSI(...)`. Still async-typed so call sites match.
39
- - `getPiPrettyFffDir()` → `~/.cache/pi/fff`.
40
- - `fff-helpers.ts`, `multi-grep-fallback.ts` — unchanged.
41
-
42
- ## Runtime deps & module resolution
43
-
44
- `cli-highlight` and `@ff-labs/fff-node` are installed into pi's npm root
45
- (`~/.pi/agent/npm/node_modules`) by `setup.sh`. Because the extensions dir is a
46
- symlink into dotfiles and Node dereferences symlinks before resolving bare
47
- imports, `setup.sh` also creates a git-ignored
48
- `extensions/node_modules` → `~/.pi/agent/npm/node_modules` bridge next to the
49
- real source so `require("cli-highlight")` / `import("@ff-labs/fff-node")`
50
- resolve.
51
-
52
- The upstream `npm:@heyhuynhgiabuu/pi-pretty` package is uninstalled by
53
- `setup.sh` — both register the same tool names and pi does not share tool-name
54
- ownership across extensions.
55
-
56
- ## Env vars
57
-
58
- Same as upstream (`PRETTY_THEME`, `PRETTY_MAX_HL_CHARS`,
59
- `PRETTY_MAX_PREVIEW_LINES`, `PRETTY_CACHE_LIMIT`, `PRETTY_ICONS`,
60
- `PRETTY_DISABLE_TOOLS`, `PRETTY_IMAGE_PROTOCOL`) plus:
61
-
62
- - `PRETTY_FFF_DIR` — override the FFF state dir (default `~/.cache/pi/fff`).
63
-
64
- ## License
65
-
66
- MIT — upstream by huynhgiabuu. See upstream repo.
36
+ See the package-level README for the current export map.
package/src/index.ts CHANGED
@@ -1,7 +1,10 @@
1
1
  /**
2
- * pi-pretty — Pretty terminal output for pi built-in tools.
2
+ * pix-pretty — Pretty terminal output for pi built-in tools.
3
3
  *
4
- * Pure rendering library no Pi lifecycle hooks or extensions.
4
+ * Primarily a rendering library (highlight/diff/icons/fff, imported by the tool
5
+ * packages). This default export is also a thin Pi extension: on load it inits
6
+ * the pretty theme, clears the highlight cache, and registers the FFF slash
7
+ * commands (/fff-health, /fff-rescan). pix-core activates it for that purpose.
5
8
  * UI features (paste chips, thinking blocks) live in pix-display.
6
9
  */
7
10
 
@@ -30,9 +33,3 @@ export default function piPrettyExtension(pi: PiPrettyApi): void {
30
33
  // Commands become available once pix-grep initialises the finder.
31
34
  registerFffCommands(pi, fffState);
32
35
  }
33
-
34
- /**
35
- * piPrettyExtension still exports a default function for packages that
36
- * import it as an extension (pix-core activates it for theme + FFF).
37
- * UI extensions (paste-chips, thinking) moved to pix-display.
38
- */