@silbaram/artifact-driven-agent 0.1.3 → 0.1.5

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@silbaram/artifact-driven-agent",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "CLI 기반 멀티 AI 에이전트 개발 프레임워크 - AI가 규칙을 어기지 못하게 하는 문서 기반 개발",
5
5
  "type": "module",
6
6
  "bin": {
@@ -86,6 +86,11 @@ export async function run(role, tool) {
86
86
  // 시스템 프롬프트 생성
87
87
  const systemPrompt = buildSystemPrompt(workspace, role, roleContent);
88
88
 
89
+ // 시스템 프롬프트를 파일로 저장 (AI 도구가 읽을 수 있도록)
90
+ const promptFile = path.join(sessionDir, 'system-prompt.md');
91
+ fs.writeFileSync(promptFile, systemPrompt, 'utf-8');
92
+ logMessage('INFO', `시스템 프롬프트 저장: ${promptFile}`);
93
+
89
94
  // 다른 활성 세션 확인
90
95
  const activeSessions = getActiveSessions().filter(s => s.sessionId !== sessionId);
91
96
  const pendingQuestions = getPendingQuestions();
@@ -122,7 +127,7 @@ export async function run(role, tool) {
122
127
 
123
128
  // 도구별 실행
124
129
  try {
125
- await launchTool(tool, systemPrompt, logMessage);
130
+ await launchTool(tool, systemPrompt, promptFile, logMessage);
126
131
 
127
132
  // 세션 완료 처리
128
133
  sessionInfo.status = 'completed';
@@ -332,46 +337,103 @@ function buildSystemPrompt(workspace, role, roleContent) {
332
337
  return prompt;
333
338
  }
334
339
 
335
- async function launchTool(tool, systemPrompt, logMessage) {
340
+ async function launchTool(tool, systemPrompt, promptFile, logMessage) {
341
+ // 프롬프트 파일의 상대 경로 (작업 디렉토리 기준)
342
+ const relativePromptPath = path.relative(process.cwd(), promptFile);
343
+
344
+ // 도구별 설정
336
345
  const commands = {
337
- claude: { cmd: 'claude', args: [] },
338
- codex: { cmd: 'codex', args: [] },
339
- gemini: { cmd: 'gemini', args: [] },
340
- copilot: { cmd: 'gh', args: ['copilot', 'suggest'] }
346
+ claude: {
347
+ cmd: 'claude',
348
+ args: ['--system-prompt-file', promptFile],
349
+ automation: 'perfect'
350
+ },
351
+ gemini: {
352
+ cmd: 'gemini',
353
+ args: [],
354
+ env: {
355
+ GEMINI_SYSTEM_MD: promptFile // 시스템 프롬프트 파일 경로
356
+ },
357
+ automation: 'perfect'
358
+ },
359
+ codex: {
360
+ cmd: 'codex',
361
+ args: [],
362
+ automation: 'manual',
363
+ instruction: `@${relativePromptPath}`
364
+ },
365
+ copilot: {
366
+ cmd: 'gh',
367
+ args: ['copilot'],
368
+ automation: 'manual',
369
+ instruction: `@${relativePromptPath}`
370
+ }
341
371
  };
342
372
 
343
- const { cmd, args } = commands[tool];
373
+ const config = commands[tool];
374
+ const { cmd, args } = config;
344
375
 
345
376
  // 도구 존재 확인
346
377
  const which = spawn('which', [cmd], { shell: true });
347
-
378
+
348
379
  return new Promise((resolve, reject) => {
349
380
  which.on('close', (code) => {
350
381
  if (code !== 0) {
351
382
  console.log(chalk.yellow(`⚠️ ${tool} CLI가 설치되어 있지 않습니다.`));
352
383
  console.log('');
353
- console.log(chalk.white('시스템 프롬프트를 출력합니다:'));
384
+ console.log(chalk.white('시스템 프롬프트가 다음 파일에 저장되었습니다:'));
385
+ console.log(chalk.cyan(` ${relativePromptPath}`));
386
+ console.log('');
354
387
  console.log(chalk.gray('─'.repeat(60)));
355
388
  console.log(systemPrompt);
356
389
  console.log(chalk.gray('─'.repeat(60)));
357
390
  console.log('');
358
- console.log(chalk.gray('위 내용을 복사하여 AI 도구에 붙여넣으세요.'));
391
+ console.log(chalk.gray('위 내용을 복사하여 AI 도구에 붙여넣거나, 파일을 읽도록 하세요.'));
359
392
  logMessage('WARN', `${tool} CLI not found, prompt displayed`);
360
393
  resolve();
361
394
  return;
362
395
  }
363
396
 
397
+ // 도구별 안내 메시지
398
+ console.log('');
399
+ if (config.automation === 'perfect') {
400
+ // 완전 자동화: 간단한 성공 메시지
401
+ console.log(chalk.green('━'.repeat(60)));
402
+ console.log(chalk.green.bold('✓ 역할이 자동으로 설정됩니다'));
403
+ console.log(chalk.green('━'.repeat(60)));
404
+ console.log('');
405
+ console.log(chalk.gray(`시스템 프롬프트: ${relativePromptPath}`));
406
+ console.log('');
407
+ } else {
408
+ // 수동 입력 필요: 명확한 안내
409
+ console.log(chalk.yellow('━'.repeat(60)));
410
+ console.log(chalk.yellow.bold('⚠️ 중요: AI 도구 시작 후 다음을 입력하세요'));
411
+ console.log(chalk.yellow('━'.repeat(60)));
412
+ console.log('');
413
+ console.log(chalk.cyan.bold(` ${config.instruction}`));
414
+ console.log('');
415
+ console.log(chalk.gray('그 다음 Enter를 눌러 역할을 수행하도록 하세요.'));
416
+ console.log('');
417
+ console.log(chalk.yellow('━'.repeat(60)));
418
+ console.log('');
419
+ }
420
+
364
421
  // CLI 실행
365
422
  console.log(chalk.green(`✓ ${tool} 실행 중...`));
366
- logMessage('INFO', `${tool} CLI 실행`);
423
+ console.log('');
424
+ logMessage('INFO', `${tool} CLI 실행 (automation: ${config.automation})`);
425
+
426
+ // 환경 변수 병합 (도구별 커스텀 환경 변수 포함)
427
+ const envVars = {
428
+ ...process.env,
429
+ ADA_SYSTEM_PROMPT: systemPrompt,
430
+ ...(config.env || {}) // 도구별 환경 변수 추가
431
+ };
367
432
 
368
433
  const child = spawn(cmd, args, {
369
434
  stdio: 'inherit',
370
435
  shell: true,
371
- env: {
372
- ...process.env,
373
- ADA_SYSTEM_PROMPT: systemPrompt
374
- }
436
+ env: envVars
375
437
  });
376
438
 
377
439
  child.on('close', (code) => {
@@ -30,7 +30,7 @@ export function getSessionsDir() {
30
30
  * 로그 디렉토리 경로 반환
31
31
  */
32
32
  export function getLogsDir() {
33
- return path.join(process.cwd(), 'logs');
33
+ return path.join(getWorkspaceDir(), '.sessions', 'logs');
34
34
  }
35
35
 
36
36
  /**