mirror of
https://github.com/garrytan/gbrain.git
synced 2026-07-28 14:59:47 +00:00
Two related corrections: 1. `gbrain query --no-expand` parsed `--no-expand` as the literal key `no_expand` instead of negating the boolean `expand` param. Result: the flag was silently ignored and expansion always ran. Now any `--no-<key>` where `<key>` is a boolean param flips it false. 2. The `query` op's source-id resolution treated `ctx.sourceId` as authoritative, so an explicit per-call `source_id` was overridden by the federated read scope. Now per-call `source_id` wins; `source_id=__all__` is an explicit opt-out for local cross-source search. Cherry-picked from PR #1124. Co-Authored-By: hnshah <hnshah@users.noreply.github.com>
25 lines
665 B
TypeScript
25 lines
665 B
TypeScript
import { describe, expect, test } from 'bun:test';
|
|
import { parseOpArgs } from '../src/cli.ts';
|
|
import { operationsByName } from '../src/core/operations.ts';
|
|
|
|
describe('parseOpArgs', () => {
|
|
test('--no-<boolean> maps to false without consuming the next flag', () => {
|
|
const params = parseOpArgs(operationsByName.query, [
|
|
'freshEmbedSourceScope code source',
|
|
'--limit',
|
|
'8',
|
|
'--no-expand',
|
|
'--source-id',
|
|
'gstack-code-repo-0e4763c9',
|
|
]);
|
|
|
|
expect(params).toEqual({
|
|
query: 'freshEmbedSourceScope code source',
|
|
limit: 8,
|
|
expand: false,
|
|
source_id: 'gstack-code-repo-0e4763c9',
|
|
});
|
|
});
|
|
});
|
|
|