agentforge-multi 0.1.8 → 0.1.10
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/agentforge +66 -13
- package/package.json +1 -1
package/agentforge
CHANGED
|
@@ -332,26 +332,65 @@ SLASH_COMMANDS = [
|
|
|
332
332
|
("/mode code", "코딩 모드로 전환"),
|
|
333
333
|
("/mode research", "연구 모드로 전환"),
|
|
334
334
|
("/eval-every <N>", "N번마다 Evaluator 실행"),
|
|
335
|
+
("/dir <path>", "작업 디렉토리 변경"),
|
|
335
336
|
("/status", "현재 설정 확인"),
|
|
336
337
|
("/help", "커맨드 목록 표시"),
|
|
337
338
|
]
|
|
338
339
|
|
|
339
340
|
class SlashCompleter(Completer):
|
|
340
341
|
def get_completions(self, document, complete_event):
|
|
342
|
+
import html as _html
|
|
341
343
|
text = document.text_before_cursor
|
|
342
|
-
if text.startswith('/'):
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
344
|
+
if not text.startswith('/'):
|
|
345
|
+
return
|
|
346
|
+
|
|
347
|
+
# ── /dir 경로 자동완성 ────────────────────────────────────────────
|
|
348
|
+
if re.match(r'^/dir\s', text):
|
|
349
|
+
partial = text[5:] # "/dir " 이후 부분
|
|
350
|
+
partial_expanded = os.path.expanduser(partial)
|
|
351
|
+
|
|
352
|
+
# 상위 디렉토리와 입력 중인 파일명 분리
|
|
353
|
+
if partial_expanded.endswith(os.sep) or not partial_expanded:
|
|
354
|
+
base_dir = partial_expanded or '.'
|
|
355
|
+
prefix = ''
|
|
356
|
+
else:
|
|
357
|
+
base_dir = os.path.dirname(partial_expanded) or '.'
|
|
358
|
+
prefix = os.path.basename(partial_expanded)
|
|
359
|
+
|
|
360
|
+
try:
|
|
361
|
+
entries = sorted(Path(base_dir).iterdir())
|
|
362
|
+
except (PermissionError, FileNotFoundError):
|
|
363
|
+
return
|
|
364
|
+
|
|
365
|
+
for entry in entries:
|
|
366
|
+
if not entry.is_dir():
|
|
367
|
+
continue
|
|
368
|
+
name = entry.name
|
|
369
|
+
if not name.startswith(prefix):
|
|
370
|
+
continue
|
|
371
|
+
# 완성 후 문자열: 원래 partial의 디렉토리 부분 + 이 항목 + /
|
|
372
|
+
orig_dir = partial[: len(partial) - len(prefix)]
|
|
373
|
+
completion_text = '/dir ' + orig_dir + name + '/'
|
|
374
|
+
yield Completion(
|
|
375
|
+
completion_text,
|
|
376
|
+
start_position=-len(text),
|
|
377
|
+
display=HTML(f'<ansicyan>{_html.escape(name)}/</ansicyan>'),
|
|
378
|
+
display_meta=HTML('<ansiwhite>디렉토리</ansiwhite>'),
|
|
379
|
+
)
|
|
380
|
+
return
|
|
381
|
+
|
|
382
|
+
# ── 일반 슬래시 커맨드 자동완성 ──────────────────────────────────
|
|
383
|
+
typed = text[1:]
|
|
384
|
+
for cmd, desc in SLASH_COMMANDS:
|
|
385
|
+
name = cmd[1:].split()[0]
|
|
386
|
+
full = cmd[1:]
|
|
387
|
+
if full.startswith(typed) or name.startswith(typed.split()[0] if typed else ''):
|
|
388
|
+
yield Completion(
|
|
389
|
+
cmd,
|
|
390
|
+
start_position=-len(text),
|
|
391
|
+
display=HTML(f'<ansicyan>{_html.escape(cmd)}</ansicyan>'),
|
|
392
|
+
display_meta=HTML(f'<ansiwhite>{_html.escape(desc)}</ansiwhite>'),
|
|
393
|
+
)
|
|
355
394
|
|
|
356
395
|
PROMPT_STYLE = PtStyle.from_dict({
|
|
357
396
|
'prompt': 'ansicyan bold',
|
|
@@ -1587,6 +1626,20 @@ def main():
|
|
|
1587
1626
|
except ValueError:
|
|
1588
1627
|
console.print("[red]숫자를 입력하세요. 예: /eval-every 3[/red]")
|
|
1589
1628
|
|
|
1629
|
+
elif cmd_name == 'dir':
|
|
1630
|
+
if not cmd_arg:
|
|
1631
|
+
console.print(f"현재 작업 디렉토리: [cyan]{workdir}[/cyan]")
|
|
1632
|
+
console.print("[dim]변경: /dir <경로> 예) /dir ~/AgentForge[/dim]")
|
|
1633
|
+
else:
|
|
1634
|
+
new_dir = Path(cmd_arg).expanduser().resolve()
|
|
1635
|
+
if not new_dir.exists():
|
|
1636
|
+
console.print(f"[red]존재하지 않는 경로: {new_dir}[/red]")
|
|
1637
|
+
elif not new_dir.is_dir():
|
|
1638
|
+
console.print(f"[red]디렉토리가 아닙니다: {new_dir}[/red]")
|
|
1639
|
+
else:
|
|
1640
|
+
workdir = str(new_dir)
|
|
1641
|
+
console.print(f"[cyan]작업 디렉토리 변경: {workdir}[/cyan]")
|
|
1642
|
+
|
|
1590
1643
|
elif cmd_name == 'status':
|
|
1591
1644
|
console.print(f"모드: [cyan]{current_mode}[/cyan] | eval-every: [cyan]{eval_every}[/cyan] | dir: [cyan]{workdir}[/cyan]")
|
|
1592
1645
|
|