@google/gemini-cli 0.0.773 → 0.0.777
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/package.json +7 -3
- package/dist/src/commands/extensions/disable.d.ts +2 -1
- package/dist/src/commands/extensions/disable.js +3 -17
- package/dist/src/commands/extensions/disable.js.map +1 -1
- package/dist/src/commands/extensions/enable.d.ts +2 -1
- package/dist/src/commands/extensions/enable.js +4 -17
- package/dist/src/commands/extensions/enable.js.map +1 -1
- package/dist/src/config/extensions/extensionEnablement.d.ts +0 -14
- package/dist/src/config/extensions/extensionEnablement.js +33 -81
- package/dist/src/config/extensions/extensionEnablement.js.map +1 -1
- package/dist/src/config/extensions/extensionEnablement.test.js +19 -164
- package/dist/src/config/extensions/extensionEnablement.test.js.map +1 -1
- package/dist/src/config/extensions/github.js +5 -9
- package/dist/src/config/extensions/github.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/tsconfig.tsbuildinfo +1 -1
- package/npm-shrinkwrap.json +17501 -0
- package/package.json +8 -4
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@google/gemini-cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.777",
|
|
4
4
|
"description": "Gemini CLI",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -22,10 +22,14 @@
|
|
|
22
22
|
"typecheck": "tsc --noEmit"
|
|
23
23
|
},
|
|
24
24
|
"files": [
|
|
25
|
-
"dist"
|
|
25
|
+
"dist",
|
|
26
|
+
"npm-shrinkwrap.json"
|
|
27
|
+
],
|
|
28
|
+
"bundleDependencies": [
|
|
29
|
+
"@google/gemini-cli-core"
|
|
26
30
|
],
|
|
27
31
|
"config": {
|
|
28
|
-
"sandboxImageUri": "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.0.
|
|
32
|
+
"sandboxImageUri": "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.0.777"
|
|
29
33
|
},
|
|
30
34
|
"dependencies": {
|
|
31
35
|
"@google/gemini-cli-core": "file:../core",
|
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { type CommandModule } from 'yargs';
|
|
7
|
+
import { SettingScope } from '../../config/settings.js';
|
|
7
8
|
interface DisableArgs {
|
|
8
9
|
name: string;
|
|
9
|
-
scope
|
|
10
|
+
scope: SettingScope;
|
|
10
11
|
}
|
|
11
12
|
export declare function handleDisable(args: DisableArgs): void;
|
|
12
13
|
export declare const disableCommand: CommandModule;
|
|
@@ -9,12 +9,7 @@ import { SettingScope } from '../../config/settings.js';
|
|
|
9
9
|
import { getErrorMessage } from '../../utils/errors.js';
|
|
10
10
|
export function handleDisable(args) {
|
|
11
11
|
try {
|
|
12
|
-
|
|
13
|
-
disableExtension(args.name, SettingScope.Workspace);
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
disableExtension(args.name, SettingScope.User);
|
|
17
|
-
}
|
|
12
|
+
disableExtension(args.name, args.scope);
|
|
18
13
|
console.log(`Extension "${args.name}" successfully disabled for scope "${args.scope}".`);
|
|
19
14
|
}
|
|
20
15
|
catch (error) {
|
|
@@ -34,18 +29,9 @@ export const disableCommand = {
|
|
|
34
29
|
describe: 'The scope to disable the extenison in.',
|
|
35
30
|
type: 'string',
|
|
36
31
|
default: SettingScope.User,
|
|
32
|
+
choices: [SettingScope.User, SettingScope.Workspace],
|
|
37
33
|
})
|
|
38
|
-
.check((
|
|
39
|
-
if (argv.scope &&
|
|
40
|
-
!Object.values(SettingScope)
|
|
41
|
-
.map((s) => s.toLowerCase())
|
|
42
|
-
.includes(argv.scope.toLowerCase())) {
|
|
43
|
-
throw new Error(`Invalid scope: ${argv.scope}. Please use one of ${Object.values(SettingScope)
|
|
44
|
-
.map((s) => s.toLowerCase())
|
|
45
|
-
.join(', ')}.`);
|
|
46
|
-
}
|
|
47
|
-
return true;
|
|
48
|
-
}),
|
|
34
|
+
.check((_argv) => true),
|
|
49
35
|
handler: (argv) => {
|
|
50
36
|
handleDisable({
|
|
51
37
|
name: argv['name'],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"disable.js","sourceRoot":"","sources":["../../../../src/commands/extensions/disable.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAsB,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAOxD,MAAM,UAAU,aAAa,CAAC,IAAiB;IAC7C,IAAI,CAAC;QACH,
|
|
1
|
+
{"version":3,"file":"disable.js","sourceRoot":"","sources":["../../../../src/commands/extensions/disable.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAsB,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAOxD,MAAM,UAAU,aAAa,CAAC,IAAiB;IAC7C,IAAI,CAAC;QACH,gBAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QACxC,OAAO,CAAC,GAAG,CACT,cAAc,IAAI,CAAC,IAAI,sCAAsC,IAAI,CAAC,KAAK,IAAI,CAC5E,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC;QACtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,cAAc,GAAkB;IAC3C,OAAO,EAAE,0BAA0B;IACnC,QAAQ,EAAE,wBAAwB;IAClC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CACjB,KAAK;SACF,UAAU,CAAC,MAAM,EAAE;QAClB,QAAQ,EAAE,uCAAuC;QACjD,IAAI,EAAE,QAAQ;KACf,CAAC;SACD,MAAM,CAAC,OAAO,EAAE;QACf,QAAQ,EAAE,wCAAwC;QAClD,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,YAAY,CAAC,IAAI;QAC1B,OAAO,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,YAAY,CAAC,SAAS,CAAC;KACrD,CAAC;SACD,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC;IAC3B,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;QAChB,aAAa,CAAC;YACZ,IAAI,EAAE,IAAI,CAAC,MAAM,CAAW;YAC5B,KAAK,EAAE,IAAI,CAAC,OAAO,CAAiB;SACrC,CAAC,CAAC;IACL,CAAC;CACF,CAAC"}
|
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { type CommandModule } from 'yargs';
|
|
7
|
+
import { SettingScope } from '../../config/settings.js';
|
|
7
8
|
interface EnableArgs {
|
|
8
9
|
name: string;
|
|
9
|
-
scope?:
|
|
10
|
+
scope?: SettingScope;
|
|
10
11
|
}
|
|
11
12
|
export declare function handleEnable(args: EnableArgs): void;
|
|
12
13
|
export declare const enableCommand: CommandModule;
|
|
@@ -9,12 +9,8 @@ import { enableExtension } from '../../config/extension.js';
|
|
|
9
9
|
import { SettingScope } from '../../config/settings.js';
|
|
10
10
|
export function handleEnable(args) {
|
|
11
11
|
try {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
enableExtension(args.name, SettingScope.User);
|
|
17
|
-
}
|
|
12
|
+
const scope = args.scope ? args.scope : SettingScope.User;
|
|
13
|
+
enableExtension(args.name, scope);
|
|
18
14
|
if (args.scope) {
|
|
19
15
|
console.log(`Extension "${args.name}" successfully enabled for scope "${args.scope}".`);
|
|
20
16
|
}
|
|
@@ -37,18 +33,9 @@ export const enableCommand = {
|
|
|
37
33
|
.option('scope', {
|
|
38
34
|
describe: 'The scope to enable the extenison in. If not set, will be enabled in all scopes.',
|
|
39
35
|
type: 'string',
|
|
36
|
+
choices: [SettingScope.User, SettingScope.Workspace],
|
|
40
37
|
})
|
|
41
|
-
.check((
|
|
42
|
-
if (argv.scope &&
|
|
43
|
-
!Object.values(SettingScope)
|
|
44
|
-
.map((s) => s.toLowerCase())
|
|
45
|
-
.includes(argv.scope.toLowerCase())) {
|
|
46
|
-
throw new Error(`Invalid scope: ${argv.scope}. Please use one of ${Object.values(SettingScope)
|
|
47
|
-
.map((s) => s.toLowerCase())
|
|
48
|
-
.join(', ')}.`);
|
|
49
|
-
}
|
|
50
|
-
return true;
|
|
51
|
-
}),
|
|
38
|
+
.check((_argv) => true),
|
|
52
39
|
handler: (argv) => {
|
|
53
40
|
handleEnable({
|
|
54
41
|
name: argv['name'],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enable.js","sourceRoot":"","sources":["../../../../src/commands/extensions/enable.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAsB,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAOxD,MAAM,UAAU,YAAY,CAAC,IAAgB;IAC3C,IAAI,CAAC;QACH,
|
|
1
|
+
{"version":3,"file":"enable.js","sourceRoot":"","sources":["../../../../src/commands/extensions/enable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AAC,SAAS,CAAC;KACrD,CAAC;SACD,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC;IAC3B,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;QAChB,YAAY,CAAC;YACX,IAAI,EAAE,IAAI,CAAC,MAAM,CAAW;YAC5B,KAAK,EAAE,IAAI,CAAC,OAAO,CAAiB;SACrC,CAAC,CAAC;IACL,CAAC;CACF,CAAC"}
|
|
@@ -9,20 +9,6 @@ export interface ExtensionEnablementConfig {
|
|
|
9
9
|
export interface AllExtensionsEnablementConfig {
|
|
10
10
|
[extensionName: string]: ExtensionEnablementConfig;
|
|
11
11
|
}
|
|
12
|
-
export declare class Override {
|
|
13
|
-
baseRule: string;
|
|
14
|
-
isDisable: boolean;
|
|
15
|
-
includeSubdirs: boolean;
|
|
16
|
-
constructor(baseRule: string, isDisable: boolean, includeSubdirs: boolean);
|
|
17
|
-
static fromInput(inputRule: string, includeSubdirs: boolean): Override;
|
|
18
|
-
static fromFileRule(fileRule: string): Override;
|
|
19
|
-
conflictsWith(other: Override): boolean;
|
|
20
|
-
isEqualTo(other: Override): boolean;
|
|
21
|
-
asRegex(): RegExp;
|
|
22
|
-
isChildOf(parent: Override): boolean;
|
|
23
|
-
output(): string;
|
|
24
|
-
matchesPath(path: string): boolean;
|
|
25
|
-
}
|
|
26
12
|
/**
|
|
27
13
|
* Determines if an extension is enabled based on the configuration and current path.
|
|
28
14
|
* The last matching rule in the overrides list wins.
|
|
@@ -5,69 +5,6 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import fs from 'node:fs';
|
|
7
7
|
import path from 'node:path';
|
|
8
|
-
export class Override {
|
|
9
|
-
baseRule;
|
|
10
|
-
isDisable;
|
|
11
|
-
includeSubdirs;
|
|
12
|
-
constructor(baseRule, isDisable, includeSubdirs) {
|
|
13
|
-
this.baseRule = baseRule;
|
|
14
|
-
this.isDisable = isDisable;
|
|
15
|
-
this.includeSubdirs = includeSubdirs;
|
|
16
|
-
}
|
|
17
|
-
static fromInput(inputRule, includeSubdirs) {
|
|
18
|
-
const isDisable = inputRule.startsWith('!');
|
|
19
|
-
let baseRule = isDisable ? inputRule.substring(1) : inputRule;
|
|
20
|
-
baseRule = ensureLeadingAndTrailingSlash(baseRule);
|
|
21
|
-
return new Override(baseRule, isDisable, includeSubdirs);
|
|
22
|
-
}
|
|
23
|
-
static fromFileRule(fileRule) {
|
|
24
|
-
const isDisable = fileRule.startsWith('!');
|
|
25
|
-
let baseRule = isDisable ? fileRule.substring(1) : fileRule;
|
|
26
|
-
const includeSubdirs = baseRule.endsWith('*');
|
|
27
|
-
baseRule = includeSubdirs
|
|
28
|
-
? baseRule.substring(0, baseRule.length - 1)
|
|
29
|
-
: baseRule;
|
|
30
|
-
return new Override(baseRule, isDisable, includeSubdirs);
|
|
31
|
-
}
|
|
32
|
-
conflictsWith(other) {
|
|
33
|
-
if (this.baseRule === other.baseRule) {
|
|
34
|
-
return (this.includeSubdirs !== other.includeSubdirs ||
|
|
35
|
-
this.isDisable !== other.isDisable);
|
|
36
|
-
}
|
|
37
|
-
return false;
|
|
38
|
-
}
|
|
39
|
-
isEqualTo(other) {
|
|
40
|
-
return (this.baseRule === other.baseRule &&
|
|
41
|
-
this.includeSubdirs === other.includeSubdirs &&
|
|
42
|
-
this.isDisable === other.isDisable);
|
|
43
|
-
}
|
|
44
|
-
asRegex() {
|
|
45
|
-
return globToRegex(`${this.baseRule}${this.includeSubdirs ? '*' : ''}`);
|
|
46
|
-
}
|
|
47
|
-
isChildOf(parent) {
|
|
48
|
-
if (!parent.includeSubdirs) {
|
|
49
|
-
return false;
|
|
50
|
-
}
|
|
51
|
-
return parent.asRegex().test(this.baseRule);
|
|
52
|
-
}
|
|
53
|
-
output() {
|
|
54
|
-
return `${this.isDisable ? '!' : ''}${this.baseRule}${this.includeSubdirs ? '*' : ''}`;
|
|
55
|
-
}
|
|
56
|
-
matchesPath(path) {
|
|
57
|
-
return this.asRegex().test(path);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
const ensureLeadingAndTrailingSlash = function (dirPath) {
|
|
61
|
-
// Normalize separators to forward slashes for consistent matching across platforms.
|
|
62
|
-
let result = dirPath.replace(/\\/g, '/');
|
|
63
|
-
if (result.charAt(0) !== '/') {
|
|
64
|
-
result = '/' + result;
|
|
65
|
-
}
|
|
66
|
-
if (result.charAt(result.length - 1) !== '/') {
|
|
67
|
-
result = result + '/';
|
|
68
|
-
}
|
|
69
|
-
return result;
|
|
70
|
-
};
|
|
71
8
|
/**
|
|
72
9
|
* Converts a glob pattern to a RegExp object.
|
|
73
10
|
* This is a simplified implementation that supports `*`.
|
|
@@ -78,7 +15,7 @@ const ensureLeadingAndTrailingSlash = function (dirPath) {
|
|
|
78
15
|
function globToRegex(glob) {
|
|
79
16
|
const regexString = glob
|
|
80
17
|
.replace(/[.+?^${}()|[\]\\]/g, '\\$&') // Escape special regex characters
|
|
81
|
-
.replace(
|
|
18
|
+
.replace(/\*/g, '.*'); // Convert * to .*
|
|
82
19
|
return new RegExp(`^${regexString}$`);
|
|
83
20
|
}
|
|
84
21
|
/**
|
|
@@ -101,11 +38,12 @@ export class ExtensionEnablementManager {
|
|
|
101
38
|
const extensionConfig = config[extensionName];
|
|
102
39
|
// Extensions are enabled by default.
|
|
103
40
|
let enabled = true;
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
41
|
+
for (const rule of extensionConfig?.overrides ?? []) {
|
|
42
|
+
const isDisableRule = rule.startsWith('!');
|
|
43
|
+
const globPattern = isDisableRule ? rule.substring(1) : rule;
|
|
44
|
+
const regex = globToRegex(globPattern);
|
|
45
|
+
if (regex.test(currentPath)) {
|
|
46
|
+
enabled = !isDisableRule;
|
|
109
47
|
}
|
|
110
48
|
}
|
|
111
49
|
return enabled;
|
|
@@ -134,21 +72,35 @@ export class ExtensionEnablementManager {
|
|
|
134
72
|
if (!config[extensionName]) {
|
|
135
73
|
config[extensionName] = { overrides: [] };
|
|
136
74
|
}
|
|
137
|
-
const
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
config[extensionName].overrides = overrides;
|
|
75
|
+
const pathWithGlob = `${scopePath}*`;
|
|
76
|
+
const pathWithoutGlob = scopePath;
|
|
77
|
+
const newPath = includeSubdirs ? pathWithGlob : pathWithoutGlob;
|
|
78
|
+
const conflictingPath = includeSubdirs ? pathWithoutGlob : pathWithGlob;
|
|
79
|
+
config[extensionName].overrides = config[extensionName].overrides.filter((rule) => rule !== conflictingPath &&
|
|
80
|
+
rule !== `!${conflictingPath}` &&
|
|
81
|
+
rule !== `!${newPath}`);
|
|
82
|
+
if (!config[extensionName].overrides.includes(newPath)) {
|
|
83
|
+
config[extensionName].overrides.push(newPath);
|
|
84
|
+
}
|
|
148
85
|
this.writeConfig(config);
|
|
149
86
|
}
|
|
150
87
|
disable(extensionName, includeSubdirs, scopePath) {
|
|
151
|
-
this.
|
|
88
|
+
const config = this.readConfig();
|
|
89
|
+
if (!config[extensionName]) {
|
|
90
|
+
config[extensionName] = { overrides: [] };
|
|
91
|
+
}
|
|
92
|
+
const pathWithGlob = `${scopePath}*`;
|
|
93
|
+
const pathWithoutGlob = scopePath;
|
|
94
|
+
const targetPath = includeSubdirs ? pathWithGlob : pathWithoutGlob;
|
|
95
|
+
const newRule = `!${targetPath}`;
|
|
96
|
+
const conflictingPath = includeSubdirs ? pathWithoutGlob : pathWithGlob;
|
|
97
|
+
config[extensionName].overrides = config[extensionName].overrides.filter((rule) => rule !== conflictingPath &&
|
|
98
|
+
rule !== `!${conflictingPath}` &&
|
|
99
|
+
rule !== targetPath);
|
|
100
|
+
if (!config[extensionName].overrides.includes(newRule)) {
|
|
101
|
+
config[extensionName].overrides.push(newRule);
|
|
102
|
+
}
|
|
103
|
+
this.writeConfig(config);
|
|
152
104
|
}
|
|
153
105
|
remove(extensionName) {
|
|
154
106
|
const config = this.readConfig();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extensionEnablement.js","sourceRoot":"","sources":["../../../../src/config/extensions/extensionEnablement.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAU7B
|
|
1
|
+
{"version":3,"file":"extensionEnablement.js","sourceRoot":"","sources":["../../../../src/config/extensions/extensionEnablement.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAU7B;;;;;;GAMG;AACH,SAAS,WAAW,CAAC,IAAY;IAC/B,MAAM,WAAW,GAAG,IAAI;SACrB,OAAO,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC,kCAAkC;SACxE,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,kBAAkB;IAE3C,OAAO,IAAI,MAAM,CAAC,IAAI,WAAW,GAAG,CAAC,CAAC;AACxC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,OAAO,0BAA0B;IAC7B,cAAc,CAAS;IACvB,SAAS,CAAS;IAE1B,YAAY,SAAiB;QAC3B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,2BAA2B,CAAC,CAAC;IAC1E,CAAC;IAED,SAAS,CAAC,aAAqB,EAAE,WAAmB;QAClD,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QACjC,MAAM,eAAe,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;QAC9C,qCAAqC;QACrC,IAAI,OAAO,GAAG,IAAI,CAAC;QAEnB,KAAK,MAAM,IAAI,IAAI,eAAe,EAAE,SAAS,IAAI,EAAE,EAAE,CAAC;YACpD,MA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,YAAY,CAAC,CAAC,CAAC,eAAe,CAAC;QACnE,MAAM,OAAO,GAAG,IAAI,UAAU,EAAE,CAAC;QACjC,MAAM,eAAe,GAAG,cAAc,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,YAAY,CAAC;QAExE,MAAM,CAAC,aAAa,CAAC,CAAC,SAAS,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC,MAAM,CACtE,CAAC,IAAI,EAAE,EAAE,CACP,IAAI,KAAK,eAAe;YACxB,IAAI,KAAK,IAAI,eAAe,EAAE;YAC9B,IAAI,KAAK,UAAU,CACtB,CAAC;QAEF,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;YACvD,MAAM,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAChD,CAAC;QAED,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC;IAED,MAAM,CAAC,aAAqB;QAC1B,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QACjC,IAAI,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC;YAC1B,OAAO,MAAM,CAAC,aAAa,CAAC,CAAC;YAC7B,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;CACF"}
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
* Copyright 2025 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import * as path from 'node:path';
|
|
7
6
|
import fs from 'node:fs';
|
|
8
7
|
import os from 'node:os';
|
|
8
|
+
import path from 'node:path';
|
|
9
9
|
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
|
10
|
-
import { ExtensionEnablementManager
|
|
10
|
+
import { ExtensionEnablementManager } from './extensionEnablement.js';
|
|
11
11
|
// Helper to create a temporary directory for testing
|
|
12
12
|
function createTestDir() {
|
|
13
13
|
const dirPath = fs.mkdtempSync(path.join(os.tmpdir(), 'gemini-test-'));
|
|
@@ -40,12 +40,12 @@ describe('ExtensionEnablementManager', () => {
|
|
|
40
40
|
expect(manager.isEnabled('ext-test', '/any/path')).toBe(true);
|
|
41
41
|
});
|
|
42
42
|
it('should enable a path based on an override rule', () => {
|
|
43
|
-
manager.disable('ext-test', true, '
|
|
43
|
+
manager.disable('ext-test', true, '*'); // Disable globally
|
|
44
44
|
manager.enable('ext-test', true, '/home/user/projects/');
|
|
45
45
|
expect(manager.isEnabled('ext-test', '/home/user/projects/my-app')).toBe(true);
|
|
46
46
|
});
|
|
47
47
|
it('should disable a path based on a disable override rule', () => {
|
|
48
|
-
manager.enable('ext-test', true, '
|
|
48
|
+
manager.enable('ext-test', true, '*'); // Enable globally
|
|
49
49
|
manager.disable('ext-test', true, '/home/user/projects/');
|
|
50
50
|
expect(manager.isEnabled('ext-test', '/home/user/projects/my-app')).toBe(false);
|
|
51
51
|
});
|
|
@@ -59,203 +59,58 @@ describe('ExtensionEnablementManager', () => {
|
|
|
59
59
|
manager.disable('ext-test', false, '/home/user/projects/my-app');
|
|
60
60
|
expect(manager.isEnabled('ext-test', '/home/user/projects/my-app')).toBe(false);
|
|
61
61
|
});
|
|
62
|
-
it('should handle', () => {
|
|
63
|
-
manager.enable('ext-test', true, '/home/user/projects');
|
|
64
|
-
manager.disable('ext-test', false, '/home/user/projects/my-app');
|
|
65
|
-
expect(manager.isEnabled('ext-test', '/home/user/projects/my-app')).toBe(false);
|
|
66
|
-
expect(manager.isEnabled('ext-test', '/home/user/projects/something-else')).toBe(true);
|
|
67
|
-
});
|
|
68
62
|
});
|
|
69
63
|
describe('includeSubdirs', () => {
|
|
70
64
|
it('should add a glob when enabling with includeSubdirs', () => {
|
|
71
65
|
manager.enable('ext-test', true, '/path/to/dir');
|
|
72
66
|
const config = manager.readConfig();
|
|
73
|
-
expect(config['ext-test'].overrides).toContain('/path/to/dir
|
|
67
|
+
expect(config['ext-test'].overrides).toContain('/path/to/dir*');
|
|
74
68
|
});
|
|
75
69
|
it('should not add a glob when enabling without includeSubdirs', () => {
|
|
76
70
|
manager.enable('ext-test', false, '/path/to/dir');
|
|
77
71
|
const config = manager.readConfig();
|
|
78
|
-
expect(config['ext-test'].overrides).toContain('/path/to/dir
|
|
79
|
-
expect(config['ext-test'].overrides).not.toContain('/path/to/dir
|
|
72
|
+
expect(config['ext-test'].overrides).toContain('/path/to/dir');
|
|
73
|
+
expect(config['ext-test'].overrides).not.toContain('/path/to/dir*');
|
|
80
74
|
});
|
|
81
75
|
it('should add a glob when disabling with includeSubdirs', () => {
|
|
82
76
|
manager.disable('ext-test', true, '/path/to/dir');
|
|
83
77
|
const config = manager.readConfig();
|
|
84
|
-
expect(config['ext-test'].overrides).toContain('!/path/to/dir
|
|
78
|
+
expect(config['ext-test'].overrides).toContain('!/path/to/dir*');
|
|
85
79
|
});
|
|
86
80
|
it('should remove conflicting glob rule when enabling without subdirs', () => {
|
|
87
81
|
manager.enable('ext-test', true, '/path/to/dir'); // Adds /path/to/dir*
|
|
88
82
|
manager.enable('ext-test', false, '/path/to/dir'); // Should remove the glob
|
|
89
83
|
const config = manager.readConfig();
|
|
90
|
-
expect(config['ext-test'].overrides).toContain('/path/to/dir
|
|
91
|
-
expect(config['ext-test'].overrides).not.toContain('/path/to/dir
|
|
84
|
+
expect(config['ext-test'].overrides).toContain('/path/to/dir');
|
|
85
|
+
expect(config['ext-test'].overrides).not.toContain('/path/to/dir*');
|
|
92
86
|
});
|
|
93
87
|
it('should remove conflicting non-glob rule when enabling with subdirs', () => {
|
|
94
88
|
manager.enable('ext-test', false, '/path/to/dir'); // Adds /path/to/dir
|
|
95
89
|
manager.enable('ext-test', true, '/path/to/dir'); // Should remove the non-glob
|
|
96
90
|
const config = manager.readConfig();
|
|
97
|
-
expect(config['ext-test'].overrides).toContain('/path/to/dir
|
|
98
|
-
expect(config['ext-test'].overrides).not.toContain('/path/to/dir
|
|
91
|
+
expect(config['ext-test'].overrides).toContain('/path/to/dir*');
|
|
92
|
+
expect(config['ext-test'].overrides).not.toContain('/path/to/dir');
|
|
99
93
|
});
|
|
100
94
|
it('should remove conflicting rules when disabling', () => {
|
|
101
95
|
manager.enable('ext-test', true, '/path/to/dir'); // enabled with glob
|
|
102
96
|
manager.disable('ext-test', false, '/path/to/dir'); // disabled without
|
|
103
97
|
const config = manager.readConfig();
|
|
104
|
-
expect(config['ext-test'].overrides).toContain('!/path/to/dir
|
|
105
|
-
expect(config['ext-test'].overrides).not.toContain('/path/to/dir
|
|
98
|
+
expect(config['ext-test'].overrides).toContain('!/path/to/dir');
|
|
99
|
+
expect(config['ext-test'].overrides).not.toContain('/path/to/dir*');
|
|
106
100
|
});
|
|
107
101
|
it('should correctly evaluate isEnabled with subdirs', () => {
|
|
108
|
-
manager.disable('ext-test', true, '
|
|
102
|
+
manager.disable('ext-test', true, '*');
|
|
109
103
|
manager.enable('ext-test', true, '/path/to/dir');
|
|
110
|
-
expect(manager.isEnabled('ext-test', '/path/to/dir
|
|
111
|
-
expect(manager.isEnabled('ext-test', '/path/to/dir/sub
|
|
112
|
-
expect(manager.isEnabled('ext-test', '/path/to/another
|
|
104
|
+
expect(manager.isEnabled('ext-test', '/path/to/dir')).toBe(true);
|
|
105
|
+
expect(manager.isEnabled('ext-test', '/path/to/dir/sub')).toBe(true);
|
|
106
|
+
expect(manager.isEnabled('ext-test', '/path/to/another')).toBe(false);
|
|
113
107
|
});
|
|
114
108
|
it('should correctly evaluate isEnabled without subdirs', () => {
|
|
115
|
-
manager.disable('ext-test', true, '
|
|
109
|
+
manager.disable('ext-test', true, '*');
|
|
116
110
|
manager.enable('ext-test', false, '/path/to/dir');
|
|
117
111
|
expect(manager.isEnabled('ext-test', '/path/to/dir')).toBe(true);
|
|
118
112
|
expect(manager.isEnabled('ext-test', '/path/to/dir/sub')).toBe(false);
|
|
119
113
|
});
|
|
120
114
|
});
|
|
121
|
-
describe('pruning child rules', () => {
|
|
122
|
-
it('should remove child rules when enabling a parent with subdirs', () => {
|
|
123
|
-
// Pre-existing rules for children
|
|
124
|
-
manager.enable('ext-test', false, '/path/to/dir/subdir1');
|
|
125
|
-
manager.disable('ext-test', true, '/path/to/dir/subdir2');
|
|
126
|
-
manager.enable('ext-test', false, '/path/to/another/dir');
|
|
127
|
-
// Enable the parent directory
|
|
128
|
-
manager.enable('ext-test', true, '/path/to/dir');
|
|
129
|
-
const config = manager.readConfig();
|
|
130
|
-
const overrides = config['ext-test'].overrides;
|
|
131
|
-
// The new parent rule should be present
|
|
132
|
-
expect(overrides).toContain(`/path/to/dir/*`);
|
|
133
|
-
// Child rules should be removed
|
|
134
|
-
expect(overrides).not.toContain('/path/to/dir/subdir1/');
|
|
135
|
-
expect(overrides).not.toContain(`!/path/to/dir/subdir2/*`);
|
|
136
|
-
// Unrelated rules should remain
|
|
137
|
-
expect(overrides).toContain('/path/to/another/dir/');
|
|
138
|
-
});
|
|
139
|
-
it('should remove child rules when disabling a parent with subdirs', () => {
|
|
140
|
-
// Pre-existing rules for children
|
|
141
|
-
manager.enable('ext-test', false, '/path/to/dir/subdir1');
|
|
142
|
-
manager.disable('ext-test', true, '/path/to/dir/subdir2');
|
|
143
|
-
manager.enable('ext-test', false, '/path/to/another/dir');
|
|
144
|
-
// Disable the parent directory
|
|
145
|
-
manager.disable('ext-test', true, '/path/to/dir');
|
|
146
|
-
const config = manager.readConfig();
|
|
147
|
-
const overrides = config['ext-test'].overrides;
|
|
148
|
-
// The new parent rule should be present
|
|
149
|
-
expect(overrides).toContain(`!/path/to/dir/*`);
|
|
150
|
-
// Child rules should be removed
|
|
151
|
-
expect(overrides).not.toContain('/path/to/dir/subdir1/');
|
|
152
|
-
expect(overrides).not.toContain(`!/path/to/dir/subdir2/*`);
|
|
153
|
-
// Unrelated rules should remain
|
|
154
|
-
expect(overrides).toContain('/path/to/another/dir/');
|
|
155
|
-
});
|
|
156
|
-
it('should not remove child rules if includeSubdirs is false', () => {
|
|
157
|
-
manager.enable('ext-test', false, '/path/to/dir/subdir1');
|
|
158
|
-
manager.enable('ext-test', false, '/path/to/dir'); // Not including subdirs
|
|
159
|
-
const config = manager.readConfig();
|
|
160
|
-
const overrides = config['ext-test'].overrides;
|
|
161
|
-
expect(overrides).toContain('/path/to/dir/subdir1/');
|
|
162
|
-
expect(overrides).toContain('/path/to/dir/');
|
|
163
|
-
});
|
|
164
|
-
});
|
|
165
|
-
it('should enable a path based on an enable override', () => {
|
|
166
|
-
manager.disable('ext-test', true, '/Users/chrstn');
|
|
167
|
-
manager.enable('ext-test', true, '/Users/chrstn/gemini-cli');
|
|
168
|
-
expect(manager.isEnabled('ext-test', '/Users/chrstn/gemini-cli')).toBe(true);
|
|
169
|
-
});
|
|
170
|
-
it('should ignore subdirs', () => {
|
|
171
|
-
manager.disable('ext-test', false, '/Users/chrstn');
|
|
172
|
-
expect(manager.isEnabled('ext-test', '/Users/chrstn/gemini-cli')).toBe(true);
|
|
173
|
-
});
|
|
174
|
-
});
|
|
175
|
-
describe('Override', () => {
|
|
176
|
-
it('should create an override from input', () => {
|
|
177
|
-
const override = Override.fromInput('/path/to/dir', true);
|
|
178
|
-
expect(override.baseRule).toBe(`/path/to/dir/`);
|
|
179
|
-
expect(override.isDisable).toBe(false);
|
|
180
|
-
expect(override.includeSubdirs).toBe(true);
|
|
181
|
-
});
|
|
182
|
-
it('should create a disable override from input', () => {
|
|
183
|
-
const override = Override.fromInput('!/path/to/dir', false);
|
|
184
|
-
expect(override.baseRule).toBe(`/path/to/dir/`);
|
|
185
|
-
expect(override.isDisable).toBe(true);
|
|
186
|
-
expect(override.includeSubdirs).toBe(false);
|
|
187
|
-
});
|
|
188
|
-
it('should create an override from a file rule', () => {
|
|
189
|
-
const override = Override.fromFileRule('/path/to/dir');
|
|
190
|
-
expect(override.baseRule).toBe('/path/to/dir');
|
|
191
|
-
expect(override.isDisable).toBe(false);
|
|
192
|
-
expect(override.includeSubdirs).toBe(false);
|
|
193
|
-
});
|
|
194
|
-
it('should create a disable override from a file rule', () => {
|
|
195
|
-
const override = Override.fromFileRule('!/path/to/dir/');
|
|
196
|
-
expect(override.isDisable).toBe(true);
|
|
197
|
-
expect(override.baseRule).toBe('/path/to/dir/');
|
|
198
|
-
expect(override.includeSubdirs).toBe(false);
|
|
199
|
-
});
|
|
200
|
-
it('should create an override with subdirs from a file rule', () => {
|
|
201
|
-
const override = Override.fromFileRule('/path/to/dir/*');
|
|
202
|
-
expect(override.baseRule).toBe('/path/to/dir/');
|
|
203
|
-
expect(override.isDisable).toBe(false);
|
|
204
|
-
expect(override.includeSubdirs).toBe(true);
|
|
205
|
-
});
|
|
206
|
-
it('should correctly identify conflicting overrides', () => {
|
|
207
|
-
const override1 = Override.fromInput('/path/to/dir', true);
|
|
208
|
-
const override2 = Override.fromInput('/path/to/dir', false);
|
|
209
|
-
expect(override1.conflictsWith(override2)).toBe(true);
|
|
210
|
-
});
|
|
211
|
-
it('should correctly identify non-conflicting overrides', () => {
|
|
212
|
-
const override1 = Override.fromInput('/path/to/dir', true);
|
|
213
|
-
const override2 = Override.fromInput('/path/to/another/dir', true);
|
|
214
|
-
expect(override1.conflictsWith(override2)).toBe(false);
|
|
215
|
-
});
|
|
216
|
-
it('should correctly identify equal overrides', () => {
|
|
217
|
-
const override1 = Override.fromInput('/path/to/dir', true);
|
|
218
|
-
const override2 = Override.fromInput('/path/to/dir', true);
|
|
219
|
-
expect(override1.isEqualTo(override2)).toBe(true);
|
|
220
|
-
});
|
|
221
|
-
it('should correctly identify unequal overrides', () => {
|
|
222
|
-
const override1 = Override.fromInput('/path/to/dir', true);
|
|
223
|
-
const override2 = Override.fromInput('!/path/to/dir', true);
|
|
224
|
-
expect(override1.isEqualTo(override2)).toBe(false);
|
|
225
|
-
});
|
|
226
|
-
it('should generate the correct regex', () => {
|
|
227
|
-
const override = Override.fromInput('/path/to/dir', true);
|
|
228
|
-
const regex = override.asRegex();
|
|
229
|
-
expect(regex.test('/path/to/dir/')).toBe(true);
|
|
230
|
-
expect(regex.test('/path/to/dir/subdir')).toBe(true);
|
|
231
|
-
expect(regex.test('/path/to/another/dir')).toBe(false);
|
|
232
|
-
});
|
|
233
|
-
it('should correctly identify child overrides', () => {
|
|
234
|
-
const parent = Override.fromInput('/path/to/dir', true);
|
|
235
|
-
const child = Override.fromInput('/path/to/dir/subdir', false);
|
|
236
|
-
expect(child.isChildOf(parent)).toBe(true);
|
|
237
|
-
});
|
|
238
|
-
it('should correctly identify child overrides with glob', () => {
|
|
239
|
-
const parent = Override.fromInput('/path/to/dir/*', true);
|
|
240
|
-
const child = Override.fromInput('/path/to/dir/subdir', false);
|
|
241
|
-
expect(child.isChildOf(parent)).toBe(true);
|
|
242
|
-
});
|
|
243
|
-
it('should correctly identify non-child overrides', () => {
|
|
244
|
-
const parent = Override.fromInput('/path/to/dir', true);
|
|
245
|
-
const other = Override.fromInput('/path/to/another/dir', false);
|
|
246
|
-
expect(other.isChildOf(parent)).toBe(false);
|
|
247
|
-
});
|
|
248
|
-
it('should generate the correct output string', () => {
|
|
249
|
-
const override = Override.fromInput('/path/to/dir', true);
|
|
250
|
-
expect(override.output()).toBe(`/path/to/dir/*`);
|
|
251
|
-
});
|
|
252
|
-
it('should generate the correct output string for a disable override', () => {
|
|
253
|
-
const override = Override.fromInput('!/path/to/dir', false);
|
|
254
|
-
expect(override.output()).toBe(`!/path/to/dir/`);
|
|
255
|
-
});
|
|
256
|
-
it('should disable a path based on a disable override rule', () => {
|
|
257
|
-
const override = Override.fromInput('!/path/to/dir', false);
|
|
258
|
-
expect(override.output()).toBe(`!/path/to/dir/`);
|
|
259
|
-
});
|
|
260
115
|
});
|
|
261
116
|
//# sourceMappingURL=extensionEnablement.test.js.map
|