<?xml version="1.0" encoding="utf-8"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Npm · QuickRef</title><link>https://qref.eknath.dev/tags/npm/</link><description>Npm updates from QuickRef</description><language>en-us</language><atom:link href="https://qref.eknath.dev/tags/npm/index.xml" rel="self" type="application/rss+xml"/><lastBuildDate>Mon, 18 Aug 2025 00:00:00 +0000</lastBuildDate><item><title>Gemini CLI</title><link>https://qref.eknath.dev/ai/gemini/</link><guid isPermaLink="true">https://qref.eknath.dev/ai/gemini/</guid><pubDate>Mon, 18 Aug 2025 00:00:00 +0000</pubDate><category>gemini</category><category>cli</category><category>ai</category><category>google</category><category>npm</category><description>A quick reference for installing and using the official Google Gemini CLI to interact with AI models from your terminal.</description><content:encoded><![CDATA[<h2 id="overview">Overview</h2>
<p><code>@google/gemini-cli</code> is the official, open-source command-line interface (CLI) for Gemini, developed by Google. It brings the power of Gemini models to your terminal, allowing you to ask questions, understand and generate code, and integrate AI into your development workflows.</p>
<h2 id="installation">Installation</h2>
<p>You must have Node.js (version 20 or higher) and npm installed.</p>
<p>You can either run the CLI without installation using <code>npx</code> or install it globally for regular use.</p>
<p><strong>Run with NPX (no install):</strong></p>
<div class="highlight"><pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>npx https://github.com/google-gemini/gemini-cli
</span></span></code></pre></div><p><strong>Global Installation:</strong></p>
<div class="highlight"><pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>npm install -g @google/gemini-cli
</span></span></code></pre></div><h2 id="configuration">Configuration</h2>
<p>The first time you run the <code>gemini</code> command, it will guide you through a setup process.</p>
<ol>
<li>Open your terminal.</li>
<li>Run the command <code>gemini</code>.</li>
<li>Follow the prompts to log in. The recommended method is to sign in with your personal Google account, which provides a generous free tier. You can also use an API key from Google AI Studio or a Google Cloud project for higher usage.</li>
</ol>
<h2 id="usage">Usage</h2>
<h3 id="interactive-mode">Interactive Mode</h3>
<p>The primary way to use the tool is by starting an interactive chat session.</p>
<div class="highlight"><pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span><span style="color:#8b949e;font-style:italic"># Navigate to your project folder if you want to ask about it</span>
</span></span><span style="display:flex;"><span>cd /path/to/your-project
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#8b949e;font-style:italic"># Start the interactive CLI</span>
</span></span><span style="display:flex;"><span>gemini
</span></span></code></pre></div><p>Once inside the session, you can ask questions, paste code, or have a conversation.</p>
<h3 id="one-off-commands">One-off Commands</h3>
<p>You can pass a prompt directly to the <code>gemini</code> command for a single response using the <code>-p</code> (prompt) flag.</p>
<p><strong>Syntax:</strong></p>
<div class="highlight"><pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>gemini -p <span style="color:#a5d6ff">&#34;[YOUR_PROMPT]&#34;</span>
</span></span></code></pre></div><p><strong>Examples:</strong></p>
<div class="highlight"><pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span><span style="color:#8b949e;font-style:italic"># Ask a general question</span>
</span></span><span style="display:flex;"><span>gemini -p <span style="color:#a5d6ff">&#34;What is the difference between PUT and PATCH HTTP methods?&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#8b949e;font-style:italic"># Ask about your codebase (run from the project directory)</span>
</span></span><span style="display:flex;"><span>gemini -p <span style="color:#a5d6ff">&#34;Explain the architecture of this codebase based on the file structure.&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#8b949e;font-style:italic"># Generate a commit message for staged changes</span>
</span></span><span style="display:flex;"><span>git diff --staged | gemini -p <span style="color:#a5d6ff">&#34;Generate a concise and conventional commit message for these changes.&#34;</span>
</span></span></code></pre></div><h3 id="piping-content">Piping Content</h3>
<p>You can pipe the content of files to the <code>gemini</code> command.</p>
<div class="highlight"><pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span><span style="color:#8b949e;font-style:italic"># Ask Gemini to explain a file</span>
</span></span><span style="display:flex;"><span>cat README.md | gemini -p <span style="color:#a5d6ff">&#34;Summarize this README for a non-technical user.&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#8b949e;font-style:italic"># Generate code and save it to a file</span>
</span></span><span style="display:flex;"><span>gemini -p <span style="color:#a5d6ff">&#34;Write a simple Python Flask server with one route&#34;</span> &gt; app.py
</span></span></code></pre></div><h2 id="effective-usage-tips">Effective Usage Tips</h2>
<ul>
<li><strong>Ground with Search:</strong> Gemini CLI can use Google Search to provide more up-to-date and factual answers. This is on by default.</li>
<li><strong>Use Vision:</strong> You can pass local image files to prompts for multimodal queries.
<code>gemini -p &quot;Describe this user interface&quot; -i &quot;screenshot.png&quot;</code></li>
<li><strong>Specify Models:</strong> If you have access to multiple Gemini models, you can specify which one to use with the <code>-m</code> flag (e.g., <code>gemini -m &quot;models/gemini-1.5-pro-latest&quot;</code>).</li>
<li><strong>Extensibility:</strong> The Gemini CLI is extensible. Explore its documentation to learn about creating custom plugins and tools for more advanced workflows.</li>
</ul>
]]></content:encoded></item><item><title>Claude CLI</title><link>https://qref.eknath.dev/ai/claude/</link><guid isPermaLink="true">https://qref.eknath.dev/ai/claude/</guid><pubDate>Mon, 18 Aug 2025 00:00:00 +0000</pubDate><category>claude</category><category>cli</category><category>ai</category><category>anthropic</category><category>npm</category><description>A quick reference for installing and using the official Claude CLI to interact with Anthropic's AI models from your terminal.</description><content:encoded><![CDATA[<h2 id="overview">Overview</h2>
<p><code>@anthropic-ai/claude-code</code> is the official command-line interface (CLI) for Claude, developed by Anthropic. It allows developers to interact with Claude models directly from the terminal, making it easy to integrate AI into development workflows, analyze code, and generate content without leaving the command line.</p>
<h2 id="installation">Installation</h2>
<p>You must have Node.js (version 18 or higher) and npm installed.</p>
<p>To install the Claude CLI globally on your system, run the following command:</p>
<div class="highlight"><pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>npm install -g @anthropic-ai/claude-code
</span></span></code></pre></div><h2 id="configuration">Configuration</h2>
<p>The first time you run the <code>claude</code> command, it will guide you through an authentication process in your web browser.</p>
<ol>
<li>Open your terminal.</li>
<li>Run the command <code>claude</code>.</li>
<li>Follow the on-screen prompts to log in to your Anthropic account. This requires an active subscription (like Claude Pro) or a funded account on the Anthropic Console.</li>
</ol>
<h2 id="usage">Usage</h2>
<h3 id="interactive-mode">Interactive Mode</h3>
<p>The primary way to use the tool is by starting an interactive chat session within your project directory.</p>
<div class="highlight"><pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span><span style="color:#8b949e;font-style:italic"># Navigate to your project folder</span>
</span></span><span style="display:flex;"><span>cd /path/to/your-project
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#8b949e;font-style:italic"># Start the interactive CLI</span>
</span></span><span style="display:flex;"><span>claude
</span></span></code></pre></div><p>Once inside the session, you can ask questions about your codebase, generate files, or ask for explanations.</p>
<p><strong>Example Prompts:</strong></p>
<pre tabindex="0"><code>&gt; Explain the purpose of the `utils.js` file.
&gt; Write a README.md file for this project.
&gt; What are the main dependencies in package.json?
</code></pre><h3 id="piping-and-one-off-commands">Piping and One-off Commands</h3>
<p>You can pipe the content of files to the <code>claude</code> command for specific, one-time tasks using the <code>-p</code> (prompt) flag.</p>
<p><strong>Syntax:</strong></p>
<div class="highlight"><pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>cat <span style="color:#ff7b72;font-weight:bold">[</span>FILENAME<span style="color:#ff7b72;font-weight:bold">]</span> | claude -p <span style="color:#a5d6ff">&#34;[YOUR_PROMPT]&#34;</span>
</span></span></code></pre></div><p><strong>Examples:</strong></p>
<div class="highlight"><pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span><span style="color:#8b949e;font-style:italic"># Get an explanation of a file</span>
</span></span><span style="display:flex;"><span>cat src/api.js | claude -p <span style="color:#a5d6ff">&#34;Explain what this code does in simple terms.&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#8b949e;font-style:italic"># Refactor a file</span>
</span></span><span style="display:flex;"><span>cat components/LegacyComponent.jsx | claude -p <span style="color:#a5d6ff">&#34;Refactor this class component into a functional component using React Hooks.&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#8b949e;font-style:italic"># Add documentation to a file</span>
</span></span><span style="display:flex;"><span>cat scripts/deploy.sh | claude -p <span style="color:#a5d6ff">&#34;Add comments to this shell script explaining each step.&#34;</span>
</span></span></code></pre></div><h2 id="effective-usage-tips">Effective Usage Tips</h2>
<ul>
<li><strong>Context is Key:</strong> Always run the <code>claude</code> command from your project&rsquo;s root directory. The CLI automatically gathers context from your file structure to provide more relevant answers.</li>
<li><strong>Be Specific:</strong> When piping commands, be very clear in your prompt about the desired action and output format.</li>
<li><strong>Use for Reviews:</strong> Pipe your code before committing to get a quick code review and suggestions for improvement. <code>git diff HEAD | claude -p &quot;Review these changes for potential bugs.&quot;</code></li>
<li><strong>Combine with other tools:</strong> Use <code>claude</code> as part of a larger script. For example, you could find all <code>TODO</code> comments and ask Claude to suggest solutions for them.</li>
</ul>
]]></content:encoded></item></channel></rss>