Skip to content

CLI usability: pip-installable + default to current directory#3

Open
anschmieg wants to merge 4 commits into
retomeier:mainfrom
anschmieg:main
Open

CLI usability: pip-installable + default to current directory#3
anschmieg wants to merge 4 commits into
retomeier:mainfrom
anschmieg:main

Conversation

@anschmieg
Copy link
Copy Markdown

@anschmieg anschmieg commented Apr 27, 2026

Summary

This PR adds two small quality-of-life improvements for momoa-cli:

  • pip install support — adds a pyproject.toml so the CLI can be installed as a global console script (momoa) via pip install -e .. Also tweaks the agentignore_rules import to work both as a standalone script and as an installed package.
  • Default to CWD — when you run momoa "your query" without passing -d or -f, it now automatically operates on the current working directory, saving some keystrokes for frequent use.

Test run

  • pip install -e . installs and registers the momoa command
  • momoa "prompt" without -d/-f picks up files from CWD
  • Explicit -d and -f still work as before
  • Running python client-cli/python_cli.py directly still works

  - Add pyproject.toml defining package metadata and console script entry point
  - Convert client-cli/ into an installable package by adding init.py
  - Adjust import in python_cli.py to work both as script and installed module (try/except)
  - Ignore generated *.egg-info/ directories in .gitignore
When neither --directory nor --files is provided, the CLI now defaults
to os.getcwd() so running `momoa "prompt"` operates on the current
working directory instead of doing nothing.

💘 Generated with Crush

Assisted-by: GLM 5.1 via Crush <crush@charm.land>
Copilot AI review requested due to automatic review settings April 27, 2026 15:24
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds Python packaging and a small CLI UX improvement so momoa-cli can be installed via pip and behaves more naturally when no input paths are provided.

Changes:

  • Add pyproject.toml defining a momoa console script and packaging metadata for momoa-cli.
  • Update python_cli.py to support both direct execution and package-relative imports, and default file collection to the current working directory when -d/-f are omitted.
  • Ignore Python *.egg-info/ artifacts in .gitignore (and add __init__.py to ensure the CLI directory is a package).

Reviewed changes

Copilot reviewed 2 out of 4 changed files in this pull request and generated 3 comments.

File Description
pyproject.toml Introduces setuptools-based packaging + momoa entrypoint.
client-cli/python_cli.py Adds dual-mode import for agentignore_rules and defaults to CWD for directory scanning.
client-cli/__init__.py Makes the CLI directory importable as a Python package for console-script installs.
.gitignore Prevents committing generated *.egg-info/ metadata.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread client-cli/python_cli.py Outdated
Comment thread client-cli/python_cli.py
Comment on lines +564 to +566
# If no directory or files specified, default to current directory
if args.directory is None and not args.files:
args.directory = os.getcwd()
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

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

Defaulting to uploading the entire current working directory can unintentionally exfiltrate sensitive or very large content (e.g., .env, .git/, node_modules/, virtualenvs), because evaluate_path defaults to include everything when no .agentignore is present and the CLI reads all file contents into memory before chunking. Please add a safety mitigation (e.g., built-in default excludes for common sensitive/huge paths, require confirmation when defaulting to CWD, and/or cap total files/bytes) to reduce accidental leakage and OOM/slow runs.

Copilot uses AI. Check for mistakes.
Comment thread client-cli/python_cli.py Outdated
anschmieg and others added 2 commits April 27, 2026 17:31
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
more specific ModuleNotFoundError instead of ImportError

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown

@jangus3636-crypto jangus3636-crypto left a comment

Choose a reason for hiding this comment

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

new

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.

3 participants