feat: update references from Gemini to Qwen in setup commands and gitignore handling

This commit is contained in:
DragonnZhang
2025-12-05 16:56:04 +08:00
parent 3e2a2255ee
commit 4a9b05e52d
3 changed files with 31 additions and 27 deletions

View File

@@ -84,7 +84,7 @@ describe('setupGithubCommand', async () => {
const expectedSubstrings = [ const expectedSubstrings = [
`set -eEuo pipefail`, `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) { for (const substring of expectedSubstrings) {
@@ -112,7 +112,7 @@ describe('setupGithubCommand', async () => {
if (gitignoreExists) { if (gitignoreExists) {
const gitignoreContent = await fs.readFile(gitignorePath, 'utf8'); const gitignoreContent = await fs.readFile(gitignorePath, 'utf8');
expect(gitignoreContent).toContain('.gemini/'); expect(gitignoreContent).toContain('.qwen/');
expect(gitignoreContent).toContain('gha-creds-*.json'); expect(gitignoreContent).toContain('gha-creds-*.json');
} }
}); });
@@ -135,7 +135,7 @@ describe('updateGitignore', () => {
const gitignorePath = path.join(scratchDir, '.gitignore'); const gitignorePath = path.join(scratchDir, '.gitignore');
const content = await fs.readFile(gitignorePath, 'utf8'); 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 () => { it('appends entries to existing .gitignore file', async () => {
@@ -148,13 +148,13 @@ describe('updateGitignore', () => {
const content = await fs.readFile(gitignorePath, 'utf8'); const content = await fs.readFile(gitignorePath, 'utf8');
expect(content).toBe( 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 () => { it('does not add duplicate entries', async () => {
const gitignorePath = path.join(scratchDir, '.gitignore'); 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 fs.writeFile(gitignorePath, existingContent);
await updateGitignore(scratchDir); await updateGitignore(scratchDir);
@@ -166,7 +166,7 @@ describe('updateGitignore', () => {
it('adds only missing entries when some already exist', async () => { it('adds only missing entries when some already exist', async () => {
const gitignorePath = path.join(scratchDir, '.gitignore'); 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 fs.writeFile(gitignorePath, existingContent);
await updateGitignore(scratchDir); await updateGitignore(scratchDir);
@@ -174,17 +174,17 @@ describe('updateGitignore', () => {
const content = await fs.readFile(gitignorePath, 'utf8'); const content = await fs.readFile(gitignorePath, 'utf8');
// Should add only the missing gha-creds-*.json entry // 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'); expect(content).toContain('gha-creds-*.json');
// Should not duplicate .gemini/ entry // Should not duplicate .qwen/ entry
expect((content.match(/\.gemini\//g) || []).length).toBe(1); expect((content.match(/\.qwen\//g) || []).length).toBe(1);
}); });
it('does not get confused by entries in comments or as substrings', async () => { it('does not get confused by entries in comments or as substrings', async () => {
const gitignorePath = path.join(scratchDir, '.gitignore'); const gitignorePath = path.join(scratchDir, '.gitignore');
const existingContent = [ const existingContent = [
'# This is a comment mentioning .gemini/ folder', '# This is a comment mentioning .qwen/ folder',
'my-app.gemini/config', 'my-app.qwen/config',
'# Another comment with gha-creds-*.json pattern', '# Another comment with gha-creds-*.json pattern',
'some-other-gha-creds-file.json', 'some-other-gha-creds-file.json',
'', '',
@@ -196,7 +196,7 @@ describe('updateGitignore', () => {
const content = await fs.readFile(gitignorePath, 'utf8'); const content = await fs.readFile(gitignorePath, 'utf8');
// Should add both entries since they don't actually exist as gitignore rules // 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'); expect(content).toContain('gha-creds-*.json');
// Verify the entries were added (not just mentioned in comments) // Verify the entries were added (not just mentioned in comments)
@@ -204,9 +204,9 @@ describe('updateGitignore', () => {
.split('\n') .split('\n')
.map((line) => line.split('#')[0].trim()) .map((line) => line.split('#')[0].trim())
.filter((line) => line); .filter((line) => line);
expect(lines).toContain('.gemini/'); expect(lines).toContain('.qwen/');
expect(lines).toContain('gha-creds-*.json'); 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'); expect(lines).toContain('some-other-gha-creds-file.json');
}); });

View File

@@ -23,11 +23,11 @@ import { getUrlOpenCommand } from '../../ui/utils/commandUtils.js';
import { t } from '../../i18n/index.js'; import { t } from '../../i18n/index.js';
export const GITHUB_WORKFLOW_PATHS = [ export const GITHUB_WORKFLOW_PATHS = [
'gemini-dispatch/gemini-dispatch.yml', 'qwen-dispatch/qwen-dispatch.yml',
'gemini-assistant/gemini-invoke.yml', 'qwen-assistant/qwen-invoke.yml',
'issue-triage/gemini-triage.yml', 'issue-triage/qwen-triage.yml',
'issue-triage/gemini-scheduled-triage.yml', 'issue-triage/qwen-scheduled-triage.yml',
'pr-review/gemini-review.yml', 'pr-review/qwen-review.yml',
]; ];
// Generate OS-specific commands to open the GitHub pages needed for setup. // Generate OS-specific commands to open the GitHub pages needed for setup.
@@ -50,9 +50,9 @@ function getOpenUrlsCommands(readmeUrl: string): string[] {
return commands; 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<void> { export async function updateGitignore(gitRepoRoot: string): Promise<void> {
const gitignoreEntries = ['.gemini/', 'gha-creds-*.json']; const gitignoreEntries = ['.qwen/', 'gha-creds-*.json'];
const gitignorePath = path.join(gitRepoRoot, '.gitignore'); const gitignorePath = path.join(gitRepoRoot, '.gitignore');
try { try {
@@ -121,7 +121,7 @@ export const setupGithubCommand: SlashCommand = {
// Get the latest release tag from GitHub // Get the latest release tag from GitHub
const proxy = context?.services?.config?.getProxy(); const proxy = context?.services?.config?.getProxy();
const releaseTag = await getLatestGitHubRelease(proxy); 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 // Create the .github/workflows directory to download the files into
const githubWorkflowsDir = path.join(gitRepoRoot, '.github', 'workflows'); const githubWorkflowsDir = path.join(gitRepoRoot, '.github', 'workflows');
@@ -143,7 +143,7 @@ export const setupGithubCommand: SlashCommand = {
for (const workflow of GITHUB_WORKFLOW_PATHS) { for (const workflow of GITHUB_WORKFLOW_PATHS) {
downloads.push( downloads.push(
(async () => { (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, { const response = await fetch(endpoint, {
method: 'GET', method: 'GET',
dispatcher: proxy ? new ProxyAgent(proxy) : undefined, dispatcher: proxy ? new ProxyAgent(proxy) : undefined,
@@ -204,8 +204,9 @@ export const setupGithubCommand: SlashCommand = {
toolName: 'run_shell_command', toolName: 'run_shell_command',
toolArgs: { toolArgs: {
description: 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, command,
is_background: false,
}, },
}; };
}, },

View File

@@ -58,7 +58,7 @@ export const getLatestGitHubRelease = async (
try { try {
const controller = new AbortController(); 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, { const response = await fetch(endpoint, {
method: 'GET', method: 'GET',
@@ -83,9 +83,12 @@ export const getLatestGitHubRelease = async (
} }
return releaseTag; return releaseTag;
} catch (_error) { } 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( 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.`,
); );
} }
}; };