Skip to content

Feat/mcp#7

Closed
kooksee wants to merge 32 commits intomainfrom
feat/mcp
Closed

Feat/mcp#7
kooksee wants to merge 32 commits intomainfrom
feat/mcp

Conversation

@kooksee
Copy link
Copy Markdown
Contributor

@kooksee kooksee commented Mar 14, 2026

No description provided.

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, 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 enhances the CLI framework by adding powerful new capabilities for managing environment variables. Users can now define or load environment variables directly through global command-line flags, which are processed before the main command parsing. This ensures that all necessary environment configurations are in place early, improving flexibility and consistency for command execution. The implementation also includes safeguards to revert any environment changes if preloading encounters issues, maintaining a clean state.

Highlights

  • New Global Environment Flags: Introduced --env (shorthand -e) and --env-file global flags, allowing users to set environment variables directly from the command line or load them from .env files before command parsing. These flags support repeated use and CSV-formatted values.
  • Robust Environment Preloading: Implemented a preloading mechanism that applies environment variables early in the command execution lifecycle. This system includes automatic rollback of environment changes if any errors occur during the preloading process, ensuring state integrity.
  • Updated Documentation: Documentation (README.md, docs/USAGE_AT_A_GLANCE.md) has been updated to reflect the new environment flags, providing clear usage examples. A new AGENTS.md document was also added, outlining guidelines for AI coding agents.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • docs/CHANGELOG.md
    • Added new built-in global environment flags: --env (shorthand -e) and --env-file, supporting environment variable injection before command parsing.
    • Fixed preloadEnvFromArgs to prevent lingering environment variables if pre-parsing fails, with automatic rollback of changed items.
Activity
  • Added AGENTS.md to provide guidelines for AI coding agents working within the redant repository.
  • Modified README.md and docs/USAGE_AT_A_GLANCE.md to include explanations and examples for the new global environment flags.
  • Updated args.go to define the new --env and --env-file global flags.
  • Integrated environment variable preloading logic into command.go to ensure variables are set before command execution and restored afterwards.
  • Expanded command_test.go with new test cases for the global environment flags, covering various scenarios and ensuring proper restoration of environment state.
  • Introduced env_preload.go to encapsulate the logic for parsing, applying, and restoring environment variables from command-line arguments.
  • Added env_preload_test.go with comprehensive unit tests for the environment preloading functionality, including parsing, error handling, and rollback mechanisms.
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

@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

这个 PR 引入了通过 --env--env-file 标志预加载环境变量的重要功能。整体实现思路清晰,特别是在失败时能够自动回滚环境变量变更,保证了操作的原子性。同时,PR 包含了详尽的单元测试和文档更新,覆盖了多种使用场景,这非常好。

我发现一个关键问题:新文件 env_preload.go 中调用了未定义的函数 readAsCSV,这将导致编译失败。请实现这个函数以完成该功能。

Comment on lines +59 to +62
paths, err := readAsCSV(value)
if err != nil {
return nil, fmt.Errorf("parsing --env-file value %q: %w", value, err)
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

critical

函数 readAsCSV 在代码中被调用,但似乎没有在任何地方定义,这将导致编译失败。

你需要实现这个函数。一个简单的 strings.Split(raw, ",") 可能无法处理值中包含逗号的情况(例如,当使用引号时)。考虑到 env_preload_test.go 中的测试用例 TestApplyEnvAssignmentsCSV,一个更健壮的实现是必要的。你可以考虑使用标准库 encoding/csv,例如:

import (
	"encoding/csv"
	"strings"
)

func readAsCSV(val string) ([]string, error) {
	if val == "" {
		return nil, nil
	}
	stringReader := strings.NewReader(val)
	csvReader := csv.NewReader(stringReader)
	// pflag 的 StringArray 分割 CSV 时,似乎也是按单行处理的,所以这里 Read() 一次是匹配的。
	return csvReader.Read()
}

请将此函数或类似功能的实现添加到包中。

kooksee and others added 17 commits March 17, 2026 17:05
- Implement tests for slash command completions and input handling.
- Validate mouse interactions for scrolling and selecting history.
- Test command execution for /ask, /plan, and /run commands.
- Ensure proper state management during command execution and history navigation.
- Verify rendering behavior for output lines with folded details.
- Check initial state for suggestions on empty input.
- 在 Command 结构中添加 Metadata 字段,用于存储命令的扩展注解。
- 实现命令调度钩子,支持将特定命令自动重定向到 agentline。
- 增加 agentline 命令的初始化参数支持,允许直接执行命令。
- 更新相关测试用例,确保新功能的正确性。
- 添加示例文档,展示如何使用新功能。
kooksee added 5 commits March 21, 2026 11:28
- Implemented multi-file upload handling in the /upload endpoint, allowing users to upload files to specified subdirectories.
- Introduced /api/files endpoint to list files in a directory, returning metadata such as size and modification time.
- Added /download endpoint for downloading files, ensuring proper handling of file paths.
- Enhanced the frontend to support file uploads via drag-and-drop and input fields, displaying upload progress and statuses.
- Created tests for upload, list, and download functionalities to ensure reliability and correctness.
- Implemented signal handling for interactive shell commands, supporting Ctrl+C and Ctrl+Z signals on Unix systems.
- Added platform-specific implementations for signal handling on Windows and Unix.
…ownload capabilities

- Added `cmds/webttycmd` for a simple local Web terminal using WebSocket + PTY.
- Implemented file upload features including multi-file support, configurable concurrency, and upload scheduling strategies (FIFO/small-first/large-first).
- Added directory download functionality with a new endpoint `/download-zip` for zipping and downloading directories.
- Enhanced user experience with session reconnection capabilities and improved control key handling.
- Updated documentation to reflect new features and usage instructions for WebTTY.
@kooksee kooksee closed this Mar 25, 2026
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