Skip to content

feat: add file tools and grep search functionality#2

Merged
minpeter merged 23 commits intomainfrom
feature/add-functionality
Jan 7, 2026
Merged

feat: add file tools and grep search functionality#2
minpeter merged 23 commits intomainfrom
feature/add-functionality

Conversation

@minpeter
Copy link
Copy Markdown
Owner

@minpeter minpeter commented Jan 7, 2026

No description provided.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @minpeter, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces an experimental script (src/exp.ts) that demonstrates an interactive AI agent powered by Friendli's AI provider and a ToolLoopAgent. This agent is designed to process user prompts and stream responses, leveraging a set of predefined tools. Additionally, it includes minor formatting adjustments to existing tool files by ensuring they end with a newline character.

Highlights

  • New AI Agent Experiment: Introduced a new experimental script, src/exp.ts, which sets up an interactive AI agent using the Friendli AI provider and a ToolLoopAgent.
  • Interactive CLI: The new exp.ts file provides a command-line interface for users to interact with the AI agent, allowing for prompt input and streaming of agent responses.
  • Tool Integration: The AI agent is configured to utilize existing tools, suggesting capabilities like file manipulation and search functionalities (e.g., grep) based on the PR title and other file changes.
  • Minor Formatting Fixes: Addressed minor formatting issues in src/tools/file/write-file.ts and src/tools/search/grep.ts by ensuring these files end with a newline character.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new experimental script src/exp.ts to run a code editing agent, and adds new file system and search tools. The implementation of the grep tool using ripgrep is robust. The main script is well-structured, but I've identified a high-severity issue with top-level error handling that could lead to an ungraceful process exit. My review includes a suggestion to properly handle promise rejections at the application's entry point. The other changes are minor formatting adjustments.

Comment thread src/unit-exp.ts Outdated
- Add showFinishReason to StreamRenderOptions interface
- Include showFinishReason in RenderContext
- Implement handleFinish function to conditionally display finish reason
- Update renderFullStream to use the new option with default value true
- Handle 'finish' stream part to invoke handleFinish
conversation context

Add MessageHistory to manage conversation context and ensure proper
message tracking in the agent loop. Update maxOutputTokens from 10 to
1024 to allow longer responses.
This change introduces a new MessageHistory class to track and manage
user and model messages in the interaction module. The class provides
methods to add messages, retrieve all messages, clear the history, and
convert stored messages to the format required by the AI model.

A factory function generates unique message IDs using a counter, and
each message stores its creation timestamp, unique ID, and role-specific
content.
- Remove deprecated `agent.ts` class and replace with `ToolLoopAgent`
- Reorganize project structure: move files from `src/utils`,
  `src/interaction`, and `src/tools` to `src/context`,
  `src/interaction`, and `src/tools`
- Update imports to reflect new module paths
- Remove unused dependencies and utilities (`retry.ts`,
  `conversation-store.ts`, `model-selector.ts`, `unit-exp.ts`)
- Simplify environment configuration by removing `DEBUG_CHUNK_LOG`
- Fix tool import paths
Remove unused import and update module path for run-command tool Update
import path from src/tools/command/run-command to
src/tools/shell/run-command Clean up commented code and reorganize
imports for consistency
dependencies

```

The changelog shows an update of the `@ai-sdk/openai-compatible` package
from v2.0.2 to v2.0.4, along with updates to its peer dependencies
(`@ai-sdk/provider` and `@ai-sdk/provider-utils`). This change ensures
compatibility and benefits from bug fixes or improvements in the newer
version. No changes to the application logic are required; this is a
dependency update.
Add command parsing and execution support for user input Implement /help
command to list available commands Remove unused experimental code
```text Add exported registerCommand and implement render command for
raw prompt rendering ```

Add rendered command to system, export registerCommand for external use,
and implement error handling for render command.
implementations

- Refactor agent initialization and model management into AgentManager
  class
- Extract model selection logic into command pattern
- Integrate custom fetch implementation for chat rendering
- Remove redundant model selector and consolidate command registration
- Update main entry point to use centralized agent and command system
- Ensure consistent API usage and error handling across modules
@minpeter minpeter force-pushed the feature/add-functionality branch from 0723b8d to 1b7230a Compare January 7, 2026 08:36
trimming in message history

The changes include:
- Implementing the `trimTrailingNewlines` function to remove trailing
  newlines from assistant messages
- Adding comprehensive unit tests to verify behavior for string and
  array content types
- Supporting both text and tool call content arrays
- Ensuring trailing newlines are trimmed only from text content, not
  other message types Add unit tests for trimTrailingNewlines function
  and implement newline trimming in message history
Add just-bash dependency and refactor shell command tool to use
just-bash instead of node:child_process.exec for safer and more powerful
command execution. Update command execution to support timeouts and
improve error handling. Add just-bash for shell command execution

Add support for executing shell commands via a just-bash-style tool,
enabling safe command execution with user approval for potentially
dangerous operations. Introduce tool approval workflow and message
history tracking for tool responses.
- Reorganize tools into execute/, explore/, modify/ folders
- Rename run_command to shell_command
- Rename file-safety.ts to safety-utils.ts
- Add needsApproval for modifier tools (write, edit, delete) and shell_command
- Implement tool execution approval UI with Y/N prompt
- Update system prompt and tests accordingly
…n- Add DEBUG_SHOW_FINISH_REASON boolean environment variable to src/env.ts\n- Update stream-renderer.ts to use env.DEBUG_SHOW_FINISH_REASON for showFinishReason option\n- This allows controlling whether to show finish reason in stream rendering via environment configuration
@minpeter minpeter merged commit 6e35648 into main Jan 7, 2026
1 check passed
@minpeter minpeter deleted the feature/add-functionality branch April 22, 2026 10:00
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.

1 participant