Metadata-Version: 2.4
Name: codex-tool-mock
Version: 0.1.0
Summary: Codex plugin and CLI for mocking shell-like tool calls in skill and agent tests.
Author: codex-tool-mock contributors
License: MIT License
        
        Copyright (c) 2026 Yiping Deng
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Requires-Python: >=3.11
Description-Content-Type: text/markdown

# codex-tool-mock

[![PyPI](https://img.shields.io/pypi/v/codex-tool-mock.svg)](https://pypi.org/project/codex-tool-mock/)

Codex tool mocking plugin and CLI. Useful for testing and evaluating skills on
Codex by mocking shell-like tool calls and asserting that expected commands were
used.

See [docs/usage.md](docs/usage.md) for setup and usage, [docs/publishing.md](docs/publishing.md)
for PyPI publishing, and [SPEC.md](SPEC.md) for the MVP behavior and milestone plan.

## MVP

- Shell-like `Bash` hook support.
- Exact and regex command matching.
- Static mocked stdout/stderr/exit code responses.
- Python responder scripts executed through `uv run --script`, including uv inline
  dependency metadata.
- Project-local fixtures and recordings under `.codex/tool-mocks/`.
- Pytest-style verification helpers.

## Install With uv

For normal use, install the CLI as a persistent uv tool:

```bash
uv tool install codex-tool-mock
codex-tool-mock --help
```

Then install the Codex plugin globally:

```bash
codex-tool-mock install-global
```

This is the recommended uv workflow because Codex hooks will keep using the
Python environment created by `uv tool install`.

To install from a local checkout instead of a package index:

```bash
uv tool install .
codex-tool-mock install-global
```

To try the CLI without installing it persistently:

```bash
uvx --from codex-tool-mock codex-tool-mock --help
```

If you use `uvx` to install the Codex plugin, make the hook re-run through `uvx`
so it does not depend on the temporary uvx environment:

```bash
uvx --from codex-tool-mock codex-tool-mock install-global --hook-runner uvx
```

For local development from this checkout:

```bash
uv sync
uv run codex-tool-mock --help
uv run codex-tool-mock install-global
```

## Install With pip

Install from a package index with pip:

```bash
pip install codex-tool-mock
codex-tool-mock --help
```

Initialize mock storage in the project you want to test:

```bash
codex-tool-mock init
```

Then add fixtures:

```bash
codex-tool-mock add-shell --id git-status --command "git status --short" --stdout "" --exit-code 0
```

To install the Codex plugin globally after a persistent `pip` or `uv tool`
install:

```bash
codex-tool-mock install-global
```

The installer copies the plugin into `~/.codex/plugins/cache/debug/codex-tool-mock/local`
and enables these entries in `~/.codex/config.toml`. The installed hook command
uses the Python environment that ran the installer, so the package must remain
installed there.

```toml
[features]
plugins = true
plugin_hooks = true

[plugins."codex-tool-mock@debug"]
enabled = true
```

You can preview target paths without writing files:

```bash
codex-tool-mock install-global --dry-run
```

More examples are in [docs/usage.md](docs/usage.md).
