mirror of
https://github.com/mksglu/context-mode.git
synced 2026-09-19 03:27:16 +08:00
10e2850d12
* fix(web): re-apply hero pattern + make Insight user-count dynamic Two regressions snuck back in when the /context-saving rename agent copied from the next branch (which never had the hero pattern fix). Re-applying on main: - .cm-master + .cm-wordmark: inline-flex → flex (so the hero-tag pill never shares a baseline-aligned row with the wordmark) - .hero-tag: margin-bottom → margin-top + align-self:flex-start (sits below the wordmark on its own line) - Insight wordmark italic: 1.18em → 1em, margin-left .12em → .14em - HTML order: <h1> wordmark first, <p class="hero-tag"> after (matches master/insight/context-saving) Plus making the Insight landing's "287,000+ developers" references dynamic (.js-user-count + the GitHub stats.json fetch shim), so the number matches the OSS plugin's source-of-truth count instead of drifting like the screenshots showed (290k+ on /, 287k+ here). * feat(og): bake live user-count from stats.json into rendered banners OG PNGs are static, so the 287,000+ number drifted away from the landing page (which already reads stats.json live). Solution: - Mark every user-count occurrence in master-og.html and context-saving-og.html with class js-user-count - render-og.mjs now fetches the same stats.json before opening the browser, then runs a one-shot DOM swap on every .js-user-count element before the screenshot Result: each render bakes the freshest count in, no manual update needed. Today's render shows 290,000+ across all three banners. * perf(web): smooth cursor blink on context-saving hero + topnav The hero green cursor was driving compositor work harder than it needed to: steps(2) + a 24px box-shadow meant the GPU repainted the full glow on every tick, which user reported as a low-FPS feel. - animation timing: 1.06s steps(2) → 1.4s ease-in-out (smooth pulse between opacity 1 and 0.28, terminal-feeling without hard flicker) - box-shadow blur: 24px → 18px and alpha .45 → .40 (lighter recompose) - add will-change:opacity + translateZ(0) so the cursor lives on its own composited layer (no repaint of surrounding text) - topnav cursor: same easing pass, renamed keyframe to nav-blink so the hero and nav don't share a single declaration name - prefers-reduced-motion now resolves to a static 0.85 opacity cursor instead of a stuck-on solid block * ci: update install stats * ci: update install stats * ci: update install stats * ci: update install stats * ci: update install stats * ci: update install stats * ci: update install stats * Fix PowerShell Unicode path handling * ci: update install stats * ci: update install stats * ci: update install stats * test: expect UTF-8 BOM in buildPowerShellScriptContent output The duplicate suite at tests/executor.test.ts still asserted the script started with the bare [Console] prelude. After #839 prepends a UTF-8 BOM (U+FEFF) so Windows PowerShell 5.1 detects the script as UTF-8, that startsWith() assertion failed on every platform (macos + ubuntu CI). Update the assertion to expect the BOM, mirroring the new test in tests/core/executor.test.ts and preserving the BOM behavior #839 adds. --------- Co-authored-by: Mert Koseoglu <bm.ksglu@gmail.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
43 lines
1.7 KiB
TypeScript
43 lines
1.7 KiB
TypeScript
import { describe, expect, test } from "vitest";
|
|
import {
|
|
buildPowerShellScriptContent,
|
|
PolyglotExecutor,
|
|
} from "../../src/executor.js";
|
|
import { detectRuntimes, type RuntimeMap } from "../../src/runtime.js";
|
|
|
|
describe("PowerShell script encoding", () => {
|
|
test("prefixes a UTF-8 BOM ahead of the UTF-8 encoding prelude", () => {
|
|
const script = buildPowerShellScriptContent("Write-Output 'ok'");
|
|
|
|
// Windows PowerShell 5.1 only reliably detects a script as UTF-8 when the
|
|
// file opens with a BOM; without it the body is read as the ANSI code page.
|
|
expect(script.charCodeAt(0)).toBe(0xfeff);
|
|
expect(script).toContain("[Console]::InputEncoding = [System.Text.UTF8Encoding]::new()");
|
|
expect(script).toContain("[Console]::OutputEncoding = [System.Text.UTF8Encoding]::new()");
|
|
expect(script).toContain("$OutputEncoding = [System.Text.UTF8Encoding]::new()");
|
|
expect(script.endsWith("Write-Output 'ok'")).toBe(true);
|
|
});
|
|
|
|
test.skipIf(process.platform !== "win32")(
|
|
"preserves non-ASCII stdout and cwd through Windows PowerShell",
|
|
async () => {
|
|
const text = "日本語 café 한글 عربي עבריت Ελληνικά हिन्दी ไทย";
|
|
const cwd = process.cwd();
|
|
const runtimes: RuntimeMap = { ...detectRuntimes(), shell: "powershell.exe" };
|
|
const executor = new PolyglotExecutor({ runtimes });
|
|
|
|
const result = await executor.execute({
|
|
language: "shell",
|
|
code: `$text = '${text}'\nWrite-Output $text\n(Get-Location).Path`,
|
|
cwd,
|
|
timeout: 10_000,
|
|
});
|
|
|
|
expect(result.exitCode).toBe(0);
|
|
expect(result.stderr).toBe("");
|
|
expect(result.stdout).toContain(text);
|
|
expect(result.stdout).toContain(cwd);
|
|
},
|
|
);
|
|
});
|