Skip to content

table: projects read as their names, with just enough path to tell two apart - #18

Merged
pyjeebz merged 3 commits into
mainfrom
fix/table-project-names
Nov 3, 2026
Merged

pyjeebz merged 3 commits into
mainfrom
fix/table-project-names

Conversation

@pyjeebz

@pyjeebz pyjeebz commented Nov 3, 2026

Copy link
Copy Markdown
Owner

Closes #7.

The PROJECT column printed each project's full path. Inside $HOME that was a short ~/…, but anywhere else it was printed whole. On a real machine one row ran to about 90 characters, and the table no longer fit a terminal. ports is the first command anyone runs, and that's the first impression.

The table and --tree now name a project directory by its name (shop). When two different directories share a name, each gets just enough of its parents to tell them apart (work/api, oss/api). Container, systemd, Windows-side and unknown rows read as before.

  • Machine-readable output is unchanged: --json, csv/tsv, the diff report and doctor's header line still carry the full path. So does here's "nothing running for …" message.
  • A directory literally named windows or — keeps its path, so it can't be mistaken for a Windows-side or unknown row.
  • One directory spelled two ways (/a/shop and /a/shop/) is one project.

How it was verified

Gate, locally with CI's versions: unit ✓, build ✓, integration ✓ (uncached), installers ✓, gofmt ✓, vet ✓, lint ✓ (v2.13.2).

Real binary, with servers in shop/, work/api/ and oss/api/ under a long scratch path:

main
PORT   PROCESS      PROJECT                                                                                   UPTIME
8794   python3.13   /tmp/claude-0/-home-user-ports/5168f63b-28c2-5252-8a61-cc7b4f22dd0e/scratchpad/oss/api    2s
8793   python3.13   /tmp/claude-0/-home-user-ports/5168f63b-28c2-5252-8a61-cc7b4f22dd0e/scratchpad/work/api   2s
8791   python3.13   /tmp/claude-0/-home-user-ports/5168f63b-28c2-5252-8a61-cc7b4f22dd0e/scratchpad/shop       2s

this branch
PORT   PROCESS      PROJECT    UPTIME
8794   python3.13   oss/api    2s
8793   python3.13   work/api   2s
8791   python3.13   shop       2s
  • The widest line of the whole machine's table: 49 columns.
  • --json (ignoring started) and --format csv are identical to main.

New tests:

  • TestTableProjectNames: names, disambiguation, other row kinds untouched, every line ≤100 columns.
  • TestDistinctSuffixes.
  • TestTableProjectNameEdges: the windows directory and a trailing slash.

TestProjectHomeSiblingBoundary now checks the path form (ProjectLabel), which csv/tsv, diff and doctor still print, so the ~ boundary stays covered.

Docs: these table examples are re-rendered to exactly what the binary prints (each column as wide as its widest cell, plus 3 spaces), and the PROJECT column definition explains the new rule:

  • the README;
  • the docs index, quickstart and commands pages;
  • the --help text of ports, here and wait.

The diff and doctor examples keep paths, because those outputs do. The landing page (web/lib/site.ts) is left for #9.

Risk

Tier: risky, because internal/inspect/output.go is on the risky-paths list. The actual change is to human-facing table text only.

  • Public surface: the table and tree PROJECT text. JSON, csv/tsv, diff and doctor are unchanged.
  • Out of scope: the issue also floated truncating long PROCESS values. I left that out. The widest real line is now 49 columns, and truncating names hides information.
  • Rollback: revert the squash commit.

A fresh-context review said ok to ship. It confirmed that two different directories can never share a label, either within or across name groups, and that the doc tables match tabwriter output exactly. Its should-fixes are the second commit: the windows/— collision, the doc wording, and cleaning paths before grouping.

Notes for the release

The table shows project names (shop, or work/api when two share a name) instead of full paths. --json, csv/tsv and diff still carry the full path.


Generated by Claude Code

@pyjeebz
pyjeebz merged commit 834466b into main Nov 3, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

table: show the project name, not the full path

2 participants