mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
feat: update docs
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
export default {
|
||||
settings: 'Settings File',
|
||||
memory: 'Memory Management',
|
||||
'trusted-folders': 'Trusted Folders',
|
||||
settings: 'Settings',
|
||||
memory: {
|
||||
display: 'hidden',
|
||||
},
|
||||
'qwen-ignore': 'Ignoring Files',
|
||||
'trusted-folders': 'Trusted Folders',
|
||||
themes: 'Themes',
|
||||
};
|
||||
|
||||
@@ -1,490 +0,0 @@
|
||||
# Sub Agents
|
||||
|
||||
Sub Agents are specialized AI assistants that handle specific types of tasks within Qwen Code. They allow you to delegate focused work to AI agents that are configured with task-specific prompts, tools, and behaviors.
|
||||
|
||||
## What are Sub Agents?
|
||||
|
||||
Sub Agents are independent AI assistants that:
|
||||
|
||||
- **Specialize in specific tasks** - Each Sub Agents is configured with a focused system prompt for particular types of work
|
||||
- **Have separate context** - They maintain their own conversation history, separate from your main chat
|
||||
- **Use controlled tools** - You can configure which tools each Sub Agents has access to
|
||||
- **Work autonomously** - Once given a task, they work independently until completion or failure
|
||||
- **Provide detailed feedback** - You can see their progress, tool usage, and execution statistics in real-time
|
||||
|
||||
## Key Benefits
|
||||
|
||||
- **Task Specialization**: Create agents optimized for specific workflows (testing, documentation, refactoring, etc.)
|
||||
- **Context Isolation**: Keep specialized work separate from your main conversation
|
||||
- **Reusability**: Save and reuse agent configurations across projects and sessions
|
||||
- **Controlled Access**: Limit which tools each agent can use for security and focus
|
||||
- **Progress Visibility**: Monitor agent execution with real-time progress updates
|
||||
|
||||
## How Sub Agents Work
|
||||
|
||||
1. **Configuration**: You create Sub Agents configurations that define their behavior, tools, and system prompts
|
||||
2. **Delegation**: The main AI can automatically delegate tasks to appropriate Sub Agents
|
||||
3. **Execution**: Sub Agents work independently, using their configured tools to complete tasks
|
||||
4. **Results**: They return results and execution summaries back to the main conversation
|
||||
|
||||
## Getting Started
|
||||
|
||||
### Quick Start
|
||||
|
||||
1. **Create your first Sub Agents**:
|
||||
|
||||
`/agents create`
|
||||
|
||||
Follow the guided wizard to create a specialized agent.
|
||||
|
||||
2. **Manage existing agents**:
|
||||
|
||||
`/agents manage`
|
||||
|
||||
View and manage your configured Sub Agents.
|
||||
|
||||
3. **Use Sub Agents automatically**: Simply ask the main AI to perform tasks that match your Sub Agents’ specializations. The AI will automatically delegate appropriate work.
|
||||
|
||||
### Example Usage
|
||||
|
||||
```
|
||||
User: "Please write comprehensive tests for the authentication module"
|
||||
AI: I'll delegate this to your testing specialist Sub Agents.
|
||||
[Delegates to "testing-expert" Sub Agents]
|
||||
[Shows real-time progress of test creation]
|
||||
[Returns with completed test files and execution summary]`
|
||||
```
|
||||
|
||||
## Management
|
||||
|
||||
### CLI Commands
|
||||
|
||||
Sub Agents are managed through the `/agents` slash command and its subcommands:
|
||||
|
||||
**Usage:**:`/agents create`。Creates a new Sub Agents through a guided step wizard.
|
||||
|
||||
**Usage:**:`/agents manage`。Opens an interactive management dialog for viewing and managing existing Sub Agents.
|
||||
|
||||
### Storage Locations
|
||||
|
||||
Sub Agents are stored as Markdown files in two locations:
|
||||
|
||||
- **Project-level**: `.qwen/agents/` (takes precedence)
|
||||
- **User-level**: `~/.qwen/agents/` (fallback)
|
||||
|
||||
This allows you to have both project-specific agents and personal agents that work across all projects.
|
||||
|
||||
### File Format
|
||||
|
||||
Sub Agents are configured using Markdown files with YAML frontmatter. This format is human-readable and easy to edit with any text editor.
|
||||
|
||||
#### Basic Structure
|
||||
|
||||
```
|
||||
---
|
||||
name: agent-name
|
||||
description: Brief description of when and how to use this agent
|
||||
tools:
|
||||
- tool1
|
||||
- tool2
|
||||
- tool3 # Optional
|
||||
---
|
||||
|
||||
System prompt content goes here.
|
||||
Multiple paragraphs are supported.
|
||||
You can use ${variable} templating for dynamic content.
|
||||
```
|
||||
|
||||
#### Example Usage
|
||||
|
||||
```
|
||||
---
|
||||
name: project-documenter
|
||||
description: Creates project documentation and README files
|
||||
---
|
||||
|
||||
You are a documentation specialist for the ${project_name} project.
|
||||
|
||||
Your task: ${task_description}
|
||||
|
||||
Working directory: ${current_directory}
|
||||
Generated on: ${timestamp}
|
||||
|
||||
Focus on creating clear, comprehensive documentation that helps both
|
||||
new contributors and end users understand the project.
|
||||
```
|
||||
|
||||
## Using Sub Agents Effectively
|
||||
|
||||
### Automatic Delegation
|
||||
|
||||
Qwen Code proactively delegates tasks based on:
|
||||
|
||||
- The task description in your request
|
||||
- The description field in Sub Agents configurations
|
||||
- Current context and available tools
|
||||
|
||||
To encourage more proactive Sub Agents use, include phrases like “use PROACTIVELY” or “MUST BE USED” in your description field.
|
||||
|
||||
### Explicit Invocation
|
||||
|
||||
Request a specific Sub Agents by mentioning it in your command:
|
||||
|
||||
```
|
||||
Let the testing-expert Sub Agents create unit tests for the payment module
|
||||
Have the documentation-writer Sub Agents update the API reference
|
||||
Get the react-specialist Sub Agents to optimize this component's performance
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
### Development Workflow Agents
|
||||
|
||||
#### Testing Specialist
|
||||
|
||||
Perfect for comprehensive test creation and test-driven development.
|
||||
|
||||
```
|
||||
---
|
||||
name: testing-expert
|
||||
description: Writes comprehensive unit tests, integration tests, and handles test automation with best practices
|
||||
tools:
|
||||
- read_file
|
||||
- write_file
|
||||
- read_many_files
|
||||
- run_shell_command
|
||||
---
|
||||
|
||||
You are a testing specialist focused on creating high-quality, maintainable tests.
|
||||
|
||||
Your expertise includes:
|
||||
|
||||
- Unit testing with appropriate mocking and isolation
|
||||
- Integration testing for component interactions
|
||||
- Test-driven development practices
|
||||
- Edge case identification and comprehensive coverage
|
||||
- Performance and load testing when appropriate
|
||||
|
||||
For each testing task:
|
||||
|
||||
1. Analyze the code structure and dependencies
|
||||
2. Identify key functionality, edge cases, and error conditions
|
||||
3. Create comprehensive test suites with descriptive names
|
||||
4. Include proper setup/teardown and meaningful assertions
|
||||
5. Add comments explaining complex test scenarios
|
||||
6. Ensure tests are maintainable and follow DRY principles
|
||||
|
||||
Always follow testing best practices for the detected language and framework.
|
||||
Focus on both positive and negative test cases.
|
||||
```
|
||||
|
||||
**Use Cases:**
|
||||
|
||||
- “Write unit tests for the authentication service”
|
||||
- “Create integration tests for the payment processing workflow”
|
||||
- “Add test coverage for edge cases in the data validation module”
|
||||
|
||||
#### Documentation Writer
|
||||
|
||||
Specialized in creating clear, comprehensive documentation.
|
||||
|
||||
```
|
||||
---
|
||||
name: documentation-writer
|
||||
description: Creates comprehensive documentation, README files, API docs, and user guides
|
||||
tools:
|
||||
- read_file
|
||||
- write_file
|
||||
- read_many_files
|
||||
- web_search
|
||||
---
|
||||
|
||||
You are a technical documentation specialist for ${project_name}.
|
||||
|
||||
Your role is to create clear, comprehensive documentation that serves both
|
||||
developers and end users. Focus on:
|
||||
|
||||
**For API Documentation:**
|
||||
|
||||
- Clear endpoint descriptions with examples
|
||||
- Parameter details with types and constraints
|
||||
- Response format documentation
|
||||
- Error code explanations
|
||||
- Authentication requirements
|
||||
|
||||
**For User Documentation:**
|
||||
|
||||
- Step-by-step instructions with screenshots when helpful
|
||||
- Installation and setup guides
|
||||
- Configuration options and examples
|
||||
- Troubleshooting sections for common issues
|
||||
- FAQ sections based on common user questions
|
||||
|
||||
**For Developer Documentation:**
|
||||
|
||||
- Architecture overviews and design decisions
|
||||
- Code examples that actually work
|
||||
- Contributing guidelines
|
||||
- Development environment setup
|
||||
|
||||
Always verify code examples and ensure documentation stays current with
|
||||
the actual implementation. Use clear headings, bullet points, and examples.
|
||||
```
|
||||
|
||||
**Use Cases:**
|
||||
|
||||
- “Create API documentation for the user management endpoints”
|
||||
- “Write a comprehensive README for this project”
|
||||
- “Document the deployment process with troubleshooting steps”
|
||||
|
||||
#### Code Reviewer
|
||||
|
||||
Focused on code quality, security, and best practices.
|
||||
|
||||
```
|
||||
---
|
||||
name: code-reviewer
|
||||
description: Reviews code for best practices, security issues, performance, and maintainability
|
||||
tools:
|
||||
- read_file
|
||||
- read_many_files
|
||||
---
|
||||
|
||||
You are an experienced code reviewer focused on quality, security, and maintainability.
|
||||
|
||||
Review criteria:
|
||||
|
||||
- **Code Structure**: Organization, modularity, and separation of concerns
|
||||
- **Performance**: Algorithmic efficiency and resource usage
|
||||
- **Security**: Vulnerability assessment and secure coding practices
|
||||
- **Best Practices**: Language/framework-specific conventions
|
||||
- **Error Handling**: Proper exception handling and edge case coverage
|
||||
- **Readability**: Clear naming, comments, and code organization
|
||||
- **Testing**: Test coverage and testability considerations
|
||||
|
||||
Provide constructive feedback with:
|
||||
|
||||
1. **Critical Issues**: Security vulnerabilities, major bugs
|
||||
2. **Important Improvements**: Performance issues, design problems
|
||||
3. **Minor Suggestions**: Style improvements, refactoring opportunities
|
||||
4. **Positive Feedback**: Well-implemented patterns and good practices
|
||||
|
||||
Focus on actionable feedback with specific examples and suggested solutions.
|
||||
Prioritize issues by impact and provide rationale for recommendations.
|
||||
```
|
||||
|
||||
**Use Cases:**
|
||||
|
||||
- “Review this authentication implementation for security issues”
|
||||
- “Check the performance implications of this database query logic”
|
||||
- “Evaluate the code structure and suggest improvements”
|
||||
|
||||
### Technology-Specific Agents
|
||||
|
||||
#### React Specialist
|
||||
|
||||
Optimized for React development, hooks, and component patterns.
|
||||
|
||||
```
|
||||
---
|
||||
name: react-specialist
|
||||
description: Expert in React development, hooks, component patterns, and modern React best practices
|
||||
tools:
|
||||
- read_file
|
||||
- write_file
|
||||
- read_many_files
|
||||
- run_shell_command
|
||||
---
|
||||
|
||||
You are a React specialist with deep expertise in modern React development.
|
||||
|
||||
Your expertise covers:
|
||||
|
||||
- **Component Design**: Functional components, custom hooks, composition patterns
|
||||
- **State Management**: useState, useReducer, Context API, and external libraries
|
||||
- **Performance**: React.memo, useMemo, useCallback, code splitting
|
||||
- **Testing**: React Testing Library, Jest, component testing strategies
|
||||
- **TypeScript Integration**: Proper typing for props, hooks, and components
|
||||
- **Modern Patterns**: Suspense, Error Boundaries, Concurrent Features
|
||||
|
||||
For React tasks:
|
||||
|
||||
1. Use functional components and hooks by default
|
||||
2. Implement proper TypeScript typing
|
||||
3. Follow React best practices and conventions
|
||||
4. Consider performance implications
|
||||
5. Include appropriate error handling
|
||||
6. Write testable, maintainable code
|
||||
|
||||
Always stay current with React best practices and avoid deprecated patterns.
|
||||
Focus on accessibility and user experience considerations.
|
||||
```
|
||||
|
||||
**Use Cases:**
|
||||
|
||||
- “Create a reusable data table component with sorting and filtering”
|
||||
- “Implement a custom hook for API data fetching with caching”
|
||||
- “Refactor this class component to use modern React patterns”
|
||||
|
||||
#### Python Expert
|
||||
|
||||
Specialized in Python development, frameworks, and best practices.
|
||||
|
||||
```
|
||||
---
|
||||
name: python-expert
|
||||
description: Expert in Python development, frameworks, testing, and Python-specific best practices
|
||||
tools:
|
||||
- read_file
|
||||
- write_file
|
||||
- read_many_files
|
||||
- run_shell_command
|
||||
---
|
||||
|
||||
You are a Python expert with deep knowledge of the Python ecosystem.
|
||||
|
||||
Your expertise includes:
|
||||
|
||||
- **Core Python**: Pythonic patterns, data structures, algorithms
|
||||
- **Frameworks**: Django, Flask, FastAPI, SQLAlchemy
|
||||
- **Testing**: pytest, unittest, mocking, test-driven development
|
||||
- **Data Science**: pandas, numpy, matplotlib, jupyter notebooks
|
||||
- **Async Programming**: asyncio, async/await patterns
|
||||
- **Package Management**: pip, poetry, virtual environments
|
||||
- **Code Quality**: PEP 8, type hints, linting with pylint/flake8
|
||||
|
||||
For Python tasks:
|
||||
|
||||
1. Follow PEP 8 style guidelines
|
||||
2. Use type hints for better code documentation
|
||||
3. Implement proper error handling with specific exceptions
|
||||
4. Write comprehensive docstrings
|
||||
5. Consider performance and memory usage
|
||||
6. Include appropriate logging
|
||||
7. Write testable, modular code
|
||||
|
||||
Focus on writing clean, maintainable Python code that follows community standards.
|
||||
```
|
||||
|
||||
**Use Cases:**
|
||||
|
||||
- “Create a FastAPI service for user authentication with JWT tokens”
|
||||
- “Implement a data processing pipeline with pandas and error handling”
|
||||
- “Write a CLI tool using argparse with comprehensive help documentation”
|
||||
|
||||
## Best Practices
|
||||
|
||||
### Design Principles
|
||||
|
||||
#### Single Responsibility Principle
|
||||
|
||||
Each Sub Agents should have a clear, focused purpose.
|
||||
|
||||
**✅ Good:**
|
||||
|
||||
```
|
||||
---
|
||||
name: testing-expert
|
||||
description: Writes comprehensive unit tests and integration tests
|
||||
---
|
||||
```
|
||||
|
||||
**❌ Avoid:**
|
||||
|
||||
```
|
||||
---
|
||||
name: general-helper
|
||||
description: Helps with testing, documentation, code review, and deployment
|
||||
---
|
||||
```
|
||||
|
||||
**Why:** Focused agents produce better results and are easier to maintain.
|
||||
|
||||
#### Clear Specialization
|
||||
|
||||
Define specific expertise areas rather than broad capabilities.
|
||||
|
||||
**✅ Good:**
|
||||
|
||||
```
|
||||
---
|
||||
name: react-performance-optimizer
|
||||
description: Optimizes React applications for performance using profiling and best practices
|
||||
---
|
||||
```
|
||||
|
||||
**❌ Avoid:**
|
||||
|
||||
```
|
||||
---
|
||||
name: frontend-developer
|
||||
description: Works on frontend development tasks
|
||||
---
|
||||
```
|
||||
|
||||
**Why:** Specific expertise leads to more targeted and effective assistance.
|
||||
|
||||
#### Actionable Descriptions
|
||||
|
||||
Write descriptions that clearly indicate when to use the agent.
|
||||
|
||||
**✅ Good:**
|
||||
|
||||
```
|
||||
description: Reviews code for security vulnerabilities, performance issues, and maintainability concerns
|
||||
```
|
||||
|
||||
**❌ Avoid:**
|
||||
|
||||
```
|
||||
description: A helpful code reviewer
|
||||
```
|
||||
|
||||
**Why:** Clear descriptions help the main AI choose the right agent for each task.
|
||||
|
||||
### Configuration Best Practices
|
||||
|
||||
#### System Prompt Guidelines
|
||||
|
||||
**Be Specific About Expertise:**
|
||||
|
||||
```
|
||||
You are a Python testing specialist with expertise in:
|
||||
|
||||
- pytest framework and fixtures
|
||||
- Mock objects and dependency injection
|
||||
- Test-driven development practices
|
||||
- Performance testing with pytest-benchmark
|
||||
```
|
||||
|
||||
**Include Step-by-Step Approaches:**
|
||||
|
||||
```
|
||||
For each testing task:
|
||||
|
||||
1. Analyze the code structure and dependencies
|
||||
2. Identify key functionality and edge cases
|
||||
3. Create comprehensive test suites with clear naming
|
||||
4. Include setup/teardown and proper assertions
|
||||
5. Add comments explaining complex test scenarios
|
||||
```
|
||||
|
||||
**Specify Output Standards:**
|
||||
|
||||
```
|
||||
Always follow these standards:
|
||||
|
||||
- Use descriptive test names that explain the scenario
|
||||
- Include both positive and negative test cases
|
||||
- Add docstrings for complex test functions
|
||||
- Ensure tests are independent and can run in any order
|
||||
```
|
||||
|
||||
## Security Considerations
|
||||
|
||||
- **Tool Restrictions**: Sub Agents only have access to their configured tools
|
||||
- **Sandboxing**: All tool execution follows the same security model as direct tool use
|
||||
- **Audit Trail**: All Sub Agents actions are logged and visible in real-time
|
||||
- **Access Control**: Project and user-level separation provides appropriate boundaries
|
||||
- **Sensitive Information**: Avoid including secrets or credentials in agent configurations
|
||||
- **Production Environments**: Consider separate agents for production vs development environments
|
||||
@@ -0,0 +1,282 @@
|
||||
# Github Actions:qwen-code-action
|
||||
|
||||
## Overview
|
||||
|
||||
`qwen-code-action` is a GitHub Action that integrates [Qwen Code] into your development workflow via the [Qwen Code CLI]. It acts both as an autonomous agent for critical routine coding tasks, and an on-demand collaborator you can quickly delegate work to.
|
||||
|
||||
Use it to perform GitHub pull request reviews, triage issues, perform code analysis and modification, and more using [Qwen Code] conversationally (e.g., `@qwencoder fix this issue`) directly inside your GitHub repositories.
|
||||
|
||||
- [qwen-code-action](#qwen-code-action)
|
||||
- [Overview](#overview)
|
||||
- [Features](#features)
|
||||
- [Quick Start](#quick-start)
|
||||
- [1. Get a Qwen API Key](#1-get-a-qwen-api-key)
|
||||
- [2. Add it as a GitHub Secret](#2-add-it-as-a-github-secret)
|
||||
- [3. Update your .gitignore](#3-update-your-gitignore)
|
||||
- [4. Choose a Workflow](#4-choose-a-workflow)
|
||||
- [5. Try it out](#5-try-it-out)
|
||||
- [Workflows](#workflows)
|
||||
- [Qwen Code Dispatch](#qwen-code-dispatch)
|
||||
- [Issue Triage](#issue-triage)
|
||||
- [Pull Request Review](#pull-request-review)
|
||||
- [Qwen Code CLI Assistant](#qwen-code-cli-assistant)
|
||||
- [Configuration](#configuration)
|
||||
- [Inputs](#inputs)
|
||||
- [Outputs](#outputs)
|
||||
- [Repository Variables](#repository-variables)
|
||||
- [Secrets](#secrets)
|
||||
- [Authentication](#authentication)
|
||||
- [GitHub Authentication](#github-authentication)
|
||||
- [Extensions](#extensions)
|
||||
- [Best Practices](#best-practices)
|
||||
- [Customization](#customization)
|
||||
- [Contributing](#contributing)
|
||||
|
||||
## Features
|
||||
|
||||
- **Automation**: Trigger workflows based on events (e.g. issue opening) or schedules (e.g. nightly).
|
||||
- **On-demand Collaboration**: Trigger workflows in issue and pull request
|
||||
comments by mentioning the [Qwen Code CLI] (e.g., `@qwencoder /review`).
|
||||
- **Extensible with Tools**: Leverage [Qwen Code] models' tool-calling capabilities to
|
||||
interact with other CLIs like the [GitHub CLI] (`gh`).
|
||||
- **Customizable**: Use a `QWEN.md` file in your repository to provide
|
||||
project-specific instructions and context to [Qwen Code CLI].
|
||||
|
||||
## Quick Start
|
||||
|
||||
Get started with Qwen Code CLI in your repository in just a few minutes:
|
||||
|
||||
### 1. Get a Qwen API Key
|
||||
|
||||
Obtain your API key from [DashScope] (Alibaba Cloud's AI platform)
|
||||
|
||||
### 2. Add it as a GitHub Secret
|
||||
|
||||
Store your API key as a secret named `QWEN_API_KEY` in your repository:
|
||||
|
||||
- Go to your repository's **Settings > Secrets and variables > Actions**
|
||||
- Click **New repository secret**
|
||||
- Name: `QWEN_API_KEY`, Value: your API key
|
||||
|
||||
### 3. Update your .gitignore
|
||||
|
||||
Add the following entries to your `.gitignore` file:
|
||||
|
||||
```gitignore
|
||||
# qwen-code-cli settings
|
||||
.qwen/
|
||||
|
||||
# GitHub App credentials
|
||||
gha-creds-*.json
|
||||
```
|
||||
|
||||
### 4. Choose a Workflow
|
||||
|
||||
You have two options to set up a workflow:
|
||||
|
||||
**Option A: Use setup command (Recommended)**
|
||||
|
||||
1. Start the Qwen Code CLI in your terminal:
|
||||
|
||||
```shell
|
||||
qwen
|
||||
```
|
||||
|
||||
2. In Qwen Code CLI in your terminal, type:
|
||||
|
||||
```
|
||||
/setup-github
|
||||
```
|
||||
|
||||
**Option B: Manually copy workflows**
|
||||
|
||||
1. Copy the pre-built workflows from the [`examples/workflows`](./examples/workflows) directory to your repository's `.github/workflows` directory. Note: the `qwen-dispatch.yml` workflow must also be copied, which triggers the workflows to run.
|
||||
|
||||
### 5. Try it out
|
||||
|
||||
**Pull Request Review:**
|
||||
|
||||
- Open a pull request in your repository and wait for automatic review
|
||||
- Comment `@qwencoder /review` on an existing pull request to manually trigger a review
|
||||
|
||||
**Issue Triage:**
|
||||
|
||||
- Open an issue and wait for automatic triage
|
||||
- Comment `@qwencoder /triage` on existing issues to manually trigger triaging
|
||||
|
||||
**General AI Assistance:**
|
||||
|
||||
- In any issue or pull request, mention `@qwencoder` followed by your request
|
||||
- Examples:
|
||||
- `@qwencoder explain this code change`
|
||||
- `@qwencoder suggest improvements for this function`
|
||||
- `@qwencoder help me debug this error`
|
||||
- `@qwencoder write unit tests for this component`
|
||||
|
||||
## Workflows
|
||||
|
||||
This action provides several pre-built workflows for different use cases. Each workflow is designed to be copied into your repository's `.github/workflows` directory and customized as needed.
|
||||
|
||||
### Qwen Code Dispatch
|
||||
|
||||
This workflow acts as a central dispatcher for Qwen Code CLI, routing requests to
|
||||
the appropriate workflow based on the triggering event and the command provided
|
||||
in the comment. For a detailed guide on how to set up the dispatch workflow, go
|
||||
to the
|
||||
[Qwen Code Dispatch workflow documentation](./examples/workflows/qwen-dispatch).
|
||||
|
||||
### Issue Triage
|
||||
|
||||
This action can be used to triage GitHub Issues automatically or on a schedule.
|
||||
For a detailed guide on how to set up the issue triage system, go to the
|
||||
[GitHub Issue Triage workflow documentation](./examples/workflows/issue-triage).
|
||||
|
||||
### Pull Request Review
|
||||
|
||||
This action can be used to automatically review pull requests when they are
|
||||
opened. For a detailed guide on how to set up the pull request review system,
|
||||
go to the [GitHub PR Review workflow documentation](./examples/workflows/pr-review).
|
||||
|
||||
### Qwen Code CLI Assistant
|
||||
|
||||
This type of action can be used to invoke a general-purpose, conversational Qwen Code
|
||||
AI assistant within the pull requests and issues to perform a wide range of
|
||||
tasks. For a detailed guide on how to set up the general-purpose Qwen Code CLI workflow,
|
||||
go to the [Qwen Code Assistant workflow documentation](./examples/workflows/qwen-assistant).
|
||||
|
||||
## Configuration
|
||||
|
||||
### Inputs
|
||||
|
||||
<!-- BEGIN_AUTOGEN_INPUTS -->
|
||||
|
||||
- <a name="__input_qwen_api_key"></a><a href="#user-content-__input_qwen_api_key"><code>qwen*api_key</code></a>: *(Optional)\_ The API key for the Qwen API.
|
||||
|
||||
- <a name="__input_qwen_cli_version"></a><a href="#user-content-__input_qwen_cli_version"><code>qwen*cli_version</code></a>: *(Optional, default: `latest`)\_ The version of the Qwen Code CLI to install. Can be "latest", "preview", "nightly", a specific version number, or a git branch, tag, or commit. For more information, see [Qwen Code CLI releases](https://github.com/QwenLM/qwen-code-action/blob/main/docs/releases.md).
|
||||
|
||||
- <a name="__input_qwen_debug"></a><a href="#user-content-__input_qwen_debug"><code>qwen*debug</code></a>: *(Optional)\_ Enable debug logging and output streaming.
|
||||
|
||||
- <a name="__input_qwen_model"></a><a href="#user-content-__input_qwen_model"><code>qwen*model</code></a>: *(Optional)\_ The model to use with Qwen Code.
|
||||
|
||||
- <a name="__input_prompt"></a><a href="#user-content-__input_prompt"><code>prompt</code></a>: _(Optional, default: `You are a helpful assistant.`)_ A string passed to the Qwen Code CLI's [`--prompt` argument](https://github.com/QwenLM/qwen-code-action/blob/main/docs/cli/configuration.md#command-line-arguments).
|
||||
|
||||
- <a name="__input_settings"></a><a href="#user-content-__input_settings"><code>settings</code></a>: _(Optional)_ A JSON string written to `.qwen/settings.json` to configure the CLI's _project_ settings.
|
||||
For more details, see the documentation on [settings files](https://github.com/QwenLM/qwen-code-action/blob/main/docs/cli/configuration.md#settings-files).
|
||||
|
||||
- <a name="__input_use_qwen_code_assist"></a><a href="#user-content-__input_use_qwen_code_assist"><code>use*qwen_code_assist</code></a>: *(Optional, default: `false`)\_ Whether to use Code Assist for Qwen Code model access instead of the default Qwen Code API key.
|
||||
For more information, see the [Qwen Code CLI documentation](https://github.com/QwenLM/qwen-code-action/blob/main/docs/cli/authentication.md).
|
||||
|
||||
- <a name="__input_use_vertex_ai"></a><a href="#user-content-__input_use_vertex_ai"><code>use*vertex_ai</code></a>: *(Optional, default: `false`)\_ Whether to use Vertex AI for Qwen Code model access instead of the default Qwen Code API key.
|
||||
For more information, see the [Qwen Code CLI documentation](https://github.com/QwenLM/qwen-code-action/blob/main/docs/cli/authentication.md).
|
||||
|
||||
- <a name="__input_extensions"></a><a href="#user-content-__input_extensions"><code>extensions</code></a>: _(Optional)_ A list of Qwen Code CLI extensions to install.
|
||||
|
||||
- <a name="__input_upload_artifacts"></a><a href="#user-content-__input_upload_artifacts"><code>upload*artifacts</code></a>: *(Optional, default: `false`)\_ Whether to upload artifacts to the github action.
|
||||
|
||||
- <a name="__input_use_pnpm"></a><a href="#user-content-__input_use_pnpm"><code>use*pnpm</code></a>: *(Optional, default: `false`)\_ Whether or not to use pnpm instead of npm to install qwen-code-cli
|
||||
|
||||
- <a name="__input_workflow_name"></a><a href="#user-content-__input_workflow_name"><code>workflow*name</code></a>: *(Optional, default: `${{ github.workflow }}`)\_ The GitHub workflow name, used for telemetry purposes.
|
||||
|
||||
<!-- END_AUTOGEN_INPUTS -->
|
||||
|
||||
### Outputs
|
||||
|
||||
<!-- BEGIN_AUTOGEN_OUTPUTS -->
|
||||
|
||||
- <a name="__output_summary"></a><a href="#user-content-__output_summary"><code>summary</code></a>: The summarized output from the Qwen Code CLI execution.
|
||||
|
||||
- <a name="__output_error"></a><a href="#user-content-__output_error"><code>error</code></a>: The error output from the Qwen Code CLI execution, if any.
|
||||
|
||||
<!-- END_AUTOGEN_OUTPUTS -->
|
||||
|
||||
### Repository Variables
|
||||
|
||||
We recommend setting the following values as repository variables so they can be reused across all workflows. Alternatively, you can set them inline as action inputs in individual workflows or to override repository-level values.
|
||||
|
||||
| Name | Description | Type | Required | When Required |
|
||||
| ------------------ | --------------------------------------------------------- | -------- | -------- | ------------------------- |
|
||||
| `DEBUG` | Enables debug logging for the Qwen Code CLI. | Variable | No | Never |
|
||||
| `QWEN_CLI_VERSION` | Controls which version of the Qwen Code CLI is installed. | Variable | No | Pinning the CLI version |
|
||||
| `APP_ID` | GitHub App ID for custom authentication. | Variable | No | Using a custom GitHub App |
|
||||
|
||||
To add a repository variable:
|
||||
|
||||
1. Go to your repository's **Settings > Secrets and variables > Actions > New variable**.
|
||||
2. Enter the variable name and value.
|
||||
3. Save.
|
||||
|
||||
For details about repository variables, refer to the [GitHub documentation on variables][variables].
|
||||
|
||||
### Secrets
|
||||
|
||||
You can set the following secrets in your repository:
|
||||
|
||||
| Name | Description | Required | When Required |
|
||||
| ----------------- | --------------------------------------------- | -------- | ------------------------------------------ |
|
||||
| `QWEN_API_KEY` | Your Qwen API key from DashScope. | Yes | Required for all workflows that call Qwen. |
|
||||
| `APP_PRIVATE_KEY` | Private key for your GitHub App (PEM format). | No | Using a custom GitHub App. |
|
||||
|
||||
To add a secret:
|
||||
|
||||
1. Go to your repository's **Settings > Secrets and variables >Actions > New repository secret**.
|
||||
2. Enter the secret name and value.
|
||||
3. Save.
|
||||
|
||||
For more information, refer to the
|
||||
[official GitHub documentation on creating and using encrypted secrets][secrets].
|
||||
|
||||
## Authentication
|
||||
|
||||
This action requires authentication to the GitHub API and optionally to Qwen Code services.
|
||||
|
||||
### GitHub Authentication
|
||||
|
||||
You can authenticate with GitHub in two ways:
|
||||
|
||||
1. **Default `GITHUB_TOKEN`:** For simpler use cases, the action can use the
|
||||
default `GITHUB_TOKEN` provided by the workflow.
|
||||
2. **Custom GitHub App (Recommended):** For the most secure and flexible
|
||||
authentication, we recommend creating a custom GitHub App.
|
||||
|
||||
For detailed setup instructions for both Qwen and GitHub authentication, go to the
|
||||
[**Authentication documentation**](./docs/authentication.md).
|
||||
|
||||
## Extensions
|
||||
|
||||
The Qwen Code CLI can be extended with additional functionality through extensions.
|
||||
These extensions are installed from source from their GitHub repositories.
|
||||
|
||||
For detailed instructions on how to set up and configure extensions, go to the
|
||||
[Extensions documentation](./docs/extensions.md).
|
||||
|
||||
## Best Practices
|
||||
|
||||
To ensure the security, reliability, and efficiency of your automated workflows, we strongly recommend following our best practices. These guidelines cover key areas such as repository security, workflow configuration, and monitoring.
|
||||
|
||||
Key recommendations include:
|
||||
|
||||
- **Securing Your Repository:** Implementing branch and tag protection, and restricting pull request approvers.
|
||||
- **Monitoring and Auditing:** Regularly reviewing action logs and enabling OpenTelemetry for deeper insights into performance and behavior.
|
||||
|
||||
For a comprehensive guide on securing your repository and workflows, please refer to our [**Best Practices documentation**](./docs/best-practices.md).
|
||||
|
||||
## Customization
|
||||
|
||||
Create a [QWEN.md] file in the root of your repository to provide
|
||||
project-specific context and instructions to [Qwen Code CLI]. This is useful for defining
|
||||
coding conventions, architectural patterns, or other guidelines the model should
|
||||
follow for a given repository.
|
||||
|
||||
## Contributing
|
||||
|
||||
Contributions are welcome! Check out the Qwen Code CLI
|
||||
[**Contributing Guide**](./CONTRIBUTING.md) for more details on how to get
|
||||
started.
|
||||
|
||||
[secrets]: https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions
|
||||
[Qwen Code]: https://github.com/QwenLM/qwen-code
|
||||
[DashScope]: https://dashscope.console.aliyun.com/apiKey
|
||||
[Qwen Code CLI]: https://github.com/QwenLM/qwen-code-action/
|
||||
[variables]: https://docs.github.com/en/actions/how-tos/write-workflows/choose-what-workflows-do/use-variables#creating-configuration-variables-for-a-repository
|
||||
[GitHub CLI]: https://docs.github.com/en/github-cli/github-cli
|
||||
[QWEN.md]: https://github.com/QwenLM/qwen-code-action/blob/main/docs/cli/configuration.md#context-files-hierarchical-instructional-context
|
||||
|
||||
Reference in New Issue
Block a user