Add preflight checks and prompt file input support #12
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
This PR introduces a preflight check mechanism for the CLI that verifies, before starting the agent, that:
repo_pathis inside a Git worktree.nodebinary is onPATH(and its version is logged).dockerbinary is onPATH(and its version is logged).In addition, it implements support for reading a prompt from a file when
--promptis given a filepath.Implementation Details
src/oai_coding_agent/preflight.pywith:is_inside_git_repo(),get_tool_version(),check_node(),check_docker()helpers.run_preflight_checks()orchestrator that prints errors viatyper.echoand exits withtyper.Exit(code=1)if any check fails.run_preflight_checks()intocli.main()immediately after building theConfig.--promptpoints to a file and load its contents.logger, so they are written to~/.oai_coding_agent/agent.log.Assumptions
node --versionanddocker --version.Testing
tests/test_preflight.pycover successful and failure scenarios for preflight checks (Git, Node.js, Docker) and validate the version logging viacaplog.tests/test_cli.pywas updated with an autouse fixture to stub out preflight during CLI tests, and the prompt-file behavior test was updated to reflect the new file-reading logic.uv run pytest -qto ensure all tests pass.Considerations & Alternatives