Commit 69108a4
Make CLI log paths clickable (#16603)
* Make CLI log paths clickable
Render CLI log file paths as terminal hyperlinks while preserving the existing neutral log-reference styling for error output.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Make run summary log path clickable
Render the aspire run summary log path as a file hyperlink while keeping the existing summary label formatting.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Make remaining CLI log paths clickable
Address two more sites that emit a log file path but were missed by the
initial commits:
- DashboardRunCommand.RenderDashboardSummary: the "Logs" row in the
`aspire dashboard run` summary now renders as a clickable file link.
The method becomes `internal static` and takes `IInteractionService`
so it can be tested directly, mirroring the RunCommand pattern.
- AppHostLauncher.HandleLaunchFailure: the "Check logs for details: {0}"
message references the detached child CLI's log file, not the session's
log file, so the auto-linkify path in ConsoleInteractionService does
not match it. Pre-format with EscapeMarkupWithFileLink and pass
allowMarkup: true so the child log path is also clickable.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Address review feedback for PR #16603
Refactor clickable log path support per JamesNK's review:
- Move file-link helper into MarkupHelpers as SafeFileLink (drops the special-cased helpers ConsoleHelpers.EscapeMarkupWithFileLink / FormatPathAsFileLink that only existed for log paths)
- Drop the auto-detect log-path machinery in ConsoleInteractionService.DisplayError; callers now opt in by passing allowMarkup: true and formatting the link explicitly with MarkupHelpers.SafeFileLink
- Add allowMarkup parameter to IInteractionService.DisplayError so callers control markup interpretation; default false preserves the safe escape-by-default behavior
- Drop the trailing 'See logs at {0}' suffix from ProjectCouldNotBeBuilt and ProjectCouldNotBeCreated; callers emit a separate DisplayMessage(SeeLogsAt, SafeFileLink(...)) line so the URL is built at the call site rather than rewriting the rendered string
- Document why bracket characters in file paths still need explicit '%5B' / '%5D' percent-encoding (Uri.AbsoluteUri leaves them untouched in the path component, and Spectre.Console's EscapeMarkup only protects the markup parser, not the OSC 8 hyperlink target). Added MarkupHelpersTests.SafeFileLink_* coverage for both the empty-path and bracketed-path cases
- Update remaining call sites (RunCommand, NewCommand, InitCommand, DashboardRunCommand, AgentInitCommand, TelemetryCommandHelpers, AppHostLauncher, StartupErrorWriter) to use the new helper
- Also fixes a stale '_interactionService' field reference inside the now-static DashboardRunCommand.RenderDashboardSummary method that surfaced after rebasing onto upstream/main
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Address hyperlink review feedback
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 0015b9f commit 69108a4
39 files changed
Lines changed: 416 additions & 106 deletions
File tree
- src/Aspire.Cli
- Commands
- Diagnostics
- Interaction
- Resources
- xlf
- Utils
- tests/Aspire.Cli.Tests
- Commands
- Interaction
- Projects
- Templating
- TestServices
- Utils
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
372 | 372 | | |
373 | 373 | | |
374 | 374 | | |
375 | | - | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
376 | 379 | | |
377 | 380 | | |
378 | 381 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
375 | 375 | | |
376 | 376 | | |
377 | 377 | | |
378 | | - | |
| 378 | + | |
379 | 379 | | |
380 | 380 | | |
381 | | - | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
382 | 386 | | |
383 | 387 | | |
384 | 388 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
306 | 306 | | |
307 | 307 | | |
308 | 308 | | |
309 | | - | |
| 309 | + | |
310 | 310 | | |
311 | | - | |
| 311 | + | |
312 | 312 | | |
313 | 313 | | |
314 | 314 | | |
| |||
326 | 326 | | |
327 | 327 | | |
328 | 328 | | |
329 | | - | |
| 329 | + | |
330 | 330 | | |
331 | 331 | | |
332 | 332 | | |
| |||
344 | 344 | | |
345 | 345 | | |
346 | 346 | | |
347 | | - | |
| 347 | + | |
348 | 348 | | |
349 | 349 | | |
350 | | - | |
| 350 | + | |
351 | 351 | | |
352 | 352 | | |
353 | 353 | | |
| |||
446 | 446 | | |
447 | 447 | | |
448 | 448 | | |
449 | | - | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
450 | 453 | | |
451 | 454 | | |
452 | 455 | | |
| |||
457 | 460 | | |
458 | 461 | | |
459 | 462 | | |
460 | | - | |
| 463 | + | |
461 | 464 | | |
462 | 465 | | |
463 | 466 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
135 | | - | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
136 | 140 | | |
137 | 141 | | |
138 | 142 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
404 | 404 | | |
405 | 405 | | |
406 | 406 | | |
407 | | - | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
408 | 412 | | |
409 | 413 | | |
410 | 414 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
290 | 290 | | |
291 | 291 | | |
292 | 292 | | |
293 | | - | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
294 | 298 | | |
295 | 299 | | |
296 | 300 | | |
| |||
464 | 468 | | |
465 | 469 | | |
466 | 470 | | |
467 | | - | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
468 | 475 | | |
469 | 476 | | |
470 | 477 | | |
| |||
480 | 487 | | |
481 | 488 | | |
482 | 489 | | |
483 | | - | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
484 | 494 | | |
485 | 495 | | |
486 | 496 | | |
| |||
597 | 607 | | |
598 | 608 | | |
599 | 609 | | |
600 | | - | |
| 610 | + | |
601 | 611 | | |
602 | 612 | | |
603 | 613 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
324 | 324 | | |
325 | 325 | | |
326 | 326 | | |
327 | | - | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
328 | 331 | | |
329 | 332 | | |
330 | 333 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
68 | 73 | | |
69 | 74 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
338 | 338 | | |
339 | 339 | | |
340 | 340 | | |
341 | | - | |
| 341 | + | |
342 | 342 | | |
343 | | - | |
| 343 | + | |
| 344 | + | |
344 | 345 | | |
345 | 346 | | |
346 | 347 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
337 | 337 | | |
338 | 338 | | |
339 | 339 | | |
340 | | - | |
| 340 | + | |
341 | 341 | | |
342 | 342 | | |
343 | 343 | | |
| |||
347 | 347 | | |
348 | 348 | | |
349 | 349 | | |
350 | | - | |
| 350 | + | |
351 | 351 | | |
352 | 352 | | |
353 | 353 | | |
| |||
0 commit comments