Skip to content

[codex] add persistent CLI setup flow - #13

Merged
morluto merged 5 commits into
mainfrom
codex/setup-persistent-cli
Jul 17, 2026
Merged

[codex] add persistent CLI setup flow#13
morluto merged 5 commits into
mainfrom
codex/setup-persistent-cli

Conversation

@morluto

@morluto morluto commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Summary

GitContribute's documented onboarding starts with npx gitcontribute@latest setup, but npx only exposes the package executable for that one invocation. Setup could successfully initialize the corpus and configure MCP while leaving no persistent gitcontribute command for direct CLI and TUI use. The successful setup report made that distinction difficult to understand, so a user could reasonably run gitcontribute next and receive command not found.

This PR treats the terminal application and MCP integrations as independent setup capabilities. Interactive npx setup now offers to install the exact running GitContribute release globally, then separately asks which MCP clients to configure. Non-interactive setup requires the explicit --install-cli flag, and --no-mcp supports terminal-only installations without inferring permission for other mutations.

Root cause and user impact

The previous wizard configured application state and coding clients but did not model persistent CLI installation as a setup capability. The MCP launcher correctly avoided saving an executable path from npm's temporary cache, but the terminal workflow had no equivalent persistent-install step or explicit warning. This was especially visible because GitContribute includes a TUI and repeated human-facing commands such as sync, search, and dossier.

Implementation

  • Add an explicitly authorized npm installation capability for the CLI and TUI.
  • Preview the real dry-run plan before interactive confirmation; planning never invokes npm or writes state.
  • Keep terminal and MCP selections independent, including terminal-only and MCP-only operation.
  • Verify npm's actual global command shim before reporting terminal installation as successful.
  • Register MCP against the verified persistent executable after combined setup.
  • Retain the exact-version npx MCP launcher when terminal installation is skipped or fails.
  • Report terminal [not installed] with the exact installation command after MCP-only npx setup.
  • Avoid offering a redundant reinstall when setup is already running from a global or source-built executable.
  • Keep package-manager execution in a focused internal/terminalinstall adapter.
  • Document consent, execution ordering, launcher policy, dry-run behavior, and partial-failure semantics.

Setup continues to perform no GitHub access and never executes repository-controlled code. Client configuration is preflighted before the global npm mutation, and MCP registration occurs only after shared configuration and corpus initialization succeed.

End-to-end coverage

The new packaged npm tests build the native Go binary, pack and install the npm artifact in an isolated workspace, and exercise the public Node launcher through the native CLI. A fake isolated npm prefix prevents tests from touching the developer's real global installation.

Covered journeys:

  • terminal-only setup installs and verifies the persistent command without modifying MCP files;
  • MCP-only setup writes the pinned npx launcher and reports that the terminal command remains uninstalled;
  • combined setup installs the command and registers MCP against its verified absolute path.

Verification

  • go test ./...
  • npm run test:npm
  • npm run test:e2e
  • npm pack --dry-run
  • git diff --check

@morluto morluto changed the title add persistent CLI setup flow [codex] add persistent CLI setup flow Jul 17, 2026
@morluto
morluto marked this pull request as ready for review July 17, 2026 23:41
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@morluto
morluto merged commit 326d80f into main Jul 17, 2026
14 checks passed
@morluto
morluto deleted the codex/setup-persistent-cli branch July 28, 2026 17:38
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.

1 participant