From 15226feb181861830ce96ac10f2c66ea1912a715 Mon Sep 17 00:00:00 2001 From: Tibsfox Date: Tue, 3 Mar 2026 01:46:52 -0800 Subject: [PATCH] fix(core): complete toPosixPath coverage for Windows output paths Three files emit path.join or path.relative results directly into JSON output without normalizing backslashes on Windows. Wrap these with toPosixPath (already used in core.cjs and init.cjs) so agents receive consistent forward-slash paths on all platforms. Files changed: - phase.cjs: wrap directory path in cmdPhasesFind - commands.cjs: wrap todo path in cmdListTodos, relPath in cmdScaffold - template.cjs: wrap relPath in cmdTemplateFill (both exists and created branches) Co-Authored-By: Claude Opus 4.6 --- get-shit-done/bin/lib/commands.cjs | 6 +++--- get-shit-done/bin/lib/phase.cjs | 4 ++-- get-shit-done/bin/lib/template.cjs | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/get-shit-done/bin/lib/commands.cjs b/get-shit-done/bin/lib/commands.cjs index 829ba993a..e42034946 100644 --- a/get-shit-done/bin/lib/commands.cjs +++ b/get-shit-done/bin/lib/commands.cjs @@ -4,7 +4,7 @@ const fs = require('fs'); const path = require('path'); const { execSync } = require('child_process'); -const { safeReadFile, loadConfig, isGitIgnored, execGit, normalizePhaseName, comparePhaseNum, getArchivedPhaseDirs, generateSlugInternal, getMilestoneInfo, resolveModelInternal, MODEL_PROFILES, output, error, findPhaseInternal } = require('./core.cjs'); +const { safeReadFile, loadConfig, isGitIgnored, execGit, normalizePhaseName, comparePhaseNum, getArchivedPhaseDirs, generateSlugInternal, getMilestoneInfo, resolveModelInternal, MODEL_PROFILES, toPosixPath, output, error, findPhaseInternal } = require('./core.cjs'); const { extractFrontmatter } = require('./frontmatter.cjs'); function cmdGenerateSlug(text, raw) { @@ -68,7 +68,7 @@ function cmdListTodos(cwd, area, raw) { created: createdMatch ? createdMatch[1].trim() : 'unknown', title: titleMatch ? titleMatch[1].trim() : 'Untitled', area: todoArea, - path: path.join('.planning', 'todos', 'pending', file), + path: toPosixPath(path.join('.planning', 'todos', 'pending', file)), }); } catch {} } @@ -528,7 +528,7 @@ function cmdScaffold(cwd, type, options, raw) { } fs.writeFileSync(filePath, content, 'utf-8'); - const relPath = path.relative(cwd, filePath); + const relPath = toPosixPath(path.relative(cwd, filePath)); output({ created: true, path: relPath }, raw, relPath); } diff --git a/get-shit-done/bin/lib/phase.cjs b/get-shit-done/bin/lib/phase.cjs index f5ceb98aa..4eff4a2e9 100644 --- a/get-shit-done/bin/lib/phase.cjs +++ b/get-shit-done/bin/lib/phase.cjs @@ -4,7 +4,7 @@ const fs = require('fs'); const path = require('path'); -const { escapeRegex, normalizePhaseName, comparePhaseNum, findPhaseInternal, getArchivedPhaseDirs, generateSlugInternal, getMilestonePhaseFilter, output, error } = require('./core.cjs'); +const { escapeRegex, normalizePhaseName, comparePhaseNum, findPhaseInternal, getArchivedPhaseDirs, generateSlugInternal, getMilestonePhaseFilter, toPosixPath, output, error } = require('./core.cjs'); const { extractFrontmatter } = require('./frontmatter.cjs'); const { writeStateMd } = require('./state.cjs'); @@ -180,7 +180,7 @@ function cmdFindPhase(cwd, phase, raw) { const result = { found: true, - directory: path.join('.planning', 'phases', match), + directory: toPosixPath(path.join('.planning', 'phases', match)), phase_number: phaseNumber, phase_name: phaseName, plans, diff --git a/get-shit-done/bin/lib/template.cjs b/get-shit-done/bin/lib/template.cjs index 02f3bad7b..f99a12469 100644 --- a/get-shit-done/bin/lib/template.cjs +++ b/get-shit-done/bin/lib/template.cjs @@ -4,7 +4,7 @@ const fs = require('fs'); const path = require('path'); -const { normalizePhaseName, findPhaseInternal, generateSlugInternal, output, error } = require('./core.cjs'); +const { normalizePhaseName, findPhaseInternal, generateSlugInternal, toPosixPath, output, error } = require('./core.cjs'); const { reconstructFrontmatter } = require('./frontmatter.cjs'); function cmdTemplateSelect(cwd, planPath, raw) { @@ -210,12 +210,12 @@ function cmdTemplateFill(cwd, templateType, options, raw) { const outPath = path.join(cwd, phaseInfo.directory, fileName); if (fs.existsSync(outPath)) { - output({ error: 'File already exists', path: path.relative(cwd, outPath) }, raw); + output({ error: 'File already exists', path: toPosixPath(path.relative(cwd, outPath)) }, raw); return; } fs.writeFileSync(outPath, fullContent, 'utf-8'); - const relPath = path.relative(cwd, outPath); + const relPath = toPosixPath(path.relative(cwd, outPath)); output({ created: true, path: relPath, template: templateType }, raw, relPath); }