Usage
This guide will help you get GitLab Knowledge Graph up and running on your first project in just a few minutes.
Prerequisites
Section titled “Prerequisites”- GitLab Knowledge Graph installed
- A workspace folder with an initialized Git repository
Basic Indexing
Section titled “Basic Indexing”The simplest way to start is by indexing a single repository or workspace folder.
Index Current Directory
Section titled “Index Current Directory”Navigate to your project directory and run:
gkg indexThis will:
- Discover all Git repositories in the current directory
- Parse and analyze the code structure
- Store the results in a local graph database
- Display progress and completion statistics
Index a Specific Directory
Section titled “Index a Specific Directory”You can also specify a path to index:
gkg index /path/to/your/workspaceExample Output
Section titled “Example Output”$ gkg index my-project✅ Workspace indexing completed in 12.34 seconds
Workspace Statistics:- Projects indexed: 3- Files processed: 1,247- Code entities extracted: 5,832- Relationships found: 12,156Server Mode
Section titled “Server Mode”For more advanced usage, you can start GitLab Knowledge Graph in server mode:
Start the Server
Section titled “Start the Server”gkg server startThe server will start on http://localhost:27495 by default. You will see output like this:
INFO http_server: HTTP server listening on 127.0.0.1:27495Access the Web Interface
Section titled “Access the Web Interface”Open your web browser and navigate to http://localhost:27495 to access the GitLab Knowledge Graph web interface. From here you can:
- View indexed workspaces and projects
- Browse the knowledge graph visually
- Search for code entities and relationships
- Monitor indexing progress in real-time
For more information on the server, see the gkg server command.
Managing Workspaces and Projects
Section titled “Managing Workspaces and Projects”As your codebase evolves, you may need to remove workspaces or projects from the Knowledge Graph.
Remove a Workspace
Section titled “Remove a Workspace”To remove an entire workspace and all its projects:
gkg remove --workspace /path/to/your/workspaceRemove a Single Project
Section titled “Remove a Single Project”To remove just one project from a workspace:
gkg remove --project /path/to/project --workspace-folder /path/to/workspaceUsing the Web Interface
Section titled “Using the Web Interface”You can also manage workspaces and projects through the web interface:
- Hover over a workspace or project in the sidebar
- Click the actions menu (three dots)
- Select “Delete Workspace” or “Delete Project”
For more details, see the gkg remove command documentation.
IDE integration
Section titled “IDE integration”GitLab Knowledge Graph integrates with your IDE. See IDE Integration for details.