From 41041a741ca6f3ba192927d3a998c9ec2a3aa71d Mon Sep 17 00:00:00 2001 From: Endi Sukaj Date: Sun, 3 May 2026 19:53:36 +0200 Subject: [PATCH 1/3] Add fabrica support --- agent-shell-fabrica.el | 115 +++++++++++++++++++++++++++++++++++++++++ agent-shell.el | 2 + 2 files changed, 117 insertions(+) create mode 100644 agent-shell-fabrica.el diff --git a/agent-shell-fabrica.el b/agent-shell-fabrica.el new file mode 100644 index 00000000..5abc9da7 --- /dev/null +++ b/agent-shell-fabrica.el @@ -0,0 +1,115 @@ +;;; agent-shell-fabrica.el --- Fabrica coding agent configurations -*- lexical-binding: t; -*- + +;; Copyright (C) 2024 Alvaro Ramirez + +;; Author: Alvaro Ramirez https://xenodium.com +;; URL: https://github.com/xenodium/agent-shell + +;; This package is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 3, or (at your option) +;; any later version. + +;; This package is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: +;; +;; This file includes Fabrica coding agent specific configurations. +;; +;; Fabrica is a terminal-based coding agent built in Rust with built-in +;; ACP support. See https://github.com/Endi1/fabrica +;; +;; Fabrica supports multiple providers (Google Gemini, Anthropic Claude, +;; OpenAI) and includes built-in tools for file operations and shell +;; commands. +;; + +;;; Code: + +(eval-when-compile + (require 'cl-lib)) +(require 'shell-maker) +(require 'acp) + +(declare-function agent-shell--indent-string "agent-shell") +(declare-function agent-shell-make-agent-config "agent-shell") +(autoload 'agent-shell-make-agent-config "agent-shell") +(declare-function agent-shell--make-acp-client "agent-shell") +(declare-function agent-shell--dwim "agent-shell") + +(defcustom agent-shell-fabrica-acp-command + '("fabrica" "serve") + "Command and parameters for the Fabrica ACP client. + +The first element is the command name, and the rest are command parameters. + +Fabrica has built-in ACP support via its `serve' subcommand." + :type '(repeat string) + :group 'agent-shell) + +(defun agent-shell-fabrica-make-agent-config () + "Create a Fabrica coding agent configuration. + +Returns an agent configuration alist using `agent-shell-make-agent-config'." + (agent-shell-make-agent-config + :identifier 'fabrica + :mode-line-name "Fabrica" + :buffer-name "Fabrica" + :shell-prompt "Fabrica> " + :shell-prompt-regexp "Fabrica> " + :welcome-function #'agent-shell-fabrica--welcome-message + :client-maker (lambda (buffer) + (agent-shell-fabrica-make-client :buffer buffer)) + :install-instructions "Install with: cargo install fabrica-cli +See https://github.com/Endi1/fabrica for details.")) + +(defun agent-shell-fabrica-start-agent () + "Start an interactive Fabrica coding agent shell." + (interactive) + (agent-shell--dwim :config (agent-shell-fabrica-make-agent-config) + :new-shell t)) + +(cl-defun agent-shell-fabrica-make-client (&key buffer) + "Create a Fabrica client using BUFFER as context. + +Fabrica uses environment variables for provider authentication. +Set GEMINI_KEY, ANTHROPIC_KEY, or OPENAI_KEY as needed." + (unless buffer + (error "Missing required argument: :buffer")) + (agent-shell--make-acp-client :command (car agent-shell-fabrica-acp-command) + :command-params (cdr agent-shell-fabrica-acp-command) + :environment-variables agent-shell-fabrica-environment + :context-buffer buffer)) + +(defun agent-shell-fabrica--welcome-message (config) + "Return Fabrica welcome message using `shell-maker' CONFIG." + (let ((art (agent-shell--indent-string 4 (agent-shell-fabrica--ascii-art))) + (message (string-trim-left (shell-maker-welcome-message config) "\n"))) + (concat "\n\n" + art + "\n\n" + message))) + +(defun agent-shell-fabrica--ascii-art () + "Fabrica ASCII art." + (let* ((is-dark (eq (frame-parameter nil 'background-mode) 'dark)) + (text (string-trim " +░░░░░░░░░░ ░░░░░░░ ░░░░░░░░░ ░░░░░░░░ ░░░ ░░░░░░░ ░░░░░░░ +░░░ ░░░ ░░░ ░░░ ░░░ ░░░ ░░░ ░░░ ░░░ ░░░ ░░░ ░░░ +░░░░░░░░ ░░░░░░░░░ ░░░░░░░░░ ░░░░░░░░ ░░░ ░░░ ░░░░░░░░░ +░░░ ░░░ ░░░ ░░░ ░░░ ░░░ ░░░ ░░░ ░░░ ░░░ ░░░ ░░░ +░░░ ░░░ ░░░ ░░░░░░░░ ░░░ ░░░ ░░░ ░░░░░░░ ░░░ ░░░ +" "\n"))) + (propertize text 'font-lock-face (if is-dark + '(:foreground "#e0a526" :inherit fixed-pitch) + '(:foreground "#b8860b" :inherit fixed-pitch))))) + +(provide 'agent-shell-fabrica) + +;;; agent-shell-fabrica.el ends here diff --git a/agent-shell.el b/agent-shell.el index 96abdaa9..50531b12 100644 --- a/agent-shell.el +++ b/agent-shell.el @@ -56,6 +56,7 @@ (require 'agent-shell-devcontainer) (require 'agent-shell-diff) (require 'agent-shell-experimental) +(require 'agent-shell-fabrica) (require 'agent-shell-droid) (require 'agent-shell-github) (require 'agent-shell-google) @@ -502,6 +503,7 @@ Goose, Cursor, Auggie, and others." (agent-shell-openai-make-codex-config) (agent-shell-cursor-make-agent-config) (agent-shell-droid-make-agent-config) + (agent-shell-fabrica-make-agent-config) (agent-shell-github-make-copilot-config) (agent-shell-google-make-gemini-config) (agent-shell-goose-make-agent-config) From 51b817a9af75bfe3bd91f4e18470e2fb246b45d0 Mon Sep 17 00:00:00 2001 From: Endi Sukaj Date: Sun, 3 May 2026 19:59:00 +0200 Subject: [PATCH 2/3] Update readme --- README.org | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.org b/README.org index acff85f6..c72fa1d5 100644 --- a/README.org +++ b/README.org @@ -176,6 +176,15 @@ npm install -g pi-acp See https://github.com/svkozak/pi-acp for details. + +*** For the Fabrica coding agent, install fabrica-cli + +#+begin_src bash +cargo install fabrica-cli +#+end_src + +See https://github.com/Endi1/fabrica for details. + ** Installation =agent-shell= is powered by built-in =comint-shell=, via [[https://github.com/xenodium/shell-maker][shell-maker]], available on [[https://melpa.org/#/shell-maker][MELPA]]. @@ -443,6 +452,7 @@ Start a specific agent shell session directly: - =M-x agent-shell-qwen-start= - Start a Qwen Code agent session - =M-x agent-shell-droid-start-agent= - Start a Factory Droid agent session - =M-x agent-shell-pi-start-agent= - Start a Pi coding agent session +- =M-x agent-shell-fabrica-start-agent= - Start a Fabrica coding agent session *** Setting a default agent for all new shells From 7095461b31d9c955c5e6e8767ac37ed3046d2a1a Mon Sep 17 00:00:00 2001 From: Endi Sukaj Date: Sat, 9 May 2026 22:40:21 +0200 Subject: [PATCH 3/3] Simplify fabrica config --- agent-shell-fabrica.el | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/agent-shell-fabrica.el b/agent-shell-fabrica.el index 5abc9da7..f61569de 100644 --- a/agent-shell-fabrica.el +++ b/agent-shell-fabrica.el @@ -78,13 +78,12 @@ See https://github.com/Endi1/fabrica for details.")) (cl-defun agent-shell-fabrica-make-client (&key buffer) "Create a Fabrica client using BUFFER as context. -Fabrica uses environment variables for provider authentication. -Set GEMINI_KEY, ANTHROPIC_KEY, or OPENAI_KEY as needed." +Fabrica loads API keys from its own config file and/or +environment variables." (unless buffer (error "Missing required argument: :buffer")) (agent-shell--make-acp-client :command (car agent-shell-fabrica-acp-command) :command-params (cdr agent-shell-fabrica-acp-command) - :environment-variables agent-shell-fabrica-environment :context-buffer buffer)) (defun agent-shell-fabrica--welcome-message (config)