diff --git a/site/app/cli/page.tsx b/site/app/cli/page.tsx new file mode 100644 index 000000000..a05ee267e --- /dev/null +++ b/site/app/cli/page.tsx @@ -0,0 +1,252 @@ +import { + ArrowLeft, + Binary, + Edit3, + FileCode2, + Network, + Search, + TerminalSquare, +} from "lucide-react"; +import type { Metadata } from "next"; +import Link from "next/link"; + +import { Wordmark } from "@/components/logo"; +import { ThemeToggle } from "@/components/theme-toggle"; +import { Badge } from "@/components/ui/badge"; +import { Button } from "@/components/ui/button"; + +export const metadata: Metadata = { + title: "CLI reference | Graph-sitter", + description: + "High-level graph and codemod commands for inspecting and editing repositories with graph-sitter.", +}; + +const graphCommands = [ + { + icon: FileCode2, + name: "inspect", + signature: "graph-sitter inspect FILE [PATH]", + text: "Shows line counts, imports, classes, functions, and per-function call summaries for a file.", + example: + "uvx graph-sitter inspect packages/app/src/index.ts ./repo --level calls", + }, + { + icon: Search, + name: "symbols", + signature: "graph-sitter symbols [QUERY] [PATH]", + text: "Finds functions, classes, and symbols and prints copyable target strings for later commands.", + example: + "uvx graph-sitter symbols runInference ./repo --kind function --backend rust", + }, + { + icon: Network, + name: "callgraph", + signature: "graph-sitter callgraph TARGET [PATH]", + text: "Traces outbound callees or inbound callers with clean local, resolved, deduped edges by default.", + example: + "uvx graph-sitter callgraph packages/app/src/index.ts.main ./repo --depth 2", + }, + { + icon: Binary, + name: "using", + signature: "graph-sitter using TARGET [PATH]", + text: "Traces the functions and methods a target calls, recursively up to the requested depth.", + example: + "uvx graph-sitter using src/app.py:handler ./repo --depth 3 --resolved-only", + }, + { + icon: Network, + name: "usages", + signature: "graph-sitter usages TARGET [PATH]", + text: "Finds callers and usage sites for a target, with optional recursive inbound traversal.", + example: + "uvx graph-sitter usages src/app.py:helper ./repo --depth 2 --dedupe", + }, + { + icon: Edit3, + name: "rename", + signature: "graph-sitter rename TARGET --to NAME [PATH]", + text: "Applies a graph-aware rename and reports affected files in check mode before writing.", + example: + "uvx graph-sitter rename src/app.py:helper ./repo --to execute_helper --check", + }, +]; + +const parseOptions = [ + ["--backend python|rust|auto", "Select the graph backend."], + ["--fallback python|error", "Control behavior when Rust is unavailable."], + ["--language auto|python|typescript", "Set language detection explicitly."], + ["--subdir PATH", "Limit parsing to one or more repo-relative paths."], + [ + "--format summary|json", + "Choose human-readable or machine-readable output.", + ], +]; + +export default function CliReferencePage() { + return ( +
+
+
+ + + + +
+
+ +
+
+
+
+ + + + uvx graph-sitter + +

+ CLI reference for graph-aware agents. +

+

+ Use the command line to parse repositories, inspect symbols, + trace call relationships, and run focused codemods without + writing a one-off script first. +

+
+ +
+
+ +
+
+ {graphCommands.map((command) => ( +
+
+ +

+ {command.name} +

+
+ + {command.signature} + +

+ {command.text} +

+
+									{command.example}
+								
+
+ ))} +
+
+ +
+
+
+

+ Common parse controls +

+

+ These options are shared by the graph commands and make the CLI + useful on large monorepos. +

+
+
+ {parseOptions.map(([option, text]) => ( +
+ {option} + {text} +
+ ))} +
+
+
+ +
+
+
+

+ Full-repo TypeScript +

+

+ Use the Rust backend for broad discovery and outbound call graph + traversal. Scope to a package with the Python backend when you + need function-level inbound caller recursion. +

+
+ +
+
+
+
+ ); +} + +function CodeBlock({ lines }: { lines: string[] }) { + return ( +
+
+
+ + + terminal + +
+
+					
+						{lines.map((line) => (
+							
+								${" "}
+								{line.split(" ")[0]}
+								{line.slice(line.indexOf(" "))}
+							
+						))}
+					
+				
+
+
+ ); +} diff --git a/site/app/page.tsx b/site/app/page.tsx index 0ab99db4a..4fd08893b 100644 --- a/site/app/page.tsx +++ b/site/app/page.tsx @@ -76,6 +76,14 @@ export default function Home() {