parent
3453b977b8
commit
30d1662128
|
@ -123,7 +123,7 @@ async function parseArguments(): Promise<CliArgs> {
|
||||||
description: 'Enables checkpointing of file edits',
|
description: 'Enables checkpointing of file edits',
|
||||||
default: false,
|
default: false,
|
||||||
})
|
})
|
||||||
.version(getCliVersion()) // This will enable the --version flag based on package.json
|
.version(await getCliVersion()) // This will enable the --version flag based on package.json
|
||||||
.alias('v', 'version')
|
.alias('v', 'version')
|
||||||
.help()
|
.help()
|
||||||
.alias('h', 'help')
|
.alias('h', 'help')
|
||||||
|
|
|
@ -48,7 +48,7 @@ vi.mock('node:fs/promises', () => ({
|
||||||
mkdir: vi.fn(),
|
mkdir: vi.fn(),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const mockGetCliVersionFn = vi.fn(() => '0.1.0');
|
const mockGetCliVersionFn = vi.fn(() => Promise.resolve('0.1.0'));
|
||||||
vi.mock('../../utils/version.js', () => ({
|
vi.mock('../../utils/version.js', () => ({
|
||||||
getCliVersion: (...args: []) => mockGetCliVersionFn(...args),
|
getCliVersion: (...args: []) => mockGetCliVersionFn(...args),
|
||||||
}));
|
}));
|
||||||
|
@ -377,7 +377,7 @@ describe('useSlashCommandProcessor', () => {
|
||||||
const originalEnv = process.env;
|
const originalEnv = process.env;
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
vi.resetModules();
|
vi.resetModules();
|
||||||
mockGetCliVersionFn.mockReturnValue('0.1.0');
|
mockGetCliVersionFn.mockResolvedValue('0.1.0');
|
||||||
process.env = { ...originalEnv };
|
process.env = { ...originalEnv };
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -427,7 +427,7 @@ Add any other context about the problem here.
|
||||||
};
|
};
|
||||||
|
|
||||||
it('should call open with the correct GitHub issue URL and return true', async () => {
|
it('should call open with the correct GitHub issue URL and return true', async () => {
|
||||||
mockGetCliVersionFn.mockReturnValue('test-version');
|
mockGetCliVersionFn.mockResolvedValue('test-version');
|
||||||
process.env.SANDBOX = 'gemini-sandbox';
|
process.env.SANDBOX = 'gemini-sandbox';
|
||||||
process.env.SEATBELT_PROFILE = 'test_profile';
|
process.env.SEATBELT_PROFILE = 'test_profile';
|
||||||
const { handleSlashCommand } = getProcessor();
|
const { handleSlashCommand } = getProcessor();
|
||||||
|
|
|
@ -518,7 +518,7 @@ export const useSlashCommandProcessor = (
|
||||||
{
|
{
|
||||||
name: 'about',
|
name: 'about',
|
||||||
description: 'show version info',
|
description: 'show version info',
|
||||||
action: (_mainCommand, _subCommand, _args) => {
|
action: async (_mainCommand, _subCommand, _args) => {
|
||||||
const osVersion = process.platform;
|
const osVersion = process.platform;
|
||||||
let sandboxEnv = 'no sandbox';
|
let sandboxEnv = 'no sandbox';
|
||||||
if (process.env.SANDBOX && process.env.SANDBOX !== 'sandbox-exec') {
|
if (process.env.SANDBOX && process.env.SANDBOX !== 'sandbox-exec') {
|
||||||
|
@ -529,7 +529,7 @@ export const useSlashCommandProcessor = (
|
||||||
})`;
|
})`;
|
||||||
}
|
}
|
||||||
const modelVersion = config?.getModel() || 'Unknown';
|
const modelVersion = config?.getModel() || 'Unknown';
|
||||||
const cliVersion = getCliVersion();
|
const cliVersion = await getCliVersion();
|
||||||
addMessage({
|
addMessage({
|
||||||
type: MessageType.ABOUT,
|
type: MessageType.ABOUT,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
|
@ -543,7 +543,7 @@ export const useSlashCommandProcessor = (
|
||||||
{
|
{
|
||||||
name: 'bug',
|
name: 'bug',
|
||||||
description: 'submit a bug report',
|
description: 'submit a bug report',
|
||||||
action: (_mainCommand, _subCommand, args) => {
|
action: async (_mainCommand, _subCommand, args) => {
|
||||||
let bugDescription = _subCommand || '';
|
let bugDescription = _subCommand || '';
|
||||||
if (args) {
|
if (args) {
|
||||||
bugDescription += ` ${args}`;
|
bugDescription += ` ${args}`;
|
||||||
|
@ -560,8 +560,8 @@ export const useSlashCommandProcessor = (
|
||||||
})`;
|
})`;
|
||||||
}
|
}
|
||||||
const modelVersion = config?.getModel() || 'Unknown';
|
const modelVersion = config?.getModel() || 'Unknown';
|
||||||
|
const cliVersion = await getCliVersion();
|
||||||
const memoryUsage = formatMemoryUsage(process.memoryUsage().rss);
|
const memoryUsage = formatMemoryUsage(process.memoryUsage().rss);
|
||||||
const cliVersion = getCliVersion();
|
|
||||||
|
|
||||||
const diagnosticInfo = `
|
const diagnosticInfo = `
|
||||||
## Describe the bug
|
## Describe the bug
|
||||||
|
|
|
@ -4,6 +4,9 @@
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export function getCliVersion(): string {
|
import { getPackageJson } from './package.js';
|
||||||
return process.env.CLI_VERSION || 'unknown';
|
|
||||||
|
export async function getCliVersion(): Promise<string> {
|
||||||
|
const pkgJson = await getPackageJson();
|
||||||
|
return process.env.CLI_VERSION || pkgJson?.version || 'unknown';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue