@structured-world/gitlab-mcp 6.23.2 → 6.24.1
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/README.md +5 -2
- package/dist/src/entities/context/context-manager.d.ts +30 -0
- package/dist/src/entities/context/context-manager.js +270 -0
- package/dist/src/entities/context/context-manager.js.map +1 -0
- package/dist/src/entities/context/handlers.d.ts +10 -0
- package/dist/src/entities/context/handlers.js +60 -0
- package/dist/src/entities/context/handlers.js.map +1 -0
- package/dist/src/entities/context/index.d.ts +11 -0
- package/dist/src/entities/context/index.js +34 -0
- package/dist/src/entities/context/index.js.map +1 -0
- package/dist/src/entities/context/registry.d.ts +5 -0
- package/dist/src/entities/context/registry.js +73 -0
- package/dist/src/entities/context/registry.js.map +1 -0
- package/dist/src/entities/context/schema.d.ts +54 -0
- package/dist/src/entities/context/schema.js +52 -0
- package/dist/src/entities/context/schema.js.map +1 -0
- package/dist/src/entities/context/types.d.ts +49 -0
- package/dist/src/entities/context/types.js +3 -0
- package/dist/src/entities/context/types.js.map +1 -0
- package/dist/src/entities/index.d.ts +1 -0
- package/dist/src/entities/index.js +1 -0
- package/dist/src/entities/index.js.map +1 -1
- package/dist/src/entities/mrs/registry.js +1 -1
- package/dist/src/entities/mrs/registry.js.map +1 -1
- package/dist/src/entities/mrs/schema-readonly.d.ts +1 -1
- package/dist/src/entities/mrs/schema-readonly.js +1 -1
- package/dist/src/entities/mrs/schema-readonly.js.map +1 -1
- package/dist/src/entities/search/schema-readonly.d.ts +7 -7
- package/dist/src/profiles/scope-enforcer.d.ts +10 -6
- package/dist/src/profiles/scope-enforcer.js +115 -9
- package/dist/src/profiles/scope-enforcer.js.map +1 -1
- package/dist/src/profiles/types.d.ts +20 -5
- package/dist/src/profiles/types.js +34 -19
- package/dist/src/profiles/types.js.map +1 -1
- package/dist/src/registry-manager.js +5 -0
- package/dist/src/registry-manager.js.map +1 -1
- package/dist/src/server.d.ts +1 -0
- package/dist/src/server.js +13 -1
- package/dist/src/server.js.map +1 -1
- package/dist/structured-world-gitlab-mcp-6.24.1.tgz +0 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/structured-world-gitlab-mcp-6.23.2.tgz +0 -0
package/README.md
CHANGED
|
@@ -735,7 +735,7 @@ Per-client capability detection may be added, allowing the server to automatical
|
|
|
735
735
|
|
|
736
736
|
## Tools 🛠️
|
|
737
737
|
|
|
738
|
-
**
|
|
738
|
+
**62 Tools Available** - Organized by entity and functionality below.
|
|
739
739
|
|
|
740
740
|
### Key Features:
|
|
741
741
|
- **CQRS Pattern** - Consolidated action-based tools: `browse_*` for reads, `manage_*` for writes
|
|
@@ -752,7 +752,7 @@ Per-client capability detection may be added, allowing the server to automatical
|
|
|
752
752
|
- 📖 = Read-only tool (available in GITLAB_READ_ONLY_MODE)
|
|
753
753
|
- ✏️ = Read/Write tool (disabled in GITLAB_READ_ONLY_MODE)
|
|
754
754
|
|
|
755
|
-
### Core Tools (
|
|
755
|
+
### Core Tools (14 tools)
|
|
756
756
|
Core GitLab functionality always available. Uses CQRS pattern with consolidated action-based tools.
|
|
757
757
|
|
|
758
758
|
#### Repository & Project Management
|
|
@@ -780,6 +780,9 @@ Core GitLab functionality always available. Uses CQRS pattern with consolidated
|
|
|
780
780
|
- 📖 **`list_todos`**: View your GitLab todos (notifications requiring action). Filter by state, action type, or target type.
|
|
781
781
|
- ✏️ **`manage_todos`**: Manage todo items. Actions: "mark_done" completes single todo, "mark_all_done" clears queue, "restore" undoes completed todo.
|
|
782
782
|
|
|
783
|
+
#### Context Management
|
|
784
|
+
- 📖 **`manage_context`**: CONTEXT: Manage runtime session context. Actions: "show" returns current context (host, preset, scope, mode); "list_presets" lists available presets; "list_profiles" lists OAuth profiles (OAuth mode only); "switch_preset" changes active preset; "switch_profile" changes OAuth profile (OAuth mode only); "set_scope" restricts operations to a namespace with auto-detection (group vs project); "reset" restores initial context.
|
|
785
|
+
|
|
783
786
|
### Labels Management (5 tools)
|
|
784
787
|
Requires USE_LABELS=true environment variable (enabled by default). Supports both project and group labels.
|
|
785
788
|
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ScopeEnforcer } from "../../profiles/scope-enforcer";
|
|
2
|
+
import { Preset, ProfileInfo } from "../../profiles/types";
|
|
3
|
+
import { PresetInfo, ResetResult, SessionContext, SetScopeResult, SwitchResult } from "./types";
|
|
4
|
+
export declare class ContextManager {
|
|
5
|
+
private static instance;
|
|
6
|
+
private profileLoader;
|
|
7
|
+
private currentPreset;
|
|
8
|
+
private currentPresetName;
|
|
9
|
+
private currentScope;
|
|
10
|
+
private currentScopeEnforcer;
|
|
11
|
+
private currentProfileName;
|
|
12
|
+
private initialContext;
|
|
13
|
+
private constructor();
|
|
14
|
+
static getInstance(): ContextManager;
|
|
15
|
+
static resetInstance(): void;
|
|
16
|
+
private captureInitialContext;
|
|
17
|
+
private scopeConfigToRuntimeScope;
|
|
18
|
+
getContext(): SessionContext;
|
|
19
|
+
listPresets(): Promise<PresetInfo[]>;
|
|
20
|
+
listProfiles(): Promise<ProfileInfo[]>;
|
|
21
|
+
switchPreset(presetName: string): Promise<SwitchResult>;
|
|
22
|
+
switchProfile(profileName: string): Promise<SwitchResult>;
|
|
23
|
+
setScope(namespace: string, includeSubgroups?: boolean): Promise<SetScopeResult>;
|
|
24
|
+
reset(): ResetResult;
|
|
25
|
+
getScopeEnforcer(): ScopeEnforcer | null;
|
|
26
|
+
hasScope(): boolean;
|
|
27
|
+
getCurrentPreset(): Preset | null;
|
|
28
|
+
getCurrentPresetName(): string | null;
|
|
29
|
+
}
|
|
30
|
+
export declare function getContextManager(): ContextManager;
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ContextManager = void 0;
|
|
4
|
+
exports.getContextManager = getContextManager;
|
|
5
|
+
const config_1 = require("../../config");
|
|
6
|
+
const logger_1 = require("../../logger");
|
|
7
|
+
const loader_1 = require("../../profiles/loader");
|
|
8
|
+
const scope_enforcer_1 = require("../../profiles/scope-enforcer");
|
|
9
|
+
const server_1 = require("../../server");
|
|
10
|
+
const namespace_1 = require("../../utils/namespace");
|
|
11
|
+
function isOAuthMode() {
|
|
12
|
+
return process.env.OAUTH_ENABLED === "true";
|
|
13
|
+
}
|
|
14
|
+
function getHost() {
|
|
15
|
+
try {
|
|
16
|
+
const url = new URL(config_1.GITLAB_BASE_URL);
|
|
17
|
+
return url.hostname;
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return config_1.GITLAB_BASE_URL;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
class ContextManager {
|
|
24
|
+
static instance = null;
|
|
25
|
+
profileLoader;
|
|
26
|
+
currentPreset = null;
|
|
27
|
+
currentPresetName = null;
|
|
28
|
+
currentScope = null;
|
|
29
|
+
currentScopeEnforcer = null;
|
|
30
|
+
currentProfileName = null;
|
|
31
|
+
initialContext = null;
|
|
32
|
+
constructor() {
|
|
33
|
+
this.profileLoader = new loader_1.ProfileLoader();
|
|
34
|
+
this.captureInitialContext();
|
|
35
|
+
}
|
|
36
|
+
static getInstance() {
|
|
37
|
+
ContextManager.instance ??= new ContextManager();
|
|
38
|
+
return ContextManager.instance;
|
|
39
|
+
}
|
|
40
|
+
static resetInstance() {
|
|
41
|
+
ContextManager.instance = null;
|
|
42
|
+
}
|
|
43
|
+
captureInitialContext() {
|
|
44
|
+
this.initialContext = {
|
|
45
|
+
host: getHost(),
|
|
46
|
+
apiUrl: config_1.GITLAB_BASE_URL,
|
|
47
|
+
readOnly: config_1.GITLAB_READ_ONLY_MODE,
|
|
48
|
+
oauthMode: isOAuthMode(),
|
|
49
|
+
presetName: this.currentPresetName ?? undefined,
|
|
50
|
+
profileName: this.currentProfileName ?? undefined,
|
|
51
|
+
scope: this.currentScope
|
|
52
|
+
? this.scopeConfigToRuntimeScope(this.currentScope, false)
|
|
53
|
+
: undefined,
|
|
54
|
+
};
|
|
55
|
+
logger_1.logger.debug({ initialContext: this.initialContext }, "Captured initial context");
|
|
56
|
+
}
|
|
57
|
+
scopeConfigToRuntimeScope(scope, detected) {
|
|
58
|
+
if (scope.project) {
|
|
59
|
+
return {
|
|
60
|
+
type: "project",
|
|
61
|
+
path: scope.project,
|
|
62
|
+
includeSubgroups: false,
|
|
63
|
+
detected,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
if (scope.group) {
|
|
67
|
+
return {
|
|
68
|
+
type: "group",
|
|
69
|
+
path: scope.group,
|
|
70
|
+
includeSubgroups: scope.includeSubgroups !== false,
|
|
71
|
+
detected,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
if (scope.namespace) {
|
|
75
|
+
return {
|
|
76
|
+
type: "group",
|
|
77
|
+
path: scope.namespace,
|
|
78
|
+
includeSubgroups: scope.includeSubgroups !== false,
|
|
79
|
+
detected,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
if (scope.projects && scope.projects.length > 0) {
|
|
83
|
+
return {
|
|
84
|
+
type: "project",
|
|
85
|
+
path: scope.projects[0],
|
|
86
|
+
additionalPaths: scope.projects.length > 1 ? scope.projects.slice(1) : undefined,
|
|
87
|
+
includeSubgroups: false,
|
|
88
|
+
detected,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
if (scope.groups && scope.groups.length > 0) {
|
|
92
|
+
return {
|
|
93
|
+
type: "group",
|
|
94
|
+
path: scope.groups[0],
|
|
95
|
+
additionalPaths: scope.groups.length > 1 ? scope.groups.slice(1) : undefined,
|
|
96
|
+
includeSubgroups: scope.includeSubgroups !== false,
|
|
97
|
+
detected,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
logger_1.logger.error({ scope }, "Invalid scope configuration: no usable scope fields found");
|
|
101
|
+
throw new Error("Invalid scope configuration: expected project, group, namespace, projects, or groups to be defined");
|
|
102
|
+
}
|
|
103
|
+
getContext() {
|
|
104
|
+
const context = {
|
|
105
|
+
host: getHost(),
|
|
106
|
+
apiUrl: config_1.GITLAB_BASE_URL,
|
|
107
|
+
readOnly: config_1.GITLAB_READ_ONLY_MODE,
|
|
108
|
+
oauthMode: isOAuthMode(),
|
|
109
|
+
presetName: this.currentPresetName ?? undefined,
|
|
110
|
+
profileName: this.currentProfileName ?? undefined,
|
|
111
|
+
scope: this.currentScope
|
|
112
|
+
? this.scopeConfigToRuntimeScope(this.currentScope, false)
|
|
113
|
+
: undefined,
|
|
114
|
+
initialContext: this.initialContext ?? undefined,
|
|
115
|
+
};
|
|
116
|
+
return context;
|
|
117
|
+
}
|
|
118
|
+
async listPresets() {
|
|
119
|
+
const profiles = await this.profileLoader.listProfiles();
|
|
120
|
+
const presets = profiles
|
|
121
|
+
.filter(p => p.isPreset)
|
|
122
|
+
.map(p => ({
|
|
123
|
+
name: p.name,
|
|
124
|
+
description: p.description,
|
|
125
|
+
readOnly: p.readOnly,
|
|
126
|
+
isBuiltIn: p.isBuiltIn,
|
|
127
|
+
}));
|
|
128
|
+
if (this.currentPresetName && this.currentPreset) {
|
|
129
|
+
const exists = presets.some(p => p.name === this.currentPresetName);
|
|
130
|
+
if (!exists) {
|
|
131
|
+
presets.unshift({
|
|
132
|
+
name: this.currentPresetName,
|
|
133
|
+
description: this.currentPreset.description,
|
|
134
|
+
readOnly: this.currentPreset.read_only ?? false,
|
|
135
|
+
isBuiltIn: false,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return presets;
|
|
140
|
+
}
|
|
141
|
+
async listProfiles() {
|
|
142
|
+
if (!isOAuthMode()) {
|
|
143
|
+
throw new Error("list_profiles is only available in OAuth mode");
|
|
144
|
+
}
|
|
145
|
+
const profiles = await this.profileLoader.listProfiles();
|
|
146
|
+
return profiles.filter(p => !p.isPreset);
|
|
147
|
+
}
|
|
148
|
+
async switchPreset(presetName) {
|
|
149
|
+
const previousPreset = this.currentPresetName;
|
|
150
|
+
try {
|
|
151
|
+
const preset = await this.profileLoader.loadPreset(presetName);
|
|
152
|
+
this.currentPreset = preset;
|
|
153
|
+
this.currentPresetName = presetName;
|
|
154
|
+
if (preset.scope) {
|
|
155
|
+
this.currentScope = preset.scope;
|
|
156
|
+
this.currentScopeEnforcer = new scope_enforcer_1.ScopeEnforcer(preset.scope);
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
this.currentScope = null;
|
|
160
|
+
this.currentScopeEnforcer = null;
|
|
161
|
+
}
|
|
162
|
+
logger_1.logger.info({ previous: previousPreset, current: presetName }, "Switched preset");
|
|
163
|
+
await (0, server_1.sendToolsListChangedNotification)();
|
|
164
|
+
return {
|
|
165
|
+
success: true,
|
|
166
|
+
previous: previousPreset ?? undefined,
|
|
167
|
+
current: presetName,
|
|
168
|
+
message: `Switched to preset '${presetName}'`,
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
catch (error) {
|
|
172
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
173
|
+
logger_1.logger.error({ error: message, preset: presetName }, "Failed to switch preset");
|
|
174
|
+
throw new Error(`Failed to switch to preset '${presetName}': ${message}`);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
async switchProfile(profileName) {
|
|
178
|
+
if (!isOAuthMode()) {
|
|
179
|
+
throw new Error("switch_profile is only available in OAuth mode");
|
|
180
|
+
}
|
|
181
|
+
const previousProfile = this.currentProfileName;
|
|
182
|
+
try {
|
|
183
|
+
await this.profileLoader.loadProfile(profileName);
|
|
184
|
+
this.currentProfileName = profileName;
|
|
185
|
+
logger_1.logger.info({ previous: previousProfile, current: profileName }, "Switched profile");
|
|
186
|
+
return {
|
|
187
|
+
success: true,
|
|
188
|
+
previous: previousProfile ?? undefined,
|
|
189
|
+
current: profileName,
|
|
190
|
+
message: `Switched to profile '${profileName}'`,
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
catch (error) {
|
|
194
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
195
|
+
logger_1.logger.error({ error: message, profile: profileName }, "Failed to switch profile");
|
|
196
|
+
throw new Error(`Failed to switch to profile '${profileName}': ${message}`);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
async setScope(namespace, includeSubgroups = true) {
|
|
200
|
+
try {
|
|
201
|
+
const namespaceType = await (0, namespace_1.detectNamespaceType)(namespace);
|
|
202
|
+
let scopeConfig;
|
|
203
|
+
if (namespaceType === "project") {
|
|
204
|
+
scopeConfig = {
|
|
205
|
+
project: namespace,
|
|
206
|
+
includeSubgroups: false,
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
scopeConfig = {
|
|
211
|
+
group: namespace,
|
|
212
|
+
includeSubgroups,
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
this.currentScope = scopeConfig;
|
|
216
|
+
this.currentScopeEnforcer = new scope_enforcer_1.ScopeEnforcer(scopeConfig);
|
|
217
|
+
const runtimeScope = {
|
|
218
|
+
type: namespaceType,
|
|
219
|
+
path: namespace,
|
|
220
|
+
includeSubgroups: namespaceType === "group" ? includeSubgroups : false,
|
|
221
|
+
detected: true,
|
|
222
|
+
};
|
|
223
|
+
logger_1.logger.info({ namespace, type: namespaceType, includeSubgroups }, "Scope set with auto-detection");
|
|
224
|
+
return {
|
|
225
|
+
success: true,
|
|
226
|
+
scope: runtimeScope,
|
|
227
|
+
message: `Scope set to ${namespaceType} '${namespace}'${namespaceType === "group" && includeSubgroups ? " (including subgroups)" : ""}`,
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
catch (error) {
|
|
231
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
232
|
+
logger_1.logger.error({ error: message, namespace }, "Failed to set scope");
|
|
233
|
+
throw new Error(`Failed to set scope for '${namespace}': ${message}`);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
reset() {
|
|
237
|
+
if (!this.initialContext) {
|
|
238
|
+
throw new Error("No initial context captured - cannot reset");
|
|
239
|
+
}
|
|
240
|
+
this.currentPreset = null;
|
|
241
|
+
this.currentPresetName = null;
|
|
242
|
+
this.currentScope = null;
|
|
243
|
+
this.currentScopeEnforcer = null;
|
|
244
|
+
this.currentProfileName = null;
|
|
245
|
+
this.captureInitialContext();
|
|
246
|
+
logger_1.logger.info("Context reset to initial state");
|
|
247
|
+
return {
|
|
248
|
+
success: true,
|
|
249
|
+
message: "Context reset to initial state",
|
|
250
|
+
context: this.getContext(),
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
getScopeEnforcer() {
|
|
254
|
+
return this.currentScopeEnforcer;
|
|
255
|
+
}
|
|
256
|
+
hasScope() {
|
|
257
|
+
return this.currentScope !== null;
|
|
258
|
+
}
|
|
259
|
+
getCurrentPreset() {
|
|
260
|
+
return this.currentPreset;
|
|
261
|
+
}
|
|
262
|
+
getCurrentPresetName() {
|
|
263
|
+
return this.currentPresetName;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
exports.ContextManager = ContextManager;
|
|
267
|
+
function getContextManager() {
|
|
268
|
+
return ContextManager.getInstance();
|
|
269
|
+
}
|
|
270
|
+
//# sourceMappingURL=context-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-manager.js","sourceRoot":"","sources":["../../../../src/entities/context/context-manager.ts"],"names":[],"mappings":";;;AAiaA,8CAEC;AArZD,yCAAsE;AACtE,yCAAsC;AACtC,kDAAsD;AACtD,kEAA8D;AAE9D,yCAAgE;AAChE,qDAA4D;AAa5D,SAAS,WAAW;IAClB,OAAO,OAAO,CAAC,GAAG,CAAC,aAAa,KAAK,MAAM,CAAC;AAC9C,CAAC;AAKD,SAAS,OAAO;IACd,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,wBAAe,CAAC,CAAC;QACrC,OAAO,GAAG,CAAC,QAAQ,CAAC;IACtB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,wBAAe,CAAC;IACzB,CAAC;AACH,CA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I,CAAC,UAAU,EAAE;SAC3B,CAAC;IACJ,CAAC;IAKD,gBAAgB;QACd,OAAO,IAAI,CAAC,oBAAoB,CAAC;IACnC,CAAC;IAKD,QAAQ;QACN,OAAO,IAAI,CAAC,YAAY,KAAK,IAAI,CAAC;IACpC,CAAC;IAKD,gBAAgB;QACd,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAKD,oBAAoB;QAClB,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAChC,CAAC;;AAtWH,wCAuWC;AAGD,SAAgB,iBAAiB;IAC/B,OAAO,cAAc,CAAC,WAAW,EAAE,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ListPresetsInput, ListProfilesInput, ManageContextInput, ResetContextInput, SetScopeInput, ShowContextInput, SwitchPresetInput, SwitchProfileInput } from "./schema";
|
|
2
|
+
import { PresetInfo, ProfileInfo, ResetResult, SessionContext, SetScopeResult, SwitchResult } from "./types";
|
|
3
|
+
export declare function handleShowContext(_input: ShowContextInput): Promise<SessionContext>;
|
|
4
|
+
export declare function handleListPresets(_input: ListPresetsInput): Promise<PresetInfo[]>;
|
|
5
|
+
export declare function handleListProfiles(_input: ListProfilesInput): Promise<ProfileInfo[]>;
|
|
6
|
+
export declare function handleSwitchPreset(input: SwitchPresetInput): Promise<SwitchResult>;
|
|
7
|
+
export declare function handleSwitchProfile(input: SwitchProfileInput): Promise<SwitchResult>;
|
|
8
|
+
export declare function handleSetScope(input: SetScopeInput): Promise<SetScopeResult>;
|
|
9
|
+
export declare function handleResetContext(_input: ResetContextInput): Promise<ResetResult>;
|
|
10
|
+
export declare function handleManageContext(input: ManageContextInput): Promise<SessionContext | PresetInfo[] | ProfileInfo[] | SwitchResult | SetScopeResult | ResetResult>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handleShowContext = handleShowContext;
|
|
4
|
+
exports.handleListPresets = handleListPresets;
|
|
5
|
+
exports.handleListProfiles = handleListProfiles;
|
|
6
|
+
exports.handleSwitchPreset = handleSwitchPreset;
|
|
7
|
+
exports.handleSwitchProfile = handleSwitchProfile;
|
|
8
|
+
exports.handleSetScope = handleSetScope;
|
|
9
|
+
exports.handleResetContext = handleResetContext;
|
|
10
|
+
exports.handleManageContext = handleManageContext;
|
|
11
|
+
const context_manager_1 = require("./context-manager");
|
|
12
|
+
async function handleShowContext(_input) {
|
|
13
|
+
const manager = (0, context_manager_1.getContextManager)();
|
|
14
|
+
return manager.getContext();
|
|
15
|
+
}
|
|
16
|
+
async function handleListPresets(_input) {
|
|
17
|
+
const manager = (0, context_manager_1.getContextManager)();
|
|
18
|
+
return manager.listPresets();
|
|
19
|
+
}
|
|
20
|
+
async function handleListProfiles(_input) {
|
|
21
|
+
const manager = (0, context_manager_1.getContextManager)();
|
|
22
|
+
return manager.listProfiles();
|
|
23
|
+
}
|
|
24
|
+
async function handleSwitchPreset(input) {
|
|
25
|
+
const manager = (0, context_manager_1.getContextManager)();
|
|
26
|
+
return manager.switchPreset(input.preset);
|
|
27
|
+
}
|
|
28
|
+
async function handleSwitchProfile(input) {
|
|
29
|
+
const manager = (0, context_manager_1.getContextManager)();
|
|
30
|
+
return manager.switchProfile(input.profile);
|
|
31
|
+
}
|
|
32
|
+
async function handleSetScope(input) {
|
|
33
|
+
const manager = (0, context_manager_1.getContextManager)();
|
|
34
|
+
return manager.setScope(input.namespace, input.includeSubgroups);
|
|
35
|
+
}
|
|
36
|
+
async function handleResetContext(_input) {
|
|
37
|
+
const manager = (0, context_manager_1.getContextManager)();
|
|
38
|
+
return manager.reset();
|
|
39
|
+
}
|
|
40
|
+
async function handleManageContext(input) {
|
|
41
|
+
switch (input.action) {
|
|
42
|
+
case "show":
|
|
43
|
+
return handleShowContext(input);
|
|
44
|
+
case "list_presets":
|
|
45
|
+
return handleListPresets(input);
|
|
46
|
+
case "list_profiles":
|
|
47
|
+
return handleListProfiles(input);
|
|
48
|
+
case "switch_preset":
|
|
49
|
+
return handleSwitchPreset(input);
|
|
50
|
+
case "switch_profile":
|
|
51
|
+
return handleSwitchProfile(input);
|
|
52
|
+
case "set_scope":
|
|
53
|
+
return handleSetScope(input);
|
|
54
|
+
case "reset":
|
|
55
|
+
return handleResetContext(input);
|
|
56
|
+
default:
|
|
57
|
+
throw new Error(`Unknown action: ${input.action}`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=handlers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handlers.js","sourceRoot":"","sources":["../../../../src/entities/context/handlers.ts"],"names":[],"mappings":";;AA6BA,8CAGC;AAKD,8CAGC;AAKD,gDAGC;AAKD,gDAGC;AAKD,kDAGC;AAKD,wCAGC;AAKD,gDAGC;AAKD,kDAwBC;AAvGD,uDAAsD;AAuB/C,KAAK,UAAU,iBAAiB,CAAC,MAAwB;IAC9D,MAAM,OAAO,GAAG,IAAA,mCAAiB,GAAE,CAAC;IACpC,OAAO,OAAO,CAAC,UAAU,EAAE,CAAC;AAC9B,CAAC;AAKM,KAAK,UAAU,iBAAiB,CAAC,MAAwB;IAC9D,MAAM,OAAO,GAAG,IAAA,mCAAiB,GAAE,CAAC;IACpC,OAAO,OAAO,CAAC,WAAW,EAAE,CAAC;AAC/B,CAAC;AAKM,KAAK,UAAU,kBAAkB,CAAC,MAAyB;IAChE,MAAM,OAAO,GAAG,IAAA,mCAAiB,GAAE,CAAC;IACpC,OAAO,OAAO,CAAC,YAAY,EAAE,CAAC;AAChC,CAAC;AAKM,KAAK,UAAU,kBAAkB,CAAC,KAAwB;IAC/D,MAAM,OAAO,GAAG,IAAA,mCAAiB,GAAE,CAAC;IACpC,OAAO,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAC5C,CAAC;AAKM,KAAK,UAAU,mBAAmB,CAAC,KAAyB;IACjE,MAAM,OAAO,GAAG,IAAA,mCAAiB,GAAE,CAAC;IACpC,OAAO,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AAC9C,CAAC;AAKM,KAAK,UAAU,cAAc,CAAC,KAAoB;IACvD,MAAM,OAAO,GAAG,IAAA,mCAAiB,GAAE,CAAC;IACpC,OAAO,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAC;AACnE,CAAC;AAKM,KAAK,UAAU,kBAAkB,CAAC,MAAyB;IAChE,MAAM,OAAO,GAAG,IAAA,mCAAiB,GAAE,CAAC;IACpC,OAAO,OAAO,CAAC,KAAK,EAAE,CAAC;AACzB,CAAC;AAKM,KAAK,UAAU,mBAAmB,CACvC,KAAyB;IAIzB,QAAQ,KAAK,CAAC,MAAM,EAAE,CAAC;QACrB,KAAK,MAAM;YACT,OAAO,iBAAiB,CAAC,KAAK,CAAC,CAAC;QAClC,KAAK,cAAc;YACjB,OAAO,iBAAiB,CAAC,KAAK,CAAC,CAAC;QAClC,KAAK,eAAe;YAClB,OAAO,kBAAkB,CAAC,KAAK,CAAC,CAAC;QACnC,KAAK,eAAe;YAClB,OAAO,kBAAkB,CAAC,KAAK,CAAC,CAAC;QACnC,KAAK,gBAAgB;YACnB,OAAO,mBAAmB,CAAC,KAAK,CAAC,CAAC;QACpC,KAAK,WAAW;YACd,OAAO,cAAc,CAAC,KAAK,CAAC,CAAC;QAC/B,KAAK,OAAO;YACV,OAAO,kBAAkB,CAAC,KAAK,CAAC,CAAC;QAEnC;YACE,MAAM,IAAI,KAAK,CAAC,mBAAoB,KAA4B,CAAC,MAAM,EAAE,CAAC,CAAC;IAC/E,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from "../shared";
|
|
2
|
+
export * from "./types";
|
|
3
|
+
export * from "./schema";
|
|
4
|
+
export * from "./context-manager";
|
|
5
|
+
export * from "./handlers";
|
|
6
|
+
export * from "./registry";
|
|
7
|
+
import { contextToolRegistry } from "./registry";
|
|
8
|
+
import type { ToolDefinition } from "../../types";
|
|
9
|
+
export declare const contextTools: ToolDefinition[];
|
|
10
|
+
export declare const contextReadOnlyTools: string[];
|
|
11
|
+
export { contextToolRegistry };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.contextToolRegistry = exports.contextReadOnlyTools = exports.contextTools = void 0;
|
|
18
|
+
__exportStar(require("../shared"), exports);
|
|
19
|
+
__exportStar(require("./types"), exports);
|
|
20
|
+
__exportStar(require("./schema"), exports);
|
|
21
|
+
__exportStar(require("./context-manager"), exports);
|
|
22
|
+
__exportStar(require("./handlers"), exports);
|
|
23
|
+
__exportStar(require("./registry"), exports);
|
|
24
|
+
const registry_1 = require("./registry");
|
|
25
|
+
Object.defineProperty(exports, "contextToolRegistry", { enumerable: true, get: function () { return registry_1.contextToolRegistry; } });
|
|
26
|
+
const isReadOnly = process.env.GITLAB_READ_ONLY_MODE === "true";
|
|
27
|
+
const contextToolsFromRegistry = (0, registry_1.getFilteredContextTools)(isReadOnly);
|
|
28
|
+
exports.contextTools = contextToolsFromRegistry.map((tool) => ({
|
|
29
|
+
name: tool.name,
|
|
30
|
+
description: tool.description,
|
|
31
|
+
inputSchema: tool.inputSchema,
|
|
32
|
+
}));
|
|
33
|
+
exports.contextReadOnlyTools = (0, registry_1.getContextReadOnlyToolNames)();
|
|
34
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/entities/context/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,4CAA0B;AAG1B,0CAAwB;AAGxB,2CAAyB;AAGzB,oDAAkC;AAGlC,6CAA2B;AAG3B,6CAA2B;AAG3B,yCAIoB;AAsBX,oGAvBP,8BAAmB,OAuBO;AAlB5B,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,KAAK,MAAM,CAAC;AAGhE,MAAM,wBAAwB,GAAG,IAAA,kCAAuB,EAAC,UAAU,CAAC,CAAC;AAGxD,QAAA,YAAY,GAAqB,wBAAwB,CAAC,GAAG,CACxE,CAAC,IAAI,EAAkB,EAAE,CAAC,CAAC;IACzB,IAAI,EAAE,IAAI,CAAC,IAAI;IACf,WAAW,EAAE,IAAI,CAAC,WAAW;IAC7B,WAAW,EAAE,IAAI,CAAC,WAAW;CAC9B,CAAC,CACH,CAAC;AAGW,QAAA,oBAAoB,GAAG,IAAA,sCAA2B,GAAE,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ToolRegistry, EnhancedToolDefinition } from "../../types";
|
|
2
|
+
export declare const contextToolRegistry: ToolRegistry;
|
|
3
|
+
export declare function getContextReadOnlyToolNames(): string[];
|
|
4
|
+
export declare function getContextToolDefinitions(): EnhancedToolDefinition[];
|
|
5
|
+
export declare function getFilteredContextTools(_readOnlyMode?: boolean): EnhancedToolDefinition[];
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.contextToolRegistry = void 0;
|
|
37
|
+
exports.getContextReadOnlyToolNames = getContextReadOnlyToolNames;
|
|
38
|
+
exports.getContextToolDefinitions = getContextToolDefinitions;
|
|
39
|
+
exports.getFilteredContextTools = getFilteredContextTools;
|
|
40
|
+
const z = __importStar(require("zod"));
|
|
41
|
+
const schema_1 = require("./schema");
|
|
42
|
+
const handlers_1 = require("./handlers");
|
|
43
|
+
exports.contextToolRegistry = new Map([
|
|
44
|
+
[
|
|
45
|
+
"manage_context",
|
|
46
|
+
{
|
|
47
|
+
name: "manage_context",
|
|
48
|
+
description: "CONTEXT: Manage runtime session context. Actions: " +
|
|
49
|
+
"'show' returns current context (host, preset, scope, mode); " +
|
|
50
|
+
"'list_presets' lists available presets with descriptions; " +
|
|
51
|
+
"'list_profiles' lists OAuth profiles (OAuth mode only); " +
|
|
52
|
+
"'switch_preset' changes active preset by name; " +
|
|
53
|
+
"'switch_profile' changes OAuth profile (OAuth mode only); " +
|
|
54
|
+
"'set_scope' restricts operations to a namespace (auto-detects group vs project); " +
|
|
55
|
+
"'reset' restores initial context from session start.",
|
|
56
|
+
inputSchema: z.toJSONSchema(schema_1.ManageContextSchema),
|
|
57
|
+
handler: async (args) => {
|
|
58
|
+
const input = schema_1.ManageContextSchema.parse(args);
|
|
59
|
+
return (0, handlers_1.handleManageContext)(input);
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
]);
|
|
64
|
+
function getContextReadOnlyToolNames() {
|
|
65
|
+
return ["manage_context"];
|
|
66
|
+
}
|
|
67
|
+
function getContextToolDefinitions() {
|
|
68
|
+
return Array.from(exports.contextToolRegistry.values());
|
|
69
|
+
}
|
|
70
|
+
function getFilteredContextTools(_readOnlyMode = false) {
|
|
71
|
+
return getContextToolDefinitions();
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../../src/entities/context/registry.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDA,kEAEC;AAKD,8DAEC;AAMD,0DAEC;AAhED,uCAAyB;AAEzB,qCAA+C;AAC/C,yCAAiD;AAcpC,QAAA,mBAAmB,GAAiB,IAAI,GAAG,CAAiC;IACvF;QACE,gBAAgB;QAChB;YACE,IAAI,EAAE,gBAAgB;YACtB,WAAW,EACT,oDAAoD;gBACpD,8DAA8D;gBAC9D,4DAA4D;gBAC5D,0DAA0D;gBAC1D,iDAAiD;gBACjD,4DAA4D;gBAC5D,mFAAmF;gBACnF,sDAAsD;YACxD,WAAW,EAAE,CAAC,CAAC,YAAY,CAAC,4BAAmB,CAAC;YAEhD,OAAO,EAAE,KAAK,EAAE,IAAa,EAAE,EAAE;gBAC/B,MAAM,KAAK,GAAG,4BAAmB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gBAC9C,OAAO,IAAA,8BAAmB,EAAC,KAAK,CAAC,CAAC;YACpC,CAAC;SACF;KACF;CACF,CAAC,CAAC;AAQH,SAAgB,2BAA2B;IACzC,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAC5B,CAAC;AAKD,SAAgB,yBAAyB;IACvC,OAAO,KAAK,CAAC,IAAI,CAAC,2BAAmB,CAAC,MAAM,EAAE,CAAC,CAAC;AAClD,CAAC;AAMD,SAAgB,uBAAuB,CAAC,gBAAyB,KAAK;IACpE,OAAO,yBAAyB,EAAE,CAAC;AACrC,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
declare const ShowContextSchema: z.ZodObject<{
|
|
3
|
+
action: z.ZodLiteral<"show">;
|
|
4
|
+
}, z.core.$strip>;
|
|
5
|
+
declare const ListPresetsSchema: z.ZodObject<{
|
|
6
|
+
action: z.ZodLiteral<"list_presets">;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
declare const ListProfilesSchema: z.ZodObject<{
|
|
9
|
+
action: z.ZodLiteral<"list_profiles">;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
declare const SwitchPresetSchema: z.ZodObject<{
|
|
12
|
+
action: z.ZodLiteral<"switch_preset">;
|
|
13
|
+
preset: z.ZodString;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
declare const SwitchProfileSchema: z.ZodObject<{
|
|
16
|
+
action: z.ZodLiteral<"switch_profile">;
|
|
17
|
+
profile: z.ZodString;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
declare const SetScopeSchema: z.ZodObject<{
|
|
20
|
+
action: z.ZodLiteral<"set_scope">;
|
|
21
|
+
namespace: z.ZodString;
|
|
22
|
+
includeSubgroups: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
declare const ResetContextSchema: z.ZodObject<{
|
|
25
|
+
action: z.ZodLiteral<"reset">;
|
|
26
|
+
}, z.core.$strip>;
|
|
27
|
+
export declare const ManageContextSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
28
|
+
action: z.ZodLiteral<"show">;
|
|
29
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
30
|
+
action: z.ZodLiteral<"list_presets">;
|
|
31
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
32
|
+
action: z.ZodLiteral<"list_profiles">;
|
|
33
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
34
|
+
action: z.ZodLiteral<"switch_preset">;
|
|
35
|
+
preset: z.ZodString;
|
|
36
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
37
|
+
action: z.ZodLiteral<"switch_profile">;
|
|
38
|
+
profile: z.ZodString;
|
|
39
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
40
|
+
action: z.ZodLiteral<"set_scope">;
|
|
41
|
+
namespace: z.ZodString;
|
|
42
|
+
includeSubgroups: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
43
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
44
|
+
action: z.ZodLiteral<"reset">;
|
|
45
|
+
}, z.core.$strip>], "action">;
|
|
46
|
+
export type ManageContextInput = z.infer<typeof ManageContextSchema>;
|
|
47
|
+
export type ShowContextInput = z.infer<typeof ShowContextSchema>;
|
|
48
|
+
export type ListPresetsInput = z.infer<typeof ListPresetsSchema>;
|
|
49
|
+
export type ListProfilesInput = z.infer<typeof ListProfilesSchema>;
|
|
50
|
+
export type SwitchPresetInput = z.infer<typeof SwitchPresetSchema>;
|
|
51
|
+
export type SwitchProfileInput = z.infer<typeof SwitchProfileSchema>;
|
|
52
|
+
export type SetScopeInput = z.infer<typeof SetScopeSchema>;
|
|
53
|
+
export type ResetContextInput = z.infer<typeof ResetContextSchema>;
|
|
54
|
+
export {};
|