GitHub Action
The CodeLayers GitHub Action (codelayers-ai/codelayers-action@v1) automatically generates a 3D code visualization for every PR and posts a comment with the interactive share link.
Free for open source. No account required.
Quick Start (Open Source)
# .github/workflows/codelayers.yml
name: CodeLayers
on:
pull_request:
jobs:
visualize:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: codelayers-ai/codelayers-action@v1
No API key. No sign-up. Open a PR and the action posts a comment with a link to the 3D visualization.
Private Repos
For private repositories, add an API key:
- uses: codelayers-ai/codelayers-action@v1
with:
api_key: ${'$'}{{ secrets.CODELAYERS_API_KEY }}
Setup
- Create an API key:
brew install codelayers-ai/tap/codelayers
codelayers login
codelayers api-keys create "GitHub CI"
Save the key immediately — it won't be shown again. See API Keys for details.
-
Add the secret — Go to your repo on GitHub: Settings → Secrets and variables → Actions → New repository secret. Name:
CODELAYERS_API_KEY. -
Add the workflow — Create
.github/workflows/codelayers.ymlwith the YAML above. -
Open a PR — The action runs automatically and posts a comment with the 3D visualization link.
Requires a CodeLayers Pro subscription.
Inputs
| Input | Required | Default | Description |
|---|---|---|---|
| api_key | Yes | — | CodeLayers API key |
| base_branch | No | auto-detect from PR | Base branch to compare against |
| expires_days | No | 7 | Days until the share link expires |
| max_views | No | unlimited | Maximum number of views |
| comment | No | true | Post/update a PR comment with the link |
| link_to_pr | No | true | Link share to GitHub repo/PR metadata |
Outputs
Use outputs in subsequent workflow steps:
| Output | Description |
|---|---|
| share_url | Full share URL with encryption key |
| share_id | Share ID (UUID) |
| node_count | Total nodes in the graph |
| file_count | Number of file nodes |
| changed_file_count | Files changed in the PR |
| blast_radius_count | Total files affected by changes (via dependency BFS) |
Using Outputs
- uses: codelayers-ai/codelayers-action@v1
id: codelayers
with:
api_key: ${'$'}{{ secrets.CODELAYERS_API_KEY }}
comment: false # disable auto-comment
- name: Custom step
run: |
echo "Share: ${'$'}{{ steps.codelayers.outputs.share_url }}"
echo "Changed: ${'$'}{{ steps.codelayers.outputs.changed_file_count }}"
echo "Blast radius: ${'$'}{{ steps.codelayers.outputs.blast_radius_count }}"
What Gets Posted
The action posts (or updates) a PR comment like this:
## CodeLayers — PR Visualization
> **12 files changed** · **47 files affected** by blast radius
> across **582 files** · **45,230 LOC** · Rust (312) · TypeScript (156) · Swift (89)
### Open 3D Visualization →
Expires in 7 days · Updated Feb 11, 2026 19:42 UTC · Generated by CodeLayers Action
The comment is idempotent — pushing new commits to the PR updates the existing comment rather than creating a new one.
How It Works Under the Hood
- Checks out your code in the GitHub Action runner
- Runs
codelayers sharewith--base origin/<pr-base>and--head HEAD - Tree-sitter parses the entire codebase (11 languages)
- Builds the dependency graph with metrics
- Computes git diff between base and head:
- Identifies changed files
- Computes per-file lines added/deleted
- Annotates graph nodes with diff metadata
- Computes blast radius (BFS through reverse import edges)
- Encrypts everything with a random AES-256 key
- Uploads encrypted blob (server never sees your code)
- Posts PR comment with the link (key is in the URL fragment)
Important: fetch-depth: 0
The actions/checkout step must use fetch-depth: 0 (full clone) so the CLI can compute the diff between base and head branches. Without full history, the diff computation will fail.
Monorepo Support
The action works with monorepos — it parses the entire repository and highlights only the files changed in the PR. The blast radius shows how changes ripple through the dependency graph across the whole repo.