Skip to content
Open
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
5 changes: 5 additions & 0 deletions .codegraph/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# CodeGraph data files — local to each machine, not for committing.
# Ignore everything in .codegraph/ except this file itself, so transient
# files (the database, daemon.pid, sockets, logs) never show up in git.
*
!.gitignore
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -634,3 +634,18 @@ The method takes one argument:

Licensed under the [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0.html)
license (see the LICENSE.txt file).
## Code knowledge graph

This repo carries a local **code knowledge graph** ([colbymchenry/codegraph](https://github.com/colbymchenry/codegraph))
that the ReportPortal AI agents (and your own tooling) use to resolve symbols and
references without scanning raw files.

```bash
npm run codegraph # build it the first time, fast incremental sync after
npm run codegraph -- --force # rebuild from scratch
```

The graph lives in `.codegraph/codegraph.db` — it is **gitignored and local to your
machine** (only `.codegraph/.gitignore` is committed). It is a pure derivative of the
source, so regenerate it any time. The engine is fetched on demand via `npx`, so there
is no added project dependency.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"description": "ReportPortal client for Node.js",
"author": "ReportPortal.io",
"scripts": {
"codegraph": "bash scripts/codegraph.sh",
"build": "npm run clean && tsc",
"clean": "rimraf ./build",
"lint": "eslint ./statistics/**/* ./lib/**/*",
Expand Down
30 changes: 30 additions & 0 deletions scripts/codegraph.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
# Build or update this repo's local code knowledge graph (.codegraph/codegraph.db).
#
# Idempotent — safe to run any time:
# (no args) first run -> init (full index); after that -> sync (fast, incremental)
# --force rebuild the graph from scratch
#
# The DB is gitignored and local to your machine; only .codegraph/.gitignore is
# committed. Engine: https://github.com/colbymchenry/codegraph (run via npx, no
# global or project install required).
set -u
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
ENGINE="@colbymchenry/codegraph@^1.1.0"
export CODEGRAPH_TELEMETRY="${CODEGRAPH_TELEMETRY:-0}"

case "${1:-}" in
--force)
echo "[codegraph] rebuild: $DIR"
npx -y "$ENGINE" index "$DIR"
;;
*)
if [ -f "$DIR/.codegraph/codegraph.db" ]; then
echo "[codegraph] update (sync): $DIR"
npx -y "$ENGINE" sync "$DIR"
else
echo "[codegraph] init: $DIR"
npx -y "$ENGINE" init "$DIR"
fi
;;
esac
Loading