Skip to content

Commit faa7b0c

Browse files
committed
Show true rel paths to users
Previously, we prepended rel paths with `/`, which was confusing. Now show proper rel paths to users.
1 parent 33f6ccb commit faa7b0c

2 files changed

Lines changed: 6 additions & 18 deletions

File tree

web/bun.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/src/components/artifacts/code/CodeFileCollection.tsx

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -93,24 +93,12 @@ export const CodeFileCollection = ({ data, className = "", onHide, hideContent =
9393

9494
const generatedFilesAbsolutePath = absoluteOutputPath;
9595
const generatedFilesRelativePath = useMemo(() => {
96-
// This should reflect the CLI `--output-path` value (relative to where runbooks was launched),
97-
// NOT an inferred suffix of the absolute path (which can be any directory).
98-
const raw = (relativeOutputPath || '').trim()
96+
// This reflects the CLI `--output-path` value (relative to where runbooks was launched).
97+
// The backend always provides this value.
98+
const raw = (relativeOutputPath || '').trim();
9999

100-
if (!raw) return '/generated'
101-
102-
// Normalize windows separators for display
103-
const normalized = raw.replaceAll('\\', '/')
104-
105-
// If user provided an absolute path, show it as-is.
106-
if (normalized.startsWith('/')) return normalized
107-
if (/^[a-zA-Z]:\//.test(normalized)) return normalized
108-
109-
// Relative paths:
110-
// - "." / "./foo" should stay as-is (clearly relative)
111-
// - "generated" / "foo/bar" we render with a leading slash for readability in the sentence
112-
if (normalized === '.' || normalized.startsWith('./') || normalized.startsWith('../')) return normalized
113-
return `/${normalized}`
100+
// Normalize windows separators for display, but otherwise show the path as the user provided it.
101+
return raw.replaceAll('\\', '/');
114102
}, [relativeOutputPath])
115103

116104
const copyToClipboard = async (text: string) => {

0 commit comments

Comments
 (0)