aiag-cli 1.7.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -2
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/auto.d.ts +1 -2
- package/dist/commands/auto.d.ts.map +1 -1
- package/dist/commands/auto.js +28 -173
- package/dist/commands/auto.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +5 -1
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/next.d.ts.map +1 -1
- package/dist/commands/next.js +36 -3
- package/dist/commands/next.js.map +1 -1
- package/dist/commands/session.d.ts.map +1 -1
- package/dist/commands/session.js +11 -1
- package/dist/commands/session.js.map +1 -1
- package/dist/commands/work.d.ts.map +1 -1
- package/dist/commands/work.js +46 -40
- package/dist/commands/work.js.map +1 -1
- package/dist/utils/initializerAgent.d.ts +0 -5
- package/dist/utils/initializerAgent.d.ts.map +1 -1
- package/dist/utils/initializerAgent.js +112 -31
- package/dist/utils/initializerAgent.js.map +1 -1
- package/dist/utils/sessionContext.d.ts +33 -0
- package/dist/utils/sessionContext.d.ts.map +1 -0
- package/dist/utils/sessionContext.js +132 -0
- package/dist/utils/sessionContext.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import * as fs from 'fs';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
/**
|
|
4
|
+
* session_context.md에서 진행 중이거나 실패한 작업을 찾아 반환
|
|
5
|
+
*/
|
|
6
|
+
export function getInterruptedWork(baseDir, featureList) {
|
|
7
|
+
const sessionContextPath = path.join(baseDir, '.aiag', 'session_context.md');
|
|
8
|
+
if (!fs.existsSync(sessionContextPath)) {
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
try {
|
|
12
|
+
const content = fs.readFileSync(sessionContextPath, 'utf-8');
|
|
13
|
+
// "No Active Feature" 체크
|
|
14
|
+
if (content.includes('## No Active Feature')) {
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
// ID 추출: "- ID: FEATURE-001" 패턴
|
|
18
|
+
const idMatch = content.match(/- ID:\s*(\S+)/);
|
|
19
|
+
if (!idMatch)
|
|
20
|
+
return undefined;
|
|
21
|
+
const featureId = idMatch[1];
|
|
22
|
+
// Status 추출: "- Status: in_progress" 패턴
|
|
23
|
+
const statusMatch = content.match(/- Status:\s*(in_progress|failed)/);
|
|
24
|
+
const status = statusMatch?.[1] || 'in_progress';
|
|
25
|
+
// Attempts 추출
|
|
26
|
+
const attemptsMatch = content.match(/- Attempts:\s*(\d+)/);
|
|
27
|
+
const attemptNumber = attemptsMatch ? parseInt(attemptsMatch[1], 10) : 1;
|
|
28
|
+
// Previous error 추출
|
|
29
|
+
const errorMatch = content.match(/## Previous Error\s*```\s*(.+?)\s*```/s);
|
|
30
|
+
const previousError = errorMatch ? errorMatch[1].trim() : undefined;
|
|
31
|
+
// 해당 feature가 아직 완료되지 않았는지 확인
|
|
32
|
+
const feature = featureList.features.find((f) => f.id === featureId);
|
|
33
|
+
if (feature && !feature.passes) {
|
|
34
|
+
return {
|
|
35
|
+
feature,
|
|
36
|
+
attemptNumber,
|
|
37
|
+
previousError,
|
|
38
|
+
status,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Update session_context.md with feature info and failure context
|
|
49
|
+
*/
|
|
50
|
+
export function updateSessionContext(baseDir, feature, context) {
|
|
51
|
+
const sessionContextPath = path.join(baseDir, '.aiag', 'session_context.md');
|
|
52
|
+
const timestamp = new Date().toISOString();
|
|
53
|
+
let content = `# Current Session Context
|
|
54
|
+
|
|
55
|
+
## Active Feature
|
|
56
|
+
|
|
57
|
+
- ID: ${feature.id}
|
|
58
|
+
- Description: ${feature.description}
|
|
59
|
+
- Status: ${context.status}
|
|
60
|
+
- Started: ${timestamp}
|
|
61
|
+
- Attempts: ${context.attempts}
|
|
62
|
+
|
|
63
|
+
`;
|
|
64
|
+
if (context.error) {
|
|
65
|
+
content += `## Previous Error
|
|
66
|
+
|
|
67
|
+
\`\`\`
|
|
68
|
+
${context.error}
|
|
69
|
+
\`\`\`
|
|
70
|
+
|
|
71
|
+
`;
|
|
72
|
+
// Add failure analysis if available
|
|
73
|
+
if (context.failureAnalysis && context.failureAnalysis.category !== 'unknown') {
|
|
74
|
+
content += `## Failure Analysis
|
|
75
|
+
|
|
76
|
+
- **Category**: ${context.failureAnalysis.category}
|
|
77
|
+
- **Suggested Fix**: ${context.failureAnalysis.suggestion}
|
|
78
|
+
- **Should Retry**: ${context.failureAnalysis.shouldRetry ? 'Yes' : 'No (manual fix recommended)'}
|
|
79
|
+
|
|
80
|
+
`;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
content += `## Acceptance Criteria
|
|
84
|
+
|
|
85
|
+
${feature.acceptanceCriteria.map((c, i) => `${i + 1}. [ ] ${c}`).join('\n')}
|
|
86
|
+
|
|
87
|
+
## Next Action
|
|
88
|
+
|
|
89
|
+
${context.status === 'failed' ? '- Retry with different approach based on error analysis' : '- Continue implementation or verify completion'}
|
|
90
|
+
`;
|
|
91
|
+
try {
|
|
92
|
+
fs.writeFileSync(sessionContextPath, content, 'utf-8');
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
console.error('Failed to update session context:', error);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Clear session context (on successful completion or manual clear)
|
|
100
|
+
*/
|
|
101
|
+
export function clearSessionContext(baseDir) {
|
|
102
|
+
const sessionContextPath = path.join(baseDir, '.aiag', 'session_context.md');
|
|
103
|
+
const content = `# Current Session Context
|
|
104
|
+
|
|
105
|
+
## No Active Feature
|
|
106
|
+
|
|
107
|
+
Last updated: ${new Date().toISOString()}
|
|
108
|
+
`;
|
|
109
|
+
try {
|
|
110
|
+
fs.writeFileSync(sessionContextPath, content, 'utf-8');
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
console.error('Failed to clear session context:', error);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Check if there is any interrupted work
|
|
118
|
+
*/
|
|
119
|
+
export function hasInterruptedWork(baseDir) {
|
|
120
|
+
const sessionContextPath = path.join(baseDir, '.aiag', 'session_context.md');
|
|
121
|
+
if (!fs.existsSync(sessionContextPath)) {
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
try {
|
|
125
|
+
const content = fs.readFileSync(sessionContextPath, 'utf-8');
|
|
126
|
+
return !content.includes('## No Active Feature') && content.includes('## Active Feature');
|
|
127
|
+
}
|
|
128
|
+
catch {
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=sessionContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sessionContext.js","sourceRoot":"","sources":["../../src/utils/sessionContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAU7B;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAAe,EACf,WAAwB;IAExB,MAAM,kBAAkB,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,oBAAoB,CAAC,CAAC;IAE7E,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,kBAAkB,CAAC,EAAE,CAAC;QACvC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC;QAE7D,yBAAyB;QACzB,IAAI,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAA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