fix: resolve CI test failure in output.py

- Fixed undefined 'tool' variable in display_history function
- Changed '[tool]' markup tag usage to proper Rich syntax
- All tests now pass (38/38 unit tests)
- Type checking passes with mypy --strict
This commit is contained in:
Auto User
2026-01-31 06:22:27 +00:00
commit 95459fb4c8
57 changed files with 9370 additions and 0 deletions

789
commands/unix.yaml Normal file
View File

@@ -0,0 +1,789 @@
version: "1.0"
description: Unix command patterns
patterns:
- name: list_files
description: List directory contents
patterns:
- list files
- list directory
- ls
- show files
template: ls -la
explanation: Lists all files including hidden ones with details.
- name: list_files_simple
description: List files simply
patterns:
- simple list
- basic ls
template: ls
explanation: Lists files in the current directory.
- name: change_directory
description: Change directory
patterns:
- change directory
- go to directory
- cd
template: cd {path}
explanation: Changes the current working directory.
- name: go_home
description: Go to home directory
patterns:
- go home
- home directory
template: cd ~
explanation: Changes to the home directory.
- name: go_previous
description: Go to previous directory
patterns:
- go back
- previous directory
template: cd -
explanation: Changes to the previous working directory.
- name: print_working_directory
description: Print working directory
patterns:
- print directory
- pwd
- current path
template: pwd
explanation: Prints the current working directory path.
- name: make_directory
description: Create a directory
patterns:
- make directory
- create folder
- mkdir
template: mkdir -p {path}
explanation: Creates a directory (and parent directories if needed).
- name: remove_file
description: Remove a file
patterns:
- remove file
- delete file
- rm
template: rm {file}
explanation: Removes a file.
- name: remove_directory
description: Remove a directory
patterns:
- remove directory
- delete folder
- rmdir
template: rm -rf {path}
explanation: Removes a directory and its contents.
- name: copy_file
description: Copy a file
patterns:
- copy file
- cp
template: cp {source} {destination}
explanation: Copies a file to the destination.
- name: copy_directory
description: Copy a directory
patterns:
- copy directory
- cp -r
template: cp -r {source} {destination}
explanation: Copies a directory recursively.
- name: move_file
description: Move or rename a file
patterns:
- move file
- rename file
- mv
template: mv {source} {destination}
explanation: Moves or renames a file or directory.
- name: view_file
description: View file contents
patterns:
- view file
- cat
- show file
template: cat {file}
explanation: Displays file contents.
- name: view_file_paged
description: View file with paging
patterns:
- less file
- more file
template: less {file}
explanation: Views file with scroll capability.
- name: head_file
description: View file head
patterns:
- head file
- first lines
template: head -n {lines} {file}
explanation: Shows the first N lines of a file.
- name: tail_file
description: View file tail
patterns:
- tail file
- last lines
template: tail -n {lines} {file}
explanation: Shows the last N lines of a file.
- name: follow_tail
description: Follow file changes
patterns:
- follow tail
- tail -f
template: tail -f {file}
explanation: Shows the last lines of a file and follows changes.
- name: search_file
description: Search for text in files
patterns:
- search text
- grep
- find text
template: grep -r "{pattern}" .
explanation: Searches for a pattern recursively in files.
- name: search_case_insensitive
description: Search case-insensitively
patterns:
- search case insensitive
- grep -i
template: grep -ri "{pattern}" .
explanation: Searches for a pattern case-insensitively.
- name: search_files_only
description: List matching files only
patterns:
- find files with text
- grep -l
template: grep -rl "{pattern}" .
explanation: Lists files containing the pattern.
- name: search_count
description: Count matching lines
patterns:
- count matches
- grep -c
template: grep -rc "{pattern}" .
explanation: Counts lines matching the pattern.
- name: find_files
description: Find files by name
patterns:
- find file
- locate file
template: find . -name "{pattern}"
explanation: Finds files by name pattern.
- name: find_files_type
description: Find files by type
patterns:
- find by type
- find directories
template: find . -type {type}
explanation: Finds files of a specific type (f=file, d=directory).
- name: find_executable
description: Find executable
patterns:
- which command
- locate executable
template: which {command}
explanation: Shows the location of a command.
- name: find_executable_all
description: Find all executables
patterns:
- whereis command
- find binary
template: whereis {command}
explanation: Shows binary, source, and manual locations.
- name: file_info
description: Show file information
patterns:
- file info
- file type
template: file {file}
explanation: Shows file type information.
- name: disk_usage
description: Show disk usage
patterns:
- disk usage
- du
template: du -sh {path}
explanation: Shows disk usage of a directory.
- name: disk_usage_all
description: Show disk usage for all
patterns:
- disk usage all
- du -h
template: du -h
explanation: Shows disk usage for all directories.
- name: disk_usage_sorted
description: Show disk usage sorted
patterns:
- du sorted
- largest directories
template: du -h | sort -rh | head -n {n}
explanation: Shows largest directories sorted by size.
- name: free_memory
description: Show memory usage
patterns:
- memory usage
- free memory
template: free -h
explanation: Shows memory and swap usage.
- name: cpu_info
description: Show CPU info
patterns:
- cpu info
- processor info
template: lscpu
explanation: Shows detailed CPU information.
- name: process_list
description: List processes
patterns:
- list processes
- show processes
- ps
template: ps aux
explanation: Lists all running processes.
- name: process_tree
description: List process tree
patterns:
- process tree
- pstree
template: pstree -p
explanation: Shows processes in a tree format.
- name: kill_process
description: Kill a process
patterns:
- kill process
- terminate process
template: kill {pid}
explanation: Sends a termination signal to a process.
- name: kill_force
description: Force kill a process
patterns:
- kill -9
- force kill
template: kill -9 {pid}
explanation: Forcefully kills a process.
- name: top_processes
description: Show top processes
patterns:
- top processes
- htop
template: htop
explanation: Shows interactive process viewer (use top if htop not available).
- name: network_status
description: Show network status
patterns:
- network status
- netstat
template: netstat -tuln
explanation: Shows listening network ports.
- name: connections
description: Show network connections
patterns:
- network connections
- ss
template: ss -tuln
explanation: Shows network socket statistics.
- name: ping_host
description: Ping a host
patterns:
- ping host
- test connectivity
template: ping -c {count} {host}
explanation: Sends packets to test connectivity.
- name: trace_route
description: Trace route to host
patterns:
- trace route
- traceroute
template: traceroute {host}
explanation: Shows the route to a host.
- name: download_file
description: Download a file
patterns:
- download file
- wget
template: wget {url}
explanation: Downloads a file from URL.
- name: download_curl
description: Download with curl
patterns:
- curl download
template: curl -O {url}
explanation: Downloads a file using curl.
- name: curl_headers
description: Get HTTP headers
patterns:
- check headers
- curl head
template: curl -I {url}
explanation: Shows HTTP response headers.
- name: ssh_connect
description: Connect via SSH
patterns:
- ssh connect
- connect to server
template: ssh {user}@{host}
explanation: Connects to a host via SSH.
- name: ssh_with_key
description: SSH with specific key
patterns:
- ssh with key
- ssh -i
template: ssh -i {key_file} {user}@{host}
explanation: Connects using a specific SSH key.
- name: scp_copy
description: Copy over SSH
patterns:
- scp copy
- secure copy
template: scp {source} {user}@{host}:{path}
explanation: Copies files over SSH.
- name: sync_files
description: Sync files with rsync
patterns:
- rsync
- sync directories
template: rsync -avz {source} {destination}
explanation: Synchronizes directories efficiently.
- name: change_permissions
description: Change file permissions
patterns:
- chmod
- change permissions
template: chmod {mode} {file}
explanation: Changes file permissions (e.g., 755, +x).
- name: change_owner
description: Change file owner
patterns:
- chown
- change owner
template: chown {user}:{group} {file}
explanation: Changes file owner and group.
- name: change_group
description: Change file group
patterns:
- change group
- chgrp
template: chgrp {group} {file}
explanation: Changes file group.
- name: compress_tar
description: Create tar archive
patterns:
- tar compress
- create tar
template: tar -czvf {archive}.tar.gz {path}
explanation: Creates a compressed tar archive.
- name: extract_tar
description: Extract tar archive
patterns:
- extract tar
- untar
template: tar -xzvf {archive}.tar.gz
explanation: Extracts a tar archive.
- name: list_tar
description: List tar contents
patterns:
- list tar
- tar -t
template: tar -tzvf {archive}.tar.gz
explanation: Lists contents of a tar archive.
- name: create_zip
description: Create zip archive
patterns:
- zip file
- create zip
template: zip -r {archive}.zip {path}
explanation: Creates a zip archive.
- name: extract_zip
description: Extract zip archive
patterns:
- unzip
- extract zip
template: unzip {archive}.zip
explanation: Extracts a zip archive.
- name: list_zip
description: List zip contents
patterns:
- list zip
- unzip -l
template: unzip -l {archive}.zip
explanation: Lists contents of a zip archive.
- name: show_date
description: Show current date
patterns:
- current date
- date
template: date
explanation: Shows current date and time.
- name: show_calendar
description: Show calendar
patterns:
- calendar
- cal
template: cal
explanation: Shows a calendar.
- name: show_calendar_year
description: Show calendar for year
patterns:
- calendar year
- cal year
template: cal -y
explanation: Shows calendar for the entire year.
- name: whoami
description: Show current user
patterns:
- current user
- who am i
template: whoami
explanation: Shows the current username.
- name: hostname
description: Show hostname
patterns:
- hostname
- machine name
template: hostname
explanation: Shows the machine hostname.
- name: uname
description: Show system info
patterns:
- system info
- uname
template: uname -a
explanation: Shows all system information.
- name: environment
description: Show environment variables
patterns:
- environment
- env
template: env
explanation: Shows all environment variables.
- name: echo_variable
description: Echo environment variable
patterns:
- echo env
- show variable
template: echo ${VAR}
explanation: Shows the value of an environment variable.
- name: set_variable
description: Set environment variable
patterns:
- export variable
- set env
template: export VAR=value
explanation: Sets an environment variable.
- name: add_path
description: Add to PATH
patterns:
- add to path
- PATH export
template: export PATH=$PATH:{path}
explanation: Adds a directory to PATH.
- name: show_man_page
description: Show manual page
patterns:
- man page
- manual
template: man {command}
explanation: Shows the manual page for a command.
- name: show_help
description: Show command help
patterns:
- command help
- --help
template: "{command} --help"
explanation: Shows help for a command.
- name: show_builtin_help
description: Show shell builtin help
patterns:
- builtin help
- help command
template: help {command}
explanation: Shows help for a shell builtin.
- name: locate_file
description: Locate files quickly
patterns:
- locate
- find quickly
template: locate {pattern}
explanation: Searches for files using a database (updatedb first if needed).
- name: updatedb
description: Update locate database
patterns:
- update locate
- updatedb
template: sudo updatedb
explanation: Updates the file database for locate.
- name: sort_file
description: Sort file contents
patterns:
- sort file
- sort lines
template: sort {file}
explanation: Sorts file contents.
- name: sort_numeric
description: Sort numerically
patterns:
- sort numbers
- sort -n
template: sort -n {file}
explanation: Sorts file contents numerically.
- name: unique_lines
description: Remove duplicate lines
patterns:
- unique
- uniq
template: sort {file} | uniq
explanation: Removes duplicate lines from sorted input.
- name: count_lines
description: Count lines
patterns:
- line count
- wc -l
template: wc -l {file}
explanation: Counts the number of lines in a file.
- name: count_words
description: Count words
patterns:
- word count
- wc
template: wc {file}
explanation: Counts lines, words, and characters in a file.
- name: word_count
description: Count occurrences
patterns:
- count occurrences
- wc -c
template: wc -c {file}
explanation: Counts characters or bytes in a file.
- name: cut_columns
description: Cut columns from file
patterns:
- cut columns
- cut fields
template: cut -d'{delimiter}' -f{fields} {file}
explanation: Extracts specific columns from a delimited file.
- name: paste_columns
description: Paste columns
patterns:
- paste columns
- merge columns
template: paste {file1} {file2}
explanation: Merges lines of files horizontally.
- name: join_files
description: Join files
patterns:
- join files
- join fields
template: join {file1} {file2}
explanation: Joins lines of two files on a common field.
- name: compare_files
description: Compare files
patterns:
- compare files
- diff
template: diff {file1} {file2}
explanation: Shows differences between two files.
- name: compare_side_by_side
description: Side by side comparison
patterns:
- side by side diff
- diff -y
template: diff -y {file1} {file2}
explanation: Shows differences side by side.
- name: patch_file
description: Apply patch
patterns:
- apply patch
- patch
template: patch -p1 < {patch_file}
explanation: Applies a patch to files.
- name: stream_editor
description: Stream editor
patterns:
- sed substitute
- sed replace
template: sed -i 's/{old}/{new}/g' {file}
explanation: Replaces text in a file using sed.
- name: awk_print
description: Process with awk
patterns:
- awk print
- awk process
template: awk '{print ${column}}' {file}
explanation: Extracts and prints specific columns.
- name: xargs
description: Build and execute commands
patterns:
- xargs
- pipe to command
template: find . -name "{pattern}" | xargs {command}
explanation: Builds and executes commands from standard input.
- name: tee_output
description: Split output
patterns:
- tee
- save and display
template: "{command} | tee {file}"
explanation: Saves output to a file while displaying it.
- name: nohup_command
description: Run command immune to hangups
patterns:
- nohup
- run in background
template: nohup {command} > {output} 2>&1 &
explanation: Runs a command immune to hangups in background.
- name: screen_create
description: Create a screen session
patterns:
- create screen
- screen new
template: screen -S {name}
explanation: Creates a new detached screen session.
- name: screen_list
description: List screen sessions
patterns:
- screen list
- screen -ls
template: screen -ls
explanation: Lists all screen sessions.
- name: screen_attach
description: Attach to screen
patterns:
- attach screen
- screen -r
template: screen -r {name}
explanation: Attaches to a screen session.
- name: tmux_create
description: Create a tmux session
patterns:
- create tmux
- tmux new
template: tmux new -s {name}
explanation: Creates a new tmux session.
- name: tmux_list
description: List tmux sessions
patterns:
- tmux list
- tmux ls
template: tmux ls
explanation: Lists all tmux sessions.
- name: tmux_attach
description: Attach to tmux
patterns:
- attach tmux
- tmux attach
template: tmux attach -t {name}
explanation: Attaches to a tmux session.
- name: alias_create
description: Create an alias
patterns:
- create alias
- alias
template: alias {name}='{command}'
explanation: Creates a shell alias.
- name: source_file
description: Source a file
patterns:
- source file
- . file
template: source {file}
explanation: Executes commands from a file in current shell.
- name: export_function
description: Export a function
patterns:
- export function
- export -f
template: export -f {function_name}
explanation: Exports a shell function to child shells.