mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-02 20:18:35 +00:00
* feat(core): add probeElementInSource for source-existence checks
* feat(core): add probe-element endpoint for source-existence checks
* feat(studio): gate editing capabilities on source existence
* fix(studio): enrich save_failure telemetry with target details
* feat(studio): async selection resolution with source probe
Make `resolveDomEditSelection` async and wire a `probeSourceElement` call
into the selection path so elements generated by scripts (not present in the
source HTML) are detected early and have all edit capabilities disabled with
a clear reason message ("This element is generated by a script and cannot be
edited visually.").
Part A – core probe logic:
- `domEditingLayers.ts`: `resolveDomEditSelection` is now async; calls
`probeSourceElement` (POST /api/projects/:id/file-mutations/probe-element/:file)
when `projectId` is supplied and the element has a stable id/selector.
`existsInSource: false` flows into `resolveDomEditCapabilities`, which
disables all write capabilities with the appropriate reason.
- `domEditingLayers.ts`: `refreshDomEditSelection` promoted to async.
- `files.ts`: new `probe-element` route; extracted `resolveProjectPath`,
`resolveFileMutationContext`, `writeIfChanged`, and `parseMutationBody`
helpers to eliminate repeated boilerplate across remove/patch/probe handlers.
Part B – caller propagation (all eight consumer sites):
- `useDomSelection.ts`: `buildDomSelectionFromTarget`,
`resolveDomSelectionFromPreviewPoint`,
`buildDomSelectionForTimelineElement`, `handleTimelineElementSelect`,
`refreshDomEditSelectionFromPreview`, and
`refreshDomEditGroupSelectionsFromPreview` all made async; `projectId`
forwarded into `resolveDomEditSelection`.
- `useDomEditCommits.ts`, `useDomEditTextCommits.ts`: updated
`buildDomSelectionFromTarget` parameter type; added `await` at call sites.
- `useDomEditSession.ts`: inner `syncSelectionFromDocument` made async; fire
with `void` to satisfy the surrounding effect.
- `usePreviewInteraction.ts`: `handlePreviewCanvasMouseDown` and
`handlePreviewCanvasPointerMove` made async (React ignores handler return
values, so this is safe).
- `useStudioUrlState.ts`: deferred `buildDomSelectionFromTarget` call
converted to `.then()` chain with `void` prefix so the effect stays sync.
- `LayersPanel.tsx`: `seekToLayer`, `handleSelectLayer`, and
`handleLayerHover` made async.
- `DomEditOverlay.tsx` / `useDomEditOverlayGestures.ts`: `onCanvasPointerMove`
return type widened to `Promise<DomEditSelection | null>`; pointer-down
handler falls back to `hoverSelectionRef.current` (always populated by a
prior hover) instead of awaiting the async move callback inline.
Part C – test and tooling fixes:
- `lefthook.yml`: filesize hook shell loop explicitly skips `*.test.ts/tsx`
files as a guard against a lefthook v2.1.6 bug where `exclude` patterns are
not applied to `{staged_files}` in shell scripts.
- `domEditing.test.ts`: all `it()` blocks calling `resolveDomEditSelection`
made async with `await`.
- `DomEditOverlay.test.ts`: mock updated to return `Promise.resolve(selection)`
and `hoverSelection` pre-seeded so pointer-down test works with the new
hover-first path.
- `studioUrlState.test.ts`: `buildDomSelectionFromTarget` mocks wrapped in
`Promise.resolve()`; seek/selection hydration test made async with
`await act(async () => { await Promise.resolve(); })` to flush microtasks.
* feat(cli): add global error handlers for crash telemetry
Register process-level uncaughtException and unhandledRejection handlers
that fire trackCliError so unhandled crashes are captured in telemetry.
Add the trackCliError function to events.ts and re-export it from the
telemetry barrel.
* feat(cli): track per-command success/failure and duration
* test(core): add integration test for JS-created element probe scenario
* fix: address PR review feedback
- uncaughtException handler now calls process.exit(1) after flushing
- cli_command_result uses real exit code from process "exit" event
- drop stack_trace from cli_error (contains filesystem paths)
- skip source probe during hover — only probe on click/selection
- format .fallowrc.jsonc
* fix(cli): restore stack_trace in cli_error telemetry
* fix(cli): use captured module refs in exit handlers instead of dead import()
44 lines
1.8 KiB
YAML
44 lines
1.8 KiB
YAML
pre-commit:
|
|
parallel: true
|
|
commands:
|
|
lint:
|
|
glob: "*.{js,jsx,ts,tsx}"
|
|
run: bunx oxlint {staged_files}
|
|
format:
|
|
glob: "*.{js,jsx,ts,tsx,json,md,yaml,yml}"
|
|
# --no-error-on-unmatched-pattern: don't fail when staged files all
|
|
# fall under .prettierignore (e.g. docs-only changes to docs/docs.json).
|
|
run: bunx oxfmt --check --no-error-on-unmatched-pattern {staged_files}
|
|
typecheck:
|
|
glob: "*.{ts,tsx}"
|
|
run: cd packages/core && bunx tsc --noEmit && cd ../studio && bunx tsc --noEmit
|
|
# Mirrors the CI gate (same `--base origin/main` so the local hook can't
|
|
# pass on a branch CI would fail). Audits the working tree, which means
|
|
# unstaged WIP in `packages/**` is part of the diff — stash before
|
|
# committing if that surprises you. `--gate new-only` (the default) only
|
|
# fails on issues introduced by the branch, not inherited findings.
|
|
fallow:
|
|
glob: "packages/**/*.{ts,tsx,mts,cts,js,jsx,mjs,cjs}"
|
|
run: bunx fallow audit --base origin/main --fail-on-issues
|
|
filesize:
|
|
# Scoped to packages/studio — the 600 LOC limit is a studio architecture
|
|
# standard enforced as part of the App.tsx decomposition work. Player and
|
|
# other packages enforce size discipline via code review and convention.
|
|
glob: "packages/studio/**/*.{ts,tsx}"
|
|
exclude: "(\\.test\\.(ts|tsx)$|\\.generated\\.)"
|
|
run: |
|
|
for f in {staged_files}; do
|
|
# Skip test and generated files (exclude pattern backup in case lefthook doesn't filter)
|
|
case "$f" in *.test.ts|*.test.tsx|*.generated.*) continue ;; esac
|
|
lines=$(wc -l < "$f")
|
|
if [ "$lines" -gt 600 ]; then
|
|
echo "ERROR: $f has $lines lines (max 600)"
|
|
exit 1
|
|
fi
|
|
done
|
|
|
|
commit-msg:
|
|
commands:
|
|
commitlint:
|
|
run: bunx commitlint --edit "{1}"
|