Skip to content

feat(mcp-cli): add --format=table renderer for report-shaped commands#4215

Merged
JSONbored merged 1 commit into
JSONbored:mainfrom
dhgoal:feat/mcp-cli-format-table
Jul 8, 2026
Merged

feat(mcp-cli): add --format=table renderer for report-shaped commands#4215
JSONbored merged 1 commit into
JSONbored:mainfrom
dhgoal:feat/mcp-cli-format-table

Conversation

@dhgoal

@dhgoal dhgoal commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a --format=table renderer to the gittensory-mcp stdio CLI's report-shaped commands (Closes #2231).

  • packages/gittensory-mcp/lib/format-table.js — a pure, dependency-free formatTable(input, opts) helper: accepts an array of row objects or { headers, rows } (string or {key,label,align} headers), computes column widths, supports per-column left/right alignment, trims trailing padding, and returns "" when there are no columns. No I/O, no deps.
  • analyze-branch / preflight gain --format table (and the inline --format=table form): next actions render as an aligned 3-column table (Action / Priority / Why), and analyze-branch additionally renders a Score-blocker table. The branch sits after the existing --json early-return, and option parsing gains only the inline --key=value form — so --json and the default line-summary output are byte-identical when --format table is not used.
  • --format added to the help usage + bash completion; lib/format-table.js added to the packable-file allowlist (scripts/check-mcp-package.mjs) and the package build node-check.

No src/** change (so no Codecov surface); confined to packages/gittensory-mcp/**, its tests, and the one required scripts/check-mcp-package.mjs allowlist line.

Scope

Validation

  • npm run build:mcp, npm run test:mcp-pack (dry-run lists lib/format-table.js), npm run typecheck — all pass.
  • 10 unit/CLI tests: formatTable alignment/right-align/positional-rows/missing-keys/empty; and CLI tests asserting the table render, the --format=table inline form, and unchanged default/--json output.
  • git diff --check clean.

Safety

  • Behavior-preserving (existing outputs byte-identical unless --format table used). No secrets/wallets/hotkeys/trust/reward terms.

@dhgoal
dhgoal requested a review from JSONbored as a code owner July 8, 2026 14:14
@superagent-security superagent-security Bot added the contributor:flagged Contributor flagged for review by trust analysis. label Jul 8, 2026
@superagent-security

Copy link
Copy Markdown
Contributor

🚨 Contributor flagged. Click here for more info: Superagent Dashboard

@codecov

codecov Bot commented Jul 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.76%. Comparing base (f3507d0) to head (b214275).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4215   +/-   ##
=======================================
  Coverage   93.76%   93.76%           
=======================================
  Files         390      390           
  Lines       36547    36547           
  Branches    13389    13389           
=======================================
  Hits        34267    34267           
  Misses       1623     1623           
  Partials      657      657           
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Adds a pure, dependency-free formatTable helper (packages/gittensory-mcp/lib)
and a --format table option on analyze-branch and preflight, rendering next
actions (and score blockers) as aligned monospace tables. Default and --json
output are byte-identical; option parsing gains the inline --key=value form
without changing the space-separated form.

Closes JSONbored#2231
@dhgoal
dhgoal force-pushed the feat/mcp-cli-format-table branch from 10f5584 to b214275 Compare July 8, 2026 14:38
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@loopover-orb loopover-orb Bot added the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. label Jul 8, 2026
@loopover-orb

loopover-orb Bot commented Jul 8, 2026

Copy link
Copy Markdown

Warning

🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-07-08 16:41:58 UTC

6 files · 1 AI reviewer · no blockers · readiness 100/100 · CI green · unstable

⏸️ Suggested Action - Manual Review

  • Touches a guarded path — held for manual review: This PR changes guardrail-protected path(s): packages/gittensory-mcp/package.json (matched **/package.json), scripts/check-mcp-package.mjs (matched scripts/**).

Review summary
Adds a pure, dependency-free formatTable() helper and wires --format table (plus inline --format=value parsing) into analyze-branch/preflight, placed after the existing --json early return so --json and default output stay byte-identical. The renderer itself is correct on the cases shown (column-width computation, alignment, trailing-space trim, empty-input guard) and is backed by solid unit tests plus CLI tests that explicitly assert default/--json output is unchanged. No src/** or schema/migration surface is touched, consistent with the stated scope.

Nits — 6 non-blocking
  • packages/gittensory-mcp/bin/gittensory-mcp.js: the new inline `--key=value` parsing runs for every `--flag` arg, including boolean-only flags like `--json`; confirm `--json=true` (or any equals form on a boolean flag) doesn't set a truthy string instead of the expected boolean, since that path isn't exercised by the new tests.
  • test/unit/mcp-cli-analyze-branch.test.ts only exercises `analyze-branch --format table`; add (or confirm existing) coverage for `preflight --format table` since the PR description claims both commands gain the flag and they share `writeBranchAnalysisTable`.
  • packages/gittensory-mcp/lib/format-table.js: `resolveAlign`/`normalizeInput` are dense one-liners with several chained ternaries/optional-chains (external nesting-depth flag on line 27); consider splitting `renderRow`'s cell-formatting ternary out for readability, though behavior is correct.
  • External review brief flags linked-issue feat(mcp-cli): add a --format=table renderer for gittensory-mcp intelligence output #2231 coverage as only 'partial' — worth double-checking the issue text actually asks for this scope (table renderer + inline --key=value parsing) before merging, per the issue-link requirement for contributor PRs.
  • Add a `preflight --format=table` CLI test mirroring the analyze-branch one in test/unit/mcp-cli-analyze-branch.test.ts (or a shared test) to cover both commands that claim the flag.
  • Touches a guarded path — held for manual review — A maintainer must review and merge this change.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ✅ Linked #2231
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 113 registered-repo PR(s), 70 merged, 7 issue(s).
Contributor context ✅ Confirmed Gittensor contributor dhgoal; Gittensor profile; 113 PR(s), 7 issue(s).
Gate result ⚠️ Not blocking Advisory; not blocking this PR.
Linked issue satisfaction

Addressed
The PR adds a pure formatTable(rows) helper in packages/gittensory-mcp/lib/format-table.js with column alignment and empty-row handling, wires a --format table|json|text option through parseOptions (including inline --format=table), applies it to analyze-branch's next-actions and score-blocker tables and to preflight's next-actions table, and includes unit tests for the formatter plus CLI tests fo

Review context
  • Author: dhgoal
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: not available
  • Official Gittensor activity: 113 PR(s), 7 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Keep the PR focused and include validation evidence before maintainer review.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.

  • Re-run Gittensory review

@JSONbored
JSONbored merged commit 35736fb into JSONbored:main Jul 8, 2026
8 of 9 checks passed
@loopover-orb loopover-orb Bot added gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. and removed gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. labels Jul 8, 2026
@JSONbored JSONbored added gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. and removed gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. labels Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor:flagged Contributor flagged for review by trust analysis. gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.

Development

Successfully merging this pull request may close these issues.

feat(mcp-cli): add a --format=table renderer for gittensory-mcp intelligence output

2 participants