Files
passepartout/org/gateway-cli.org
Amr Gharbeia 42e07801ce
Some checks failed
Deploy (Gitea) / deploy (push) Failing after 3s
Release v0.3.0 — Event Orchestration, Human-in-the-Loop, Daily-Driver TUI
Test results: 86 pass, 0 fail across 21 suites. TUI integration: 7/7 pass.

Features:
- 9-vector deterministic dispatcher gates (secrets, paths, shells, network)
- Human-in-the-Loop Flight Plan workflow for blocked actions
- Event Orchestrator: unified hooks + cron + tier-based routing
- Context Manager: stack-based project scoping with persistence
- Model-Tier Routing: per-slot provider cascades with privacy filter
- Memory Scope Segmentation: memex/session/project with scope-aware retrieval
- Asynchronous Embedding Gateway: provider-agnostic vectors with cron job
- TUI Experience: scrollback, history, status bar, themes, tab completion
- v0.2.x Backfill Remediation: 14 stale/todo/stub items resolved
- Multi-distro deployment: Debian + Fedora, systemd, Docker
- 31 literate Org files with full prose

Fixes:
- CLI test: fiveam:is t -> pass/fail handler-case
- Cascade-parsing integration test: load provider before checking
- Version strings 0.2.0 -> 0.3.0 in core-communication, tui-main, architecture
2026-05-06 15:50:20 -04:00

73 lines
2.3 KiB
Org Mode

#+TITLE: SKILL: CLI Gateway (org-skill-cli-gateway.org)
#+AUTHOR: Agent
#+FILETAGS: :skill:gateway:cli:
#+PROPERTY: header-args:lisp :tangle ../lisp/gateway-cli.lisp
* Overview
The CLI Gateway is the simplest interface to Passepartout — raw stdin/stdout over TCP. It connects to the daemon's framed protocol and translates between terminal input/output and the plist-based communication format. No TUI, no ncurses, no dependencies beyond a TCP socket. Every other gateway (TUI, Emacs, Telegram) builds on this same protocol.
** Contract
1. (gateway-cli-input text): wraps text in a ~:user-input~ envelope
with ~:source :CLI~ and injects into the pipeline via
~inject-stimulus~.
* Implementation
** Package Context
#+begin_src lisp
(in-package :passepartout)
#+end_src
** CLI Command Handling
;; REPL-VERIFIED: 2026-05-03T13:00:00
#+begin_src lisp
(defun gateway-cli-input (text)
"Processes raw text from the command line."
(inject-stimulus (list :type :EVENT
:payload (list :sensor :user-input :text text)
:meta (list :source :CLI))))
#+end_src
** Skill Registration
#+begin_src lisp
(defskill :passepartout-gateway-cli
:priority 100
:trigger (lambda (ctx) (eq (getf (getf ctx :meta) :source) :CLI))
:deterministic (lambda (action ctx) (declare (ignore ctx)) action))
#+end_src
* Test Suite
#+begin_src lisp
(eval-when (:compile-toplevel :load-toplevel :execute)
(ql:quickload :fiveam :silent t))
(defpackage :passepartout-gateway-cli-tests
(:use :cl :passepartout)
(:export #:cli-suite))
(in-package :passepartout-gateway-cli-tests)
(fiveam:def-suite cli-suite :description "Verification of the CLI Gateway")
(fiveam:in-suite cli-suite)
(fiveam:test test-gateway-cli-input-format
"Contract 1: gateway-cli-input injects a properly formed signal without error."
(handler-case
(progn (gateway-cli-input "hello") (fiveam:pass))
(error (c)
(fiveam:fail "gateway-cli-input crashed: ~a" c))))
#+end_src
** Load-Time Sanity Check
Verifies the function exists and can be called at load time without
depending on FiveAM macro resolution in the jailed package.
#+begin_src lisp
(handler-case
(progn (gateway-cli-input "test-load") (log-message "CLI: Load-time test OK"))
(error (c) (log-message "CLI: Load-time test FAILED: ~a" c)))
#+end_src