| 1942 | # ─── CLI ───────────────────────────────────────────────────────────────────── |
| 1943 | |
| 1944 | def build_arg_parser() -> argparse.ArgumentParser: |
| 1945 | p = argparse.ArgumentParser( |
| 1946 | description="Intelligent Python file splitter with architecture analysis.", |
| 1947 | formatter_class=argparse.RawDescriptionHelpFormatter, |
| 1948 | epilog=textwrap.dedent("""\ |
| 1949 | Examples: |
| 1950 | python split_coder.py Clouds_Coder.py |
| 1951 | python split_coder.py Clouds_Coder.py --output-dir ./clouds_split |
| 1952 | python split_coder.py Clouds_Coder.py --dry-run |
| 1953 | python split_coder.py Clouds_Coder.py --update |
| 1954 | python split_coder.py Clouds_Coder.py --show-tree |
| 1955 | python split_coder.py Clouds_Coder.py --dump-layout |
| 1956 | python split_coder.py Clouds_Coder.py --self-check |
| 1957 | python split_coder.py Clouds_Coder.py --auto-layout # ignore built-in rules |
| 1958 | """), |
| 1959 | ) |
| 1960 | p.add_argument("source", help="Source Python file to split") |
| 1961 | p.add_argument( |
| 1962 | "--output-dir", "-o", |
| 1963 | help="Output directory (default: <source_stem>_split/ next to source)", |
| 1964 | ) |
| 1965 | p.add_argument( |
| 1966 | "--dry-run", "-n", |
| 1967 | action="store_true", |
| 1968 | help="Preview without writing any files", |
| 1969 | ) |
| 1970 | p.add_argument( |
| 1971 | "--update", "-u", |
| 1972 | action="store_true", |
| 1973 | help="Incremental update: only regenerate changed modules", |
| 1974 | ) |
| 1975 | p.add_argument( |
| 1976 | "--show-tree", |
| 1977 | action="store_true", |
| 1978 | help="Print directory tree after split", |
| 1979 | ) |
| 1980 | p.add_argument( |
| 1981 | "--dump-layout", |
| 1982 | action="store_true", |
| 1983 | help="Print the symbol→module layout as JSON (useful for debugging)", |
| 1984 | ) |
| 1985 | p.add_argument( |
| 1986 | "--auto-layout", |
| 1987 | action="store_true", |
| 1988 | help="Use auto-generated layout instead of built-in rules", |
| 1989 | ) |
| 1990 | p.add_argument( |
| 1991 | "--layout-file", |
| 1992 | help="Path to a custom layout JSON file (overrides built-in rules)", |
| 1993 | ) |
| 1994 | p.add_argument( |
| 1995 | "--report-name", |
| 1996 | default="FRAMEWORK.md", |
| 1997 | help="Markdown framework report filename written inside the output directory.", |
| 1998 | ) |
| 1999 | p.add_argument( |
| 2000 | "--no-report", |
| 2001 | action="store_true", |