Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions cli/commands/analyze.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
title: 'analyze'
description: 'Upload a repository and run the full analysis pipeline'
---

Archives the repository, uploads it to the Supermodel API, and runs call graph generation, dependency analysis, and domain classification. Results are cached locally by content hash. Subsequent commands (`dead-code`, `blast-radius`, `graph`) reuse the cache automatically.

By default, `.graph.*` shard files are written next to each source file. Pass `--no-shards` to skip writing graph files.

## Synopsis

```bash
supermodel analyze [path] [flags]
```

## Flags

| Flag | Description |
|---|---|
| `--three-file` | Generate `.calls`/`.deps`/`.impact` files instead of a single `.graph` |
| `--no-shards` | Skip writing `.graph.*` shard files |
| `--force` | Re-analyze even if a cached result exists |
| `-o, --output` | Output format: `human` \| `json` |
| `-h, --help` | Help for analyze |

## Examples

```bash
# Analyze the current directory
supermodel analyze

# Generate three-file shards (recommended)
supermodel analyze --three-file

# Re-analyze without using the cache, output JSON
supermodel analyze --force -o json

# Run analysis without writing sidecar files
supermodel analyze --no-shards
```
32 changes: 32 additions & 0 deletions cli/commands/audit.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
title: 'audit'
description: 'Codebase health report from graph intelligence'
---

Analyses the codebase via the Supermodel API and produces a structured Markdown health report covering:

- Overall status (HEALTHY / DEGRADED / CRITICAL)
- Circular dependency detection
- Domain coupling metrics and high-coupling domains
- High blast-radius files
- Prioritised recommendations

## Synopsis

```bash
supermodel audit [flags]
```

## Flags

| Flag | Description |
|---|---|
| `--dir` | Project directory (default: current working directory) |
| `-h, --help` | Help for audit |

## Examples

```bash
supermodel audit
supermodel audit --dir ./path/to/project
```
45 changes: 45 additions & 0 deletions cli/commands/blast-radius.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
title: 'blast-radius'
description: 'Analyze the impact of changing a file or function'
---

Uploads the repository to the Supermodel API and runs impact analysis using call graph and dependency graph reachability. Results include risk scoring, affected files and functions, and entry points that would be impacted by changes to the target.

**Aliases:** `br`, `impact`

## Synopsis

```bash
supermodel blast-radius [file...] [flags]
```

Three usage modes:

```bash
supermodel blast-radius <file> # analyze a specific file
supermodel blast-radius --diff changes.diff # analyze from a git diff
supermodel blast-radius # global coupling map
```

## Flags

| Flag | Description |
|---|---|
| `--diff` | Path to a unified diff file (git diff output) |
| `--force` | Re-analyze even if a cached result exists |
| `-o, --output` | Output format: `human` \| `json` |
| `-h, --help` | Help for blast-radius |

## Examples

```bash
# Impact of changing one file
supermodel blast-radius internal/api/client.go

# Impact of a pending PR
git diff main...HEAD > /tmp/pr.diff
supermodel blast-radius --diff /tmp/pr.diff

# Global coupling map (no target)
supermodel blast-radius -o json
```
27 changes: 27 additions & 0 deletions cli/commands/clean.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
title: 'clean'
description: 'Remove all .graph.* files from the repository'
---

Removes every `.graph.*` sidecar file from the repository.

## Synopsis

```bash
supermodel clean [path] [flags]
```

## Flags

| Flag | Description |
|---|---|
| `--dry-run` | Show what would be removed without removing |
| `-h, --help` | Help for clean |

## Examples

```bash
supermodel clean
supermodel clean --dry-run
supermodel clean ./my-project
```
39 changes: 39 additions & 0 deletions cli/commands/compact.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
title: 'compact'
description: 'Reduce token usage of source code while preserving semantics'
---

Strips comments, removes blank lines, and shortens local identifiers to produce token-efficient source code that remains syntactically valid and semantically identical (all tests still pass).

Supports Go, Python, TypeScript, JavaScript, and Rust.

For a single file, compacted output is written to stdout. For a directory, files are written to `--output` (default: `./compacted/`).

**Aliases:** `pack`, `minify`

## Synopsis

```bash
supermodel compact [path] [flags]
```

## Flags

| Flag | Description |
|---|---|
| `-o, --output` | Output directory for directory mode (default `compacted`) |
| `--dry-run` | Print stats without writing files |
| `-h, --help` | Help for compact |

## Examples

```bash
# Single file → stdout
supermodel compact internal/api/client.go

# Whole repo → ./compacted/
supermodel compact .

# See savings without writing
supermodel compact --dry-run .
```
39 changes: 39 additions & 0 deletions cli/commands/dead-code.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
title: 'dead-code'
description: 'Find unreachable functions using static analysis'
---

Uploads the repository to the Supermodel API and runs multi-phase dead code analysis including call graph reachability, entry point detection, and transitive propagation. Results include confidence levels (high/medium/low), line numbers, and explanations for why each function was flagged.

**Aliases:** `dc`

## Synopsis

```bash
supermodel dead-code [path] [flags]
```

## Flags

| Flag | Description |
|---|---|
| `--min-confidence` | Minimum confidence: `high`, `medium`, or `low` |
| `--limit` | Maximum number of candidates to return |
| `--ignore` | Glob pattern to exclude (repeatable, supports `**`) |
| `--timeout` | Maximum seconds to wait (default `7200`, `0` = no limit) |
| `--force` | Re-analyze even if a cached result exists |
| `-o, --output` | Output format: `human` \| `json` |
| `-h, --help` | Help for dead-code |

## Examples

```bash
# High-confidence candidates only
supermodel dead-code --min-confidence high

# Top 20 results, JSON output
supermodel dead-code --limit 20 -o json

# Skip vendored and generated code
supermodel dead-code --ignore '**/vendor/**' --ignore '**/*_pb.go'
```
40 changes: 40 additions & 0 deletions cli/commands/docs.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
title: 'docs'
description: 'Generate static architecture documentation for a repository'
---

Generates a static HTML site documenting the architecture of a codebase. The command uploads the repository to the Supermodel API, converts the returned code graph to markdown, and builds a browsable static site with search, dependency graphs, taxonomy navigation, and SEO metadata. The site also emits machine-readable artifacts (JSON-LD and `LLMS.txt`) alongside the HTML.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Capitalize “Markdown” (proper noun).

Line [6] says “converts … to markdown”. For consistency/style (and per typical doclint expectations), it should be “Markdown”.

✅ Proposed fix
-Generates a static HTML site documenting the architecture of a codebase. The command uploads the repository to the Supermodel API, converts the returned code graph to markdown, and builds a browsable static site with search, dependency graphs, taxonomy navigation, and SEO metadata. The site also emits machine-readable artifacts (JSON-LD and `LLMS.txt`) alongside the HTML.
+Generates a static HTML site documenting the architecture of a codebase. The command uploads the repository to the Supermodel API, converts the returned code graph to Markdown, and builds a browsable static site with search, dependency graphs, taxonomy navigation, and SEO metadata. The site also emits machine-readable artifacts (JSON-LD and `LLMS.txt`) alongside the HTML.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Generates a static HTML site documenting the architecture of a codebase. The command uploads the repository to the Supermodel API, converts the returned code graph to markdown, and builds a browsable static site with search, dependency graphs, taxonomy navigation, and SEO metadata. The site also emits machine-readable artifacts (JSON-LD and `LLMS.txt`) alongside the HTML.
Generates a static HTML site documenting the architecture of a codebase. The command uploads the repository to the Supermodel API, converts the returned code graph to Markdown, and builds a browsable static site with search, dependency graphs, taxonomy navigation, and SEO metadata. The site also emits machine-readable artifacts (JSON-LD and `LLMS.txt`) alongside the HTML.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~6-~6: Did you mean the formatting language “Markdown” (= proper noun)?
Context: ...PI, converts the returned code graph to markdown, and builds a browsable static site wit...

(MARKDOWN_NNP)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cli/commands/docs.mdx` at line 6, The documentation uses a lowercase
"markdown" in the phrase "converts the returned code graph to markdown"; update
that token to "Markdown" (capital M) to follow proper noun/style conventions —
locate the exact sentence in the docs.mdx content and replace "markdown" with
"Markdown" so the sentence reads "converts the returned code graph to Markdown".


The output directory can be served locally or deployed to any static host (GitHub Pages, Vercel, Netlify, Cloudflare Pages).

## Synopsis

```bash
supermodel docs [path] [flags]
```

## Flags

| Flag | Description |
|---|---|
| `-o, --output` | Output directory (default `./docs-output`) |
| `--repo` | GitHub repo slug `owner/repo` for source links |
| `--base-url` | Canonical base URL where the site will be hosted (default `https://example.com`) |
| `--site-name` | Display title for the generated site (default `<repo> Architecture Docs`) |
| `--max-entities` | Cap on entity pages (default `12000`, `0` = unlimited) |
| `--max-source-files` | Cap on source files in analysis (default `3000`, `0` = unlimited) |
| `--templates-dir` | Override bundled HTML/CSS/JS templates with a custom directory |
| `--force` | Bypass cache and re-upload even if a cached result exists |
| `-h, --help` | Help for docs |

## Examples

```bash
supermodel docs

supermodel docs ./my-project --output ./docs-site

supermodel docs --repo owner/repo --base-url https://owner.github.io/repo

supermodel docs --site-name "My App Docs" --output /var/www/html
```
36 changes: 36 additions & 0 deletions cli/commands/find.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
title: 'find'
description: 'Find usages and callers of a symbol across the codebase'
---

Searches the graph for all nodes matching the given symbol name (substring match, case-insensitive) and prints their call relationships.

Similar to "Find Usages" in IDEs — without requiring a language server.

## Synopsis

```bash
supermodel find <symbol> [flags]
```

## Flags

| Flag | Description |
|---|---|
| `--kind` | Filter by node label: `Function`, `File`, `Class`, … |
| `--force` | Re-analyze even if cache is fresh |
| `-o, --output` | Output format: `human` \| `json` |
| `-h, --help` | Help for find |

## Examples

```bash
# Find anything containing this name
supermodel find handleRequest

# Restrict to classes
supermodel find Client --kind Class

# JSON output for tool consumption
supermodel find parse -o json
```
38 changes: 38 additions & 0 deletions cli/commands/focus.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
title: 'focus'
description: 'Token-efficient graph slice for a single file'
---

Extracts the minimal graph context relevant to the given file: direct imports, functions defined, callers, and (optionally) type declarations.

Output is structured markdown for direct injection into LLM context windows, keeping token usage minimal while preserving semantic relevance. Use `--output json` for structured consumption by tools.

**Aliases:** `ctx`, `context`

## Synopsis

```bash
supermodel focus <file> [flags]
```

## Flags

| Flag | Description |
|---|---|
| `--depth` | Import traversal depth (default `1`) |
| `--types` | Include type/class declarations |
| `--force` | Re-analyze even if cache is fresh |
| `-o, --output` | Output format: `markdown` \| `json` (default `markdown`) |
| `-h, --help` | Help for focus |

## Examples

```bash
supermodel focus internal/api/client.go

# Walk imports two hops deep, include types
supermodel focus internal/api/client.go --depth 2 --types

# JSON for tool consumption
supermodel focus internal/api/client.go -o json
```
37 changes: 37 additions & 0 deletions cli/commands/graph.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
title: 'graph'
description: 'Display the repository graph'
---

Fetches or loads the cached graph and renders it in one of three formats:

- `human` — aligned table of nodes (default)
- `json` — full graph as JSON
- `dot` — Graphviz DOT for use with `dot`/`graphviz`

## Synopsis

```bash
supermodel graph [path] [flags]
```

## Flags

| Flag | Description |
|---|---|
| `--label` | Filter nodes by label (`File`, `Function`, `Class`, …) |
| `--force` | Re-analyze even if a cached result exists |
| `-o, --output` | Output format: `human` \| `json` \| `dot` (default `human`) |
| `-h, --help` | Help for graph |

## Examples

```bash
supermodel graph

# Only files
supermodel graph --label File

# Render with Graphviz
supermodel graph -o dot | dot -Tsvg > graph.svg
```
Loading
Loading