mycli Agent Skills & AI Rules

GitHub

A Terminal Client for MySQL with AutoCompletion and Syntax Highlighting.

11,909 stars Python Python 1 file ยท ~2,313 tokens #auto-completion#database#mycli#mysql#python#syntax-highlighting
RAW Rules
1 Discovered Rules โ€ข ~1,741 Estimated Tokens
Quick:
Loading skill content...

AI Agent Protocol & Instructions

AGENTS.md root-instruction ~1,741 tokens
Raw
# Mycli

Rich MySQL terminal client with auto-completion, syntax highlighting, and dataframes.

## Project Structure

    /                                                     # repository root
    โ”œโ”€โ”€ .github/                                          # GitHub Actions and configuration
    โ”œโ”€โ”€ pyproject.toml                                    # project configuration
    โ”œโ”€โ”€ doc/                                              # documentation
    โ”œโ”€โ”€ doc/cookbook.md                                   # recipes for how to configure and use mycli
    โ”œโ”€โ”€ doc/key_bindings.md                               # documentation of key binding behaviors
    โ”œโ”€โ”€ doc/known_bugs.md                                 # documentation of known bugs and limitations
    โ”œโ”€โ”€ doc/llm.md                                        # documentation on how to use LLM features
    โ”œโ”€โ”€ doc/transforms.md                                 # documentation on how to use dataframe transform/plot features
    โ”œโ”€โ”€ doc/screenshots/                                  # screenshots for documentation
    โ”œโ”€โ”€ mycli/                                            # application source
    โ”œโ”€โ”€ mycli/__init__.py                                 # provides version number
    โ”œโ”€โ”€ mycli/app_state.py                                # `AppStateMixin` application state mixin and related functions
    โ”œโ”€โ”€ mycli/cli_runner.py                               # connects and dispatches main modes based on CLI arguments
    โ”œโ”€โ”€ mycli/client_commands.py                          # special commands which must be registered separately
    โ”œโ”€โ”€ mycli/client_connection.py                        # `ClientConnectionMixin` mixin for establishing the database connection
    โ”œโ”€โ”€ mycli/client_query.py                             # `ClientQueryMixin` mixin for running queries and refreshing completions
    โ”œโ”€โ”€ mycli/client.py                                   # the `MyCli` "god class"
    โ”œโ”€โ”€ mycli/compat.py                                   # OS compatibility helpers
    โ”œโ”€โ”€ mycli/config.py                                   # configuration file readers and utilities
    โ”œโ”€โ”€ mycli/constants.py                                # shared constants
    โ”œโ”€โ”€ mycli/main.py                                     # processes CLI arguments
    โ”œโ”€โ”€ mycli/main_modes/                                 # main execution paths
    โ”œโ”€โ”€ mycli/main_modes/batch.py                         # `--batch` mode
    โ”œโ”€โ”€ mycli/main_modes/checkup.py                       # `--checkup` mode
    โ”œโ”€โ”€ mycli/main_modes/completions.py                   # `--completions` mode
    โ”œโ”€โ”€ mycli/main_modes/execute.py                       # `--execute` mode
    โ”œโ”€โ”€ mycli/main_modes/list_dsn.py                      # `--list-dsn` mode
    โ”œโ”€โ”€ mycli/main_modes/repl.py                          # interactive REPL mode
    โ”œโ”€โ”€ mycli/myclirc                                     # project-level configuration file
    โ”œโ”€โ”€ mycli/output.py                                   # `OutputMixin` mixin for feedback and output of query results
    โ”œโ”€โ”€ mycli/packages/                                   # application packages
    โ”œโ”€โ”€ mycli/packages/completion/completion_engine.py    # implementation of completion suggestions
    โ”œโ”€โ”€ mycli/packages/completion/completion_refresher.py # populates a `SQLCompleter` object in a background thread
    โ”œโ”€โ”€ mycli/packages/completion/schema_prefetcher.py    # background prefetcher for multi-schema auto-completion
    โ”œโ”€โ”€ mycli/packages/completion/sql_completer.py        # finds SQL completion candidates
    โ”œโ”€โ”€ mycli/packages/credentials/password_sources.py    # password sources and precedence
    โ”œโ”€โ”€ mycli/packages/dataframes/completion.py           # completions for `.|` transforms
    โ”œโ”€โ”€ mycli/packages/dataframes/transform.py            # implements `.|` transforms
    โ”œโ”€โ”€ mycli/packages/execution/background_runner.py     # run queries in the background, with query state and timing updates
    โ”œโ”€โ”€ mycli/packages/execution/sql_execute.py           # `SQLExecute` class and friends
    โ”œโ”€โ”€ mycli/packages/integrations/                      # integrations with fzf, Boundary, Kubernetes, macOS, OpenSSH, and Vault
    โ”œโ”€โ”€ mycli/packages/prompt_toolkit/fzf_history.py      # uses fzf integration to serach the prompt_toolkit history
    โ”œโ”€โ”€ mycli/packages/prompt_toolkit/history.py          # extends the prompt_toolkit history class
    โ”œโ”€โ”€ mycli/packages/prompt_toolkit/key_bindings.py     # prompt_toolkit key bindings
    โ”œโ”€โ”€ mycli/packages/prompt_toolkit/multiline.py        # prompt_toolkit multiline input
    โ”œโ”€โ”€ mycli/packages/prompt_toolkit/style.py            # prompt_toolkit (and Pygments) styles
    โ”œโ”€โ”€ mycli/packages/prompt_toolkit/toolbar.py          # prompt_toolkit bottom toolbar
    โ”œโ”€โ”€ mycli/packages/prompt_toolkit/utils.py            # general utility functions for prompt_toolkit
    โ”œโ”€โ”€ mycli/packages/pygments/mycli_lexer.py            # extends `MySqlLexer` from Pygments
    โ”œโ”€โ”€ mycli/packages/redirection/                       # implementation of shell-style redirects
    โ”œโ”€โ”€ mycli/packages/special_commands/                  # implementation of mycli special commands
    โ”œโ”€โ”€ mycli/packages/sql_result/sql_result.py           # the `SQLResult` dataclass for holding responses
    โ”œโ”€โ”€ mycli/packages/tabular_output/                    # extends cli_helper with additional output formats
    โ”œโ”€โ”€ mycli/packages/utils/batch_utils.py               # utilities for `--batch` mode
    โ”œโ”€โ”€ mycli/packages/utils/cli_utils.py                 # utilities for parsing CLI arguments
    โ”œโ”€โ”€ mycli/packages/utils/interactive_utils.py         # utilities for confirming on destructive statements
    โ”œโ”€โ”€ mycli/packages/utils/key_binding_utils.py         # handlers for key bindings and related special commands
    โ”œโ”€โ”€ mycli/packages/utils/keyring_utils.py             # saved credential utilities
    โ”œโ”€โ”€ mycli/packages/utils/path_utils.py                # utilities for files, including completion suggestions
    โ”œโ”€โ”€ mycli/packages/utils/sql_utils.py                 # utilities for parsing SQL statements
    โ”œโ”€โ”€ mycli/packages/utils/string_utils.py              # generic string utilities
    โ”œโ”€โ”€ mycli/resources/completions/                      # shell completions for CLI interface
    โ”œโ”€โ”€ mycli/types.py                                    # shared types
    โ”œโ”€โ”€ mycli_test/features/                              # behave tests
    โ”œโ”€โ”€ mycli_test/myclirc                                # mycli configuration used for tests
    โ”œโ”€โ”€ mycli_test/mylogin.cnf                            # `mylogin.cnf` example used for tests
    โ”œโ”€โ”€ mycli_test/pytests/                               # pytest tests
    โ”œโ”€โ”€ mycli_test/pytests/conftest.py                    # pytest configuration
    โ””โ”€โ”€ mycli_test/utils.py                               # shared utilities for tests

## Development

### Python

#### Python Dependency Management

This repo uses `uv` for dependency management. **Always** prefix Python
commands with `uv run`.  Example:

```bash
env -u PYTHONPATH uv run -- python script.py
```

#### Python Typing

This repo uses type annotations which are checked by `mypy`.  **Always** add
type annotations, and always check new code with `env -u PYTHONPATH uv run -- mypy --install-types --non-interactive script.py`.

Use lower-case type annotations such as `tuple`, not upper-case type
annotations such as `Tuple`.

Use `Type | None` instead of `Optional[Type]`.

#### Python Testing

Tests are coordinated by `tox`, and include both `pytest` and `behave` tests.
To run the full test suite, execute `env -u PYTHONPATH uv run -- tox`.

#### Python Compatibility

Use Python features available from Python 3.11 through Python 3.15.
Compatibility with Python 3.9 is not needed.  Compatibility with Python
3.10 is not needed.

#### Python Style

Import style: prefer `from package import name` over `import package.name as name`.

Quoting style: prefer single quotes for new code, but do not remove double quotes
from existing code.

#### Python Environment

 * Package manager: `uv` (not pip)
 * Formatter: `env -u PYTHONPATH uv run -- ruff format`
 * Linter: `env -u PYTHONPATH uv run -- ruff check`
 * Type checker: `env -u PYTHONPATH uv run -- mypy --install-types --non-interactive`

### Git Workflows

#### Git Commit Messages

 * Use the present tense.
 * Keep the first line under 50 characters in length.
 * Keep the second line blank.
 * Keep all other lines under 72 characters in length.
 * Reference issue numbers when available.

#### Generating PRs

When generating a PR, follow the instructions in `.github/PULL_REQUEST_TEMPLATE.md`:

 * Add new author names to `mycli/AUTHORS.txt`.
 * Add a new entry to `changelog.md`.

### Code Comments

Keep comments concise and direct.  Use full sentences, ending with a period.

### See Also

See also the file `CONTRIBUTING.md`.