@silbaram/artifact-driven-agent 0.1.2 → 0.1.3

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.
@@ -1,81 +1,81 @@
1
- import fs from 'fs-extra';
2
- import path from 'path';
3
- import chalk from 'chalk';
4
- import { getLogsDir, getSessionsDir, isWorkspaceSetup } from '../utils/files.js';
5
-
6
- export async function logs(sessionId) {
7
- if (!isWorkspaceSetup()) {
8
- console.log(chalk.red('❌ 먼저 setup을 실행하세요.'));
9
- process.exit(1);
10
- }
11
-
12
- const logsDir = getLogsDir();
13
- const sessionsDir = getSessionsDir();
14
-
15
- // 세션 ID가 없으면 가장 최근 세션 찾기
16
- if (!sessionId) {
17
- if (fs.existsSync(sessionsDir)) {
18
- const sessions = fs.readdirSync(sessionsDir)
19
- .filter(f => fs.statSync(path.join(sessionsDir, f)).isDirectory())
20
- .sort()
21
- .reverse();
22
-
23
- if (sessions.length > 0) {
24
- sessionId = sessions[0];
25
- }
26
- }
27
- }
28
-
29
- if (!sessionId) {
30
- console.log(chalk.yellow('⚠️ 세션 기록이 없습니다.'));
31
- return;
32
- }
33
-
34
- const logFile = path.join(logsDir, `${sessionId}.log`);
35
-
36
- console.log('');
37
- console.log(chalk.cyan('━'.repeat(60)));
38
- console.log(chalk.cyan.bold(`📄 로그: ${sessionId}`));
39
- console.log(chalk.cyan('━'.repeat(60)));
40
- console.log('');
41
-
42
- if (!fs.existsSync(logFile)) {
43
- console.log(chalk.gray(' 로그 파일 없음'));
44
- console.log('');
45
-
46
- // 세션 정보라도 표시
47
- const sessionFile = path.join(sessionsDir, sessionId, 'session.json');
48
- if (fs.existsSync(sessionFile)) {
49
- try {
50
- const session = JSON.parse(fs.readFileSync(sessionFile, 'utf-8'));
51
- console.log(chalk.white.bold(' 세션 정보:'));
52
- console.log(chalk.gray(` 역할: ${session.role || '-'}`));
53
- console.log(chalk.gray(` 도구: ${session.tool || '-'}`));
54
- console.log(chalk.gray(` 템플릿: ${session.template || '-'}`));
55
- console.log(chalk.gray(` 시작: ${session.started_at || '-'}`));
56
- console.log(chalk.gray(` 상태: ${session.status || '-'}`));
57
- console.log('');
58
- } catch (e) {
59
- // ignore
60
- }
61
- }
62
- return;
63
- }
64
-
65
- const content = fs.readFileSync(logFile, 'utf-8');
66
- const lines = content.split('\n');
67
-
68
- for (const line of lines) {
69
- if (line.includes('[ERROR]')) {
70
- console.log(chalk.red(line));
71
- } else if (line.includes('[WARN]')) {
72
- console.log(chalk.yellow(line));
73
- } else if (line.includes('[INFO]')) {
74
- console.log(chalk.gray(line));
75
- } else {
76
- console.log(line);
77
- }
78
- }
79
-
80
- console.log('');
81
- }
1
+ import fs from 'fs-extra';
2
+ import path from 'path';
3
+ import chalk from 'chalk';
4
+ import { getLogsDir, getSessionsDir, isWorkspaceSetup } from '../utils/files.js';
5
+
6
+ export async function logs(sessionId) {
7
+ if (!isWorkspaceSetup()) {
8
+ console.log(chalk.red('❌ 먼저 setup을 실행하세요.'));
9
+ process.exit(1);
10
+ }
11
+
12
+ const logsDir = getLogsDir();
13
+ const sessionsDir = getSessionsDir();
14
+
15
+ // 세션 ID가 없으면 가장 최근 세션 찾기
16
+ if (!sessionId) {
17
+ if (fs.existsSync(sessionsDir)) {
18
+ const sessions = fs.readdirSync(sessionsDir)
19
+ .filter(f => fs.statSync(path.join(sessionsDir, f)).isDirectory())
20
+ .sort()
21
+ .reverse();
22
+
23
+ if (sessions.length > 0) {
24
+ sessionId = sessions[0];
25
+ }
26
+ }
27
+ }
28
+
29
+ if (!sessionId) {
30
+ console.log(chalk.yellow('⚠️ 세션 기록이 없습니다.'));
31
+ return;
32
+ }
33
+
34
+ const logFile = path.join(logsDir, `${sessionId}.log`);
35
+
36
+ console.log('');
37
+ console.log(chalk.cyan('━'.repeat(60)));
38
+ console.log(chalk.cyan.bold(`📄 로그: ${sessionId}`));
39
+ console.log(chalk.cyan('━'.repeat(60)));
40
+ console.log('');
41
+
42
+ if (!fs.existsSync(logFile)) {
43
+ console.log(chalk.gray(' 로그 파일 없음'));
44
+ console.log('');
45
+
46
+ // 세션 정보라도 표시
47
+ const sessionFile = path.join(sessionsDir, sessionId, 'session.json');
48
+ if (fs.existsSync(sessionFile)) {
49
+ try {
50
+ const session = JSON.parse(fs.readFileSync(sessionFile, 'utf-8'));
51
+ console.log(chalk.white.bold(' 세션 정보:'));
52
+ console.log(chalk.gray(` 역할: ${session.role || '-'}`));
53
+ console.log(chalk.gray(` 도구: ${session.tool || '-'}`));
54
+ console.log(chalk.gray(` 템플릿: ${session.template || '-'}`));
55
+ console.log(chalk.gray(` 시작: ${session.started_at || '-'}`));
56
+ console.log(chalk.gray(` 상태: ${session.status || '-'}`));
57
+ console.log('');
58
+ } catch (e) {
59
+ // ignore
60
+ }
61
+ }
62
+ return;
63
+ }
64
+
65
+ const content = fs.readFileSync(logFile, 'utf-8');
66
+ const lines = content.split('\n');
67
+
68
+ for (const line of lines) {
69
+ if (line.includes('[ERROR]')) {
70
+ console.log(chalk.red(line));
71
+ } else if (line.includes('[WARN]')) {
72
+ console.log(chalk.yellow(line));
73
+ } else if (line.includes('[INFO]')) {
74
+ console.log(chalk.gray(line));
75
+ } else {
76
+ console.log(line);
77
+ }
78
+ }
79
+
80
+ console.log('');
81
+ }