* Write ` /.partial` so an agent inspecting the dir can detect * an aborted bundle. The marker is small JSON — the contract is "if * `.partial` exists, do not consume ` ` until the CLI is re-run * and `.partial` disappears." * * We DO NOT clean the `.tmp/` contents on partial — leaving
( dir: string, err: unknown, requestId: string, snapshotId: string, )
| 762 | * call clears them. |
| 763 | */ |
| 764 | async function writePartialMarker( |
| 765 | dir: string, |
| 766 | err: unknown, |
| 767 | requestId: string, |
| 768 | snapshotId: string, |
| 769 | ): Promise<void> { |
| 770 | await mkdir(dir, { recursive: true }); |
| 771 | const body = { |
| 772 | schemaVersion: BUNDLE_SCHEMA_VERSION, |
| 773 | snapshotId, |
| 774 | requestId, |
| 775 | error: err instanceof Error ? err.message : String(err), |
| 776 | createdAt: new Date().toISOString(), |
| 777 | }; |
| 778 | await writeFile(join(dir, '.partial'), JSON.stringify(body, null, 2) + '\n', 'utf8'); |
| 779 | } |
| 780 | |
| 781 | function bundleIntegrityError( |
| 782 | reason: BundleIntegrityReason, |
no test coverage detected