X-CMD
This is $WORK’s shutdown week (we are all off the clock!), so I’m mixing up the Drop formats a bit across the week. Today’s Drop focuses on a spiffy new … I don’t even know what category to put it in … tool/toolset for leveling up your CLI experience: X-CMD.
The site has TONS of examples/videos, so I’ll call out some specific things I like about it here, and leave the rest for you to dig into.
X-CMD

X-CMD is a lightweight POSIX script framework designed for managing tools and extending classic command line functionality. It aims to provide a unified interface for using over 500 open-source tools and programming language runtimes, as well as enhancing the POSIX shell experience. It supports one-click execution of hosted scripts in POSIX-compatible shells (ash/bash/dash/zsh), allows installation of programming language runtimes (e.g., node, python, java) without root privileges, enhances POSIX shell with themes, quick path navigation, and improved shell completion, and provides interactive CLI tools for various services (e.g., GitHub, Gitee).
X-CMD AI

On top of all the above, X-CMD integrates with various AI/LLM services including OpenAI’s GPT models (aliased to @gpt and@gpt4), Google’s Gemini (aliased to @gemini), and Ollama for local models (aliased to @o). In the case of Ollama, it adds a very nice management layer which lets us view downloaded models (ls command), view available model lists (la command), run models (run command), and pull new models (pull command). What’s more, you can pipe stdout of any command to an LLM to start an interactive chat about the results. There is also robust support for other LLM/GPT taakss such as translation (tran), writing assistance (writer), local image-to-text conversion (llava), and local audio-to-text conversion (whisper). X-CMD can also access various information sources like Wikipedia, RFC documents, and TLDR pages using AI capabilities. And, it can use Jina (via jina) to generate embeddings for further AI ops.
Here is an example of the Jina functionality. It fetches last Thursday’s Drop and lets me ask questions about it with Ollama:
$ x jina r 'https://dailydrop.hrbrmstr.dev/2024/06/28/drop-489-2024-06-28-format-friday/' | @o
Question: What is this post about?
This post is about three code formatting tools: Unibeautify, Dprint, and JQfmt. The author of the blog, hrbrmstr, discusses the importance of code formatting in software development and presents these three tools as solutions to common problems.
Unibeautify is a universal interface for various code formatters and linters that supports over 20 programming languages. It allows users to configure multiple beautifiers for each language and provides a consistent configuration and execution process.
Dprint is a Rust-based, pluggable code formatter that uses WASM modules for language support. It offers fast performance and granular control over formatting rules across multiple languages.
JQfmt is a new tool specifically designed for formatting jq programs, which can be complex and challenging to read. It applies opinionated, consistent formatting rules to jq code, making it easier to maintain and understand.
The post highlights the benefits of each tool, including improved readability, maintainability, and consistency in code style.
Question: What is the reading level of the post?
Based on various readability metrics, I estimate the reading level of this post to be around a 10th-grade level (approximately 9-10 on the Flesch-Kincaid Grade Level scale).
Here are some specific metrics:
● Flesch-Kincaid Grade Level: 9.3● Gunning-Fog Index: 11.4● SMOG Readability Formula: 8.5● Coleman-Liau Index: 10.2
These metrics suggest that the post is written in a clear and concise manner, with an average sentence length of around 15-20 words. The vocabulary used is generally technical and specialized, reflecting the topic's focus on coding and software development.
However, it's worth noting that these readability metrics are not perfect and may vary depending on individual readers' backgrounds and experiences.
Question: How long will it take to read this post?
Based on my analysis, I estimate the reading time for this post to be around 7-10 minutes.
Here's a breakdown of the estimated reading time:
● Average sentence length: 15-20 words● Number of sentences: approximately 450-500 words● Reading speed: average adult reading speed is around 200-250 words per minute
Using these estimates, I calculate the total reading time as follows:
● Total words: 450-500● Reading speed: 225 words per minute (midpoint of the range)● Estimated reading time: 2.0-2.5 minutes (450-500 words / 225 words per minute)
To account for variations in reading speed and comprehension, I add a buffer to the estimated reading time:
● Total reading time: 7-10 minutes
Please note that this is an estimate, and actual reading time may vary depending on individual factors such as reading speed, familiarity with technical terms, and level of interest in the topic.
X-CMD Cyber

There is a cyber edge to X-CMD, as it has some specific tools for both CISA KEV, Shodan, OSV, and some other adjacent utilities. A KEV screenshot is in the section header.
X-CMD Enhanced Shell Commands

X-CMD provides a nice TUI layer on top of tools like ls, ps, and more. The ps output is in the section header. A super nice feature of the enhanced commands is that you can pipe them to one of the supported models and start a chat:
$ x ps | @o
>>> What process is consuming the most CPU?
Also: TIL about IntelligencePlatformComputeService!!
Based on the provided data, it appears that there are several processes consuming significant amounts of CPU resources.
To identify the process consuming the most CPU, we can sort the data by the "CPU" column and look at the top few entries. Here's a summary:
_spotlight: 0.0-0.2 CPU usage (multiple instances)These processes are likely related to Spotlight search indexing.
Arc Helper (Renderer): 0.0-0.6 CPU usage (multiple instances)These processes seem to be related to Arc, a browser or application helper process.
IntelligencePlatformComputeService: 0.1 CPU usageThis process is likely related to Apple's Intelligence Platform, which provides AI-powered features for various apps.
Based on this analysis, it appears that the _spotlight processes are consuming the most CPU resources, with some instances using up to 0.2 CPU. However, please note that these values might not be entirely accurate, as the "CPU" column only shows a rough estimate of the process's CPU usage.
To get a more accurate picture, you can use other tools like top, htop, or Activity Monitor on your Mac to monitor system processes and their resource utilization.
FIN
I heartily encourage folks to give X-CMD a go! There are many more features to explore, make sure to reference the guide for more information.
Remember, you can follow and interact with the full text of The Daily Drop’s free posts on Mastodon via @dailydrop.hrbrmstr.dev@dailydrop.hrbrmstr.dev ☮️
Leave a comment