From ee8c4a8314f75ffef45757c09868830011ef8d74 Mon Sep 17 00:00:00 2001 From: konard Date: Sun, 26 Jul 2026 08:40:27 +0000 Subject: [PATCH 1/4] Initial commit with task details Adding .gitkeep for PR creation (default mode). This file will be removed when the task is complete. Issue: https://github.com/link-foundation/command-stream/issues/183 --- .gitkeep | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitkeep diff --git a/.gitkeep b/.gitkeep new file mode 100644 index 0000000..6421526 --- /dev/null +++ b/.gitkeep @@ -0,0 +1 @@ +# .gitkeep file auto-generated at 2026-07-26T08:40:27.171Z for PR creation at branch issue-183-49600e8cc302 for issue https://github.com/link-foundation/command-stream/issues/183 \ No newline at end of file From 2e89d4e85f440d6bc514f3a7a880a56cfd9999e4 Mon Sep 17 00:00:00 2001 From: konard Date: Sun, 26 Jul 2026 08:50:02 +0000 Subject: [PATCH 2/4] fix(js): render GIF artifacts on Node.js --- .github/workflows/js.yml | 1 + js/.changeset/fuzzy-gifs-wave.md | 6 +++++ js/src/terminal-artifacts.mjs | 9 +++++--- js/tests/node-terminal-artifacts.mjs | 33 ++++++++++++++++++++++++++++ 4 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 js/.changeset/fuzzy-gifs-wave.md create mode 100644 js/tests/node-terminal-artifacts.mjs diff --git a/.github/workflows/js.yml b/.github/workflows/js.yml index f85241a..ccd8d95 100644 --- a/.github/workflows/js.yml +++ b/.github/workflows/js.yml @@ -185,6 +185,7 @@ jobs: process.exit(1); }); " + node --test js/tests/node-terminal-artifacts.mjs release: name: Release JavaScript package diff --git a/js/.changeset/fuzzy-gifs-wave.md b/js/.changeset/fuzzy-gifs-wave.md new file mode 100644 index 0000000..4fdf904 --- /dev/null +++ b/js/.changeset/fuzzy-gifs-wave.md @@ -0,0 +1,6 @@ +--- +'command-stream': patch +--- + +Fix GIF terminal artifact rendering on Node.js by supporting the CommonJS +default export exposed by `gifenc`. diff --git a/js/src/terminal-artifacts.mjs b/js/src/terminal-artifacts.mjs index 6d2624b..d6f3dcc 100644 --- a/js/src/terminal-artifacts.mjs +++ b/js/src/terminal-artifacts.mjs @@ -407,9 +407,12 @@ const renderRecordingSvg = ({ frames, options, font }) => { }; const renderGif = async ({ frames, options, font }) => { - const [{ Resvg }, { GIFEncoder, applyPalette, quantize }] = await Promise.all( - [import('@resvg/resvg-js'), import('gifenc')] - ); + const [{ Resvg }, gifencModule] = await Promise.all([ + import('@resvg/resvg-js'), + import('gifenc'), + ]); + const gifenc = gifencModule.GIFEncoder ? gifencModule : gifencModule.default; + const { GIFEncoder, applyPalette, quantize } = gifenc; const { width, height } = dimensions(frames, options); const { times } = frameTimes(frames, options.idleTimeLimit); const sheet = svgShell({ diff --git a/js/tests/node-terminal-artifacts.mjs b/js/tests/node-terminal-artifacts.mjs new file mode 100644 index 0000000..fcb79db --- /dev/null +++ b/js/tests/node-terminal-artifacts.mjs @@ -0,0 +1,33 @@ +import assert from 'node:assert/strict'; +import { mkdtemp, readFile, rm } from 'node:fs/promises'; +import { tmpdir } from 'node:os'; +import { join } from 'node:path'; +import { test } from 'node:test'; + +import { writeTerminalArtifacts } from '../src/terminal-artifacts.mjs'; + +test('writes GIF terminal artifacts in Node.js', async (context) => { + const directory = await mkdtemp(join(tmpdir(), 'command-stream-node-gif-')); + context.after(() => rm(directory, { force: true, recursive: true })); + + await writeTerminalArtifacts({ + directory, + frames: [ + { + time: 0, + cols: 1, + rows: 1, + lines: [''], + cells: [[]], + }, + ], + transcript: '', + asciicast: { + header: { version: 2, width: 1, height: 1, timestamp: 0, env: {} }, + events: [], + }, + }); + + const gif = await readFile(join(directory, 'recording.gif')); + assert.equal(gif.subarray(0, 6).toString(), 'GIF89a'); +}); From 60833a7d8ba5fbba9fc8335d05438f0028c9c74e Mon Sep 17 00:00:00 2001 From: konard Date: Sun, 26 Jul 2026 08:52:43 +0000 Subject: [PATCH 3/4] ci(js): install dependencies for Node artifact test --- .github/workflows/js.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/js.yml b/.github/workflows/js.yml index ccd8d95..a129ad1 100644 --- a/.github/workflows/js.yml +++ b/.github/workflows/js.yml @@ -174,6 +174,11 @@ jobs: with: node-version: ${{ matrix.node-version }} + - name: Install dependencies (Node) + if: matrix.runtime == 'node' + working-directory: js + run: npm ci + - name: Test Node.js compatibility if: matrix.runtime == 'node' run: | From 18331e704734529cf2470fba41e48ca26a70e06c Mon Sep 17 00:00:00 2001 From: konard Date: Sun, 26 Jul 2026 08:55:22 +0000 Subject: [PATCH 4/4] chore: remove issue branch scaffold --- .gitkeep | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .gitkeep diff --git a/.gitkeep b/.gitkeep deleted file mode 100644 index 6421526..0000000 --- a/.gitkeep +++ /dev/null @@ -1 +0,0 @@ -# .gitkeep file auto-generated at 2026-07-26T08:40:27.171Z for PR creation at branch issue-183-49600e8cc302 for issue https://github.com/link-foundation/command-stream/issues/183 \ No newline at end of file