Add af instance discover command for auto-discovering Astro deployments#63
Merged
Add af instance discover command for auto-discovering Astro deployments#63
af instance discover command for auto-discovering Astro deployments#63Conversation
ebfb672 to
a028213
Compare
- Use ternary operator for instance name generation - Remove unused variable `pos` - Combine nested `with` statements in tests Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add nosec comments for legitimate subprocess and token name usage - Apply ruff formatting Co-Authored-By: Claude Opus 4.5 <[email protected]>
Co-Authored-By: Claude Opus 4.5 <[email protected]>
Co-Authored-By: Claude Opus 4.5 <[email protected]>
The adapter adds /api/v2 or /api/v1 when making requests, so we should store the base webserver URL, not the full API URL which already includes /api/v2. Co-Authored-By: Claude Opus 4.5 <[email protected]>
Existing instances are already skipped by default. The flag was redundant since it had the same behavior as the default. Co-Authored-By: Claude Opus 4.5 <[email protected]>
Co-Authored-By: Claude Opus 4.5 <[email protected]>
Simplify the discover command by removing the prefix option.
Instance names are now always generated as {workspace}-{deployment}.
Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Apply ruff format to instances.py and local.py - Exclude skills/ from mypy to fix duplicate "tests" module error - Fix bandit config path to astro-airflow-mcp/pyproject.toml Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Simplify AUTH_ERROR_KEYWORDS to match actual CLI output - Extract _run_list_command helper to reduce repetitive code - Use any() for cleaner auth error checking - Improve token extraction comments Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Fix bandit config path from astro-airflow-mcp/pyproject.toml to pyproject.toml (prek runs from the directory containing the config) - Remove skills/ from exclude patterns (no skills dir in this project) Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Move astro/astro_cli.py to discovery/astro_cli.py (only used for discovery) - Refactor instances.py to use AstroDiscoveryBackend for token operations instead of direct AstroCli usage (removes duplicate logic) - Delete empty astro/ package - Update all imports in tests Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Refactor discover command into subcommands: - `af instance discover` - all backends - `af instance discover astro --all-workspaces` - Astro-specific - `af instance discover local --scan` - Local-specific - Add `af instance reset` command to restore default config - Change default instance name to `localhost:8080` format to match local discovery naming convention - Add `inst` as shorthand alias for `instance` command Co-Authored-By: Claude Opus 4.5 <[email protected]>
a028213 to
31dddc0
Compare
8af6c25 to
ed774c6
Compare
ed774c6 to
3b21c83
Compare
ad233fd to
cebffb2
Compare
tayloramurphy
approved these changes
Feb 3, 2026
Collaborator
tayloramurphy
left a comment
There was a problem hiding this comment.
Approving for docs and confirming I tested locally on an astro and privately hosted airflow instance.
schnie
commented
Feb 3, 2026
| | `--auth-token` | `AIRFLOW_AUTH_TOKEN` | `None` | Bearer token for authentication | | ||
| | `--username` | `AIRFLOW_USERNAME` | `None` | Username for authentication (Airflow 3.x uses OAuth2 token exchange) | | ||
| | `--password` | `AIRFLOW_PASSWORD` | `None` | Password for authentication | | ||
| | `--airflow-project-dir` | `AIRFLOW_PROJECT_DIR` | `$PWD` | Astro project directory for auto-discovering Airflow URL | |
Member
Author
There was a problem hiding this comment.
@jlaneve what do you think here? I kind of settled on env vars then the config file managed by af instance commands. I don't know if supporting the flags is worth it.
kaxil
approved these changes
Feb 4, 2026
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
Adds a new
af instance discovercommand that auto-discovers Airflow instances from multiple backends and populates the af config.Discovery backends:
.astro/config.yamlfirst, then common ports)Usage
Other instance commands:
Note:
af instandaf instanceswork as aliases foraf instance.Example Output
Implementation Notes
--all-workspacesfor astro,--scanfor local).astro/config.yamlfor configured port before scanning common portslocalhost:{port}for local,{workspace}-{deployment}for Astrolocalhost:8080to match local discovery namingsourcefield to track where instances were discovered fromaf-cli-discoverastro_cli.pyunderdiscovery/module (only used for discovery)Test plan
af instance listshows discovered instances with sourceaf dags listaf instance resetrestores default config🤖 Generated with Claude Code