Files
passepartout/org/channel-cli.org
Amr Gharbeia c227877302 v0.8.3: TUI stabilization — box calls, package fixes, sandbox, configure
Bug fixes:
- Fix box() calls: set color-pair before box, pass ACS default chtype integers
- Fix markdown functions: move to passepartout.channel-tui package where
  Croatoan is imported; use add-attributes/remove-attributes instead of
  :bold/:underline kwargs to add-string; call theme-color in gate-trace-lines
  to convert theme keys to Croatoan colors
- Fix sandbox: remove dex:get/dex:post from restricted symbols
  (blocked neuro-provider from loading)
- Export *log-lock* from passepartout (was unbound in jailed skill packages)
- Fix configure: always deploy to XDG, skip cp when source==dest
- Fix bash crash handler format string (~~ escaping)
- Revert test reorder in 28 files (caused package leakage in skill loader)

Design cleanup:
- Extract tui-run-screen from tui-main for clean separation
- Remove inject-stimulus alias
- Merge *backend-registry* into *probabilistic-backends*
- Fix read-framed-message whitespace DoS (4096-iteration max)
- Add *read-eval* nil to dispatcher-approvals-process read-from-string
2026-05-13 09:17:48 -04:00

2.3 KiB

SKILL: CLI Gateway (org-skill-cli-gateway.org)

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. (channel-cli-input text): wraps text in a :user-input envelope with :source :CLI and injects into the pipeline via stimulus-inject.

Implementation

Package Context

(in-package :passepartout)

CLI Command Handling

;; REPL-VERIFIED: 2026-05-03T13:00:00

(defun channel-cli-input (text)
  "Processes raw text from the command line."
  (stimulus-inject (list :type :EVENT 
                         :payload (list :sensor :user-input :text text) 
                         :meta (list :source :CLI))))

Skill Registration

(defskill :passepartout-channel-cli
  :priority 100
  :trigger (lambda (ctx) (eq (getf (getf ctx :meta) :source) :CLI))
  :deterministic (lambda (action ctx) (declare (ignore ctx)) action))

Test Suite

(eval-when (:compile-toplevel :load-toplevel :execute)
  (ql:quickload :fiveam :silent t))

(defpackage :passepartout-channel-cli-tests
  (:use :cl :passepartout)
  (:export #:cli-suite))

(in-package :passepartout-channel-cli-tests)

(fiveam:def-suite cli-suite :description "Verification of the CLI Gateway")
(fiveam:in-suite cli-suite)

(fiveam:test test-channel-cli-input-format
  "Contract 1: channel-cli-input injects a properly formed signal without error."
  (handler-case
      (progn (channel-cli-input "hello") (fiveam:pass))
    (error (c)
      (fiveam:fail "channel-cli-input crashed: ~a" c))))

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.

(handler-case
    (progn (channel-cli-input "test-load") (log-message "CLI: Load-time test OK"))
  (error (c) (log-message "CLI: Load-time test FAILED: ~a" c)))