Skip to content

Add ghost init command for interactive post-install setup#13

Merged
murrayju merged 21 commits into
mainfrom
murrayju/init-cmd
May 15, 2026
Merged

Add ghost init command for interactive post-install setup#13
murrayju merged 21 commits into
mainfrom
murrayju/init-cmd

Conversation

@murrayju
Copy link
Copy Markdown
Member

Summary

  • Adds ghost init, an interactive multi-select that walks the user through adding Ghost to $PATH, logging in, installing the MCP server for one or more clients, and installing shell completions. Each step shows its detected status (e.g. already in PATH (~/.local/bin), already configured (you@example.com)) and is pre-selected only if not already configured.
  • Adds ghost init path — a non-interactive subcommand that appends the install dir to the user's shell rc file. Suitable for scripts.
  • Adds --skip-if-configured so ghost init is safe to re-run from the installer; it exits cleanly when nothing needs to change.
  • scripts/install.sh now delegates all post-install setup (PATH, login, MCP, completions) to ghost init, removing ~200 lines of shell-side rc-file logic that previously duplicated what the Go code can now do correctly. The installer falls back to ghost init path when /dev/tty isn't usable.
  • ghost mcp install and ghost mcp uninstall now support multi-client selection via the same shared multi-select prompt — pick any combination interactively, or pass all / a specific client name as before.
  • Extracts the multi-select UI into internal/common/multiselect.go and the shell rc / PATH / completion helpers into internal/common/shell_setup.go, both with unit tests.
  • Adds a ./check script that runs go install, fmt, mod tidy, fix, vet, staticcheck, and test in one shot; CLAUDE.md updated to reference it.
  • Regenerated CLI reference docs under docs/cli/.

Test plan

  • ./check passes
  • Fresh install via curl -fsSL https://install.ghost.build | sh walks through the new menu on a machine with no prior Ghost config
  • Re-running the installer with everything already configured exits quickly (the --skip-if-configured path)
  • ghost init with stdin redirected returns the TTY error instead of hanging
  • ghost init path works under sh -c with no TTY (smoke test for the script-friendly fallback)
  • ghost mcp install with no args shows the multi-select; selecting multiple clients installs into all of them
  • ghost mcp uninstall with no args shows the multi-select; selected clients are removed and others are left alone
  • Esc in the MCP submenu of ghost init exits the flow cleanly with "Canceled."
  • Ctrl+C anywhere in ghost init exits without a stack trace

🤖 Generated with Claude Code

@murrayju murrayju force-pushed the murrayju/init-cmd branch from c00d32a to d89d427 Compare May 14, 2026 22:53
@murrayju murrayju merged commit 76b06c2 into main May 15, 2026
2 checks passed
@murrayju murrayju deleted the murrayju/init-cmd branch May 15, 2026 21:48
murrayju added a commit that referenced this pull request May 15, 2026
Cobra's `doc.GenMarkdownTree` emits files that end with a blank line
(`...text\n\n`). `git diff --check` flags that as a whitespace error
whenever a doc gets added or its tail modified — e.g. the doc EOF issues
called out in the review of #13.

Fix: post-process generated markdown in `cmd/generate-docs` to collapse
trailing newlines down to a single `\n`, and regenerate every CLI doc to
match. Future regenerations stay clean automatically.

The 52 doc-file changes are mechanical (one trailing newline removed
each); the only behavior change is in `cmd/generate-docs/main.go`.
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