diff --git a/README.md b/README.md index fff8878..c4ab3e4 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,12 @@ Live site: - Core tools: Git, Node.js, pnpm, Python, uv, Bun, Docker Desktop, Docker Engine (Colima on macOS or Docker CE in WSL2 Ubuntu on Windows), and Windows WSL2. - Editor tools: VS Code and the Claude Code VS Code extension. - AI tools: Claude Desktop, Claude Code CLI, Codex App, and Codex CLI. +- Media tools: FFmpeg, yt-dlp, and Deno (the JavaScript runtime yt-dlp needs for YouTube). yt-dlp pulls in Deno automatically. On Windows these use WinGet portable packages (`Gyan.FFmpeg.Essentials`, `yt-dlp.yt-dlp`, `DenoLand.Deno`) with `--scope user`; on macOS they use Homebrew formulae. - Source control tools: GitHub CLI, GitHub auth check, GitLab CLI, and Git identity defaults. - Optional deployment tool: Vercel CLI. +The `video-class` preset (`presetSelection("video-class")`) selects Codex App, FFmpeg, yt-dlp, and Deno for non-developer video classes. It does not add WSL2, Git, or Node.js. + Advanced observability settings for Claude Code CLI and Codex CLI are opt-in. They stay off by default, and the UI's "select all" action does not enable them. Prompt/body collection toggles are also off by default. Docker Engine is selected by default. Docker Desktop remains available as an alternative, but the two options are mutually exclusive. diff --git a/src/App.jsx b/src/App.jsx index 81d9b1b..733732b 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -116,6 +116,7 @@ const GROUP_LABELS = { Core: "기본 도구", Editor: "에디터", "AI tools": "AI 도구", + Media: "미디어 도구", "Web deploy": "웹 배포", "Source control": "소스 관리", Advanced: "고급 설정" @@ -148,6 +149,9 @@ const PACKAGE_TEXT = { "codex-app": { note: "Codex 데스크톱 앱입니다." }, codex: { note: "Codex 명령줄 도구입니다. 공식 설치 순서를 우선 사용합니다." }, "codex-telemetry": { label: "Codex 관측 로그", note: "Codex 실행 로그 설정을 추가합니다." }, + ffmpeg: { note: "영상과 오디오를 변환하고 자르는 ffmpeg 명령을 설치합니다." }, + deno: { note: "yt-dlp가 YouTube를 읽을 때 필요한 JavaScript 실행 환경입니다." }, + "yt-dlp": { note: "영상 다운로드 도구입니다. YouTube용 Deno를 먼저 설치합니다." }, vercel: { note: "Vercel 배포용 명령줄 도구를 설치합니다." }, gh: { note: "GitHub 작업용 gh 명령을 설치합니다." }, "github-auth": { label: "GitHub CLI 로그인", note: "GitHub CLI 로그인 상태를 확인하고 필요한 명령을 안내합니다." }, diff --git a/src/builder.js b/src/builder.js index b446f2e..27956db 100644 --- a/src/builder.js +++ b/src/builder.js @@ -142,7 +142,7 @@ export const PACKAGES = [ group: "AI tools", label: "Codex App", note: "Installs the official OpenAI Codex desktop app.", - presets: [], + presets: ["video-class"], deps: { mac: [], win: [] }, mac: () => ["install_codex_app"], win: () => ["Install-CodexApp"] @@ -167,6 +167,36 @@ export const PACKAGES = [ mac: (settings) => [`configure_codex_telemetry ${telemetryArgs(settings)}`], win: (settings) => [`Set-CodexTelemetry ${telemetryArgs(settings, ps)}`] }, + { + id: "ffmpeg", + group: "Media", + label: "FFmpeg", + note: "Video and audio conversion tool (ffmpeg command).", + presets: ["video-class"], + deps: { mac: ["homebrew"], win: [] }, + mac: () => ['brew_formula "FFmpeg" "ffmpeg" "ffmpeg"'], + win: () => ["Install-Winget -Label 'FFmpeg' -PackageId 'Gyan.FFmpeg.Essentials' -Command 'ffmpeg' -ExtraArgs @('--scope','user')"] + }, + { + id: "deno", + group: "Media", + label: "Deno", + note: "JavaScript runtime that yt-dlp needs for YouTube.", + presets: ["video-class"], + deps: { mac: ["homebrew"], win: [] }, + mac: () => ['brew_formula "Deno" "deno" "deno"'], + win: () => ["Install-Winget -Label 'Deno' -PackageId 'DenoLand.Deno' -Command 'deno' -ExtraArgs @('--scope','user')"] + }, + { + id: "yt-dlp", + group: "Media", + label: "yt-dlp", + note: "Video downloader. Installs Deno first because YouTube needs a JavaScript runtime.", + presets: ["video-class"], + deps: { mac: ["homebrew", "deno"], win: ["deno"] }, + mac: () => ['brew_formula "yt-dlp" "yt-dlp" "yt-dlp"'], + win: () => ["Install-Winget -Label 'yt-dlp' -PackageId 'yt-dlp.yt-dlp' -Command 'yt-dlp' -ExtraArgs @('--scope','user','--skip-dependencies')"] + }, { id: "vercel", group: "Web deploy", @@ -690,6 +720,49 @@ export function buildMacScript(resolved, settings) { ].join("\n"); } +const PS_FUNCTION_START = /^function ([\w-]+)/; + +function escapeRegExp(text) { + return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); +} + +// Drops PowerShell helper functions that neither the selected tools' calls nor other kept helpers reference. +function pruneUnusedFunctions(lines, bodyLines) { + const blocks = []; + const out = []; + for (let i = 0; i < lines.length; i += 1) { + const match = PS_FUNCTION_START.exec(lines[i]); + if (!match) { + out.push({ text: lines[i] }); + continue; + } + const start = i; + if (lines[i].trimEnd().endsWith("{")) { + while (i < lines.length - 1 && lines[i] !== "}") { + i += 1; + } + } + const block = { name: match[1], text: lines.slice(start, i + 1).join("\r\n") }; + blocks.push(block); + out.push(block); + } + const references = (text, name) => new RegExp(`(? !entry.name || kept.has(entry.name)).map((entry) => entry.text); +} + export function buildWindowsScript(resolved, settings) { const body = []; for (const id of visibleResolved(resolved)) { @@ -698,7 +771,7 @@ export function buildWindowsScript(resolved, settings) { body.push(...item.win(settings)); } } - return [ + const header = [ "@echo off", "rem Generated by Dev Setup Builder.", "rem If Windows blocks it: right-click file > Properties > Unblock.", @@ -712,6 +785,8 @@ export function buildWindowsScript(resolved, settings) { "exit /b %EC%", "", "#__PS_SCRIPT_BELOW__", + ]; + const helpers = [ "$ErrorActionPreference = 'Continue'", "$ProgressPreference = 'SilentlyContinue'", "try { chcp 65001 > $null } catch {}", @@ -1152,6 +1227,8 @@ export function buildWindowsScript(resolved, settings) { " Ok 'Git identity defaults set'", "}", "", + ]; + const footer = [ "Refresh-Path", "", ...body, @@ -1165,7 +1242,8 @@ export function buildWindowsScript(resolved, settings) { "}", "Write-Host 'Done. Open a new terminal before using newly installed commands.'", "exit 0" - ].join("\r\n"); + ]; + return [...header, ...pruneUnusedFunctions(helpers, footer), ...footer].join("\r\n"); } export function buildScript(ids, os, settings) { @@ -1251,6 +1329,8 @@ export function selfTest() { claudeNativeIndex >= 0 && claudeNativeIndex < claudeBrewIndex && claudeBrewIndex < claudeNpmIndex, buildMacScript(new Set(["homebrew", "docker"]), settings).includes('brew_cask "Docker Desktop" "docker"'), buildWindowsScript(new Set(["docker"]), settings).includes("Docker.DockerDesktop"), + buildMacScript(resolveSelection(new Set(["yt-dlp"]), "mac"), settings).includes('brew_formula "Deno"'), + buildWindowsScript(resolveSelection(new Set(["yt-dlp"]), "win"), settings).includes("DenoLand.Deno"), buildMacScript(resolveSelection(new Set(["docker-engine"]), "mac"), settings).includes("colima start"), buildWindowsScript(resolveSelection(new Set(["docker-engine"]), "win"), settings).includes("docker-ce docker-ce-cli") ]; diff --git a/tests/e2e/app.spec.js b/tests/e2e/app.spec.js index 75e1005..bbd368a 100644 --- a/tests/e2e/app.spec.js +++ b/tests/e2e/app.spec.js @@ -26,7 +26,7 @@ test("builds scripts and captures primary states", async ({ page }) => { await expect(page.getByRole("heading", { name: "개발 환경 설치 도우미" })).toBeVisible(); await expect(page.getByRole("radio", { name: "macOS" })).toHaveAttribute("aria-checked", "true"); await expect(toolList.getByRole("checkbox", { name: /Windows WSL2/ })).toHaveCount(0); - await expect(toolList.getByRole("checkbox")).toHaveCount(19); + await expect(toolList.getByRole("checkbox")).toHaveCount(22); await expect(toolList.getByRole("checkbox", { name: /Bun/ })).toBeChecked(); await expect(toolList.getByRole("checkbox", { name: /Codex App/ })).toBeChecked(); await expect(toolList.getByRole("checkbox", { name: /Git 사용자 정보 기본값/ })).toBeChecked(); diff --git a/tests/mac.test.js b/tests/mac.test.js index 5fbdb87..864d4c8 100644 --- a/tests/mac.test.js +++ b/tests/mac.test.js @@ -2,6 +2,7 @@ import assert from "node:assert/strict"; import { PACKAGES, buildMacScript, + presetSelection, resolveSelection, selfTest, supportsOs @@ -22,6 +23,15 @@ assert.equal(codex.has("homebrew"), true); assert.equal(nodeIndex >= 0 && nodeIndex < codexCallIndex, true); assert.equal(codexNativeIndex >= 0 && codexNativeIndex < codexBrewIndex && codexBrewIndex < codexNpmIndex, true); +const videoClassMac = resolveSelection(presetSelection("video-class"), "mac"); +const videoClassMacScript = buildMacScript(videoClassMac, settings); +assert.equal(videoClassMac.has("homebrew"), true); +assert.equal(videoClassMac.has("node"), false); +assert.match(videoClassMacScript, /brew_formula "FFmpeg" "ffmpeg" "ffmpeg"/); +assert.match(videoClassMacScript, /brew_formula "Deno" "deno" "deno"/); +assert.match(videoClassMacScript, /brew_formula "yt-dlp" "yt-dlp" "yt-dlp"/); +assert.equal(videoClassMacScript.indexOf('brew_formula "Deno"') < videoClassMacScript.indexOf('brew_formula "yt-dlp"'), true); + const claudeCode = resolveSelection(new Set(["claude-code"]), "mac"); const claudeCodeScript = buildMacScript(claudeCode, settings); const claudeNativeIndex = claudeCodeScript.indexOf("https://claude.ai/install.sh"); diff --git a/tests/windows.test.js b/tests/windows.test.js index 96b54bd..d07d76b 100644 --- a/tests/windows.test.js +++ b/tests/windows.test.js @@ -5,6 +5,7 @@ import { tmpdir } from "node:os"; import { join } from "node:path"; import { buildWindowsScript, + presetSelection, resolveSelection, selfTest } from "../src/builder.js"; @@ -39,6 +40,35 @@ assert.match(codexAppScript, /(^|\r\n)Install-CodexApp(\r\n|$)/); assert.match(codexAppScript, /9PLM9XGG6VKS/); assert.match(codexAppScript, /--source msstore/); +const videoClass = presetSelection("video-class"); +assert.deepEqual(videoClass, new Set(["codex-app", "ffmpeg", "deno", "yt-dlp"])); +const videoClassResolved = resolveSelection(videoClass, "win"); +const videoClassScript = buildWindowsScript(videoClassResolved, settings); +for (const id of ["wsl2", "git", "node"]) { + assert.equal(videoClassResolved.has(id), false, `${id} must stay out of the video-class preset`); +} +assert.match(videoClassScript, /Install-Winget -Label 'FFmpeg' -PackageId 'Gyan\.FFmpeg\.Essentials' -Command 'ffmpeg' -ExtraArgs @\('--scope','user'\)/); +assert.match(videoClassScript, /Install-Winget -Label 'Deno' -PackageId 'DenoLand\.Deno' -Command 'deno' -ExtraArgs @\('--scope','user'\)/); +assert.match(videoClassScript, /Install-Winget -Label 'yt-dlp' -PackageId 'yt-dlp\.yt-dlp' -Command 'yt-dlp' -ExtraArgs @\('--scope','user','--skip-dependencies'\)/); +assert.equal(videoClassScript.indexOf("-PackageId 'DenoLand.Deno'") < videoClassScript.indexOf("-PackageId 'yt-dlp.yt-dlp'"), true); +assert.doesNotMatch(videoClassScript, /Install-WSL2\r\n/); +assert.equal(videoClassScript.indexOf("-PackageId 'Gyan.FFmpeg.Essentials'") < videoClassScript.indexOf("-PackageId 'yt-dlp.yt-dlp'"), true); +assert.doesNotMatch(videoClassScript, /\birm\b|\biex\b|Invoke-Expression/i); +assert.doesNotMatch(videoClassScript, /function (Install-(Bun|Uv|ClaudeCode|CodexCli|DockerEngine|WSL2)|Set-(ClaudeCode|Codex)Telemetry)/); +assert.match(videoClassScript, /function Install-CodexApp/); +assert.match(videoClassScript, /function Test-CodexApp/); + +// Pruning keeps helpers that selected tools still call, including transitive ones. +const claudeCodeFull = buildWindowsScript(resolveSelection(new Set(["claude-code"]), "win"), settings); +assert.match(claudeCodeFull, /function Install-ClaudeCode/); +assert.match(claudeCodeFull, /function Install-NpmGlobal/); +const pnpmOnly = buildWindowsScript(resolveSelection(new Set(["pnpm"]), "win"), settings); +assert.doesNotMatch(pnpmOnly, /function Install-CodexApp/); +assert.doesNotMatch(videoClassScript, /^Set-(ClaudeCode|Codex)Telemetry /m); + +const ytDlp = resolveSelection(new Set(["yt-dlp"]), "win"); +assert.equal(ytDlp.has("deno"), true); + const extension = resolveSelection(new Set(["claude-extension"]), "win"); const extensionScript = buildWindowsScript(extension, settings); @@ -84,7 +114,7 @@ const commandDetector = pythonScript.slice( ); const wingetInstaller = pythonScript.slice( pythonScript.indexOf("function Install-Winget"), - pythonScript.indexOf("function Install-NpmGlobal") + pythonScript.lastIndexOf("\r\nRefresh-Path\r\n") ); const pythonBodyStart = pythonScript.lastIndexOf("$pythonOk = $false"); const pythonBody = pythonScript.slice( @@ -169,7 +199,7 @@ if (!pwsh.error && pwsh.status === 0) { const helpers = codexTelemetryScript.slice( codexTelemetryScript.indexOf("function ConvertTo-TomlString"), - codexTelemetryScript.indexOf("function Check-GitHubAuth") + codexTelemetryScript.lastIndexOf("\r\nRefresh-Path\r\n") ); const call = codexTelemetryScript.split(/\r?\n/).find((line) => line.startsWith("Set-CodexTelemetry ")); const harness = [