Make install/init non-interactive paths more accessible to agents#20
Make install/init non-interactive paths more accessible to agents#20cevian wants to merge 2 commits into
Conversation
When ghost init or the install script can't reach an interactive terminal, list the exact commands an agent needs to run (ghost login, ghost mcp install all, ghost completion <shell>) instead of just telling the user to "run it from a TTY". Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
| 1. ghost init path # add ghost to your PATH | ||
| 2. ghost login # authenticate (or use --api-key) | ||
| 3. ghost mcp install all # install MCP server in all detected clients (or pass a specific client name) | ||
| 4. ghost completion <shell> # print completion script; append it to your shell rc file`) |
There was a problem hiding this comment.
It'd be nice not to duplicate so much of the content from these 2 messages (and the tests).
Better yet, it'd be cool if in this case we only printed the commands which weren't already configured.
| 1. ghost init path # add ghost to your PATH | ||
| 2. ghost login # authenticate (or use --api-key) | ||
| 3. ghost mcp install all # install MCP server in all detected clients (or pass a specific client name) | ||
| 4. ghost completion <shell> # print completion script; append it to your shell rc file |
There was a problem hiding this comment.
Running ghost completion zsh isn't really helpful - it just prints a script to the screen. You really need to modify the shell.rc to call this command correctly, which isn't adequately explained here.
I think we should add a ghost init completion command, which does this for you (we already have the code).
Address PR review feedback: - Add `ghost init completion` subcommand that actually appends the completion snippet to the shell rc file, so the printed command is self-contained (previously `ghost completion <shell>` only printed a script). - De-duplicate the two non-interactive error sites behind a single helper that detects current state and lists only the standalone commands for steps that aren't already configured. The --skip-if-configured hint is omitted when the flag was already passed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Addressed both pieces of review feedback in f19d180:
Added two new tests ( |
|
|
||
| func buildInitCompletionCmd() *cobra.Command { | ||
| cmd := &cobra.Command{ | ||
| Use: "completion", |
There was a problem hiding this comment.
Maybe make this completions with completion as an alias. I'm not really sure which is more correct, but we use the plural in the descriptions 😅
Summary
ghost initis invoked without a TTY, list the exact commands needed to finish setup non-interactively (ghost init path,ghost login,ghost mcp install all,ghost completion <shell>) instead of just saying "run it from a TTY".scripts/install.sh) can't reach/dev/tty, it already runsghost init path; now it also prints the remaining commands an agent should run instead of just suggestingghost init.🤖 Generated with Claude Code