rename cli to plano (#647)

This commit is contained in:
Adil Hafeez 2025-12-23 18:37:58 -08:00 committed by GitHub
parent e224cba3e3
commit e7ce00b5a7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
70 changed files with 226 additions and 212 deletions

View file

@ -1,6 +1,6 @@
services:
archgw:
image: katanemo/archgw:latest
plano:
image: katanemo/plano:latest
ports:
- "10000:10000"
- "10001:10001"

View file

@ -1,6 +1,6 @@
## Setup Instructions(User): archgw CLI
## Setup Instructions(User): plano CLI
This guide will walk you through the steps to set up the archgw cli on your local machine
This guide will walk you through the steps to set up the plano cli on your local machine
### Step 1: Create a Python virtual environment
@ -19,17 +19,17 @@ source venv/bin/activate
### Step 3: Run the build script
```bash
pip install archgw==0.3.22
pip install plano==0.4.0
```
## Uninstall Instructions: archgw CLI
## Uninstall Instructions: plano CLI
```bash
pip uninstall archgw
pip uninstall plano
```
## Setup Instructions (Dev): archgw CLI
## Setup Instructions (Dev): plano CLI
This guide will walk you through the steps to set up the archgw cli on your local machine when you want to develop the Archgw CLI
This guide will walk you through the steps to set up the plano cli on your local machine when you want to develop the plano CLI
### Step 1: Create a Python virtual environment
@ -53,16 +53,16 @@ poetry install
### Step 4: build Arch
```bash
archgw build
plano build
```
### Logs
`archgw` command can also view logs from the gateway. Use following command to view logs,
`plano` command can also view logs from the gateway. Use following command to view logs,
```bash
archgw logs --follow
plano logs --follow
```
## Uninstall Instructions: archgw CLI
## Uninstall Instructions: plano CLI
```bash
pip uninstall archgw
pip uninstall plano

View file

@ -1,5 +1,5 @@
import os
SERVICE_NAME_ARCHGW = "archgw"
ARCHGW_DOCKER_NAME = "archgw"
ARCHGW_DOCKER_IMAGE = os.getenv("ARCHGW_DOCKER_IMAGE", "katanemo/archgw:0.3.22")
SERVICE_NAME_ARCHGW = "plano"
PLANO_DOCKER_NAME = "plano"
PLANO_DOCKER_IMAGE = os.getenv("PLANO_DOCKER_IMAGE", "katanemo/plano:0.4.0")

View file

@ -7,14 +7,14 @@ import sys
import yaml
from cli.utils import convert_legacy_listeners, getLogger
from cli.consts import (
ARCHGW_DOCKER_IMAGE,
ARCHGW_DOCKER_NAME,
PLANO_DOCKER_IMAGE,
PLANO_DOCKER_NAME,
)
import subprocess
from cli.docker_cli import (
docker_container_status,
docker_remove_container,
docker_start_archgw_detached,
docker_start_plano_detached,
docker_stop_container,
health_check_endpoint,
stream_gateway_logs,
@ -39,6 +39,9 @@ def _get_gateway_ports(arch_config_file: str) -> list[int]:
all_ports = [listener.get("port") for listener in listeners]
# unique ports
all_ports = list(set(all_ports))
return all_ports
@ -51,27 +54,26 @@ def start_arch(arch_config_file, env, log_timeout=120, foreground=False):
log_timeout (int): Time in seconds to show logs before checking for healthy state.
"""
log.info(
f"Starting arch gateway, image name: {ARCHGW_DOCKER_NAME}, tag: {ARCHGW_DOCKER_IMAGE}"
f"Starting arch gateway, image name: {PLANO_DOCKER_NAME}, tag: {PLANO_DOCKER_IMAGE}"
)
try:
archgw_container_status = docker_container_status(ARCHGW_DOCKER_NAME)
if archgw_container_status != "not found":
log.info("archgw found in docker, stopping and removing it")
docker_stop_container(ARCHGW_DOCKER_NAME)
docker_remove_container(ARCHGW_DOCKER_NAME)
plano_container_status = docker_container_status(PLANO_DOCKER_NAME)
if plano_container_status != "not found":
log.info("plano found in docker, stopping and removing it")
docker_stop_container(PLANO_DOCKER_NAME)
docker_remove_container(PLANO_DOCKER_NAME)
gateway_ports = _get_gateway_ports(arch_config_file)
return_code, _, archgw_stderr = docker_start_archgw_detached(
return_code, _, plano_stderr = docker_start_plano_detached(
arch_config_file,
os.path.expanduser("~/archgw_logs"),
env,
gateway_ports,
)
if return_code != 0:
log.info("Failed to start arch gateway: " + str(return_code))
log.info("stderr: " + archgw_stderr)
log.info("Failed to start plano gateway: " + str(return_code))
log.info("stderr: " + plano_stderr)
sys.exit(1)
start_time = time.time()
@ -84,12 +86,12 @@ def start_arch(arch_config_file, env, log_timeout=120, foreground=False):
if not health_check_status:
all_listeners_healthy = False
archgw_status = docker_container_status(ARCHGW_DOCKER_NAME)
plano_status = docker_container_status(PLANO_DOCKER_NAME)
current_time = time.time()
elapsed_time = current_time - start_time
if archgw_status == "exited":
log.info("archgw container exited unexpectedly.")
if plano_status == "exited":
log.info("plano container exited unexpectedly.")
stream_gateway_logs(follow=False)
sys.exit(1)
@ -100,14 +102,14 @@ def start_arch(arch_config_file, env, log_timeout=120, foreground=False):
sys.exit(1)
if all_listeners_healthy:
log.info("archgw is running and is healthy!")
log.info("plano is running and is healthy!")
break
else:
health_check_status_str = (
"healthy" if health_check_status else "not healthy"
)
log.info(
f"archgw status: {archgw_status}, health status: {health_check_status_str}"
f"plano status: {plano_status}, health status: {health_check_status_str}"
)
time.sleep(1)
@ -119,7 +121,7 @@ def start_arch(arch_config_file, env, log_timeout=120, foreground=False):
stop_docker_container()
def stop_docker_container(service=ARCHGW_DOCKER_NAME):
def stop_docker_container(service=PLANO_DOCKER_NAME):
"""
Shutdown all Docker Compose services by running `docker-compose down`.

View file

@ -4,8 +4,8 @@ import sys
import requests
from cli.consts import (
ARCHGW_DOCKER_IMAGE,
ARCHGW_DOCKER_NAME,
PLANO_DOCKER_IMAGE,
PLANO_DOCKER_NAME,
)
from cli.utils import getLogger
@ -40,9 +40,8 @@ def docker_remove_container(container: str) -> str:
return result.returncode
def docker_start_archgw_detached(
def docker_start_plano_detached(
arch_config_file: str,
logs_path_abs: str,
env: dict,
gateway_ports: list[int],
) -> str:
@ -70,13 +69,13 @@ def docker_start_archgw_detached(
"run",
"-d",
"--name",
ARCHGW_DOCKER_NAME,
PLANO_DOCKER_NAME,
*port_mappings_args,
*volume_mappings_args,
*env_args,
"--add-host",
"host.docker.internal:host-gateway",
ARCHGW_DOCKER_IMAGE,
PLANO_DOCKER_IMAGE,
]
result = subprocess.run(options, capture_output=True, text=True, check=False)
@ -93,11 +92,11 @@ def health_check_endpoint(endpoint: str) -> bool:
return False
def stream_gateway_logs(follow, service="archgw"):
def stream_gateway_logs(follow, service="plano"):
"""
Stream logs from the arch gateway service.
Stream logs from the plano gateway service.
"""
log.info("Logs from arch gateway service.")
log.info("Logs from plano gateway service.")
options = ["docker", "logs"]
if follow:
@ -116,7 +115,7 @@ def stream_gateway_logs(follow, service="archgw"):
log.info(f"Failed to stream logs: {str(e)}")
def docker_validate_archgw_schema(arch_config_file):
def docker_validate_plano_schema(arch_config_file):
result = subprocess.run(
[
"docker",
@ -126,7 +125,7 @@ def docker_validate_archgw_schema(arch_config_file):
f"{arch_config_file}:/app/arch_config.yaml:ro",
"--entrypoint",
"python",
ARCHGW_DOCKER_IMAGE,
PLANO_DOCKER_IMAGE,
"-m",
"cli.config_generator",
],

View file

@ -7,7 +7,7 @@ import importlib.metadata
import json
from cli import targets
from cli.docker_cli import (
docker_validate_archgw_schema,
docker_validate_plano_schema,
stream_gateway_logs,
docker_container_status,
)
@ -25,43 +25,45 @@ from cli.core import (
start_cli_agent,
)
from cli.consts import (
ARCHGW_DOCKER_IMAGE,
ARCHGW_DOCKER_NAME,
PLANO_DOCKER_IMAGE,
PLANO_DOCKER_NAME,
SERVICE_NAME_ARCHGW,
)
log = getLogger(__name__)
# ref https://patorjk.com/software/taag/#p=display&f=Doom&t=Plano&x=none&v=4&h=4&w=80&we=false
logo = r"""
_ _
/ \ _ __ ___ | |__
/ _ \ | '__|/ __|| '_ \
/ ___ \ | | | (__ | | | |
/_/ \_\|_| \___||_| |_|
______ _
| ___ \ |
| |_/ / | __ _ _ __ ___
| __/| |/ _` | '_ \ / _ \
| | | | (_| | | | | (_) |
\_| |_|\__,_|_| |_|\___/
"""
# Command to build archgw Docker images
# Command to build plano Docker images
ARCHGW_DOCKERFILE = "./arch/Dockerfile"
def get_version():
try:
version = importlib.metadata.version("archgw")
version = importlib.metadata.version("plano")
return version
except importlib.metadata.PackageNotFoundError:
return "version not found"
@click.group(invoke_without_command=True)
@click.option("--version", is_flag=True, help="Show the archgw cli version and exit.")
@click.option("--version", is_flag=True, help="Show the plano cli version and exit.")
@click.pass_context
def main(ctx, version):
if version:
click.echo(f"archgw cli version: {get_version()}")
click.echo(f"plano cli version: {get_version()}")
ctx.exit()
log.info(f"Starting archgw cli version: {get_version()}")
log.info(f"Starting plano cli version: {get_version()}")
if ctx.invoked_subcommand is None:
click.echo("""Arch (The Intelligent Prompt Gateway) CLI""")
@ -76,7 +78,7 @@ def build():
# Check if /arch/Dockerfile exists
if os.path.exists(ARCHGW_DOCKERFILE):
if os.path.exists(ARCHGW_DOCKERFILE):
click.echo("Building archgw image...")
click.echo("Building plano image...")
try:
subprocess.run(
[
@ -85,7 +87,7 @@ def build():
"-f",
ARCHGW_DOCKERFILE,
"-t",
f"{ARCHGW_DOCKER_IMAGE}",
f"{PLANO_DOCKER_IMAGE}",
".",
"--add-host=host.docker.internal:host-gateway",
],
@ -93,7 +95,7 @@ def build():
)
click.echo("archgw image built successfully.")
except subprocess.CalledProcessError as e:
click.echo(f"Error building archgw image: {e}")
click.echo(f"Error building plano image: {e}")
sys.exit(1)
else:
click.echo("Error: Dockerfile not found in /arch")
@ -128,7 +130,7 @@ def up(file, path, foreground):
validation_return_code,
validation_stdout,
validation_stderr,
) = docker_validate_archgw_schema(arch_config_file)
) = docker_validate_plano_schema(arch_config_file)
if validation_return_code != 0:
log.info(f"Error: Validation failed. Exiting")
log.info(f"Validation stdout: {validation_stdout}")
@ -211,7 +213,7 @@ def generate_prompt_targets(file):
@click.command()
@click.option(
"--debug",
help="For detailed debug logs to trace calls from archgw <> api_server, etc",
help="For detailed debug logs to trace calls from plano <> api_server, etc",
is_flag=True,
)
@click.option("--follow", help="Follow the logs", is_flag=True)
@ -259,11 +261,11 @@ def cli_agent(type, file, path, settings):
CLI_AGENT: The type of CLI agent to start (currently only 'claude' is supported)
"""
# Check if archgw docker container is running
archgw_status = docker_container_status(ARCHGW_DOCKER_NAME)
# Check if plano docker container is running
archgw_status = docker_container_status(PLANO_DOCKER_NAME)
if archgw_status != "running":
log.error(f"archgw docker container is not running (status: {archgw_status})")
log.error("Please start archgw using the 'archgw up' command.")
log.error("Please start plano using the 'archgw up' command.")
sys.exit(1)
# Determine arch_config.yaml path

View file

@ -1,7 +1,7 @@
[tool.poetry]
name = "archgw"
version = "0.3.22"
description = "Python-based CLI tool to manage Arch Gateway."
name = "plano"
version = "0.4.0"
description = "Python-based CLI tool to manage Plano."
authors = ["Katanemo Labs, Inc."]
readme = "README.md"
packages = [{ include = "cli" }]
@ -18,7 +18,7 @@ requests = ">=2.31.0,<3.0.0"
pytest = ">=8.4.1,<9.0.0"
[tool.poetry.scripts]
archgw = "cli.main:main"
plano = "cli.main:main"
[build-system]
requires = ["poetry-core>=2.0.0"]

View file

@ -5,7 +5,7 @@ failed_files=()
for file in $(find . -name arch_config.yaml -o -name arch_config_full_reference.yaml); do
echo "Validating ${file}..."
touch $(pwd)/${file}_rendered
if ! docker run --rm -v "$(pwd)/${file}:/app/arch_config.yaml:ro" -v "$(pwd)/${file}_rendered:/app/arch_config_rendered.yaml:rw" --entrypoint /bin/sh katanemo/archgw:0.3.22 -c "python -m cli.config_generator" 2>&1 > /dev/null ; then
if ! docker run --rm -v "$(pwd)/${file}:/app/arch_config.yaml:ro" -v "$(pwd)/${file}_rendered:/app/arch_config_rendered.yaml:rw" --entrypoint /bin/sh katanemo/plano:0.4.0 -c "python -m cli.config_generator" 2>&1 > /dev/null ; then
echo "Validation failed for $file"
failed_files+=("$file")
fi