fix: Skip GitHub prompt in non-interactive shells (#40)#41
Merged
Conversation
`fips-agents create gateway` and `create ui` (and the other four create
subcommands, which share the same helper) hung on the
`Create GitHub repository?` prompt when stdin wasn't a TTY, then exited
with an empty `Unexpected error:` because click.confirm raised Abort and
the catch-all swallowed its empty message.
`_determine_github_mode` now checks `sys.stdin.isatty()` before
prompting and falls back to local mode with a one-line hint pointing to
`--github`/`--yes`. As defense in depth the confirm call is wrapped in
`try/except click.exceptions.Abort` for environments where isatty lies.
The six `Unexpected error: {e}` sites switch to `{e!r}` so future
empty-message exceptions surface their type instead of going blank.
Assisted-by: Claude Code (Opus 4.7)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_determine_github_modenow checkssys.stdin.isatty()before callingclick.confirm; non-TTY shells (CI, agent-driven,claude-code, piped input) fall back to local mode with a one-line hint about--github/--yesinstead of hanging on the prompttry/except click.exceptions.Abortas defense in depth for environments whereisatty()returns true but stdin closes mid-promptUnexpected error: {e}sites now use{e!r}so a future swallowed empty-message exception (like the originalclick.Abort) surfaces its type instead of going blankTestDetermineGithubMode(8 cases) covering flag short-circuits, gh-missing/unauthenticated paths,--yes, the new non-TTY fallback, and aborted-confirm fallbackThe fix lives in the shared helper, so all six
createsubcommands (mcp-server,agent,gateway,ui,workflow,sandbox) get the new behavior. Closes #40.Test plan
pytest --no-cov— 273 passed (8 new)black --check src tests— cleanruff check src tests— cleanecho "" | fips-agents create gateway test-gateway --target-dir …no longer hangs; logsMode: Local only (non-interactive shell — pass --github or --yes …)and proceeds to scaffold the project. Same verified forcreate ui.