From d06a6d7ef9844d9c8ad2018d09458a565ef0c9b8 Mon Sep 17 00:00:00 2001 From: TianHao Zhang <52599892+DragonnZhang@users.noreply.github.com> Date: Thu, 11 Dec 2025 14:09:22 +0800 Subject: [PATCH] feat: update references from Gemini to Qwen in setup commands and gitignore handling (#1156) --- .../ui/commands/setupGithubCommand.test.ts | 28 +++++++++---------- .../cli/src/ui/commands/setupGithubCommand.ts | 21 +++++++------- packages/cli/src/utils/gitUtils.ts | 9 ++++-- 3 files changed, 31 insertions(+), 27 deletions(-) diff --git a/packages/cli/src/ui/commands/setupGithubCommand.test.ts b/packages/cli/src/ui/commands/setupGithubCommand.test.ts index bac02070..6f0faae3 100644 --- a/packages/cli/src/ui/commands/setupGithubCommand.test.ts +++ b/packages/cli/src/ui/commands/setupGithubCommand.test.ts @@ -84,7 +84,7 @@ describe('setupGithubCommand', async () => { const expectedSubstrings = [ `set -eEuo pipefail`, - `fakeOpenCommand "https://github.com/google-github-actions/run-gemini-cli`, + `fakeOpenCommand "https://github.com/QwenLM/qwen-code-action`, ]; for (const substring of expectedSubstrings) { @@ -112,7 +112,7 @@ describe('setupGithubCommand', async () => { if (gitignoreExists) { const gitignoreContent = await fs.readFile(gitignorePath, 'utf8'); - expect(gitignoreContent).toContain('.gemini/'); + expect(gitignoreContent).toContain('.qwen/'); expect(gitignoreContent).toContain('gha-creds-*.json'); } }); @@ -135,7 +135,7 @@ describe('updateGitignore', () => { const gitignorePath = path.join(scratchDir, '.gitignore'); const content = await fs.readFile(gitignorePath, 'utf8'); - expect(content).toBe('.gemini/\ngha-creds-*.json\n'); + expect(content).toBe('.qwen/\ngha-creds-*.json\n'); }); it('appends entries to existing .gitignore file', async () => { @@ -148,13 +148,13 @@ describe('updateGitignore', () => { const content = await fs.readFile(gitignorePath, 'utf8'); expect(content).toBe( - '# Existing content\nnode_modules/\n\n.gemini/\ngha-creds-*.json\n', + '# Existing content\nnode_modules/\n\n.qwen/\ngha-creds-*.json\n', ); }); it('does not add duplicate entries', async () => { const gitignorePath = path.join(scratchDir, '.gitignore'); - const existingContent = '.gemini/\nsome-other-file\ngha-creds-*.json\n'; + const existingContent = '.qwen/\nsome-other-file\ngha-creds-*.json\n'; await fs.writeFile(gitignorePath, existingContent); await updateGitignore(scratchDir); @@ -166,7 +166,7 @@ describe('updateGitignore', () => { it('adds only missing entries when some already exist', async () => { const gitignorePath = path.join(scratchDir, '.gitignore'); - const existingContent = '.gemini/\nsome-other-file\n'; + const existingContent = '.qwen/\nsome-other-file\n'; await fs.writeFile(gitignorePath, existingContent); await updateGitignore(scratchDir); @@ -174,17 +174,17 @@ describe('updateGitignore', () => { const content = await fs.readFile(gitignorePath, 'utf8'); // Should add only the missing gha-creds-*.json entry - expect(content).toBe('.gemini/\nsome-other-file\n\ngha-creds-*.json\n'); + expect(content).toBe('.qwen/\nsome-other-file\n\ngha-creds-*.json\n'); expect(content).toContain('gha-creds-*.json'); - // Should not duplicate .gemini/ entry - expect((content.match(/\.gemini\//g) || []).length).toBe(1); + // Should not duplicate .qwen/ entry + expect((content.match(/\.qwen\//g) || []).length).toBe(1); }); it('does not get confused by entries in comments or as substrings', async () => { const gitignorePath = path.join(scratchDir, '.gitignore'); const existingContent = [ - '# This is a comment mentioning .gemini/ folder', - 'my-app.gemini/config', + '# This is a comment mentioning .qwen/ folder', + 'my-app.qwen/config', '# Another comment with gha-creds-*.json pattern', 'some-other-gha-creds-file.json', '', @@ -196,7 +196,7 @@ describe('updateGitignore', () => { const content = await fs.readFile(gitignorePath, 'utf8'); // Should add both entries since they don't actually exist as gitignore rules - expect(content).toContain('.gemini/'); + expect(content).toContain('.qwen/'); expect(content).toContain('gha-creds-*.json'); // Verify the entries were added (not just mentioned in comments) @@ -204,9 +204,9 @@ describe('updateGitignore', () => { .split('\n') .map((line) => line.split('#')[0].trim()) .filter((line) => line); - expect(lines).toContain('.gemini/'); + expect(lines).toContain('.qwen/'); expect(lines).toContain('gha-creds-*.json'); - expect(lines).toContain('my-app.gemini/config'); + expect(lines).toContain('my-app.qwen/config'); expect(lines).toContain('some-other-gha-creds-file.json'); }); diff --git a/packages/cli/src/ui/commands/setupGithubCommand.ts b/packages/cli/src/ui/commands/setupGithubCommand.ts index 378f1101..b12268ed 100644 --- a/packages/cli/src/ui/commands/setupGithubCommand.ts +++ b/packages/cli/src/ui/commands/setupGithubCommand.ts @@ -23,11 +23,11 @@ import { getUrlOpenCommand } from '../../ui/utils/commandUtils.js'; import { t } from '../../i18n/index.js'; export const GITHUB_WORKFLOW_PATHS = [ - 'gemini-dispatch/gemini-dispatch.yml', - 'gemini-assistant/gemini-invoke.yml', - 'issue-triage/gemini-triage.yml', - 'issue-triage/gemini-scheduled-triage.yml', - 'pr-review/gemini-review.yml', + 'qwen-dispatch/qwen-dispatch.yml', + 'qwen-assistant/qwen-invoke.yml', + 'issue-triage/qwen-triage.yml', + 'issue-triage/qwen-scheduled-triage.yml', + 'pr-review/qwen-review.yml', ]; // Generate OS-specific commands to open the GitHub pages needed for setup. @@ -50,9 +50,9 @@ function getOpenUrlsCommands(readmeUrl: string): string[] { return commands; } -// Add Gemini CLI specific entries to .gitignore file +// Add Qwen Code specific entries to .gitignore file export async function updateGitignore(gitRepoRoot: string): Promise { - const gitignoreEntries = ['.gemini/', 'gha-creds-*.json']; + const gitignoreEntries = ['.qwen/', 'gha-creds-*.json']; const gitignorePath = path.join(gitRepoRoot, '.gitignore'); try { @@ -121,7 +121,7 @@ export const setupGithubCommand: SlashCommand = { // Get the latest release tag from GitHub const proxy = context?.services?.config?.getProxy(); const releaseTag = await getLatestGitHubRelease(proxy); - const readmeUrl = `https://github.com/google-github-actions/run-gemini-cli/blob/${releaseTag}/README.md#quick-start`; + const readmeUrl = `https://github.com/QwenLM/qwen-code-action/blob/${releaseTag}/README.md#quick-start`; // Create the .github/workflows directory to download the files into const githubWorkflowsDir = path.join(gitRepoRoot, '.github', 'workflows'); @@ -143,7 +143,7 @@ export const setupGithubCommand: SlashCommand = { for (const workflow of GITHUB_WORKFLOW_PATHS) { downloads.push( (async () => { - const endpoint = `https://raw.githubusercontent.com/google-github-actions/run-gemini-cli/refs/tags/${releaseTag}/examples/workflows/${workflow}`; + const endpoint = `https://raw.githubusercontent.com/QwenLM/qwen-code-action/refs/tags/${releaseTag}/examples/workflows/${workflow}`; const response = await fetch(endpoint, { method: 'GET', dispatcher: proxy ? new ProxyAgent(proxy) : undefined, @@ -204,8 +204,9 @@ export const setupGithubCommand: SlashCommand = { toolName: 'run_shell_command', toolArgs: { description: - 'Setting up GitHub Actions to triage issues and review PRs with Gemini.', + 'Setting up GitHub Actions to triage issues and review PRs with Qwen.', command, + is_background: false, }, }; }, diff --git a/packages/cli/src/utils/gitUtils.ts b/packages/cli/src/utils/gitUtils.ts index 11cf729b..35f58210 100644 --- a/packages/cli/src/utils/gitUtils.ts +++ b/packages/cli/src/utils/gitUtils.ts @@ -58,7 +58,7 @@ export const getLatestGitHubRelease = async ( try { const controller = new AbortController(); - const endpoint = `https://api.github.com/repos/google-github-actions/run-gemini-cli/releases/latest`; + const endpoint = `https://api.github.com/repos/QwenLM/qwen-code-action/releases/latest`; const response = await fetch(endpoint, { method: 'GET', @@ -83,9 +83,12 @@ export const getLatestGitHubRelease = async ( } return releaseTag; } catch (_error) { - console.debug(`Failed to determine latest run-gemini-cli release:`, _error); + console.debug( + `Failed to determine latest qwen-code-action release:`, + _error, + ); throw new Error( - `Unable to determine the latest run-gemini-cli release on GitHub.`, + `Unable to determine the latest qwen-code-action release on GitHub.`, ); } };