Skip to content

Add CLI tool scaffolding #5

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 17 commits into from
Jun 9, 2025
Merged

Conversation

trevor-e
Copy link
Member

@trevor-e trevor-e commented Jun 9, 2025

Adds a basic analysis CLI tool for iOS apps. Running:

app-size-analyzer ios "tests/artifacts/HackerNews 2-12-25, 6.06 PM.xcarchive.zip"

will spit out an ios-analysis-report.json file with basic information.

@trevor-e trevor-e changed the title [WIP] Add CLI tool scaffolding Add CLI tool scaffolding Jun 9, 2025
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These __init__.py files are annoying to add/maintain but I've seen they are recommended to help IDEs with completions.

console = Console()


@click.group(invoke_without_command=True)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This uses click as the CLI lib which I've seen other projects in Sentry use.

click.echo(ctx.get_help())


@cli.command()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit of a mouthful to read but this essentially sets up the ios subcommand, so these flags are only applicable to iOS.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Longer term I think we'll want to try to infer iOS vs Android from the artifact itself and avoid subcommands, but I do think for now it's fine for iOS-specific args

console.print(f"[bold green]✓[/bold green] Results written to: [cyan]{output_path}[/cyan]")


def _print_table_output(results: AnalysisResults, quiet: bool) -> None:
Copy link
Member Author

@trevor-e trevor-e Jun 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll probably delete this table output at some point but so far it's been helpful with debugging.

extract_archive(input_path, temp_dir)
return find_app_bundle(temp_dir, platform="ios")

def _extract_app_info(self, app_bundle_path: Path) -> AppInfo:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a lot of this we don't need anymore since we'll do it on the upload path, right? Particularly because we will need it for build distribution too so it shouldn't be tied to size analysis

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea not sure exactly where that will live but it will definitely not be part of size analysis later on. Just threw in here for now.

Base automatically changed from telkins/ios-size-analysis to main June 9, 2025 18:45
# Conflicts:
#	.cursor/rules/overview.mdc
#	.gitignore
@trevor-e trevor-e merged commit e0eacfc into main Jun 9, 2025
5 checks passed
@trevor-e trevor-e deleted the cursor/create-cli-tool-scaffolding-66ff branch June 9, 2025 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants