@giladbarnea/pi-custom-footer 0.1.4 → 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.
Files changed (3) hide show
  1. package/README.md +5 -1
  2. package/index.ts +11 -14
  3. package/package.json +4 -4
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
- On terminals with 40 rows or fewer, skills get at most four rows. To fit, the row first drops token ages, then separators, then shortens long names in the middle (`caut…ctor`). Only then does it show three rows plus a hidden-skill count.
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. On a terminal of 40 rows or
7
- * fewer, the skills get at most four rows. When they do not fit, the row gives
8
- * up the least important thing left, one step at a time:
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, three rows in the most compact layout plus a "+N skills" count.
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 SHORT_TERMINAL_HEIGHT = 40;
35
- const SKILL_COLLAPSE_ROW_THRESHOLD = 4;
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
- // A short terminal takes the fullest layout that fits the row limit. Hiding
652
- // skills behind a count is the last resort, after the most compact layout.
653
- const shortTerminal = terminalHeight <= SHORT_TERMINAL_HEIGHT;
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 candidates = shortTerminal ? layouts : layouts.slice(0, 1);
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 collapseSkills = shortTerminal && skillLines.length > SKILL_COLLAPSE_ROW_THRESHOLD;
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 [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@giladbarnea/pi-custom-footer",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "Context, cache, cost, and loaded skills at a glance in Pi.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -40,9 +40,9 @@
40
40
  "@earendil-works/pi-tui": ">=0.84.2"
41
41
  },
42
42
  "devDependencies": {
43
- "@earendil-works/pi-ai": "0.85.1",
44
- "@earendil-works/pi-coding-agent": "0.85.1",
45
- "@earendil-works/pi-tui": "0.85.1",
43
+ "@earendil-works/pi-ai": "1.4.0",
44
+ "@earendil-works/pi-coding-agent": "1.4.0",
45
+ "@earendil-works/pi-tui": "1.4.0",
46
46
  "@types/node": "^22.0.0",
47
47
  "jiti": "^2.7.0",
48
48
  "typescript": "~5.9.3"