textcli-loader
Zero-dependency text-cli instruction package loader.
Load and execute text-cli packages in any Python environment — no text-cli runtime required.
Works with any AI Agent framework that can pip install.
from textcli_loader import load_package, execute
# Load a package
meta = load_package("./my-package/")
# Execute a directive
result = execute("AI:date-calc;add-days,2026-01-01,30")
print(result["rst_data"]["text"]) # → "2026-01-31"
Installation
pip install textcli-loader
Or from source:
pip install -e .
Usage
Load and execute
from textcli_loader import load_package, execute
meta = load_package("./my-date-calc/")
print(f"Loaded: {meta['id']}")
for d in meta["directives"]:
print(f" AI:{d['domain']};{d['action']} — {d.get('description', '')}")
result = execute("AI:date-calc;add-days,2026-01-01,30")
print(result)
# → {"rst_types": "text", "rst_data": {"text": "2026-01-31"}, "rst_err": ""}
Use in AI Agent tools
from textcli_loader import load_package, execute
# One-time setup
load_package("./weather-api/")
# Register as tool for any AI Agent framework
def call_textcli_directive(prompt: str) -> dict:
return execute(prompt)
# AI calls: call_textcli_directive("AI:天气;查询,明天,北京")
Response format
All results use text-cli compatible envelope:
{
"rst_types": "text",
"rst_data": {"text": "<result>"},
"rst_err": ""
}
Errors:
{
"rst_types": "text",
"rst_data": {"text": "[INVALID_DIRECTIVE_FORMAT] ..."},
"rst_err": "INVALID_DIRECTIVE_FORMAT"
}
Package format
A text-cli package is a directory with:
my-package/
├── schema.json ← package metadata + directive declarations
└── handler.py ← Python functions with @directive decorator
See package-dev-guide_zh.md for the full specification.
Not supported
- MCP packages — require mcporter + MCP server infrastructure
- Copilot packages — require copilot runtime (127.0.0.1 sandbox)
- Path engine — requires text-cli service runtime
- Aggregate routing — requires text-cli service runtime
Requirements
- Python ≥ 3.10
- Zero external dependencies (stdlib only)
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file textcli_loader-0.1.1.tar.gz.
File metadata
- Download URL: textcli_loader-0.1.1.tar.gz
- Upload date:
- Size: 8.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b378a3a3813ed67a01eed59b1fbc2ec25211f86ba0ca509b033a2a1d267c7fc
|
|
| MD5 |
159a381832f13ce17e7d57b843a31216
|
|
| BLAKE2b-256 |
78d987cf77893f3a5b9858d257e0dff8e43018d0c95439b88999e4d8e66bb37e
|
File details
Details for the file textcli_loader-0.1.1-py3-none-any.whl.
File metadata
- Download URL: textcli_loader-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ff6286c2320f31e9bfc9728581a5180c0ba47f89975cd7bdfb112a231474a07
|
|
| MD5 |
170dfbe167dcf87ba10e81e5e5d9a9ad
|
|
| BLAKE2b-256 |
ef50282109b4977cb0f125de8ef94b14b5f8dfce1ba84435411c27b3f508164e
|