Skip to content

Render /list-claude-pr-status output as a markdown table#1437

Merged
functionstackx merged 1 commit into
mainfrom
update-list-claude-pr-status-table
May 17, 2026
Merged

Render /list-claude-pr-status output as a markdown table#1437
functionstackx merged 1 commit into
mainfrom
update-list-claude-pr-status-table

Conversation

@functionstackx
Copy link
Copy Markdown
Collaborator

Summary

  • Moves table formatting out of the assistant and into the command script itself, so output is a complete, ready-to-show markdown table.
  • READY rows are emitted before RUNNING. Each PR cell is a clickable link.
  • Adds an explicit fallback line for the case when no PRs match.

Test plan

🤖 Generated with Claude Code

The command previously left table rendering to the assistant. Move
formatting into the script itself so output is a complete, ready-to-show
markdown table with clickable PR links, READY rows first then RUNNING.
Add an explicit fallback message for the empty-result case.

Verified locally against current open claude/* PRs and against an empty
TSV before opening the PR.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@functionstackx functionstackx requested a review from a team May 17, 2026 06:42
@functionstackx functionstackx merged commit 8080c72 into main May 17, 2026
3 checks passed
@functionstackx functionstackx deleted the update-list-claude-pr-status-table branch May 17, 2026 06:42
Copy link
Copy Markdown
Contributor

@claude claude Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — small, self-contained renderer change in a developer slash command.

Extended reasoning...

Overview

This PR rewrites Step 3 of .claude/commands/list-claude-pr-status.md so the slash command emits a complete markdown table directly from a bash/awk pipeline rather than delegating rendering to the assistant. It also adds an empty-input fallback message. Only one file changed.

Security risks

None. This is a documentation-style slash command file consumed by the Claude Code harness. No production code, no auth/crypto/permissions surface, no external inputs that affect runtime behavior outside the user's local shell.

Level of scrutiny

Low. The file is a developer-facing slash command used informationally (the command explicitly does not auto-merge). The renderer is a few lines of awk that read a TSV produced earlier in the same command. Logic is straightforward — sort by state group, prepend header, format each row as a table row.

Other factors

One nit was flagged: PR titles containing a literal | will corrupt the rendered table because $4 is interpolated without escaping. It is cosmetic only, and an easy follow-up fix. Not worth blocking on for an informational tool.

Comment on lines +64 to +65
{printf "| [#%s](https://github.com/SemiAnalysisAI/InferenceX/pull/%s) | %s | `%s` | %s |\n", $1, $1, $2, $3, $4}'
```
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 PR titles containing a literal | will corrupt the rendered markdown table. The awk printf at line 64 interpolates the title field ($4) directly into a table cell with no escaping, so a title like Fix foo | refactor bar produces a row with extra column boundaries and a misaligned table. Easy fix: gsub(/\|/, "\\|", $4) inside the awk action before printing.

Extended reasoning...

What the bug is

In Step 3 (lines 55-66), the renderer pipes the TSV through awk and emits each data row with:

printf "| [#%s](https://github.com/SemiAnalysisAI/InferenceX/pull/%s) | %s | `%s` | %s |\n", $1, $1, $2, $3, $4

The title column ($4) is interpolated verbatim. GitHub PR titles are free-form user input coming from gh pr list --json title and can legitimately contain a literal | (e.g. frontend | use new API, Fix foo | refactor bar).

How it manifests

For a PR titled Fix foo | refactor bar, the emitted row is:

| [#123](https://github.com/SemiAnalysisAI/InferenceX/pull/123) | READY | `SUCCESS=44` | Fix foo | refactor bar |

Markdown parses pipes as column separators, so that row becomes 6 cells in a 4-column table and the row is misaligned in the rendered output.

Why existing code doesn't prevent it

The previous Step 3 was prose that delegated rendering to the assistant, which could escape pipes when constructing the table. This PR moves rendering into a deterministic bash/awk pipeline that emits raw field values. The check-breakdown column ($3) is wrapped in backticks which incidentally tolerates pipes inside it, but the title column has no such protection.

Step-by-step proof

  1. Author opens a PR on a claude/... branch with title Fix foo | refactor bar.
  2. Step 1 stores 123\tFix foo | refactor bar into /tmp/claude_pr_candidates.tsv.
  3. Step 2 classifies it as READY and appends 123\tREADY\tSUCCESS=44\tFix foo | refactor bar to /tmp/claude_pr_status.tsv.
  4. Step 3's awk reads that line with -F'\t', so $4 = "Fix foo | refactor bar".
  5. The printf emits | [#123](...) | READY | SUCCESS=44 | Fix foo | refactor bar |.
  6. The markdown renderer sees 6 |-delimited segments and produces a misaligned 6-cell row under a 4-column header.

Impact

Cosmetic / display-only. The link and information are still present and readable in raw form, and this is an informational developer slash command. Pipes in PR titles are uncommon — but not impossible — for Claude-authored PRs.

How to fix

Escape pipes in the title before printing, e.g.:

{ gsub(/\|/, "\\|", $4);
  printf "| [#%s](https://github.com/SemiAnalysisAI/InferenceX/pull/%s) | %s | `%s` | %s |\n", $1, $1, $2, $3, $4 }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

1 participant