Skip to content

feat: add ai commands to terminal#782

Open
mateonunez wants to merge 4 commits into
mainfrom
claude/ai-portfolio-improvements-Dwa8p
Open

feat: add ai commands to terminal#782
mateonunez wants to merge 4 commits into
mainfrom
claude/ai-portfolio-improvements-Dwa8p

Conversation

@mateonunez

Copy link
Copy Markdown
Owner

This pull request adds AI-powered commands to the terminal, enabling users to interact with an Anthropic Claude model for chat, explanations, summaries, and TLDRs. It introduces streaming output for commands, improves the command execution flow to support streaming responses, and enhances the terminal UI to display streamed AI output in real time. Several supporting changes were made to the command context, state management, and command formatting to support these new capabilities.

AI Integration and New Commands:

  • Added new AI commands (ask, explain, summarize, tldr) that send prompts to an Anthropic Claude model and stream responses back to the terminal, using context built from Spotify and GitHub data sources. (components/mate/terminal/commands/ai.ts, components/mate/terminal/commands/index.ts, .env.local.example) [1] Fed41041R1, [2] [3]

  • Implemented an API route (app/api/ai/chat/route.ts) to handle chat requests, validate prompts, and stream text responses from Anthropic. (app/api/ai/chat/route.ts)

Streaming Output Support:

  • Enhanced terminal state and tools to support streaming text, including new methods to append and finalize streamed output. (components/mate/terminal/command-context.tsx, components/mate/terminal/hooks/use-terminal-state.ts, components/mate/terminal/terminal.tsx) [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13]

  • Updated the terminal UI to display streaming output with a visual indicator and prevent new input while streaming is active. (components/mate/terminal/terminal.tsx, components/mate/terminal/hooks/use-terminal-input.ts) [1] [2] [3] [4]

Command Execution and Typing Improvements:

  • Refactored command execution to support commands returning either a string or a streamed result, and updated the flow to add input lines only after streaming is complete. (components/mate/terminal/hooks/use-command-runner.tsx, components/mate/terminal/hooks/use-command-executor.ts, components/mate/terminal/types/commands.ts) [1] [2] [3] [4] [5]

Command Formatting:

  • Improved command formatting to display usage strings and better align descriptions in the terminal help output. (components/mate/terminal/utils/formatting.ts)

claude added 3 commits March 18, 2026 08:11
Add `ai` and `@ai-sdk/anthropic` packages for AI-powered terminal
commands with streaming support.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

https://claude.ai/code/session_01FXuX3ypbwddUC3rFvYTneT
Integrate Vercel AI SDK with Anthropic Claude to add intelligent terminal
commands: `ask`, `explain`, `summarize`, and `tldr`. Key changes:

- API route (app/api/ai/chat) with streaming text responses
- Rich system prompt as AIt (Mateo's digital alter ego) with live
  Spotify/GitHub context injection
- Command system extended to support arguments and streaming output
- Terminal state manages streaming text with real-time chunk rendering
- Input blocked during active AI streaming
- Commands registered under new "AI" group in help output

Usage: `ask what tech stack do you use?`, `tldr your open source work`,
`explain your approach to testing`, `summarize`

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

https://claude.ai/code/session_01FXuX3ypbwddUC3rFvYTneT
@vercel

vercel Bot commented Mar 18, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
website Ready Ready Preview, Comment Mar 18, 2026 8:40am

The outer div's keydown handler was intercepting space keypresses
(to focus the input) even when the input already had focus, preventing
users from typing spaces. Skip the handler when the event originates
from the input element.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

https://claude.ai/code/session_01FXuX3ypbwddUC3rFvYTneT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants