IntelliShell Documentation

repository·main·Indexed 23 days ago

https://github.com/lasantosr/intelli-shell

IntelliShell is a command template and snippet manager that provides IntelliSense-like capabilities for terminal shells. It allows users to transform command history into a structured library of templates with dynamic variables, AI-powered assistance via LLMs (OpenAI, Anthropic, Ollama), and smart search. Key features include workspace-specific commands via .intellishell files, dynamic completions, and integration with various shells including Bash, Zsh, Fish, Nu, and PowerShell.

Tokens
33.3K
Snippets
87
Records
206
Agent score
78%

What's inside IntelliShell

  1. Overview of IntelliShell features

    main

    IntelliShell is a command template and snippet manager designed to improve terminal efficiency. It acts as an intelligent library for your command-line experience by providing features beyond standard shell history.

    Key capabilities include:

    • Command Templates: Use {{variables}} to create reusable commands that prompt for input on the fly.
    • Dynamic Completions: Define custom scripts to generate live suggestions for template variables (e.g., listing git branches).
    • AI Copilot: Connect to local or remote LLMs to generate commands from natural language or fix errors in the previous command.
    • Smart Search: Fast, keyword-based search and ranking for saved commands.
    • Organization: Categorize commands using descriptions and hashtags (e.g., #work, #maintenance).
    • Safety: Visual feedback for potentially destructive commands using tags like #destructive or regex patterns.
    • Sync & Share: Export your library to files, HTTP endpoints, or GitHub Gists.
    • Extensible Knowledge: Import command examples from tldr pages or other content via AI.
  2. Configure Dynamic Completions for variables

    main

    For variables that require real-time data (like branch names or container IDs), you can define Dynamic Completions. A completion is a shell command that runs in the background to generate a list of suggestions on the fly.

    Common use cases include:

    • Listing Git branches for git checkout {{branch}}.
    • Listing Docker containers for docker exec -it {{container}} bash.
    • Fetching Kubernetes services for kubectl logs {{service}}.
  3. Understand the difference between IntelliShell and Shell History

    main

    IntelliShell is designed to be a complementary tool to standard shell history (like ctrl+r) or tools like Atuin. While shell history is a chronological, unfiltered log of what you have done (including typos and one-off commands), IntelliShell is a curated library of what you want to do.

    Key Distinctions

    AspectShell History / AtuinIntelliShell
    Primary PurposeA chronological log of every command you executeA curated library of reusable command templates
    ContentOften cluttered with raw, one-off commands, and typosA clean, organized, and intentional set of useful commands
    Repetitive TasksStores every unique variation (e.g., ssh host1, ssh host2)Stores one template (ssh {{host}}) and remembers your past inputs for quick reuse
    Project OnboardingYou must read READMEs or other docs to find project-specific commandsJust hit ctrl+space in a new repo or devcontainer to instantly discover available tools and commands
    Command DiscoveryLimited to commands you have personally run beforeDiscover commands from your team (.intellishell files), the community (Gists), or tldr pages
    Core PhilosophyRecall: "What was that exact command I ran yesterday?"Intent: "How do I perform this common task?"
  4. Customize AI task prompts with dynamic placeholders

    main

    You can customize the system prompts for the suggest, fix, import, and completion tasks in the [ai.prompts] section. Use these dynamic placeholders to provide context to the AI:

    • ##OS_SHELL_INFO##: Details about the current operating system and shell.
    • ##WORKING_DIR##: The current working directory path and a tree-like view of its contents.
    • ##SHELL_HISTORY##: The last few commands from the shell's history (available only for the fix task).
  5. Organize and filter commands with hashtags

    main

    Any word in a command's description starting with # is treated as a searchable tag.

    To filter by hashtag:

    1. Press <kbd>Ctrl</kbd>+<kbd>Space</kbd> to open the search UI.
    2. Type # to see a list of available hashtags.
    3. Selecting a hashtag will filter the command list to only show templates containing that tag.

    Tip: Hashtag discovery is cumulative. Searching for docker #compose and then typing # again will only suggest tags that appear on commands matching both docker and #compose.

  6. How to use command templates and dynamic completions

    main

    IntelliShell allows you to transform static commands into interactive builders using two main mechanisms:

    1. Variables: Wrap parts of a command in double curly braces {{variable_name}}. When you recall this template, IntelliShell will prompt you to provide values for these variables.
    2. Dynamic Completions: You can power these templates by defining custom scripts. These scripts run to generate live, interactive suggestions for your variables (for example, a script that returns a list of active Docker containers to populate a variable).
  7. How Workspace Libraries work in IntelliShell

    main

    Workspace Libraries allow you to define commands and completions that are specific to a particular directory or repository using .intellishell files.

    Discovery Mechanism

    When you trigger a search, IntelliShell searches for a .intellishell entry in the current directory. If not found, it traverses parent directories until it reaches a .git directory or the filesystem root.

    Loading Modes

    • Single File: The file is loaded, and commands are tagged with the name of the parent directory.
    • Directory: All files inside the directory (and subdirectories) are loaded recursively. Each command is tagged with the filename (excluding extension). Hidden files are skipped.

    Behavior

    • Priority: Workspace commands are loaded into a temporary, session-only library and are given top priority in search results, appearing above personal and tldr commands.
    • Scope: Commands are only available when you are inside that workspace's directory tree.
    • Persistence: Workspace items are session-only and are not saved to your permanent database.
    • Disabling: You can temporarily disable this feature by setting the INTELLI_SKIP_WORKSPACE=1 environment variable.
  8. Use Secret Variables to protect sensitive data

    main

    To prevent sensitive information like API tokens, passwords, or comments from being saved to your suggestion history, wrap the variable in triple curly braces: {{{variable_name}}}.

    Behavior:

    • The value is used in the command exactly once.
    • The value is never saved to suggestion history.
    • If a matching environment variable exists (e.g., PASSWORD), IntelliShell will suggest using the environment variable (e.g., $PASSWORD or $env:PASSWORD) instead of the plain text value to prevent exposure.
    curl -u user:{{{password}}} https://api.example.com/data
  9. The IntelliShell Philosophy: A Library of Intents

    main

    IntelliShell shifts the command-line paradigm from manual execution to a structured 'library of intents'. Instead of typing raw commands, you build and use reusable, interactive 'recipes' (command templates). This allows you to:

    • Organize workflows: Store commands in a searchable knowledge base with descriptions and tags.
    • Automate complex steps: Create dynamic commands that fetch and inject data (like IDs) automatically.
    • Reduce friction: Use short searches or aliases instead of re-typing long, complex strings.
    • Prevent errors: Minimize typos by reusing tested templates.
  10. Accelerate onboarding with executable documentation

    main

    IntelliShell facilitates faster onboarding by providing instant command discovery and executable documentation:

    • Instant Discovery: By including a .intellishell file in the repository, new developers can press ctrl+space to immediately view all essential project commands without searching through README files.
    • Executable Documentation: Instead of static text, IntelliShell provides ready-to-run commands that include descriptions and placeholders for arguments, acting as living documentation for project setup, builds, and deployments.
  11. Configure Destructive Command Warnings

    main

    IntelliShell identifies and visually highlights potentially dangerous commands (e.g., using red warning styles) to prevent accidental execution. This is handled through two methods:

    1. Tag-Based Detection: Explicitly tagging a command with #destructive will always flag it.
    2. Config-Based Regex Detection: You can define custom regular expression patterns in your configuration file under the [destructive].patterns section to catch other dangerous commands.