Metadata-Version: 2.4
Name: rsi-explorer-jtac
Version: 1.5.0
Summary: RSI (Request Support Information) parser and Junos CLI simulator
Project-URL: Homepage, https://github.hpe.com/ying-wang/RSI-Explorer-JTAC
Project-URL: Repository, https://github.hpe.com/ying-wang/RSI-Explorer-JTAC
Project-URL: Issues, https://github.hpe.com/ying-wang/RSI-Explorer-JTAC/issues
Author: Ying Wang
License: MIT
License-File: LICENSE
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: System Administrators
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: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: System :: Networking
Requires-Python: >=3.8
Requires-Dist: httpx
Requires-Dist: prompt-toolkit>=3.0.0
Requires-Dist: pyparsing>=3.1.4
Requires-Dist: pyyaml>=6.0.2
Provides-Extra: dev
Requires-Dist: mypy>=1.0.0; extra == 'dev'
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
Requires-Dist: pytest>=7.0.0; extra == 'dev'
Requires-Dist: ruff>=0.1.0; extra == 'dev'
Provides-Extra: junos
Requires-Dist: junos-eznc>=2.6.0; extra == 'junos'
Description-Content-Type: text/markdown

# rsi-explorer-JTAC

A Juniper RSI (Request Support Information) parser and interactive Junos CLI simulator. Load an RSI file and explore its contents as if you were on the actual device, with tab completion, pipe commands, and contextual help.

This customized version is optimized for the JTAC daily workflow and introduces features that make the simulator experience much closer to a real Junos CLI:

- **Spacebar Completion**: Supports shortcut expansion (for example, typing `sh cha har` and pressing Space expands to `show chassis hardware`).
- **Contextual Help (`?`)**: Type `?` at any point to list available sub-commands (for example, `show chassis ?`).
- **Enhanced Config Mode**: Supports full hierarchical navigation, including `configure`, `edit`, and `show` within specific hierarchy levels.
- **Smart Output Filtering**: Automatically omits `no-forwarding` statements (for example, in `show chassis hardware`) for a cleaner view of auto-matched components.
- **Improved Pager Control**: Press `Ctrl+C` once to stop the pager and return to the CLI prompt. Press `Ctrl+C` a second time to exit the tool.

[![RSI CLI Demo](https://i.imgur.com/hWe8trh.gif)](https://github.hpe.com/ying-wang/rsi-explorer-JTAC/raw/main/docs/media/Untitled_hq.mp4)

## Quick Start (JTAC/BAAS)

Python 3.8+ is required.

Install from PyPI on the remote Linux host (no local download needed):

```bash
python3 -m pip install --user -U uv
python3 -m pip install --user -U rsi-explorer-jtac
export PATH="$HOME/.local/bin:$PATH"
```

Run directly against RSI files on JTAC paths:

```bash
rsi-cli /volume/CSdata/<user>/case/<case-id>/20260327rsi.txt
```

## Clone & Run
```bash
git clone git@github.hpe.com:ying-wang/RSI-Explorer-JTAC.git rsi-explorer
cd rsi-explorer
uv sync
uv run rsi-cli <rsi-file>
```

## Installation

From PyPI:

```bash
python3 -m pip install --user -U rsi-explorer-jtac
```

The package provides:

- `rsi-cli-jtac`

Example:

```bash
rsi-cli-jtac <rsi-file>
```

## Publish To PyPI (Maintainers)

1. Bump the version in `pyproject.toml`.
2. Build distributions:

```bash
python3 -m pip install --user -U build twine
python3 -m build
python3 -m twine check dist/*
```

3. Upload to TestPyPI first:

```bash
python3 -m twine upload --repository testpypi dist/*
```

4. Verify install from TestPyPI:

```bash
python3 -m pip install --user -U --index-url https://test.pypi.org/simple/ rsi-explorer-jtac
```

5. Upload to PyPI:

```bash
python3 -m twine upload dist/*
```

## Pipe Commands (`|`)
```text
show interfaces terse | match ge-0
show config | display set | save backup.conf
show interfaces | count
show route | except 0.0.0.0 | last 20
```

Available pipes: `no-more`, `save <file>`, `count`, `match <pattern>`, `except <pattern>`, `last <N>`, `find <pattern>`, `trim <N>`, `display set`

## Limitations
Simulation output is replayed from the RSI. If the RSI does not contain the command you request, you will see `Unknown command` message.

## CLI Options
```text
rsi-cli <rsi-file>                    # interactive mode
rsi-cli <rsi-file> --no-pager       # disable paging
```

## Development
```bash
uv sync --dev
uv run pytest
uv run ruff check rsi/
uv run ruff format rsi/
```
