feat: add Gemini vision optimization, custom canvas geometry, 2-column layout, detailed layout reporting, fix Windows build path bug - #252
Open
iG8R wants to merge 2 commits into
Open
Conversation
…out, Detailed Layout Reporting, fix Windows Build Path Bug
Fix Gemini Default Width Fallback (src/core/library.ts): Ensure default Gemini exports resolve directly to 1536px instead of evaluating opts.cols * cellW + 8 (1538px), preventing a 2px spillover into an accidental 6th tile.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📌 Motivation & Background
pxpipewas originally built around Anthropic’s vision architecture (scripts/build.mjsfailed on Windows due to an invalidfile://URL interpolation on drive-letter paths (resulting inCannot find module 'F:\F:\...').🚀 Key Changes & Features
1. Dedicated Gemini Vision Profiles (
src/core/gemini-model-profiles.ts)gemini-2.0-flash,gemini-1.5-flash,gemini-1.5-pro,gemini-3.6-flash, andgemini-3.7-flash.2. Universal Dynamic Geometry Adapter (
src/core/render.ts)computeCanvasGeometry(targetWidth, targetHeight, cellW, cellH):colsandlinesfor any arbitrary dimensions (e.g.,spleen-5x8,jbmono10,jbmono14).padXLeft = Math.ceil(slack / 2)).3. Two-Column Layout Engine (
--columns 2)renderChunkToPngandrenderTextToPngsUncached.│).4. Dynamic Character Budget Scaling (
src/core/library.ts)dynamicCharBudgetwithmaxLines * maxCols, eliminating premature page breaks caused by the legacy 728px character-cap ceiling.5. CLI Geometry Overrides (
src/core/export.ts&src/node.ts)--width <px>,--height <px>, and--columns <1|2>.--modelprofile by default, with CLI arguments selectively overriding specific layout properties.6. Detailed, Column-Aligned Terminal Reporting (
src/node.ts)printExportReportto display global layout configuration (font, cell pitch, columns, margins).|vertical dividers displaying dimensions, line counts, character counts, file sizes, tile counts, and estimated vision tokens.7. Cross-Platform Build Fix (
scripts/build.mjs)new URL(..., 'file://${tsPkgPath}').pathnamewith standardpath.resolve(path.dirname(tsPkgPath), tscRelative).pnpm run build.🧪 Verification & Results
Tested on a 153,532 character codebase export:
CLI Output Preview:
📂 Modified Files
src/core/gemini-model-profiles.tssrc/core/render.tssrc/core/library.tssrc/core/export.tssrc/node.tsscripts/build.mjs