aiwf 0.3.21 โ 0.3.23
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/package.json +3 -2
- package/src/cli/index.js +39 -336
- package/src/lib/installer.js +310 -90
- package/src/utils/messages.js +24 -0
- package/src/DEPENDENCY_MAP.md +0 -90
- package/src/cli/cache-cli.js +0 -459
- package/src/cli/checkpoint-cli.js +0 -417
- package/src/cli/language-cli.js +0 -286
- package/src/cli/sprint-cli.js +0 -287
- package/src/commands/ai-tool.js +0 -383
- package/src/commands/compress.js +0 -60
- package/src/commands/create-project.js +0 -160
- package/src/commands/evaluate.js +0 -459
- package/src/commands/persona.js +0 -309
- package/src/commands/sprint-task.js +0 -262
- package/src/commands/token.js +0 -312
- package/src/lib/ai-persona-manager.js +0 -711
- package/src/lib/cache-system.js +0 -332
- package/src/lib/context-engine.js +0 -568
- package/src/lib/github-integration.js +0 -402
- package/src/lib/memory-profiler.js +0 -471
- package/src/lib/metrics-collector.js +0 -885
- package/src/lib/offline-detector.js +0 -386
- package/src/lib/resource-loader-enhanced.js +0 -399
- package/src/lib/resource-loader.js +0 -250
- package/src/lib/resources/commands/ai-persona.js +0 -602
- package/src/lib/resources/commands/compress-context.js +0 -389
- package/src/lib/resources/commands/evaluate.js +0 -246
- package/src/lib/resources/commands/persona-context-apply.js +0 -562
- package/src/lib/resources/commands/token-tracking.js +0 -443
- package/src/lib/resources/config/commit-patterns.js +0 -103
- package/src/lib/resources/config/language.json +0 -6
- package/src/lib/resources/personas/PERSONA_INDEX.md +0 -57
- package/src/lib/resources/personas/analyst.json +0 -44
- package/src/lib/resources/personas/architect/best_practices.md +0 -136
- package/src/lib/resources/personas/architect/knowledge_base.md +0 -377
- package/src/lib/resources/personas/architect.json +0 -44
- package/src/lib/resources/personas/backend/best_practices.md +0 -766
- package/src/lib/resources/personas/backend/knowledge_base.md +0 -1070
- package/src/lib/resources/personas/data_analyst/best_practices.md +0 -594
- package/src/lib/resources/personas/data_analyst/knowledge_base.md +0 -1057
- package/src/lib/resources/personas/developer.json +0 -44
- package/src/lib/resources/personas/developer.md +0 -37
- package/src/lib/resources/personas/evaluation_criteria.json +0 -137
- package/src/lib/resources/personas/frontend/best_practices.md +0 -445
- package/src/lib/resources/personas/frontend/knowledge_base.md +0 -729
- package/src/lib/resources/personas/persona-index.json +0 -31
- package/src/lib/resources/personas/reviewer.json +0 -44
- package/src/lib/resources/personas/security/best_practices.md +0 -307
- package/src/lib/resources/personas/security/knowledge_base.md +0 -498
- package/src/lib/resources/personas/tester.json +0 -44
- package/src/lib/resources/templates/README.md +0 -78
- package/src/lib/resources/templates/api-server/config.json +0 -64
- package/src/lib/resources/templates/api-server/template/.aiwf/config.json +0 -56
- package/src/lib/resources/templates/api-server/template/.aiwf/feature-ledger.json +0 -42
- package/src/lib/resources/templates/api-server/template/.aiwf/personas/backend-engineer.json +0 -40
- package/src/lib/resources/templates/api-server/template/.aiwf/scripts/cli.js +0 -111
- package/src/lib/resources/templates/api-server/template/.env.example +0 -29
- package/src/lib/resources/templates/api-server/template/.eslintrc.json +0 -23
- package/src/lib/resources/templates/api-server/template/README.md +0 -171
- package/src/lib/resources/templates/api-server/template/jest.config.js +0 -26
- package/src/lib/resources/templates/api-server/template/nodemon.json +0 -9
- package/src/lib/resources/templates/api-server/template/package.json +0 -61
- package/src/lib/resources/templates/api-server/template/src/app.ts +0 -60
- package/src/lib/resources/templates/api-server/template/src/config/swagger.ts +0 -38
- package/src/lib/resources/templates/api-server/template/src/controllers/aiwfController.ts +0 -54
- package/src/lib/resources/templates/api-server/template/src/controllers/authController.ts +0 -128
- package/src/lib/resources/templates/api-server/template/src/controllers/statusController.ts +0 -28
- package/src/lib/resources/templates/api-server/template/src/index.ts +0 -28
- package/src/lib/resources/templates/api-server/template/src/middleware/aiwfMiddleware.ts +0 -50
- package/src/lib/resources/templates/api-server/template/src/middleware/authMiddleware.ts +0 -41
- package/src/lib/resources/templates/api-server/template/src/middleware/errorHandler.ts +0 -42
- package/src/lib/resources/templates/api-server/template/src/middleware/notFoundHandler.ts +0 -14
- package/src/lib/resources/templates/api-server/template/src/middleware/requestLogger.ts +0 -20
- package/src/lib/resources/templates/api-server/template/src/routes/aiwf.ts +0 -31
- package/src/lib/resources/templates/api-server/template/src/routes/index.ts +0 -13
- package/src/lib/resources/templates/api-server/template/src/routes/v1/index.ts +0 -67
- package/src/lib/resources/templates/api-server/template/src/utils/logger.ts +0 -37
- package/src/lib/resources/templates/api-server/template/tests/app.test.ts +0 -40
- package/src/lib/resources/templates/api-server/template/tsconfig.json +0 -43
- package/src/lib/resources/templates/npm-library/config.json +0 -61
- package/src/lib/resources/templates/npm-library/template/LICENSE +0 -21
- package/src/lib/resources/templates/npm-library/template/README.md +0 -201
- package/src/lib/resources/templates/npm-library/template/package.json +0 -78
- package/src/lib/resources/templates/web-app/config.json +0 -53
- package/src/lib/resources/templates/web-app/template/.aiwf/config.json +0 -54
- package/src/lib/resources/templates/web-app/template/.aiwf/feature-ledger.json +0 -37
- package/src/lib/resources/templates/web-app/template/.aiwf/personas/fullstack-developer.json +0 -40
- package/src/lib/resources/templates/web-app/template/.aiwf/scripts/cli.js +0 -110
- package/src/lib/resources/templates/web-app/template/.eslintrc.cjs +0 -20
- package/src/lib/resources/templates/web-app/template/README.md +0 -151
- package/src/lib/resources/templates/web-app/template/index.html +0 -14
- package/src/lib/resources/templates/web-app/template/package.json +0 -44
- package/src/lib/resources/templates/web-app/template/postcss.config.js +0 -6
- package/src/lib/resources/templates/web-app/template/public/vite.svg +0 -1
- package/src/lib/resources/templates/web-app/template/src/App.tsx +0 -21
- package/src/lib/resources/templates/web-app/template/src/components/Layout.tsx +0 -57
- package/src/lib/resources/templates/web-app/template/src/components/aiwf/ContextStatus.tsx +0 -107
- package/src/lib/resources/templates/web-app/template/src/components/aiwf/TokenUsage.tsx +0 -71
- package/src/lib/resources/templates/web-app/template/src/index.css +0 -60
- package/src/lib/resources/templates/web-app/template/src/main.tsx +0 -10
- package/src/lib/resources/templates/web-app/template/src/pages/AiwfDashboard.tsx +0 -57
- package/src/lib/resources/templates/web-app/template/src/pages/HomePage.tsx +0 -89
- package/src/lib/resources/templates/web-app/template/src/pages/NotFound.tsx +0 -25
- package/src/lib/resources/templates/web-app/template/src/stores/aiwfStore.ts +0 -126
- package/src/lib/resources/templates/web-app/template/src/types/global.d.ts +0 -9
- package/src/lib/resources/templates/web-app/template/src/vite-env.d.ts +0 -1
- package/src/lib/resources/templates/web-app/template/tailwind.config.js +0 -30
- package/src/lib/resources/templates/web-app/template/tsconfig.json +0 -37
- package/src/lib/resources/templates/web-app/template/tsconfig.node.json +0 -10
- package/src/lib/resources/templates/web-app/template/vite.config.ts +0 -23
- package/src/lib/resources/utils/background-monitor.js +0 -223
- package/src/lib/resources/utils/compression-metrics.js +0 -1031
- package/src/lib/resources/utils/compression-strategies.js +0 -557
- package/src/lib/resources/utils/content-normalizer.js +0 -455
- package/src/lib/resources/utils/context-compressor.js +0 -583
- package/src/lib/resources/utils/context-rule-parser.js +0 -180
- package/src/lib/resources/utils/context-token-monitor.js +0 -463
- package/src/lib/resources/utils/context-update-manager.js +0 -502
- package/src/lib/resources/utils/git-utils.js +0 -220
- package/src/lib/resources/utils/importance-classifier.js +0 -645
- package/src/lib/resources/utils/information-filter.js +0 -710
- package/src/lib/resources/utils/persona-aware-compressor.js +0 -598
- package/src/lib/resources/utils/prompt-injector.js +0 -242
- package/src/lib/resources/utils/simplified-evaluator.js +0 -119
- package/src/lib/resources/utils/text-summarizer.js +0 -492
- package/src/lib/resources/utils/token-counter.js +0 -177
- package/src/lib/resources/utils/token-monitor.js +0 -484
- package/src/lib/resources/utils/token-reporter.js +0 -452
- package/src/lib/resources/utils/token-storage.js +0 -433
- package/src/lib/resources/utils/token-tracker.js +0 -283
- package/src/lib/state/priority-calculator.js +0 -217
- package/src/lib/state/state-index.js +0 -155
- package/src/lib/state/task-scanner.js +0 -328
- package/src/lib/task-analyzer.js +0 -599
- package/src/lib/template-cache-system.js +0 -559
- package/src/lib/template-downloader.js +0 -467
- package/src/lib/template-version-manager.js +0 -491
- package/src/lib/token-optimizer.js +0 -517
- package/src/utils/engineering-guard.js +0 -399
|
@@ -1,402 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* AIWF GitHub Integration
|
|
3
|
-
* GitHub Issues์ Pull Requests ํตํฉ ๊ด๋ฆฌ
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { execSync } from 'child_process';
|
|
7
|
-
import fs from 'fs/promises';
|
|
8
|
-
import path from 'path';
|
|
9
|
-
import chalk from 'chalk';
|
|
10
|
-
import ora from 'ora';
|
|
11
|
-
import { StateIndexManager } from './state/state-index.js';
|
|
12
|
-
|
|
13
|
-
export class GitHubIntegration {
|
|
14
|
-
constructor() {
|
|
15
|
-
this.projectRoot = null;
|
|
16
|
-
this.aiwfPath = null;
|
|
17
|
-
this.stateIndexManager = null;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* ์ด๊ธฐํ
|
|
22
|
-
*/
|
|
23
|
-
async init() {
|
|
24
|
-
this.projectRoot = await this.findProjectRoot();
|
|
25
|
-
this.aiwfPath = path.join(this.projectRoot, '.aiwf');
|
|
26
|
-
this.stateIndexManager = new StateIndexManager(this.aiwfPath);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
async findProjectRoot(startDir = process.cwd()) {
|
|
30
|
-
let currentDir = startDir;
|
|
31
|
-
|
|
32
|
-
while (currentDir !== path.parse(currentDir).root) {
|
|
33
|
-
try {
|
|
34
|
-
const aiwfPath = path.join(currentDir, '.aiwf');
|
|
35
|
-
await fs.access(aiwfPath);
|
|
36
|
-
return currentDir;
|
|
37
|
-
} catch {
|
|
38
|
-
currentDir = path.dirname(currentDir);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
throw new Error('.aiwf directory not found. Are you in an AIWF project?');
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* GitHub CLI ์ฌ์ฉ ๊ฐ๋ฅ ์ฌ๋ถ ํ์ธ
|
|
47
|
-
*/
|
|
48
|
-
checkGitHubCLI() {
|
|
49
|
-
try {
|
|
50
|
-
execSync('gh --version', { stdio: 'ignore' });
|
|
51
|
-
return true;
|
|
52
|
-
} catch {
|
|
53
|
-
throw new Error('GitHub CLI (gh) is not installed. Please install it first: https://cli.github.com/');
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* ํ์คํฌ์์ GitHub ์ด์ ์์ฑ
|
|
59
|
-
*/
|
|
60
|
-
async createIssue(taskId) {
|
|
61
|
-
const spinner = ora('Creating GitHub issue...').start();
|
|
62
|
-
|
|
63
|
-
try {
|
|
64
|
-
await this.init();
|
|
65
|
-
this.checkGitHubCLI();
|
|
66
|
-
|
|
67
|
-
// ์ํ ์ธ๋ฑ์ค์์ ํ์คํฌ ์ ๋ณด ๋ก๋
|
|
68
|
-
const stateIndex = await this.stateIndexManager.loadIndex();
|
|
69
|
-
if (!stateIndex) {
|
|
70
|
-
throw new Error('State index not found. Run "aiwf state update" first.');
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const task = stateIndex.tasks[taskId];
|
|
74
|
-
if (!task) {
|
|
75
|
-
throw new Error(`Task ${taskId} not found in state index.`);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
spinner.text = 'Generating issue template...';
|
|
79
|
-
|
|
80
|
-
// ์ด์ ํ
ํ๋ฆฟ ์์ฑ
|
|
81
|
-
const issueBody = this.generateIssueTemplate(task);
|
|
82
|
-
const issueTitle = `${taskId}: ${task.title}`;
|
|
83
|
-
|
|
84
|
-
// GitHub CLI๋ก ์ด์ ์์ฑ
|
|
85
|
-
spinner.text = 'Creating issue on GitHub...';
|
|
86
|
-
const labels = this.generateLabels(task);
|
|
87
|
-
|
|
88
|
-
const createCommand = [
|
|
89
|
-
'gh', 'issue', 'create',
|
|
90
|
-
'--title', `"${issueTitle}"`,
|
|
91
|
-
'--body', `"${issueBody}"`,
|
|
92
|
-
'--label', `"${labels.join(',')}"`,
|
|
93
|
-
'--assignee', '@me'
|
|
94
|
-
].join(' ');
|
|
95
|
-
|
|
96
|
-
const result = execSync(createCommand, {
|
|
97
|
-
encoding: 'utf8',
|
|
98
|
-
cwd: this.projectRoot
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
// ์ด์ URL ์ถ์ถ
|
|
102
|
-
const issueUrl = result.trim();
|
|
103
|
-
const issueNumber = this.extractIssueNumber(issueUrl);
|
|
104
|
-
|
|
105
|
-
// ํ์คํฌ ํ์ผ์ GitHub ์ด์ ์ ๋ณด ์ถ๊ฐ
|
|
106
|
-
if (task.file_path) {
|
|
107
|
-
await this.updateTaskWithIssue(task.file_path, issueNumber, issueUrl);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
spinner.succeed(`GitHub issue created successfully: ${issueUrl}`);
|
|
111
|
-
|
|
112
|
-
console.log(chalk.cyan('\n๐ Issue Details:'));
|
|
113
|
-
console.log(` Title: ${issueTitle}`);
|
|
114
|
-
console.log(` URL: ${issueUrl}`);
|
|
115
|
-
console.log(` Labels: ${labels.join(', ')}`);
|
|
116
|
-
|
|
117
|
-
} catch (error) {
|
|
118
|
-
spinner.fail(`Failed to create GitHub issue: ${error.message}`);
|
|
119
|
-
throw error;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Pull Request ์์ฑ
|
|
125
|
-
*/
|
|
126
|
-
async createPullRequest(taskId) {
|
|
127
|
-
const spinner = ora('Creating pull request...').start();
|
|
128
|
-
|
|
129
|
-
try {
|
|
130
|
-
await this.init();
|
|
131
|
-
this.checkGitHubCLI();
|
|
132
|
-
|
|
133
|
-
// ํ์ฌ ๋ธ๋์น ํ์ธ
|
|
134
|
-
const currentBranch = execSync('git branch --show-current', {
|
|
135
|
-
encoding: 'utf8',
|
|
136
|
-
cwd: this.projectRoot
|
|
137
|
-
}).trim();
|
|
138
|
-
|
|
139
|
-
if (currentBranch === 'main' || currentBranch === 'master') {
|
|
140
|
-
throw new Error('Cannot create PR from main/master branch. Please create a feature branch first.');
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
spinner.text = 'Checking branch status...';
|
|
144
|
-
|
|
145
|
-
// ๋ณ๊ฒฝ์ฌํญ ํ์ธ
|
|
146
|
-
const diffStat = execSync('git diff main...HEAD --stat', {
|
|
147
|
-
encoding: 'utf8',
|
|
148
|
-
cwd: this.projectRoot
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
if (!diffStat.trim()) {
|
|
152
|
-
throw new Error('No changes found between current branch and main.');
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// ์ปค๋ฐ ํ์คํ ๋ฆฌ ํ์ธ
|
|
156
|
-
const commits = execSync('git log main..HEAD --oneline', {
|
|
157
|
-
encoding: 'utf8',
|
|
158
|
-
cwd: this.projectRoot
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
spinner.text = 'Generating PR template...';
|
|
162
|
-
|
|
163
|
-
// PR ํ
ํ๋ฆฟ ์์ฑ
|
|
164
|
-
const prBody = this.generatePRTemplate(taskId, commits, diffStat);
|
|
165
|
-
const prTitle = taskId ? `${taskId}: Complete task implementation` : `Complete feature implementation`;
|
|
166
|
-
|
|
167
|
-
// GitHub CLI๋ก PR ์์ฑ
|
|
168
|
-
spinner.text = 'Creating pull request on GitHub...';
|
|
169
|
-
|
|
170
|
-
const createCommand = [
|
|
171
|
-
'gh', 'pr', 'create',
|
|
172
|
-
'--title', `"${prTitle}"`,
|
|
173
|
-
'--body', `"${prBody}"`,
|
|
174
|
-
'--base', 'main',
|
|
175
|
-
'--head', currentBranch
|
|
176
|
-
].join(' ');
|
|
177
|
-
|
|
178
|
-
const result = execSync(createCommand, {
|
|
179
|
-
encoding: 'utf8',
|
|
180
|
-
cwd: this.projectRoot
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
const prUrl = result.trim();
|
|
184
|
-
|
|
185
|
-
spinner.succeed(`Pull request created successfully: ${prUrl}`);
|
|
186
|
-
|
|
187
|
-
console.log(chalk.cyan('\n๐ Pull Request Details:'));
|
|
188
|
-
console.log(` Title: ${prTitle}`);
|
|
189
|
-
console.log(` URL: ${prUrl}`);
|
|
190
|
-
console.log(` Base: main โ ${currentBranch}`);
|
|
191
|
-
|
|
192
|
-
} catch (error) {
|
|
193
|
-
spinner.fail(`Failed to create pull request: ${error.message}`);
|
|
194
|
-
throw error;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* GitHub ์ด์์ AIWF ํ์คํฌ ๋๊ธฐํ
|
|
200
|
-
*/
|
|
201
|
-
async syncIssues() {
|
|
202
|
-
const spinner = ora('Syncing GitHub issues...').start();
|
|
203
|
-
|
|
204
|
-
try {
|
|
205
|
-
await this.init();
|
|
206
|
-
this.checkGitHubCLI();
|
|
207
|
-
|
|
208
|
-
// GitHub์์ ์ด์ ๋ชฉ๋ก ๊ฐ์ ธ์ค๊ธฐ
|
|
209
|
-
spinner.text = 'Fetching GitHub issues...';
|
|
210
|
-
const issuesJson = execSync('gh issue list --json number,title,state,labels,assignees', {
|
|
211
|
-
encoding: 'utf8',
|
|
212
|
-
cwd: this.projectRoot
|
|
213
|
-
});
|
|
214
|
-
|
|
215
|
-
const issues = JSON.parse(issuesJson);
|
|
216
|
-
|
|
217
|
-
// AIWF ํ์คํฌ์ ์ฐ๊ฒฐ๋ ์ด์๋ค ํ์ธ
|
|
218
|
-
const stateIndex = await this.stateIndexManager.loadIndex();
|
|
219
|
-
if (!stateIndex) {
|
|
220
|
-
throw new Error('State index not found. Run "aiwf state update" first.');
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
spinner.text = 'Analyzing synchronization...';
|
|
224
|
-
|
|
225
|
-
let syncCount = 0;
|
|
226
|
-
const syncResults = [];
|
|
227
|
-
|
|
228
|
-
for (const issue of issues) {
|
|
229
|
-
// ์ด์ ์ ๋ชฉ์์ ํ์คํฌ ID ์ถ์ถ
|
|
230
|
-
const taskIdMatch = issue.title.match(/^([A-Z]\d+):/);
|
|
231
|
-
if (taskIdMatch) {
|
|
232
|
-
const taskId = taskIdMatch[1];
|
|
233
|
-
const task = stateIndex.tasks[taskId];
|
|
234
|
-
|
|
235
|
-
if (task) {
|
|
236
|
-
// ์ํ ๋๊ธฐํ ํ์ธ
|
|
237
|
-
const issueState = issue.state.toLowerCase();
|
|
238
|
-
const taskState = task.status;
|
|
239
|
-
|
|
240
|
-
let needsSync = false;
|
|
241
|
-
if (issueState === 'closed' && taskState !== 'completed') {
|
|
242
|
-
needsSync = true;
|
|
243
|
-
} else if (issueState === 'open' && taskState === 'completed') {
|
|
244
|
-
needsSync = true;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
if (needsSync) {
|
|
248
|
-
syncResults.push({
|
|
249
|
-
taskId,
|
|
250
|
-
issueNumber: issue.number,
|
|
251
|
-
issueState,
|
|
252
|
-
taskState,
|
|
253
|
-
needsSync
|
|
254
|
-
});
|
|
255
|
-
syncCount++;
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
spinner.succeed(`GitHub sync completed. Found ${syncCount} items needing attention.`);
|
|
262
|
-
|
|
263
|
-
if (syncResults.length > 0) {
|
|
264
|
-
console.log(chalk.cyan('\n๐ Sync Status:'));
|
|
265
|
-
for (const result of syncResults) {
|
|
266
|
-
console.log(` ${result.taskId}: Issue #${result.issueNumber} (${result.issueState}) โ Task (${result.taskState})`);
|
|
267
|
-
}
|
|
268
|
-
console.log(chalk.yellow('\nNote: Manual review recommended for state mismatches.'));
|
|
269
|
-
} else {
|
|
270
|
-
console.log(chalk.green('\nโ
All GitHub issues are in sync with AIWF tasks.'));
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
} catch (error) {
|
|
274
|
-
spinner.fail(`Failed to sync GitHub issues: ${error.message}`);
|
|
275
|
-
throw error;
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
/**
|
|
280
|
-
* ์ด์ ํ
ํ๋ฆฟ ์์ฑ
|
|
281
|
-
*/
|
|
282
|
-
generateIssueTemplate(task) {
|
|
283
|
-
return `## ๐ Task: ${task.title}
|
|
284
|
-
|
|
285
|
-
### Description
|
|
286
|
-
${task.description || 'No description provided.'}
|
|
287
|
-
|
|
288
|
-
### Acceptance Criteria
|
|
289
|
-
- [ ] Task implementation completed
|
|
290
|
-
- [ ] Tests written and passing
|
|
291
|
-
- [ ] Documentation updated
|
|
292
|
-
- [ ] Code reviewed
|
|
293
|
-
|
|
294
|
-
### Additional Information
|
|
295
|
-
- **Task ID**: ${task.id}
|
|
296
|
-
- **Sprint**: ${task.sprint_id || 'N/A'}
|
|
297
|
-
- **Priority**: ${task.priority_score?.toFixed(2) || 'N/A'}
|
|
298
|
-
- **Estimated Hours**: ${task.estimated_hours || 'N/A'}
|
|
299
|
-
- **Complexity**: ${task.complexity || 'N/A'}
|
|
300
|
-
|
|
301
|
-
### Task File
|
|
302
|
-
\`${task.file_path || 'N/A'}\`
|
|
303
|
-
|
|
304
|
-
---
|
|
305
|
-
*This issue was automatically created by AIWF*`;
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
/**
|
|
309
|
-
* PR ํ
ํ๋ฆฟ ์์ฑ
|
|
310
|
-
*/
|
|
311
|
-
generatePRTemplate(taskId, commits, diffStat) {
|
|
312
|
-
return `## ๐ฏ Overview
|
|
313
|
-
${taskId ? `Completed implementation of ${taskId}.` : 'Completed feature implementation.'}
|
|
314
|
-
|
|
315
|
-
## ๐ Changes
|
|
316
|
-
\`\`\`
|
|
317
|
-
${commits}
|
|
318
|
-
\`\`\`
|
|
319
|
-
|
|
320
|
-
## ๐ Changed Files
|
|
321
|
-
\`\`\`
|
|
322
|
-
${diffStat}
|
|
323
|
-
\`\`\`
|
|
324
|
-
|
|
325
|
-
## โ
Checklist
|
|
326
|
-
- [ ] Tests pass
|
|
327
|
-
- [ ] Code review completed
|
|
328
|
-
- [ ] Documentation updated
|
|
329
|
-
|
|
330
|
-
## ๐ Related Information
|
|
331
|
-
${taskId ? `- Related Task: ${taskId}` : '- No specific task linked'}
|
|
332
|
-
|
|
333
|
-
---
|
|
334
|
-
*This pull request was automatically created by AIWF*`;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
/**
|
|
338
|
-
* ํ์คํฌ ํ์
๊ณผ ์ํ์ ๋ฐ๋ฅธ ๋ผ๋ฒจ ์์ฑ
|
|
339
|
-
*/
|
|
340
|
-
generateLabels(task) {
|
|
341
|
-
const labels = ['aiwf-task'];
|
|
342
|
-
|
|
343
|
-
if (task.type) {
|
|
344
|
-
labels.push(task.type);
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
if (task.sprint_id && task.sprint_id !== 'general') {
|
|
348
|
-
labels.push('sprint-task');
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
if (task.priority_score && task.priority_score > 0.8) {
|
|
352
|
-
labels.push('high-priority');
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
if (task.complexity === 'high' || task.complexity === 'very-high') {
|
|
356
|
-
labels.push('complex');
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
return labels;
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
/**
|
|
363
|
-
* ์ด์ URL์์ ์ด์ ๋ฒํธ ์ถ์ถ
|
|
364
|
-
*/
|
|
365
|
-
extractIssueNumber(issueUrl) {
|
|
366
|
-
const match = issueUrl.match(/\/issues\/(\d+)$/);
|
|
367
|
-
return match ? match[1] : null;
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
/**
|
|
371
|
-
* ํ์คํฌ ํ์ผ์ GitHub ์ด์ ์ ๋ณด ์ถ๊ฐ
|
|
372
|
-
*/
|
|
373
|
-
async updateTaskWithIssue(filePath, issueNumber, issueUrl) {
|
|
374
|
-
try {
|
|
375
|
-
const content = await fs.readFile(filePath, 'utf8');
|
|
376
|
-
|
|
377
|
-
// ์ด๋ฏธ GitHub ์ ๋ณด๊ฐ ์๋์ง ํ์ธ
|
|
378
|
-
if (content.includes('github_issue:') || content.includes('GitHub Issue:')) {
|
|
379
|
-
return; // ์ด๋ฏธ ์์ผ๋ฉด ์
๋ฐ์ดํธํ์ง ์์
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
// YAML frontmatter๊ฐ ์๋์ง ํ์ธ
|
|
383
|
-
const frontmatterMatch = content.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
|
|
384
|
-
|
|
385
|
-
let updatedContent;
|
|
386
|
-
if (frontmatterMatch) {
|
|
387
|
-
// YAML frontmatter์ ์ถ๊ฐ
|
|
388
|
-
const frontmatter = frontmatterMatch[1];
|
|
389
|
-
const body = frontmatterMatch[2];
|
|
390
|
-
const updatedFrontmatter = `${frontmatter}\ngithub_issue: ${issueNumber}\ngithub_url: ${issueUrl}`;
|
|
391
|
-
updatedContent = `---\n${updatedFrontmatter}\n---\n${body}`;
|
|
392
|
-
} else {
|
|
393
|
-
// ํ์ผ ์์ ๋ถ๋ถ์ GitHub ์ ๋ณด ์ถ๊ฐ
|
|
394
|
-
updatedContent = `<!-- GitHub Issue: #${issueNumber} - ${issueUrl} -->\n\n${content}`;
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
await fs.writeFile(filePath, updatedContent, 'utf8');
|
|
398
|
-
} catch (error) {
|
|
399
|
-
console.warn(`Failed to update task file with GitHub issue: ${error.message}`);
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
}
|