@theia/ai-ide 1.66.0-next.67 → 1.66.0-next.73
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/lib/browser/frontend-module.d.ts.map +1 -1
- package/lib/browser/frontend-module.js +5 -0
- package/lib/browser/frontend-module.js.map +1 -1
- package/lib/browser/github-repo-variable-contribution.d.ts +8 -10
- package/lib/browser/github-repo-variable-contribution.d.ts.map +1 -1
- package/lib/browser/github-repo-variable-contribution.js +22 -41
- package/lib/browser/github-repo-variable-contribution.js.map +1 -1
- package/lib/common/github-repo-protocol.d.ts +15 -0
- package/lib/common/github-repo-protocol.d.ts.map +1 -0
- package/lib/common/github-repo-protocol.js +21 -0
- package/lib/common/github-repo-protocol.js.map +1 -0
- package/lib/node/backend-module.d.ts.map +1 -1
- package/lib/node/backend-module.js +4 -0
- package/lib/node/backend-module.js.map +1 -1
- package/lib/node/github-repo-service-impl.d.ts +7 -0
- package/lib/node/github-repo-service-impl.d.ts.map +1 -0
- package/lib/node/github-repo-service-impl.js +86 -0
- package/lib/node/github-repo-service-impl.js.map +1 -0
- package/package.json +23 -23
- package/src/browser/frontend-module.ts +6 -0
- package/src/browser/github-repo-variable-contribution.ts +23 -50
- package/src/common/github-repo-protocol.ts +32 -0
- package/src/node/backend-module.ts +7 -0
- package/src/node/github-repo-service-impl.ts +98 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frontend-module.d.ts","sourceRoot":"","sources":["../../src/browser/frontend-module.ts"],"names":[],"mappings":"AAgBA,OAAO,mCAAmC,CAAC;AAE3C,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;;
|
|
1
|
+
{"version":3,"file":"frontend-module.d.ts","sourceRoot":"","sources":["../../src/browser/frontend-module.ts"],"names":[],"mappings":"AAgBA,OAAO,mCAAmC,CAAC;AAE3C,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;;AA+E/D,wBAwKG"}
|
|
@@ -55,6 +55,7 @@ const task_context_service_1 = require("@theia/ai-chat/lib/browser/task-context-
|
|
|
55
55
|
const core_1 = require("@theia/core");
|
|
56
56
|
const prompt_fragments_configuration_widget_1 = require("./ai-configuration/prompt-fragments-configuration-widget");
|
|
57
57
|
const browser_automation_protocol_1 = require("../common/browser-automation-protocol");
|
|
58
|
+
const github_repo_protocol_1 = require("../common/github-repo-protocol");
|
|
58
59
|
const app_tester_chat_functions_1 = require("./app-tester-chat-functions");
|
|
59
60
|
const model_aliases_configuration_widget_1 = require("./ai-configuration/model-aliases-configuration-widget");
|
|
60
61
|
const ai_ide_preferences_1 = require("../common/ai-ide-preferences");
|
|
@@ -187,6 +188,10 @@ exports.default = new inversify_1.ContainerModule((bind, _unbind, _isBound, rebi
|
|
|
187
188
|
.inSingletonScope();
|
|
188
189
|
bind(task_background_summary_variable_1.TaskContextSummaryVariableContribution).toSelf().inSingletonScope();
|
|
189
190
|
bind(common_2.AIVariableContribution).toService(task_background_summary_variable_1.TaskContextSummaryVariableContribution);
|
|
191
|
+
bind(github_repo_protocol_1.GitHubRepoService).toDynamicValue(ctx => {
|
|
192
|
+
const provider = ctx.container.get(browser_1.RemoteConnectionProvider);
|
|
193
|
+
return provider.createProxy(github_repo_protocol_1.githubRepoServicePath);
|
|
194
|
+
}).inSingletonScope();
|
|
190
195
|
bind(github_repo_variable_contribution_1.GitHubRepoVariableContribution).toSelf().inSingletonScope();
|
|
191
196
|
bind(common_2.AIVariableContribution).toService(github_repo_variable_contribution_1.GitHubRepoVariableContribution);
|
|
192
197
|
bind(task_context_file_storage_service_1.TaskContextFileStorageService).toSelf().inSingletonScope();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frontend-module.js","sourceRoot":"","sources":["../../src/browser/frontend-module.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;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AAC;QACpB,EAAE,EAAE,4EAAoC,CAAC,EAAE;QAC3C,YAAY,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,4EAAoC,CAAC;KAC9E,CAAC,CAAC;SACF,gBAAgB,EAAE,CAAC;AAC5B,CAAC,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"frontend-module.js","sourceRoot":"","sources":["../../src/browser/frontend-module.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;AAEhF,6CAA2C;AAE3C,4DAA+D;AAC/D,sDAA+F;AAC/F,sDAA4F;AAC5F,uDAAmD;AACnD,+CAA2C;AAC3C,qGAA+F;AAC/F,+DAO+B;AAC/B,2EAAsE;AACtE,qDAMiC;AACjC,uEAAiF;AACjF,2EAIqC;AACrC,2EAA6E;AAC7E,yEAcoC;AACpC,+EAAmG;AACnG,yEAA0F;AAC1F,mEAA6D;AAC7D,2DAAsD;AACtD,uEAAiE;AACjE,2DAAgG;AAChG,8FAA2F;AAC3F,0FAA8F;AAC9F,8GAA6G;AAC7G,wFAA4F;AAC5F,oGAAiG;AACjG,6EAAoF;AACpF,8FAA2F;AAC3F,mFAA0F;AAC1F,yFAAoF;AACpF,0FAAuF;AACvF,iFAA0F;AAC1F,2FAAoF;AACpF,0GAAsG;AACtG,yFAA4F;AAC5F,2FAAqF;AACrF,2FAAoF;AACpF,0FAA4F;AAC5F,sCAA0E;AAC1E,oHAAgH;AAChH,uFAAiG;AACjG,yEAA0F;AAC1F,2EAAsI;AACtI,8GAAwG;AACxG,qEAAqE;AACrE,wDAAiE;AACjE,2EAAyE;AACzE,yFAAoF;AACpF,6DAAwD;AAExD,kBAAe,I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,GAAG,GAAG,CAAC,SAAS,CAAC,GAAG,CAA4B,kCAAwB,CAAC,CAAC;QACxF,OAAO,QAAQ,CAAC,WAAW,CAAoB,4CAAqB,CAAC,CAAC;IAC1E,CAAC,CAAC,CAAC,gBAAgB,EAAE,CAAC;IAEtB,IAAI,CAAC,kEAA8B,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IACjE,IAAI,CAAC,+BAAsB,CAAC,CAAC,SAAS,CAAC,kEAA8B,CAAC,CAAC;IACvE,IAAI,CAAC,iEAA6B,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAChE,MAAM,CAAC,gDAAyB,CAAC,CAAC,SAAS,CAAC,iEAA6B,CAAC,CAAC;IAE3E,IAAI,CAAC,0BAAmB,CAAC,CAAC,EAAE,CAAC,4EAAmC,CAAC,CAAC;IAClE,IAAI,CAAC,4EAAoC,CAAC,CAAC,MAAM,EAAE,CAAC;IACpD,IAAI,CAAC,uBAAa,CAAC;SACd,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACpB,EAAE,EAAE,4EAAoC,CAAC,EAAE;QAC3C,YAAY,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,4EAAoC,CAAC;KAC9E,CAAC,CAAC;SACF,gBAAgB,EAAE,CAAC;AAC5B,CAAC,CAAC,CAAC"}
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import { MaybePromise } from '@theia/core';
|
|
2
2
|
import { AIVariableContribution, AIVariableResolver, AIVariableService, AIVariableResolutionRequest, AIVariableContext, ResolvedAIVariable, AIVariable } from '@theia/ai-core/lib/common';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { WorkspaceService } from '@theia/workspace/lib/browser';
|
|
4
|
+
import { FileService } from '@theia/filesystem/lib/browser/file-service';
|
|
5
|
+
import { GitHubRepoService } from '../common/github-repo-protocol';
|
|
6
6
|
export declare const GITHUB_REPO_NAME_VARIABLE: AIVariable;
|
|
7
7
|
export declare class GitHubRepoVariableContribution implements AIVariableContribution, AIVariableResolver {
|
|
8
|
-
protected readonly
|
|
9
|
-
protected readonly
|
|
10
|
-
protected readonly
|
|
8
|
+
protected readonly workspaceService: WorkspaceService;
|
|
9
|
+
protected readonly fileService: FileService;
|
|
10
|
+
protected readonly gitHubRepoService: GitHubRepoService;
|
|
11
11
|
registerVariables(service: AIVariableService): void;
|
|
12
|
-
canResolve(request: AIVariableResolutionRequest,
|
|
13
|
-
resolve(request: AIVariableResolutionRequest,
|
|
14
|
-
private isGitHubRemote;
|
|
15
|
-
private extractRepoNameFromGitHubUrl;
|
|
12
|
+
canResolve(request: AIVariableResolutionRequest, _context: AIVariableContext): MaybePromise<number>;
|
|
13
|
+
resolve(request: AIVariableResolutionRequest, _context: AIVariableContext): Promise<ResolvedAIVariable | undefined>;
|
|
16
14
|
}
|
|
17
15
|
//# sourceMappingURL=github-repo-variable-contribution.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github-repo-variable-contribution.d.ts","sourceRoot":"","sources":["../../src/browser/github-repo-variable-contribution.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,YAAY,EAAO,MAAM,aAAa,CAAC;AAChD,OAAO,EACH,sBAAsB,EACtB,kBAAkB,EAClB,iBAAiB,EACjB,2BAA2B,EAC3B,iBAAiB,EACjB,kBAAkB,EAClB,UAAU,EACb,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"github-repo-variable-contribution.d.ts","sourceRoot":"","sources":["../../src/browser/github-repo-variable-contribution.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,YAAY,EAAO,MAAM,aAAa,CAAC;AAChD,OAAO,EACH,sBAAsB,EACtB,kBAAkB,EAClB,iBAAiB,EACjB,2BAA2B,EAC3B,iBAAiB,EACjB,kBAAkB,EAClB,UAAU,EACb,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,4CAA4C,CAAC;AAEzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEnE,eAAO,MAAM,yBAAyB,EAAE,UAIvC,CAAC;AAEF,qBACa,8BAA+B,YAAW,sBAAsB,EAAE,kBAAkB;IAG7F,SAAS,CAAC,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAGtD,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAG5C,SAAS,CAAC,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAExD,iBAAiB,CAAC,OAAO,EAAE,iBAAiB,GAAG,IAAI;IAInD,UAAU,CAAC,OAAO,EAAE,2BAA2B,EAAE,QAAQ,EAAE,iBAAiB,GAAG,YAAY,CAAC,MAAM,CAAC;IAQ7F,OAAO,CAAC,OAAO,EAAE,2BAA2B,EAAE,QAAQ,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,GAAG,SAAS,CAAC;CA8B5H"}
|
|
@@ -19,9 +19,9 @@ exports.GitHubRepoVariableContribution = exports.GITHUB_REPO_NAME_VARIABLE = voi
|
|
|
19
19
|
const tslib_1 = require("tslib");
|
|
20
20
|
const inversify_1 = require("@theia/core/shared/inversify");
|
|
21
21
|
const core_1 = require("@theia/core");
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const
|
|
22
|
+
const browser_1 = require("@theia/workspace/lib/browser");
|
|
23
|
+
const file_service_1 = require("@theia/filesystem/lib/browser/file-service");
|
|
24
|
+
const github_repo_protocol_1 = require("../common/github-repo-protocol");
|
|
25
25
|
exports.GITHUB_REPO_NAME_VARIABLE = {
|
|
26
26
|
id: 'github-repo-name-provider',
|
|
27
27
|
name: 'githubRepoName',
|
|
@@ -31,35 +31,30 @@ let GitHubRepoVariableContribution = class GitHubRepoVariableContribution {
|
|
|
31
31
|
registerVariables(service) {
|
|
32
32
|
service.registerResolver(exports.GITHUB_REPO_NAME_VARIABLE, this);
|
|
33
33
|
}
|
|
34
|
-
canResolve(request,
|
|
34
|
+
canResolve(request, _context) {
|
|
35
35
|
if (request.variable.name !== exports.GITHUB_REPO_NAME_VARIABLE.name) {
|
|
36
36
|
return 0;
|
|
37
37
|
}
|
|
38
|
-
const selectedRepo = this.repositoryProvider.selectedRepository;
|
|
39
|
-
if (!selectedRepo) {
|
|
40
|
-
return 0;
|
|
41
|
-
}
|
|
42
38
|
return 1;
|
|
43
39
|
}
|
|
44
|
-
async resolve(request,
|
|
40
|
+
async resolve(request, _context) {
|
|
45
41
|
if (request.variable.name !== exports.GITHUB_REPO_NAME_VARIABLE.name) {
|
|
46
42
|
return undefined;
|
|
47
43
|
}
|
|
48
|
-
const repository = this.repositoryProvider.selectedRepository;
|
|
49
|
-
if (!repository) {
|
|
50
|
-
return { variable: request.variable, value: 'No GitHub repository is currently selected or detected.' };
|
|
51
|
-
}
|
|
52
44
|
try {
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
const githubRemote = remotes.find(remote => remote.name === 'origin' && this.isGitHubRemote(remote.fetch)) || remotes.find(remote => this.isGitHubRemote(remote.fetch));
|
|
56
|
-
if (!githubRemote) {
|
|
45
|
+
const workspaceRoots = await this.workspaceService.roots;
|
|
46
|
+
if (workspaceRoots.length === 0) {
|
|
57
47
|
return { variable: request.variable, value: 'No GitHub repository is currently selected or detected.' };
|
|
58
48
|
}
|
|
59
|
-
|
|
60
|
-
|
|
49
|
+
// Get the filesystem path from the workspace root URI
|
|
50
|
+
const workspaceRoot = workspaceRoots[0].resource;
|
|
51
|
+
const workspacePath = workspaceRoot.path.fsPath();
|
|
52
|
+
// Use the backend service to get GitHub repository information
|
|
53
|
+
const repoInfo = await this.gitHubRepoService.getGitHubRepoInfo(workspacePath);
|
|
54
|
+
if (!repoInfo) {
|
|
61
55
|
return { variable: request.variable, value: 'No GitHub repository is currently selected or detected.' };
|
|
62
56
|
}
|
|
57
|
+
const repoName = `${repoInfo.owner}/${repoInfo.repo}`;
|
|
63
58
|
return { variable: request.variable, value: `You are currently working with the GitHub repository: **${repoName}**` };
|
|
64
59
|
}
|
|
65
60
|
catch (error) {
|
|
@@ -67,34 +62,20 @@ let GitHubRepoVariableContribution = class GitHubRepoVariableContribution {
|
|
|
67
62
|
return { variable: request.variable, value: 'No GitHub repository is currently selected or detected.' };
|
|
68
63
|
}
|
|
69
64
|
}
|
|
70
|
-
isGitHubRemote(remoteUrl) {
|
|
71
|
-
return remoteUrl.includes('github.com');
|
|
72
|
-
}
|
|
73
|
-
extractRepoNameFromGitHubUrl(url) {
|
|
74
|
-
const httpsMatch = url.match(/https:\/\/github\.com\/([^\/]+\/[^\/]+?)(?:\.git)?$/);
|
|
75
|
-
if (httpsMatch) {
|
|
76
|
-
return httpsMatch[1];
|
|
77
|
-
}
|
|
78
|
-
const sshMatch = url.match(/git@github\.com:([^\/]+\/[^\/]+?)(?:\.git)?$/);
|
|
79
|
-
if (sshMatch) {
|
|
80
|
-
return sshMatch[1];
|
|
81
|
-
}
|
|
82
|
-
return undefined;
|
|
83
|
-
}
|
|
84
65
|
};
|
|
85
66
|
exports.GitHubRepoVariableContribution = GitHubRepoVariableContribution;
|
|
86
67
|
tslib_1.__decorate([
|
|
87
|
-
(0, inversify_1.inject)(
|
|
88
|
-
tslib_1.__metadata("design:type",
|
|
89
|
-
], GitHubRepoVariableContribution.prototype, "
|
|
68
|
+
(0, inversify_1.inject)(browser_1.WorkspaceService),
|
|
69
|
+
tslib_1.__metadata("design:type", browser_1.WorkspaceService)
|
|
70
|
+
], GitHubRepoVariableContribution.prototype, "workspaceService", void 0);
|
|
90
71
|
tslib_1.__decorate([
|
|
91
|
-
(0, inversify_1.inject)(
|
|
92
|
-
tslib_1.__metadata("design:type",
|
|
93
|
-
], GitHubRepoVariableContribution.prototype, "
|
|
72
|
+
(0, inversify_1.inject)(file_service_1.FileService),
|
|
73
|
+
tslib_1.__metadata("design:type", file_service_1.FileService)
|
|
74
|
+
], GitHubRepoVariableContribution.prototype, "fileService", void 0);
|
|
94
75
|
tslib_1.__decorate([
|
|
95
|
-
(0, inversify_1.inject)(
|
|
76
|
+
(0, inversify_1.inject)(github_repo_protocol_1.GitHubRepoService),
|
|
96
77
|
tslib_1.__metadata("design:type", Object)
|
|
97
|
-
], GitHubRepoVariableContribution.prototype, "
|
|
78
|
+
], GitHubRepoVariableContribution.prototype, "gitHubRepoService", void 0);
|
|
98
79
|
exports.GitHubRepoVariableContribution = GitHubRepoVariableContribution = tslib_1.__decorate([
|
|
99
80
|
(0, inversify_1.injectable)()
|
|
100
81
|
], GitHubRepoVariableContribution);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github-repo-variable-contribution.js","sourceRoot":"","sources":["../../src/browser/github-repo-variable-contribution.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;;AAEhF,4DAAkE;AAClE,sCAAgD;AAUhD,
|
|
1
|
+
{"version":3,"file":"github-repo-variable-contribution.js","sourceRoot":"","sources":["../../src/browser/github-repo-variable-contribution.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;;AAEhF,4DAAkE;AAClE,sCAAgD;AAUhD,0DAAgE;AAChE,6EAAyE;AAEzE,yEAAmE;AAEtD,QAAA,yBAAyB,G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AQ,EAAE,KAAK,EAAE,yDAAyD,EAAE,CAAC;YAC5G,CAAC;YAED,MAAM,QAAQ,GAAG,GAAG,QAAQ,CAAC,KAAK,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC;YACtD,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,KAAK,EAAE,2DAA2D,QAAQ,IAAI,EAAE,CAAC;QAE1H,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,OAAO,CAAC,IAAI,CAAC,2CAA2C,EAAE,KAAK,CAAC,CAAC;YACjE,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,KAAK,EAAE,yDAAyD,EAAE,CAAC;QAC5G,CAAC;IACL,CAAC;CACJ,CAAA;AArDY,wEAA8B;AAGpB;IADlB,IAAA,kBAAM,EAAC,0BAAgB,CAAC;sCACY,0BAAgB;wEAAC;AAGnC;IADlB,IAAA,kBAAM,EAAC,0BAAW,CAAC;sCACY,0BAAW;mEAAC;AAGzB;IADlB,IAAA,kBAAM,EAAC,wCAAiB,CAAC;;yEAC8B;yCAT/C,8BAA8B;IAD1C,IAAA,sBAAU,GAAE;GACA,8BAA8B,CAqD1C"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const GitHubRepoService: unique symbol;
|
|
2
|
+
export declare const githubRepoServicePath = "/services/github-repo";
|
|
3
|
+
export interface GitHubRepoInfo {
|
|
4
|
+
owner: string;
|
|
5
|
+
repo: string;
|
|
6
|
+
}
|
|
7
|
+
export interface GitHubRepoService {
|
|
8
|
+
/**
|
|
9
|
+
* Gets the GitHub repository information for the given workspace path.
|
|
10
|
+
* @param workspacePath The absolute path to the workspace directory
|
|
11
|
+
* @returns GitHub repository info (owner/repo) or undefined if not a GitHub repository
|
|
12
|
+
*/
|
|
13
|
+
getGitHubRepoInfo(workspacePath: string): Promise<GitHubRepoInfo | undefined>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=github-repo-protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-repo-protocol.d.ts","sourceRoot":"","sources":["../../src/common/github-repo-protocol.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,iBAAiB,eAA8B,CAAC;AAC7D,eAAO,MAAM,qBAAqB,0BAA0B,CAAC;AAE7D,MAAM,WAAW,cAAc;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,iBAAiB;IAC9B;;;;OAIG;IACH,iBAAiB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAAC;CACjF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2025 EclipseSource GmbH.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.githubRepoServicePath = exports.GitHubRepoService = void 0;
|
|
19
|
+
exports.GitHubRepoService = Symbol('GitHubRepoService');
|
|
20
|
+
exports.githubRepoServicePath = '/services/github-repo';
|
|
21
|
+
//# sourceMappingURL=github-repo-protocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-repo-protocol.js","sourceRoot":"","sources":["../../src/common/github-repo-protocol.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;AAEnE,QAAA,iBAAiB,GAAG,MAAM,CAAC,mBAAmB,CAAC,CAAC;AAChD,QAAA,qBAAqB,GAAG,uBAAuB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backend-module.d.ts","sourceRoot":"","sources":["../../src/node/backend-module.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;;
|
|
1
|
+
{"version":3,"file":"backend-module.d.ts","sourceRoot":"","sources":["../../src/node/backend-module.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;;AAsB/D,wBAYG"}
|
|
@@ -23,6 +23,8 @@ const connection_container_module_1 = require("@theia/core/lib/node/messaging/co
|
|
|
23
23
|
const workspace_preferences_1 = require("../common/workspace-preferences");
|
|
24
24
|
const ai_configuration_preferences_1 = require("../common/ai-configuration-preferences");
|
|
25
25
|
const ai_ide_preferences_1 = require("../common/ai-ide-preferences");
|
|
26
|
+
const github_repo_protocol_1 = require("../common/github-repo-protocol");
|
|
27
|
+
const github_repo_service_impl_1 = require("./github-repo-service-impl");
|
|
26
28
|
const browserAutomationModule = connection_container_module_1.ConnectionContainerModule.create(({ bind, bindBackendService, bindFrontendService }) => {
|
|
27
29
|
bind(browser_automation_protocol_1.BrowserAutomation).to(browser_automation_impl_1.BrowserAutomationImpl).inSingletonScope();
|
|
28
30
|
bind(core_1.ConnectionHandler).toDynamicValue(ctx => new core_1.RpcConnectionHandler(browser_automation_protocol_1.browserAutomationPath, client => {
|
|
@@ -37,5 +39,7 @@ exports.default = new inversify_1.ContainerModule(bind => {
|
|
|
37
39
|
bind(core_1.PreferenceContribution).toConstantValue({ schema: workspace_preferences_1.WorkspacePreferencesSchema });
|
|
38
40
|
bind(core_1.PreferenceContribution).toConstantValue({ schema: ai_configuration_preferences_1.AiConfigurationPreferences });
|
|
39
41
|
bind(connection_container_module_1.ConnectionContainerModule).toConstantValue(browserAutomationModule);
|
|
42
|
+
bind(github_repo_protocol_1.GitHubRepoService).to(github_repo_service_impl_1.GitHubRepoServiceImpl).inSingletonScope();
|
|
43
|
+
bind(core_1.ConnectionHandler).toDynamicValue(ctx => new core_1.RpcConnectionHandler(github_repo_protocol_1.githubRepoServicePath, () => ctx.container.get(github_repo_protocol_1.GitHubRepoService))).inSingletonScope();
|
|
40
44
|
});
|
|
41
45
|
//# sourceMappingURL=backend-module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backend-module.js","sourceRoot":"","sources":["../../src/node/backend-module.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;AAEhF,sCAA8F;AAC9F,4DAA+D;AAC/D,uFAA+H;AAC/H,wFAAmF;AACnF,4GAAuG;AACvG,2EAA6E;AAC7E,yFAAoF;AACpF,qEAAqE;
|
|
1
|
+
{"version":3,"file":"backend-module.js","sourceRoot":"","sources":["../../src/node/backend-module.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;A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DAAyB,CAAC,CAAC,eAAe,CAAC,uBAAuB,CAAC,CAAC;IAEzE,IAAI,CAAC,wCAAiB,CAAC,CAAC,EAAE,CAAC,gDAAqB,CAAC,CAAC,gBAAgB,EAAE,CAAC;IACrE,IAAI,CAAC,wBAAiB,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,CACzC,IAAI,2BAAoB,CAAC,4CAAqB,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAoB,wCAAiB,CAAC,CAAC,CACjH,CAAC,gBAAgB,EAAE,CAAC;AAEzB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { GitHubRepoService, GitHubRepoInfo } from '../common/github-repo-protocol';
|
|
2
|
+
export declare class GitHubRepoServiceImpl implements GitHubRepoService {
|
|
3
|
+
getGitHubRepoInfo(workspacePath: string): Promise<GitHubRepoInfo | undefined>;
|
|
4
|
+
private isGitHubRemote;
|
|
5
|
+
private extractRepoInfoFromGitHubUrl;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=github-repo-service-impl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-repo-service-impl.d.ts","sourceRoot":"","sources":["../../src/node/github-repo-service-impl.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAEnF,qBACa,qBAAsB,YAAW,iBAAiB;IAErD,iBAAiB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC;IAwCnF,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,4BAA4B;CA8BvC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2025 EclipseSource GmbH.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.GitHubRepoServiceImpl = void 0;
|
|
19
|
+
const tslib_1 = require("tslib");
|
|
20
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
21
|
+
const simple_git_1 = require("simple-git");
|
|
22
|
+
let GitHubRepoServiceImpl = class GitHubRepoServiceImpl {
|
|
23
|
+
async getGitHubRepoInfo(workspacePath) {
|
|
24
|
+
try {
|
|
25
|
+
// Initialize simple-git with the workspace path
|
|
26
|
+
const git = (0, simple_git_1.simpleGit)(workspacePath);
|
|
27
|
+
// Check if this is a git repository
|
|
28
|
+
const isRepo = await git.checkIsRepo();
|
|
29
|
+
if (!isRepo) {
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
// Get all remotes with their URLs
|
|
33
|
+
const remotes = await git.getRemotes(true);
|
|
34
|
+
if (remotes.length === 0) {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
// Find GitHub remote (prefer 'origin', then any GitHub remote)
|
|
38
|
+
const githubRemote = remotes.find(remote => remote.name === 'origin' && this.isGitHubRemote(remote.refs.fetch || remote.refs.push || '')) || remotes.find(remote => this.isGitHubRemote(remote.refs.fetch || remote.refs.push || ''));
|
|
39
|
+
if (!githubRemote) {
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
const remoteUrl = githubRemote.refs.fetch || githubRemote.refs.push || '';
|
|
43
|
+
const repoInfo = this.extractRepoInfoFromGitHubUrl(remoteUrl);
|
|
44
|
+
return repoInfo;
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
console.warn('Failed to get GitHub repository info:', error);
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
isGitHubRemote(remoteUrl) {
|
|
52
|
+
return remoteUrl.includes('github.com');
|
|
53
|
+
}
|
|
54
|
+
extractRepoInfoFromGitHubUrl(url) {
|
|
55
|
+
// Handle HTTPS URLs: https://github.com/owner/repo or https://github.com/owner/repo.git
|
|
56
|
+
const httpsMatch = url.match(/https:\/\/github\.com\/([^\/]+)\/([^\/]+?)(?:\.git)?$/);
|
|
57
|
+
if (httpsMatch) {
|
|
58
|
+
return {
|
|
59
|
+
owner: httpsMatch[1],
|
|
60
|
+
repo: httpsMatch[2]
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
// Handle SSH URLs: git@github.com:owner/repo or git@github.com:owner/repo.git
|
|
64
|
+
const sshMatch = url.match(/git@github\.com:([^\/]+)\/([^\/]+?)(?:\.git)?$/);
|
|
65
|
+
if (sshMatch) {
|
|
66
|
+
return {
|
|
67
|
+
owner: sshMatch[1],
|
|
68
|
+
repo: sshMatch[2]
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
// Handle alternative SSH format: ssh://git@github.com/owner/repo or ssh://git@github.com/owner/repo.git
|
|
72
|
+
const sshAltMatch = url.match(/ssh:\/\/git@github\.com\/([^\/]+)\/([^\/]+?)(?:\.git)?$/);
|
|
73
|
+
if (sshAltMatch) {
|
|
74
|
+
return {
|
|
75
|
+
owner: sshAltMatch[1],
|
|
76
|
+
repo: sshAltMatch[2]
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
return undefined;
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
exports.GitHubRepoServiceImpl = GitHubRepoServiceImpl;
|
|
83
|
+
exports.GitHubRepoServiceImpl = GitHubRepoServiceImpl = tslib_1.__decorate([
|
|
84
|
+
(0, inversify_1.injectable)()
|
|
85
|
+
], GitHubRepoServiceImpl);
|
|
86
|
+
//# sourceMappingURL=github-repo-service-impl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-repo-service-impl.js","sourceRoot":"","sources":["../../src/node/github-repo-service-impl.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;;AAEhF,4DAA0D;AAC1D,2CAAkD;AAI3C,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAE9B,KAAK,CAAC,iBAAiB,CAAC,aAAqB;QACzC,IAAI,CAAC;YACD,gDAAgD;YAChD,MAAM,GAAG,GAAc,IAAA,sBAAS,EAAC,aAAa,CAAC,CAAC;YAEhD,oCAAoC;YACpC,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,WAAW,EAAE,CAAC;YACvC,IAAI,CAAC,MAAM,EAAE,CAAC;gBACV,OAAO,SAAS,CAAC;YACrB,CAAC;YAED,kCAAkC;YAClC,MAAM,OAAO,GAAG,MAAM,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YAE3C,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACvB,OAAO,SAAS,CAAC;YACrB,CAAC;YAED,+DAA+D;YAC/D,MAAM,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CACvC,MAAM,CAAC,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK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AAC;aACpB,CAAC;QACN,CAAC;QAED,wGAAwG;QACxG,MAAM,WAAW,GAAG,GAAG,CAAC,KAAK,CAAC,yDAAyD,CAAC,CAAC;QACzF,IAAI,WAAW,EAAE,CAAC;YACd,OAAO;gBACH,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC;gBACrB,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC;aACvB,CAAC;QACN,CAAC;QAED,OAAO,SAAS,CAAC;IACrB,CAAC;CACJ,CAAA;AA5EY,sDAAqB;gCAArB,qBAAqB;IADjC,IAAA,sBAAU,GAAE;GACA,qBAAqB,CA4EjC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/ai-ide",
|
|
3
|
-
"version": "1.66.0-next.
|
|
3
|
+
"version": "1.66.0-next.73+6d82794da",
|
|
4
4
|
"description": "AI IDE Agents Extension",
|
|
5
5
|
"license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -15,36 +15,36 @@
|
|
|
15
15
|
"theia-extension"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@theia/ai-chat": "1.66.0-next.
|
|
19
|
-
"@theia/ai-chat-ui": "1.66.0-next.
|
|
20
|
-
"@theia/ai-core": "1.66.0-next.
|
|
21
|
-
"@theia/ai-mcp": "1.66.0-next.
|
|
22
|
-
"@theia/core": "1.66.0-next.
|
|
23
|
-
"@theia/debug": "1.66.0-next.
|
|
24
|
-
"@theia/editor": "1.66.0-next.
|
|
25
|
-
"@theia/filesystem": "1.66.0-next.
|
|
26
|
-
"@theia/
|
|
27
|
-
"@theia/
|
|
28
|
-
"@theia/
|
|
29
|
-
"@theia/
|
|
30
|
-
"@theia/
|
|
31
|
-
"@theia/
|
|
32
|
-
"@theia/
|
|
33
|
-
"@theia/
|
|
34
|
-
"@theia/
|
|
35
|
-
"@theia/workspace": "1.66.0-next.67+6fae23c43",
|
|
18
|
+
"@theia/ai-chat": "1.66.0-next.73+6d82794da",
|
|
19
|
+
"@theia/ai-chat-ui": "1.66.0-next.73+6d82794da",
|
|
20
|
+
"@theia/ai-core": "1.66.0-next.73+6d82794da",
|
|
21
|
+
"@theia/ai-mcp": "1.66.0-next.73+6d82794da",
|
|
22
|
+
"@theia/core": "1.66.0-next.73+6d82794da",
|
|
23
|
+
"@theia/debug": "1.66.0-next.73+6d82794da",
|
|
24
|
+
"@theia/editor": "1.66.0-next.73+6d82794da",
|
|
25
|
+
"@theia/filesystem": "1.66.0-next.73+6d82794da",
|
|
26
|
+
"@theia/markers": "1.66.0-next.73+6d82794da",
|
|
27
|
+
"@theia/monaco": "1.66.0-next.73+6d82794da",
|
|
28
|
+
"@theia/navigator": "1.66.0-next.73+6d82794da",
|
|
29
|
+
"@theia/preferences": "1.66.0-next.73+6d82794da",
|
|
30
|
+
"@theia/scm": "1.66.0-next.73+6d82794da",
|
|
31
|
+
"@theia/search-in-workspace": "1.66.0-next.73+6d82794da",
|
|
32
|
+
"@theia/task": "1.66.0-next.73+6d82794da",
|
|
33
|
+
"@theia/terminal": "1.66.0-next.73+6d82794da",
|
|
34
|
+
"@theia/workspace": "1.66.0-next.73+6d82794da",
|
|
36
35
|
"date-fns": "^4.1.0",
|
|
37
36
|
"ignore": "^6.0.0",
|
|
38
37
|
"js-yaml": "^4.1.0",
|
|
39
38
|
"minimatch": "^10.0.3",
|
|
40
|
-
"puppeteer-core": "^24.10.0"
|
|
39
|
+
"puppeteer-core": "^24.10.0",
|
|
40
|
+
"simple-git": "^3.25.0"
|
|
41
41
|
},
|
|
42
42
|
"publishConfig": {
|
|
43
43
|
"access": "public"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@theia/cli": "1.66.0-next.
|
|
47
|
-
"@theia/test": "1.66.0-next.
|
|
46
|
+
"@theia/cli": "1.66.0-next.73+6d82794da",
|
|
47
|
+
"@theia/test": "1.66.0-next.73+6d82794da"
|
|
48
48
|
},
|
|
49
49
|
"theiaExtensions": [
|
|
50
50
|
{
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"nyc": {
|
|
69
69
|
"extends": "../../configs/nyc.json"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "6d82794da24e16f75d70eaac3a4178a29e822e82"
|
|
72
72
|
}
|
|
@@ -86,6 +86,7 @@ import { TaskContextStorageService } from '@theia/ai-chat/lib/browser/task-conte
|
|
|
86
86
|
import { CommandContribution, PreferenceContribution } from '@theia/core';
|
|
87
87
|
import { AIPromptFragmentsConfigurationWidget } from './ai-configuration/prompt-fragments-configuration-widget';
|
|
88
88
|
import { BrowserAutomation, browserAutomationPath } from '../common/browser-automation-protocol';
|
|
89
|
+
import { GitHubRepoService, githubRepoServicePath } from '../common/github-repo-protocol';
|
|
89
90
|
import { CloseBrowserProvider, IsBrowserRunningProvider, LaunchBrowserProvider, QueryDomProvider } from './app-tester-chat-functions';
|
|
90
91
|
import { ModelAliasesConfigurationWidget } from './ai-configuration/model-aliases-configuration-widget';
|
|
91
92
|
import { aiIdePreferenceSchema } from '../common/ai-ide-preferences';
|
|
@@ -244,6 +245,11 @@ export default new ContainerModule((bind, _unbind, _isBound, rebind) => {
|
|
|
244
245
|
bind(TaskContextSummaryVariableContribution).toSelf().inSingletonScope();
|
|
245
246
|
bind(AIVariableContribution).toService(TaskContextSummaryVariableContribution);
|
|
246
247
|
|
|
248
|
+
bind(GitHubRepoService).toDynamicValue(ctx => {
|
|
249
|
+
const provider = ctx.container.get<ServiceConnectionProvider>(RemoteConnectionProvider);
|
|
250
|
+
return provider.createProxy<GitHubRepoService>(githubRepoServicePath);
|
|
251
|
+
}).inSingletonScope();
|
|
252
|
+
|
|
247
253
|
bind(GitHubRepoVariableContribution).toSelf().inSingletonScope();
|
|
248
254
|
bind(AIVariableContribution).toService(GitHubRepoVariableContribution);
|
|
249
255
|
bind(TaskContextFileStorageService).toSelf().inSingletonScope();
|
|
@@ -25,9 +25,10 @@ import {
|
|
|
25
25
|
ResolvedAIVariable,
|
|
26
26
|
AIVariable
|
|
27
27
|
} from '@theia/ai-core/lib/common';
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
|
|
28
|
+
import { WorkspaceService } from '@theia/workspace/lib/browser';
|
|
29
|
+
import { FileService } from '@theia/filesystem/lib/browser/file-service';
|
|
30
|
+
|
|
31
|
+
import { GitHubRepoService } from '../common/github-repo-protocol';
|
|
31
32
|
|
|
32
33
|
export const GITHUB_REPO_NAME_VARIABLE: AIVariable = {
|
|
33
34
|
id: 'github-repo-name-provider',
|
|
@@ -38,59 +39,50 @@ export const GITHUB_REPO_NAME_VARIABLE: AIVariable = {
|
|
|
38
39
|
@injectable()
|
|
39
40
|
export class GitHubRepoVariableContribution implements AIVariableContribution, AIVariableResolver {
|
|
40
41
|
|
|
41
|
-
@inject(
|
|
42
|
-
protected readonly
|
|
42
|
+
@inject(WorkspaceService)
|
|
43
|
+
protected readonly workspaceService: WorkspaceService;
|
|
43
44
|
|
|
44
|
-
@inject(
|
|
45
|
-
protected readonly
|
|
45
|
+
@inject(FileService)
|
|
46
|
+
protected readonly fileService: FileService;
|
|
46
47
|
|
|
47
|
-
@inject(
|
|
48
|
-
protected readonly
|
|
48
|
+
@inject(GitHubRepoService)
|
|
49
|
+
protected readonly gitHubRepoService: GitHubRepoService;
|
|
49
50
|
|
|
50
51
|
registerVariables(service: AIVariableService): void {
|
|
51
52
|
service.registerResolver(GITHUB_REPO_NAME_VARIABLE, this);
|
|
52
53
|
}
|
|
53
54
|
|
|
54
|
-
canResolve(request: AIVariableResolutionRequest,
|
|
55
|
+
canResolve(request: AIVariableResolutionRequest, _context: AIVariableContext): MaybePromise<number> {
|
|
55
56
|
if (request.variable.name !== GITHUB_REPO_NAME_VARIABLE.name) {
|
|
56
57
|
return 0;
|
|
57
58
|
}
|
|
58
59
|
|
|
59
|
-
const selectedRepo = this.repositoryProvider.selectedRepository;
|
|
60
|
-
if (!selectedRepo) {
|
|
61
|
-
return 0;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
60
|
return 1;
|
|
65
61
|
}
|
|
66
62
|
|
|
67
|
-
async resolve(request: AIVariableResolutionRequest,
|
|
63
|
+
async resolve(request: AIVariableResolutionRequest, _context: AIVariableContext): Promise<ResolvedAIVariable | undefined> {
|
|
68
64
|
if (request.variable.name !== GITHUB_REPO_NAME_VARIABLE.name) {
|
|
69
65
|
return undefined;
|
|
70
66
|
}
|
|
71
67
|
|
|
72
|
-
const repository = this.repositoryProvider.selectedRepository;
|
|
73
|
-
if (!repository) {
|
|
74
|
-
return { variable: request.variable, value: 'No GitHub repository is currently selected or detected.' };
|
|
75
|
-
}
|
|
76
|
-
|
|
77
68
|
try {
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
// Find GitHub remote (prefer 'origin', then any GitHub remote)
|
|
81
|
-
const githubRemote = remotes.find(remote =>
|
|
82
|
-
remote.name === 'origin' && this.isGitHubRemote(remote.fetch)
|
|
83
|
-
) || remotes.find(remote => this.isGitHubRemote(remote.fetch));
|
|
84
|
-
|
|
85
|
-
if (!githubRemote) {
|
|
69
|
+
const workspaceRoots = await this.workspaceService.roots;
|
|
70
|
+
if (workspaceRoots.length === 0) {
|
|
86
71
|
return { variable: request.variable, value: 'No GitHub repository is currently selected or detected.' };
|
|
87
72
|
}
|
|
88
73
|
|
|
89
|
-
|
|
90
|
-
|
|
74
|
+
// Get the filesystem path from the workspace root URI
|
|
75
|
+
const workspaceRoot = workspaceRoots[0].resource;
|
|
76
|
+
const workspacePath = workspaceRoot.path.fsPath();
|
|
77
|
+
|
|
78
|
+
// Use the backend service to get GitHub repository information
|
|
79
|
+
const repoInfo = await this.gitHubRepoService.getGitHubRepoInfo(workspacePath);
|
|
80
|
+
|
|
81
|
+
if (!repoInfo) {
|
|
91
82
|
return { variable: request.variable, value: 'No GitHub repository is currently selected or detected.' };
|
|
92
83
|
}
|
|
93
84
|
|
|
85
|
+
const repoName = `${repoInfo.owner}/${repoInfo.repo}`;
|
|
94
86
|
return { variable: request.variable, value: `You are currently working with the GitHub repository: **${repoName}**` };
|
|
95
87
|
|
|
96
88
|
} catch (error) {
|
|
@@ -98,23 +90,4 @@ export class GitHubRepoVariableContribution implements AIVariableContribution, A
|
|
|
98
90
|
return { variable: request.variable, value: 'No GitHub repository is currently selected or detected.' };
|
|
99
91
|
}
|
|
100
92
|
}
|
|
101
|
-
|
|
102
|
-
private isGitHubRemote(remoteUrl: string): boolean {
|
|
103
|
-
return remoteUrl.includes('github.com');
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
private extractRepoNameFromGitHubUrl(url: string): string | undefined {
|
|
107
|
-
|
|
108
|
-
const httpsMatch = url.match(/https:\/\/github\.com\/([^\/]+\/[^\/]+?)(?:\.git)?$/);
|
|
109
|
-
if (httpsMatch) {
|
|
110
|
-
return httpsMatch[1];
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
const sshMatch = url.match(/git@github\.com:([^\/]+\/[^\/]+?)(?:\.git)?$/);
|
|
114
|
-
if (sshMatch) {
|
|
115
|
-
return sshMatch[1];
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
return undefined;
|
|
119
|
-
}
|
|
120
93
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2025 EclipseSource GmbH.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
export const GitHubRepoService = Symbol('GitHubRepoService');
|
|
18
|
+
export const githubRepoServicePath = '/services/github-repo';
|
|
19
|
+
|
|
20
|
+
export interface GitHubRepoInfo {
|
|
21
|
+
owner: string;
|
|
22
|
+
repo: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface GitHubRepoService {
|
|
26
|
+
/**
|
|
27
|
+
* Gets the GitHub repository information for the given workspace path.
|
|
28
|
+
* @param workspacePath The absolute path to the workspace directory
|
|
29
|
+
* @returns GitHub repository info (owner/repo) or undefined if not a GitHub repository
|
|
30
|
+
*/
|
|
31
|
+
getGitHubRepoInfo(workspacePath: string): Promise<GitHubRepoInfo | undefined>;
|
|
32
|
+
}
|
|
@@ -22,6 +22,8 @@ import { ConnectionContainerModule } from '@theia/core/lib/node/messaging/connec
|
|
|
22
22
|
import { WorkspacePreferencesSchema } from '../common/workspace-preferences';
|
|
23
23
|
import { AiConfigurationPreferences } from '../common/ai-configuration-preferences';
|
|
24
24
|
import { aiIdePreferenceSchema } from '../common/ai-ide-preferences';
|
|
25
|
+
import { GitHubRepoService, githubRepoServicePath } from '../common/github-repo-protocol';
|
|
26
|
+
import { GitHubRepoServiceImpl } from './github-repo-service-impl';
|
|
25
27
|
|
|
26
28
|
const browserAutomationModule = ConnectionContainerModule.create(({ bind, bindBackendService, bindFrontendService }) => {
|
|
27
29
|
bind(BrowserAutomation).to(BrowserAutomationImpl).inSingletonScope();
|
|
@@ -42,4 +44,9 @@ export default new ContainerModule(bind => {
|
|
|
42
44
|
|
|
43
45
|
bind(ConnectionContainerModule).toConstantValue(browserAutomationModule);
|
|
44
46
|
|
|
47
|
+
bind(GitHubRepoService).to(GitHubRepoServiceImpl).inSingletonScope();
|
|
48
|
+
bind(ConnectionHandler).toDynamicValue(ctx =>
|
|
49
|
+
new RpcConnectionHandler(githubRepoServicePath, () => ctx.container.get<GitHubRepoService>(GitHubRepoService))
|
|
50
|
+
).inSingletonScope();
|
|
51
|
+
|
|
45
52
|
});
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2025 EclipseSource GmbH.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
import { injectable } from '@theia/core/shared/inversify';
|
|
18
|
+
import { simpleGit, SimpleGit } from 'simple-git';
|
|
19
|
+
import { GitHubRepoService, GitHubRepoInfo } from '../common/github-repo-protocol';
|
|
20
|
+
|
|
21
|
+
@injectable()
|
|
22
|
+
export class GitHubRepoServiceImpl implements GitHubRepoService {
|
|
23
|
+
|
|
24
|
+
async getGitHubRepoInfo(workspacePath: string): Promise<GitHubRepoInfo | undefined> {
|
|
25
|
+
try {
|
|
26
|
+
// Initialize simple-git with the workspace path
|
|
27
|
+
const git: SimpleGit = simpleGit(workspacePath);
|
|
28
|
+
|
|
29
|
+
// Check if this is a git repository
|
|
30
|
+
const isRepo = await git.checkIsRepo();
|
|
31
|
+
if (!isRepo) {
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Get all remotes with their URLs
|
|
36
|
+
const remotes = await git.getRemotes(true);
|
|
37
|
+
|
|
38
|
+
if (remotes.length === 0) {
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Find GitHub remote (prefer 'origin', then any GitHub remote)
|
|
43
|
+
const githubRemote = remotes.find(remote =>
|
|
44
|
+
remote.name === 'origin' && this.isGitHubRemote(remote.refs.fetch || remote.refs.push || '')
|
|
45
|
+
) || remotes.find(remote =>
|
|
46
|
+
this.isGitHubRemote(remote.refs.fetch || remote.refs.push || '')
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
if (!githubRemote) {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const remoteUrl = githubRemote.refs.fetch || githubRemote.refs.push || '';
|
|
54
|
+
const repoInfo = this.extractRepoInfoFromGitHubUrl(remoteUrl);
|
|
55
|
+
|
|
56
|
+
return repoInfo;
|
|
57
|
+
|
|
58
|
+
} catch (error) {
|
|
59
|
+
console.warn('Failed to get GitHub repository info:', error);
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
private isGitHubRemote(remoteUrl: string): boolean {
|
|
65
|
+
return remoteUrl.includes('github.com');
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
private extractRepoInfoFromGitHubUrl(url: string): GitHubRepoInfo | undefined {
|
|
69
|
+
// Handle HTTPS URLs: https://github.com/owner/repo or https://github.com/owner/repo.git
|
|
70
|
+
const httpsMatch = url.match(/https:\/\/github\.com\/([^\/]+)\/([^\/]+?)(?:\.git)?$/);
|
|
71
|
+
if (httpsMatch) {
|
|
72
|
+
return {
|
|
73
|
+
owner: httpsMatch[1],
|
|
74
|
+
repo: httpsMatch[2]
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Handle SSH URLs: git@github.com:owner/repo or git@github.com:owner/repo.git
|
|
79
|
+
const sshMatch = url.match(/git@github\.com:([^\/]+)\/([^\/]+?)(?:\.git)?$/);
|
|
80
|
+
if (sshMatch) {
|
|
81
|
+
return {
|
|
82
|
+
owner: sshMatch[1],
|
|
83
|
+
repo: sshMatch[2]
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Handle alternative SSH format: ssh://git@github.com/owner/repo or ssh://git@github.com/owner/repo.git
|
|
88
|
+
const sshAltMatch = url.match(/ssh:\/\/git@github\.com\/([^\/]+)\/([^\/]+?)(?:\.git)?$/);
|
|
89
|
+
if (sshAltMatch) {
|
|
90
|
+
return {
|
|
91
|
+
owner: sshAltMatch[1],
|
|
92
|
+
repo: sshAltMatch[2]
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return undefined;
|
|
97
|
+
}
|
|
98
|
+
}
|