mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-16 09:01:17 -07:00
Allow @-includes outside of workspaces (with permission) (#18470)
This commit is contained in:
committed by
GitHub
parent
e73288f25f
commit
262e8384d4
@@ -1188,40 +1188,6 @@ describe('handleAtCommand', () => {
|
||||
expect.stringContaining(`using glob: ${path.join(subDirPath, '**')}`),
|
||||
);
|
||||
});
|
||||
|
||||
it('should skip absolute paths outside workspace', async () => {
|
||||
const outsidePath = '/tmp/outside-workspace.txt';
|
||||
const query = `Check @${outsidePath} please.`;
|
||||
|
||||
const mockWorkspaceContext = {
|
||||
isPathWithinWorkspace: vi.fn((path: string) =>
|
||||
path.startsWith(testRootDir),
|
||||
),
|
||||
getDirectories: () => [testRootDir],
|
||||
addDirectory: vi.fn(),
|
||||
getInitialDirectories: () => [testRootDir],
|
||||
setDirectories: vi.fn(),
|
||||
onDirectoriesChanged: vi.fn(() => () => {}),
|
||||
} as unknown as ReturnType<typeof mockConfig.getWorkspaceContext>;
|
||||
mockConfig.getWorkspaceContext = () => mockWorkspaceContext;
|
||||
|
||||
const result = await handleAtCommand({
|
||||
query,
|
||||
config: mockConfig,
|
||||
addItem: mockAddItem,
|
||||
onDebugMessage: mockOnDebugMessage,
|
||||
messageId: 502,
|
||||
signal: abortController.signal,
|
||||
});
|
||||
|
||||
expect(result).toEqual({
|
||||
processedQuery: [{ text: `Check @${outsidePath} please.` }],
|
||||
});
|
||||
|
||||
expect(mockOnDebugMessage).toHaveBeenCalledWith(
|
||||
`Path ${outsidePath} is not in the workspace and will be skipped.`,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
it("should not add the user's turn to history, as that is the caller's responsibility", async () => {
|
||||
|
||||
Reference in New Issue
Block a user