Apple Code Assistant
Professional CLI tool powered by Apple Intelligence for on-device code generation. Features modern terminal UI, real-time streaming, multi-language support, and conversation management.
Inspired by Apple-AI-CLI.
Prerequisites
- Rust 1.70+ (edition 2021)
- macOS 15+ with Apple Intelligence support (for future integration)
- Apple Silicon Mac recommended
Installation
Then use the apple-code binary:
Build and run
Quick start
# Simple generation
# Summarize a diff (smartcat-style)
|
# Use a template for tests
Getting plain code only (no markdown)
By default, some models may still wrap code in ``` fences and add explanations. To force plain code output suitable for files and editors:
# Only code written to the file (no markdown, no explanation)
You can further tighten behavior with a prompt template in config.toml, for example:
[]
= "Never use markdown or explanations. Return only the final code."
Then call:
Examples (from source checkout)
# Interactive mode (REPL with logo, /help, /exit, /history, /sessions)
# Direct code generation with preview
# Save to file
# Copy to clipboard
# Use stdin as context (pipe data in, smartcat-style)
|
|
|
# Use prompt templates from config.toml
# Extend previous conversation in non-interactive mode
# Repeat input before output (useful in editors)
|
# Limit size of piped/context data and add globbed context files
|
# Edit existing file (send file content + prompt to model, write result back)
# Configuration
# List models and languages, test API
Features
- Config – Load from
.envand~/.config/apple-code-assistant/config.toml; subcommandconfig --list/get/set/reset - Terminal UI – ASCII logo, theme (light/dark), bordered code preview
- Code generation – Trait-based client (mock included); direct mode with
-pand options - REPL – Interactive mode with
/help,/exit,/clear,/history,/sessions,/models,/languages,/test - Conversations – Sessions persisted under config dir;
/historyand/sessions - File operations –
--save -o <file>,--edit <file> - Clipboard –
--copy(arboard) - Syntax highlighting – syntect in preview and REPL when language is set
- Multi-language – 20+ languages and aliases;
languagessubcommand; validation of--language - Stdin piping – When stdin is not a TTY (e.g.
git diff | apple-code -p "…") the piped content is appended to the prompt (smartcat-style) - Prompt templates – Templates configurables dans
config.toml, sélectionnés via--template/-T - CLI conversations –
--extend-conversationpour réutiliser la dernière session,--repeat-inputpour rejouer l’entrée avant la sortie - Context control –
--char-limitpour borner la taille de stdin/contexte,--context-globpour ajouter des fichiers de contexte par glob - Tool mode –
--tool-modepour une sortie brute adaptée aux éditeurs (aucun cadre ni mise en forme) - Signals – Ctrl+C handled with “Operation cancelled”
Development plan
A step-by-step development plan (phases 1–8) is in docs/DEVELOPMENT_PLAN.md.
License
MIT