fix(cli): fixed-name outputs and history turn records replace a link, never write through it (#7911)

* fix(cli): fixed-name outputs and history turn records replace a link, never write through it

transcript.json, hyperframes.json patches, the grade-compare sheet, the batch manifest, diff and
measure outputs, lambda stack state and the history turn records are written through a temp file
renamed into place. A linked hyperframes.json is left alone, and the default .hyperframes/<tool>
output folder is used only when every folder on the way is real.

* fix(cli): measure and diff pictures and sbs.mp4 replace a link, never write through it

writeImage and the diff side-by-side now have ffmpeg write into a new private folder beside the
output, then rename the file over its name. measure frames already staged and renamed its PNGs.
This commit is contained in:
Michael Wang
2026-11-16 02:59:43 +00:00
committed by GitHub
parent 5892788cb3
commit 756b2fcae1
13 changed files with 261 additions and 57 deletions
+3 -2
View File
@@ -11,8 +11,9 @@ import { failCommand } from "../../utils/commandResult.js";
* can symlink the directory.
*/
import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync } from "node:fs";
import { dirname, join } from "node:path";
import { replaceFileAtomically } from "@hyperframes/core/atomic-file";
export interface StackOutputs {
/** Project-name prefix passed to `deploy`. Used as CloudFormation stack-name suffix. */
@@ -52,7 +53,7 @@ export function stateFilePath(
export function writeStackOutputs(outputs: StackOutputs, cwd: string = process.cwd()): string {
const path = stateFilePath(outputs.stackName, cwd);
mkdirSync(dirname(path), { recursive: true });
writeFileSync(path, JSON.stringify(outputs, null, 2) + "\n");
replaceFileAtomically(path, JSON.stringify(outputs, null, 2) + "\n");
return path;
}