@google/gemini-cli 0.11.0-nightly.20251020.a96f0659 → 0.11.0-nightly.20251021.e72c00cf
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/google-gemini-cli-0.11.0-nightly.20251020.a96f0659.tgz +0 -0
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/package.json +2 -2
- package/dist/src/commands/extensions/disable.js +8 -5
- package/dist/src/commands/extensions/disable.js.map +1 -1
- package/dist/src/commands/extensions/enable.js +5 -3
- package/dist/src/commands/extensions/enable.js.map +1 -1
- package/dist/src/commands/extensions/install.js +5 -4
- package/dist/src/commands/extensions/install.js.map +1 -1
- package/dist/src/commands/extensions/link.js +3 -2
- package/dist/src/commands/extensions/link.js.map +1 -1
- package/dist/src/commands/extensions/list.js +4 -3
- package/dist/src/commands/extensions/list.js.map +1 -1
- package/dist/src/commands/extensions/new.js +14 -20
- package/dist/src/commands/extensions/new.js.map +1 -1
- package/dist/src/commands/extensions/uninstall.js +3 -2
- package/dist/src/commands/extensions/uninstall.js.map +1 -1
- package/dist/src/commands/extensions/update.js +16 -16
- package/dist/src/commands/extensions/update.js.map +1 -1
- package/dist/src/commands/mcp/add.js +7 -4
- package/dist/src/commands/mcp/add.js.map +1 -1
- package/dist/src/commands/mcp/add.test.js +13 -3
- package/dist/src/commands/mcp/add.test.js.map +1 -1
- package/dist/src/commands/mcp/list.js +2 -2
- package/dist/src/commands/mcp/list.js.map +1 -1
- package/dist/src/config/config.d.ts +2 -3
- package/dist/src/config/config.integration.test.js +0 -30
- package/dist/src/config/config.integration.test.js.map +1 -1
- package/dist/src/config/config.js +21 -28
- package/dist/src/config/config.js.map +1 -1
- package/dist/src/config/config.test.js +109 -149
- package/dist/src/config/config.test.js.map +1 -1
- package/dist/src/config/extension.d.ts +3 -11
- package/dist/src/config/extension.js +24 -32
- package/dist/src/config/extension.js.map +1 -1
- package/dist/src/config/extension.test.js +33 -133
- package/dist/src/config/extension.test.js.map +1 -1
- package/dist/src/config/extensions/github.d.ts +3 -2
- package/dist/src/config/extensions/github.js +12 -9
- package/dist/src/config/extensions/github.js.map +1 -1
- package/dist/src/config/extensions/github.test.js +6 -5
- package/dist/src/config/extensions/github.test.js.map +1 -1
- package/dist/src/config/extensions/update.d.ts +5 -4
- package/dist/src/config/extensions/update.js +10 -6
- package/dist/src/config/extensions/update.js.map +1 -1
- package/dist/src/config/extensions/update.test.js +57 -57
- package/dist/src/config/extensions/update.test.js.map +1 -1
- package/dist/src/config/extensions/variableSchema.d.ts +2 -0
- package/dist/src/config/extensions/variableSchema.js.map +1 -1
- package/dist/src/config/policy.d.ts +3 -2
- package/dist/src/config/policy.js +20 -10
- package/dist/src/config/policy.js.map +1 -1
- package/dist/src/config/policy.test.js +58 -34
- package/dist/src/config/policy.test.js.map +1 -1
- package/dist/src/config/settings.js +3 -1
- package/dist/src/config/settings.js.map +1 -1
- package/dist/src/config/settings.test.js +9 -9
- package/dist/src/config/settings.test.js.map +1 -1
- package/dist/src/gemini.js +19 -15
- package/dist/src/gemini.js.map +1 -1
- package/dist/src/gemini.test.js +8 -0
- package/dist/src/gemini.test.js.map +1 -1
- package/dist/src/generated/git-commit.d.ts +2 -2
- package/dist/src/generated/git-commit.js +2 -2
- package/dist/src/nonInteractiveCli.js +2 -2
- package/dist/src/nonInteractiveCli.js.map +1 -1
- package/dist/src/services/prompt-processors/atFileProcessor.js +3 -2
- package/dist/src/services/prompt-processors/atFileProcessor.js.map +1 -1
- package/dist/src/ui/AppContainer.js +4 -2
- package/dist/src/ui/AppContainer.js.map +1 -1
- package/dist/src/ui/commands/directoryCommand.js +1 -1
- package/dist/src/ui/commands/directoryCommand.js.map +1 -1
- package/dist/src/ui/commands/directoryCommand.test.js +0 -1
- package/dist/src/ui/commands/directoryCommand.test.js.map +1 -1
- package/dist/src/ui/commands/memoryCommand.js +1 -1
- package/dist/src/ui/commands/memoryCommand.js.map +1 -1
- package/dist/src/ui/commands/memoryCommand.test.js +1 -1
- package/dist/src/ui/commands/memoryCommand.test.js.map +1 -1
- package/dist/src/ui/components/SettingsDialog.test.js +1 -20
- package/dist/src/ui/components/SettingsDialog.test.js.map +1 -1
- package/dist/src/ui/components/views/ExtensionsList.js +3 -4
- package/dist/src/ui/components/views/ExtensionsList.js.map +1 -1
- package/dist/src/ui/components/views/ExtensionsList.test.js +2 -9
- package/dist/src/ui/components/views/ExtensionsList.test.js.map +1 -1
- package/dist/src/ui/components/views/McpStatus.js +2 -2
- package/dist/src/ui/components/views/McpStatus.js.map +1 -1
- package/dist/src/ui/hooks/useExtensionUpdates.d.ts +2 -1
- package/dist/src/ui/hooks/useExtensionUpdates.js +5 -3
- package/dist/src/ui/hooks/useExtensionUpdates.js.map +1 -1
- package/dist/src/ui/hooks/useExtensionUpdates.test.js +22 -13
- package/dist/src/ui/hooks/useExtensionUpdates.test.js.map +1 -1
- package/dist/src/ui/utils/computeStats.js +5 -2
- package/dist/src/ui/utils/computeStats.js.map +1 -1
- package/dist/src/ui/utils/computeStats.test.d.ts +6 -0
- package/dist/src/ui/utils/computeStats.test.js +262 -0
- package/dist/src/ui/utils/computeStats.test.js.map +1 -0
- package/dist/src/utils/cleanup.test.d.ts +6 -0
- package/dist/src/utils/cleanup.test.js +49 -0
- package/dist/src/utils/cleanup.test.js.map +1 -0
- package/dist/src/utils/handleAutoUpdate.test.d.ts +6 -0
- package/dist/src/utils/handleAutoUpdate.test.js +225 -0
- package/dist/src/utils/handleAutoUpdate.test.js.map +1 -0
- package/dist/src/utils/sandbox-macos-permissive-open.sb +3 -1
- package/dist/src/utils/startupWarnings.test.d.ts +6 -0
- package/dist/src/utils/startupWarnings.test.js +61 -0
- package/dist/src/utils/startupWarnings.test.js.map +1 -0
- package/dist/src/validateNonInterActiveAuth.js +2 -2
- package/dist/src/validateNonInterActiveAuth.js.map +1 -1
- package/dist/src/zed-integration/zedIntegration.js +1 -2
- package/dist/src/zed-integration/zedIntegration.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/dist/google-gemini-cli-0.11.0-nightly.20251015.203bad7c.tgz +0 -0
|
@@ -10,7 +10,6 @@ import { DEFAULT_GEMINI_MODEL, DEFAULT_GEMINI_MODEL_AUTO, OutputFormat, SHELL_TO
|
|
|
10
10
|
import { loadCliConfig, parseArguments } from './config.js';
|
|
11
11
|
import * as ServerConfig from '@google/gemini-cli-core';
|
|
12
12
|
import { isWorkspaceTrusted } from './trustedFolders.js';
|
|
13
|
-
import { ExtensionEnablementManager } from './extensions/extensionEnablement.js';
|
|
14
13
|
vi.mock('./trustedFolders.js', () => ({
|
|
15
14
|
isWorkspaceTrusted: vi
|
|
16
15
|
.fn()
|
|
@@ -420,7 +419,7 @@ describe('loadCliConfig', () => {
|
|
|
420
419
|
process.argv = ['node', 'script.js'];
|
|
421
420
|
const argv = await parseArguments({});
|
|
422
421
|
const settings = {};
|
|
423
|
-
const config = await loadCliConfig(settings, [],
|
|
422
|
+
const config = await loadCliConfig(settings, [], 'test-session', argv);
|
|
424
423
|
expect(config.getProxy()).toBeFalsy();
|
|
425
424
|
});
|
|
426
425
|
const proxy_url = 'http://localhost:7890';
|
|
@@ -460,7 +459,7 @@ describe('loadCliConfig', () => {
|
|
|
460
459
|
process.argv = ['node', 'script.js'];
|
|
461
460
|
const argv = await parseArguments({});
|
|
462
461
|
const settings = {};
|
|
463
|
-
const config = await loadCliConfig(settings, [],
|
|
462
|
+
const config = await loadCliConfig(settings, [], 'test-session', argv);
|
|
464
463
|
expect(config.getProxy()).toBe(expected);
|
|
465
464
|
});
|
|
466
465
|
});
|
|
@@ -505,12 +504,8 @@ describe('Hierarchical Memory Loading (config.ts) - Placeholder Suite', () => {
|
|
|
505
504
|
},
|
|
506
505
|
];
|
|
507
506
|
const argv = await parseArguments({});
|
|
508
|
-
await loadCliConfig(settings, extensions,
|
|
509
|
-
expect(ServerConfig.loadServerHierarchicalMemory).toHaveBeenCalledWith(expect.any(String), [], false, expect.any(Object),
|
|
510
|
-
'/path/to/ext1/GEMINI.md',
|
|
511
|
-
'/path/to/ext3/context1.md',
|
|
512
|
-
'/path/to/ext3/context2.md',
|
|
513
|
-
], true, 'tree', {
|
|
507
|
+
await loadCliConfig(settings, extensions, 'session-id', argv);
|
|
508
|
+
expect(ServerConfig.loadServerHierarchicalMemory).toHaveBeenCalledWith(expect.any(String), [], false, expect.any(Object), extensions, true, 'tree', {
|
|
514
509
|
respectGitIgnore: false,
|
|
515
510
|
respectGeminiIgnore: true,
|
|
516
511
|
}, undefined);
|
|
@@ -574,7 +569,7 @@ describe('mergeMcpServers', () => {
|
|
|
574
569
|
const originalSettings = JSON.parse(JSON.stringify(settings));
|
|
575
570
|
process.argv = ['node', 'script.js'];
|
|
576
571
|
const argv = await parseArguments({});
|
|
577
|
-
await loadCliConfig(settings, extensions,
|
|
572
|
+
await loadCliConfig(settings, extensions, 'test-session', argv);
|
|
578
573
|
expect(settings).toEqual(originalSettings);
|
|
579
574
|
});
|
|
580
575
|
});
|
|
@@ -613,7 +608,7 @@ describe('mergeExcludeTools', () => {
|
|
|
613
608
|
];
|
|
614
609
|
process.argv = ['node', 'script.js'];
|
|
615
610
|
const argv = await parseArguments({});
|
|
616
|
-
const config = await loadCliConfig(settings, extensions,
|
|
611
|
+
const config = await loadCliConfig(settings, extensions, 'test-session', argv);
|
|
617
612
|
expect(config.getExcludeTools()).toEqual(expect.arrayContaining(['tool1', 'tool2', 'tool3', 'tool4', 'tool5']));
|
|
618
613
|
expect(config.getExcludeTools()).toHaveLength(5);
|
|
619
614
|
});
|
|
@@ -631,7 +626,7 @@ describe('mergeExcludeTools', () => {
|
|
|
631
626
|
];
|
|
632
627
|
process.argv = ['node', 'script.js'];
|
|
633
628
|
const argv = await parseArguments({});
|
|
634
|
-
const config = await loadCliConfig(settings, extensions,
|
|
629
|
+
const config = await loadCliConfig(settings, extensions, 'test-session', argv);
|
|
635
630
|
expect(config.getExcludeTools()).toEqual(expect.arrayContaining(['tool1', 'tool2', 'tool3']));
|
|
636
631
|
expect(config.getExcludeTools()).toHaveLength(3);
|
|
637
632
|
});
|
|
@@ -657,7 +652,7 @@ describe('mergeExcludeTools', () => {
|
|
|
657
652
|
];
|
|
658
653
|
process.argv = ['node', 'script.js'];
|
|
659
654
|
const argv = await parseArguments({});
|
|
660
|
-
const config = await loadCliConfig(settings, extensions,
|
|
655
|
+
const config = await loadCliConfig(settings, extensions, 'test-session', argv);
|
|
661
656
|
expect(config.getExcludeTools()).toEqual(expect.arrayContaining(['tool1', 'tool2', 'tool3', 'tool4']));
|
|
662
657
|
expect(config.getExcludeTools()).toHaveLength(4);
|
|
663
658
|
});
|
|
@@ -667,7 +662,7 @@ describe('mergeExcludeTools', () => {
|
|
|
667
662
|
const extensions = [];
|
|
668
663
|
process.argv = ['node', 'script.js'];
|
|
669
664
|
const argv = await parseArguments({});
|
|
670
|
-
const config = await loadCliConfig(settings, extensions,
|
|
665
|
+
const config = await loadCliConfig(settings, extensions, 'test-session', argv);
|
|
671
666
|
expect(config.getExcludeTools()).toEqual([]);
|
|
672
667
|
});
|
|
673
668
|
it('should return default excludes when no excludeTools are specified and it is not interactive', async () => {
|
|
@@ -676,7 +671,7 @@ describe('mergeExcludeTools', () => {
|
|
|
676
671
|
const extensions = [];
|
|
677
672
|
process.argv = ['node', 'script.js', '-p', 'test'];
|
|
678
673
|
const argv = await parseArguments({});
|
|
679
|
-
const config = await loadCliConfig(settings, extensions,
|
|
674
|
+
const config = await loadCliConfig(settings, extensions, 'test-session', argv);
|
|
680
675
|
expect(config.getExcludeTools()).toEqual(defaultExcludes);
|
|
681
676
|
});
|
|
682
677
|
it('should handle settings with excludeTools but no extensions', async () => {
|
|
@@ -684,7 +679,7 @@ describe('mergeExcludeTools', () => {
|
|
|
684
679
|
const argv = await parseArguments({});
|
|
685
680
|
const settings = { tools: { exclude: ['tool1', 'tool2'] } };
|
|
686
681
|
const extensions = [];
|
|
687
|
-
const config = await loadCliConfig(settings, extensions,
|
|
682
|
+
const config = await loadCliConfig(settings, extensions, 'test-session', argv);
|
|
688
683
|
expect(config.getExcludeTools()).toEqual(expect.arrayContaining(['tool1', 'tool2']));
|
|
689
684
|
expect(config.getExcludeTools()).toHaveLength(2);
|
|
690
685
|
});
|
|
@@ -702,7 +697,7 @@ describe('mergeExcludeTools', () => {
|
|
|
702
697
|
];
|
|
703
698
|
process.argv = ['node', 'script.js'];
|
|
704
699
|
const argv = await parseArguments({});
|
|
705
|
-
const config = await loadCliConfig(settings, extensions,
|
|
700
|
+
const config = await loadCliConfig(settings, extensions, 'test-session', argv);
|
|
706
701
|
expect(config.getExcludeTools()).toEqual(expect.arrayContaining(['tool1', 'tool2']));
|
|
707
702
|
expect(config.getExcludeTools()).toHaveLength(2);
|
|
708
703
|
});
|
|
@@ -721,7 +716,7 @@ describe('mergeExcludeTools', () => {
|
|
|
721
716
|
const originalSettings = JSON.parse(JSON.stringify(settings));
|
|
722
717
|
process.argv = ['node', 'script.js'];
|
|
723
718
|
const argv = await parseArguments({});
|
|
724
|
-
await loadCliConfig(settings, extensions,
|
|
719
|
+
await loadCliConfig(settings, extensions, 'test-session', argv);
|
|
725
720
|
expect(settings).toEqual(originalSettings);
|
|
726
721
|
});
|
|
727
722
|
});
|
|
@@ -742,7 +737,7 @@ describe('Approval mode tool exclusion logic', () => {
|
|
|
742
737
|
const argv = await parseArguments({});
|
|
743
738
|
const settings = {};
|
|
744
739
|
const extensions = [];
|
|
745
|
-
const config = await loadCliConfig(settings, extensions,
|
|
740
|
+
const config = await loadCliConfig(settings, extensions, 'test-session', argv);
|
|
746
741
|
const excludedTools = config.getExcludeTools();
|
|
747
742
|
expect(excludedTools).toContain(SHELL_TOOL_NAME);
|
|
748
743
|
expect(excludedTools).toContain(EDIT_TOOL_NAME);
|
|
@@ -760,7 +755,7 @@ describe('Approval mode tool exclusion logic', () => {
|
|
|
760
755
|
const argv = await parseArguments({});
|
|
761
756
|
const settings = {};
|
|
762
757
|
const extensions = [];
|
|
763
|
-
const config = await loadCliConfig(settings, extensions,
|
|
758
|
+
const config = await loadCliConfig(settings, extensions, 'test-session', argv);
|
|
764
759
|
const excludedTools = config.getExcludeTools();
|
|
765
760
|
expect(excludedTools).toContain(SHELL_TOOL_NAME);
|
|
766
761
|
expect(excludedTools).toContain(EDIT_TOOL_NAME);
|
|
@@ -778,7 +773,7 @@ describe('Approval mode tool exclusion logic', () => {
|
|
|
778
773
|
const argv = await parseArguments({});
|
|
779
774
|
const settings = {};
|
|
780
775
|
const extensions = [];
|
|
781
|
-
const config = await loadCliConfig(settings, extensions,
|
|
776
|
+
const config = await loadCliConfig(settings, extensions, 'test-session', argv);
|
|
782
777
|
const excludedTools = config.getExcludeTools();
|
|
783
778
|
expect(excludedTools).toContain(SHELL_TOOL_NAME);
|
|
784
779
|
expect(excludedTools).not.toContain(EDIT_TOOL_NAME);
|
|
@@ -796,7 +791,7 @@ describe('Approval mode tool exclusion logic', () => {
|
|
|
796
791
|
const argv = await parseArguments({});
|
|
797
792
|
const settings = {};
|
|
798
793
|
const extensions = [];
|
|
799
|
-
const config = await loadCliConfig(settings, extensions,
|
|
794
|
+
const config = await loadCliConfig(settings, extensions, 'test-session', argv);
|
|
800
795
|
const excludedTools = config.getExcludeTools();
|
|
801
796
|
expect(excludedTools).not.toContain(SHELL_TOOL_NAME);
|
|
802
797
|
expect(excludedTools).not.toContain(EDIT_TOOL_NAME);
|
|
@@ -807,7 +802,7 @@ describe('Approval mode tool exclusion logic', () => {
|
|
|
807
802
|
const argv = await parseArguments({});
|
|
808
803
|
const settings = {};
|
|
809
804
|
const extensions = [];
|
|
810
|
-
const config = await loadCliConfig(settings, extensions,
|
|
805
|
+
const config = await loadCliConfig(settings, extensions, 'test-session', argv);
|
|
811
806
|
const excludedTools = config.getExcludeTools();
|
|
812
807
|
expect(excludedTools).not.toContain(SHELL_TOOL_NAME);
|
|
813
808
|
expect(excludedTools).not.toContain(EDIT_TOOL_NAME);
|
|
@@ -827,7 +822,7 @@ describe('Approval mode tool exclusion logic', () => {
|
|
|
827
822
|
const argv = await parseArguments({});
|
|
828
823
|
const settings = {};
|
|
829
824
|
const extensions = [];
|
|
830
|
-
const config = await loadCliConfig(settings, extensions,
|
|
825
|
+
const config = await loadCliConfig(settings, extensions, 'test-session', argv);
|
|
831
826
|
const excludedTools = config.getExcludeTools();
|
|
832
827
|
expect(excludedTools).not.toContain(SHELL_TOOL_NAME);
|
|
833
828
|
expect(excludedTools).not.toContain(EDIT_TOOL_NAME);
|
|
@@ -846,7 +841,7 @@ describe('Approval mode tool exclusion logic', () => {
|
|
|
846
841
|
const argv = await parseArguments({});
|
|
847
842
|
const settings = { tools: { exclude: ['custom_tool'] } };
|
|
848
843
|
const extensions = [];
|
|
849
|
-
const config = await loadCliConfig(settings, extensions,
|
|
844
|
+
const config = await loadCliConfig(settings, extensions, 'test-session', argv);
|
|
850
845
|
const excludedTools = config.getExcludeTools();
|
|
851
846
|
expect(excludedTools).toContain('custom_tool'); // From settings
|
|
852
847
|
expect(excludedTools).toContain(SHELL_TOOL_NAME); // From approval mode
|
|
@@ -863,7 +858,7 @@ describe('Approval mode tool exclusion logic', () => {
|
|
|
863
858
|
};
|
|
864
859
|
const settings = {};
|
|
865
860
|
const extensions = [];
|
|
866
|
-
await expect(loadCliConfig(settings, extensions,
|
|
861
|
+
await expect(loadCliConfig(settings, extensions, 'test-session', invalidArgv)).rejects.toThrow('Invalid approval mode: invalid_mode. Valid values are: yolo, auto_edit, default');
|
|
867
862
|
});
|
|
868
863
|
});
|
|
869
864
|
describe('loadCliConfig with allowed-mcp-server-names', () => {
|
|
@@ -888,7 +883,7 @@ describe('loadCliConfig with allowed-mcp-server-names', () => {
|
|
|
888
883
|
it('should allow all MCP servers if the flag is not provided', async () => {
|
|
889
884
|
process.argv = ['node', 'script.js'];
|
|
890
885
|
const argv = await parseArguments({});
|
|
891
|
-
const config = await loadCliConfig(baseSettings, [],
|
|
886
|
+
const config = await loadCliConfig(baseSettings, [], 'test-session', argv);
|
|
892
887
|
expect(config.getMcpServers()).toEqual(baseSettings.mcpServers);
|
|
893
888
|
});
|
|
894
889
|
it('should allow only the specified MCP server', async () => {
|
|
@@ -899,7 +894,7 @@ describe('loadCliConfig with allowed-mcp-server-names', () => {
|
|
|
899
894
|
'server1',
|
|
900
895
|
];
|
|
901
896
|
const argv = await parseArguments({});
|
|
902
|
-
const config = await loadCliConfig(baseSettings, [],
|
|
897
|
+
const config = await loadCliConfig(baseSettings, [], 'test-session', argv);
|
|
903
898
|
expect(config.getMcpServers()).toEqual({
|
|
904
899
|
server1: { url: 'http://localhost:8080' },
|
|
905
900
|
});
|
|
@@ -914,7 +909,7 @@ describe('loadCliConfig with allowed-mcp-server-names', () => {
|
|
|
914
909
|
'server3',
|
|
915
910
|
];
|
|
916
911
|
const argv = await parseArguments({});
|
|
917
|
-
const config = await loadCliConfig(baseSettings, [],
|
|
912
|
+
const config = await loadCliConfig(baseSettings, [], 'test-session', argv);
|
|
918
913
|
expect(config.getMcpServers()).toEqual({
|
|
919
914
|
server1: { url: 'http://localhost:8080' },
|
|
920
915
|
server3: { url: 'http://localhost:8082' },
|
|
@@ -930,7 +925,7 @@ describe('loadCliConfig with allowed-mcp-server-names', () => {
|
|
|
930
925
|
'server4',
|
|
931
926
|
];
|
|
932
927
|
const argv = await parseArguments({});
|
|
933
|
-
const config = await loadCliConfig(baseSettings, [],
|
|
928
|
+
const config = await loadCliConfig(baseSettings, [], 'test-session', argv);
|
|
934
929
|
expect(config.getMcpServers()).toEqual({
|
|
935
930
|
server1: { url: 'http://localhost:8080' },
|
|
936
931
|
});
|
|
@@ -938,7 +933,7 @@ describe('loadCliConfig with allowed-mcp-server-names', () => {
|
|
|
938
933
|
it('should allow no MCP servers if the flag is provided but empty', async () => {
|
|
939
934
|
process.argv = ['node', 'script.js', '--allowed-mcp-server-names', ''];
|
|
940
935
|
const argv = await parseArguments({});
|
|
941
|
-
const config = await loadCliConfig(baseSettings, [],
|
|
936
|
+
const config = await loadCliConfig(baseSettings, [], 'test-session', argv);
|
|
942
937
|
expect(config.getMcpServers()).toEqual({});
|
|
943
938
|
});
|
|
944
939
|
it('should read allowMCPServers from settings', async () => {
|
|
@@ -948,7 +943,7 @@ describe('loadCliConfig with allowed-mcp-server-names', () => {
|
|
|
948
943
|
...baseSettings,
|
|
949
944
|
mcp: { allowed: ['server1', 'server2'] },
|
|
950
945
|
};
|
|
951
|
-
const config = await loadCliConfig(settings, [],
|
|
946
|
+
const config = await loadCliConfig(settings, [], 'test-session', argv);
|
|
952
947
|
expect(config.getMcpServers()).toEqual({
|
|
953
948
|
server1: { url: 'http://localhost:8080' },
|
|
954
949
|
server2: { url: 'http://localhost:8081' },
|
|
@@ -961,7 +956,7 @@ describe('loadCliConfig with allowed-mcp-server-names', () => {
|
|
|
961
956
|
...baseSettings,
|
|
962
957
|
mcp: { excluded: ['server1', 'server2'] },
|
|
963
958
|
};
|
|
964
|
-
const config = await loadCliConfig(settings, [],
|
|
959
|
+
const config = await loadCliConfig(settings, [], 'test-session', argv);
|
|
965
960
|
expect(config.getMcpServers()).toEqual({
|
|
966
961
|
server3: { url: 'http://localhost:8082' },
|
|
967
962
|
});
|
|
@@ -976,7 +971,7 @@ describe('loadCliConfig with allowed-mcp-server-names', () => {
|
|
|
976
971
|
allowed: ['server1', 'server2'],
|
|
977
972
|
},
|
|
978
973
|
};
|
|
979
|
-
const config = await loadCliConfig(settings, [],
|
|
974
|
+
const config = await loadCliConfig(settings, [], 'test-session', argv);
|
|
980
975
|
expect(config.getMcpServers()).toEqual({
|
|
981
976
|
server2: { url: 'http://localhost:8081' },
|
|
982
977
|
});
|
|
@@ -996,7 +991,7 @@ describe('loadCliConfig with allowed-mcp-server-names', () => {
|
|
|
996
991
|
allowed: ['server2'],
|
|
997
992
|
},
|
|
998
993
|
};
|
|
999
|
-
const config = await loadCliConfig(settings, [],
|
|
994
|
+
const config = await loadCliConfig(settings, [], 'test-session', argv);
|
|
1000
995
|
expect(config.getMcpServers()).toEqual({
|
|
1001
996
|
server1: { url: 'http://localhost:8080' },
|
|
1002
997
|
});
|
|
@@ -1018,48 +1013,13 @@ describe('loadCliConfig with allowed-mcp-server-names', () => {
|
|
|
1018
1013
|
excluded: ['server3'], // Should be ignored
|
|
1019
1014
|
},
|
|
1020
1015
|
};
|
|
1021
|
-
const config = await loadCliConfig(settings, [],
|
|
1016
|
+
const config = await loadCliConfig(settings, [], 'test-session', argv);
|
|
1022
1017
|
expect(config.getMcpServers()).toEqual({
|
|
1023
1018
|
server2: { url: 'http://localhost:8081' },
|
|
1024
1019
|
server3: { url: 'http://localhost:8082' },
|
|
1025
1020
|
});
|
|
1026
1021
|
});
|
|
1027
1022
|
});
|
|
1028
|
-
describe('loadCliConfig extensions', () => {
|
|
1029
|
-
const mockExtensions = [
|
|
1030
|
-
{
|
|
1031
|
-
path: '/path/to/ext1',
|
|
1032
|
-
name: 'ext1',
|
|
1033
|
-
version: '1.0.0',
|
|
1034
|
-
contextFiles: ['/path/to/ext1.md'],
|
|
1035
|
-
isActive: true,
|
|
1036
|
-
},
|
|
1037
|
-
{
|
|
1038
|
-
path: '/path/to/ext2',
|
|
1039
|
-
name: 'ext2',
|
|
1040
|
-
version: '1.0.0',
|
|
1041
|
-
contextFiles: ['/path/to/ext2.md'],
|
|
1042
|
-
isActive: true,
|
|
1043
|
-
},
|
|
1044
|
-
];
|
|
1045
|
-
it('should not filter extensions if --extensions flag is not used', async () => {
|
|
1046
|
-
process.argv = ['node', 'script.js'];
|
|
1047
|
-
const argv = await parseArguments({});
|
|
1048
|
-
const settings = {};
|
|
1049
|
-
const config = await loadCliConfig(settings, mockExtensions, new ExtensionEnablementManager(argv.extensions), 'test-session', argv);
|
|
1050
|
-
expect(config.getExtensionContextFilePaths()).toEqual([
|
|
1051
|
-
'/path/to/ext1.md',
|
|
1052
|
-
'/path/to/ext2.md',
|
|
1053
|
-
]);
|
|
1054
|
-
});
|
|
1055
|
-
it('should filter extensions if --extensions flag is used', async () => {
|
|
1056
|
-
process.argv = ['node', 'script.js', '--extensions', 'ext1'];
|
|
1057
|
-
const argv = await parseArguments({});
|
|
1058
|
-
const settings = {};
|
|
1059
|
-
const config = await loadCliConfig(settings, mockExtensions, new ExtensionEnablementManager(argv.extensions), 'test-session', argv);
|
|
1060
|
-
expect(config.getExtensionContextFilePaths()).toEqual(['/path/to/ext1.md']);
|
|
1061
|
-
});
|
|
1062
|
-
});
|
|
1063
1023
|
describe('loadCliConfig model selection', () => {
|
|
1064
1024
|
it('selects a model from settings.json if provided', async () => {
|
|
1065
1025
|
process.argv = ['node', 'script.js'];
|
|
@@ -1068,7 +1028,7 @@ describe('loadCliConfig model selection', () => {
|
|
|
1068
1028
|
model: {
|
|
1069
1029
|
name: 'gemini-9001-ultra',
|
|
1070
1030
|
},
|
|
1071
|
-
}, [],
|
|
1031
|
+
}, [], 'test-session', argv);
|
|
1072
1032
|
expect(config.getModel()).toBe('gemini-9001-ultra');
|
|
1073
1033
|
});
|
|
1074
1034
|
it('uses the default gemini model if nothing is set', async () => {
|
|
@@ -1076,25 +1036,25 @@ describe('loadCliConfig model selection', () => {
|
|
|
1076
1036
|
const argv = await parseArguments({});
|
|
1077
1037
|
const config = await loadCliConfig({
|
|
1078
1038
|
// No model set.
|
|
1079
|
-
}, [],
|
|
1039
|
+
}, [], 'test-session', argv);
|
|
1080
1040
|
expect(config.getModel()).toBe('auto');
|
|
1081
1041
|
});
|
|
1082
|
-
it('always prefers model from
|
|
1042
|
+
it('always prefers model from argv', async () => {
|
|
1083
1043
|
process.argv = ['node', 'script.js', '--model', 'gemini-8675309-ultra'];
|
|
1084
1044
|
const argv = await parseArguments({});
|
|
1085
1045
|
const config = await loadCliConfig({
|
|
1086
1046
|
model: {
|
|
1087
1047
|
name: 'gemini-9001-ultra',
|
|
1088
1048
|
},
|
|
1089
|
-
}, [],
|
|
1049
|
+
}, [], 'test-session', argv);
|
|
1090
1050
|
expect(config.getModel()).toBe('gemini-8675309-ultra');
|
|
1091
1051
|
});
|
|
1092
|
-
it('selects the model from
|
|
1052
|
+
it('selects the model from argv if provided', async () => {
|
|
1093
1053
|
process.argv = ['node', 'script.js', '--model', 'gemini-8675309-ultra'];
|
|
1094
1054
|
const argv = await parseArguments({});
|
|
1095
1055
|
const config = await loadCliConfig({
|
|
1096
1056
|
// No model provided via settings.
|
|
1097
|
-
}, [],
|
|
1057
|
+
}, [], 'test-session', argv);
|
|
1098
1058
|
expect(config.getModel()).toBe('gemini-8675309-ultra');
|
|
1099
1059
|
});
|
|
1100
1060
|
});
|
|
@@ -1106,7 +1066,7 @@ describe('loadCliConfig model selection with model router', () => {
|
|
|
1106
1066
|
experimental: {
|
|
1107
1067
|
useModelRouter: true,
|
|
1108
1068
|
},
|
|
1109
|
-
}, [],
|
|
1069
|
+
}, [], 'test-session', argv);
|
|
1110
1070
|
expect(config.getModel()).toBe(DEFAULT_GEMINI_MODEL_AUTO);
|
|
1111
1071
|
});
|
|
1112
1072
|
it('should use default model when useModelRouter is false and no model is provided', async () => {
|
|
@@ -1116,7 +1076,7 @@ describe('loadCliConfig model selection with model router', () => {
|
|
|
1116
1076
|
experimental: {
|
|
1117
1077
|
useModelRouter: false,
|
|
1118
1078
|
},
|
|
1119
|
-
}, [],
|
|
1079
|
+
}, [], 'test-session', argv);
|
|
1120
1080
|
expect(config.getModel()).toBe(DEFAULT_GEMINI_MODEL);
|
|
1121
1081
|
});
|
|
1122
1082
|
it('should prioritize argv over useModelRouter', async () => {
|
|
@@ -1126,7 +1086,7 @@ describe('loadCliConfig model selection with model router', () => {
|
|
|
1126
1086
|
experimental: {
|
|
1127
1087
|
useModelRouter: true,
|
|
1128
1088
|
},
|
|
1129
|
-
}, [],
|
|
1089
|
+
}, [], 'test-session', argv);
|
|
1130
1090
|
expect(config.getModel()).toBe('gemini-from-argv');
|
|
1131
1091
|
});
|
|
1132
1092
|
it('should prioritize settings over useModelRouter', async () => {
|
|
@@ -1139,7 +1099,7 @@ describe('loadCliConfig model selection with model router', () => {
|
|
|
1139
1099
|
model: {
|
|
1140
1100
|
name: 'gemini-from-settings',
|
|
1141
1101
|
},
|
|
1142
|
-
}, [],
|
|
1102
|
+
}, [], 'test-session', argv);
|
|
1143
1103
|
expect(config.getModel()).toBe('gemini-from-settings');
|
|
1144
1104
|
});
|
|
1145
1105
|
it('should prioritize environment variable over useModelRouter', async () => {
|
|
@@ -1150,7 +1110,7 @@ describe('loadCliConfig model selection with model router', () => {
|
|
|
1150
1110
|
experimental: {
|
|
1151
1111
|
useModelRouter: true,
|
|
1152
1112
|
},
|
|
1153
|
-
}, [],
|
|
1113
|
+
}, [], 'test-session', argv);
|
|
1154
1114
|
expect(config.getModel()).toBe('gemini-from-env');
|
|
1155
1115
|
});
|
|
1156
1116
|
});
|
|
@@ -1176,7 +1136,7 @@ describe('loadCliConfig folderTrust', () => {
|
|
|
1176
1136
|
},
|
|
1177
1137
|
};
|
|
1178
1138
|
const argv = await parseArguments({});
|
|
1179
|
-
const config = await loadCliConfig(settings, [],
|
|
1139
|
+
const config = await loadCliConfig(settings, [], 'test-session', argv);
|
|
1180
1140
|
expect(config.getFolderTrust()).toBe(false);
|
|
1181
1141
|
});
|
|
1182
1142
|
it('should be true when folderTrust is true', async () => {
|
|
@@ -1189,14 +1149,14 @@ describe('loadCliConfig folderTrust', () => {
|
|
|
1189
1149
|
},
|
|
1190
1150
|
},
|
|
1191
1151
|
};
|
|
1192
|
-
const config = await loadCliConfig(settings, [],
|
|
1152
|
+
const config = await loadCliConfig(settings, [], 'test-session', argv);
|
|
1193
1153
|
expect(config.getFolderTrust()).toBe(true);
|
|
1194
1154
|
});
|
|
1195
1155
|
it('should be false by default', async () => {
|
|
1196
1156
|
process.argv = ['node', 'script.js'];
|
|
1197
1157
|
const argv = await parseArguments({});
|
|
1198
1158
|
const settings = {};
|
|
1199
|
-
const config = await loadCliConfig(settings, [],
|
|
1159
|
+
const config = await loadCliConfig(settings, [], 'test-session', argv);
|
|
1200
1160
|
expect(config.getFolderTrust()).toBe(false);
|
|
1201
1161
|
});
|
|
1202
1162
|
});
|
|
@@ -1231,7 +1191,7 @@ describe('loadCliConfig with includeDirectories', () => {
|
|
|
1231
1191
|
],
|
|
1232
1192
|
},
|
|
1233
1193
|
};
|
|
1234
|
-
const config = await loadCliConfig(settings, [],
|
|
1194
|
+
const config = await loadCliConfig(settings, [], 'test-session', argv);
|
|
1235
1195
|
const expected = [
|
|
1236
1196
|
mockCwd,
|
|
1237
1197
|
path.resolve(path.sep, 'cli', 'path1'),
|
|
@@ -1266,7 +1226,7 @@ describe('loadCliConfig chatCompression', () => {
|
|
|
1266
1226
|
},
|
|
1267
1227
|
},
|
|
1268
1228
|
};
|
|
1269
|
-
const config = await loadCliConfig(settings, [],
|
|
1229
|
+
const config = await loadCliConfig(settings, [], 'test-session', argv);
|
|
1270
1230
|
expect(config.getChatCompression()).toEqual({
|
|
1271
1231
|
contextPercentageThreshold: 0.5,
|
|
1272
1232
|
});
|
|
@@ -1275,7 +1235,7 @@ describe('loadCliConfig chatCompression', () => {
|
|
|
1275
1235
|
process.argv = ['node', 'script.js'];
|
|
1276
1236
|
const argv = await parseArguments({});
|
|
1277
1237
|
const settings = {};
|
|
1278
|
-
const config = await loadCliConfig(settings, [],
|
|
1238
|
+
const config = await loadCliConfig(settings, [], 'test-session', argv);
|
|
1279
1239
|
expect(config.getChatCompression()).toBeUndefined();
|
|
1280
1240
|
});
|
|
1281
1241
|
});
|
|
@@ -1295,43 +1255,43 @@ describe('loadCliConfig useRipgrep', () => {
|
|
|
1295
1255
|
process.argv = ['node', 'script.js'];
|
|
1296
1256
|
const argv = await parseArguments({});
|
|
1297
1257
|
const settings = {};
|
|
1298
|
-
const config = await loadCliConfig(settings, [],
|
|
1258
|
+
const config = await loadCliConfig(settings, [], 'test-session', argv);
|
|
1299
1259
|
expect(config.getUseRipgrep()).toBe(true);
|
|
1300
1260
|
});
|
|
1301
1261
|
it('should be false when useRipgrep is set to false in settings', async () => {
|
|
1302
1262
|
process.argv = ['node', 'script.js'];
|
|
1303
1263
|
const argv = await parseArguments({});
|
|
1304
1264
|
const settings = { tools: { useRipgrep: false } };
|
|
1305
|
-
const config = await loadCliConfig(settings, [],
|
|
1265
|
+
const config = await loadCliConfig(settings, [], 'test-session', argv);
|
|
1306
1266
|
expect(config.getUseRipgrep()).toBe(false);
|
|
1307
1267
|
});
|
|
1308
1268
|
it('should be true when useRipgrep is explicitly set to true in settings', async () => {
|
|
1309
1269
|
process.argv = ['node', 'script.js'];
|
|
1310
1270
|
const argv = await parseArguments({});
|
|
1311
1271
|
const settings = { tools: { useRipgrep: true } };
|
|
1312
|
-
const config = await loadCliConfig(settings, [],
|
|
1272
|
+
const config = await loadCliConfig(settings, [], 'test-session', argv);
|
|
1313
1273
|
expect(config.getUseRipgrep()).toBe(true);
|
|
1314
1274
|
});
|
|
1315
1275
|
describe('loadCliConfig useModelRouter', () => {
|
|
1316
|
-
it('should be
|
|
1276
|
+
it('should be true by default when useModelRouter is not set in settings', async () => {
|
|
1317
1277
|
process.argv = ['node', 'script.js'];
|
|
1318
1278
|
const argv = await parseArguments({});
|
|
1319
1279
|
const settings = {};
|
|
1320
|
-
const config = await loadCliConfig(settings, [],
|
|
1280
|
+
const config = await loadCliConfig(settings, [], 'test-session', argv);
|
|
1321
1281
|
expect(config.getUseModelRouter()).toBe(true);
|
|
1322
1282
|
});
|
|
1323
1283
|
it('should be true when useModelRouter is set to true in settings', async () => {
|
|
1324
1284
|
process.argv = ['node', 'script.js'];
|
|
1325
1285
|
const argv = await parseArguments({});
|
|
1326
1286
|
const settings = { experimental: { useModelRouter: true } };
|
|
1327
|
-
const config = await loadCliConfig(settings, [],
|
|
1287
|
+
const config = await loadCliConfig(settings, [], 'test-session', argv);
|
|
1328
1288
|
expect(config.getUseModelRouter()).toBe(true);
|
|
1329
1289
|
});
|
|
1330
1290
|
it('should be false when useModelRouter is explicitly set to false in settings', async () => {
|
|
1331
1291
|
process.argv = ['node', 'script.js'];
|
|
1332
1292
|
const argv = await parseArguments({});
|
|
1333
1293
|
const settings = { experimental: { useModelRouter: false } };
|
|
1334
|
-
const config = await loadCliConfig(settings, [],
|
|
1294
|
+
const config = await loadCliConfig(settings, [], 'test-session', argv);
|
|
1335
1295
|
expect(config.getUseModelRouter()).toBe(false);
|
|
1336
1296
|
});
|
|
1337
1297
|
});
|
|
@@ -1354,7 +1314,7 @@ describe('screenReader configuration', () => {
|
|
|
1354
1314
|
const settings = {
|
|
1355
1315
|
ui: { accessibility: { screenReader: true } },
|
|
1356
1316
|
};
|
|
1357
|
-
const config = await loadCliConfig(settings, [],
|
|
1317
|
+
const config = await loadCliConfig(settings, [], 'test-session', argv);
|
|
1358
1318
|
expect(config.getScreenReader()).toBe(true);
|
|
1359
1319
|
});
|
|
1360
1320
|
it('should use screenReader value from settings if CLI flag is not present (settings false)', async () => {
|
|
@@ -1363,7 +1323,7 @@ describe('screenReader configuration', () => {
|
|
|
1363
1323
|
const settings = {
|
|
1364
1324
|
ui: { accessibility: { screenReader: false } },
|
|
1365
1325
|
};
|
|
1366
|
-
const config = await loadCliConfig(settings, [],
|
|
1326
|
+
const config = await loadCliConfig(settings, [], 'test-session', argv);
|
|
1367
1327
|
expect(config.getScreenReader()).toBe(false);
|
|
1368
1328
|
});
|
|
1369
1329
|
it('should prioritize --screen-reader CLI flag (true) over settings (false)', async () => {
|
|
@@ -1372,14 +1332,14 @@ describe('screenReader configuration', () => {
|
|
|
1372
1332
|
const settings = {
|
|
1373
1333
|
ui: { accessibility: { screenReader: false } },
|
|
1374
1334
|
};
|
|
1375
|
-
const config = await loadCliConfig(settings, [],
|
|
1335
|
+
const config = await loadCliConfig(settings, [], 'test-session', argv);
|
|
1376
1336
|
expect(config.getScreenReader()).toBe(true);
|
|
1377
1337
|
});
|
|
1378
1338
|
it('should be false by default when no flag or setting is present', async () => {
|
|
1379
1339
|
process.argv = ['node', 'script.js'];
|
|
1380
1340
|
const argv = await parseArguments({});
|
|
1381
1341
|
const settings = {};
|
|
1382
|
-
const config = await loadCliConfig(settings, [],
|
|
1342
|
+
const config = await loadCliConfig(settings, [], 'test-session', argv);
|
|
1383
1343
|
expect(config.getScreenReader()).toBe(false);
|
|
1384
1344
|
});
|
|
1385
1345
|
});
|
|
@@ -1406,7 +1366,7 @@ describe('loadCliConfig tool exclusions', () => {
|
|
|
1406
1366
|
process.stdin.isTTY = true;
|
|
1407
1367
|
process.argv = ['node', 'script.js'];
|
|
1408
1368
|
const argv = await parseArguments({});
|
|
1409
|
-
const config = await loadCliConfig({}, [],
|
|
1369
|
+
const config = await loadCliConfig({}, [], 'test-session', argv);
|
|
1410
1370
|
expect(config.getExcludeTools()).not.toContain('run_shell_command');
|
|
1411
1371
|
expect(config.getExcludeTools()).not.toContain('replace');
|
|
1412
1372
|
expect(config.getExcludeTools()).not.toContain('write_file');
|
|
@@ -1415,7 +1375,7 @@ describe('loadCliConfig tool exclusions', () => {
|
|
|
1415
1375
|
process.stdin.isTTY = true;
|
|
1416
1376
|
process.argv = ['node', 'script.js', '--yolo'];
|
|
1417
1377
|
const argv = await parseArguments({});
|
|
1418
|
-
const config = await loadCliConfig({}, [],
|
|
1378
|
+
const config = await loadCliConfig({}, [], 'test-session', argv);
|
|
1419
1379
|
expect(config.getExcludeTools()).not.toContain('run_shell_command');
|
|
1420
1380
|
expect(config.getExcludeTools()).not.toContain('replace');
|
|
1421
1381
|
expect(config.getExcludeTools()).not.toContain('write_file');
|
|
@@ -1424,7 +1384,7 @@ describe('loadCliConfig tool exclusions', () => {
|
|
|
1424
1384
|
process.stdin.isTTY = false;
|
|
1425
1385
|
process.argv = ['node', 'script.js', '-p', 'test'];
|
|
1426
1386
|
const argv = await parseArguments({});
|
|
1427
|
-
const config = await loadCliConfig({}, [],
|
|
1387
|
+
const config = await loadCliConfig({}, [], 'test-session', argv);
|
|
1428
1388
|
expect(config.getExcludeTools()).toContain('run_shell_command');
|
|
1429
1389
|
expect(config.getExcludeTools()).toContain('replace');
|
|
1430
1390
|
expect(config.getExcludeTools()).toContain('write_file');
|
|
@@ -1433,7 +1393,7 @@ describe('loadCliConfig tool exclusions', () => {
|
|
|
1433
1393
|
process.stdin.isTTY = false;
|
|
1434
1394
|
process.argv = ['node', 'script.js', '-p', 'test', '--yolo'];
|
|
1435
1395
|
const argv = await parseArguments({});
|
|
1436
|
-
const config = await loadCliConfig({}, [],
|
|
1396
|
+
const config = await loadCliConfig({}, [], 'test-session', argv);
|
|
1437
1397
|
expect(config.getExcludeTools()).not.toContain('run_shell_command');
|
|
1438
1398
|
expect(config.getExcludeTools()).not.toContain('replace');
|
|
1439
1399
|
expect(config.getExcludeTools()).not.toContain('write_file');
|
|
@@ -1449,7 +1409,7 @@ describe('loadCliConfig tool exclusions', () => {
|
|
|
1449
1409
|
'ShellTool',
|
|
1450
1410
|
];
|
|
1451
1411
|
const argv = await parseArguments({});
|
|
1452
|
-
const config = await loadCliConfig({}, [],
|
|
1412
|
+
const config = await loadCliConfig({}, [], 'test-session', argv);
|
|
1453
1413
|
expect(config.getExcludeTools()).not.toContain(SHELL_TOOL_NAME);
|
|
1454
1414
|
});
|
|
1455
1415
|
it('should not exclude shell tool in non-interactive mode when --allowed-tools="run_shell_command" is set', async () => {
|
|
@@ -1463,7 +1423,7 @@ describe('loadCliConfig tool exclusions', () => {
|
|
|
1463
1423
|
'run_shell_command',
|
|
1464
1424
|
];
|
|
1465
1425
|
const argv = await parseArguments({});
|
|
1466
|
-
const config = await loadCliConfig({}, [],
|
|
1426
|
+
const config = await loadCliConfig({}, [], 'test-session', argv);
|
|
1467
1427
|
expect(config.getExcludeTools()).not.toContain(SHELL_TOOL_NAME);
|
|
1468
1428
|
});
|
|
1469
1429
|
it('should not exclude shell tool in non-interactive mode when --allowed-tools="ShellTool(wc)" is set', async () => {
|
|
@@ -1477,7 +1437,7 @@ describe('loadCliConfig tool exclusions', () => {
|
|
|
1477
1437
|
'ShellTool(wc)',
|
|
1478
1438
|
];
|
|
1479
1439
|
const argv = await parseArguments({});
|
|
1480
|
-
const config = await loadCliConfig({}, [],
|
|
1440
|
+
const config = await loadCliConfig({}, [], 'test-session', argv);
|
|
1481
1441
|
expect(config.getExcludeTools()).not.toContain(SHELL_TOOL_NAME);
|
|
1482
1442
|
});
|
|
1483
1443
|
});
|
|
@@ -1500,35 +1460,35 @@ describe('loadCliConfig interactive', () => {
|
|
|
1500
1460
|
process.stdin.isTTY = true;
|
|
1501
1461
|
process.argv = ['node', 'script.js'];
|
|
1502
1462
|
const argv = await parseArguments({});
|
|
1503
|
-
const config = await loadCliConfig({}, [],
|
|
1463
|
+
const config = await loadCliConfig({}, [], 'test-session', argv);
|
|
1504
1464
|
expect(config.isInteractive()).toBe(true);
|
|
1505
1465
|
});
|
|
1506
1466
|
it('should be interactive if prompt-interactive is set', async () => {
|
|
1507
1467
|
process.stdin.isTTY = false;
|
|
1508
1468
|
process.argv = ['node', 'script.js', '--prompt-interactive', 'test'];
|
|
1509
1469
|
const argv = await parseArguments({});
|
|
1510
|
-
const config = await loadCliConfig({}, [],
|
|
1470
|
+
const config = await loadCliConfig({}, [], 'test-session', argv);
|
|
1511
1471
|
expect(config.isInteractive()).toBe(true);
|
|
1512
1472
|
});
|
|
1513
1473
|
it('should not be interactive if not isTTY and no prompt', async () => {
|
|
1514
1474
|
process.stdin.isTTY = false;
|
|
1515
1475
|
process.argv = ['node', 'script.js'];
|
|
1516
1476
|
const argv = await parseArguments({});
|
|
1517
|
-
const config = await loadCliConfig({}, [],
|
|
1477
|
+
const config = await loadCliConfig({}, [], 'test-session', argv);
|
|
1518
1478
|
expect(config.isInteractive()).toBe(false);
|
|
1519
1479
|
});
|
|
1520
1480
|
it('should not be interactive if prompt is set', async () => {
|
|
1521
1481
|
process.stdin.isTTY = true;
|
|
1522
1482
|
process.argv = ['node', 'script.js', '--prompt', 'test'];
|
|
1523
1483
|
const argv = await parseArguments({});
|
|
1524
|
-
const config = await loadCliConfig({}, [],
|
|
1484
|
+
const config = await loadCliConfig({}, [], 'test-session', argv);
|
|
1525
1485
|
expect(config.isInteractive()).toBe(false);
|
|
1526
1486
|
});
|
|
1527
1487
|
it('should not be interactive if positional prompt words are provided with other flags', async () => {
|
|
1528
1488
|
process.stdin.isTTY = true;
|
|
1529
1489
|
process.argv = ['node', 'script.js', '--model', 'gemini-1.5-pro', 'Hello'];
|
|
1530
1490
|
const argv = await parseArguments({});
|
|
1531
|
-
const config = await loadCliConfig({}, [],
|
|
1491
|
+
const config = await loadCliConfig({}, [], 'test-session', argv);
|
|
1532
1492
|
expect(config.isInteractive()).toBe(false);
|
|
1533
1493
|
});
|
|
1534
1494
|
it('should not be interactive if positional prompt words are provided with multiple flags', async () => {
|
|
@@ -1542,7 +1502,7 @@ describe('loadCliConfig interactive', () => {
|
|
|
1542
1502
|
'Hello world',
|
|
1543
1503
|
];
|
|
1544
1504
|
const argv = await parseArguments({});
|
|
1545
|
-
const config = await loadCliConfig({}, [],
|
|
1505
|
+
const config = await loadCliConfig({}, [], 'test-session', argv);
|
|
1546
1506
|
expect(config.isInteractive()).toBe(false);
|
|
1547
1507
|
// Verify the question is preserved for one-shot execution
|
|
1548
1508
|
expect(argv.prompt).toBe('Hello world');
|
|
@@ -1552,7 +1512,7 @@ describe('loadCliConfig interactive', () => {
|
|
|
1552
1512
|
process.stdin.isTTY = true;
|
|
1553
1513
|
process.argv = ['node', 'script.js', '-e', 'none', 'hello'];
|
|
1554
1514
|
const argv = await parseArguments({});
|
|
1555
|
-
const config = await loadCliConfig({}, [],
|
|
1515
|
+
const config = await loadCliConfig({}, [], 'test-session', argv);
|
|
1556
1516
|
expect(config.isInteractive()).toBe(false);
|
|
1557
1517
|
expect(argv.query).toBe('hello');
|
|
1558
1518
|
expect(argv.extensions).toEqual(['none']);
|
|
@@ -1561,7 +1521,7 @@ describe('loadCliConfig interactive', () => {
|
|
|
1561
1521
|
process.stdin.isTTY = true;
|
|
1562
1522
|
process.argv = ['node', 'script.js', 'hello world how are you'];
|
|
1563
1523
|
const argv = await parseArguments({});
|
|
1564
|
-
const config = await loadCliConfig({}, [],
|
|
1524
|
+
const config = await loadCliConfig({}, [], 'test-session', argv);
|
|
1565
1525
|
expect(config.isInteractive()).toBe(false);
|
|
1566
1526
|
expect(argv.query).toBe('hello world how are you');
|
|
1567
1527
|
expect(argv.prompt).toBe('hello world how are you');
|
|
@@ -1581,7 +1541,7 @@ describe('loadCliConfig interactive', () => {
|
|
|
1581
1541
|
'array',
|
|
1582
1542
|
];
|
|
1583
1543
|
const argv = await parseArguments({});
|
|
1584
|
-
const config = await loadCliConfig({}, [],
|
|
1544
|
+
const config = await loadCliConfig({}, [], 'test-session', argv);
|
|
1585
1545
|
expect(config.isInteractive()).toBe(false);
|
|
1586
1546
|
expect(argv.query).toBe('write a function to sort array');
|
|
1587
1547
|
expect(argv.model).toBe('gemini-1.5-pro');
|
|
@@ -1590,7 +1550,7 @@ describe('loadCliConfig interactive', () => {
|
|
|
1590
1550
|
process.stdin.isTTY = true;
|
|
1591
1551
|
process.argv = ['node', 'script.js', ''];
|
|
1592
1552
|
const argv = await parseArguments({});
|
|
1593
|
-
const config = await loadCliConfig({}, [],
|
|
1553
|
+
const config = await loadCliConfig({}, [], 'test-session', argv);
|
|
1594
1554
|
expect(config.isInteractive()).toBe(true);
|
|
1595
1555
|
expect(argv.query).toBeUndefined();
|
|
1596
1556
|
});
|
|
@@ -1608,7 +1568,7 @@ describe('loadCliConfig interactive', () => {
|
|
|
1608
1568
|
'you',
|
|
1609
1569
|
];
|
|
1610
1570
|
const argv = await parseArguments({});
|
|
1611
|
-
const config = await loadCliConfig({}, [],
|
|
1571
|
+
const config = await loadCliConfig({}, [], 'test-session', argv);
|
|
1612
1572
|
expect(config.isInteractive()).toBe(false);
|
|
1613
1573
|
expect(argv.query).toBe('hello world how are you');
|
|
1614
1574
|
expect(argv.extensions).toEqual(['none']);
|
|
@@ -1617,7 +1577,7 @@ describe('loadCliConfig interactive', () => {
|
|
|
1617
1577
|
process.stdin.isTTY = true;
|
|
1618
1578
|
process.argv = ['node', 'script.js', '--model', 'gemini-1.5-pro'];
|
|
1619
1579
|
const argv = await parseArguments({});
|
|
1620
|
-
const config = await loadCliConfig({}, [],
|
|
1580
|
+
const config = await loadCliConfig({}, [], 'test-session', argv);
|
|
1621
1581
|
expect(config.isInteractive()).toBe(true);
|
|
1622
1582
|
});
|
|
1623
1583
|
});
|
|
@@ -1641,37 +1601,37 @@ describe('loadCliConfig approval mode', () => {
|
|
|
1641
1601
|
it('should default to DEFAULT approval mode when no flags are set', async () => {
|
|
1642
1602
|
process.argv = ['node', 'script.js'];
|
|
1643
1603
|
const argv = await parseArguments({});
|
|
1644
|
-
const config = await loadCliConfig({}, [],
|
|
1604
|
+
const config = await loadCliConfig({}, [], 'test-session', argv);
|
|
1645
1605
|
expect(config.getApprovalMode()).toBe(ServerConfig.ApprovalMode.DEFAULT);
|
|
1646
1606
|
});
|
|
1647
1607
|
it('should set YOLO approval mode when --yolo flag is used', async () => {
|
|
1648
1608
|
process.argv = ['node', 'script.js', '--yolo'];
|
|
1649
1609
|
const argv = await parseArguments({});
|
|
1650
|
-
const config = await loadCliConfig({}, [],
|
|
1610
|
+
const config = await loadCliConfig({}, [], 'test-session', argv);
|
|
1651
1611
|
expect(config.getApprovalMode()).toBe(ServerConfig.ApprovalMode.YOLO);
|
|
1652
1612
|
});
|
|
1653
1613
|
it('should set YOLO approval mode when -y flag is used', async () => {
|
|
1654
1614
|
process.argv = ['node', 'script.js', '-y'];
|
|
1655
1615
|
const argv = await parseArguments({});
|
|
1656
|
-
const config = await loadCliConfig({}, [],
|
|
1616
|
+
const config = await loadCliConfig({}, [], 'test-session', argv);
|
|
1657
1617
|
expect(config.getApprovalMode()).toBe(ServerConfig.ApprovalMode.YOLO);
|
|
1658
1618
|
});
|
|
1659
1619
|
it('should set DEFAULT approval mode when --approval-mode=default', async () => {
|
|
1660
1620
|
process.argv = ['node', 'script.js', '--approval-mode', 'default'];
|
|
1661
1621
|
const argv = await parseArguments({});
|
|
1662
|
-
const config = await loadCliConfig({}, [],
|
|
1622
|
+
const config = await loadCliConfig({}, [], 'test-session', argv);
|
|
1663
1623
|
expect(config.getApprovalMode()).toBe(ServerConfig.ApprovalMode.DEFAULT);
|
|
1664
1624
|
});
|
|
1665
1625
|
it('should set AUTO_EDIT approval mode when --approval-mode=auto_edit', async () => {
|
|
1666
1626
|
process.argv = ['node', 'script.js', '--approval-mode', 'auto_edit'];
|
|
1667
1627
|
const argv = await parseArguments({});
|
|
1668
|
-
const config = await loadCliConfig({}, [],
|
|
1628
|
+
const config = await loadCliConfig({}, [], 'test-session', argv);
|
|
1669
1629
|
expect(config.getApprovalMode()).toBe(ServerConfig.ApprovalMode.AUTO_EDIT);
|
|
1670
1630
|
});
|
|
1671
1631
|
it('should set YOLO approval mode when --approval-mode=yolo', async () => {
|
|
1672
1632
|
process.argv = ['node', 'script.js', '--approval-mode', 'yolo'];
|
|
1673
1633
|
const argv = await parseArguments({});
|
|
1674
|
-
const config = await loadCliConfig({}, [],
|
|
1634
|
+
const config = await loadCliConfig({}, [], 'test-session', argv);
|
|
1675
1635
|
expect(config.getApprovalMode()).toBe(ServerConfig.ApprovalMode.YOLO);
|
|
1676
1636
|
});
|
|
1677
1637
|
it('should prioritize --approval-mode over --yolo when both would be valid (but validation prevents this)', async () => {
|
|
@@ -1681,13 +1641,13 @@ describe('loadCliConfig approval mode', () => {
|
|
|
1681
1641
|
const argv = await parseArguments({});
|
|
1682
1642
|
// Manually set yolo to true to simulate what would happen if validation didn't prevent it
|
|
1683
1643
|
argv.yolo = true;
|
|
1684
|
-
const config = await loadCliConfig({}, [],
|
|
1644
|
+
const config = await loadCliConfig({}, [], 'test-session', argv);
|
|
1685
1645
|
expect(config.getApprovalMode()).toBe(ServerConfig.ApprovalMode.DEFAULT);
|
|
1686
1646
|
});
|
|
1687
1647
|
it('should fall back to --yolo behavior when --approval-mode is not set', async () => {
|
|
1688
1648
|
process.argv = ['node', 'script.js', '--yolo'];
|
|
1689
1649
|
const argv = await parseArguments({});
|
|
1690
|
-
const config = await loadCliConfig({}, [],
|
|
1650
|
+
const config = await loadCliConfig({}, [], 'test-session', argv);
|
|
1691
1651
|
expect(config.getApprovalMode()).toBe(ServerConfig.ApprovalMode.YOLO);
|
|
1692
1652
|
});
|
|
1693
1653
|
// --- Untrusted Folder Scenarios ---
|
|
@@ -1701,25 +1661,25 @@ describe('loadCliConfig approval mode', () => {
|
|
|
1701
1661
|
it('should override --approval-mode=yolo to DEFAULT', async () => {
|
|
1702
1662
|
process.argv = ['node', 'script.js', '--approval-mode', 'yolo'];
|
|
1703
1663
|
const argv = await parseArguments({});
|
|
1704
|
-
const config = await loadCliConfig({}, [],
|
|
1664
|
+
const config = await loadCliConfig({}, [], 'test-session', argv);
|
|
1705
1665
|
expect(config.getApprovalMode()).toBe(ServerConfig.ApprovalMode.DEFAULT);
|
|
1706
1666
|
});
|
|
1707
1667
|
it('should override --approval-mode=auto_edit to DEFAULT', async () => {
|
|
1708
1668
|
process.argv = ['node', 'script.js', '--approval-mode', 'auto_edit'];
|
|
1709
1669
|
const argv = await parseArguments({});
|
|
1710
|
-
const config = await loadCliConfig({}, [],
|
|
1670
|
+
const config = await loadCliConfig({}, [], 'test-session', argv);
|
|
1711
1671
|
expect(config.getApprovalMode()).toBe(ServerConfig.ApprovalMode.DEFAULT);
|
|
1712
1672
|
});
|
|
1713
1673
|
it('should override --yolo flag to DEFAULT', async () => {
|
|
1714
1674
|
process.argv = ['node', 'script.js', '--yolo'];
|
|
1715
1675
|
const argv = await parseArguments({});
|
|
1716
|
-
const config = await loadCliConfig({}, [],
|
|
1676
|
+
const config = await loadCliConfig({}, [], 'test-session', argv);
|
|
1717
1677
|
expect(config.getApprovalMode()).toBe(ServerConfig.ApprovalMode.DEFAULT);
|
|
1718
1678
|
});
|
|
1719
1679
|
it('should remain DEFAULT when --approval-mode=default', async () => {
|
|
1720
1680
|
process.argv = ['node', 'script.js', '--approval-mode', 'default'];
|
|
1721
1681
|
const argv = await parseArguments({});
|
|
1722
|
-
const config = await loadCliConfig({}, [],
|
|
1682
|
+
const config = await loadCliConfig({}, [], 'test-session', argv);
|
|
1723
1683
|
expect(config.getApprovalMode()).toBe(ServerConfig.ApprovalMode.DEFAULT);
|
|
1724
1684
|
});
|
|
1725
1685
|
});
|
|
@@ -1786,7 +1746,7 @@ describe('loadCliConfig fileFiltering', () => {
|
|
|
1786
1746
|
},
|
|
1787
1747
|
};
|
|
1788
1748
|
const argv = await parseArguments(settings);
|
|
1789
|
-
const config = await loadCliConfig(settings, [],
|
|
1749
|
+
const config = await loadCliConfig(settings, [], 'test-session', argv);
|
|
1790
1750
|
expect(getter(config)).toBe(value);
|
|
1791
1751
|
});
|
|
1792
1752
|
});
|
|
@@ -1794,25 +1754,25 @@ describe('Output format', () => {
|
|
|
1794
1754
|
it('should default to TEXT', async () => {
|
|
1795
1755
|
process.argv = ['node', 'script.js'];
|
|
1796
1756
|
const argv = await parseArguments({});
|
|
1797
|
-
const config = await loadCliConfig({}, [],
|
|
1757
|
+
const config = await loadCliConfig({}, [], 'test-session', argv);
|
|
1798
1758
|
expect(config.getOutputFormat()).toBe(OutputFormat.TEXT);
|
|
1799
1759
|
});
|
|
1800
1760
|
it('should use the format from settings', async () => {
|
|
1801
1761
|
process.argv = ['node', 'script.js'];
|
|
1802
1762
|
const argv = await parseArguments({});
|
|
1803
|
-
const config = await loadCliConfig({ output: { format: OutputFormat.JSON } }, [],
|
|
1763
|
+
const config = await loadCliConfig({ output: { format: OutputFormat.JSON } }, [], 'test-session', argv);
|
|
1804
1764
|
expect(config.getOutputFormat()).toBe(OutputFormat.JSON);
|
|
1805
1765
|
});
|
|
1806
1766
|
it('should prioritize the format from argv', async () => {
|
|
1807
1767
|
process.argv = ['node', 'script.js', '--output-format', 'json'];
|
|
1808
1768
|
const argv = await parseArguments({});
|
|
1809
|
-
const config = await loadCliConfig({ output: { format: OutputFormat.JSON } }, [],
|
|
1769
|
+
const config = await loadCliConfig({ output: { format: OutputFormat.JSON } }, [], 'test-session', argv);
|
|
1810
1770
|
expect(config.getOutputFormat()).toBe(OutputFormat.JSON);
|
|
1811
1771
|
});
|
|
1812
1772
|
it('should accept stream-json as a valid output format', async () => {
|
|
1813
1773
|
process.argv = ['node', 'script.js', '--output-format', 'stream-json'];
|
|
1814
1774
|
const argv = await parseArguments({});
|
|
1815
|
-
const config = await loadCliConfig({}, [],
|
|
1775
|
+
const config = await loadCliConfig({}, [], 'test-session', argv);
|
|
1816
1776
|
expect(config.getOutputFormat()).toBe(OutputFormat.STREAM_JSON);
|
|
1817
1777
|
});
|
|
1818
1778
|
it('should error on invalid --output-format argument', async () => {
|
|
@@ -1883,7 +1843,7 @@ describe('Telemetry configuration via environment variables', () => {
|
|
|
1883
1843
|
process.argv = ['node', 'script.js'];
|
|
1884
1844
|
const argv = await parseArguments({});
|
|
1885
1845
|
const settings = { telemetry: { enabled: false } };
|
|
1886
|
-
const config = await loadCliConfig(settings, [],
|
|
1846
|
+
const config = await loadCliConfig(settings, [], 'test-session', argv);
|
|
1887
1847
|
expect(config.getTelemetryEnabled()).toBe(true);
|
|
1888
1848
|
});
|
|
1889
1849
|
it('should prioritize GEMINI_TELEMETRY_TARGET over settings', async () => {
|
|
@@ -1893,7 +1853,7 @@ describe('Telemetry configuration via environment variables', () => {
|
|
|
1893
1853
|
const settings = {
|
|
1894
1854
|
telemetry: { target: ServerConfig.TelemetryTarget.LOCAL },
|
|
1895
1855
|
};
|
|
1896
|
-
const config = await loadCliConfig(settings, [],
|
|
1856
|
+
const config = await loadCliConfig(settings, [], 'test-session', argv);
|
|
1897
1857
|
expect(config.getTelemetryTarget()).toBe('gcp');
|
|
1898
1858
|
});
|
|
1899
1859
|
it('should throw when GEMINI_TELEMETRY_TARGET is invalid', async () => {
|
|
@@ -1903,7 +1863,7 @@ describe('Telemetry configuration via environment variables', () => {
|
|
|
1903
1863
|
const settings = {
|
|
1904
1864
|
telemetry: { target: ServerConfig.TelemetryTarget.GCP },
|
|
1905
1865
|
};
|
|
1906
|
-
await expect(loadCliConfig(settings, [],
|
|
1866
|
+
await expect(loadCliConfig(settings, [], 'test-session', argv)).rejects.toThrow(/Invalid telemetry configuration: .*Invalid telemetry target/i);
|
|
1907
1867
|
vi.unstubAllEnvs();
|
|
1908
1868
|
});
|
|
1909
1869
|
it('should prioritize GEMINI_TELEMETRY_OTLP_ENDPOINT over settings and default env var', async () => {
|
|
@@ -1914,7 +1874,7 @@ describe('Telemetry configuration via environment variables', () => {
|
|
|
1914
1874
|
const settings = {
|
|
1915
1875
|
telemetry: { otlpEndpoint: 'http://settings.com' },
|
|
1916
1876
|
};
|
|
1917
|
-
const config = await loadCliConfig(settings, [],
|
|
1877
|
+
const config = await loadCliConfig(settings, [], 'test-session', argv);
|
|
1918
1878
|
expect(config.getTelemetryOtlpEndpoint()).toBe('http://gemini.env.com');
|
|
1919
1879
|
});
|
|
1920
1880
|
it('should prioritize GEMINI_TELEMETRY_OTLP_PROTOCOL over settings', async () => {
|
|
@@ -1922,7 +1882,7 @@ describe('Telemetry configuration via environment variables', () => {
|
|
|
1922
1882
|
process.argv = ['node', 'script.js'];
|
|
1923
1883
|
const argv = await parseArguments({});
|
|
1924
1884
|
const settings = { telemetry: { otlpProtocol: 'grpc' } };
|
|
1925
|
-
const config = await loadCliConfig(settings, [],
|
|
1885
|
+
const config = await loadCliConfig(settings, [], 'test-session', argv);
|
|
1926
1886
|
expect(config.getTelemetryOtlpProtocol()).toBe('http');
|
|
1927
1887
|
});
|
|
1928
1888
|
it('should prioritize GEMINI_TELEMETRY_LOG_PROMPTS over settings', async () => {
|
|
@@ -1930,7 +1890,7 @@ describe('Telemetry configuration via environment variables', () => {
|
|
|
1930
1890
|
process.argv = ['node', 'script.js'];
|
|
1931
1891
|
const argv = await parseArguments({});
|
|
1932
1892
|
const settings = { telemetry: { logPrompts: true } };
|
|
1933
|
-
const config = await loadCliConfig(settings, [],
|
|
1893
|
+
const config = await loadCliConfig(settings, [], 'test-session', argv);
|
|
1934
1894
|
expect(config.getTelemetryLogPromptsEnabled()).toBe(false);
|
|
1935
1895
|
});
|
|
1936
1896
|
it('should prioritize GEMINI_TELEMETRY_OUTFILE over settings', async () => {
|
|
@@ -1940,7 +1900,7 @@ describe('Telemetry configuration via environment variables', () => {
|
|
|
1940
1900
|
const settings = {
|
|
1941
1901
|
telemetry: { outfile: '/settings/telemetry.log' },
|
|
1942
1902
|
};
|
|
1943
|
-
const config = await loadCliConfig(settings, [],
|
|
1903
|
+
const config = await loadCliConfig(settings, [], 'test-session', argv);
|
|
1944
1904
|
expect(config.getTelemetryOutfile()).toBe('/gemini/env/telemetry.log');
|
|
1945
1905
|
});
|
|
1946
1906
|
it('should prioritize GEMINI_TELEMETRY_USE_COLLECTOR over settings', async () => {
|
|
@@ -1948,7 +1908,7 @@ describe('Telemetry configuration via environment variables', () => {
|
|
|
1948
1908
|
process.argv = ['node', 'script.js'];
|
|
1949
1909
|
const argv = await parseArguments({});
|
|
1950
1910
|
const settings = { telemetry: { useCollector: false } };
|
|
1951
|
-
const config = await loadCliConfig(settings, [],
|
|
1911
|
+
const config = await loadCliConfig(settings, [], 'test-session', argv);
|
|
1952
1912
|
expect(config.getTelemetryUseCollector()).toBe(true);
|
|
1953
1913
|
});
|
|
1954
1914
|
it('should use settings value when GEMINI_TELEMETRY_ENABLED is not set', async () => {
|
|
@@ -1956,7 +1916,7 @@ describe('Telemetry configuration via environment variables', () => {
|
|
|
1956
1916
|
process.argv = ['node', 'script.js'];
|
|
1957
1917
|
const argv = await parseArguments({});
|
|
1958
1918
|
const settings = { telemetry: { enabled: true } };
|
|
1959
|
-
const config = await loadCliConfig(settings, [],
|
|
1919
|
+
const config = await loadCliConfig(settings, [], 'test-session', argv);
|
|
1960
1920
|
expect(config.getTelemetryEnabled()).toBe(true);
|
|
1961
1921
|
});
|
|
1962
1922
|
it('should use settings value when GEMINI_TELEMETRY_TARGET is not set', async () => {
|
|
@@ -1966,35 +1926,35 @@ describe('Telemetry configuration via environment variables', () => {
|
|
|
1966
1926
|
const settings = {
|
|
1967
1927
|
telemetry: { target: ServerConfig.TelemetryTarget.LOCAL },
|
|
1968
1928
|
};
|
|
1969
|
-
const config = await loadCliConfig(settings, [],
|
|
1929
|
+
const config = await loadCliConfig(settings, [], 'test-session', argv);
|
|
1970
1930
|
expect(config.getTelemetryTarget()).toBe('local');
|
|
1971
1931
|
});
|
|
1972
1932
|
it("should treat GEMINI_TELEMETRY_ENABLED='1' as true", async () => {
|
|
1973
1933
|
vi.stubEnv('GEMINI_TELEMETRY_ENABLED', '1');
|
|
1974
1934
|
process.argv = ['node', 'script.js'];
|
|
1975
1935
|
const argv = await parseArguments({});
|
|
1976
|
-
const config = await loadCliConfig({}, [],
|
|
1936
|
+
const config = await loadCliConfig({}, [], 'test-session', argv);
|
|
1977
1937
|
expect(config.getTelemetryEnabled()).toBe(true);
|
|
1978
1938
|
});
|
|
1979
1939
|
it("should treat GEMINI_TELEMETRY_ENABLED='0' as false", async () => {
|
|
1980
1940
|
vi.stubEnv('GEMINI_TELEMETRY_ENABLED', '0');
|
|
1981
1941
|
process.argv = ['node', 'script.js'];
|
|
1982
1942
|
const argv = await parseArguments({});
|
|
1983
|
-
const config = await loadCliConfig({ telemetry: { enabled: true } }, [],
|
|
1943
|
+
const config = await loadCliConfig({ telemetry: { enabled: true } }, [], 'test-session', argv);
|
|
1984
1944
|
expect(config.getTelemetryEnabled()).toBe(false);
|
|
1985
1945
|
});
|
|
1986
1946
|
it("should treat GEMINI_TELEMETRY_LOG_PROMPTS='1' as true", async () => {
|
|
1987
1947
|
vi.stubEnv('GEMINI_TELEMETRY_LOG_PROMPTS', '1');
|
|
1988
1948
|
process.argv = ['node', 'script.js'];
|
|
1989
1949
|
const argv = await parseArguments({});
|
|
1990
|
-
const config = await loadCliConfig({}, [],
|
|
1950
|
+
const config = await loadCliConfig({}, [], 'test-session', argv);
|
|
1991
1951
|
expect(config.getTelemetryLogPromptsEnabled()).toBe(true);
|
|
1992
1952
|
});
|
|
1993
1953
|
it("should treat GEMINI_TELEMETRY_LOG_PROMPTS='false' as false", async () => {
|
|
1994
1954
|
vi.stubEnv('GEMINI_TELEMETRY_LOG_PROMPTS', 'false');
|
|
1995
1955
|
process.argv = ['node', 'script.js'];
|
|
1996
1956
|
const argv = await parseArguments({});
|
|
1997
|
-
const config = await loadCliConfig({ telemetry: { logPrompts: true } }, [],
|
|
1957
|
+
const config = await loadCliConfig({ telemetry: { logPrompts: true } }, [], 'test-session', argv);
|
|
1998
1958
|
expect(config.getTelemetryLogPromptsEnabled()).toBe(false);
|
|
1999
1959
|
});
|
|
2000
1960
|
});
|