8
8
9
9
# Default file patterns
10
10
DEFAULT_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" ,
13
13
"Makefile" , "*.yaml" , "*.yml" ,
14
14
}
15
15
16
16
DEFAULT_EXCLUDE_PATTERNS = {
17
- "*test*" , "tests/*" , "docs/*" , "examples/*" , "v1/*" ,
18
- "dist/*" , "build/*" , "experimental/*" , "deprecated/*" ,
17
+ "*test*" , "tests/*" , "docs/*" , "examples/*" , "v1/*" ,
18
+ "dist/*" , "build/*" , "experimental/*" , "deprecated/*" ,
19
19
"legacy/*" , ".git/*" , ".github/*" , ".next/*" , ".vscode/*" , "obj/*" , "bin/*" , "node_modules/*" , "*.log"
20
20
}
21
21
22
22
# --- Main Function ---
23
23
def main ():
24
24
parser = argparse .ArgumentParser (description = "Generate a tutorial for a GitHub codebase or local directory." )
25
-
25
+
26
26
# Create mutually exclusive group for source
27
27
source_group = parser .add_mutually_exclusive_group (required = True )
28
28
source_group .add_argument ("--repo" , help = "URL of the public GitHub repository." )
29
29
source_group .add_argument ("--dir" , help = "Path to local directory." )
30
-
30
+
31
31
parser .add_argument ("-n" , "--name" , help = "Project name (optional, derived from repo/directory if omitted)." )
32
32
parser .add_argument ("-t" , "--token" , help = "GitHub personal access token (optional, reads from GITHUB_TOKEN env var if not provided)." )
33
33
parser .add_argument ("-o" , "--output" , default = "output" , help = "Base directory for output (default: ./output)." )
34
34
parser .add_argument ("-i" , "--include" , nargs = "+" , help = "Include file patterns (e.g. '*.py' '*.js'). Defaults to common code files if not specified." )
35
35
parser .add_argument ("-e" , "--exclude" , nargs = "+" , help = "Exclude file patterns (e.g. 'tests/*' 'docs/*'). Defaults to test/build directories if not specified." )
36
36
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)" )
37
39
38
40
args = parser .parse_args ()
39
41
@@ -57,6 +59,9 @@ def main():
57
59
"exclude_patterns" : set (args .exclude ) if args .exclude else DEFAULT_EXCLUDE_PATTERNS ,
58
60
"max_file_size" : args .max_size ,
59
61
62
+ # Add language for multi-language support
63
+ "language" : args .language ,
64
+
60
65
# Outputs will be populated by the nodes
61
66
"files" : [],
62
67
"abstractions" : [],
@@ -66,13 +71,14 @@ def main():
66
71
"final_output_dir" : None
67
72
}
68
73
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" )
70
76
71
77
# Create the flow instance
72
78
tutorial_flow = create_tutorial_flow ()
73
79
74
80
# Run the flow
75
81
tutorial_flow .run (shared )
76
-
82
+
77
83
if __name__ == "__main__" :
78
- main ()
84
+ main ()
0 commit comments