n8n-nodes-github-copilot 3.30.1 → 3.31.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/dist/nodes/GitHubCopilotAuthHelper/GitHubCopilotAuthHelper.node.d.ts +5 -0
- package/dist/nodes/GitHubCopilotAuthHelper/GitHubCopilotAuthHelper.node.js +575 -0
- package/dist/package.json +3 -4
- package/dist/shared/utils/GitHubDeviceFlowHandler.d.ts +42 -0
- package/dist/shared/utils/GitHubDeviceFlowHandler.js +142 -0
- package/package.json +3 -4
- package/dist/credentials/GitHubApi.credentials.d.ts +0 -9
- package/dist/credentials/GitHubApi.credentials.js +0 -57
- package/dist/credentials/GitHubApiManual.credentials.d.ts +0 -7
- package/dist/credentials/GitHubApiManual.credentials.js +0 -33
- package/dist/credentials/GitHubCopilotOAuth2Api.credentials.backup.d.ts +0 -9
- package/dist/credentials/GitHubCopilotOAuth2Api.credentials.backup.js +0 -141
- package/dist/credentials/GitHubCopilotOAuth2Api.credentials.d.ts +0 -9
- package/dist/credentials/GitHubCopilotOAuth2Api.credentials.js +0 -120
- package/dist/credentials/GitHubCopilotOAuth2Api.credentials.oauth.d.ts +0 -9
- package/dist/credentials/GitHubCopilotOAuth2Api.credentials.oauth.js +0 -75
- package/dist/nodes/GitHubCopilot/githubcopilot.svg +0 -34
- package/dist/nodes/GitHubCopilotChatAPI/copilot.svg +0 -34
- package/dist/nodes/GitHubCopilotChatModel/copilot.svg +0 -34
- package/dist/nodes/GitHubCopilotOpenAI/copilot.svg +0 -34
- package/dist/nodes/GitHubCopilotTest/copilot.svg +0 -34
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.requestDeviceCode = requestDeviceCode;
|
|
4
|
+
exports.pollForAccessToken = pollForAccessToken;
|
|
5
|
+
exports.convertToCopilotToken = convertToCopilotToken;
|
|
6
|
+
exports.executeDeviceFlow = executeDeviceFlow;
|
|
7
|
+
async function requestDeviceCode(clientId, scopes, deviceCodeUrl) {
|
|
8
|
+
const response = await fetch(deviceCodeUrl, {
|
|
9
|
+
method: "POST",
|
|
10
|
+
headers: {
|
|
11
|
+
"Accept": "application/json",
|
|
12
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
13
|
+
},
|
|
14
|
+
body: new URLSearchParams({
|
|
15
|
+
client_id: clientId,
|
|
16
|
+
scope: scopes,
|
|
17
|
+
}),
|
|
18
|
+
});
|
|
19
|
+
if (!response.ok) {
|
|
20
|
+
throw new Error(`Failed to request device code: ${response.status} ${response.statusText}`);
|
|
21
|
+
}
|
|
22
|
+
return (await response.json());
|
|
23
|
+
}
|
|
24
|
+
async function pollForAccessToken(clientId, deviceCode, accessTokenUrl, interval = 5, maxAttempts = 180) {
|
|
25
|
+
let currentInterval = interval * 1000;
|
|
26
|
+
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
27
|
+
await sleep(currentInterval);
|
|
28
|
+
const response = await fetch(accessTokenUrl, {
|
|
29
|
+
method: "POST",
|
|
30
|
+
headers: {
|
|
31
|
+
"Accept": "application/json",
|
|
32
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
33
|
+
},
|
|
34
|
+
body: new URLSearchParams({
|
|
35
|
+
client_id: clientId,
|
|
36
|
+
device_code: deviceCode,
|
|
37
|
+
grant_type: "urn:ietf:params:oauth:grant-type:device_code",
|
|
38
|
+
}),
|
|
39
|
+
});
|
|
40
|
+
const data = (await response.json());
|
|
41
|
+
if (data.access_token) {
|
|
42
|
+
return data.access_token;
|
|
43
|
+
}
|
|
44
|
+
if (data.error === "authorization_pending") {
|
|
45
|
+
console.log(`[Device Flow] Attempt ${attempt}/${maxAttempts}: Waiting for authorization...`);
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
if (data.error === "slow_down") {
|
|
49
|
+
currentInterval += 5000;
|
|
50
|
+
console.log(`[Device Flow] Rate limited, increasing interval to ${currentInterval / 1000}s`);
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
if (data.error === "expired_token") {
|
|
54
|
+
throw new Error("Device code expired. Please start the Device Flow again.");
|
|
55
|
+
}
|
|
56
|
+
if (data.error === "access_denied") {
|
|
57
|
+
throw new Error("User denied authorization.");
|
|
58
|
+
}
|
|
59
|
+
throw new Error(`OAuth error: ${data.error} - ${data.error_description || "Unknown error"}`);
|
|
60
|
+
}
|
|
61
|
+
throw new Error("Device Flow timeout. Authorization took too long.");
|
|
62
|
+
}
|
|
63
|
+
async function convertToCopilotToken(githubToken, copilotTokenUrl) {
|
|
64
|
+
const response = await fetch(copilotTokenUrl, {
|
|
65
|
+
method: "GET",
|
|
66
|
+
headers: {
|
|
67
|
+
"Authorization": `token ${githubToken}`,
|
|
68
|
+
"Accept": "application/vnd.github+json",
|
|
69
|
+
"X-GitHub-Api-Version": "2025-04-01",
|
|
70
|
+
"User-Agent": "GitHub-Copilot-Chat/1.0.0 VSCode/1.85.0",
|
|
71
|
+
"Editor-Version": "vscode/1.85.0",
|
|
72
|
+
"Editor-Plugin-Version": "copilot-chat/0.12.0",
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
if (!response.ok) {
|
|
76
|
+
console.warn(`[Device Flow] Failed to convert to Copilot token: ${response.status}`);
|
|
77
|
+
return {
|
|
78
|
+
token: githubToken,
|
|
79
|
+
expires_at: Date.now() + (8 * 60 * 60 * 1000),
|
|
80
|
+
refresh_in: 8 * 60 * 60,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
const data = (await response.json());
|
|
84
|
+
return data;
|
|
85
|
+
}
|
|
86
|
+
async function executeDeviceFlow(clientId, scopes, deviceCodeUrl, accessTokenUrl, copilotTokenUrl, onProgress) {
|
|
87
|
+
try {
|
|
88
|
+
onProgress === null || onProgress === void 0 ? void 0 : onProgress({
|
|
89
|
+
step: 1,
|
|
90
|
+
status: "requesting_device_code",
|
|
91
|
+
message: "Solicitando device code do GitHub...",
|
|
92
|
+
});
|
|
93
|
+
const deviceData = await requestDeviceCode(clientId, scopes, deviceCodeUrl);
|
|
94
|
+
onProgress === null || onProgress === void 0 ? void 0 : onProgress({
|
|
95
|
+
step: 2,
|
|
96
|
+
status: "awaiting_authorization",
|
|
97
|
+
message: "Aguardando sua autorização no GitHub...",
|
|
98
|
+
deviceData: {
|
|
99
|
+
userCode: deviceData.user_code,
|
|
100
|
+
verificationUri: deviceData.verification_uri,
|
|
101
|
+
verificationUriComplete: deviceData.verification_uri_complete,
|
|
102
|
+
expiresIn: deviceData.expires_in,
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
const accessToken = await pollForAccessToken(clientId, deviceData.device_code, accessTokenUrl, deviceData.interval);
|
|
106
|
+
onProgress === null || onProgress === void 0 ? void 0 : onProgress({
|
|
107
|
+
step: 3,
|
|
108
|
+
status: "token_obtained",
|
|
109
|
+
message: "Token GitHub OAuth obtido! Convertendo para token Copilot...",
|
|
110
|
+
});
|
|
111
|
+
const copilotData = await convertToCopilotToken(accessToken, copilotTokenUrl);
|
|
112
|
+
onProgress === null || onProgress === void 0 ? void 0 : onProgress({
|
|
113
|
+
step: 4,
|
|
114
|
+
status: "complete",
|
|
115
|
+
message: "✅ Autenticação completa! Token salvo com sucesso.",
|
|
116
|
+
});
|
|
117
|
+
return {
|
|
118
|
+
success: true,
|
|
119
|
+
accessToken: copilotData.token || accessToken,
|
|
120
|
+
expiresAt: new Date(copilotData.expires_at),
|
|
121
|
+
metadata: {
|
|
122
|
+
sku: copilotData.sku,
|
|
123
|
+
chatEnabled: copilotData.chat_enabled,
|
|
124
|
+
refreshIn: copilotData.refresh_in,
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
catch (error) {
|
|
129
|
+
onProgress === null || onProgress === void 0 ? void 0 : onProgress({
|
|
130
|
+
step: -1,
|
|
131
|
+
status: "error",
|
|
132
|
+
message: `❌ Erro: ${error instanceof Error ? error.message : String(error)}`,
|
|
133
|
+
});
|
|
134
|
+
return {
|
|
135
|
+
success: false,
|
|
136
|
+
error: error instanceof Error ? error.message : String(error),
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
function sleep(ms) {
|
|
141
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
142
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-github-copilot",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.31.1",
|
|
4
4
|
"description": "n8n community node for GitHub Copilot with CLI integration, Chat API access, and AI Chat Model for workflows - access GPT-5, Claude, Gemini and more using your Copilot subscription",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/sufficit/n8n-nodes-github-copilot",
|
|
@@ -26,12 +26,11 @@
|
|
|
26
26
|
"n8n": {
|
|
27
27
|
"n8nNodesApiVersion": 1,
|
|
28
28
|
"credentials": [
|
|
29
|
-
"dist/credentials/GitHubCopilotApi.credentials.js"
|
|
30
|
-
"dist/credentials/GitHubCopilotOAuth2Api.credentials.js",
|
|
31
|
-
"dist/credentials/GitHubCopilotOAuth2Api.credentials.oauth.js"
|
|
29
|
+
"dist/credentials/GitHubCopilotApi.credentials.js"
|
|
32
30
|
],
|
|
33
31
|
"nodes": [
|
|
34
32
|
"dist/nodes/GitHubCopilot/GitHubCopilot.node.js",
|
|
33
|
+
"dist/nodes/GitHubCopilotAuthHelper/GitHubCopilotAuthHelper.node.js",
|
|
35
34
|
"dist/nodes/GitHubCopilotChatAPI/GitHubCopilotChatAPI.node.js",
|
|
36
35
|
"dist/nodes/GitHubCopilotChatModel/GitHubCopilotChatModel.node.js",
|
|
37
36
|
"dist/nodes/GitHubCopilotOpenAI/GitHubCopilotOpenAI.node.js",
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ICredentialType, INodeProperties, ICredentialTestRequest } from 'n8n-workflow';
|
|
2
|
-
export declare class GitHubApi implements ICredentialType {
|
|
3
|
-
name: string;
|
|
4
|
-
displayName: string;
|
|
5
|
-
extends: string[];
|
|
6
|
-
documentationUrl: string;
|
|
7
|
-
properties: INodeProperties[];
|
|
8
|
-
test: ICredentialTestRequest;
|
|
9
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GitHubApi = void 0;
|
|
4
|
-
class GitHubApi {
|
|
5
|
-
constructor() {
|
|
6
|
-
this.name = 'gitHubApi';
|
|
7
|
-
this.displayName = 'GitHub OAuth2 API';
|
|
8
|
-
this.extends = ['oAuth2Api'];
|
|
9
|
-
this.documentationUrl = 'https://docs.github.com/en/developers/apps/building-oauth-apps/authorizing-oauth-apps';
|
|
10
|
-
this.properties = [
|
|
11
|
-
{
|
|
12
|
-
displayName: 'Grant Type',
|
|
13
|
-
name: 'grantType',
|
|
14
|
-
type: 'hidden',
|
|
15
|
-
default: 'authorizationCode',
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
displayName: 'Authorization URL',
|
|
19
|
-
name: 'authUrl',
|
|
20
|
-
type: 'hidden',
|
|
21
|
-
default: 'https://github.com/login/oauth/authorize',
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
displayName: 'Access Token URL',
|
|
25
|
-
name: 'accessTokenUrl',
|
|
26
|
-
type: 'hidden',
|
|
27
|
-
default: 'https://github.com/login/oauth/access_token',
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
displayName: 'Scope',
|
|
31
|
-
name: 'scope',
|
|
32
|
-
type: 'hidden',
|
|
33
|
-
default: 'copilot copilot:read copilot:write read:org repo user',
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
displayName: 'Auth URI Query Parameters',
|
|
37
|
-
name: 'authQueryParameters',
|
|
38
|
-
type: 'hidden',
|
|
39
|
-
default: '',
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
displayName: 'Authentication',
|
|
43
|
-
name: 'authentication',
|
|
44
|
-
type: 'hidden',
|
|
45
|
-
default: 'header',
|
|
46
|
-
},
|
|
47
|
-
];
|
|
48
|
-
this.test = {
|
|
49
|
-
request: {
|
|
50
|
-
baseURL: 'https://api.githubcopilot.com',
|
|
51
|
-
url: '/models',
|
|
52
|
-
method: 'GET',
|
|
53
|
-
},
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
exports.GitHubApi = GitHubApi;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GitHubApiManual = void 0;
|
|
4
|
-
class GitHubApiManual {
|
|
5
|
-
constructor() {
|
|
6
|
-
this.name = 'gitHubApiManual';
|
|
7
|
-
this.displayName = 'GitHub API (Manual Token)';
|
|
8
|
-
this.documentationUrl = 'https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token';
|
|
9
|
-
this.properties = [
|
|
10
|
-
{
|
|
11
|
-
displayName: 'Access Token',
|
|
12
|
-
name: 'accessToken',
|
|
13
|
-
type: 'string',
|
|
14
|
-
typeOptions: { password: true },
|
|
15
|
-
required: true,
|
|
16
|
-
default: '',
|
|
17
|
-
placeholder: 'gho_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
|
|
18
|
-
description: 'GitHub Copilot access token. Must start with "gho_" for GitHub Copilot API. Personal Access Tokens (ghp_*) are not supported.',
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
displayName: 'Token Type Info',
|
|
22
|
-
name: 'tokenInfo',
|
|
23
|
-
type: 'notice',
|
|
24
|
-
default: '',
|
|
25
|
-
displayOptions: {
|
|
26
|
-
show: {},
|
|
27
|
-
},
|
|
28
|
-
description: '⚠️ IMPORTANT: Only GitHub Copilot tokens (gho_*) work with this API. Personal Access Tokens (ghp_*) and other formats will be rejected with authentication errors. Contact your organization admin to obtain a proper GitHub Copilot access token.',
|
|
29
|
-
},
|
|
30
|
-
];
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
exports.GitHubApiManual = GitHubApiManual;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ICredentialType, INodeProperties, ICredentialTestRequest, IAuthenticateGeneric } from "n8n-workflow";
|
|
2
|
-
export declare class GitHubCopilotOAuth2Api implements ICredentialType {
|
|
3
|
-
name: string;
|
|
4
|
-
displayName: string;
|
|
5
|
-
documentationUrl: string;
|
|
6
|
-
properties: INodeProperties[];
|
|
7
|
-
authenticate: IAuthenticateGeneric;
|
|
8
|
-
test: ICredentialTestRequest;
|
|
9
|
-
}
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GitHubCopilotOAuth2Api = void 0;
|
|
4
|
-
const GitHubCopilotEndpoints_1 = require("../shared/utils/GitHubCopilotEndpoints");
|
|
5
|
-
class GitHubCopilotOAuth2Api {
|
|
6
|
-
constructor() {
|
|
7
|
-
this.name = "githubCopilotOAuth2Api";
|
|
8
|
-
this.displayName = "GitHub Copilot OAuth2 (with Helper)";
|
|
9
|
-
this.documentationUrl = "https://docs.github.com/en/copilot/github-copilot-chat/copilot-chat-in-ides/using-github-copilot-chat-in-your-ide";
|
|
10
|
-
this.properties = [
|
|
11
|
-
{
|
|
12
|
-
displayName: "🎯 GitHub Copilot OAuth Helper",
|
|
13
|
-
name: "authNotice",
|
|
14
|
-
type: "notice",
|
|
15
|
-
default: "",
|
|
16
|
-
description: `<strong>🚀 Easy Token Generation:</strong><br/>
|
|
17
|
-
1. Run the helper script: <code>node get-copilot-token.js</code><br/>
|
|
18
|
-
2. Follow the Device Flow OAuth in your browser<br/>
|
|
19
|
-
3. Copy the generated token below<br/><br/>
|
|
20
|
-
<em>The script handles all OAuth complexity automatically!</em>`,
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
displayName: "Authentication Method",
|
|
24
|
-
name: "authMethod",
|
|
25
|
-
type: "options",
|
|
26
|
-
options: [
|
|
27
|
-
{
|
|
28
|
-
name: "Manual Token (Paste from Script)",
|
|
29
|
-
value: "manual",
|
|
30
|
-
description: "Paste token generated by get-copilot-token.js script",
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
name: "Device Flow OAuth (Interactive)",
|
|
34
|
-
value: "deviceFlow",
|
|
35
|
-
description: "Generate Device Flow code for manual authorization",
|
|
36
|
-
},
|
|
37
|
-
],
|
|
38
|
-
default: "manual",
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
displayName: "GitHub Copilot Token",
|
|
42
|
-
name: "token",
|
|
43
|
-
type: "string",
|
|
44
|
-
typeOptions: {
|
|
45
|
-
password: true,
|
|
46
|
-
},
|
|
47
|
-
default: "",
|
|
48
|
-
required: true,
|
|
49
|
-
displayOptions: {
|
|
50
|
-
show: {
|
|
51
|
-
authMethod: ["manual"],
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
description: "🔑 Paste the token generated by <code>get-copilot-token.js</code> script (format: gho_*)",
|
|
55
|
-
placeholder: "gho_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
displayName: "🔧 Device Flow Setup",
|
|
59
|
-
name: "deviceFlowSetup",
|
|
60
|
-
type: "notice",
|
|
61
|
-
default: "",
|
|
62
|
-
displayOptions: {
|
|
63
|
-
show: {
|
|
64
|
-
authMethod: ["deviceFlow"],
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
description: `<strong>� Device Flow Configuration:</strong><br/>
|
|
68
|
-
Client ID: <code>01ab8ac9400c4e429b23</code><br/>
|
|
69
|
-
Scopes: <code>repo user:email</code><br/><br/>
|
|
70
|
-
<strong>🌐 Manual Steps:</strong><br/>
|
|
71
|
-
1. Go to: <a href="https://github.com/login/device" target="_blank">https://github.com/login/device</a><br/>
|
|
72
|
-
2. Use Client ID: 01ab8ac9400c4e429b23<br/>
|
|
73
|
-
3. Enter the 8-character code generated below<br/>
|
|
74
|
-
4. Authorize the application<br/>
|
|
75
|
-
5. Get your token and paste it in Manual Token field`,
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
displayName: "Generate Device Code",
|
|
79
|
-
name: "generateCode",
|
|
80
|
-
type: "button",
|
|
81
|
-
typeOptions: {
|
|
82
|
-
action: "generateDeviceCode",
|
|
83
|
-
},
|
|
84
|
-
default: "",
|
|
85
|
-
displayOptions: {
|
|
86
|
-
show: {
|
|
87
|
-
authMethod: ["deviceFlow"],
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
description: "Click to generate an 8-character code for Device Flow OAuth",
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
displayName: "Device Code",
|
|
94
|
-
name: "deviceCode",
|
|
95
|
-
type: "string",
|
|
96
|
-
default: "",
|
|
97
|
-
displayOptions: {
|
|
98
|
-
show: {
|
|
99
|
-
authMethod: ["deviceFlow"],
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
description: "🔤 8-character code for GitHub Device Flow (generated automatically)",
|
|
103
|
-
placeholder: "ABCD-EFGH",
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
displayName: "Verification URL",
|
|
107
|
-
name: "verificationUrl",
|
|
108
|
-
type: "string",
|
|
109
|
-
default: "https://github.com/login/device",
|
|
110
|
-
displayOptions: {
|
|
111
|
-
show: {
|
|
112
|
-
authMethod: ["deviceFlow"],
|
|
113
|
-
},
|
|
114
|
-
},
|
|
115
|
-
description: "🌐 URL to authorize the application",
|
|
116
|
-
},
|
|
117
|
-
];
|
|
118
|
-
this.authenticate = {
|
|
119
|
-
type: "generic",
|
|
120
|
-
properties: {
|
|
121
|
-
headers: {
|
|
122
|
-
Authorization: "=Bearer {{$credentials.token}}",
|
|
123
|
-
Accept: "application/json",
|
|
124
|
-
"Content-Type": "application/json",
|
|
125
|
-
"User-Agent": "GitHub-Copilot-Chat/1.0.0 VSCode/1.85.0",
|
|
126
|
-
"Editor-Version": "vscode/1.85.0",
|
|
127
|
-
"Editor-Plugin-Version": "copilot-chat/0.12.0",
|
|
128
|
-
"X-GitHub-Api-Version": "2025-04-01",
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
};
|
|
132
|
-
this.test = {
|
|
133
|
-
request: {
|
|
134
|
-
baseURL: GitHubCopilotEndpoints_1.GITHUB_COPILOT_API.BASE_URL,
|
|
135
|
-
url: GitHubCopilotEndpoints_1.GITHUB_COPILOT_API.ENDPOINTS.MODELS,
|
|
136
|
-
method: "GET",
|
|
137
|
-
},
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
exports.GitHubCopilotOAuth2Api = GitHubCopilotOAuth2Api;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ICredentialType, INodeProperties, ICredentialTestRequest, IAuthenticateGeneric } from "n8n-workflow";
|
|
2
|
-
export declare class GitHubCopilotOAuth2Api implements ICredentialType {
|
|
3
|
-
name: string;
|
|
4
|
-
displayName: string;
|
|
5
|
-
documentationUrl: string;
|
|
6
|
-
properties: INodeProperties[];
|
|
7
|
-
authenticate: IAuthenticateGeneric;
|
|
8
|
-
test: ICredentialTestRequest;
|
|
9
|
-
}
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GitHubCopilotOAuth2Api = void 0;
|
|
4
|
-
const GitHubCopilotEndpoints_1 = require("../shared/utils/GitHubCopilotEndpoints");
|
|
5
|
-
class GitHubCopilotOAuth2Api {
|
|
6
|
-
constructor() {
|
|
7
|
-
this.name = "githubCopilotOAuth2Api";
|
|
8
|
-
this.displayName = "GitHub Copilot OAuth2 (with Helper)";
|
|
9
|
-
this.documentationUrl = "https://docs.github.com/en/copilot/github-copilot-chat/copilot-chat-in-ides/using-github-copilot-chat-in-your-ide";
|
|
10
|
-
this.properties = [
|
|
11
|
-
{
|
|
12
|
-
displayName: "🎯 Como obter seu token",
|
|
13
|
-
name: "authMethod",
|
|
14
|
-
type: "options",
|
|
15
|
-
options: [
|
|
16
|
-
{
|
|
17
|
-
name: "🚀 Script Automático (RECOMENDADO)",
|
|
18
|
-
value: "script",
|
|
19
|
-
description: "Execute: node get-copilot-token.js no terminal",
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
name: "🔧 OAuth Manual no GitHub",
|
|
23
|
-
value: "manual",
|
|
24
|
-
description: "Processo manual no site do GitHub",
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
name: "📋 Já tenho o token",
|
|
28
|
-
value: "have_token",
|
|
29
|
-
description: "Pular instruções e inserir token",
|
|
30
|
-
},
|
|
31
|
-
],
|
|
32
|
-
default: "script",
|
|
33
|
-
description: "Escolha como quer obter seu token GitHub Copilot",
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
displayName: "🚀 Execute o Script Automático",
|
|
37
|
-
name: "scriptInstructions",
|
|
38
|
-
type: "notice",
|
|
39
|
-
default: "",
|
|
40
|
-
displayOptions: {
|
|
41
|
-
show: {
|
|
42
|
-
authMethod: ["script"],
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
description: `<div style="background: #e8f5e8; padding: 15px; border: 2px solid #4CAF50; border-radius: 8px;">
|
|
46
|
-
<strong style="color: #2E7D32; font-size: 16px;">📋 SCRIPT AUTOMÁTICO (MAIS FÁCIL)</strong><br/><br/>
|
|
47
|
-
<strong>1. Abra o terminal:</strong><br/>
|
|
48
|
-
<code style="background: #f0f0f0; padding: 8px; border-radius: 4px; display: block; margin: 8px 0;">cd z:\\Desenvolvimento\\n8n-nodes-copilot</code><br/>
|
|
49
|
-
<strong>2. Execute o script:</strong><br/>
|
|
50
|
-
<code style="background: #f0f0f0; padding: 8px; border-radius: 4px; display: block; margin: 8px 0;">node get-copilot-token.js</code><br/>
|
|
51
|
-
<strong>3. Siga as instruções:</strong><br/>
|
|
52
|
-
• O script abre o navegador automaticamente<br/>
|
|
53
|
-
• Faça login no GitHub se necessário<br/>
|
|
54
|
-
• Autorize a aplicação<br/>
|
|
55
|
-
• O token será exibido no terminal<br/><br/>
|
|
56
|
-
<strong>4. Copie o token e cole no campo abaixo</strong>
|
|
57
|
-
</div>`,
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
displayName: "🔧 OAuth Manual no GitHub",
|
|
61
|
-
name: "manualInstructions",
|
|
62
|
-
type: "notice",
|
|
63
|
-
default: "",
|
|
64
|
-
displayOptions: {
|
|
65
|
-
show: {
|
|
66
|
-
authMethod: ["manual"],
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
description: `<div style="background: #fff3e0; padding: 15px; border: 2px solid #FF9800; border-radius: 8px;">
|
|
70
|
-
<strong style="color: #E65100; font-size: 16px;">📋 PROCESSO MANUAL</strong><br/><br/>
|
|
71
|
-
<strong>1. Abra esta URL:</strong><br/>
|
|
72
|
-
<a href="https://github.com/login/device" target="_blank" style="background: #2196F3; color: white; padding: 10px 15px; text-decoration: none; border-radius: 5px; display: inline-block; margin: 8px 0;">🌐 CLIQUE AQUI - GitHub Device Flow</a><br/><br/>
|
|
73
|
-
<strong>2. Cole este Client ID:</strong><br/>
|
|
74
|
-
<code style="background: #f0f0f0; padding: 8px; border-radius: 4px; display: block; margin: 8px 0; font-size: 14px;">01ab8ac9400c4e429b23</code><br/>
|
|
75
|
-
<strong>3. Cole estes Scopes:</strong><br/>
|
|
76
|
-
<code style="background: #f0f0f0; padding: 8px; border-radius: 4px; display: block; margin: 8px 0;">repo user:email</code><br/>
|
|
77
|
-
<strong>4. Processo:</strong><br/>
|
|
78
|
-
• GitHub gera código de 8 caracteres<br/>
|
|
79
|
-
• Autorize a aplicação<br/>
|
|
80
|
-
• Copie o token final<br/><br/>
|
|
81
|
-
<strong>5. Cole o token no campo abaixo</strong>
|
|
82
|
-
</div>`,
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
displayName: "GitHub Copilot Token",
|
|
86
|
-
name: "token",
|
|
87
|
-
type: "string",
|
|
88
|
-
typeOptions: {
|
|
89
|
-
password: true,
|
|
90
|
-
},
|
|
91
|
-
default: "",
|
|
92
|
-
required: true,
|
|
93
|
-
description: "🔑 Cole aqui seu token GitHub Copilot (formato: gho_*)",
|
|
94
|
-
placeholder: "gho_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
|
95
|
-
},
|
|
96
|
-
];
|
|
97
|
-
this.authenticate = {
|
|
98
|
-
type: "generic",
|
|
99
|
-
properties: {
|
|
100
|
-
headers: {
|
|
101
|
-
Authorization: "=Bearer {{$credentials.token}}",
|
|
102
|
-
Accept: "application/json",
|
|
103
|
-
"Content-Type": "application/json",
|
|
104
|
-
"User-Agent": "GitHub-Copilot-Chat/1.0.0 VSCode/1.85.0",
|
|
105
|
-
"Editor-Version": "vscode/1.85.0",
|
|
106
|
-
"Editor-Plugin-Version": "copilot-chat/0.12.0",
|
|
107
|
-
"X-GitHub-Api-Version": "2025-04-01",
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
};
|
|
111
|
-
this.test = {
|
|
112
|
-
request: {
|
|
113
|
-
baseURL: GitHubCopilotEndpoints_1.GITHUB_COPILOT_API.BASE_URL,
|
|
114
|
-
url: GitHubCopilotEndpoints_1.GITHUB_COPILOT_API.ENDPOINTS.MODELS,
|
|
115
|
-
method: "GET",
|
|
116
|
-
},
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
exports.GitHubCopilotOAuth2Api = GitHubCopilotOAuth2Api;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { ICredentialType, INodeProperties, ICredentialTestRequest } from "n8n-workflow";
|
|
2
|
-
export declare class GitHubCopilotOAuth2Api implements ICredentialType {
|
|
3
|
-
name: string;
|
|
4
|
-
extends: string[];
|
|
5
|
-
displayName: string;
|
|
6
|
-
documentationUrl: string;
|
|
7
|
-
properties: INodeProperties[];
|
|
8
|
-
test: ICredentialTestRequest;
|
|
9
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GitHubCopilotOAuth2Api = void 0;
|
|
4
|
-
const GitHubCopilotEndpoints_1 = require("../shared/utils/GitHubCopilotEndpoints");
|
|
5
|
-
class GitHubCopilotOAuth2Api {
|
|
6
|
-
constructor() {
|
|
7
|
-
this.name = "githubCopilotOAuth2Api";
|
|
8
|
-
this.extends = ["oAuth2Api"];
|
|
9
|
-
this.displayName = "GitHub Copilot OAuth2 API";
|
|
10
|
-
this.documentationUrl = "github";
|
|
11
|
-
this.properties = [
|
|
12
|
-
{
|
|
13
|
-
displayName: "Grant Type",
|
|
14
|
-
name: "grantType",
|
|
15
|
-
type: "hidden",
|
|
16
|
-
default: "authorizationCode",
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
displayName: "Client ID",
|
|
20
|
-
name: "clientId",
|
|
21
|
-
type: "hidden",
|
|
22
|
-
default: "01ab8ac9400c4e429b23",
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
displayName: "Client Secret",
|
|
26
|
-
name: "clientSecret",
|
|
27
|
-
type: "hidden",
|
|
28
|
-
default: "",
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
displayName: "Authorization URL",
|
|
32
|
-
name: "authUrl",
|
|
33
|
-
type: "hidden",
|
|
34
|
-
default: "https://github.com/login/oauth/authorize",
|
|
35
|
-
required: true,
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
displayName: "Access Token URL",
|
|
39
|
-
name: "accessTokenUrl",
|
|
40
|
-
type: "hidden",
|
|
41
|
-
default: "https://github.com/login/oauth/access_token",
|
|
42
|
-
required: true,
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
displayName: "Scope",
|
|
46
|
-
name: "scope",
|
|
47
|
-
type: "hidden",
|
|
48
|
-
default: "repo user:email",
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
displayName: "Auth URI Query Parameters",
|
|
52
|
-
name: "authQueryParameters",
|
|
53
|
-
type: "hidden",
|
|
54
|
-
default: "",
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
displayName: "Authentication",
|
|
58
|
-
name: "authentication",
|
|
59
|
-
type: "hidden",
|
|
60
|
-
default: "header",
|
|
61
|
-
},
|
|
62
|
-
];
|
|
63
|
-
this.test = {
|
|
64
|
-
request: {
|
|
65
|
-
baseURL: GitHubCopilotEndpoints_1.GITHUB_COPILOT_API.GITHUB_BASE_URL,
|
|
66
|
-
url: GitHubCopilotEndpoints_1.GITHUB_COPILOT_API.ENDPOINTS.USER_COPILOT,
|
|
67
|
-
headers: {
|
|
68
|
-
Accept: "application/vnd.github.v3+json",
|
|
69
|
-
"User-Agent": "n8n-GitHub-Copilot",
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
exports.GitHubCopilotOAuth2Api = GitHubCopilotOAuth2Api;
|