fix(cli): read actual composition dimensions in info and fix semver update check (#194)

## Summary

- **`info`** **command** now reads actual `data-width`/`data-height` from the root composition element instead of hardcoding 1920x1080 or 1080x1920 based on a parser heuristic that defaults to "portrait"
- **Update check** now uses proper semver comparison instead of string inequality (`!== VERSION`). Previously reported "update available" when installed `0.2.1` and npm had `0.2.0`

**Part 2 of 5** in a stacked PR series fixing E2E test findings.

## Test plan

- [x] `npx hyperframes info` on a 1920x1080 project shows "1920x1080" (not "1080x1920")
- [x] `npx hyperframes info --json` returns correct width/height fields
- [x] Version check no longer reports downgrade as available update
This commit is contained in:
Miguel Ángel
2026-04-02 14:12:48 -07:00
committed by GitHub
parent 5e8ff36675
commit 7f4e4333e5
4 changed files with 43 additions and 12 deletions
+20 -3
View File
@@ -45,7 +45,24 @@ export default defineCommand({
(max, el) => Math.max(max, el.startTime + el.duration),
0,
);
const resolution = parsed.resolution === "portrait" ? "1080x1920" : "1920x1080";
// Read actual dimensions from root composition element
const widthMatch =
html.match(/data-composition-id[^>]*data-width=["'](\d+)["']/) ||
html.match(/data-width=["'](\d+)["'][^>]*data-composition-id/);
const heightMatch =
html.match(/data-composition-id[^>]*data-height=["'](\d+)["']/) ||
html.match(/data-height=["'](\d+)["'][^>]*data-composition-id/);
const width = widthMatch?.[1]
? parseInt(widthMatch[1], 10)
: parsed.resolution === "portrait"
? 1080
: 1920;
const height = heightMatch?.[1]
? parseInt(heightMatch[1], 10)
: parsed.resolution === "portrait"
? 1920
: 1080;
const resolution = `${width}x${height}`;
const size = totalSize(project.dir);
const typeCounts: Record<string, number> = {};
@@ -62,8 +79,8 @@ export default defineCommand({
withMeta({
name: project.name,
resolution: parsed.resolution,
width: parsed.resolution === "portrait" ? 1080 : 1920,
height: parsed.resolution === "portrait" ? 1920 : 1080,
width,
height,
duration: maxEnd,
elements: parsed.elements.length,
tracks: tracks.size,