Metadata-Version: 2.4
Name: akaidoo
Version: 1.1.0
Summary: List files from Odoo addon dependencies using manifestoo.
License: MIT
Project-URL: Homepage, https://github.com/yourusername/akaidoo
Project-URL: Bug Tracker, https://github.com/yourusername/akaidoo/issues
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Build Tools
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: manifestoo-core>=1.0.0
Requires-Dist: manifestoo
Requires-Dist: typer[all]>=0.9.0
Requires-Dist: pyperclip
Requires-Dist: tree-sitter
Requires-Dist: tree-sitter-python
Requires-Dist: GitPython
Provides-Extra: test
Requires-Dist: pytest; extra == "test"
Requires-Dist: pytest-mock; extra == "test"
Requires-Dist: typer[all]; extra == "test"
Dynamic: license-file

<p align="center">
  <img src="assets/akaidoo.png" alt="Akaidoo Logo" width="300"/>
</p>

<h1 align="center">Akaidoo - vibe code your Odoo!</h1>

<p align="center">
  <!-- TODO: Uncomment and update badges once set up -->
  <!-- <a href="YOUR_GITHUB_ACTIONS_LINK"><img src="YOUR_GITHUB_ACTIONS_BADGE_SVG" alt="Build Status"></a> -->
  <!-- <a href="YOUR_CODECOV_LINK"><img src="YOUR_CODECOV_BADGE_SVG" alt="Coverage Status"></a> -->
  <a href="https://pypi.org/project/akaidoo/"><img src="https://img.shields.io/pypi/v/akaidoo.svg" alt="PyPI version"></a>
  <a href="https://pypi.org/project/akaidoo/"><img src="https://img.shields.io/pypi/pyversions/akaidoo.svg" alt="Python versions"></a>
  <a href="LICENSE"><img src="https://img.shields.io/pypi/l/akaidoo.svg" alt="License"></a>
</p>

<p align="center">
  <i>Navigate the Odoo & OCA Maze: Instantly Gather Relevant Modules Files.</i>
</p>

---

**Akaidoo** extends the [manifestoo](https://github.com/acsone/manifestoo) CLI to list
and copy all relevant source files (Python models, XML views, wizards, data, reports,
and even OpenUpgrade migration scripts) from a specific Odoo addon and its _entire_
dependency tree. It's designed to feed AI LLMs.

Akaidoo bridges the AI gap for Odoo by helping you:

- 🤖 **Boost AI Tools:** Feed precisely the right context to AI LLMs. Works best with
  Gemini and its 1 million tokens context.
- 📝 **Streamline Editing:** Open all pertinent files in your editor with a single
  command.
- 🧩 **Understand Scope:** Quickly grasp the breadth of an addon's interactions.
- 🔍 **Perform searches:**
  (`akaidoo sale_stock -c ~/DEV/odoo16/odoo.cfg | xargs grep "def _compute_price_unit"`)
- 🚀 **Accelerate Migrations:** Gather module code, dependencies, and their
  corresponding OpenUpgrade migration scripts in one go.

## Key Features

- **Deep Dependency Traversal:** Leverages `manifestoo` to accurately resolve all direct
  and transitive dependencies.
- **Intelligent File Collection:** Gathers `.py` (models, root files) and `.xml` (views,
  wizards, reports) from the identified addons.
- **OpenUpgrade Script Integration:** Optionally include all migration scripts from a
  specified OpenUpgrade repository for the target addon and its dependencies
  (`-u, --openupgrade`).
- **Flexible Addon Discovery:**
  - Use Odoo configuration files (`-c, --odoo-cfg`).
  - Specify addon paths directly (`--addons-path`).
  - Auto-detect from an importable `odoo` package.
- **Granular Filtering:**
  - Include/exclude specific file types (models, views, wizards, reports).
  - Focus _only_ on models or views.
  - Exclude Odoo core addons (`--exclude-core`) or common framework addons
    (`--exclude-framework`).
  - Intelligently skip trivial `__init__.py` files.
- **Versatile Output Modes:**
  - **List Paths:** Print file paths to `stdout` (default).
  - **To Clipboard:** Copy the _content_ of all found files to your clipboard
    (`-x, --clipboard`), each prefixed with its relative path – perfect for AI prompts!
  - **To File:** Dump all file contents into a single output file (`-o, --output-file`).
  - **To Editor:** Directly open all found files in your preferred editor
    (`-e, --edit`).
- **Shrink files to save tokens:**
  - -s to shrink the Python methods in dependencies
  - -S to shrink the Python methods everywhere

## Installation

<!--- install-begin -->

The recommended way to install Akaidoo is using [pipx](https://pypi.org/project/pipx/)
(to install it in an isolated environment):

```console
pipx install akaidoo
```

Alternatively, using pip:

```console
pip install --user akaidoo
```

For clipboard functionality (`-x`): Akaidoo uses `pyperclip`. You might need to install
it and its dependencies:

```console
pip install pyperclip
# On Linux, you may also need:
# sudo apt-get install xclip  # or xsel
```

<!--- install-end -->

## Quick Start

Imagine you're working on the `sale_timesheet` addon in an Odoo project.

1.  **Get all relevant file paths for `sale_timesheet` and its dependencies:** (Using
    your project's Odoo configuration file)

```console
akaidoo sale_timesheet -c ~/path/to/your/odoo.conf
```

2.  **Copy all Python model code for `sale_timesheet` (without its deps -l) to your
    clipboard for an AI prompt:**

```console
akaidoo sale_timesheet -c odoo.conf --only-models -l -x
```

    *(Each file's content in the clipboard will be prefixed with `# FILEPATH: path/to/file.py`)*

3.  **Open all Python and XML view files for `project` and its direct dependencies
    (excluding core) in Neovim (use --editor-cmd or EDITOR env var to specify a
    different editor):**

```console
akaidoo project -c odoo.conf --exclude-core --no-include-wizards --no-include-reports -e
```

    *(This uses the `nvim -p` command to open files in tabs. It's especially handy when using AI plugins like Avante.)*

4.  **Get only the files from the `mrp` addon itself, ignoring its dependencies, and
    save their content to a file (useful if you outgrow the clipboard size):**

```console
akaidoo mrp -c odoo.conf --only-target-addon -o mrp_context.txt
```

5.  **Gather `sale_stock` files, its dependencies, AND its OpenUpgrade migration
    scripts:** (Assuming your OpenUpgrade clone is at `~/OpenUpgrade`)

```console
akaidoo sale_stock -c odoo.conf -u ~/OpenUpgrade -o sale_stock_migration_context.txt
```

    This will collect all standard module files for `sale_stock` and its dependencies, plus all files from `~/OpenUpgrade/openupgrade_scripts/scripts/sale_stock/`, `~/OpenUpgrade/openupgrade_scripts/scripts/ADDON_DEPENDENCY_1/`, etc., into `sale_stock_migration_context.txt`. This is powerful for feeding comprehensive context to an AI for migration tasks.

6.  Gather the files from any source directory:

```console
akaidoo some_directory
```

    If some_directory is not an Odoo addon, then for convenience, akaidoo will select all the files from some_directory (recursively) and copy their content to the clipboard (-x) or to a file (-o) according to the options. It will skip hidden files and __pycache__.

**Exploring All Options:** For a full list of options:

```console
akaidoo --help
```

## Contributing

Contributions, bug reports, and feature requests are very welcome! Please feel free to
open an issue or submit a pull request on the GitHub repository.

## License

Akaidoo is licensed under the MIT License.
