-
Notifications
You must be signed in to change notification settings - Fork 0
Promote candidate lote2 changes to main (AUD-007/008/009/010) #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 10 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
76ebac8
ci: add reproducible packaging release gates
nsalvacao 507bf7f
docs: define canonical docs routing
nsalvacao 97ad375
fix(cli): canonicalize legacy cli_crawler command surface
nsalvacao df46343
docs(spec): reconcile release task status drift
nsalvacao ae9a549
Merge pull request #21 from nsalvacao/worker/lote2-aud009-release-gates
nsalvacao 5ec2699
Merge pull request #22 from nsalvacao/worker/lote2-aud010-docs-routing
nsalvacao 0192f75
Update src/crawler/cli_crawler.py
nsalvacao 1e085ab
Merge pull request #23 from nsalvacao/worker/lote2-aud007-command-sur…
nsalvacao 3e7d197
Update specs/001-cli-plugins-base/tasks.md
nsalvacao f85e2ab
Merge pull request #24 from nsalvacao/worker/lote2-aud008-spec-drift
nsalvacao f5e79ee
Potential fix for pull request finding
nsalvacao File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,103 +1,12 @@ | ||
| #!/usr/bin/env python3 | ||
| """Universal CLI Help Crawler - OpenAPI for CLIs. | ||
| """Legacy compatibility script for ``cli-crawler``. | ||
|
|
||
| Crawls CLI --help outputs and generates structured JSON maps | ||
| that AI agents can use for precise command reasoning. | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import argparse | ||
| import logging | ||
| import sys | ||
| from pathlib import Path | ||
|
|
||
| from crawler.config import CLIConfig, CrawlerConfig, load_config | ||
| from crawler.pipeline import crawl_all, crawl_cli | ||
|
|
||
|
|
||
| def main() -> None: | ||
| parser = argparse.ArgumentParser( | ||
| description="Crawl CLI --help outputs and generate structured JSON maps", | ||
| epilog="Examples:\n" | ||
| " python cli_crawler.py git -o output/git.json\n" | ||
| " python cli_crawler.py --config config.yaml --all\n" | ||
| " python cli_crawler.py docker -v --include-raw\n", | ||
| formatter_class=argparse.RawDescriptionHelpFormatter, | ||
| ) | ||
| parser.add_argument("cli", nargs="?", help="CLI to crawl (e.g., git, docker)") | ||
| parser.add_argument("--config", "-c", type=Path, help="Path to config YAML") | ||
| parser.add_argument("--output", "-o", type=Path, help="Output file path") | ||
| parser.add_argument( | ||
| "--output-dir", | ||
| type=Path, | ||
| default=Path("./output"), | ||
| help="Output directory (default: ./output)", | ||
| ) | ||
| parser.add_argument("--all", action="store_true", help="Crawl all CLIs in config") | ||
| parser.add_argument( | ||
| "--include-raw", action="store_true", help="Include raw help text in main JSON" | ||
| ) | ||
| parser.add_argument("--verbose", "-v", action="store_true", help="Verbose logging") | ||
| parser.add_argument("--strict", action="store_true", help="Fail on first parse error") | ||
| parser.add_argument("--max-depth", type=int, help="Override max recursion depth") | ||
| parser.add_argument("--timeout", type=int, help="Override timeout per command (seconds)") | ||
| parser.add_argument("--list", action="store_true", help="List configured CLIs and exit") | ||
|
|
||
| args = parser.parse_args() | ||
|
|
||
| # Configure logging | ||
| logging.basicConfig( | ||
| level=logging.DEBUG if args.verbose else logging.INFO, | ||
| format="%(asctime)s [%(levelname)s] %(name)s: %(message)s", | ||
| datefmt="%H:%M:%S", | ||
| ) | ||
| Prefer invoking the canonical command directly: | ||
|
|
||
| # Load config | ||
| config: CrawlerConfig | ||
| if args.config and args.config.exists(): | ||
| config = load_config(str(args.config)) | ||
| else: | ||
| config = CrawlerConfig() | ||
|
|
||
| # List mode | ||
| if args.list: | ||
| if not config.clis: | ||
| print("No CLIs configured. Use --config to specify a config file.") | ||
| else: | ||
| print(f"Configured CLIs ({len(config.clis)}):") | ||
| for name, cfg in sorted(config.clis.items()): | ||
| group = f" [{cfg.group}]" if cfg.group else "" | ||
| env = f" (env: {cfg.environment})" if cfg.environment != "wsl" else "" | ||
| print(f" {name}{group}{env}") | ||
| return | ||
|
|
||
| # Crawl all CLIs | ||
| if args.all: | ||
| if not config.clis: | ||
| print("No CLIs configured. Use --config to specify a config file.") | ||
| sys.exit(1) | ||
| crawl_all(config, args.output_dir, args.include_raw, args.strict) | ||
| return | ||
|
|
||
| # Crawl single CLI | ||
| if args.cli: | ||
| cli_config = config.clis.get(args.cli, CLIConfig(name=args.cli)) | ||
|
|
||
| # Apply CLI arg overrides | ||
| if args.max_depth is not None: | ||
| cli_config.max_depth = args.max_depth | ||
| if args.timeout is not None: | ||
| cli_config.timeout = args.timeout | ||
|
|
||
| output = args.output or args.output_dir / f"{args.cli}.json" | ||
| crawl_cli(args.cli, cli_config, output, args.include_raw, args.strict) | ||
| return | ||
|
|
||
| # No action specified | ||
| parser.print_help() | ||
| sys.exit(1) | ||
| cli-crawler <cli_name> [options] | ||
| """ | ||
|
|
||
| from crawler.cli_crawler import main | ||
|
|
||
nsalvacao marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| if __name__ == "__main__": | ||
| main() | ||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.