fraim-framework 2.0.62 → 2.0.63
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/bin/fraim-mcp.js +25 -9
- package/dist/src/cli/commands/init-project.js +98 -26
- package/dist/src/cli/commands/init.js +81 -23
- package/dist/src/cli/commands/setup.js +275 -47
- package/dist/src/local-mcp-server/stdio-server.js +351 -22
- package/dist/src/utils/enforcement-utils.js +239 -0
- package/dist/src/utils/git-utils.js +0 -27
- package/dist/src/utils/platform-detection.js +1 -1
- package/dist/src/utils/script-sync-utils.js +6 -1
- package/dist/src/utils/validate-workflows.js +101 -0
- package/package.json +4 -3
- package/bin/fraim.js +0 -23
- package/dist/src/cli/commands/mcp.js +0 -65
- package/dist/src/fraim/issue-tracking/ado-provider.js +0 -304
- package/dist/src/fraim/issue-tracking/factory.js +0 -63
- package/dist/src/fraim/issue-tracking/github-provider.js +0 -200
- package/dist/src/fraim/issue-tracking/types.js +0 -7
- package/dist/src/fraim/issue-tracking-config.js +0 -83
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* GitHub Issue Tracking Provider
|
|
4
|
-
*
|
|
5
|
-
* Implements the IssueTrackingProvider interface for GitHub Issues
|
|
6
|
-
*/
|
|
7
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
8
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
9
|
-
};
|
|
10
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.GitHubIssueProvider = void 0;
|
|
12
|
-
const axios_1 = __importDefault(require("axios"));
|
|
13
|
-
class GitHubIssueProvider {
|
|
14
|
-
constructor(config) {
|
|
15
|
-
this.config = config;
|
|
16
|
-
this.baseUrl = `https://api.github.com/repos/${config.owner}/${config.repo}`;
|
|
17
|
-
}
|
|
18
|
-
async createIssue(params) {
|
|
19
|
-
const { title, body, labels, assignee, dryRun } = params;
|
|
20
|
-
const payload = {
|
|
21
|
-
title,
|
|
22
|
-
body
|
|
23
|
-
};
|
|
24
|
-
if (labels && labels.length > 0) {
|
|
25
|
-
payload.labels = labels;
|
|
26
|
-
}
|
|
27
|
-
if (assignee) {
|
|
28
|
-
payload.assignee = assignee;
|
|
29
|
-
}
|
|
30
|
-
if (dryRun) {
|
|
31
|
-
return {
|
|
32
|
-
success: true,
|
|
33
|
-
dryRun: true,
|
|
34
|
-
provider: 'github',
|
|
35
|
-
message: `[DRY RUN] Would create GitHub issue: "${title}" in ${this.config.owner}/${this.config.repo}`
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
try {
|
|
39
|
-
const response = await axios_1.default.post(`${this.baseUrl}/issues`, payload, {
|
|
40
|
-
headers: {
|
|
41
|
-
'Authorization': `Bearer ${this.config.token}`,
|
|
42
|
-
'Accept': 'application/vnd.github.v3+json',
|
|
43
|
-
'Content-Type': 'application/json',
|
|
44
|
-
},
|
|
45
|
-
});
|
|
46
|
-
return {
|
|
47
|
-
success: true,
|
|
48
|
-
issueNumber: response.data.number,
|
|
49
|
-
issueId: response.data.number,
|
|
50
|
-
htmlUrl: response.data.html_url,
|
|
51
|
-
provider: 'github'
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
catch (error) {
|
|
55
|
-
return {
|
|
56
|
-
success: false,
|
|
57
|
-
provider: 'github',
|
|
58
|
-
message: this.formatError(error)
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
async getIssue(issueId) {
|
|
63
|
-
try {
|
|
64
|
-
const response = await axios_1.default.get(`${this.baseUrl}/issues/${issueId}`, {
|
|
65
|
-
headers: {
|
|
66
|
-
'Authorization': `Bearer ${this.config.token}`,
|
|
67
|
-
'Accept': 'application/vnd.github.v3+json',
|
|
68
|
-
},
|
|
69
|
-
});
|
|
70
|
-
const issue = response.data;
|
|
71
|
-
return {
|
|
72
|
-
id: issue.number,
|
|
73
|
-
title: issue.title,
|
|
74
|
-
body: issue.body || '',
|
|
75
|
-
state: issue.state === 'open' ? 'open' : 'closed',
|
|
76
|
-
assignee: issue.assignee?.login,
|
|
77
|
-
labels: issue.labels.map((label) => label.name),
|
|
78
|
-
createdAt: new Date(issue.created_at),
|
|
79
|
-
updatedAt: new Date(issue.updated_at),
|
|
80
|
-
htmlUrl: issue.html_url
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
catch (error) {
|
|
84
|
-
if (error.response?.status === 404) {
|
|
85
|
-
return null;
|
|
86
|
-
}
|
|
87
|
-
throw new Error(this.formatError(error));
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
async updateIssue(issueId, updates) {
|
|
91
|
-
const payload = {};
|
|
92
|
-
if (updates.title)
|
|
93
|
-
payload.title = updates.title;
|
|
94
|
-
if (updates.body)
|
|
95
|
-
payload.body = updates.body;
|
|
96
|
-
if (updates.labels)
|
|
97
|
-
payload.labels = updates.labels;
|
|
98
|
-
if (updates.assignee)
|
|
99
|
-
payload.assignee = updates.assignee;
|
|
100
|
-
if (updates.dryRun) {
|
|
101
|
-
return {
|
|
102
|
-
success: true,
|
|
103
|
-
dryRun: true,
|
|
104
|
-
provider: 'github',
|
|
105
|
-
message: `[DRY RUN] Would update GitHub issue #${issueId} in ${this.config.owner}/${this.config.repo}`
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
try {
|
|
109
|
-
const response = await axios_1.default.patch(`${this.baseUrl}/issues/${issueId}`, payload, {
|
|
110
|
-
headers: {
|
|
111
|
-
'Authorization': `Bearer ${this.config.token}`,
|
|
112
|
-
'Accept': 'application/vnd.github.v3+json',
|
|
113
|
-
'Content-Type': 'application/json',
|
|
114
|
-
},
|
|
115
|
-
});
|
|
116
|
-
return {
|
|
117
|
-
success: true,
|
|
118
|
-
issueNumber: response.data.number,
|
|
119
|
-
issueId: response.data.number,
|
|
120
|
-
htmlUrl: response.data.html_url,
|
|
121
|
-
provider: 'github'
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
catch (error) {
|
|
125
|
-
return {
|
|
126
|
-
success: false,
|
|
127
|
-
provider: 'github',
|
|
128
|
-
message: this.formatError(error)
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
async listIssues(filters) {
|
|
133
|
-
const params = {
|
|
134
|
-
per_page: filters?.limit || 30
|
|
135
|
-
};
|
|
136
|
-
if (filters?.state && filters.state !== 'all') {
|
|
137
|
-
params.state = filters.state;
|
|
138
|
-
}
|
|
139
|
-
if (filters?.assignee) {
|
|
140
|
-
params.assignee = filters.assignee;
|
|
141
|
-
}
|
|
142
|
-
if (filters?.labels && filters.labels.length > 0) {
|
|
143
|
-
params.labels = filters.labels.join(',');
|
|
144
|
-
}
|
|
145
|
-
try {
|
|
146
|
-
const response = await axios_1.default.get(`${this.baseUrl}/issues`, {
|
|
147
|
-
headers: {
|
|
148
|
-
'Authorization': `Bearer ${this.config.token}`,
|
|
149
|
-
'Accept': 'application/vnd.github.v3+json',
|
|
150
|
-
},
|
|
151
|
-
params
|
|
152
|
-
});
|
|
153
|
-
return response.data.map((issue) => ({
|
|
154
|
-
id: issue.number,
|
|
155
|
-
title: issue.title,
|
|
156
|
-
body: issue.body || '',
|
|
157
|
-
state: issue.state === 'open' ? 'open' : 'closed',
|
|
158
|
-
assignee: issue.assignee?.login,
|
|
159
|
-
labels: issue.labels.map((label) => label.name),
|
|
160
|
-
createdAt: new Date(issue.created_at),
|
|
161
|
-
updatedAt: new Date(issue.updated_at),
|
|
162
|
-
htmlUrl: issue.html_url
|
|
163
|
-
}));
|
|
164
|
-
}
|
|
165
|
-
catch (error) {
|
|
166
|
-
throw new Error(this.formatError(error));
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
async validateConfig() {
|
|
170
|
-
try {
|
|
171
|
-
// Test by getting repository info
|
|
172
|
-
const response = await axios_1.default.get(this.baseUrl, {
|
|
173
|
-
headers: {
|
|
174
|
-
'Authorization': `Bearer ${this.config.token}`,
|
|
175
|
-
'Accept': 'application/vnd.github.v3+json',
|
|
176
|
-
},
|
|
177
|
-
});
|
|
178
|
-
return {
|
|
179
|
-
valid: true,
|
|
180
|
-
message: `Connected to ${response.data.full_name}`
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
catch (error) {
|
|
184
|
-
return {
|
|
185
|
-
valid: false,
|
|
186
|
-
message: this.formatError(error)
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
formatError(error) {
|
|
191
|
-
if (axios_1.default.isAxiosError(error)) {
|
|
192
|
-
return `GitHub API Error: ${error.response?.status} - ${JSON.stringify(error.response?.data)}`;
|
|
193
|
-
}
|
|
194
|
-
else if (error instanceof Error) {
|
|
195
|
-
return `GitHub Error: ${error.message}`;
|
|
196
|
-
}
|
|
197
|
-
return 'Unknown GitHub error';
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
exports.GitHubIssueProvider = GitHubIssueProvider;
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Issue Tracking Configuration Helper
|
|
4
|
-
*
|
|
5
|
-
* Provides guidance on which MCP tools to use based on configuration.
|
|
6
|
-
* This replaces custom providers with MCP tool recommendations.
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.getIssueTrackingGuidance = getIssueTrackingGuidance;
|
|
10
|
-
exports.getRepositoryInfo = getRepositoryInfo;
|
|
11
|
-
const config_loader_1 = require("./config-loader");
|
|
12
|
-
/**
|
|
13
|
-
* Get guidance on which MCP tools to use for issue tracking
|
|
14
|
-
*/
|
|
15
|
-
function getIssueTrackingGuidance() {
|
|
16
|
-
const config = (0, config_loader_1.loadFraimConfig)();
|
|
17
|
-
// Check for ADO configuration
|
|
18
|
-
if (config.repository?.provider === 'ado') {
|
|
19
|
-
return {
|
|
20
|
-
provider: 'ado',
|
|
21
|
-
mcpTools: {
|
|
22
|
-
createIssue: 'mcp_ado_create_work_item',
|
|
23
|
-
getIssue: 'mcp_ado_get_work_item',
|
|
24
|
-
updateIssue: 'mcp_ado_update_work_item',
|
|
25
|
-
listIssues: 'mcp_ado_list_work_items',
|
|
26
|
-
createPR: 'mcp_ado_create_pull_request',
|
|
27
|
-
getPR: 'mcp_ado_get_pull_request',
|
|
28
|
-
mergePR: 'mcp_ado_merge_pull_request'
|
|
29
|
-
},
|
|
30
|
-
config: {
|
|
31
|
-
organization: config.repository.organization,
|
|
32
|
-
project: config.repository.project
|
|
33
|
-
},
|
|
34
|
-
environmentVars: ['ADO_TOKEN', 'AZURE_DEVOPS_TOKEN'],
|
|
35
|
-
setupInstructions: `Configure ADO MCP server in your IDE with:
|
|
36
|
-
- Organization: ${config.repository.organization}
|
|
37
|
-
- Project: ${config.repository.project}
|
|
38
|
-
- Token: Set ADO_TOKEN or AZURE_DEVOPS_TOKEN environment variable`
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
// Default to GitHub
|
|
42
|
-
const owner = config.repository?.owner || config.git?.repoOwner || 'mathursrus';
|
|
43
|
-
const repo = config.repository?.name || config.git?.repoName || 'FRAIM';
|
|
44
|
-
return {
|
|
45
|
-
provider: 'github',
|
|
46
|
-
mcpTools: {
|
|
47
|
-
createIssue: 'mcp_github_issue_write',
|
|
48
|
-
getIssue: 'mcp_github_issue_read',
|
|
49
|
-
updateIssue: 'mcp_github_issue_write',
|
|
50
|
-
listIssues: 'mcp_github_list_issues',
|
|
51
|
-
createPR: 'mcp_github_create_pull_request',
|
|
52
|
-
getPR: 'mcp_github_pull_request_read',
|
|
53
|
-
mergePR: 'mcp_github_merge_pull_request'
|
|
54
|
-
},
|
|
55
|
-
config: {
|
|
56
|
-
owner,
|
|
57
|
-
repo
|
|
58
|
-
},
|
|
59
|
-
environmentVars: ['GITHUB_TOKEN'],
|
|
60
|
-
setupInstructions: `GitHub MCP tools are configured for:
|
|
61
|
-
- Repository: ${owner}/${repo}
|
|
62
|
-
- Token: Set GITHUB_TOKEN environment variable
|
|
63
|
-
- MCP Server: Ensure GitHub MCP server is configured in your IDE`
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Get repository information from .fraim/config.json
|
|
68
|
-
*/
|
|
69
|
-
function getRepositoryInfo() {
|
|
70
|
-
try {
|
|
71
|
-
const config = (0, config_loader_1.loadFraimConfig)();
|
|
72
|
-
const owner = config.repository?.owner || config.git?.repoOwner;
|
|
73
|
-
const repo = config.repository?.name || config.git?.repoName;
|
|
74
|
-
return {
|
|
75
|
-
owner,
|
|
76
|
-
repo,
|
|
77
|
-
url: owner && repo ? `https://github.com/${owner}/${repo}.git` : undefined
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
catch (e) {
|
|
81
|
-
return {};
|
|
82
|
-
}
|
|
83
|
-
}
|