@tenchi4u/pi-cc-header 1.0.4 → 1.0.5

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
@@ -80,7 +80,7 @@ Quotes are loaded from a `quotes.json` file. The package ships a default set of
80
80
  ]
81
81
  ```
82
82
 
83
- Quotes over 10 words are split as evenly as possible across up to 2 lines, preferring a break at punctuation (`. , : ; -`). The author name sits centered beneath, in the slogan color.
83
+ Quotes over 10 words are split as evenly as possible across up to 2 lines, preferring a break at punctuation (`. , : ; -`). The author name is right-aligned to the end of the longest quote line, in the slogan color.
84
84
 
85
85
  ### Custom ASCII logo
86
86
 
@@ -195,7 +195,10 @@ function loadQuotes(ctx: ExtensionContext): Quote[] {
195
195
  export function formatQuote(quote: string, author: string, punctBonus = 25): string {
196
196
  const words = quote.trim().split(/\s+/);
197
197
  if (words.length <= 10) {
198
- return `"${quote}"\n${author}`;
198
+ const line = `"${quote}"`;
199
+ const pad = Math.max(0, visibleWidth(line) - visibleWidth(author));
200
+ return `${line}
201
+ ${" ".repeat(pad)}${author}`;
199
202
  }
200
203
 
201
204
  let bestI = 1;
@@ -215,7 +218,11 @@ export function formatQuote(quote: string, author: string, punctBonus = 25): str
215
218
 
216
219
  const line1 = `"${words.slice(0, bestI).join(" ")}`;
217
220
  const line2 = `${words.slice(bestI).join(" ")}"`;
218
- return `${line1}\n${line2}\n${author}`;
221
+ const maxW = Math.max(visibleWidth(line1), visibleWidth(line2));
222
+ const pad = Math.max(0, maxW - visibleWidth(author));
223
+ return `${line1}
224
+ ${line2}
225
+ ${" ".repeat(pad)}${author}`;
219
226
  }
220
227
 
221
228
  export function getRandomQuote(ctx: ExtensionContext): string | null {
@@ -700,7 +707,7 @@ class PiHeader implements Component {
700
707
  if (state.sloganOn && state.slogan) {
701
708
  rows.push("");
702
709
  const sloganLines = state.slogan.split("\n");
703
- let quoteLineWidth = 0; // Track width of the quote line for author right-justification
710
+ let quoteLineWidth = 0; // Track width of the quote line for author right-justification
704
711
  for (let idx = 0; idx < sloganLines.length; idx++) {
705
712
  const line = sloganLines[idx];
706
713
  const sloganW = visibleWidth(line);
@@ -710,24 +717,24 @@ class PiHeader implements Component {
710
717
  : line;
711
718
 
712
719
  const isAuthor = idx === sloganLines.length - 1 && sloganLines.length > 1;
713
- if (isAuthor) {
714
- // Right-justify author to match the width of the quote line above
715
- const authorW = visibleWidth(sloganText);
716
- const padding = Math.max(0, quoteLineWidth - authorW);
717
- const paddedAuthor = " ".repeat(padding) + sloganText;
718
- rows.push(
719
- state.sloganColor
720
- ? formatQuoteAuthor(paddedAuthor, state.sloganColorKey)
721
- : `${paddedAuthor}`,
722
- );
723
- } else {
724
- quoteLineWidth = visibleWidth(sloganText);
725
- rows.push(
726
- state.sloganColor
727
- ? `[${CMAP[state.sloganColorKey]}m${sloganText}`
728
- : muted(`${sloganText}`),
729
- );
730
- }
720
+ if (isAuthor) {
721
+ // Right-justify author to match the width of the quote line above
722
+ const authorW = visibleWidth(sloganText);
723
+ const padding = Math.max(0, quoteLineWidth - authorW);
724
+ const paddedAuthor = " ".repeat(padding) + sloganText;
725
+ rows.push(
726
+ state.sloganColor
727
+ ? formatQuoteAuthor(paddedAuthor, state.sloganColorKey)
728
+ : `${paddedAuthor}`,
729
+ );
730
+ } else {
731
+ quoteLineWidth = visibleWidth(sloganText);
732
+ rows.push(
733
+ state.sloganColor
734
+ ? `[${CMAP[state.sloganColorKey]}m${sloganText}`
735
+ : muted(`${sloganText}`),
736
+ );
737
+ }
731
738
  }
732
739
  } else {
733
740
  rows.push(muted(this.stats.agents ? `${this.stats.agents} · ${cwd}` : cwd));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tenchi4u/pi-cc-header",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "Claude Code–style startup header for Pi — animated Pi logo with a 9-color palette, toggleable IBM stripes and Minecraft themes; configurable info bar displays version, model, resource stats, AGENTS.md marker, cwd, and a customizable slogan.",
5
5
  "type": "module",
6
6
  "keywords": [