88
99# Default file patterns
1010DEFAULT_INCLUDE_PATTERNS = {
11- "*.py" , "*.js" , "*.jsx" , "*.ts" , "*.tsx" , "*.go" , "*.java" , "*.pyi" , "*.pyx" ,
12- "*.c" , "*.cc" , "*.cpp" , "*.h" , "*.md" , "*.rst" , "Dockerfile" ,
11+ "*.py" , "*.js" , "*.jsx" , "*.ts" , "*.tsx" , "*.go" , "*.java" , "*.pyi" , "*.pyx" ,
12+ "*.c" , "*.cc" , "*.cpp" , "*.h" , "*.md" , "*.rst" , "Dockerfile" ,
1313 "Makefile" , "*.yaml" , "*.yml" ,
1414}
1515
1616DEFAULT_EXCLUDE_PATTERNS = {
17- "*test*" , "tests/*" , "docs/*" , "examples/*" , "v1/*" ,
18- "dist/*" , "build/*" , "experimental/*" , "deprecated/*" ,
17+ "*test*" , "tests/*" , "docs/*" , "examples/*" , "v1/*" ,
18+ "dist/*" , "build/*" , "experimental/*" , "deprecated/*" ,
1919 "legacy/*" , ".git/*" , ".github/*" , ".next/*" , ".vscode/*" , "obj/*" , "bin/*" , "node_modules/*" , "*.log"
2020}
2121
2222# --- Main Function ---
2323def main ():
2424 parser = argparse .ArgumentParser (description = "Generate a tutorial for a GitHub codebase or local directory." )
25-
25+
2626 # Create mutually exclusive group for source
2727 source_group = parser .add_mutually_exclusive_group (required = True )
2828 source_group .add_argument ("--repo" , help = "URL of the public GitHub repository." )
2929 source_group .add_argument ("--dir" , help = "Path to local directory." )
30-
30+
3131 parser .add_argument ("-n" , "--name" , help = "Project name (optional, derived from repo/directory if omitted)." )
3232 parser .add_argument ("-t" , "--token" , help = "GitHub personal access token (optional, reads from GITHUB_TOKEN env var if not provided)." )
3333 parser .add_argument ("-o" , "--output" , default = "output" , help = "Base directory for output (default: ./output)." )
3434 parser .add_argument ("-i" , "--include" , nargs = "+" , help = "Include file patterns (e.g. '*.py' '*.js'). Defaults to common code files if not specified." )
3535 parser .add_argument ("-e" , "--exclude" , nargs = "+" , help = "Exclude file patterns (e.g. 'tests/*' 'docs/*'). Defaults to test/build directories if not specified." )
3636 parser .add_argument ("-s" , "--max-size" , type = int , default = 100000 , help = "Maximum file size in bytes (default: 100000, about 100KB)." )
37+ # Add language parameter for multi-language support
38+ parser .add_argument ("--language" , default = "english" , help = "Language for the generated tutorial (default: english)" )
3739
3840 args = parser .parse_args ()
3941
@@ -57,6 +59,9 @@ def main():
5759 "exclude_patterns" : set (args .exclude ) if args .exclude else DEFAULT_EXCLUDE_PATTERNS ,
5860 "max_file_size" : args .max_size ,
5961
62+ # Add language for multi-language support
63+ "language" : args .language ,
64+
6065 # Outputs will be populated by the nodes
6166 "files" : [],
6267 "abstractions" : [],
@@ -66,13 +71,14 @@ def main():
6671 "final_output_dir" : None
6772 }
6873
69- print (f"Starting tutorial generation for: { args .repo or args .dir } " )
74+ # Display starting message with repository/directory and language
75+ print (f"Starting tutorial generation for: { args .repo or args .dir } in { args .language .capitalize ()} language" )
7076
7177 # Create the flow instance
7278 tutorial_flow = create_tutorial_flow ()
7379
7480 # Run the flow
7581 tutorial_flow .run (shared )
76-
82+
7783if __name__ == "__main__" :
78- main ()
84+ main ()
0 commit comments