@giladbarnea/pi-custom-footer 0.1.5 → 0.1.6
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 +5 -1
- package/index.ts +11 -14
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
last_updated: 2026-10-26T15-03
|
|
3
|
+
---
|
|
4
|
+
|
|
1
5
|
<div align="center">
|
|
2
6
|
|
|
3
7
|
# Custom Footer
|
|
@@ -27,7 +31,7 @@ Below the editor, see:
|
|
|
27
31
|
|
|
28
32
|
The layout follows your Pi theme. The header and the footer each take the fewest lines they can. To fit, they first drop labels, round readings, remove whitespace, and drop the branch icon. Only then does the footer hide facts: the reused/new split, the session hit rate, the token counts, and last the cost per turn.
|
|
29
33
|
|
|
30
|
-
|
|
34
|
+
Skills get up to 10% of the terminal's rows, rounded to the nearest row with a minimum of two. To fit, the row first drops token ages, then separators, then shortens long names in the middle (`caut…ctor`). Only then does it reserve the final row for a hidden-skill count.
|
|
31
35
|
|
|
32
36
|
**Resize without rescanning the conversation.** The header and footer share cached values. Session changes refresh them, including forks and compaction.
|
|
33
37
|
|
package/index.ts
CHANGED
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Skill row. Each loaded skill shows its name and its token age: how far the
|
|
5
5
|
* context has grown since the first response that saw the skill. The age tells
|
|
6
|
-
* how deep in the context the skill now sits.
|
|
7
|
-
*
|
|
8
|
-
* up the least important thing left
|
|
6
|
+
* how deep in the context the skill now sits. Skills get one tenth of the
|
|
7
|
+
* terminal's rows, rounded to the nearest row with a minimum of two. When
|
|
8
|
+
* they do not fit, the row gives up the least important thing left:
|
|
9
9
|
* 1. The token ages.
|
|
10
10
|
* 2. The separators between skills.
|
|
11
11
|
* 3. The middle of the longest names, one character per step, down to four
|
|
12
12
|
* characters on each side of the ellipsis. Names shorter than ten
|
|
13
13
|
* characters never change.
|
|
14
|
-
* 4. Last,
|
|
14
|
+
* 4. Last, reserve the final row for a "+N skills" count.
|
|
15
15
|
* Knowing which skills are loaded matters more than any detail about them, so
|
|
16
16
|
* hiding a skill is the last resort. The Claude Code status line in
|
|
17
17
|
* ~/.claude/statusline.sh uses the same order.
|
|
@@ -31,9 +31,8 @@ import { getLoadedSkills, type SkillLocation } from "./skill-tracker.ts";
|
|
|
31
31
|
|
|
32
32
|
// ── Layout constants ────────────────────────────────────────────────────────
|
|
33
33
|
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
const COLLAPSED_SKILL_ROWS = 3;
|
|
34
|
+
const MINIMUM_SKILL_ROWS = 2;
|
|
35
|
+
const TERMINAL_ROWS_PER_SKILL_ROW = 10;
|
|
37
36
|
// A truncated name keeps four characters on each side of the ellipsis.
|
|
38
37
|
const MIN_TRUNCATED_NAME_LENGTH = 9;
|
|
39
38
|
const NARROW_SEPARATOR = " ";
|
|
@@ -648,15 +647,13 @@ export default function (pi: ExtensionAPI) {
|
|
|
648
647
|
width,
|
|
649
648
|
theme.fg("dim", layout.separator),
|
|
650
649
|
);
|
|
651
|
-
//
|
|
652
|
-
//
|
|
653
|
-
const
|
|
650
|
+
// Take the fullest layout that fits the row limit. Hiding skills behind a
|
|
651
|
+
// count is the last resort, after the most compact layout.
|
|
652
|
+
const maximumSkillRows = Math.max(MINIMUM_SKILL_ROWS, Math.round(terminalHeight / TERMINAL_ROWS_PER_SKILL_ROW));
|
|
654
653
|
const layouts = skillLayouts(Math.max(0, ...loadedSkills.map(({ name }) => name.length)));
|
|
655
|
-
const
|
|
656
|
-
const layout = candidates.find((candidate) => renderSkillLines(candidate).length <= SKILL_COLLAPSE_ROW_THRESHOLD) ?? candidates.at(-1)!;
|
|
654
|
+
const layout = layouts.find((candidate) => renderSkillLines(candidate).length <= maximumSkillRows) ?? layouts.at(-1)!;
|
|
657
655
|
const skillLines = renderSkillLines(layout);
|
|
658
|
-
const
|
|
659
|
-
const visibleSkillLines = collapseSkills ? skillLines.slice(0, COLLAPSED_SKILL_ROWS) : skillLines;
|
|
656
|
+
const visibleSkillLines = skillLines.length > maximumSkillRows ? skillLines.slice(0, maximumSkillRows - 1) : skillLines;
|
|
660
657
|
const hiddenSkillCount = skillLines.slice(visibleSkillLines.length).reduce((count, line) => count + line.partCount, 0);
|
|
661
658
|
const overflowLines = hiddenSkillCount === 0 ? [] : [truncateToWidth(theme.fg("dim", ` +${hiddenSkillCount} skills`), width)];
|
|
662
659
|
return [
|