Files
hyperframes/packages/cli/src/fontLocalizeCli.ts
T
Michael WangandClaude Opus 5.5 84c7d02a19 fix(cli): keep project folders from choosing the programs and config the CLI runs (#7511)
* fix(cli): resolve helper programs from PATH, never the working directory

On Windows a bare command name is looked up in the working directory before
PATH. The CLI now sets NoDefaultCurrentDirectoryInExePath at startup, which
Node's spawn and cmd.exe both honor and child processes inherit, so tools
such as powershell.exe, taskkill and npx.cmd always come from PATH.

The shared ffmpeg/ffprobe resolver no longer scans the working directory on
Windows and skips relative PATH entries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(cli): keep Python helpers from importing files in the working directory

`python -c` and `python -m` put the working directory first on sys.path, so
a file in the project named like a probed module ran instead of the
installed package. Inline helper code now drops that entry before any
import, and `-m` helpers (pip) run through runpy after the same step. Paths
and arguments are unchanged.

On Windows, findPython also skips a `where` match in the working directory.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(cli): run the skills installer and nested CLI calls independent of the project

The global skills install ran `npx skills@<pin>` in the current folder, so
npm could take the package or registry from that project's node_modules or
.npmrc. It now runs from the home folder; the install is global either way.

When the CLI starts the media-use engine it hands over its own entry file.
The local voice fallback and the audio helpers then run that same CLI with
the same Node instead of resolving `npx hyperframes` from the project.
Without a handed-over entry they behave as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(media-use): load only provider keys from a project .env

The audio scripts copied every key of a project .env into their environment
except two. They now take the same kind of short allowlist the CLI uses:
HeyGen, ElevenLabs and Gemini API keys plus a few harmless settings. Program
overrides, runtime options, credential files and the credential store path
come only from the person's own environment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(cli): build whisper.cpp only from a pinned, verified release

The source-build fallback cloned the upstream default branch. It now clones
the v1.9.5 release tag and refuses to build unless the checkout is the
reviewed commit for that tag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(cli): keep registry caches apart and refuse config install targets

Registry cache file names now include a digest of the exact registry URL,
and each entry records the URL it came from, so one registry's cached
manifest is never read for another. Entries from older versions are
refetched once.

Registry installs refuse targets inside .git or any hidden directory, hidden
configuration files, and package.json, hyperframes.json and
hyperframes.lock.json. An example installed by `init` may still bring its
own package.json and .gitignore.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(capture): keep page text to one line in agent files and validate Vertex keys

Capture writes AGENTS.md, CLAUDE.md and .cursorrules from the page's title,
font names and colours. Page text is now flattened to one short line and
colours must be hex values. Existing agent files that capture did not write
are kept, with a warning.

HYPERFRAMES_VERTEX_SERVICE_ACCOUNT must now be a plain service-account key
with a Google token endpoint; other credential types skip captioning with a
warning.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(cli): find the digest-named registry cache and trim a new file's comment

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(cli): match registry targets as Windows names them; skills install without HOME

Windows drops trailing dots and spaces from a path segment and reads name:stream as
name, so package.json. or .git./hooks reached the files the target rules refuse.
The global skills install now falls back to the temp folder when HOME does not exist.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(cli): turn off the Windows working-directory lookup in every program entry

The warm-check server and client are their own tsup entries and copied the
environment before cli.js set NoDefaultCurrentDirectoryInExePath, so the server
spawned a bare powershell.exe that Windows could take from the project folder.
Every entry that hides child consoles now also loads windowsExeSearch first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(cli): refuse Windows short-name registry targets

A segment like CLAUDE~1 or PACKAG~1.JSO opens the long name on NTFS, so it
reached the files the target rules refuse. The trailing-dot and stream-name
normalization is removed: publication already rejects those segments.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 20:01:19 +00:00

36 lines
1.2 KiB
TypeScript

// fallow-ignore-file unused-file
import "./utils/hideChildConsoles.js";
import "./utils/windowsExeSearch.js";
import { injectDeterministicFontFaces } from "@hyperframes/producer";
import { runFontLocalize, stampFontVersions } from "./fontLocalize.js";
import { PRODUCER_VERSION, VERSION } from "./version.js";
async function readStdin(): Promise<string> {
const chunks: Buffer[] = [];
for await (const chunk of process.stdin) {
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
}
return Buffer.concat(chunks).toString("utf8");
}
/** Standalone-entry main; the bin wrapper owns the actual process exit code. */
export async function main(): Promise<number> {
return runFontLocalize(
{
readInput: readStdin,
writeOutput: (value) => process.stdout.write(value),
writeError: (value) => process.stderr.write(value),
},
async (html) => {
const localized = await injectDeterministicFontFaces(html, {
failClosedFontFetch: true,
allowSystemFontCapture: false,
});
return stampFontVersions(localized, {
producer: PRODUCER_VERSION,
localizer: VERSION,
});
},
);
}