File size: 1,757 Bytes
4140be3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env python3
from __future__ import annotations

import argparse
import shutil
from pathlib import Path


def move_group(src_dir: Path, pattern: str, dst_dir: Path) -> int:
    dst_dir.mkdir(parents=True, exist_ok=True)
    moved = 0
    for p in src_dir.glob(pattern):
        if not p.is_file():
            continue
        target = dst_dir / p.name
        shutil.move(str(p), str(target))
        moved += 1
    return moved


def main() -> None:
    parser = argparse.ArgumentParser(
        description="Organize help_docs by moving *.help.txt and *.manual_bundle.txt into separate folders."
    )
    parser.add_argument(
        "--help-docs-dir",
        type=str,
        default="/225040511/project/BioScientist/agent_system/toolbase/output/help_docs",
        help="Directory containing help_docs artifacts.",
    )
    parser.add_argument(
        "--help-subdir",
        type=str,
        default="help_txt",
        help="Subdirectory name for *.help.txt files.",
    )
    parser.add_argument(
        "--manual-subdir",
        type=str,
        default="manual_bundle_txt",
        help="Subdirectory name for *.manual_bundle.txt files.",
    )
    args = parser.parse_args()

    base = Path(args.help_docs_dir)
    if not base.exists():
        raise FileNotFoundError(f"help_docs directory not found: {base}")

    moved_help = move_group(base, "*.help.txt", base / args.help_subdir)
    moved_manual = move_group(base, "*.manual_bundle.txt", base / args.manual_subdir)

    print(f"moved_help_txt={moved_help}")
    print(f"moved_manual_bundle_txt={moved_manual}")
    print(f"help_txt_dir={base / args.help_subdir}")
    print(f"manual_bundle_txt_dir={base / args.manual_subdir}")


if __name__ == "__main__":
    main()