Skyline Code Helper CLI (ai)
A lightweight, enterprise-grade, local LLM-powered command-line interface (CLI) for in-place code refactoring and scaffolding. Designed for complete data privacy and seamless developer ergonomics, this tool integrates directly into your terminal and pipes code changes straight into Visual Studio Code's native diff viewer for a review-first approval gate.
Built specifically for Skyline Cloud LLC development workflows.
🚀 Features
Zero-Token Local Inference: Harnesses your local Ollama server running qwen2.5-coder:3b (or larger weights) with zero API costs and absolute source code privacy.
Visual Diff Integration: Automatically launches a split-screen side-by-side visual difference editor (code --diff) in VS Code so you can inspect proposed updates before committing them.
Dynamic Multi-Agent System Prompts: Reads the extension of your target file (e.g., .cs, .py, .sql) and automatically routes the request to language-specific system architectures (architect_rules_cs.txt, architect_rules_py.txt, architect_rules_sql.txt).
Smart Scaffolding: Auto-detects if a target file exists. If it does, a fail-safe backup (.bak) is created; if it doesn't, the tool enters scaffolding mode to write directory paths and generate your boilerplate from scratch.
Performance & UX Upgrades: - Smooth terminal feedback using a thread-safe CLI progress spinner.
Generous context window sizing (8192 tokens) to process legacy source classes.
Network timeout fail-safe at 120 seconds.
Local Short-Circuits: Bypass the LLM entirely for high-frequency commands (like adding corporate licensing/disclaimers) using high-speed regex pattern matching.
🛠️ Architecture & Data Flow
[ CLI Input ] -> ai .\Path\To\File.cs "refactor method..."
|
v
[ Python Wrapper ]
|
+-------------+-------------+
| |
v v
[File Exists?] [Identify Extension] (Yes) -> Backup File (CS/PY/SQL) -> Load Target Rules File (No) -> Touch Empty File | | +-------------+-------------+ | v [ Local Payload ] -> Injects System Rules + Source File + Instruction | v [ Local Ollama Server ] -> Process via qwen2.5-coder:3b (Port 11434) | v [ Temp Proposal File ] -> Saved as File.cs.proposal | v [ VS Code Diff Viewer ] -> Launches "code --diff File.cs File.cs.proposal" | v [ Terminal Prompt ] -> Accept LLM Changes? (y/n) | +-----------+-----------+ | | v v ( Yes ) ( No ) Overwrite File Discard Proposal Clean up Proposal Revert Scaffolds
📦 Prerequisites
Ollama: Installed and running locally. Download from ollama.com.
VS Code: Installed and added to your system PATH (the code command must work in your terminal).
Python 3.8+ with the requests library:
pip install requests
⚙️ Installation & Global Execution Setup
To get a true "Copilot CLI" feel where you can type ai without specifying Python paths or wrapping your prompts in quotation marks, configure a system alias.
- Position the Files
Save code_helper.py to a dedicated directory on your system (e.g., C:\SkylineTools\code_helper.py).
- Create the System Command
Create a batch file named ai.bat inside that same folder (C:\SkylineTools\ai.bat):
@echo off python "C:\SkylineTools\code_helper.py" %*
- Update Your System PATH
Open the Windows Start Menu, search for "Edit the system environment variables", and open it.
Click Environment Variables...
Under User variables, select Path and click Edit.
Click New and add your tools folder path: C:\SkylineTools
Click OK on all screens to apply, and restart any open terminals or VS Code windows.
💡 How It Works & Usage Examples
Open any shell terminal in any project workspace and call your code assistant natively:
Refactoring an Existing C# Class
ai .\Services\PaymentProcessor.cs refactor the ProcessTransaction method to be asynchronous and add XML comments
Creates a .bak backup, spins, sends the file payload to the local model combined with architect_rules_cs.txt, and loads the diff preview in VS Code.
Scaffolding a Brand New Python Script
ai .\Scripts\fetch_metrics.py generate a python script to query system CPU/Memory loads and save them as a CSV log
Identifies that the script doesn't exist, initializes an empty file to satisfy the split-screen viewer, loads architect_rules_py.txt, and generates the script.
Instant Bypass Shortcut
ai .\Controllers\OrderController.cs Add disclaimer
Instantly triggers a local regex pattern parser, identifies the last using declaration, and injects the Skyline Cloud LLC corporate copyright block without hitting the LLM network gateway.
🧠 Managing AI Agent Personas
The first time you run a query on an unsupported file extension, the script will automatically create the appropriate text-based agent configuration file next to code_helper.py:
architect_rules_cs.txt (Default C# Architect Rules)
architect_rules_py.txt (Default Python Best-Practice Rules)
architect_rules_sql.txt (Default Database/SQL Rules)
architect_rules.txt (Default General Fallback rules)
To alter the architectural standards of your AI assistant (e.g., forcing camelCase, demanding specific test framework mockings, or standardizing logging frameworks), simply edit these .txt files. The rules are dynamically injected into the system prompts on every single run.