fix(banner): PAI-OpenCode v3.0 branding — replace vanilla PAI 4.0.3 defaults#140
fix(banner): PAI-OpenCode v3.0 branding — replace vanilla PAI 4.0.3 defaults#140Steffen025 wants to merge 1 commit intodevfrom
Conversation
….0.3 - Default paiVersion: '4.0.3' → '3.0.0' (PAI-OpenCode version) - Default repoUrl: 'github.com/danielmiessler/PAI' → 'github.com/Steffen025/pai-opencode' - settings.json fallback version: '2.0' → '3.0.0' - Header text: 'PAI | Personal AI Infrastructure' → 'PAI-OpenCode v3.0.0 | Personal AI Infrastructure' (large + medium banners) - Credit line added below repo URL in large + medium banners: 'Built on PAI by Daniel Miessler · github.com/danielmiessler/PAI' - Version detection: 'claude --version' → 'opencode --version'
📝 WalkthroughWalkthroughThe Banner.ts file is updated to change the default PAI version from 4.0.3 to 3.0.0, update the repository URL to github.com/Steffen025/pai-opencode, switch version probing from Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.opencode/PAI/Tools/Banner.ts:
- Around line 705-708: The credit centering uses a hardcoded 61 width causing
off-by-2 alignment; update the centering logic in Banner.ts where creditLine and
creditPad are computed (variables creditLine, creditPad, and subsequent
lines.push calls) to use the correct visible length (change the hardcoded 61 to
63) or, better, compute the visible length dynamically by stripping ANSI/color
codes from creditLine and using that length when calculating "
".repeat(Math.max(0, Math.floor((width - visibleLen) / 2))); ensure the same
approach is applied where the Navy banner had the same fix.
- Around line 363-368: The center alignment is off because creditLen is
hardcoded as 61 while the visible text is 63; update the code around
creditLine/creditLen/creditPad to compute the visible length dynamically (e.g.,
define the plain text "Built on PAI by Daniel Miessler ·
github.com/danielmiessler/PAI" and set creditLen = visibleText.length) or simply
change creditLen to 63 so creditPad centers correctly before pushing the line
with lines.push(`${creditPad}${creditLine}`).
- Around line 683-686: The centering uses a hardcoded 44 width causing
misalignment; update the calculation in Banner.ts to use the correct visible
header length (48) by replacing the 44 in the headerPad computation (the line
that computes headerPad using " ".repeat(Math.max(0, Math.floor((width - 44) /
2)))) with 48 (or compute the actual headerText length dynamically) so
headerText is centered correctly; adjust the same constant wherever the Navy
banner used 48 to keep behavior consistent.
- Around line 328-333: The hardcoded headerLen (44) is incorrect for the visible
header length; instead compute the visible length dynamically by stripping
ANSI/color sequences from headerText (e.g., remove /\x1b\[[0-9;]*m/g) and use
that length to compute headerPad so centering uses the actual visible character
count; update the code around headerLen/headerPad/headerText (and keep usage of
stats.paiVersion, width, headerPad, lines.push) to calculate visibleLength =
headerTextWithoutColors.length and then set headerPad = "
".repeat(Math.floor((width - visibleLength) / 2)).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 01dac6c4-84ac-4f63-9bf1-40b8c2a368a6
📒 Files selected for processing (1)
.opencode/PAI/Tools/Banner.ts
| // Header: PAI-OpenCode v3.0 | Personal AI Infrastructure | ||
| const paiColored = `${C.navy}P${RESET}${C.medBlue}A${RESET}${C.lightBlue}I${RESET}`; | ||
| const headerText = `${paiColored} ${C.steel}|${RESET} ${C.slate}Personal AI Infrastructure${RESET}`; | ||
| const headerLen = 33; // "PAI | Personal AI Infrastructure" | ||
| const headerText = `${paiColored}${C.slate}-OpenCode ${C.silver}v${stats.paiVersion}${RESET} ${C.steel}|${RESET} ${C.slate}Personal AI Infrastructure${RESET}`; | ||
| const headerLen = 44; // "PAI-OpenCode v3.0.0 | Personal AI Infrastructure" | ||
| const headerPad = " ".repeat(Math.floor((width - headerLen) / 2)); | ||
| lines.push(`${headerPad}${headerText}`); |
There was a problem hiding this comment.
headerLen calculation appears slightly off.
The visible length of "PAI-OpenCode v3.0.0 | Personal AI Infrastructure" is 48 characters, but headerLen is set to 44. This will cause the header to be slightly off-center (~2 characters to the right).
Note: The length varies with version string (e.g., v10.0.0 would be 49 chars). Consider computing dynamically or adjusting to 48 for typical version strings.
Suggested fix
- const headerLen = 44; // "PAI-OpenCode v3.0.0 | Personal AI Infrastructure"
+ const headerLen = 48; // "PAI-OpenCode v3.0.0 | Personal AI Infrastructure"📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // Header: PAI-OpenCode v3.0 | Personal AI Infrastructure | |
| const paiColored = `${C.navy}P${RESET}${C.medBlue}A${RESET}${C.lightBlue}I${RESET}`; | |
| const headerText = `${paiColored} ${C.steel}|${RESET} ${C.slate}Personal AI Infrastructure${RESET}`; | |
| const headerLen = 33; // "PAI | Personal AI Infrastructure" | |
| const headerText = `${paiColored}${C.slate}-OpenCode ${C.silver}v${stats.paiVersion}${RESET} ${C.steel}|${RESET} ${C.slate}Personal AI Infrastructure${RESET}`; | |
| const headerLen = 44; // "PAI-OpenCode v3.0.0 | Personal AI Infrastructure" | |
| const headerPad = " ".repeat(Math.floor((width - headerLen) / 2)); | |
| lines.push(`${headerPad}${headerText}`); | |
| // Header: PAI-OpenCode v3.0 | Personal AI Infrastructure | |
| const paiColored = `${C.navy}P${RESET}${C.medBlue}A${RESET}${C.lightBlue}I${RESET}`; | |
| const headerText = `${paiColored}${C.slate}-OpenCode ${C.silver}v${stats.paiVersion}${RESET} ${C.steel}|${RESET} ${C.slate}Personal AI Infrastructure${RESET}`; | |
| const headerLen = 48; // "PAI-OpenCode v3.0.0 | Personal AI Infrastructure" | |
| const headerPad = " ".repeat(Math.floor((width - headerLen) / 2)); | |
| lines.push(`${headerPad}${headerText}`); |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.opencode/PAI/Tools/Banner.ts around lines 328 - 333, The hardcoded
headerLen (44) is incorrect for the visible header length; instead compute the
visible length dynamically by stripping ANSI/color sequences from headerText
(e.g., remove /\x1b\[[0-9;]*m/g) and use that length to compute headerPad so
centering uses the actual visible character count; update the code around
headerLen/headerPad/headerText (and keep usage of stats.paiVersion, width,
headerPad, lines.push) to calculate visibleLength =
headerTextWithoutColors.length and then set headerPad = "
".repeat(Math.floor((width - visibleLength) / 2)).
|
|
||
| const creditLine = `${C.muted}Built on PAI by Daniel Miessler \u00b7 github.com/danielmiessler/PAI${RESET}`; | ||
| const creditLen = 61; // visible length | ||
| const creditPad = " ".repeat(Math.floor((width - creditLen) / 2)); | ||
| lines.push(`${creditPad}${creditLine}`); | ||
| lines.push(""); |
There was a problem hiding this comment.
creditLen calculation appears slightly off.
The visible length of "Built on PAI by Daniel Miessler · github.com/danielmiessler/PAI" is 63 characters, but creditLen is set to 61. This will cause slight off-center alignment.
Suggested fix
- const creditLen = 61; // visible length
+ const creditLen = 63; // visible length📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const creditLine = `${C.muted}Built on PAI by Daniel Miessler \u00b7 github.com/danielmiessler/PAI${RESET}`; | |
| const creditLen = 61; // visible length | |
| const creditPad = " ".repeat(Math.floor((width - creditLen) / 2)); | |
| lines.push(`${creditPad}${creditLine}`); | |
| lines.push(""); | |
| const creditLine = `${C.muted}Built on PAI by Daniel Miessler \u00b7 github.com/danielmiessler/PAI${RESET}`; | |
| const creditLen = 63; // visible length | |
| const creditPad = " ".repeat(Math.floor((width - creditLen) / 2)); | |
| lines.push(`${creditPad}${creditLine}`); | |
| lines.push(""); |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.opencode/PAI/Tools/Banner.ts around lines 363 - 368, The center alignment
is off because creditLen is hardcoded as 61 while the visible text is 63; update
the code around creditLine/creditLen/creditPad to compute the visible length
dynamically (e.g., define the plain text "Built on PAI by Daniel Miessler ·
github.com/danielmiessler/PAI" and set creditLen = visibleText.length) or simply
change creditLen to 63 so creditPad centers correctly before pushing the line
with lines.push(`${creditPad}${creditLine}`).
| const headerText = `${paiColored}${C.slate}-OpenCode ${C.silver}v${stats.paiVersion}${RESET} ${C.steel}|${RESET} ${C.slate}Personal AI Infrastructure${RESET}`; | ||
| const headerPad = " ".repeat(Math.max(0, Math.floor((width - 44) / 2))); | ||
| lines.push(`${headerPad}${headerText}`); | ||
| lines.push(""); |
There was a problem hiding this comment.
Same headerLen discrepancy as the Navy banner.
The header width used for centering (44) should be 48 to match the actual visible text length.
Suggested fix
- const headerPad = " ".repeat(Math.max(0, Math.floor((width - 44) / 2)));
+ const headerPad = " ".repeat(Math.max(0, Math.floor((width - 48) / 2)));📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const headerText = `${paiColored}${C.slate}-OpenCode ${C.silver}v${stats.paiVersion}${RESET} ${C.steel}|${RESET} ${C.slate}Personal AI Infrastructure${RESET}`; | |
| const headerPad = " ".repeat(Math.max(0, Math.floor((width - 44) / 2))); | |
| lines.push(`${headerPad}${headerText}`); | |
| lines.push(""); | |
| const headerText = `${paiColored}${C.slate}-OpenCode ${C.silver}v${stats.paiVersion}${RESET} ${C.steel}|${RESET} ${C.slate}Personal AI Infrastructure${RESET}`; | |
| const headerPad = " ".repeat(Math.max(0, Math.floor((width - 48) / 2))); | |
| lines.push(`${headerPad}${headerText}`); | |
| lines.push(""); |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.opencode/PAI/Tools/Banner.ts around lines 683 - 686, The centering uses a
hardcoded 44 width causing misalignment; update the calculation in Banner.ts to
use the correct visible header length (48) by replacing the 44 in the headerPad
computation (the line that computes headerPad using " ".repeat(Math.max(0,
Math.floor((width - 44) / 2)))) with 48 (or compute the actual headerText length
dynamically) so headerText is centered correctly; adjust the same constant
wherever the Navy banner used 48 to keep behavior consistent.
| const creditLine = `${C.steel}Built on PAI by Daniel Miessler \u00b7 github.com/danielmiessler/PAI${RESET}`; | ||
| const creditPad = " ".repeat(Math.max(0, Math.floor((width - 61) / 2))); | ||
| lines.push(`${creditPad}${creditLine}`); | ||
| lines.push(""); |
There was a problem hiding this comment.
Same creditLen discrepancy as the Navy banner.
The credit width used for centering (61) should be 63 to match the actual visible text length.
Suggested fix
- const creditPad = " ".repeat(Math.max(0, Math.floor((width - 61) / 2)));
+ const creditPad = " ".repeat(Math.max(0, Math.floor((width - 63) / 2)));📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const creditLine = `${C.steel}Built on PAI by Daniel Miessler \u00b7 github.com/danielmiessler/PAI${RESET}`; | |
| const creditPad = " ".repeat(Math.max(0, Math.floor((width - 61) / 2))); | |
| lines.push(`${creditPad}${creditLine}`); | |
| lines.push(""); | |
| const creditLine = `${C.steel}Built on PAI by Daniel Miessler \u00b7 github.com/danielmiessler/PAI${RESET}`; | |
| const creditPad = " ".repeat(Math.max(0, Math.floor((width - 63) / 2))); | |
| lines.push(`${creditPad}${creditLine}`); | |
| lines.push(""); |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.opencode/PAI/Tools/Banner.ts around lines 705 - 708, The credit centering
uses a hardcoded 61 width causing off-by-2 alignment; update the centering logic
in Banner.ts where creditLine and creditPad are computed (variables creditLine,
creditPad, and subsequent lines.push calls) to use the correct visible length
(change the hardcoded 61 to 63) or, better, compute the visible length
dynamically by stripping ANSI/color codes from creditLine and using that length
when calculating " ".repeat(Math.max(0, Math.floor((width - visibleLen) / 2)));
ensure the same approach is applied where the Navy banner had the same fix.
|
Closing — change folded into release PR #139 as part of v3.0. |
Summary
When users type
pai, the startup banner was showing vanilla PAI branding (v4.0.3, Daniel Miessler's repo URL) instead of PAI-OpenCode identifiers.Changes (
Banner.ts)paiVersion = "4.0.3"(hardcoded default)paiVersion = "3.0.0"repoUrl = "github.com/danielmiessler/PAI"repoUrl = "github.com/Steffen025/pai-opencode"settings.pai?.version || "2.0"settings.pai?.version || "3.0.0"PAI | Personal AI InfrastructurePAI-OpenCode v3.0.0 | Personal AI InfrastructureBuilt on PAI by Daniel Miessler · github.com/danielmiessler/PAIclaude --versionfor version detectionopencode --versionResult
github.com/Steffen025/pai-opencode)claudebinarySummary by CodeRabbit