refactor: delete orphan declarations flagged by fallow (#949)

* ci: run fallow audit in lefthook pre-commit

Mirrors the same `fallow audit --base ... --fail-on-issues` check that
runs in CI, but locally against HEAD so issues surface at commit time
instead of after the push round-trip.

Scoped to `packages/**` source files via the glob — non-code edits
(README, docs, top-level configs) skip the hook entirely.

Measured locally: ~5s in parallel with the existing lint/format/typecheck
checks. Doesn't extend wall-clock time because typecheck (~11s) is the
long pole, and lefthook runs commands in parallel.

The default `--gate new-only` means inherited findings don't block the
commit — same gate behavior as CI, so local pre-commit and PR audit
agree.

* refactor: delete orphan declarations flagged by fallow

After fallow's auto-fix de-exports unused symbols, oxlint surfaces them
as no-unused-vars. This PR deletes those orphan declarations outright.

Biggest cleanup: studio/src/icons/SystemIcons.tsx shrinks from 132 to 57
lines — 33 unused icon wrappers and their phosphor-icon imports deleted.

Other deletions across 14 more files covering paired getter/setters,
helper functions, dead env constants, internal components with no
callers, and cascading unused imports.

Cascade-causing files held back for follow-up PRs: renderOrchestrator
barrel of captureCost re-exports, telemetry/portUtils/remote barrels,
Button.tsx + ui/index.ts (would orphan whole file), studioMotion
type re-exports.

Test plan: typecheck clean across 8 packages, oxlint + oxfmt clean,
fallow audit exit 0 (remaining findings inherited), cli + studio
vitest suites pass.
This commit is contained in:
James Russo
2026-05-18 21:11:03 -07:00
committed by GitHub
parent b6b7bcb51a
commit 2729ee5087
16 changed files with 9 additions and 453 deletions
-10
View File
@@ -13,12 +13,6 @@ const CACHE_DIR = join(homedir(), ".cache", "hyperframes", "chrome");
// too or it silently picks system Chrome over a perfectly good headless-shell.
const PUPPETEER_CACHE_DIR = join(homedir(), ".cache", "puppeteer", "chrome-headless-shell");
/** Override browser path via --browser-path flag. Takes priority over env var. */
let _browserPathOverride: string | undefined;
export function setBrowserPath(path: string): void {
_browserPathOverride = path;
}
export type BrowserSource = "env" | "cache" | "system" | "download";
export interface BrowserResult {
@@ -61,10 +55,6 @@ function whichBinary(name: string): string | undefined {
}
function findFromEnv(): BrowserResult | undefined {
// --browser-path flag takes priority
if (_browserPathOverride && existsSync(_browserPathOverride)) {
return { executablePath: _browserPathOverride, source: "env" };
}
const envPath = process.env["HYPERFRAMES_BROWSER_PATH"];
if (envPath && existsSync(envPath)) {
return { executablePath: envPath, source: "env" };
@@ -288,76 +288,3 @@ function getWidthParam(url: string): number {
return 0;
}
}
/**
* Format cataloged assets as markdown for the DESIGN.md Assets section.
* Matches Aura.build's format: grouped by type, named from file paths.
*/
export function formatAssetCatalog(assets: CatalogedAsset[]): string {
if (assets.length === 0) return "No assets detected.\n";
// Group by type
const groups: Record<string, CatalogedAsset[]> = {};
for (const a of assets) {
const group = a.type;
if (!groups[group]) groups[group] = [];
groups[group]!.push(a);
}
const lines: string[] = [];
// Output in order: Fonts, Images, Videos, Icons, Background, Other
const order: CatalogedAsset["type"][] = ["Font", "Image", "Video", "Icon", "Background", "Other"];
for (const type of order) {
const group = groups[type];
if (!group || group.length === 0) continue;
const sectionName =
type === "Font"
? "Fonts"
: type === "Image"
? "Images"
: type === "Video"
? "Videos"
: type === "Icon"
? "Icons"
: type === "Background"
? "Backgrounds"
: "Other";
lines.push(`### ${sectionName}`);
for (const a of group) {
const name = a.notes || deriveAssetName(a.url);
const contexts = a.contexts.join(", ");
lines.push(`- **${name}**: ${a.url} — contexts: ${contexts}`);
}
lines.push("");
}
return lines.join("\n");
}
/**
* Derive a human-readable name from a URL's file path.
* E.g., "ConnectBentoBackground.jpg" → "Connect Bento Background"
*/
function deriveAssetName(url: string): string {
try {
const u = new URL(url);
const path = u.pathname;
// Get filename without extension
const filename = path.split("/").pop() || "";
const nameWithoutExt = filename.replace(/\.[^.]+$/, "");
// Remove hash suffixes (e.g., "Sohne.cb178166" → "Sohne")
const cleaned = nameWithoutExt.replace(/\.[a-f0-9]{6,}$/, "");
// Convert camelCase/PascalCase to spaces
const spaced = cleaned
.replace(/([a-z])([A-Z])/g, "$1 $2")
.replace(/[-_]/g, " ")
.replace(/\s+/g, " ")
.trim();
return spaced || filename;
} catch {
return "Asset";
}
}