mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-10-30 09:16:55 +00:00
* feat(cli): add hyperframes/api entry with transcribe and removeBackground HyperFrames Desktop runs the CLI as a child process, relaunching Electron with ELECTRON_RUN_AS_NODE=1. A programmatic entry lets it import plain functions and run them in a utilityProcess instead, so the RunAsNode fuse can be turned off. packages/cli/src/api.ts exports transcribe() and removeBackground(): typed options in, typed result out, progress through callbacks, failures thrown as TranscribeError / RemoveBackgroundError with a code and the original error as cause. Neither prints, reads argv or exits. The transcribe and remove-background commands now keep only flag handling, printing and exit codes, and call these functions. Their output, JSON and exit codes are unchanged. The package gains an exports map with "./api" (built dist plus d.ts) and "./package.json", generated from package-subpaths.json like the sibling packages. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(cli): trim api.ts comments under the package's comment share Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(cli): trim trailing dots without a quadratic regex CodeQL flags the trailing-dots regex on the Parakeet error now that it sits behind a library entry. Same result, linear time. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(cli): make the transcribe API's signal stop every stage Review follow-ups on the api entry: - parakeet-mlx now runs as an async child that the caller's signal can kill. Its failures keep the synchronous run's message, status and stderr. - A pre-aborted signal throws before any setup. Whisper checks the signal before each setup stage, and the model download gets it. - onEngine reports the model whisper runs (small for Spanish, not small.en). The resolver moved to whisper/modelForLanguage.ts so both share it. - api/transcribe.ts imports everything at module scope. The command test hoists its whisper mock, since that module now loads during imports. - whisper's internal TranscribeOptions/TranscribeResult types are renamed WhisperOptions/RunnerResult, so the API's public names are unique. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(cli): let an AbortSignal stop whisper's install and audio prep Review follow-ups on the api entry: - whisper's runtime install (brew, git clone, cmake) and its ffmpeg audio prep run through a new stoppableExecFile when an API caller passes a signal. The child runs off the event loop, an abort ends it and every process it started, and the call rejects with a "cancelled" TranscribeError once they are gone. A failure throws the same error execFileSync throws (message, code, errno, status, signal, stdout, stderr), compared field by field in stoppableExecFile.test.ts. parakeet-mlx uses the same helper. - Without a signal the helper is execFileSync, and the CLI passes none, so the CLI output stays byte for byte the same as hyperframes 0.8.146. - TranscribeOptions.signal now says what it covers: a tool lookup that is already running (capped at 10 seconds) finishes first. - New regressions in api.test.ts abort during a stand-in install step and during a stand-in ffmpeg convert. Both end in under 10 seconds with no process left, and both fail with the old synchronous calls. - Tests load every module at the top of the file: namespace spies replace the importOriginal partial mocks, and node:fs and node:child_process are spied through their default exports and synced with syncBuiltinESMExports. remove-background --info imports its manager statically. The scanner in api.test.ts now reads every file this PR touches and catches importOriginal and vi.importActual. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
24 lines
538 B
TypeScript
24 lines
538 B
TypeScript
import type { KnipConfig } from "knip";
|
|
|
|
const config: KnipConfig = {
|
|
workspaces: {
|
|
"packages/cli": {
|
|
entry: ["src/cli.ts", "src/api.ts"],
|
|
},
|
|
"packages/core": {
|
|
entry: ["src/index.ts", "src/lint/index.ts", "src/compiler/index.ts"],
|
|
},
|
|
"packages/engine": {
|
|
entry: ["src/index.ts"],
|
|
},
|
|
"packages/producer": {
|
|
entry: ["src/index.ts", "src/server.ts"],
|
|
},
|
|
"packages/studio": {
|
|
entry: ["src/index.ts", "src/styles/tailwind-preset.ts"],
|
|
},
|
|
},
|
|
};
|
|
|
|
export default config;
|