@bismawy/pi-arnative 0.2.0 → 0.2.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/README.md +39 -61
- package/extensions/footer.ts +23 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -1,89 +1,69 @@
|
|
|
1
|
-
|
|
1
|
+
# Arnative
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A visual layer and tool styling tailored to your vibe coding.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[](https://pi.dev/packages/@bismawy/pi-arnative)
|
|
6
|
+
[](https://www.npmjs.com/package/@bismawy/pi-arnative)
|
|
7
|
+
[](https://github.com/bismawy/pi-arnative)
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
## Overview
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-

|
|
11
|
+
pi-arnative replaces pi’s default terminal chrome with a unified, cohesive visual aesthetic.
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
- **11 themes, one generator:** `arnative` plus 10 variants (`sun`, `zinc`, `violet`, `emerald`, `matrix`, `cyberpunk`, `synthwave`, `gruvbox`, `nord`, `dracula`), all generated from a single base file so their structure can never drift.
|
|
19
|
-
- **Header box with tabs:** replaces pi's stacked resource list with a 5-line box — logo, version + shortcuts, and a clickable `Model / Directory / Context / Skills / Extensions / Themes` tab menu. The `Directory` tab shows the full working directory (wrapped at `/`, never truncated).
|
|
20
|
-
- **Tool boxes:** every tool call renders in its own rounded box — spinner while running, then `✓`/`x`, right-aligned duration, and a one-line summary. Click or `ctrl+e` for the full output.
|
|
21
|
-
- **2-line footer:** `cwd | duration | branch/tag/status` on the first line, extension status + tok/s + cache + tokens on the second, plus a full-box editor with a `> ` prompt.
|
|
22
|
-
- **Transcript clock:** user and assistant messages get a right-aligned time, and the user bubble background is repaired where Markdown resets would otherwise leave black blocks.
|
|
23
|
-
- **Render fixes:** hidden reload box, readable drag selection, single-line compaction messages, and a higher-contrast `↓ Jump to latest message` pill.
|
|
24
|
-
- **Contrast-checked themes:** the self-check measures every `themes/*.json` against its own canvas, so no variant ships an unreadable box.
|
|
13
|
+
- Warm Themes: Cohesive, contrast-checked color palettes generated without drift.
|
|
14
|
+
- Tabbed Header: Compact box menu with quick access to Model, Skills, Extensions, and Themes.
|
|
15
|
+
- Rounded Tool Boxes: Clear status, spinner, and duration for every tool call.
|
|
16
|
+
- Enhanced Footer: 2-line layout showing directory path, git branch, model, and token metrics.
|
|
17
|
+
- Transcript Clock: Timestamps for messages with clean bubble backgrounds.
|
|
18
|
+
- Usage Dashboard: /usage command to track tokens and session costs.
|
|
25
19
|
|
|
26
20
|
## Install
|
|
27
21
|
|
|
28
|
-
**Install [JetBrains Mono Nerd Font](https://www.nerdfonts.com/font-downloads) first.** Every icon in this package (tab icons ` `, tool icons ` ✓`, footer icons ` `, and the rounded box corners `╭─╮`) is a Nerd Font glyph — without the font they render as empty boxes (□) or random characters.
|
|
29
|
-
|
|
30
|
-
1. Download **JetBrainsMono Nerd Font** from [nerdfonts.com/font-downloads](https://www.nerdfonts.com/font-downloads).
|
|
31
|
-
2. Extract and install it (Linux: copy into `~/.local/share/fonts/` then `fc-cache -f`; Windows: right click → Install).
|
|
32
|
-
3. Set your terminal to **JetBrainsMono NF** (or another Nerd Font) as the primary font.
|
|
33
|
-
|
|
34
22
|
```bash
|
|
35
23
|
pi install npm:@bismawy/pi-arnative
|
|
36
24
|
```
|
|
37
25
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
To try it without installing, from this directory:
|
|
26
|
+
Select a theme via `/settings` → **Theme** → `arnative` (or any `arnative-*` variant).
|
|
41
27
|
|
|
28
|
+
To test locally without installing:
|
|
42
29
|
```bash
|
|
43
30
|
pi --extension ./extensions/footer.ts
|
|
44
31
|
```
|
|
32
|
+
> **Prerequisite:** Requires a [Nerd Font](https://www.nerdfonts.com/font-downloads) (e.g. JetBrains Mono Nerd Font) for icons and rounded box borders.
|
|
45
33
|
|
|
46
|
-
##
|
|
47
|
-
|
|
48
|
-
| Command | Action |
|
|
49
|
-
| :--- | :--- |
|
|
50
|
-
| `/usage` | Token, message & cache usage across all local Pi sessions |
|
|
34
|
+
## Shortcuts
|
|
51
35
|
|
|
52
|
-
|
|
|
53
|
-
|
|
|
54
|
-
| `
|
|
55
|
-
|
|
|
56
|
-
|
|
|
36
|
+
| Key / Action | Result |
|
|
37
|
+
| --- | --- |
|
|
38
|
+
| `/usage` | Show session usage & token metrics |
|
|
39
|
+
| `ctrl+alt+t` | Cycle header tabs (Model → Directory → Context → Skills → Extensions → Themes) |
|
|
40
|
+
| `ctrl+alt+r` | Quick reload runtime (`/reload`) |
|
|
41
|
+
| Click tab | Open selected header tab |
|
|
42
|
+
| Click tool / `ctrl+e` | Toggle tool output box |
|
|
57
43
|
|
|
58
|
-
##
|
|
44
|
+
## Architecture
|
|
59
45
|
|
|
60
46
|
<details>
|
|
61
47
|
<summary><b>Extensions</b></summary>
|
|
62
48
|
|
|
63
49
|
| File | Role |
|
|
64
|
-
|
|
|
65
|
-
| `extensions/tools.ts` |
|
|
66
|
-
| `extensions/section-headers.ts` |
|
|
67
|
-
| `extensions/footer.ts` | 2-line footer and
|
|
68
|
-
| `extensions/timestamps.ts` |
|
|
69
|
-
| `extensions/ui-render-tweaks.ts` |
|
|
70
|
-
| `extensions/usage.ts` | `/usage`
|
|
71
|
-
|
|
72
|
-
`lib/box.ts` and `lib/ansi.ts` hold the single definitions shared by all of them. They live outside `extensions/` so pi never loads them as extensions.
|
|
50
|
+
| --- | --- |
|
|
51
|
+
| `extensions/tools.ts` | Rounded tool boxes, spinners, and duration |
|
|
52
|
+
| `extensions/section-headers.ts` | Tabbed header and resource box |
|
|
53
|
+
| `extensions/footer.ts` | 2-line status footer and boxed editor |
|
|
54
|
+
| `extensions/timestamps.ts` | Message clock and bubble background fixes |
|
|
55
|
+
| `extensions/ui-render-tweaks.ts` | Contrast tweaks, selection style, and UI polish |
|
|
56
|
+
| `extensions/usage.ts` | `/usage` token dashboard |
|
|
73
57
|
|
|
74
58
|
</details>
|
|
75
59
|
|
|
76
60
|
<details>
|
|
77
61
|
<summary><b>Themes</b></summary>
|
|
78
62
|
|
|
79
|
-
- `themes/arnative.json`
|
|
80
|
-
- `themes/gen-themes.mjs`
|
|
81
|
-
- `npm run themes` rewrites every variant; `npm test` runs the same generator in `--check` mode, so a hand-edited variant file cannot drift.
|
|
82
|
-
- Every variant fills all `vars`/`colors`/`export` keys, so no color can silently inherit the base.
|
|
63
|
+
- `themes/arnative.json` serves as the structure source of truth.
|
|
64
|
+
- `themes/gen-themes.mjs` generates variants with automated contrast checks.
|
|
83
65
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
Contrast rules enforced by the self-check (measured against each theme's own `userMessageBg` canvas): content ≥ 3.0, secondary text ≥ 2.0, `thinking*` ramp 1.3–4.0, accent pill ≥ 4.5, tool box text ≥ 4.5 on both success and error backgrounds, error box weight matched to the success box, and `scrollbarThumb` / `searchMatchBg` distinguishable from their track / selection.
|
|
66
|
+
**Variants:** `sun` · `zinc` · `violet` · `emerald` · `matrix` · `cyberpunk` · `synthwave` · `gruvbox` · `nord` · `dracula`
|
|
87
67
|
|
|
88
68
|
</details>
|
|
89
69
|
|
|
@@ -91,18 +71,16 @@ Contrast rules enforced by the self-check (measured against each theme's own `us
|
|
|
91
71
|
<summary><b>Development</b></summary>
|
|
92
72
|
|
|
93
73
|
```bash
|
|
94
|
-
npm test #
|
|
95
|
-
npm run themes #
|
|
74
|
+
npm test # Run self-checks & theme generator check
|
|
75
|
+
npm run themes # Rebuild all theme variants
|
|
96
76
|
```
|
|
97
77
|
|
|
98
|
-
Each extension is also a standalone self-check: `node extensions/tools.ts`.
|
|
99
|
-
|
|
100
78
|
</details>
|
|
101
79
|
|
|
102
80
|
## License
|
|
103
81
|
|
|
104
82
|
Distributed under the **MIT** license.
|
|
105
83
|
|
|
106
|
-
##
|
|
84
|
+
## Author
|
|
107
85
|
|
|
108
|
-
|
|
86
|
+
[Bisma](https://github.com/bismawy)
|
package/extensions/footer.ts
CHANGED
|
@@ -9,10 +9,14 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import type { AssistantMessage } from "@earendil-works/pi-ai";
|
|
11
11
|
import { CustomEditor, FooterComponent, type ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
12
|
-
import { truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
|
|
12
|
+
import { Key, matchesKey, truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
|
|
13
13
|
import { execFile } from "node:child_process";
|
|
14
14
|
import { formatTokens } from "../lib/usage-store.ts";
|
|
15
15
|
|
|
16
|
+
// The TUI drops key-release events before handleInput, so press+release cannot
|
|
17
|
+
// fire this twice even when the terminal reports event types (Kitty flag 2).
|
|
18
|
+
const RELOAD_SHORTCUT = Key.ctrlAlt("r");
|
|
19
|
+
|
|
16
20
|
// Intercept the built-in FooterComponent to force a pure 2-line footer
|
|
17
21
|
const PATCHED_KEY = Symbol.for("pi-arnative.footer2LinesPatched");
|
|
18
22
|
if (FooterComponent?.prototype?.render && !(globalThis as Record<symbol, boolean>)[PATCHED_KEY]) {
|
|
@@ -471,6 +475,17 @@ export default function (pi: ExtensionAPI) {
|
|
|
471
475
|
return super.renderTopBorder(width, hiddenLineCount);
|
|
472
476
|
}
|
|
473
477
|
|
|
478
|
+
handleInput(data: string) {
|
|
479
|
+
if (matchesKey(data, RELOAD_SHORTCUT)) {
|
|
480
|
+
this.setText("");
|
|
481
|
+
if (this.onSubmit) {
|
|
482
|
+
this.onSubmit("/reload");
|
|
483
|
+
}
|
|
484
|
+
return;
|
|
485
|
+
}
|
|
486
|
+
super.handleInput(data);
|
|
487
|
+
}
|
|
488
|
+
|
|
474
489
|
render(width: number): string[] {
|
|
475
490
|
// The box eats 5 columns: 2 sides + the 3-column " > " prompt, so the
|
|
476
491
|
// content is rendered 5 columns narrower.
|
|
@@ -643,5 +658,12 @@ if (isMain) {
|
|
|
643
658
|
assert(getToolWorkingMessage("mcp", { tool: "fetch_repo" }) === "Fetching", "mcp fetch -> Fetching");
|
|
644
659
|
assert(boxed.slice(0, 4).every((l) => visibleWidth(l) === visibleWidth(D) + 5), "lebar kotak seragam (sisi+prompt)");
|
|
645
660
|
assert(boxEditorLines(["\u2500\u2500\u2500\u2500"], 1, plain).length === 1, "terlalu sempit: tak diubah");
|
|
661
|
+
|
|
662
|
+
// Guard: the reload shortcut must match every encoding a terminal can deliver,
|
|
663
|
+
// so a typo in the key id fails here instead of silently doing nothing.
|
|
664
|
+
assert(matchesKey("\x1b\x12", RELOAD_SHORTCUT), "shortcut cocok dgn ctrl+alt+r legacy (ESC + 0x12)");
|
|
665
|
+
assert(matchesKey("\x1b[114;7u", RELOAD_SHORTCUT), "shortcut cocok dgn ctrl+alt+r Kitty CSI-u");
|
|
666
|
+
assert(!matchesKey("\x12", RELOAD_SHORTCUT), "ctrl+r polos tidak memicu reload");
|
|
667
|
+
assert(!matchesKey("r", RELOAD_SHORTCUT), "huruf r tidak memicu reload");
|
|
646
668
|
console.log("footer.ts self-check OK");
|
|
647
669
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bismawy/pi-arnative",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Arnative look for Pi: 11 warm-neutral themes, rounded tool boxes, branded header with tabs, 2-line footer with git/model/status, transcript clock, and a /usage dashboard.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"@earendil-works/pi-tui": "*"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
|
+
"dev": "pi --extension ./extensions/tools.ts --extension ./extensions/section-headers.ts --extension ./extensions/footer.ts --extension ./extensions/timestamps.ts --extension ./extensions/ui-render-tweaks.ts --extension ./extensions/usage.ts",
|
|
40
41
|
"test": "node lib/box.ts && node lib/ansi.ts && node themes/gen-themes.mjs --check && node extensions/tools.ts && node extensions/footer.ts && node extensions/timestamps.ts && node extensions/section-headers.ts && node extensions/ui-render-tweaks.ts && node extensions/usage.ts",
|
|
41
42
|
"themes": "node themes/gen-themes.mjs"
|
|
42
43
|
}
|