codeburn/app/scripts/buildStamp.ts
iamtoruk 0a76626d21 fix(app): clean build stamp, splash without hash, About checks for updates
- build stamp ignores the pricing-snapshot files the build regenerates,
  so a release checkout no longer shows a false -dirty
- splash shows just the flame, CodeBurn, and the version (dropped the
  commit-hash line); the clean build id stays in About only
- About 'Check for updates' uses the in-app checker and reports inline
  ('You're on the latest' / 'Update available: X · Download') instead
  of blindly opening the releases page

392/392.
2026-07-17 14:30:00 -07:00

33 lines
1.4 KiB
TypeScript

// The build stamp's dirty check, factored out so it is unit-testable.
//
// Packaging regenerates the pricing-snapshot files from a live feed
// (scripts/bundle-litellm.mjs) DURING the build, so an otherwise-clean release
// checkout shows those two tracked files as modified at stamp time. Treating that
// as "-dirty" is a false positive: the committed source is clean. The dirty flag
// must therefore ignore exactly these regenerated files.
/** Tracked files the packaging build rewrites from a live feed. Changes limited
* to these must NOT flip the build stamp to "-dirty". */
export const GENERATED_DATA_FILES = [
'src/data/litellm-snapshot.json',
'src/data/pricing-fallback.json',
]
/**
* True when `git status --porcelain` reports any change OTHER than the
* regenerated pricing snapshots. Porcelain lines are `XY <path>` (path from
* column 3); a rename is `XY old -> new`, counted by its destination. Quoted
* paths (special chars) are unquoted before comparison.
*/
export function isDirtyIgnoringGenerated(porcelain: string): boolean {
const generated = new Set(GENERATED_DATA_FILES)
for (const line of porcelain.split('\n')) {
if (!line.trim()) continue
let path = line.slice(3).trim()
const arrow = path.indexOf(' -> ')
if (arrow !== -1) path = path.slice(arrow + 4)
path = path.replace(/^"(.*)"$/, '$1')
if (!generated.has(path)) return true
}
return false
}