Skip to content

feat(mcp): add PowerShell shell completion#1448

Merged
JSONbored merged 4 commits into
JSONbored:mainfrom
glorydavid03023:scan/mcp-cli
Jun 28, 2026
Merged

feat(mcp): add PowerShell shell completion#1448
JSONbored merged 4 commits into
JSONbored:mainfrom
glorydavid03023:scan/mcp-cli

Conversation

@glorydavid03023

@glorydavid03023 glorydavid03023 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Extends gittensory-mcp completion to support PowerShell alongside bash, zsh, and fish. PowerShell is a primary shell on Windows and was previously rejected as an unsupported shell — this closes that gap.

# Add to your $PROFILE
gittensory-mcp completion powershell | Out-String | Invoke-Expression

completion powershell prints a Register-ArgumentCompleter -Native script that completes the top-level commands and the subcommands of profile, cache, agent, and maintain, driven by the same CLI_COMMAND_SPEC single source of truth as the other shells. --json returns { "shell": "powershell", "script": "..." }.

Changes

  • packages/gittensory-mcp/bin/gittensory-mcp.js — add "powershell" to COMPLETION_SHELLS, a buildPowershellCompletion() generator, dispatch in buildCompletionScript(), and the help-text usage line.
  • test/unit/mcp-cli-basics.test.ts — add a PowerShell completion test (asserts Register-ArgumentCompleter, CompletionResult, command + subcommand lists); update the unsupported-shell case to a still-unsupported shell (tcsh) and the usage regex.
  • packages/gittensory-mcp/README.md — document PowerShell with an install snippet.

Validation

Run locally on Node v22.22.0 (the project's engine):

  • npm run build:mcp → pass
  • test/unit/mcp-cli-basics.test.ts → all 19 tests pass, including the new prints a PowerShell argument-completer script case.
  • Verified the generated script is valid PowerShell: parsed it with [System.Management.Automation.Language.Parser]::ParseInput (0 syntax errors) and confirmed Register-ArgumentCompleter executes without error in a real PowerShell session.
  • Confirmed the existing bash/zsh/fish output is unchanged and completion tcsh still errors as unsupported.

Honest caveat (unrelated to this change): a full tsc --noEmit can't complete on my local box because node_modules is missing some newly-added deps (pg, ioredis, pngjs, etc.) used by unrelated src/selfhost/* / src/visual-agent/* files. There are zero type errors in the files this PR touches. CI runs a clean install and gives the authoritative result.

Contract notes

No MCP tool or HTTP/OpenAPI changes. Local CLI behavior only; the --json payload shape is unchanged (additive new shell value).

Security / privacy

No auth, cookie, CORS, GitHub App output, identity, or contributor-evidence changes. The generated script contains only static command/subcommand names already shown in --help.

Closes #1452

Extend `gittensory-mcp completion` to support PowerShell alongside bash,
zsh, and fish. `completion powershell` prints a `Register-ArgumentCompleter`
script that completes top-level commands and the subcommands of `profile`,
`cache`, `agent`, and `maintain`, driven by the same `CLI_COMMAND_SPEC`
single source of truth. `--json` returns `{ shell, script }` as for the
other shells.

PowerShell is a primary shell on Windows and was previously rejected as an
unsupported shell; this closes that gap.

Tests cover the generated PowerShell script (Register-ArgumentCompleter,
CompletionResult, command/subcommand lists) and update the unsupported-shell
case to a still-unsupported shell.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dosubot dosubot Bot added the size:XS label Jun 26, 2026
@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@f7764b6). Learn more about missing BASE report.
⚠️ Report is 10 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1448   +/-   ##
=======================================
  Coverage        ?   95.52%           
=======================================
  Files           ?      204           
  Lines           ?    22279           
  Branches        ?     8048           
=======================================
  Hits            ?    21283           
  Misses          ?      415           
  Partials        ?      581           
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@loopover-orb

loopover-orb Bot commented Jun 27, 2026

Copy link
Copy Markdown

Warning

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

⏸️ Gittensory review — held for maintainer review

3 files · 1 AI reviewers · 1 blocker · readiness 55/100 · CI green · clean

⏸️ Held for maintainer review — This is a first-time contribution to this repo, so the gate stays advisory rather than blocking. The findings remain visible, and the gate will apply normally once this author has merge history here.

Review summary
The change adds PowerShell to the existing completion shell list, generates a native `Register-ArgumentCompleter` script, updates help text, and documents the install snippet. The generator is mostly wired through the same `CLI_COMMAND_SPEC` source as the other shells, but the PowerShell AST branch chooses top-level completions when the user has already typed a command followed by a space. That makes the advertised subcommand completion fail on the common empty-prefix path.

Blockers

  • packages/gittensory-mcp/bin/gittensory-mcp.js:1752 returns top-level commands when `$elements.Count -le 2`, so `gittensory-mcp profile <TAB>` completes `login/logout/...` instead of `profile` subcommands because PowerShell's `CommandElements` contains only the executable and `profile` after a trailing space.

Concerns raised — review before merging

  • AI reviewers agree on a likely critical defect: packages/gittensory-mcp/bin/gittensory-mcp.js:1752 returns top-level commands when `$elements.Count -le 2`, so `gittensory-mcp profile <TAB>` completes `login/logout/...` instead of `profile` subcommands because PowerShell's `CommandElements` contains only the executable and `profile` after a trailing space.: packages/gittensory-mcp/bin/gittensory-mcp.js:1752 returns top-level commands when `$elements.Count -le 2`, so `gittensory-mcp profile <TAB>` completes `login/logout/...` instead of `profile` subcommands because PowerShell's `CommandElements` contains only the executable and `profile` after a trailing space.
Signal Result Evidence
Code review ❌ 1 blocker 1 reviewers, synthesized
Linked issue ✅ Linked #1452
Related work ⚠️ 3 scoped overlaps Top overlaps are listed below; lower-confidence bulk is hidden.
Review load ❌ 8/20 Readiness component derived from cached public PR metadata and labels; size label size:XS.
Validation evidence ❌ 5/25 Cached preflight status is hold.
Open PR queue ❌ 3/10 15 open PR(s), 10 likely reviewable, 5 unlinked.
Contributor context ✅ Confirmed Gittensor contributor glorydavid03023; Gittensor profile; 188 PR(s), 5 issue(s).
Gate result ⚠️ Not blocking Advisory; not blocking this PR.
Nits — 5 non-blocking
  • test/unit/mcp-cli-basics.test.ts:184 only asserts that the generated script contains the subcommand table, not that the PowerShell branching logic completes subcommands for the empty-prefix trailing-space case.
  • packages/gittensory-mcp/bin/gittensory-mcp.js:1743 should either use or intentionally omit `$cursorPosition`; leaving it named but unused makes the generated script look less deliberate.
  • packages/gittensory-mcp/bin/gittensory-mcp.js:1752 should branch on the current word/trailing-space state, for example treating `$elements.Count -eq 1` or `$elements.Count -eq 2 -and $wordToComplete` as top-level completion and using `$elements[1]` for subcommands when the first command is already complete.
  • test/unit/mcp-cli-basics.test.ts:184 should add a script-level assertion or fixture for `gittensory-mcp profile ` so the test covers the real subcommand completion path, not just string presence.
  • PR author also opened the linked issue — Link an issue that was opened by a different contributor, or provide a rationale for why this self-authored issue represents genuine discovery work.
Review context
  • Author: glorydavid03023
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository registration is not available in the local Gittensory cache.
  • Public profile languages: not available
  • Official Gittensor activity: 188 PR(s), 5 issue(s).
  • Related work: Items reference the same linked issue MCP CLI: add PowerShell shell completion #1452. (issue #1452)
  • Related work: Open PR work references issue MCP CLI: add PowerShell shell completion #1452. (issue #1452)
  • Related work: Titles/paths share 5 meaningful terms. (PR #1444)
  • Additional title-only matches omitted; title-only overlap does not block.
Contributor next steps
  • Review top overlaps.
  • Add scope summary.
  • Fix blocker.
  • Expect slower review.
  • Refresh registry data or choose a registered active repo.
  • Check active issues and PRs before submitting.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Review load = cached public PR metadata such as size labels, changed paths, and preflight status.
  • Open PR queue = repo-wide review pressure; it is not a PR quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
Review details

Generated from public PR metadata and the diff. Advisory only; deterministic signals remain authoritative.

The change adds PowerShell to the existing completion shell list, generates a native `Register-ArgumentCompleter` script, updates help text, and documents the install snippet. The generator is mostly wired through the same `CLI_COMMAND_SPEC` source as the other shells, but the PowerShell AST branch chooses top-level completions when the user has already typed a command followed by a space. That makes the advertised subcommand completion fail on the common empty-prefix path.

Blockers

  • packages/gittensory-mcp/bin/gittensory-mcp.js:1752 returns top-level commands when `$elements.Count -le 2`, so `gittensory-mcp profile <TAB>` completes `login/logout/...` instead of `profile` subcommands because PowerShell's `CommandElements` contains only the executable and `profile` after a trailing space.

Nits (4)

  • test/unit/mcp-cli-basics.test.ts:184 only asserts that the generated script contains the subcommand table, not that the PowerShell branching logic completes subcommands for the empty-prefix trailing-space case.
  • packages/gittensory-mcp/bin/gittensory-mcp.js:1743 should either use or intentionally omit `$cursorPosition`; leaving it named but unused makes the generated script look less deliberate.
  • packages/gittensory-mcp/bin/gittensory-mcp.js:1752 should branch on the current word/trailing-space state, for example treating `$elements.Count -eq 1` or `$elements.Count -eq 2 -and $wordToComplete` as top-level completion and using `$elements[1]` for subcommands when the first command is already complete.
  • test/unit/mcp-cli-basics.test.ts:184 should add a script-level assertion or fixture for `gittensory-mcp profile ` so the test covers the real subcommand completion path, not just string presence.

🟩 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

@loopover-orb loopover-orb Bot added gittensor gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. labels Jun 27, 2026
andriypolanski pushed a commit to andriypolanski/gittensory that referenced this pull request Jun 27, 2026
…s were stuck OPEN) (JSONbored#1076)

With requireApprovals=0, a green+approved PR should auto-merge — but the planner read the STORED mergeableState,
which lags GitHub's async recompute after gittensory[bot]'s own APPROVE flips blocked→clean. Result: PRs stuck
OPEN at mergeState=CLEAN, never merged (e.g. awesome-claude#4206, metagraphed#1438/JSONbored#1448). Fix: maybeRunAgentMaintenance
fetches the LIVE mergeable_state (fetchLivePullRequestMergeState, GET /pulls/{n}) and the planner uses it
(falls back to stored on a fetch error); 'unknown' is treated as not-yet-clean so a later trigger/sweep retries.
@dosubot dosubot Bot added the lgtm label Jun 28, 2026
@JSONbored
JSONbored merged commit f516415 into JSONbored:main Jun 28, 2026
17 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in gittensory - v1 roadmap Jun 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

MCP CLI: add PowerShell shell completion

2 participants