CmdSmith Project Log
Guides building a CLI generator that fills blanks using RAG on PDF/TXT manuals and LLM structured outputs.
What this file does
Guides building a CLI generator that fills blanks using RAG on PDF/TXT manuals and LLM structured outputs.
When to use it
- You are prototyping a research tool that generates CLI commands from documentation
- You need a template for a FastAPI + LangChain + ChromaDB RAG pipeline
- You want a minimal workflow to ingest PDF manuals and serve a chat frontend
Assumes this stack
CmdSmith Project Log
Goal: Build a "Fill-in-the-Blank" CLI generator for researchers using RAG (Documentation) and LLMs (Structured Outputs). Stack: Python (FastAPI), LangChain (RAG), ChromaDB (Vector Store), OpenAI GPT-5.1/Local LLM, HTML/JS (Frontend).
1. Initial Setup
A. Project Folder & Virtual Environment
Never install libraries globally. We use a contained venv.
# 1. Create virtual environment
python3 -m venv venv
# 2. Activate the environment
source venv/bin/activate
B. Dependencies
Install them:
pip install -r requirements.txt
C. API Keys
Create a file named .env in the project root:
OPENAI_API_KEY=sk-api-key
2. Code Implementation
A. The Ingestion Script (ingest.py)
Purpose: Reads PDF/TXT manuals and saves them to ./vector_db.
B. The Backend (main.py)
Purpose: API that takes user input, retrieves docs, and returns structured JSON. Key Feature: Uses specialized system prompt and Strict JSON Schema.
C. The Frontend (index.html)
- Use the "Dark Mode" theme.
3. Workflow: How to Update Documentation
- Find Manual: Save the tool's manual as a PDF (e.g.,
samtools.pdf). - Place: Put it in the
docs/folder. - Alternatively, scrape command descriptions using
scrape.py. - Run Ingest:
This updates thesource venv/bin/activate python ingest.pyvector_dbfolder.
4. Usage: Running the Tool
- Open Terminal and go to project folder.
- Activate Environment:
source venv/bin/activate - Start Backend:
(Wait for "Application startup complete")python main.py - Start Frontend:
- Open
index.htmlin web browser (Chrome/Safari).
- Open
- Use:
- Start chatting
What's inside
4 sections: setup, code implementation, update workflow, usage steps. 3 code blocks, 1 env file template.
Change this for your project
- Replace
OPENAI_API_KEY=sk-api-keywith your actual API key - Replace
samtools.pdfwith your own manual filename - Replace
OpenAI GPT-5.1with your chosen LLM model
Where it goes
A standard operating procedure. Keep where the team or agent running the process will find it.
Related Documents
Comprehensive AI Assistant Tools Reference
Lists 80+ tools with MCP server associations, bulk support, parallel capability, resource impact, and execution type for AI agent workflows.
iOS Deployment Guide
Walks through setting up an iOS development environment, building a Tauri app for iOS, and publishing to the App Store or alternative channels.
How to Add Resources to Your FastMCP Server
Teaches how to add static and dynamic MCP resources to a FastMCP server, with six ready-to-copy examples for a GitHub crawler.
PCI Compliance Guide
Explains PCI DSS compliance via tokenization, lists forbidden and allowed data, and provides code examples for BigCommerce and Stripe.