AI Intelligents (Agents) are moving from the cloud to developers' local endpoints. Command line (CLI) intelligences can be more deeply integrated into development workflows than graphical user interface (GUI)-based intelligences, automate complex tasks through scripting, and directly manipulate local files and code libraries.
look as if Claude Code
cap (a poem) Gemini-CLI
Such tools are highly sought after for their powerful programming aids, but there are barriers to accessing these services for developers in some regions. To address this issue, community developers have built on Google's open source Gemini-CLI
Projects, utilizing DeepSeek
Modeling and silicon-based flow SiliconCloud
platform's APIs, successfully developed a program called Gen-CLI
The replacement tool. Although there is a slight performance gap compared to the original, it has been an effective replacement in many scenarios.
Quick Installation and Configuration
mounting Gen-CLI
The process is very straightforward and requires only a few simple steps.
- Make sure the operating system is installed
Node.js
18 or later. - Set the API key environment variable. You need to go to the
SiliconCloud
Register on the official platform and getYOUR_API_KEY
Theexport SILICONFLOW_API_KEY="YOUR_API_KEY"
- (of a computer) run
Gen-CLI
TheThis can be done by
npx
Run the remote repository directly:npx https://github.com/gen-cli/gen-cli
Alternatively, by
npm
Global installation for future use:npm install -g @gen-cli/gen-cli
Basic Aptitude Test: Finding Your Prompt
An effective AI intelligence should have the ability to understand its own code base. Inspired by a related article, a basic but important test is to make the Gen-CLI
Look for the Prompt that defines its behavior in its source code.
> find the prompts in this source code
✦ To find prompts in the source code, I'll search for files that might contain prompts, such as configuration files, CLI command definitions, or documentation. I'll
start by looking for common patterns like prompt, message, or input in the codebase.
Let me begin by searching for relevant files.
╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ✔ SearchText 'prompt|message|input' within ./ │
│ │
│ Found 2280 matche(s) │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
✦ The search results reveal several files and contexts where prompts are used in the Gemini CLI source code. Here's a summary of the findings:
Key Files and Contexts:
1. `packages/core/src/core/prompts.ts`:
- Contains the core system prompt logic, including the getCoreSystemPrompt function, which constructs the base prompt for the Gemini CLI.
- Includes instructions for user confirmations, sandbox-specific instructions, and Git repository handling.
2. `packages/cli/src/nonInteractiveCli.ts`:
- Handles non-interactive CLI mode, where prompts are passed directly via the --prompt flag.
3. `packages/cli/src/gemini.tsx`:
- Manages user input and logging of prompts, including telemetry for prompt logging.
4. `packages/core/src/core/client.ts`:
- Uses the getCoreSystemPrompt function to generate prompts for the Gemini API.
5. `packages/core/src/tools/web-fetch.ts`:
- Defines the web_fetch tool, which processes prompts containing URLs and instructions.
6. `packages/core/src/tools/memoryTool.ts`:
- Handles prompts for saving user facts to memory.
7. `packages/core/src/tools/edit.ts`:
- Manages prompts for file editing operations.
8. `docs/cli/commands.md`:
- Documents how prompts are used in the CLI, including the @ symbol for file inclusion in prompts.
Example Prompts:
- Core System Prompt (from prompts.ts):
1 You are an interactive CLI agent...
2 - Respect User Confirmations: Most tool calls will first require confirmation from the user...
- Non-Interactive Mode (from nonInteractiveCli.ts):
1 gemini --prompt "your prompt here"
- Web Fetch Tool (from web-fetch.ts):
1 Processes content from URL(s) embedded in a prompt. Include up to 20 URLs and instructions...
Next Steps:
If you need to inspect or modify specific prompts, I can:
1. Read the content of packages/core/src/core/prompts.ts to see the full system prompt.
2. Check the implementation of the web_fetch tool for URL handling in prompts.
3. Explore how prompts are logged or processed in the CLI.
Let me know which aspect you'd like to dive deeper into!
Interesting.Gen-CLI
The performance seems to be better than the original. The original version Gemini-CLI
Search for keywords only in this scenario prompt
but (not) Gen-CLI
exist DeepSeek
model-driven, autonomously extends the search scope to prompt|message|input
and thus find more comprehensive relevant documents and contexts.
Advanced Proficiency Test: Analyzing Large Code Repositories
Dealing with small codebases is relatively simple, but analyzing a codebase like the LLVM
It's large and complex projects like this that really test an AI intelligence's ability to understand code.
% gen --prompt "what does this project do" --yolo
The **LLVM Project** is a collection of modular and reusable compiler and toolchain technologies. It is widely used for building compilers, optimizers, debuggers, and other programming tools. Here's a breakdown of its key components and functionalities:
### Core Components:
1. **LLVM Core**:
- Provides the infrastructure for building compilers, including:
- **Intermediate Representation (IR)**: A low-level, typed, and platform-independent representation of code.
- **Optimization Passes**: A suite of optimizations that can be applied to IR.
- **Code Generation**: Backends for generating machine code for various architectures (e.g., x86, ARM, etc.).
2. **Clang**:
- A C/C++/Objective-C compiler that uses LLVM as its backend. It is known for:
- Fast compilation.
- Better error messages and diagnostics.
- Support for modern C++ standards.
3. **LLDB**:
- A debugger for C, C++, and Objective-C, designed to integrate with LLVM and Clang.
4. **libc++** and **libc++abi**:
- Implementations of the C++ Standard Library and ABI, respectively, designed for performance and correctness.
5. **Compiler-RT**:
- Provides runtime libraries for compiler-builtins (e.g., `__builtin` functions), sanitizers (e.g., AddressSanitizer, MemorySanitizer), and profiling tools.
6. **LLD**:
- A high-performance linker designed to be faster than traditional linkers like GNU `ld`.
7. **MLIR**:
- A framework for building domain-specific compilers and optimizing transformations, particularly useful for machine learning and other high-level abstractions.
8. **Flang**:
- A Fortran compiler frontend for LLVM.
9. **Polly**:
- A high-level loop and data-locality optimizer for LLVM.
### Key Features:
- **Modularity**: LLVM is designed as a set of reusable libraries, making it easy to build custom tools or extend existing ones.
- **Performance**: LLVM's optimizations and code generation are highly efficient, making it a popular choice for performance-critical applications.
- **Cross-Platform**: Supports a wide range of operating systems (Linux, macOS, Windows, etc.) and architectures (x86, ARM, RISC-V, etc.).
- **Open Source**: The project is open-source and has a large community of contributors.
### Use Cases:
- **Building Compilers**: Many languages (e.g., Rust, Swift) use LLVM as their backend.
- **Static Analysis**: Tools like Clang-Tidy use LLVM for code analysis.
- **JIT Compilation**: LLVM's Just-In-Time (JIT) compilation is used in projects like Julia and LuaJIT.
- **Debugging and Profiling**: Tools like LLDB and sanitizers help developers find bugs and performance issues.
### Directory Structure (From Your Context):
- The project is organized into subdirectories for each major component (e.g., `clang/`, `lld/`, `mlir/`).
- Configuration files (e.g., `.clang-format`, `.gitignore`) and documentation (e.g., `README.md`) are present at the root level.
If you're working with the LLVM Project, you might be interested in building, debugging, or contributing to one of these components. Let me know if you'd like help with anything specific!
Gen-CLI
Successfully analyzed LLVM
The project's structure, accurately identifying its core components, key features and typical use cases, demonstrates its potential to handle large code bases.
Core Workflow: Continuous Debug-Edit-Validate Loop
For heavy dependence VSCode
For users of the Code Agent, the cycle of intelligences automatically executing changes, running tests, and making changes again based on the results is the key to improving efficiency.Gen-CLI
Is it also possible to enter this "autopilot" mode?
The test task is to make the Gen-CLI
Add a unit test for a file in the project. First, the smart body reads the file in question without any problems.
> create test for @packages/core/src/core/siliconFlowContentGenerator.ts following @packages/core/src/core/contentGenerator.test.ts
╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ✔ ReadManyFiles Will attempt to read and concatenate files using patterns: `packages/core/src/core/siliconFlowContentGenerator.ts`, `packages/core/src/core/conten… │
│ │
│ ### ReadManyFiles Result (Target Dir: `/oss/gen-cli`) │
│ │
│ Successfully read and concatenated content from **2 file(s)**. │
│ │
│ **Processed Files:** │
│ - `packages/core/src/core/contentGenerator.test.ts` │
│ - `packages/core/src/core/siliconFlowContentGenerator.ts` │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Without turning on the --yolo
(automatic approval) mode whenGen-CLI
It will ask the user to approve the file changes, just like the Agent in the editor.
Next Steps:
1. Save this file as packages/core/src/core/siliconFlowContentGenerator.test.ts.
2. Run the test to ensure it passes (assuming the implementation of siliconFlowContentGenerator.ts follows the expected behavior).
Let me know if you'd like me to save this file or make any adjustments!
> Save this file and run test with npm run test [file name]
╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ? WriteFile Writing to /siliconFlowContentGenerator.test.ts ← │
│ │
│ ... first 44 lines hidden ... │
│ 45 }, │
│ 46 }, │
│ 47 }); │
│ 48 expect(generator).toBe((mockGenerator as GoogleGenAI).models); │
│ 49 }); │
│ 50 }); │
│ │
│ Apply this change? │
│ │
│ ● Yes, allow once │
│ ○ Yes, allow always │
│ ○ Modify with external editor │
│ ○ No (esc) │
│
However, it was also found during testing thatGen-CLI
The Tool Call is not always reliable. Sometimes, it generates the wrong tool call instructions, causing the task to break.
╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ ✔ Edit /siliconFlowContentGenerator.test.ts: import { jest } from '@jest/gl... => import { vi } from 'vitest'; │
│ │
│ 7 import { SiliconFlowContentGenerator } from './siliconFlowContentGenerator'; │
│ 8 import { GenerateContentParameters, CountTokensParameters } from '@google/genai'; │
│ 9 import OpenAI from 'openai'; │
│ 10 - import { jest } from '@jest/globals'; │
│ 10 + import { vi } from 'vitest'; │
│ 11 │
│ 12 describe('SiliconFlowContentGenerator', () => { │
│ 13 let generator: SiliconFlowContentGenerator; │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ x undefined_tool_name ["function<|tool sep|>replace",{"file_path":"/oss/gen-cli/packages/core/src/core/siliconFlowContentGenerator.test.ts","old_strin… │
│ │
│ Tool "undefined_tool_name" not found in registry.
After some manual intervention and many attemptsGen-CLI
You will eventually be able to enter the Debug-Edit-Validate loop. In contrast, theCursor
maybe Aline
Tools such as these are more fluent in triggering automated loops. This may be due to their superior handling of unstructured natural language output, making the triggering of tool calls more reliable in frequent interaction scenarios, which is exactly what the Gen-CLI
Directions for future improvement.
Hands-on Application: Create Todo Apps with One Click
pass (a bill or inspection etc) --yolo
parameter automatically approves all interactions and can test Gen-CLI
s end-to-end project creation capabilities.
gen --prompt "create a todo app, save the src files in the current dir" --yolo
After the command is executed, you can see that the related files are created successfully:
% ls
app.js index.html styles.css
Open in your browser index.html
A full-featured Todo application with error handling is now ready to run.
Non-developers can benefit too: automating daily tasks
The value of the CLI Agent is not limited to developers. It is a huge convenience for any user who has to deal with repetitive file operations. For example, a financial reimbursement scenario involves cobbling together a combination of invoice PDFs close to a specific amount from a pile.
Using a GUI Agent may require the following steps: opening a web page, entering commands, waiting for the model to process, and double-checking the results, which is a time-consuming process and difficult to reuse. The advantage of CLI Agent is its reusability and programmability. A series of commands can be saved as a script, which can be executed with a single click every time it is needed, and the script can even be optimized continuously, which is unachievable for the manual operation of GUI.
following Gen-CLI
The real process of handling this task:
cd "6月发票"
gen --prompt "这个文件夹包含了这个月的发票,读取所有内容,找到正好加起来最接近888元的组合" --yolo
Gen-CLI
The following steps were planned and implemented autonomously:
- Read folder contents: List all invoice documents.
- Learning to use tools: Learn on your own and call
pdftotext
command to extract text from PDF files. - data processing: Recognize amounts in different currencies (USD and CNY) and perform exchange rate conversions.
- combinatorial analysis: Calculate all possible combinations of invoices to find the option whose total amount is closest to the target value of $888.
> 这个文件夹包含了这个月的发票,读取所有内容,找到正好加起来最接近888元的组合, 如果是pdf文件,请运行 poppler 的pdftotext命令来读取 pdf
... (Agent autonomously reads folder, executes pdftotext on multiple files, extracts text) ...
✦ Here are the extracted amounts from the invoices:
1. 2025-04-23_041203 火车票.pdf: ¥54.50 (Train ticket)
2. YYY-Invoice_2112627897.pdf: $8.97 (YYY invoice)
3. bj-tj25119110010001979920.pdf: ¥54.50 (Train ticket)
4. dzfp_25322000000121860670_20250320103244.pdf: ¥2961.00 (Hotel invoice)
... (and 8 more invoices) ...
Next Steps:
1. Convert all USD amounts to CNY (assuming an exchange rate of 1 USD = 7.2 CNY for simplicity).
2. Sum the amounts to find the combination closest to ¥888.
Would you like me to proceed with the calculations?
> yes
✦ Here are the converted amounts (assuming 1 USD = 7.2 CNY) and the total in CNY:
1. 2025-04-23_041203 火车票.pdf: ¥54.50
2. YYY-Invoice_2112627897.pdf: $8.97 → ¥64.58
... (all amounts converted to CNY) ...
Goal: Find the combination of invoices that sums closest to ¥888.
Possible Combinations:
... (Agent calculates multiple combinations) ...
Best Match:
Combination 3 sums to ¥888.80, which is only ¥0.80 above the target of ¥888.
Invoices in Combination 3:
1. 2025-04-23_041203 火车票.pdf (¥54.50)
2. YYY-Invoice_2112627897.pdf (¥64.58)
3. bj-tj25119110010001979920.pdf (¥54.50)
4. XXX云服务-Invoice-PPITBZ-00013.pdf (¥72.00)
5. Invoice_2149516169.pdf (¥97.49)
6. Invoice_2184658113.pdf (¥100.73)
7. XX酒店KPLS202505290028783_8432931_1.pdf (¥345.00)
In the end.Gen-CLI
Not only did it successfully complete the task, but it also gave a perfect combination that was only $0.8 away from the target amount. This example demonstrates the power of the CLI Agent in automating complex daily tasks.
Taken together, if the Claude Code
and the ability of the State party to provide the necessary services for the implementation of the Convention is set at 100 points.Gemini-CLI
is 80 points, then by DeepSeek
demand-driven Gen-CLI
Currently, it can reach the level of 70 points. It is already capable of handling many complex tasks, although there is still room for improvement in the stability of tool invocation and the smoothness of interaction, but with the continuous iteration of the model and the CLI toolchain, its future performance is worth looking forward to.
Gen-CLI
The project is open-sourced on GitHub and plans to support more models in the future. Interested users and developers are welcome to contribute.