diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml
new file mode 100644
index 00000000..422e8406
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug.yml
@@ -0,0 +1,77 @@
+name: Bug report
+description: Report a reproducible problem in CodeGraph
+title: "[Bug]: "
+body:
+ - type: markdown
+ attributes:
+ value: |
+ Thanks for reporting a problem. For security issues, use private vulnerability reporting instead of this form.
+ - type: input
+ id: version
+ attributes:
+ label: CodeGraph version or commit
+ description: Provide the npm version or full Git commit SHA.
+ placeholder: 0.1.0 or 0123456789abcdef...
+ validations:
+ required: true
+ - type: input
+ id: node
+ attributes:
+ label: Node.js version
+ placeholder: 22.14.0
+ validations:
+ required: true
+ - type: input
+ id: platform
+ attributes:
+ label: Platform
+ description: Include the operating system and CPU architecture.
+ placeholder: macOS 15 arm64
+ validations:
+ required: true
+ - type: dropdown
+ id: install
+ attributes:
+ label: Install method
+ options:
+ - npx or npm package
+ - Source checkout
+ - MCPB desktop extension
+ - Other
+ validations:
+ required: true
+ - type: textarea
+ id: reproduction
+ attributes:
+ label: Reproduction
+ description: Give the smallest complete sequence that reproduces the problem.
+ placeholder: Numbered commands and configuration, with secrets removed.
+ validations:
+ required: true
+ - type: textarea
+ id: expected
+ attributes:
+ label: Expected behavior
+ validations:
+ required: true
+ - type: textarea
+ id: actual
+ attributes:
+ label: Actual behavior
+ validations:
+ required: true
+ - type: textarea
+ id: logs
+ attributes:
+ label: Redacted logs
+ description: Remove tokens, credentials, private source code, personal data, and local usernames.
+ render: shell
+ validations:
+ required: true
+ - type: checkboxes
+ id: safety
+ attributes:
+ label: Sensitive information
+ options:
+ - label: I removed credentials, private source code, personal data, and other sensitive information.
+ required: true
diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml
new file mode 100644
index 00000000..ef4598c1
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/config.yml
@@ -0,0 +1,8 @@
+blank_issues_enabled: false
+contact_links:
+ - name: Security vulnerability
+ url: https://github.com/Phoenixrr2113/codebase-graph/security/advisories/new
+ about: Report vulnerabilities privately. Do not include exploit details in a public issue.
+ - name: Questions and ideas
+ url: https://github.com/Phoenixrr2113/codebase-graph/discussions
+ about: Ask for help or discuss ideas that are not yet actionable issues.
diff --git a/.github/ISSUE_TEMPLATE/feature.yml b/.github/ISSUE_TEMPLATE/feature.yml
new file mode 100644
index 00000000..616d1a09
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/feature.yml
@@ -0,0 +1,32 @@
+name: Feature request
+description: Propose an outcome that would improve CodeGraph
+title: "[Feature]: "
+body:
+ - type: textarea
+ id: problem
+ attributes:
+ label: Problem
+ description: What user or developer problem needs to be solved?
+ validations:
+ required: true
+ - type: textarea
+ id: outcome
+ attributes:
+ label: Proposed outcome
+ description: Describe the observable result, not only an implementation.
+ validations:
+ required: true
+ - type: textarea
+ id: alternatives
+ attributes:
+ label: Alternatives considered
+ description: What workarounds or different approaches have you tried?
+ validations:
+ required: true
+ - type: textarea
+ id: scope
+ attributes:
+ label: Scope
+ description: Which package, interface, or workflow would this affect? Include compatibility or migration concerns.
+ validations:
+ required: true
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 00000000..2a1e26a1
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,23 @@
+version: 2
+updates:
+ - package-ecosystem: npm
+ directory: /
+ schedule:
+ interval: weekly
+ day: monday
+ open-pull-requests-limit: 5
+ labels:
+ - dependencies
+
+ - package-ecosystem: github-actions
+ directory: /
+ schedule:
+ interval: weekly
+ day: monday
+ open-pull-requests-limit: 5
+ labels:
+ - dependencies
+ groups:
+ actions:
+ patterns:
+ - "*"
diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md
new file mode 100644
index 00000000..eec680b5
--- /dev/null
+++ b/.github/pull_request_template.md
@@ -0,0 +1,23 @@
+## What changed
+
+Describe the problem and the smallest complete change that solves it.
+
+## Related issue
+
+Closes #
+
+## Security impact
+
+Describe affected inputs, access paths, dependencies, secrets, and data. Write "None" only after checking them.
+
+## Verification
+
+List the exact commands you ran and their results.
+
+## Checklist
+
+- [ ] Tests cover new behavior and regressions.
+- [ ] `pnpm lint`, `pnpm typecheck`, `pnpm test`, and `pnpm build` pass.
+- [ ] User-facing documentation is updated, or no documentation change is needed.
+- [ ] Release impact is documented, or this change does not affect published artifacts.
+- [ ] No secrets, generated `dist` trees, or local `.codegraph` data are included.
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 26f46865..121a2c69 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -14,26 +14,22 @@ concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
+env:
+ CODEGRAPH_EMBEDDING_PROVIDER: none
+
jobs:
- # Hard gate: must be green for a PR to merge.
- # Builds every package (tsc, so this also typechecks the whole monorepo)
- # and runs @codegraph/core's suite, which is green without any API keys
- # or services.
- build-and-test:
- name: Build & unit tests
+ repository:
+ name: Repository
runs-on: ubuntu-latest
- env:
- # Documented offline/CI mode (see README): skip vector indexes so no
- # embedding API key is required.
- CODEGRAPH_EMBEDDING_PROVIDER: none
steps:
- - uses: actions/checkout@v4
+ - name: Check out repository
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Install pnpm
- uses: pnpm/action-setup@v4 # version comes from package.json "packageManager"
+ uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
- - name: Setup Node
- uses: actions/setup-node@v4
+ - name: Set up Node.js
+ uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 22
cache: pnpm
@@ -41,56 +37,49 @@ jobs:
- name: Install dependencies
run: pnpm install --frozen-lockfile
- - name: Build & typecheck library packages
- # Excludes @codegraph/mcp (release-only esbuild + native-module
- # packaging via packages/npm-package/build.mjs — not a correctness
- # check, and needs a populated tree) and codegraph-landing (the
- # marketing app, already gated by Vercel). Everything else is tsc.
- run: pnpm turbo build --filter='!@codegraph/mcp' --filter='!codegraph-landing'
-
- - name: Unit tests (core)
- run: pnpm turbo test --filter=@codegraph/core
-
- # Non-blocking smoke run against a live FalkorDB. Surfaces graph/plugin-nlp
- # status without gating merges, because the suite still has pre-existing
- # failures that need triage (integration tests that require an embedding
- # provider + LLM/Voyage credentials, a few legacy tests referencing removed
- # APIs, and packages lacking --passWithNoTests). Once those are resolved,
- # drop `continue-on-error` and fold these filters into build-and-test.
- integration-smoke:
- name: Integration smoke (FalkorDB, non-blocking)
+ - name: Audit production dependencies
+ run: pnpm audit:prod
+
+ - name: Lint
+ run: pnpm lint
+
+ - name: Typecheck
+ run: pnpm typecheck
+
+ - name: Test
+ run: pnpm test
+
+ - name: Build
+ run: pnpm build
+
+ - name: Build desktop extension
+ run: pnpm build:mcpb
+
+ integration:
+ name: Integration (FalkorDB)
runs-on: ubuntu-latest
- continue-on-error: true
env:
- CODEGRAPH_EMBEDDING_PROVIDER: none
FALKORDB_HOST: localhost
+ FALKORDB_PORT: 16379
services:
falkordb:
- image: falkordb/falkordb:latest
+ image: falkordb/falkordb@sha256:52b6583afe7b5ba6bbf5b5f0290bdaa765bd97477b310a590771dc33ebc7b5f5
ports:
- - 6379:6379
- options: >-
- --health-cmd "redis-cli ping"
- --health-interval 10s
- --health-timeout 5s
- --health-retries 10
- cgbench-falkordb:
- image: falkordb/falkordb:latest
- ports:
- - 6380:6379
+ - 16379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 10
steps:
- - uses: actions/checkout@v4
+ - name: Check out repository
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Install pnpm
- uses: pnpm/action-setup@v4
+ uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
- - name: Setup Node
- uses: actions/setup-node@v4
+ - name: Set up Node.js
+ uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 22
cache: pnpm
@@ -98,7 +87,75 @@ jobs:
- name: Install dependencies
run: pnpm install --frozen-lockfile
- - name: Graph + NLP tests (informational)
- # turbo builds the needed deps automatically (test depends on build);
- # this never triggers the @codegraph/mcp packaging build.
- run: pnpm turbo test --filter=@codegraph/graph --filter=@codegraph/plugin-nlp
+ - name: Build packages
+ run: pnpm build
+
+ - name: Run service-backed integration tests
+ run: pnpm test:integration
+
+ - name: Test repository scripts
+ run: pnpm test:scripts
+
+ package-build:
+ name: Build package artifact
+ runs-on: ubuntu-latest
+ steps:
+ - name: Check out repository
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+
+ - name: Install pnpm
+ uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
+
+ - name: Set up Node.js
+ uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
+ with:
+ node-version: 22
+ cache: pnpm
+
+ - name: Install dependencies
+ run: pnpm install --frozen-lockfile
+
+ - name: Build npm package
+ run: pnpm build:npm
+
+ - name: Validate npm package
+ run: pnpm validate:npm
+
+ - name: Upload exact package artifact
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
+ with:
+ name: codegraph-mcp-package
+ path: tmp/release
+ if-no-files-found: error
+ retention-days: 3
+
+ package:
+ name: Package (${{ matrix.os }})
+ needs: package-build
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [ubuntu-latest, macos-latest, windows-latest]
+ runs-on: ${{ matrix.os }}
+ steps:
+ - name: Check out repository
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+
+ - name: Set up Node.js
+ uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
+ with:
+ node-version: 22
+ package-manager-cache: false
+
+ - name: Download exact package artifact
+ uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
+ with:
+ name: codegraph-mcp-package
+ path: tmp/release
+
+ - name: Install macOS embedded runtime libraries
+ if: runner.os == 'macOS'
+ run: brew install libomp openssl@3
+
+ - name: Test package in a fresh consumer
+ run: node scripts/release/smoke-package.mjs tmp/release/package-result.json
diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml
new file mode 100644
index 00000000..880deab4
--- /dev/null
+++ b/.github/workflows/codeql.yml
@@ -0,0 +1,35 @@
+name: CodeQL
+
+on:
+ push:
+ branches: [main]
+ pull_request:
+ branches: [main]
+ schedule:
+ - cron: "23 6 * * 1"
+ workflow_dispatch:
+
+permissions:
+ contents: read
+ packages: read
+ security-events: write
+
+concurrency:
+ group: codeql-${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: true
+
+jobs:
+ analyze:
+ name: Analyze
+ runs-on: ubuntu-latest
+ steps:
+ - name: Check out repository
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+
+ - name: Initialize CodeQL
+ uses: github/codeql-action/init@ff2f1c621b7f889edc0d3c761ac2e6a3f8cdb0dd # v4
+ with:
+ languages: javascript-typescript
+
+ - name: Analyze
+ uses: github/codeql-action/analyze@ff2f1c621b7f889edc0d3c761ac2e6a3f8cdb0dd # v4
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 00000000..12a520c4
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,327 @@
+name: Release
+
+on:
+ push:
+ tags:
+ - "v*"
+ workflow_dispatch:
+ inputs:
+ bootstrap_version:
+ description: "Existing npm version to finalize as the one-time bootstrap release"
+ required: true
+ type: string
+ bootstrap_commit:
+ description: "Full reviewed commit SHA used for the manual npm publication"
+ required: true
+ type: string
+
+permissions: {}
+
+concurrency:
+ group: npm-release
+ cancel-in-progress: false
+
+jobs:
+ validate:
+ name: Validate release
+ runs-on: ubuntu-latest
+ permissions:
+ contents: read
+ env:
+ CODEGRAPH_EMBEDDING_PROVIDER: none
+ FALKORDB_HOST: localhost
+ FALKORDB_PORT: 16379
+ services:
+ falkordb:
+ image: falkordb/falkordb@sha256:52b6583afe7b5ba6bbf5b5f0290bdaa765bd97477b310a590771dc33ebc7b5f5
+ ports:
+ - 16379:6379
+ options: >-
+ --health-cmd "redis-cli ping"
+ --health-interval 10s
+ --health-timeout 5s
+ --health-retries 10
+ steps:
+ - name: Check out exact tag
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+ with:
+ fetch-depth: 0
+ ref: ${{ github.event_name == 'workflow_dispatch' && inputs.bootstrap_commit || github.ref }}
+
+ - name: Install pnpm
+ uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
+
+ - name: Set up Node.js
+ uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
+ with:
+ node-version: 22.14.0
+ package-manager-cache: false
+
+ - name: Install dependencies
+ run: pnpm install --frozen-lockfile
+
+ - name: Verify annotated release tag
+ if: github.event_name == 'push'
+ shell: bash
+ run: |
+ set -euo pipefail
+ if [[ "$(git cat-file -t "$GITHUB_REF")" != "tag" ]]; then
+ echo "Release tag must be annotated: $GITHUB_REF" >&2
+ exit 1
+ fi
+ git fetch --no-tags origin main:refs/remotes/origin/main
+ release_commit="$(git rev-list -n 1 "$GITHUB_REF")"
+ if ! git merge-base --is-ancestor "$release_commit" origin/main; then
+ echo "Release tag commit must be reachable from origin/main" >&2
+ exit 1
+ fi
+
+ - name: Verify release request and npm state
+ env:
+ BOOTSTRAP_COMMIT: ${{ inputs.bootstrap_commit }}
+ BOOTSTRAP_VERSION: ${{ inputs.bootstrap_version }}
+ run: node scripts/release/verify-release-tag.mjs
+
+ - name: Verify bootstrap source commit
+ if: github.event_name == 'workflow_dispatch'
+ shell: bash
+ env:
+ REVIEWED_COMMIT: ${{ inputs.bootstrap_commit }}
+ run: |
+ set -euo pipefail
+ if [[ "$(git rev-parse HEAD)" != "$REVIEWED_COMMIT" ]]; then
+ echo "Checked-out commit does not match bootstrap_commit" >&2
+ exit 1
+ fi
+ git fetch --no-tags origin main:refs/remotes/origin/main
+ if ! git merge-base --is-ancestor "$REVIEWED_COMMIT" origin/main; then
+ echo "Bootstrap commit must be reachable from origin/main" >&2
+ exit 1
+ fi
+
+ - name: Verify bootstrap tag is unused
+ if: github.event_name == 'workflow_dispatch'
+ shell: bash
+ env:
+ VERSION: ${{ inputs.bootstrap_version }}
+ run: |
+ set -euo pipefail
+ if git rev-parse --verify "refs/tags/v$VERSION" >/dev/null 2>&1; then
+ echo "Bootstrap tag v$VERSION already exists locally" >&2
+ exit 1
+ fi
+ if [[ -n "$(git ls-remote --tags origin "refs/tags/v$VERSION")" ]]; then
+ echo "Bootstrap tag v$VERSION already exists on origin" >&2
+ exit 1
+ fi
+
+ - name: Audit production dependencies
+ run: pnpm audit:prod
+
+ - name: Lint
+ run: pnpm lint
+
+ - name: Typecheck
+ run: pnpm typecheck
+
+ - name: Test
+ run: pnpm test
+
+ - name: Integration test
+ run: pnpm test:integration
+
+ - name: Build
+ run: pnpm build
+
+ - name: Test repository scripts
+ run: pnpm test:scripts
+
+ - name: Build desktop extension
+ run: pnpm build:mcpb
+
+ - name: Build, validate, and smoke npm artifact
+ run: pnpm release:check
+
+ - name: Upload verified npm artifact
+ uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
+ with:
+ name: codegraph-release-package
+ path: tmp/release
+ if-no-files-found: error
+ retention-days: 3
+
+ publish:
+ name: Publish npm package
+ if: github.event_name == 'push'
+ needs: validate
+ runs-on: ubuntu-latest
+ environment: npm
+ permissions:
+ contents: write
+ id-token: write
+ steps:
+ - name: Check out exact tag
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+ with:
+ fetch-depth: 0
+ persist-credentials: false
+ ref: ${{ github.ref }}
+
+ - name: Set up Node.js
+ uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
+ with:
+ node-version: 22.14.0
+ package-manager-cache: false
+
+ - name: Install trusted-publishing npm version
+ run: npm install --global --ignore-scripts npm@11.5.1
+
+ - name: Download verified npm artifact
+ uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
+ with:
+ name: codegraph-release-package
+ path: tmp/release
+
+ - name: Read release metadata
+ id: metadata
+ shell: bash
+ run: |
+ echo "version=$(node -p "require('./tmp/release/package-result.json').version")" >> "$GITHUB_OUTPUT"
+ echo "filename=$(node -p "const p=require('./tmp/release/package-result.json'); p.filename")" >> "$GITHUB_OUTPUT"
+
+ - name: Publish with trusted publishing
+ env:
+ FILENAME: ${{ steps.metadata.outputs.filename }}
+ run: npm publish "tmp/release/$FILENAME" --access public
+
+ - name: Wait for registry propagation
+ shell: bash
+ env:
+ VERSION: ${{ steps.metadata.outputs.version }}
+ run: |
+ for attempt in 1 2 3 4 5 6; do
+ if [[ "$(npm view "codegraph-mcp@$VERSION" version --json 2>/dev/null)" == "\"$VERSION\"" ]]; then
+ exit 0
+ fi
+ if [[ "$attempt" == "6" ]]; then
+ echo "codegraph-mcp@$VERSION did not become visible after six attempts" >&2
+ exit 1
+ fi
+ sleep 10
+ done
+
+ - name: Verify registry package
+ shell: bash
+ env:
+ VERSION: ${{ steps.metadata.outputs.version }}
+ run: |
+ mkdir -p tmp/registry
+ npm pack "codegraph-mcp@$VERSION" --pack-destination tmp/registry
+ node scripts/release/smoke-package.mjs \
+ --tarball "tmp/registry/codegraph-mcp-$VERSION.tgz" \
+ --version "$VERSION"
+
+ - name: Create package checksum
+ shell: bash
+ env:
+ FILENAME: ${{ steps.metadata.outputs.filename }}
+ run: |
+ cd tmp/registry
+ sha256sum "$FILENAME" > "$FILENAME.sha256"
+
+ - name: Create verified GitHub release
+ shell: bash
+ env:
+ GH_TOKEN: ${{ github.token }}
+ FILENAME: ${{ steps.metadata.outputs.filename }}
+ VERSION: ${{ steps.metadata.outputs.version }}
+ run: |
+ gh release create "v$VERSION" \
+ "tmp/registry/$FILENAME" \
+ "tmp/registry/$FILENAME.sha256" \
+ --verify-tag \
+ --generate-notes \
+ --title "v$VERSION"
+
+ bootstrap-finalize:
+ name: Finalize bootstrap release
+ if: github.event_name == 'workflow_dispatch'
+ needs: validate
+ runs-on: ubuntu-latest
+ permissions:
+ contents: write
+ steps:
+ - name: Check out reviewed bootstrap commit
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+ with:
+ fetch-depth: 0
+ ref: ${{ inputs.bootstrap_commit }}
+
+ - name: Set up Node.js
+ uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
+ with:
+ node-version: 22.14.0
+ package-manager-cache: false
+
+ - name: Download verified npm artifact
+ uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
+ with:
+ name: codegraph-release-package
+ path: tmp/release
+
+ - name: Read release metadata
+ id: metadata
+ shell: bash
+ run: |
+ echo "version=$(node -p "require('./tmp/release/package-result.json').version")" >> "$GITHUB_OUTPUT"
+ echo "filename=$(node -p "const p=require('./tmp/release/package-result.json'); p.filename")" >> "$GITHUB_OUTPUT"
+
+ - name: Download and verify registry package
+ shell: bash
+ env:
+ FILENAME: ${{ steps.metadata.outputs.filename }}
+ VERSION: ${{ steps.metadata.outputs.version }}
+ run: |
+ mkdir -p tmp/registry
+ npm pack "codegraph-mcp@$VERSION" --pack-destination tmp/registry
+ if ! cmp -s "tmp/release/$FILENAME" "tmp/registry/$FILENAME"; then
+ echo "Registry tarball does not match the artifact built from bootstrap_commit" >&2
+ sha256sum "tmp/release/$FILENAME" "tmp/registry/$FILENAME" >&2
+ exit 1
+ fi
+ node scripts/release/smoke-package.mjs \
+ --tarball "tmp/registry/codegraph-mcp-$VERSION.tgz" \
+ --version "$VERSION"
+
+ - name: Create package checksum
+ shell: bash
+ env:
+ FILENAME: ${{ steps.metadata.outputs.filename }}
+ run: |
+ cd tmp/registry
+ sha256sum "$FILENAME" > "$FILENAME.sha256"
+
+ - name: Create annotated bootstrap tag
+ shell: bash
+ env:
+ VERSION: ${{ steps.metadata.outputs.version }}
+ run: |
+ set -euo pipefail
+ git config user.name "github-actions[bot]"
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
+ git tag -a "v$VERSION" -m "Release v$VERSION"
+ git push origin "v$VERSION"
+
+ - name: Create verified GitHub release
+ shell: bash
+ env:
+ GH_TOKEN: ${{ github.token }}
+ FILENAME: ${{ steps.metadata.outputs.filename }}
+ VERSION: ${{ steps.metadata.outputs.version }}
+ run: |
+ gh release create "v$VERSION" \
+ "tmp/registry/$FILENAME" \
+ "tmp/registry/$FILENAME.sha256" \
+ --verify-tag \
+ --generate-notes \
+ --title "v$VERSION"
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
new file mode 100644
index 00000000..b72fd9f8
--- /dev/null
+++ b/CODE_OF_CONDUCT.md
@@ -0,0 +1,77 @@
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
+
+We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
+
+## Our Standards
+
+Examples of behavior that contributes to a positive environment for our community include:
+
+- Demonstrating empathy and kindness toward other people
+- Being respectful of differing opinions, viewpoints, and experiences
+- Giving and gracefully accepting constructive feedback
+- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
+- Focusing on what is best not just for us as individuals, but for the overall community
+
+Examples of unacceptable behavior include:
+
+- The use of sexualized language or imagery, and sexual attention or advances of any kind
+- Trolling, insulting or derogatory comments, and personal or political attacks
+- Public or private harassment
+- Publishing others' private information, such as a physical or email address, without their explicit permission
+- Other conduct which could reasonably be considered inappropriate in a professional setting
+
+## Enforcement Responsibilities
+
+Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
+
+Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
+
+## Scope
+
+This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official email address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be reported through the contact options on the [maintainer's GitHub profile](https://github.com/Phoenixrr2113). Security-sensitive reports must use the repository's [private vulnerability reporting form](https://github.com/Phoenixrr2113/codebase-graph/security/advisories/new). All complaints will be reviewed and investigated promptly and fairly.
+
+All community leaders are obligated to respect the privacy and security of the reporter of any incident.
+
+## Enforcement Guidelines
+
+Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
+
+### 1. Correction
+
+**Community Impact:** Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
+
+**Consequence:** A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
+
+### 2. Warning
+
+**Community Impact:** A violation through a single incident or series of actions.
+
+**Consequence:** A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period. This includes avoiding interactions in community spaces and external channels such as social media. Violating these terms may lead to a temporary or permanent ban.
+
+### 3. Temporary Ban
+
+**Community Impact:** A serious violation of community standards, including sustained inappropriate behavior.
+
+**Consequence:** A temporary ban from any sort of interaction or public communication with the community for a specified period. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
+
+### 4. Permanent Ban
+
+**Community Impact:** Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
+
+**Consequence:** A permanent ban from any sort of public interaction within the community.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1, available at [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html](https://www.contributor-covenant.org/version/2/1/code_of_conduct.html).
+
+Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
+
+For answers to common questions, see the [Contributor Covenant FAQ](https://www.contributor-covenant.org/faq). [Translations](https://www.contributor-covenant.org/translations) are also available.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 00000000..4d55e87e
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,57 @@
+# Contributing to CodeGraph
+
+Thanks for helping improve CodeGraph. Bug reports, focused feature proposals, documentation fixes, and tested pull requests are welcome.
+
+## Development setup
+
+CodeGraph requires Node.js 22 and the pnpm version declared in the root `package.json` `packageManager` field. Corepack can install that exact pnpm release.
+Docker supplies the external FalkorDB integration service. FalkorDBLite's supported platform binaries are installed with the workspace dependencies. Apple silicon also requires Homebrew `libomp` and `openssl@3` for the embedded integration suite.
+
+```bash
+corepack enable
+git clone https://github.com/Phoenixrr2113/codebase-graph.git
+cd codebase-graph
+pnpm install --frozen-lockfile
+```
+
+Fork the repository, create a short-lived branch from `main`, and keep each pull request focused on one outcome. Add or update tests before changing behavior.
+
+## Required checks
+
+Run these commands before opening a pull request:
+
+```bash
+pnpm audit:prod
+pnpm lint
+pnpm typecheck
+pnpm test
+pnpm build
+pnpm docker:db
+pnpm test:integration
+pnpm test:scripts
+```
+
+If a change affects the npm package, MCP server entry point, dependency graph, or release scripts, also run:
+
+```bash
+pnpm release:check
+```
+
+If a change affects the desktop extension, also run:
+
+```bash
+pnpm build:mcpb
+```
+
+Include the commands and results in the pull request. CI repeats the repository checks and tests the exact npm tarball on Linux, macOS, and Windows.
+
+## Pull requests
+
+- Link the issue or explain the problem the change solves.
+- Keep public functions typed and validate data at system boundaries.
+- Add tests for new behavior and regressions.
+- Update user-facing documentation when commands, configuration, or behavior changes.
+- Call out security, compatibility, migration, and release effects.
+- Never commit generated `dist` directories, secrets, `.env` files, local `.codegraph` data, or benchmark output containing local paths.
+
+By participating, you agree to follow the [Code of Conduct](CODE_OF_CONDUCT.md). Report security issues through the [private vulnerability reporting form](https://github.com/Phoenixrr2113/codebase-graph/security/advisories/new), not a public issue.
diff --git a/README.md b/README.md
index c57efb25..e4bd7fb9 100644
--- a/README.md
+++ b/README.md
@@ -1,146 +1,174 @@
# CodeGraph
-A code knowledge graph and search system for AI agents. Indexes your codebase into a graph database, embeds symbols and documentation, and exposes search through a Model Context Protocol (MCP) server.
+[](https://github.com/Phoenixrr2113/codebase-graph/actions/workflows/ci.yml)
+[](https://github.com/Phoenixrr2113/codebase-graph/actions/workflows/codeql.yml)
+[](https://github.com/Phoenixrr2113/codebase-graph/stargazers)
+[](LICENSE)
+
+CodeGraph turns source code and project knowledge into a searchable graph for AI agents. It parses code with tree-sitter, stores structural and temporal relationships in FalkorDB, and exposes four focused tools through the Model Context Protocol (MCP).
+
+## Access the project
+
+- [Live application](https://v0-landing-page-build-kappa-virid.vercel.app)
+- [Source code](https://github.com/Phoenixrr2113/codebase-graph)
+- [Issues](https://github.com/Phoenixrr2113/codebase-graph/issues)
+- [Discussions](https://github.com/Phoenixrr2113/codebase-graph/discussions)
+- [Contribution guide](CONTRIBUTING.md)
+- [Security policy](SECURITY.md)
+- [MIT license](LICENSE)
+
+The public npm package is named `codegraph-mcp`. Its npm link, version badge, and weekly-download badge will be added after the one-time `0.1.0` bootstrap publish is verified against the registry.
## What it does
-- **Search code by meaning** — vector embeddings + cross-encoder reranking find the function, class, or interface you describe, even when you don't know the name. Internal benchmark: MRR 0.969, Success@1 94%, Success@5 100%, ~447ms latency on a project of ~2.3K nodes.
-- **Understand structure** — tree-sitter parsers extract Functions, Classes, Interfaces, Variables, and Types across 5 first-class languages (TypeScript, Python, Go, Rust, Markdown), with tree-sitter coverage for additional languages via the generic plugin.
-- **Track decisions over time** — bitemporal knowledge graph stores facts with `valid_at` / `invalid_at` timestamps, supporting point-in-time queries ("what was true on March 1st?").
-- **Plug into AI agents** — exposes 4 MCP tool groups (`search`, `knowledge`, `codebase`, `query`) for use in Claude Desktop, Cursor, Claude Code, or any MCP client.
+- Searches code by symbol, structure, and meaning.
+- Extracts functions, classes, interfaces, variables, types, imports, calls, and other relationships.
+- Stores project facts with `valid_at` and `invalid_at` timestamps for point-in-time queries.
+- Supports first-class TypeScript, JavaScript, Python, Go, Rust, and Markdown parsing, with generic tree-sitter support for additional languages.
+- Runs with embedded FalkorDBLite on Linux x64 and Apple silicon macOS, or an external FalkorDB service on any supported Node.js platform. Apple silicon requires Homebrew `libomp` and `openssl@3` runtime libraries.
+- Exposes `search`, `knowledge`, `codebase`, and `query` MCP tools.
+
+## Install from source
-## Quickstart
+Requirements: Node.js 22, Corepack, and Docker for the external FalkorDB quickstart.
```bash
git clone https://github.com/Phoenixrr2113/codebase-graph.git
cd codebase-graph
-pnpm install
+corepack enable
+pnpm install --frozen-lockfile
pnpm build
-
-# Option A — embedded database (no Docker required)
-brew install redis # macOS — FalkorDBLite needs redis-server
-echo "CODEGRAPH_DRIVER=falkordblite" > .env
-echo "CODEGRAPH_DB_PATH=.codegraph/falkordb" >> .env
-
-# Option B — FalkorDB via Docker
-# pnpm docker:db
-# echo "CODEGRAPH_DRIVER=falkordb" > .env
-
-# Index a project
-pnpm --filter @codegraph/cli start configure --projects /path/to/your/project
-pnpm --filter @codegraph/cli start reindex
-
-# Run the MCP server (stdio transport)
-pnpm --filter @codegraph/mcp-server start
+pnpm docker:db
```
+Use `CODEGRAPH_EMBEDDING_PROVIDER=none` for structural search without an API key. Configure a supported embedding provider later if you want semantic vector search.
+
## Use with an MCP client
-### Claude Desktop
+### Source checkout
-Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
+After building the repository, point the client at the generated server entry point. Replace both absolute paths with paths on your machine.
```json
{
"mcpServers": {
"codegraph": {
"command": "node",
- "args": ["/absolute/path/to/codebase-graph/packages/mcp-server/dist/index.js"],
+ "args": [
+ "/absolute/path/to/codebase-graph/packages/mcp-server/dist/index.js"
+ ],
"env": {
- "VOYAGE_API_KEY": "your-key",
- "JINA_API_KEY": "your-key"
+ "CODEGRAPH_EMBEDDING_PROVIDER": "none",
+ "CODEGRAPH_DRIVER": "falkordb",
+ "FALKORDB_HOST": "localhost",
+ "FALKORDB_PORT": "6379"
}
}
}
}
```
-### Claude Code
+For Claude Code:
```bash
-claude mcp add codegraph node /absolute/path/to/codebase-graph/packages/mcp-server/dist/index.js
+claude mcp add codegraph \
+ --env CODEGRAPH_EMBEDDING_PROVIDER=none \
+ --env CODEGRAPH_DRIVER=falkordb \
+ --env FALKORDB_HOST=localhost \
+ --env FALKORDB_PORT=6379 \
+ -- node /absolute/path/to/codebase-graph/packages/mcp-server/dist/index.js
```
-## MCP tools
-
-Four persona-based tool groups by default. Set `CODEGRAPH_RAW_TOOLS=1` to expose the underlying handlers individually.
+### npm package after bootstrap
-| Tool | What it does |
-|------|--------------|
-| **search** | Find code/symbols by name or meaning; get context for a file or symbol |
-| **knowledge** | Store and recall entities, relationships, and facts (with bitemporal queries) |
-| **codebase** | Configure projects, reindex, check status/stats, read source code |
-| **query** | Execute read-only Cypher against the graph (power users) |
+After `codegraph-mcp@0.1.0` is visible on npm, clients can run the server without a source checkout:
-See [CLAUDE.md](./CLAUDE.md) for the complete tool reference (parameters, examples, workflows).
+```json
+{
+ "mcpServers": {
+ "codegraph": {
+ "command": "npx",
+ "args": ["-y", "codegraph-mcp"],
+ "env": {
+ "CODEGRAPH_EMBEDDING_PROVIDER": "none"
+ }
+ }
+ }
+}
+```
-## Architecture
+The first conversation can configure and index a project through the `codebase` tool:
-- **Graph storage:** FalkorDB (Docker) or FalkorDBLite (embedded), with HNSW vector indexes per node type.
-- **Embeddings:** pluggable — Voyage AI (`voyage-code-3`, 1024-dim), OpenRouter, or local nomic-embed via `@huggingface/transformers` (768-dim, runs on CPU).
-- **Reranker:** cross-encoder via Jina (`jina-reranker-v2-base-multilingual`) or Voyage.
-- **Indexer:** tree-sitter for AST parsing, SHA-256 file-hash incremental change detection.
-- **MCP server:** 4 persona tools by default; raw mode exposes the underlying handlers.
+```json
+{ "action": "configure", "projectAction": "set", "projects": ["/absolute/path/to/project"] }
+```
-## Configuration
+```json
+{ "action": "reindex", "mode": "full" }
+```
-Environment variables (set in `.env` at the repo root):
+Embedded storage is selected automatically on Linux x64. On Apple silicon macOS, install its native runtime libraries first with `brew install libomp openssl@3`; CodeGraph otherwise falls back to external FalkorDB. Windows, Intel macOS, and Linux arm64 require an external FalkorDB service. Set `CODEGRAPH_DRIVER=falkordb`, `FALKORDB_HOST`, and `FALKORDB_PORT` in the MCP client environment on those platforms.
-```bash
-# Embedding provider (auto-detected from API keys)
-CODEGRAPH_EMBEDDING_PROVIDER=voyage # voyage | local | openrouter
-VOYAGE_API_KEY=...
+## MCP tools
-# Reranker provider (auto-detected from API keys)
-CODEGRAPH_RERANK_PROVIDER=jina # jina | voyage
-JINA_API_KEY=...
+| Tool | Purpose |
+| --- | --- |
+| `search` | Find code and project knowledge by name, structure, or meaning |
+| `knowledge` | Store and recall entities, relationships, facts, and documents |
+| `codebase` | Configure projects, index code, inspect status, and read source |
+| `query` | Run read-only Cypher queries against the graph |
-# LLM (for knowledge extraction + chain-of-thought search)
-LLM_PROVIDER=cerebras
-CEREBRAS_API_KEY=...
+Set `CODEGRAPH_RAW_TOOLS=1` to expose the lower-level handlers instead of the four grouped tools.
-# Graph driver
-CODEGRAPH_DRIVER=falkordblite # falkordblite | falkordb
-CODEGRAPH_DB_PATH=.codegraph/falkordb # for falkordblite
-```
+## Configuration
-## Packages
+| Variable | Purpose |
+| --- | --- |
+| `CODEGRAPH_DRIVER` | `falkordblite` for embedded storage or `falkordb` for an external service |
+| `CODEGRAPH_DB_PATH` | Embedded FalkorDBLite data path |
+| `FALKORDB_HOST` | External FalkorDB host, default `localhost` |
+| `FALKORDB_PORT` | External FalkorDB port, default `6379` |
+| `FALKORDB_GRAPH` | Graph name, default `codegraph` |
+| `CODEGRAPH_EMBEDDING_PROVIDER` | `none`, `local`, `voyage`, or `openrouter` |
+| `VOYAGE_API_KEY` | Voyage embeddings and optional reranking |
+| `OPENROUTER_API_KEY` | OpenRouter embeddings or LLM features |
+| `CEREBRAS_API_KEY` | Optional LLM-backed knowledge extraction |
-| Package | Description |
-|---------|-------------|
-| [`@codegraph/core`](packages/core/) | Indexer, search pipelines, service layer, git sync |
-| [`@codegraph/graph`](packages/graph/) | Graph DB driver abstraction, knowledge operations, Cypher templates |
-| [`@codegraph/plugin-nlp`](packages/plugin-nlp/) | Embeddings, reranker, entity resolution, conversation/document ingestion |
-| [`@codegraph/mcp-server`](packages/mcp-server/) | MCP server with 4 persona tools |
-| [`@codegraph/api`](packages/api/) | Express REST API for the dashboard |
-| [`@codegraph/cli`](packages/cli/) | CLI wrapper around the core service |
-| [`@codegraph/plugin-typescript`](packages/plugin-typescript/) | TS/JS/JSX tree-sitter plugin |
-| [`@codegraph/plugin-python`](packages/plugin-python/) | Python tree-sitter plugin |
-| [`@codegraph/plugin-go`](packages/plugin-go/) | Go tree-sitter plugin |
-| [`@codegraph/plugin-rust`](packages/plugin-rust/) | Rust tree-sitter plugin |
-| [`@codegraph/plugin-markdown`](packages/plugin-markdown/) | Markdown parser |
-| [`@codegraph/plugin-generic`](packages/plugin-generic/) | Tree-sitter fallback for additional languages |
-| [`@codegraph/plugin-common`](packages/plugin-common/) | Shared extraction utilities (complexity, AST helpers) |
-| [`@codegraph/plugin-languages`](packages/plugin-languages/) | Plugin registry coordination |
-| [`@codegraph/logger`](packages/logger/) | Structured logging + tracing decorator |
-| [`@codegraph/types`](packages/types/) | Shared TypeScript type definitions |
-
-Plus `apps/web` (Next.js dashboard with Graph Explorer + Operations tabs at `localhost:3000`).
+Never commit provider keys. Put secrets in the MCP client's protected environment configuration or a local ignored `.env` file.
## Development
```bash
-pnpm install # Install dependencies
-pnpm build # Build all packages
-pnpm dev # Start dev mode
-pnpm test # Run all tests
-pnpm docker:db # Start FalkorDB via Docker
+pnpm install --frozen-lockfile
+pnpm audit:prod
+pnpm lint
+pnpm typecheck
+pnpm test
+pnpm build
+pnpm docker:db
+pnpm test:integration
+pnpm test:scripts
+pnpm build:mcpb
+pnpm release:check
```
-## Status
+See [CONTRIBUTING.md](CONTRIBUTING.md) for the pull request workflow and required evidence.
+FalkorDBLite's Linux x64 and Apple silicon macOS binaries are installed with the workspace dependencies. Apple silicon also requires Homebrew `libomp` and `openssl@3`.
+
+## Packages
+
+| Package | Responsibility |
+| --- | --- |
+| [`@codegraph/core`](packages/core/) | Indexing, search pipelines, services, and git synchronization |
+| [`@codegraph/graph`](packages/graph/) | FalkorDB and FalkorDBLite drivers, graph queries, and knowledge operations |
+| [`@codegraph/plugin-nlp`](packages/plugin-nlp/) | Embeddings, reranking, entity resolution, and document ingestion |
+| [`@codegraph/mcp-server`](packages/mcp-server/) | MCP transport and the four public tool groups |
+| [`@codegraph/cli`](packages/cli/) | Source-checkout command-line tools |
+| [`codegraph-mcp`](packages/npm-package/) | Public npm distribution staging and entry point |
+| [`@codegraph/mcpb`](packages/mcpb/) | Platform-local MCPB desktop extension build |
-Active development. Public on 2026-04-25. No releases yet — install from source.
+The Next.js application lives in [`apps/web`](apps/web/), and the reproducible search benchmark lives in [`benchmarks/cgbench-v1`](benchmarks/cgbench-v1/).
## License
-MIT — see [LICENSE](./LICENSE).
+CodeGraph is available under the [MIT License](LICENSE).
diff --git a/SECURITY.md b/SECURITY.md
new file mode 100644
index 00000000..45e91574
--- /dev/null
+++ b/SECURITY.md
@@ -0,0 +1,18 @@
+# Security Policy
+
+## Supported versions
+
+Security fixes are provided for the current minor release line.
+
+| Version | Supported |
+| --- | --- |
+| 0.1.x | Yes |
+| Earlier versions | No |
+
+## Report a vulnerability
+
+Use GitHub's [private vulnerability reporting form](https://github.com/Phoenixrr2113/codebase-graph/security/advisories/new). Do not open a public issue containing exploit details, credentials, private source code, or other sensitive data.
+
+Include affected versions, impact, reproduction steps, and any suggested mitigation. Remove real credentials and personal data from logs or examples.
+
+The maintainer will aim to acknowledge a report within 72 hours, provide status updates while it is investigated, and coordinate disclosure after a fix is available. Response and remediation timing depend on severity and reproducibility.
diff --git a/apps/web/app/globals.css b/apps/web/app/globals.css
index c23c5a6a..7c732358 100644
--- a/apps/web/app/globals.css
+++ b/apps/web/app/globals.css
@@ -3,24 +3,6 @@
@custom-variant dark (&:is(.dark *));
-@font-face {
- font-family: 'Geist';
- src: url('/fonts/GeistVF.woff2') format('woff2');
- font-display: swap;
-}
-
-@font-face {
- font-family: 'Geist Mono';
- src: url('/fonts/GeistMonoVF.woff2') format('woff2');
- font-display: swap;
-}
-
-@font-face {
- font-family: 'JetBrains Mono';
- src: url('/fonts/JetBrainsMonoVF.woff2') format('woff2');
- font-display: swap;
-}
-
/* Dark-first developer tool theme - inspired by Linear, Vercel, Raycast */
:root {
/* Light mode fallback */
@@ -84,8 +66,8 @@
}
@theme inline {
- --font-sans: 'Geist', 'Geist Fallback', system-ui, sans-serif;
- --font-mono: 'JetBrains Mono', 'Geist Mono', 'Geist Mono Fallback', ui-monospace, monospace;
+ --font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
+ --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace;
--color-background: var(--background);
--color-foreground: var(--foreground);
--color-card: var(--card);
@@ -160,7 +142,7 @@
display: inline;
}
-/* Wider panes (integrations tabs) keep strict pre wrapping — the box is
+/* Wider panes (integrations tabs) keep strict pre wrapping: the box is
wide enough that horizontal scroll is never triggered. */
.code-snippet--wide pre.shiki {
white-space: pre;
diff --git a/apps/web/components/dashboard/embedding-badge.tsx b/apps/web/components/dashboard/embedding-badge.tsx
index 4bc13078..233efd8c 100644
--- a/apps/web/components/dashboard/embedding-badge.tsx
+++ b/apps/web/components/dashboard/embedding-badge.tsx
@@ -37,9 +37,12 @@ export function EmbeddingBadge() {
}, [])
useEffect(() => {
- fetchStats()
+ const initialFetch = window.setTimeout(fetchStats, 0)
const interval = setInterval(fetchStats, 30_000)
- return () => clearInterval(interval)
+ return () => {
+ clearTimeout(initialFetch)
+ clearInterval(interval)
+ }
}, [fetchStats])
const handleGenerate = useCallback(async () => {
diff --git a/apps/web/components/dashboard/entity-detail.tsx b/apps/web/components/dashboard/entity-detail.tsx
index 6b7fd551..eb69b718 100644
--- a/apps/web/components/dashboard/entity-detail.tsx
+++ b/apps/web/components/dashboard/entity-detail.tsx
@@ -56,9 +56,10 @@ export function EntityDetail({ node }: EntityDetailProps) {
const isExported = props.isExported === true
const isAsync = props.isAsync === true
const isArrow = props.isArrow === true
+ const isAbstract = props.isAbstract === true
+ const extendsName = typeof props.extends === 'string' ? props.extends : undefined
const docstring = props.docstring as string | undefined
const bodySnippet = props.bodySnippet as string | undefined
- const signature = props.signature as string | undefined
const params = props.params
const returnType = props.returnType as string | undefined
@@ -122,9 +123,9 @@ export function EntityDetail({ node }: EntityDetailProps) {
{node.type === 'Class' && (
}>
- {props.isAbstract && abstract }
+ {isAbstract && abstract }
class {node.label}
- {props.extends && extends {String(props.extends)}}
+ {extendsName && extends {extendsName}}
)}
@@ -151,6 +152,7 @@ export function EntityDetail({ node }: EntityDetailProps) {
{filePath && startLine != null && (
{
- setLoading(true)
- setLines(null)
- setHighlightedHtml(null)
-
const el = endLine ?? startLine
fetch(`${apiUrl}/api/source?path=${encodeURIComponent(filePath)}&startLine=${startLine}&endLine=${el}&context=5`)
.then(r => r.ok ? r.json() : null)
diff --git a/apps/web/components/dashboard/graph-canvas.tsx b/apps/web/components/dashboard/graph-canvas.tsx
index 08e22a5f..91b3d806 100644
--- a/apps/web/components/dashboard/graph-canvas.tsx
+++ b/apps/web/components/dashboard/graph-canvas.tsx
@@ -82,8 +82,8 @@ export function GraphCanvas({ apiUrl, onNodeSelect, highlightedNames, hiddenEdge
const instance = cy({
container: containerRef.current,
elements: [...nodes, ...edges],
- style: cytoscapeStylesheet as cytoscape.Stylesheet[],
- layout: LAYOUT_OPTIONS.cose as cytoscape.LayoutOptions,
+ style: cytoscapeStylesheet,
+ layout: LAYOUT_OPTIONS.cose,
minZoom: 0.1,
maxZoom: 5,
})
@@ -224,7 +224,7 @@ export function GraphCanvas({ apiUrl, onNodeSelect, highlightedNames, hiddenEdge
const handleRelayout = useCallback((newLayout?: LayoutName) => {
const l = newLayout ?? layout
if (newLayout) setLayout(l)
- cyRef.current?.layout(LAYOUT_OPTIONS[l] as cytoscape.LayoutOptions).run()
+ cyRef.current?.layout(LAYOUT_OPTIONS[l]).run()
}, [layout])
return (
diff --git a/apps/web/components/dashboard/query-panel.tsx b/apps/web/components/dashboard/query-panel.tsx
index 10a35d17..88c01777 100644
--- a/apps/web/components/dashboard/query-panel.tsx
+++ b/apps/web/components/dashboard/query-panel.tsx
@@ -19,6 +19,20 @@ interface ResultItem {
[key: string]: unknown
}
+function asString(value: unknown): string | undefined {
+ return typeof value === 'string' ? value : undefined
+}
+
+function asFiniteNumber(value: unknown): number | undefined {
+ return typeof value === 'number' && Number.isFinite(value) ? value : undefined
+}
+
+function asStringArray(value: unknown): string[] {
+ return Array.isArray(value) && value.every((item): item is string => typeof item === 'string')
+ ? value
+ : []
+}
+
export function QueryPanel({ apiUrl }: QueryPanelProps) {
const [query, setQuery] = useState('')
const [mode, setMode] = useState('cypher')
@@ -125,6 +139,10 @@ export function QueryPanel({ apiUrl }: QueryPanelProps) {
search: 'createUser authentication handler',
natural: 'What functions call createOrder? Why does payment retry 3 times?',
}
+ const routedTo = asString(meta?.routedTo)
+ const iterations = asFiniteNumber(meta?.iterations)
+ const queries = asStringArray(meta?.queries)
+ const total = asFiniteNumber(meta?.total)
return (
@@ -192,16 +210,16 @@ export function QueryPanel({ apiUrl }: QueryPanelProps) {
{results !== null ? (
{/* Meta info (routing, iterations) */}
- {meta?.routedTo && (
+ {routedTo && (
- {meta.routedTo as string}
- {meta.iterations && {meta.iterations as number} iterations}
+ {routedTo}
+ {iterations !== undefined && {iterations} iterations}
{durationMs != null && {durationMs}ms}
)}
- {meta?.queries && (meta.queries as string[]).length > 1 && (
+ {queries.length > 1 && (
- Queries: {(meta.queries as string[]).map((q, i) => (
+ Queries: {queries.map((q, i) => (
{i > 0 && ' → '}{q}
))}
@@ -210,8 +228,8 @@ export function QueryPanel({ apiUrl }: QueryPanelProps) {
{/* Result count + copy */}
- {results.length} result{results.length !== 1 ? 's' : ''}
- {durationMs != null && !meta?.routedTo && {durationMs}ms}
+ {total ?? results.length} result{(total ?? results.length) !== 1 ? 's' : ''}
+ {durationMs != null && !routedTo && {durationMs}ms}