fix(dashboard): recognise Windows paths in terminal completion and breadcrumbs - #8012
fix(dashboard): recognise Windows paths in terminal completion and breadcrumbs#8012shrihan-vijay wants to merge 1 commit into
Conversation
…eadcrumbs Two path-classifying predicates were POSIX-only, so a Windows gateway (backslash paths, drive letters) silently broke both surfaces: - terminalCompletion.ts's shouldComplete/looksLikePath only checked for '/', '~', and '.', so a backslash-separated token (`cd ..\`, `dir .\`) never opened the completion menu. - MarkdownPanel.tsx's breadcrumbSegments split only on '/', so a drive-rooted path (`C:\Users\me\notes.md`) read as a single non-navigable breadcrumb segment instead of the usual ancestor chain. Both now accept either separator, and breadcrumbSegments treats a drive root as absolute without needing a restored prefix (the drive letter survives the split as its own segment, unlike POSIX's leading '/'). While fixing terminalCompletion.ts, added a UNC-prefix refusal alongside the backslash support: shouldComplete/looksLikePath gate whether the frontend fetches POST /api/terminal/complete for the token, and completing a UNC-shaped token (`\\host\share`) would have the gateway list a directory on a named host -- on Windows that stat is an outbound SMB connection. This is the same class of issue a sibling PR (kirodotdev#7969, sanitizing markdown path chips) documents for isPathCandidate. Hoisted the shared UNC_PREFIX_RE into urlTransform.ts, next to WINDOWS_ABS_PATH_RE, per that PR's design review comment asking for it to be shared once a sibling predicate needed the same treatment; terminalCompletion.ts keeps its own local copy rather than importing it, since that module is deliberately dependency-free. Fixes kirodotdev#7990. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qj2fBtkAg8y3xRh4Xc41Wv
|
👋 Hi! This PR's description is missing some required sections from our PR template. Workflow runs won't be auto-approved until the description is updated. Missing sections:
Please update your PR description to include these sections, then push or re-save the description. The workflows will be approved on the next cycle. |
1 similar comment
|
👋 Hi! This PR's description is missing some required sections from our PR template. Workflow runs won't be auto-approved until the description is updated. Missing sections:
Please update your PR description to include these sections, then push or re-save the description. The workflows will be approved on the next cycle. |
Open PR relationship auditThis is a consolidated, point-in-time code-level audit note. It compares complete merge-base diffs and current/merged code; it does not treat a shared topic as duplication or partial coverage as completion. Relationship findings
No PR, Issue, label, branch, or review state was changed by the relationship-note portion of this audit. |
|
@shrihan-vijay Thanks for keeping this scoped to #7990 and for leaving What already landed: merged #7969 ( What is still missing on main: both of your user-facing fixes. Two changes we would like before merge:
Then please rebase. The branch is 705 commits behind main and is currently blocked, and open #9301 edits the lines immediately after Posted from the 2026-09-08 open-PR relationship audit (read-only, one auditor per PR); reply here if any of this is wrong. |
Problem / Motivation
Two path-classifying predicates in the frontend were written POSIX-only:
terminalCompletion.ts'sshouldComplete/looksLikePathonly recognized/,~, and., andMarkdownPanel.tsx'sbreadcrumbSegmentsonly spliton
/. On a Windows gateway (backslash paths, drive letters), this meant theterminal's completion menu never opened for a backslash-separated token
(
cd ..\,dir .\), and an open file's breadcrumb bar rendered adrive-rooted path (
C:\Users\me\notes.md) as one giant, non-navigablesegment instead of the usual clickable ancestor chain.
Why it matters
Kiro Crew supports native Windows gateways (see the cross-platform guidance
in
AGENTS.md), so a Windows user driving the web terminal or opening a filein the dashboard hits a visibly broken experience on two separate, everyday
surfaces: no path autocomplete in the terminal, and a useless breadcrumb bar
in the file viewer.
What changed (motivation → approach → change)
Observed symptom: the terminal completion menu and the markdown panel's
breadcrumbs both silently fail to recognize Windows-style paths.
Root cause: both predicates test only for
/(and POSIX-specific markerslike a leading
/) without ever checking for\or a drive-letter root.Approach: rather than reinventing drive-letter detection, I reused the one
shared predicate the codebase already has for it (
WINDOWS_ABS_PATH_REinurlTransform.ts), and extended both files to accept either path separator,splitting/joining consistently with whichever separator the input actually
used.
While in
terminalCompletion.ts, I found a related, previously-latent issue:shouldComplete/looksLikePathgate whether the frontend fetchesPOST /api/terminal/completefor the typed token, and a UNC-shaped token(
\\host\share, or already today//host/share) would have the gatewaylist a directory on a named host — on Windows, that stat is an outbound SMB
connection offering the host's credentials, for nothing but typing a token
in the terminal. This is the same vulnerability class a sibling, still-open
PR (#7969) documents and fixes for the markdown path-chip
predicate (
isPathCandidate). I added the same UNC refusal here, andhoisted the shared
UNC_PREFIX_REintourlTransform.tsnext toWINDOWS_ABS_PATH_RE, per that PR's own design-review comment asking forexactly this once a sibling predicate needed the same treatment.
terminalCompletion.tskeeps its own local copy of the regex rather thanimporting it, since that module is deliberately dependency-free (zero
imports) so its logic stays unit-testable without pulling in
react-markdowntransitively throughurlTransform.ts.Scope note:
isPathCandidate/MarkdownRenderer.tsx(the third predicatenamed in the parent issue) is left entirely to #7969, which already covers
it and is still open — this PR does not touch that file.
Tests
terminalCompletion.test.ts: new cases forshouldComplete/completionModetriggering on backslash-separated tokens, and refusing to trigger (or route
to the path tier) for a UNC-shaped token in either separator spelling.
MarkdownPanel.test.tsx: new cases forbreadcrumbSegmentssplitting adrive-rooted backslash path into the correct segments, reconstructing each
ancestor path with the drive letter intact, and accepting the
forward-slash spelling of a drive-rooted path too.
urlTransform.test.ts: new cases assertingUNC_PREFIX_REmatches bothUNC spellings and does not match a drive-rooted or POSIX path.
Manual verification
N/A — unit coverage sufficient. These are pure string-classification
functions with deterministic inputs/outputs, fully exercised by the added
unit tests.
Screenshots / video
N/A — no visual/layout change. The fix is behavioral (which strings trigger
completion / how a path string is split into breadcrumb segments); the
rendering of the completion menu and breadcrumb bar is unchanged.
Related Issues
Fixes #7990
Pattern harvest
Not generalizable: this is the second and third of three call sites in a
known, already-tracked class of POSIX-only path predicates in the frontend —
the first (
isPathCandidate) is covered by #7969, and the parent issue(#7990) is itself the tracking mechanism for finishing the enumerated list.
No new rule is needed beyond completing that list.
Checklist
feat|fix|docs|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com
🤖 Generated with Claude Code
https://claude.ai/code/session_01Qj2fBtkAg8y3xRh4Xc41Wv