Skip to main content

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

textcli_loader-0.1.0.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

textcli_loader-0.1.0-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file textcli_loader-0.1.0.tar.gz.

File metadata

  • Download URL: textcli_loader-0.1.0.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for textcli_loader-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9d1387d2bc73606464e144df4cf39c7d6c1415e1d7d5549d6e4d9a04db18f3a2
MD5 5fb90aaaf0a470401eee2b0acfeacbf6
BLAKE2b-256 a194c42f821faf451c2f6d5cf47e84bab7d591bc1b15363a46c0fce5690bb3f1

See more details on using hashes here.

File details

Details for the file textcli_loader-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: textcli_loader-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for textcli_loader-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 57f69dad18d124e65a7bcb0ac24fae1d347c7e426f313306a01c6fe189c3b37e
MD5 61cb4d89a086f8c25650b15170074b89
BLAKE2b-256 d8a12c10bb0d4297539679c72b1a81d2b1e87741053a854a8cbed7d5a152ffcd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page