askcii 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/CLAUDE.md +131 -0
- data/Gemfile.lock +7 -3
- data/README.md +348 -109
- data/Rakefile +19 -3
- data/askcii.gemspec +4 -2
- data/completions/README.md +64 -0
- data/completions/askcii.bash +29 -0
- data/completions/askcii.zsh +27 -0
- data/lib/askcii/application.rb +80 -31
- data/lib/askcii/chat_factory.rb +80 -0
- data/lib/askcii/chat_session.rb +71 -44
- data/lib/askcii/cli.rb +49 -3
- data/lib/askcii/commands/base_command.rb +45 -0
- data/lib/askcii/commands/chat_command.rb +56 -0
- data/lib/askcii/commands/clear_history_command.rb +31 -0
- data/lib/askcii/commands/configure_command.rb +17 -0
- data/lib/askcii/commands/help_command.rb +52 -0
- data/lib/askcii/commands/history_command.rb +46 -0
- data/lib/askcii/commands/last_response_command.rb +31 -0
- data/lib/askcii/commands/list_sessions_command.rb +36 -0
- data/lib/askcii/config_validator.rb +90 -0
- data/lib/askcii/configuration_manager.rb +166 -54
- data/lib/askcii/errors.rb +15 -0
- data/lib/askcii/models/chat.rb +6 -3
- data/lib/askcii/models/config.rb +12 -4
- data/lib/askcii/provider_config.rb +116 -0
- data/lib/askcii/version.rb +1 -1
- data/lib/askcii.rb +72 -34
- metadata +48 -4
data/README.md
CHANGED
|
@@ -1,92 +1,249 @@
|
|
|
1
1
|
# Askcii
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Bring the power of Large Language Models to your command line—the Unix way.**
|
|
4
|
+
|
|
5
|
+
Askcii is a terminal-native CLI tool that connects you to multiple LLM providers (OpenAI, Anthropic, Gemini, DeepSeek, OpenRouter, and Ollama) through a simple, composable interface. It's designed to integrate seamlessly into your existing Unix workflows, treating LLMs as just another filter in your pipeline.
|
|
6
|
+
|
|
7
|
+
## Philosophy: Why CLI, Not TUI?
|
|
8
|
+
|
|
9
|
+
In the Unix tradition, the most powerful tools are those that **compose**. They read from standard input, write to standard output, and can be chained together with pipes to create sophisticated workflows. Askcii embraces this philosophy completely.
|
|
10
|
+
|
|
11
|
+
Unlike interactive TUI (Text User Interface) applications that take over your terminal with full-screen interfaces, Askcii is a **single-purpose filter**: it takes text in, sends it to an LLM, and streams the response back out. This simple design makes it infinitely more versatile.
|
|
12
|
+
|
|
13
|
+
**What this means in practice:**
|
|
14
|
+
|
|
15
|
+
- **Pipeable**: Chain it with `grep`, `awk`, `sed`, `jq`, and any other Unix tool
|
|
16
|
+
- **Scriptable**: Use it in shell scripts, cron jobs, and automation workflows
|
|
17
|
+
- **Composable**: Combine it with your existing toolchain without context switching
|
|
18
|
+
- **Redirectable**: Save outputs to files, pipe to other commands, integrate into larger systems
|
|
19
|
+
- **Session-aware**: Maintain conversation context across invocations when needed
|
|
20
|
+
- **Privacy-first**: Run in private mode or use local models via Ollama for sensitive data
|
|
21
|
+
|
|
22
|
+
Askcii doesn't try to be a chat application. It's a **Unix power tool** that puts LLM capabilities directly into your pipeline, where they belong.
|
|
4
23
|
|
|
5
24
|
## Installation
|
|
6
25
|
|
|
7
|
-
|
|
26
|
+
```bash
|
|
27
|
+
gem install askcii
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Or add to your Gemfile:
|
|
8
31
|
|
|
9
32
|
```ruby
|
|
10
33
|
gem 'askcii'
|
|
11
34
|
```
|
|
12
35
|
|
|
13
|
-
|
|
36
|
+
## Quick Start
|
|
14
37
|
|
|
15
|
-
|
|
38
|
+
```bash
|
|
39
|
+
# Simple prompt
|
|
40
|
+
askcii 'Explain recursive functions in one sentence'
|
|
41
|
+
|
|
42
|
+
# Pipe input from other commands
|
|
43
|
+
git diff | askcii 'Review this code change'
|
|
16
44
|
|
|
17
|
-
|
|
45
|
+
# Chain with other tools
|
|
46
|
+
curl -s https://api.github.com/repos/ruby/ruby | askcii 'Summarize this repo' | tee summary.txt
|
|
18
47
|
|
|
19
|
-
|
|
48
|
+
# Private session (no history)
|
|
49
|
+
askcii -p 'What is my IP address showing?'
|
|
50
|
+
```
|
|
20
51
|
|
|
21
52
|
## Usage
|
|
22
53
|
|
|
23
|
-
### Basic
|
|
54
|
+
### Basic Patterns
|
|
24
55
|
|
|
25
56
|
```bash
|
|
26
|
-
#
|
|
57
|
+
# Direct prompt
|
|
27
58
|
askcii 'Your prompt here'
|
|
28
59
|
|
|
29
|
-
#
|
|
30
|
-
echo '
|
|
60
|
+
# Standard input from pipe
|
|
61
|
+
echo 'Context text' | askcii 'Analyze this'
|
|
31
62
|
|
|
32
|
-
#
|
|
63
|
+
# Read from file
|
|
33
64
|
askcii 'Summarize this document' < document.txt
|
|
34
65
|
|
|
35
|
-
#
|
|
36
|
-
askcii
|
|
66
|
+
# Redirect output to file
|
|
67
|
+
askcii 'Write a bash script to backup /home' > backup.sh
|
|
37
68
|
|
|
38
|
-
#
|
|
39
|
-
askcii
|
|
69
|
+
# Chain multiple commands
|
|
70
|
+
cat error.log | grep ERROR | askcii 'What are the common patterns?' | less
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Command-Line Options
|
|
40
74
|
|
|
41
|
-
# Use a specific configuration
|
|
42
|
-
askcii -m 2 'Hello using configuration 2'
|
|
43
75
|
```
|
|
76
|
+
Usage: askcii [options] 'Your prompt here'
|
|
44
77
|
|
|
45
|
-
|
|
78
|
+
Options:
|
|
79
|
+
-p, --private Private session (no conversation history saved)
|
|
80
|
+
-r, --last-response Retrieve and output the last assistant response
|
|
81
|
+
-c, --configure Launch configuration management interface
|
|
82
|
+
-m, --model ID Use specific configuration by ID number
|
|
83
|
+
-h, --help Show this help message
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Real-World Examples
|
|
87
|
+
|
|
88
|
+
### Code Analysis & Development
|
|
46
89
|
|
|
47
90
|
```bash
|
|
48
|
-
#
|
|
49
|
-
|
|
91
|
+
# Code review with detailed feedback
|
|
92
|
+
git diff main..feature-branch | askcii 'Review these changes. Focus on security and performance.'
|
|
50
93
|
|
|
51
|
-
#
|
|
52
|
-
|
|
94
|
+
# Explain unfamiliar code
|
|
95
|
+
cat legacy_module.rb | askcii 'Explain what this code does and identify potential issues'
|
|
96
|
+
|
|
97
|
+
# Generate unit tests
|
|
98
|
+
askcii 'Write RSpec tests for a User model with email validation' > spec/user_spec.rb
|
|
99
|
+
|
|
100
|
+
# Debug assistance
|
|
101
|
+
tail -50 production.log | grep ERROR | askcii 'What are the root causes of these errors?'
|
|
102
|
+
|
|
103
|
+
# Refactoring suggestions
|
|
104
|
+
cat messy_controller.rb | askcii 'Suggest refactoring to improve this code'
|
|
105
|
+
|
|
106
|
+
# Documentation generation
|
|
107
|
+
ls -R lib/ | askcii 'Create a project structure overview' > STRUCTURE.md
|
|
53
108
|
```
|
|
54
109
|
|
|
55
|
-
###
|
|
110
|
+
### Data Processing & Analysis
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
# CSV to JSON conversion
|
|
114
|
+
cat users.csv | askcii 'Convert this CSV to JSON array format' > users.json
|
|
115
|
+
|
|
116
|
+
# Log analysis and summarization
|
|
117
|
+
tail -1000 /var/log/nginx/access.log | askcii 'Summarize traffic patterns and anomalies'
|
|
118
|
+
|
|
119
|
+
# Data extraction from unstructured text
|
|
120
|
+
curl -s https://example.com/article | askcii 'Extract all email addresses and URLs as a list'
|
|
121
|
+
|
|
122
|
+
# SQL query generation
|
|
123
|
+
askcii 'Write a PostgreSQL query to find duplicate users by email' >> queries.sql
|
|
56
124
|
|
|
125
|
+
# API response analysis
|
|
126
|
+
curl -s https://api.service.com/status | jq . | askcii 'Is this API healthy? Explain the metrics.'
|
|
57
127
|
```
|
|
58
|
-
Usage: askcii [options] 'Your prompt here'
|
|
59
128
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
129
|
+
### System Administration
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
# Server health check summary
|
|
133
|
+
df -h && free -h && uptime | askcii 'Assess system health and recommend actions'
|
|
134
|
+
|
|
135
|
+
# Parse and explain complex configs
|
|
136
|
+
cat /etc/nginx/nginx.conf | askcii 'Explain this configuration and suggest optimizations'
|
|
137
|
+
|
|
138
|
+
# Security audit
|
|
139
|
+
find . -name "*.sh" -exec cat {} \; | askcii 'Review these shell scripts for security issues'
|
|
140
|
+
|
|
141
|
+
# Quick command help
|
|
142
|
+
askcii 'Show me tar command examples for incremental backups'
|
|
143
|
+
|
|
144
|
+
# Incident analysis
|
|
145
|
+
journalctl --since "1 hour ago" | askcii 'Identify any critical system events'
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Documentation & Writing
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
# Generate README sections
|
|
152
|
+
askcii 'Write installation instructions for a Ruby gem' >> README.md
|
|
153
|
+
|
|
154
|
+
# Meeting notes to action items
|
|
155
|
+
cat meeting_transcript.txt | askcii 'Extract action items with owners as markdown checklist'
|
|
156
|
+
|
|
157
|
+
# Explain technical concepts
|
|
158
|
+
askcii 'Explain OAuth2 flow in simple terms' > oauth_explainer.md
|
|
159
|
+
|
|
160
|
+
# Create Git commit messages
|
|
161
|
+
git diff --staged | askcii 'Write a conventional commit message' | pbcopy
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Session-Based Conversations
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
# Named session for ongoing work
|
|
168
|
+
export ASKCII_SESSION="database-migration"
|
|
169
|
+
askcii 'I need to migrate from MySQL to PostgreSQL'
|
|
170
|
+
askcii 'What about handling JSON columns?' # Remembers context
|
|
171
|
+
askcii 'Show migration script for users table' > migrate_users.sql
|
|
172
|
+
|
|
173
|
+
# Project-specific session
|
|
174
|
+
ASKCII_SESSION="feature-auth" askcii 'How should I implement 2FA?'
|
|
175
|
+
ASKCII_SESSION="feature-auth" askcii 'Show me the code for TOTP generation'
|
|
176
|
+
|
|
177
|
+
# Retrieve last response (useful when output scrolled away)
|
|
178
|
+
askcii -r | less
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Multi-Provider Workflows
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
# Use Claude for creative content
|
|
185
|
+
askcii -m 1 'Write a technical blog post intro about WebAssembly' > blog_draft.md
|
|
186
|
+
|
|
187
|
+
# Use GPT-4 for code generation
|
|
188
|
+
askcii -m 2 'Create a Python class for rate limiting' > rate_limiter.py
|
|
189
|
+
|
|
190
|
+
# Use local Ollama for private/sensitive data
|
|
191
|
+
cat proprietary_data.txt | askcii -m 3 -p 'Analyze this confidential report'
|
|
192
|
+
|
|
193
|
+
# Use DeepSeek for cost-effective tasks
|
|
194
|
+
find . -name "*.rb" | xargs wc -l | askcii -m 4 'Summarize codebase statistics'
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Advanced Compositions
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
# Multi-stage pipeline
|
|
201
|
+
cat research_papers.txt | \
|
|
202
|
+
askcii 'Extract key findings' | \
|
|
203
|
+
askcii 'Group by topic' | \
|
|
204
|
+
askcii 'Create a bibliography' > bibliography.md
|
|
205
|
+
|
|
206
|
+
# Watch and analyze in real-time
|
|
207
|
+
tail -f app.log | grep --line-buffered ERROR | while read line; do
|
|
208
|
+
echo "$line" | askcii -p 'Explain this error briefly'
|
|
209
|
+
done
|
|
210
|
+
|
|
211
|
+
# Batch processing with parallel
|
|
212
|
+
find . -name "*.java" | parallel -j4 "cat {} | askcii 'Rate code quality 1-10' | echo {}: "
|
|
213
|
+
|
|
214
|
+
# Interactive script integration
|
|
215
|
+
#!/bin/bash
|
|
216
|
+
context=$(cat context.txt)
|
|
217
|
+
while true; do
|
|
218
|
+
read -p "Question: " question
|
|
219
|
+
echo "$context" | askcii "$question"
|
|
220
|
+
done
|
|
66
221
|
```
|
|
67
222
|
|
|
68
223
|
## Configuration Management
|
|
69
224
|
|
|
70
|
-
Askcii supports
|
|
225
|
+
Askcii supports multiple provider configurations, allowing you to switch between different LLMs based on your needs—cost, privacy, capability, or speed.
|
|
71
226
|
|
|
72
|
-
### Interactive Configuration
|
|
227
|
+
### Interactive Configuration Setup
|
|
73
228
|
|
|
74
|
-
|
|
229
|
+
Launch the configuration manager:
|
|
75
230
|
|
|
76
231
|
```bash
|
|
77
232
|
askcii -c
|
|
78
233
|
```
|
|
79
234
|
|
|
80
|
-
|
|
235
|
+
You'll see an interface like:
|
|
81
236
|
|
|
82
237
|
```
|
|
83
238
|
Configuration Management
|
|
84
239
|
=======================
|
|
85
240
|
Current configurations:
|
|
86
|
-
1. GPT-4 [openai] (default)
|
|
87
|
-
2. Claude Sonnet [anthropic]
|
|
88
|
-
3. Gemini
|
|
89
|
-
4.
|
|
241
|
+
1. GPT-4 Turbo [openai] (default)
|
|
242
|
+
2. Claude 3.5 Sonnet [anthropic]
|
|
243
|
+
3. Gemini 2.0 Flash [gemini]
|
|
244
|
+
4. DeepSeek V3 [deepseek]
|
|
245
|
+
5. Mixtral [openrouter]
|
|
246
|
+
6. Llama 3.2 [ollama]
|
|
90
247
|
|
|
91
248
|
Options:
|
|
92
249
|
1. Add new configuration
|
|
@@ -97,127 +254,209 @@ Options:
|
|
|
97
254
|
|
|
98
255
|
### Supported Providers
|
|
99
256
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
257
|
+
| Provider | Use Case | API Key Required |
|
|
258
|
+
|----------|----------|------------------|
|
|
259
|
+
| **OpenAI** | GPT models (GPT-4, GPT-4 Turbo, GPT-3.5) | Yes |
|
|
260
|
+
| **Anthropic** | Claude models (Opus, Sonnet, Haiku) | Yes |
|
|
261
|
+
| **Gemini** | Google's Gemini models | Yes |
|
|
262
|
+
| **DeepSeek** | Cost-effective DeepSeek models | Yes |
|
|
263
|
+
| **OpenRouter** | Access 100+ models through one API | Yes |
|
|
264
|
+
| **Ollama** | Local models (Llama, Mistral, etc.) | No |
|
|
106
265
|
|
|
107
|
-
### Adding
|
|
266
|
+
### Adding Configurations
|
|
108
267
|
|
|
109
|
-
When
|
|
268
|
+
When you add a new configuration, you provide:
|
|
110
269
|
|
|
111
|
-
1. **
|
|
112
|
-
2. **Provider
|
|
113
|
-
3. **API
|
|
114
|
-
4. **
|
|
115
|
-
5. **Model ID
|
|
270
|
+
1. **Name**: Friendly identifier (e.g., "GPT-4 for Code")
|
|
271
|
+
2. **Provider**: Choose from the supported list
|
|
272
|
+
3. **API Key**: Your provider API key (except Ollama)
|
|
273
|
+
4. **Endpoint**: API endpoint (defaults provided)
|
|
274
|
+
5. **Model ID**: Specific model identifier
|
|
116
275
|
|
|
117
|
-
Example
|
|
276
|
+
**Example: Adding OpenAI**
|
|
118
277
|
```
|
|
119
|
-
|
|
120
|
-
Provider (
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
278
|
+
Name: GPT-4 Turbo
|
|
279
|
+
Provider: 1 (OpenAI)
|
|
280
|
+
API Key: sk-proj-xxxxxxxxxxxxx
|
|
281
|
+
Endpoint: [leave blank for default]
|
|
282
|
+
Model ID: gpt-4-turbo-preview
|
|
124
283
|
```
|
|
125
284
|
|
|
126
|
-
Example
|
|
285
|
+
**Example: Adding Ollama (Local)**
|
|
127
286
|
```
|
|
128
|
-
|
|
129
|
-
Provider (
|
|
130
|
-
|
|
131
|
-
|
|
287
|
+
Name: Local Llama
|
|
288
|
+
Provider: 6 (Ollama)
|
|
289
|
+
Endpoint: http://localhost:11434/v1
|
|
290
|
+
Model ID: llama3.2:latest
|
|
132
291
|
```
|
|
133
292
|
|
|
134
293
|
### Using Configurations
|
|
135
294
|
|
|
136
295
|
```bash
|
|
137
|
-
# Use
|
|
296
|
+
# Use default configuration
|
|
138
297
|
askcii 'Hello world'
|
|
139
298
|
|
|
140
|
-
# Use
|
|
141
|
-
askcii -m 2 '
|
|
299
|
+
# Use specific configuration by ID
|
|
300
|
+
askcii -m 2 'Use Claude for this'
|
|
142
301
|
|
|
143
|
-
#
|
|
144
|
-
askcii -c
|
|
302
|
+
# Switch default in config manager
|
|
303
|
+
askcii -c # Then select "Set default configuration"
|
|
145
304
|
```
|
|
146
305
|
|
|
147
|
-
### Configuration Storage
|
|
148
|
-
|
|
149
|
-
Configuration settings are stored in a SQLite database located at `~/.local/share/askcii/askcii.db`.
|
|
150
|
-
|
|
151
306
|
### Environment Variable Fallback
|
|
152
307
|
|
|
153
|
-
|
|
308
|
+
For quick one-offs or CI/CD environments, use environment variables:
|
|
154
309
|
|
|
155
310
|
```bash
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
311
|
+
# Quick override
|
|
312
|
+
ASKCII_API_KEY="sk-xxx" ASKCII_MODEL_ID="gpt-4" askcii 'Quick question'
|
|
313
|
+
|
|
314
|
+
# In scripts
|
|
315
|
+
export ASKCII_API_KEY="your_key"
|
|
316
|
+
export ASKCII_API_ENDPOINT="https://api.openai.com/v1"
|
|
317
|
+
export ASKCII_MODEL_ID="gpt-3.5-turbo"
|
|
318
|
+
askcii 'Automated query'
|
|
159
319
|
```
|
|
160
320
|
|
|
161
|
-
##
|
|
321
|
+
## Session Management
|
|
322
|
+
|
|
323
|
+
Askcii maintains conversation context across invocations, but you control when and how.
|
|
162
324
|
|
|
163
|
-
###
|
|
325
|
+
### Session Contexts
|
|
326
|
+
|
|
327
|
+
Sessions are identified by the `ASKCII_SESSION` environment variable:
|
|
164
328
|
|
|
165
329
|
```bash
|
|
166
|
-
#
|
|
167
|
-
|
|
330
|
+
# Random session per terminal session (recommended)
|
|
331
|
+
export ASKCII_SESSION=$(openssl rand -hex 16)
|
|
168
332
|
|
|
169
|
-
#
|
|
170
|
-
|
|
333
|
+
# Named session for a specific project
|
|
334
|
+
export ASKCII_SESSION="refactoring-auth-module"
|
|
335
|
+
askcii 'What patterns should I use for the auth module?'
|
|
336
|
+
askcii 'Show code for the JWT validator' # Remembers previous context
|
|
171
337
|
|
|
172
|
-
#
|
|
173
|
-
askcii '
|
|
338
|
+
# One-off session (no context retention)
|
|
339
|
+
askcii 'Standalone question' # Creates random session ID
|
|
174
340
|
|
|
175
|
-
#
|
|
176
|
-
askcii '
|
|
341
|
+
# Private mode (no database storage at all)
|
|
342
|
+
askcii -p 'What is 2+2?' # No session, no history
|
|
343
|
+
```
|
|
177
344
|
|
|
178
|
-
|
|
179
|
-
|
|
345
|
+
### Retrieving Responses
|
|
346
|
+
|
|
347
|
+
```bash
|
|
348
|
+
# Get last response from current session
|
|
349
|
+
askcii -r
|
|
350
|
+
|
|
351
|
+
# Useful in scripts
|
|
352
|
+
last_response=$(askcii -r)
|
|
353
|
+
echo "$last_response" | process_further.sh
|
|
354
|
+
|
|
355
|
+
# Copy to clipboard
|
|
356
|
+
askcii -r | pbcopy # macOS
|
|
357
|
+
askcii -r | xclip -selection clipboard # Linux
|
|
180
358
|
```
|
|
181
359
|
|
|
182
|
-
###
|
|
360
|
+
### Privacy Considerations
|
|
183
361
|
|
|
184
362
|
```bash
|
|
185
|
-
#
|
|
186
|
-
askcii -
|
|
363
|
+
# Private mode: no storage, no history
|
|
364
|
+
askcii -p 'Analyze this sensitive data' < confidential.txt
|
|
187
365
|
|
|
188
|
-
# Use
|
|
189
|
-
askcii -m
|
|
366
|
+
# Use local Ollama for complete privacy
|
|
367
|
+
askcii -m 6 'Process private information' < private.txt
|
|
190
368
|
|
|
191
|
-
#
|
|
192
|
-
|
|
369
|
+
# Session isolation
|
|
370
|
+
ASKCII_SESSION="temp-$(date +%s)" askcii 'Temporary context'
|
|
193
371
|
```
|
|
194
372
|
|
|
195
|
-
##
|
|
373
|
+
## Data Storage
|
|
196
374
|
|
|
197
|
-
|
|
375
|
+
- **Database**: `~/.local/share/askcii/askcii.db` (SQLite)
|
|
376
|
+
- **Stored**: Conversations, messages, configurations
|
|
377
|
+
- **Not stored**: Private mode sessions (`-p` flag)
|
|
198
378
|
|
|
199
|
-
|
|
200
|
-
|
|
379
|
+
## Integration Examples
|
|
380
|
+
|
|
381
|
+
### Git Hooks
|
|
201
382
|
|
|
202
383
|
```bash
|
|
203
|
-
#
|
|
204
|
-
|
|
205
|
-
askcii '
|
|
206
|
-
|
|
384
|
+
# .git/hooks/pre-commit
|
|
385
|
+
#!/bin/bash
|
|
386
|
+
git diff --cached | askcii -p 'Any obvious issues with this commit?' | tee /dev/tty
|
|
387
|
+
read -p "Proceed with commit? [y/N] " -n 1 -r
|
|
388
|
+
echo
|
|
389
|
+
[[ $REPLY =~ ^[Yy]$ ]] || exit 1
|
|
390
|
+
```
|
|
207
391
|
|
|
208
|
-
|
|
209
|
-
askcii -p 'What is the weather like?'
|
|
392
|
+
### Vim Integration
|
|
210
393
|
|
|
211
|
-
|
|
212
|
-
|
|
394
|
+
```vim
|
|
395
|
+
" In ~/.vimrc - send selection to askcii
|
|
396
|
+
vnoremap <leader>a :w !askcii 'Improve this code'<CR>
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
### Shell Aliases
|
|
400
|
+
|
|
401
|
+
```bash
|
|
402
|
+
# ~/.bashrc or ~/.zshrc
|
|
403
|
+
alias explain='askcii "Explain this command:"'
|
|
404
|
+
alias review='git diff | askcii "Review this code:"'
|
|
405
|
+
alias commit-msg='git diff --staged | askcii -p "Write a commit message:" | head -1'
|
|
406
|
+
alias tldr='askcii "Summarize in 3 bullets:"'
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
### Makefiles
|
|
410
|
+
|
|
411
|
+
```makefile
|
|
412
|
+
.PHONY: analyze
|
|
413
|
+
analyze:
|
|
414
|
+
@find src/ -name "*.rb" -exec cat {} \; | askcii 'Code quality report' > analysis.txt
|
|
415
|
+
@echo "Analysis saved to analysis.txt"
|
|
213
416
|
```
|
|
214
417
|
|
|
215
418
|
## Development
|
|
216
419
|
|
|
217
|
-
|
|
420
|
+
```bash
|
|
421
|
+
# Setup
|
|
422
|
+
git clone https://github.com/yourusername/askcii.git
|
|
423
|
+
cd askcii
|
|
424
|
+
bin/setup
|
|
425
|
+
|
|
426
|
+
# Run locally
|
|
427
|
+
bin/askcii 'Test prompt'
|
|
428
|
+
|
|
429
|
+
# Run tests
|
|
430
|
+
rake test
|
|
218
431
|
|
|
219
|
-
|
|
432
|
+
# Interactive console
|
|
433
|
+
bin/console
|
|
434
|
+
|
|
435
|
+
# Build and install locally
|
|
436
|
+
bundle exec rake build
|
|
437
|
+
bundle exec rake install
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
## Why Askcii?
|
|
441
|
+
|
|
442
|
+
**Unix Philosophy**: Do one thing well. Askcii is a filter, not an application.
|
|
443
|
+
|
|
444
|
+
**Provider Agnostic**: Switch between OpenAI, Anthropic, local models—same interface.
|
|
445
|
+
|
|
446
|
+
**Session Awareness**: Maintain context when needed, forget when you don't.
|
|
447
|
+
|
|
448
|
+
**Privacy First**: Private mode and local model support for sensitive workflows.
|
|
449
|
+
|
|
450
|
+
**Scriptable**: Integrates into automation, cron jobs, CI/CD pipelines.
|
|
451
|
+
|
|
452
|
+
**Composable**: Works with every other Unix tool you already know.
|
|
453
|
+
|
|
454
|
+
**Terminal Native**: No context switching, no browser tabs, no GUI overhead.
|
|
220
455
|
|
|
221
456
|
## License
|
|
222
457
|
|
|
223
|
-
|
|
458
|
+
MIT License - See [LICENSE](https://opensource.org/licenses/MIT)
|
|
459
|
+
|
|
460
|
+
---
|
|
461
|
+
|
|
462
|
+
**Askcii**: Because the best interface is the one you're already using.
|
data/Rakefile
CHANGED
|
@@ -1,8 +1,24 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'bundler/gem_tasks'
|
|
4
|
-
require '
|
|
4
|
+
require 'rake/testtask'
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
Rake::TestTask.new(:test) do |t|
|
|
7
|
+
t.libs << 'test'
|
|
8
|
+
t.libs << 'lib'
|
|
9
|
+
t.test_files = FileList['test/**/*_test.rb']
|
|
10
|
+
end
|
|
7
11
|
|
|
8
|
-
|
|
12
|
+
Rake::TestTask.new(:comprehensive) do |t|
|
|
13
|
+
t.libs << 'test'
|
|
14
|
+
t.libs << 'lib'
|
|
15
|
+
t.test_files = FileList['test/comprehensive_test.rb']
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
Rake::TestTask.new(:simple) do |t|
|
|
19
|
+
t.libs << 'test'
|
|
20
|
+
t.libs << 'lib'
|
|
21
|
+
t.test_files = FileList['test/simple_test.rb']
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
task default: :comprehensive
|
data/askcii.gemspec
CHANGED
|
@@ -6,7 +6,7 @@ Gem::Specification.new do |spec|
|
|
|
6
6
|
spec.name = 'askcii'
|
|
7
7
|
spec.version = Askcii::VERSION
|
|
8
8
|
spec.authors = ['Roel Bondoc']
|
|
9
|
-
spec.email = ['
|
|
9
|
+
spec.email = ['rsbondoc@gmail.com']
|
|
10
10
|
|
|
11
11
|
spec.summary = 'Command line application for LLM interactions'
|
|
12
12
|
spec.description = 'A terminal-friendly interface for interacting with LLM models'
|
|
@@ -27,9 +27,11 @@ Gem::Specification.new do |spec|
|
|
|
27
27
|
spec.require_paths = ['lib']
|
|
28
28
|
|
|
29
29
|
spec.add_dependency 'amalgalite', '~> 1.9'
|
|
30
|
-
spec.add_dependency 'ruby_llm', '1.
|
|
30
|
+
spec.add_dependency 'ruby_llm', '1.5.1'
|
|
31
31
|
spec.add_dependency 'sequel', '~> 5.92'
|
|
32
32
|
|
|
33
|
+
spec.add_development_dependency 'csv', '~> 3.0'
|
|
33
34
|
spec.add_development_dependency 'minitest', '~> 5.25'
|
|
35
|
+
spec.add_development_dependency 'ostruct', '~> 0.6'
|
|
34
36
|
spec.add_development_dependency 'rake', '~> 13.0'
|
|
35
37
|
end
|