Turn any idea, plan, or codebase into a beautiful interactive diagram. An agent skill for Claude Code, Codex, and more.
HTML agent-skillsai-agentsarchitecture-diagramclaude-codeclaude-skillscodexcoding-agentsdeepseek-harnessdeveloper-toolsdiagramsdiagrams-as-codedsh-pluginflowchartllmmermaidopencodesequence-diagramsoftware-architecturesystem-designvisualization
fix(showcase): select the Windows command without raw path equality
杨嘉伟fe84249ca2ca
diff --git a/scripts/build-readme-showcase.mjs b/scripts/build-readme-showcase.mjsindex c18d77c5..534501c4 100644--- a/scripts/build-readme-showcase.mjs+++ b/scripts/build-readme-showcase.mjs@@ -68,13 +68,13 @@ function executable(file) {}}-function commandPath(command, spawnCommand = spawnSync) {- if (process.platform === 'win32') {+function commandPath(command, spawnCommand = spawnSync, platform = process.platform) {+ if (platform === 'win32') {const result = spawnCommand('where.exe', [command], {encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'], windowsHide: true,});if (result.error || result.status !== 0) return null;- return result.stdout.trim().split(/\r?\n/).find(Boolean) || null;+ return result.stdout.split(/\r?\n/u).map(entry => entry.trim()).find(Boolean) || null;}const result = spawnCommand('sh', ['-c', 'command -v "$1"', 'archify-showcase', command], {encoding: 'utf8',@@ -378,7 +378,8 @@ async function main() {}}-const invokedDirectly = process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url);+const invokedDirectly = process.argv[1]+ && import.meta.url === pathToFileURL(process.argv[1]).href;if (invokedDirectly) {main().catch(error => {console.error(error.stack || error.message);diff --git a/test/readme-showcase.test.mjs b/test/readme-showcase.test.mjsindex 9da4bbd7..f05897fe 100644--- a/test/readme-showcase.test.mjs+++ b/test/readme-showcase.test.mjs@@ -173,13 +173,13 @@ test('Windows command lookup and ffmpeg launch keep their boundary diagnostics',const lookup = showcase.commandPath('ffmpeg', () => ({status: 0,stdout: `\r\n${selected}\r\nC:\\Other\\ffmpeg.exe\r\n`,- }));+ }), 'win32');assert.equal(lookup, selected);assert.equal(showcase.commandPath('ffmpeg', () => ({status: 1,stdout: '',error: new Error('where failed'),- })), null);+ }), 'win32'), null);assert.throws(() => showcase.launchFfmpeg(selected, ['-version'], () => ({status: null,