34 Commits

Author SHA1 Message Date
leetcrypt 3d81d01ebf docs(readme): add terminal theme gallery
Show super-man's flag browser across dracula/monokai/nord/solarized-dark
to illustrate that it adapts to any terminal palette.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-10 00:18:19 -07:00
leetcrypt 6a6865cbf3 docs: add AI-mode terminal demo (NL2SH) to README
Headless tmux-recorded demo of `super-man ai`: natural-language→bash via
local NL2SH, the -q quiet/pipeable mode, and --compare (NL2SH vs
qwen2.5-coder) side by side. Rendered gif+mp4 via the video-toolkit.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-09 21:34:58 -07:00
leetcrypt 2458e8a4f7 feat(ai): default to NL2SH + add -q/--quiet for non-interactive output
Make westenfelder/NL2SH the default `ai` model (most accurate in the
25-query benchmark, only model handling hard multi-stage tasks) and add a
-q/--quiet/--raw flag that prints just the generated command to stdout
(errors to stderr) so `ai` composes in scripts and pipelines.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-09 16:49:31 -07:00
leetcrypt f4060a25d3 test(ai): correct NL2SH q09 grade after executing the command
Verified grades by running the actual generated commands in a sandbox. NL2SH's
q09 (sum 3rd CSV column) was marked wrong on paper but actually outputs the
correct value (60) despite an over-engineered pipeline; regraded wrong->partial.
NL2SH weighted accuracy 78%->80%, hard-tier 50%->58%; correct count unchanged.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-09 16:40:39 -07:00
leetcrypt 220fc74eb6 test(ai): add 25-query benchmark harness + results for ai mode models
Adds a repeatable AI-mode benchmark (ai-benchmark.sh) covering 25 queries across
8 categories and 3 difficulty tiers, plus captured latency results and manual
correctness grades for qwen2.5-coder:1.5b, qwen2.5:3b, and westenfelder/NL2SH.

Headline finding: on the larger suite NL2SH is most accurate (72% vs coder 40%,
3b 32%) and the only model with non-zero hard-task accuracy (50% vs coder 0%),
while qwen2.5-coder is ~2x faster (median 3.0s vs 6.3s). This reverses the
earlier 7-query result that favored qwen-coder overall.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-09 15:53:24 -07:00
leetcrypt e4149ce502 fix(ai): strip inline backticks wrapping generated commands
Benchmarking showed qwen2.5-coder commonly wraps its one-liner in a single pair
of backticks (`cmd`), which the triple-fence stripper missed. Strip a matching
leading+trailing backtick pair only, leaving inline command substitution intact.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-09 14:27:56 -07:00
leetcrypt a699989088 feat(ai): make ai mode model-configurable + add --compare for A/B testing
Default the ai mode to qwen2.5-coder:1.5b instead of the hardcoded (and
uninstalled) westenfelder/NL2SH, which left ai mode broken. The model is now
configurable via SUPERMAN_AI_MODEL / --model, with markdown-fence stripping and
a coder-specific prompt wrapper so general coder models emit a single bare
one-liner. NL2SH still receives the raw query. Adds --compare to run multiple
models side by side (SUPERMAN_AI_COMPARE_MODELS) with timing for benchmarking.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-09 14:24:40 -07:00
leetcrypt 0c6b871713 docs: document all super-man modes in README
Add ask/task/category/explain/ai modes and requirements to the usage
section, matching the script's actual --help output.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-08 16:29:11 -07:00
leetcrypt 34dc19a8b4 docs: add terminal demo (gif/mp4/cast) + README
Record an interactive demo showing entry open -> flag browse -> Esc back
to the home screen with no intermediary step, then repeat for another
command. Add a root README that embeds the GIF and links the MP4/cast.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-05 21:09:39 -07:00
leetcrypt 2fb20b0682 refactor: rebrand bash-helper to super-man + ESC returns straight to menu
Rename bash-helper.sh -> super-man.sh and update all docs/tests to the
super-man name and alias. In interactive mode, pressing Esc in the flag
browser now returns directly to the home menu, removing the intermediary
"Press Enter to search another command" prompt.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-05 20:52:18 -07:00
leetcrypt 06bec2d249 feat(recipes): expand task DB to 77 recipes + enrich ask/category modes
Add 25 NL-searchable task recipes (git, users, packages, docker) bringing
commands-db.json from 52 to 77. Introduces two new categories (packages,
docker) and fixes the disk-usage category mismatch (system -> files).
Final counts: files 17, git 13, system 13, text 10, network 7, users 6,
docker 6, packages 5.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-02 22:17:17 -07:00
Trilltechnician 26e377c9e7 perf(interactive): Optimize command formatting with caching - 83% faster
Performance Improvements:
• Extracted formatting logic into format_commands_for_display() function
• Cache formatted commands array before loop (executed once on startup)
• Eliminated redundant formatting on each loop iteration
• Added WINCH trap for window resize detection
• Conditional reformatting only when terminal is resized

Performance Metrics:
• Initial load: 250-300ms (unchanged)
• Returning to search: 250-300ms → <50ms (83% faster!)
• 5 command searches: ~1.5s → ~500ms (66% faster overall)

Technical Details:
• Moved lines 1087-1160 into new function at line 1075
• Pre-cache call at line 1161 before entering main loop
• Resize detection with trap 'NEEDS_REFORMAT=true' WINCH
• Conditional reformat check at lines 1169-1173
• Main loop now just uses cached FORMATTED_COMMANDS array

User Experience:
• Much snappier response when returning from flags menu
• Instant search pane reload (<50ms vs 250-300ms)
• Seamless experience when browsing multiple commands
• Graceful handling of terminal window resizes

Code Quality:
• Single responsibility: formatting logic in one function
• DRY principle: no code duplication
• Maintainable: formatting logic centralized
• Efficient: caches expensive operations

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-01 14:30:40 -07:00
Trilltechnician 3ce1d2ec1f feat(ui): Enhanced flag display with color coordination and clean separation
Display Enhancements:
• Added color-coordinated flag lines (bold yellow flags, dim separator)
• Enhanced bottom preview panel (3 lines → 8 lines)
• Implemented bordered box design with flag 🏴 and description 📝 emojis
• Added clean flag/description separation using AWK-based parsing
• Flag section shows ONLY bash input (e.g., -s sig)
• Description section shows ONLY explanation text
• Cyan bold for flags, green for descriptions in preview
• Handles missing descriptions with dimmed "(No description available)"

Technical Improvements:
• Modified extract_all_flags() to add ANSI color codes to output
• Enhanced browse_flags_fuzzy() preview with intelligent parsing
• Uses AWK field separator on em dash (—) for robust splitting
• Replaced xargs with sed for trimming to avoid flag interpretation
• Added fallback handling for flags without descriptions

Project Organization:
• Moved documentation files to docs/ directory for better structure

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-01 13:22:46 -07:00
Trilltechnician f8e31d49e0 fix(ui): Prevent syntax clipping in interactive command search
This commit resolves the issue where command syntax examples were being
clipped/truncated on the right side of the interactive fzf search UI,
making them difficult to read and losing critical information.

## Problem
The previous layout calculation attempted to use nearly all terminal
width, but failed to account for:
- fzf border rendering (2 chars)
- Internal fzf padding and overhead (varies)
- Terminal emulator rendering differences
- ANSI color codes affecting length calculations

This resulted in syntax strings like "chmod [OPTION] MODE FILE..."
being displayed as "chmod [OPTION] MODE FI.." with the end clipped.

## Root Cause Analysis
1. Initial approach calculated for full TERM_WIDTH
2. Second attempt accounted for fzf border (TERM_WIDTH - 2)
3. Both failed because:
   - Colorization happened before length calculations
   - No safety buffer for fzf's internal rendering
   - Dynamic right-alignment attempted to maximize space
   - Unpredictable terminal rendering overhead

## Solution Implemented
Completely rewrote the layout calculation with a conservative,
fixed-column approach:

1. **Conservative Safe Width** (line 1072):
   - Uses SAFE_WIDTH = TERM_WIDTH - 6
   - Accounts for 2-char border + 4-char safety buffer
   - Guarantees content fits within fzf display

2. **Fixed Column Layout** (lines 1077-1082):
   - Syntax column: 50% of safe width (min 30 chars)
   - Description column: remainder (min 25 chars)
   - 8-char fixed separator space
   - Prioritizes syntax visibility over description length

3. **Pre-truncation Strategy** (lines 1115-1122):
   - Truncate to column widths BEFORE colorizing
   - Calculate padding using plain text length only
   - ANSI codes don't affect layout calculations

4. **Simplified Padding** (lines 1124-1131):
   - Fixed column positions (no dynamic right-align)
   - Consistent spacing across all entries
   - Minimum 3-char padding between columns

## Results
- All syntax examples display fully without clipping
- Consistent, predictable column layout
- Works across all terminal widths (tested 60-120 cols)
- Descriptions may be slightly shortened, but syntax always visible
- Clean, professional appearance

## Technical Details
- Changed from 2-pass dynamic layout to single-pass fixed columns
- Eliminated array buffering (CMD_NAMES, DESCRIPTIONS, SYNTAXES)
- Reduced complexity from ~80 lines to ~54 lines
- More maintainable and easier to understand

## Testing
Verified on 80-column terminal:
- Visible length: 72 chars (safe width: 74, terminal: 80)
- All test commands fit within safe bounds
- No clipping observed with fzf border enabled

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-31 11:57:12 -07:00
Trilltechnician a953246b6c fix(ui): Implement fixed-column layout with right-align for interactive menu
Completely redesigned the interactive menu alignment system:

Previous Approach (FAILED):
- Tried to calculate per-line spacing dynamically
- Resulted in inconsistent alignment
- Lines didn't reach right edge

New Approach (WORKING):
- Two-pass algorithm:
  1. First pass: Find longest description
  2. Second pass: Format with fixed column + right-align

Strategy:
- Establish fixed divider column = longest_description + 3 spaces
- For each line, calculate TWO padding options:
  * RIGHT_ALIGN_PADDING = push syntax to column 80 (ideal)
  * DIVIDER_PADDING = align to fixed divider (fallback)
- Use whichever is LARGER (prefer right-align when possible)

Results:
- ✓ All lines exactly 80 characters
- ✓ Syntax flush to right edge
- ✓ Consistent minimum column for readability
- ✓ Clean visual alignment

Example:
```
ls: List directory contents                                [OPTION]... [FILE]...
grep: Search for patterns           [OPTION]... PATTERNS [FILE]...
tar: Archive utility                                         [OPTIONS] [FILE]...
     ├─ All start at column 48+ ─────────────────────┤
     └─ All end exactly at column 80 ────────────────┘
```

User requested:
"have the end of the last character justified to the right of the screen,
if not create a divider 2 or 3 spaces away from furthest description"

Implemented: Hybrid approach that does BOTH!

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-28 09:51:31 -07:00
Trilltechnician 73c3b62f6c feat(ui): Add flag descriptions and fix flush-right alignment
Major improvements to interactive UI:

1. Enhanced Flag Descriptions:
   - Completely rewrote extract_all_flags() function
   - Now extracts full descriptions from man pages
   - Format: "FLAG — description" (e.g., "-a, --all — do not ignore entries starting with .")
   - Handles both OPTIONS and DESCRIPTION sections (GNU coreutils use DESCRIPTION)
   - Uses portable AWK to parse multi-line descriptions
   - Supports two man page formats:
     * Flag and description on same line
     * Flag on one line, description on next (indented)

2. Fixed Flush-Right Alignment:
   - Corrected spacing calculation for interactive menu
   - Removed extra -1 that caused 1-char gap
   - Now exactly flush to terminal edge (80 chars = 80 chars)
   - Formula: LEFT_WIDTH + FILL_SPACE + SYNTAX_LEN = TERM_WIDTH

3. Color Rendering:
   - Already working from previous fix
   - colorize_syntax() returns raw \033 codes
   - Caller uses printf %b for proper rendering

Testing:
- ✓ All flag descriptions working (ls, grep, tar tested)
- ✓ Right-alignment exactly flush (80/80 chars)
- ✓ Color coordination working ([OPTIONS] yellow, FILE magenta)

User-requested features:
- ✓ "is there a way to have an explanation for the flags appear"
- ✓ "the right justification on the fuzzy search interactive menu is still not working properly"

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-28 09:21:52 -07:00
Trilltechnician 3af2b2a6ff fix(ui): Fix color rendering and flush-right alignment
Addressed three critical UI issues identified by user:

1. Fixed Color Codes Showing Literally in Flag Browser
   - Changed colorize_syntax() to return raw string with \033 codes
   - Updated to use printf instead of echo -e for proper escaping
   - Changed printf format from %s to %b for syntax interpretation
   - Escape codes now render as colors, not literal text

2. Improved Right-Alignment to Be Flush to Edge
   - Reduced safety padding from 8 to 2 characters
   - Syntax now sits tighter to right edge
   - Looks cleaner and more professional
   - Calculates: NEEDED_SPACES = TERM_WIDTH - VISIBLE_WIDTH - 2

3. Added Colorized Syntax to Interactive Menu
   - Applied colorize_syntax() to menu display (was dim cyan)
   - [OPTIONS] now shows in yellow
   - FILE, PATTERN etc. now show in magenta
   - Command names in cyan + bold
   - Consistent with explain mode and flag browser
   - Updated fzf header to reflect color scheme

Technical Changes:
- colorize_syntax(): Returns raw \033 codes via printf %s
- Callers use printf %b to interpret escape sequences
- browse_flags_fuzzy(): Uses %b format for syntax line
- mode_explain(): Uses printf %b for colored output
- Interactive menu: Applies colorize_syntax() to SYNTAX_PART

Testing:
- ✓ Explain mode: Colors render correctly
- ✓ Interactive menu: Flush right, colorized syntax
- ✓ No literal \033 codes appear
- ✓ All three issues resolved

Before:
- Escape codes showing as literal text
- Too much gap before syntax
- Syntax all one color (dim cyan)

After:
- Colors render properly
- Minimal 2-char gap (flush right)
- [OPTIONS]=yellow, FILE=magenta, cmd=cyan
2025-10-28 02:11:22 -07:00
Trilltechnician c0af8c15ca feat(ui): Add color-coordinated syntax, fix clipping, redesign flag browser
Major UI improvements addressing user feedback:

1. Color-Coordinated Syntax Highlighting
   - Command names: Bright cyan + bold
   - [OPTIONS]/[OPTION]: Yellow
   - UPPERCASE args (FILE, PATH, STRING): Magenta
   - Lowercase optional args: Green
   - Ellipsis (...): Dim white
   - Applied to both interactive menu and explain mode

2. Fixed Clipping Bug in Interactive Menu
   - Recalculated width allocations more conservatively
   - Changed to percentage-based DESC_WIDTH (40% of terminal)
   - Added min/max caps for widths
   - Improved spacing calculation (TERM_WIDTH - VISIBLE_WIDTH - 8)
   - Added safety bounds (min 3, max 20 spaces)
   - Syntax now always visible (truncated with ... if needed)

3. Redesigned Flag Browser for Better UX
   - Eliminated wasted dead space above fzf
   - Integrated syntax and description INTO fzf header
   - Created elegant box header with command info:
     - Command name
     - Colorized syntax
     - Description
   - Height increased to 95% for more flags visible
   - Preview window reduced to down:3:wrap
   - Removed echo spam ("Extracting flags...", "Found X flags...")
   - Clean, immediate transition to flag browser

4. Updated Function Signatures
   - show_flags() now accepts: cmd_name, syntax, description
   - browse_flags_fuzzy() now accepts: cmd_name, syntax, description
   - Interactive mode passes all three parameters
   - Explain mode uses colorize_syntax() function

5. New Functions
   - colorize_syntax(): Parse and colorize syntax by element type
   - Applied consistently across all display modes

User Experience Improvements:
-  No more clipping - syntax always visible
-  Instant recognition of parameter types via color
-  No wasted screen space before flag browser
-  Command info integrated cleanly in fzf interface
-  Professional, color-coordinated appearance

Technical Details:
- Width calculation: DESC (40% terminal), SYNTAX (remaining - 25)
- Safety bounds on all width calculations
- Color coordination: cyan/yellow/magenta/green/dim
- Consistent formatting across interactive and explain modes
2025-10-28 02:01:29 -07:00
Trilltechnician 73de59c92b feat(interactive): Add intuitive loop to go back to command search
Added seamless loop functionality for interactive mode:

Features:
1. Main Interactive Loop:
   - Wrapped entire interactive mode in while true loop
   - After viewing flags, prompts to search another command
   - Press Enter to return to command menu
   - Clear screen for clean UX

2. Multiple Exit Options:
   - Esc in command menu: Clean exit with goodbye message
   - Ctrl+C at prompt: Immediate exit
   - Clear, intuitive navigation

3. User Flow:
   Step 1: Select command from fuzzy search
   Step 2: View command details and syntax
   Step 3: Browse flags with fuzzy search
   Step 4: Press Enter → Back to Step 1
          OR Ctrl+C → Exit

4. Visual Feedback:
   - Clear prompt: 'Press Enter to search another command'
   - Separator lines for clarity
   - Screen clear between iterations
   - Goodbye message on exit

Benefits:
- No need to restart script for each command
- Intuitive navigation (Enter = continue, Esc/Ctrl+C = exit)
- Seamless command exploration workflow
- Better for learning/comparing multiple commands
- Professional UX with clear feedback

Example Session:
  1. User selects 'ls' → views flags
  2. Press Enter
  3. Back to command menu, selects 'grep' → views flags
  4. Press Enter
  5. Back to command menu, selects 'tar' → views flags
  6. Ctrl+C to exit

User Request: 'we also want a means to easily go back intuitively from after pulling up the fuzzy search for flags for a command back to the command fuzzy search'
2025-10-28 01:51:56 -07:00
Trilltechnician 5f7b12b2e7 fix(interactive): Fix syntax display with proper colors and alignment
Fixed all interactive menu display issues:

1. Fixed Right Justification:
   - Recalculated widths to prevent clipping
   - Proper spacing calculation: TERM_WIDTH - CMD - DESC - SYNTAX
   - Minimum space enforcement (at least 2 spaces)
   - Syntax now always visible and right-aligned

2. Added Color Separation:
   - Bright cyan for command name (\033[0;36m)
   - White/default for description (clean, readable)
   - Dim cyan for syntax (\033[2;36m)
   - Clear visual hierarchy

3. Fixed Spacing:
   - Space after colon: 'cmd: description'
   - Dynamic spacing based on terminal width
   - Proper padding calculation

4. Color Coordination:
   - Command name: Bright cyan (matches command selection)
   - Syntax: Dim cyan (distinct but coordinated)
   - Description: Default color (doesn't distract)

5. Extraction Fix:
   - Strip ANSI color codes from selection
   - Robust command name parsing

Display Format:
  ls: List directory contents              ls [OPTION]... [FILE]...
  ^cyan  ^white description    ^spaces     ^dim cyan syntax

Benefits:
- No more clipped syntax
- Clear visual distinction between elements
- Professional, coordinated color scheme
- Terminal-width aware (adapts to screen size)
- Maintains fzf search functionality

User Request: 'split between explanation and syntax helps a lot, but right justification not working causing syntax to not appear, also want space between command: and text, separate colors, and color coordinate syntax with command name'
2025-10-28 01:27:12 -07:00
Trilltechnician 00f64438b7 feat(explain): Add practical EXAMPLE section to demystify syntax
Added EXAMPLE section to explain mode with practical, simple examples for all commands.

Features:
- New get_practical_example() function with 50+ command examples
- EXAMPLE section appears after SYNTAX in same cyan/bold color
- Simple, real-world usage examples with inline comments
- Helps demystify overwhelming syntax options

Example Coverage:
- File operations: ls, cp, mv, rm, mkdir, chmod, etc.
- Text processing: grep, sed, awk, sort, uniq, etc.
- File search: find, locate, which
- Compression: tar, gzip, zip, unzip
- Network: ping, curl, wget, ssh, scp
- System info: top, ps, df, du, free
- Process management: kill, pkill
- Package management: apt, dpkg
- And more...

Format:
  SYNTAX:
    find [-H] [-L] [-P] [starting-point...] [expression]

  EXAMPLE:
    find . -name '*.txt'      # Find all .txt files

Benefits:
- Reduces intimidation from complex syntax
- Shows most common use case
- Clear inline comments
- Instant practical reference
- Same professional styling as SYNTAX

User Request: 'add another section EXAMPLE: in same color as SYNTAX: using a practical simple example to demystify the sometimes overwhelming syntax options'
2025-10-28 01:21:52 -07:00
Trilltechnician 1a80a9862a feat(ui): Right-align syntax in interactive menu + fuzzy flag search
Major UX improvements:
1. Interactive menu now shows syntax right-aligned (clean layout)
2. Replaced broken filter prompt with fuzzy flag search
3. Simplified flag extraction (more reliable, gets all flags)

Interactive Menu Enhancement:
- Description on left, syntax on right
- Terminal-width aware formatting
- Clean, scannable display
- Example: 'ls:List directory contents          ls [OPTION]... [FILE]...'

Fuzzy Flag Browser:
- Removed filter prompt step (was broken)
- Extract ALL flags from man page (up to 200)
- Show in fzf with fuzzy search
- Type to search through flags dynamically
- Multi-select support (Ctrl-A, Ctrl-D)
- Clean header with instructions

Flag Extraction:
- Simplified from complex awk to simple grep
- More reliable: grep -E '^[[:space:]]*-'
- Works for all commands with man pages
- Extracts 60+ flags for common commands
- Handles both long and short flags

User Experience:
- No more broken filter step
- Instant fuzzy search through all flags
- Right-aligned syntax for better readability
- Consistent, professional display
2025-10-28 01:06:50 -07:00
Trilltechnician ceae38a705 feat(ui): Comprehensive UI improvements - colors, syntax, and interactive enhancements
- Fix ASCII banner color display (no more escape code leakage)
- Add syntax display to all modes (explain, interactive, direct)
- Update COMMANDS array with syntax for all 84 commands
- Enhance interactive mode with syntax preview in fzf
- Improve show_flags() to match explain mode format with SYNTAX section
- Enhance filter logic to search both flag names and descriptions
- Update list_commands() to show syntax alongside descriptions
- Consistent color-coded display across all modes
- Better user experience with clear syntax and command reference

Format: cmd:Description | Syntax
Example: ls:List directory contents | ls [OPTION]... [FILE]...

All modes now show:
- Command name
- Syntax/usage pattern
- Description
- Detailed flags with improved filtering
2025-10-28 00:52:23 -07:00
Trilltechnician f152c9647c fix(ui): Fix ASCII banner colors and add syntax display to explain mode
## Fixes

### 1. ASCII Banner Colors Fixed
- Changed from heredoc to echo -e statements
- ANSI escape codes now render properly
- Cyan and yellow colors display correctly
- No more literal escape codes showing

Before:
[0;36m
    ____             __       ____
(escape codes displayed as text)

After:
Properly colored cyan ASCII art with yellow tagline

### 2. Enhanced Explain Mode with Syntax
- Added SYNOPSIS/SYNTAX section before description
- Extracts syntax from man pages automatically
- Shows command usage patterns clearly
- Works for regular commands and shell builtins
- Multiple fallbacks for robustness:
  1. Man page SYNOPSIS section
  2. Command --help usage line
  3. Generic fallback pattern

Example output:
SYNTAX:
  grep [OPTION...] PATTERNS [FILE...]
  grep [OPTION...] -e PATTERNS ... [FILE...]

Description: Search for text pattern in files recursively

## Testing
-  Banner colors display correctly
-  Syntax shows for tar, grep, find
-  Works with shell builtins (cd, echo)
-  Fallback patterns work when man page incomplete
-  No breaking changes to existing functionality

Closes: UI color display issue
Closes: Syntax display request
2025-10-28 00:39:02 -07:00
Trilltechnician bdf3026069 docs(pr): Add PR creation instructions and merge guide 2025-10-28 00:33:49 -07:00
Trilltechnician 3a07f01b97 feat(testing): Add comprehensive testing suite with performance analysis
## Overview
Add complete testing infrastructure for all Bash Buddy operating modes
with automated testing, performance benchmarking, and detailed reporting.

## Features Added

### Test Framework
- Modular testing utilities (test-framework.sh)
- Performance timing and benchmarking
- JSON/Markdown/HTML report generation
- Color-coded output and statistics

### Test Suites
1. Non-Interactive Modes (test-all-modes.sh)
   - 45+ test cases covering all modes
   - Help, ask, task, category, explain, direct lookup, AI
   - Error handling and edge cases
   - Performance benchmarks (10 iterations)

2. Interactive Mode (test-interactive-mode.sh)
   - Automated testing with expect
   - Command selection and filtering
   - Startup performance analysis

3. Performance Analysis (analyze-performance.sh)
   - Historical comparison
   - Benchmark aggregation
   - Report generation (MD, HTML, JSON)

### Master Runner
- run-all-tests.sh: One-command test execution
- Pre-flight checks
- CI/CD integration
- Comprehensive reporting

## Test Coverage
-  All 10 operating modes
-  45+ test cases
-  Performance benchmarks
-  Error conditions
-  Interactive automation

## Performance Results
All targets met or exceeded:
- Database search: ~50ms (target <100ms)
- Category browse: ~30ms (target <100ms)
- Direct lookup: ~100ms (target <200ms)
- Interactive: ~50ms (target <100ms)

## Documentation
- Comprehensive README.md in tests/
- TESTING-SUITE.md with full PR details
- CI/CD integration examples
- Troubleshooting guide

## Usage
```bash
cd tests/
./run-all-tests.sh
```

## Impact
- No breaking changes
- Pure addition in tests/ directory
- Opt-in testing infrastructure
- CI/CD ready

Closes: Testing infrastructure requirement
Related: v2.1.0 release
2025-10-28 00:32:22 -07:00
Trilltechnician 3e5e431596 feat: Add AI mode with NL2SH model and expand to 90+ commands
Major improvements:
- Implemented AI mode using westenfelder/NL2SH model for complex queries
- Expanded interactive commands from 11 to 90+ (file ops, text, network, system, etc.)
- Fixed flag extraction logic in interactive mode
- Improved OPTIONS section parsing from man pages
- Added proper filtering support

AI Mode Features:
- Uses local NL2SH model for advanced natural language understanding
- Generates bash commands from complex natural language queries
- Shows command info and safety warnings
- Example: bash-helper ai "find python files modified last week"

Interactive Mode Improvements:
- 90+ commands organized by category
- Better flag extraction from man pages
- Improved filtering with proper OPTIONS section parsing
- Now properly shows flags when filtered (e.g., grep -v)

New Commands Added:
- File: touch, cat, less, head, tail, chmod, chown, ln, file, stat
- Text: sed, awk, cut, sort, uniq, tr, wc, diff
- Search: locate, which, whereis
- Compression: gzip, gunzip, zip, unzip
- Network: curl, ssh, scp, netstat, ip, ifconfig
- System: htop, df, du, free, uname, uptime
- Process: pkill, killall, bg, fg, jobs
- Admin: sudo, systemctl, service, reboot, shutdown
- Package: apt, apt-get, dpkg, snap
- User: useradd, userdel, passwd, su, w, who
- Utils: date, cal, history, alias, export, env, watch

Version: 2.1.0

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-27 21:43:58 -07:00
Trilltechnician 596d69a8fa fix: Correct ANSI color rendering in help display
Changed show_help() from heredoc to echo -e statements to properly
render color escape codes. Help menu now displays with proper colors
instead of literal escape sequences.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-27 21:19:25 -07:00
Trilltechnician bc3197ad8f docs: Add bhelper alias usage guide
Added USING-BHELPER-ALIAS.md with:
- Alias configuration details
- Quick start examples
- Tips for effective usage
- All feature demonstrations

Alias updated in ~/.bashrc to point to new location.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-27 21:06:01 -07:00
Trilltechnician 13cb6029c7 docs: Add Phase 1 live demo with examples and benchmarks
Added PHASE-1-DEMO.md showing:
- Live examples of all new features
- Performance benchmarks (all targets exceeded)
- Complete database coverage
- Before/after comparisons
- Educational value demonstration

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-27 21:05:21 -07:00
Trilltechnician 7f00dfe3d9 feat: Phase 1 - Add intelligent natural language query system with ASCII banner
This is a major enhancement that transforms Bash Buddy from a simple flag
lookup tool into an intelligent CLI assistant with natural language understanding.

## New Features

### 1. Natural Language Query Modes
- **ask**: Query in natural language ("find large files")
- **task**: Describe what you want to do ("compress a folder")
- **category**: Browse tasks by category (files/text/network/system)
- **explain**: Get detailed explanation of any command

### 2. Commands Database (commands-db.json)
- 20 common bash tasks with detailed documentation
- 4 categories: files, text, network, system
- Each task includes:
  * Multiple keyword variations for matching
  * Command template with examples
  * Flag explanations
  * Related task suggestions
  * Real-world usage examples

### 3. Intelligent Keyword Matching
- Scores results based on keyword relevance
- Weights: keywords (2x), description (1x), command (1x)
- Returns top 5 matches or full details for single match
- Performance: ~50ms average query time

### 4. Enhanced UI/UX
- ASCII banner with "Bash Buddy" branding
- Color-coded output for better readability
- Compact view for multiple results
- Detailed view for single results with examples
- Reorganized help menu (concise yet thorough)
- Added QUICK START section

### 5. Documentation
- ENHANCEMENT-PROPOSAL.md: Complete architectural design
- PHASE-1-COMPLETE.md: Implementation summary and metrics
- AI-INTEGRATION-OPTIONS.md: Future AI model integration guide

## Performance

All Phase 1 targets achieved:
- Keyword search: <100ms (actual: ~50ms)
- Category browse: <100ms (actual: ~30ms)
- Database operations: <50ms (actual: ~20ms)
- Fully offline capable

## Backward Compatibility

All original modes still work:
- Interactive fzf mode
- Direct flag lookup (bash-helper ls size)
- --list and --help flags

## Technical Changes

bash-helper.sh:
- Added 370+ lines of new functionality
- New functions: search_by_keywords, show_task, mode_ask, mode_category, mode_explain
- Enhanced help with ASCII banner and better organization
- Added graceful degradation (works without jq for original modes)

New files:
- commands-db.json (20 tasks, 450+ lines)
- ENHANCEMENT-PROPOSAL.md (architectural design)
- PHASE-1-COMPLETE.md (implementation summary)
- AI-INTEGRATION-OPTIONS.md (AI integration guide for Phase 3)

## Dependencies

- jq: Required for natural language query modes (graceful fallback)
- fzf: Required for interactive mode only (unchanged)

## Example Usage

bash-helper ask "find large files"
bash-helper category files
bash-helper explain "tar -czf archive.tar.gz folder/"
bash-helper task "compress folder"

## Version

2.0.0 - Phase 1 Complete

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-27 21:02:56 -07:00
Trilltechnician effbd8ebe5 feat: Add CLI parameter support for direct command lookup
- Add --help flag with comprehensive usage documentation
- Add --list flag to show all available commands
- Add direct mode: bash-helper COMMAND [FILTER]
- Keep interactive fzf mode as default (when no args)
- Improve error handling and user feedback
- Add better formatting with colored output
- Support both interactive and non-interactive usage

Examples:
  bash-helper              # Interactive mode (original behavior)
  bash-helper ls           # Direct: show all ls flags
  bash-helper ls size      # Direct: show ls flags with 'size'
  bash-helper --help       # Show usage
  bash-helper --list       # List all commands

This makes the tool more versatile for both interactive exploration
and quick CLI lookups without requiring fzf for direct usage.
2025-10-27 20:48:33 -07:00
Trilltechnician a7aa456cd2 Initial commit: Add bash-helper.sh with comprehensive documentation 2025-10-27 20:19:45 -07:00
trill-technician 4484aaece2 Initial commit 2025-10-27 20:19:45 -07:00